From b8ea3442715eda55a16c4cdebb4dca12dfc3e867 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 23 Aug 2021 04:02:16 +0000 Subject: [PATCH 01/29] Bump gson from 2.8.7 to 2.8.8 Bumps [gson](https://github.com/google/gson) from 2.8.7 to 2.8.8. - [Release notes](https://github.com/google/gson/releases) - [Changelog](https://github.com/google/gson/blob/master/CHANGELOG.md) - [Commits](https://github.com/google/gson/compare/gson-parent-2.8.7...gson-parent-2.8.8) --- updated-dependencies: - dependency-name: com.google.code.gson:gson dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index f742a1f94..8fe19c842 100644 --- a/pom.xml +++ b/pom.xml @@ -169,7 +169,7 @@ com.google.code.gson gson - 2.8.7 + 2.8.8 com.fasterxml.jackson.core From d76fa43fb6385fd25625b340343eb181e9c70755 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 26 Aug 2021 04:01:50 +0000 Subject: [PATCH 02/29] Bump mockito-core from 3.10.0 to 3.12.4 Bumps [mockito-core](https://github.com/mockito/mockito) from 3.10.0 to 3.12.4. - [Release notes](https://github.com/mockito/mockito/releases) - [Commits](https://github.com/mockito/mockito/compare/v3.10.0...v3.12.4) --- updated-dependencies: - dependency-name: org.mockito:mockito-core dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index f742a1f94..8bcbef2d2 100644 --- a/pom.xml +++ b/pom.xml @@ -195,7 +195,7 @@ org.mockito mockito-core - 3.10.0 + 3.12.4 test From 817e6e3f87569905024b3227acb9717bb78d81f3 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 8 Sep 2021 04:01:38 +0000 Subject: [PATCH 03/29] Bump maven-javadoc-plugin from 3.3.0 to 3.3.1 Bumps [maven-javadoc-plugin](https://github.com/apache/maven-javadoc-plugin) from 3.3.0 to 3.3.1. - [Release notes](https://github.com/apache/maven-javadoc-plugin/releases) - [Commits](https://github.com/apache/maven-javadoc-plugin/compare/maven-javadoc-plugin-3.3.0...maven-javadoc-plugin-3.3.1) --- updated-dependencies: - dependency-name: org.apache.maven.plugins:maven-javadoc-plugin dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index f742a1f94..a911fc762 100644 --- a/pom.xml +++ b/pom.xml @@ -84,7 +84,7 @@ org.apache.maven.plugins maven-javadoc-plugin - 3.3.0 + 3.3.1 attach-javadocs From 1ebec3e499be533fd9b6cfd532104d9ed4288266 Mon Sep 17 00:00:00 2001 From: Wouter Boereboom Date: Wed, 29 Sep 2021 09:50:04 +0200 Subject: [PATCH 04/29] updated to checkout v68 and implemented sessions endpoint --- README.md | 2 +- src/main/java/com/adyen/Client.java | 2 +- .../CreateCheckoutSessionRequest.java | 1554 ++++++++++++++++ .../CreateCheckoutSessionResponse.java | 1601 +++++++++++++++++ src/main/java/com/adyen/service/Checkout.java | 20 + .../service/resource/checkout/Sessions.java | 36 + src/test/java/com/adyen/CheckoutTest.java | 55 +- .../mocks/checkout/sessions-success.json | 11 + 8 files changed, 3256 insertions(+), 25 deletions(-) create mode 100644 src/main/java/com/adyen/model/checkout/CreateCheckoutSessionRequest.java create mode 100644 src/main/java/com/adyen/model/checkout/CreateCheckoutSessionResponse.java create mode 100644 src/main/java/com/adyen/service/resource/checkout/Sessions.java create mode 100644 src/test/resources/mocks/checkout/sessions-success.json diff --git a/README.md b/README.md index d619b0770..f4b10048b 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ This is the officially supported Java library for using Adyen's APIs. The library supports all APIs under the following services: -* [Checkout API](https://docs.adyen.com/api-explorer/#/CheckoutService/v67/overview): Our latest integration for accepting online payments. Current supported version: **v67** +* [Checkout API](https://docs.adyen.com/api-explorer/#/CheckoutService/v68/overview): Our latest integration for accepting online payments. Current supported version: **v68** * [Payments API](https://docs.adyen.com/api-explorer/#/Payment/v52/overview): Our classic integration for online payments. Current supported version: **v52** * [Recurring API](https://docs.adyen.com/api-explorer/#/Recurring/v49/overview): Endpoints for managing saved payment details. Current supported version: **v49** * [Payouts API](https://docs.adyen.com/api-explorer/#/Payout/v51/overview): Endpoints for sending funds to your customers. Current supported version: **v51** diff --git a/src/main/java/com/adyen/Client.java b/src/main/java/com/adyen/Client.java index f47ce92c6..e84c249a8 100644 --- a/src/main/java/com/adyen/Client.java +++ b/src/main/java/com/adyen/Client.java @@ -51,7 +51,7 @@ public class Client { public static final String CHECKOUT_ENDPOINT_TEST = "https://checkout-test.adyen.com/checkout"; public static final String CHECKOUT_ENDPOINT_LIVE_SUFFIX = "-checkout-live.adyenpayments.com/checkout"; public static final String CHECKOUT_ENDPOINT_CERT_LIVE = "https://checkoutcert-live-%s.adyen.com/checkout"; - public static final String CHECKOUT_API_VERSION = "v67"; + public static final String CHECKOUT_API_VERSION = "v68"; public static final String CHECKOUT_STORED_PAYMENT_METHODS_VERSION = "v65"; public static final String BIN_LOOKUP_PAL_SUFFIX = "/pal/servlet/BinLookup/"; public static final String BIN_LOOKUP_API_VERSION = "v50"; diff --git a/src/main/java/com/adyen/model/checkout/CreateCheckoutSessionRequest.java b/src/main/java/com/adyen/model/checkout/CreateCheckoutSessionRequest.java new file mode 100644 index 000000000..902c74695 --- /dev/null +++ b/src/main/java/com/adyen/model/checkout/CreateCheckoutSessionRequest.java @@ -0,0 +1,1554 @@ +/* + * ###### + * ###### + * ############ ####( ###### #####. ###### ############ ############ + * ############# #####( ###### #####. ###### ############# ############# + * ###### #####( ###### #####. ###### ##### ###### ##### ###### + * ###### ###### #####( ###### #####. ###### ##### ##### ##### ###### + * ###### ###### #####( ###### #####. ###### ##### ##### ###### + * ############# ############# ############# ############# ##### ###### + * ############ ############ ############# ############ ##### ###### + * ###### + * ############# + * ############ + * + * Adyen Java API Library + * + * Copyright (c) 2021 Adyen B.V. + * This file is open source and available under the MIT license. + * See the LICENSE file for more info. + */ + + +package com.adyen.model.checkout; + +import java.util.Objects; + +import com.adyen.model.AccountInfo; +import com.adyen.model.Address; +import com.adyen.model.Amount; +import com.adyen.model.applicationinfo.ApplicationInfo; +import com.adyen.model.Name; +import com.adyen.model.Split; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * CreateCheckoutSessionRequest + */ +public class CreateCheckoutSessionRequest { + public static final String SERIALIZED_NAME_ACCOUNT_INFO = "accountInfo"; + @SerializedName(SERIALIZED_NAME_ACCOUNT_INFO) + private AccountInfo accountInfo; + + public static final String SERIALIZED_NAME_ADDITIONAL_AMOUNT = "additionalAmount"; + @SerializedName(SERIALIZED_NAME_ADDITIONAL_AMOUNT) + private Amount additionalAmount; + + public static final String SERIALIZED_NAME_ADDITIONAL_DATA = "additionalData"; + @SerializedName(SERIALIZED_NAME_ADDITIONAL_DATA) + private Map additionalData = null; + + public static final String SERIALIZED_NAME_ALLOWED_PAYMENT_METHODS = "allowedPaymentMethods"; + @SerializedName(SERIALIZED_NAME_ALLOWED_PAYMENT_METHODS) + private List allowedPaymentMethods = null; + + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + @SerializedName(SERIALIZED_NAME_AMOUNT) + private Amount amount; + + public static final String SERIALIZED_NAME_APPLICATION_INFO = "applicationInfo"; + @SerializedName(SERIALIZED_NAME_APPLICATION_INFO) + private ApplicationInfo applicationInfo; + + public static final String SERIALIZED_NAME_BILLING_ADDRESS = "billingAddress"; + @SerializedName(SERIALIZED_NAME_BILLING_ADDRESS) + private Address billingAddress; + + public static final String SERIALIZED_NAME_BLOCKED_PAYMENT_METHODS = "blockedPaymentMethods"; + @SerializedName(SERIALIZED_NAME_BLOCKED_PAYMENT_METHODS) + private List blockedPaymentMethods = null; + + public static final String SERIALIZED_NAME_CAPTURE_DELAY_HOURS = "captureDelayHours"; + @SerializedName(SERIALIZED_NAME_CAPTURE_DELAY_HOURS) + private Integer captureDelayHours; + + /** + * The platform where a payment transaction takes place. This field is optional for filtering out payment methods that are only available on specific platforms. If this value is not set, then we will try to infer it from the `sdkVersion` or `token`. Possible values: * iOS * Android * Web + */ + @JsonAdapter(ChannelEnum.Adapter.class) + public enum ChannelEnum { + IOS("iOS"), + + ANDROID("Android"), + + WEB("Web"); + + private final String value; + + ChannelEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static ChannelEnum fromValue(String value) { + for (ChannelEnum b : ChannelEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final ChannelEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public ChannelEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return ChannelEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_CHANNEL = "channel"; + @SerializedName(SERIALIZED_NAME_CHANNEL) + private ChannelEnum channel; + + public static final String SERIALIZED_NAME_COMPANY = "company"; + @SerializedName(SERIALIZED_NAME_COMPANY) + private Company company; + + public static final String SERIALIZED_NAME_COUNTRY_CODE = "countryCode"; + @SerializedName(SERIALIZED_NAME_COUNTRY_CODE) + private String countryCode; + + public static final String SERIALIZED_NAME_DATE_OF_BIRTH = "dateOfBirth"; + @SerializedName(SERIALIZED_NAME_DATE_OF_BIRTH) + private String dateOfBirth; + + public static final String SERIALIZED_NAME_DELIVERY_ADDRESS = "deliveryAddress"; + @SerializedName(SERIALIZED_NAME_DELIVERY_ADDRESS) + private Address deliveryAddress; + + public static final String SERIALIZED_NAME_ENABLE_ONE_CLICK = "enableOneClick"; + @SerializedName(SERIALIZED_NAME_ENABLE_ONE_CLICK) + private Boolean enableOneClick; + + public static final String SERIALIZED_NAME_ENABLE_PAY_OUT = "enablePayOut"; + @SerializedName(SERIALIZED_NAME_ENABLE_PAY_OUT) + private Boolean enablePayOut; + + public static final String SERIALIZED_NAME_ENABLE_RECURRING = "enableRecurring"; + @SerializedName(SERIALIZED_NAME_ENABLE_RECURRING) + private Boolean enableRecurring; + + public static final String SERIALIZED_NAME_EXPIRES_AT = "expiresAt"; + @SerializedName(SERIALIZED_NAME_EXPIRES_AT) + private String expiresAt; + + public static final String SERIALIZED_NAME_LINE_ITEMS = "lineItems"; + @SerializedName(SERIALIZED_NAME_LINE_ITEMS) + private List lineItems = null; + + public static final String SERIALIZED_NAME_MANDATE = "mandate"; + @SerializedName(SERIALIZED_NAME_MANDATE) + private Mandate mandate; + + public static final String SERIALIZED_NAME_MCC = "mcc"; + @SerializedName(SERIALIZED_NAME_MCC) + private String mcc; + + public static final String SERIALIZED_NAME_MERCHANT_ACCOUNT = "merchantAccount"; + @SerializedName(SERIALIZED_NAME_MERCHANT_ACCOUNT) + private String merchantAccount; + + public static final String SERIALIZED_NAME_MERCHANT_ORDER_REFERENCE = "merchantOrderReference"; + @SerializedName(SERIALIZED_NAME_MERCHANT_ORDER_REFERENCE) + private String merchantOrderReference; + + public static final String SERIALIZED_NAME_METADATA = "metadata"; + @SerializedName(SERIALIZED_NAME_METADATA) + private Map metadata = null; + + public static final String SERIALIZED_NAME_MPI_DATA = "mpiData"; + @SerializedName(SERIALIZED_NAME_MPI_DATA) + private ThreeDSecureData mpiData; + + public static final String SERIALIZED_NAME_RECURRING_EXPIRY = "recurringExpiry"; + @SerializedName(SERIALIZED_NAME_RECURRING_EXPIRY) + private String recurringExpiry; + + public static final String SERIALIZED_NAME_RECURRING_FREQUENCY = "recurringFrequency"; + @SerializedName(SERIALIZED_NAME_RECURRING_FREQUENCY) + private String recurringFrequency; + + /** + * Defines a recurring payment type. Allowed values: * `Subscription` – A transaction for a fixed or variable amount, which follows a fixed schedule. * `CardOnFile` – With a card-on-file (CoF) transaction, card details are stored to enable one-click or omnichannel journeys, or simply to streamline the checkout process. Any subscription not following a fixed schedule is also considered a card-on-file transaction. * `UnscheduledCardOnFile` – An unscheduled card-on-file (UCoF) transaction is a transaction that occurs on a non-fixed schedule and/or have variable amounts. For example, automatic top-ups when a cardholder's balance drops below a certain amount. + */ + @JsonAdapter(RecurringProcessingModelEnum.Adapter.class) + public enum RecurringProcessingModelEnum { + CARDONFILE("CardOnFile"), + + SUBSCRIPTION("Subscription"), + + UNSCHEDULEDCARDONFILE("UnscheduledCardOnFile"); + + private final String value; + + RecurringProcessingModelEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static RecurringProcessingModelEnum fromValue(String value) { + for (RecurringProcessingModelEnum b : RecurringProcessingModelEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final RecurringProcessingModelEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public RecurringProcessingModelEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return RecurringProcessingModelEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_RECURRING_PROCESSING_MODEL = "recurringProcessingModel"; + @SerializedName(SERIALIZED_NAME_RECURRING_PROCESSING_MODEL) + private RecurringProcessingModelEnum recurringProcessingModel; + + public static final String SERIALIZED_NAME_REDIRECT_FROM_ISSUER_METHOD = "redirectFromIssuerMethod"; + @SerializedName(SERIALIZED_NAME_REDIRECT_FROM_ISSUER_METHOD) + private String redirectFromIssuerMethod; + + public static final String SERIALIZED_NAME_REDIRECT_TO_ISSUER_METHOD = "redirectToIssuerMethod"; + @SerializedName(SERIALIZED_NAME_REDIRECT_TO_ISSUER_METHOD) + private String redirectToIssuerMethod; + + public static final String SERIALIZED_NAME_REFERENCE = "reference"; + @SerializedName(SERIALIZED_NAME_REFERENCE) + private String reference; + + public static final String SERIALIZED_NAME_RETURN_URL = "returnUrl"; + @SerializedName(SERIALIZED_NAME_RETURN_URL) + private String returnUrl; + + public static final String SERIALIZED_NAME_RISK_DATA = "riskData"; + @SerializedName(SERIALIZED_NAME_RISK_DATA) + private RiskData riskData; + + public static final String SERIALIZED_NAME_SHOPPER_EMAIL = "shopperEmail"; + @SerializedName(SERIALIZED_NAME_SHOPPER_EMAIL) + private String shopperEmail; + + public static final String SERIALIZED_NAME_SHOPPER_I_P = "shopperIP"; + @SerializedName(SERIALIZED_NAME_SHOPPER_I_P) + private String shopperIP; + + /** + * Specifies the sales channel, through which the shopper gives their card details, and whether the shopper is a returning customer. For the web service API, Adyen assumes Ecommerce shopper interaction by default. This field has the following possible values: * `Ecommerce` - Online transactions where the cardholder is present (online). For better authorisation rates, we recommend sending the card security code (CSC) along with the request. * `ContAuth` - Card on file and/or subscription transactions, where the cardholder is known to the merchant (returning customer). If the shopper is present (online), you can supply also the CSC to improve authorisation (one-click payment). * `Moto` - Mail-order and telephone-order transactions where the shopper is in contact with the merchant via email or telephone. * `POS` - Point-of-sale transactions where the shopper is physically present to make a payment using a secure payment terminal. + */ + @JsonAdapter(ShopperInteractionEnum.Adapter.class) + public enum ShopperInteractionEnum { + ECOMMERCE("Ecommerce"), + + CONTAUTH("ContAuth"), + + MOTO("Moto"), + + POS("POS"); + + private final String value; + + ShopperInteractionEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static ShopperInteractionEnum fromValue(String value) { + for (ShopperInteractionEnum b : ShopperInteractionEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final ShopperInteractionEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public ShopperInteractionEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return ShopperInteractionEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_SHOPPER_INTERACTION = "shopperInteraction"; + @SerializedName(SERIALIZED_NAME_SHOPPER_INTERACTION) + private ShopperInteractionEnum shopperInteraction; + + public static final String SERIALIZED_NAME_SHOPPER_LOCALE = "shopperLocale"; + @SerializedName(SERIALIZED_NAME_SHOPPER_LOCALE) + private String shopperLocale; + + public static final String SERIALIZED_NAME_SHOPPER_NAME = "shopperName"; + @SerializedName(SERIALIZED_NAME_SHOPPER_NAME) + private Name shopperName; + + public static final String SERIALIZED_NAME_SHOPPER_REFERENCE = "shopperReference"; + @SerializedName(SERIALIZED_NAME_SHOPPER_REFERENCE) + private String shopperReference; + + public static final String SERIALIZED_NAME_SHOPPER_STATEMENT = "shopperStatement"; + @SerializedName(SERIALIZED_NAME_SHOPPER_STATEMENT) + private String shopperStatement; + + public static final String SERIALIZED_NAME_SOCIAL_SECURITY_NUMBER = "socialSecurityNumber"; + @SerializedName(SERIALIZED_NAME_SOCIAL_SECURITY_NUMBER) + private String socialSecurityNumber; + + public static final String SERIALIZED_NAME_SPLIT_CARD_FUNDING_SOURCES = "splitCardFundingSources"; + @SerializedName(SERIALIZED_NAME_SPLIT_CARD_FUNDING_SOURCES) + private Boolean splitCardFundingSources = false; + + public static final String SERIALIZED_NAME_SPLITS = "splits"; + @SerializedName(SERIALIZED_NAME_SPLITS) + private List splits = null; + + public static final String SERIALIZED_NAME_STORE_PAYMENT_METHOD = "storePaymentMethod"; + @SerializedName(SERIALIZED_NAME_STORE_PAYMENT_METHOD) + private Boolean storePaymentMethod; + + public static final String SERIALIZED_NAME_TELEPHONE_NUMBER = "telephoneNumber"; + @SerializedName(SERIALIZED_NAME_TELEPHONE_NUMBER) + private String telephoneNumber; + + public static final String SERIALIZED_NAME_THREE_D_S_AUTHENTICATION_ONLY = "threeDSAuthenticationOnly"; + @SerializedName(SERIALIZED_NAME_THREE_D_S_AUTHENTICATION_ONLY) + private Boolean threeDSAuthenticationOnly = false; + + public static final String SERIALIZED_NAME_TRUSTED_SHOPPER = "trustedShopper"; + @SerializedName(SERIALIZED_NAME_TRUSTED_SHOPPER) + private Boolean trustedShopper; + + + public CreateCheckoutSessionRequest accountInfo(AccountInfo accountInfo) { + + this.accountInfo = accountInfo; + return this; + } + + /** + * Get accountInfo + * + * @return accountInfo + **/ + public AccountInfo getAccountInfo() { + return accountInfo; + } + + public void setAccountInfo(AccountInfo accountInfo) { + this.accountInfo = accountInfo; + } + + public CreateCheckoutSessionRequest additionalAmount(Amount additionalAmount) { + + this.additionalAmount = additionalAmount; + return this; + } + + /** + * Get additionalAmount + * + * @return additionalAmount + **/ + + public Amount getAdditionalAmount() { + return additionalAmount; + } + + public void setAdditionalAmount(Amount additionalAmount) { + this.additionalAmount = additionalAmount; + } + + public CreateCheckoutSessionRequest additionalData(Map additionalData) { + this.additionalData = additionalData; + return this; + } + + public CreateCheckoutSessionRequest putAdditionalDataItem(String key, String additionalDataItem) { + if (this.additionalData == null) { + this.additionalData = new HashMap(); + } + this.additionalData.put(key, additionalDataItem); + return this; + } + + /** + * This field contains additional data, which may be required for a particular payment request. The `additionalData` object consists of entries, each of which includes the key and value. + * + * @return additionalData + **/ + public Map getAdditionalData() { + return additionalData; + } + + public void setAdditionalData(Map additionalData) { + this.additionalData = additionalData; + } + + + public CreateCheckoutSessionRequest allowedPaymentMethods(List allowedPaymentMethods) { + + this.allowedPaymentMethods = allowedPaymentMethods; + return this; + } + + public CreateCheckoutSessionRequest addAllowedPaymentMethodsItem(String allowedPaymentMethodsItem) { + if (this.allowedPaymentMethods == null) { + this.allowedPaymentMethods = new ArrayList(); + } + this.allowedPaymentMethods.add(allowedPaymentMethodsItem); + return this; + } + + /** + * List of payment methods to be presented to the shopper. To refer to payment methods, use their `paymentMethod.type`from [Payment methods overview](https://docs.adyen.com/payment-methods). Example: `\"allowedPaymentMethods\":[\"ideal\",\"giropay\"]` + * + * @return allowedPaymentMethods + **/ + public List getAllowedPaymentMethods() { + return allowedPaymentMethods; + } + + + public void setAllowedPaymentMethods(List allowedPaymentMethods) { + this.allowedPaymentMethods = allowedPaymentMethods; + } + + + public CreateCheckoutSessionRequest amount(Amount amount) { + + this.amount = amount; + return this; + } + + /** + * Get amount + * + * @return amount + **/ + public Amount getAmount() { + return amount; + } + + + public void setAmount(Amount amount) { + this.amount = amount; + } + + + public CreateCheckoutSessionRequest applicationInfo(ApplicationInfo applicationInfo) { + + this.applicationInfo = applicationInfo; + return this; + } + + /** + * Get applicationInfo + * + * @return applicationInfo + **/ + public ApplicationInfo getApplicationInfo() { + return applicationInfo; + } + + public void setApplicationInfo(ApplicationInfo applicationInfo) { + this.applicationInfo = applicationInfo; + } + + public CreateCheckoutSessionRequest billingAddress(Address billingAddress) { + + this.billingAddress = billingAddress; + return this; + } + + /** + * Get billingAddress + * + * @return billingAddress + **/ + public Address getBillingAddress() { + return billingAddress; + } + + public void setBillingAddress(Address billingAddress) { + this.billingAddress = billingAddress; + } + + public CreateCheckoutSessionRequest blockedPaymentMethods(List blockedPaymentMethods) { + + this.blockedPaymentMethods = blockedPaymentMethods; + return this; + } + + public CreateCheckoutSessionRequest addBlockedPaymentMethodsItem(String blockedPaymentMethodsItem) { + if (this.blockedPaymentMethods == null) { + this.blockedPaymentMethods = new ArrayList(); + } + this.blockedPaymentMethods.add(blockedPaymentMethodsItem); + return this; + } + + /** + * List of payment methods to be hidden from the shopper. To refer to payment methods, use their `paymentMethod.type`from [Payment methods overview](https://docs.adyen.com/payment-methods). Example: `\"blockedPaymentMethods\":[\"ideal\",\"giropay\"]` + * + * @return blockedPaymentMethods + **/ + public List getBlockedPaymentMethods() { + return blockedPaymentMethods; + } + + public void setBlockedPaymentMethods(List blockedPaymentMethods) { + this.blockedPaymentMethods = blockedPaymentMethods; + } + + public CreateCheckoutSessionRequest captureDelayHours(Integer captureDelayHours) { + + this.captureDelayHours = captureDelayHours; + return this; + } + + /** + * The delay between the authorisation and scheduled auto-capture, specified in hours. + * + * @return captureDelayHours + **/ + public Integer getCaptureDelayHours() { + return captureDelayHours; + } + + + public void setCaptureDelayHours(Integer captureDelayHours) { + this.captureDelayHours = captureDelayHours; + } + + + public CreateCheckoutSessionRequest channel(ChannelEnum channel) { + + this.channel = channel; + return this; + } + + /** + * The platform where a payment transaction takes place. This field is optional for filtering out payment methods that are only available on specific platforms. If this value is not set, then we will try to infer it from the `sdkVersion` or `token`. Possible values: * iOS * Android * Web + * + * @return channel + **/ + public ChannelEnum getChannel() { + return channel; + } + + + public void setChannel(ChannelEnum channel) { + this.channel = channel; + } + + + public CreateCheckoutSessionRequest company(Company company) { + + this.company = company; + return this; + } + + /** + * Get company + * + * @return company + **/ + + + public Company getCompany() { + return company; + } + + + public void setCompany(Company company) { + this.company = company; + } + + + public CreateCheckoutSessionRequest countryCode(String countryCode) { + + this.countryCode = countryCode; + return this; + } + + /** + * The shopper's two-letter country code. + * + * @return countryCode + **/ + public String getCountryCode() { + return countryCode; + } + + + public void setCountryCode(String countryCode) { + this.countryCode = countryCode; + } + + + public CreateCheckoutSessionRequest dateOfBirth(String dateOfBirth) { + + this.dateOfBirth = dateOfBirth; + return this; + } + + /** + * The shopper's date of birth. Format [ISO-8601](https://www.w3.org/TR/NOTE-datetime): YYYY-MM-DD + * + * @return dateOfBirth + **/ + public String getDateOfBirth() { + return dateOfBirth; + } + + + public void setDateOfBirth(String dateOfBirth) { + this.dateOfBirth = dateOfBirth; + } + + + public CreateCheckoutSessionRequest deliveryAddress(Address deliveryAddress) { + + this.deliveryAddress = deliveryAddress; + return this; + } + + /** + * Get deliveryAddress + * + * @return deliveryAddress + **/ + + + public Address getDeliveryAddress() { + return deliveryAddress; + } + + + public void setDeliveryAddress(Address deliveryAddress) { + this.deliveryAddress = deliveryAddress; + } + + + public CreateCheckoutSessionRequest enableOneClick(Boolean enableOneClick) { + + this.enableOneClick = enableOneClick; + return this; + } + + /** + * When true and `shopperReference` is provided, the shopper will be asked if the payment details should be stored for future one-click payments. + * + * @return enableOneClick + **/ + public Boolean getEnableOneClick() { + return enableOneClick; + } + + + public void setEnableOneClick(Boolean enableOneClick) { + this.enableOneClick = enableOneClick; + } + + + public CreateCheckoutSessionRequest enablePayOut(Boolean enablePayOut) { + + this.enablePayOut = enablePayOut; + return this; + } + + /** + * When true and `shopperReference` is provided, the payment details will be tokenized for payouts. + * + * @return enablePayOut + **/ + public Boolean getEnablePayOut() { + return enablePayOut; + } + + + public void setEnablePayOut(Boolean enablePayOut) { + this.enablePayOut = enablePayOut; + } + + + public CreateCheckoutSessionRequest enableRecurring(Boolean enableRecurring) { + + this.enableRecurring = enableRecurring; + return this; + } + + /** + * When true and `shopperReference` is provided, the payment details will be tokenized for recurring payments. + * + * @return enableRecurring + **/ + public Boolean getEnableRecurring() { + return enableRecurring; + } + + + public void setEnableRecurring(Boolean enableRecurring) { + this.enableRecurring = enableRecurring; + } + + + public CreateCheckoutSessionRequest expiresAt(String expiresAt) { + + this.expiresAt = expiresAt; + return this; + } + + /** + * The date the session expires in ISO8601 format. When not specified, it defaults to 1h after creation. + * + * @return expiresAt + **/ + public String getExpiresAt() { + return expiresAt; + } + + + public void setExpiresAt(String expiresAt) { + this.expiresAt = expiresAt; + } + + + public CreateCheckoutSessionRequest lineItems(List lineItems) { + + this.lineItems = lineItems; + return this; + } + + public CreateCheckoutSessionRequest addLineItemsItem(LineItem lineItemsItem) { + if (this.lineItems == null) { + this.lineItems = new ArrayList(); + } + this.lineItems.add(lineItemsItem); + return this; + } + + /** + * Price and product information about the purchased items, to be included on the invoice sent to the shopper. > This field is required for 3x 4x Oney, Affirm, Afterpay, Clearpay, Klarna, Ratepay, and Zip. + * + * @return lineItems + **/ + public List getLineItems() { + return lineItems; + } + + + public void setLineItems(List lineItems) { + this.lineItems = lineItems; + } + + + public CreateCheckoutSessionRequest mandate(Mandate mandate) { + + this.mandate = mandate; + return this; + } + + /** + * Get mandate + * + * @return mandate + **/ + + + public Mandate getMandate() { + return mandate; + } + + + public void setMandate(Mandate mandate) { + this.mandate = mandate; + } + + + public CreateCheckoutSessionRequest mcc(String mcc) { + + this.mcc = mcc; + return this; + } + + /** + * The [merchant category code](https://en.wikipedia.org/wiki/Merchant_category_code) (MCC) is a four-digit number, which relates to a particular market segment. This code reflects the predominant activity that is conducted by the merchant. + * + * @return mcc + **/ + public String getMcc() { + return mcc; + } + + + public void setMcc(String mcc) { + this.mcc = mcc; + } + + + public CreateCheckoutSessionRequest merchantAccount(String merchantAccount) { + + this.merchantAccount = merchantAccount; + return this; + } + + /** + * The merchant account identifier, with which you want to process the transaction. + * + * @return merchantAccount + **/ + public String getMerchantAccount() { + return merchantAccount; + } + + + public void setMerchantAccount(String merchantAccount) { + this.merchantAccount = merchantAccount; + } + + + public CreateCheckoutSessionRequest merchantOrderReference(String merchantOrderReference) { + + this.merchantOrderReference = merchantOrderReference; + return this; + } + + /** + * This reference allows linking multiple transactions to each other for reporting purposes (i.e. order auth-rate). The reference should be unique per billing cycle. The same merchant order reference should never be reused after the first authorised attempt. If used, this field should be supplied for all incoming authorisations. > We strongly recommend you send the `merchantOrderReference` value to benefit from linking payment requests when authorisation retries take place. In addition, we recommend you provide `retry.orderAttemptNumber`, `retry.chainAttemptNumber`, and `retry.skipRetry` values in `PaymentRequest.additionalData`. + * + * @return merchantOrderReference + **/ + public String getMerchantOrderReference() { + return merchantOrderReference; + } + + + public void setMerchantOrderReference(String merchantOrderReference) { + this.merchantOrderReference = merchantOrderReference; + } + + + public CreateCheckoutSessionRequest metadata(Map metadata) { + + this.metadata = metadata; + return this; + } + + public CreateCheckoutSessionRequest putMetadataItem(String key, String metadataItem) { + if (this.metadata == null) { + this.metadata = new HashMap(); + } + this.metadata.put(key, metadataItem); + return this; + } + + /** + * Metadata consists of entries, each of which includes a key and a value. Limits: * Maximum 20 key-value pairs per request.* Maximum 20 characters per key. * Maximum 80 characters per value. + * + * @return metadata + **/ + public Map getMetadata() { + return metadata; + } + + + public void setMetadata(Map metadata) { + this.metadata = metadata; + } + + + public CreateCheckoutSessionRequest mpiData(ThreeDSecureData mpiData) { + + this.mpiData = mpiData; + return this; + } + + /** + * Get mpiData + * + * @return mpiData + **/ + + + public ThreeDSecureData getMpiData() { + return mpiData; + } + + + public void setMpiData(ThreeDSecureData mpiData) { + this.mpiData = mpiData; + } + + + public CreateCheckoutSessionRequest recurringExpiry(String recurringExpiry) { + + this.recurringExpiry = recurringExpiry; + return this; + } + + /** + * Date after which no further authorisations shall be performed. Only for 3D Secure 2. + * + * @return recurringExpiry + **/ + public String getRecurringExpiry() { + return recurringExpiry; + } + + + public void setRecurringExpiry(String recurringExpiry) { + this.recurringExpiry = recurringExpiry; + } + + + public CreateCheckoutSessionRequest recurringFrequency(String recurringFrequency) { + + this.recurringFrequency = recurringFrequency; + return this; + } + + /** + * Minimum number of days between authorisations. Only for 3D Secure 2. + * + * @return recurringFrequency + **/ + public String getRecurringFrequency() { + return recurringFrequency; + } + + + public void setRecurringFrequency(String recurringFrequency) { + this.recurringFrequency = recurringFrequency; + } + + + public CreateCheckoutSessionRequest recurringProcessingModel(RecurringProcessingModelEnum recurringProcessingModel) { + + this.recurringProcessingModel = recurringProcessingModel; + return this; + } + + /** + * Defines a recurring payment type. Allowed values: * `Subscription` – A transaction for a fixed or variable amount, which follows a fixed schedule. * `CardOnFile` – With a card-on-file (CoF) transaction, card details are stored to enable one-click or omnichannel journeys, or simply to streamline the checkout process. Any subscription not following a fixed schedule is also considered a card-on-file transaction. * `UnscheduledCardOnFile` – An unscheduled card-on-file (UCoF) transaction is a transaction that occurs on a non-fixed schedule and/or have variable amounts. For example, automatic top-ups when a cardholder's balance drops below a certain amount. + * + * @return recurringProcessingModel + **/ + public RecurringProcessingModelEnum getRecurringProcessingModel() { + return recurringProcessingModel; + } + + + public void setRecurringProcessingModel(RecurringProcessingModelEnum recurringProcessingModel) { + this.recurringProcessingModel = recurringProcessingModel; + } + + + public CreateCheckoutSessionRequest redirectFromIssuerMethod(String redirectFromIssuerMethod) { + + this.redirectFromIssuerMethod = redirectFromIssuerMethod; + return this; + } + + /** + * Specifies the redirect method (GET or POST) when redirecting back from the issuer. + * + * @return redirectFromIssuerMethod + **/ + public String getRedirectFromIssuerMethod() { + return redirectFromIssuerMethod; + } + + + public void setRedirectFromIssuerMethod(String redirectFromIssuerMethod) { + this.redirectFromIssuerMethod = redirectFromIssuerMethod; + } + + + public CreateCheckoutSessionRequest redirectToIssuerMethod(String redirectToIssuerMethod) { + + this.redirectToIssuerMethod = redirectToIssuerMethod; + return this; + } + + /** + * Specifies the redirect method (GET or POST) when redirecting to the issuer. + * + * @return redirectToIssuerMethod + **/ + public String getRedirectToIssuerMethod() { + return redirectToIssuerMethod; + } + + + public void setRedirectToIssuerMethod(String redirectToIssuerMethod) { + this.redirectToIssuerMethod = redirectToIssuerMethod; + } + + + public CreateCheckoutSessionRequest reference(String reference) { + + this.reference = reference; + return this; + } + + /** + * The reference to uniquely identify a payment. + * + * @return reference + **/ + public String getReference() { + return reference; + } + + + public void setReference(String reference) { + this.reference = reference; + } + + + public CreateCheckoutSessionRequest returnUrl(String returnUrl) { + + this.returnUrl = returnUrl; + return this; + } + + /** + * The URL to return to when a redirect payment is completed. + * + * @return returnUrl + **/ + public String getReturnUrl() { + return returnUrl; + } + + + public void setReturnUrl(String returnUrl) { + this.returnUrl = returnUrl; + } + + + public CreateCheckoutSessionRequest riskData(RiskData riskData) { + + this.riskData = riskData; + return this; + } + + /** + * Get riskData + * + * @return riskData + **/ + + + public RiskData getRiskData() { + return riskData; + } + + + public void setRiskData(RiskData riskData) { + this.riskData = riskData; + } + + + public CreateCheckoutSessionRequest shopperEmail(String shopperEmail) { + + this.shopperEmail = shopperEmail; + return this; + } + + /** + * The shopper's email address. + * + * @return shopperEmail + **/ + public String getShopperEmail() { + return shopperEmail; + } + + + public void setShopperEmail(String shopperEmail) { + this.shopperEmail = shopperEmail; + } + + + public CreateCheckoutSessionRequest shopperIP(String shopperIP) { + + this.shopperIP = shopperIP; + return this; + } + + /** + * The shopper's IP address. In general, we recommend that you provide this data, as it is used in a number of risk checks (for instance, number of payment attempts or location-based checks). > For 3D Secure 2 transactions, schemes require `shopperIP` for all browser-based implementations. This field is also mandatory for some merchants depending on your business model. For more information, [contact Support](https://support.adyen.com/hc/en-us/requests/new). + * + * @return shopperIP + **/ + public String getShopperIP() { + return shopperIP; + } + + + public void setShopperIP(String shopperIP) { + this.shopperIP = shopperIP; + } + + + public CreateCheckoutSessionRequest shopperInteraction(ShopperInteractionEnum shopperInteraction) { + + this.shopperInteraction = shopperInteraction; + return this; + } + + /** + * Specifies the sales channel, through which the shopper gives their card details, and whether the shopper is a returning customer. For the web service API, Adyen assumes Ecommerce shopper interaction by default. This field has the following possible values: * `Ecommerce` - Online transactions where the cardholder is present (online). For better authorisation rates, we recommend sending the card security code (CSC) along with the request. * `ContAuth` - Card on file and/or subscription transactions, where the cardholder is known to the merchant (returning customer). If the shopper is present (online), you can supply also the CSC to improve authorisation (one-click payment). * `Moto` - Mail-order and telephone-order transactions where the shopper is in contact with the merchant via email or telephone. * `POS` - Point-of-sale transactions where the shopper is physically present to make a payment using a secure payment terminal. + * + * @return shopperInteraction + **/ + public ShopperInteractionEnum getShopperInteraction() { + return shopperInteraction; + } + + + public void setShopperInteraction(ShopperInteractionEnum shopperInteraction) { + this.shopperInteraction = shopperInteraction; + } + + + public CreateCheckoutSessionRequest shopperLocale(String shopperLocale) { + + this.shopperLocale = shopperLocale; + return this; + } + + /** + * The combination of a language code and a country code to specify the language to be used in the payment. + * + * @return shopperLocale + **/ + public String getShopperLocale() { + return shopperLocale; + } + + + public void setShopperLocale(String shopperLocale) { + this.shopperLocale = shopperLocale; + } + + + public CreateCheckoutSessionRequest shopperName(Name shopperName) { + + this.shopperName = shopperName; + return this; + } + + /** + * Get shopperName + * + * @return shopperName + **/ + + + public Name getShopperName() { + return shopperName; + } + + + public void setShopperName(Name shopperName) { + this.shopperName = shopperName; + } + + + public CreateCheckoutSessionRequest shopperReference(String shopperReference) { + + this.shopperReference = shopperReference; + return this; + } + + /** + * Your reference to uniquely identify this shopper, for example user ID or account ID. Minimum length: 3 characters. > Your reference must not include personally identifiable information (PII), for example name or email address. + * + * @return shopperReference + **/ + public String getShopperReference() { + return shopperReference; + } + + + public void setShopperReference(String shopperReference) { + this.shopperReference = shopperReference; + } + + + public CreateCheckoutSessionRequest shopperStatement(String shopperStatement) { + + this.shopperStatement = shopperStatement; + return this; + } + + /** + * The text to be shown on the shopper's bank statement. To enable this field, contact our [Support Team](https://support.adyen.com/hc/en-us/requests/new). We recommend sending a maximum of 22 characters, otherwise banks might truncate the string. + * + * @return shopperStatement + **/ + public String getShopperStatement() { + return shopperStatement; + } + + + public void setShopperStatement(String shopperStatement) { + this.shopperStatement = shopperStatement; + } + + + public CreateCheckoutSessionRequest socialSecurityNumber(String socialSecurityNumber) { + + this.socialSecurityNumber = socialSecurityNumber; + return this; + } + + /** + * The shopper's social security number. + * + * @return socialSecurityNumber + **/ + public String getSocialSecurityNumber() { + return socialSecurityNumber; + } + + + public void setSocialSecurityNumber(String socialSecurityNumber) { + this.socialSecurityNumber = socialSecurityNumber; + } + + + public CreateCheckoutSessionRequest splitCardFundingSources(Boolean splitCardFundingSources) { + + this.splitCardFundingSources = splitCardFundingSources; + return this; + } + + /** + * Boolean value indicating whether the card payment method should be split into separate debit and credit options. + * + * @return splitCardFundingSources + **/ + public Boolean getSplitCardFundingSources() { + return splitCardFundingSources; + } + + + public void setSplitCardFundingSources(Boolean splitCardFundingSources) { + this.splitCardFundingSources = splitCardFundingSources; + } + + + public CreateCheckoutSessionRequest splits(List splits) { + + this.splits = splits; + return this; + } + + public CreateCheckoutSessionRequest addSplitsItem(Split splitsItem) { + if (this.splits == null) { + this.splits = new ArrayList(); + } + this.splits.add(splitsItem); + return this; + } + + /** + * An array of objects specifying how the payment should be split when using [Adyen for Platforms](https://docs.adyen.com/platforms/processing-payments#providing-split-information) or [Issuing](https://docs.adyen.com/issuing/manage-funds#split). + * + * @return splits + **/ + public List getSplits() { + return splits; + } + + + public void setSplits(List splits) { + this.splits = splits; + } + + + public CreateCheckoutSessionRequest storePaymentMethod(Boolean storePaymentMethod) { + + this.storePaymentMethod = storePaymentMethod; + return this; + } + + /** + * When this is set to **true** and the `shopperReference` is provided, the payment details will be stored. + * + * @return storePaymentMethod + **/ + public Boolean getStorePaymentMethod() { + return storePaymentMethod; + } + + + public void setStorePaymentMethod(Boolean storePaymentMethod) { + this.storePaymentMethod = storePaymentMethod; + } + + + public CreateCheckoutSessionRequest telephoneNumber(String telephoneNumber) { + + this.telephoneNumber = telephoneNumber; + return this; + } + + /** + * The shopper's telephone number. + * + * @return telephoneNumber + **/ + public String getTelephoneNumber() { + return telephoneNumber; + } + + + public void setTelephoneNumber(String telephoneNumber) { + this.telephoneNumber = telephoneNumber; + } + + + public CreateCheckoutSessionRequest threeDSAuthenticationOnly(Boolean threeDSAuthenticationOnly) { + + this.threeDSAuthenticationOnly = threeDSAuthenticationOnly; + return this; + } + + /** + * If set to true, you will only perform the [3D Secure 2 authentication](https://docs.adyen.com/online-payments/3d-secure/other-3ds-flows/authentication-only), and not the payment authorisation. + * + * @return threeDSAuthenticationOnly + **/ + public Boolean getThreeDSAuthenticationOnly() { + return threeDSAuthenticationOnly; + } + + + public void setThreeDSAuthenticationOnly(Boolean threeDSAuthenticationOnly) { + this.threeDSAuthenticationOnly = threeDSAuthenticationOnly; + } + + + public CreateCheckoutSessionRequest trustedShopper(Boolean trustedShopper) { + + this.trustedShopper = trustedShopper; + return this; + } + + /** + * Set to true if the payment should be routed to a trusted MID. + * + * @return trustedShopper + **/ + public Boolean getTrustedShopper() { + return trustedShopper; + } + + + public void setTrustedShopper(Boolean trustedShopper) { + this.trustedShopper = trustedShopper; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateCheckoutSessionRequest createCheckoutSessionRequest = (CreateCheckoutSessionRequest) o; + return Objects.equals(this.accountInfo, createCheckoutSessionRequest.accountInfo) && + Objects.equals(this.additionalAmount, createCheckoutSessionRequest.additionalAmount) && + Objects.equals(this.additionalData, createCheckoutSessionRequest.additionalData) && + Objects.equals(this.allowedPaymentMethods, createCheckoutSessionRequest.allowedPaymentMethods) && + Objects.equals(this.amount, createCheckoutSessionRequest.amount) && + Objects.equals(this.applicationInfo, createCheckoutSessionRequest.applicationInfo) && + Objects.equals(this.billingAddress, createCheckoutSessionRequest.billingAddress) && + Objects.equals(this.blockedPaymentMethods, createCheckoutSessionRequest.blockedPaymentMethods) && + Objects.equals(this.captureDelayHours, createCheckoutSessionRequest.captureDelayHours) && + Objects.equals(this.channel, createCheckoutSessionRequest.channel) && + Objects.equals(this.company, createCheckoutSessionRequest.company) && + Objects.equals(this.countryCode, createCheckoutSessionRequest.countryCode) && + Objects.equals(this.dateOfBirth, createCheckoutSessionRequest.dateOfBirth) && + Objects.equals(this.deliveryAddress, createCheckoutSessionRequest.deliveryAddress) && + Objects.equals(this.enableOneClick, createCheckoutSessionRequest.enableOneClick) && + Objects.equals(this.enablePayOut, createCheckoutSessionRequest.enablePayOut) && + Objects.equals(this.enableRecurring, createCheckoutSessionRequest.enableRecurring) && + Objects.equals(this.expiresAt, createCheckoutSessionRequest.expiresAt) && + Objects.equals(this.lineItems, createCheckoutSessionRequest.lineItems) && + Objects.equals(this.mandate, createCheckoutSessionRequest.mandate) && + Objects.equals(this.mcc, createCheckoutSessionRequest.mcc) && + Objects.equals(this.merchantAccount, createCheckoutSessionRequest.merchantAccount) && + Objects.equals(this.merchantOrderReference, createCheckoutSessionRequest.merchantOrderReference) && + Objects.equals(this.metadata, createCheckoutSessionRequest.metadata) && + Objects.equals(this.mpiData, createCheckoutSessionRequest.mpiData) && + Objects.equals(this.recurringExpiry, createCheckoutSessionRequest.recurringExpiry) && + Objects.equals(this.recurringFrequency, createCheckoutSessionRequest.recurringFrequency) && + Objects.equals(this.recurringProcessingModel, createCheckoutSessionRequest.recurringProcessingModel) && + Objects.equals(this.redirectFromIssuerMethod, createCheckoutSessionRequest.redirectFromIssuerMethod) && + Objects.equals(this.redirectToIssuerMethod, createCheckoutSessionRequest.redirectToIssuerMethod) && + Objects.equals(this.reference, createCheckoutSessionRequest.reference) && + Objects.equals(this.returnUrl, createCheckoutSessionRequest.returnUrl) && + Objects.equals(this.riskData, createCheckoutSessionRequest.riskData) && + Objects.equals(this.shopperEmail, createCheckoutSessionRequest.shopperEmail) && + Objects.equals(this.shopperIP, createCheckoutSessionRequest.shopperIP) && + Objects.equals(this.shopperInteraction, createCheckoutSessionRequest.shopperInteraction) && + Objects.equals(this.shopperLocale, createCheckoutSessionRequest.shopperLocale) && + Objects.equals(this.shopperName, createCheckoutSessionRequest.shopperName) && + Objects.equals(this.shopperReference, createCheckoutSessionRequest.shopperReference) && + Objects.equals(this.shopperStatement, createCheckoutSessionRequest.shopperStatement) && + Objects.equals(this.socialSecurityNumber, createCheckoutSessionRequest.socialSecurityNumber) && + Objects.equals(this.splitCardFundingSources, createCheckoutSessionRequest.splitCardFundingSources) && + Objects.equals(this.splits, createCheckoutSessionRequest.splits) && + Objects.equals(this.storePaymentMethod, createCheckoutSessionRequest.storePaymentMethod) && + Objects.equals(this.telephoneNumber, createCheckoutSessionRequest.telephoneNumber) && + Objects.equals(this.threeDSAuthenticationOnly, createCheckoutSessionRequest.threeDSAuthenticationOnly) && + Objects.equals(this.trustedShopper, createCheckoutSessionRequest.trustedShopper); + } + + @Override + public int hashCode() { + return Objects.hash(accountInfo, additionalAmount, additionalData, allowedPaymentMethods, amount, applicationInfo, billingAddress, blockedPaymentMethods, captureDelayHours, channel, company, countryCode, dateOfBirth, deliveryAddress, enableOneClick, enablePayOut, enableRecurring, expiresAt, lineItems, mandate, mcc, merchantAccount, merchantOrderReference, metadata, mpiData, recurringExpiry, recurringFrequency, recurringProcessingModel, redirectFromIssuerMethod, redirectToIssuerMethod, reference, returnUrl, riskData, shopperEmail, shopperIP, shopperInteraction, shopperLocale, shopperName, shopperReference, shopperStatement, socialSecurityNumber, splitCardFundingSources, splits, storePaymentMethod, telephoneNumber, threeDSAuthenticationOnly, trustedShopper); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateCheckoutSessionRequest {\n"); + sb.append(" accountInfo: ").append(toIndentedString(accountInfo)).append("\n"); + sb.append(" additionalAmount: ").append(toIndentedString(additionalAmount)).append("\n"); + sb.append(" additionalData: ").append(toIndentedString(additionalData)).append("\n"); + sb.append(" allowedPaymentMethods: ").append(toIndentedString(allowedPaymentMethods)).append("\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" applicationInfo: ").append(toIndentedString(applicationInfo)).append("\n"); + sb.append(" billingAddress: ").append(toIndentedString(billingAddress)).append("\n"); + sb.append(" blockedPaymentMethods: ").append(toIndentedString(blockedPaymentMethods)).append("\n"); + sb.append(" captureDelayHours: ").append(toIndentedString(captureDelayHours)).append("\n"); + sb.append(" channel: ").append(toIndentedString(channel)).append("\n"); + sb.append(" company: ").append(toIndentedString(company)).append("\n"); + sb.append(" countryCode: ").append(toIndentedString(countryCode)).append("\n"); + sb.append(" dateOfBirth: ").append(toIndentedString(dateOfBirth)).append("\n"); + sb.append(" deliveryAddress: ").append(toIndentedString(deliveryAddress)).append("\n"); + sb.append(" enableOneClick: ").append(toIndentedString(enableOneClick)).append("\n"); + sb.append(" enablePayOut: ").append(toIndentedString(enablePayOut)).append("\n"); + sb.append(" enableRecurring: ").append(toIndentedString(enableRecurring)).append("\n"); + sb.append(" expiresAt: ").append(toIndentedString(expiresAt)).append("\n"); + sb.append(" lineItems: ").append(toIndentedString(lineItems)).append("\n"); + sb.append(" mandate: ").append(toIndentedString(mandate)).append("\n"); + sb.append(" mcc: ").append(toIndentedString(mcc)).append("\n"); + sb.append(" merchantAccount: ").append(toIndentedString(merchantAccount)).append("\n"); + sb.append(" merchantOrderReference: ").append(toIndentedString(merchantOrderReference)).append("\n"); + sb.append(" metadata: ").append(toIndentedString(metadata)).append("\n"); + sb.append(" mpiData: ").append(toIndentedString(mpiData)).append("\n"); + sb.append(" recurringExpiry: ").append(toIndentedString(recurringExpiry)).append("\n"); + sb.append(" recurringFrequency: ").append(toIndentedString(recurringFrequency)).append("\n"); + sb.append(" recurringProcessingModel: ").append(toIndentedString(recurringProcessingModel)).append("\n"); + sb.append(" redirectFromIssuerMethod: ").append(toIndentedString(redirectFromIssuerMethod)).append("\n"); + sb.append(" redirectToIssuerMethod: ").append(toIndentedString(redirectToIssuerMethod)).append("\n"); + sb.append(" reference: ").append(toIndentedString(reference)).append("\n"); + sb.append(" returnUrl: ").append(toIndentedString(returnUrl)).append("\n"); + sb.append(" riskData: ").append(toIndentedString(riskData)).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"); + sb.append(" shopperLocale: ").append(toIndentedString(shopperLocale)).append("\n"); + sb.append(" shopperName: ").append(toIndentedString(shopperName)).append("\n"); + sb.append(" shopperReference: ").append(toIndentedString(shopperReference)).append("\n"); + sb.append(" shopperStatement: ").append(toIndentedString(shopperStatement)).append("\n"); + sb.append(" socialSecurityNumber: ").append(toIndentedString(socialSecurityNumber)).append("\n"); + sb.append(" splitCardFundingSources: ").append(toIndentedString(splitCardFundingSources)).append("\n"); + sb.append(" splits: ").append(toIndentedString(splits)).append("\n"); + sb.append(" storePaymentMethod: ").append(toIndentedString(storePaymentMethod)).append("\n"); + sb.append(" telephoneNumber: ").append(toIndentedString(telephoneNumber)).append("\n"); + sb.append(" threeDSAuthenticationOnly: ").append(toIndentedString(threeDSAuthenticationOnly)).append("\n"); + sb.append(" trustedShopper: ").append(toIndentedString(trustedShopper)).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 "); + } + +} + + diff --git a/src/main/java/com/adyen/model/checkout/CreateCheckoutSessionResponse.java b/src/main/java/com/adyen/model/checkout/CreateCheckoutSessionResponse.java new file mode 100644 index 000000000..1d640a46d --- /dev/null +++ b/src/main/java/com/adyen/model/checkout/CreateCheckoutSessionResponse.java @@ -0,0 +1,1601 @@ +/* + * ###### + * ###### + * ############ ####( ###### #####. ###### ############ ############ + * ############# #####( ###### #####. ###### ############# ############# + * ###### #####( ###### #####. ###### ##### ###### ##### ###### + * ###### ###### #####( ###### #####. ###### ##### ##### ##### ###### + * ###### ###### #####( ###### #####. ###### ##### ##### ###### + * ############# ############# ############# ############# ##### ###### + * ############ ############ ############# ############ ##### ###### + * ###### + * ############# + * ############ + * + * Adyen Java API Library + * + * Copyright (c) 2021 Adyen B.V. + * This file is open source and available under the MIT license. + * See the LICENSE file for more info. + */ + + +package com.adyen.model.checkout; + +import java.util.Objects; +import java.util.Arrays; + +import com.adyen.model.AccountInfo; +import com.adyen.model.Address; +import com.adyen.model.Amount; +import com.adyen.model.applicationinfo.ApplicationInfo; +import com.adyen.model.checkout.Company; +import com.adyen.model.checkout.LineItem; +import com.adyen.model.checkout.Mandate; +import com.adyen.model.Name; +import com.adyen.model.checkout.RiskData; +import com.adyen.model.Split; +import com.adyen.model.checkout.ThreeDSecureData; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * CreateCheckoutSessionResponse + */ +public class CreateCheckoutSessionResponse { + public static final String SERIALIZED_NAME_ACCOUNT_INFO = "accountInfo"; + @SerializedName(SERIALIZED_NAME_ACCOUNT_INFO) + private AccountInfo accountInfo; + + public static final String SERIALIZED_NAME_ADDITIONAL_AMOUNT = "additionalAmount"; + @SerializedName(SERIALIZED_NAME_ADDITIONAL_AMOUNT) + private Amount additionalAmount; + + public static final String SERIALIZED_NAME_ADDITIONAL_DATA = "additionalData"; + @SerializedName(SERIALIZED_NAME_ADDITIONAL_DATA) + private Map additionalData = null; + + public static final String SERIALIZED_NAME_ALLOWED_PAYMENT_METHODS = "allowedPaymentMethods"; + @SerializedName(SERIALIZED_NAME_ALLOWED_PAYMENT_METHODS) + private List allowedPaymentMethods = null; + + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + @SerializedName(SERIALIZED_NAME_AMOUNT) + private Amount amount; + + public static final String SERIALIZED_NAME_APPLICATION_INFO = "applicationInfo"; + @SerializedName(SERIALIZED_NAME_APPLICATION_INFO) + private ApplicationInfo applicationInfo; + + public static final String SERIALIZED_NAME_BILLING_ADDRESS = "billingAddress"; + @SerializedName(SERIALIZED_NAME_BILLING_ADDRESS) + private Address billingAddress; + + public static final String SERIALIZED_NAME_BLOCKED_PAYMENT_METHODS = "blockedPaymentMethods"; + @SerializedName(SERIALIZED_NAME_BLOCKED_PAYMENT_METHODS) + private List blockedPaymentMethods = null; + + public static final String SERIALIZED_NAME_CAPTURE_DELAY_HOURS = "captureDelayHours"; + @SerializedName(SERIALIZED_NAME_CAPTURE_DELAY_HOURS) + private Integer captureDelayHours; + + /** + * The platform where a payment transaction takes place. This field is optional for filtering out payment methods that are only available on specific platforms. If this value is not set, then we will try to infer it from the `sdkVersion` or `token`. Possible values: * iOS * Android * Web + */ + @JsonAdapter(ChannelEnum.Adapter.class) + public enum ChannelEnum { + IOS("iOS"), + + ANDROID("Android"), + + WEB("Web"); + + private final String value; + + ChannelEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static ChannelEnum fromValue(String value) { + for (ChannelEnum b : ChannelEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final ChannelEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public ChannelEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return ChannelEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_CHANNEL = "channel"; + @SerializedName(SERIALIZED_NAME_CHANNEL) + private ChannelEnum channel; + + public static final String SERIALIZED_NAME_COMPANY = "company"; + @SerializedName(SERIALIZED_NAME_COMPANY) + private Company company; + + public static final String SERIALIZED_NAME_COUNTRY_CODE = "countryCode"; + @SerializedName(SERIALIZED_NAME_COUNTRY_CODE) + private String countryCode; + + public static final String SERIALIZED_NAME_DATE_OF_BIRTH = "dateOfBirth"; + @SerializedName(SERIALIZED_NAME_DATE_OF_BIRTH) + private String dateOfBirth; + + public static final String SERIALIZED_NAME_DELIVERY_ADDRESS = "deliveryAddress"; + @SerializedName(SERIALIZED_NAME_DELIVERY_ADDRESS) + private Address deliveryAddress; + + public static final String SERIALIZED_NAME_ENABLE_ONE_CLICK = "enableOneClick"; + @SerializedName(SERIALIZED_NAME_ENABLE_ONE_CLICK) + private Boolean enableOneClick; + + public static final String SERIALIZED_NAME_ENABLE_PAY_OUT = "enablePayOut"; + @SerializedName(SERIALIZED_NAME_ENABLE_PAY_OUT) + private Boolean enablePayOut; + + public static final String SERIALIZED_NAME_ENABLE_RECURRING = "enableRecurring"; + @SerializedName(SERIALIZED_NAME_ENABLE_RECURRING) + private Boolean enableRecurring; + + public static final String SERIALIZED_NAME_EXPIRES_AT = "expiresAt"; + @SerializedName(SERIALIZED_NAME_EXPIRES_AT) + private String expiresAt; + + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + private String id; + + public static final String SERIALIZED_NAME_LINE_ITEMS = "lineItems"; + @SerializedName(SERIALIZED_NAME_LINE_ITEMS) + private List lineItems = null; + + public static final String SERIALIZED_NAME_MANDATE = "mandate"; + @SerializedName(SERIALIZED_NAME_MANDATE) + private Mandate mandate; + + public static final String SERIALIZED_NAME_MCC = "mcc"; + @SerializedName(SERIALIZED_NAME_MCC) + private String mcc; + + public static final String SERIALIZED_NAME_MERCHANT_ACCOUNT = "merchantAccount"; + @SerializedName(SERIALIZED_NAME_MERCHANT_ACCOUNT) + private String merchantAccount; + + public static final String SERIALIZED_NAME_MERCHANT_ORDER_REFERENCE = "merchantOrderReference"; + @SerializedName(SERIALIZED_NAME_MERCHANT_ORDER_REFERENCE) + private String merchantOrderReference; + + public static final String SERIALIZED_NAME_METADATA = "metadata"; + @SerializedName(SERIALIZED_NAME_METADATA) + private Map metadata = null; + + public static final String SERIALIZED_NAME_MPI_DATA = "mpiData"; + @SerializedName(SERIALIZED_NAME_MPI_DATA) + private ThreeDSecureData mpiData; + + public static final String SERIALIZED_NAME_RECURRING_EXPIRY = "recurringExpiry"; + @SerializedName(SERIALIZED_NAME_RECURRING_EXPIRY) + private String recurringExpiry; + + public static final String SERIALIZED_NAME_RECURRING_FREQUENCY = "recurringFrequency"; + @SerializedName(SERIALIZED_NAME_RECURRING_FREQUENCY) + private String recurringFrequency; + + /** + * Defines a recurring payment type. Allowed values: * `Subscription` – A transaction for a fixed or variable amount, which follows a fixed schedule. * `CardOnFile` – With a card-on-file (CoF) transaction, card details are stored to enable one-click or omnichannel journeys, or simply to streamline the checkout process. Any subscription not following a fixed schedule is also considered a card-on-file transaction. * `UnscheduledCardOnFile` – An unscheduled card-on-file (UCoF) transaction is a transaction that occurs on a non-fixed schedule and/or have variable amounts. For example, automatic top-ups when a cardholder's balance drops below a certain amount. + */ + @JsonAdapter(RecurringProcessingModelEnum.Adapter.class) + public enum RecurringProcessingModelEnum { + CARDONFILE("CardOnFile"), + + SUBSCRIPTION("Subscription"), + + UNSCHEDULEDCARDONFILE("UnscheduledCardOnFile"); + + private final String value; + + RecurringProcessingModelEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static RecurringProcessingModelEnum fromValue(String value) { + for (RecurringProcessingModelEnum b : RecurringProcessingModelEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final RecurringProcessingModelEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public RecurringProcessingModelEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return RecurringProcessingModelEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_RECURRING_PROCESSING_MODEL = "recurringProcessingModel"; + @SerializedName(SERIALIZED_NAME_RECURRING_PROCESSING_MODEL) + private RecurringProcessingModelEnum recurringProcessingModel; + + public static final String SERIALIZED_NAME_REDIRECT_FROM_ISSUER_METHOD = "redirectFromIssuerMethod"; + @SerializedName(SERIALIZED_NAME_REDIRECT_FROM_ISSUER_METHOD) + private String redirectFromIssuerMethod; + + public static final String SERIALIZED_NAME_REDIRECT_TO_ISSUER_METHOD = "redirectToIssuerMethod"; + @SerializedName(SERIALIZED_NAME_REDIRECT_TO_ISSUER_METHOD) + private String redirectToIssuerMethod; + + public static final String SERIALIZED_NAME_REFERENCE = "reference"; + @SerializedName(SERIALIZED_NAME_REFERENCE) + private String reference; + + public static final String SERIALIZED_NAME_RETURN_URL = "returnUrl"; + @SerializedName(SERIALIZED_NAME_RETURN_URL) + private String returnUrl; + + public static final String SERIALIZED_NAME_RISK_DATA = "riskData"; + @SerializedName(SERIALIZED_NAME_RISK_DATA) + private RiskData riskData; + + public static final String SERIALIZED_NAME_SESSION_DATA = "sessionData"; + @SerializedName(SERIALIZED_NAME_SESSION_DATA) + private String sessionData; + + public static final String SERIALIZED_NAME_SHOPPER_EMAIL = "shopperEmail"; + @SerializedName(SERIALIZED_NAME_SHOPPER_EMAIL) + private String shopperEmail; + + public static final String SERIALIZED_NAME_SHOPPER_I_P = "shopperIP"; + @SerializedName(SERIALIZED_NAME_SHOPPER_I_P) + private String shopperIP; + + /** + * Specifies the sales channel, through which the shopper gives their card details, and whether the shopper is a returning customer. For the web service API, Adyen assumes Ecommerce shopper interaction by default. This field has the following possible values: * `Ecommerce` - Online transactions where the cardholder is present (online). For better authorisation rates, we recommend sending the card security code (CSC) along with the request. * `ContAuth` - Card on file and/or subscription transactions, where the cardholder is known to the merchant (returning customer). If the shopper is present (online), you can supply also the CSC to improve authorisation (one-click payment). * `Moto` - Mail-order and telephone-order transactions where the shopper is in contact with the merchant via email or telephone. * `POS` - Point-of-sale transactions where the shopper is physically present to make a payment using a secure payment terminal. + */ + @JsonAdapter(ShopperInteractionEnum.Adapter.class) + public enum ShopperInteractionEnum { + ECOMMERCE("Ecommerce"), + + CONTAUTH("ContAuth"), + + MOTO("Moto"), + + POS("POS"); + + private final String value; + + ShopperInteractionEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static ShopperInteractionEnum fromValue(String value) { + for (ShopperInteractionEnum b : ShopperInteractionEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final ShopperInteractionEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public ShopperInteractionEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return ShopperInteractionEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_SHOPPER_INTERACTION = "shopperInteraction"; + @SerializedName(SERIALIZED_NAME_SHOPPER_INTERACTION) + private ShopperInteractionEnum shopperInteraction; + + public static final String SERIALIZED_NAME_SHOPPER_LOCALE = "shopperLocale"; + @SerializedName(SERIALIZED_NAME_SHOPPER_LOCALE) + private String shopperLocale; + + public static final String SERIALIZED_NAME_SHOPPER_NAME = "shopperName"; + @SerializedName(SERIALIZED_NAME_SHOPPER_NAME) + private Name shopperName; + + public static final String SERIALIZED_NAME_SHOPPER_REFERENCE = "shopperReference"; + @SerializedName(SERIALIZED_NAME_SHOPPER_REFERENCE) + private String shopperReference; + + public static final String SERIALIZED_NAME_SHOPPER_STATEMENT = "shopperStatement"; + @SerializedName(SERIALIZED_NAME_SHOPPER_STATEMENT) + private String shopperStatement; + + public static final String SERIALIZED_NAME_SOCIAL_SECURITY_NUMBER = "socialSecurityNumber"; + @SerializedName(SERIALIZED_NAME_SOCIAL_SECURITY_NUMBER) + private String socialSecurityNumber; + + public static final String SERIALIZED_NAME_SPLIT_CARD_FUNDING_SOURCES = "splitCardFundingSources"; + @SerializedName(SERIALIZED_NAME_SPLIT_CARD_FUNDING_SOURCES) + private Boolean splitCardFundingSources = false; + + public static final String SERIALIZED_NAME_SPLITS = "splits"; + @SerializedName(SERIALIZED_NAME_SPLITS) + private List splits = null; + + public static final String SERIALIZED_NAME_STORE_PAYMENT_METHOD = "storePaymentMethod"; + @SerializedName(SERIALIZED_NAME_STORE_PAYMENT_METHOD) + private Boolean storePaymentMethod; + + public static final String SERIALIZED_NAME_TELEPHONE_NUMBER = "telephoneNumber"; + @SerializedName(SERIALIZED_NAME_TELEPHONE_NUMBER) + private String telephoneNumber; + + public static final String SERIALIZED_NAME_THREE_D_S_AUTHENTICATION_ONLY = "threeDSAuthenticationOnly"; + @SerializedName(SERIALIZED_NAME_THREE_D_S_AUTHENTICATION_ONLY) + private Boolean threeDSAuthenticationOnly = false; + + public static final String SERIALIZED_NAME_TRUSTED_SHOPPER = "trustedShopper"; + @SerializedName(SERIALIZED_NAME_TRUSTED_SHOPPER) + private Boolean trustedShopper; + + + public CreateCheckoutSessionResponse accountInfo(AccountInfo accountInfo) { + + this.accountInfo = accountInfo; + return this; + } + + /** + * Get accountInfo + * + * @return accountInfo + **/ + public AccountInfo getAccountInfo() { + return accountInfo; + } + + + public void setAccountInfo(AccountInfo accountInfo) { + this.accountInfo = accountInfo; + } + + + public CreateCheckoutSessionResponse additionalAmount(Amount additionalAmount) { + + this.additionalAmount = additionalAmount; + return this; + } + + /** + * Get additionalAmount + * + * @return additionalAmount + **/ + public Amount getAdditionalAmount() { + return additionalAmount; + } + + + public void setAdditionalAmount(Amount additionalAmount) { + this.additionalAmount = additionalAmount; + } + + + public CreateCheckoutSessionResponse additionalData(Map additionalData) { + + this.additionalData = additionalData; + return this; + } + + public CreateCheckoutSessionResponse putAdditionalDataItem(String key, String additionalDataItem) { + if (this.additionalData == null) { + this.additionalData = new HashMap(); + } + this.additionalData.put(key, additionalDataItem); + return this; + } + + /** + * This field contains additional data, which may be required for a particular payment request. The `additionalData` object consists of entries, each of which includes the key and value. + * + * @return additionalData + **/ + public Map getAdditionalData() { + return additionalData; + } + + + public void setAdditionalData(Map additionalData) { + this.additionalData = additionalData; + } + + + public CreateCheckoutSessionResponse allowedPaymentMethods(List allowedPaymentMethods) { + + this.allowedPaymentMethods = allowedPaymentMethods; + return this; + } + + public CreateCheckoutSessionResponse addAllowedPaymentMethodsItem(String allowedPaymentMethodsItem) { + if (this.allowedPaymentMethods == null) { + this.allowedPaymentMethods = new ArrayList(); + } + this.allowedPaymentMethods.add(allowedPaymentMethodsItem); + return this; + } + + /** + * List of payment methods to be presented to the shopper. To refer to payment methods, use their `paymentMethod.type`from [Payment methods overview](https://docs.adyen.com/payment-methods). Example: `\"allowedPaymentMethods\":[\"ideal\",\"giropay\"]` + * + * @return allowedPaymentMethods + **/ + public List getAllowedPaymentMethods() { + return allowedPaymentMethods; + } + + + public void setAllowedPaymentMethods(List allowedPaymentMethods) { + this.allowedPaymentMethods = allowedPaymentMethods; + } + + + public CreateCheckoutSessionResponse amount(Amount amount) { + + this.amount = amount; + return this; + } + + /** + * Get amount + * + * @return amount + **/ + public Amount getAmount() { + return amount; + } + + + public void setAmount(Amount amount) { + this.amount = amount; + } + + + public CreateCheckoutSessionResponse applicationInfo(ApplicationInfo applicationInfo) { + + this.applicationInfo = applicationInfo; + return this; + } + + /** + * Get applicationInfo + * + * @return applicationInfo + **/ + public ApplicationInfo getApplicationInfo() { + return applicationInfo; + } + + + public void setApplicationInfo(ApplicationInfo applicationInfo) { + this.applicationInfo = applicationInfo; + } + + + public CreateCheckoutSessionResponse billingAddress(Address billingAddress) { + + this.billingAddress = billingAddress; + return this; + } + + /** + * Get billingAddress + * + * @return billingAddress + **/ + public Address getBillingAddress() { + return billingAddress; + } + + + public void setBillingAddress(Address billingAddress) { + this.billingAddress = billingAddress; + } + + + public CreateCheckoutSessionResponse blockedPaymentMethods(List blockedPaymentMethods) { + + this.blockedPaymentMethods = blockedPaymentMethods; + return this; + } + + public CreateCheckoutSessionResponse addBlockedPaymentMethodsItem(String blockedPaymentMethodsItem) { + if (this.blockedPaymentMethods == null) { + this.blockedPaymentMethods = new ArrayList(); + } + this.blockedPaymentMethods.add(blockedPaymentMethodsItem); + return this; + } + + /** + * List of payment methods to be hidden from the shopper. To refer to payment methods, use their `paymentMethod.type`from [Payment methods overview](https://docs.adyen.com/payment-methods). Example: `\"blockedPaymentMethods\":[\"ideal\",\"giropay\"]` + * + * @return blockedPaymentMethods + **/ + public List getBlockedPaymentMethods() { + return blockedPaymentMethods; + } + + + public void setBlockedPaymentMethods(List blockedPaymentMethods) { + this.blockedPaymentMethods = blockedPaymentMethods; + } + + + public CreateCheckoutSessionResponse captureDelayHours(Integer captureDelayHours) { + + this.captureDelayHours = captureDelayHours; + return this; + } + + /** + * The delay between the authorisation and scheduled auto-capture, specified in hours. + * + * @return captureDelayHours + **/ + public Integer getCaptureDelayHours() { + return captureDelayHours; + } + + + public void setCaptureDelayHours(Integer captureDelayHours) { + this.captureDelayHours = captureDelayHours; + } + + + public CreateCheckoutSessionResponse channel(ChannelEnum channel) { + + this.channel = channel; + return this; + } + + /** + * The platform where a payment transaction takes place. This field is optional for filtering out payment methods that are only available on specific platforms. If this value is not set, then we will try to infer it from the `sdkVersion` or `token`. Possible values: * iOS * Android * Web + * + * @return channel + **/ + public ChannelEnum getChannel() { + return channel; + } + + + public void setChannel(ChannelEnum channel) { + this.channel = channel; + } + + + public CreateCheckoutSessionResponse company(Company company) { + + this.company = company; + return this; + } + + /** + * Get company + * + * @return company + **/ + public Company getCompany() { + return company; + } + + + public void setCompany(Company company) { + this.company = company; + } + + + public CreateCheckoutSessionResponse countryCode(String countryCode) { + + this.countryCode = countryCode; + return this; + } + + /** + * The shopper's two-letter country code. + * + * @return countryCode + **/ + public String getCountryCode() { + return countryCode; + } + + + public void setCountryCode(String countryCode) { + this.countryCode = countryCode; + } + + + public CreateCheckoutSessionResponse dateOfBirth(String dateOfBirth) { + + this.dateOfBirth = dateOfBirth; + return this; + } + + /** + * The shopper's date of birth. Format [ISO-8601](https://www.w3.org/TR/NOTE-datetime): YYYY-MM-DD + * + * @return dateOfBirth + **/ + public String getDateOfBirth() { + return dateOfBirth; + } + + + public void setDateOfBirth(String dateOfBirth) { + this.dateOfBirth = dateOfBirth; + } + + + public CreateCheckoutSessionResponse deliveryAddress(Address deliveryAddress) { + + this.deliveryAddress = deliveryAddress; + return this; + } + + /** + * Get deliveryAddress + * + * @return deliveryAddress + **/ + public Address getDeliveryAddress() { + return deliveryAddress; + } + + + public void setDeliveryAddress(Address deliveryAddress) { + this.deliveryAddress = deliveryAddress; + } + + + public CreateCheckoutSessionResponse enableOneClick(Boolean enableOneClick) { + + this.enableOneClick = enableOneClick; + return this; + } + + /** + * When true and `shopperReference` is provided, the shopper will be asked if the payment details should be stored for future one-click payments. + * + * @return enableOneClick + **/ + public Boolean getEnableOneClick() { + return enableOneClick; + } + + + public void setEnableOneClick(Boolean enableOneClick) { + this.enableOneClick = enableOneClick; + } + + + public CreateCheckoutSessionResponse enablePayOut(Boolean enablePayOut) { + + this.enablePayOut = enablePayOut; + return this; + } + + /** + * When true and `shopperReference` is provided, the payment details will be tokenized for payouts. + * + * @return enablePayOut + **/ + public Boolean getEnablePayOut() { + return enablePayOut; + } + + + public void setEnablePayOut(Boolean enablePayOut) { + this.enablePayOut = enablePayOut; + } + + + public CreateCheckoutSessionResponse enableRecurring(Boolean enableRecurring) { + + this.enableRecurring = enableRecurring; + return this; + } + + /** + * When true and `shopperReference` is provided, the payment details will be tokenized for recurring payments. + * + * @return enableRecurring + **/ + public Boolean getEnableRecurring() { + return enableRecurring; + } + + + public void setEnableRecurring(Boolean enableRecurring) { + this.enableRecurring = enableRecurring; + } + + + public CreateCheckoutSessionResponse expiresAt(String expiresAt) { + + this.expiresAt = expiresAt; + return this; + } + + /** + * The date the session expires in ISO8601 format. When not specified, it defaults to 1h after creation. + * + * @return expiresAt + **/ + public String getExpiresAt() { + return expiresAt; + } + + + public void setExpiresAt(String expiresAt) { + this.expiresAt = expiresAt; + } + + + /** + * A unique identifier of the session. + * + * @return id + **/ + public String getId() { + return id; + } + + + public CreateCheckoutSessionResponse lineItems(List lineItems) { + + this.lineItems = lineItems; + return this; + } + + public CreateCheckoutSessionResponse addLineItemsItem(LineItem lineItemsItem) { + if (this.lineItems == null) { + this.lineItems = new ArrayList(); + } + this.lineItems.add(lineItemsItem); + return this; + } + + /** + * Price and product information about the purchased items, to be included on the invoice sent to the shopper. > This field is required for 3x 4x Oney, Affirm, Afterpay, Clearpay, Klarna, Ratepay, and Zip. + * + * @return lineItems + **/ + public List getLineItems() { + return lineItems; + } + + + public void setLineItems(List lineItems) { + this.lineItems = lineItems; + } + + + public CreateCheckoutSessionResponse mandate(Mandate mandate) { + + this.mandate = mandate; + return this; + } + + /** + * Get mandate + * + * @return mandate + **/ + public Mandate getMandate() { + return mandate; + } + + + public void setMandate(Mandate mandate) { + this.mandate = mandate; + } + + + public CreateCheckoutSessionResponse mcc(String mcc) { + + this.mcc = mcc; + return this; + } + + /** + * The [merchant category code](https://en.wikipedia.org/wiki/Merchant_category_code) (MCC) is a four-digit number, which relates to a particular market segment. This code reflects the predominant activity that is conducted by the merchant. + * + * @return mcc + **/ + public String getMcc() { + return mcc; + } + + + public void setMcc(String mcc) { + this.mcc = mcc; + } + + + public CreateCheckoutSessionResponse merchantAccount(String merchantAccount) { + + this.merchantAccount = merchantAccount; + return this; + } + + /** + * The merchant account identifier, with which you want to process the transaction. + * + * @return merchantAccount + **/ + public String getMerchantAccount() { + return merchantAccount; + } + + + public void setMerchantAccount(String merchantAccount) { + this.merchantAccount = merchantAccount; + } + + + public CreateCheckoutSessionResponse merchantOrderReference(String merchantOrderReference) { + + this.merchantOrderReference = merchantOrderReference; + return this; + } + + /** + * This reference allows linking multiple transactions to each other for reporting purposes (i.e. order auth-rate). The reference should be unique per billing cycle. The same merchant order reference should never be reused after the first authorised attempt. If used, this field should be supplied for all incoming authorisations. > We strongly recommend you send the `merchantOrderReference` value to benefit from linking payment requests when authorisation retries take place. In addition, we recommend you provide `retry.orderAttemptNumber`, `retry.chainAttemptNumber`, and `retry.skipRetry` values in `PaymentRequest.additionalData`. + * + * @return merchantOrderReference + **/ + public String getMerchantOrderReference() { + return merchantOrderReference; + } + + + public void setMerchantOrderReference(String merchantOrderReference) { + this.merchantOrderReference = merchantOrderReference; + } + + + public CreateCheckoutSessionResponse metadata(Map metadata) { + + this.metadata = metadata; + return this; + } + + public CreateCheckoutSessionResponse putMetadataItem(String key, String metadataItem) { + if (this.metadata == null) { + this.metadata = new HashMap(); + } + this.metadata.put(key, metadataItem); + return this; + } + + /** + * Metadata consists of entries, each of which includes a key and a value. Limits: * Maximum 20 key-value pairs per request.* Maximum 20 characters per key. * Maximum 80 characters per value. + * + * @return metadata + **/ + public Map getMetadata() { + return metadata; + } + + + public void setMetadata(Map metadata) { + this.metadata = metadata; + } + + + public CreateCheckoutSessionResponse mpiData(ThreeDSecureData mpiData) { + + this.mpiData = mpiData; + return this; + } + + /** + * Get mpiData + * + * @return mpiData + **/ + public ThreeDSecureData getMpiData() { + return mpiData; + } + + + public void setMpiData(ThreeDSecureData mpiData) { + this.mpiData = mpiData; + } + + + public CreateCheckoutSessionResponse recurringExpiry(String recurringExpiry) { + + this.recurringExpiry = recurringExpiry; + return this; + } + + /** + * Date after which no further authorisations shall be performed. Only for 3D Secure 2. + * + * @return recurringExpiry + **/ + public String getRecurringExpiry() { + return recurringExpiry; + } + + + public void setRecurringExpiry(String recurringExpiry) { + this.recurringExpiry = recurringExpiry; + } + + + public CreateCheckoutSessionResponse recurringFrequency(String recurringFrequency) { + + this.recurringFrequency = recurringFrequency; + return this; + } + + /** + * Minimum number of days between authorisations. Only for 3D Secure 2. + * + * @return recurringFrequency + **/ + public String getRecurringFrequency() { + return recurringFrequency; + } + + + public void setRecurringFrequency(String recurringFrequency) { + this.recurringFrequency = recurringFrequency; + } + + + public CreateCheckoutSessionResponse recurringProcessingModel(RecurringProcessingModelEnum recurringProcessingModel) { + + this.recurringProcessingModel = recurringProcessingModel; + return this; + } + + /** + * Defines a recurring payment type. Allowed values: * `Subscription` – A transaction for a fixed or variable amount, which follows a fixed schedule. * `CardOnFile` – With a card-on-file (CoF) transaction, card details are stored to enable one-click or omnichannel journeys, or simply to streamline the checkout process. Any subscription not following a fixed schedule is also considered a card-on-file transaction. * `UnscheduledCardOnFile` – An unscheduled card-on-file (UCoF) transaction is a transaction that occurs on a non-fixed schedule and/or have variable amounts. For example, automatic top-ups when a cardholder's balance drops below a certain amount. + * + * @return recurringProcessingModel + **/ + public RecurringProcessingModelEnum getRecurringProcessingModel() { + return recurringProcessingModel; + } + + + public void setRecurringProcessingModel(RecurringProcessingModelEnum recurringProcessingModel) { + this.recurringProcessingModel = recurringProcessingModel; + } + + + public CreateCheckoutSessionResponse redirectFromIssuerMethod(String redirectFromIssuerMethod) { + + this.redirectFromIssuerMethod = redirectFromIssuerMethod; + return this; + } + + /** + * Specifies the redirect method (GET or POST) when redirecting back from the issuer. + * + * @return redirectFromIssuerMethod + **/ + public String getRedirectFromIssuerMethod() { + return redirectFromIssuerMethod; + } + + + public void setRedirectFromIssuerMethod(String redirectFromIssuerMethod) { + this.redirectFromIssuerMethod = redirectFromIssuerMethod; + } + + + public CreateCheckoutSessionResponse redirectToIssuerMethod(String redirectToIssuerMethod) { + + this.redirectToIssuerMethod = redirectToIssuerMethod; + return this; + } + + /** + * Specifies the redirect method (GET or POST) when redirecting to the issuer. + * + * @return redirectToIssuerMethod + **/ + public String getRedirectToIssuerMethod() { + return redirectToIssuerMethod; + } + + + public void setRedirectToIssuerMethod(String redirectToIssuerMethod) { + this.redirectToIssuerMethod = redirectToIssuerMethod; + } + + + public CreateCheckoutSessionResponse reference(String reference) { + + this.reference = reference; + return this; + } + + /** + * The reference to uniquely identify a payment. + * + * @return reference + **/ + public String getReference() { + return reference; + } + + + public void setReference(String reference) { + this.reference = reference; + } + + + public CreateCheckoutSessionResponse returnUrl(String returnUrl) { + + this.returnUrl = returnUrl; + return this; + } + + /** + * The URL to return to when a redirect payment is completed. + * + * @return returnUrl + **/ + public String getReturnUrl() { + return returnUrl; + } + + + public void setReturnUrl(String returnUrl) { + this.returnUrl = returnUrl; + } + + + public CreateCheckoutSessionResponse riskData(RiskData riskData) { + + this.riskData = riskData; + return this; + } + + /** + * Get riskData + * + * @return riskData + **/ + public RiskData getRiskData() { + return riskData; + } + + + public void setRiskData(RiskData riskData) { + this.riskData = riskData; + } + + + public CreateCheckoutSessionResponse sessionData(String sessionData) { + + this.sessionData = sessionData; + return this; + } + + /** + * Get sessionData + * + * @return sessionData + **/ + public String getSessionData() { + return sessionData; + } + + + public void setSessionData(String sessionData) { + this.sessionData = sessionData; + } + + + public CreateCheckoutSessionResponse shopperEmail(String shopperEmail) { + + this.shopperEmail = shopperEmail; + return this; + } + + /** + * The shopper's email address. + * + * @return shopperEmail + **/ + public String getShopperEmail() { + return shopperEmail; + } + + + public void setShopperEmail(String shopperEmail) { + this.shopperEmail = shopperEmail; + } + + + public CreateCheckoutSessionResponse shopperIP(String shopperIP) { + + this.shopperIP = shopperIP; + return this; + } + + /** + * The shopper's IP address. In general, we recommend that you provide this data, as it is used in a number of risk checks (for instance, number of payment attempts or location-based checks). > For 3D Secure 2 transactions, schemes require `shopperIP` for all browser-based implementations. This field is also mandatory for some merchants depending on your business model. For more information, [contact Support](https://support.adyen.com/hc/en-us/requests/new). + * + * @return shopperIP + **/ + public String getShopperIP() { + return shopperIP; + } + + + public void setShopperIP(String shopperIP) { + this.shopperIP = shopperIP; + } + + + public CreateCheckoutSessionResponse shopperInteraction(ShopperInteractionEnum shopperInteraction) { + + this.shopperInteraction = shopperInteraction; + return this; + } + + /** + * Specifies the sales channel, through which the shopper gives their card details, and whether the shopper is a returning customer. For the web service API, Adyen assumes Ecommerce shopper interaction by default. This field has the following possible values: * `Ecommerce` - Online transactions where the cardholder is present (online). For better authorisation rates, we recommend sending the card security code (CSC) along with the request. * `ContAuth` - Card on file and/or subscription transactions, where the cardholder is known to the merchant (returning customer). If the shopper is present (online), you can supply also the CSC to improve authorisation (one-click payment). * `Moto` - Mail-order and telephone-order transactions where the shopper is in contact with the merchant via email or telephone. * `POS` - Point-of-sale transactions where the shopper is physically present to make a payment using a secure payment terminal. + * + * @return shopperInteraction + **/ + public ShopperInteractionEnum getShopperInteraction() { + return shopperInteraction; + } + + + public void setShopperInteraction(ShopperInteractionEnum shopperInteraction) { + this.shopperInteraction = shopperInteraction; + } + + + public CreateCheckoutSessionResponse shopperLocale(String shopperLocale) { + + this.shopperLocale = shopperLocale; + return this; + } + + /** + * The combination of a language code and a country code to specify the language to be used in the payment. + * + * @return shopperLocale + **/ + public String getShopperLocale() { + return shopperLocale; + } + + + public void setShopperLocale(String shopperLocale) { + this.shopperLocale = shopperLocale; + } + + + public CreateCheckoutSessionResponse shopperName(Name shopperName) { + + this.shopperName = shopperName; + return this; + } + + /** + * Get shopperName + * + * @return shopperName + **/ + public Name getShopperName() { + return shopperName; + } + + + public void setShopperName(Name shopperName) { + this.shopperName = shopperName; + } + + + public CreateCheckoutSessionResponse shopperReference(String shopperReference) { + + this.shopperReference = shopperReference; + return this; + } + + /** + * Your reference to uniquely identify this shopper, for example user ID or account ID. Minimum length: 3 characters. > Your reference must not include personally identifiable information (PII), for example name or email address. + * + * @return shopperReference + **/ + public String getShopperReference() { + return shopperReference; + } + + + public void setShopperReference(String shopperReference) { + this.shopperReference = shopperReference; + } + + + public CreateCheckoutSessionResponse shopperStatement(String shopperStatement) { + + this.shopperStatement = shopperStatement; + return this; + } + + /** + * The text to be shown on the shopper's bank statement. To enable this field, contact our [Support Team](https://support.adyen.com/hc/en-us/requests/new). We recommend sending a maximum of 22 characters, otherwise banks might truncate the string. + * + * @return shopperStatement + **/ + public String getShopperStatement() { + return shopperStatement; + } + + + public void setShopperStatement(String shopperStatement) { + this.shopperStatement = shopperStatement; + } + + + public CreateCheckoutSessionResponse socialSecurityNumber(String socialSecurityNumber) { + + this.socialSecurityNumber = socialSecurityNumber; + return this; + } + + /** + * The shopper's social security number. + * + * @return socialSecurityNumber + **/ + public String getSocialSecurityNumber() { + return socialSecurityNumber; + } + + + public void setSocialSecurityNumber(String socialSecurityNumber) { + this.socialSecurityNumber = socialSecurityNumber; + } + + + public CreateCheckoutSessionResponse splitCardFundingSources(Boolean splitCardFundingSources) { + + this.splitCardFundingSources = splitCardFundingSources; + return this; + } + + /** + * Boolean value indicating whether the card payment method should be split into separate debit and credit options. + * + * @return splitCardFundingSources + **/ + public Boolean getSplitCardFundingSources() { + return splitCardFundingSources; + } + + + public void setSplitCardFundingSources(Boolean splitCardFundingSources) { + this.splitCardFundingSources = splitCardFundingSources; + } + + + public CreateCheckoutSessionResponse splits(List splits) { + + this.splits = splits; + return this; + } + + public CreateCheckoutSessionResponse addSplitsItem(Split splitsItem) { + if (this.splits == null) { + this.splits = new ArrayList(); + } + this.splits.add(splitsItem); + return this; + } + + /** + * An array of objects specifying how the payment should be split when using [Adyen for Platforms](https://docs.adyen.com/platforms/processing-payments#providing-split-information) or [Issuing](https://docs.adyen.com/issuing/manage-funds#split). + * + * @return splits + **/ + public List getSplits() { + return splits; + } + + + public void setSplits(List splits) { + this.splits = splits; + } + + + public CreateCheckoutSessionResponse storePaymentMethod(Boolean storePaymentMethod) { + + this.storePaymentMethod = storePaymentMethod; + return this; + } + + /** + * When this is set to **true** and the `shopperReference` is provided, the payment details will be stored. + * + * @return storePaymentMethod + **/ + public Boolean getStorePaymentMethod() { + return storePaymentMethod; + } + + + public void setStorePaymentMethod(Boolean storePaymentMethod) { + this.storePaymentMethod = storePaymentMethod; + } + + + public CreateCheckoutSessionResponse telephoneNumber(String telephoneNumber) { + + this.telephoneNumber = telephoneNumber; + return this; + } + + /** + * The shopper's telephone number. + * + * @return telephoneNumber + **/ + public String getTelephoneNumber() { + return telephoneNumber; + } + + + public void setTelephoneNumber(String telephoneNumber) { + this.telephoneNumber = telephoneNumber; + } + + + public CreateCheckoutSessionResponse threeDSAuthenticationOnly(Boolean threeDSAuthenticationOnly) { + + this.threeDSAuthenticationOnly = threeDSAuthenticationOnly; + return this; + } + + /** + * If set to true, you will only perform the [3D Secure 2 authentication](https://docs.adyen.com/online-payments/3d-secure/other-3ds-flows/authentication-only), and not the payment authorisation. + * + * @return threeDSAuthenticationOnly + **/ + public Boolean getThreeDSAuthenticationOnly() { + return threeDSAuthenticationOnly; + } + + + public void setThreeDSAuthenticationOnly(Boolean threeDSAuthenticationOnly) { + this.threeDSAuthenticationOnly = threeDSAuthenticationOnly; + } + + + public CreateCheckoutSessionResponse trustedShopper(Boolean trustedShopper) { + + this.trustedShopper = trustedShopper; + return this; + } + + /** + * Set to true if the payment should be routed to a trusted MID. + * + * @return trustedShopper + **/ + public Boolean getTrustedShopper() { + return trustedShopper; + } + + + public void setTrustedShopper(Boolean trustedShopper) { + this.trustedShopper = trustedShopper; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateCheckoutSessionResponse createCheckoutSessionResponse = (CreateCheckoutSessionResponse) o; + return Objects.equals(this.accountInfo, createCheckoutSessionResponse.accountInfo) && + Objects.equals(this.additionalAmount, createCheckoutSessionResponse.additionalAmount) && + Objects.equals(this.additionalData, createCheckoutSessionResponse.additionalData) && + Objects.equals(this.allowedPaymentMethods, createCheckoutSessionResponse.allowedPaymentMethods) && + Objects.equals(this.amount, createCheckoutSessionResponse.amount) && + Objects.equals(this.applicationInfo, createCheckoutSessionResponse.applicationInfo) && + Objects.equals(this.billingAddress, createCheckoutSessionResponse.billingAddress) && + Objects.equals(this.blockedPaymentMethods, createCheckoutSessionResponse.blockedPaymentMethods) && + Objects.equals(this.captureDelayHours, createCheckoutSessionResponse.captureDelayHours) && + Objects.equals(this.channel, createCheckoutSessionResponse.channel) && + Objects.equals(this.company, createCheckoutSessionResponse.company) && + Objects.equals(this.countryCode, createCheckoutSessionResponse.countryCode) && + Objects.equals(this.dateOfBirth, createCheckoutSessionResponse.dateOfBirth) && + Objects.equals(this.deliveryAddress, createCheckoutSessionResponse.deliveryAddress) && + Objects.equals(this.enableOneClick, createCheckoutSessionResponse.enableOneClick) && + Objects.equals(this.enablePayOut, createCheckoutSessionResponse.enablePayOut) && + Objects.equals(this.enableRecurring, createCheckoutSessionResponse.enableRecurring) && + Objects.equals(this.expiresAt, createCheckoutSessionResponse.expiresAt) && + Objects.equals(this.id, createCheckoutSessionResponse.id) && + Objects.equals(this.lineItems, createCheckoutSessionResponse.lineItems) && + Objects.equals(this.mandate, createCheckoutSessionResponse.mandate) && + Objects.equals(this.mcc, createCheckoutSessionResponse.mcc) && + Objects.equals(this.merchantAccount, createCheckoutSessionResponse.merchantAccount) && + Objects.equals(this.merchantOrderReference, createCheckoutSessionResponse.merchantOrderReference) && + Objects.equals(this.metadata, createCheckoutSessionResponse.metadata) && + Objects.equals(this.mpiData, createCheckoutSessionResponse.mpiData) && + Objects.equals(this.recurringExpiry, createCheckoutSessionResponse.recurringExpiry) && + Objects.equals(this.recurringFrequency, createCheckoutSessionResponse.recurringFrequency) && + Objects.equals(this.recurringProcessingModel, createCheckoutSessionResponse.recurringProcessingModel) && + Objects.equals(this.redirectFromIssuerMethod, createCheckoutSessionResponse.redirectFromIssuerMethod) && + Objects.equals(this.redirectToIssuerMethod, createCheckoutSessionResponse.redirectToIssuerMethod) && + Objects.equals(this.reference, createCheckoutSessionResponse.reference) && + Objects.equals(this.returnUrl, createCheckoutSessionResponse.returnUrl) && + Objects.equals(this.riskData, createCheckoutSessionResponse.riskData) && + Objects.equals(this.sessionData, createCheckoutSessionResponse.sessionData) && + Objects.equals(this.shopperEmail, createCheckoutSessionResponse.shopperEmail) && + Objects.equals(this.shopperIP, createCheckoutSessionResponse.shopperIP) && + Objects.equals(this.shopperInteraction, createCheckoutSessionResponse.shopperInteraction) && + Objects.equals(this.shopperLocale, createCheckoutSessionResponse.shopperLocale) && + Objects.equals(this.shopperName, createCheckoutSessionResponse.shopperName) && + Objects.equals(this.shopperReference, createCheckoutSessionResponse.shopperReference) && + Objects.equals(this.shopperStatement, createCheckoutSessionResponse.shopperStatement) && + Objects.equals(this.socialSecurityNumber, createCheckoutSessionResponse.socialSecurityNumber) && + Objects.equals(this.splitCardFundingSources, createCheckoutSessionResponse.splitCardFundingSources) && + Objects.equals(this.splits, createCheckoutSessionResponse.splits) && + Objects.equals(this.storePaymentMethod, createCheckoutSessionResponse.storePaymentMethod) && + Objects.equals(this.telephoneNumber, createCheckoutSessionResponse.telephoneNumber) && + Objects.equals(this.threeDSAuthenticationOnly, createCheckoutSessionResponse.threeDSAuthenticationOnly) && + Objects.equals(this.trustedShopper, createCheckoutSessionResponse.trustedShopper); + } + + @Override + public int hashCode() { + return Objects.hash(accountInfo, additionalAmount, additionalData, allowedPaymentMethods, amount, applicationInfo, billingAddress, blockedPaymentMethods, captureDelayHours, channel, company, countryCode, dateOfBirth, deliveryAddress, enableOneClick, enablePayOut, enableRecurring, expiresAt, id, lineItems, mandate, mcc, merchantAccount, merchantOrderReference, metadata, mpiData, recurringExpiry, recurringFrequency, recurringProcessingModel, redirectFromIssuerMethod, redirectToIssuerMethod, reference, returnUrl, riskData, sessionData, shopperEmail, shopperIP, shopperInteraction, shopperLocale, shopperName, shopperReference, shopperStatement, socialSecurityNumber, splitCardFundingSources, splits, storePaymentMethod, telephoneNumber, threeDSAuthenticationOnly, trustedShopper); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateCheckoutSessionResponse {\n"); + sb.append(" accountInfo: ").append(toIndentedString(accountInfo)).append("\n"); + sb.append(" additionalAmount: ").append(toIndentedString(additionalAmount)).append("\n"); + sb.append(" additionalData: ").append(toIndentedString(additionalData)).append("\n"); + sb.append(" allowedPaymentMethods: ").append(toIndentedString(allowedPaymentMethods)).append("\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" applicationInfo: ").append(toIndentedString(applicationInfo)).append("\n"); + sb.append(" billingAddress: ").append(toIndentedString(billingAddress)).append("\n"); + sb.append(" blockedPaymentMethods: ").append(toIndentedString(blockedPaymentMethods)).append("\n"); + sb.append(" captureDelayHours: ").append(toIndentedString(captureDelayHours)).append("\n"); + sb.append(" channel: ").append(toIndentedString(channel)).append("\n"); + sb.append(" company: ").append(toIndentedString(company)).append("\n"); + sb.append(" countryCode: ").append(toIndentedString(countryCode)).append("\n"); + sb.append(" dateOfBirth: ").append(toIndentedString(dateOfBirth)).append("\n"); + sb.append(" deliveryAddress: ").append(toIndentedString(deliveryAddress)).append("\n"); + sb.append(" enableOneClick: ").append(toIndentedString(enableOneClick)).append("\n"); + sb.append(" enablePayOut: ").append(toIndentedString(enablePayOut)).append("\n"); + sb.append(" enableRecurring: ").append(toIndentedString(enableRecurring)).append("\n"); + sb.append(" expiresAt: ").append(toIndentedString(expiresAt)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" lineItems: ").append(toIndentedString(lineItems)).append("\n"); + sb.append(" mandate: ").append(toIndentedString(mandate)).append("\n"); + sb.append(" mcc: ").append(toIndentedString(mcc)).append("\n"); + sb.append(" merchantAccount: ").append(toIndentedString(merchantAccount)).append("\n"); + sb.append(" merchantOrderReference: ").append(toIndentedString(merchantOrderReference)).append("\n"); + sb.append(" metadata: ").append(toIndentedString(metadata)).append("\n"); + sb.append(" mpiData: ").append(toIndentedString(mpiData)).append("\n"); + sb.append(" recurringExpiry: ").append(toIndentedString(recurringExpiry)).append("\n"); + sb.append(" recurringFrequency: ").append(toIndentedString(recurringFrequency)).append("\n"); + sb.append(" recurringProcessingModel: ").append(toIndentedString(recurringProcessingModel)).append("\n"); + sb.append(" redirectFromIssuerMethod: ").append(toIndentedString(redirectFromIssuerMethod)).append("\n"); + sb.append(" redirectToIssuerMethod: ").append(toIndentedString(redirectToIssuerMethod)).append("\n"); + sb.append(" reference: ").append(toIndentedString(reference)).append("\n"); + sb.append(" returnUrl: ").append(toIndentedString(returnUrl)).append("\n"); + sb.append(" riskData: ").append(toIndentedString(riskData)).append("\n"); + sb.append(" sessionData: ").append(toIndentedString(sessionData)).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"); + sb.append(" shopperLocale: ").append(toIndentedString(shopperLocale)).append("\n"); + sb.append(" shopperName: ").append(toIndentedString(shopperName)).append("\n"); + sb.append(" shopperReference: ").append(toIndentedString(shopperReference)).append("\n"); + sb.append(" shopperStatement: ").append(toIndentedString(shopperStatement)).append("\n"); + sb.append(" socialSecurityNumber: ").append(toIndentedString(socialSecurityNumber)).append("\n"); + sb.append(" splitCardFundingSources: ").append(toIndentedString(splitCardFundingSources)).append("\n"); + sb.append(" splits: ").append(toIndentedString(splits)).append("\n"); + sb.append(" storePaymentMethod: ").append(toIndentedString(storePaymentMethod)).append("\n"); + sb.append(" telephoneNumber: ").append(toIndentedString(telephoneNumber)).append("\n"); + sb.append(" threeDSAuthenticationOnly: ").append(toIndentedString(threeDSAuthenticationOnly)).append("\n"); + sb.append(" trustedShopper: ").append(toIndentedString(trustedShopper)).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 "); + } + +} + diff --git a/src/main/java/com/adyen/service/Checkout.java b/src/main/java/com/adyen/service/Checkout.java index 7d26db7c7..b4e9061db 100644 --- a/src/main/java/com/adyen/service/Checkout.java +++ b/src/main/java/com/adyen/service/Checkout.java @@ -29,6 +29,8 @@ import com.adyen.model.checkout.CheckoutCreateOrderRequest; import com.adyen.model.checkout.CheckoutCreateOrderResponse; import com.adyen.model.checkout.CreateStoredPaymentMethodRequest; +import com.adyen.model.checkout.CreateCheckoutSessionRequest; +import com.adyen.model.checkout.CreateCheckoutSessionResponse; import com.adyen.model.checkout.PaymentMethodsRequest; import com.adyen.model.checkout.PaymentMethodsResponse; import com.adyen.model.checkout.PaymentResultRequest; @@ -48,6 +50,7 @@ import com.adyen.service.resource.checkout.Payments; import com.adyen.service.resource.checkout.PaymentsDetails; import com.adyen.service.resource.checkout.PaymentsResult; +import com.adyen.service.resource.checkout.Sessions; import com.adyen.service.resource.checkout.StoredPaymentsMethods; import com.google.gson.reflect.TypeToken; @@ -62,6 +65,7 @@ public class Checkout extends ApiKeyAuthenticatedService { private PaymentsResult paymentsResult; private Orders orders; private OrdersCancel ordersCancel; + private Sessions sessions; private StoredPaymentsMethods storedPaymentsMethods; public Checkout(Client client) { @@ -74,6 +78,7 @@ public Checkout(Client client) { paymentsResult = new PaymentsResult(this); orders = new Orders(this); ordersCancel = new OrdersCancel(this); + sessions = new Sessions(this); storedPaymentsMethods = new StoredPaymentsMethods(this); } @@ -213,4 +218,19 @@ public CheckoutCancelOrderResponse ordersCancel(CheckoutCancelOrderRequest check return GSON.fromJson(jsonResult, new TypeToken() { }.getType()); } + + /** + * POST /sessions API call + * + * @param createCheckoutSessionRequest CreateCheckoutSessionRequest + * @return + * @throws ApiException + * @throws IOException + */ + public CreateCheckoutSessionResponse sessions(CreateCheckoutSessionRequest createCheckoutSessionRequest) throws ApiException, IOException { + String jsonRequest = GSON.toJson(createCheckoutSessionRequest); + String jsonResult = sessions.request(jsonRequest); + return GSON.fromJson(jsonResult, new TypeToken() { + }.getType()); + } } diff --git a/src/main/java/com/adyen/service/resource/checkout/Sessions.java b/src/main/java/com/adyen/service/resource/checkout/Sessions.java new file mode 100644 index 000000000..4fd7df673 --- /dev/null +++ b/src/main/java/com/adyen/service/resource/checkout/Sessions.java @@ -0,0 +1,36 @@ +/* + * ###### + * ###### + * ############ ####( ###### #####. ###### ############ ############ + * ############# #####( ###### #####. ###### ############# ############# + * ###### #####( ###### #####. ###### ##### ###### ##### ###### + * ###### ###### #####( ###### #####. ###### ##### ##### ##### ###### + * ###### ###### #####( ###### #####. ###### ##### ##### ###### + * ############# ############# ############# ############# ##### ###### + * ############ ############ ############# ############ ##### ###### + * ###### + * ############# + * ############ + * + * Adyen Java API Library + * + * Copyright (c) 2020 Adyen B.V. + * This file is open source and available under the MIT license. + * See the LICENSE file for more info. + */ + +package com.adyen.service.resource.checkout; + + import com.adyen.Client; + import com.adyen.Service; + import com.adyen.service.Resource; + + import java.util.Arrays; + +public class Sessions extends Resource { + + public Sessions(Service service) { + super(service, service.getClient().getConfig().getCheckoutEndpoint() + "/" + Client.CHECKOUT_API_VERSION + "/sessions", + Arrays.asList("amount", "reference", "returnUrl", "merchantAccount")); + } +} diff --git a/src/test/java/com/adyen/CheckoutTest.java b/src/test/java/com/adyen/CheckoutTest.java index c14af901c..e13ab3988 100644 --- a/src/test/java/com/adyen/CheckoutTest.java +++ b/src/test/java/com/adyen/CheckoutTest.java @@ -26,29 +26,7 @@ import com.adyen.model.Amount; import com.adyen.model.Split; import com.adyen.model.SplitAmount; -import com.adyen.model.checkout.CheckoutCancelOrderRequest; -import com.adyen.model.checkout.CheckoutCancelOrderResponse; -import com.adyen.model.checkout.CheckoutCreateOrderRequest; -import com.adyen.model.checkout.CheckoutCreateOrderResponse; -import com.adyen.model.checkout.CheckoutOrder; -import com.adyen.model.checkout.CheckoutPaymentsAction; -import com.adyen.model.checkout.CreateStoredPaymentMethodRequest; -import com.adyen.model.checkout.DefaultPaymentMethodDetails; -import com.adyen.model.checkout.PaymentMethodDetails; -import com.adyen.model.checkout.PaymentMethodsRequest; -import com.adyen.model.checkout.PaymentMethodsResponse; -import com.adyen.model.checkout.PaymentResultRequest; -import com.adyen.model.checkout.PaymentResultResponse; -import com.adyen.model.checkout.PaymentSessionRequest; -import com.adyen.model.checkout.PaymentSessionResponse; -import com.adyen.model.checkout.PaymentsDetailsRequest; -import com.adyen.model.checkout.PaymentsDetailsResponse; -import com.adyen.model.checkout.PaymentsRequest; -import com.adyen.model.checkout.PaymentsResponse; -import com.adyen.model.checkout.Redirect; -import com.adyen.model.checkout.RiskData; -import com.adyen.model.checkout.StoredPaymentMethodResource; -import com.adyen.model.checkout.StoringMethod; +import com.adyen.model.checkout.*; import com.adyen.model.checkout.details.AchDetails; import com.adyen.model.checkout.details.AmazonPayDetails; import com.adyen.model.checkout.details.AndroidPayDetails; @@ -2165,6 +2143,37 @@ public void TestBankTransferPaymentsSuccess() throws IOException, ApiException { assertEquals("851-6178-9473-6924A", paymentsResponse.getAction().getReference()); assertEquals("bankTransfer_IBAN", paymentsResponse.getAction().getPaymentMethodType()); } + + /** + * Test Checkout Sessions + */ + protected CreateCheckoutSessionRequest createCreateCheckoutSessionRequest() { + CreateCheckoutSessionRequest createCheckoutSessionRequest = new CreateCheckoutSessionRequest(); + createCheckoutSessionRequest.setMerchantAccount("TestMerchant"); + createCheckoutSessionRequest.setReference("TestReference"); + createCheckoutSessionRequest.setReturnUrl("http://test-url.com"); + + Amount amount = new Amount(); + amount.setCurrency("EUR"); + amount.setValue(10000L); + + createCheckoutSessionRequest.setAmount(amount); + return createCheckoutSessionRequest; + } + + @Test + public void TestCheckoutSessionSuccess() throws IOException, ApiException { + Client client = createMockClientFromFile("mocks/checkout/sessions-success.json"); + Checkout checkout = new Checkout(client); + CreateCheckoutSessionRequest sessionsRequest = createCreateCheckoutSessionRequest(); + CreateCheckoutSessionResponse sessionsResponse = checkout.sessions(sessionsRequest); + assertEquals("TestMerchant", sessionsResponse.getMerchantAccount()); + assertEquals("TestReference", sessionsResponse.getReference()); + assertEquals("http://test-url.com", sessionsResponse.getReturnUrl()); + assertEquals("2021-09-30T06:45:06Z", sessionsResponse.getExpiresAt()); + assertEquals("EUR", sessionsResponse.getAmount().getCurrency()); + assertEquals("1000", sessionsResponse.getAmount().getValue().toString()); + } } class TestPaymentMethodDetails implements PaymentMethodDetails { diff --git a/src/test/resources/mocks/checkout/sessions-success.json b/src/test/resources/mocks/checkout/sessions-success.json new file mode 100644 index 000000000..21a559ab3 --- /dev/null +++ b/src/test/resources/mocks/checkout/sessions-success.json @@ -0,0 +1,11 @@ +{ + "id": "session-test-id", + "amount": { + "currency": "EUR", + "value": 1000 + }, + "reference": "TestReference", + "returnUrl": "http://test-url.com", + "expiresAt": "2021-09-30T06:45:06Z", + "merchantAccount": "TestMerchant" +} \ No newline at end of file From 536e8c58257e83956290541e6af6f521ec76936c Mon Sep 17 00:00:00 2001 From: Wouter Boereboom Date: Wed, 29 Sep 2021 10:07:38 +0200 Subject: [PATCH 05/29] fixed linting for new model classes --- .../adyen/model/checkout/CreateCheckoutSessionResponse.java | 6 ------ .../com/adyen/model/checkout/PaymentSessionResponse.java | 2 -- 2 files changed, 8 deletions(-) diff --git a/src/main/java/com/adyen/model/checkout/CreateCheckoutSessionResponse.java b/src/main/java/com/adyen/model/checkout/CreateCheckoutSessionResponse.java index 1d640a46d..cac8cad50 100644 --- a/src/main/java/com/adyen/model/checkout/CreateCheckoutSessionResponse.java +++ b/src/main/java/com/adyen/model/checkout/CreateCheckoutSessionResponse.java @@ -23,19 +23,13 @@ package com.adyen.model.checkout; import java.util.Objects; -import java.util.Arrays; import com.adyen.model.AccountInfo; import com.adyen.model.Address; import com.adyen.model.Amount; import com.adyen.model.applicationinfo.ApplicationInfo; -import com.adyen.model.checkout.Company; -import com.adyen.model.checkout.LineItem; -import com.adyen.model.checkout.Mandate; import com.adyen.model.Name; -import com.adyen.model.checkout.RiskData; import com.adyen.model.Split; -import com.adyen.model.checkout.ThreeDSecureData; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; diff --git a/src/main/java/com/adyen/model/checkout/PaymentSessionResponse.java b/src/main/java/com/adyen/model/checkout/PaymentSessionResponse.java index 44d91b9c5..a2f2ac192 100755 --- a/src/main/java/com/adyen/model/checkout/PaymentSessionResponse.java +++ b/src/main/java/com/adyen/model/checkout/PaymentSessionResponse.java @@ -497,8 +497,6 @@ public String toString() { } - - } From 8e948723c77c78aef3c1b700fcea3457641e2151 Mon Sep 17 00:00:00 2001 From: Wouter Boereboom Date: Wed, 29 Sep 2021 10:28:44 +0200 Subject: [PATCH 06/29] minor linting fixes --- src/main/java/com/adyen/service/Checkout.java | 2 +- .../service/resource/checkout/Sessions.java | 2 +- src/test/java/com/adyen/CheckoutTest.java | 28 +++++++++++++++++-- .../mocks/checkout/sessions-success.json | 2 +- 4 files changed, 29 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/adyen/service/Checkout.java b/src/main/java/com/adyen/service/Checkout.java index b4e9061db..26e9008f8 100644 --- a/src/main/java/com/adyen/service/Checkout.java +++ b/src/main/java/com/adyen/service/Checkout.java @@ -14,7 +14,7 @@ * * Adyen Java API Library * - * Copyright (c) 2020 Adyen B.V. + * Copyright (c) 2021 Adyen B.V. * This file is open source and available under the MIT license. * See the LICENSE file for more info. */ diff --git a/src/main/java/com/adyen/service/resource/checkout/Sessions.java b/src/main/java/com/adyen/service/resource/checkout/Sessions.java index 4fd7df673..db1e1a2e2 100644 --- a/src/main/java/com/adyen/service/resource/checkout/Sessions.java +++ b/src/main/java/com/adyen/service/resource/checkout/Sessions.java @@ -14,7 +14,7 @@ * * Adyen Java API Library * - * Copyright (c) 2020 Adyen B.V. + * Copyright (c) 2021 Adyen B.V. * This file is open source and available under the MIT license. * See the LICENSE file for more info. */ diff --git a/src/test/java/com/adyen/CheckoutTest.java b/src/test/java/com/adyen/CheckoutTest.java index e13ab3988..52ee24c60 100644 --- a/src/test/java/com/adyen/CheckoutTest.java +++ b/src/test/java/com/adyen/CheckoutTest.java @@ -14,7 +14,7 @@ * * Adyen Java API Library * - * Copyright (c) 2020 Adyen B.V. + * Copyright (c) 2021 Adyen B.V. * This file is open source and available under the MIT license. * See the LICENSE file for more info. */ @@ -26,7 +26,31 @@ import com.adyen.model.Amount; import com.adyen.model.Split; import com.adyen.model.SplitAmount; -import com.adyen.model.checkout.*; +import com.adyen.model.checkout.CheckoutCancelOrderRequest; +import com.adyen.model.checkout.CheckoutCancelOrderResponse; +import com.adyen.model.checkout.CheckoutCreateOrderRequest; +import com.adyen.model.checkout.CheckoutCreateOrderResponse; +import com.adyen.model.checkout.CheckoutOrder; +import com.adyen.model.checkout.CheckoutPaymentsAction; +import com.adyen.model.checkout.CreateStoredPaymentMethodRequest; +import com.adyen.model.checkout.DefaultPaymentMethodDetails; +import com.adyen.model.checkout.PaymentMethodDetails; +import com.adyen.model.checkout.PaymentMethodsRequest; +import com.adyen.model.checkout.PaymentMethodsResponse; +import com.adyen.model.checkout.PaymentResultRequest; +import com.adyen.model.checkout.PaymentResultResponse; +import com.adyen.model.checkout.PaymentSessionRequest; +import com.adyen.model.checkout.PaymentSessionResponse; +import com.adyen.model.checkout.PaymentsDetailsRequest; +import com.adyen.model.checkout.PaymentsDetailsResponse; +import com.adyen.model.checkout.PaymentsRequest; +import com.adyen.model.checkout.PaymentsResponse; +import com.adyen.model.checkout.CreateCheckoutSessionRequest; +import com.adyen.model.checkout.CreateCheckoutSessionResponse; +import com.adyen.model.checkout.Redirect; +import com.adyen.model.checkout.RiskData; +import com.adyen.model.checkout.StoredPaymentMethodResource; +import com.adyen.model.checkout.StoringMethod; import com.adyen.model.checkout.details.AchDetails; import com.adyen.model.checkout.details.AmazonPayDetails; import com.adyen.model.checkout.details.AndroidPayDetails; diff --git a/src/test/resources/mocks/checkout/sessions-success.json b/src/test/resources/mocks/checkout/sessions-success.json index 21a559ab3..ac9bc7110 100644 --- a/src/test/resources/mocks/checkout/sessions-success.json +++ b/src/test/resources/mocks/checkout/sessions-success.json @@ -8,4 +8,4 @@ "returnUrl": "http://test-url.com", "expiresAt": "2021-09-30T06:45:06Z", "merchantAccount": "TestMerchant" -} \ No newline at end of file +} From fba1b7511ad8b56710b2c8c26b313505d1ba1493 Mon Sep 17 00:00:00 2001 From: Wouter Boereboom Date: Wed, 29 Sep 2021 10:55:10 +0200 Subject: [PATCH 07/29] fixed unit tests --- .../model/checkout/CreateCheckoutSessionRequest.java | 11 ++++------- .../model/checkout/CreateCheckoutSessionResponse.java | 11 ++++------- 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/src/main/java/com/adyen/model/checkout/CreateCheckoutSessionRequest.java b/src/main/java/com/adyen/model/checkout/CreateCheckoutSessionRequest.java index 902c74695..db42db3f9 100644 --- a/src/main/java/com/adyen/model/checkout/CreateCheckoutSessionRequest.java +++ b/src/main/java/com/adyen/model/checkout/CreateCheckoutSessionRequest.java @@ -30,6 +30,7 @@ import com.adyen.model.applicationinfo.ApplicationInfo; import com.adyen.model.Name; import com.adyen.model.Split; +import com.fasterxml.jackson.annotation.JsonValue; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; @@ -88,11 +89,10 @@ public class CreateCheckoutSessionRequest { @JsonAdapter(ChannelEnum.Adapter.class) public enum ChannelEnum { IOS("iOS"), - ANDROID("Android"), - WEB("Web"); + @JsonValue private final String value; ChannelEnum(String value) { @@ -209,11 +209,10 @@ public ChannelEnum read(final JsonReader jsonReader) throws IOException { @JsonAdapter(RecurringProcessingModelEnum.Adapter.class) public enum RecurringProcessingModelEnum { CARDONFILE("CardOnFile"), - SUBSCRIPTION("Subscription"), - UNSCHEDULEDCARDONFILE("UnscheduledCardOnFile"); + @JsonValue private final String value; RecurringProcessingModelEnum(String value) { @@ -290,13 +289,11 @@ public RecurringProcessingModelEnum read(final JsonReader jsonReader) throws IOE @JsonAdapter(ShopperInteractionEnum.Adapter.class) public enum ShopperInteractionEnum { ECOMMERCE("Ecommerce"), - CONTAUTH("ContAuth"), - MOTO("Moto"), - POS("POS"); + @JsonValue private final String value; ShopperInteractionEnum(String value) { diff --git a/src/main/java/com/adyen/model/checkout/CreateCheckoutSessionResponse.java b/src/main/java/com/adyen/model/checkout/CreateCheckoutSessionResponse.java index cac8cad50..685241b20 100644 --- a/src/main/java/com/adyen/model/checkout/CreateCheckoutSessionResponse.java +++ b/src/main/java/com/adyen/model/checkout/CreateCheckoutSessionResponse.java @@ -30,6 +30,7 @@ import com.adyen.model.applicationinfo.ApplicationInfo; import com.adyen.model.Name; import com.adyen.model.Split; +import com.fasterxml.jackson.annotation.JsonValue; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; @@ -88,11 +89,10 @@ public class CreateCheckoutSessionResponse { @JsonAdapter(ChannelEnum.Adapter.class) public enum ChannelEnum { IOS("iOS"), - ANDROID("Android"), - WEB("Web"); + @JsonValue private final String value; ChannelEnum(String value) { @@ -213,11 +213,10 @@ public ChannelEnum read(final JsonReader jsonReader) throws IOException { @JsonAdapter(RecurringProcessingModelEnum.Adapter.class) public enum RecurringProcessingModelEnum { CARDONFILE("CardOnFile"), - SUBSCRIPTION("Subscription"), - UNSCHEDULEDCARDONFILE("UnscheduledCardOnFile"); + @JsonValue private final String value; RecurringProcessingModelEnum(String value) { @@ -298,13 +297,11 @@ public RecurringProcessingModelEnum read(final JsonReader jsonReader) throws IOE @JsonAdapter(ShopperInteractionEnum.Adapter.class) public enum ShopperInteractionEnum { ECOMMERCE("Ecommerce"), - CONTAUTH("ContAuth"), - MOTO("Moto"), - POS("POS"); + @JsonValue private final String value; ShopperInteractionEnum(String value) { From 821834545df2cecd81c8e5b2e7105776aeb0165f Mon Sep 17 00:00:00 2001 From: Wouter Boereboom Date: Wed, 29 Sep 2021 11:09:20 +0200 Subject: [PATCH 08/29] added test for error flow on checkout session --- src/test/java/com/adyen/CheckoutTest.java | 9 +++++++++ .../mocks/checkout/sessions-error-invalid-data-422.json | 6 ++++++ 2 files changed, 15 insertions(+) create mode 100644 src/test/resources/mocks/checkout/sessions-error-invalid-data-422.json diff --git a/src/test/java/com/adyen/CheckoutTest.java b/src/test/java/com/adyen/CheckoutTest.java index 52ee24c60..048c14b67 100644 --- a/src/test/java/com/adyen/CheckoutTest.java +++ b/src/test/java/com/adyen/CheckoutTest.java @@ -2198,6 +2198,15 @@ public void TestCheckoutSessionSuccess() throws IOException, ApiException { assertEquals("EUR", sessionsResponse.getAmount().getCurrency()); assertEquals("1000", sessionsResponse.getAmount().getValue().toString()); } + + @Test + public void TestCheckoutSessionErrorMocked() throws Exception { + Client client = createMockClientFromFile("mocks/checkout/sessions-error-invalid-data-422.json"); + Checkout checkout = new Checkout(client); + CreateCheckoutSessionRequest sessionsRequest = createCreateCheckoutSessionRequest(); + CreateCheckoutSessionResponse sessionsResponse = checkout.sessions(sessionsRequest); + assertNull(sessionsResponse.getSessionData()); + } } class TestPaymentMethodDetails implements PaymentMethodDetails { diff --git a/src/test/resources/mocks/checkout/sessions-error-invalid-data-422.json b/src/test/resources/mocks/checkout/sessions-error-invalid-data-422.json new file mode 100644 index 000000000..d6a9efa4e --- /dev/null +++ b/src/test/resources/mocks/checkout/sessions-error-invalid-data-422.json @@ -0,0 +1,6 @@ +{ + "status": 422, + "errorCode": "130", + "message": "Reference Missing", + "errorType": "validation" +} From 412a6daff66bb094dfc522d0672c0e2f3f7f9ef0 Mon Sep 17 00:00:00 2001 From: Wouter Boereboom Date: Wed, 29 Sep 2021 13:10:50 +0200 Subject: [PATCH 09/29] small fixed based on review --- .../checkout/CreateCheckoutSessionRequest.java | 14 ++------------ .../checkout/CreateCheckoutSessionResponse.java | 14 ++------------ .../adyen/service/resource/checkout/Sessions.java | 8 ++++---- 3 files changed, 8 insertions(+), 28 deletions(-) diff --git a/src/main/java/com/adyen/model/checkout/CreateCheckoutSessionRequest.java b/src/main/java/com/adyen/model/checkout/CreateCheckoutSessionRequest.java index db42db3f9..fc408578d 100644 --- a/src/main/java/com/adyen/model/checkout/CreateCheckoutSessionRequest.java +++ b/src/main/java/com/adyen/model/checkout/CreateCheckoutSessionRequest.java @@ -37,6 +37,8 @@ import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; +import static com.adyen.util.Util.toIndentedString; + import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; @@ -1534,18 +1536,6 @@ public String toString() { 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 "); - } - } diff --git a/src/main/java/com/adyen/model/checkout/CreateCheckoutSessionResponse.java b/src/main/java/com/adyen/model/checkout/CreateCheckoutSessionResponse.java index 685241b20..78cbdeb82 100644 --- a/src/main/java/com/adyen/model/checkout/CreateCheckoutSessionResponse.java +++ b/src/main/java/com/adyen/model/checkout/CreateCheckoutSessionResponse.java @@ -37,6 +37,8 @@ import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; +import static com.adyen.util.Util.toIndentedString; + import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; @@ -1576,17 +1578,5 @@ public String toString() { 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 "); - } - } diff --git a/src/main/java/com/adyen/service/resource/checkout/Sessions.java b/src/main/java/com/adyen/service/resource/checkout/Sessions.java index db1e1a2e2..9a757a0cd 100644 --- a/src/main/java/com/adyen/service/resource/checkout/Sessions.java +++ b/src/main/java/com/adyen/service/resource/checkout/Sessions.java @@ -21,11 +21,11 @@ package com.adyen.service.resource.checkout; - import com.adyen.Client; - import com.adyen.Service; - import com.adyen.service.Resource; +import com.adyen.Client; +import com.adyen.Service; +import com.adyen.service.Resource; - import java.util.Arrays; +import java.util.Arrays; public class Sessions extends Resource { From 6256056471fbb7dd58531fffbd430ca5deb8c72e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 30 Sep 2021 04:01:46 +0000 Subject: [PATCH 10/29] Bump swagger-models from 2.1.2 to 2.1.11 Bumps swagger-models from 2.1.2 to 2.1.11. --- updated-dependencies: - dependency-name: io.swagger.core.v3:swagger-models dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index f742a1f94..57a9d1b4c 100644 --- a/pom.xml +++ b/pom.xml @@ -212,7 +212,7 @@ io.swagger.core.v3 swagger-models - 2.1.2 + 2.1.11 io.swagger.core.v3 From c2dcaf7281743c734f28bbc89dfe43a4a7907857 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 30 Sep 2021 04:01:49 +0000 Subject: [PATCH 11/29] Bump swagger-annotations from 2.1.2 to 2.1.11 Bumps swagger-annotations from 2.1.2 to 2.1.11. --- updated-dependencies: - dependency-name: io.swagger.core.v3:swagger-annotations dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index f742a1f94..aaacd74dc 100644 --- a/pom.xml +++ b/pom.xml @@ -217,7 +217,7 @@ io.swagger.core.v3 swagger-annotations - 2.1.2 + 2.1.11 From 70a330a01fd2b9390c3dbdd53b54514df42dd23f Mon Sep 17 00:00:00 2001 From: Wouter Boereboom <62436079+wboereboom@users.noreply.github.com> Date: Thu, 30 Sep 2021 09:36:40 +0200 Subject: [PATCH 12/29] Update CODEOWNERS --- .github/CODEOWNERS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index d4a5be198..d024e97a1 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1 +1 @@ -* @rkewlani @martinsrenato @Aleffio @abhilash-adyen @saquibsayyad @AlexandrosMor @wboereboom +* @rkewlani @martinsrenato @Aleffio @abhilash-adyen @saquibsayyad @AlexandrosMor @wboereboom @Morerice From 0f9f3e28357db3f1f27afbabe4fde55b3605ba5d Mon Sep 17 00:00:00 2001 From: Wouter Boereboom Date: Thu, 30 Sep 2021 16:54:27 +0200 Subject: [PATCH 13/29] fix ApplicationInfo --- .../com/adyen/model/checkout/CreateCheckoutSessionResponse.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/com/adyen/model/checkout/CreateCheckoutSessionResponse.java b/src/main/java/com/adyen/model/checkout/CreateCheckoutSessionResponse.java index 78cbdeb82..018d44760 100644 --- a/src/main/java/com/adyen/model/checkout/CreateCheckoutSessionResponse.java +++ b/src/main/java/com/adyen/model/checkout/CreateCheckoutSessionResponse.java @@ -394,6 +394,7 @@ public ShopperInteractionEnum read(final JsonReader jsonReader) throws IOExcepti public CreateCheckoutSessionResponse accountInfo(AccountInfo accountInfo) { this.accountInfo = accountInfo; + this.applicationInfo = new ApplicationInfo(); return this; } From 0da8fee52da3cd136a122366bbc1c0e402cd69e4 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Thu, 30 Sep 2021 20:36:28 +0000 Subject: [PATCH 14/29] Update jackson.version --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index f742a1f94..0c46dec1d 100644 --- a/pom.xml +++ b/pom.xml @@ -25,7 +25,7 @@ UTF-8 UTF-8 - 2.12.3 + 2.13.0 scm:git:git@github.com:Adyen/adyen-java-api-library.git From 37da2ffd227c58520eb62a93f84c43a7b4857f23 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 1 Oct 2021 04:01:52 +0000 Subject: [PATCH 15/29] Bump jackson.version from 2.12.3 to 2.13.0 Bumps `jackson.version` from 2.12.3 to 2.13.0. Updates `jackson-annotations` from 2.12.3 to 2.13.0 - [Release notes](https://github.com/FasterXML/jackson/releases) - [Commits](https://github.com/FasterXML/jackson/commits) Updates `jackson-databind` from 2.12.3 to 2.13.0 - [Release notes](https://github.com/FasterXML/jackson/releases) - [Commits](https://github.com/FasterXML/jackson/commits) Updates `jackson-datatype-jdk8` from 2.12.3 to 2.13.0 --- updated-dependencies: - dependency-name: com.fasterxml.jackson.core:jackson-annotations dependency-type: direct:production update-type: version-update:semver-minor - dependency-name: com.fasterxml.jackson.core:jackson-databind dependency-type: direct:production update-type: version-update:semver-minor - dependency-name: com.fasterxml.jackson.datatype:jackson-datatype-jdk8 dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index f742a1f94..0c46dec1d 100644 --- a/pom.xml +++ b/pom.xml @@ -25,7 +25,7 @@ UTF-8 UTF-8 - 2.12.3 + 2.13.0 scm:git:git@github.com:Adyen/adyen-java-api-library.git From 8ace7aae6629b74df315b95ac9859dffe3a85edc Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Fri, 1 Oct 2021 08:37:48 +0000 Subject: [PATCH 16/29] Update dependency org.mockito:mockito-core to v3.12.4 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index f742a1f94..8bcbef2d2 100644 --- a/pom.xml +++ b/pom.xml @@ -195,7 +195,7 @@ org.mockito mockito-core - 3.10.0 + 3.12.4 test From 3fd0c161aef37adb4b35e43dcdac63cbd3377bf2 Mon Sep 17 00:00:00 2001 From: Wouter Boereboom <62436079+wboereboom@users.noreply.github.com> Date: Fri, 1 Oct 2021 13:06:49 +0200 Subject: [PATCH 17/29] Update .github/CODEOWNERS Co-authored-by: Alessio Zampatti --- .github/CODEOWNERS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index d024e97a1..4f6f4405a 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1 +1 @@ -* @rkewlani @martinsrenato @Aleffio @abhilash-adyen @saquibsayyad @AlexandrosMor @wboereboom @Morerice +* @AlexandrosMor @wboereboom @Morerice @Aleffio From 78e1eea468ed6321fa8f575cec833c58cac720d9 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Wed, 6 Oct 2021 10:49:44 +0000 Subject: [PATCH 18/29] Update dependency io.swagger.core.v3:swagger-annotations to v2.1.11 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index c6afd4b0f..8747084d6 100644 --- a/pom.xml +++ b/pom.xml @@ -217,7 +217,7 @@ io.swagger.core.v3 swagger-annotations - 2.1.2 + 2.1.11 From 499f56e01f233648363488af56df5c94ddda74c2 Mon Sep 17 00:00:00 2001 From: Wouter Boereboom Date: Wed, 6 Oct 2021 11:29:38 +0000 Subject: [PATCH 19/29] bump version in readme and pom --- README.md | 2 +- pom.xml | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index f4b10048b..6bac2dcd2 100644 --- a/README.md +++ b/README.md @@ -41,7 +41,7 @@ You can use Maven and add this dependency to your project's POM: com.adyen adyen-java-api-library - 17.0.0 + 17.1.0 ``` diff --git a/pom.xml b/pom.xml index 5916fcef1..d38968a1e 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.adyen adyen-java-api-library jar - 17.0.0 + 17.1.0 Adyen Java API Library Adyen API Client Library for Java https://github.com/adyen/adyen-java-api-library @@ -25,6 +25,8 @@ UTF-8 UTF-8 + 1.8 + 1.8 2.13.0 From 6d6cba3be8484e2f5976dfb28ada7118ed3c1070 Mon Sep 17 00:00:00 2001 From: Wouter Boereboom Date: Wed, 6 Oct 2021 11:30:58 +0000 Subject: [PATCH 20/29] removed maven compiler source and target from pom --- pom.xml | 2 -- 1 file changed, 2 deletions(-) diff --git a/pom.xml b/pom.xml index d38968a1e..bfc4cc89a 100644 --- a/pom.xml +++ b/pom.xml @@ -25,8 +25,6 @@ UTF-8 UTF-8 - 1.8 - 1.8 2.13.0 From 78098d3c24d7e0845aa8205fa226032a486ae813 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 8 Oct 2021 10:53:30 +0200 Subject: [PATCH 21/29] Bump mockito-core from 3.12.4 to 4.0.0 (#636) Bumps [mockito-core](https://github.com/mockito/mockito) from 3.12.4 to 4.0.0. - [Release notes](https://github.com/mockito/mockito/releases) - [Commits](https://github.com/mockito/mockito/compare/v3.12.4...v4.0.0) --- updated-dependencies: - dependency-name: org.mockito:mockito-core dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index bfc4cc89a..47bf72df1 100644 --- a/pom.xml +++ b/pom.xml @@ -195,7 +195,7 @@ org.mockito mockito-core - 3.12.4 + 4.0.0 test From c2b7e468b96ee8bd2e0891d6c54be2747e65d818 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Fri, 8 Oct 2021 11:08:18 +0200 Subject: [PATCH 22/29] Update dependency org.apache.maven.plugins:maven-gpg-plugin to v3 (#542) --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 47bf72df1..7d7c6924c 100644 --- a/pom.xml +++ b/pom.xml @@ -97,7 +97,7 @@ org.apache.maven.plugins maven-gpg-plugin - 1.6 + 3.0.1 sign-artifacts From f5541f8eea46ca1875726bd7776a4d6a6caa2a58 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 8 Oct 2021 11:08:40 +0200 Subject: [PATCH 23/29] Bump maven-gpg-plugin from 1.6 to 3.0.1 (#543) Bumps [maven-gpg-plugin](https://github.com/apache/maven-gpg-plugin) from 1.6 to 3.0.1. - [Release notes](https://github.com/apache/maven-gpg-plugin/releases) - [Commits](https://github.com/apache/maven-gpg-plugin/compare/maven-gpg-plugin-1.6...maven-gpg-plugin-3.0.1) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> From cf87589b3c018f7cd8785e17026450660f06d230 Mon Sep 17 00:00:00 2001 From: Wouter Boereboom <62436079+wboereboom@users.noreply.github.com> Date: Fri, 8 Oct 2021 16:35:00 +0200 Subject: [PATCH 24/29] Pw 5187/update modifications checkout (#634) * updated modification endpoints. tests WIP * fixed tests and linting * added error test flow --- .../CreatePaymentAmountUpdateRequest.java | 264 ++++++++++++ .../checkout/CreatePaymentCancelRequest.java | 119 ++++++ .../checkout/CreatePaymentCaptureRequest.java | 184 +++++++++ .../checkout/CreatePaymentRefundRequest.java | 182 ++++++++ .../CreatePaymentReversalRequest.java | 118 ++++++ .../CreateStandalonePaymentCancelRequest.java | 146 +++++++ .../checkout/PaymentAmountUpdateResource.java | 389 ++++++++++++++++++ .../model/checkout/PaymentCancelResource.java | 250 +++++++++++ .../checkout/PaymentCaptureResource.java | 314 ++++++++++++++ .../model/checkout/PaymentRefundResource.java | 314 ++++++++++++++ .../checkout/PaymentReversalResource.java | 250 +++++++++++ .../StandalonePaymentCancelResource.java | 250 +++++++++++ src/main/java/com/adyen/service/Checkout.java | 120 +++++- .../service/resource/checkout/Cancels.java | 36 ++ .../checkout/PaymentsAmountUpdates.java | 36 ++ .../resource/checkout/PaymentsCancels.java | 36 ++ .../resource/checkout/PaymentsCaptures.java | 36 ++ .../resource/checkout/PaymentsRefunds.java | 36 ++ .../resource/checkout/PaymentsReversals.java | 36 ++ src/test/java/com/adyen/CheckoutTest.java | 188 ++++++++- .../checkout/amount-updates-success.json | 11 + .../mocks/checkout/cancels-success.json | 11 + .../mocks/checkout/captures-success.json | 11 + .../checkout/modifications-error-422.json | 7 + .../mocks/checkout/refunds-success.json | 11 + .../mocks/checkout/reversals-success.json | 11 + .../checkout/standalone-cancels-success.json | 7 + 27 files changed, 3371 insertions(+), 2 deletions(-) create mode 100644 src/main/java/com/adyen/model/checkout/CreatePaymentAmountUpdateRequest.java create mode 100644 src/main/java/com/adyen/model/checkout/CreatePaymentCancelRequest.java create mode 100644 src/main/java/com/adyen/model/checkout/CreatePaymentCaptureRequest.java create mode 100644 src/main/java/com/adyen/model/checkout/CreatePaymentRefundRequest.java create mode 100644 src/main/java/com/adyen/model/checkout/CreatePaymentReversalRequest.java create mode 100644 src/main/java/com/adyen/model/checkout/CreateStandalonePaymentCancelRequest.java create mode 100644 src/main/java/com/adyen/model/checkout/PaymentAmountUpdateResource.java create mode 100644 src/main/java/com/adyen/model/checkout/PaymentCancelResource.java create mode 100644 src/main/java/com/adyen/model/checkout/PaymentCaptureResource.java create mode 100644 src/main/java/com/adyen/model/checkout/PaymentRefundResource.java create mode 100644 src/main/java/com/adyen/model/checkout/PaymentReversalResource.java create mode 100644 src/main/java/com/adyen/model/checkout/StandalonePaymentCancelResource.java create mode 100644 src/main/java/com/adyen/service/resource/checkout/Cancels.java create mode 100644 src/main/java/com/adyen/service/resource/checkout/PaymentsAmountUpdates.java create mode 100644 src/main/java/com/adyen/service/resource/checkout/PaymentsCancels.java create mode 100644 src/main/java/com/adyen/service/resource/checkout/PaymentsCaptures.java create mode 100644 src/main/java/com/adyen/service/resource/checkout/PaymentsRefunds.java create mode 100644 src/main/java/com/adyen/service/resource/checkout/PaymentsReversals.java create mode 100644 src/test/resources/mocks/checkout/amount-updates-success.json create mode 100644 src/test/resources/mocks/checkout/cancels-success.json create mode 100644 src/test/resources/mocks/checkout/captures-success.json create mode 100644 src/test/resources/mocks/checkout/modifications-error-422.json create mode 100644 src/test/resources/mocks/checkout/refunds-success.json create mode 100644 src/test/resources/mocks/checkout/reversals-success.json create mode 100644 src/test/resources/mocks/checkout/standalone-cancels-success.json diff --git a/src/main/java/com/adyen/model/checkout/CreatePaymentAmountUpdateRequest.java b/src/main/java/com/adyen/model/checkout/CreatePaymentAmountUpdateRequest.java new file mode 100644 index 000000000..79184cf41 --- /dev/null +++ b/src/main/java/com/adyen/model/checkout/CreatePaymentAmountUpdateRequest.java @@ -0,0 +1,264 @@ +/* + * ###### + * ###### + * ############ ####( ###### #####. ###### ############ ############ + * ############# #####( ###### #####. ###### ############# ############# + * ###### #####( ###### #####. ###### ##### ###### ##### ###### + * ###### ###### #####( ###### #####. ###### ##### ##### ##### ###### + * ###### ###### #####( ###### #####. ###### ##### ##### ###### + * ############# ############# ############# ############# ##### ###### + * ############ ############ ############# ############ ##### ###### + * ###### + * ############# + * ############ + * + * Adyen Java API Library + * + * Copyright (c) 2021 Adyen B.V. + * This file is open source and available under the MIT license. + * See the LICENSE file for more info. + */ +package com.adyen.model.checkout; + +import java.util.Objects; + +import com.fasterxml.jackson.annotation.JsonValue; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import com.adyen.model.Amount; +import com.adyen.model.Split; + +/** + * CreatePaymentAmountUpdateRequest + */ +public class CreatePaymentAmountUpdateRequest { + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + @SerializedName(SERIALIZED_NAME_AMOUNT) + private Amount amount; + + public static final String SERIALIZED_NAME_MERCHANT_ACCOUNT = "merchantAccount"; + @SerializedName(SERIALIZED_NAME_MERCHANT_ACCOUNT) + private String merchantAccount; + + /** + * The reason for the amount update. Possible values: * **delayedCharge** * **noShow** + */ + @JsonAdapter(ReasonEnum.Adapter.class) + public enum ReasonEnum { + DELAYEDCHARGE("delayedCharge"), + + NOSHOW("noShow"); + + @JsonValue + private String value; + + ReasonEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static ReasonEnum fromValue(String value) { + for (ReasonEnum b : ReasonEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final ReasonEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public ReasonEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return ReasonEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_REASON = "reason"; + @SerializedName(SERIALIZED_NAME_REASON) + private ReasonEnum reason; + + public static final String SERIALIZED_NAME_REFERENCE = "reference"; + @SerializedName(SERIALIZED_NAME_REFERENCE) + private String reference; + + public static final String SERIALIZED_NAME_SPLITS = "splits"; + @SerializedName(SERIALIZED_NAME_SPLITS) + private List splits = null; + + + public CreatePaymentAmountUpdateRequest amount(Amount amount) { + + this.amount = amount; + return this; + } + + /** + * Get amount + * @return amount + **/ + public Amount getAmount() { + return amount; + } + + + public void setAmount(Amount amount) { + this.amount = amount; + } + + + public CreatePaymentAmountUpdateRequest merchantAccount(String merchantAccount) { + + this.merchantAccount = merchantAccount; + return this; + } + + /** + * The merchant account that is used to process the payment. + * @return merchantAccount + **/ + public String getMerchantAccount() { + return merchantAccount; + } + + + public void setMerchantAccount(String merchantAccount) { + this.merchantAccount = merchantAccount; + } + + + public CreatePaymentAmountUpdateRequest reason(ReasonEnum reason) { + + this.reason = reason; + return this; + } + + /** + * The reason for the amount update. Possible values: * **delayedCharge** * **noShow** + * @return reason + **/ + public ReasonEnum getReason() { + return reason; + } + + + public void setReason(ReasonEnum reason) { + this.reason = reason; + } + + + public CreatePaymentAmountUpdateRequest reference(String reference) { + + this.reference = reference; + return this; + } + + /** + * Your reference for the amount update request. Maximum length: 80 characters. + * @return reference + **/ + public String getReference() { + return reference; + } + + + public void setReference(String reference) { + this.reference = reference; + } + + + public CreatePaymentAmountUpdateRequest splits(List splits) { + + this.splits = splits; + return this; + } + + public CreatePaymentAmountUpdateRequest addSplitsItem(Split splitsItem) { + if (this.splits == null) { + this.splits = new ArrayList(); + } + this.splits.add(splitsItem); + return this; + } + + /** + * An array of objects specifying how the amount should be split between accounts when using Adyen for Platforms. For details, refer to [Providing split information](https://docs.adyen.com/platforms/processing-payments#providing-split-information). + * @return splits + **/ + public List getSplits() { + return splits; + } + + + public void setSplits(List splits) { + this.splits = splits; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreatePaymentAmountUpdateRequest createPaymentAmountUpdateRequest = (CreatePaymentAmountUpdateRequest) o; + return Objects.equals(this.amount, createPaymentAmountUpdateRequest.amount) && + Objects.equals(this.merchantAccount, createPaymentAmountUpdateRequest.merchantAccount) && + Objects.equals(this.reason, createPaymentAmountUpdateRequest.reason) && + Objects.equals(this.reference, createPaymentAmountUpdateRequest.reference) && + Objects.equals(this.splits, createPaymentAmountUpdateRequest.splits); + } + + @Override + public int hashCode() { + return Objects.hash(amount, merchantAccount, reason, reference, splits); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreatePaymentAmountUpdateRequest {\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" merchantAccount: ").append(toIndentedString(merchantAccount)).append("\n"); + sb.append(" reason: ").append(toIndentedString(reason)).append("\n"); + sb.append(" reference: ").append(toIndentedString(reference)).append("\n"); + sb.append(" splits: ").append(toIndentedString(splits)).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 "); + } + +} + diff --git a/src/main/java/com/adyen/model/checkout/CreatePaymentCancelRequest.java b/src/main/java/com/adyen/model/checkout/CreatePaymentCancelRequest.java new file mode 100644 index 000000000..c2f748a49 --- /dev/null +++ b/src/main/java/com/adyen/model/checkout/CreatePaymentCancelRequest.java @@ -0,0 +1,119 @@ +/* + * ###### + * ###### + * ############ ####( ###### #####. ###### ############ ############ + * ############# #####( ###### #####. ###### ############# ############# + * ###### #####( ###### #####. ###### ##### ###### ##### ###### + * ###### ###### #####( ###### #####. ###### ##### ##### ##### ###### + * ###### ###### #####( ###### #####. ###### ##### ##### ###### + * ############# ############# ############# ############# ##### ###### + * ############ ############ ############# ############ ##### ###### + * ###### + * ############# + * ############ + * + * Adyen Java API Library + * + * Copyright (c) 2021 Adyen B.V. + * This file is open source and available under the MIT license. + * See the LICENSE file for more info. + */ +package com.adyen.model.checkout; + +import java.util.Objects; +import com.google.gson.annotations.SerializedName; + +/** + * CreatePaymentCancelRequest + */ +public class CreatePaymentCancelRequest { + public static final String SERIALIZED_NAME_MERCHANT_ACCOUNT = "merchantAccount"; + @SerializedName(SERIALIZED_NAME_MERCHANT_ACCOUNT) + private String merchantAccount; + + public static final String SERIALIZED_NAME_REFERENCE = "reference"; + @SerializedName(SERIALIZED_NAME_REFERENCE) + private String reference; + + + public CreatePaymentCancelRequest merchantAccount(String merchantAccount) { + + this.merchantAccount = merchantAccount; + return this; + } + + /** + * The merchant account that is used to process the payment. + * @return merchantAccount + **/ + public String getMerchantAccount() { + return merchantAccount; + } + + + public void setMerchantAccount(String merchantAccount) { + this.merchantAccount = merchantAccount; + } + + + public CreatePaymentCancelRequest reference(String reference) { + + this.reference = reference; + return this; + } + + /** + * Your reference for the cancel request. Maximum length: 80 characters. + * @return reference + **/ + public String getReference() { + return reference; + } + + + public void setReference(String reference) { + this.reference = reference; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreatePaymentCancelRequest createPaymentCancelRequest = (CreatePaymentCancelRequest) o; + return Objects.equals(this.merchantAccount, createPaymentCancelRequest.merchantAccount) && + Objects.equals(this.reference, createPaymentCancelRequest.reference); + } + + @Override + public int hashCode() { + return Objects.hash(merchantAccount, reference); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreatePaymentCancelRequest {\n"); + sb.append(" merchantAccount: ").append(toIndentedString(merchantAccount)).append("\n"); + sb.append(" reference: ").append(toIndentedString(reference)).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 "); + } + +} + diff --git a/src/main/java/com/adyen/model/checkout/CreatePaymentCaptureRequest.java b/src/main/java/com/adyen/model/checkout/CreatePaymentCaptureRequest.java new file mode 100644 index 000000000..105a1298c --- /dev/null +++ b/src/main/java/com/adyen/model/checkout/CreatePaymentCaptureRequest.java @@ -0,0 +1,184 @@ +/* + * ###### + * ###### + * ############ ####( ###### #####. ###### ############ ############ + * ############# #####( ###### #####. ###### ############# ############# + * ###### #####( ###### #####. ###### ##### ###### ##### ###### + * ###### ###### #####( ###### #####. ###### ##### ##### ##### ###### + * ###### ###### #####( ###### #####. ###### ##### ##### ###### + * ############# ############# ############# ############# ##### ###### + * ############ ############ ############# ############ ##### ###### + * ###### + * ############# + * ############ + * + * Adyen Java API Library + * + * Copyright (c) 2021 Adyen B.V. + * This file is open source and available under the MIT license. + * See the LICENSE file for more info. + */ +package com.adyen.model.checkout; + +import java.util.Objects; + +import com.google.gson.annotations.SerializedName; +import java.util.ArrayList; +import java.util.List; +import com.adyen.model.Amount; +import com.adyen.model.Split; + +/** + * CreatePaymentCaptureRequest + */ +public class CreatePaymentCaptureRequest { + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + @SerializedName(SERIALIZED_NAME_AMOUNT) + private Amount amount; + + public static final String SERIALIZED_NAME_MERCHANT_ACCOUNT = "merchantAccount"; + @SerializedName(SERIALIZED_NAME_MERCHANT_ACCOUNT) + private String merchantAccount; + + public static final String SERIALIZED_NAME_REFERENCE = "reference"; + @SerializedName(SERIALIZED_NAME_REFERENCE) + private String reference; + + public static final String SERIALIZED_NAME_SPLITS = "splits"; + @SerializedName(SERIALIZED_NAME_SPLITS) + private List splits = null; + + + public CreatePaymentCaptureRequest amount(Amount amount) { + + this.amount = amount; + return this; + } + + /** + * Get amount + * @return amount + **/ + public Amount getAmount() { + return amount; + } + + + public void setAmount(Amount amount) { + this.amount = amount; + } + + + public CreatePaymentCaptureRequest merchantAccount(String merchantAccount) { + + this.merchantAccount = merchantAccount; + return this; + } + + /** + * The merchant account that is used to process the payment. + * @return merchantAccount + **/ + public String getMerchantAccount() { + return merchantAccount; + } + + + public void setMerchantAccount(String merchantAccount) { + this.merchantAccount = merchantAccount; + } + + + public CreatePaymentCaptureRequest reference(String reference) { + + this.reference = reference; + return this; + } + + /** + * Your reference for the capture request. Maximum length: 80 characters. + * @return reference + **/ + public String getReference() { + return reference; + } + + + public void setReference(String reference) { + this.reference = reference; + } + + + public CreatePaymentCaptureRequest splits(List splits) { + + this.splits = splits; + return this; + } + + public CreatePaymentCaptureRequest addSplitsItem(Split splitsItem) { + if (this.splits == null) { + this.splits = new ArrayList(); + } + this.splits.add(splitsItem); + return this; + } + + /** + * An array of objects specifying how the amount should be split between accounts when using Adyen for Platforms. For details, refer to [Providing split information](https://docs.adyen.com/platforms/processing-payments#providing-split-information). + * @return splits + **/ + public List getSplits() { + return splits; + } + + + public void setSplits(List splits) { + this.splits = splits; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreatePaymentCaptureRequest createPaymentCaptureRequest = (CreatePaymentCaptureRequest) o; + return Objects.equals(this.amount, createPaymentCaptureRequest.amount) && + Objects.equals(this.merchantAccount, createPaymentCaptureRequest.merchantAccount) && + Objects.equals(this.reference, createPaymentCaptureRequest.reference) && + Objects.equals(this.splits, createPaymentCaptureRequest.splits); + } + + @Override + public int hashCode() { + return Objects.hash(amount, merchantAccount, reference, splits); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreatePaymentCaptureRequest {\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" merchantAccount: ").append(toIndentedString(merchantAccount)).append("\n"); + sb.append(" reference: ").append(toIndentedString(reference)).append("\n"); + sb.append(" splits: ").append(toIndentedString(splits)).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 "); + } + +} + diff --git a/src/main/java/com/adyen/model/checkout/CreatePaymentRefundRequest.java b/src/main/java/com/adyen/model/checkout/CreatePaymentRefundRequest.java new file mode 100644 index 000000000..7a6ceb2eb --- /dev/null +++ b/src/main/java/com/adyen/model/checkout/CreatePaymentRefundRequest.java @@ -0,0 +1,182 @@ +/* + * ###### + * ###### + * ############ ####( ###### #####. ###### ############ ############ + * ############# #####( ###### #####. ###### ############# ############# + * ###### #####( ###### #####. ###### ##### ###### ##### ###### + * ###### ###### #####( ###### #####. ###### ##### ##### ##### ###### + * ###### ###### #####( ###### #####. ###### ##### ##### ###### + * ############# ############# ############# ############# ##### ###### + * ############ ############ ############# ############ ##### ###### + * ###### + * ############# + * ############ + * + * Adyen Java API Library + * + * Copyright (c) 2021 Adyen B.V. + * This file is open source and available under the MIT license. + * See the LICENSE file for more info. + */ +package com.adyen.model.checkout; + +import java.util.Objects; +import com.google.gson.annotations.SerializedName; +import java.util.ArrayList; +import java.util.List; +import com.adyen.model.Amount; +import com.adyen.model.Split; +/** + * CreatePaymentRefundRequest + */ +public class CreatePaymentRefundRequest { + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + @SerializedName(SERIALIZED_NAME_AMOUNT) + private Amount amount; + + public static final String SERIALIZED_NAME_MERCHANT_ACCOUNT = "merchantAccount"; + @SerializedName(SERIALIZED_NAME_MERCHANT_ACCOUNT) + private String merchantAccount; + + public static final String SERIALIZED_NAME_REFERENCE = "reference"; + @SerializedName(SERIALIZED_NAME_REFERENCE) + private String reference; + + public static final String SERIALIZED_NAME_SPLITS = "splits"; + @SerializedName(SERIALIZED_NAME_SPLITS) + private List splits = null; + + + public CreatePaymentRefundRequest amount(Amount amount) { + + this.amount = amount; + return this; + } + + /** + * Get amount + * @return amount + **/ + public Amount getAmount() { + return amount; + } + + + public void setAmount(Amount amount) { + this.amount = amount; + } + + + public CreatePaymentRefundRequest merchantAccount(String merchantAccount) { + + this.merchantAccount = merchantAccount; + return this; + } + + /** + * The merchant account that is used to process the payment. + * @return merchantAccount + **/ + public String getMerchantAccount() { + return merchantAccount; + } + + + public void setMerchantAccount(String merchantAccount) { + this.merchantAccount = merchantAccount; + } + + + public CreatePaymentRefundRequest reference(String reference) { + + this.reference = reference; + return this; + } + + /** + * Your reference for the refund request. Maximum length: 80 characters. + * @return reference + **/ + public String getReference() { + return reference; + } + + + public void setReference(String reference) { + this.reference = reference; + } + + + public CreatePaymentRefundRequest splits(List splits) { + + this.splits = splits; + return this; + } + + public CreatePaymentRefundRequest addSplitsItem(Split splitsItem) { + if (this.splits == null) { + this.splits = new ArrayList(); + } + this.splits.add(splitsItem); + return this; + } + + /** + * An array of objects specifying how the amount should be split between accounts when using Adyen for Platforms. For details, refer to [Providing split information](https://docs.adyen.com/platforms/processing-payments#providing-split-information). + * @return splits + **/ + public List getSplits() { + return splits; + } + + + public void setSplits(List splits) { + this.splits = splits; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreatePaymentRefundRequest createPaymentRefundRequest = (CreatePaymentRefundRequest) o; + return Objects.equals(this.amount, createPaymentRefundRequest.amount) && + Objects.equals(this.merchantAccount, createPaymentRefundRequest.merchantAccount) && + Objects.equals(this.reference, createPaymentRefundRequest.reference) && + Objects.equals(this.splits, createPaymentRefundRequest.splits); + } + + @Override + public int hashCode() { + return Objects.hash(amount, merchantAccount, reference, splits); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreatePaymentRefundRequest {\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" merchantAccount: ").append(toIndentedString(merchantAccount)).append("\n"); + sb.append(" reference: ").append(toIndentedString(reference)).append("\n"); + sb.append(" splits: ").append(toIndentedString(splits)).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 "); + } + +} + diff --git a/src/main/java/com/adyen/model/checkout/CreatePaymentReversalRequest.java b/src/main/java/com/adyen/model/checkout/CreatePaymentReversalRequest.java new file mode 100644 index 000000000..2bd054aff --- /dev/null +++ b/src/main/java/com/adyen/model/checkout/CreatePaymentReversalRequest.java @@ -0,0 +1,118 @@ +/* + * ###### + * ###### + * ############ ####( ###### #####. ###### ############ ############ + * ############# #####( ###### #####. ###### ############# ############# + * ###### #####( ###### #####. ###### ##### ###### ##### ###### + * ###### ###### #####( ###### #####. ###### ##### ##### ##### ###### + * ###### ###### #####( ###### #####. ###### ##### ##### ###### + * ############# ############# ############# ############# ##### ###### + * ############ ############ ############# ############ ##### ###### + * ###### + * ############# + * ############ + * + * Adyen Java API Library + * + * Copyright (c) 2021 Adyen B.V. + * This file is open source and available under the MIT license. + * See the LICENSE file for more info. + */ +package com.adyen.model.checkout; +import java.util.Objects; +import com.google.gson.annotations.SerializedName; + +/** + * CreatePaymentReversalRequest + */ +public class CreatePaymentReversalRequest { + public static final String SERIALIZED_NAME_MERCHANT_ACCOUNT = "merchantAccount"; + @SerializedName(SERIALIZED_NAME_MERCHANT_ACCOUNT) + private String merchantAccount; + + public static final String SERIALIZED_NAME_REFERENCE = "reference"; + @SerializedName(SERIALIZED_NAME_REFERENCE) + private String reference; + + + public CreatePaymentReversalRequest merchantAccount(String merchantAccount) { + + this.merchantAccount = merchantAccount; + return this; + } + + /** + * The merchant account that is used to process the payment. + * @return merchantAccount + **/ + public String getMerchantAccount() { + return merchantAccount; + } + + + public void setMerchantAccount(String merchantAccount) { + this.merchantAccount = merchantAccount; + } + + + public CreatePaymentReversalRequest reference(String reference) { + + this.reference = reference; + return this; + } + + /** + * Your reference for the reversal request. Maximum length: 80 characters. + * @return reference + **/ + public String getReference() { + return reference; + } + + + public void setReference(String reference) { + this.reference = reference; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreatePaymentReversalRequest createPaymentReversalRequest = (CreatePaymentReversalRequest) o; + return Objects.equals(this.merchantAccount, createPaymentReversalRequest.merchantAccount) && + Objects.equals(this.reference, createPaymentReversalRequest.reference); + } + + @Override + public int hashCode() { + return Objects.hash(merchantAccount, reference); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreatePaymentReversalRequest {\n"); + sb.append(" merchantAccount: ").append(toIndentedString(merchantAccount)).append("\n"); + sb.append(" reference: ").append(toIndentedString(reference)).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 "); + } + +} + diff --git a/src/main/java/com/adyen/model/checkout/CreateStandalonePaymentCancelRequest.java b/src/main/java/com/adyen/model/checkout/CreateStandalonePaymentCancelRequest.java new file mode 100644 index 000000000..4f7c80a9a --- /dev/null +++ b/src/main/java/com/adyen/model/checkout/CreateStandalonePaymentCancelRequest.java @@ -0,0 +1,146 @@ +/* +/* + * ###### + * ###### + * ############ ####( ###### #####. ###### ############ ############ + * ############# #####( ###### #####. ###### ############# ############# + * ###### #####( ###### #####. ###### ##### ###### ##### ###### + * ###### ###### #####( ###### #####. ###### ##### ##### ##### ###### + * ###### ###### #####( ###### #####. ###### ##### ##### ###### + * ############# ############# ############# ############# ##### ###### + * ############ ############ ############# ############ ##### ###### + * ###### + * ############# + * ############ + * + * Adyen Java API Library + * + * Copyright (c) 2021 Adyen B.V. + * This file is open source and available under the MIT license. + * See the LICENSE file for more info. + */ +package com.adyen.model.checkout; +import java.util.Objects; +import com.google.gson.annotations.SerializedName; + + +/** + * CreateStandalonePaymentCancelRequest + */ +public class CreateStandalonePaymentCancelRequest { + public static final String SERIALIZED_NAME_MERCHANT_ACCOUNT = "merchantAccount"; + @SerializedName(SERIALIZED_NAME_MERCHANT_ACCOUNT) + private String merchantAccount; + + public static final String SERIALIZED_NAME_PAYMENT_REFERENCE = "paymentReference"; + @SerializedName(SERIALIZED_NAME_PAYMENT_REFERENCE) + private String paymentReference; + + public static final String SERIALIZED_NAME_REFERENCE = "reference"; + @SerializedName(SERIALIZED_NAME_REFERENCE) + private String reference; + + + public CreateStandalonePaymentCancelRequest merchantAccount(String merchantAccount) { + + this.merchantAccount = merchantAccount; + return this; + } + + /** + * The merchant account that is used to process the payment. + * @return merchantAccount + **/ + public String getMerchantAccount() { + return merchantAccount; + } + + + public void setMerchantAccount(String merchantAccount) { + this.merchantAccount = merchantAccount; + } + + + public CreateStandalonePaymentCancelRequest paymentReference(String paymentReference) { + + this.paymentReference = paymentReference; + return this; + } + + /** + * The [`reference`](https://docs.adyen.com/api-explorer/#/CheckoutService/latest/post/payments__reqParam_reference) of the payment that you want to cancel. + * @return paymentReference + **/ + public String getPaymentReference() { + return paymentReference; + } + + + public void setPaymentReference(String paymentReference) { + this.paymentReference = paymentReference; + } + + + public CreateStandalonePaymentCancelRequest reference(String reference) { + + this.reference = reference; + return this; + } + + /** + * Your reference for the cancel request. Maximum length: 80 characters. + * @return reference + **/ + public String getReference() { + return reference; + } + + + public void setReference(String reference) { + this.reference = reference; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateStandalonePaymentCancelRequest createStandalonePaymentCancelRequest = (CreateStandalonePaymentCancelRequest) o; + return Objects.equals(this.merchantAccount, createStandalonePaymentCancelRequest.merchantAccount) && + Objects.equals(this.paymentReference, createStandalonePaymentCancelRequest.paymentReference) && + Objects.equals(this.reference, createStandalonePaymentCancelRequest.reference); + } + + @Override + public int hashCode() { + return Objects.hash(merchantAccount, paymentReference, reference); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateStandalonePaymentCancelRequest {\n"); + sb.append(" merchantAccount: ").append(toIndentedString(merchantAccount)).append("\n"); + sb.append(" paymentReference: ").append(toIndentedString(paymentReference)).append("\n"); + sb.append(" reference: ").append(toIndentedString(reference)).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 "); + } + +} + diff --git a/src/main/java/com/adyen/model/checkout/PaymentAmountUpdateResource.java b/src/main/java/com/adyen/model/checkout/PaymentAmountUpdateResource.java new file mode 100644 index 000000000..c89ddce26 --- /dev/null +++ b/src/main/java/com/adyen/model/checkout/PaymentAmountUpdateResource.java @@ -0,0 +1,389 @@ +/* + * ###### + * ###### + * ############ ####( ###### #####. ###### ############ ############ + * ############# #####( ###### #####. ###### ############# ############# + * ###### #####( ###### #####. ###### ##### ###### ##### ###### + * ###### ###### #####( ###### #####. ###### ##### ##### ##### ###### + * ###### ###### #####( ###### #####. ###### ##### ##### ###### + * ############# ############# ############# ############# ##### ###### + * ############ ############ ############# ############ ##### ###### + * ###### + * ############# + * ############ + * + * Adyen Java API Library + * + * Copyright (c) 2021 Adyen B.V. + * This file is open source and available under the MIT license. + * See the LICENSE file for more info. + */ +package com.adyen.model.checkout; + +import java.util.Objects; + +import com.fasterxml.jackson.annotation.JsonValue; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import com.adyen.model.Amount; +import com.adyen.model.Split; + +/** + * PaymentAmountUpdateResource + */ +public class PaymentAmountUpdateResource { + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + @SerializedName(SERIALIZED_NAME_AMOUNT) + private Amount amount; + + public static final String SERIALIZED_NAME_MERCHANT_ACCOUNT = "merchantAccount"; + @SerializedName(SERIALIZED_NAME_MERCHANT_ACCOUNT) + private String merchantAccount; + + public static final String SERIALIZED_NAME_PAYMENT_PSP_REFERENCE = "paymentPspReference"; + @SerializedName(SERIALIZED_NAME_PAYMENT_PSP_REFERENCE) + private String paymentPspReference; + + public static final String SERIALIZED_NAME_PSP_REFERENCE = "pspReference"; + @SerializedName(SERIALIZED_NAME_PSP_REFERENCE) + private String pspReference; + + /** + * The reason for the amount update. Possible values: * **DelayedCharge** * **NoShow** + */ + @JsonAdapter(ReasonEnum.Adapter.class) + public enum ReasonEnum { + DELAYEDCHARGE("delayedCharge"), + + NOSHOW("noShow"); + + @JsonValue + private String value; + + ReasonEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static ReasonEnum fromValue(String value) { + for (ReasonEnum b : ReasonEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final ReasonEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public ReasonEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return ReasonEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_REASON = "reason"; + @SerializedName(SERIALIZED_NAME_REASON) + private ReasonEnum reason; + + public static final String SERIALIZED_NAME_REFERENCE = "reference"; + @SerializedName(SERIALIZED_NAME_REFERENCE) + private String reference; + + public static final String SERIALIZED_NAME_SPLITS = "splits"; + @SerializedName(SERIALIZED_NAME_SPLITS) + private List splits = null; + + /** + * The status of your request. This will always have the value **received**. + */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + RECEIVED("received"); + + @JsonValue + private String value; + + StatusEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final StatusEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public StatusEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return StatusEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + private StatusEnum status; + + + public PaymentAmountUpdateResource amount(Amount amount) { + + this.amount = amount; + return this; + } + + /** + * Get amount + * @return amount + **/ + public Amount getAmount() { + return amount; + } + + + public void setAmount(Amount amount) { + this.amount = amount; + } + + + public PaymentAmountUpdateResource merchantAccount(String merchantAccount) { + + this.merchantAccount = merchantAccount; + return this; + } + + /** + * The merchant account that is used to process the payment. + * @return merchantAccount + **/ + public String getMerchantAccount() { + return merchantAccount; + } + + + public void setMerchantAccount(String merchantAccount) { + this.merchantAccount = merchantAccount; + } + + + public PaymentAmountUpdateResource paymentPspReference(String paymentPspReference) { + + this.paymentPspReference = paymentPspReference; + return this; + } + + /** + * The [`pspReference`](https://docs.adyen.com/api-explorer/#/CheckoutService/latest/post/payments__resParam_pspReference) of the payment to update. + * @return paymentPspReference + **/ + public String getPaymentPspReference() { + return paymentPspReference; + } + + + public void setPaymentPspReference(String paymentPspReference) { + this.paymentPspReference = paymentPspReference; + } + + + public PaymentAmountUpdateResource pspReference(String pspReference) { + + this.pspReference = pspReference; + return this; + } + + /** + * Adyen's 16-character reference associated with the amount update request. + * @return pspReference + **/ + public String getPspReference() { + return pspReference; + } + + + public void setPspReference(String pspReference) { + this.pspReference = pspReference; + } + + + public PaymentAmountUpdateResource reason(ReasonEnum reason) { + + this.reason = reason; + return this; + } + + /** + * The reason for the amount update. Possible values: * **DelayedCharge** * **NoShow** + * @return reason + **/ + public ReasonEnum getReason() { + return reason; + } + + + public void setReason(ReasonEnum reason) { + this.reason = reason; + } + + + public PaymentAmountUpdateResource reference(String reference) { + + this.reference = reference; + return this; + } + + /** + * Your reference for the amount update request. Maximum length: 80 characters. + * @return reference + **/ + public String getReference() { + return reference; + } + + + public void setReference(String reference) { + this.reference = reference; + } + + + public PaymentAmountUpdateResource splits(List splits) { + + this.splits = splits; + return this; + } + + public PaymentAmountUpdateResource addSplitsItem(Split splitsItem) { + if (this.splits == null) { + this.splits = new ArrayList(); + } + this.splits.add(splitsItem); + return this; + } + + /** + * An array of objects specifying how the amount should be split between accounts when using Adyen for Platforms. For details, refer to [Providing split information](https://docs.adyen.com/platforms/processing-payments#providing-split-information). + * @return splits + **/ + public List getSplits() { + return splits; + } + + + public void setSplits(List splits) { + this.splits = splits; + } + + + public PaymentAmountUpdateResource status(StatusEnum status) { + + this.status = status; + return this; + } + + /** + * The status of your request. This will always have the value **received**. + * @return status + **/ + public StatusEnum getStatus() { + return status; + } + + + public void setStatus(StatusEnum status) { + this.status = status; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PaymentAmountUpdateResource paymentAmountUpdateResource = (PaymentAmountUpdateResource) o; + return Objects.equals(this.amount, paymentAmountUpdateResource.amount) && + Objects.equals(this.merchantAccount, paymentAmountUpdateResource.merchantAccount) && + Objects.equals(this.paymentPspReference, paymentAmountUpdateResource.paymentPspReference) && + Objects.equals(this.pspReference, paymentAmountUpdateResource.pspReference) && + Objects.equals(this.reason, paymentAmountUpdateResource.reason) && + Objects.equals(this.reference, paymentAmountUpdateResource.reference) && + Objects.equals(this.splits, paymentAmountUpdateResource.splits) && + Objects.equals(this.status, paymentAmountUpdateResource.status); + } + + @Override + public int hashCode() { + return Objects.hash(amount, merchantAccount, paymentPspReference, pspReference, reason, reference, splits, status); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PaymentAmountUpdateResource {\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" merchantAccount: ").append(toIndentedString(merchantAccount)).append("\n"); + sb.append(" paymentPspReference: ").append(toIndentedString(paymentPspReference)).append("\n"); + sb.append(" pspReference: ").append(toIndentedString(pspReference)).append("\n"); + sb.append(" reason: ").append(toIndentedString(reason)).append("\n"); + sb.append(" reference: ").append(toIndentedString(reference)).append("\n"); + sb.append(" splits: ").append(toIndentedString(splits)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).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 "); + } + +} + diff --git a/src/main/java/com/adyen/model/checkout/PaymentCancelResource.java b/src/main/java/com/adyen/model/checkout/PaymentCancelResource.java new file mode 100644 index 000000000..2dab93ea9 --- /dev/null +++ b/src/main/java/com/adyen/model/checkout/PaymentCancelResource.java @@ -0,0 +1,250 @@ +/* + * ###### + * ###### + * ############ ####( ###### #####. ###### ############ ############ + * ############# #####( ###### #####. ###### ############# ############# + * ###### #####( ###### #####. ###### ##### ###### ##### ###### + * ###### ###### #####( ###### #####. ###### ##### ##### ##### ###### + * ###### ###### #####( ###### #####. ###### ##### ##### ###### + * ############# ############# ############# ############# ##### ###### + * ############ ############ ############# ############ ##### ###### + * ###### + * ############# + * ############ + * + * Adyen Java API Library + * + * Copyright (c) 2021 Adyen B.V. + * This file is open source and available under the MIT license. + * See the LICENSE file for more info. + */ +package com.adyen.model.checkout; + +import java.util.Objects; + +import com.fasterxml.jackson.annotation.JsonValue; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +/** + * PaymentCancelResource + */ +public class PaymentCancelResource { + public static final String SERIALIZED_NAME_MERCHANT_ACCOUNT = "merchantAccount"; + @SerializedName(SERIALIZED_NAME_MERCHANT_ACCOUNT) + private String merchantAccount; + + public static final String SERIALIZED_NAME_PAYMENT_PSP_REFERENCE = "paymentPspReference"; + @SerializedName(SERIALIZED_NAME_PAYMENT_PSP_REFERENCE) + private String paymentPspReference; + + public static final String SERIALIZED_NAME_PSP_REFERENCE = "pspReference"; + @SerializedName(SERIALIZED_NAME_PSP_REFERENCE) + private String pspReference; + + public static final String SERIALIZED_NAME_REFERENCE = "reference"; + @SerializedName(SERIALIZED_NAME_REFERENCE) + private String reference; + + /** + * The status of your request. This will always have the value **received**. + */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + RECEIVED("received"); + + @JsonValue + private String value; + + StatusEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final StatusEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public StatusEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return StatusEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + private StatusEnum status; + + + public PaymentCancelResource merchantAccount(String merchantAccount) { + + this.merchantAccount = merchantAccount; + return this; + } + + /** + * The merchant account that is used to process the payment. + * @return merchantAccount + **/ + public String getMerchantAccount() { + return merchantAccount; + } + + + public void setMerchantAccount(String merchantAccount) { + this.merchantAccount = merchantAccount; + } + + + public PaymentCancelResource paymentPspReference(String paymentPspReference) { + + this.paymentPspReference = paymentPspReference; + return this; + } + + /** + * The [`pspReference`](https://docs.adyen.com/api-explorer/#/CheckoutService/latest/post/payments__resParam_pspReference) of the payment to cancel. + * @return paymentPspReference + **/ + public String getPaymentPspReference() { + return paymentPspReference; + } + + + public void setPaymentPspReference(String paymentPspReference) { + this.paymentPspReference = paymentPspReference; + } + + + public PaymentCancelResource pspReference(String pspReference) { + + this.pspReference = pspReference; + return this; + } + + /** + * Adyen's 16-character reference associated with the cancel request. + * @return pspReference + **/ + public String getPspReference() { + return pspReference; + } + + + public void setPspReference(String pspReference) { + this.pspReference = pspReference; + } + + + public PaymentCancelResource reference(String reference) { + + this.reference = reference; + return this; + } + + /** + * Your reference for the cancel request. + * @return reference + **/ + public String getReference() { + return reference; + } + + + public void setReference(String reference) { + this.reference = reference; + } + + + public PaymentCancelResource status(StatusEnum status) { + + this.status = status; + return this; + } + + /** + * The status of your request. This will always have the value **received**. + * @return status + **/ + public StatusEnum getStatus() { + return status; + } + + + public void setStatus(StatusEnum status) { + this.status = status; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PaymentCancelResource paymentCancelResource = (PaymentCancelResource) o; + return Objects.equals(this.merchantAccount, paymentCancelResource.merchantAccount) && + Objects.equals(this.paymentPspReference, paymentCancelResource.paymentPspReference) && + Objects.equals(this.pspReference, paymentCancelResource.pspReference) && + Objects.equals(this.reference, paymentCancelResource.reference) && + Objects.equals(this.status, paymentCancelResource.status); + } + + @Override + public int hashCode() { + return Objects.hash(merchantAccount, paymentPspReference, pspReference, reference, status); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PaymentCancelResource {\n"); + sb.append(" merchantAccount: ").append(toIndentedString(merchantAccount)).append("\n"); + sb.append(" paymentPspReference: ").append(toIndentedString(paymentPspReference)).append("\n"); + sb.append(" pspReference: ").append(toIndentedString(pspReference)).append("\n"); + sb.append(" reference: ").append(toIndentedString(reference)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).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 "); + } + +} + diff --git a/src/main/java/com/adyen/model/checkout/PaymentCaptureResource.java b/src/main/java/com/adyen/model/checkout/PaymentCaptureResource.java new file mode 100644 index 000000000..b56e07378 --- /dev/null +++ b/src/main/java/com/adyen/model/checkout/PaymentCaptureResource.java @@ -0,0 +1,314 @@ +/* + * ###### + * ###### + * ############ ####( ###### #####. ###### ############ ############ + * ############# #####( ###### #####. ###### ############# ############# + * ###### #####( ###### #####. ###### ##### ###### ##### ###### + * ###### ###### #####( ###### #####. ###### ##### ##### ##### ###### + * ###### ###### #####( ###### #####. ###### ##### ##### ###### + * ############# ############# ############# ############# ##### ###### + * ############ ############ ############# ############ ##### ###### + * ###### + * ############# + * ############ + * + * Adyen Java API Library + * + * Copyright (c) 2021 Adyen B.V. + * This file is open source and available under the MIT license. + * See the LICENSE file for more info. + */ +package com.adyen.model.checkout; + +import java.util.Objects; + +import com.fasterxml.jackson.annotation.JsonValue; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import com.adyen.model.Amount; +import com.adyen.model.Split; + +/** + * PaymentCaptureResource + */ +public class PaymentCaptureResource { + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + @SerializedName(SERIALIZED_NAME_AMOUNT) + private Amount amount; + + public static final String SERIALIZED_NAME_MERCHANT_ACCOUNT = "merchantAccount"; + @SerializedName(SERIALIZED_NAME_MERCHANT_ACCOUNT) + private String merchantAccount; + + public static final String SERIALIZED_NAME_PAYMENT_PSP_REFERENCE = "paymentPspReference"; + @SerializedName(SERIALIZED_NAME_PAYMENT_PSP_REFERENCE) + private String paymentPspReference; + + public static final String SERIALIZED_NAME_PSP_REFERENCE = "pspReference"; + @SerializedName(SERIALIZED_NAME_PSP_REFERENCE) + private String pspReference; + + public static final String SERIALIZED_NAME_REFERENCE = "reference"; + @SerializedName(SERIALIZED_NAME_REFERENCE) + private String reference; + + public static final String SERIALIZED_NAME_SPLITS = "splits"; + @SerializedName(SERIALIZED_NAME_SPLITS) + private List splits = null; + + /** + * The status of your request. This will always have the value **received**. + */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + RECEIVED("received"); + + @JsonValue + private String value; + + StatusEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final StatusEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public StatusEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return StatusEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + private StatusEnum status; + + + public PaymentCaptureResource amount(Amount amount) { + + this.amount = amount; + return this; + } + + /** + * Get amount + * @return amount + **/ + public Amount getAmount() { + return amount; + } + + + public void setAmount(Amount amount) { + this.amount = amount; + } + + + public PaymentCaptureResource merchantAccount(String merchantAccount) { + + this.merchantAccount = merchantAccount; + return this; + } + + /** + * The merchant account that is used to process the payment. + * @return merchantAccount + **/ + public String getMerchantAccount() { + return merchantAccount; + } + + + public void setMerchantAccount(String merchantAccount) { + this.merchantAccount = merchantAccount; + } + + + public PaymentCaptureResource paymentPspReference(String paymentPspReference) { + + this.paymentPspReference = paymentPspReference; + return this; + } + + /** + * The [`pspReference`](https://docs.adyen.com/api-explorer/#/CheckoutService/latest/post/payments__resParam_pspReference) of the payment to capture. + * @return paymentPspReference + **/ + public String getPaymentPspReference() { + return paymentPspReference; + } + + + public void setPaymentPspReference(String paymentPspReference) { + this.paymentPspReference = paymentPspReference; + } + + + public PaymentCaptureResource pspReference(String pspReference) { + + this.pspReference = pspReference; + return this; + } + + /** + * Adyen's 16-character reference associated with the capture request. + * @return pspReference + **/ + public String getPspReference() { + return pspReference; + } + + + public void setPspReference(String pspReference) { + this.pspReference = pspReference; + } + + + public PaymentCaptureResource reference(String reference) { + + this.reference = reference; + return this; + } + + /** + * Your reference for the capture request. + * @return reference + **/ + public String getReference() { + return reference; + } + + + public void setReference(String reference) { + this.reference = reference; + } + + + public PaymentCaptureResource splits(List splits) { + + this.splits = splits; + return this; + } + + public PaymentCaptureResource addSplitsItem(Split splitsItem) { + if (this.splits == null) { + this.splits = new ArrayList(); + } + this.splits.add(splitsItem); + return this; + } + + /** + * An array of objects specifying how the amount should be split between accounts when using Adyen for Platforms. For details, refer to [Providing split information](https://docs.adyen.com/platforms/processing-payments#providing-split-information). + * @return splits + **/ + public List getSplits() { + return splits; + } + + + public void setSplits(List splits) { + this.splits = splits; + } + + + public PaymentCaptureResource status(StatusEnum status) { + + this.status = status; + return this; + } + + /** + * The status of your request. This will always have the value **received**. + * @return status + **/ + public StatusEnum getStatus() { + return status; + } + + + public void setStatus(StatusEnum status) { + this.status = status; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PaymentCaptureResource paymentCaptureResource = (PaymentCaptureResource) o; + return Objects.equals(this.amount, paymentCaptureResource.amount) && + Objects.equals(this.merchantAccount, paymentCaptureResource.merchantAccount) && + Objects.equals(this.paymentPspReference, paymentCaptureResource.paymentPspReference) && + Objects.equals(this.pspReference, paymentCaptureResource.pspReference) && + Objects.equals(this.reference, paymentCaptureResource.reference) && + Objects.equals(this.splits, paymentCaptureResource.splits) && + Objects.equals(this.status, paymentCaptureResource.status); + } + + @Override + public int hashCode() { + return Objects.hash(amount, merchantAccount, paymentPspReference, pspReference, reference, splits, status); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PaymentCaptureResource {\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" merchantAccount: ").append(toIndentedString(merchantAccount)).append("\n"); + sb.append(" paymentPspReference: ").append(toIndentedString(paymentPspReference)).append("\n"); + sb.append(" pspReference: ").append(toIndentedString(pspReference)).append("\n"); + sb.append(" reference: ").append(toIndentedString(reference)).append("\n"); + sb.append(" splits: ").append(toIndentedString(splits)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).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 "); + } + +} + diff --git a/src/main/java/com/adyen/model/checkout/PaymentRefundResource.java b/src/main/java/com/adyen/model/checkout/PaymentRefundResource.java new file mode 100644 index 000000000..ed12670c0 --- /dev/null +++ b/src/main/java/com/adyen/model/checkout/PaymentRefundResource.java @@ -0,0 +1,314 @@ +/* + * ###### + * ###### + * ############ ####( ###### #####. ###### ############ ############ + * ############# #####( ###### #####. ###### ############# ############# + * ###### #####( ###### #####. ###### ##### ###### ##### ###### + * ###### ###### #####( ###### #####. ###### ##### ##### ##### ###### + * ###### ###### #####( ###### #####. ###### ##### ##### ###### + * ############# ############# ############# ############# ##### ###### + * ############ ############ ############# ############ ##### ###### + * ###### + * ############# + * ############ + * + * Adyen Java API Library + * + * Copyright (c) 2021 Adyen B.V. + * This file is open source and available under the MIT license. + * See the LICENSE file for more info. + */ +package com.adyen.model.checkout; + +import java.util.Objects; + +import com.fasterxml.jackson.annotation.JsonValue; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import com.adyen.model.Amount; +import com.adyen.model.Split; + +/** + * PaymentRefundResource + */ +public class PaymentRefundResource { + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + @SerializedName(SERIALIZED_NAME_AMOUNT) + private Amount amount; + + public static final String SERIALIZED_NAME_MERCHANT_ACCOUNT = "merchantAccount"; + @SerializedName(SERIALIZED_NAME_MERCHANT_ACCOUNT) + private String merchantAccount; + + public static final String SERIALIZED_NAME_PAYMENT_PSP_REFERENCE = "paymentPspReference"; + @SerializedName(SERIALIZED_NAME_PAYMENT_PSP_REFERENCE) + private String paymentPspReference; + + public static final String SERIALIZED_NAME_PSP_REFERENCE = "pspReference"; + @SerializedName(SERIALIZED_NAME_PSP_REFERENCE) + private String pspReference; + + public static final String SERIALIZED_NAME_REFERENCE = "reference"; + @SerializedName(SERIALIZED_NAME_REFERENCE) + private String reference; + + public static final String SERIALIZED_NAME_SPLITS = "splits"; + @SerializedName(SERIALIZED_NAME_SPLITS) + private List splits = null; + + /** + * The status of your request. This will always have the value **received**. + */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + RECEIVED("received"); + + @JsonValue + private String value; + + StatusEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final StatusEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public StatusEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return StatusEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + private StatusEnum status; + + + public PaymentRefundResource amount(Amount amount) { + + this.amount = amount; + return this; + } + + /** + * Get amount + * @return amount + **/ + public Amount getAmount() { + return amount; + } + + + public void setAmount(Amount amount) { + this.amount = amount; + } + + + public PaymentRefundResource merchantAccount(String merchantAccount) { + + this.merchantAccount = merchantAccount; + return this; + } + + /** + * The merchant account that is used to process the payment. + * @return merchantAccount + **/ + public String getMerchantAccount() { + return merchantAccount; + } + + + public void setMerchantAccount(String merchantAccount) { + this.merchantAccount = merchantAccount; + } + + + public PaymentRefundResource paymentPspReference(String paymentPspReference) { + + this.paymentPspReference = paymentPspReference; + return this; + } + + /** + * The [`pspReference`](https://docs.adyen.com/api-explorer/#/CheckoutService/latest/post/payments__resParam_pspReference) of the payment to refund. + * @return paymentPspReference + **/ + public String getPaymentPspReference() { + return paymentPspReference; + } + + + public void setPaymentPspReference(String paymentPspReference) { + this.paymentPspReference = paymentPspReference; + } + + + public PaymentRefundResource pspReference(String pspReference) { + + this.pspReference = pspReference; + return this; + } + + /** + * Adyen's 16-character reference associated with the refund request. + * @return pspReference + **/ + public String getPspReference() { + return pspReference; + } + + + public void setPspReference(String pspReference) { + this.pspReference = pspReference; + } + + + public PaymentRefundResource reference(String reference) { + + this.reference = reference; + return this; + } + + /** + * Your reference for the refund request. + * @return reference + **/ + public String getReference() { + return reference; + } + + + public void setReference(String reference) { + this.reference = reference; + } + + + public PaymentRefundResource splits(List splits) { + + this.splits = splits; + return this; + } + + public PaymentRefundResource addSplitsItem(Split splitsItem) { + if (this.splits == null) { + this.splits = new ArrayList(); + } + this.splits.add(splitsItem); + return this; + } + + /** + * An array of objects specifying how the amount should be split between accounts when using Adyen for Platforms. For details, refer to [Providing split information](https://docs.adyen.com/platforms/processing-payments#providing-split-information). + * @return splits + **/ + public List getSplits() { + return splits; + } + + + public void setSplits(List splits) { + this.splits = splits; + } + + + public PaymentRefundResource status(StatusEnum status) { + + this.status = status; + return this; + } + + /** + * The status of your request. This will always have the value **received**. + * @return status + **/ + public StatusEnum getStatus() { + return status; + } + + + public void setStatus(StatusEnum status) { + this.status = status; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PaymentRefundResource paymentRefundResource = (PaymentRefundResource) o; + return Objects.equals(this.amount, paymentRefundResource.amount) && + Objects.equals(this.merchantAccount, paymentRefundResource.merchantAccount) && + Objects.equals(this.paymentPspReference, paymentRefundResource.paymentPspReference) && + Objects.equals(this.pspReference, paymentRefundResource.pspReference) && + Objects.equals(this.reference, paymentRefundResource.reference) && + Objects.equals(this.splits, paymentRefundResource.splits) && + Objects.equals(this.status, paymentRefundResource.status); + } + + @Override + public int hashCode() { + return Objects.hash(amount, merchantAccount, paymentPspReference, pspReference, reference, splits, status); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PaymentRefundResource {\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" merchantAccount: ").append(toIndentedString(merchantAccount)).append("\n"); + sb.append(" paymentPspReference: ").append(toIndentedString(paymentPspReference)).append("\n"); + sb.append(" pspReference: ").append(toIndentedString(pspReference)).append("\n"); + sb.append(" reference: ").append(toIndentedString(reference)).append("\n"); + sb.append(" splits: ").append(toIndentedString(splits)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).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 "); + } + +} + diff --git a/src/main/java/com/adyen/model/checkout/PaymentReversalResource.java b/src/main/java/com/adyen/model/checkout/PaymentReversalResource.java new file mode 100644 index 000000000..e34847770 --- /dev/null +++ b/src/main/java/com/adyen/model/checkout/PaymentReversalResource.java @@ -0,0 +1,250 @@ +/* + * ###### + * ###### + * ############ ####( ###### #####. ###### ############ ############ + * ############# #####( ###### #####. ###### ############# ############# + * ###### #####( ###### #####. ###### ##### ###### ##### ###### + * ###### ###### #####( ###### #####. ###### ##### ##### ##### ###### + * ###### ###### #####( ###### #####. ###### ##### ##### ###### + * ############# ############# ############# ############# ##### ###### + * ############ ############ ############# ############ ##### ###### + * ###### + * ############# + * ############ + * + * Adyen Java API Library + * + * Copyright (c) 2021 Adyen B.V. + * This file is open source and available under the MIT license. + * See the LICENSE file for more info. + */ +package com.adyen.model.checkout; + +import java.util.Objects; + +import com.fasterxml.jackson.annotation.JsonValue; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +/** + * PaymentReversalResource + */ +public class PaymentReversalResource { + public static final String SERIALIZED_NAME_MERCHANT_ACCOUNT = "merchantAccount"; + @SerializedName(SERIALIZED_NAME_MERCHANT_ACCOUNT) + private String merchantAccount; + + public static final String SERIALIZED_NAME_PAYMENT_PSP_REFERENCE = "paymentPspReference"; + @SerializedName(SERIALIZED_NAME_PAYMENT_PSP_REFERENCE) + private String paymentPspReference; + + public static final String SERIALIZED_NAME_PSP_REFERENCE = "pspReference"; + @SerializedName(SERIALIZED_NAME_PSP_REFERENCE) + private String pspReference; + + public static final String SERIALIZED_NAME_REFERENCE = "reference"; + @SerializedName(SERIALIZED_NAME_REFERENCE) + private String reference; + + /** + * The status of your request. This will always have the value **received**. + */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + RECEIVED("received"); + + @JsonValue + private String value; + + StatusEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final StatusEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public StatusEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return StatusEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + private StatusEnum status; + + + public PaymentReversalResource merchantAccount(String merchantAccount) { + + this.merchantAccount = merchantAccount; + return this; + } + + /** + * The merchant account that is used to process the payment. + * @return merchantAccount + **/ + public String getMerchantAccount() { + return merchantAccount; + } + + + public void setMerchantAccount(String merchantAccount) { + this.merchantAccount = merchantAccount; + } + + + public PaymentReversalResource paymentPspReference(String paymentPspReference) { + + this.paymentPspReference = paymentPspReference; + return this; + } + + /** + * The [`pspReference`](https://docs.adyen.com/api-explorer/#/CheckoutService/latest/post/payments__resParam_pspReference) of the payment to reverse. + * @return paymentPspReference + **/ + public String getPaymentPspReference() { + return paymentPspReference; + } + + + public void setPaymentPspReference(String paymentPspReference) { + this.paymentPspReference = paymentPspReference; + } + + + public PaymentReversalResource pspReference(String pspReference) { + + this.pspReference = pspReference; + return this; + } + + /** + * Adyen's 16-character reference associated with the reversal request. + * @return pspReference + **/ + public String getPspReference() { + return pspReference; + } + + + public void setPspReference(String pspReference) { + this.pspReference = pspReference; + } + + + public PaymentReversalResource reference(String reference) { + + this.reference = reference; + return this; + } + + /** + * Your reference for the reversal request. + * @return reference + **/ + public String getReference() { + return reference; + } + + + public void setReference(String reference) { + this.reference = reference; + } + + + public PaymentReversalResource status(StatusEnum status) { + + this.status = status; + return this; + } + + /** + * The status of your request. This will always have the value **received**. + * @return status + **/ + public StatusEnum getStatus() { + return status; + } + + + public void setStatus(StatusEnum status) { + this.status = status; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PaymentReversalResource paymentReversalResource = (PaymentReversalResource) o; + return Objects.equals(this.merchantAccount, paymentReversalResource.merchantAccount) && + Objects.equals(this.paymentPspReference, paymentReversalResource.paymentPspReference) && + Objects.equals(this.pspReference, paymentReversalResource.pspReference) && + Objects.equals(this.reference, paymentReversalResource.reference) && + Objects.equals(this.status, paymentReversalResource.status); + } + + @Override + public int hashCode() { + return Objects.hash(merchantAccount, paymentPspReference, pspReference, reference, status); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PaymentReversalResource {\n"); + sb.append(" merchantAccount: ").append(toIndentedString(merchantAccount)).append("\n"); + sb.append(" paymentPspReference: ").append(toIndentedString(paymentPspReference)).append("\n"); + sb.append(" pspReference: ").append(toIndentedString(pspReference)).append("\n"); + sb.append(" reference: ").append(toIndentedString(reference)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).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 "); + } + +} + diff --git a/src/main/java/com/adyen/model/checkout/StandalonePaymentCancelResource.java b/src/main/java/com/adyen/model/checkout/StandalonePaymentCancelResource.java new file mode 100644 index 000000000..fcd65e637 --- /dev/null +++ b/src/main/java/com/adyen/model/checkout/StandalonePaymentCancelResource.java @@ -0,0 +1,250 @@ +/* + * ###### + * ###### + * ############ ####( ###### #####. ###### ############ ############ + * ############# #####( ###### #####. ###### ############# ############# + * ###### #####( ###### #####. ###### ##### ###### ##### ###### + * ###### ###### #####( ###### #####. ###### ##### ##### ##### ###### + * ###### ###### #####( ###### #####. ###### ##### ##### ###### + * ############# ############# ############# ############# ##### ###### + * ############ ############ ############# ############ ##### ###### + * ###### + * ############# + * ############ + * + * Adyen Java API Library + * + * Copyright (c) 2021 Adyen B.V. + * This file is open source and available under the MIT license. + * See the LICENSE file for more info. + */ +package com.adyen.model.checkout; + +import java.util.Objects; + +import com.fasterxml.jackson.annotation.JsonValue; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +/** + * StandalonePaymentCancelResource + */ +public class StandalonePaymentCancelResource { + public static final String SERIALIZED_NAME_MERCHANT_ACCOUNT = "merchantAccount"; + @SerializedName(SERIALIZED_NAME_MERCHANT_ACCOUNT) + private String merchantAccount; + + public static final String SERIALIZED_NAME_PAYMENT_REFERENCE = "paymentReference"; + @SerializedName(SERIALIZED_NAME_PAYMENT_REFERENCE) + private String paymentReference; + + public static final String SERIALIZED_NAME_PSP_REFERENCE = "pspReference"; + @SerializedName(SERIALIZED_NAME_PSP_REFERENCE) + private String pspReference; + + public static final String SERIALIZED_NAME_REFERENCE = "reference"; + @SerializedName(SERIALIZED_NAME_REFERENCE) + private String reference; + + /** + * The status of your request. This will always have the value **received**. + */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + RECEIVED("received"); + + @JsonValue + private String value; + + StatusEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final StatusEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public StatusEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return StatusEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + private StatusEnum status; + + + public StandalonePaymentCancelResource merchantAccount(String merchantAccount) { + + this.merchantAccount = merchantAccount; + return this; + } + + /** + * The merchant account that is used to process the payment. + * @return merchantAccount + **/ + public String getMerchantAccount() { + return merchantAccount; + } + + + public void setMerchantAccount(String merchantAccount) { + this.merchantAccount = merchantAccount; + } + + + public StandalonePaymentCancelResource paymentReference(String paymentReference) { + + this.paymentReference = paymentReference; + return this; + } + + /** + * The [`reference`](https://docs.adyen.com/api-explorer/#/CheckoutService/latest/post/payments__reqParam_reference) of the payment to cancel. + * @return paymentReference + **/ + public String getPaymentReference() { + return paymentReference; + } + + + public void setPaymentReference(String paymentReference) { + this.paymentReference = paymentReference; + } + + + public StandalonePaymentCancelResource pspReference(String pspReference) { + + this.pspReference = pspReference; + return this; + } + + /** + * Adyen's 16-character reference associated with the cancel request. + * @return pspReference + **/ + public String getPspReference() { + return pspReference; + } + + + public void setPspReference(String pspReference) { + this.pspReference = pspReference; + } + + + public StandalonePaymentCancelResource reference(String reference) { + + this.reference = reference; + return this; + } + + /** + * Your reference for the cancel request. + * @return reference + **/ + public String getReference() { + return reference; + } + + + public void setReference(String reference) { + this.reference = reference; + } + + + public StandalonePaymentCancelResource status(StatusEnum status) { + + this.status = status; + return this; + } + + /** + * The status of your request. This will always have the value **received**. + * @return status + **/ + public StatusEnum getStatus() { + return status; + } + + + public void setStatus(StatusEnum status) { + this.status = status; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + StandalonePaymentCancelResource standalonePaymentCancelResource = (StandalonePaymentCancelResource) o; + return Objects.equals(this.merchantAccount, standalonePaymentCancelResource.merchantAccount) && + Objects.equals(this.paymentReference, standalonePaymentCancelResource.paymentReference) && + Objects.equals(this.pspReference, standalonePaymentCancelResource.pspReference) && + Objects.equals(this.reference, standalonePaymentCancelResource.reference) && + Objects.equals(this.status, standalonePaymentCancelResource.status); + } + + @Override + public int hashCode() { + return Objects.hash(merchantAccount, paymentReference, pspReference, reference, status); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class StandalonePaymentCancelResource {\n"); + sb.append(" merchantAccount: ").append(toIndentedString(merchantAccount)).append("\n"); + sb.append(" paymentReference: ").append(toIndentedString(paymentReference)).append("\n"); + sb.append(" pspReference: ").append(toIndentedString(pspReference)).append("\n"); + sb.append(" reference: ").append(toIndentedString(reference)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).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 "); + } + +} + diff --git a/src/main/java/com/adyen/service/Checkout.java b/src/main/java/com/adyen/service/Checkout.java index 26e9008f8..86b9fc001 100644 --- a/src/main/java/com/adyen/service/Checkout.java +++ b/src/main/java/com/adyen/service/Checkout.java @@ -24,6 +24,7 @@ import com.adyen.ApiKeyAuthenticatedService; import com.adyen.Client; import com.adyen.model.RequestOptions; +import com.adyen.service.exception.ApiException; import com.adyen.model.checkout.CheckoutCancelOrderRequest; import com.adyen.model.checkout.CheckoutCancelOrderResponse; import com.adyen.model.checkout.CheckoutCreateOrderRequest; @@ -42,7 +43,18 @@ import com.adyen.model.checkout.PaymentsRequest; import com.adyen.model.checkout.PaymentsResponse; import com.adyen.model.checkout.StoredPaymentMethodResource; -import com.adyen.service.exception.ApiException; +import com.adyen.model.checkout.CreatePaymentCaptureRequest; +import com.adyen.model.checkout.PaymentCaptureResource; +import com.adyen.model.checkout.CreatePaymentCancelRequest; +import com.adyen.model.checkout.PaymentCancelResource; +import com.adyen.model.checkout.PaymentReversalResource; +import com.adyen.model.checkout.CreatePaymentReversalRequest; +import com.adyen.model.checkout.PaymentRefundResource; +import com.adyen.model.checkout.CreatePaymentRefundRequest; +import com.adyen.model.checkout.CreateStandalonePaymentCancelRequest; +import com.adyen.model.checkout.StandalonePaymentCancelResource; +import com.adyen.model.checkout.PaymentAmountUpdateResource; +import com.adyen.model.checkout.CreatePaymentAmountUpdateRequest; import com.adyen.service.resource.checkout.Orders; import com.adyen.service.resource.checkout.OrdersCancel; import com.adyen.service.resource.checkout.PaymentMethods; @@ -53,11 +65,18 @@ import com.adyen.service.resource.checkout.Sessions; import com.adyen.service.resource.checkout.StoredPaymentsMethods; import com.google.gson.reflect.TypeToken; +import com.adyen.service.resource.checkout.Cancels; +import com.adyen.service.resource.checkout.PaymentsRefunds; +import com.adyen.service.resource.checkout.PaymentsCancels; +import com.adyen.service.resource.checkout.PaymentsAmountUpdates; +import com.adyen.service.resource.checkout.PaymentsReversals; +import com.adyen.service.resource.checkout.PaymentsCaptures; import java.io.IOException; public class Checkout extends ApiKeyAuthenticatedService { + private Cancels cancels; private Payments payments; private PaymentMethods paymentMethods; private PaymentsDetails paymentsDetails; @@ -71,6 +90,7 @@ public class Checkout extends ApiKeyAuthenticatedService { public Checkout(Client client) { super(client); + cancels = new Cancels(this); payments = new Payments(this); paymentMethods = new PaymentMethods(this); paymentsDetails = new PaymentsDetails(this); @@ -223,6 +243,7 @@ public CheckoutCancelOrderResponse ordersCancel(CheckoutCancelOrderRequest check * POST /sessions API call * * @param createCheckoutSessionRequest CreateCheckoutSessionRequest + * @return * @throws ApiException * @throws IOException @@ -233,4 +254,101 @@ public CreateCheckoutSessionResponse sessions(CreateCheckoutSessionRequest creat return GSON.fromJson(jsonResult, new TypeToken() { }.getType()); } + + /** + * POST /payments/{paymentPspReference}/captures + * + * @param paymentPspReference String + * @param createPaymentCaptureRequest CreatePaymentCaptureRequest + */ + public PaymentCaptureResource paymentsCaptures(String paymentPspReference, CreatePaymentCaptureRequest createPaymentCaptureRequest) throws ApiException, IOException { + PaymentsCaptures paymentsCaptures = new PaymentsCaptures(this, paymentPspReference); + String jsonRequest = GSON.toJson(createPaymentCaptureRequest); + String jsonResult = paymentsCaptures.request(jsonRequest); + return GSON.fromJson(jsonResult, new TypeToken() { + }.getType()); + } + + /** + * POST /payments/{paymentPspReference}/cancels + * + * @param paymentPspReference String + * @param createPaymentCancelRequest CreatePaymentCancelRequest + * @return + * @throws ApiException + * @throws IOException + */ + public PaymentCancelResource paymentsCancels(String paymentPspReference, CreatePaymentCancelRequest createPaymentCancelRequest) throws ApiException, IOException { + PaymentsCancels paymentsCancels = new PaymentsCancels(this, paymentPspReference); + String jsonRequest = GSON.toJson(createPaymentCancelRequest); + String jsonResult = paymentsCancels.request(jsonRequest); + return GSON.fromJson(jsonResult, new TypeToken() { + }.getType()); + } + + /** + * POST /cancels + * + * @param createStandalonePaymentCancelRequest CreateStandalonePaymentCancelRequest + * @return + * @throws ApiException + * @throws IOException + */ + public StandalonePaymentCancelResource cancels(CreateStandalonePaymentCancelRequest createStandalonePaymentCancelRequest) throws ApiException, IOException { + String jsonRequest = GSON.toJson(createStandalonePaymentCancelRequest); + String jsonResult = cancels.request(jsonRequest); + return GSON.fromJson(jsonResult, new TypeToken() { + }.getType()); + } + + /** + * POST /payments/{paymentPspReference}/reversal + * + * @param paymentPspReference String + * @param createPaymentReversalRequest CreatePaymentReversalRequest + * @return + * @throws ApiException + * @throws IOException + */ + public PaymentReversalResource paymentsReversals(String paymentPspReference, CreatePaymentReversalRequest createPaymentReversalRequest) throws ApiException, IOException { + PaymentsReversals paymentReversal = new PaymentsReversals(this, paymentPspReference); + String jsonRequest = GSON.toJson(createPaymentReversalRequest); + String jsonResult = paymentReversal.request(jsonRequest); + return GSON.fromJson(jsonResult, new TypeToken() { + }.getType()); + } + + /** + * POST /payments/{paymentPspReference}/refunds + * + * @param paymentPspReference String + * @param createPaymentRefundRequest CreatePaymentRefundRequest + * @return + * @throws ApiException + * @throws IOException + */ + public PaymentRefundResource paymentsRefunds(String paymentPspReference, CreatePaymentRefundRequest createPaymentRefundRequest) throws ApiException, IOException { + PaymentsRefunds paymentsRefunds = new PaymentsRefunds(this, paymentPspReference); + String jsonRequest = GSON.toJson(createPaymentRefundRequest); + String jsonResult = paymentsRefunds.request(jsonRequest); + return GSON.fromJson(jsonResult, new TypeToken() { + }.getType()); + } + + /** + * POST /payments/{paymentPspReference}/amountUpdates + * + * @param paymentPspReference String + * @param createPaymentAmountUpdateRequest CreatePaymentAmountUpdateRequest + * @return + * @throws ApiException + * @throws IOException + */ + public PaymentAmountUpdateResource paymentsAmountUpdates(String paymentPspReference, CreatePaymentAmountUpdateRequest createPaymentAmountUpdateRequest) throws ApiException, IOException { + PaymentsAmountUpdates paymentsAmountUpdates = new PaymentsAmountUpdates(this, paymentPspReference); + String jsonRequest = GSON.toJson(createPaymentAmountUpdateRequest); + String jsonResult = paymentsAmountUpdates.request(jsonRequest); + return GSON.fromJson(jsonResult, new TypeToken() { + }.getType()); + } } diff --git a/src/main/java/com/adyen/service/resource/checkout/Cancels.java b/src/main/java/com/adyen/service/resource/checkout/Cancels.java new file mode 100644 index 000000000..3883f234e --- /dev/null +++ b/src/main/java/com/adyen/service/resource/checkout/Cancels.java @@ -0,0 +1,36 @@ +/* + * ###### + * ###### + * ############ ####( ###### #####. ###### ############ ############ + * ############# #####( ###### #####. ###### ############# ############# + * ###### #####( ###### #####. ###### ##### ###### ##### ###### + * ###### ###### #####( ###### #####. ###### ##### ##### ##### ###### + * ###### ###### #####( ###### #####. ###### ##### ##### ###### + * ############# ############# ############# ############# ##### ###### + * ############ ############ ############# ############ ##### ###### + * ###### + * ############# + * ############ + * + * Adyen Java API Library + * + * Copyright (c) 2021 Adyen B.V. + * This file is open source and available under the MIT license. + * See the LICENSE file for more info. + */ + +package com.adyen.service.resource.checkout; + +import com.adyen.Client; +import com.adyen.Service; +import com.adyen.service.Resource; + +import java.util.Arrays; + +public class Cancels extends Resource { + + public Cancels(Service service) { + super(service, service.getClient().getConfig().getCheckoutEndpoint() + "/" + Client.CHECKOUT_API_VERSION + + "/cancels", Arrays.asList("merchantAccount", "paymentReference")); + } +} diff --git a/src/main/java/com/adyen/service/resource/checkout/PaymentsAmountUpdates.java b/src/main/java/com/adyen/service/resource/checkout/PaymentsAmountUpdates.java new file mode 100644 index 000000000..2feb310b6 --- /dev/null +++ b/src/main/java/com/adyen/service/resource/checkout/PaymentsAmountUpdates.java @@ -0,0 +1,36 @@ +/* + * ###### + * ###### + * ############ ####( ###### #####. ###### ############ ############ + * ############# #####( ###### #####. ###### ############# ############# + * ###### #####( ###### #####. ###### ##### ###### ##### ###### + * ###### ###### #####( ###### #####. ###### ##### ##### ##### ###### + * ###### ###### #####( ###### #####. ###### ##### ##### ###### + * ############# ############# ############# ############# ##### ###### + * ############ ############ ############# ############ ##### ###### + * ###### + * ############# + * ############ + * + * Adyen Java API Library + * + * Copyright (c) 2021 Adyen B.V. + * This file is open source and available under the MIT license. + * See the LICENSE file for more info. + */ + +package com.adyen.service.resource.checkout; + +import com.adyen.Client; +import com.adyen.Service; +import com.adyen.service.Resource; + +import java.util.Arrays; + +public class PaymentsAmountUpdates extends Resource { + + public PaymentsAmountUpdates(Service service, String paymentPspReference) { + super(service, service.getClient().getConfig().getCheckoutEndpoint() + "/" + Client.CHECKOUT_API_VERSION + + "/payments/" + paymentPspReference + "/amountUpdates", Arrays.asList("amount", "merchantAccount")); + } +} diff --git a/src/main/java/com/adyen/service/resource/checkout/PaymentsCancels.java b/src/main/java/com/adyen/service/resource/checkout/PaymentsCancels.java new file mode 100644 index 000000000..57204d44f --- /dev/null +++ b/src/main/java/com/adyen/service/resource/checkout/PaymentsCancels.java @@ -0,0 +1,36 @@ +/* + * ###### + * ###### + * ############ ####( ###### #####. ###### ############ ############ + * ############# #####( ###### #####. ###### ############# ############# + * ###### #####( ###### #####. ###### ##### ###### ##### ###### + * ###### ###### #####( ###### #####. ###### ##### ##### ##### ###### + * ###### ###### #####( ###### #####. ###### ##### ##### ###### + * ############# ############# ############# ############# ##### ###### + * ############ ############ ############# ############ ##### ###### + * ###### + * ############# + * ############ + * + * Adyen Java API Library + * + * Copyright (c) 2021 Adyen B.V. + * This file is open source and available under the MIT license. + * See the LICENSE file for more info. + */ + +package com.adyen.service.resource.checkout; + +import com.adyen.Client; +import com.adyen.Service; +import com.adyen.service.Resource; + +import java.util.Arrays; + +public class PaymentsCancels extends Resource { + + public PaymentsCancels(Service service, String paymentPspReference) { + super(service, service.getClient().getConfig().getCheckoutEndpoint() + "/" + Client.CHECKOUT_API_VERSION + + "/payments/" + paymentPspReference + "/cancels", Arrays.asList("merchantAccount")); + } +} diff --git a/src/main/java/com/adyen/service/resource/checkout/PaymentsCaptures.java b/src/main/java/com/adyen/service/resource/checkout/PaymentsCaptures.java new file mode 100644 index 000000000..1ce6bf704 --- /dev/null +++ b/src/main/java/com/adyen/service/resource/checkout/PaymentsCaptures.java @@ -0,0 +1,36 @@ +/* + * ###### + * ###### + * ############ ####( ###### #####. ###### ############ ############ + * ############# #####( ###### #####. ###### ############# ############# + * ###### #####( ###### #####. ###### ##### ###### ##### ###### + * ###### ###### #####( ###### #####. ###### ##### ##### ##### ###### + * ###### ###### #####( ###### #####. ###### ##### ##### ###### + * ############# ############# ############# ############# ##### ###### + * ############ ############ ############# ############ ##### ###### + * ###### + * ############# + * ############ + * + * Adyen Java API Library + * + * Copyright (c) 2021 Adyen B.V. + * This file is open source and available under the MIT license. + * See the LICENSE file for more info. + */ + +package com.adyen.service.resource.checkout; + +import com.adyen.Client; +import com.adyen.Service; +import com.adyen.service.Resource; + +import java.util.Arrays; + +public class PaymentsCaptures extends Resource { + + public PaymentsCaptures(Service service, String paymentPspReference) { + super(service, service.getClient().getConfig().getCheckoutEndpoint() + "/" + Client.CHECKOUT_API_VERSION + + "/payments/" + paymentPspReference + "/captures", Arrays.asList("amount", "merchantAccount")); + } +} diff --git a/src/main/java/com/adyen/service/resource/checkout/PaymentsRefunds.java b/src/main/java/com/adyen/service/resource/checkout/PaymentsRefunds.java new file mode 100644 index 000000000..088090cc4 --- /dev/null +++ b/src/main/java/com/adyen/service/resource/checkout/PaymentsRefunds.java @@ -0,0 +1,36 @@ +/* + * ###### + * ###### + * ############ ####( ###### #####. ###### ############ ############ + * ############# #####( ###### #####. ###### ############# ############# + * ###### #####( ###### #####. ###### ##### ###### ##### ###### + * ###### ###### #####( ###### #####. ###### ##### ##### ##### ###### + * ###### ###### #####( ###### #####. ###### ##### ##### ###### + * ############# ############# ############# ############# ##### ###### + * ############ ############ ############# ############ ##### ###### + * ###### + * ############# + * ############ + * + * Adyen Java API Library + * + * Copyright (c) 2021 Adyen B.V. + * This file is open source and available under the MIT license. + * See the LICENSE file for more info. + */ + +package com.adyen.service.resource.checkout; + +import com.adyen.Client; +import com.adyen.Service; +import com.adyen.service.Resource; + +import java.util.Arrays; + +public class PaymentsRefunds extends Resource { + + public PaymentsRefunds(Service service, String paymentPspReference) { + super(service, service.getClient().getConfig().getCheckoutEndpoint() + "/" + Client.CHECKOUT_API_VERSION + + "/payments/" + paymentPspReference + "/refunds", Arrays.asList("amount", "merchantAccount")); + } +} diff --git a/src/main/java/com/adyen/service/resource/checkout/PaymentsReversals.java b/src/main/java/com/adyen/service/resource/checkout/PaymentsReversals.java new file mode 100644 index 000000000..b718f169d --- /dev/null +++ b/src/main/java/com/adyen/service/resource/checkout/PaymentsReversals.java @@ -0,0 +1,36 @@ +/* + * ###### + * ###### + * ############ ####( ###### #####. ###### ############ ############ + * ############# #####( ###### #####. ###### ############# ############# + * ###### #####( ###### #####. ###### ##### ###### ##### ###### + * ###### ###### #####( ###### #####. ###### ##### ##### ##### ###### + * ###### ###### #####( ###### #####. ###### ##### ##### ###### + * ############# ############# ############# ############# ##### ###### + * ############ ############ ############# ############ ##### ###### + * ###### + * ############# + * ############ + * + * Adyen Java API Library + * + * Copyright (c) 2021 Adyen B.V. + * This file is open source and available under the MIT license. + * See the LICENSE file for more info. + */ + +package com.adyen.service.resource.checkout; + +import com.adyen.Client; +import com.adyen.Service; +import com.adyen.service.Resource; + +import java.util.Arrays; + +public class PaymentsReversals extends Resource { + + public PaymentsReversals(Service service, String paymentPspReference) { + super(service, service.getClient().getConfig().getCheckoutEndpoint() + "/" + Client.CHECKOUT_API_VERSION + + "/payments/" + paymentPspReference + "/reversals", Arrays.asList("merchantAccount")); + } +} diff --git a/src/test/java/com/adyen/CheckoutTest.java b/src/test/java/com/adyen/CheckoutTest.java index 048c14b67..520a2daac 100644 --- a/src/test/java/com/adyen/CheckoutTest.java +++ b/src/test/java/com/adyen/CheckoutTest.java @@ -51,6 +51,18 @@ import com.adyen.model.checkout.RiskData; import com.adyen.model.checkout.StoredPaymentMethodResource; import com.adyen.model.checkout.StoringMethod; +import com.adyen.model.checkout.CreatePaymentCaptureRequest; +import com.adyen.model.checkout.PaymentCaptureResource; +import com.adyen.model.checkout.CreatePaymentCancelRequest; +import com.adyen.model.checkout.PaymentCancelResource; +import com.adyen.model.checkout.PaymentReversalResource; +import com.adyen.model.checkout.CreatePaymentReversalRequest; +import com.adyen.model.checkout.PaymentRefundResource; +import com.adyen.model.checkout.CreatePaymentRefundRequest; +import com.adyen.model.checkout.CreateStandalonePaymentCancelRequest; +import com.adyen.model.checkout.StandalonePaymentCancelResource; +import com.adyen.model.checkout.PaymentAmountUpdateResource; +import com.adyen.model.checkout.CreatePaymentAmountUpdateRequest; import com.adyen.model.checkout.details.AchDetails; import com.adyen.model.checkout.details.AmazonPayDetails; import com.adyen.model.checkout.details.AndroidPayDetails; @@ -1932,6 +1944,180 @@ public void TestPaymentsResponseIdentifyShopper() throws IOException, ApiExcepti assertEquals("scheme", paymentsResponse.getAction().getPaymentMethodType()); } + /** + * Start modifications endpoints tests + */ + @Test public void TestPaymentsCaptures() throws IOException, ApiException { + Client client = createMockClientFromFile("mocks/checkout/captures-success.json"); + Checkout checkout = new Checkout(client); + CreatePaymentCaptureRequest createPaymentCaptureRequest = new CreatePaymentCaptureRequest(); + createPaymentCaptureRequest.setAmount(createAmountObject("EUR", 1000L)); + createPaymentCaptureRequest.setMerchantAccount("test_merchant_account"); + PaymentCaptureResource paymentCaptureResource = checkout.paymentsCaptures("12321A", createPaymentCaptureRequest); + assertEquals("received", paymentCaptureResource.getStatus().toString()); + assertEquals("my_reference", paymentCaptureResource.getReference()); + } + + @Test public void TestPaymentsCapturesFailed() throws IOException, ApiException { + Client client = createMockClientForErrors(422, "mocks/checkout/modifications-error-422.json"); + try { + Checkout checkout = new Checkout(client); + CreatePaymentCaptureRequest createPaymentCaptureRequest = new CreatePaymentCaptureRequest(); + createPaymentCaptureRequest.setAmount(createAmountObject("EUR", 1000L)); + createPaymentCaptureRequest.setMerchantAccount("test_merchant_account"); + PaymentCaptureResource paymentCaptureResource = checkout.paymentsCaptures("12321A", createPaymentCaptureRequest); + fail("Exception expected"); + } catch (ApiException e) { + assertNotNull(e.getError()); + assertEquals("167", e.getError().getErrorCode()); + assertEquals(422, e.getError().getStatus()); + assertEquals(e.getResponseHeaders().size(), 0); + assertNotNull(e.getResponseHeaders()); + } + } + + @Test public void TestPaymentsCancels() throws IOException, ApiException { + Client client = createMockClientFromFile("mocks/checkout/cancels-success.json"); + Checkout checkout = new Checkout(client); + CreatePaymentCancelRequest createPaymentCancelRequest = new CreatePaymentCancelRequest(); + createPaymentCancelRequest.setMerchantAccount("test_merchant_account"); + PaymentCancelResource paymentCancelResource = checkout.paymentsCancels("12321A", createPaymentCancelRequest); + assertEquals("received", paymentCancelResource.getStatus().toString()); + assertEquals("my_reference", paymentCancelResource.getReference()); + } + + @Test public void TestPaymentsCancelsFailed() throws IOException, ApiException { + try { + Client client = createMockClientForErrors(422, "mocks/checkout/modifications-error-422.json"); + Checkout checkout = new Checkout(client); + CreatePaymentCancelRequest createPaymentCancelRequest = new CreatePaymentCancelRequest(); + createPaymentCancelRequest.setMerchantAccount("test_merchant_account"); + checkout.paymentsCancels("12321A", createPaymentCancelRequest); + fail("Exception expected"); + } catch (ApiException e) { + assertNotNull(e.getError()); + assertEquals("167", e.getError().getErrorCode()); + assertEquals(422, e.getError().getStatus()); + assertEquals(e.getResponseHeaders().size(), 0); + assertNotNull(e.getResponseHeaders()); + } + } + + @Test public void TestCancels() throws IOException, ApiException { + Client client = createMockClientFromFile("mocks/checkout/standalone-cancels-success.json"); + Checkout checkout = new Checkout(client); + CreateStandalonePaymentCancelRequest createStandalonePaymentCancelRequest = new CreateStandalonePaymentCancelRequest(); + createStandalonePaymentCancelRequest.setMerchantAccount("test_merchant_account"); + StandalonePaymentCancelResource standalonePaymentCancelResource = checkout.cancels(createStandalonePaymentCancelRequest); + assertEquals("received", standalonePaymentCancelResource.getStatus().toString()); + assertEquals("861633338418518C", standalonePaymentCancelResource.getPspReference()); + } + @Test public void TestCancelsFailed() throws IOException, ApiException { + try { + Client client = createMockClientForErrors(422, "mocks/checkout/modifications-error-422.json"); + Checkout checkout = new Checkout(client); + CreateStandalonePaymentCancelRequest createStandalonePaymentCancelRequest = new CreateStandalonePaymentCancelRequest(); + createStandalonePaymentCancelRequest.setMerchantAccount("test_merchant_account"); + checkout.cancels(createStandalonePaymentCancelRequest); + fail("Exception expected"); + } catch (ApiException e) { + assertNotNull(e.getError()); + assertEquals("167", e.getError().getErrorCode()); + assertEquals(422, e.getError().getStatus()); + assertEquals(e.getResponseHeaders().size(), 0); + assertNotNull(e.getResponseHeaders()); + } + } + + @Test public void TestPaymentsRefunds() throws IOException, ApiException { + Client client = createMockClientFromFile("mocks/checkout/refunds-success.json"); + Checkout checkout = new Checkout(client); + CreatePaymentRefundRequest createPaymentRefundRequest = new CreatePaymentRefundRequest(); + createPaymentRefundRequest.setAmount(createAmountObject("EUR", 1000L)); + createPaymentRefundRequest.setMerchantAccount("test_merchant_account"); + PaymentRefundResource paymentRefundResource = checkout.paymentsRefunds("12321A", createPaymentRefundRequest); + assertEquals("received", paymentRefundResource.getStatus().toString()); + assertEquals("my_reference", paymentRefundResource.getReference()); + } + + @Test public void TestPaymentsRefundsFailed() throws IOException, ApiException { + try { + Client client = createMockClientForErrors(422, "mocks/checkout/modifications-error-422.json"); + Checkout checkout = new Checkout(client); + CreatePaymentRefundRequest createPaymentRefundRequest = new CreatePaymentRefundRequest(); + createPaymentRefundRequest.setAmount(createAmountObject("EUR", 1000L)); + createPaymentRefundRequest.setMerchantAccount("test_merchant_account"); + checkout.paymentsRefunds("12321A", createPaymentRefundRequest); + fail("Exception expected"); + } catch (ApiException e) { + assertNotNull(e.getError()); + assertEquals("167", e.getError().getErrorCode()); + assertEquals(422, e.getError().getStatus()); + assertEquals(e.getResponseHeaders().size(), 0); + assertNotNull(e.getResponseHeaders()); + } + } + + @Test public void TestPaymentsReversals() throws IOException, ApiException { + Client client = createMockClientFromFile("mocks/checkout/reversals-success.json"); + Checkout checkout = new Checkout(client); + CreatePaymentReversalRequest createPaymentReversalRequest = new CreatePaymentReversalRequest(); + createPaymentReversalRequest.setMerchantAccount("test_merchant_account"); + PaymentReversalResource paymentReversalResource = checkout.paymentsReversals("12321A", createPaymentReversalRequest); + assertEquals("received", paymentReversalResource.getStatus().toString()); + assertEquals("my_reference", paymentReversalResource.getReference()); + } + + @Test public void TestPaymentsReversalsFailed() throws IOException, ApiException { + try { + Client client = createMockClientForErrors(422, "mocks/checkout/modifications-error-422.json"); + Checkout checkout = new Checkout(client); + CreatePaymentReversalRequest createPaymentReversalRequest = new CreatePaymentReversalRequest(); + createPaymentReversalRequest.setMerchantAccount("test_merchant_account"); + checkout.paymentsReversals("12321A", createPaymentReversalRequest); + fail("Exception expected"); + } catch (ApiException e) { + assertNotNull(e.getError()); + assertEquals("167", e.getError().getErrorCode()); + assertEquals(422, e.getError().getStatus()); + assertEquals(e.getResponseHeaders().size(), 0); + assertNotNull(e.getResponseHeaders()); + } + } + + @Test public void TestPaymentsAmountUpdates() throws IOException, ApiException { + Client client = createMockClientFromFile("mocks/checkout/amount-updates-success.json"); + Checkout checkout = new Checkout(client); + CreatePaymentAmountUpdateRequest createPaymentAmountUpdateRequest = new CreatePaymentAmountUpdateRequest(); + createPaymentAmountUpdateRequest.setAmount(createAmountObject("EUR", 1000L)); + createPaymentAmountUpdateRequest.setMerchantAccount("test_merchant_account"); + PaymentAmountUpdateResource paymentAmountUpdateResource = checkout.paymentsAmountUpdates("12321A", createPaymentAmountUpdateRequest); + assertEquals("received", paymentAmountUpdateResource.getStatus().toString()); + assertEquals("my_reference", paymentAmountUpdateResource.getReference()); + } + + @Test public void TestPaymentsAmountUpdatesFailed() throws IOException, ApiException { + try { + Client client = createMockClientForErrors(422, "mocks/checkout/modifications-error-422.json"); + Checkout checkout = new Checkout(client); + CreatePaymentAmountUpdateRequest createPaymentAmountUpdateRequest = new CreatePaymentAmountUpdateRequest(); + createPaymentAmountUpdateRequest.setAmount(createAmountObject("EUR", 1000L)); + createPaymentAmountUpdateRequest.setMerchantAccount("test_merchant_account"); + checkout.paymentsAmountUpdates("12321A", createPaymentAmountUpdateRequest); + fail("Exception expected"); + } catch (ApiException e) { + assertNotNull(e.getError()); + assertEquals("167", e.getError().getErrorCode()); + assertEquals(422, e.getError().getStatus()); + assertEquals(e.getResponseHeaders().size(), 0); + assertNotNull(e.getResponseHeaders()); + } + } + + /** + * end modification endpoints tests + */ + /** * Returns a sample PaymentSessionRequest object with test data */ @@ -2047,7 +2233,7 @@ protected PaymentsDetailsRequest createPaymentsDetailsRequest() { } /** - * Returns a sample Amount opbject with given currency and value + * Returns a sample Amount object with given currency and value */ protected Amount createAmountObject(String currency, Long value) { Amount amount = new Amount(); diff --git a/src/test/resources/mocks/checkout/amount-updates-success.json b/src/test/resources/mocks/checkout/amount-updates-success.json new file mode 100644 index 000000000..a5de36a69 --- /dev/null +++ b/src/test/resources/mocks/checkout/amount-updates-success.json @@ -0,0 +1,11 @@ +{ + "merchantAccount":"test_merchant_account", + "paymentPspReference":"852633330805862B", + "pspReference":"882633337753910C", + "reference":"my_reference", + "status":"received", + "amount":{ + "currency":"EUR", + "value":1000 + } +} \ No newline at end of file diff --git a/src/test/resources/mocks/checkout/cancels-success.json b/src/test/resources/mocks/checkout/cancels-success.json new file mode 100644 index 000000000..a5de36a69 --- /dev/null +++ b/src/test/resources/mocks/checkout/cancels-success.json @@ -0,0 +1,11 @@ +{ + "merchantAccount":"test_merchant_account", + "paymentPspReference":"852633330805862B", + "pspReference":"882633337753910C", + "reference":"my_reference", + "status":"received", + "amount":{ + "currency":"EUR", + "value":1000 + } +} \ No newline at end of file diff --git a/src/test/resources/mocks/checkout/captures-success.json b/src/test/resources/mocks/checkout/captures-success.json new file mode 100644 index 000000000..a5de36a69 --- /dev/null +++ b/src/test/resources/mocks/checkout/captures-success.json @@ -0,0 +1,11 @@ +{ + "merchantAccount":"test_merchant_account", + "paymentPspReference":"852633330805862B", + "pspReference":"882633337753910C", + "reference":"my_reference", + "status":"received", + "amount":{ + "currency":"EUR", + "value":1000 + } +} \ No newline at end of file diff --git a/src/test/resources/mocks/checkout/modifications-error-422.json b/src/test/resources/mocks/checkout/modifications-error-422.json new file mode 100644 index 000000000..325494e0a --- /dev/null +++ b/src/test/resources/mocks/checkout/modifications-error-422.json @@ -0,0 +1,7 @@ +{ + "status": 422, + "errorCode": "167", + "message": "Original pspReference required for this operation", + "errorType": "validation", + "pspReference": "invalid_psp" +} diff --git a/src/test/resources/mocks/checkout/refunds-success.json b/src/test/resources/mocks/checkout/refunds-success.json new file mode 100644 index 000000000..7c4edc336 --- /dev/null +++ b/src/test/resources/mocks/checkout/refunds-success.json @@ -0,0 +1,11 @@ +{ + "merchantAccount": "test_merchant_account", + "paymentPspReference": "852633330805862B", + "pspReference": "862633338502676D", + "reference": "my_reference", + "status": "received", + "amount": { + "currency": "EUR", + "value": 1000 + } +} diff --git a/src/test/resources/mocks/checkout/reversals-success.json b/src/test/resources/mocks/checkout/reversals-success.json new file mode 100644 index 000000000..7c4edc336 --- /dev/null +++ b/src/test/resources/mocks/checkout/reversals-success.json @@ -0,0 +1,11 @@ +{ + "merchantAccount": "test_merchant_account", + "paymentPspReference": "852633330805862B", + "pspReference": "862633338502676D", + "reference": "my_reference", + "status": "received", + "amount": { + "currency": "EUR", + "value": 1000 + } +} diff --git a/src/test/resources/mocks/checkout/standalone-cancels-success.json b/src/test/resources/mocks/checkout/standalone-cancels-success.json new file mode 100644 index 000000000..af4f5830e --- /dev/null +++ b/src/test/resources/mocks/checkout/standalone-cancels-success.json @@ -0,0 +1,7 @@ +{ + "merchantAccount": "test_merchant_account", + "pspReference": "861633338418518C", + "reference": "852633330805862B", + "status": "received", + "paymentReference": "852633330805862B" +} \ No newline at end of file From f6ab407d9965307fc0d12731e2b19ca17445acf9 Mon Sep 17 00:00:00 2001 From: Wouter Boereboom Date: Fri, 15 Oct 2021 10:05:47 +0200 Subject: [PATCH 25/29] updated various types due to breaking changes in checkout v68 --- .../checkout/CreatePaymentLinkRequest.java | 75 +- .../adyen/model/checkout/PaymentMethod.java | 70 +- .../model/checkout/PaymentMethodIssuer.java | 123 +++ .../adyen/model/checkout/PaymentsRequest.java | 23 +- src/test/java/com/adyen/CheckoutTest.java | 11 +- .../com/adyen/service/PaymentLinksTest.java | 3 +- .../checkout/paymentmethods-success.json | 932 +++++++++--------- 7 files changed, 724 insertions(+), 513 deletions(-) create mode 100644 src/main/java/com/adyen/model/checkout/PaymentMethodIssuer.java diff --git a/src/main/java/com/adyen/model/checkout/CreatePaymentLinkRequest.java b/src/main/java/com/adyen/model/checkout/CreatePaymentLinkRequest.java index e98fc6ee0..3fcab6b19 100755 --- a/src/main/java/com/adyen/model/checkout/CreatePaymentLinkRequest.java +++ b/src/main/java/com/adyen/model/checkout/CreatePaymentLinkRequest.java @@ -222,6 +222,55 @@ public RequiredShopperFieldsEnum read(final JsonReader jsonReader) throws IOExce @SerializedName("storePaymentMethod") private Boolean storePaymentMethod = null; + /** + * Indicates if the details of the payment method will be stored for the shopper. Possible values:* **disabled** – No details will be stored.* **askForConsent** – If the `shopperReference` is provided the shopper can decide whether or not the details will be stored.* **enabled** – If the `shopperReference` is provided the details will be stored without asking consent to the shopper. + */ + @JsonAdapter(StorePaymentMethodModeEnum.Adapter.class) + public enum StorePaymentMethodModeEnum { + ASKFORCONSENT("askForConsent"), + DISABLED("disabled"), + ENABLED("enabled"); + + @JsonValue + private String value; + + StorePaymentMethodModeEnum(String value) { + this.value = value; + } + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + public static StorePaymentMethodModeEnum fromValue(String value) { + for (StorePaymentMethodModeEnum b : StorePaymentMethodModeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + return null; + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final StorePaymentMethodModeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public StorePaymentMethodModeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return StorePaymentMethodModeEnum.fromValue(value); + } + } + } + + @SerializedName("storePaymentMethodMode") + private StorePaymentMethodModeEnum storePaymentMethodMode; + public CreatePaymentLinkRequest allowedPaymentMethods(List allowedPaymentMethods) { this.allowedPaymentMethods = allowedPaymentMethods; return this; @@ -754,6 +803,24 @@ public void setStorePaymentMethod(Boolean storePaymentMethod) { this.storePaymentMethod = storePaymentMethod; } + public CreatePaymentLinkRequest storePaymentMethodMode(StorePaymentMethodModeEnum storePaymentMethodMode) { + + this.storePaymentMethodMode = storePaymentMethodMode; + return this; + } + + /** + * Indicates if the details of the payment method will be stored for the shopper. Possible values:* **disabled** – No details will be stored.* **askForConsent** – If the `shopperReference` is provided the shopper can decide whether or not the details will be stored.* **enabled** – If the `shopperReference` is provided the details will be stored without asking consent to the shopper. + * @return storePaymentMethodMode + **/ + public StorePaymentMethodModeEnum getStorePaymentMethodMode() { + return storePaymentMethodMode; + } + + + public void setStorePaymentMethodMode(StorePaymentMethodModeEnum storePaymentMethodMode) { + this.storePaymentMethodMode = storePaymentMethodMode; + } @Override public boolean equals(java.lang.Object o) { @@ -791,12 +858,13 @@ public boolean equals(java.lang.Object o) { Objects.equals(this.shopperReference, createPaymentLinkRequest.shopperReference) && Objects.equals(this.splits, createPaymentLinkRequest.splits) && Objects.equals(this.store, createPaymentLinkRequest.store) && - Objects.equals(this.storePaymentMethod, createPaymentLinkRequest.storePaymentMethod); + Objects.equals(this.storePaymentMethod, createPaymentLinkRequest.storePaymentMethod) && + Objects.equals(this.storePaymentMethodMode, createPaymentLinkRequest.storePaymentMethodMode); } @Override public int hashCode() { - return Objects.hash(allowedPaymentMethods, amount, applicationInfo, billingAddress, blockedPaymentMethods, countryCode, deliverAt, deliveryAddress, description, expiresAt, installmentOptions, lineItems, merchantAccount, merchantOrderReference, metadata, recurringProcessingModel, reference, requiredShopperFields, returnUrl, reusable, riskData, shopperEmail, shopperLocale, shopperName, shopperReference, splits, store, storePaymentMethod); + return Objects.hash(allowedPaymentMethods, amount, applicationInfo, billingAddress, blockedPaymentMethods, countryCode, deliverAt, deliveryAddress, description, expiresAt, installmentOptions, lineItems, merchantAccount, merchantOrderReference, metadata, recurringProcessingModel, reference, requiredShopperFields, returnUrl, reusable, riskData, shopperEmail, shopperLocale, shopperName, shopperReference, splits, store, storePaymentMethod, storePaymentMethodMode); } @@ -832,7 +900,8 @@ public String toString() { " splits: " + toIndentedString(splits) + "\n" + " store: " + toIndentedString(store) + "\n" + " storePaymentMethod: " + toIndentedString(storePaymentMethod) + "\n" + - "}"; + " storePaymentMethodMode: " + toIndentedString(storePaymentMethodMode) + "\n" + + "}"; } /** diff --git a/src/main/java/com/adyen/model/checkout/PaymentMethod.java b/src/main/java/com/adyen/model/checkout/PaymentMethod.java index 790d86e63..bfd48d74f 100755 --- a/src/main/java/com/adyen/model/checkout/PaymentMethod.java +++ b/src/main/java/com/adyen/model/checkout/PaymentMethod.java @@ -53,6 +53,9 @@ public class PaymentMethod { @SerializedName("details") private List details = null; + @SerializedName("issuers") + private List issuers = null; + /** * The funding source of the payment method. */ @@ -105,9 +108,6 @@ public FundingSourceEnum read(final JsonReader jsonReader) throws IOException { @SerializedName("group") private PaymentMethodGroup group = null; - @SerializedName("inputDetails") - private List inputDetails = null; - @SerializedName("name") private String name = null; @@ -252,33 +252,6 @@ public void setGroup(PaymentMethodGroup group) { this.group = group; } - public PaymentMethod inputDetails(List inputDetails) { - this.inputDetails = inputDetails; - return this; - } - - public PaymentMethod addInputDetailsItem(InputDetail inputDetailsItem) { - if (this.inputDetails == null) { - this.inputDetails = new ArrayList(); - } - this.inputDetails.add(inputDetailsItem); - return this; - } - - /** - * All input details to be provided to complete the payment with this payment method. - * - * @return inputDetails - **/ - public List getInputDetails() { - return inputDetails; - } - - public void setInputDetails(List inputDetails) { - this.inputDetails = inputDetails; - } - - public PaymentMethod name(String name) { this.name = name; return this; @@ -308,6 +281,34 @@ public PaymentMethod type(String type) { } + public PaymentMethod issuers(List issuers) { + + this.issuers = issuers; + return this; + } + + public PaymentMethod addIssuersItem(PaymentMethodIssuer issuersItem) { + if (this.issuers == null) { + this.issuers = new ArrayList(); + } + this.issuers.add(issuersItem); + return this; + } + + /** + * A list of issuers for this payment method. + * @return issuers + **/ + public List getIssuers() { + return issuers; + } + + + public void setIssuers(List issuers) { + this.issuers = issuers; + } + + /** * The unique payment method code. * @@ -336,15 +337,15 @@ public boolean equals(Object o) { Objects.equals(this.details, paymentMethod.details) && Objects.equals(this.fundingSource, paymentMethod.fundingSource) && Objects.equals(this.group, paymentMethod.group) && - Objects.equals(this.inputDetails, paymentMethod.inputDetails) && Objects.equals(this.name, paymentMethod.name) && + Objects.equals(this.issuers, paymentMethod.issuers) && Objects.equals(this.type, paymentMethod.type); } @Override public int hashCode() { return Objects.hash(brand, brands, configuration, details, fundingSource, group, - inputDetails, name, type); + name, issuers, type); } @Override @@ -358,13 +359,10 @@ public String toString() { sb.append(" details: ").append(toIndentedString(details)).append("\n"); sb.append(" fundingSource: ").append(toIndentedString(fundingSource)).append("\n"); sb.append(" group: ").append(toIndentedString(group)).append("\n"); - sb.append(" inputDetails: ").append(toIndentedString(inputDetails)).append("\n"); + sb.append(" issuers: ").append(toIndentedString(issuers)).append("\n"); sb.append(" name: ").append(toIndentedString(name)).append("\n"); sb.append(" type: ").append(toIndentedString(type)).append("\n"); sb.append("}"); return sb.toString(); } } - - - diff --git a/src/main/java/com/adyen/model/checkout/PaymentMethodIssuer.java b/src/main/java/com/adyen/model/checkout/PaymentMethodIssuer.java new file mode 100644 index 000000000..23999d052 --- /dev/null +++ b/src/main/java/com/adyen/model/checkout/PaymentMethodIssuer.java @@ -0,0 +1,123 @@ +/* + * Adyen Checkout API + * Adyen Checkout API provides a simple and flexible way to initiate and authorise online payments. You can use the same integration for payments made with cards (including 3D Secure), mobile wallets, and local payment methods (for example, iDEAL and Sofort). This API reference provides information on available endpoints and how to interact with them. To learn more about the API, visit [Checkout documentation](https://docs.adyen.com/online-payments). ## Authentication Each request to the Checkout API must be signed with an API key. For this, obtain an API Key from your Customer Area, as described in [How to get the API key](https://docs.adyen.com/development-resources/api-credentials#generate-api-key). Then set this key to the `X-API-Key` header value, for example: ``` curl -H \"Content-Type: application/json\" \\ -H \"X-API-Key: Your_Checkout_API_key\" \\ ... ``` Note that when going live, you need to generate a new API Key to access the [live endpoints](https://docs.adyen.com/development-resources/live-endpoints). ## Versioning Checkout API supports versioning of its endpoints through a version suffix in the endpoint URL. This suffix has the following format: \"vXX\", where XX is the version number. For example: ``` https://checkout-test.adyen.com/v68/payments ``` + * + * The version of the OpenAPI document: 68 + * Contact: developer-experience@adyen.com + * + * 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 com.google.gson.annotations.SerializedName; +import static com.adyen.util.Util.toIndentedString; + +/** + * PaymentMethodIssuer + */ +public class PaymentMethodIssuer { + @SerializedName("disabled") + private Boolean disabled = false; + + @SerializedName("id") + private String id; + + @SerializedName("name") + private String name; + + + public PaymentMethodIssuer disabled(Boolean disabled) { + + this.disabled = disabled; + return this; + } + + /** + * A boolean value indicating whether this issuer is unavailable. Can be `true` whenever the issuer is offline. + * @return disabled + **/ + public Boolean getDisabled() { + return disabled; + } + + + public void setDisabled(Boolean disabled) { + this.disabled = disabled; + } + + + public PaymentMethodIssuer id(String id) { + + this.id = id; + return this; + } + + /** + * The unique identifier of this issuer, to submit in requests to /payments. + * @return id + **/ + public String getId() { + return id; + } + + + public void setId(String id) { + this.id = id; + } + + + public PaymentMethodIssuer name(String name) { + + this.name = name; + return this; + } + + /** + * A localized name of the issuer. + * @return name + **/ + public String getName() { + return name; + } + + + public void setName(String name) { + this.name = name; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PaymentMethodIssuer paymentMethodIssuer = (PaymentMethodIssuer) o; + return Objects.equals(this.disabled, paymentMethodIssuer.disabled) && + Objects.equals(this.id, paymentMethodIssuer.id) && + Objects.equals(this.name, paymentMethodIssuer.name); + } + + @Override + public int hashCode() { + return Objects.hash(disabled, id, name); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PaymentMethodIssuer {\n"); + sb.append(" disabled: ").append(toIndentedString(disabled)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append("}"); + return sb.toString(); + } +} diff --git a/src/main/java/com/adyen/model/checkout/PaymentsRequest.java b/src/main/java/com/adyen/model/checkout/PaymentsRequest.java index f3379278b..8cfcf4b22 100755 --- a/src/main/java/com/adyen/model/checkout/PaymentsRequest.java +++ b/src/main/java/com/adyen/model/checkout/PaymentsRequest.java @@ -71,6 +71,8 @@ public class PaymentsRequest { private Address billingAddress = null; @SerializedName("captureDelayHours") private Integer captureDelayHours = null; + @SerializedName("checkoutAttemptId") + private String checkoutAttemptId = null; @SerializedName("channel") private ChannelEnum channel = null; @SerializedName("company") @@ -1260,6 +1262,23 @@ public void setConversionId(String conversionId) { this.conversionId = conversionId; } + public PaymentsRequest checkoutAttemptId(String checkoutAttemptId) { + + this.checkoutAttemptId = checkoutAttemptId; + return this; + } + + /** + * Checkout attempt ID that corresponds to the Id generated for tracking user payment journey. + * @return checkoutAttemptId + **/ + public String getCheckoutAttemptId() { + return checkoutAttemptId; + } + + public void setCheckoutAttemptId(String checkoutAttemptId) { + this.checkoutAttemptId = checkoutAttemptId; + } public String getRecurringExpiry() { return recurringExpiry; @@ -1295,6 +1314,7 @@ public boolean equals(Object o) { Objects.equals(this.captureDelayHours, paymentsRequest.captureDelayHours) && Objects.equals(this.channel, paymentsRequest.channel) && Objects.equals(this.company, paymentsRequest.company) && + Objects.equals(this.checkoutAttemptId, paymentsRequest.checkoutAttemptId) && Objects.equals(this.conversionId, paymentsRequest.conversionId) && Objects.equals(this.countryCode, paymentsRequest.countryCode) && Objects.equals(this.dateOfBirth, paymentsRequest.dateOfBirth) && @@ -1349,7 +1369,7 @@ public boolean equals(Object o) { @Override public int hashCode() { return Objects.hash(accountInfo, additionalData, amount, applicationInfo, billingAddress, browserInfo, - captureDelayHours, channel, company, conversionId, countryCode, dateOfBirth, dccQuote, deliveryAddress, + captureDelayHours, channel, checkoutAttemptId, company, conversionId, countryCode, dateOfBirth, dccQuote, deliveryAddress, deliveryDate, deviceFingerprint, enableOneClick, enablePayOut, enableRecurring, entityType, fraudOffset, installments, lineItems, mcc, merchantAccount, merchantOrderReference, merchantRiskIndicator, metadata, mpiData, order, orderReference, origin, paymentMethod, recurringExpiry, recurringFrequency, @@ -1373,6 +1393,7 @@ public String toString() { sb.append(" browserInfo: ").append(toIndentedString(browserInfo)).append("\n"); sb.append(" captureDelayHours: ").append(toIndentedString(captureDelayHours)).append("\n"); sb.append(" channel: ").append(toIndentedString(channel)).append("\n"); + sb.append(" checkoutAttemptId: ").append(toIndentedString(checkoutAttemptId)).append("\n"); sb.append(" company: ").append(toIndentedString(company)).append("\n"); sb.append(" conversionId: ").append(toIndentedString(conversionId)).append("\n"); sb.append(" countryCode: ").append(toIndentedString(countryCode)).append("\n"); diff --git a/src/test/java/com/adyen/CheckoutTest.java b/src/test/java/com/adyen/CheckoutTest.java index 520a2daac..43a2ed412 100644 --- a/src/test/java/com/adyen/CheckoutTest.java +++ b/src/test/java/com/adyen/CheckoutTest.java @@ -232,10 +232,13 @@ public void TestPaymentMethodsSuccessMocked() throws Exception { PaymentMethodsRequest paymentMethodsRequest = new PaymentMethodsRequest(); paymentMethodsRequest.setMerchantAccount("MagentoMerchantTest"); PaymentMethodsResponse paymentMethodsResponse = checkout.paymentMethods(paymentMethodsRequest); - assertEquals(27, paymentMethodsResponse.getPaymentMethods().size()); - assertEquals("Credit Card", paymentMethodsResponse.getPaymentMethods().get(0).getName()); - assertEquals(6, paymentMethodsResponse.getPaymentMethods().get(0).getBrands().size()); - assertEquals("vvvgiftcard", paymentMethodsResponse.getPaymentMethods().get(23).getBrand()); + assertEquals(32, paymentMethodsResponse.getPaymentMethods().size()); + assertEquals("Credit Card", paymentMethodsResponse.getPaymentMethods().get(2).getName()); + assertEquals(9, paymentMethodsResponse.getPaymentMethods().get(2).getBrands().size()); + assertEquals("svs", paymentMethodsResponse.getPaymentMethods().get(25).getBrand()); + assertEquals("Local Polish Payment Methods", paymentMethodsResponse.getPaymentMethods().get(12).getName()); + assertEquals("Bank transfer / postal", paymentMethodsResponse.getPaymentMethods().get(12).getIssuers().get(2).getName()); + } diff --git a/src/test/java/com/adyen/service/PaymentLinksTest.java b/src/test/java/com/adyen/service/PaymentLinksTest.java index 5655cf545..a1616dfc2 100644 --- a/src/test/java/com/adyen/service/PaymentLinksTest.java +++ b/src/test/java/com/adyen/service/PaymentLinksTest.java @@ -149,6 +149,7 @@ private CreatePaymentLinkRequest createPaymentLinkRequest() { address.setStateOrProvince("SP"); createPaymentLinkRequest.setBillingAddress(address); createPaymentLinkRequest.setDeliveryAddress(address); + createPaymentLinkRequest.setStorePaymentMethodMode(CreatePaymentLinkRequest.StorePaymentMethodModeEnum.DISABLED); return createPaymentLinkRequest; } @@ -162,4 +163,4 @@ private Amount createAmountObject(String currency, Long value) { amount.setValue(value); return amount; } -} \ No newline at end of file +} diff --git a/src/test/resources/mocks/checkout/paymentmethods-success.json b/src/test/resources/mocks/checkout/paymentmethods-success.json index cd7698f13..248d4ea3e 100644 --- a/src/test/resources/mocks/checkout/paymentmethods-success.json +++ b/src/test/resources/mocks/checkout/paymentmethods-success.json @@ -1,590 +1,586 @@ { - "groups": [ + "paymentMethods": [ { - "name": "BCMC Mobile", - "types": [ - "bcmc_mobile_QR", - "bcmc_mobile_app" - ] + "name": "AliPay", + "type": "alipay" }, { - "name": "Credit Card", - "types": [ - "amex", - "bcmc", - "cup", - "maestro", - "mc", - "visa" - ] + "name": "AliPay", + "type": "alipay_wap" }, - { - "name": "WeChatPay", - "types": [ - "wechatpayQR", - "wechatpayWeb" - ] - } - ], - "paymentMethods": [ { "brands": [ "amex", "bcmc", "cup", + "diners", + "discover", + "jcb", "maestro", "mc", "visa" ], - "details": [ - { - "key": "number", - "type": "text" - }, - { - "key": "expiryMonth", - "type": "text" - }, - { - "key": "expiryYear", - "type": "text" - }, - { - "key": "cvc", - "type": "text" - }, - { - "key": "holderName", - "optional": true, - "type": "text" - } - ], "name": "Credit Card", - "supportsRecurring": true, "type": "scheme" }, + { + "configuration": { + "merchantId": "1000", + "merchantName": "Merchant Name" + }, + "name": "Apple Pay", + "type": "applepay" + }, { "name": "Bank Transfer (DE)", - "supportsRecurring": true, "type": "bankTransfer_DE" }, { "name": "SEPA Bank Transfer", - "supportsRecurring": true, "type": "bankTransfer_IBAN" }, { - "details": [ - { - "key": "number", - "type": "text" - }, - { - "key": "expiryMonth", - "type": "text" - }, - { - "key": "expiryYear", - "type": "text" - }, - { - "key": "holderName", - "optional": true, - "type": "text" - } - ], "name": "Bancontact card", - "supportsRecurring": false, "type": "bcmc" }, { - "name": "BCMC Mobile", - "supportsRecurring": false, - "type": "bcmc_mobile_QR" - }, - { - "name": "BCMC Mobile", - "supportsRecurring": false, - "type": "bcmc_mobile_app" + "name": "Payconiq by Bancontact", + "type": "bcmc_mobile" }, { "name": "Boleto", - "supportsRecurring": true, "type": "boleto" }, { - "name": "Boleto Bancario via Santander", - "supportsRecurring": true, + "name": "Boleto Bancario", "type": "boletobancario_santander" }, { - "details": [ + "name": "Online bank transfer.", + "type": "directEbanking" + }, + { + "name": "BACS Direct Debit", + "type": "directdebit_GB" + }, + { + "issuers": [ { - "key": "number", - "type": "text" + "id": "66", + "name": "Bank Nowy BFG S.A." }, { - "key": "expiryMonth", - "type": "text" + "id": "92", + "name": "Bank Spółdzielczy w Brodnicy" }, { - "key": "expiryYear", - "type": "text" + "id": "11", + "name": "Bank transfer / postal" }, { - "key": "cvc", - "type": "text" + "id": "74", + "name": "Banki Spółdzielcze" }, { - "key": "holderName", - "optional": true, - "type": "text" + "id": "73", + "name": "BLIK" }, { - "key": "telephoneNumber", - "optional": true, - "type": "text" - } - ], - "name": "ExpressPay", - "supportsRecurring": true, - "type": "cup" - }, - { - "name": "Online bank transfer.", - "supportsRecurring": true, - "type": "directEbanking" - }, - { - "name": "BACS Direct Debit", - "supportsRecurring": true, - "type": "directdebit_GB" - }, - { - "details": [ - { - "items": [ - { - "id": "92", - "name": "Bank Sp�?dzielczy w Brodnicy" - }, - { - "id": "11", - "name": "Bank transfer / postal" - }, - { - "id": "74", - "name": "Banki Sp�?dzielcze" - }, - { - "id": "73", - "name": "BLIK" - }, - { - "id": "48", - "name": "BNP Paribas - P?ac? z ?�?ty" - }, - { - "id": "88", - "name": "BNP Paribas dawni Klienci Raiffeisen" - }, - { - "id": "83", - "name": "EnveloBank" - }, - { - "id": "56", - "name": "eurobank p?atno?ci online" - }, - { - "id": "76", - "name": "Getin Bank PBL" - }, - { - "id": "81", - "name": "Idea Cloud" - }, - { - "id": "7", - "name": "ING Corporate customers" - }, - { - "id": "35", - "name": "Kantor Polski" - }, - { - "id": "44", - "name": "Millennium - P?atno?ci Internetowe" - }, - { - "id": "10", - "name": "Millennium Corporate customers" - }, - { - "id": "24", - "name": "mPay" - }, - { - "id": "68", - "name": "mRaty" - }, - { - "id": "1", - "name": "mTransfer" - }, - { - "id": "91", - "name": "Nest Bank" - }, - { - "id": "80", - "name": "Noble Pay" - }, - { - "id": "50", - "name": "Pay Way Toyota Bank" - }, - { - "id": "45", - "name": "Pay with Alior Bank" - }, - { - "id": "65", - "name": "Paylink Idea Bank" - }, - { - "id": "36", - "name": "Pekao24Przelew" - }, - { - "id": "70", - "name": "Pocztowy24" - }, - { - "id": "6", - "name": "Przelew24" - }, - { - "id": "46", - "name": "P?ac? z Citi Handlowy" - }, - { - "id": "38", - "name": "P?ac? z ING" - }, - { - "id": "2", - "name": "P?ac? z Inteligo" - }, - { - "id": "4", - "name": "P?ac? z iPKO" - }, - { - "id": "66", - "name": "P?ac? z PBS" - }, - { - "id": "75", - "name": "P?ac? z Plus Bank" - }, - { - "id": "51", - "name": "P?a? z BO?" - }, - { - "id": "55", - "name": "Raty z Alior Bankiem PLN" - }, - { - "id": "52", - "name": "SkyCash" - }, - { - "id": "60", - "name": "T-Mobile us?ugi bankowe" - }, - { - "id": "21", - "name": "VIA - Moje Rachunki" - }, - { - "id": "84", - "name": "Volkswagen Bank direct" - } - ], - "key": "issuer", - "type": "select" + "id": "90", + "name": "BNP Paribas - płacę z Pl@net" + }, + { + "id": "59", + "name": "CinkciarzPAY" + }, + { + "id": "87", + "name": "Credit Agricole PBL" + }, + { + "id": "83", + "name": "EnveloBank" + }, + { + "id": "76", + "name": "Getin Bank PBL" + }, + { + "id": "81", + "name": "Idea Cloud" + }, + { + "id": "7", + "name": "ING Corporate customers" + }, + { + "id": "93", + "name": "Kasa Stefczyka" + }, + { + "id": "44", + "name": "Millennium - Płatności Internetowe" + }, + { + "id": "10", + "name": "Millennium Corporate customers" + }, + { + "id": "68", + "name": "mRaty" + }, + { + "id": "1", + "name": "mTransfer" + }, + { + "id": "91", + "name": "Nest Bank" + }, + { + "id": "80", + "name": "Noble Pay" + }, + { + "id": "50", + "name": "Pay Way Toyota Bank" + }, + { + "id": "45", + "name": "Pay with Alior Bank" + }, + { + "id": "36", + "name": "Pekao24Przelew" + }, + { + "id": "70", + "name": "Pocztowy24" + }, + { + "id": "6", + "name": "Przelew24" + }, + { + "id": "46", + "name": "Płacę z Citi Handlowy" + }, + { + "id": "38", + "name": "Płacę z ING" + }, + { + "id": "2", + "name": "Płacę z Inteligo" + }, + { + "id": "4", + "name": "Płacę z iPKO" + }, + { + "id": "75", + "name": "Płacę z Plus Bank" + }, + { + "id": "51", + "name": "Płać z BOŚ" + }, + { + "id": "55", + "name": "Raty z Alior Bankiem PLN" + }, + { + "id": "89", + "name": "Santander" + }, + { + "id": "52", + "name": "SkyCash" } ], "name": "Local Polish Payment Methods", - "supportsRecurring": true, "type": "dotpay" }, { "name": "Finnish E-Banking", - "supportsRecurring": true, "type": "ebanking_FI" }, { - "details": [ + "issuers": [ + { + "id": "231", + "name": "POP Pankki" + }, + { + "id": "551", + "name": "Komerční banka" + }, + { + "id": "232", + "name": "Aktia" + }, + { + "id": "552", + "name": "Raiffeisen" + }, + { + "id": "233", + "name": "Säästöpankki" + }, + { + "id": "750", + "name": "Swedbank" + }, + { + "id": "211", + "name": "Nordea" + }, + { + "id": "553", + "name": "ČSOB" + }, + { + "id": "234", + "name": "S-Pankki" + }, + { + "id": "751", + "name": "SEB" + }, + { + "id": "554", + "name": "Moneta" + }, + { + "id": "235", + "name": "OmaSP" + }, + { + "id": "752", + "name": "Nordea" + }, + { + "id": "213", + "name": "Op-Pohjola" + }, + { + "id": "555", + "name": "UniCredit" + }, { - "key": "bic", - "type": "text" + "id": "753", + "name": "LHV" + }, + { + "id": "556", + "name": "Fio" + }, + { + "id": "557", + "name": "mBank" + }, + { + "id": "216", + "name": "Handelsbanken" + }, + { + "id": "558", + "name": "Air Bank" + }, + { + "id": "260", + "name": "Länsförsäkringar" + }, + { + "id": "240", + "name": "BankDeposit" + }, + { + "id": "265", + "name": "Sparbanken" + }, + { + "id": "640", + "name": "BankDeposit" + }, + { + "id": "200", + "name": "Ålandsbanken" + }, + { + "id": "940", + "name": "Swedbank" + }, + { + "id": "500", + "name": "Česká spořitelna" + }, + { + "id": "720", + "name": "Swedbank" + }, + { + "id": "941", + "name": "SEB" + }, + { + "id": "204", + "name": "Danske Bank" + }, + { + "id": "721", + "name": "SEB" + }, + { + "id": "942", + "name": "Citadele" + }, + { + "id": "205", + "name": "Handelsbanken" + }, + { + "id": "722", + "name": "DNB" + }, + { + "id": "943", + "name": "DNB" + }, + { + "id": "206", + "name": "Nordea" + }, + { + "id": "723", + "name": "Šiaulių bankas" + }, + { + "id": "207", + "name": "SEB" + }, + { + "id": "724", + "name": "Nordea" + }, + { + "id": "505", + "name": "Komerční banka" + }, + { + "id": "208", + "name": "Skandiabanken" + }, + { + "id": "209", + "name": "Swedbank" } ], + "name": "Bank Payment", + "type": "entercash" + }, + { "name": "GiroPay", - "supportsRecurring": true, "type": "giropay" }, { - "details": [ - { - "items": [ - { - "id": "1121", - "name": "Test Issuer" - }, - { - "id": "1154", - "name": "Test Issuer 5" - }, - { - "id": "1153", - "name": "Test Issuer 4" - }, - { - "id": "1152", - "name": "Test Issuer 3" - }, - { - "id": "1151", - "name": "Test Issuer 2" - }, - { - "id": "1162", - "name": "Test Issuer Cancelled" - }, - { - "id": "1161", - "name": "Test Issuer Pending" - }, - { - "id": "1160", - "name": "Test Issuer Refused" - }, - { - "id": "1159", - "name": "Test Issuer 10" - }, - { - "id": "1158", - "name": "Test Issuer 9" - }, - { - "id": "1157", - "name": "Test Issuer 8" - }, - { - "id": "1156", - "name": "Test Issuer 7" - }, - { - "id": "1155", - "name": "Test Issuer 6" - } - ], - "key": "issuer", - "type": "select" + "issuers": [ + { + "id": "1121", + "name": "Test Issuer" + }, + { + "id": "1154", + "name": "Test Issuer 5" + }, + { + "id": "1153", + "name": "Test Issuer 4" + }, + { + "id": "1152", + "name": "Test Issuer 3" + }, + { + "id": "1151", + "name": "Test Issuer 2" + }, + { + "id": "1162", + "name": "Test Issuer Cancelled" + }, + { + "id": "1161", + "name": "Test Issuer Pending" + }, + { + "id": "1160", + "name": "Test Issuer Refused" + }, + { + "id": "1159", + "name": "Test Issuer 10" + }, + { + "id": "1158", + "name": "Test Issuer 9" + }, + { + "id": "1157", + "name": "Test Issuer 8" + }, + { + "id": "1156", + "name": "Test Issuer 7" + }, + { + "id": "1155", + "name": "Test Issuer 6" } ], "name": "iDEAL", - "supportsRecurring": true, "type": "ideal" }, { "name": "Pay later with Klarna.", - "supportsRecurring": true, "type": "klarna" }, { - "name": "Slice it with Klarna.", - "supportsRecurring": true, + "name": "Pay over time with Klarna.", "type": "klarna_account" }, { - "details": [ - { - "items": [ - { - "id": "fpx_bimb", - "name": "Bank Islam" - }, - { - "id": "fpx_uob", - "name": "UOB Bank" - }, - { - "id": "fpx_cimbclicks", - "name": "CIMB Clicks" - }, - { - "id": "fpx_kfh", - "name": "Kuwait Finance House" - }, - { - "id": "fpx_rhb", - "name": "RHB Now" - }, - { - "id": "fpx_abmb", - "name": "Alliance Bank" - }, - { - "id": "fpx_hsbc", - "name": "HSBC" - }, - { - "id": "fpx_amb", - "name": "Am Online" - }, - { - "id": "fpx_ocbc", - "name": "OCBC Bank" - }, - { - "id": "fpx_abb", - "name": "Affin Bank" - }, - { - "id": "fpx_scb", - "name": "Standard Chartered Bank" - }, - { - "id": "fpx_pbb", - "name": "Public Bank" - }, - { - "id": "fpx_bsn", - "name": "Bank Simpanan Nasional" - }, - { - "id": "fpx_bmmb", - "name": "Bank Muamalat" - }, - { - "id": "fpx_hlb", - "name": "Hong Leong Connect" - }, - { - "id": "fpx_mb2u", - "name": "Maybank2u" - }, - { - "id": "fpx_bkrm", - "name": "Bank Rakyat" - } - ], - "key": "issuer", - "type": "select" + "name": "Pay now with Klarna.", + "type": "klarna_paynow" + }, + { + "issuers": [ + { + "id": "fpx_bimb", + "name": "Bank Islam" + }, + { + "id": "fpx_uob", + "name": "UOB Bank" + }, + { + "id": "fpx_cimbclicks", + "name": "CIMB Clicks" + }, + { + "id": "fpx_kfh", + "name": "Kuwait Finance House" + }, + { + "id": "fpx_rhb", + "name": "RHB Now" + }, + { + "id": "fpx_abmb", + "name": "Alliance Bank" + }, + { + "id": "fpx_amb", + "name": "Am Online" + }, + { + "id": "fpx_hsbc", + "name": "HSBC" + }, + { + "id": "fpx_abb", + "name": "Affin Bank" + }, + { + "id": "fpx_ocbc", + "name": "OCBC Bank" + }, + { + "id": "fpx_pbb", + "name": "Public Bank" + }, + { + "id": "fpx_scb", + "name": "Standard Chartered Bank" + }, + { + "id": "fpx_bsn", + "name": "Bank Simpanan Nasional" + }, + { + "id": "fpx_mb2u", + "name": "Maybank2u" + }, + { + "id": "fpx_hlb", + "name": "Hong Leong Connect" + }, + { + "id": "fpx_bmmb", + "name": "Bank Muamalat" + }, + { + "id": "fpx_agrobank", + "name": "Agrobank" + }, + { + "id": "fpx_bkrm", + "name": "Bank Rakyat" } ], "name": "Malaysia E-Banking", - "supportsRecurring": true, "type": "molpay_ebanking_fpx_MY" }, { "name": "Multibanco", - "supportsRecurring": true, "type": "multibanco" }, { - "details": [ + "issuers": [ { - "items": [ - { - "id": "1", - "name": "Model Bank v2" - } - ], - "key": "issuer", - "type": "select" + "id": "1", + "name": "Model Bank v2" } ], "name": "Online banking", - "supportsRecurring": false, "type": "openbanking_UK" }, { "name": "POLi", - "supportsRecurring": true, "type": "poli" }, { - "details": [ - { - "key": "sepa.ownerName", - "type": "text" - }, - { - "key": "sepa.ibanNumber", - "type": "text" - } - ], "name": "SEPA Direct Debit", - "supportsRecurring": true, "type": "sepadirectdebit" }, { - "details": [ - { - "key": "number", - "type": "text" - }, - { - "key": "expiryMonth", - "optional": true, - "type": "text" - }, - { - "key": "expiryYear", - "optional": true, - "type": "text" - }, - { - "key": "cvc", - "optional": true, - "type": "text" - }, - { - "key": "holderName", - "optional": true, - "type": "text" - } - ], + "brand": "svs", "name": "SVS", - "supportsRecurring": true, - "type": "svs" + "type": "giftcard" }, { - "name": "VVV Giftcard", - "brand": "vvvgiftcard", - "type": "giftcard" + "name": "Trustly", + "type": "trustly" }, { "name": "UnionPay", - "supportsRecurring": true, "type": "unionpay" }, + { + "name": "Vipps", + "type": "vipps" + }, + { + "name": "WeChat Pay", + "type": "wechatpayMiniProgram" + }, { "name": "WeChat Pay", - "supportsRecurring": true, "type": "wechatpayQR" }, { "name": "WeChat Pay", - "supportsRecurring": true, "type": "wechatpayWeb" } ] -} \ No newline at end of file +} From 08b8ec97be421ccc398f57424269b42673d0555c Mon Sep 17 00:00:00 2001 From: Wouter Boereboom Date: Mon, 18 Oct 2021 15:51:02 +0200 Subject: [PATCH 26/29] removed details field as mentioned in erlease notes --- .../adyen/model/checkout/PaymentMethod.java | 40 +------------------ 1 file changed, 1 insertion(+), 39 deletions(-) diff --git a/src/main/java/com/adyen/model/checkout/PaymentMethod.java b/src/main/java/com/adyen/model/checkout/PaymentMethod.java index bfd48d74f..6640144c8 100755 --- a/src/main/java/com/adyen/model/checkout/PaymentMethod.java +++ b/src/main/java/com/adyen/model/checkout/PaymentMethod.java @@ -50,9 +50,6 @@ public class PaymentMethod { @SerializedName("configuration") private Map configuration = null; - @SerializedName("details") - private List details = null; - @SerializedName("issuers") private List issuers = null; @@ -186,39 +183,6 @@ public void setConfiguration(Map configuration) { this.configuration = configuration; } - public PaymentMethod details(List details) { - this.details = details; - return this; - } - - public PaymentMethod addDetailsItem(InputDetail detailsItem) { - - if (details == null) { - details = new ArrayList<>(); - } - - details.add(detailsItem); - return this; - } - - /** - * All input details to be provided to complete the payment with this payment method. - * - * @return details - **/ - public List getDetails() { - return details; - } - - public void setDetails(List details) { - this.details = details; - } - - public PaymentMethod fundingSource(FundingSourceEnum fundingSource) { - this.fundingSource = fundingSource; - return this; - } - /** * The funding source of the payment method. * @@ -334,7 +298,6 @@ public boolean equals(Object o) { return Objects.equals(this.brand, paymentMethod.brand) && Objects.equals(this.brands, paymentMethod.brands) && Objects.equals(this.configuration, paymentMethod.configuration) && - Objects.equals(this.details, paymentMethod.details) && Objects.equals(this.fundingSource, paymentMethod.fundingSource) && Objects.equals(this.group, paymentMethod.group) && Objects.equals(this.name, paymentMethod.name) && @@ -344,7 +307,7 @@ public boolean equals(Object o) { @Override public int hashCode() { - return Objects.hash(brand, brands, configuration, details, fundingSource, group, + return Objects.hash(brand, brands, configuration, fundingSource, group, name, issuers, type); } @@ -356,7 +319,6 @@ public String toString() { sb.append(" brand: ").append(toIndentedString(brand)).append("\n"); sb.append(" brands: ").append(toIndentedString(brands)).append("\n"); sb.append(" configuration: ").append(toIndentedString(configuration)).append("\n"); - sb.append(" details: ").append(toIndentedString(details)).append("\n"); sb.append(" fundingSource: ").append(toIndentedString(fundingSource)).append("\n"); sb.append(" group: ").append(toIndentedString(group)).append("\n"); sb.append(" issuers: ").append(toIndentedString(issuers)).append("\n"); From 6a89a0590c8a9be81e4f2ce66c22e0fd5a6f487f Mon Sep 17 00:00:00 2001 From: Wouter Boereboom Date: Tue, 19 Oct 2021 14:00:11 +0200 Subject: [PATCH 27/29] reinstate inputDetails + added Deprecated annotation --- .../adyen/model/checkout/PaymentMethod.java | 36 +++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/adyen/model/checkout/PaymentMethod.java b/src/main/java/com/adyen/model/checkout/PaymentMethod.java index 6640144c8..ecd208245 100755 --- a/src/main/java/com/adyen/model/checkout/PaymentMethod.java +++ b/src/main/java/com/adyen/model/checkout/PaymentMethod.java @@ -105,6 +105,9 @@ public FundingSourceEnum read(final JsonReader jsonReader) throws IOException { @SerializedName("group") private PaymentMethodGroup group = null; + @SerializedName("inputDetails") + private List inputDetails = null; + @SerializedName("name") private String name = null; @@ -216,12 +219,39 @@ public void setGroup(PaymentMethodGroup group) { this.group = group; } + public PaymentMethod inputDetails(List inputDetails) { + this.inputDetails = inputDetails; + return this; + } + + public PaymentMethod addInputDetailsItem(InputDetail inputDetailsItem) { + if (this.inputDetails == null) { + this.inputDetails = new ArrayList(); + } + this.inputDetails.add(inputDetailsItem); + return this; + } + + /** + * All input details to be provided to complete the payment with this payment method. + * + * @return inputDetails + * @deprecated + **/ + @Deprecated + public List getInputDetails() { + return inputDetails; + } + + public void setInputDetails(List inputDetails) { + this.inputDetails = inputDetails; + } + public PaymentMethod name(String name) { this.name = name; return this; } - /** * The displayable name of this payment method. * @@ -300,6 +330,7 @@ public boolean equals(Object o) { Objects.equals(this.configuration, paymentMethod.configuration) && Objects.equals(this.fundingSource, paymentMethod.fundingSource) && Objects.equals(this.group, paymentMethod.group) && + Objects.equals(this.inputDetails, paymentMethod.inputDetails) && Objects.equals(this.name, paymentMethod.name) && Objects.equals(this.issuers, paymentMethod.issuers) && Objects.equals(this.type, paymentMethod.type); @@ -308,7 +339,7 @@ public boolean equals(Object o) { @Override public int hashCode() { return Objects.hash(brand, brands, configuration, fundingSource, group, - name, issuers, type); + inputDetails, name, issuers, type); } @Override @@ -322,6 +353,7 @@ public String toString() { sb.append(" fundingSource: ").append(toIndentedString(fundingSource)).append("\n"); sb.append(" group: ").append(toIndentedString(group)).append("\n"); sb.append(" issuers: ").append(toIndentedString(issuers)).append("\n"); + sb.append(" inputDetails: ").append(toIndentedString(inputDetails)).append("\n"); sb.append(" name: ").append(toIndentedString(name)).append("\n"); sb.append(" type: ").append(toIndentedString(type)).append("\n"); sb.append("}"); From 5c20d05b3f3f571b095c1f7a309218c2a9cf3510 Mon Sep 17 00:00:00 2001 From: Jeantwan Teuma Date: Tue, 19 Oct 2021 15:38:18 +0200 Subject: [PATCH 28/29] [PW-5474] - Add the requestChallengeAsMandate ENUM (#637) * PW-5474 - Add new requestChallengeAsMandate ENUM * PW-5474 - Add threeDSRequestorChallengeInd parameter * PW-5474 - Add deprecated tag to challengeIndicator field * PW-5474 - Add further deprecated tags and comments --- .../com/adyen/model/ThreeDS2RequestData.java | 39 ++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/adyen/model/ThreeDS2RequestData.java b/src/main/java/com/adyen/model/ThreeDS2RequestData.java index 8db3a1292..9ff57cd69 100644 --- a/src/main/java/com/adyen/model/ThreeDS2RequestData.java +++ b/src/main/java/com/adyen/model/ThreeDS2RequestData.java @@ -51,7 +51,8 @@ public enum ChallengeIndicatorEnum { NOPREFERENCE("noPreference"), REQUESTCHALLENGE("requestChallenge"), - REQUESTNOCHALLENGE("requestNoChallenge"); + REQUESTNOCHALLENGE("requestNoChallenge"), + REQUESTCHALLENGEASMANDATE("requestChallengeAsMandate"); @JsonValue private String value; @@ -89,6 +90,10 @@ public ChallengeIndicatorEnum read(final JsonReader jsonReader) throws IOExcepti } } + /** + * @deprecated As of Checkout/Payments API version 68, this field is not used anymore. + */ + @Deprecated @SerializedName("challengeIndicator") private ChallengeIndicatorEnum challengeIndicator = null; @@ -135,6 +140,9 @@ public ChallengeIndicatorEnum read(final JsonReader jsonReader) throws IOExcepti @SerializedName("threeDSRequestorID") private String threeDSRequestorID = null; + @SerializedName("threeDSRequestorChallengeInd") + private String threeDSRequestorChallengeInd = null; + @SerializedName("threeDSRequestorName") private String threeDSRequestorName = null; @@ -211,15 +219,27 @@ public void setAuthenticationOnly(Boolean authenticationOnly) { this.authenticationOnly = authenticationOnly; } + /** + * @deprecated As of Checkout/Payments API version 68, this field is not used anymore. + */ + @Deprecated public ThreeDS2RequestData challengeIndicator(ChallengeIndicatorEnum challengeIndicator) { this.challengeIndicator = challengeIndicator; return this; } + /** + * @deprecated As of Checkout/Payments API version 68, this field is not used anymore. + */ + @Deprecated public ChallengeIndicatorEnum getChallengeIndicator() { return challengeIndicator; } + /** + * @deprecated As of Checkout/Payments API version 68, this field is not used anymore. + */ + @Deprecated public void setChallengeIndicator(ChallengeIndicatorEnum challengeIndicator) { this.challengeIndicator = challengeIndicator; } @@ -410,6 +430,23 @@ public ThreeDS2RequestData messageVersion(String messageVersion) { return this; } + /** + * Indicates whether a challenge is requested for this transaction. + * @return threeDSRequestorChallengeInd + */ + public String getThreeDSRequestorChallengeInd() { + return threeDSRequestorChallengeInd; + } + + public void setThreeDSRequestorChallengeInd(String threeDSRequestorChallengeInd) { + this.threeDSRequestorChallengeInd = threeDSRequestorChallengeInd; + } + + public ThreeDS2RequestData threeDSRequestorChallengeInd(String threeDSRequestorChallengeInd) { + this.threeDSRequestorChallengeInd = threeDSRequestorChallengeInd; + return this; + } + /** * Required for [authentication-only integration](https://docs.adyen.com/checkout/3d-secure-2/3ds2-checkout-authentication-only-integration) for Visa. Unique 3D Secure requestor identifier assigned by the Directory Server when you enrol for 3D Secure 2. * @return threeDSRequestorID From dc41ea63ea6c5cbbab26c96b81d8d0b76ae72170 Mon Sep 17 00:00:00 2001 From: jeant Date: Tue, 19 Oct 2021 16:04:25 +0200 Subject: [PATCH 29/29] Version bump 17.2.0 --- README.md | 2 +- pom.xml | 2 +- src/main/java/com/adyen/Client.java | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 6bac2dcd2..2baf32b09 100644 --- a/README.md +++ b/README.md @@ -41,7 +41,7 @@ You can use Maven and add this dependency to your project's POM: com.adyen adyen-java-api-library - 17.1.0 + 17.2.0 ``` diff --git a/pom.xml b/pom.xml index 7d7c6924c..0c4363795 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.adyen adyen-java-api-library jar - 17.1.0 + 17.2.0 Adyen Java API Library Adyen API Client Library for Java https://github.com/adyen/adyen-java-api-library diff --git a/src/main/java/com/adyen/Client.java b/src/main/java/com/adyen/Client.java index e84c249a8..5a385a3be 100644 --- a/src/main/java/com/adyen/Client.java +++ b/src/main/java/com/adyen/Client.java @@ -47,7 +47,7 @@ public class Client { public static final String MARKETPAY_NOTIFICATION_API_VERSION = "v6"; public static final String MARKETPAY_HOP_API_VERSION = "v6"; public static final String LIB_NAME = "adyen-java-api-library"; - public static final String LIB_VERSION = "17.0.0"; + public static final String LIB_VERSION = "17.2.0"; public static final String CHECKOUT_ENDPOINT_TEST = "https://checkout-test.adyen.com/checkout"; public static final String CHECKOUT_ENDPOINT_LIVE_SUFFIX = "-checkout-live.adyenpayments.com/checkout"; public static final String CHECKOUT_ENDPOINT_CERT_LIVE = "https://checkoutcert-live-%s.adyen.com/checkout";