From 501079aba2ff5e4c4e2cf4ff8bc803338bcf55ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Montone?= <83733486+NicolasMontone@users.noreply.github.com> Date: Thu, 19 Sep 2024 13:25:41 -0300 Subject: [PATCH] feat(ItemResponse): add statusDetail. (#51) * fix(ItemResponse): add statusDetail. * Versions --- README.md | 2 +- pom.xml | 2 +- .../client/response/ItemProductState.java | 17 ++++++++ .../response/ItemProductStepWarning.java | 15 +++++++ .../pluggy/client/response/ItemResponse.java | 1 + .../client/response/ItemStatusDetail.java | 42 +++++++++++++++++++ 6 files changed, 77 insertions(+), 2 deletions(-) create mode 100644 src/main/java/ai/pluggy/client/response/ItemProductState.java create mode 100644 src/main/java/ai/pluggy/client/response/ItemProductStepWarning.java create mode 100644 src/main/java/ai/pluggy/client/response/ItemStatusDetail.java diff --git a/README.md b/README.md index 568e8de..bcdee4b 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ Currently, the package is available in Github Packages, so make sure to have the ai.pluggy pluggy-java - 1.2.0 + 1.3.0 ``` diff --git a/pom.xml b/pom.xml index 14640a0..692e8e7 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ ai.pluggy pluggy-java - 1.2.0 + 1.3.0 jar diff --git a/src/main/java/ai/pluggy/client/response/ItemProductState.java b/src/main/java/ai/pluggy/client/response/ItemProductState.java new file mode 100644 index 0000000..cde3205 --- /dev/null +++ b/src/main/java/ai/pluggy/client/response/ItemProductState.java @@ -0,0 +1,17 @@ +package ai.pluggy.client.response; + +import java.util.Date; +import java.util.List; +import lombok.Builder; +import lombok.Data; + +@Data +@Builder +public class ItemProductState { + /** Whether product was collected in this last execution or not */ + boolean isUpdated; + /** Date when product was last collected for this Item, null if it has never been. */ + Date lastUpdatedAt; + /** If product was not collected, this field will provide more detailed info about the reason. */ + List warnings; +} diff --git a/src/main/java/ai/pluggy/client/response/ItemProductStepWarning.java b/src/main/java/ai/pluggy/client/response/ItemProductStepWarning.java new file mode 100644 index 0000000..6f0a35c --- /dev/null +++ b/src/main/java/ai/pluggy/client/response/ItemProductStepWarning.java @@ -0,0 +1,15 @@ +package ai.pluggy.client.response; + +import lombok.Builder; +import lombok.Data; + +@Data +@Builder +public class ItemProductStepWarning { + /** The specific warning code */ + String code; + /** Human readable message that explains the warning */ + String message; + /** Related error message exactly as found in the institution (if any). */ + String providerMessage; +} diff --git a/src/main/java/ai/pluggy/client/response/ItemResponse.java b/src/main/java/ai/pluggy/client/response/ItemResponse.java index bda3089..70cdc51 100644 --- a/src/main/java/ai/pluggy/client/response/ItemResponse.java +++ b/src/main/java/ai/pluggy/client/response/ItemResponse.java @@ -20,6 +20,7 @@ public class ItemResponse { String webhookUrl; ItemError error = null; CredentialLabel parameter; + ItemStatusDetail statusDetail; String clientUserId; Integer consecutiveFailedLoginAttempts; } diff --git a/src/main/java/ai/pluggy/client/response/ItemStatusDetail.java b/src/main/java/ai/pluggy/client/response/ItemStatusDetail.java new file mode 100644 index 0000000..120b8ed --- /dev/null +++ b/src/main/java/ai/pluggy/client/response/ItemStatusDetail.java @@ -0,0 +1,42 @@ +package ai.pluggy.client.response; + +import lombok.Builder; +import lombok.Data; + +/** + * Only available when item.status is 'PARTIAL_SUCCESS'. + * Provides fine-grained information, per product, about their latest collection state. + * + * If a product was not requested at all, its entry will be null. + * If it was requested, it's entry will reflect if it has been collected or not. + * If collected, isUpdated will be true, and lastUpdatedAt will be the Date when it happened + * If not collected, isUpdated will be false, and lastUpdatedAt will be null it wasn't ever collected before, or the previous date if it was. + */ +@Data +@Builder +public class ItemStatusDetail { + /** Collection details for 'ACCOUNTS' product, or null if it was not requested at all. */ + private ItemProductState accounts; + /** Collection details for 'CREDIT_CARDS' product, or null if it was not requested at all. */ + private ItemProductState creditCards; + /** Collection details for account 'TRANSACTIONS' product, or null if it was not requested at all. */ + private ItemProductState transactions; + /** Collection details for 'INVESTMENTS' product, or null if it was not requested at all. */ + private ItemProductState investments; + /** Collection details for 'INVESTMENT_TRANSACTIONS' product, or null if it was not requested at all. */ + private ItemProductState investmentTransactions; + /** Collection details for 'IDENTITY' product, or null if it was not requested at all. */ + private ItemProductState identity; + /** Collection details for 'PAYMENT_DATA' product, or null if it was not requested at all. */ + private ItemProductState paymentData; + /** Collection details for 'INCOME_REPORT' product, or null if it was not requested at all. */ + private ItemProductState incomeReports; + /** Collection details for 'PORTFOLIO' product, or null if it was not requested at all. */ + private ItemProductState portfolio; + /** Collection details for 'LOAN' product, or null if it was not requested at all. */ + private ItemProductState loans; + /** Collection details for 'OPPORTUNITIES' product, or null if it was not requested at all. */ + private ItemProductState opportunities; + /** Collection details for 'BENEFIT' product, or null if it was not requested at all. */ + private ItemProductState benefits; +}