diff --git a/src/main/java/com/adyen/model/checkout/CardDetails.java b/src/main/java/com/adyen/model/checkout/CardDetails.java index 5fbf3ec91..7f242b565 100644 --- a/src/main/java/com/adyen/model/checkout/CardDetails.java +++ b/src/main/java/com/adyen/model/checkout/CardDetails.java @@ -31,6 +31,7 @@ CardDetails.JSON_PROPERTY_ENCRYPTED_CARD_NUMBER, CardDetails.JSON_PROPERTY_ENCRYPTED_EXPIRY_MONTH, CardDetails.JSON_PROPERTY_ENCRYPTED_EXPIRY_YEAR, + CardDetails.JSON_PROPERTY_ENCRYPTED_PASSWORD, CardDetails.JSON_PROPERTY_ENCRYPTED_SECURITY_CODE, CardDetails.JSON_PROPERTY_EXPIRY_MONTH, CardDetails.JSON_PROPERTY_EXPIRY_YEAR, @@ -75,6 +76,9 @@ public class CardDetails { public static final String JSON_PROPERTY_ENCRYPTED_EXPIRY_YEAR = "encryptedExpiryYear"; private String encryptedExpiryYear; + public static final String JSON_PROPERTY_ENCRYPTED_PASSWORD = "encryptedPassword"; + private String encryptedPassword; + public static final String JSON_PROPERTY_ENCRYPTED_SECURITY_CODE = "encryptedSecurityCode"; private String encryptedSecurityCode; @@ -508,6 +512,45 @@ public void setEncryptedExpiryYear(String encryptedExpiryYear) { this.encryptedExpiryYear = encryptedExpiryYear; } + /** + * This field contains an encrypted, one-time password or an authentication code provided by the + * cardholder. + * + * @param encryptedPassword This field contains an encrypted, one-time password or an + * authentication code provided by the cardholder. + * @return the current {@code CardDetails} instance, allowing for method chaining + */ + public CardDetails encryptedPassword(String encryptedPassword) { + this.encryptedPassword = encryptedPassword; + return this; + } + + /** + * This field contains an encrypted, one-time password or an authentication code provided by the + * cardholder. + * + * @return encryptedPassword This field contains an encrypted, one-time password or an + * authentication code provided by the cardholder. + */ + @JsonProperty(JSON_PROPERTY_ENCRYPTED_PASSWORD) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getEncryptedPassword() { + return encryptedPassword; + } + + /** + * This field contains an encrypted, one-time password or an authentication code provided by the + * cardholder. + * + * @param encryptedPassword This field contains an encrypted, one-time password or an + * authentication code provided by the cardholder. + */ + @JsonProperty(JSON_PROPERTY_ENCRYPTED_PASSWORD) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setEncryptedPassword(String encryptedPassword) { + this.encryptedPassword = encryptedPassword; + } + /** * The encrypted card verification code. * @@ -1162,6 +1205,7 @@ public boolean equals(Object o) { && Objects.equals(this.encryptedCardNumber, cardDetails.encryptedCardNumber) && Objects.equals(this.encryptedExpiryMonth, cardDetails.encryptedExpiryMonth) && Objects.equals(this.encryptedExpiryYear, cardDetails.encryptedExpiryYear) + && Objects.equals(this.encryptedPassword, cardDetails.encryptedPassword) && Objects.equals(this.encryptedSecurityCode, cardDetails.encryptedSecurityCode) && Objects.equals(this.expiryMonth, cardDetails.expiryMonth) && Objects.equals(this.expiryYear, cardDetails.expiryYear) @@ -1193,6 +1237,7 @@ public int hashCode() { encryptedCardNumber, encryptedExpiryMonth, encryptedExpiryYear, + encryptedPassword, encryptedSecurityCode, expiryMonth, expiryYear, @@ -1232,6 +1277,7 @@ public String toString() { sb.append(" encryptedExpiryYear: ") .append(toIndentedString(encryptedExpiryYear)) .append("\n"); + sb.append(" encryptedPassword: ").append(toIndentedString(encryptedPassword)).append("\n"); sb.append(" encryptedSecurityCode: ") .append(toIndentedString(encryptedSecurityCode)) .append("\n"); diff --git a/src/main/java/com/adyen/model/checkout/CardDonations.java b/src/main/java/com/adyen/model/checkout/CardDonations.java index c239bd6a4..2f55a3fcb 100644 --- a/src/main/java/com/adyen/model/checkout/CardDonations.java +++ b/src/main/java/com/adyen/model/checkout/CardDonations.java @@ -31,6 +31,7 @@ CardDonations.JSON_PROPERTY_ENCRYPTED_CARD_NUMBER, CardDonations.JSON_PROPERTY_ENCRYPTED_EXPIRY_MONTH, CardDonations.JSON_PROPERTY_ENCRYPTED_EXPIRY_YEAR, + CardDonations.JSON_PROPERTY_ENCRYPTED_PASSWORD, CardDonations.JSON_PROPERTY_ENCRYPTED_SECURITY_CODE, CardDonations.JSON_PROPERTY_EXPIRY_MONTH, CardDonations.JSON_PROPERTY_EXPIRY_YEAR, @@ -75,6 +76,9 @@ public class CardDonations { public static final String JSON_PROPERTY_ENCRYPTED_EXPIRY_YEAR = "encryptedExpiryYear"; private String encryptedExpiryYear; + public static final String JSON_PROPERTY_ENCRYPTED_PASSWORD = "encryptedPassword"; + private String encryptedPassword; + public static final String JSON_PROPERTY_ENCRYPTED_SECURITY_CODE = "encryptedSecurityCode"; private String encryptedSecurityCode; @@ -508,6 +512,45 @@ public void setEncryptedExpiryYear(String encryptedExpiryYear) { this.encryptedExpiryYear = encryptedExpiryYear; } + /** + * This field contains an encrypted, one-time password or an authentication code provided by the + * cardholder. + * + * @param encryptedPassword This field contains an encrypted, one-time password or an + * authentication code provided by the cardholder. + * @return the current {@code CardDonations} instance, allowing for method chaining + */ + public CardDonations encryptedPassword(String encryptedPassword) { + this.encryptedPassword = encryptedPassword; + return this; + } + + /** + * This field contains an encrypted, one-time password or an authentication code provided by the + * cardholder. + * + * @return encryptedPassword This field contains an encrypted, one-time password or an + * authentication code provided by the cardholder. + */ + @JsonProperty(JSON_PROPERTY_ENCRYPTED_PASSWORD) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getEncryptedPassword() { + return encryptedPassword; + } + + /** + * This field contains an encrypted, one-time password or an authentication code provided by the + * cardholder. + * + * @param encryptedPassword This field contains an encrypted, one-time password or an + * authentication code provided by the cardholder. + */ + @JsonProperty(JSON_PROPERTY_ENCRYPTED_PASSWORD) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setEncryptedPassword(String encryptedPassword) { + this.encryptedPassword = encryptedPassword; + } + /** * The encrypted card verification code. * @@ -1162,6 +1205,7 @@ public boolean equals(Object o) { && Objects.equals(this.encryptedCardNumber, cardDonations.encryptedCardNumber) && Objects.equals(this.encryptedExpiryMonth, cardDonations.encryptedExpiryMonth) && Objects.equals(this.encryptedExpiryYear, cardDonations.encryptedExpiryYear) + && Objects.equals(this.encryptedPassword, cardDonations.encryptedPassword) && Objects.equals(this.encryptedSecurityCode, cardDonations.encryptedSecurityCode) && Objects.equals(this.expiryMonth, cardDonations.expiryMonth) && Objects.equals(this.expiryYear, cardDonations.expiryYear) @@ -1193,6 +1237,7 @@ public int hashCode() { encryptedCardNumber, encryptedExpiryMonth, encryptedExpiryYear, + encryptedPassword, encryptedSecurityCode, expiryMonth, expiryYear, @@ -1232,6 +1277,7 @@ public String toString() { sb.append(" encryptedExpiryYear: ") .append(toIndentedString(encryptedExpiryYear)) .append("\n"); + sb.append(" encryptedPassword: ").append(toIndentedString(encryptedPassword)).append("\n"); sb.append(" encryptedSecurityCode: ") .append(toIndentedString(encryptedSecurityCode)) .append("\n"); diff --git a/src/main/java/com/adyen/model/checkout/ResponseAdditionalDataSwish.java b/src/main/java/com/adyen/model/checkout/ResponseAdditionalDataSwish.java new file mode 100644 index 000000000..d359fa625 --- /dev/null +++ b/src/main/java/com/adyen/model/checkout/ResponseAdditionalDataSwish.java @@ -0,0 +1,119 @@ +/* + * 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 com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.core.JsonProcessingException; +import java.util.*; + +/** ResponseAdditionalDataSwish */ +@JsonPropertyOrder({ResponseAdditionalDataSwish.JSON_PROPERTY_SWISH_PAYER_ALIAS}) +public class ResponseAdditionalDataSwish { + public static final String JSON_PROPERTY_SWISH_PAYER_ALIAS = "swish.payerAlias"; + private String swishPayerAlias; + + public ResponseAdditionalDataSwish() {} + + /** + * A Swish shopper's telephone number. + * + * @param swishPayerAlias A Swish shopper's telephone number. + * @return the current {@code ResponseAdditionalDataSwish} instance, allowing for method chaining + */ + public ResponseAdditionalDataSwish swishPayerAlias(String swishPayerAlias) { + this.swishPayerAlias = swishPayerAlias; + return this; + } + + /** + * A Swish shopper's telephone number. + * + * @return swishPayerAlias A Swish shopper's telephone number. + */ + @JsonProperty(JSON_PROPERTY_SWISH_PAYER_ALIAS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getSwishPayerAlias() { + return swishPayerAlias; + } + + /** + * A Swish shopper's telephone number. + * + * @param swishPayerAlias A Swish shopper's telephone number. + */ + @JsonProperty(JSON_PROPERTY_SWISH_PAYER_ALIAS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setSwishPayerAlias(String swishPayerAlias) { + this.swishPayerAlias = swishPayerAlias; + } + + /** Return true if this ResponseAdditionalDataSwish object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ResponseAdditionalDataSwish responseAdditionalDataSwish = (ResponseAdditionalDataSwish) o; + return Objects.equals(this.swishPayerAlias, responseAdditionalDataSwish.swishPayerAlias); + } + + @Override + public int hashCode() { + return Objects.hash(swishPayerAlias); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ResponseAdditionalDataSwish {\n"); + sb.append(" swishPayerAlias: ").append(toIndentedString(swishPayerAlias)).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 ResponseAdditionalDataSwish given an JSON string + * + * @param jsonString JSON string + * @return An instance of ResponseAdditionalDataSwish + * @throws JsonProcessingException if the JSON string is invalid with respect to + * ResponseAdditionalDataSwish + */ + public static ResponseAdditionalDataSwish fromJson(String jsonString) + throws JsonProcessingException { + return JSON.getMapper().readValue(jsonString, ResponseAdditionalDataSwish.class); + } + + /** + * Convert an instance of ResponseAdditionalDataSwish 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/Split.java b/src/main/java/com/adyen/model/checkout/Split.java index 160bacb49..6801ac0d9 100644 --- a/src/main/java/com/adyen/model/checkout/Split.java +++ b/src/main/java/com/adyen/model/checkout/Split.java @@ -61,12 +61,10 @@ public class Split { * specified `account`. * **TopUp**: allows you and your users to top up balance * accounts using direct debit, card payments, or other payment methods. * **VAT**: the * value-added tax charged on the payment, booked to your platforms liable balance account. * - * **Commission**: your platform's commission (specified in `amount`) on the - * payment, booked to your liable balance account. * **Default**: in very specific use cases, - * allows you to book the specified `amount` to the specified `account`. For - * more information, contact Adyen support. Possible values for the [Classic Platforms - * integration](https://docs.adyen.com/classic-platforms): **Commission**, **Default**, - * **MarketPlace**, **PaymentFee**, **VAT**. + * **Default**: in very specific use cases, allows you to book the specified `amount` to + * the specified `account`. For more information, contact Adyen support. Possible values + * for the [Classic Platforms integration](https://docs.adyen.com/classic-platforms): + * **Commission**, **Default**, **MarketPlace**, **PaymentFee**, **VAT**. */ public enum TypeEnum { ACQUIRINGFEES(String.valueOf("AcquiringFees")), @@ -364,12 +362,10 @@ public void setReference(String reference) { * specified `account`. * **TopUp**: allows you and your users to top up balance * accounts using direct debit, card payments, or other payment methods. * **VAT**: the * value-added tax charged on the payment, booked to your platforms liable balance account. * - * **Commission**: your platform's commission (specified in `amount`) on the - * payment, booked to your liable balance account. * **Default**: in very specific use cases, - * allows you to book the specified `amount` to the specified `account`. For - * more information, contact Adyen support. Possible values for the [Classic Platforms - * integration](https://docs.adyen.com/classic-platforms): **Commission**, **Default**, - * **MarketPlace**, **PaymentFee**, **VAT**. + * **Default**: in very specific use cases, allows you to book the specified `amount` to + * the specified `account`. For more information, contact Adyen support. Possible values + * for the [Classic Platforms integration](https://docs.adyen.com/classic-platforms): + * **Commission**, **Default**, **MarketPlace**, **PaymentFee**, **VAT**. * * @param type The part of the payment you want to book to the specified `account`. * Possible values for the [Balance @@ -390,12 +386,11 @@ public void setReference(String reference) { * conversion, booked to the specified `account`. * **TopUp**: allows you and your * users to top up balance accounts using direct debit, card payments, or other payment * methods. * **VAT**: the value-added tax charged on the payment, booked to your platforms - * liable balance account. * **Commission**: your platform's commission (specified in - * `amount`) on the payment, booked to your liable balance account. * **Default**: - * in very specific use cases, allows you to book the specified `amount` to the - * specified `account`. For more information, contact Adyen support. Possible values - * for the [Classic Platforms integration](https://docs.adyen.com/classic-platforms): - * **Commission**, **Default**, **MarketPlace**, **PaymentFee**, **VAT**. + * liable balance account. * **Default**: in very specific use cases, allows you to book the + * specified `amount` to the specified `account`. For more information, + * contact Adyen support. Possible values for the [Classic Platforms + * integration](https://docs.adyen.com/classic-platforms): **Commission**, **Default**, + * **MarketPlace**, **PaymentFee**, **VAT**. * @return the current {@code Split} instance, allowing for method chaining */ public Split type(TypeEnum type) { @@ -422,12 +417,10 @@ public Split type(TypeEnum type) { * specified `account`. * **TopUp**: allows you and your users to top up balance * accounts using direct debit, card payments, or other payment methods. * **VAT**: the * value-added tax charged on the payment, booked to your platforms liable balance account. * - * **Commission**: your platform's commission (specified in `amount`) on the - * payment, booked to your liable balance account. * **Default**: in very specific use cases, - * allows you to book the specified `amount` to the specified `account`. For - * more information, contact Adyen support. Possible values for the [Classic Platforms - * integration](https://docs.adyen.com/classic-platforms): **Commission**, **Default**, - * **MarketPlace**, **PaymentFee**, **VAT**. + * **Default**: in very specific use cases, allows you to book the specified `amount` to + * the specified `account`. For more information, contact Adyen support. Possible values + * for the [Classic Platforms integration](https://docs.adyen.com/classic-platforms): + * **Commission**, **Default**, **MarketPlace**, **PaymentFee**, **VAT**. * * @return type The part of the payment you want to book to the specified `account`. * Possible values for the [Balance @@ -448,12 +441,11 @@ public Split type(TypeEnum type) { * conversion, booked to the specified `account`. * **TopUp**: allows you and your * users to top up balance accounts using direct debit, card payments, or other payment * methods. * **VAT**: the value-added tax charged on the payment, booked to your platforms - * liable balance account. * **Commission**: your platform's commission (specified in - * `amount`) on the payment, booked to your liable balance account. * **Default**: - * in very specific use cases, allows you to book the specified `amount` to the - * specified `account`. For more information, contact Adyen support. Possible values - * for the [Classic Platforms integration](https://docs.adyen.com/classic-platforms): - * **Commission**, **Default**, **MarketPlace**, **PaymentFee**, **VAT**. + * liable balance account. * **Default**: in very specific use cases, allows you to book the + * specified `amount` to the specified `account`. For more information, + * contact Adyen support. Possible values for the [Classic Platforms + * integration](https://docs.adyen.com/classic-platforms): **Commission**, **Default**, + * **MarketPlace**, **PaymentFee**, **VAT**. */ @JsonProperty(JSON_PROPERTY_TYPE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -480,12 +472,10 @@ public TypeEnum getType() { * specified `account`. * **TopUp**: allows you and your users to top up balance * accounts using direct debit, card payments, or other payment methods. * **VAT**: the * value-added tax charged on the payment, booked to your platforms liable balance account. * - * **Commission**: your platform's commission (specified in `amount`) on the - * payment, booked to your liable balance account. * **Default**: in very specific use cases, - * allows you to book the specified `amount` to the specified `account`. For - * more information, contact Adyen support. Possible values for the [Classic Platforms - * integration](https://docs.adyen.com/classic-platforms): **Commission**, **Default**, - * **MarketPlace**, **PaymentFee**, **VAT**. + * **Default**: in very specific use cases, allows you to book the specified `amount` to + * the specified `account`. For more information, contact Adyen support. Possible values + * for the [Classic Platforms integration](https://docs.adyen.com/classic-platforms): + * **Commission**, **Default**, **MarketPlace**, **PaymentFee**, **VAT**. * * @param type The part of the payment you want to book to the specified `account`. * Possible values for the [Balance @@ -506,12 +496,11 @@ public TypeEnum getType() { * conversion, booked to the specified `account`. * **TopUp**: allows you and your * users to top up balance accounts using direct debit, card payments, or other payment * methods. * **VAT**: the value-added tax charged on the payment, booked to your platforms - * liable balance account. * **Commission**: your platform's commission (specified in - * `amount`) on the payment, booked to your liable balance account. * **Default**: - * in very specific use cases, allows you to book the specified `amount` to the - * specified `account`. For more information, contact Adyen support. Possible values - * for the [Classic Platforms integration](https://docs.adyen.com/classic-platforms): - * **Commission**, **Default**, **MarketPlace**, **PaymentFee**, **VAT**. + * liable balance account. * **Default**: in very specific use cases, allows you to book the + * specified `amount` to the specified `account`. For more information, + * contact Adyen support. Possible values for the [Classic Platforms + * integration](https://docs.adyen.com/classic-platforms): **Commission**, **Default**, + * **MarketPlace**, **PaymentFee**, **VAT**. */ @JsonProperty(JSON_PROPERTY_TYPE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) diff --git a/src/main/java/com/adyen/model/checkout/ValidateShopperIdResponse.java b/src/main/java/com/adyen/model/checkout/ValidateShopperIdResponse.java index bffc1fa4f..6cfb52834 100644 --- a/src/main/java/com/adyen/model/checkout/ValidateShopperIdResponse.java +++ b/src/main/java/com/adyen/model/checkout/ValidateShopperIdResponse.java @@ -32,9 +32,9 @@ public class ValidateShopperIdResponse { public ValidateShopperIdResponse() {} /** - * reason + * Reason for the result. * - * @param reason + * @param reason Reason for the result. * @return the current {@code ValidateShopperIdResponse} instance, allowing for method chaining */ public ValidateShopperIdResponse reason(String reason) { @@ -43,9 +43,9 @@ public ValidateShopperIdResponse reason(String reason) { } /** - * Get reason + * Reason for the result. * - * @return reason + * @return reason Reason for the result. */ @JsonProperty(JSON_PROPERTY_REASON) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -54,9 +54,9 @@ public String getReason() { } /** - * reason + * Reason for the result. * - * @param reason + * @param reason Reason for the result. */ @JsonProperty(JSON_PROPERTY_REASON) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) diff --git a/src/main/java/com/adyen/model/legalentitymanagement/OnboardingLink.java b/src/main/java/com/adyen/model/legalentitymanagement/OnboardingLink.java index f76f4bb76..08c65afde 100644 --- a/src/main/java/com/adyen/model/legalentitymanagement/OnboardingLink.java +++ b/src/main/java/com/adyen/model/legalentitymanagement/OnboardingLink.java @@ -26,12 +26,13 @@ public class OnboardingLink { public OnboardingLink() {} /** - * The URL of the hosted onboarding page where you need to redirect your user. This URL expires - * after 4 minutes and can only be used once. If the link expires, you need to create a new link. + * The URL of the hosted onboarding page where you need to redirect your user. This URL: - Expires + * after 4 minutes. - Can only be used once. - Can only be clicked once by the user. If the link + * expires, you need to create a new link. * - * @param url The URL of the hosted onboarding page where you need to redirect your user. This URL - * expires after 4 minutes and can only be used once. If the link expires, you need to create - * a new link. + * @param url The URL of the hosted onboarding page where you need to redirect your user. This + * URL: - Expires after 4 minutes. - Can only be used once. - Can only be clicked once by the + * user. If the link expires, you need to create a new link. * @return the current {@code OnboardingLink} instance, allowing for method chaining */ public OnboardingLink url(String url) { @@ -40,12 +41,13 @@ public OnboardingLink url(String url) { } /** - * The URL of the hosted onboarding page where you need to redirect your user. This URL expires - * after 4 minutes and can only be used once. If the link expires, you need to create a new link. + * The URL of the hosted onboarding page where you need to redirect your user. This URL: - Expires + * after 4 minutes. - Can only be used once. - Can only be clicked once by the user. If the link + * expires, you need to create a new link. * * @return url The URL of the hosted onboarding page where you need to redirect your user. This - * URL expires after 4 minutes and can only be used once. If the link expires, you need to - * create a new link. + * URL: - Expires after 4 minutes. - Can only be used once. - Can only be clicked once by the + * user. If the link expires, you need to create a new link. */ @JsonProperty(JSON_PROPERTY_URL) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -54,12 +56,13 @@ public String getUrl() { } /** - * The URL of the hosted onboarding page where you need to redirect your user. This URL expires - * after 4 minutes and can only be used once. If the link expires, you need to create a new link. + * The URL of the hosted onboarding page where you need to redirect your user. This URL: - Expires + * after 4 minutes. - Can only be used once. - Can only be clicked once by the user. If the link + * expires, you need to create a new link. * - * @param url The URL of the hosted onboarding page where you need to redirect your user. This URL - * expires after 4 minutes and can only be used once. If the link expires, you need to create - * a new link. + * @param url The URL of the hosted onboarding page where you need to redirect your user. This + * URL: - Expires after 4 minutes. - Can only be used once. - Can only be clicked once by the + * user. If the link expires, you need to create a new link. */ @JsonProperty(JSON_PROPERTY_URL) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) diff --git a/src/main/java/com/adyen/model/management/PayByBankPlaidInfo.java b/src/main/java/com/adyen/model/management/PayByBankPlaidInfo.java index be1b5e488..c5e4cab2f 100644 --- a/src/main/java/com/adyen/model/management/PayByBankPlaidInfo.java +++ b/src/main/java/com/adyen/model/management/PayByBankPlaidInfo.java @@ -19,79 +19,18 @@ /** PayByBankPlaidInfo */ @JsonPropertyOrder({ - PayByBankPlaidInfo.JSON_PROPERTY_COUNTRY_CODE, PayByBankPlaidInfo.JSON_PROPERTY_LOGO, - PayByBankPlaidInfo.JSON_PROPERTY_MERCHANT_CITY, - PayByBankPlaidInfo.JSON_PROPERTY_MERCHANT_LEGAL_NAME, - PayByBankPlaidInfo.JSON_PROPERTY_MERCHANT_SHOP_URL, - PayByBankPlaidInfo.JSON_PROPERTY_MERCHANT_STATE_PROVINCE, - PayByBankPlaidInfo.JSON_PROPERTY_MERCHANT_STREET_ADDRESS, - PayByBankPlaidInfo.JSON_PROPERTY_TRANSACTION_DESCRIPTION, - PayByBankPlaidInfo.JSON_PROPERTY_ZIP_CODE + PayByBankPlaidInfo.JSON_PROPERTY_TRANSACTION_DESCRIPTION }) public class PayByBankPlaidInfo { - public static final String JSON_PROPERTY_COUNTRY_CODE = "countryCode"; - private String countryCode; - public static final String JSON_PROPERTY_LOGO = "logo"; private String logo; - public static final String JSON_PROPERTY_MERCHANT_CITY = "merchantCity"; - private String merchantCity; - - public static final String JSON_PROPERTY_MERCHANT_LEGAL_NAME = "merchantLegalName"; - private String merchantLegalName; - - public static final String JSON_PROPERTY_MERCHANT_SHOP_URL = "merchantShopUrl"; - private String merchantShopUrl; - - public static final String JSON_PROPERTY_MERCHANT_STATE_PROVINCE = "merchantStateProvince"; - private String merchantStateProvince; - - public static final String JSON_PROPERTY_MERCHANT_STREET_ADDRESS = "merchantStreetAddress"; - private String merchantStreetAddress; - public static final String JSON_PROPERTY_TRANSACTION_DESCRIPTION = "transactionDescription"; private TransactionDescriptionInfo transactionDescription; - public static final String JSON_PROPERTY_ZIP_CODE = "zipCode"; - private String zipCode; - public PayByBankPlaidInfo() {} - /** - * Country Code. - * - * @param countryCode Country Code. - * @return the current {@code PayByBankPlaidInfo} instance, allowing for method chaining - */ - public PayByBankPlaidInfo countryCode(String countryCode) { - this.countryCode = countryCode; - return this; - } - - /** - * Country Code. - * - * @return countryCode Country Code. - */ - @JsonProperty(JSON_PROPERTY_COUNTRY_CODE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getCountryCode() { - return countryCode; - } - - /** - * Country Code. - * - * @param countryCode Country Code. - */ - @JsonProperty(JSON_PROPERTY_COUNTRY_CODE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setCountryCode(String countryCode) { - this.countryCode = countryCode; - } - /** * Merchant logo (max. size 150kB). Format: Base64-encoded string. * @@ -125,171 +64,6 @@ public void setLogo(String logo) { this.logo = logo; } - /** - * The city the merchant is doing business in. - * - * @param merchantCity The city the merchant is doing business in. - * @return the current {@code PayByBankPlaidInfo} instance, allowing for method chaining - */ - public PayByBankPlaidInfo merchantCity(String merchantCity) { - this.merchantCity = merchantCity; - return this; - } - - /** - * The city the merchant is doing business in. - * - * @return merchantCity The city the merchant is doing business in. - */ - @JsonProperty(JSON_PROPERTY_MERCHANT_CITY) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getMerchantCity() { - return merchantCity; - } - - /** - * The city the merchant is doing business in. - * - * @param merchantCity The city the merchant is doing business in. - */ - @JsonProperty(JSON_PROPERTY_MERCHANT_CITY) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setMerchantCity(String merchantCity) { - this.merchantCity = merchantCity; - } - - /** - * Legal Business Name of the Merchant. - * - * @param merchantLegalName Legal Business Name of the Merchant. - * @return the current {@code PayByBankPlaidInfo} instance, allowing for method chaining - */ - public PayByBankPlaidInfo merchantLegalName(String merchantLegalName) { - this.merchantLegalName = merchantLegalName; - return this; - } - - /** - * Legal Business Name of the Merchant. - * - * @return merchantLegalName Legal Business Name of the Merchant. - */ - @JsonProperty(JSON_PROPERTY_MERCHANT_LEGAL_NAME) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getMerchantLegalName() { - return merchantLegalName; - } - - /** - * Legal Business Name of the Merchant. - * - * @param merchantLegalName Legal Business Name of the Merchant. - */ - @JsonProperty(JSON_PROPERTY_MERCHANT_LEGAL_NAME) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setMerchantLegalName(String merchantLegalName) { - this.merchantLegalName = merchantLegalName; - } - - /** - * Merchant shop url. - * - * @param merchantShopUrl Merchant shop url. - * @return the current {@code PayByBankPlaidInfo} instance, allowing for method chaining - */ - public PayByBankPlaidInfo merchantShopUrl(String merchantShopUrl) { - this.merchantShopUrl = merchantShopUrl; - return this; - } - - /** - * Merchant shop url. - * - * @return merchantShopUrl Merchant shop url. - */ - @JsonProperty(JSON_PROPERTY_MERCHANT_SHOP_URL) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getMerchantShopUrl() { - return merchantShopUrl; - } - - /** - * Merchant shop url. - * - * @param merchantShopUrl Merchant shop url. - */ - @JsonProperty(JSON_PROPERTY_MERCHANT_SHOP_URL) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setMerchantShopUrl(String merchantShopUrl) { - this.merchantShopUrl = merchantShopUrl; - } - - /** - * The state/province of the merchant. - * - * @param merchantStateProvince The state/province of the merchant. - * @return the current {@code PayByBankPlaidInfo} instance, allowing for method chaining - */ - public PayByBankPlaidInfo merchantStateProvince(String merchantStateProvince) { - this.merchantStateProvince = merchantStateProvince; - return this; - } - - /** - * The state/province of the merchant. - * - * @return merchantStateProvince The state/province of the merchant. - */ - @JsonProperty(JSON_PROPERTY_MERCHANT_STATE_PROVINCE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getMerchantStateProvince() { - return merchantStateProvince; - } - - /** - * The state/province of the merchant. - * - * @param merchantStateProvince The state/province of the merchant. - */ - @JsonProperty(JSON_PROPERTY_MERCHANT_STATE_PROVINCE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setMerchantStateProvince(String merchantStateProvince) { - this.merchantStateProvince = merchantStateProvince; - } - - /** - * The street address of the merchant. - * - * @param merchantStreetAddress The street address of the merchant. - * @return the current {@code PayByBankPlaidInfo} instance, allowing for method chaining - */ - public PayByBankPlaidInfo merchantStreetAddress(String merchantStreetAddress) { - this.merchantStreetAddress = merchantStreetAddress; - return this; - } - - /** - * The street address of the merchant. - * - * @return merchantStreetAddress The street address of the merchant. - */ - @JsonProperty(JSON_PROPERTY_MERCHANT_STREET_ADDRESS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getMerchantStreetAddress() { - return merchantStreetAddress; - } - - /** - * The street address of the merchant. - * - * @param merchantStreetAddress The street address of the merchant. - */ - @JsonProperty(JSON_PROPERTY_MERCHANT_STREET_ADDRESS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setMerchantStreetAddress(String merchantStreetAddress) { - this.merchantStreetAddress = merchantStreetAddress; - } - /** * transactionDescription * @@ -324,39 +98,6 @@ public void setTransactionDescription(TransactionDescriptionInfo transactionDesc this.transactionDescription = transactionDescription; } - /** - * The zip code of the account. - * - * @param zipCode The zip code of the account. - * @return the current {@code PayByBankPlaidInfo} instance, allowing for method chaining - */ - public PayByBankPlaidInfo zipCode(String zipCode) { - this.zipCode = zipCode; - return this; - } - - /** - * The zip code of the account. - * - * @return zipCode The zip code of the account. - */ - @JsonProperty(JSON_PROPERTY_ZIP_CODE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getZipCode() { - return zipCode; - } - - /** - * The zip code of the account. - * - * @param zipCode The zip code of the account. - */ - @JsonProperty(JSON_PROPERTY_ZIP_CODE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setZipCode(String zipCode) { - this.zipCode = zipCode; - } - /** Return true if this PayByBankPlaidInfo object is equal to o. */ @Override public boolean equals(Object o) { @@ -367,50 +108,23 @@ public boolean equals(Object o) { return false; } PayByBankPlaidInfo payByBankPlaidInfo = (PayByBankPlaidInfo) o; - return Objects.equals(this.countryCode, payByBankPlaidInfo.countryCode) - && Objects.equals(this.logo, payByBankPlaidInfo.logo) - && Objects.equals(this.merchantCity, payByBankPlaidInfo.merchantCity) - && Objects.equals(this.merchantLegalName, payByBankPlaidInfo.merchantLegalName) - && Objects.equals(this.merchantShopUrl, payByBankPlaidInfo.merchantShopUrl) - && Objects.equals(this.merchantStateProvince, payByBankPlaidInfo.merchantStateProvince) - && Objects.equals(this.merchantStreetAddress, payByBankPlaidInfo.merchantStreetAddress) - && Objects.equals(this.transactionDescription, payByBankPlaidInfo.transactionDescription) - && Objects.equals(this.zipCode, payByBankPlaidInfo.zipCode); + return Objects.equals(this.logo, payByBankPlaidInfo.logo) + && Objects.equals(this.transactionDescription, payByBankPlaidInfo.transactionDescription); } @Override public int hashCode() { - return Objects.hash( - countryCode, - logo, - merchantCity, - merchantLegalName, - merchantShopUrl, - merchantStateProvince, - merchantStreetAddress, - transactionDescription, - zipCode); + return Objects.hash(logo, transactionDescription); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class PayByBankPlaidInfo {\n"); - sb.append(" countryCode: ").append(toIndentedString(countryCode)).append("\n"); sb.append(" logo: ").append(toIndentedString(logo)).append("\n"); - sb.append(" merchantCity: ").append(toIndentedString(merchantCity)).append("\n"); - sb.append(" merchantLegalName: ").append(toIndentedString(merchantLegalName)).append("\n"); - sb.append(" merchantShopUrl: ").append(toIndentedString(merchantShopUrl)).append("\n"); - sb.append(" merchantStateProvince: ") - .append(toIndentedString(merchantStateProvince)) - .append("\n"); - sb.append(" merchantStreetAddress: ") - .append(toIndentedString(merchantStreetAddress)) - .append("\n"); sb.append(" transactionDescription: ") .append(toIndentedString(transactionDescription)) .append("\n"); - sb.append(" zipCode: ").append(toIndentedString(zipCode)).append("\n"); sb.append("}"); return sb.toString(); } diff --git a/src/main/java/com/adyen/model/management/Refunds.java b/src/main/java/com/adyen/model/management/Refunds.java index f63cb32c3..2f9a6fcf5 100644 --- a/src/main/java/com/adyen/model/management/Refunds.java +++ b/src/main/java/com/adyen/model/management/Refunds.java @@ -18,11 +18,14 @@ import java.util.*; /** Refunds */ -@JsonPropertyOrder({Refunds.JSON_PROPERTY_REFERENCED}) +@JsonPropertyOrder({Refunds.JSON_PROPERTY_REFERENCED, Refunds.JSON_PROPERTY_UNREFERENCED}) public class Refunds { public static final String JSON_PROPERTY_REFERENCED = "referenced"; private Referenced referenced; + public static final String JSON_PROPERTY_UNREFERENCED = "unreferenced"; + private Unreferenced unreferenced; + public Refunds() {} /** @@ -58,6 +61,39 @@ public void setReferenced(Referenced referenced) { this.referenced = referenced; } + /** + * unreferenced + * + * @param unreferenced + * @return the current {@code Refunds} instance, allowing for method chaining + */ + public Refunds unreferenced(Unreferenced unreferenced) { + this.unreferenced = unreferenced; + return this; + } + + /** + * Get unreferenced + * + * @return unreferenced + */ + @JsonProperty(JSON_PROPERTY_UNREFERENCED) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Unreferenced getUnreferenced() { + return unreferenced; + } + + /** + * unreferenced + * + * @param unreferenced + */ + @JsonProperty(JSON_PROPERTY_UNREFERENCED) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setUnreferenced(Unreferenced unreferenced) { + this.unreferenced = unreferenced; + } + /** Return true if this Refunds object is equal to o. */ @Override public boolean equals(Object o) { @@ -68,12 +104,13 @@ public boolean equals(Object o) { return false; } Refunds refunds = (Refunds) o; - return Objects.equals(this.referenced, refunds.referenced); + return Objects.equals(this.referenced, refunds.referenced) + && Objects.equals(this.unreferenced, refunds.unreferenced); } @Override public int hashCode() { - return Objects.hash(referenced); + return Objects.hash(referenced, unreferenced); } @Override @@ -81,6 +118,7 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class Refunds {\n"); sb.append(" referenced: ").append(toIndentedString(referenced)).append("\n"); + sb.append(" unreferenced: ").append(toIndentedString(unreferenced)).append("\n"); sb.append("}"); return sb.toString(); } diff --git a/src/main/java/com/adyen/model/management/Unreferenced.java b/src/main/java/com/adyen/model/management/Unreferenced.java new file mode 100644 index 000000000..835c1de0b --- /dev/null +++ b/src/main/java/com/adyen/model/management/Unreferenced.java @@ -0,0 +1,123 @@ +/* + * Management API + * + * The version of the OpenAPI document: 3 + * + * + * 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.management; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.core.JsonProcessingException; +import java.util.*; + +/** Unreferenced */ +@JsonPropertyOrder({Unreferenced.JSON_PROPERTY_ENABLE_UNREFERENCED_REFUNDS}) +public class Unreferenced { + public static final String JSON_PROPERTY_ENABLE_UNREFERENCED_REFUNDS = + "enableUnreferencedRefunds"; + private Boolean enableUnreferencedRefunds; + + public Unreferenced() {} + + /** + * Indicates whether unreferenced refunds are enabled on the terminal. + * + * @param enableUnreferencedRefunds Indicates whether unreferenced refunds are enabled on the + * terminal. + * @return the current {@code Unreferenced} instance, allowing for method chaining + */ + public Unreferenced enableUnreferencedRefunds(Boolean enableUnreferencedRefunds) { + this.enableUnreferencedRefunds = enableUnreferencedRefunds; + return this; + } + + /** + * Indicates whether unreferenced refunds are enabled on the terminal. + * + * @return enableUnreferencedRefunds Indicates whether unreferenced refunds are enabled on the + * terminal. + */ + @JsonProperty(JSON_PROPERTY_ENABLE_UNREFERENCED_REFUNDS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Boolean getEnableUnreferencedRefunds() { + return enableUnreferencedRefunds; + } + + /** + * Indicates whether unreferenced refunds are enabled on the terminal. + * + * @param enableUnreferencedRefunds Indicates whether unreferenced refunds are enabled on the + * terminal. + */ + @JsonProperty(JSON_PROPERTY_ENABLE_UNREFERENCED_REFUNDS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setEnableUnreferencedRefunds(Boolean enableUnreferencedRefunds) { + this.enableUnreferencedRefunds = enableUnreferencedRefunds; + } + + /** Return true if this Unreferenced object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Unreferenced unreferenced = (Unreferenced) o; + return Objects.equals(this.enableUnreferencedRefunds, unreferenced.enableUnreferencedRefunds); + } + + @Override + public int hashCode() { + return Objects.hash(enableUnreferencedRefunds); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Unreferenced {\n"); + sb.append(" enableUnreferencedRefunds: ") + .append(toIndentedString(enableUnreferencedRefunds)) + .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 Unreferenced given an JSON string + * + * @param jsonString JSON string + * @return An instance of Unreferenced + * @throws JsonProcessingException if the JSON string is invalid with respect to Unreferenced + */ + public static Unreferenced fromJson(String jsonString) throws JsonProcessingException { + return JSON.getMapper().readValue(jsonString, Unreferenced.class); + } + + /** + * Convert an instance of Unreferenced 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/nexo/PredefinedContentHelper.java b/src/main/java/com/adyen/model/nexo/PredefinedContentHelper.java index 3feb49c7c..eff0d4e1b 100644 --- a/src/main/java/com/adyen/model/nexo/PredefinedContentHelper.java +++ b/src/main/java/com/adyen/model/nexo/PredefinedContentHelper.java @@ -1,6 +1,5 @@ package com.adyen.model.nexo; -import java.io.UnsupportedEncodingException; import java.net.URLDecoder; import java.nio.charset.StandardCharsets; import java.util.Collections; @@ -9,137 +8,141 @@ import java.util.Optional; /** - * A helper class to parse and manage the key-value pairs within a PredefinedContent referenceID string. - * The referenceID is expected to be in a URL query string format (e.g., {@code key1=value1&key2=value2}). + * A helper class to parse and manage the key-value pairs within a PredefinedContent referenceID + * string. The referenceID is expected to be in a URL query string format (e.g., {@code + * key1=value1&key2=value2}). */ public final class PredefinedContentHelper { - private static final String KEY_EVENT = "event"; - private static final String KEY_TRANSACTION_ID = "TransactionID"; - private static final String KEY_TIME_STAMP = "TimeStamp"; + private static final String KEY_EVENT = "event"; + private static final String KEY_TRANSACTION_ID = "TransactionID"; + private static final String KEY_TIME_STAMP = "TimeStamp"; - /** - * Defines the supported events for display notifications within a PredefinedContent reference ID. - */ - public enum DisplayNotificationEvent { - TENDER_CREATED, - CARD_INSERTED, - CARD_PRESENTED, - CARD_SWIPED, - WAIT_FOR_APP_SELECTION, - APPLICATION_SELECTED, - ASK_SIGNATURE, - CHECK_SIGNATURE, - SIGNATURE_CHECKED, - WAIT_FOR_PIN, - PIN_ENTERED, - PRINT_RECEIPT, - RECEIPT_PRINTED, - CARD_REMOVED, - TENDER_FINAL, - ASK_DCC, - DCC_ACCEPTED, - DCC_REJECTED, - ASK_GRATUITY, - GRATUITY_ENTERED, - BALANCE_QUERY_STARTED, - BALANCE_QUERY_COMPLETED, - LOAD_STARTED, - LOAD_COMPLETED, - PROVIDE_CARD_DETAILS, - CARD_DETAILS_PROVIDED - } + /** + * Defines the supported events for display notifications within a PredefinedContent reference ID. + */ + public enum DisplayNotificationEvent { + TENDER_CREATED, + CARD_INSERTED, + CARD_PRESENTED, + CARD_SWIPED, + WAIT_FOR_APP_SELECTION, + APPLICATION_SELECTED, + ASK_SIGNATURE, + CHECK_SIGNATURE, + SIGNATURE_CHECKED, + WAIT_FOR_PIN, + PIN_ENTERED, + PRINT_RECEIPT, + RECEIPT_PRINTED, + CARD_REMOVED, + TENDER_FINAL, + ASK_DCC, + DCC_ACCEPTED, + DCC_REJECTED, + ASK_GRATUITY, + GRATUITY_ENTERED, + BALANCE_QUERY_STARTED, + BALANCE_QUERY_COMPLETED, + LOAD_STARTED, + LOAD_COMPLETED, + PROVIDE_CARD_DETAILS, + CARD_DETAILS_PROVIDED + } - private final Map params; + private final Map params; - /** - * Constructs a helper instance by parsing the provided reference ID. - * - * @param referenceId The string from {@link PredefinedContent#getReferenceID()}, - * expected to be in URL query string format. - */ - public PredefinedContentHelper(String referenceId) { - this.params = parse(referenceId); - } + /** + * Constructs a helper instance by parsing the provided reference ID. + * + * @param referenceId The string from {@link PredefinedContent#getReferenceID()}, expected to be + * in URL query string format. + */ + public PredefinedContentHelper(String referenceId) { + this.params = parse(referenceId); + } - /** - * Extracts and validates the 'event' value from the reference ID. - * - * @return An {@link Optional} containing the {@link DisplayNotificationEvent} if it is present and valid, - * otherwise an empty Optional. - *
{@code
-     * PredefinedContentHelper helper = new PredefinedContentHelper("...&event=PIN_ENTERED");
-     * helper.getEvent().ifPresent(event -> System.out.println(event)); // Prints PIN_ENTERED
-     * }
- */ - public Optional getEvent() { - return get(KEY_EVENT).flatMap(eventValue -> { - try { + /** + * Extracts and validates the 'event' value from the reference ID. + * + * @return An {@link Optional} containing the {@link DisplayNotificationEvent} if it is present + * and valid, otherwise an empty Optional. + *
{@code
+   * PredefinedContentHelper helper = new PredefinedContentHelper("...&event=PIN_ENTERED");
+   * helper.getEvent().ifPresent(event -> System.out.println(event)); // Prints PIN_ENTERED
+   * }
+ */ + public Optional getEvent() { + return get(KEY_EVENT) + .flatMap( + eventValue -> { + try { return Optional.of(DisplayNotificationEvent.valueOf(eventValue)); - } catch (IllegalArgumentException e) { + } catch (IllegalArgumentException e) { return Optional.empty(); // The event string is not a valid enum constant - } - }); - } + } + }); + } - /** - * Gets the transaction ID from the reference ID. - * - * @return An {@link Optional} containing the TransactionID, or an empty Optional if not present. - */ - public Optional getTransactionId() { - return get(KEY_TRANSACTION_ID); - } + /** + * Gets the transaction ID from the reference ID. + * + * @return An {@link Optional} containing the TransactionID, or an empty Optional if not present. + */ + public Optional getTransactionId() { + return get(KEY_TRANSACTION_ID); + } - /** - * Gets the timestamp from the reference ID. - * - * @return An {@link Optional} containing the TimeStamp, or an empty Optional if not present. - */ - public Optional getTimeStamp() { - return get(KEY_TIME_STAMP); - } + /** + * Gets the timestamp from the reference ID. + * + * @return An {@link Optional} containing the TimeStamp, or an empty Optional if not present. + */ + public Optional getTimeStamp() { + return get(KEY_TIME_STAMP); + } - /** - * Gets the value for a given key from the reference ID. - * - * @param key The name of the parameter to retrieve. - * @return An {@link Optional} containing the parameter's value, or an empty Optional if not present. - */ - public Optional get(String key) { - return Optional.ofNullable(params.get(key)); - } + /** + * Gets the value for a given key from the reference ID. + * + * @param key The name of the parameter to retrieve. + * @return An {@link Optional} containing the parameter's value, or an empty Optional if not + * present. + */ + public Optional get(String key) { + return Optional.ofNullable(params.get(key)); + } - /** - * Returns an unmodifiable view of all parsed parameters. - * - * @return An unmodifiable {@link Map} of all key-value pairs from the reference ID. - */ - public Map toMap() { - return Collections.unmodifiableMap(params); - } + /** + * Returns an unmodifiable view of all parsed parameters. + * + * @return An unmodifiable {@link Map} of all key-value pairs from the reference ID. + */ + public Map toMap() { + return Collections.unmodifiableMap(params); + } - /** - * Parses a URL query-like string into a map. - * - * @param referenceId The string to parse. - * @return A map of the parsed key-value pairs. - */ - private static Map parse(String referenceId) { - if (referenceId == null || referenceId.trim().isEmpty()) { - return Collections.emptyMap(); - } + /** + * Parses a URL query-like string into a map. + * + * @param referenceId The string to parse. + * @return A map of the parsed key-value pairs. + */ + private static Map parse(String referenceId) { + if (referenceId == null || referenceId.trim().isEmpty()) { + return Collections.emptyMap(); + } - Map queryPairs = new LinkedHashMap<>(); - String[] pairs = referenceId.split("&"); - for (String pair : pairs) { - int idx = pair.indexOf("="); - if (idx > 0 && idx < pair.length() - 1) { - String key = URLDecoder.decode(pair.substring(0, idx), StandardCharsets.UTF_8); - String value = URLDecoder.decode(pair.substring(idx + 1), StandardCharsets.UTF_8); - queryPairs.put(key, value); - } - } - return queryPairs; + Map queryPairs = new LinkedHashMap<>(); + String[] pairs = referenceId.split("&"); + for (String pair : pairs) { + int idx = pair.indexOf("="); + if (idx > 0 && idx < pair.length() - 1) { + String key = URLDecoder.decode(pair.substring(0, idx), StandardCharsets.UTF_8); + String value = URLDecoder.decode(pair.substring(idx + 1), StandardCharsets.UTF_8); + queryPairs.put(key, value); + } } -} \ No newline at end of file + return queryPairs; + } +} diff --git a/src/test/java/com/adyen/model/nexo/PredefinedContentHelperTest.java b/src/test/java/com/adyen/model/nexo/PredefinedContentHelperTest.java index c44a52596..34c1c88f4 100644 --- a/src/test/java/com/adyen/model/nexo/PredefinedContentHelperTest.java +++ b/src/test/java/com/adyen/model/nexo/PredefinedContentHelperTest.java @@ -1,97 +1,97 @@ package com.adyen.model.nexo; -import org.junit.Test; - -import java.util.Map; -import java.util.Optional; - import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; -/** - * Tests for {@link PredefinedContentHelper}. - */ +import java.util.Map; +import java.util.Optional; +import org.junit.Test; + +/** Tests for {@link PredefinedContentHelper}. */ public class PredefinedContentHelperTest { - @Test - public void testShouldExtractValidEvent() { - String referenceId = "TransactionID=oLkO001517998574000&TimeStamp=2018-02-07T10%3a16%3a14.000Z&event=PIN_ENTERED"; - PredefinedContentHelper helper = new PredefinedContentHelper(referenceId); - - Optional event = helper.getEvent(); - assertTrue("Event should be present", event.isPresent()); - assertEquals(PredefinedContentHelper.DisplayNotificationEvent.PIN_ENTERED, event.get()); - } - - @Test - public void testShouldReturnEmptyForInvalidEvent() { - PredefinedContentHelper helper = new PredefinedContentHelper("event=INVALID_EVENT"); - - assertFalse("Event should not be present for invalid value", helper.getEvent().isPresent()); - } - - @Test - public void testShouldExtractTransactionId() { - PredefinedContentHelper helper = new PredefinedContentHelper("TransactionID=12345&TimeStamp=2018-02-07T10%3a16%3a14.000Z&event=PIN_ENTERED"); - - Optional transactionId = helper.getTransactionId(); - assertTrue("TransactionID should be present", transactionId.isPresent()); - assertEquals("12345", transactionId.get()); - } - - @Test - public void testShouldExtractTimeStamp() { - PredefinedContentHelper helper = new PredefinedContentHelper("TimeStamp=2024-07-11T12:00:00Z"); - - Optional timeStamp = helper.getTimeStamp(); - assertTrue("TimeStamp should be present", timeStamp.isPresent()); - assertEquals("2024-07-11T12:00:00Z", timeStamp.get()); - } - - @Test - public void testShouldExtractArbitraryKey() { - PredefinedContentHelper helper = new PredefinedContentHelper("foo=bar&baz=qux"); - - Optional foo = helper.get("foo"); - assertTrue("Value for 'foo' should be present", foo.isPresent()); - assertEquals("bar", foo.get()); - - Optional baz = helper.get("baz"); - assertTrue("Value for 'baz' should be present", baz.isPresent()); - assertEquals("qux", baz.get()); - - assertFalse("Value for 'missing' should not be present", helper.get("missing").isPresent()); - } - - @Test - public void testShouldConvertParamsToMap() { - PredefinedContentHelper helper = new PredefinedContentHelper("a=1&b=2&event=WAIT_FOR_PIN"); - - Map map = helper.toMap(); - assertEquals(3, map.size()); - assertEquals("1", map.get("a")); - assertEquals("2", map.get("b")); - assertEquals("WAIT_FOR_PIN", map.get("event")); - } - - @Test - public void testShouldHandleEmptyReferenceId() { - PredefinedContentHelper helper = new PredefinedContentHelper(""); - - assertFalse(helper.getEvent().isPresent()); - assertFalse(helper.getTransactionId().isPresent()); - assertFalse(helper.getTimeStamp().isPresent()); - assertTrue(helper.toMap().isEmpty()); - } - - @Test - public void testShouldHandleNullReferenceId() { - PredefinedContentHelper helper = new PredefinedContentHelper(null); - - assertFalse(helper.getEvent().isPresent()); - assertFalse(helper.getTransactionId().isPresent()); - assertFalse(helper.getTimeStamp().isPresent()); - assertTrue(helper.toMap().isEmpty()); - } -} \ No newline at end of file + @Test + public void testShouldExtractValidEvent() { + String referenceId = + "TransactionID=oLkO001517998574000&TimeStamp=2018-02-07T10%3a16%3a14.000Z&event=PIN_ENTERED"; + PredefinedContentHelper helper = new PredefinedContentHelper(referenceId); + + Optional event = helper.getEvent(); + assertTrue("Event should be present", event.isPresent()); + assertEquals(PredefinedContentHelper.DisplayNotificationEvent.PIN_ENTERED, event.get()); + } + + @Test + public void testShouldReturnEmptyForInvalidEvent() { + PredefinedContentHelper helper = new PredefinedContentHelper("event=INVALID_EVENT"); + + assertFalse("Event should not be present for invalid value", helper.getEvent().isPresent()); + } + + @Test + public void testShouldExtractTransactionId() { + PredefinedContentHelper helper = + new PredefinedContentHelper( + "TransactionID=12345&TimeStamp=2018-02-07T10%3a16%3a14.000Z&event=PIN_ENTERED"); + + Optional transactionId = helper.getTransactionId(); + assertTrue("TransactionID should be present", transactionId.isPresent()); + assertEquals("12345", transactionId.get()); + } + + @Test + public void testShouldExtractTimeStamp() { + PredefinedContentHelper helper = new PredefinedContentHelper("TimeStamp=2024-07-11T12:00:00Z"); + + Optional timeStamp = helper.getTimeStamp(); + assertTrue("TimeStamp should be present", timeStamp.isPresent()); + assertEquals("2024-07-11T12:00:00Z", timeStamp.get()); + } + + @Test + public void testShouldExtractArbitraryKey() { + PredefinedContentHelper helper = new PredefinedContentHelper("foo=bar&baz=qux"); + + Optional foo = helper.get("foo"); + assertTrue("Value for 'foo' should be present", foo.isPresent()); + assertEquals("bar", foo.get()); + + Optional baz = helper.get("baz"); + assertTrue("Value for 'baz' should be present", baz.isPresent()); + assertEquals("qux", baz.get()); + + assertFalse("Value for 'missing' should not be present", helper.get("missing").isPresent()); + } + + @Test + public void testShouldConvertParamsToMap() { + PredefinedContentHelper helper = new PredefinedContentHelper("a=1&b=2&event=WAIT_FOR_PIN"); + + Map map = helper.toMap(); + assertEquals(3, map.size()); + assertEquals("1", map.get("a")); + assertEquals("2", map.get("b")); + assertEquals("WAIT_FOR_PIN", map.get("event")); + } + + @Test + public void testShouldHandleEmptyReferenceId() { + PredefinedContentHelper helper = new PredefinedContentHelper(""); + + assertFalse(helper.getEvent().isPresent()); + assertFalse(helper.getTransactionId().isPresent()); + assertFalse(helper.getTimeStamp().isPresent()); + assertTrue(helper.toMap().isEmpty()); + } + + @Test + public void testShouldHandleNullReferenceId() { + PredefinedContentHelper helper = new PredefinedContentHelper(null); + + assertFalse(helper.getEvent().isPresent()); + assertFalse(helper.getTransactionId().isPresent()); + assertFalse(helper.getTimeStamp().isPresent()); + assertTrue(helper.toMap().isEmpty()); + } +}