From d0be308d77fcd142723b7cb53a703113977a2946 Mon Sep 17 00:00:00 2001 From: AdyenAutomationBot <38424300+AdyenAutomationBot@users.noreply.github.com> Date: Mon, 18 Nov 2024 16:13:38 +0100 Subject: [PATCH] Update all services (#1392) * false[adyen-sdk-automation] automated change * Correct enums (legacy) * Add test for RatePay (using CheckoutBankAccount) * Add TestPaymentWithRiverty --------- Co-authored-by: Beppe Catanese <1771700+gcatanese@users.noreply.github.com> Co-authored-by: gcatanese --- .../model/checkout/CardDetailsRequest.java | 8 +- .../model/checkout/CheckoutBankAccount.java | 531 ++++++++++++++++++ .../model/checkout/CheckoutPaymentMethod.java | 60 +- .../model/checkout/PaymentMethodsRequest.java | 41 +- .../adyen/model/checkout/PaymentRequest.java | 81 ++- .../adyen/model/checkout/RivertyDetails.java | 497 ++++++++++++++++ .../adyen/service/checkout/PaymentsApi.java | 4 +- src/test/java/com/adyen/CheckoutTest.java | 132 +++++ .../checkout/paymentResponseRatepay.json | 8 + .../checkout/paymentResponseRiverty.json | 9 + 10 files changed, 1359 insertions(+), 12 deletions(-) create mode 100644 src/main/java/com/adyen/model/checkout/CheckoutBankAccount.java create mode 100644 src/main/java/com/adyen/model/checkout/RivertyDetails.java create mode 100644 src/test/resources/mocks/checkout/paymentResponseRatepay.json create mode 100644 src/test/resources/mocks/checkout/paymentResponseRiverty.json diff --git a/src/main/java/com/adyen/model/checkout/CardDetailsRequest.java b/src/main/java/com/adyen/model/checkout/CardDetailsRequest.java index 56ed965ac..c3aececbf 100644 --- a/src/main/java/com/adyen/model/checkout/CardDetailsRequest.java +++ b/src/main/java/com/adyen/model/checkout/CardDetailsRequest.java @@ -60,7 +60,7 @@ public CardDetailsRequest() { } /** - * A minimum of the first 8 digits of the card number and a maximum of the full card number. 11 digits gives the best result. You must be [fully PCI compliant](https://docs.adyen.com/development-resources/pci-dss-compliance-guide) to collect raw card data. + * A minimum of the first eight digits of the card number. The full card number gives the best result. You must be [fully PCI compliant](https://docs.adyen.com/development-resources/pci-dss-compliance-guide) to collect raw card data. * * @param cardNumber * @return the current {@code CardDetailsRequest} instance, allowing for method chaining @@ -71,10 +71,10 @@ public CardDetailsRequest cardNumber(String cardNumber) { } /** - * A minimum of the first 8 digits of the card number and a maximum of the full card number. 11 digits gives the best result. You must be [fully PCI compliant](https://docs.adyen.com/development-resources/pci-dss-compliance-guide) to collect raw card data. + * A minimum of the first eight digits of the card number. The full card number gives the best result. You must be [fully PCI compliant](https://docs.adyen.com/development-resources/pci-dss-compliance-guide) to collect raw card data. * @return cardNumber */ - @ApiModelProperty(required = true, value = "A minimum of the first 8 digits of the card number and a maximum of the full card number. 11 digits gives the best result. You must be [fully PCI compliant](https://docs.adyen.com/development-resources/pci-dss-compliance-guide) to collect raw card data.") + @ApiModelProperty(required = true, value = "A minimum of the first eight digits of the card number. The full card number gives the best result. You must be [fully PCI compliant](https://docs.adyen.com/development-resources/pci-dss-compliance-guide) to collect raw card data.") @JsonProperty(JSON_PROPERTY_CARD_NUMBER) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getCardNumber() { @@ -82,7 +82,7 @@ public String getCardNumber() { } /** - * A minimum of the first 8 digits of the card number and a maximum of the full card number. 11 digits gives the best result. You must be [fully PCI compliant](https://docs.adyen.com/development-resources/pci-dss-compliance-guide) to collect raw card data. + * A minimum of the first eight digits of the card number. The full card number gives the best result. You must be [fully PCI compliant](https://docs.adyen.com/development-resources/pci-dss-compliance-guide) to collect raw card data. * * @param cardNumber */ diff --git a/src/main/java/com/adyen/model/checkout/CheckoutBankAccount.java b/src/main/java/com/adyen/model/checkout/CheckoutBankAccount.java new file mode 100644 index 000000000..bc1a45929 --- /dev/null +++ b/src/main/java/com/adyen/model/checkout/CheckoutBankAccount.java @@ -0,0 +1,531 @@ +/* + * Adyen Checkout API + * + * The version of the OpenAPI document: 71 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.adyen.model.checkout; + +import java.util.Objects; +import java.util.Arrays; +import java.util.Map; +import java.util.HashMap; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.core.JsonProcessingException; + + +/** + * CheckoutBankAccount + */ +@JsonPropertyOrder({ + CheckoutBankAccount.JSON_PROPERTY_ACCOUNT_TYPE, + CheckoutBankAccount.JSON_PROPERTY_BANK_ACCOUNT_NUMBER, + CheckoutBankAccount.JSON_PROPERTY_BANK_CITY, + CheckoutBankAccount.JSON_PROPERTY_BANK_LOCATION_ID, + CheckoutBankAccount.JSON_PROPERTY_BANK_NAME, + CheckoutBankAccount.JSON_PROPERTY_BIC, + CheckoutBankAccount.JSON_PROPERTY_COUNTRY_CODE, + CheckoutBankAccount.JSON_PROPERTY_IBAN, + CheckoutBankAccount.JSON_PROPERTY_OWNER_NAME, + CheckoutBankAccount.JSON_PROPERTY_TAX_ID +}) + +public class CheckoutBankAccount { + /** + * The type of the bank account. + */ + public enum AccountTypeEnum { + BALANCE("balance"), + + CHECKING("checking"), + + DEPOSIT("deposit"), + + GENERAL("general"), + + OTHER("other"), + + PAYMENT("payment"), + + SAVINGS("savings"); + + private String value; + + AccountTypeEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static AccountTypeEnum fromValue(String value) { + for (AccountTypeEnum b : AccountTypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_ACCOUNT_TYPE = "accountType"; + private AccountTypeEnum accountType; + + public static final String JSON_PROPERTY_BANK_ACCOUNT_NUMBER = "bankAccountNumber"; + private String bankAccountNumber; + + public static final String JSON_PROPERTY_BANK_CITY = "bankCity"; + private String bankCity; + + public static final String JSON_PROPERTY_BANK_LOCATION_ID = "bankLocationId"; + private String bankLocationId; + + public static final String JSON_PROPERTY_BANK_NAME = "bankName"; + private String bankName; + + public static final String JSON_PROPERTY_BIC = "bic"; + private String bic; + + public static final String JSON_PROPERTY_COUNTRY_CODE = "countryCode"; + private String countryCode; + + public static final String JSON_PROPERTY_IBAN = "iban"; + private String iban; + + public static final String JSON_PROPERTY_OWNER_NAME = "ownerName"; + private String ownerName; + + public static final String JSON_PROPERTY_TAX_ID = "taxId"; + private String taxId; + + public CheckoutBankAccount() { + } + + /** + * The type of the bank account. + * + * @param accountType + * @return the current {@code CheckoutBankAccount} instance, allowing for method chaining + */ + public CheckoutBankAccount accountType(AccountTypeEnum accountType) { + this.accountType = accountType; + return this; + } + + /** + * The type of the bank account. + * @return accountType + */ + @ApiModelProperty(value = "The type of the bank account.") + @JsonProperty(JSON_PROPERTY_ACCOUNT_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public AccountTypeEnum getAccountType() { + return accountType; + } + + /** + * The type of the bank account. + * + * @param accountType + */ + @JsonProperty(JSON_PROPERTY_ACCOUNT_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setAccountType(AccountTypeEnum accountType) { + this.accountType = accountType; + } + + /** + * The bank account number (without separators). + * + * @param bankAccountNumber + * @return the current {@code CheckoutBankAccount} instance, allowing for method chaining + */ + public CheckoutBankAccount bankAccountNumber(String bankAccountNumber) { + this.bankAccountNumber = bankAccountNumber; + return this; + } + + /** + * The bank account number (without separators). + * @return bankAccountNumber + */ + @ApiModelProperty(value = "The bank account number (without separators).") + @JsonProperty(JSON_PROPERTY_BANK_ACCOUNT_NUMBER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getBankAccountNumber() { + return bankAccountNumber; + } + + /** + * The bank account number (without separators). + * + * @param bankAccountNumber + */ + @JsonProperty(JSON_PROPERTY_BANK_ACCOUNT_NUMBER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setBankAccountNumber(String bankAccountNumber) { + this.bankAccountNumber = bankAccountNumber; + } + + /** + * The bank city. + * + * @param bankCity + * @return the current {@code CheckoutBankAccount} instance, allowing for method chaining + */ + public CheckoutBankAccount bankCity(String bankCity) { + this.bankCity = bankCity; + return this; + } + + /** + * The bank city. + * @return bankCity + */ + @ApiModelProperty(value = "The bank city.") + @JsonProperty(JSON_PROPERTY_BANK_CITY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getBankCity() { + return bankCity; + } + + /** + * The bank city. + * + * @param bankCity + */ + @JsonProperty(JSON_PROPERTY_BANK_CITY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setBankCity(String bankCity) { + this.bankCity = bankCity; + } + + /** + * The location id of the bank. The field value is `nil` in most cases. + * + * @param bankLocationId + * @return the current {@code CheckoutBankAccount} instance, allowing for method chaining + */ + public CheckoutBankAccount bankLocationId(String bankLocationId) { + this.bankLocationId = bankLocationId; + return this; + } + + /** + * The location id of the bank. The field value is `nil` in most cases. + * @return bankLocationId + */ + @ApiModelProperty(value = "The location id of the bank. The field value is `nil` in most cases.") + @JsonProperty(JSON_PROPERTY_BANK_LOCATION_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getBankLocationId() { + return bankLocationId; + } + + /** + * The location id of the bank. The field value is `nil` in most cases. + * + * @param bankLocationId + */ + @JsonProperty(JSON_PROPERTY_BANK_LOCATION_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setBankLocationId(String bankLocationId) { + this.bankLocationId = bankLocationId; + } + + /** + * The name of the bank. + * + * @param bankName + * @return the current {@code CheckoutBankAccount} instance, allowing for method chaining + */ + public CheckoutBankAccount bankName(String bankName) { + this.bankName = bankName; + return this; + } + + /** + * The name of the bank. + * @return bankName + */ + @ApiModelProperty(value = "The name of the bank.") + @JsonProperty(JSON_PROPERTY_BANK_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getBankName() { + return bankName; + } + + /** + * The name of the bank. + * + * @param bankName + */ + @JsonProperty(JSON_PROPERTY_BANK_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setBankName(String bankName) { + this.bankName = bankName; + } + + /** + * The [Business Identifier Code](https://en.wikipedia.org/wiki/ISO_9362) (BIC) is the SWIFT address assigned to a bank. The field value is `nil` in most cases. + * + * @param bic + * @return the current {@code CheckoutBankAccount} instance, allowing for method chaining + */ + public CheckoutBankAccount bic(String bic) { + this.bic = bic; + return this; + } + + /** + * The [Business Identifier Code](https://en.wikipedia.org/wiki/ISO_9362) (BIC) is the SWIFT address assigned to a bank. The field value is `nil` in most cases. + * @return bic + */ + @ApiModelProperty(value = "The [Business Identifier Code](https://en.wikipedia.org/wiki/ISO_9362) (BIC) is the SWIFT address assigned to a bank. The field value is `nil` in most cases.") + @JsonProperty(JSON_PROPERTY_BIC) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getBic() { + return bic; + } + + /** + * The [Business Identifier Code](https://en.wikipedia.org/wiki/ISO_9362) (BIC) is the SWIFT address assigned to a bank. The field value is `nil` in most cases. + * + * @param bic + */ + @JsonProperty(JSON_PROPERTY_BIC) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setBic(String bic) { + this.bic = bic; + } + + /** + * Country code where the bank is located. A valid value is an ISO two-character country code (e.g. 'NL'). + * + * @param countryCode + * @return the current {@code CheckoutBankAccount} instance, allowing for method chaining + */ + public CheckoutBankAccount countryCode(String countryCode) { + this.countryCode = countryCode; + return this; + } + + /** + * Country code where the bank is located. A valid value is an ISO two-character country code (e.g. 'NL'). + * @return countryCode + */ + @ApiModelProperty(value = "Country code where the bank is located. A valid value is an ISO two-character country code (e.g. 'NL').") + @JsonProperty(JSON_PROPERTY_COUNTRY_CODE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getCountryCode() { + return countryCode; + } + + /** + * Country code where the bank is located. A valid value is an ISO two-character country code (e.g. 'NL'). + * + * @param countryCode + */ + @JsonProperty(JSON_PROPERTY_COUNTRY_CODE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setCountryCode(String countryCode) { + this.countryCode = countryCode; + } + + /** + * The [International Bank Account Number](https://en.wikipedia.org/wiki/International_Bank_Account_Number) (IBAN). + * + * @param iban + * @return the current {@code CheckoutBankAccount} instance, allowing for method chaining + */ + public CheckoutBankAccount iban(String iban) { + this.iban = iban; + return this; + } + + /** + * The [International Bank Account Number](https://en.wikipedia.org/wiki/International_Bank_Account_Number) (IBAN). + * @return iban + */ + @ApiModelProperty(value = "The [International Bank Account Number](https://en.wikipedia.org/wiki/International_Bank_Account_Number) (IBAN).") + @JsonProperty(JSON_PROPERTY_IBAN) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getIban() { + return iban; + } + + /** + * The [International Bank Account Number](https://en.wikipedia.org/wiki/International_Bank_Account_Number) (IBAN). + * + * @param iban + */ + @JsonProperty(JSON_PROPERTY_IBAN) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setIban(String iban) { + this.iban = iban; + } + + /** + * The name of the bank account holder. If you submit a name with non-Latin characters, we automatically replace some of them with corresponding Latin characters to meet the FATF recommendations. For example: * χ12 is converted to ch12. * üA is converted to euA. * Peter Møller is converted to Peter Mller, because banks don't accept 'ø'. After replacement, the ownerName must have at least three alphanumeric characters (A-Z, a-z, 0-9), and at least one of them must be a valid Latin character (A-Z, a-z). For example: * John17 - allowed. * J17 - allowed. * 171 - not allowed. * John-7 - allowed. > If provided details don't match the required format, the response returns the error message: 203 'Invalid bank account holder name'. + * + * @param ownerName + * @return the current {@code CheckoutBankAccount} instance, allowing for method chaining + */ + public CheckoutBankAccount ownerName(String ownerName) { + this.ownerName = ownerName; + return this; + } + + /** + * The name of the bank account holder. If you submit a name with non-Latin characters, we automatically replace some of them with corresponding Latin characters to meet the FATF recommendations. For example: * χ12 is converted to ch12. * üA is converted to euA. * Peter Møller is converted to Peter Mller, because banks don't accept 'ø'. After replacement, the ownerName must have at least three alphanumeric characters (A-Z, a-z, 0-9), and at least one of them must be a valid Latin character (A-Z, a-z). For example: * John17 - allowed. * J17 - allowed. * 171 - not allowed. * John-7 - allowed. > If provided details don't match the required format, the response returns the error message: 203 'Invalid bank account holder name'. + * @return ownerName + */ + @ApiModelProperty(value = "The name of the bank account holder. If you submit a name with non-Latin characters, we automatically replace some of them with corresponding Latin characters to meet the FATF recommendations. For example: * χ12 is converted to ch12. * üA is converted to euA. * Peter Møller is converted to Peter Mller, because banks don't accept 'ø'. After replacement, the ownerName must have at least three alphanumeric characters (A-Z, a-z, 0-9), and at least one of them must be a valid Latin character (A-Z, a-z). For example: * John17 - allowed. * J17 - allowed. * 171 - not allowed. * John-7 - allowed. > If provided details don't match the required format, the response returns the error message: 203 'Invalid bank account holder name'.") + @JsonProperty(JSON_PROPERTY_OWNER_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getOwnerName() { + return ownerName; + } + + /** + * The name of the bank account holder. If you submit a name with non-Latin characters, we automatically replace some of them with corresponding Latin characters to meet the FATF recommendations. For example: * χ12 is converted to ch12. * üA is converted to euA. * Peter Møller is converted to Peter Mller, because banks don't accept 'ø'. After replacement, the ownerName must have at least three alphanumeric characters (A-Z, a-z, 0-9), and at least one of them must be a valid Latin character (A-Z, a-z). For example: * John17 - allowed. * J17 - allowed. * 171 - not allowed. * John-7 - allowed. > If provided details don't match the required format, the response returns the error message: 203 'Invalid bank account holder name'. + * + * @param ownerName + */ + @JsonProperty(JSON_PROPERTY_OWNER_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setOwnerName(String ownerName) { + this.ownerName = ownerName; + } + + /** + * The bank account holder's tax ID. + * + * @param taxId + * @return the current {@code CheckoutBankAccount} instance, allowing for method chaining + */ + public CheckoutBankAccount taxId(String taxId) { + this.taxId = taxId; + return this; + } + + /** + * The bank account holder's tax ID. + * @return taxId + */ + @ApiModelProperty(value = "The bank account holder's tax ID.") + @JsonProperty(JSON_PROPERTY_TAX_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getTaxId() { + return taxId; + } + + /** + * The bank account holder's tax ID. + * + * @param taxId + */ + @JsonProperty(JSON_PROPERTY_TAX_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setTaxId(String taxId) { + this.taxId = taxId; + } + + /** + * Return true if this CheckoutBankAccount object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CheckoutBankAccount checkoutBankAccount = (CheckoutBankAccount) o; + return Objects.equals(this.accountType, checkoutBankAccount.accountType) && + Objects.equals(this.bankAccountNumber, checkoutBankAccount.bankAccountNumber) && + Objects.equals(this.bankCity, checkoutBankAccount.bankCity) && + Objects.equals(this.bankLocationId, checkoutBankAccount.bankLocationId) && + Objects.equals(this.bankName, checkoutBankAccount.bankName) && + Objects.equals(this.bic, checkoutBankAccount.bic) && + Objects.equals(this.countryCode, checkoutBankAccount.countryCode) && + Objects.equals(this.iban, checkoutBankAccount.iban) && + Objects.equals(this.ownerName, checkoutBankAccount.ownerName) && + Objects.equals(this.taxId, checkoutBankAccount.taxId); + } + + @Override + public int hashCode() { + return Objects.hash(accountType, bankAccountNumber, bankCity, bankLocationId, bankName, bic, countryCode, iban, ownerName, taxId); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CheckoutBankAccount {\n"); + sb.append(" accountType: ").append(toIndentedString(accountType)).append("\n"); + sb.append(" bankAccountNumber: ").append(toIndentedString(bankAccountNumber)).append("\n"); + sb.append(" bankCity: ").append(toIndentedString(bankCity)).append("\n"); + sb.append(" bankLocationId: ").append(toIndentedString(bankLocationId)).append("\n"); + sb.append(" bankName: ").append(toIndentedString(bankName)).append("\n"); + sb.append(" bic: ").append(toIndentedString(bic)).append("\n"); + sb.append(" countryCode: ").append(toIndentedString(countryCode)).append("\n"); + sb.append(" iban: ").append(toIndentedString(iban)).append("\n"); + sb.append(" ownerName: ").append(toIndentedString(ownerName)).append("\n"); + sb.append(" taxId: ").append(toIndentedString(taxId)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +/** + * Create an instance of CheckoutBankAccount given an JSON string + * + * @param jsonString JSON string + * @return An instance of CheckoutBankAccount + * @throws JsonProcessingException if the JSON string is invalid with respect to CheckoutBankAccount + */ + public static CheckoutBankAccount fromJson(String jsonString) throws JsonProcessingException { + return JSON.getMapper().readValue(jsonString, CheckoutBankAccount.class); + } +/** + * Convert an instance of CheckoutBankAccount to an JSON string + * + * @return JSON string + */ + public String toJson() throws JsonProcessingException { + return JSON.getMapper().writeValueAsString(this); + } +} diff --git a/src/main/java/com/adyen/model/checkout/CheckoutPaymentMethod.java b/src/main/java/com/adyen/model/checkout/CheckoutPaymentMethod.java index f3dd28588..f79e1753d 100644 --- a/src/main/java/com/adyen/model/checkout/CheckoutPaymentMethod.java +++ b/src/main/java/com/adyen/model/checkout/CheckoutPaymentMethod.java @@ -52,6 +52,7 @@ import com.adyen.model.checkout.PayWithGoogleDetails; import com.adyen.model.checkout.PaymentDetails; import com.adyen.model.checkout.RatepayDetails; +import com.adyen.model.checkout.RivertyDetails; import com.adyen.model.checkout.SamsungPayDetails; import com.adyen.model.checkout.SepaDirectDebitDetails; import com.adyen.model.checkout.StoredPaymentMethodDetails; @@ -1147,6 +1148,34 @@ public CheckoutPaymentMethod deserialize(JsonParser jp, DeserializationContext c } + // deserialize RivertyDetails + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (RivertyDetails.class.equals(Integer.class) || RivertyDetails.class.equals(Long.class) || RivertyDetails.class.equals(Float.class) || RivertyDetails.class.equals(Double.class) || RivertyDetails.class.equals(Boolean.class) || RivertyDetails.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= ((RivertyDetails.class.equals(Integer.class) || RivertyDetails.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= ((RivertyDetails.class.equals(Float.class) || RivertyDetails.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT); + attemptParsing |= (RivertyDetails.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= (RivertyDetails.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + // Checks if the unique type of the oneOf json matches any of the object TypeEnum values + boolean typeMatch = Arrays.stream(RivertyDetails.TypeEnum.values()).anyMatch((t) -> t.getValue().contains(tree.findValue("type").asText())); + if (attemptParsing || typeMatch) { + // Strict deserialization for oneOf models + deserialized = JSON.getMapper().readValue(tree.toString(), RivertyDetails.class); + // typeMatch should enforce proper deserialization + match++; + log.log(Level.FINER, "Input data matches schema 'RivertyDetails'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'RivertyDetails'", e); + } + + // deserialize SamsungPayDetails try { boolean attemptParsing = true; @@ -1664,6 +1693,11 @@ public CheckoutPaymentMethod(RatepayDetails o) { setActualInstance(o); } + public CheckoutPaymentMethod(RivertyDetails o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + public CheckoutPaymentMethod(SamsungPayDetails o) { super("oneOf", Boolean.FALSE); setActualInstance(o); @@ -1792,6 +1826,8 @@ public CheckoutPaymentMethod(ZipDetails o) { }); schemas.put("RatepayDetails", new GenericType() { }); + schemas.put("RivertyDetails", new GenericType() { + }); schemas.put("SamsungPayDetails", new GenericType() { }); schemas.put("SepaDirectDebitDetails", new GenericType() { @@ -1825,7 +1861,7 @@ public Map getSchemas() { /** * Set the instance that matches the oneOf child schema, check * the instance parameter is valid against the oneOf child schemas: - * AchDetails, AfterpayDetails, AmazonPayDetails, AncvDetails, AndroidPayDetails, ApplePayDetails, BacsDirectDebitDetails, BillDeskDetails, BlikDetails, CardDetails, CashAppDetails, CellulantDetails, DokuDetails, DotpayDetails, DragonpayDetails, EBankingFinlandDetails, EcontextVoucherDetails, EftDetails, GenericIssuerPaymentMethodDetails, GiropayDetails, GooglePayDetails, IdealDetails, KlarnaDetails, MasterpassDetails, MbwayDetails, MobilePayDetails, MolPayDetails, OpenInvoiceDetails, PayByBankAISDirectDebitDetails, PayByBankDetails, PayPalDetails, PayToDetails, PayUUpiDetails, PayWithGoogleDetails, PaymentDetails, RatepayDetails, SamsungPayDetails, SepaDirectDebitDetails, StoredPaymentMethodDetails, TwintDetails, UpiCollectDetails, UpiIntentDetails, VippsDetails, VisaCheckoutDetails, WeChatPayDetails, WeChatPayMiniProgramDetails, ZipDetails + * AchDetails, AfterpayDetails, AmazonPayDetails, AncvDetails, AndroidPayDetails, ApplePayDetails, BacsDirectDebitDetails, BillDeskDetails, BlikDetails, CardDetails, CashAppDetails, CellulantDetails, DokuDetails, DotpayDetails, DragonpayDetails, EBankingFinlandDetails, EcontextVoucherDetails, EftDetails, GenericIssuerPaymentMethodDetails, GiropayDetails, GooglePayDetails, IdealDetails, KlarnaDetails, MasterpassDetails, MbwayDetails, MobilePayDetails, MolPayDetails, OpenInvoiceDetails, PayByBankAISDirectDebitDetails, PayByBankDetails, PayPalDetails, PayToDetails, PayUUpiDetails, PayWithGoogleDetails, PaymentDetails, RatepayDetails, RivertyDetails, SamsungPayDetails, SepaDirectDebitDetails, StoredPaymentMethodDetails, TwintDetails, UpiCollectDetails, UpiIntentDetails, VippsDetails, VisaCheckoutDetails, WeChatPayDetails, WeChatPayMiniProgramDetails, ZipDetails * * It could be an instance of the 'oneOf' schemas. * The oneOf child schemas may themselves be a composed schema (allOf, anyOf, oneOf). @@ -2012,6 +2048,11 @@ public void setActualInstance(Object instance) { return; } + if (JSON.isInstanceOf(RivertyDetails.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + if (JSON.isInstanceOf(SamsungPayDetails.class, instance, new HashSet>())) { super.setActualInstance(instance); return; @@ -2067,14 +2108,14 @@ public void setActualInstance(Object instance) { return; } - throw new RuntimeException("Invalid instance type. Must be AchDetails, AfterpayDetails, AmazonPayDetails, AncvDetails, AndroidPayDetails, ApplePayDetails, BacsDirectDebitDetails, BillDeskDetails, BlikDetails, CardDetails, CashAppDetails, CellulantDetails, DokuDetails, DotpayDetails, DragonpayDetails, EBankingFinlandDetails, EcontextVoucherDetails, EftDetails, GenericIssuerPaymentMethodDetails, GiropayDetails, GooglePayDetails, IdealDetails, KlarnaDetails, MasterpassDetails, MbwayDetails, MobilePayDetails, MolPayDetails, OpenInvoiceDetails, PayByBankAISDirectDebitDetails, PayByBankDetails, PayPalDetails, PayToDetails, PayUUpiDetails, PayWithGoogleDetails, PaymentDetails, RatepayDetails, SamsungPayDetails, SepaDirectDebitDetails, StoredPaymentMethodDetails, TwintDetails, UpiCollectDetails, UpiIntentDetails, VippsDetails, VisaCheckoutDetails, WeChatPayDetails, WeChatPayMiniProgramDetails, ZipDetails"); + throw new RuntimeException("Invalid instance type. Must be AchDetails, AfterpayDetails, AmazonPayDetails, AncvDetails, AndroidPayDetails, ApplePayDetails, BacsDirectDebitDetails, BillDeskDetails, BlikDetails, CardDetails, CashAppDetails, CellulantDetails, DokuDetails, DotpayDetails, DragonpayDetails, EBankingFinlandDetails, EcontextVoucherDetails, EftDetails, GenericIssuerPaymentMethodDetails, GiropayDetails, GooglePayDetails, IdealDetails, KlarnaDetails, MasterpassDetails, MbwayDetails, MobilePayDetails, MolPayDetails, OpenInvoiceDetails, PayByBankAISDirectDebitDetails, PayByBankDetails, PayPalDetails, PayToDetails, PayUUpiDetails, PayWithGoogleDetails, PaymentDetails, RatepayDetails, RivertyDetails, SamsungPayDetails, SepaDirectDebitDetails, StoredPaymentMethodDetails, TwintDetails, UpiCollectDetails, UpiIntentDetails, VippsDetails, VisaCheckoutDetails, WeChatPayDetails, WeChatPayMiniProgramDetails, ZipDetails"); } /** * Get the actual instance, which can be the following: - * AchDetails, AfterpayDetails, AmazonPayDetails, AncvDetails, AndroidPayDetails, ApplePayDetails, BacsDirectDebitDetails, BillDeskDetails, BlikDetails, CardDetails, CashAppDetails, CellulantDetails, DokuDetails, DotpayDetails, DragonpayDetails, EBankingFinlandDetails, EcontextVoucherDetails, EftDetails, GenericIssuerPaymentMethodDetails, GiropayDetails, GooglePayDetails, IdealDetails, KlarnaDetails, MasterpassDetails, MbwayDetails, MobilePayDetails, MolPayDetails, OpenInvoiceDetails, PayByBankAISDirectDebitDetails, PayByBankDetails, PayPalDetails, PayToDetails, PayUUpiDetails, PayWithGoogleDetails, PaymentDetails, RatepayDetails, SamsungPayDetails, SepaDirectDebitDetails, StoredPaymentMethodDetails, TwintDetails, UpiCollectDetails, UpiIntentDetails, VippsDetails, VisaCheckoutDetails, WeChatPayDetails, WeChatPayMiniProgramDetails, ZipDetails + * AchDetails, AfterpayDetails, AmazonPayDetails, AncvDetails, AndroidPayDetails, ApplePayDetails, BacsDirectDebitDetails, BillDeskDetails, BlikDetails, CardDetails, CashAppDetails, CellulantDetails, DokuDetails, DotpayDetails, DragonpayDetails, EBankingFinlandDetails, EcontextVoucherDetails, EftDetails, GenericIssuerPaymentMethodDetails, GiropayDetails, GooglePayDetails, IdealDetails, KlarnaDetails, MasterpassDetails, MbwayDetails, MobilePayDetails, MolPayDetails, OpenInvoiceDetails, PayByBankAISDirectDebitDetails, PayByBankDetails, PayPalDetails, PayToDetails, PayUUpiDetails, PayWithGoogleDetails, PaymentDetails, RatepayDetails, RivertyDetails, SamsungPayDetails, SepaDirectDebitDetails, StoredPaymentMethodDetails, TwintDetails, UpiCollectDetails, UpiIntentDetails, VippsDetails, VisaCheckoutDetails, WeChatPayDetails, WeChatPayMiniProgramDetails, ZipDetails * - * @return The actual instance (AchDetails, AfterpayDetails, AmazonPayDetails, AncvDetails, AndroidPayDetails, ApplePayDetails, BacsDirectDebitDetails, BillDeskDetails, BlikDetails, CardDetails, CashAppDetails, CellulantDetails, DokuDetails, DotpayDetails, DragonpayDetails, EBankingFinlandDetails, EcontextVoucherDetails, EftDetails, GenericIssuerPaymentMethodDetails, GiropayDetails, GooglePayDetails, IdealDetails, KlarnaDetails, MasterpassDetails, MbwayDetails, MobilePayDetails, MolPayDetails, OpenInvoiceDetails, PayByBankAISDirectDebitDetails, PayByBankDetails, PayPalDetails, PayToDetails, PayUUpiDetails, PayWithGoogleDetails, PaymentDetails, RatepayDetails, SamsungPayDetails, SepaDirectDebitDetails, StoredPaymentMethodDetails, TwintDetails, UpiCollectDetails, UpiIntentDetails, VippsDetails, VisaCheckoutDetails, WeChatPayDetails, WeChatPayMiniProgramDetails, ZipDetails) + * @return The actual instance (AchDetails, AfterpayDetails, AmazonPayDetails, AncvDetails, AndroidPayDetails, ApplePayDetails, BacsDirectDebitDetails, BillDeskDetails, BlikDetails, CardDetails, CashAppDetails, CellulantDetails, DokuDetails, DotpayDetails, DragonpayDetails, EBankingFinlandDetails, EcontextVoucherDetails, EftDetails, GenericIssuerPaymentMethodDetails, GiropayDetails, GooglePayDetails, IdealDetails, KlarnaDetails, MasterpassDetails, MbwayDetails, MobilePayDetails, MolPayDetails, OpenInvoiceDetails, PayByBankAISDirectDebitDetails, PayByBankDetails, PayPalDetails, PayToDetails, PayUUpiDetails, PayWithGoogleDetails, PaymentDetails, RatepayDetails, RivertyDetails, SamsungPayDetails, SepaDirectDebitDetails, StoredPaymentMethodDetails, TwintDetails, UpiCollectDetails, UpiIntentDetails, VippsDetails, VisaCheckoutDetails, WeChatPayDetails, WeChatPayMiniProgramDetails, ZipDetails) */ @Override public Object getActualInstance() { @@ -2477,6 +2518,17 @@ public RatepayDetails getRatepayDetails() throws ClassCastException { return (RatepayDetails)super.getActualInstance(); } + /** + * Get the actual instance of `RivertyDetails`. If the actual instance is not `RivertyDetails`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `RivertyDetails` + * @throws ClassCastException if the instance is not `RivertyDetails` + */ + public RivertyDetails getRivertyDetails() throws ClassCastException { + return (RivertyDetails)super.getActualInstance(); + } + /** * Get the actual instance of `SamsungPayDetails`. If the actual instance is not `SamsungPayDetails`, * the ClassCastException will be thrown. diff --git a/src/main/java/com/adyen/model/checkout/PaymentMethodsRequest.java b/src/main/java/com/adyen/model/checkout/PaymentMethodsRequest.java index 1438dfb75..de0bdc49a 100644 --- a/src/main/java/com/adyen/model/checkout/PaymentMethodsRequest.java +++ b/src/main/java/com/adyen/model/checkout/PaymentMethodsRequest.java @@ -45,6 +45,7 @@ PaymentMethodsRequest.JSON_PROPERTY_COUNTRY_CODE, PaymentMethodsRequest.JSON_PROPERTY_MERCHANT_ACCOUNT, PaymentMethodsRequest.JSON_PROPERTY_ORDER, + PaymentMethodsRequest.JSON_PROPERTY_SHOPPER_CONVERSION_ID, PaymentMethodsRequest.JSON_PROPERTY_SHOPPER_LOCALE, PaymentMethodsRequest.JSON_PROPERTY_SHOPPER_REFERENCE, PaymentMethodsRequest.JSON_PROPERTY_SPLIT_CARD_FUNDING_SOURCES, @@ -114,6 +115,9 @@ public static ChannelEnum fromValue(String value) { public static final String JSON_PROPERTY_ORDER = "order"; private EncryptedOrderData order; + public static final String JSON_PROPERTY_SHOPPER_CONVERSION_ID = "shopperConversionId"; + private String shopperConversionId; + public static final String JSON_PROPERTY_SHOPPER_LOCALE = "shopperLocale"; private String shopperLocale; @@ -457,6 +461,39 @@ public void setOrder(EncryptedOrderData order) { this.order = order; } + /** + * A unique ID that can be used to associate `/paymentMethods` and `/payments` requests with the same shopper transaction, offering insights into conversion rates. + * + * @param shopperConversionId + * @return the current {@code PaymentMethodsRequest} instance, allowing for method chaining + */ + public PaymentMethodsRequest shopperConversionId(String shopperConversionId) { + this.shopperConversionId = shopperConversionId; + return this; + } + + /** + * A unique ID that can be used to associate `/paymentMethods` and `/payments` requests with the same shopper transaction, offering insights into conversion rates. + * @return shopperConversionId + */ + @ApiModelProperty(value = "A unique ID that can be used to associate `/paymentMethods` and `/payments` requests with the same shopper transaction, offering insights into conversion rates.") + @JsonProperty(JSON_PROPERTY_SHOPPER_CONVERSION_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getShopperConversionId() { + return shopperConversionId; + } + + /** + * A unique ID that can be used to associate `/paymentMethods` and `/payments` requests with the same shopper transaction, offering insights into conversion rates. + * + * @param shopperConversionId + */ + @JsonProperty(JSON_PROPERTY_SHOPPER_CONVERSION_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setShopperConversionId(String shopperConversionId) { + this.shopperConversionId = shopperConversionId; + } + /** * The combination of a language code and a country code to specify the language to be used in the payment. * @@ -642,6 +679,7 @@ public boolean equals(Object o) { Objects.equals(this.countryCode, paymentMethodsRequest.countryCode) && Objects.equals(this.merchantAccount, paymentMethodsRequest.merchantAccount) && Objects.equals(this.order, paymentMethodsRequest.order) && + Objects.equals(this.shopperConversionId, paymentMethodsRequest.shopperConversionId) && Objects.equals(this.shopperLocale, paymentMethodsRequest.shopperLocale) && Objects.equals(this.shopperReference, paymentMethodsRequest.shopperReference) && Objects.equals(this.splitCardFundingSources, paymentMethodsRequest.splitCardFundingSources) && @@ -651,7 +689,7 @@ public boolean equals(Object o) { @Override public int hashCode() { - return Objects.hash(additionalData, allowedPaymentMethods, amount, blockedPaymentMethods, channel, countryCode, merchantAccount, order, shopperLocale, shopperReference, splitCardFundingSources, store, storeFiltrationMode); + return Objects.hash(additionalData, allowedPaymentMethods, amount, blockedPaymentMethods, channel, countryCode, merchantAccount, order, shopperConversionId, shopperLocale, shopperReference, splitCardFundingSources, store, storeFiltrationMode); } @Override @@ -666,6 +704,7 @@ public String toString() { sb.append(" countryCode: ").append(toIndentedString(countryCode)).append("\n"); sb.append(" merchantAccount: ").append(toIndentedString(merchantAccount)).append("\n"); sb.append(" order: ").append(toIndentedString(order)).append("\n"); + sb.append(" shopperConversionId: ").append(toIndentedString(shopperConversionId)).append("\n"); sb.append(" shopperLocale: ").append(toIndentedString(shopperLocale)).append("\n"); sb.append(" shopperReference: ").append(toIndentedString(shopperReference)).append("\n"); sb.append(" splitCardFundingSources: ").append(toIndentedString(splitCardFundingSources)).append("\n"); diff --git a/src/main/java/com/adyen/model/checkout/PaymentRequest.java b/src/main/java/com/adyen/model/checkout/PaymentRequest.java index d65689a45..b1530598a 100644 --- a/src/main/java/com/adyen/model/checkout/PaymentRequest.java +++ b/src/main/java/com/adyen/model/checkout/PaymentRequest.java @@ -22,6 +22,7 @@ import com.adyen.model.checkout.AuthenticationData; import com.adyen.model.checkout.BillingAddress; import com.adyen.model.checkout.BrowserInfo; +import com.adyen.model.checkout.CheckoutBankAccount; import com.adyen.model.checkout.CheckoutPaymentMethod; import com.adyen.model.checkout.Company; import com.adyen.model.checkout.DeliveryAddress; @@ -66,6 +67,7 @@ PaymentRequest.JSON_PROPERTY_AMOUNT, PaymentRequest.JSON_PROPERTY_APPLICATION_INFO, PaymentRequest.JSON_PROPERTY_AUTHENTICATION_DATA, + PaymentRequest.JSON_PROPERTY_BANK_ACCOUNT, PaymentRequest.JSON_PROPERTY_BILLING_ADDRESS, PaymentRequest.JSON_PROPERTY_BROWSER_INFO, PaymentRequest.JSON_PROPERTY_CAPTURE_DELAY_HOURS, @@ -112,6 +114,7 @@ PaymentRequest.JSON_PROPERTY_RETURN_URL, PaymentRequest.JSON_PROPERTY_RISK_DATA, PaymentRequest.JSON_PROPERTY_SESSION_VALIDITY, + PaymentRequest.JSON_PROPERTY_SHOPPER_CONVERSION_ID, PaymentRequest.JSON_PROPERTY_SHOPPER_EMAIL, PaymentRequest.JSON_PROPERTY_SHOPPER_I_P, PaymentRequest.JSON_PROPERTY_SHOPPER_INTERACTION, @@ -149,6 +152,9 @@ public class PaymentRequest { public static final String JSON_PROPERTY_AUTHENTICATION_DATA = "authenticationData"; private AuthenticationData authenticationData; + public static final String JSON_PROPERTY_BANK_ACCOUNT = "bankAccount"; + private CheckoutBankAccount bankAccount; + public static final String JSON_PROPERTY_BILLING_ADDRESS = "billingAddress"; private BillingAddress billingAddress; @@ -435,6 +441,9 @@ public static RecurringProcessingModelEnum fromValue(String value) { public static final String JSON_PROPERTY_SESSION_VALIDITY = "sessionValidity"; private String sessionValidity; + public static final String JSON_PROPERTY_SHOPPER_CONVERSION_ID = "shopperConversionId"; + private String shopperConversionId; + public static final String JSON_PROPERTY_SHOPPER_EMAIL = "shopperEmail"; private String shopperEmail; @@ -732,6 +741,39 @@ public void setAuthenticationData(AuthenticationData authenticationData) { this.authenticationData = authenticationData; } + /** + * bankAccount + * + * @param bankAccount + * @return the current {@code PaymentRequest} instance, allowing for method chaining + */ + public PaymentRequest bankAccount(CheckoutBankAccount bankAccount) { + this.bankAccount = bankAccount; + return this; + } + + /** + * bankAccount + * @return bankAccount + */ + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_BANK_ACCOUNT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public CheckoutBankAccount getBankAccount() { + return bankAccount; + } + + /** + * bankAccount + * + * @param bankAccount + */ + @JsonProperty(JSON_PROPERTY_BANK_ACCOUNT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setBankAccount(CheckoutBankAccount bankAccount) { + this.bankAccount = bankAccount; + } + /** * billingAddress * @@ -2298,6 +2340,39 @@ public void setSessionValidity(String sessionValidity) { this.sessionValidity = sessionValidity; } + /** + * A unique ID that can be used to associate `/paymentMethods` and `/payments` requests with the same shopper transaction, offering insights into conversion rates. + * + * @param shopperConversionId + * @return the current {@code PaymentRequest} instance, allowing for method chaining + */ + public PaymentRequest shopperConversionId(String shopperConversionId) { + this.shopperConversionId = shopperConversionId; + return this; + } + + /** + * A unique ID that can be used to associate `/paymentMethods` and `/payments` requests with the same shopper transaction, offering insights into conversion rates. + * @return shopperConversionId + */ + @ApiModelProperty(value = "A unique ID that can be used to associate `/paymentMethods` and `/payments` requests with the same shopper transaction, offering insights into conversion rates.") + @JsonProperty(JSON_PROPERTY_SHOPPER_CONVERSION_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getShopperConversionId() { + return shopperConversionId; + } + + /** + * A unique ID that can be used to associate `/paymentMethods` and `/payments` requests with the same shopper transaction, offering insights into conversion rates. + * + * @param shopperConversionId + */ + @JsonProperty(JSON_PROPERTY_SHOPPER_CONVERSION_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setShopperConversionId(String shopperConversionId) { + this.shopperConversionId = shopperConversionId; + } + /** * The shopper's email address. We recommend that you provide this data, as it is used in velocity fraud checks. > For 3D Secure 2 transactions, schemes require `shopperEmail` for all browser-based and mobile implementations. * @@ -2872,6 +2947,7 @@ public boolean equals(Object o) { Objects.equals(this.amount, paymentRequest.amount) && Objects.equals(this.applicationInfo, paymentRequest.applicationInfo) && Objects.equals(this.authenticationData, paymentRequest.authenticationData) && + Objects.equals(this.bankAccount, paymentRequest.bankAccount) && Objects.equals(this.billingAddress, paymentRequest.billingAddress) && Objects.equals(this.browserInfo, paymentRequest.browserInfo) && Objects.equals(this.captureDelayHours, paymentRequest.captureDelayHours) && @@ -2918,6 +2994,7 @@ public boolean equals(Object o) { Objects.equals(this.returnUrl, paymentRequest.returnUrl) && Objects.equals(this.riskData, paymentRequest.riskData) && Objects.equals(this.sessionValidity, paymentRequest.sessionValidity) && + Objects.equals(this.shopperConversionId, paymentRequest.shopperConversionId) && Objects.equals(this.shopperEmail, paymentRequest.shopperEmail) && Objects.equals(this.shopperIP, paymentRequest.shopperIP) && Objects.equals(this.shopperInteraction, paymentRequest.shopperInteraction) && @@ -2938,7 +3015,7 @@ public boolean equals(Object o) { @Override public int hashCode() { - return Objects.hash(accountInfo, additionalAmount, additionalData, amount, applicationInfo, authenticationData, billingAddress, browserInfo, captureDelayHours, channel, checkoutAttemptId, company, conversionId, countryCode, dateOfBirth, dccQuote, deliverAt, deliveryAddress, deliveryDate, deviceFingerprint, enableOneClick, enablePayOut, enableRecurring, entityType, fraudOffset, fundOrigin, fundRecipient, industryUsage, installments, lineItems, localizedShopperStatement, mandate, mcc, merchantAccount, merchantOrderReference, merchantRiskIndicator, metadata, mpiData, order, orderReference, origin, paymentMethod, platformChargebackLogic, recurringExpiry, recurringFrequency, recurringProcessingModel, redirectFromIssuerMethod, redirectToIssuerMethod, reference, returnUrl, riskData, sessionValidity, shopperEmail, shopperIP, shopperInteraction, shopperLocale, shopperName, shopperReference, shopperStatement, socialSecurityNumber, splits, store, storePaymentMethod, subMerchants, telephoneNumber, threeDS2RequestData, threeDSAuthenticationOnly, trustedShopper); + return Objects.hash(accountInfo, additionalAmount, additionalData, amount, applicationInfo, authenticationData, bankAccount, billingAddress, browserInfo, captureDelayHours, channel, checkoutAttemptId, company, conversionId, countryCode, dateOfBirth, dccQuote, deliverAt, deliveryAddress, deliveryDate, deviceFingerprint, enableOneClick, enablePayOut, enableRecurring, entityType, fraudOffset, fundOrigin, fundRecipient, industryUsage, installments, lineItems, localizedShopperStatement, mandate, mcc, merchantAccount, merchantOrderReference, merchantRiskIndicator, metadata, mpiData, order, orderReference, origin, paymentMethod, platformChargebackLogic, recurringExpiry, recurringFrequency, recurringProcessingModel, redirectFromIssuerMethod, redirectToIssuerMethod, reference, returnUrl, riskData, sessionValidity, shopperConversionId, shopperEmail, shopperIP, shopperInteraction, shopperLocale, shopperName, shopperReference, shopperStatement, socialSecurityNumber, splits, store, storePaymentMethod, subMerchants, telephoneNumber, threeDS2RequestData, threeDSAuthenticationOnly, trustedShopper); } @Override @@ -2951,6 +3028,7 @@ public String toString() { sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); sb.append(" applicationInfo: ").append(toIndentedString(applicationInfo)).append("\n"); sb.append(" authenticationData: ").append(toIndentedString(authenticationData)).append("\n"); + sb.append(" bankAccount: ").append(toIndentedString(bankAccount)).append("\n"); sb.append(" billingAddress: ").append(toIndentedString(billingAddress)).append("\n"); sb.append(" browserInfo: ").append(toIndentedString(browserInfo)).append("\n"); sb.append(" captureDelayHours: ").append(toIndentedString(captureDelayHours)).append("\n"); @@ -2997,6 +3075,7 @@ public String toString() { sb.append(" returnUrl: ").append(toIndentedString(returnUrl)).append("\n"); sb.append(" riskData: ").append(toIndentedString(riskData)).append("\n"); sb.append(" sessionValidity: ").append(toIndentedString(sessionValidity)).append("\n"); + sb.append(" shopperConversionId: ").append(toIndentedString(shopperConversionId)).append("\n"); sb.append(" shopperEmail: ").append(toIndentedString(shopperEmail)).append("\n"); sb.append(" shopperIP: ").append(toIndentedString(shopperIP)).append("\n"); sb.append(" shopperInteraction: ").append(toIndentedString(shopperInteraction)).append("\n"); diff --git a/src/main/java/com/adyen/model/checkout/RivertyDetails.java b/src/main/java/com/adyen/model/checkout/RivertyDetails.java new file mode 100644 index 000000000..83d0fc82d --- /dev/null +++ b/src/main/java/com/adyen/model/checkout/RivertyDetails.java @@ -0,0 +1,497 @@ +/* + * Adyen Checkout API + * + * The version of the OpenAPI document: 71 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.adyen.model.checkout; + +import java.util.Objects; +import java.util.Arrays; +import java.util.Map; +import java.util.HashMap; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.core.JsonProcessingException; + + +/** + * RivertyDetails + */ +@JsonPropertyOrder({ + RivertyDetails.JSON_PROPERTY_BILLING_ADDRESS, + RivertyDetails.JSON_PROPERTY_CHECKOUT_ATTEMPT_ID, + RivertyDetails.JSON_PROPERTY_DELIVERY_ADDRESS, + RivertyDetails.JSON_PROPERTY_DEVICE_FINGERPRINT, + RivertyDetails.JSON_PROPERTY_IBAN, + RivertyDetails.JSON_PROPERTY_PERSONAL_DETAILS, + RivertyDetails.JSON_PROPERTY_RECURRING_DETAIL_REFERENCE, + RivertyDetails.JSON_PROPERTY_STORED_PAYMENT_METHOD_ID, + RivertyDetails.JSON_PROPERTY_TYPE +}) + +public class RivertyDetails { + public static final String JSON_PROPERTY_BILLING_ADDRESS = "billingAddress"; + private String billingAddress; + + public static final String JSON_PROPERTY_CHECKOUT_ATTEMPT_ID = "checkoutAttemptId"; + private String checkoutAttemptId; + + public static final String JSON_PROPERTY_DELIVERY_ADDRESS = "deliveryAddress"; + private String deliveryAddress; + + public static final String JSON_PROPERTY_DEVICE_FINGERPRINT = "deviceFingerprint"; + private String deviceFingerprint; + + public static final String JSON_PROPERTY_IBAN = "iban"; + private String iban; + + public static final String JSON_PROPERTY_PERSONAL_DETAILS = "personalDetails"; + private String personalDetails; + + public static final String JSON_PROPERTY_RECURRING_DETAIL_REFERENCE = "recurringDetailReference"; + @Deprecated // deprecated since Adyen Checkout API v49: Use `storedPaymentMethodId` instead. + private String recurringDetailReference; + + public static final String JSON_PROPERTY_STORED_PAYMENT_METHOD_ID = "storedPaymentMethodId"; + private String storedPaymentMethodId; + + /** + * **riverty** + */ + public enum TypeEnum { + RIVERTY("riverty"), + + RIVERTY_ACCOUNT("riverty_account"), + + SEPADIRECTDEBIT_RIVERTY("sepadirectdebit_riverty"); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static TypeEnum fromValue(String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_TYPE = "type"; + private TypeEnum type; + + public RivertyDetails() { + } + + /** + * The address where to send the invoice. + * + * @param billingAddress + * @return the current {@code RivertyDetails} instance, allowing for method chaining + */ + public RivertyDetails billingAddress(String billingAddress) { + this.billingAddress = billingAddress; + return this; + } + + /** + * The address where to send the invoice. + * @return billingAddress + */ + @ApiModelProperty(value = "The address where to send the invoice.") + @JsonProperty(JSON_PROPERTY_BILLING_ADDRESS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getBillingAddress() { + return billingAddress; + } + + /** + * The address where to send the invoice. + * + * @param billingAddress + */ + @JsonProperty(JSON_PROPERTY_BILLING_ADDRESS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setBillingAddress(String billingAddress) { + this.billingAddress = billingAddress; + } + + /** + * The checkout attempt identifier. + * + * @param checkoutAttemptId + * @return the current {@code RivertyDetails} instance, allowing for method chaining + */ + public RivertyDetails checkoutAttemptId(String checkoutAttemptId) { + this.checkoutAttemptId = checkoutAttemptId; + return this; + } + + /** + * The checkout attempt identifier. + * @return checkoutAttemptId + */ + @ApiModelProperty(value = "The checkout attempt identifier.") + @JsonProperty(JSON_PROPERTY_CHECKOUT_ATTEMPT_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getCheckoutAttemptId() { + return checkoutAttemptId; + } + + /** + * The checkout attempt identifier. + * + * @param checkoutAttemptId + */ + @JsonProperty(JSON_PROPERTY_CHECKOUT_ATTEMPT_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setCheckoutAttemptId(String checkoutAttemptId) { + this.checkoutAttemptId = checkoutAttemptId; + } + + /** + * The address where the goods should be delivered. + * + * @param deliveryAddress + * @return the current {@code RivertyDetails} instance, allowing for method chaining + */ + public RivertyDetails deliveryAddress(String deliveryAddress) { + this.deliveryAddress = deliveryAddress; + return this; + } + + /** + * The address where the goods should be delivered. + * @return deliveryAddress + */ + @ApiModelProperty(value = "The address where the goods should be delivered.") + @JsonProperty(JSON_PROPERTY_DELIVERY_ADDRESS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getDeliveryAddress() { + return deliveryAddress; + } + + /** + * The address where the goods should be delivered. + * + * @param deliveryAddress + */ + @JsonProperty(JSON_PROPERTY_DELIVERY_ADDRESS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setDeliveryAddress(String deliveryAddress) { + this.deliveryAddress = deliveryAddress; + } + + /** + * A string containing the shopper's device fingerprint. For more information, refer to [Device fingerprinting](https://docs.adyen.com/risk-management/device-fingerprinting). + * + * @param deviceFingerprint + * @return the current {@code RivertyDetails} instance, allowing for method chaining + */ + public RivertyDetails deviceFingerprint(String deviceFingerprint) { + this.deviceFingerprint = deviceFingerprint; + return this; + } + + /** + * A string containing the shopper's device fingerprint. For more information, refer to [Device fingerprinting](https://docs.adyen.com/risk-management/device-fingerprinting). + * @return deviceFingerprint + */ + @ApiModelProperty(value = "A string containing the shopper's device fingerprint. For more information, refer to [Device fingerprinting](https://docs.adyen.com/risk-management/device-fingerprinting).") + @JsonProperty(JSON_PROPERTY_DEVICE_FINGERPRINT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getDeviceFingerprint() { + return deviceFingerprint; + } + + /** + * A string containing the shopper's device fingerprint. For more information, refer to [Device fingerprinting](https://docs.adyen.com/risk-management/device-fingerprinting). + * + * @param deviceFingerprint + */ + @JsonProperty(JSON_PROPERTY_DEVICE_FINGERPRINT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setDeviceFingerprint(String deviceFingerprint) { + this.deviceFingerprint = deviceFingerprint; + } + + /** + * The iban number of the customer + * + * @param iban + * @return the current {@code RivertyDetails} instance, allowing for method chaining + */ + public RivertyDetails iban(String iban) { + this.iban = iban; + return this; + } + + /** + * The iban number of the customer + * @return iban + */ + @ApiModelProperty(value = "The iban number of the customer ") + @JsonProperty(JSON_PROPERTY_IBAN) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getIban() { + return iban; + } + + /** + * The iban number of the customer + * + * @param iban + */ + @JsonProperty(JSON_PROPERTY_IBAN) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setIban(String iban) { + this.iban = iban; + } + + /** + * Shopper name, date of birth, phone number, and email address. + * + * @param personalDetails + * @return the current {@code RivertyDetails} instance, allowing for method chaining + */ + public RivertyDetails personalDetails(String personalDetails) { + this.personalDetails = personalDetails; + return this; + } + + /** + * Shopper name, date of birth, phone number, and email address. + * @return personalDetails + */ + @ApiModelProperty(value = "Shopper name, date of birth, phone number, and email address.") + @JsonProperty(JSON_PROPERTY_PERSONAL_DETAILS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getPersonalDetails() { + return personalDetails; + } + + /** + * Shopper name, date of birth, phone number, and email address. + * + * @param personalDetails + */ + @JsonProperty(JSON_PROPERTY_PERSONAL_DETAILS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setPersonalDetails(String personalDetails) { + this.personalDetails = personalDetails; + } + + /** + * This is the `recurringDetailReference` returned in the response when you created the token. + * + * @param recurringDetailReference + * @return the current {@code RivertyDetails} instance, allowing for method chaining + * + * @deprecated since Adyen Checkout API v49 + * Use `storedPaymentMethodId` instead. + */ + @Deprecated + public RivertyDetails recurringDetailReference(String recurringDetailReference) { + this.recurringDetailReference = recurringDetailReference; + return this; + } + + /** + * This is the `recurringDetailReference` returned in the response when you created the token. + * @return recurringDetailReference + * + * @deprecated since Adyen Checkout API v49 + * Use `storedPaymentMethodId` instead. + */ + @Deprecated + @ApiModelProperty(value = "This is the `recurringDetailReference` returned in the response when you created the token.") + @JsonProperty(JSON_PROPERTY_RECURRING_DETAIL_REFERENCE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getRecurringDetailReference() { + return recurringDetailReference; + } + + /** + * This is the `recurringDetailReference` returned in the response when you created the token. + * + * @param recurringDetailReference + * + * @deprecated since Adyen Checkout API v49 + * Use `storedPaymentMethodId` instead. + */ + @Deprecated + @JsonProperty(JSON_PROPERTY_RECURRING_DETAIL_REFERENCE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setRecurringDetailReference(String recurringDetailReference) { + this.recurringDetailReference = recurringDetailReference; + } + + /** + * This is the `recurringDetailReference` returned in the response when you created the token. + * + * @param storedPaymentMethodId + * @return the current {@code RivertyDetails} instance, allowing for method chaining + */ + public RivertyDetails storedPaymentMethodId(String storedPaymentMethodId) { + this.storedPaymentMethodId = storedPaymentMethodId; + return this; + } + + /** + * This is the `recurringDetailReference` returned in the response when you created the token. + * @return storedPaymentMethodId + */ + @ApiModelProperty(value = "This is the `recurringDetailReference` returned in the response when you created the token.") + @JsonProperty(JSON_PROPERTY_STORED_PAYMENT_METHOD_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getStoredPaymentMethodId() { + return storedPaymentMethodId; + } + + /** + * This is the `recurringDetailReference` returned in the response when you created the token. + * + * @param storedPaymentMethodId + */ + @JsonProperty(JSON_PROPERTY_STORED_PAYMENT_METHOD_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setStoredPaymentMethodId(String storedPaymentMethodId) { + this.storedPaymentMethodId = storedPaymentMethodId; + } + + /** + * **riverty** + * + * @param type + * @return the current {@code RivertyDetails} instance, allowing for method chaining + */ + public RivertyDetails type(TypeEnum type) { + this.type = type; + return this; + } + + /** + * **riverty** + * @return type + */ + @ApiModelProperty(required = true, value = "**riverty**") + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public TypeEnum getType() { + return type; + } + + /** + * **riverty** + * + * @param type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setType(TypeEnum type) { + this.type = type; + } + + /** + * Return true if this RivertyDetails object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RivertyDetails rivertyDetails = (RivertyDetails) o; + return Objects.equals(this.billingAddress, rivertyDetails.billingAddress) && + Objects.equals(this.checkoutAttemptId, rivertyDetails.checkoutAttemptId) && + Objects.equals(this.deliveryAddress, rivertyDetails.deliveryAddress) && + Objects.equals(this.deviceFingerprint, rivertyDetails.deviceFingerprint) && + Objects.equals(this.iban, rivertyDetails.iban) && + Objects.equals(this.personalDetails, rivertyDetails.personalDetails) && + Objects.equals(this.recurringDetailReference, rivertyDetails.recurringDetailReference) && + Objects.equals(this.storedPaymentMethodId, rivertyDetails.storedPaymentMethodId) && + Objects.equals(this.type, rivertyDetails.type); + } + + @Override + public int hashCode() { + return Objects.hash(billingAddress, checkoutAttemptId, deliveryAddress, deviceFingerprint, iban, personalDetails, recurringDetailReference, storedPaymentMethodId, type); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RivertyDetails {\n"); + sb.append(" billingAddress: ").append(toIndentedString(billingAddress)).append("\n"); + sb.append(" checkoutAttemptId: ").append(toIndentedString(checkoutAttemptId)).append("\n"); + sb.append(" deliveryAddress: ").append(toIndentedString(deliveryAddress)).append("\n"); + sb.append(" deviceFingerprint: ").append(toIndentedString(deviceFingerprint)).append("\n"); + sb.append(" iban: ").append(toIndentedString(iban)).append("\n"); + sb.append(" personalDetails: ").append(toIndentedString(personalDetails)).append("\n"); + sb.append(" recurringDetailReference: ").append(toIndentedString(recurringDetailReference)).append("\n"); + sb.append(" storedPaymentMethodId: ").append(toIndentedString(storedPaymentMethodId)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +/** + * Create an instance of RivertyDetails given an JSON string + * + * @param jsonString JSON string + * @return An instance of RivertyDetails + * @throws JsonProcessingException if the JSON string is invalid with respect to RivertyDetails + */ + public static RivertyDetails fromJson(String jsonString) throws JsonProcessingException { + return JSON.getMapper().readValue(jsonString, RivertyDetails.class); + } +/** + * Convert an instance of RivertyDetails to an JSON string + * + * @return JSON string + */ + public String toJson() throws JsonProcessingException { + return JSON.getMapper().writeValueAsString(this); + } +} diff --git a/src/main/java/com/adyen/service/checkout/PaymentsApi.java b/src/main/java/com/adyen/service/checkout/PaymentsApi.java index 8849a29e1..85f88cbc4 100644 --- a/src/main/java/com/adyen/service/checkout/PaymentsApi.java +++ b/src/main/java/com/adyen/service/checkout/PaymentsApi.java @@ -61,7 +61,7 @@ public PaymentsApi(Client client, String baseURL) { } /** - * Get the list of brands on the card + * Get the brands and other details of a card * * @param cardDetailsRequest {@link CardDetailsRequest } (required) * @return {@link CardDetailsResponse } @@ -72,7 +72,7 @@ public CardDetailsResponse cardDetails(CardDetailsRequest cardDetailsRequest) th } /** - * Get the list of brands on the card + * Get the brands and other details of a card * * @param cardDetailsRequest {@link CardDetailsRequest } (required) * @param requestOptions {@link RequestOptions } Object to store additional data such as idempotency-keys (optional) diff --git a/src/test/java/com/adyen/CheckoutTest.java b/src/test/java/com/adyen/CheckoutTest.java index dd3a45e34..b63031f00 100644 --- a/src/test/java/com/adyen/CheckoutTest.java +++ b/src/test/java/com/adyen/CheckoutTest.java @@ -26,6 +26,7 @@ import com.adyen.httpclient.HTTPClientException; import com.adyen.model.checkout.*; +import com.adyen.model.payment.PaymentResult; import com.adyen.service.checkout.*; import org.junit.Assert; @@ -33,6 +34,7 @@ import java.io.IOException; import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; import java.util.*; @@ -451,4 +453,134 @@ public void TestCheckoutPaymentMethodSerialisation() throws Exception { Assert.assertTrue(checkoutPaymentMethodScheme.toJson().contains("scheme")); Assert.assertTrue(checkoutPaymentMethodApple.toJson().contains("NRWtuNlNEWkRCSm1xWndjMDFFbktkQU")); } + + @Test + public void TestPaymentWithRatepay() throws Exception { + Client client = createMockClientFromFile("mocks/checkout/paymentResponseRatepay.json"); + + RatepayDetails ratepayDetails = new RatepayDetails() + .type(RatepayDetails.TypeEnum.RATEPAY_DIRECTDEBIT); + + PaymentRequest paymentRequest = new PaymentRequest() + .paymentMethod(new CheckoutPaymentMethod(ratepayDetails)) + .amount(new Amount() + .currency("EUR") + .value(700L)) + .shopperName(new Name() + .firstName("Simon") + .lastName("Hopper")) + .telephoneNumber("+31858888138") + .shopperEmail("s.hopper@example.com") + .billingAddress(new BillingAddress() + .country("NL") + .city("Amsterdam") + .houseNumberOrName("6-50") + .street("Simon Carmiggeltstraat") + .postalCode("1011 DJ")) + .deviceFingerprint("eyJ2ZXJzaW9uIjoiMS4wLjAiLCJkZXZ...") + .lineItems(Arrays.asList(new LineItem().quantity(1L) + .amountExcludingTax(331L) + .taxPercentage(2100L) + .description("Shoes") + .id("Item #1") + .taxAmount(69L) + .amountIncludingTax(400L), + new LineItem() + .quantity(2L) + .amountExcludingTax(248L) + .taxPercentage(2100L) + .description("Socks") + .id("Item #2") + .taxAmount(52L) + .amountIncludingTax(300L))) + .bankAccount(new CheckoutBankAccount() + .countryCode("NL") + .iban("NL13TEST0123456789") + .ownerName("Simon Hopper")); + paymentRequest.setPaymentMethod(new CheckoutPaymentMethod(ratepayDetails)); + PaymentsApi checkout = new PaymentsApi(client); + PaymentResponse paymentResponse = checkout.payments(paymentRequest); + + assertEquals("881567437271705K", paymentResponse.getPspReference()); + assertEquals(PaymentResponse.ResultCodeEnum.AUTHORISED, paymentResponse.getResultCode()); + assertNotNull(paymentResponse.getAdditionalData()); + + verify(client.getHttpClient()).request( + "https://checkout-test.adyen.com/v71/payments", + paymentRequest.toJson(), + client.getConfig(), + false, + null, + ApiConstants.HttpMethod.POST, + null + ); + } + + @Test + public void TestPaymentWithRiverty() throws Exception { + Client client = createMockClientFromFile("mocks/checkout/paymentResponseRiverty.json"); + + RivertyDetails rivertyDetails = new RivertyDetails() + .type(RivertyDetails.TypeEnum.SEPADIRECTDEBIT_RIVERTY) + .iban("NL13TEST0123456789"); + + PaymentRequest paymentRequest = new PaymentRequest() + .paymentMethod(new CheckoutPaymentMethod(rivertyDetails)) + .amount(new Amount() + .currency("EUR") + .value(700L)) + .shopperName(new Name() + .firstName("Simon") + .lastName("Hopper")) + .telephoneNumber("+31858888138") + .shopperIP("123.123.123.123") + .shopperEmail("s.hopper@example.com") + .billingAddress(new BillingAddress() + .country("NL") + .city("Amsterdam") + .houseNumberOrName("6-50") + .street("Simon Carmiggeltstraat") + .postalCode("1011 DJ")) + .deliveryAddress(new DeliveryAddress() + .country("NL") + .city("Amsterdam") + .houseNumberOrName("6-50") + .street("Simon Carmiggeltstraat") + .postalCode("1011 DJ")) + .deviceFingerprint("eyJ2ZXJzaW9uIjoiMS4wLjAiLCJkZXZ...") + .lineItems(Arrays.asList(new LineItem().quantity(1L) + .amountExcludingTax(331L) + .taxPercentage(2100L) + .description("Shoes") + .id("Item #1") + .taxAmount(69L) + .amountIncludingTax(400L), + new LineItem() + .quantity(2L) + .amountExcludingTax(248L) + .taxPercentage(2100L) + .description("Socks") + .id("Item #2") + .taxAmount(52L) + .amountIncludingTax(300L))); + paymentRequest.setPaymentMethod(new CheckoutPaymentMethod(rivertyDetails)); + PaymentsApi checkout = new PaymentsApi(client); + PaymentResponse paymentResponse = checkout.payments(paymentRequest); + + assertNull(paymentResponse.getPspReference()); + assertEquals(PaymentResponse.ResultCodeEnum.REDIRECTSHOPPER, paymentResponse.getResultCode()); + assertEquals(CheckoutRedirectAction.TypeEnum.REDIRECT, paymentResponse.getAction().getCheckoutRedirectAction().getType()); + assertEquals("https://checkoutshopper-test.adyen.com/checkoutshopper…", paymentResponse.getAction().getCheckoutRedirectAction().getUrl()); + + + verify(client.getHttpClient()).request( + "https://checkout-test.adyen.com/v71/payments", + paymentRequest.toJson(), + client.getConfig(), + false, + null, + ApiConstants.HttpMethod.POST, + null + ); + } } diff --git a/src/test/resources/mocks/checkout/paymentResponseRatepay.json b/src/test/resources/mocks/checkout/paymentResponseRatepay.json new file mode 100644 index 000000000..2460c3ee9 --- /dev/null +++ b/src/test/resources/mocks/checkout/paymentResponseRatepay.json @@ -0,0 +1,8 @@ +{ + "additionalData": { + "openinvoicedata.descriptor": "DN0099661Y8" + }, + "pspReference":"881567437271705K", + "resultCode":"Authorised", + "merchantReference":"YOUR_ORDER_NUMBER" +} \ No newline at end of file diff --git a/src/test/resources/mocks/checkout/paymentResponseRiverty.json b/src/test/resources/mocks/checkout/paymentResponseRiverty.json new file mode 100644 index 000000000..6ab9fe627 --- /dev/null +++ b/src/test/resources/mocks/checkout/paymentResponseRiverty.json @@ -0,0 +1,9 @@ +{ + "action": { + "paymentMethodType": "riverty", + "method": "GET", + "url": "https://checkoutshopper-test.adyen.com/checkoutshopper…", + "type": "redirect" + }, + "resultCode": "RedirectShopper" +} \ No newline at end of file