From e21ec4e9c6e78941851ffc9f1ccafb4dd5ad3334 Mon Sep 17 00:00:00 2001 From: Rick Wieman <1265791+RickWieman@users.noreply.github.com> Date: Fri, 6 Aug 2021 10:01:11 +0200 Subject: [PATCH 01/10] Revert "Add AccountEventContainer layer for AccountHolderStatus, fixes #529" (#595) This reverts commit 78129f976fa26fc9c7c9d8e65ee3cfb7abf8e007. --- .../marketpay/AccountEventContainer.java | 68 ------------------- .../model/marketpay/AccountHolderStatus.java | 12 ++-- src/test/java/com/adyen/MarketPayTest.java | 2 +- ...get-individual-account-holder-success.json | 8 +-- 4 files changed, 10 insertions(+), 80 deletions(-) delete mode 100644 src/main/java/com/adyen/model/marketpay/AccountEventContainer.java diff --git a/src/main/java/com/adyen/model/marketpay/AccountEventContainer.java b/src/main/java/com/adyen/model/marketpay/AccountEventContainer.java deleted file mode 100644 index a67516bd5..000000000 --- a/src/main/java/com/adyen/model/marketpay/AccountEventContainer.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * ###### - * ###### - * ############ ####( ###### #####. ###### ############ ############ - * ############# #####( ###### #####. ###### ############# ############# - * ###### #####( ###### #####. ###### ##### ###### ##### ###### - * ###### ###### #####( ###### #####. ###### ##### ##### ##### ###### - * ###### ###### #####( ###### #####. ###### ##### ##### ###### - * ############# ############# ############# ############# ##### ###### - * ############ ############ ############# ############ ##### ###### - * ###### - * ############# - * ############ - * - * Adyen Java API Library - * - * Copyright (c) 2021 Adyen B.V. - * This file is open source and available under the MIT license. - * See the LICENSE file for more info. - */ - -package com.adyen.model.marketpay; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.google.gson.annotations.SerializedName; - -public class AccountEventContainer { - @SerializedName("AccountEvent") - @JsonProperty("AccountEvent") - private AccountEvent accountEvent = null; - - public AccountEvent getAccountEvent() { - return accountEvent; - } - - public void setAccountEvent(AccountEvent accountEvent) { - this.accountEvent = accountEvent; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - - AccountEventContainer that = (AccountEventContainer) o; - - return accountEvent != null ? accountEvent.equals(that.accountEvent) : that.accountEvent == null; - } - - @Override - public int hashCode() { - return accountEvent != null ? accountEvent.hashCode() : 0; - } - - @Override - public String toString() { - final StringBuilder sb = new StringBuilder("AccountEventContainer{"); - sb.append("accountEvent=").append(accountEvent); - sb.append('}'); - return sb.toString(); - } - - -} diff --git a/src/main/java/com/adyen/model/marketpay/AccountHolderStatus.java b/src/main/java/com/adyen/model/marketpay/AccountHolderStatus.java index 84c74d427..cd7ee6502 100755 --- a/src/main/java/com/adyen/model/marketpay/AccountHolderStatus.java +++ b/src/main/java/com/adyen/model/marketpay/AccountHolderStatus.java @@ -42,7 +42,7 @@ public class AccountHolderStatus { @SerializedName("events") - private List events = null; + private List events = null; @SerializedName("payoutState") private AccountPayoutState payoutState = null; @@ -105,14 +105,14 @@ public StatusEnum read(final JsonReader jsonReader) throws IOException { @SerializedName("statusReason") private String statusReason = null; - public AccountHolderStatus events(List events) { + public AccountHolderStatus events(List events) { this.events = events; return this; } - public AccountHolderStatus addEventsItem(AccountEventContainer eventsItem) { + public AccountHolderStatus addEventsItem(AccountEvent eventsItem) { if (this.events == null) { - this.events = new ArrayList(); + this.events = new ArrayList(); } this.events.add(eventsItem); return this; @@ -123,11 +123,11 @@ public AccountHolderStatus addEventsItem(AccountEventContainer eventsItem) { * * @return events **/ - public List getEvents() { + public List getEvents() { return events; } - public void setEvents(List events) { + public void setEvents(List events) { this.events = events; } diff --git a/src/test/java/com/adyen/MarketPayTest.java b/src/test/java/com/adyen/MarketPayTest.java index 2799e7c9c..1d5b3b583 100644 --- a/src/test/java/com/adyen/MarketPayTest.java +++ b/src/test/java/com/adyen/MarketPayTest.java @@ -401,7 +401,7 @@ public void TestGetIndividualAccountHolderSuccess() throws Exception { assertEquals("TestMerchant1", getAccountHolderResponse.getAccountHolderDetails().getStoreDetails().get(0).getMerchantAccount()); assertEquals("Other", getAccountHolderResponse.getAccountHolderDetails().getStoreDetails().get(0).getMerchantCategoryCode()); assertEquals("611223344", getAccountHolderResponse.getAccountHolderDetails().getStoreDetails().get(0).getPhoneNumber().getPhoneNumber()); - assertEquals(INACTIVATEACCOUNT, getAccountHolderResponse.getAccountHolderStatus().getEvents().get(0).getAccountEvent().getEvent()); + assertEquals(INACTIVATEACCOUNT, getAccountHolderResponse.getAccountHolderStatus().getEvents().get(0).getEvent()); } @Test diff --git a/src/test/resources/mocks/marketpay/account/get-individual-account-holder-success.json b/src/test/resources/mocks/marketpay/account/get-individual-account-holder-success.json index d670ffcee..e79092755 100644 --- a/src/test/resources/mocks/marketpay/account/get-individual-account-holder-success.json +++ b/src/test/resources/mocks/marketpay/account/get-individual-account-holder-success.json @@ -106,11 +106,9 @@ }, "events": [ { - "AccountEvent": { - "event": "InactivateAccount", - "reason": "reason", - "executionDate": "2020-02-11T00:00:00+01:00" - } + "event": "InactivateAccount", + "reason": "reason", + "executionDate": "2020-02-11T00:00:00+01:00" } ] }, From 3897f966d66c65be1eb94ebdf07770dc823cb41f Mon Sep 17 00:00:00 2001 From: Wouter Boereboom Date: Fri, 6 Aug 2021 16:01:36 +0200 Subject: [PATCH 02/10] added tavv and tokenAuthenticationVerificationValue fields to ThreeDSecureData model --- .../com/adyen/model/ThreeDSecureData.java | 39 ++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/adyen/model/ThreeDSecureData.java b/src/main/java/com/adyen/model/ThreeDSecureData.java index d12c136e4..d5cd1c4f2 100644 --- a/src/main/java/com/adyen/model/ThreeDSecureData.java +++ b/src/main/java/com/adyen/model/ThreeDSecureData.java @@ -120,6 +120,12 @@ public String toString() { @SerializedName("cavv") private String cavv = null; + @SerializedName("tavv") + private String tavv = null; + + @SerializedName("tokenAuthenticationVerificationValue") + private String tokenAuthenticationVerificationValue = null; + @SerializedName("eci") private String eci = null; @@ -220,6 +226,33 @@ public ThreeDSecureData cavv(String cavv) { return this; } + /** + * Network token cryptogram. + * + * @return tavv + **/ + public String getTavv() { + return tavv; + } + + public void setTavv(String tavv) { + this.tavv = tavv; + } + + /** + * Network token authentication verification value (TAVV). The network token cryptogram. + * + * @return tokenAuthenticationVerificationValue + **/ + public String getTokenAuthenticationVerificationValue() { + return tokenAuthenticationVerificationValue; + } + + public void setTokenAuthenticationVerificationValue(String tokenAuthenticationVerificationValue) { + this.tokenAuthenticationVerificationValue = tokenAuthenticationVerificationValue; + } + + /** * the cardholder authentication value (base64 encoded, 20 bytes in decoded form) * @@ -336,6 +369,8 @@ public boolean equals(Object o) { && Objects.equals(this.authenticationResponse, threeDSecureData.authenticationResponse) && Objects.equals(this.xid, threeDSecureData.xid) && Objects.equals(this.cavv, threeDSecureData.cavv) + && Objects.equals(this.tavv, threeDSecureData.tavv) + && Objects.equals(this.tokenAuthenticationVerificationValue, threeDSecureData.tokenAuthenticationVerificationValue) && Objects.equals(this.eci, threeDSecureData.eci) && Objects.equals(this.dsTransID, threeDSecureData.dsTransID) && Objects.equals(this.challengeCancel, threeDSecureData.challengeCancel) @@ -345,7 +380,7 @@ public boolean equals(Object o) { @Override public int hashCode() { - return Objects.hash(cavvAlgorithm, directoryResponse, authenticationResponse, xid, cavv, eci, dsTransID, challengeCancel, riskScore, transStatusReason); + return Objects.hash(cavvAlgorithm, directoryResponse, authenticationResponse, xid, cavv, tavv, tokenAuthenticationVerificationValue, eci, dsTransID, challengeCancel, riskScore, transStatusReason); } @@ -359,6 +394,8 @@ public String toString() { sb.append(" authenticationResponse: ").append(toIndentedString(authenticationResponse)).append("\n"); sb.append(" xid: ").append(toIndentedString(xid)).append("\n"); sb.append(" cavv: ").append(toIndentedString(cavv)).append("\n"); + sb.append(" tavv: ").append(toIndentedString(tavv)).append("\n"); + sb.append(" tokenAuthenticationVerificationValue: ").append(toIndentedString(tokenAuthenticationVerificationValue)).append("\n"); sb.append(" eci: ").append(toIndentedString(eci)).append("\n"); sb.append(" dsTransID: ").append(toIndentedString(dsTransID)).append("\n"); sb.append(" challengeCancel").append(toIndentedString(challengeCancel)).append("\n"); From 56d5d9a29d4b9e034203320f49db2aabe51a7c44 Mon Sep 17 00:00:00 2001 From: Alessio Zampatti Date: Fri, 6 Aug 2021 16:39:39 +0200 Subject: [PATCH 03/10] Update CODEOWNERS --- .github/CODEOWNERS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index fdee26b77..d4a5be198 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1 +1 @@ -* @rkewlani @martinsrenato @Aleffio @abhilash-adyen @saquibsayyad +* @rkewlani @martinsrenato @Aleffio @abhilash-adyen @saquibsayyad @AlexandrosMor @wboereboom From ee19198adf62d85d4cdaa85f17c4a257796e0a99 Mon Sep 17 00:00:00 2001 From: Wouter Boereboom Date: Tue, 17 Aug 2021 13:28:07 +0200 Subject: [PATCH 04/10] fixed issue with HMAC comparison --- src/main/java/com/adyen/terminal/security/NexoCrypto.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/com/adyen/terminal/security/NexoCrypto.java b/src/main/java/com/adyen/terminal/security/NexoCrypto.java index 5c9fbe52b..04212266b 100644 --- a/src/main/java/com/adyen/terminal/security/NexoCrypto.java +++ b/src/main/java/com/adyen/terminal/security/NexoCrypto.java @@ -144,7 +144,6 @@ private void validateHmac(byte[] receivedHmac, byte[] decryptedMessage, NexoDeri for (int i = 0; i < hmac.length && valid; i++) { if (receivedHmac[i] != hmac[i]) { valid = false; - break; } } From 899049a163ac3bee15a9133afa2f9823e213f4e9 Mon Sep 17 00:00:00 2001 From: Wouter Boereboom Date: Tue, 17 Aug 2021 14:38:50 +0200 Subject: [PATCH 05/10] valid removed from loop condition --- src/main/java/com/adyen/terminal/security/NexoCrypto.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/adyen/terminal/security/NexoCrypto.java b/src/main/java/com/adyen/terminal/security/NexoCrypto.java index 04212266b..efcf21dad 100644 --- a/src/main/java/com/adyen/terminal/security/NexoCrypto.java +++ b/src/main/java/com/adyen/terminal/security/NexoCrypto.java @@ -141,7 +141,7 @@ private void validateHmac(byte[] receivedHmac, byte[] decryptedMessage, NexoDeri if (receivedHmac.length != hmac.length) { valid = false; } - for (int i = 0; i < hmac.length && valid; i++) { + for (int i = 0; i < hmac.length; i++) { if (receivedHmac[i] != hmac[i]) { valid = false; } From a2f4a4bb8f0c327abecb2890dcf2696f0b007168 Mon Sep 17 00:00:00 2001 From: Wouter Boereboom Date: Tue, 17 Aug 2021 15:55:33 +0200 Subject: [PATCH 06/10] updated hmac validation loop to use MessageDigest.isEqual --- .../java/com/adyen/terminal/security/NexoCrypto.java | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/src/main/java/com/adyen/terminal/security/NexoCrypto.java b/src/main/java/com/adyen/terminal/security/NexoCrypto.java index efcf21dad..42342cbdd 100644 --- a/src/main/java/com/adyen/terminal/security/NexoCrypto.java +++ b/src/main/java/com/adyen/terminal/security/NexoCrypto.java @@ -39,6 +39,7 @@ import java.nio.charset.StandardCharsets; import java.security.InvalidAlgorithmParameterException; import java.security.InvalidKeyException; +import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.util.Random; @@ -136,16 +137,7 @@ private byte[] hmac(byte[] bytes, NexoDerivedKey derivedKey) throws NoSuchAlgori */ private void validateHmac(byte[] receivedHmac, byte[] decryptedMessage, NexoDerivedKey derivedKey) throws NexoCryptoException, InvalidKeyException, NoSuchAlgorithmException { byte[] hmac = hmac(decryptedMessage, derivedKey); - - boolean valid = true; - if (receivedHmac.length != hmac.length) { - valid = false; - } - for (int i = 0; i < hmac.length; i++) { - if (receivedHmac[i] != hmac[i]) { - valid = false; - } - } + boolean valid = MessageDigest.isEqual(hmac, receivedHmac); if (!valid) { throw new NexoCryptoException("Hmac validation failed"); From 12ba039b31600045670026bcba52e592111e99ff Mon Sep 17 00:00:00 2001 From: OscarTF <80273973+OscarTF@users.noreply.github.com> Date: Thu, 19 Aug 2021 10:28:59 +0200 Subject: [PATCH 07/10] Improving the library compatibility. (#532) * Improving the library compatibility. Recovering compatibility with Android 6 M API level 23 and earlier versions. java.util.Optional was added in API level 24 (Android 7 N). https://developer.android.com/reference/java/util/Optional * Use AdyenHttpClient instead of HttpURLConnectionClient Co-authored-by: Saquib Co-authored-by: Saquib --- src/main/java/com/adyen/Client.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/main/java/com/adyen/Client.java b/src/main/java/com/adyen/Client.java index 9defa4b8a..851b7854e 100644 --- a/src/main/java/com/adyen/Client.java +++ b/src/main/java/com/adyen/Client.java @@ -26,7 +26,6 @@ import com.adyen.httpclient.ClientInterface; import java.security.KeyStore; -import java.util.Optional; public class Client { private ClientInterface httpClient; @@ -226,8 +225,7 @@ public String toString() { } public ClientInterface getHttpClient() { - this.httpClient = Optional.ofNullable(this.httpClient).orElseGet(AdyenHttpClient::new); - return this.httpClient; + return this.httpClient == null ? new AdyenHttpClient() : this.httpClient; } public void setHttpClient(ClientInterface httpClient) { From ba24e306c1868f03f41a2a975e7534b590287537 Mon Sep 17 00:00:00 2001 From: Rick Wieman <1265791+RickWieman@users.noreply.github.com> Date: Thu, 19 Aug 2021 13:42:10 +0200 Subject: [PATCH 08/10] Add support for UltimateParentCompany (#600) * Add listedUltimateParentCompany to BusinessDetails Used to supply parent company information. * Add ultimateParentCompany to KYCVerificationResult * Add "ultimateParentCompany*" in FieldType to follow OpenAPI spec * Use UltimateParentCompanyBusinessDetails in UltimateParentCompany This is a very limited set of properties; using BusinessDetails would be incorrect. --- .../model/marketpay/BusinessDetails.java | 35 +++- .../com/adyen/model/marketpay/FieldType.java | 34 +++- .../KYCUltimateParentCompanyCheckResult.java | 115 ++++++++++++ .../marketpay/KYCVerificationResult.java | 16 +- .../marketpay/UltimateParentCompany.java | 129 +++++++++++++ .../UltimateParentCompanyBusinessDetails.java | 175 ++++++++++++++++++ src/test/java/com/adyen/MarketPayTest.java | 36 +++- ...ss-account-holder-with-parent-success.json | 103 +++++++++++ 8 files changed, 636 insertions(+), 7 deletions(-) create mode 100755 src/main/java/com/adyen/model/marketpay/KYCUltimateParentCompanyCheckResult.java create mode 100755 src/main/java/com/adyen/model/marketpay/UltimateParentCompany.java create mode 100755 src/main/java/com/adyen/model/marketpay/UltimateParentCompanyBusinessDetails.java create mode 100644 src/test/resources/mocks/marketpay/account/get-business-account-holder-with-parent-success.json diff --git a/src/main/java/com/adyen/model/marketpay/BusinessDetails.java b/src/main/java/com/adyen/model/marketpay/BusinessDetails.java index ce2abe6b1..ad0cd1b9a 100755 --- a/src/main/java/com/adyen/model/marketpay/BusinessDetails.java +++ b/src/main/java/com/adyen/model/marketpay/BusinessDetails.java @@ -63,6 +63,9 @@ public class BusinessDetails { @SerializedName("taxId") private String taxId = null; + @SerializedName("listedUltimateParentCompany") + private List listedUltimateParentCompany = null; + public BusinessDetails doingBusinessAs(String doingBusinessAs) { this.doingBusinessAs = doingBusinessAs; return this; @@ -259,6 +262,32 @@ public void setStockTicker(String stockTicker) { this.stockTicker = stockTicker; } + /** + * Information about the parent public company. Required if the account holder is 100% owned by a publicly listed + * company. + * + * @return listedUltimateParentCompany + */ + public List getListedUltimateParentCompany() { + return listedUltimateParentCompany; + } + + public void setListedUltimateParentCompany(List listedUltimateParentCompany) { + this.listedUltimateParentCompany = listedUltimateParentCompany; + } + + public BusinessDetails listedUltimateParentCompany(List listedUltimateParentCompany) { + this.listedUltimateParentCompany = listedUltimateParentCompany; + return this; + } + + public BusinessDetails addListedUltimateParentCompanyItem(UltimateParentCompany listedUltimateParentCompanyItem) { + if (this.listedUltimateParentCompany == null) { + this.listedUltimateParentCompany = new ArrayList<>(); + } + this.listedUltimateParentCompany.add(listedUltimateParentCompanyItem); + return this; + } @Override public boolean equals(Object o) { @@ -278,12 +307,13 @@ public boolean equals(Object o) { Objects.equals(this.stockExchange, businessDetails.stockExchange) && Objects.equals(this.stockNumber, businessDetails.stockNumber) && Objects.equals(this.stockTicker, businessDetails.stockTicker) && - Objects.equals(this.taxId, businessDetails.taxId); + Objects.equals(this.taxId, businessDetails.taxId) && + Objects.equals(this.listedUltimateParentCompany, businessDetails.listedUltimateParentCompany); } @Override public int hashCode() { - return Objects.hash(doingBusinessAs, incorporatedAt, legalBusinessName, registrationNumber, shareholders, signatories, stockExchange, stockNumber, stockTicker, taxId); + return Objects.hash(doingBusinessAs, incorporatedAt, legalBusinessName, registrationNumber, shareholders, signatories, stockExchange, stockNumber, stockTicker, taxId, listedUltimateParentCompany); } @@ -302,6 +332,7 @@ public String toString() { sb.append(" stockNumber: ").append(toIndentedString(stockNumber)).append("\n"); sb.append(" stockTicker: ").append(toIndentedString(stockTicker)).append("\n"); sb.append(" taxId: ").append(toIndentedString(taxId)).append("\n"); + sb.append(" listedUltimateParentCompany: ").append(toIndentedString(listedUltimateParentCompany)).append("\n"); sb.append("}"); return sb.toString(); } diff --git a/src/main/java/com/adyen/model/marketpay/FieldType.java b/src/main/java/com/adyen/model/marketpay/FieldType.java index b2a29baed..bf80bcd8c 100755 --- a/src/main/java/com/adyen/model/marketpay/FieldType.java +++ b/src/main/java/com/adyen/model/marketpay/FieldType.java @@ -25,7 +25,6 @@ import java.util.Objects; - import static com.adyen.util.Util.toIndentedString; /** @@ -195,6 +194,39 @@ public enum FieldNameEnum { @SerializedName("tierNumber") TIERNUMBER("tierNumber"), + @SerializedName("ultimateParentCompany") + ULTIMATEPARENTCOMPANY("ultimateParentCompany"), + + @SerializedName("ultimateParentCompanyAddressDetails") + ULTIMATEPARENTCOMPANYADDRESSDETAILS("ultimateParentCompanyAddressDetails"), + + @SerializedName("ultimateParentCompanyAddressDetailsCountry") + ULTIMATEPARENTCOMPANYADDRESSDETAILSCOUNTRY("ultimateParentCompanyAddressDetailsCountry"), + + @SerializedName("ultimateParentCompanyBusinessDetails") + ULTIMATEPARENTCOMPANYBUSINESSDETAILS("ultimateParentCompanyBusinessDetails"), + + @SerializedName("ultimateParentCompanyBusinessDetailsLegalBusinessName") + ULTIMATEPARENTCOMPANYBUSINESSDETAILSLEGALBUSINESSNAME("ultimateParentCompanyBusinessDetailsLegalBusinessName"), + + @SerializedName("ultimateParentCompanyBusinessDetailsRegistrationNumber") + ULTIMATEPARENTCOMPANYBUSINESSDETAILSREGISTRATIONNUMBER("ultimateParentCompanyBusinessDetailsRegistrationNumber"), + + @SerializedName("ultimateParentCompanyCode") + ULTIMATEPARENTCOMPANYCODE("ultimateParentCompanyCode"), + + @SerializedName("ultimateParentCompanyStockExchange") + ULTIMATEPARENTCOMPANYSTOCKEXCHANGE("ultimateParentCompanyStockExchange"), + + @SerializedName("ultimateParentCompanyStockNumber") + ULTIMATEPARENTCOMPANYSTOCKNUMBER("ultimateParentCompanyStockNumber"), + + @SerializedName("ultimateParentCompanyStockNumberOrStockTicker") + ULTIMATEPARENTCOMPANYSTOCKNUMBERORSTOCKTICKER("ultimateParentCompanyStockNumberOrStockTicker"), + + @SerializedName("ultimateParentCompanyStockTicker") + ULTIMATEPARENTCOMPANYSTOCKTICKER("ultimateParentCompanyStockTicker"), + @SerializedName("unknown") UNKNOWN("unknown"), diff --git a/src/main/java/com/adyen/model/marketpay/KYCUltimateParentCompanyCheckResult.java b/src/main/java/com/adyen/model/marketpay/KYCUltimateParentCompanyCheckResult.java new file mode 100755 index 000000000..225a994de --- /dev/null +++ b/src/main/java/com/adyen/model/marketpay/KYCUltimateParentCompanyCheckResult.java @@ -0,0 +1,115 @@ +/* + * ###### + * ###### + * ############ ####( ###### #####. ###### ############ ############ + * ############# #####( ###### #####. ###### ############# ############# + * ###### #####( ###### #####. ###### ##### ###### ##### ###### + * ###### ###### #####( ###### #####. ###### ##### ##### ##### ###### + * ###### ###### #####( ###### #####. ###### ##### ##### ###### + * ############# ############# ############# ############# ##### ###### + * ############ ############ ############# ############ ##### ###### + * ###### + * ############# + * ############ + * + * Adyen Java API Library + * + * Copyright (c) 2021 Adyen B.V. + * This file is open source and available under the MIT license. + * See the LICENSE file for more info. + */ +package com.adyen.model.marketpay; + +import com.google.gson.annotations.SerializedName; + +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +import static com.adyen.util.Util.toIndentedString; + +/** + * KYCUltimateParentCompanyCheckResult + */ +public class KYCUltimateParentCompanyCheckResult { + @SerializedName("checks") + private List checks = new ArrayList<>(); + + @SerializedName("ultimateParentCompanyCode") + private String ultimateParentCompanyCode = null; + + public KYCUltimateParentCompanyCheckResult checkStatusData(List checkStatusData) { + this.checks = checkStatusData; + return this; + } + + public KYCUltimateParentCompanyCheckResult addCheckStatusDataItem(KYCCheckStatusData checkStatusDataItem) { + this.checks.add(checkStatusDataItem); + return this; + } + + /** + * A list of the checks and their statuses. + * + * @return checks + **/ + public List getChecks() { + return checks; + } + + public void setChecks(List checks) { + this.checks = checks; + } + + public KYCUltimateParentCompanyCheckResult ultimateParentCompanyCode(String ultimateParentCompanyCode) { + this.ultimateParentCompanyCode = ultimateParentCompanyCode; + return this; + } + + /** + * The code of the Ultimate Parent Company to which the check applies. + * + * @return ultimateParentCompanyCode + **/ + public String getUltimateParentCompanyCode() { + return ultimateParentCompanyCode; + } + + public void setUltimateParentCompanyCode(String ultimateParentCompanyCode) { + this.ultimateParentCompanyCode = ultimateParentCompanyCode; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + KYCUltimateParentCompanyCheckResult kYCUltimateParentCompanyCheckResult = (KYCUltimateParentCompanyCheckResult) o; + return Objects.equals(this.checks, kYCUltimateParentCompanyCheckResult.checks) && + Objects.equals(this.ultimateParentCompanyCode, kYCUltimateParentCompanyCheckResult.ultimateParentCompanyCode); + } + + @Override + public int hashCode() { + return Objects.hash(checks, ultimateParentCompanyCode); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class KYCUltimateParentCompanyCheckResult {\n"); + + sb.append(" checks: ").append(toIndentedString(checks)).append("\n"); + sb.append(" ultimateParentCompanyCode: ").append(toIndentedString(ultimateParentCompanyCode)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + + +} + diff --git a/src/main/java/com/adyen/model/marketpay/KYCVerificationResult.java b/src/main/java/com/adyen/model/marketpay/KYCVerificationResult.java index d4b0efc0e..c68f52a87 100755 --- a/src/main/java/com/adyen/model/marketpay/KYCVerificationResult.java +++ b/src/main/java/com/adyen/model/marketpay/KYCVerificationResult.java @@ -20,9 +20,10 @@ */ package com.adyen.model.marketpay; +import com.google.gson.annotations.SerializedName; + import java.util.ArrayList; import java.util.List; -import com.google.gson.annotations.SerializedName; /** * KYCVerificationResult @@ -40,6 +41,9 @@ public class KYCVerificationResult { @SerializedName("payoutMethods") private List payoutMethods = new ArrayList<>(); + @SerializedName("ultimateParentCompany") + private List ultimateParentCompany = new ArrayList<>(); + public List getShareholders() { return shareholders; } @@ -72,8 +76,16 @@ public void setPayoutMethods(List payoutMethods) { this.payoutMethods = payoutMethods; } + public List getUltimateParentCompany() { + return ultimateParentCompany; + } + + public void setUltimateParentCompany(List ultimateParentCompany) { + this.ultimateParentCompany = ultimateParentCompany; + } + @Override public String toString() { - return "KYCVerificationResult{" + "shareholders=" + shareholders + ", accountHolder=" + accountHolder + ", bankAccounts=" + bankAccounts + ", payoutMethods=" + payoutMethods + '}'; + return "KYCVerificationResult{" + "shareholders=" + shareholders + ", accountHolder=" + accountHolder + ", bankAccounts=" + bankAccounts + ", payoutMethods=" + payoutMethods + ", ultimateParentCompany=" + ultimateParentCompany + '}'; } } diff --git a/src/main/java/com/adyen/model/marketpay/UltimateParentCompany.java b/src/main/java/com/adyen/model/marketpay/UltimateParentCompany.java new file mode 100755 index 000000000..bbb6b6e7e --- /dev/null +++ b/src/main/java/com/adyen/model/marketpay/UltimateParentCompany.java @@ -0,0 +1,129 @@ +/* + * ###### + * ###### + * ############ ####( ###### #####. ###### ############ ############ + * ############# #####( ###### #####. ###### ############# ############# + * ###### #####( ###### #####. ###### ##### ###### ##### ###### + * ###### ###### #####( ###### #####. ###### ##### ##### ##### ###### + * ###### ###### #####( ###### #####. ###### ##### ##### ###### + * ############# ############# ############# ############# ##### ###### + * ############ ############ ############# ############ ##### ###### + * ###### + * ############# + * ############ + * + * Adyen Java API Library + * + * Copyright (c) 2021 Adyen B.V. + * This file is open source and available under the MIT license. + * See the LICENSE file for more info. + */ + +package com.adyen.model.marketpay; + +import com.adyen.model.Address; +import com.google.gson.annotations.SerializedName; + +import java.util.Objects; + +import static com.adyen.util.Util.toIndentedString; + +/** + * UltimateParentCompany + */ +public class UltimateParentCompany { + @SerializedName("address") + private Address address = null; + + @SerializedName("businessDetails") + private UltimateParentCompanyBusinessDetails businessDetails = null; + + @SerializedName("ultimateParentCompanyCode") + private String ultimateParentCompanyCode = null; + + /** + * Address of the ultimate parent company. + * + * @return address + */ + public Address getAddress() { + return address; + } + + public void setAddress(Address address) { + this.address = address; + } + + public UltimateParentCompany address(Address address) { + this.address = address; + return this; + } + + /** + * Details about the ultimate parent company's business. + * + * @return businessDetails + */ + public UltimateParentCompanyBusinessDetails getBusinessDetails() { + return businessDetails; + } + + public void setBusinessDetails(UltimateParentCompanyBusinessDetails businessDetails) { + this.businessDetails = businessDetails; + } + + public UltimateParentCompany businessDetails(UltimateParentCompanyBusinessDetails businessDetails) { + this.businessDetails = businessDetails; + return this; + } + + /** + * Adyen-generated unique alphanumeric identifier (UUID) for the entry, returned in the response when you create an + * ultimate parent company. Required when updating an existing entry in an /updateAccountHolder request. + * + * @return ultimateParentCompanyCode + */ + public String getUltimateParentCompanyCode() { + return ultimateParentCompanyCode; + } + + public void setUltimateParentCompanyCode(String ultimateParentCompanyCode) { + this.ultimateParentCompanyCode = ultimateParentCompanyCode; + } + + public UltimateParentCompany ultimateParentCompanyCode(String ultimateParentCompanyCode) { + this.ultimateParentCompanyCode = ultimateParentCompanyCode; + return this; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UltimateParentCompany ultimateParentCompany = (UltimateParentCompany) o; + return Objects.equals(this.address, ultimateParentCompany.address) && + Objects.equals(this.businessDetails, ultimateParentCompany.businessDetails) && + Objects.equals(this.ultimateParentCompanyCode, ultimateParentCompany.ultimateParentCompanyCode); + } + + @Override + public int hashCode() { + return Objects.hash(address, businessDetails, ultimateParentCompanyCode); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UltimateParentCompany {\n"); + + sb.append(" address: ").append(toIndentedString(address)).append("\n"); + sb.append(" businessDetails: ").append(toIndentedString(businessDetails)).append("\n"); + sb.append(" ultimateParentCompanyCode: ").append(toIndentedString(ultimateParentCompanyCode)).append("\n"); + sb.append("}"); + return sb.toString(); + } +} diff --git a/src/main/java/com/adyen/model/marketpay/UltimateParentCompanyBusinessDetails.java b/src/main/java/com/adyen/model/marketpay/UltimateParentCompanyBusinessDetails.java new file mode 100755 index 000000000..53fd24758 --- /dev/null +++ b/src/main/java/com/adyen/model/marketpay/UltimateParentCompanyBusinessDetails.java @@ -0,0 +1,175 @@ +/* + * ###### + * ###### + * ############ ####( ###### #####. ###### ############ ############ + * ############# #####( ###### #####. ###### ############# ############# + * ###### #####( ###### #####. ###### ##### ###### ##### ###### + * ###### ###### #####( ###### #####. ###### ##### ##### ##### ###### + * ###### ###### #####( ###### #####. ###### ##### ##### ###### + * ############# ############# ############# ############# ##### ###### + * ############ ############ ############# ############ ##### ###### + * ###### + * ############# + * ############ + * + * Adyen Java API Library + * + * Copyright (c) 2021 Adyen B.V. + * This file is open source and available under the MIT license. + * See the LICENSE file for more info. + */ + +package com.adyen.model.marketpay; + +import com.google.gson.annotations.SerializedName; + +import java.util.Objects; + +import static com.adyen.util.Util.toIndentedString; + +/** + * UltimateParentCompanyBusinessDetails + */ +public class UltimateParentCompanyBusinessDetails { + @SerializedName("legalBusinessName") + private String legalBusinessName = null; + + @SerializedName("registrationNumber") + private String registrationNumber = null; + + @SerializedName("stockExchange") + private String stockExchange = null; + + @SerializedName("stockNumber") + private String stockNumber = null; + + @SerializedName("stockTicker") + private String stockTicker = null; + + + public UltimateParentCompanyBusinessDetails legalBusinessName(String legalBusinessName) { + this.legalBusinessName = legalBusinessName; + return this; + } + + /** + * The legal name of the company. + * + * @return legalBusinessName + **/ + public String getLegalBusinessName() { + return legalBusinessName; + } + + public void setLegalBusinessName(String legalBusinessName) { + this.legalBusinessName = legalBusinessName; + } + + public UltimateParentCompanyBusinessDetails registrationNumber(String registrationNumber) { + this.registrationNumber = registrationNumber; + return this; + } + + /** + * The registration number of the company. + * + * @return registrationNumber + **/ + public String getRegistrationNumber() { + return registrationNumber; + } + + public void setRegistrationNumber(String registrationNumber) { + this.registrationNumber = registrationNumber; + } + + public UltimateParentCompanyBusinessDetails stockExchange(String stockExchange) { + this.stockExchange = stockExchange; + return this; + } + + /** + * Market Identifier Code (MIC) + * + * @return stockExchange + */ + public String getStockExchange() { + return stockExchange; + } + + public void setStockExchange(String stockExchange) { + this.stockExchange = stockExchange; + } + + public UltimateParentCompanyBusinessDetails stockNumber(String stockNumber) { + this.stockNumber = stockNumber; + return this; + } + + /** + * International Securities Identification Number (ISIN) + * + * @return stockNumber + */ + public String getStockNumber() { + return stockNumber; + } + + public void setStockNumber(String stockNumber) { + this.stockNumber = stockNumber; + } + + public UltimateParentCompanyBusinessDetails stockTicker(String stockTicker) { + this.stockTicker = stockTicker; + return this; + } + + /** + * Stock Ticker symbol. + * + * @return stockTicker + */ + public String getStockTicker() { + return stockTicker; + } + + public void setStockTicker(String stockTicker) { + this.stockTicker = stockTicker; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UltimateParentCompanyBusinessDetails businessDetails = (UltimateParentCompanyBusinessDetails) o; + return Objects.equals(this.legalBusinessName, businessDetails.legalBusinessName) && + Objects.equals(this.registrationNumber, businessDetails.registrationNumber) && + Objects.equals(this.stockExchange, businessDetails.stockExchange) && + Objects.equals(this.stockNumber, businessDetails.stockNumber) && + Objects.equals(this.stockTicker, businessDetails.stockTicker); + } + + @Override + public int hashCode() { + return Objects.hash(legalBusinessName, registrationNumber, stockExchange, stockNumber, stockTicker); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UltimateParentCompanyBusinessDetails {\n"); + sb.append(" legalBusinessName: ").append(toIndentedString(legalBusinessName)).append("\n"); + sb.append(" registrationNumber: ").append(toIndentedString(registrationNumber)).append("\n"); + sb.append(" stockExchange: ").append(toIndentedString(stockExchange)).append("\n"); + sb.append(" stockNumber: ").append(toIndentedString(stockNumber)).append("\n"); + sb.append(" stockTicker: ").append(toIndentedString(stockTicker)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + +} diff --git a/src/test/java/com/adyen/MarketPayTest.java b/src/test/java/com/adyen/MarketPayTest.java index 1d5b3b583..968d6ae18 100644 --- a/src/test/java/com/adyen/MarketPayTest.java +++ b/src/test/java/com/adyen/MarketPayTest.java @@ -111,8 +111,14 @@ import static com.adyen.model.marketpay.AccountEvent.EventEnum.INACTIVATEACCOUNT; import static com.adyen.model.marketpay.KYCCheckStatusData.StatusEnum.AWAITING_DATA; import static com.adyen.model.marketpay.KYCCheckStatusData.StatusEnum.PASSED; -import static com.adyen.model.marketpay.KYCCheckStatusData.TypeEnum.*; -import static org.junit.Assert.*; +import static com.adyen.model.marketpay.KYCCheckStatusData.TypeEnum.BANK_ACCOUNT_VERIFICATION; +import static com.adyen.model.marketpay.KYCCheckStatusData.TypeEnum.COMPANY_VERIFICATION; +import static com.adyen.model.marketpay.KYCCheckStatusData.TypeEnum.IDENTITY_VERIFICATION; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; /** * Tests for /authorise and /authorise3d @@ -437,6 +443,32 @@ public void TestGetBusinessAccountHolderSuccess() throws Exception { assertEquals(ShareholderContact.ShareholderTypeEnum.CONTROLLER, getAccountHolderResponse.getAccountHolderDetails().getBusinessDetails().getShareholders().get(0).getShareholderType()); } + @Test + public void TestGetBusinessAccountHolderWithParentSuccess() throws Exception { + // setup client + Client client = createMockClientFromFile("mocks/marketpay/account/get-business-account-holder-with-parent-success.json"); + + // use Account service + Account account = new Account(client); + + // create GetAccountHolder Request + GetAccountHolderRequest getAccountHolderRequest = new GetAccountHolderRequest(); + getAccountHolderRequest.setAccountHolderCode("TestAccountHolderUltimateParentCompany"); + + GetAccountHolderResponse getAccountHolderResponse = account.getAccountHolder(getAccountHolderRequest); + + assertEquals("TestAccountHolderUltimateParentCompany", getAccountHolderResponse.getAccountHolderCode()); + assertEquals("25aee067-3560-4e16-83d6-0b6aa96e7e85", getAccountHolderResponse.getAccountHolderDetails().getBusinessDetails().getListedUltimateParentCompany().get(0).getUltimateParentCompanyCode()); + assertEquals("UPC Test Street", getAccountHolderResponse.getAccountHolderDetails().getBusinessDetails().getListedUltimateParentCompany().get(0).getAddress().getStreet()); + + assertEquals(COMPANY_VERIFICATION, getAccountHolderResponse.getVerification().getAccountHolder().getChecks().get(0).getType()); + assertEquals(PASSED, getAccountHolderResponse.getVerification().getAccountHolder().getChecks().get(0).getStatus()); + + assertEquals(COMPANY_VERIFICATION, getAccountHolderResponse.getVerification().getUltimateParentCompany().get(0).getChecks().get(0).getType()); + assertEquals(PASSED, getAccountHolderResponse.getVerification().getUltimateParentCompany().get(0).getChecks().get(0).getStatus()); + assertEquals("25aee067-3560-4e16-83d6-0b6aa96e7e85", getAccountHolderResponse.getVerification().getUltimateParentCompany().get(0).getUltimateParentCompanyCode()); + } + @Test public void TestUploadDocumentSuccess() throws Exception { // setup client diff --git a/src/test/resources/mocks/marketpay/account/get-business-account-holder-with-parent-success.json b/src/test/resources/mocks/marketpay/account/get-business-account-holder-with-parent-success.json new file mode 100644 index 000000000..c5caf181a --- /dev/null +++ b/src/test/resources/mocks/marketpay/account/get-business-account-holder-with-parent-success.json @@ -0,0 +1,103 @@ +{ + "pspReference": "8816286790542602", + "accountHolderCode": "TestAccountHolderUltimateParentCompany", + "accountHolderDetails": { + "address": { + "city": "PASSED", + "country": "NL", + "houseNumberOrName": "2", + "postalCode": "4321AB", + "street": "Outer Test Street" + }, + "bankAccountDetails": [], + "businessDetails": { + "legalBusinessName": "TestData", + "listedUltimateParentCompany": [ + { + "address": { + "city": "PASSED", + "country": "NL", + "houseNumberOrName": "1", + "postalCode": "1234AB", + "street": "UPC Test Street" + }, + "businessDetails": { + "legalBusinessName": "TestData", + "registrationNumber": "123456", + "stockExchange": "XAMS", + "stockNumber": "NL0012969182", + "stockTicker": "ADYEN" + }, + "ultimateParentCompanyCode": "25aee067-3560-4e16-83d6-0b6aa96e7e85" + } + ], + "registrationNumber": "12345678" + }, + "email": "support@adyen.com", + "legalArrangements": [], + "merchantCategoryCode": "7999", + "payoutMethods": [], + "webAddress": null + }, + "accountHolderStatus": { + "status": "Active", + "processingState": { + "disabled": false, + "processedFrom": { + "currency": "EUR", + "value": 0 + }, + "processedTo": { + "currency": "EUR", + "value": 0 + }, + "tierNumber": 0 + }, + "payoutState": { + "allowPayout": true, + "payoutLimit": { + "currency": "EUR", + "value": 0 + }, + "disabled": false, + "tierNumber": 0 + }, + "events": [] + }, + "accounts": [ + { + "accountCode": "8816286790475498", + "description": "TransactionAccount", + "payoutSchedule": { + "schedule": "DEFAULT" + }, + "payoutSpeed": "STANDARD", + "status": "Active" + } + ], + "legalEntity": "Business", + "systemUpToDateTime": "2021-08-11T12:50:48+02:00", + "verification": { + "accountHolder": { + "checks": [ + { + "type": "COMPANY_VERIFICATION", + "status": "PASSED", + "summary": {} + } + ] + }, + "ultimateParentCompany": [ + { + "checks": [ + { + "type": "COMPANY_VERIFICATION", + "status": "PASSED", + "summary": {} + } + ], + "ultimateParentCompanyCode": "25aee067-3560-4e16-83d6-0b6aa96e7e85" + } + ] + } +} \ No newline at end of file From 9382331915a4af82c8059e9521634b3dba16b1e2 Mon Sep 17 00:00:00 2001 From: Rick Wieman <1265791+RickWieman@users.noreply.github.com> Date: Thu, 19 Aug 2021 15:44:52 +0200 Subject: [PATCH 09/10] Extend signatory support (Account API) (#599) * Add /deleteSignatories endpoint to Account API https://docs.adyen.com/api-explorer/#/Account/v6/post/deleteSignatories * Add signatoryCode to DocumentDetail for /uploadDocument endpoint * Rename "DeleteSignatory*" to "DeleteSignories*" to follow OpenAPI spec * Add KYCSignatoryCheckResult in KYCVerificationResult And update the ACCOUNT_HOLDER_UPDATED mock notification to v6 so that we can test this. --- .../marketpay/DeleteSignatoriesRequest.java | 115 ++++++ .../marketpay/DeleteSignatoriesResponse.java | 25 ++ .../adyen/model/marketpay/DocumentDetail.java | 27 +- .../com/adyen/model/marketpay/FieldType.java | 3 + .../marketpay/KYCSignatoryCheckResult.java | 109 ++++++ .../marketpay/KYCVerificationResult.java | 13 +- src/main/java/com/adyen/service/Account.java | 13 + .../resource/account/DeleteSignatories.java | 33 ++ .../com/adyen/MarketPayNotificationTest.java | 66 +++- src/test/java/com/adyen/MarketPayTest.java | 41 ++ ...lete-signatories-error-invalid-fields.json | 13 + .../account/delete-signatories-success.json | 3 + .../notification/account-holder-updated.json | 360 +++++++++++------- 13 files changed, 670 insertions(+), 151 deletions(-) create mode 100755 src/main/java/com/adyen/model/marketpay/DeleteSignatoriesRequest.java create mode 100644 src/main/java/com/adyen/model/marketpay/DeleteSignatoriesResponse.java create mode 100755 src/main/java/com/adyen/model/marketpay/KYCSignatoryCheckResult.java create mode 100644 src/main/java/com/adyen/service/resource/account/DeleteSignatories.java create mode 100644 src/test/resources/mocks/marketpay/account/delete-signatories-error-invalid-fields.json create mode 100644 src/test/resources/mocks/marketpay/account/delete-signatories-success.json diff --git a/src/main/java/com/adyen/model/marketpay/DeleteSignatoriesRequest.java b/src/main/java/com/adyen/model/marketpay/DeleteSignatoriesRequest.java new file mode 100755 index 000000000..e8486218e --- /dev/null +++ b/src/main/java/com/adyen/model/marketpay/DeleteSignatoriesRequest.java @@ -0,0 +1,115 @@ +/* + * ###### + * ###### + * ############ ####( ###### #####. ###### ############ ############ + * ############# #####( ###### #####. ###### ############# ############# + * ###### #####( ###### #####. ###### ##### ###### ##### ###### + * ###### ###### #####( ###### #####. ###### ##### ##### ##### ###### + * ###### ###### #####( ###### #####. ###### ##### ##### ###### + * ############# ############# ############# ############# ##### ###### + * ############ ############ ############# ############ ##### ###### + * ###### + * ############# + * ############ + * + * Adyen Java API Library + * + * Copyright (c) 2021 Adyen B.V. + * This file is open source and available under the MIT license. + * See the LICENSE file for more info. + */ +package com.adyen.model.marketpay; + +import com.google.gson.annotations.SerializedName; + +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +import static com.adyen.util.Util.toIndentedString; + +/** + * DeleteSignatoriesRequest + */ +public class DeleteSignatoriesRequest { + @SerializedName("accountHolderCode") + private String accountHolderCode = null; + + @SerializedName("signatoryCodes") + private List signatoryCodes = new ArrayList<>(); + + public DeleteSignatoriesRequest accountHolderCode(String accountHolderCode) { + this.accountHolderCode = accountHolderCode; + return this; + } + + /** + * account holder code, whose signatories have to be deleted + * + * @return accountHolderCode + **/ + public String getAccountHolderCode() { + return accountHolderCode; + } + + public void setAccountHolderCode(String accountHolderCode) { + this.accountHolderCode = accountHolderCode; + } + + public DeleteSignatoriesRequest signatoryCodes(List signatoryCodes) { + this.signatoryCodes = signatoryCodes; + return this; + } + + public DeleteSignatoriesRequest addSignatoryCodesItem(String signatoryCodesItem) { + this.signatoryCodes.add(signatoryCodesItem); + return this; + } + + /** + * codes of the signatories to be deleted + * + * @return signatoryCodes + **/ + public List getSignatoryCodes() { + return signatoryCodes; + } + + public void setSignatoryCodes(List signatoryCodes) { + this.signatoryCodes = signatoryCodes; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DeleteSignatoriesRequest deleteSignatoriesRequest = (DeleteSignatoriesRequest) o; + return Objects.equals(this.accountHolderCode, deleteSignatoriesRequest.accountHolderCode) && Objects.equals(this.signatoryCodes, deleteSignatoriesRequest.signatoryCodes); + } + + @Override + public int hashCode() { + return Objects.hash(accountHolderCode, signatoryCodes); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DeleteSignatoriesRequest {\n"); + + sb.append(" accountHolderCode: ").append(toIndentedString(accountHolderCode)).append("\n"); + sb.append(" signatoryCodes: ").append(toIndentedString(signatoryCodes)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + + +} + diff --git a/src/main/java/com/adyen/model/marketpay/DeleteSignatoriesResponse.java b/src/main/java/com/adyen/model/marketpay/DeleteSignatoriesResponse.java new file mode 100644 index 000000000..638a84c16 --- /dev/null +++ b/src/main/java/com/adyen/model/marketpay/DeleteSignatoriesResponse.java @@ -0,0 +1,25 @@ +/* + * ###### + * ###### + * ############ ####( ###### #####. ###### ############ ############ + * ############# #####( ###### #####. ###### ############# ############# + * ###### #####( ###### #####. ###### ##### ###### ##### ###### + * ###### ###### #####( ###### #####. ###### ##### ##### ##### ###### + * ###### ###### #####( ###### #####. ###### ##### ##### ###### + * ############# ############# ############# ############# ##### ###### + * ############ ############ ############# ############ ##### ###### + * ###### + * ############# + * ############ + * + * Adyen Java API Library + * + * Copyright (c) 2021 Adyen B.V. + * This file is open source and available under the MIT license. + * See the LICENSE file for more info. + */ + +package com.adyen.model.marketpay; + +public class DeleteSignatoriesResponse extends GenericResponse { +} diff --git a/src/main/java/com/adyen/model/marketpay/DocumentDetail.java b/src/main/java/com/adyen/model/marketpay/DocumentDetail.java index 00242a36c..f60dcdb61 100755 --- a/src/main/java/com/adyen/model/marketpay/DocumentDetail.java +++ b/src/main/java/com/adyen/model/marketpay/DocumentDetail.java @@ -107,6 +107,9 @@ public String toString() { @SerializedName("shareholderCode") private String shareholderCode = null; + @SerializedName("signatoryCode") + private String signatoryCode = null; + public DocumentDetail accountHolderCode(String accountHolderCode) { this.accountHolderCode = accountHolderCode; return this; @@ -215,6 +218,24 @@ public void setShareholderCode(String shareholderCode) { this.shareholderCode = shareholderCode; } + /** + * The Adyen-generated signatoryCode to which the document must be linked. + * Populated only if the document is uploaded for a signatory. + * + * @return signatoryCode + **/ + public String getSignatoryCode() { + return signatoryCode; + } + + public void setSignatoryCode(String signatoryCode) { + this.signatoryCode = signatoryCode; + } + + public DocumentDetail signatoryCode(String signatoryCode) { + this.signatoryCode = signatoryCode; + return this; + } @Override public boolean equals(Object o) { @@ -231,12 +252,13 @@ public boolean equals(Object o) { documentDetail.filename) && Objects.equals(this.documentType, documentDetail.documentType) && Objects.equals(this.description, documentDetail.description) - && Objects.equals(this.shareholderCode, documentDetail.shareholderCode); + && Objects.equals(this.shareholderCode, documentDetail.shareholderCode) + && Objects.equals(this.signatoryCode, documentDetail.signatoryCode); } @Override public int hashCode() { - return Objects.hash(accountHolderCode, bankAccountUUID, filename, documentType, description, shareholderCode); + return Objects.hash(accountHolderCode, bankAccountUUID, filename, documentType, description, shareholderCode, signatoryCode); } @@ -251,6 +273,7 @@ public String toString() { sb.append(" documentType: ").append(toIndentedString(documentType)).append("\n"); sb.append(" description: ").append(toIndentedString(description)).append("\n"); sb.append(" shareholderCode: ").append(toIndentedString(shareholderCode)).append("\n"); + sb.append(" signatoryCode: ").append(toIndentedString(signatoryCode)).append("\n"); sb.append("}"); return sb.toString(); } diff --git a/src/main/java/com/adyen/model/marketpay/FieldType.java b/src/main/java/com/adyen/model/marketpay/FieldType.java index bf80bcd8c..efbcc8449 100755 --- a/src/main/java/com/adyen/model/marketpay/FieldType.java +++ b/src/main/java/com/adyen/model/marketpay/FieldType.java @@ -182,6 +182,9 @@ public enum FieldNameEnum { @SerializedName("shareholder") SHAREHOLDER("shareholder"), + @SerializedName("signatory") + SIGNATORY("signatory"), + @SerializedName("stateOrProvince") STATEORPROVINCE("stateOrProvince"), diff --git a/src/main/java/com/adyen/model/marketpay/KYCSignatoryCheckResult.java b/src/main/java/com/adyen/model/marketpay/KYCSignatoryCheckResult.java new file mode 100755 index 000000000..d2ae83f84 --- /dev/null +++ b/src/main/java/com/adyen/model/marketpay/KYCSignatoryCheckResult.java @@ -0,0 +1,109 @@ +/* + * ###### + * ###### + * ############ ####( ###### #####. ###### ############ ############ + * ############# #####( ###### #####. ###### ############# ############# + * ###### #####( ###### #####. ###### ##### ###### ##### ###### + * ###### ###### #####( ###### #####. ###### ##### ##### ##### ###### + * ###### ###### #####( ###### #####. ###### ##### ##### ###### + * ############# ############# ############# ############# ##### ###### + * ############ ############ ############# ############ ##### ###### + * ###### + * ############# + * ############ + * + * Adyen Java API Library + * + * Copyright (c) 2021 Adyen B.V. + * This file is open source and available under the MIT license. + * See the LICENSE file for more info. + */ +package com.adyen.model.marketpay; + +import com.google.gson.annotations.SerializedName; + +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +import static com.adyen.util.Util.toIndentedString; + +/** + * KYCSignatoryCheckResult + */ +public class KYCSignatoryCheckResult { + @SerializedName("checks") + private List checks = new ArrayList<>(); + + @SerializedName("signatoryCode") + private String signatoryCode = null; + + public KYCSignatoryCheckResult checkStatusData(List checkStatusData) { + this.checks = checkStatusData; + return this; + } + + public KYCSignatoryCheckResult addCheckStatusDataItem(KYCCheckStatusData checkStatusDataItem) { + this.checks.add(checkStatusDataItem); + return this; + } + + /** + * A list of the checks and their statuses. + * + * @return checks + **/ + public List getChecks() { + return checks; + } + + public void setChecks(List checks) { + this.checks = checks; + } + + public KYCSignatoryCheckResult signatoryCode(String signatoryCode) { + this.signatoryCode = signatoryCode; + return this; + } + + /** + * The code of the signatory to which the check applies. + * + * @return signatoryCode + **/ + public String getSignatoryCode() { + return signatoryCode; + } + + public void setSignatoryCode(String signatoryCode) { + this.signatoryCode = signatoryCode; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + KYCSignatoryCheckResult kyCShareholderCheckResult = (KYCSignatoryCheckResult) o; + return Objects.equals(this.checks, kyCShareholderCheckResult.checks) && Objects.equals(this.signatoryCode, kyCShareholderCheckResult.signatoryCode); + } + + @Override + public int hashCode() { + return Objects.hash(checks, signatoryCode); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class KYCSignatoryCheckResult {\n"); + sb.append(" checks: ").append(toIndentedString(checks)).append("\n"); + sb.append(" signatoryCode: ").append(toIndentedString(signatoryCode)).append("\n"); + sb.append("}"); + return sb.toString(); + } +} + diff --git a/src/main/java/com/adyen/model/marketpay/KYCVerificationResult.java b/src/main/java/com/adyen/model/marketpay/KYCVerificationResult.java index c68f52a87..c71278c57 100755 --- a/src/main/java/com/adyen/model/marketpay/KYCVerificationResult.java +++ b/src/main/java/com/adyen/model/marketpay/KYCVerificationResult.java @@ -32,6 +32,9 @@ public class KYCVerificationResult { @SerializedName("shareholders") private List shareholders = new ArrayList<>(); + @SerializedName("signatories") + private List signatories = new ArrayList<>(); + @SerializedName("accountHolder") private KYCCheckResult accountHolder; @@ -52,6 +55,14 @@ public void setShareholders(List shareholders) { this.shareholders = shareholders; } + public List getSignatories() { + return signatories; + } + + public void setSignatories(List signatories) { + this.signatories = signatories; + } + public KYCCheckResult getAccountHolder() { return accountHolder; } @@ -86,6 +97,6 @@ public void setUltimateParentCompany(List u @Override public String toString() { - return "KYCVerificationResult{" + "shareholders=" + shareholders + ", accountHolder=" + accountHolder + ", bankAccounts=" + bankAccounts + ", payoutMethods=" + payoutMethods + ", ultimateParentCompany=" + ultimateParentCompany + '}'; + return "KYCVerificationResult{" + "shareholders=" + shareholders + ", signatories=" + signatories + ", accountHolder=" + accountHolder + ", bankAccounts=" + bankAccounts + ", payoutMethods=" + payoutMethods + ", ultimateParentCompany=" + ultimateParentCompany + '}'; } } diff --git a/src/main/java/com/adyen/service/Account.java b/src/main/java/com/adyen/service/Account.java index a87f43e21..4285bb351 100644 --- a/src/main/java/com/adyen/service/Account.java +++ b/src/main/java/com/adyen/service/Account.java @@ -38,6 +38,8 @@ import com.adyen.model.marketpay.DeletePayoutMethodResponse; import com.adyen.model.marketpay.DeleteShareholderRequest; import com.adyen.model.marketpay.DeleteShareholderResponse; +import com.adyen.model.marketpay.DeleteSignatoriesRequest; +import com.adyen.model.marketpay.DeleteSignatoriesResponse; import com.adyen.model.marketpay.GetAccountHolderRequest; import com.adyen.model.marketpay.GetAccountHolderResponse; import com.adyen.model.marketpay.GetTaxFormRequest; @@ -66,6 +68,7 @@ import com.adyen.service.resource.account.DeleteBankAccount; import com.adyen.service.resource.account.DeletePayoutMethod; import com.adyen.service.resource.account.DeleteShareholder; +import com.adyen.service.resource.account.DeleteSignatories; import com.adyen.service.resource.account.GetAccountHolder; import com.adyen.service.resource.account.GetTaxForm; import com.adyen.service.resource.account.GetUploadedDocuments; @@ -88,6 +91,7 @@ public class Account extends Service { private CreateAccount createAccount; private DeleteBankAccount deleteBankAccount; private DeleteShareholder deleteShareholder; + private DeleteSignatories deleteSignatories; private SuspendAccountHolder suspendAccountHolder; private UnSuspendAccountHolder unSuspendAccountHolder; private UpdateAccountHolderState updateAccountHolderState; @@ -109,6 +113,7 @@ public Account(Client client) { createAccount = new CreateAccount(this); deleteBankAccount = new DeleteBankAccount(this); deleteShareholder = new DeleteShareholder(this); + deleteSignatories = new DeleteSignatories(this); suspendAccountHolder = new SuspendAccountHolder(this); unSuspendAccountHolder = new UnSuspendAccountHolder(this); updateAccountHolderState = new UpdateAccountHolderState(this); @@ -178,6 +183,14 @@ public DeleteShareholderResponse deleteShareholder(DeleteShareholderRequest dele }.getType()); } + public DeleteSignatoriesResponse deleteSignatories(DeleteSignatoriesRequest deleteSignatoriesRequest) throws ApiException, IOException { + String jsonRequest = GSON.toJson(deleteSignatoriesRequest); + + String jsonResult = deleteSignatories.request(jsonRequest); + return GSON.fromJson(jsonResult, new TypeToken() { + }.getType()); + } + public SuspendAccountHolderResponse suspendAccountHolder(SuspendAccountHolderRequest suspendAccountHolderRequest) throws ApiException, IOException { String jsonRequest = GSON.toJson(suspendAccountHolderRequest); diff --git a/src/main/java/com/adyen/service/resource/account/DeleteSignatories.java b/src/main/java/com/adyen/service/resource/account/DeleteSignatories.java new file mode 100644 index 000000000..3724ff7a1 --- /dev/null +++ b/src/main/java/com/adyen/service/resource/account/DeleteSignatories.java @@ -0,0 +1,33 @@ +/* + * ###### + * ###### + * ############ ####( ###### #####. ###### ############ ############ + * ############# #####( ###### #####. ###### ############# ############# + * ###### #####( ###### #####. ###### ##### ###### ##### ###### + * ###### ###### #####( ###### #####. ###### ##### ##### ##### ###### + * ###### ###### #####( ###### #####. ###### ##### ##### ###### + * ############# ############# ############# ############# ##### ###### + * ############ ############ ############# ############ ##### ###### + * ###### + * ############# + * ############ + * + * Adyen Java API Library + * + * Copyright (c) 2021 Adyen B.V. + * This file is open source and available under the MIT license. + * See the LICENSE file for more info. + */ + +package com.adyen.service.resource.account; + +import com.adyen.Client; +import com.adyen.Service; +import com.adyen.service.Resource; + +public class DeleteSignatories extends Resource { + + public DeleteSignatories(Service service) { + super(service, service.getClient().getConfig().getMarketPayEndpoint() + "/Account/" + Client.MARKETPAY_ACCOUNT_API_VERSION + "/deleteSignatories", null); + } +} diff --git a/src/test/java/com/adyen/MarketPayNotificationTest.java b/src/test/java/com/adyen/MarketPayNotificationTest.java index ef8a2cb19..a6d24b2db 100644 --- a/src/test/java/com/adyen/MarketPayNotificationTest.java +++ b/src/test/java/com/adyen/MarketPayNotificationTest.java @@ -20,27 +20,68 @@ */ package com.adyen; +import com.adyen.model.marketpay.AccountHolderStatus; +import com.adyen.model.marketpay.CreateAccountResponse; import com.adyen.model.marketpay.ErrorFieldType; import com.adyen.model.marketpay.FieldType; import com.adyen.model.marketpay.PayoutScheduleResponse; -import com.adyen.model.marketpay.*; -import com.adyen.model.marketpay.notification.*; +import com.adyen.model.marketpay.notification.AccountCloseNotification; +import com.adyen.model.marketpay.notification.AccountCreateNotification; +import com.adyen.model.marketpay.notification.AccountFundsBelowThresholdNotification; +import com.adyen.model.marketpay.notification.AccountHolderCreateNotification; +import com.adyen.model.marketpay.notification.AccountHolderPayoutNotification; +import com.adyen.model.marketpay.notification.AccountHolderStatusChangeNotification; +import com.adyen.model.marketpay.notification.AccountHolderStoreStatusChangeNotification; +import com.adyen.model.marketpay.notification.AccountHolderUpcomingDeadlineNotification; +import com.adyen.model.marketpay.notification.AccountHolderUpcomingDeadlineNotificationContent; +import com.adyen.model.marketpay.notification.AccountHolderUpdateNotification; +import com.adyen.model.marketpay.notification.AccountHolderVerificationNotification; +import com.adyen.model.marketpay.notification.AccountUpdateNotification; +import com.adyen.model.marketpay.notification.BeneficiarySetupNotification; +import com.adyen.model.marketpay.notification.CompensateNegativeBalanceNotification; +import com.adyen.model.marketpay.notification.CreateNotificationConfigurationRequest; +import com.adyen.model.marketpay.notification.CreateNotificationConfigurationResponse; +import com.adyen.model.marketpay.notification.DeleteNotificationConfigurationRequest; +import com.adyen.model.marketpay.notification.DeleteNotificationConfigurationResponse; +import com.adyen.model.marketpay.notification.DirectDebitInitiatedNotification; +import com.adyen.model.marketpay.notification.GenericNotification; +import com.adyen.model.marketpay.notification.GetNotificationConfigurationListResponse; +import com.adyen.model.marketpay.notification.GetNotificationConfigurationRequest; +import com.adyen.model.marketpay.notification.GetNotificationConfigurationResponse; +import com.adyen.model.marketpay.notification.NotificationConfigurationDetails; +import com.adyen.model.marketpay.notification.NotificationEventConfiguration; +import com.adyen.model.marketpay.notification.PaymentFailureNotification; +import com.adyen.model.marketpay.notification.RefundFundsTransferNotification; +import com.adyen.model.marketpay.notification.ReportAvailableNotification; +import com.adyen.model.marketpay.notification.ScheduledRefundsNotification; +import com.adyen.model.marketpay.notification.TestNotificationConfigurationRequest; +import com.adyen.model.marketpay.notification.TestNotificationConfigurationResponse; +import com.adyen.model.marketpay.notification.TransferFundsNotification; +import com.adyen.model.marketpay.notification.UpdateNotificationConfigurationRequest; +import com.adyen.model.marketpay.notification.UpdateNotificationConfigurationResponse; import com.adyen.notification.NotificationHandler; import com.adyen.service.Notification; import org.junit.Assert; import org.junit.Test; import static com.adyen.model.marketpay.CreateAccountResponse.StatusEnum.ACTIVE; +import static com.adyen.model.marketpay.KYCCheckStatusData.StatusEnum.AWAITING_DATA; import static com.adyen.model.marketpay.KYCCheckStatusData.StatusEnum.DATA_PROVIDED; +import static com.adyen.model.marketpay.KYCCheckStatusData.StatusEnum.PASSED; import static com.adyen.model.marketpay.KYCCheckStatusData.TypeEnum.COMPANY_VERIFICATION; +import static com.adyen.model.marketpay.KYCCheckStatusData.TypeEnum.IDENTITY_VERIFICATION; +import static com.adyen.model.marketpay.KYCCheckStatusData.TypeEnum.PASSPORT_VERIFICATION; +import static com.adyen.model.marketpay.KYCCheckStatusData.TypeEnum.PAYOUT_METHOD_VERIFICATION; import static com.adyen.model.marketpay.PayoutScheduleResponse.ScheduleEnum.DAILY; import static com.adyen.model.marketpay.Transaction.TransactionStatusEnum.PENDINGCREDIT; import static com.adyen.model.marketpay.notification.NotificationEventConfiguration.EventTypeEnum.ACCOUNT_CREATED; -import static com.adyen.model.marketpay.notification.NotificationEventConfiguration.EventTypeEnum.ACCOUNT_HOLDER_STATUS_CHANGE; import static com.adyen.model.marketpay.notification.NotificationEventConfiguration.EventTypeEnum.ACCOUNT_HOLDER_VERIFICATION; import static com.adyen.model.marketpay.notification.NotificationEventConfiguration.IncludeModeEnum.INCLUDE; import static java.time.ZonedDateTime.parse; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; public class MarketPayNotificationTest extends BaseTest { @@ -262,8 +303,21 @@ public void testMarketPayAccountHolderUpdatedNotification() { assertEquals("accountHolderCode", notification.getContent().getAccountHolderCode()); assertEquals(AccountHolderStatus.StatusEnum.ACTIVE, notification.getContent().getAccountHolderStatus().getStatus()); assertEquals(COMPANY_VERIFICATION, notification.getContent().getVerificationResult().getAccountHolder().getChecks().get(0).getType()); - assertEquals(DATA_PROVIDED, notification.getContent().getVerificationResult().getAccountHolder().getChecks().get(0).getStatus()); - assertEquals(DATA_PROVIDED, notification.getContent().getVerificationResult().getShareholders().get(0).getChecks().get(0).getStatus()); + assertEquals(PASSED, notification.getContent().getVerificationResult().getAccountHolder().getChecks().get(0).getStatus()); + + assertEquals(PAYOUT_METHOD_VERIFICATION, notification.getContent().getVerificationResult().getPayoutMethods().get(0).getChecks().get(0).getType()); + assertEquals(PASSED, notification.getContent().getVerificationResult().getPayoutMethods().get(0).getChecks().get(0).getStatus()); + + assertEquals("7c46d0fc-68e2-435c-bb9f-e8719d9cb3df", notification.getContent().getVerificationResult().getShareholders().get(0).getShareholderCode()); + assertEquals(IDENTITY_VERIFICATION, notification.getContent().getVerificationResult().getShareholders().get(0).getChecks().get(0).getType()); + assertEquals(PASSED, notification.getContent().getVerificationResult().getShareholders().get(0).getChecks().get(0).getStatus()); + + assertEquals("591d1886-3cfa-4980-bb3a-228f837a2bb3", notification.getContent().getVerificationResult().getSignatories().get(0).getSignatoryCode()); + assertEquals(IDENTITY_VERIFICATION, notification.getContent().getVerificationResult().getSignatories().get(0).getChecks().get(0).getType()); + assertEquals(DATA_PROVIDED, notification.getContent().getVerificationResult().getSignatories().get(0).getChecks().get(0).getStatus()); + assertEquals(PASSPORT_VERIFICATION, notification.getContent().getVerificationResult().getSignatories().get(0).getChecks().get(1).getType()); + assertEquals(AWAITING_DATA, notification.getContent().getVerificationResult().getSignatories().get(0).getChecks().get(1).getStatus()); + assertEquals("AccountHolderDetails.BusinessDetails.Signatories.Document.document", notification.getContent().getVerificationResult().getSignatories().get(0).getChecks().get(1).getRequiredFields().get(0)); } @Test diff --git a/src/test/java/com/adyen/MarketPayTest.java b/src/test/java/com/adyen/MarketPayTest.java index 968d6ae18..77089b599 100644 --- a/src/test/java/com/adyen/MarketPayTest.java +++ b/src/test/java/com/adyen/MarketPayTest.java @@ -52,6 +52,8 @@ import com.adyen.model.marketpay.DeletePayoutMethodResponse; import com.adyen.model.marketpay.DeleteShareholderRequest; import com.adyen.model.marketpay.DeleteShareholderResponse; +import com.adyen.model.marketpay.DeleteSignatoriesRequest; +import com.adyen.model.marketpay.DeleteSignatoriesResponse; import com.adyen.model.marketpay.DocumentDetail; import com.adyen.model.marketpay.ErrorFieldType; import com.adyen.model.marketpay.FieldType; @@ -585,6 +587,45 @@ public void TestDeleteShareholderSuccess() throws Exception { } + @Test + public void TestDeleteSignatoriesSuccess() throws Exception { + // setup client + Client client = createMockClientFromFile("mocks/marketpay/account/delete-signatories-success.json"); + + // use Account service + Account account = new Account(client); + + // create DeleteSignatories Request + DeleteSignatoriesRequest deleteSignatoriesRequest = new DeleteSignatoriesRequest(); + deleteSignatoriesRequest.setAccountHolderCode("TestAccountHolder289429"); + deleteSignatoriesRequest.addSignatoryCodesItem("39b57c2d-d73b-400c-93de-708a51cd1f20"); + + DeleteSignatoriesResponse deleteSignatoriesResponse = account.deleteSignatories(deleteSignatoriesRequest); + assertEquals("8516284978974831", deleteSignatoriesResponse.getPspReference()); + } + + @Test + public void TestDeleteSignatoriesInvalid() throws Exception { + // setup client + Client client = createMockClientFromFile("mocks/marketpay/account/delete-signatories-error-invalid-fields.json"); + + // use Account service + Account account = new Account(client); + + // create DeleteSignatories Request + DeleteSignatoriesRequest deleteSignatoriesRequest = new DeleteSignatoriesRequest(); + deleteSignatoriesRequest.setAccountHolderCode("TestAccountHolder289429"); + deleteSignatoriesRequest.addSignatoryCodesItem("9a2deb52-9832-45eb-8233-9bd8cc3ebb69"); + + DeleteSignatoriesResponse deleteSignatoriesResponse = account.deleteSignatories(deleteSignatoriesRequest); + assertEquals("8516284974139611", deleteSignatoriesResponse.getPspReference()); + assertEquals(1, deleteSignatoriesResponse.getInvalidFields().size()); + assertEquals(137, deleteSignatoriesResponse.getInvalidFields().get(0).getErrorCode().intValue()); + assertEquals("Signatory does not exist for signatoryCode: [9a2deb52-9832-45eb-8233-9bd8cc3ebb69]", deleteSignatoriesResponse.getInvalidFields().get(0).getErrorDescription()); + assertEquals("AccountHolderDetails.BusinessDetails.signatory", deleteSignatoriesResponse.getInvalidFields().get(0).getFieldType().getField()); + assertEquals(FieldType.FieldNameEnum.SIGNATORY, deleteSignatoriesResponse.getInvalidFields().get(0).getFieldType().getFieldName()); + } + @Test public void TestSuspendAccountHolderSuccess() throws Exception { // setup client diff --git a/src/test/resources/mocks/marketpay/account/delete-signatories-error-invalid-fields.json b/src/test/resources/mocks/marketpay/account/delete-signatories-error-invalid-fields.json new file mode 100644 index 000000000..718a69504 --- /dev/null +++ b/src/test/resources/mocks/marketpay/account/delete-signatories-error-invalid-fields.json @@ -0,0 +1,13 @@ +{ + "invalidFields": [ + { + "errorCode": 137, + "errorDescription": "Signatory does not exist for signatoryCode: [9a2deb52-9832-45eb-8233-9bd8cc3ebb69]", + "fieldType": { + "field": "AccountHolderDetails.BusinessDetails.signatory", + "fieldName": "signatory" + } + } + ], + "pspReference": "8516284974139611" +} \ No newline at end of file diff --git a/src/test/resources/mocks/marketpay/account/delete-signatories-success.json b/src/test/resources/mocks/marketpay/account/delete-signatories-success.json new file mode 100644 index 000000000..664b1132a --- /dev/null +++ b/src/test/resources/mocks/marketpay/account/delete-signatories-success.json @@ -0,0 +1,3 @@ +{ + "pspReference": "8516284978974831" +} \ No newline at end of file diff --git a/src/test/resources/mocks/marketpay/notification/account-holder-updated.json b/src/test/resources/mocks/marketpay/notification/account-holder-updated.json index eb4b1e55d..c6f9bb6dc 100644 --- a/src/test/resources/mocks/marketpay/notification/account-holder-updated.json +++ b/src/test/resources/mocks/marketpay/notification/account-holder-updated.json @@ -1,181 +1,257 @@ { - "eventDate": "2018-03-02T10:02:45+01:00", - "eventType": "ACCOUNT_HOLDER_UPDATED", - "executingUserKey": "ws", - "live": "false", - "pspReference": "8515199813653278", - "content": { - "pspReference": "8515199813653278", - "submittedAsync": "false", - "accountHolderCode": "accountHolderCode", - "accountHolderDetails": { - "address": { - "city": "PASSEDCITY", - "country": "GB", - "postalCode": "12345", - "stateOrProvince": "NH", - "street": "Teststreet 1" + "eventDate" : "2021-08-18T14:30:20+02:00", + "eventType" : "ACCOUNT_HOLDER_UPDATED", + "executingUserKey" : "ws_168197", + "live" : false, + "pspReference" : "8616292898086510", + "content" : { + "invalidFields" : [ + ], + "accountHolderCode" : "accountHolderCode", + "accountHolderDetails" : { + "address" : { + "city" : "PASSED", + "country" : "NL", + "houseNumberOrName" : "1", + "postalCode" : "1234AB", + "street" : "Test Street" }, - "bankAccountDetails": [ + "bankAccountDetails" : [ { - "BankAccountDetail": { - "bankAccountUUID": "0c9c8c09-f6cf-4d0f-b4a9-547d2147ac3c", - "bankCity": "PASSED", - "bankName": "testBank", - "countryCode": "GB", - "currencyCode": "EUR", - "iban": "GB26TEST40051512347366", - "ownerCity": "PASSED", - "ownerCountryCode": "NL", - "ownerDateOfBirth": "1980-01-01", - "ownerHouseNumberOrName": "9", - "ownerName": "TestData", - "ownerNationality": "NL", - "ownerPostalCode": "1062HT", - "ownerState": "NL", - "ownerStreet": "street", - "primaryAccount": "true" - } + "bankAccountUUID" : "c50352cc-3c2f-416a-914f-ed8c71444d93", + "countryCode" : "NL", + "currencyCode" : "EUR", + "iban" : "NL13TEST0123456789", + "ownerCity" : "PASSED", + "ownerCountryCode" : "NL", + "ownerName" : "TestData", + "ownerPostalCode" : "1234AB", + "ownerStreet" : "Test Street", + "primaryAccount" : false } ], - "businessDetails": { - "legalBusinessName": "Test company", - "shareholders": [ + "businessDetails" : { + "doingBusinessAs" : "TestData", + "legalBusinessName" : "TestData", + "registrationNumber" : "12345678", + "shareholders" : [ { - "ShareholderContact": { - "email": "test.ah681@adyen.com", - "name": { - "firstName": "Test", - "gender": "MALE", - "lastName": "Test" - }, - "personalData": { - "dateOfBirth": "1970-01-01", - "idNumber": "1234567890", - "nationality": "NL" - }, - "shareholderCode": "6d2d8ba3-751c-4ecc-8777-6bbdcd4053cd" - } + "address" : { + "city" : "PASSED", + "country" : "NL", + "houseNumberOrName" : "2", + "postalCode" : "1234AB", + "street" : "Test Street" + }, + "name" : { + "firstName" : "First", + "gender" : "UNKNOWN", + "lastName" : "TestData" + }, + "personalData" : { + "dateOfBirth" : "1990-01-01" + }, + "shareholderCode" : "7c46d0fc-68e2-435c-bb9f-e8719d9cb3df", + "shareholderType" : "Owner" + }, + { + "address" : { + "city" : "PASSED", + "country" : "NL", + "houseNumberOrName" : "3", + "postalCode" : "1234CD", + "street" : "Test Street" + }, + "name" : { + "firstName" : "Second", + "gender" : "UNKNOWN", + "lastName" : "TestData" + }, + "personalData" : { + "dateOfBirth" : "1985-01-01" + }, + "shareholderCode" : "7a5f505b-76c2-4639-8ee8-dfe41b5c0f2c", + "shareholderType" : "Owner" } - ] + ], + "signatories" : [ + { + "address" : { + "city" : "PASSED", + "country" : "NL", + "houseNumberOrName" : "2", + "postalCode" : "1234AB", + "street" : "Test Street" + }, + "email" : "support@adyen.com", + "fullPhoneNumber" : "+31612345678", + "name" : { + "firstName" : "First", + "gender" : "MALE", + "lastName" : "TestData" + }, + "personalData" : { + "dateOfBirth" : "1990-01-01", + "nationality" : "NL" + }, + "jobTitle" : "Chief Executive Officer", + "signatoryCode" : "591d1886-3cfa-4980-bb3a-228f837a2bb3" + }, + { + "address" : { + "city" : "PASSED", + "country" : "NL", + "houseNumberOrName" : "3", + "postalCode" : "1234AB", + "street" : "Test Street" + }, + "email" : "support@adyen.com", + "fullPhoneNumber" : "+31612345678", + "name" : { + "firstName" : "Second", + "gender" : "MALE", + "lastName" : "TestData" + }, + "personalData" : { + "dateOfBirth" : "1985-01-01", + "nationality" : "NL" + }, + "jobTitle" : "Chief Financial Officer", + "signatoryCode" : "cad47f48-7638-47a1-ae3d-1f0d9d53ddaf" + } + ], + "taxId" : "1234567890" }, - "email": "ah62@adyen.com" + "email" : "support@adyen.com", + "legalArrangements" : [ + ], + "merchantCategoryCode" : "7999", + "payoutMethods" : [ + ], + "phoneNumber" : { + "phoneCountryCode" : "NL", + "phoneNumber" : "******5678", + "phoneType" : "Mobile" + }, + "webAddress" : null }, - "accountHolderStatus": { - "status": "Active", - "processingState": { - "disabled": "false", - "processedFrom": { - "currency": "GBP", - "value": 0 - }, - "processedTo": { - "currency": "GBP", - "value": 0 + "accountHolderStatus" : { + "status" : "Active", + "processingState" : { + "disabled" : false, + "processedFrom" : { + "currency" : "EUR", + "value" : 500000 }, - "tierNumber": 0 + "tierNumber" : 3 }, - "payoutState": { - "allowPayout": "false", - "disabled": "false", - "tierNumber": 0 + "payoutState" : { + "allowPayout" : false, + "disabled" : false }, - "events": [] + "events" : [ + { + "event" : "InactivateAccount", + "executionDate" : "2021-09-17T14:10:19+02:00", + "reason" : "Processed more than EUR 5000.00 or equivalent, deadline triggered" + } + ] }, - "invalidFields": [], - "kycVerificationResults": [ - { - "KYCVerificationResult": { - "accountHolderCode": "ah690", - "checkResults": [ - { - "KYCCheckResult": { - "checkType": "COMPANY_VERIFICATION", - "verificationStatus": "DATA_PROVIDED" - } + "legalEntity" : "Business", + "verification" : { + "accountHolder" : { + "checks" : [ + { + "type" : "COMPANY_VERIFICATION", + "status" : "PASSED", + "summary" : { + } - ], - "verificationStatuses": { - "COMPANY_VERIFICATION": "DATA_PROVIDED" } - } + ] }, - { - "KYCVerificationResult": { - "accountHolderCode": "ah690", - "checkResults": [ + "shareholders" : [ + { + "checks" : [ { - "KYCCheckResult": { - "checkType": "IDENTITY_VERIFICATION", - "verificationStatus": "DATA_PROVIDED" + "type" : "IDENTITY_VERIFICATION", + "status" : "PASSED", + "summary" : { + } }, { - "KYCCheckResult": { - "checkType": "PASSPORT_VERIFICATION", - "verificationStatus": "AWAITING_DATA" - } + "type" : "PASSPORT_VERIFICATION", + "status" : "PASSED" } ], - "shareholderCode": "6d2d8ba3-751c-4ecc-8777-6bbdcd4053cd", - "verificationStatuses": { - "IDENTITY_VERIFICATION": "DATA_PROVIDED", - "PASSPORT_VERIFICATION": "AWAITING_DATA" - } - } - }, - { - "KYCVerificationResult": { - "accountHolderCode": "ah690", - "bankAccountUUID": "0c9c8c09-f6cf-4d0f-b4a9-547d2147ac3c", - "checkResults": [ + "shareholderCode" : "7c46d0fc-68e2-435c-bb9f-e8719d9cb3df" + }, + { + "checks" : [ { - "KYCCheckResult": { - "checkType": "BANK_ACCOUNT_VERIFICATION", - "verificationStatus": "DATA_PROVIDED" + "type" : "IDENTITY_VERIFICATION", + "status" : "PASSED", + "summary" : { + } + }, + { + "type" : "PASSPORT_VERIFICATION", + "status" : "PASSED" } ], - "verificationStatuses": { - "BANK_ACCOUNT_VERIFICATION": "DATA_PROVIDED" - } + "shareholderCode" : "7a5f505b-76c2-4639-8ee8-dfe41b5c0f2c" } - } - ], - "legalEntity": "Business", - "requirementsForNextAccountState": [], - "updatedFields": [], - "verification": { - "accountHolder": { - "checks": [ - { - "type": "COMPANY_VERIFICATION", - "status": "DATA_PROVIDED" - } - ] - }, - "shareholders": [ + ], + "signatories" : [ { - "shareholderCode": "6d2d8ba3-751c-4ecc-8777-6bbdcd4053cd", - "checks": [ + "checks" : [ + { + "type" : "IDENTITY_VERIFICATION", + "status" : "DATA_PROVIDED" + }, { - "type": "IDENTITY_VERIFICATION", - "status": "DATA_PROVIDED" + "type" : "PASSPORT_VERIFICATION", + "status" : "AWAITING_DATA", + "requiredFields" : [ + "AccountHolderDetails.BusinessDetails.Signatories.Document.document" + ] } - ] + ], + "signatoryCode" : "591d1886-3cfa-4980-bb3a-228f837a2bb3" + }, + { + "checks" : [ + { + "type" : "IDENTITY_VERIFICATION", + "status" : "DATA_PROVIDED" + }, + { + "type" : "PASSPORT_VERIFICATION", + "status" : "AWAITING_DATA", + "requiredFields" : [ + "AccountHolderDetails.BusinessDetails.Signatories.Document.document" + ] + } + ], + "signatoryCode" : "cad47f48-7638-47a1-ae3d-1f0d9d53ddaf" } ], - "bankAccounts": [ + "payoutMethods" : [ { - "bankAccountUUID": "0c9c8c09-f6cf-4d0f-b4a9-547d2147ac3c", - "checks": [ + "checks" : [ { - "type": "BANK_ACCOUNT_VERIFICATION", - "status": "DATA_PROVIDED" + "type" : "PAYOUT_METHOD_VERIFICATION", + "status" : "PASSED", + "summary" : { + + } } - ] + ], + "payoutMethodCode" : "c50352cc-3c2f-416a-914f-ed8c71444d93" } ] } } -} +} \ No newline at end of file From f6a11876fe9210370480678fafb5579156f5880a Mon Sep 17 00:00:00 2001 From: Wouter Boereboom <62436079+wboereboom@users.noreply.github.com> Date: Thu, 19 Aug 2021 16:19:26 +0200 Subject: [PATCH 10/10] bump version for release (#605) * bump version for release * bumped library to a new major release --- README.md | 2 +- pom.xml | 2 +- src/main/java/com/adyen/Client.java | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index fe041d2e8..d619b0770 100644 --- a/README.md +++ b/README.md @@ -41,7 +41,7 @@ You can use Maven and add this dependency to your project's POM: com.adyen adyen-java-api-library - 16.0.0 + 17.0.0 ``` diff --git a/pom.xml b/pom.xml index bad354a48..f742a1f94 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.adyen adyen-java-api-library jar - 16.0.0 + 17.0.0 Adyen Java API Library Adyen API Client Library for Java https://github.com/adyen/adyen-java-api-library diff --git a/src/main/java/com/adyen/Client.java b/src/main/java/com/adyen/Client.java index 851b7854e..f47ce92c6 100644 --- a/src/main/java/com/adyen/Client.java +++ b/src/main/java/com/adyen/Client.java @@ -47,7 +47,7 @@ public class Client { public static final String MARKETPAY_NOTIFICATION_API_VERSION = "v6"; public static final String MARKETPAY_HOP_API_VERSION = "v6"; public static final String LIB_NAME = "adyen-java-api-library"; - public static final String LIB_VERSION = "16.0.0"; + public static final String LIB_VERSION = "17.0.0"; public static final String CHECKOUT_ENDPOINT_TEST = "https://checkout-test.adyen.com/checkout"; public static final String CHECKOUT_ENDPOINT_LIVE_SUFFIX = "-checkout-live.adyenpayments.com/checkout"; public static final String CHECKOUT_ENDPOINT_CERT_LIVE = "https://checkoutcert-live-%s.adyen.com/checkout";