Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,14 @@

public final class AssetReportGetRequest extends BaseClientRequest {
private String assetReportToken;
private boolean includeInsights = false;

public AssetReportGetRequest(String assetReportToken) {
this.assetReportToken = assetReportToken;
}

public AssetReportGetRequest withIncludeInsights(boolean includeInsights) {
this.includeInsights = includeInsights;
return this;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@
import java.util.List;
import java.util.Objects;

import com.plaid.client.response.TransactionsGetResponse.Transaction.Location;
import com.plaid.client.response.TransactionsGetResponse.Transaction.PaymentMeta;

/**
* See https://plaid.com/docs/api/#assets for more detail into the returned schema
* See https://plaid.com/docs/#assets for more detail into the returned schema.
**/
public class AssetReportGetResponse extends BaseResponse {
private AssetReport report;
Expand Down Expand Up @@ -535,6 +538,19 @@ public static final class Transaction {
private String unofficialCurrencyCode;
private String isoCurrencyCode;

// The following fields are only included in an Asset Report with Insights.
// For more information, see
// https://plaid.com/docs/#retrieve-json-report-request.
private String accountOwner;
private List<String> category;
private String categoryId;
private String dateTransacted;
private Location location;
private String name;
private PaymentMeta paymentMeta;
private String pendingTransactionId;
private String transactionType;

public String getAccountId() {
return accountId;
}
Expand Down Expand Up @@ -567,6 +583,42 @@ public String getIsoCurrencyCode() {
return isoCurrencyCode;
}

public String getAccountOwner() {
return accountOwner;
}

public List<String> getCategory() {
return category;
}

public String getCategoryId() {
return categoryId;
}

public String getDateTransacted() {
return dateTransacted;
}

public Location getLocation() {
return location;
}

public String getName() {
return name;
}

public PaymentMeta getPaymentMeta() {
return paymentMeta;
}

public String getPendingTransactionId() {
return pendingTransactionId;
}

public String getTransactionType() {
return transactionType;
}

@Override
public boolean equals(Object obj) {
if (this == obj) {
Expand All @@ -583,13 +635,23 @@ public boolean equals(Object obj) {
Objects.equals(pending, that.pending) &&
Objects.equals(amount, that.amount) &&
Objects.equals(unofficialCurrencyCode, that.unofficialCurrencyCode) &&
Objects.equals(isoCurrencyCode, that.isoCurrencyCode);
Objects.equals(isoCurrencyCode, that.isoCurrencyCode) &&
Objects.equals(accountOwner, that.accountOwner) &&
Objects.equals(category, that.category) &&
Objects.equals(categoryId, that.categoryId) &&
Objects.equals(dateTransacted, that.dateTransacted) &&
Objects.equals(location, that.location) &&
Objects.equals(name, that.name) &&
Objects.equals(paymentMeta, that.paymentMeta) &&
Objects.equals(pendingTransactionId, that.pendingTransactionId) &&
Objects.equals(transactionType, that.transactionType);
}

@Override
public int hashCode() {
return Objects.hash(accountId, transactionId, date, originalDescription, pending, amount,
unofficialCurrencyCode, isoCurrencyCode);
unofficialCurrencyCode, isoCurrencyCode, accountOwner, category, categoryId,
dateTransacted, location, name, paymentMeta, pendingTransactionId, transactionType);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,21 @@ public void testAssetReportGetSuccess() throws Exception {
assertFalse(respBody.getReport().getItems().isEmpty());

assertNotNull(respBody.getReport().getAssetReportId());

// Retrieve the report as an Asset Report with Insights.
AssetReportGetRequest assetReportGet =
new AssetReportGetRequest(assetReportToken)
.withIncludeInsights(true);
response = client().service().assetReportGet(assetReportGet).execute();

respBody = response.body();
assertSuccessResponse(response);

assertNotNull(respBody.getReport());

// An Asset Report with Insights should include a name (when available).
assertNotNull(respBody.getReport().getItems().get(0).getAccounts().get(0).getTransactions()
.get(0).getName());
}

/**
Expand All @@ -58,7 +73,8 @@ public static Response<AssetReportGetResponse> waitTillReady(
int attempt = 0;
Response<AssetReportGetResponse> response;
do {
AssetReportGetRequest assetReportGet = new AssetReportGetRequest(assetReportToken);
AssetReportGetRequest assetReportGet =
new AssetReportGetRequest(assetReportToken);
response = client.service().assetReportGet(assetReportGet).execute();
attempt++;
Thread.sleep(INTER_REQUEST_SLEEP);
Expand Down