diff --git a/README.md b/README.md index 809135b17..0cec069f0 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ Add this dependency to your project's POM: com.adyen adyen-java-api-library - 1.5.4 + 1.6.0 ``` diff --git a/checkstyle.xml b/checkstyle.xml new file mode 100644 index 000000000..51f711dab --- /dev/null +++ b/checkstyle.xml @@ -0,0 +1,172 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/checkout-api.html b/docs/checkout-api.html index dfae39ecf..8cbc9c4ec 100755 --- a/docs/checkout-api.html +++ b/docs/checkout-api.html @@ -79,8 +79,17 @@

payments

paymentsRequest.putPaymentMethodItem("holderName", "John Smith"); paymentsRequest.putPaymentMethodItem("cvc", "737"); paymentsRequest.setReturnUrl("https://your-company.com/..."); -paymentsRequest.setMerchantAccount("YOUR_MERCHANT_ACCOUNT"); -PaymentsResponse paymentResponse = checkout.payments(paymentsRequest); +paymentsRequest.setMerchantAccount("YOUR_MERCHANT_ACCOUNT"); + This Adyen API supports idempotency. To enable idempotent behavior on this request call, you need + to supply a RequestOptions object with idempotencyKey. In following example, "IDEMPOTENCY + KEY FOR THIS REQUEST" is a unique identifer for the message with a maximum 64 characters (we recommend a + UUID). +

+

RequestOptions requestOptions = new RequestOptions();
requestOptions.setIdempotencyKey("IDEMPOTENCY KEY FOR THIS REQUEST");
PaymentsResponse paymentResponse = checkout.payments(paymentsRequest, requestOptions);
+ If you don't want to use idempotencyKey, simply send paymentRequest as shown in following example: +

+

PaymentsResponse paymentResponse = checkout.payments(paymentsRequest);
 

payments/details

diff --git a/docs/checkout-sdk.html b/docs/checkout-sdk.html index 4e1cbae2d..828f2e6b8 100755 --- a/docs/checkout-sdk.html +++ b/docs/checkout-sdk.html @@ -38,7 +38,9 @@

Checkout SDK integration

The Checkout SDK service has the following methods:

paymentSession

-

Provides the data object that can be used to start the Checkout SDK. To set up the payment, pass its amount, currency, and other required parameters. We use this to optimise the payment flow and perform better risk assessment of the transaction.

+

Provides the data object that can be used to start the Checkout SDK. To set up the payment, pass its amount, + currency, and other required parameters. We use this to optimise the payment flow and perform better risk + assessment of the transaction.

Checkout checkout = new Checkout(client);
 PaymentSessionRequest paymentSessionRequest = new PaymentSessionRequest();
 paymentSessionRequest.setAmount(createAmountObject("EUR", 17408L));
@@ -46,9 +48,19 @@ 

paymentSession

paymentSessionRequest.returnUrl("https://www.yourshop.com/checkout/result"); paymentSessionRequest.merchantAccount("YOUR_MERCHANT_ACCOUNT"); paymentSessionRequest.setCountryCode("NL"); -paymentSessionRequest.setSdkVersion("1.3.0"); -PaymentSessionResponse paymentSessionResponse = checkout.paymentSession(paymentSessionRequest); +paymentSessionRequest.setSdkVersion("1.3.0");
+ This Adyen API supports idempotency. To enable idempotent behavior on this request call, you need + to supply a RequestOptions object with idempotencyKey. In following example, "IDEMPOTENCY + KEY FOR THIS REQUEST" is a unique identifer for the message with a maximum 64 characters (we recommend a + UUID). +

+

RequestOptions requestOptions = new RequestOptions();
requestOptions.setIdempotencyKey("IDEMPOTENCY KEY FOR THIS REQUEST");
PaymentSessionResponse paymentSessionResponse = checkout.paymentSession(paymentSessionRequest, requestOptions);
+ If you don't want to use idempotencyKey, simply send paymentRequest as shown in following example: +

+

PaymentSessionResponse paymentSessionResponse = checkout.paymentSession(paymentSessionRequest);
 
+

payments/result

Verifies the payment result using the payload returned from the Checkout SDK.

Checkout checkout = new Checkout(client);
diff --git a/docs/install-library.html b/docs/install-library.html
index 837ce2698..8907e6574 100755
--- a/docs/install-library.html
+++ b/docs/install-library.html
@@ -49,7 +49,8 @@ 

Maven

class="hljs-tag"></groupId> <artifactId>adyen-java-api-library</artifactId> - <version>1.5.4</<version>1.6.0</version> </dependency>
diff --git a/pom.xml b/pom.xml index b45f4bb4d..68b96e2e8 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.adyen adyen-java-api-library jar - 1.5.4 + 1.6.0 Adyen Java API Library Adyen API Client Library for Java https://github.com/adyen/adyen-java-api-library @@ -42,19 +42,11 @@ - maven-assembly-plugin - - - package - - single - - - + maven-jar-plugin - - jar-with-dependencies - + + ${project.build.outputDirectory}/META-INF/MANIFEST.MF + @@ -126,6 +118,45 @@ true + + org.apache.maven.plugins + maven-checkstyle-plugin + 3.0.0 + + checkstyle.xml + UTF-8 + true + true + + + + validate + validate + + check + + + + + + org.apache.felix + maven-bundle-plugin + 3.5.0 + + + bundle-manifest + process-classes + + manifest + + + + + + com.adyen + + + diff --git a/src/main/java/com/adyen/Client.java b/src/main/java/com/adyen/Client.java index 699b02019..e6ab081b8 100644 --- a/src/main/java/com/adyen/Client.java +++ b/src/main/java/com/adyen/Client.java @@ -41,7 +41,7 @@ public class Client { public static final String MARKETPAY_FUND_API_VERSION = "v3"; public static final String MARKETPAY_NOTIFICATION_API_VERSION = "v1"; public static final String USER_AGENT_SUFFIX = "adyen-java-api-library/"; - public static final String LIB_VERSION = "1.5.4"; + public static final String LIB_VERSION = "1.6.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_API_VERSION = "v32"; @@ -81,6 +81,12 @@ public Client(String apiKey, Environment environment) { this.setEnvironment(environment); } + public Client(String apiKey, Environment environment, String liveEndpointUrlPrefix) { + this.config = new Config(); + this.config.setApiKey(apiKey); + this.setEnvironment(environment, liveEndpointUrlPrefix); + } + public Client(String apiKey, Environment environment, int connectionTimeoutMillis) { this.config = new Config(); @@ -109,6 +115,7 @@ public Client(String apiKey, Environment environment, int connectionTimeoutMilli /** * @deprecated As of library version 1.5.4, replaced by {@link #setEnvironment(Environment environment, String liveEndpointUrlPrefix)}. */ + @Deprecated public void setEnvironment(Environment environment) { this.setEnvironment(environment, null); } diff --git a/src/main/java/com/adyen/Util/DateUtil.java b/src/main/java/com/adyen/Util/DateUtil.java index 929508f1b..40b159d99 100644 --- a/src/main/java/com/adyen/Util/DateUtil.java +++ b/src/main/java/com/adyen/Util/DateUtil.java @@ -23,6 +23,8 @@ import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; +import java.util.Locale; +import java.util.TimeZone; public final class DateUtil { private DateUtil() { @@ -33,15 +35,15 @@ public static Date parseDateToFormat(String dateString, String format) { return null; } - Date date; - SimpleDateFormat fmt = new SimpleDateFormat(format); + SimpleDateFormat fmt = new SimpleDateFormat(format, Locale.ENGLISH); + fmt.setTimeZone(TimeZone.getTimeZone("GMT")); + try { - date = fmt.parse(dateString); - } catch (ParseException e) { - return null; + return fmt.parse(dateString); + } catch (ParseException ignored) { } - return date; + return null; } public static Date parseYmdDate(String dateString) { diff --git a/src/main/java/com/adyen/Util/HMACValidator.java b/src/main/java/com/adyen/Util/HMACValidator.java index b4e931b95..4eb058074 100644 --- a/src/main/java/com/adyen/Util/HMACValidator.java +++ b/src/main/java/com/adyen/Util/HMACValidator.java @@ -1,4 +1,4 @@ -/** +/* * ###### * ###### * ############ ####( ###### #####. ###### ############ ############ @@ -20,10 +20,6 @@ */ package com.adyen.Util; -import static com.adyen.constants.ApiConstants.AdditionalData.HMAC_SIGNATURE; - -import com.adyen.model.Amount; -import com.adyen.model.notification.NotificationRequestItem; import java.nio.charset.Charset; import java.security.SignatureException; import java.util.ArrayList; @@ -33,10 +29,13 @@ import javax.crypto.spec.SecretKeySpec; import org.apache.commons.codec.binary.Base64; import org.apache.commons.codec.binary.Hex; +import com.adyen.model.Amount; +import com.adyen.model.notification.NotificationRequestItem; +import static com.adyen.constants.ApiConstants.AdditionalData.HMAC_SIGNATURE; public class HMACValidator { - public final static String HMAC_SHA256_ALGORITHM = "HmacSHA256"; - public final static Charset C_UTF8 = Charset.forName("UTF8"); + public static final String HMAC_SHA256_ALGORITHM = "HmacSHA256"; + public static final Charset C_UTF8 = Charset.forName("UTF8"); public static final String DATA_SEPARATOR = ":"; // To calculate the HMAC SHA-256 @@ -64,13 +63,11 @@ public String calculateHMAC(String data, String key) throws java.security.Signat } // To calculate the HMAC SHA-256 - public String calculateHMAC(NotificationRequestItem notificationRequestItem, String key) - throws SignatureException { + public String calculateHMAC(NotificationRequestItem notificationRequestItem, String key) throws SignatureException { return calculateHMAC(getDataToSign(notificationRequestItem), key); } - public boolean validateHMAC(NotificationRequestItem notificationRequestItem, String key) - throws SignatureException { + public boolean validateHMAC(NotificationRequestItem notificationRequestItem, String key) throws SignatureException { final String expectedSign = calculateHMAC(notificationRequestItem, key); final String merchantSign = notificationRequestItem.getAdditionalData().get(HMAC_SIGNATURE); diff --git a/src/main/java/com/adyen/Util/Util.java b/src/main/java/com/adyen/Util/Util.java index 213a4dc33..998702d94 100644 --- a/src/main/java/com/adyen/Util/Util.java +++ b/src/main/java/com/adyen/Util/Util.java @@ -23,10 +23,13 @@ import com.adyen.model.Amount; import java.math.BigDecimal; import java.math.RoundingMode; +import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; import java.util.List; +import java.util.Locale; +import java.util.TimeZone; public final class Util { private Util() { @@ -149,6 +152,9 @@ public static String calculateSessionValidity() { calendar.add(Calendar.DATE, 1); Date sessionDate = calendar.getTime(); - return new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssXXX").format(sessionDate); + DateFormat fmt = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssXXX", Locale.ENGLISH); + fmt.setTimeZone(TimeZone.getTimeZone("GMT")); + + return fmt.format(sessionDate); } } diff --git a/src/main/java/com/adyen/constants/ApiConstants.java b/src/main/java/com/adyen/constants/ApiConstants.java index 9e23c6c5f..985840c1e 100644 --- a/src/main/java/com/adyen/constants/ApiConstants.java +++ b/src/main/java/com/adyen/constants/ApiConstants.java @@ -72,6 +72,11 @@ interface SelectedBrand { } interface PaymentMethod { + + String NUMBER = "number"; + String EXPIRY_MONTH = "expiryMonth"; + String EXPIRY_YEAR = "expiryYear"; + String CVC = "cvc"; String ENCRYPTED_CARD_NUMBER = "encryptedCardNumber"; String ENCRYPTED_EXPIRY_MONTH = "encryptedExpiryMonth"; String ENCRYPTED_EXPIRY_YEAR = "encryptedExpiryYear"; @@ -92,4 +97,14 @@ interface Data { interface PaymentMethodType { String TYPE_SCHEME = "scheme"; } + + interface RequestProperty { + String IDEMPOTENCY_KEY = "Idempotency-Key"; + String ACCEPT_CHARSET = "Accept-Charset"; + String USER_AGENT = "User-Agent"; + String METHOD_POST = "POST"; + String CONTENT_TYPE = "Content-Type"; + String API_KEY = "x-api-key"; + String APPLICATION_JSON_TYPE = "application/json"; + } } diff --git a/src/main/java/com/adyen/enums/Environment.java b/src/main/java/com/adyen/enums/Environment.java index 8bb68df0d..fe94709a1 100644 --- a/src/main/java/com/adyen/enums/Environment.java +++ b/src/main/java/com/adyen/enums/Environment.java @@ -1,4 +1,4 @@ -/** +/* * ###### * ###### * ############ ####( ###### #####. ###### ############ ############ @@ -21,14 +21,14 @@ package com.adyen.enums; public enum Environment { - TEST { - public String toString(){ - return "TEST"; - } - }, - LIVE{ - public String toString(){ - return "LIVE"; - } - } + TEST { + public String toString() { + return "TEST"; + } + }, + LIVE { + public String toString() { + return "LIVE"; + } + } } diff --git a/src/main/java/com/adyen/enums/VatCategory.java b/src/main/java/com/adyen/enums/VatCategory.java index 703ce4fdf..4cfed5269 100644 --- a/src/main/java/com/adyen/enums/VatCategory.java +++ b/src/main/java/com/adyen/enums/VatCategory.java @@ -1,4 +1,4 @@ -/** +/* * ###### * ###### * ############ ####( ###### #####. ###### ############ ############ @@ -22,17 +22,17 @@ public enum VatCategory { HIGH { - public String toString(){ + public String toString() { return "High"; } }, LOW { - public String toString(){ + public String toString() { return "Low"; } }, NONE { - public String toString(){ + public String toString() { return "None"; } } diff --git a/src/main/java/com/adyen/httpclient/ClientInterface.java b/src/main/java/com/adyen/httpclient/ClientInterface.java index bcb7cbca2..46c75b4ea 100644 --- a/src/main/java/com/adyen/httpclient/ClientInterface.java +++ b/src/main/java/com/adyen/httpclient/ClientInterface.java @@ -21,6 +21,7 @@ package com.adyen.httpclient; import com.adyen.Config; +import com.adyen.model.RequestOptions; import java.io.IOException; import java.util.Map; @@ -29,5 +30,7 @@ public interface ClientInterface { String request(String endpoint, String json, Config config) throws IOException, HTTPClientException; String request(String endpoint, String json, Config config, boolean isApiKeyRequired) throws IOException, HTTPClientException; + String request(String endpoint, String json, Config config, boolean isApiKeyRequired, RequestOptions requestOptions) throws IOException, HTTPClientException; + String post(String endpoint, Map postParameters, Config config) throws IOException, HTTPClientException; } diff --git a/src/main/java/com/adyen/httpclient/HTTPClientException.java b/src/main/java/com/adyen/httpclient/HTTPClientException.java index b2adfdc45..4c856c499 100644 --- a/src/main/java/com/adyen/httpclient/HTTPClientException.java +++ b/src/main/java/com/adyen/httpclient/HTTPClientException.java @@ -1,4 +1,4 @@ -/** +/* * ###### * ###### * ############ ####( ###### #####. ###### ############ ############ @@ -28,7 +28,8 @@ public class HTTPClientException extends Exception { private Map> responseHeaders = null; private String responseBody = null; - public HTTPClientException() {} + public HTTPClientException() { + } public HTTPClientException(Throwable throwable) { super(throwable); diff --git a/src/main/java/com/adyen/httpclient/HttpURLConnectionClient.java b/src/main/java/com/adyen/httpclient/HttpURLConnectionClient.java index 772ae2b29..7bb53fb3d 100644 --- a/src/main/java/com/adyen/httpclient/HttpURLConnectionClient.java +++ b/src/main/java/com/adyen/httpclient/HttpURLConnectionClient.java @@ -20,10 +20,6 @@ */ package com.adyen.httpclient; -import com.adyen.Client; -import com.adyen.Config; -import org.apache.commons.codec.binary.Base64; - import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; @@ -34,6 +30,17 @@ import java.net.URLEncoder; import java.util.Map; import java.util.Scanner; +import org.apache.commons.codec.binary.Base64; +import com.adyen.Client; +import com.adyen.Config; +import com.adyen.model.RequestOptions; +import static com.adyen.constants.ApiConstants.RequestProperty.ACCEPT_CHARSET; +import static com.adyen.constants.ApiConstants.RequestProperty.API_KEY; +import static com.adyen.constants.ApiConstants.RequestProperty.APPLICATION_JSON_TYPE; +import static com.adyen.constants.ApiConstants.RequestProperty.CONTENT_TYPE; +import static com.adyen.constants.ApiConstants.RequestProperty.IDEMPOTENCY_KEY; +import static com.adyen.constants.ApiConstants.RequestProperty.METHOD_POST; +import static com.adyen.constants.ApiConstants.RequestProperty.USER_AGENT; public class HttpURLConnectionClient implements ClientInterface { private static final String CHARSET = "UTF-8"; @@ -53,19 +60,24 @@ public String request(String requestUrl, String requestBody, Config config) thro } @Override - public String request(String requestUrl, String requestBody, Config config, boolean isApiKeyRequired) throws IOException, HTTPClientException { - HttpURLConnection httpConnection = createRequest(requestUrl, config.getApplicationName()); + public String request(String endpoint, String json, Config config, boolean isApiKeyRequired) throws IOException, HTTPClientException { + return request(endpoint, json, config, isApiKeyRequired, null); + } + + @Override + public String request(String requestUrl, String requestBody, Config config, boolean isApiKeyRequired, RequestOptions requestOptions) throws IOException, HTTPClientException { + HttpURLConnection httpConnection = createRequest(requestUrl, config.getApplicationName(), requestOptions); String apiKey = config.getApiKey(); int connectionTimeoutMillis = config.getConnectionTimeoutMillis(); // Use Api key if required or if provided - if (isApiKeyRequired || (apiKey != null && !apiKey.isEmpty())) { + if (isApiKeyRequired || (apiKey != null && ! apiKey.isEmpty())) { setApiKey(httpConnection, apiKey); } else { setBasicAuthentication(httpConnection, config.getUsername(), config.getPassword()); } httpConnection.setConnectTimeout(connectionTimeoutMillis); - setContentType(httpConnection, "application/json"); + setContentType(httpConnection, APPLICATION_JSON_TYPE); return doPostRequest(httpConnection, requestBody); } @@ -117,6 +129,13 @@ private String getQuery(Map params) throws UnsupportedEncodingEx * Initialize the httpConnection */ private HttpURLConnection createRequest(String requestUrl, String applicationName) throws IOException { + return createRequest(requestUrl, applicationName, null); + } + + /** + * Initialize the httpConnection + */ + private HttpURLConnection createRequest(String requestUrl, String applicationName, RequestOptions requestOptions) throws IOException { URL targetUrl = new URL(requestUrl); HttpURLConnection httpConnection; @@ -128,11 +147,13 @@ private HttpURLConnection createRequest(String requestUrl, String applicationNam } httpConnection.setUseCaches(false); httpConnection.setDoOutput(true); - httpConnection.setRequestMethod("POST"); - - httpConnection.setRequestProperty("Accept-Charset", CHARSET); - httpConnection.setRequestProperty("User-Agent", String.format("%s %s%s", applicationName, Client.USER_AGENT_SUFFIX, Client.LIB_VERSION)); + httpConnection.setRequestMethod(METHOD_POST); + httpConnection.setRequestProperty(ACCEPT_CHARSET, CHARSET); + httpConnection.setRequestProperty(USER_AGENT, String.format("%s %s%s", applicationName, Client.USER_AGENT_SUFFIX, Client.LIB_VERSION)); + if (requestOptions != null && requestOptions.getIdempotencyKey() != null) { + httpConnection.setRequestProperty(IDEMPOTENCY_KEY, requestOptions.getIdempotencyKey()); + } return httpConnection; } @@ -153,7 +174,7 @@ private HttpURLConnection setBasicAuthentication(HttpURLConnection httpConnectio * Sets content type */ private HttpURLConnection setContentType(HttpURLConnection httpConnection, String contentType) { - httpConnection.setRequestProperty("Content-Type", contentType); + httpConnection.setRequestProperty(CONTENT_TYPE, contentType); return httpConnection; } @@ -161,8 +182,8 @@ private HttpURLConnection setContentType(HttpURLConnection httpConnection, Strin * Sets api key */ private HttpURLConnection setApiKey(HttpURLConnection httpConnection, String apiKey) { - if (apiKey != null && !apiKey.isEmpty()) { - httpConnection.setRequestProperty("x-api-key", apiKey); + if (apiKey != null && ! apiKey.isEmpty()) { + httpConnection.setRequestProperty(API_KEY, apiKey); } return httpConnection; } diff --git a/src/main/java/com/adyen/model/Address.java b/src/main/java/com/adyen/model/Address.java index 8607383ed..8eaa519c1 100644 --- a/src/main/java/com/adyen/model/Address.java +++ b/src/main/java/com/adyen/model/Address.java @@ -1,4 +1,4 @@ -/** +/* * ###### * ###### * ############ ####( ###### #####. ###### ############ ############ @@ -27,175 +27,181 @@ * Address */ public class Address { - @SerializedName("city") - private String city = null; - - @SerializedName("country") - private String country = null; - - @SerializedName("houseNumberOrName") - private String houseNumberOrName = null; - - @SerializedName("postalCode") - private String postalCode = null; - - @SerializedName("stateOrProvince") - private String stateOrProvince = null; - - @SerializedName("street") - private String street = null; - - public Address city(String city) { - this.city = city; - return this; - } - - /** - * the city - * @return city - **/ - public String getCity() { - return city; - } - - public void setCity(String city) { - this.city = city; - } - - public Address country(String country) { - this.country = country; - return this; - } - - /** - * the two letter country code (ISO 3166-1) - * @return country - **/ - public String getCountry() { - return country; - } - - public void setCountry(String country) { - this.country = country; - } - - public Address houseNumberOrName(String houseNumberOrName) { - this.houseNumberOrName = houseNumberOrName; - return this; - } - - /** - * the house number or name - * @return houseNumberOrName - **/ - public String getHouseNumberOrName() { - return houseNumberOrName; - } - - public void setHouseNumberOrName(String houseNumberOrName) { - this.houseNumberOrName = houseNumberOrName; - } - - public Address postalCode(String postalCode) { - this.postalCode = postalCode; - return this; - } - - /** - * the postal / zip code - * @return postalCode - **/ - public String getPostalCode() { - return postalCode; - } - - public void setPostalCode(String postalCode) { - this.postalCode = postalCode; - } - - public Address stateOrProvince(String stateOrProvince) { - this.stateOrProvince = stateOrProvince; - return this; - } - - /** - * the state or province - * @return stateOrProvince - **/ - public String getStateOrProvince() { - return stateOrProvince; - } - - public void setStateOrProvince(String stateOrProvince) { - this.stateOrProvince = stateOrProvince; - } - - public Address street(String street) { - this.street = street; - return this; - } - - /** - * the street name - * @return street - **/ - public String getStreet() { - return street; - } - - public void setStreet(String street) { - this.street = street; - } - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - Address address = (Address) o; - return Objects.equals(this.city, address.city) && - Objects.equals(this.country, address.country) && - Objects.equals(this.houseNumberOrName, address.houseNumberOrName) && - Objects.equals(this.postalCode, address.postalCode) && - Objects.equals(this.stateOrProvince, address.stateOrProvince) && - Objects.equals(this.street, address.street); - } - - @Override - public int hashCode() { - return Objects.hash(city, country, houseNumberOrName, postalCode, stateOrProvince, street); - } - - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class Address {\n"); - - sb.append(" city: ").append(toIndentedString(city)).append("\n"); - sb.append(" country: ").append(toIndentedString(country)).append("\n"); - sb.append(" houseNumberOrName: ").append(toIndentedString(houseNumberOrName)).append("\n"); - sb.append(" postalCode: ").append(toIndentedString(postalCode)).append("\n"); - sb.append(" stateOrProvince: ").append(toIndentedString(stateOrProvince)).append("\n"); - sb.append(" street: ").append(toIndentedString(street)).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 "); - } - + @SerializedName("city") + private String city = null; + + @SerializedName("country") + private String country = null; + + @SerializedName("houseNumberOrName") + private String houseNumberOrName = null; + + @SerializedName("postalCode") + private String postalCode = null; + + @SerializedName("stateOrProvince") + private String stateOrProvince = null; + + @SerializedName("street") + private String street = null; + + public Address city(String city) { + this.city = city; + return this; + } + + /** + * the city + * + * @return city + **/ + public String getCity() { + return city; + } + + public void setCity(String city) { + this.city = city; + } + + public Address country(String country) { + this.country = country; + return this; + } + + /** + * the two letter country code (ISO 3166-1) + * + * @return country + **/ + public String getCountry() { + return country; + } + + public void setCountry(String country) { + this.country = country; + } + + public Address houseNumberOrName(String houseNumberOrName) { + this.houseNumberOrName = houseNumberOrName; + return this; + } + + /** + * the house number or name + * + * @return houseNumberOrName + **/ + public String getHouseNumberOrName() { + return houseNumberOrName; + } + + public void setHouseNumberOrName(String houseNumberOrName) { + this.houseNumberOrName = houseNumberOrName; + } + + public Address postalCode(String postalCode) { + this.postalCode = postalCode; + return this; + } + + /** + * the postal / zip code + * + * @return postalCode + **/ + public String getPostalCode() { + return postalCode; + } + + public void setPostalCode(String postalCode) { + this.postalCode = postalCode; + } + + public Address stateOrProvince(String stateOrProvince) { + this.stateOrProvince = stateOrProvince; + return this; + } + + /** + * the state or province + * + * @return stateOrProvince + **/ + public String getStateOrProvince() { + return stateOrProvince; + } + + public void setStateOrProvince(String stateOrProvince) { + this.stateOrProvince = stateOrProvince; + } + + public Address street(String street) { + this.street = street; + return this; + } + + /** + * the street name + * + * @return street + **/ + public String getStreet() { + return street; + } + + public void setStreet(String street) { + this.street = street; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Address address = (Address) o; + return Objects.equals(this.city, address.city) + && Objects.equals(this.country, address.country) + && Objects.equals(this.houseNumberOrName, address.houseNumberOrName) + && Objects.equals(this.postalCode, address.postalCode) + && Objects.equals(this.stateOrProvince, address.stateOrProvince) + && Objects.equals(this.street, address.street); + } + + @Override + public int hashCode() { + return Objects.hash(city, country, houseNumberOrName, postalCode, stateOrProvince, street); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Address {\n"); + + sb.append(" city: ").append(toIndentedString(city)).append("\n"); + sb.append(" country: ").append(toIndentedString(country)).append("\n"); + sb.append(" houseNumberOrName: ").append(toIndentedString(houseNumberOrName)).append("\n"); + sb.append(" postalCode: ").append(toIndentedString(postalCode)).append("\n"); + sb.append(" stateOrProvince: ").append(toIndentedString(stateOrProvince)).append("\n"); + sb.append(" street: ").append(toIndentedString(street)).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/BankAccount.java b/src/main/java/com/adyen/model/BankAccount.java index 509b8019d..3e990a457 100644 --- a/src/main/java/com/adyen/model/BankAccount.java +++ b/src/main/java/com/adyen/model/BankAccount.java @@ -1,4 +1,4 @@ -/** +/* * ###### * ###### * ############ ####( ###### #####. ###### ############ ############ @@ -27,241 +27,251 @@ * BankAccount */ public class BankAccount { - @SerializedName("iban") - private String iban = null; - - @SerializedName("ownerName") - private String ownerName = null; - - @SerializedName("bankName") - private String bankName = null; - - @SerializedName("taxId") - private String taxId = null; - - @SerializedName("bankCity") - private String bankCity = null; - - @SerializedName("countryCode") - private String countryCode = null; - - @SerializedName("bankAccountNumber") - private String bankAccountNumber = null; - - @SerializedName("bankLocationId") - private String bankLocationId = null; - - @SerializedName("bic") - private String bic = null; - - public BankAccount iban(String iban) { - this.iban = iban; - return this; - } - - /** - * the international bank account number - * @return iban - **/ - public String getIban() { - return iban; - } - - public void setIban(String iban) { - this.iban = iban; - } - - public BankAccount ownerName(String ownerName) { - this.ownerName = ownerName; - return this; - } - - /** - * the bank account holder name - * @return ownerName - **/ - public String getOwnerName() { - return ownerName; - } - - public void setOwnerName(String ownerName) { - this.ownerName = ownerName; - } - - public BankAccount bankName(String bankName) { - this.bankName = bankName; - return this; - } - - /** - * the name of the bank - * @return bankName - **/ - public String getBankName() { - return bankName; - } - - public void setBankName(String bankName) { - this.bankName = bankName; - } - - public BankAccount taxId(String taxId) { - this.taxId = taxId; - return this; - } - - /** - * the bank account holder TAX id - * @return taxId - **/ - public String getTaxId() { - return taxId; - } - - public void setTaxId(String taxId) { - this.taxId = taxId; - } - - public BankAccount bankCity(String bankCity) { - this.bankCity = bankCity; - return this; - } - - /** - * the bank city - * @return bankCity - **/ - public String getBankCity() { - return bankCity; - } - - public void setBankCity(String bankCity) { - this.bankCity = bankCity; - } - - public BankAccount countryCode(String countryCode) { - this.countryCode = countryCode; - return this; - } - - /** - * the two letter country code where the bank account is located (ISO 3166-1) - * @return countryCode - **/ - public String getCountryCode() { - return countryCode; - } - - public void setCountryCode(String countryCode) { - this.countryCode = countryCode; - } - - public BankAccount bankAccountNumber(String bankAccountNumber) { - this.bankAccountNumber = bankAccountNumber; - return this; - } - - /** - * the bank account number (without separators) - * @return bankAccountNumber - **/ - public String getBankAccountNumber() { - return bankAccountNumber; - } - - public void setBankAccountNumber(String bankAccountNumber) { - this.bankAccountNumber = bankAccountNumber; - } - - public BankAccount bankLocationId(String bankLocationId) { - this.bankLocationId = bankLocationId; - return this; - } - - /** - * the bank transit routing number - * @return bankLocationId - **/ - public String getBankLocationId() { - return bankLocationId; - } - - public void setBankLocationId(String bankLocationId) { - this.bankLocationId = bankLocationId; - } - - public BankAccount bic(String bic) { - this.bic = bic; - return this; - } - - /** - * the business identifier code - * @return bic - **/ - public String getBic() { - return bic; - } - - public void setBic(String bic) { - this.bic = bic; - } - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @SerializedName("iban") + private String iban = null; + + @SerializedName("ownerName") + private String ownerName = null; + + @SerializedName("bankName") + private String bankName = null; + + @SerializedName("taxId") + private String taxId = null; + + @SerializedName("bankCity") + private String bankCity = null; + + @SerializedName("countryCode") + private String countryCode = null; + + @SerializedName("bankAccountNumber") + private String bankAccountNumber = null; + + @SerializedName("bankLocationId") + private String bankLocationId = null; + + @SerializedName("bic") + private String bic = null; + + public BankAccount iban(String iban) { + this.iban = iban; + return this; + } + + /** + * the international bank account number + * + * @return iban + **/ + public String getIban() { + return iban; + } + + public void setIban(String iban) { + this.iban = iban; + } + + public BankAccount ownerName(String ownerName) { + this.ownerName = ownerName; + return this; + } + + /** + * the bank account holder name + * + * @return ownerName + **/ + public String getOwnerName() { + return ownerName; } - if (o == null || getClass() != o.getClass()) { - return false; + + public void setOwnerName(String ownerName) { + this.ownerName = ownerName; + } + + public BankAccount bankName(String bankName) { + this.bankName = bankName; + return this; + } + + /** + * the name of the bank + * + * @return bankName + **/ + public String getBankName() { + return bankName; + } + + public void setBankName(String bankName) { + this.bankName = bankName; + } + + public BankAccount taxId(String taxId) { + this.taxId = taxId; + return this; } - BankAccount bankAccount = (BankAccount) o; - return Objects.equals(this.iban, bankAccount.iban) && - Objects.equals(this.ownerName, bankAccount.ownerName) && - Objects.equals(this.bankName, bankAccount.bankName) && - Objects.equals(this.taxId, bankAccount.taxId) && - Objects.equals(this.bankCity, bankAccount.bankCity) && - Objects.equals(this.countryCode, bankAccount.countryCode) && - Objects.equals(this.bankAccountNumber, bankAccount.bankAccountNumber) && - Objects.equals(this.bankLocationId, bankAccount.bankLocationId) && - Objects.equals(this.bic, bankAccount.bic); - } - - @Override - public int hashCode() { - return Objects.hash(iban, ownerName, bankName, taxId, bankCity, countryCode, bankAccountNumber, bankLocationId, bic); - } - - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class BankAccount {\n"); - - sb.append(" iban: ").append(toIndentedString(iban)).append("\n"); - sb.append(" ownerName: ").append(toIndentedString(ownerName)).append("\n"); - sb.append(" bankName: ").append(toIndentedString(bankName)).append("\n"); - sb.append(" taxId: ").append(toIndentedString(taxId)).append("\n"); - sb.append(" bankCity: ").append(toIndentedString(bankCity)).append("\n"); - sb.append(" countryCode: ").append(toIndentedString(countryCode)).append("\n"); - sb.append(" bankAccountNumber: ").append(toIndentedString(bankAccountNumber)).append("\n"); - sb.append(" bankLocationId: ").append(toIndentedString(bankLocationId)).append("\n"); - sb.append(" bic: ").append(toIndentedString(bic)).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"; + + /** + * the bank account holder TAX id + * + * @return taxId + **/ + public String getTaxId() { + return taxId; + } + + public void setTaxId(String taxId) { + this.taxId = taxId; + } + + public BankAccount bankCity(String bankCity) { + this.bankCity = bankCity; + return this; + } + + /** + * the bank city + * + * @return bankCity + **/ + public String getBankCity() { + return bankCity; + } + + public void setBankCity(String bankCity) { + this.bankCity = bankCity; } - return o.toString().replace("\n", "\n "); - } - + + public BankAccount countryCode(String countryCode) { + this.countryCode = countryCode; + return this; + } + + /** + * the two letter country code where the bank account is located (ISO 3166-1) + * + * @return countryCode + **/ + public String getCountryCode() { + return countryCode; + } + + public void setCountryCode(String countryCode) { + this.countryCode = countryCode; + } + + public BankAccount bankAccountNumber(String bankAccountNumber) { + this.bankAccountNumber = bankAccountNumber; + return this; + } + + /** + * the bank account number (without separators) + * + * @return bankAccountNumber + **/ + public String getBankAccountNumber() { + return bankAccountNumber; + } + + public void setBankAccountNumber(String bankAccountNumber) { + this.bankAccountNumber = bankAccountNumber; + } + + public BankAccount bankLocationId(String bankLocationId) { + this.bankLocationId = bankLocationId; + return this; + } + + /** + * the bank transit routing number + * + * @return bankLocationId + **/ + public String getBankLocationId() { + return bankLocationId; + } + + public void setBankLocationId(String bankLocationId) { + this.bankLocationId = bankLocationId; + } + + public BankAccount bic(String bic) { + this.bic = bic; + return this; + } + + /** + * the business identifier code + * + * @return bic + **/ + public String getBic() { + return bic; + } + + public void setBic(String bic) { + this.bic = bic; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BankAccount bankAccount = (BankAccount) o; + return Objects.equals(this.iban, bankAccount.iban) + && Objects.equals(this.ownerName, bankAccount.ownerName) + && Objects.equals(this.bankName, bankAccount.bankName) + && Objects.equals(this.taxId, + bankAccount.taxId) + && Objects.equals(this.bankCity, bankAccount.bankCity) + && Objects.equals(this.countryCode, bankAccount.countryCode) + && Objects.equals(this.bankAccountNumber, bankAccount.bankAccountNumber) + && Objects.equals(this.bankLocationId, bankAccount.bankLocationId) + && Objects.equals(this.bic, bankAccount.bic); + } + + @Override + public int hashCode() { + return Objects.hash(iban, ownerName, bankName, taxId, bankCity, countryCode, bankAccountNumber, bankLocationId, bic); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BankAccount {\n"); + + sb.append(" iban: ").append(toIndentedString(iban)).append("\n"); + sb.append(" ownerName: ").append(toIndentedString(ownerName)).append("\n"); + sb.append(" bankName: ").append(toIndentedString(bankName)).append("\n"); + sb.append(" taxId: ").append(toIndentedString(taxId)).append("\n"); + sb.append(" bankCity: ").append(toIndentedString(bankCity)).append("\n"); + sb.append(" countryCode: ").append(toIndentedString(countryCode)).append("\n"); + sb.append(" bankAccountNumber: ").append(toIndentedString(bankAccountNumber)).append("\n"); + sb.append(" bankLocationId: ").append(toIndentedString(bankLocationId)).append("\n"); + sb.append(" bic: ").append(toIndentedString(bic)).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/BrowserInfo.java b/src/main/java/com/adyen/model/BrowserInfo.java index 36da557f3..3a8784d92 100644 --- a/src/main/java/com/adyen/model/BrowserInfo.java +++ b/src/main/java/com/adyen/model/BrowserInfo.java @@ -1,4 +1,4 @@ -/** +/* * ###### * ###### * ############ ####( ###### #####. ###### ############ ############ @@ -27,87 +27,88 @@ * BrowserInfo */ public class BrowserInfo { - @SerializedName("userAgent") - private String userAgent = null; - - @SerializedName("acceptHeader") - private String acceptHeader = null; - - public BrowserInfo userAgent(String userAgent) { - this.userAgent = userAgent; - return this; - } - - /** - * the user agent value of the shopper's browser - * @return userAgent - **/ - public String getUserAgent() { - return userAgent; - } - - public void setUserAgent(String userAgent) { - this.userAgent = userAgent; - } - - public BrowserInfo acceptHeader(String acceptHeader) { - this.acceptHeader = acceptHeader; - return this; - } - - /** - * the accept header value of the shopper's browser - * @return acceptHeader - **/ - public String getAcceptHeader() { - return acceptHeader; - } - - public void setAcceptHeader(String acceptHeader) { - this.acceptHeader = acceptHeader; - } - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @SerializedName("userAgent") + private String userAgent = null; + + @SerializedName("acceptHeader") + private String acceptHeader = null; + + public BrowserInfo userAgent(String userAgent) { + this.userAgent = userAgent; + return this; + } + + /** + * the user agent value of the shopper's browser + * + * @return userAgent + **/ + public String getUserAgent() { + return userAgent; + } + + public void setUserAgent(String userAgent) { + this.userAgent = userAgent; + } + + public BrowserInfo acceptHeader(String acceptHeader) { + this.acceptHeader = acceptHeader; + return this; } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * the accept header value of the shopper's browser + * + * @return acceptHeader + **/ + public String getAcceptHeader() { + return acceptHeader; } - BrowserInfo browserInfo = (BrowserInfo) o; - return Objects.equals(this.userAgent, browserInfo.userAgent) && - Objects.equals(this.acceptHeader, browserInfo.acceptHeader); - } - - @Override - public int hashCode() { - return Objects.hash(userAgent, acceptHeader); - } - - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class BrowserInfo {\n"); - - sb.append(" userAgent: ").append(toIndentedString(userAgent)).append("\n"); - sb.append(" acceptHeader: ").append(toIndentedString(acceptHeader)).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"; + + public void setAcceptHeader(String acceptHeader) { + this.acceptHeader = acceptHeader; } - return o.toString().replace("\n", "\n "); - } - + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BrowserInfo browserInfo = (BrowserInfo) o; + return Objects.equals(this.userAgent, browserInfo.userAgent) && Objects.equals(this.acceptHeader, browserInfo.acceptHeader); + } + + @Override + public int hashCode() { + return Objects.hash(userAgent, acceptHeader); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BrowserInfo {\n"); + + sb.append(" userAgent: ").append(toIndentedString(userAgent)).append("\n"); + sb.append(" acceptHeader: ").append(toIndentedString(acceptHeader)).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/Card.java b/src/main/java/com/adyen/model/Card.java index 70bee7d91..d966ab4ce 100644 --- a/src/main/java/com/adyen/model/Card.java +++ b/src/main/java/com/adyen/model/Card.java @@ -1,4 +1,4 @@ -/** +/* * ###### * ###### * ############ ####( ###### #####. ###### ############ ############ @@ -27,219 +27,228 @@ * Card */ public class Card { - @SerializedName("expiryMonth") - private String expiryMonth = null; - - @SerializedName("expiryYear") - private String expiryYear = null; - - @SerializedName("cvc") - private String cvc = null; - - @SerializedName("holderName") - private String holderName = null; - - @SerializedName("issueNumber") - private String issueNumber = null; - - @SerializedName("number") - private String number = null; - - @SerializedName("startMonth") - private String startMonth = null; - - @SerializedName("startYear") - private String startYear = null; - - public Card expiryMonth(String expiryMonth) { - this.expiryMonth = expiryMonth; - return this; - } - - /** - * the month component of the expiry date (may be left padded with 0 for single digits) - * @return expiryMonth - **/ - public String getExpiryMonth() { - return expiryMonth; - } - - public void setExpiryMonth(String expiryMonth) { - this.expiryMonth = expiryMonth; - } - - public Card expiryYear(String expiryYear) { - this.expiryYear = expiryYear; - return this; - } - - /** - * the year component of the expiry date - * @return expiryYear - **/ - public String getExpiryYear() { - return expiryYear; - } - - public void setExpiryYear(String expiryYear) { - this.expiryYear = expiryYear; - } - - public Card cvc(String cvc) { - this.cvc = cvc; - return this; - } - - /** - * the card security code which, depending on card brand, is referred to as CVV2/CVC2 (three digits) or CID (4 digits) - * @return cvc - **/ - public String getCvc() { - return cvc; - } - - public void setCvc(String cvc) { - this.cvc = cvc; - } - - public Card holderName(String holderName) { - this.holderName = holderName; - return this; - } - - /** - * the cardholder name as printed on the card - * @return holderName - **/ - public String getHolderName() { - return holderName; - } - - public void setHolderName(String holderName) { - this.holderName = holderName; - } - - public Card issueNumber(String issueNumber) { - this.issueNumber = issueNumber; - return this; - } - - /** - * for some UK debit cards only the issue number of the card - * @return issueNumber - **/ - public String getIssueNumber() { - return issueNumber; - } - - public void setIssueNumber(String issueNumber) { - this.issueNumber = issueNumber; - } - - public Card number(String number) { - this.number = number; - return this; - } - - /** - * the card number (without separators) - * @return number - **/ - public String getNumber() { - return number; - } - - public void setNumber(String number) { - this.number = number; - } - - public Card startMonth(String startMonth) { - this.startMonth = startMonth; - return this; - } - - /** - * for some UK debit cards only the month component of the start date - * @return startMonth - **/ - public String getStartMonth() { - return startMonth; - } - - public void setStartMonth(String startMonth) { - this.startMonth = startMonth; - } - - public Card startYear(String startYear) { - this.startYear = startYear; - return this; - } - - /** - * for some UK debit cards only the year component of the start date - * @return startYear - **/ - public String getStartYear() { - return startYear; - } - - public void setStartYear(String startYear) { - this.startYear = startYear; - } - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - Card card = (Card) o; - return Objects.equals(this.expiryMonth, card.expiryMonth) && - Objects.equals(this.expiryYear, card.expiryYear) && - Objects.equals(this.cvc, card.cvc) && - Objects.equals(this.holderName, card.holderName) && - Objects.equals(this.issueNumber, card.issueNumber) && - Objects.equals(this.number, card.number) && - Objects.equals(this.startMonth, card.startMonth) && - Objects.equals(this.startYear, card.startYear); - } - - @Override - public int hashCode() { - return Objects.hash(expiryMonth, expiryYear, cvc, holderName, issueNumber, number, startMonth, startYear); - } - - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class Card {\n"); - - sb.append(" expiryMonth: ").append(toIndentedString(expiryMonth)).append("\n"); - sb.append(" expiryYear: ").append(toIndentedString(expiryYear)).append("\n"); - sb.append(" cvc: ").append(toIndentedString(cvc)).append("\n"); - sb.append(" holderName: ").append(toIndentedString(holderName)).append("\n"); - sb.append(" issueNumber: ").append(toIndentedString(issueNumber)).append("\n"); - sb.append(" number: ").append(toIndentedString(number)).append("\n"); - sb.append(" startMonth: ").append(toIndentedString(startMonth)).append("\n"); - sb.append(" startYear: ").append(toIndentedString(startYear)).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 "); - } - + @SerializedName("expiryMonth") + private String expiryMonth = null; + + @SerializedName("expiryYear") + private String expiryYear = null; + + @SerializedName("cvc") + private String cvc = null; + + @SerializedName("holderName") + private String holderName = null; + + @SerializedName("issueNumber") + private String issueNumber = null; + + @SerializedName("number") + private String number = null; + + @SerializedName("startMonth") + private String startMonth = null; + + @SerializedName("startYear") + private String startYear = null; + + public Card expiryMonth(String expiryMonth) { + this.expiryMonth = expiryMonth; + return this; + } + + /** + * the month component of the expiry date (may be left padded with 0 for single digits) + * + * @return expiryMonth + **/ + public String getExpiryMonth() { + return expiryMonth; + } + + public void setExpiryMonth(String expiryMonth) { + this.expiryMonth = expiryMonth; + } + + public Card expiryYear(String expiryYear) { + this.expiryYear = expiryYear; + return this; + } + + /** + * the year component of the expiry date + * + * @return expiryYear + **/ + public String getExpiryYear() { + return expiryYear; + } + + public void setExpiryYear(String expiryYear) { + this.expiryYear = expiryYear; + } + + public Card cvc(String cvc) { + this.cvc = cvc; + return this; + } + + /** + * the card security code which, depending on card brand, is referred to as CVV2/CVC2 (three digits) or CID (4 digits) + * + * @return cvc + **/ + public String getCvc() { + return cvc; + } + + public void setCvc(String cvc) { + this.cvc = cvc; + } + + public Card holderName(String holderName) { + this.holderName = holderName; + return this; + } + + /** + * the cardholder name as printed on the card + * + * @return holderName + **/ + public String getHolderName() { + return holderName; + } + + public void setHolderName(String holderName) { + this.holderName = holderName; + } + + public Card issueNumber(String issueNumber) { + this.issueNumber = issueNumber; + return this; + } + + /** + * for some UK debit cards only the issue number of the card + * + * @return issueNumber + **/ + public String getIssueNumber() { + return issueNumber; + } + + public void setIssueNumber(String issueNumber) { + this.issueNumber = issueNumber; + } + + public Card number(String number) { + this.number = number; + return this; + } + + /** + * the card number (without separators) + * + * @return number + **/ + public String getNumber() { + return number; + } + + public void setNumber(String number) { + this.number = number; + } + + public Card startMonth(String startMonth) { + this.startMonth = startMonth; + return this; + } + + /** + * for some UK debit cards only the month component of the start date + * + * @return startMonth + **/ + public String getStartMonth() { + return startMonth; + } + + public void setStartMonth(String startMonth) { + this.startMonth = startMonth; + } + + public Card startYear(String startYear) { + this.startYear = startYear; + return this; + } + + /** + * for some UK debit cards only the year component of the start date + * + * @return startYear + **/ + public String getStartYear() { + return startYear; + } + + public void setStartYear(String startYear) { + this.startYear = startYear; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Card card = (Card) o; + return Objects.equals(this.expiryMonth, card.expiryMonth) + && Objects.equals(this.expiryYear, card.expiryYear) + && Objects.equals(this.cvc, card.cvc) + && Objects.equals(this.holderName, + card.holderName) + && Objects.equals(this.issueNumber, card.issueNumber) + && Objects.equals(this.number, card.number) + && Objects.equals(this.startMonth, card.startMonth) + && Objects.equals(this.startYear, card.startYear); + } + + @Override + public int hashCode() { + return Objects.hash(expiryMonth, expiryYear, cvc, holderName, issueNumber, number, startMonth, startYear); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Card {\n"); + + sb.append(" expiryMonth: ").append(toIndentedString(expiryMonth)).append("\n"); + sb.append(" expiryYear: ").append(toIndentedString(expiryYear)).append("\n"); + sb.append(" cvc: ").append(toIndentedString(cvc)).append("\n"); + sb.append(" holderName: ").append(toIndentedString(holderName)).append("\n"); + sb.append(" issueNumber: ").append(toIndentedString(issueNumber)).append("\n"); + sb.append(" number: ").append(toIndentedString(number)).append("\n"); + sb.append(" startMonth: ").append(toIndentedString(startMonth)).append("\n"); + sb.append(" startYear: ").append(toIndentedString(startYear)).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/ELV.java b/src/main/java/com/adyen/model/ELV.java index 40838d782..3fd81e374 100644 --- a/src/main/java/com/adyen/model/ELV.java +++ b/src/main/java/com/adyen/model/ELV.java @@ -1,4 +1,4 @@ -/** +/* * ###### * ###### * ############ ####( ###### #####. ###### ############ ############ @@ -27,153 +27,158 @@ * ELV */ public class ELV { - @SerializedName("bankName") - private String bankName = null; - - @SerializedName("bankAccountNumber") - private String bankAccountNumber = null; - - @SerializedName("bankLocationId") - private String bankLocationId = null; - - @SerializedName("bankLocation") - private String bankLocation = null; - - @SerializedName("accountHolderName") - private String accountHolderName = null; - - public ELV bankName(String bankName) { - this.bankName = bankName; - return this; - } - - /** - * Get bankName - * @return bankName - **/ - public String getBankName() { - return bankName; - } - - public void setBankName(String bankName) { - this.bankName = bankName; - } - - public ELV bankAccountNumber(String bankAccountNumber) { - this.bankAccountNumber = bankAccountNumber; - return this; - } - - /** - * Get bankAccountNumber - * @return bankAccountNumber - **/ - public String getBankAccountNumber() { - return bankAccountNumber; - } - - public void setBankAccountNumber(String bankAccountNumber) { - this.bankAccountNumber = bankAccountNumber; - } - - public ELV bankLocationId(String bankLocationId) { - this.bankLocationId = bankLocationId; - return this; - } - - /** - * Get bankLocationId - * @return bankLocationId - **/ - public String getBankLocationId() { - return bankLocationId; - } - - public void setBankLocationId(String bankLocationId) { - this.bankLocationId = bankLocationId; - } - - public ELV bankLocation(String bankLocation) { - this.bankLocation = bankLocation; - return this; - } - - /** - * Get bankLocation - * @return bankLocation - **/ - public String getBankLocation() { - return bankLocation; - } - - public void setBankLocation(String bankLocation) { - this.bankLocation = bankLocation; - } - - public ELV accountHolderName(String accountHolderName) { - this.accountHolderName = accountHolderName; - return this; - } - - /** - * Get accountHolderName - * @return accountHolderName - **/ - public String getAccountHolderName() { - return accountHolderName; - } - - public void setAccountHolderName(String accountHolderName) { - this.accountHolderName = accountHolderName; - } - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - ELV ELV = (ELV) o; - return Objects.equals(this.bankName, ELV.bankName) && - Objects.equals(this.bankAccountNumber, ELV.bankAccountNumber) && - Objects.equals(this.bankLocationId, ELV.bankLocationId) && - Objects.equals(this.bankLocation, ELV.bankLocation) && - Objects.equals(this.accountHolderName, ELV.accountHolderName); - } - - @Override - public int hashCode() { - return Objects.hash(bankName, bankAccountNumber, bankLocationId, bankLocation, accountHolderName); - } - - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class ELV {\n"); - - sb.append(" bankName: ").append(toIndentedString(bankName)).append("\n"); - sb.append(" bankAccountNumber: ").append(toIndentedString(bankAccountNumber)).append("\n"); - sb.append(" bankLocationId: ").append(toIndentedString(bankLocationId)).append("\n"); - sb.append(" bankLocation: ").append(toIndentedString(bankLocation)).append("\n"); - sb.append(" accountHolderName: ").append(toIndentedString(accountHolderName)).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 "); - } - + @SerializedName("bankName") + private String bankName = null; + + @SerializedName("bankAccountNumber") + private String bankAccountNumber = null; + + @SerializedName("bankLocationId") + private String bankLocationId = null; + + @SerializedName("bankLocation") + private String bankLocation = null; + + @SerializedName("accountHolderName") + private String accountHolderName = null; + + public ELV bankName(String bankName) { + this.bankName = bankName; + return this; + } + + /** + * Get bankName + * + * @return bankName + **/ + public String getBankName() { + return bankName; + } + + public void setBankName(String bankName) { + this.bankName = bankName; + } + + public ELV bankAccountNumber(String bankAccountNumber) { + this.bankAccountNumber = bankAccountNumber; + return this; + } + + /** + * Get bankAccountNumber + * + * @return bankAccountNumber + **/ + public String getBankAccountNumber() { + return bankAccountNumber; + } + + public void setBankAccountNumber(String bankAccountNumber) { + this.bankAccountNumber = bankAccountNumber; + } + + public ELV bankLocationId(String bankLocationId) { + this.bankLocationId = bankLocationId; + return this; + } + + /** + * Get bankLocationId + * + * @return bankLocationId + **/ + public String getBankLocationId() { + return bankLocationId; + } + + public void setBankLocationId(String bankLocationId) { + this.bankLocationId = bankLocationId; + } + + public ELV bankLocation(String bankLocation) { + this.bankLocation = bankLocation; + return this; + } + + /** + * Get bankLocation + * + * @return bankLocation + **/ + public String getBankLocation() { + return bankLocation; + } + + public void setBankLocation(String bankLocation) { + this.bankLocation = bankLocation; + } + + public ELV accountHolderName(String accountHolderName) { + this.accountHolderName = accountHolderName; + return this; + } + + /** + * Get accountHolderName + * + * @return accountHolderName + **/ + public String getAccountHolderName() { + return accountHolderName; + } + + public void setAccountHolderName(String accountHolderName) { + this.accountHolderName = accountHolderName; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ELV elv = (ELV) o; + return Objects.equals(this.bankName, elv.bankName) + && Objects.equals(this.bankAccountNumber, elv.bankAccountNumber) + && Objects.equals(this.bankLocationId, elv.bankLocationId) + && Objects.equals(this.bankLocation, elv.bankLocation) + && Objects.equals(this.accountHolderName, elv.accountHolderName); + } + + @Override + public int hashCode() { + return Objects.hash(bankName, bankAccountNumber, bankLocationId, bankLocation, accountHolderName); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ELV {\n"); + + sb.append(" bankName: ").append(toIndentedString(bankName)).append("\n"); + sb.append(" bankAccountNumber: ").append(toIndentedString(bankAccountNumber)).append("\n"); + sb.append(" bankLocationId: ").append(toIndentedString(bankLocationId)).append("\n"); + sb.append(" bankLocation: ").append(toIndentedString(bankLocation)).append("\n"); + sb.append(" accountHolderName: ").append(toIndentedString(accountHolderName)).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/ForexQuote.java b/src/main/java/com/adyen/model/ForexQuote.java index c6dafe05c..f41f2ce48 100644 --- a/src/main/java/com/adyen/model/ForexQuote.java +++ b/src/main/java/com/adyen/model/ForexQuote.java @@ -1,4 +1,4 @@ -/** +/* * ###### * ###### * ############ ####( ###### #####. ###### ############ ############ @@ -28,307 +28,320 @@ * ForexQuote */ public class ForexQuote { - @SerializedName("reference") - private String reference = null; - - @SerializedName("interbank") - private Amount interbank = null; - - @SerializedName("sell") - private Amount sell = null; - - @SerializedName("buy") - private Amount buy = null; - - @SerializedName("validTill") - private Date validTill = null; - - @SerializedName("basePoints") - private Integer basePoints = null; - - @SerializedName("source") - private String source = null; - - @SerializedName("signature") - private String signature = null; - - @SerializedName("type") - private String type = null; - - @SerializedName("baseAmount") - private Amount baseAmount = null; - - @SerializedName("account") - private String account = null; - - @SerializedName("accountType") - private String accountType = null; - - public ForexQuote reference(String reference) { - this.reference = reference; - return this; - } - - /** - * the reference assigned to the forex quote request - * @return reference - **/ - public String getReference() { - return reference; - } - - public void setReference(String reference) { - this.reference = reference; - } - - public ForexQuote interbank(Amount interbank) { - this.interbank = interbank; - return this; - } - - /** - * Get interbank - * @return interbank - **/ - public Amount getInterbank() { - return interbank; - } - - public void setInterbank(Amount interbank) { - this.interbank = interbank; - } - - public ForexQuote sell(Amount sell) { - this.sell = sell; - return this; - } - - /** - * the sell rate - * @return sell - **/ - public Amount getSell() { - return sell; - } - - public void setSell(Amount sell) { - this.sell = sell; - } - - public ForexQuote buy(Amount buy) { - this.buy = buy; - return this; - } - - /** - * the buy rate - * @return buy - **/ - public Amount getBuy() { - return buy; - } - - public void setBuy(Amount buy) { - this.buy = buy; - } - - public ForexQuote validTill(Date validTill) { - this.validTill = validTill; - return this; - } - - /** - * Get validTill - * @return validTill - **/ - public Date getValidTill() { - return validTill; - } - - public void setValidTill(Date validTill) { - this.validTill = validTill; - } - - public ForexQuote basePoints(Integer basePoints) { - this.basePoints = basePoints; - return this; - } - - /** - * Get basePoints - * @return basePoints - **/ - public Integer getBasePoints() { - return basePoints; - } - - public void setBasePoints(Integer basePoints) { - this.basePoints = basePoints; - } - - public ForexQuote source(String source) { - this.source = source; - return this; - } - - /** - * the source of the forex quote - * @return source - **/ - public String getSource() { - return source; - } - - public void setSource(String source) { - this.source = source; - } - - public ForexQuote signature(String signature) { - this.signature = signature; - return this; - } - - /** - * the signature to validate the integrity - * @return signature - **/ - public String getSignature() { - return signature; - } - - public void setSignature(String signature) { - this.signature = signature; - } - - public ForexQuote type(String type) { - this.type = type; - return this; - } - - /** - * the type of forex - * @return type - **/ - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - public ForexQuote baseAmount(Amount baseAmount) { - this.baseAmount = baseAmount; - return this; - } - - /** - * the base amount - * @return baseAmount - **/ - public Amount getBaseAmount() { - return baseAmount; - } - - public void setBaseAmount(Amount baseAmount) { - this.baseAmount = baseAmount; - } - - public ForexQuote account(String account) { - this.account = account; - return this; - } - - /** - * the account name - * @return account - **/ - public String getAccount() { - return account; - } - - public void setAccount(String account) { - this.account = account; - } - - public ForexQuote accountType(String accountType) { - this.accountType = accountType; - return this; - } - - /** - * the account type - * @return accountType - **/ - public String getAccountType() { - return accountType; - } - - public void setAccountType(String accountType) { - this.accountType = accountType; - } - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - ForexQuote forexQuote = (ForexQuote) o; - return Objects.equals(this.reference, forexQuote.reference) && - Objects.equals(this.interbank, forexQuote.interbank) && - Objects.equals(this.sell, forexQuote.sell) && - Objects.equals(this.buy, forexQuote.buy) && - Objects.equals(this.validTill, forexQuote.validTill) && - Objects.equals(this.basePoints, forexQuote.basePoints) && - Objects.equals(this.source, forexQuote.source) && - Objects.equals(this.signature, forexQuote.signature) && - Objects.equals(this.type, forexQuote.type) && - Objects.equals(this.baseAmount, forexQuote.baseAmount) && - Objects.equals(this.account, forexQuote.account) && - Objects.equals(this.accountType, forexQuote.accountType); - } - - @Override - public int hashCode() { - return Objects.hash(reference, interbank, sell, buy, validTill, basePoints, source, signature, type, baseAmount, account, accountType); - } - - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class ForexQuote {\n"); - - sb.append(" reference: ").append(toIndentedString(reference)).append("\n"); - sb.append(" interbank: ").append(toIndentedString(interbank)).append("\n"); - sb.append(" sell: ").append(toIndentedString(sell)).append("\n"); - sb.append(" buy: ").append(toIndentedString(buy)).append("\n"); - sb.append(" validTill: ").append(toIndentedString(validTill)).append("\n"); - sb.append(" basePoints: ").append(toIndentedString(basePoints)).append("\n"); - sb.append(" source: ").append(toIndentedString(source)).append("\n"); - sb.append(" signature: ").append(toIndentedString(signature)).append("\n"); - sb.append(" type: ").append(toIndentedString(type)).append("\n"); - sb.append(" baseAmount: ").append(toIndentedString(baseAmount)).append("\n"); - sb.append(" account: ").append(toIndentedString(account)).append("\n"); - sb.append(" accountType: ").append(toIndentedString(accountType)).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 "); - } - + @SerializedName("reference") + private String reference = null; + + @SerializedName("interbank") + private Amount interbank = null; + + @SerializedName("sell") + private Amount sell = null; + + @SerializedName("buy") + private Amount buy = null; + + @SerializedName("validTill") + private Date validTill = null; + + @SerializedName("basePoints") + private Integer basePoints = null; + + @SerializedName("source") + private String source = null; + + @SerializedName("signature") + private String signature = null; + + @SerializedName("type") + private String type = null; + + @SerializedName("baseAmount") + private Amount baseAmount = null; + + @SerializedName("account") + private String account = null; + + @SerializedName("accountType") + private String accountType = null; + + public ForexQuote reference(String reference) { + this.reference = reference; + return this; + } + + /** + * the reference assigned to the forex quote request + * + * @return reference + **/ + public String getReference() { + return reference; + } + + public void setReference(String reference) { + this.reference = reference; + } + + public ForexQuote interbank(Amount interbank) { + this.interbank = interbank; + return this; + } + + /** + * Get interbank + * + * @return interbank + **/ + public Amount getInterbank() { + return interbank; + } + + public void setInterbank(Amount interbank) { + this.interbank = interbank; + } + + public ForexQuote sell(Amount sell) { + this.sell = sell; + return this; + } + + /** + * the sell rate + * + * @return sell + **/ + public Amount getSell() { + return sell; + } + + public void setSell(Amount sell) { + this.sell = sell; + } + + public ForexQuote buy(Amount buy) { + this.buy = buy; + return this; + } + + /** + * the buy rate + * + * @return buy + **/ + public Amount getBuy() { + return buy; + } + + public void setBuy(Amount buy) { + this.buy = buy; + } + + public ForexQuote validTill(Date validTill) { + this.validTill = validTill; + return this; + } + + /** + * Get validTill + * + * @return validTill + **/ + public Date getValidTill() { + return validTill; + } + + public void setValidTill(Date validTill) { + this.validTill = validTill; + } + + public ForexQuote basePoints(Integer basePoints) { + this.basePoints = basePoints; + return this; + } + + /** + * Get basePoints + * + * @return basePoints + **/ + public Integer getBasePoints() { + return basePoints; + } + + public void setBasePoints(Integer basePoints) { + this.basePoints = basePoints; + } + + public ForexQuote source(String source) { + this.source = source; + return this; + } + + /** + * the source of the forex quote + * + * @return source + **/ + public String getSource() { + return source; + } + + public void setSource(String source) { + this.source = source; + } + + public ForexQuote signature(String signature) { + this.signature = signature; + return this; + } + + /** + * the signature to validate the integrity + * + * @return signature + **/ + public String getSignature() { + return signature; + } + + public void setSignature(String signature) { + this.signature = signature; + } + + public ForexQuote type(String type) { + this.type = type; + return this; + } + + /** + * the type of forex + * + * @return type + **/ + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public ForexQuote baseAmount(Amount baseAmount) { + this.baseAmount = baseAmount; + return this; + } + + /** + * the base amount + * + * @return baseAmount + **/ + public Amount getBaseAmount() { + return baseAmount; + } + + public void setBaseAmount(Amount baseAmount) { + this.baseAmount = baseAmount; + } + + public ForexQuote account(String account) { + this.account = account; + return this; + } + + /** + * the account name + * + * @return account + **/ + public String getAccount() { + return account; + } + + public void setAccount(String account) { + this.account = account; + } + + public ForexQuote accountType(String accountType) { + this.accountType = accountType; + return this; + } + + /** + * the account type + * + * @return accountType + **/ + public String getAccountType() { + return accountType; + } + + public void setAccountType(String accountType) { + this.accountType = accountType; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ForexQuote forexQuote = (ForexQuote) o; + return Objects.equals(this.reference, forexQuote.reference) + && Objects.equals(this.interbank, forexQuote.interbank) + && Objects.equals(this.sell, forexQuote.sell) + && Objects.equals(this.buy, + forexQuote.buy) + && Objects.equals(this.validTill, forexQuote.validTill) + && Objects.equals(this.basePoints, forexQuote.basePoints) + && Objects.equals(this.source, forexQuote.source) + && Objects.equals(this.signature, forexQuote.signature) + && Objects.equals(this.type, forexQuote.type) + && Objects.equals(this.baseAmount, forexQuote.baseAmount) + && Objects.equals(this.account, forexQuote.account) + && Objects.equals(this.accountType, forexQuote.accountType); + } + + @Override + public int hashCode() { + return Objects.hash(reference, interbank, sell, buy, validTill, basePoints, source, signature, type, baseAmount, account, accountType); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ForexQuote {\n"); + + sb.append(" reference: ").append(toIndentedString(reference)).append("\n"); + sb.append(" interbank: ").append(toIndentedString(interbank)).append("\n"); + sb.append(" sell: ").append(toIndentedString(sell)).append("\n"); + sb.append(" buy: ").append(toIndentedString(buy)).append("\n"); + sb.append(" validTill: ").append(toIndentedString(validTill)).append("\n"); + sb.append(" basePoints: ").append(toIndentedString(basePoints)).append("\n"); + sb.append(" source: ").append(toIndentedString(source)).append("\n"); + sb.append(" signature: ").append(toIndentedString(signature)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" baseAmount: ").append(toIndentedString(baseAmount)).append("\n"); + sb.append(" account: ").append(toIndentedString(account)).append("\n"); + sb.append(" accountType: ").append(toIndentedString(accountType)).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/FraudCheckResult.java b/src/main/java/com/adyen/model/FraudCheckResult.java index 11100103c..c8b7f19cc 100644 --- a/src/main/java/com/adyen/model/FraudCheckResult.java +++ b/src/main/java/com/adyen/model/FraudCheckResult.java @@ -1,4 +1,4 @@ -/** +/* * ###### * ###### * ############ ####( ###### #####. ###### ############ ############ @@ -27,109 +27,110 @@ * FraudCheckResult */ public class FraudCheckResult { - @SerializedName("name") - private String name = null; - - @SerializedName("accountScore") - private Integer accountScore = null; - - @SerializedName("checkId") - private Integer checkId = null; - - public FraudCheckResult name(String name) { - this.name = name; - return this; - } - - /** - * the name of the risk check - * @return name - **/ - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public FraudCheckResult accountScore(Integer accountScore) { - this.accountScore = accountScore; - return this; - } - - /** - * the fraud score generated by the risk check - * @return accountScore - **/ - public Integer getAccountScore() { - return accountScore; - } - - public void setAccountScore(Integer accountScore) { - this.accountScore = accountScore; - } - - public FraudCheckResult checkId(Integer checkId) { - this.checkId = checkId; - return this; - } - - /** - * the id of the risk check - * @return checkId - **/ - public Integer getCheckId() { - return checkId; - } - - public void setCheckId(Integer checkId) { - this.checkId = checkId; - } - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @SerializedName("name") + private String name = null; + + @SerializedName("accountScore") + private Integer accountScore = null; + + @SerializedName("checkId") + private Integer checkId = null; + + public FraudCheckResult name(String name) { + this.name = name; + return this; + } + + /** + * the name of the risk check + * + * @return name + **/ + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public FraudCheckResult accountScore(Integer accountScore) { + this.accountScore = accountScore; + return this; + } + + /** + * the fraud score generated by the risk check + * + * @return accountScore + **/ + public Integer getAccountScore() { + return accountScore; + } + + public void setAccountScore(Integer accountScore) { + this.accountScore = accountScore; + } + + public FraudCheckResult checkId(Integer checkId) { + this.checkId = checkId; + return this; + } + + /** + * the id of the risk check + * + * @return checkId + **/ + public Integer getCheckId() { + return checkId; + } + + public void setCheckId(Integer checkId) { + this.checkId = checkId; } - if (o == null || getClass() != o.getClass()) { - return false; + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FraudCheckResult fraudCheckResult = (FraudCheckResult) o; + return Objects.equals(this.name, fraudCheckResult.name) && Objects.equals(this.accountScore, fraudCheckResult.accountScore) && Objects.equals(this.checkId, fraudCheckResult.checkId); } - FraudCheckResult fraudCheckResult = (FraudCheckResult) o; - return Objects.equals(this.name, fraudCheckResult.name) && - Objects.equals(this.accountScore, fraudCheckResult.accountScore) && - Objects.equals(this.checkId, fraudCheckResult.checkId); - } - - @Override - public int hashCode() { - return Objects.hash(name, accountScore, checkId); - } - - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class FraudCheckResult {\n"); - - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" accountScore: ").append(toIndentedString(accountScore)).append("\n"); - sb.append(" checkId: ").append(toIndentedString(checkId)).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"; + + @Override + public int hashCode() { + return Objects.hash(name, accountScore, checkId); } - return o.toString().replace("\n", "\n "); - } - + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FraudCheckResult {\n"); + + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" accountScore: ").append(toIndentedString(accountScore)).append("\n"); + sb.append(" checkId: ").append(toIndentedString(checkId)).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/Installments.java b/src/main/java/com/adyen/model/Installments.java index 228a2bda6..a46cd563a 100644 --- a/src/main/java/com/adyen/model/Installments.java +++ b/src/main/java/com/adyen/model/Installments.java @@ -1,4 +1,4 @@ -/** +/* * ###### * ###### * ############ ####( ###### #####. ###### ############ ############ @@ -27,65 +27,66 @@ * Installments */ public class Installments { - @SerializedName("value") - private Integer value = null; + @SerializedName("value") + private Integer value = null; - public Installments value(Integer value) { - this.value = value; - return this; - } + public Installments value(Integer value) { + this.value = value; + return this; + } - /** - * the number of installments in which the payment will be divided - * @return value - **/ - public Integer getValue() { - return value; - } + /** + * the number of installments in which the payment will be divided + * + * @return value + **/ + public Integer getValue() { + return value; + } - public void setValue(Integer value) { - this.value = value; - } + public void setValue(Integer value) { + this.value = value; + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Installments installments = (Installments) o; + return Objects.equals(this.value, installments.value); } - if (o == null || getClass() != o.getClass()) { - return false; - } - Installments installments = (Installments) o; - return Objects.equals(this.value, installments.value); - } - @Override - public int hashCode() { - return Objects.hash(value); - } + @Override + public int hashCode() { + return Objects.hash(value); + } - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class Installments {\n"); + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Installments {\n"); - sb.append(" value: ").append(toIndentedString(value)).append("\n"); - sb.append("}"); - return sb.toString(); - } + sb.append(" value: ").append(toIndentedString(value)).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"; + /** + * 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 "); } - return o.toString().replace("\n", "\n "); - } - + } diff --git a/src/main/java/com/adyen/model/Name.java b/src/main/java/com/adyen/model/Name.java index ab8e04b92..38151e9b4 100644 --- a/src/main/java/com/adyen/model/Name.java +++ b/src/main/java/com/adyen/model/Name.java @@ -1,4 +1,4 @@ -/** +/* * ###### * ###### * ############ ####( ###### #####. ###### ############ ############ @@ -27,156 +27,157 @@ * Name */ public class Name { - @SerializedName("infix") - private String infix = null; + @SerializedName("infix") + private String infix = null; + + /** + * the gender + */ + public enum GenderEnum { + @SerializedName("MALE") + MALE("MALE"), + + @SerializedName("FEMALE") + FEMALE("FEMALE"), + + @SerializedName("UNKNOWN") + UNKNOWN("UNKNOWN"); + + private String value; + + GenderEnum(String value) { + this.value = value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + } + + @SerializedName("gender") + private GenderEnum gender = null; + + @SerializedName("lastName") + private String lastName = null; + + @SerializedName("firstName") + private String firstName = null; - /** - * the gender - */ - public enum GenderEnum { - @SerializedName("MALE") - MALE("MALE"), - - @SerializedName("FEMALE") - FEMALE("FEMALE"), - - @SerializedName("UNKNOWN") - UNKNOWN("UNKNOWN"); + public Name infix(String infix) { + this.infix = infix; + return this; + } + + /** + * the infix + * + * @return infix + **/ + public String getInfix() { + return infix; + } - private String value; + public void setInfix(String infix) { + this.infix = infix; + } + + public Name gender(GenderEnum gender) { + this.gender = gender; + return this; + } - GenderEnum(String value) { - this.value = value; + /** + * the gender + * + * @return gender + **/ + public GenderEnum getGender() { + return gender; } + public void setGender(GenderEnum gender) { + this.gender = gender; + } + + public Name lastName(String lastName) { + this.lastName = lastName; + return this; + } + + /** + * the last name + * + * @return lastName + **/ + public String getLastName() { + return lastName; + } + + public void setLastName(String lastName) { + this.lastName = lastName; + } + + public Name firstName(String firstName) { + this.firstName = firstName; + return this; + } + + /** + * the first name + * + * @return firstName + **/ + public String getFirstName() { + return firstName; + } + + public void setFirstName(String firstName) { + this.firstName = firstName; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Name name = (Name) o; + return Objects.equals(this.infix, name.infix) && Objects.equals(this.gender, name.gender) && Objects.equals(this.lastName, name.lastName) && Objects.equals(this.firstName, name.firstName); + } + + @Override + public int hashCode() { + return Objects.hash(infix, gender, lastName, firstName); + } + + @Override public String toString() { - return String.valueOf(value); - } - } - - @SerializedName("gender") - private GenderEnum gender = null; - - @SerializedName("lastName") - private String lastName = null; - - @SerializedName("firstName") - private String firstName = null; - - public Name infix(String infix) { - this.infix = infix; - return this; - } - - /** - * the infix - * @return infix - **/ - public String getInfix() { - return infix; - } - - public void setInfix(String infix) { - this.infix = infix; - } - - public Name gender(GenderEnum gender) { - this.gender = gender; - return this; - } - - /** - * the gender - * @return gender - **/ - public GenderEnum getGender() { - return gender; - } - - public void setGender(GenderEnum gender) { - this.gender = gender; - } - - public Name lastName(String lastName) { - this.lastName = lastName; - return this; - } - - /** - * the last name - * @return lastName - **/ - public String getLastName() { - return lastName; - } - - public void setLastName(String lastName) { - this.lastName = lastName; - } - - public Name firstName(String firstName) { - this.firstName = firstName; - return this; - } - - /** - * the first name - * @return firstName - **/ - public String getFirstName() { - return firstName; - } - - public void setFirstName(String firstName) { - this.firstName = firstName; - } - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - Name name = (Name) o; - return Objects.equals(this.infix, name.infix) && - Objects.equals(this.gender, name.gender) && - Objects.equals(this.lastName, name.lastName) && - Objects.equals(this.firstName, name.firstName); - } - - @Override - public int hashCode() { - return Objects.hash(infix, gender, lastName, firstName); - } - - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class Name {\n"); - - sb.append(" infix: ").append(toIndentedString(infix)).append("\n"); - sb.append(" gender: ").append(toIndentedString(gender)).append("\n"); - sb.append(" lastName: ").append(toIndentedString(lastName)).append("\n"); - sb.append(" firstName: ").append(toIndentedString(firstName)).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 "); - } - + StringBuilder sb = new StringBuilder(); + sb.append("class Name {\n"); + + sb.append(" infix: ").append(toIndentedString(infix)).append("\n"); + sb.append(" gender: ").append(toIndentedString(gender)).append("\n"); + sb.append(" lastName: ").append(toIndentedString(lastName)).append("\n"); + sb.append(" firstName: ").append(toIndentedString(firstName)).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/PaymentResult.java b/src/main/java/com/adyen/model/PaymentResult.java index 863b2465f..e9226d96f 100644 --- a/src/main/java/com/adyen/model/PaymentResult.java +++ b/src/main/java/com/adyen/model/PaymentResult.java @@ -20,8 +20,6 @@ */ package com.adyen.model; -import java.text.ParseException; -import java.text.SimpleDateFormat; import java.util.Date; import java.util.Map; import java.util.Objects; diff --git a/src/main/java/com/adyen/model/RequestOptions.java b/src/main/java/com/adyen/model/RequestOptions.java new file mode 100644 index 000000000..73fc4fbd8 --- /dev/null +++ b/src/main/java/com/adyen/model/RequestOptions.java @@ -0,0 +1,16 @@ +package com.adyen.model; + +public class RequestOptions { + + private String idempotencyKey; + + public String getIdempotencyKey() { + return idempotencyKey; + } + + public void setIdempotencyKey(String idempotencyKey) { + this.idempotencyKey = idempotencyKey; + } + + +} diff --git a/src/main/java/com/adyen/model/ThreeDSecureData.java b/src/main/java/com/adyen/model/ThreeDSecureData.java index 4f23998df..54aa9f718 100644 --- a/src/main/java/com/adyen/model/ThreeDSecureData.java +++ b/src/main/java/com/adyen/model/ThreeDSecureData.java @@ -1,4 +1,4 @@ -/** +/* * ###### * ###### * ############ ####( ###### #####. ###### ############ ############ @@ -27,231 +27,231 @@ * ThreeDSecureData */ public class ThreeDSecureData { - @SerializedName("cavvAlgorithm") - private String cavvAlgorithm = null; - - /** - * the enrollment response from the 3D directory server - */ - public enum DirectoryResponseEnum { - @SerializedName("Y") - Y("Y"), - - @SerializedName("N") - N("N"), - - @SerializedName("U") - U("U"), - - @SerializedName("E") - E("E"); - - private String value; - - DirectoryResponseEnum(String value) { - this.value = value; + @SerializedName("cavvAlgorithm") + private String cavvAlgorithm = null; + + /** + * the enrollment response from the 3D directory server + */ + public enum DirectoryResponseEnum { + @SerializedName("Y") + Y("Y"), + + @SerializedName("N") + N("N"), + + @SerializedName("U") + U("U"), + + @SerializedName("E") + E("E"); + + private String value; + + DirectoryResponseEnum(String value) { + this.value = value; + } + + @Override + public String toString() { + return String.valueOf(value); + } } - @Override - public String toString() { - return String.valueOf(value); + @SerializedName("directoryResponse") + private DirectoryResponseEnum directoryResponse = null; + + /** + * the authentication response if the shopper was redirected + */ + public enum AuthenticationResponseEnum { + @SerializedName("Y") + Y("Y"), + + @SerializedName("N") + N("N"), + + @SerializedName("U") + U("U"), + + @SerializedName("A") + A("A"); + + private String value; + + AuthenticationResponseEnum(String value) { + this.value = value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + } + + @SerializedName("authenticationResponse") + private AuthenticationResponseEnum authenticationResponse = null; + + @SerializedName("xid") + private String xid = null; + + @SerializedName("cavv") + private String cavv = null; + + @SerializedName("eci") + private String eci = null; + + public ThreeDSecureData cavvAlgorithm(String cavvAlgorithm) { + this.cavvAlgorithm = cavvAlgorithm; + return this; + } + + /** + * the CAVV algorithm used + * @return cavvAlgorithm + **/ + public String getCavvAlgorithm() { + return cavvAlgorithm; + } + + public void setCavvAlgorithm(String cavvAlgorithm) { + this.cavvAlgorithm = cavvAlgorithm; + } + + public ThreeDSecureData directoryResponse(DirectoryResponseEnum directoryResponse) { + this.directoryResponse = directoryResponse; + return this; + } + + /** + * the enrollment response from the 3D directory server + * @return directoryResponse + **/ + public DirectoryResponseEnum getDirectoryResponse() { + return directoryResponse; + } + + public void setDirectoryResponse(DirectoryResponseEnum directoryResponse) { + this.directoryResponse = directoryResponse; } - } - - @SerializedName("directoryResponse") - private DirectoryResponseEnum directoryResponse = null; - - /** - * the authentication response if the shopper was redirected - */ - public enum AuthenticationResponseEnum { - @SerializedName("Y") - Y("Y"), - - @SerializedName("N") - N("N"), - - @SerializedName("U") - U("U"), - - @SerializedName("A") - A("A"); - - private String value; - - AuthenticationResponseEnum(String value) { - this.value = value; + + public ThreeDSecureData authenticationResponse(AuthenticationResponseEnum authenticationResponse) { + this.authenticationResponse = authenticationResponse; + return this; + } + + /** + * the authentication response if the shopper was redirected + * @return authenticationResponse + **/ + public AuthenticationResponseEnum getAuthenticationResponse() { + return authenticationResponse; + } + + public void setAuthenticationResponse(AuthenticationResponseEnum authenticationResponse) { + this.authenticationResponse = authenticationResponse; + } + + public ThreeDSecureData xid(String xid) { + this.xid = xid; + return this; + } + + /** + * the transaction identifier (base64 encoded, 20 bytes in decoded form) + * @return xid + **/ + public String getXid() { + return xid; + } + + public void setXid(String xid) { + this.xid = xid; + } + + public ThreeDSecureData cavv(String cavv) { + this.cavv = cavv; + return this; + } + + /** + * the cardholder authentication value (base64 encoded, 20 bytes in decoded form) + * @return cavv + **/ + public String getCavv() { + return cavv; + } + + public void setCavv(String cavv) { + this.cavv = cavv; } + public ThreeDSecureData eci(String eci) { + this.eci = eci; + return this; + } + + /** + * the electronic commerce indicator + * @return eci + **/ + public String getEci() { + return eci; + } + + public void setEci(String eci) { + this.eci = eci; + } + + @Override - public String toString() { - return String.valueOf(value); + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ThreeDSecureData threeDSecureData = (ThreeDSecureData) o; + return Objects.equals(this.cavvAlgorithm, threeDSecureData.cavvAlgorithm) + && Objects.equals(this.directoryResponse, threeDSecureData.directoryResponse) + && Objects.equals(this.authenticationResponse, threeDSecureData.authenticationResponse) + && Objects.equals(this.xid, threeDSecureData.xid) + && Objects.equals(this.cavv, threeDSecureData.cavv) + && Objects.equals(this.eci, threeDSecureData.eci); } - } - - @SerializedName("authenticationResponse") - private AuthenticationResponseEnum authenticationResponse = null; - - @SerializedName("xid") - private String xid = null; - - @SerializedName("cavv") - private String cavv = null; - - @SerializedName("eci") - private String eci = null; - - public ThreeDSecureData cavvAlgorithm(String cavvAlgorithm) { - this.cavvAlgorithm = cavvAlgorithm; - return this; - } - - /** - * the CAVV algorithm used - * @return cavvAlgorithm - **/ - public String getCavvAlgorithm() { - return cavvAlgorithm; - } - - public void setCavvAlgorithm(String cavvAlgorithm) { - this.cavvAlgorithm = cavvAlgorithm; - } - - public ThreeDSecureData directoryResponse(DirectoryResponseEnum directoryResponse) { - this.directoryResponse = directoryResponse; - return this; - } - - /** - * the enrollment response from the 3D directory server - * @return directoryResponse - **/ - public DirectoryResponseEnum getDirectoryResponse() { - return directoryResponse; - } - - public void setDirectoryResponse(DirectoryResponseEnum directoryResponse) { - this.directoryResponse = directoryResponse; - } - - public ThreeDSecureData authenticationResponse(AuthenticationResponseEnum authenticationResponse) { - this.authenticationResponse = authenticationResponse; - return this; - } - - /** - * the authentication response if the shopper was redirected - * @return authenticationResponse - **/ - public AuthenticationResponseEnum getAuthenticationResponse() { - return authenticationResponse; - } - - public void setAuthenticationResponse(AuthenticationResponseEnum authenticationResponse) { - this.authenticationResponse = authenticationResponse; - } - - public ThreeDSecureData xid(String xid) { - this.xid = xid; - return this; - } - - /** - * the transaction identifier (base64 encoded, 20 bytes in decoded form) - * @return xid - **/ - public String getXid() { - return xid; - } - - public void setXid(String xid) { - this.xid = xid; - } - - public ThreeDSecureData cavv(String cavv) { - this.cavv = cavv; - return this; - } - - /** - * the cardholder authentication value (base64 encoded, 20 bytes in decoded form) - * @return cavv - **/ - public String getCavv() { - return cavv; - } - - public void setCavv(String cavv) { - this.cavv = cavv; - } - - public ThreeDSecureData eci(String eci) { - this.eci = eci; - return this; - } - - /** - * the electronic commerce indicator - * @return eci - **/ - public String getEci() { - return eci; - } - - public void setEci(String eci) { - this.eci = eci; - } - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + + @Override + public int hashCode() { + return Objects.hash(cavvAlgorithm, directoryResponse, authenticationResponse, xid, cavv, eci); } - if (o == null || getClass() != o.getClass()) { - return false; + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ThreeDSecureData {\n"); + + sb.append(" cavvAlgorithm: ").append(toIndentedString(cavvAlgorithm)).append("\n"); + sb.append(" directoryResponse: ").append(toIndentedString(directoryResponse)).append("\n"); + sb.append(" authenticationResponse: ").append(toIndentedString(authenticationResponse)).append("\n"); + sb.append(" xid: ").append(toIndentedString(xid)).append("\n"); + sb.append(" cavv: ").append(toIndentedString(cavv)).append("\n"); + sb.append(" eci: ").append(toIndentedString(eci)).append("\n"); + sb.append("}"); + return sb.toString(); } - ThreeDSecureData threeDSecureData = (ThreeDSecureData) o; - return Objects.equals(this.cavvAlgorithm, threeDSecureData.cavvAlgorithm) && - Objects.equals(this.directoryResponse, threeDSecureData.directoryResponse) && - Objects.equals(this.authenticationResponse, threeDSecureData.authenticationResponse) && - Objects.equals(this.xid, threeDSecureData.xid) && - Objects.equals(this.cavv, threeDSecureData.cavv) && - Objects.equals(this.eci, threeDSecureData.eci); - } - - @Override - public int hashCode() { - return Objects.hash(cavvAlgorithm, directoryResponse, authenticationResponse, xid, cavv, eci); - } - - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class ThreeDSecureData {\n"); - - sb.append(" cavvAlgorithm: ").append(toIndentedString(cavvAlgorithm)).append("\n"); - sb.append(" directoryResponse: ").append(toIndentedString(directoryResponse)).append("\n"); - sb.append(" authenticationResponse: ").append(toIndentedString(authenticationResponse)).append("\n"); - sb.append(" xid: ").append(toIndentedString(xid)).append("\n"); - sb.append(" cavv: ").append(toIndentedString(cavv)).append("\n"); - sb.append(" eci: ").append(toIndentedString(eci)).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"; + + /** + * 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 "); } - return o.toString().replace("\n", "\n "); - } - + } diff --git a/src/main/java/com/adyen/model/TokenDetails.java b/src/main/java/com/adyen/model/TokenDetails.java index 6aec31267..c8c3eacc2 100644 --- a/src/main/java/com/adyen/model/TokenDetails.java +++ b/src/main/java/com/adyen/model/TokenDetails.java @@ -1,4 +1,4 @@ -/** +/* * ###### * ###### * ############ ####( ###### #####. ###### ############ ############ @@ -28,86 +28,87 @@ * TokenDetails */ public class TokenDetails { - @SerializedName("tokenDataType") - private String tokenDataType = null; - - @SerializedName("tokenData") - private Map tokenData = null; - - public TokenDetails tokenDataType(String tokenDataType) { - this.tokenDataType = tokenDataType; - return this; - } - - /** - * Get tokenDataType - * @return tokenDataType - **/ - public String getTokenDataType() { - return tokenDataType; - } - - public void setTokenDataType(String tokenDataType) { - this.tokenDataType = tokenDataType; - } - - public TokenDetails tokenData(Map tokenData) { - this.tokenData = tokenData; - return this; - } - - /** - * Get tokenData - * @return tokenData - */ - public Map getTokenData() { - return tokenData; - } - - public void setTokenData(Map tokenData) { - this.tokenData = tokenData; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @SerializedName("tokenDataType") + private String tokenDataType = null; + + @SerializedName("tokenData") + private Map tokenData = null; + + public TokenDetails tokenDataType(String tokenDataType) { + this.tokenDataType = tokenDataType; + return this; + } + + /** + * Get tokenDataType + * + * @return tokenDataType + **/ + public String getTokenDataType() { + return tokenDataType; + } + + public void setTokenDataType(String tokenDataType) { + this.tokenDataType = tokenDataType; + } + + public TokenDetails tokenData(Map tokenData) { + this.tokenData = tokenData; + return this; + } + + /** + * Get tokenData + * + * @return tokenData + */ + public Map getTokenData() { + return tokenData; } - if (o == null || getClass() != o.getClass()) { - return false; + + public void setTokenData(Map tokenData) { + this.tokenData = tokenData; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TokenDetails tokenDetails = (TokenDetails) o; + return Objects.equals(this.tokenDataType, tokenDetails.tokenDataType) && Objects.equals(this.tokenData, tokenDetails.tokenData); } - TokenDetails tokenDetails = (TokenDetails) o; - return Objects.equals(this.tokenDataType, tokenDetails.tokenDataType) && - Objects.equals(this.tokenData, tokenDetails.tokenData); - } - - @Override - public int hashCode() { - return Objects.hash(tokenDataType, tokenData); - } - - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class TokenDetails {\n"); - - sb.append(" tokenDataType: ").append(toIndentedString(tokenDataType)).append("\n"); - sb.append(" tokenData: ").append(toIndentedString(tokenData)).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"; + + @Override + public int hashCode() { + return Objects.hash(tokenDataType, tokenData); } - return o.toString().replace("\n", "\n "); - } - + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TokenDetails {\n"); + + sb.append(" tokenDataType: ").append(toIndentedString(tokenDataType)).append("\n"); + sb.append(" tokenData: ").append(toIndentedString(tokenData)).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/DefaultPaymentMethodDetails.java b/src/main/java/com/adyen/model/checkout/DefaultPaymentMethodDetails.java new file mode 100755 index 000000000..ed2858193 --- /dev/null +++ b/src/main/java/com/adyen/model/checkout/DefaultPaymentMethodDetails.java @@ -0,0 +1,328 @@ +/* + * ###### + * ###### + * ############ ####( ###### #####. ###### ############ ############ + * ############# #####( ###### #####. ###### ############# ############# + * ###### #####( ###### #####. ###### ##### ###### ##### ###### + * ###### ###### #####( ###### #####. ###### ##### ##### ##### ###### + * ###### ###### #####( ###### #####. ###### ##### ##### ###### + * ############# ############# ############# ############# ##### ###### + * ############ ############ ############# ############ ##### ###### + * ###### + * ############# + * ############ + * + * Adyen Java API Library + * + * Copyright (c) 2017 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 com.adyen.model.Address; +import com.google.gson.annotations.SerializedName; + +public class DefaultPaymentMethodDetails implements PaymentMethodDetails { + @SerializedName("type") + private String type; + @SerializedName("number") + private String number; + @SerializedName("expiryMonth") + private String expiryMonth; + @SerializedName("expiryYear") + private String expiryYear; + @SerializedName("holderName") + private String holderName; + @SerializedName("cvc") + private String cvc; + @SerializedName("installmentConfigurationKey") + private String installmentConfigurationKey; + @SerializedName("personalDetails") + private PersonalDetails personalDetails; + @SerializedName("billingAddress") + private Address billingAddress; + @SerializedName("deliveryAddress") + private Address deliveryAddress; + @SerializedName("encryptedCardNumber") + private String encryptedCardNumber; + @SerializedName("encryptedExpiryMonth") + private String encryptedExpiryMonth; + @SerializedName("encryptedExpiryYear") + private String encryptedExpiryYear; + @SerializedName("encryptedSecurityCode") + private String encryptedSecurityCode; + @SerializedName("recurringDetailReference") + private String recurringDetailReference; + @SerializedName("storeDetails") + private Boolean storeDetails; + @SerializedName("idealIssuer") + private String idealIssuer; + + @Override + public String getType() { + return type; + } + + @Override + public void setType(String type) { + this.type = type; + } + + public DefaultPaymentMethodDetails type(String type) { + this.type = type; + return this; + } + + public String getNumber() { + return number; + } + + public void setNumber(String number) { + this.number = number; + } + + public DefaultPaymentMethodDetails number(String number) { + this.number = number; + return this; + } + + public String getExpiryMonth() { + return expiryMonth; + } + + public void setExpiryMonth(String expiryMonth) { + this.expiryMonth = expiryMonth; + } + + public DefaultPaymentMethodDetails expiryMonth(String expiryMonth) { + this.expiryMonth = expiryMonth; + return this; + } + + public String getExpiryYear() { + return expiryYear; + } + + public void setExpiryYear(String expiryYear) { + this.expiryYear = expiryYear; + } + + public DefaultPaymentMethodDetails expiryYear(String expiryYear) { + this.expiryYear = expiryYear; + return this; + } + + public String getHolderName() { + return holderName; + } + + public void setHolderName(String holderName) { + this.holderName = holderName; + } + + public DefaultPaymentMethodDetails holderName(String holderName) { + this.holderName = holderName; + return this; + } + + public String getCvc() { + return cvc; + } + + public void setCvc(String cvc) { + this.cvc = cvc; + } + + public DefaultPaymentMethodDetails cvc(String cvc) { + this.cvc = cvc; + return this; + } + + public String getInstallmentConfigurationKey() { + return installmentConfigurationKey; + } + + public void setInstallmentConfigurationKey(String installmentConfigurationKey) { + this.installmentConfigurationKey = installmentConfigurationKey; + } + + public DefaultPaymentMethodDetails installmentConfigurationKey(String installmentConfigurationKey) { + this.installmentConfigurationKey = installmentConfigurationKey; + return this; + } + + public PersonalDetails getPersonalDetails() { + return personalDetails; + } + + public void setPersonalDetails(PersonalDetails personalDetails) { + this.personalDetails = personalDetails; + } + + public DefaultPaymentMethodDetails personalDetails(PersonalDetails personalDetails) { + this.personalDetails = personalDetails; + return this; + } + + public Address getBillingAddress() { + return billingAddress; + } + + public void setBillingAddress(Address billingAddress) { + this.billingAddress = billingAddress; + } + + public DefaultPaymentMethodDetails billingAddress(Address billingAddress) { + this.billingAddress = billingAddress; + return this; + } + + public Address getDeliveryAddress() { + return deliveryAddress; + } + + public void setDeliveryAddress(Address deliveryAddress) { + this.deliveryAddress = deliveryAddress; + } + + public DefaultPaymentMethodDetails deliveryAddress(Address deliveryAddress) { + this.deliveryAddress = deliveryAddress; + return this; + } + + public String getEncryptedCardNumber() { + return encryptedCardNumber; + } + + public void setEncryptedCardNumber(String encryptedCardNumber) { + this.encryptedCardNumber = encryptedCardNumber; + } + + public DefaultPaymentMethodDetails encryptedCardNumber(String encryptedCardNumber) { + this.encryptedCardNumber = encryptedCardNumber; + return this; + } + + public String getEncryptedExpiryMonth() { + return encryptedExpiryMonth; + } + + public void setEncryptedExpiryMonth(String encryptedExpiryMonth) { + this.encryptedExpiryMonth = encryptedExpiryMonth; + } + + public DefaultPaymentMethodDetails encryptedExpiryMonth(String encryptedExpiryMonth) { + this.encryptedExpiryMonth = encryptedExpiryMonth; + return this; + } + + public String getEncryptedExpiryYear() { + return encryptedExpiryYear; + } + + public void setEncryptedExpiryYear(String encryptedExpiryYear) { + this.encryptedExpiryYear = encryptedExpiryYear; + } + + public DefaultPaymentMethodDetails encryptedExpiryYear(String encryptedExpiryYear) { + this.encryptedExpiryYear = encryptedExpiryYear; + return this; + } + + public String getEncryptedSecurityCode() { + return encryptedSecurityCode; + } + + public void setEncryptedSecurityCode(String encryptedSecurityCode) { + this.encryptedSecurityCode = encryptedSecurityCode; + } + + public DefaultPaymentMethodDetails encryptedSecurityCode(String encryptedSecurityCode) { + this.encryptedSecurityCode = encryptedSecurityCode; + return this; + } + + public String getRecurringDetailReference() { + return recurringDetailReference; + } + + public void setRecurringDetailReference(String recurringDetailReference) { + this.recurringDetailReference = recurringDetailReference; + } + + public DefaultPaymentMethodDetails recurringDetailReference(String recurringDetailReference) { + this.recurringDetailReference = recurringDetailReference; + return this; + } + + public Boolean getStoreDetails() { + return storeDetails; + } + + public void setStoreDetails(Boolean storeDetails) { + this.storeDetails = storeDetails; + } + + public DefaultPaymentMethodDetails storeDetails(Boolean storeDetails) { + this.storeDetails = storeDetails; + return this; + } + + public String getIdealIssuer() { + return idealIssuer; + } + + public void setIdealIssuer(String idealIssuer) { + this.idealIssuer = idealIssuer; + } + + public DefaultPaymentMethodDetails idealIssuer(String idealIssuer) { + this.idealIssuer = idealIssuer; + return this; + } + + @Override + public String toString() { + return "DefaultPaymentMethodDetails{" + + "type='" + + type + + '\'' + + ", expiryMonth='" + + expiryMonth + + '\'' + + ", expiryYear='" + + expiryYear + + '\'' + + ", holderName='" + + holderName + + '\'' + + ", installmentConfigurationKey='" + + installmentConfigurationKey + + '\'' + + ", personalDetails=" + + personalDetails + + ", billingAddress=" + + billingAddress + + ", deliveryAddress=" + + deliveryAddress + + ", encryptedExpiryMonth='" + + encryptedExpiryMonth + + '\'' + + ", encryptedExpiryYear='" + + encryptedExpiryYear + + '\'' + + ", recurringDetailReference='" + + recurringDetailReference + + '\'' + + ", storeDetails=" + + storeDetails + + ", idealIssuer=" + + idealIssuer + + '}'; + } +} + + + diff --git a/src/main/java/com/adyen/model/checkout/InputDetail.java b/src/main/java/com/adyen/model/checkout/InputDetail.java index 7ab1a63d1..0cf57a194 100755 --- a/src/main/java/com/adyen/model/checkout/InputDetail.java +++ b/src/main/java/com/adyen/model/checkout/InputDetail.java @@ -35,7 +35,7 @@ public class InputDetail { @SerializedName("configuration") - private Map _configuration = null; + private Map configuration = null; @SerializedName("details") private List details = null; @@ -58,32 +58,32 @@ public class InputDetail { @SerializedName("value") private String value = null; - public InputDetail _configuration(Map _configuration) { - this._configuration = _configuration; + public InputDetail configuration(Map configuration) { + this.configuration = configuration; return this; } - public InputDetail putConfigurationItem(String key, String _configurationItem) { + public InputDetail putConfigurationItem(String key, String configurationItem) { - if (this._configuration == null) { - this._configuration = null; + if (this.configuration == null) { + this.configuration = null; } - this._configuration.put(key, _configurationItem); + this.configuration.put(key, configurationItem); return this; } /** * Configuration parameters for the required input. * - * @return _configuration + * @return configuration **/ public Map getConfiguration() { - return _configuration; + return configuration; } - public void setConfiguration(Map _configuration) { - this._configuration = _configuration; + public void setConfiguration(Map configuration) { + this.configuration = configuration; } public InputDetail details(List details) { @@ -246,7 +246,7 @@ public boolean equals(Object o) { return false; } InputDetail inputDetail = (InputDetail) o; - return Objects.equals(this._configuration, inputDetail._configuration) && + return Objects.equals(this.configuration, inputDetail.configuration) && Objects.equals(this.details, inputDetail.details) && Objects.equals(this.itemSearchUrl, inputDetail.itemSearchUrl) && Objects.equals(this.items, inputDetail.items) && @@ -258,7 +258,7 @@ public boolean equals(Object o) { @Override public int hashCode() { - return Objects.hash(_configuration, details, itemSearchUrl, items, key, optional, type, value); + return Objects.hash(configuration, details, itemSearchUrl, items, key, optional, type, value); } @Override @@ -266,7 +266,7 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class InputDetail {\n"); - sb.append(" _configuration: ").append(toIndentedString(_configuration)).append("\n"); + sb.append(" configuration: ").append(toIndentedString(configuration)).append("\n"); sb.append(" details: ").append(toIndentedString(details)).append("\n"); sb.append(" itemSearchUrl: ").append(toIndentedString(itemSearchUrl)).append("\n"); sb.append(" items: ").append(toIndentedString(items)).append("\n"); diff --git a/src/main/java/com/adyen/model/checkout/ModelConfiguration.java b/src/main/java/com/adyen/model/checkout/ModelConfiguration.java index d5e37f550..011f4b3f6 100755 --- a/src/main/java/com/adyen/model/checkout/ModelConfiguration.java +++ b/src/main/java/com/adyen/model/checkout/ModelConfiguration.java @@ -21,11 +21,10 @@ package com.adyen.model.checkout; +import java.util.Objects; import com.adyen.model.Installments; import com.google.gson.annotations.SerializedName; -import java.util.Objects; - /** * ModelConfiguration */ @@ -105,10 +104,9 @@ public boolean equals(Object o) { if (o == null || getClass() != o.getClass()) { return false; } - ModelConfiguration _configuration = (ModelConfiguration) o; - return Objects.equals(this.avs, _configuration.avs) && - Objects.equals(this.cardHolderNameRequired, _configuration.cardHolderNameRequired) && - Objects.equals(this.installments, _configuration.installments); + ModelConfiguration configuration = (ModelConfiguration) o; + return Objects.equals(this.avs, configuration.avs) && Objects.equals(this.cardHolderNameRequired, configuration.cardHolderNameRequired) && Objects.equals(this.installments, + configuration.installments); } @Override diff --git a/src/main/java/com/adyen/model/checkout/PaymentMethod.java b/src/main/java/com/adyen/model/checkout/PaymentMethod.java index dec381c87..2f0c97512 100755 --- a/src/main/java/com/adyen/model/checkout/PaymentMethod.java +++ b/src/main/java/com/adyen/model/checkout/PaymentMethod.java @@ -18,16 +18,13 @@ * This file is open source and available under the MIT license. * See the LICENSE file for more info. */ - - package com.adyen.model.checkout; -import com.google.gson.annotations.SerializedName; - import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.Objects; +import com.google.gson.annotations.SerializedName; /** * PaymentMethod @@ -35,7 +32,7 @@ public class PaymentMethod { @SerializedName("configuration") - private Map _configuration = null; + private Map configuration = null; @SerializedName("details") private List details = null; @@ -52,32 +49,32 @@ public class PaymentMethod { @SerializedName("type") private String type = null; - public PaymentMethod _configuration(Map _configuration) { - this._configuration = _configuration; + public PaymentMethod configuration(Map configuration) { + this.configuration = configuration; return this; } - public PaymentMethod putConfigurationItem(String key, String _configurationItem) { + public PaymentMethod putConfigurationItem(String key, String configurationItem) { - if (this._configuration == null) { - this._configuration = null; + if (this.configuration == null) { + this.configuration = null; } - this._configuration.put(key, _configurationItem); + this.configuration.put(key, configurationItem); return this; } /** * The configuration of the payment method. * - * @return _configuration + * @return configuration **/ public Map getConfiguration() { - return _configuration; + return configuration; } - public void setConfiguration(Map _configuration) { - this._configuration = _configuration; + public void setConfiguration(Map configuration) { + this.configuration = configuration; } public PaymentMethod details(List details) { @@ -193,17 +190,17 @@ public boolean equals(Object o) { return false; } PaymentMethod paymentMethod = (PaymentMethod) o; - return Objects.equals(this._configuration, paymentMethod._configuration) && - Objects.equals(this.details, paymentMethod.details) && - Objects.equals(this.group, paymentMethod.group) && - Objects.equals(this.name, paymentMethod.name) && - Objects.equals(this.paymentMethodData, paymentMethod.paymentMethodData) && - Objects.equals(this.type, paymentMethod.type); + return Objects.equals(this.configuration, paymentMethod.configuration) + && Objects.equals(this.details, paymentMethod.details) + && Objects.equals(this.group, paymentMethod.group) + && Objects.equals(this.name, paymentMethod.name) + && Objects.equals(this.paymentMethodData, paymentMethod.paymentMethodData) + && Objects.equals(this.type, paymentMethod.type); } @Override public int hashCode() { - return Objects.hash(_configuration, details, group, name, paymentMethodData, type); + return Objects.hash(configuration, details, group, name, paymentMethodData, type); } @Override @@ -211,7 +208,7 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class PaymentMethod {\n"); - sb.append(" _configuration: ").append(toIndentedString(_configuration)).append("\n"); + sb.append(" configuration: ").append(toIndentedString(configuration)).append("\n"); sb.append(" details: ").append(toIndentedString(details)).append("\n"); sb.append(" group: ").append(toIndentedString(group)).append("\n"); sb.append(" name: ").append(toIndentedString(name)).append("\n"); diff --git a/src/main/java/com/adyen/model/checkout/PaymentMethodDetails.java b/src/main/java/com/adyen/model/checkout/PaymentMethodDetails.java new file mode 100755 index 000000000..c371cf238 --- /dev/null +++ b/src/main/java/com/adyen/model/checkout/PaymentMethodDetails.java @@ -0,0 +1,26 @@ +/* + * ###### + * ###### + * ############ ####( ###### #####. ###### ############ ############ + * ############# #####( ###### #####. ###### ############# ############# + * ###### #####( ###### #####. ###### ##### ###### ##### ###### + * ###### ###### #####( ###### #####. ###### ##### ##### ##### ###### + * ###### ###### #####( ###### #####. ###### ##### ##### ###### + * ############# ############# ############# ############# ##### ###### + * ############ ############ ############# ############ ##### ###### + * ###### + * ############# + * ############ + * + * Adyen Java API Library + * + * Copyright (c) 2017 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; + +public interface PaymentMethodDetails { + String getType(); + void setType(String type); +} diff --git a/src/main/java/com/adyen/model/checkout/PaymentSessionRequest.java b/src/main/java/com/adyen/model/checkout/PaymentSessionRequest.java index abd263deb..1217a4c46 100755 --- a/src/main/java/com/adyen/model/checkout/PaymentSessionRequest.java +++ b/src/main/java/com/adyen/model/checkout/PaymentSessionRequest.java @@ -18,19 +18,25 @@ * This file is open source and available under the MIT license. * See the LICENSE file for more info. */ - package com.adyen.model.checkout; -import com.adyen.model.*; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import com.adyen.model.Address; +import com.adyen.model.Amount; +import com.adyen.model.ForexQuote; +import com.adyen.model.Installments; +import com.adyen.model.Name; 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.*; - /** * PaymentSessionRequest */ @@ -52,7 +58,7 @@ public class PaymentSessionRequest { @SerializedName("company") private Company company = null; @SerializedName("configuration") - private ModelConfiguration _configuration = null; + private ModelConfiguration configuration = null; @SerializedName("countryCode") private String countryCode = null; @SerializedName("dateOfBirth") @@ -136,7 +142,8 @@ public PaymentSessionRequest putAdditionalDataItem(String key, String additional } /** - * 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. For more information on possible key-value pairs, refer to the [additionalData section](https://docs.adyen.com/developers/api-reference/payments-api#paymentrequestadditionaldata). + * 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. For more information on possible key-value pairs, refer to the [additionalData section](https://docs.adyen.com/developers/api-reference/payments-api#paymentrequestadditionaldata). * * @return additionalData **/ @@ -208,7 +215,8 @@ public PaymentSessionRequest channel(ChannelEnum channel) { } /** - * 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 + * 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 **/ @@ -238,22 +246,22 @@ public void setCompany(Company company) { this.company = company; } - public PaymentSessionRequest _configuration(ModelConfiguration _configuration) { - this._configuration = _configuration; + public PaymentSessionRequest configuration(ModelConfiguration configuration) { + this.configuration = configuration; return this; } /** - * Get _configuration + * Get configuration * - * @return _configuration + * @return configuration **/ public ModelConfiguration getConfiguration() { - return _configuration; + return configuration; } - public void setConfiguration(ModelConfiguration _configuration) { - this._configuration = _configuration; + public void setConfiguration(ModelConfiguration configuration) { + this.configuration = configuration; } public PaymentSessionRequest countryCode(String countryCode) { @@ -506,7 +514,8 @@ public PaymentSessionRequest mcc(String mcc) { } /** - * 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. + * 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 **/ @@ -542,7 +551,8 @@ public PaymentSessionRequest merchantOrderReference(String merchantOrderReferenc } /** - * This reference allows linking multiple transactions to each other. > When providing the `merchantOrderReference` value, we also recommend you submit `retry.orderAttemptNumber`, `retry.chainAttemptNumber`, and `retry.skipRetry` values. + * This reference allows linking multiple transactions to each other. > When providing the `merchantOrderReference` value, we also recommend you submit + * `retry.orderAttemptNumber`, `retry.chainAttemptNumber`, and `retry.skipRetry` values. * * @return merchantOrderReference **/ @@ -624,7 +634,8 @@ public PaymentSessionRequest reference(String reference) { } /** - * The reference to uniquely identify a payment. This reference is used in all communication with you about the payment status. We recommend using a unique value per payment; however, it is not a requirement. If you need to provide multiple references for a transaction, separate them with hyphens (\"-\"). Maximum length: 80 characters. + * The reference to uniquely identify a payment. This reference is used in all communication with you about the payment status. We recommend using a unique value per payment; however, it is not a + * requirement. If you need to provide multiple references for a transaction, separate them with hyphens (\"-\"). Maximum length: 80 characters. * * @return reference **/ @@ -714,7 +725,8 @@ public PaymentSessionRequest shopperIP(String shopperIP) { } /** - * The shopper's IP address. 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). > This field is mandatory for some merchants depending on your business model. For more information, [contact Support](https://support.adyen.com/hc/en-us/requests/new). + * The shopper's IP address. 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). > This + * field is 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 **/ @@ -732,7 +744,12 @@ public PaymentSessionRequest shopperInteraction(ShopperInteractionEnum shopperIn } /** - * 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. + * 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 **/ @@ -879,51 +896,91 @@ public boolean equals(Object o) { return false; } PaymentSessionRequest paymentSessionRequest = (PaymentSessionRequest) o; - return Objects.equals(this.additionalData, paymentSessionRequest.additionalData) && - Objects.equals(this.amount, paymentSessionRequest.amount) && - Objects.equals(this.billingAddress, paymentSessionRequest.billingAddress) && - Objects.equals(this.captureDelayHours, paymentSessionRequest.captureDelayHours) && - Objects.equals(this.channel, paymentSessionRequest.channel) && - Objects.equals(this.company, paymentSessionRequest.company) && - Objects.equals(this._configuration, paymentSessionRequest._configuration) && - Objects.equals(this.countryCode, paymentSessionRequest.countryCode) && - Objects.equals(this.dateOfBirth, paymentSessionRequest.dateOfBirth) && - Objects.equals(this.dccQuote, paymentSessionRequest.dccQuote) && - Objects.equals(this.deliveryAddress, paymentSessionRequest.deliveryAddress) && - Objects.equals(this.deliveryDate, paymentSessionRequest.deliveryDate) && - Objects.equals(this.enableOneClick, paymentSessionRequest.enableOneClick) && - Objects.equals(this.enablePayOut, paymentSessionRequest.enablePayOut) && - Objects.equals(this.enableRecurring, paymentSessionRequest.enableRecurring) && - Objects.equals(this.entityType, paymentSessionRequest.entityType) && - Objects.equals(this.fraudOffset, paymentSessionRequest.fraudOffset) && - Objects.equals(this.html, paymentSessionRequest.html) && - Objects.equals(this.installments, paymentSessionRequest.installments) && - Objects.equals(this.lineItems, paymentSessionRequest.lineItems) && - Objects.equals(this.mcc, paymentSessionRequest.mcc) && - Objects.equals(this.merchantAccount, paymentSessionRequest.merchantAccount) && - Objects.equals(this.merchantOrderReference, paymentSessionRequest.merchantOrderReference) && - Objects.equals(this.metadata, paymentSessionRequest.metadata) && - Objects.equals(this.orderReference, paymentSessionRequest.orderReference) && - Objects.equals(this.origin, paymentSessionRequest.origin) && - Objects.equals(this.reference, paymentSessionRequest.reference) && - Objects.equals(this.returnUrl, paymentSessionRequest.returnUrl) && - Objects.equals(this.sdkVersion, paymentSessionRequest.sdkVersion) && - Objects.equals(this.sessionValidity, paymentSessionRequest.sessionValidity) && - Objects.equals(this.shopperEmail, paymentSessionRequest.shopperEmail) && - Objects.equals(this.shopperIP, paymentSessionRequest.shopperIP) && - Objects.equals(this.shopperInteraction, paymentSessionRequest.shopperInteraction) && - Objects.equals(this.shopperLocale, paymentSessionRequest.shopperLocale) && - Objects.equals(this.shopperName, paymentSessionRequest.shopperName) && - Objects.equals(this.shopperReference, paymentSessionRequest.shopperReference) && - Objects.equals(this.shopperStatement, paymentSessionRequest.shopperStatement) && - Objects.equals(this.socialSecurityNumber, paymentSessionRequest.socialSecurityNumber) && - Objects.equals(this.telephoneNumber, paymentSessionRequest.telephoneNumber) && - Objects.equals(this.token, paymentSessionRequest.token); + return Objects.equals(this.additionalData, paymentSessionRequest.additionalData) + && Objects.equals(this.amount, paymentSessionRequest.amount) + && Objects.equals(this.billingAddress, + paymentSessionRequest.billingAddress) + && Objects.equals(this.captureDelayHours, paymentSessionRequest.captureDelayHours) + && Objects.equals(this.channel, paymentSessionRequest.channel) + && Objects.equals(this.company, paymentSessionRequest.company) + && Objects.equals(this.configuration, paymentSessionRequest.configuration) + && Objects.equals(this.countryCode, paymentSessionRequest.countryCode) + && Objects.equals(this.dateOfBirth, paymentSessionRequest.dateOfBirth) + && Objects.equals(this.dccQuote, paymentSessionRequest.dccQuote) + && Objects.equals(this.deliveryAddress, paymentSessionRequest.deliveryAddress) + && Objects.equals(this.deliveryDate, paymentSessionRequest.deliveryDate) + && Objects.equals(this.enableOneClick, paymentSessionRequest.enableOneClick) + && Objects.equals(this.enablePayOut, paymentSessionRequest.enablePayOut) + && Objects.equals(this.enableRecurring, paymentSessionRequest.enableRecurring) + && Objects.equals(this.entityType, paymentSessionRequest.entityType) + && Objects.equals(this.fraudOffset, paymentSessionRequest.fraudOffset) + && Objects.equals(this.html, paymentSessionRequest.html) + && Objects.equals(this.installments, paymentSessionRequest.installments) + && Objects.equals(this.lineItems, paymentSessionRequest.lineItems) + && Objects.equals(this.mcc, paymentSessionRequest.mcc) + && Objects.equals(this.merchantAccount, paymentSessionRequest.merchantAccount) + && Objects.equals(this.merchantOrderReference, paymentSessionRequest.merchantOrderReference) + && Objects.equals(this.metadata, paymentSessionRequest.metadata) + && Objects.equals(this.orderReference, paymentSessionRequest.orderReference) + && Objects.equals(this.origin, paymentSessionRequest.origin) + && Objects.equals(this.reference, paymentSessionRequest.reference) + && Objects.equals(this.returnUrl, paymentSessionRequest.returnUrl) + && Objects.equals(this.sdkVersion, paymentSessionRequest.sdkVersion) + && Objects.equals(this.sessionValidity, paymentSessionRequest.sessionValidity) + && Objects.equals(this.shopperEmail, paymentSessionRequest.shopperEmail) + && Objects.equals(this.shopperIP, paymentSessionRequest.shopperIP) + && Objects.equals(this.shopperInteraction, paymentSessionRequest.shopperInteraction) + && Objects.equals(this.shopperLocale, paymentSessionRequest.shopperLocale) + && Objects.equals(this.shopperName, paymentSessionRequest.shopperName) + && Objects.equals(this.shopperReference, paymentSessionRequest.shopperReference) + && Objects.equals(this.shopperStatement, paymentSessionRequest.shopperStatement) + && Objects.equals(this.socialSecurityNumber, paymentSessionRequest.socialSecurityNumber) + && Objects.equals(this.telephoneNumber, paymentSessionRequest.telephoneNumber) + && Objects.equals(this.token, paymentSessionRequest.token); } @Override public int hashCode() { - return Objects.hash(additionalData, amount, billingAddress, captureDelayHours, channel, company, _configuration, countryCode, dateOfBirth, dccQuote, deliveryAddress, deliveryDate, enableOneClick, enablePayOut, enableRecurring, entityType, fraudOffset, html, installments, lineItems, mcc, merchantAccount, merchantOrderReference, metadata, orderReference, origin, reference, returnUrl, sdkVersion, sessionValidity, shopperEmail, shopperIP, shopperInteraction, shopperLocale, shopperName, shopperReference, shopperStatement, socialSecurityNumber, telephoneNumber, token); + return Objects.hash(additionalData, + amount, + billingAddress, + captureDelayHours, + channel, + company, + configuration, + countryCode, + dateOfBirth, + dccQuote, + deliveryAddress, + deliveryDate, + enableOneClick, + enablePayOut, + enableRecurring, + entityType, + fraudOffset, + html, + installments, + lineItems, + mcc, + merchantAccount, + merchantOrderReference, + metadata, + orderReference, + origin, + reference, + returnUrl, + sdkVersion, + sessionValidity, + shopperEmail, + shopperIP, + shopperInteraction, + shopperLocale, + shopperName, + shopperReference, + shopperStatement, + socialSecurityNumber, + telephoneNumber, + token); } @Override @@ -937,7 +994,7 @@ public String toString() { 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(" _configuration: ").append(toIndentedString(_configuration)).append("\n"); + sb.append(" configuration: ").append(toIndentedString(configuration)).append("\n"); sb.append(" countryCode: ").append(toIndentedString(countryCode)).append("\n"); sb.append(" dateOfBirth: ").append(toIndentedString(dateOfBirth)).append("\n"); sb.append(" dccQuote: ").append(toIndentedString(dccQuote)).append("\n"); @@ -987,7 +1044,8 @@ private String toIndentedString(Object o) { } /** - * 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 + * 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 { @@ -1082,7 +1140,12 @@ public EntityTypeEnum read(final JsonReader jsonReader) throws IOException { } /** - * 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. + * 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 { diff --git a/src/main/java/com/adyen/model/checkout/PaymentsRequest.java b/src/main/java/com/adyen/model/checkout/PaymentsRequest.java index 99b5d47a4..00e8afca5 100755 --- a/src/main/java/com/adyen/model/checkout/PaymentsRequest.java +++ b/src/main/java/com/adyen/model/checkout/PaymentsRequest.java @@ -22,23 +22,26 @@ package com.adyen.model.checkout; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.Map; +import java.util.Objects; import com.adyen.Util.Util; -import com.adyen.model.*; +import com.adyen.model.Address; +import com.adyen.model.Amount; +import com.adyen.model.BrowserInfo; +import com.adyen.model.ForexQuote; +import com.adyen.model.Installments; +import com.adyen.model.Name; +import com.adyen.serializer.DateSerializer; +import com.adyen.serializer.DateTimeGMTSerializer; 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.*; -import static com.adyen.constants.ApiConstants.PaymentMethod.ENCRYPTED_CARD_NUMBER; -import static com.adyen.constants.ApiConstants.PaymentMethod.ENCRYPTED_EXPIRY_MONTH; -import static com.adyen.constants.ApiConstants.PaymentMethod.ENCRYPTED_EXPIRY_YEAR; -import static com.adyen.constants.ApiConstants.PaymentMethod.ENCRYPTED_SECURITY_CODE; -import static com.adyen.constants.ApiConstants.PaymentMethod.HOLDER_NAME; -import static com.adyen.constants.ApiConstants.PaymentMethod.METHOD_TYPE; -import static com.adyen.constants.ApiConstants.PaymentMethod.RECURRING_DETAIL_REFERENCE; import static com.adyen.constants.ApiConstants.PaymentMethodType.TYPE_SCHEME; /** @@ -64,12 +67,14 @@ public class PaymentsRequest { @SerializedName("countryCode") private String countryCode = null; @SerializedName("dateOfBirth") + @JsonAdapter(DateSerializer.class) private Date dateOfBirth = null; @SerializedName("dccQuote") private ForexQuote dccQuote = null; @SerializedName("deliveryAddress") private Address deliveryAddress = null; @SerializedName("deliveryDate") + @JsonAdapter(DateTimeGMTSerializer.class) private Date deliveryDate = null; @SerializedName("enableOneClick") private Boolean enableOneClick = null; @@ -96,7 +101,7 @@ public class PaymentsRequest { @SerializedName("orderReference") private String orderReference = null; @SerializedName("paymentMethod") - private Map paymentMethod = null; + private PaymentMethodDetails paymentMethod = null; @SerializedName("reference") private String reference = null; @SerializedName("returnUrl") @@ -123,6 +128,8 @@ public class PaymentsRequest { private String telephoneNumber = null; @SerializedName("browserInfo") private BrowserInfo browserInfo = null; + @SerializedName("deviceFingerprint") + private String deviceFingerprint = null; public PaymentsRequest additionalData(Map additionalData) { this.additionalData = additionalData; @@ -580,51 +587,59 @@ public void setOrderReference(String orderReference) { this.orderReference = orderReference; } - public PaymentsRequest paymentMethod(Map paymentMethod) { + public PaymentMethodDetails getPaymentMethod() { + return paymentMethod; + } + + public void setPaymentMethod(PaymentMethodDetails paymentMethod) { + this.paymentMethod = paymentMethod; + } + + public PaymentsRequest paymentMethod(PaymentMethodDetails paymentMethod) { this.paymentMethod = paymentMethod; return this; } - public PaymentsRequest putPaymentMethodItem(String key, String paymentMethodItem) { + public PaymentsRequest addEncryptedCardData(String encryptedCardNumber, String encryptedExpiryMonth, String encryptedExpiryYear, String encryptedSecurityCode, String holderName) { + DefaultPaymentMethodDetails paymentMethodDetails = new DefaultPaymentMethodDetails(); + + paymentMethodDetails.type(TYPE_SCHEME).encryptedCardNumber(encryptedCardNumber).encryptedExpiryMonth(encryptedExpiryMonth).encryptedExpiryYear(encryptedExpiryYear); + if (encryptedSecurityCode != null) { + paymentMethodDetails.setEncryptedSecurityCode(encryptedSecurityCode); + } + if (holderName != null) { + paymentMethodDetails.setHolderName(holderName); + } - this.paymentMethod.put(key, paymentMethodItem); + this.paymentMethod = paymentMethodDetails; return this; } /** - * The collection that contains the type of the payment method and its specific information (e.g. `idealIssuer`). + * Add raw card data into the payment request. You need to be PCI compliant! * * @return paymentMethod - **/ - public Map getPaymentMethod() { - return paymentMethod; - } - - public void setPaymentMethod(Map paymentMethod) { - this.paymentMethod = paymentMethod; - } + */ + public PaymentsRequest addCardData(String cardNumber, String expiryMonth, String expiryYear, String securityCode, String holderName) { + DefaultPaymentMethodDetails paymentMethodDetails = new DefaultPaymentMethodDetails(); + paymentMethodDetails.type(TYPE_SCHEME).number(cardNumber).expiryMonth(expiryMonth).expiryYear(expiryYear); - public PaymentsRequest addEncryptedCardData(String encryptedCardNumber, String encryptedExpiryMonth, String encryptedExpiryYear, String encryptedSecurityCode, String holderName) { - this.paymentMethod = new HashMap<>(); - this.paymentMethod.put(METHOD_TYPE, TYPE_SCHEME); - this.paymentMethod.put(ENCRYPTED_CARD_NUMBER, encryptedCardNumber); - this.paymentMethod.put(ENCRYPTED_EXPIRY_MONTH, encryptedExpiryMonth); - this.paymentMethod.put(ENCRYPTED_EXPIRY_YEAR, encryptedExpiryYear); - if (encryptedSecurityCode != null) { - this.paymentMethod.put(ENCRYPTED_SECURITY_CODE, encryptedSecurityCode); + if (securityCode != null) { + paymentMethodDetails.setCvc(securityCode); } if (holderName != null) { - this.paymentMethod.put(HOLDER_NAME, holderName); + paymentMethodDetails.setHolderName(holderName); } + this.paymentMethod = paymentMethodDetails; return this; } public PaymentsRequest addOneClickData(String recurringDetailReference, String encryptedSecurityCode) { - this.paymentMethod = new HashMap<>(); - this.paymentMethod.put(METHOD_TYPE, TYPE_SCHEME); - this.paymentMethod.put(RECURRING_DETAIL_REFERENCE, recurringDetailReference); - this.paymentMethod.put(ENCRYPTED_SECURITY_CODE, encryptedSecurityCode); + DefaultPaymentMethodDetails paymentMethodDetails = new DefaultPaymentMethodDetails(); + paymentMethodDetails.type(TYPE_SCHEME).recurringDetailReference(recurringDetailReference).encryptedSecurityCode(encryptedSecurityCode); + + this.paymentMethod = paymentMethodDetails; return this; } @@ -873,6 +888,19 @@ public PaymentsRequest addBrowserInfoData(String userAgent, String acceptHeader) return this; } + public String getDeviceFingerprint() { + return deviceFingerprint; + } + + public void setDeviceFingerprint(String deviceFingerprint) { + this.deviceFingerprint = deviceFingerprint; + } + + public PaymentsRequest deviceFingerprint(String deviceFingerprint) { + this.deviceFingerprint = deviceFingerprint; + return this; + } + @Override public boolean equals(Object o) { if (this == o) { @@ -918,6 +946,7 @@ public boolean equals(Object o) { && Objects.equals(this.shopperReference, paymentsRequest.shopperReference) && Objects.equals(this.shopperStatement, paymentsRequest.shopperStatement) && Objects.equals(this.socialSecurityNumber, paymentsRequest.socialSecurityNumber) + && Objects.equals(this.deviceFingerprint, paymentsRequest.deviceFingerprint) && Objects.equals(this.telephoneNumber, paymentsRequest.telephoneNumber); } @@ -958,6 +987,7 @@ public int hashCode() { shopperReference, shopperStatement, socialSecurityNumber, + deviceFingerprint, telephoneNumber); } @@ -1001,6 +1031,7 @@ public String toString() { 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(" deviceFingerprint: ").append(toIndentedString(deviceFingerprint)).append("\n"); sb.append(" telephoneNumber: ").append(toIndentedString(telephoneNumber)).append("\n"); sb.append("}"); return sb.toString(); diff --git a/src/main/java/com/adyen/model/checkout/PersonalDetails.java b/src/main/java/com/adyen/model/checkout/PersonalDetails.java new file mode 100644 index 000000000..e6f475a5f --- /dev/null +++ b/src/main/java/com/adyen/model/checkout/PersonalDetails.java @@ -0,0 +1,138 @@ +/* + * ###### + * ###### + * ############ ####( ###### #####. ###### ############ ############ + * ############# #####( ###### #####. ###### ############# ############# + * ###### #####( ###### #####. ###### ##### ###### ##### ###### + * ###### ###### #####( ###### #####. ###### ##### ##### ##### ###### + * ###### ###### #####( ###### #####. ###### ##### ##### ###### + * ############# ############# ############# ############# ##### ###### + * ############ ############ ############# ############ ##### ###### + * ###### + * ############# + * ############ + * + * Adyen Java API Library + * + * Copyright (c) 2017 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 com.google.gson.annotations.SerializedName; + +public class PersonalDetails { + @SerializedName("firstName") + private String firstName; + @SerializedName("infix") + private String infix; + @SerializedName("lastName") + private String lastName; + @SerializedName("dateOfBirth") + private String dateOfBirth; + @SerializedName("telephoneNumber") + private String telephoneNumber; + @SerializedName("socialSecurityNumber") + private String socialSecurityNumber; + @SerializedName("shopperEmail") + private String shopperEmail; + + public String getFirstName() { + return firstName; + } + + public void setFirstName(String firstName) { + this.firstName = firstName; + } + + public PersonalDetails firstName(String firstName) { + this.firstName = firstName; + return this; + } + + public String getInfix() { + return infix; + } + + public void setInfix(String infix) { + this.infix = infix; + } + + public PersonalDetails infix(String infix) { + this.infix = infix; + return this; + } + + public String getLastName() { + return lastName; + } + + public PersonalDetails lastName(String lastName) { + this.lastName = lastName; + return this; + } + + public String getDateOfBirth() { + return dateOfBirth; + } + + public PersonalDetails dateOfBirth(String dateOfBirth) { + this.dateOfBirth = dateOfBirth; + return this; + } + + public String getTelephoneNumber() { + return telephoneNumber; + } + + public PersonalDetails telephoneNumber(String telephoneNumber) { + this.telephoneNumber = telephoneNumber; + return this; + } + + public String getSocialSecurityNumber() { + return socialSecurityNumber; + } + + public PersonalDetails socialSecurityNumber(String socialSecurityNumber) { + this.socialSecurityNumber = socialSecurityNumber; + return this; + } + + public String getShopperEmail() { + return shopperEmail; + } + + public PersonalDetails shopperEmail(String shopperEmail) { + this.shopperEmail = shopperEmail; + return this; + } + + @Override + public String toString() { + return "PersonalDetails{" + + "firstName='" + + firstName + + '\'' + + ", infix='" + + infix + + '\'' + + ", lastName='" + + lastName + + '\'' + + ", dateOfBirth='" + + dateOfBirth + + '\'' + + ", telephoneNumber='" + + telephoneNumber + + '\'' + + ", socialSecurityNumber='" + + socialSecurityNumber + + '\'' + + ", shopperEmail='" + + shopperEmail + + '\'' + + '}'; + } +} diff --git a/src/main/java/com/adyen/model/checkout/RecurringDetail.java b/src/main/java/com/adyen/model/checkout/RecurringDetail.java index b4acac2b7..a19827a30 100755 --- a/src/main/java/com/adyen/model/checkout/RecurringDetail.java +++ b/src/main/java/com/adyen/model/checkout/RecurringDetail.java @@ -18,16 +18,13 @@ * This file is open source and available under the MIT license. * See the LICENSE file for more info. */ - - package com.adyen.model.checkout; -import com.google.gson.annotations.SerializedName; - import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.Objects; +import com.google.gson.annotations.SerializedName; /** * RecurringDetail @@ -35,7 +32,7 @@ public class RecurringDetail { @SerializedName("configuration") - private Map _configuration = null; + private Map configuration = null; @SerializedName("details") private List details = null; @@ -55,32 +52,32 @@ public class RecurringDetail { @SerializedName("type") private String type = null; - public RecurringDetail _configuration(Map _configuration) { - this._configuration = _configuration; + public RecurringDetail configuration(Map configuration) { + this.configuration = configuration; return this; } - public RecurringDetail putConfigurationItem(String key, String _configurationItem) { + public RecurringDetail putConfigurationItem(String key, String configurationItem) { - if (this._configuration == null) { - this._configuration = null; + if (this.configuration == null) { + this.configuration = null; } - this._configuration.put(key, _configurationItem); + this.configuration.put(key, configurationItem); return this; } /** * The configuration of the payment method. * - * @return _configuration + * @return configuration **/ public Map getConfiguration() { - return _configuration; + return configuration; } - public void setConfiguration(Map _configuration) { - this._configuration = _configuration; + public void setConfiguration(Map configuration) { + this.configuration = configuration; } public RecurringDetail details(List details) { @@ -215,18 +212,18 @@ public boolean equals(Object o) { return false; } RecurringDetail recurringDetail = (RecurringDetail) o; - return Objects.equals(this._configuration, recurringDetail._configuration) && - Objects.equals(this.details, recurringDetail.details) && - Objects.equals(this.group, recurringDetail.group) && - Objects.equals(this.name, recurringDetail.name) && - Objects.equals(this.paymentMethodData, recurringDetail.paymentMethodData) && - Objects.equals(this.storedDetails, recurringDetail.storedDetails) && - Objects.equals(this.type, recurringDetail.type); + return Objects.equals(this.configuration, recurringDetail.configuration) + && Objects.equals(this.details, recurringDetail.details) + && Objects.equals(this.group, recurringDetail.group) + && Objects.equals(this.name, recurringDetail.name) + && Objects.equals(this.paymentMethodData, recurringDetail.paymentMethodData) + && Objects.equals(this.storedDetails, recurringDetail.storedDetails) + && Objects.equals(this.type, recurringDetail.type); } @Override public int hashCode() { - return Objects.hash(_configuration, details, group, name, paymentMethodData, storedDetails, type); + return Objects.hash(configuration, details, group, name, paymentMethodData, storedDetails, type); } @Override @@ -234,7 +231,7 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class RecurringDetail {\n"); - sb.append(" _configuration: ").append(toIndentedString(_configuration)).append("\n"); + sb.append(" configuration: ").append(toIndentedString(configuration)).append("\n"); sb.append(" details: ").append(toIndentedString(details)).append("\n"); sb.append(" group: ").append(toIndentedString(group)).append("\n"); sb.append(" name: ").append(toIndentedString(name)).append("\n"); diff --git a/src/main/java/com/adyen/model/marketpay/UpdateAccountHolderStateResponse.java b/src/main/java/com/adyen/model/marketpay/UpdateAccountHolderStateResponse.java index 2b56fb8cc..563fb82d8 100644 --- a/src/main/java/com/adyen/model/marketpay/UpdateAccountHolderStateResponse.java +++ b/src/main/java/com/adyen/model/marketpay/UpdateAccountHolderStateResponse.java @@ -21,7 +21,5 @@ package com.adyen.model.marketpay; -import com.adyen.model.marketpay.GetAccountHolderResponse; - public class UpdateAccountHolderStateResponse extends GetAccountHolderResponse { } diff --git a/src/main/java/com/adyen/model/marketpay/notification/ExchangeMessageContainer.java b/src/main/java/com/adyen/model/marketpay/notification/ExchangeMessageContainer.java index d600da1e3..e9594c06f 100644 --- a/src/main/java/com/adyen/model/marketpay/notification/ExchangeMessageContainer.java +++ b/src/main/java/com/adyen/model/marketpay/notification/ExchangeMessageContainer.java @@ -18,7 +18,6 @@ * This file is open source and available under the MIT license. * See the LICENSE file for more info. */ - package com.adyen.model.marketpay.notification; import com.google.gson.annotations.SerializedName; diff --git a/src/main/java/com/adyen/model/marketpay/notification/TestNotificationConfigurationResponse.java b/src/main/java/com/adyen/model/marketpay/notification/TestNotificationConfigurationResponse.java index 81bd78dae..aa30ca024 100755 --- a/src/main/java/com/adyen/model/marketpay/notification/TestNotificationConfigurationResponse.java +++ b/src/main/java/com/adyen/model/marketpay/notification/TestNotificationConfigurationResponse.java @@ -188,11 +188,11 @@ public void setOkMessages(List okMessages) { **/ public List getExchangeMessages() { - if(exchangeMessages == null) { + if (exchangeMessages == null) { exchangeMessages = new ArrayList(); - if(exchangeMessageContainers != null && !exchangeMessageContainers.isEmpty()){ - for(ExchangeMessageContainer exchangeMessageContainer : exchangeMessageContainers) { + if (exchangeMessageContainers != null && ! exchangeMessageContainers.isEmpty()) { + for (ExchangeMessageContainer exchangeMessageContainer : exchangeMessageContainers) { exchangeMessages.add(exchangeMessageContainer.getExchangeMessage()); } } diff --git a/src/main/java/com/adyen/model/notification/NotificationRequest.java b/src/main/java/com/adyen/model/notification/NotificationRequest.java index 907bc923d..ad92d84ec 100644 --- a/src/main/java/com/adyen/model/notification/NotificationRequest.java +++ b/src/main/java/com/adyen/model/notification/NotificationRequest.java @@ -1,4 +1,4 @@ -/** +/* * ###### * ###### * ############ ####( ###### #####. ###### ############ ############ @@ -53,7 +53,7 @@ public void setNotificationItemContainers(List public List getNotificationItems() { List notificationRequestItems = new ArrayList<>(); - for(NotificationRequestItemContainer container: this.notificationItemContainers) { + for (NotificationRequestItemContainer container : this.notificationItemContainers) { notificationRequestItems.add(container.getNotificationItem()); } diff --git a/src/main/java/com/adyen/model/recurring/DisableRequest.java b/src/main/java/com/adyen/model/recurring/DisableRequest.java index 3aa6b87f7..d5d9eb712 100644 --- a/src/main/java/com/adyen/model/recurring/DisableRequest.java +++ b/src/main/java/com/adyen/model/recurring/DisableRequest.java @@ -1,4 +1,4 @@ -/** +/* * ###### * ###### * ############ ####( ###### #####. ###### ############ ############ @@ -27,131 +27,135 @@ * DisableRequest */ public class DisableRequest { - @SerializedName("merchantAccount") - private String merchantAccount = null; - - @SerializedName("shopperReference") - private String shopperReference = null; - - @SerializedName("recurringDetailReference") - private String recurringDetailReference = null; - - @SerializedName("contract") - private String contract = null; - - public DisableRequest merchantAccount(String merchantAccount) { - this.merchantAccount = merchantAccount; - return this; - } - - /** - * the merchant account which will be used for processing this request - * @return merchantAccount - **/ - public String getMerchantAccount() { - return merchantAccount; - } - - public void setMerchantAccount(String merchantAccount) { - this.merchantAccount = merchantAccount; - } - - public DisableRequest shopperReference(String shopperReference) { - this.shopperReference = shopperReference; - return this; - } - - /** - * a reference you use to uniquely identify the shopper (e.g. user ID or account ID) - * @return shopperReference - **/ - public String getShopperReference() { - return shopperReference; - } - - public void setShopperReference(String shopperReference) { - this.shopperReference = shopperReference; - } - - public DisableRequest recurringDetailReference(String recurringDetailReference) { - this.recurringDetailReference = recurringDetailReference; - return this; - } - - /** - * the recurring detail you wish to disable - * @return recurringDetailReference - **/ - public String getRecurringDetailReference() { - return recurringDetailReference; - } - - public void setRecurringDetailReference(String recurringDetailReference) { - this.recurringDetailReference = recurringDetailReference; - } - - public DisableRequest contract(String contract) { - this.contract = contract; - return this; - } - - /** - * specify the contract if you only want to disable a specific use - * @return contract - **/ - public String getContract() { - return contract; - } - - public void setContract(String contract) { - this.contract = contract; - } - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - DisableRequest disableRequest = (DisableRequest) o; - return Objects.equals(this.merchantAccount, disableRequest.merchantAccount) && - Objects.equals(this.shopperReference, disableRequest.shopperReference) && - Objects.equals(this.recurringDetailReference, disableRequest.recurringDetailReference) && - Objects.equals(this.contract, disableRequest.contract); - } - - @Override - public int hashCode() { - return Objects.hash(merchantAccount, shopperReference, recurringDetailReference, contract); - } - - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class DisableRequest {\n"); - - sb.append(" merchantAccount: ").append(toIndentedString(merchantAccount)).append("\n"); - sb.append(" shopperReference: ").append(toIndentedString(shopperReference)).append("\n"); - sb.append(" recurringDetailReference: ").append(toIndentedString(recurringDetailReference)).append("\n"); - sb.append(" contract: ").append(toIndentedString(contract)).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 "); - } - + @SerializedName("merchantAccount") + private String merchantAccount = null; + + @SerializedName("shopperReference") + private String shopperReference = null; + + @SerializedName("recurringDetailReference") + private String recurringDetailReference = null; + + @SerializedName("contract") + private String contract = null; + + public DisableRequest merchantAccount(String merchantAccount) { + this.merchantAccount = merchantAccount; + return this; + } + + /** + * the merchant account which will be used for processing this request + * + * @return merchantAccount + **/ + public String getMerchantAccount() { + return merchantAccount; + } + + public void setMerchantAccount(String merchantAccount) { + this.merchantAccount = merchantAccount; + } + + public DisableRequest shopperReference(String shopperReference) { + this.shopperReference = shopperReference; + return this; + } + + /** + * a reference you use to uniquely identify the shopper (e.g. user ID or account ID) + * + * @return shopperReference + **/ + public String getShopperReference() { + return shopperReference; + } + + public void setShopperReference(String shopperReference) { + this.shopperReference = shopperReference; + } + + public DisableRequest recurringDetailReference(String recurringDetailReference) { + this.recurringDetailReference = recurringDetailReference; + return this; + } + + /** + * the recurring detail you wish to disable + * + * @return recurringDetailReference + **/ + public String getRecurringDetailReference() { + return recurringDetailReference; + } + + public void setRecurringDetailReference(String recurringDetailReference) { + this.recurringDetailReference = recurringDetailReference; + } + + public DisableRequest contract(String contract) { + this.contract = contract; + return this; + } + + /** + * specify the contract if you only want to disable a specific use + * + * @return contract + **/ + public String getContract() { + return contract; + } + + public void setContract(String contract) { + this.contract = contract; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DisableRequest disableRequest = (DisableRequest) o; + return Objects.equals(this.merchantAccount, disableRequest.merchantAccount) + && Objects.equals(this.shopperReference, disableRequest.shopperReference) + && Objects.equals(this.recurringDetailReference, disableRequest.recurringDetailReference) + && Objects.equals(this.contract, disableRequest.contract); + } + + @Override + public int hashCode() { + return Objects.hash(merchantAccount, shopperReference, recurringDetailReference, contract); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DisableRequest {\n"); + + sb.append(" merchantAccount: ").append(toIndentedString(merchantAccount)).append("\n"); + sb.append(" shopperReference: ").append(toIndentedString(shopperReference)).append("\n"); + sb.append(" recurringDetailReference: ").append(toIndentedString(recurringDetailReference)).append("\n"); + sb.append(" contract: ").append(toIndentedString(contract)).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/recurring/DisableResult.java b/src/main/java/com/adyen/model/recurring/DisableResult.java index d7750b750..be047002c 100644 --- a/src/main/java/com/adyen/model/recurring/DisableResult.java +++ b/src/main/java/com/adyen/model/recurring/DisableResult.java @@ -1,4 +1,4 @@ -/** +/* * ###### * ###### * ############ ####( ###### #####. ###### ############ ############ @@ -29,92 +29,93 @@ * DisableResult */ public class DisableResult { - @SerializedName("response") - private String response = null; - - @SerializedName("details") - private List details = new ArrayList(); - - public DisableResult response(String response) { - this.response = response; - return this; - } - - /** - * Depending on whether a specific recurring detail was in the request, result is either [detail-successfully-disabled] or [all-details-successfully-disabled] - * @return response - **/ - public String getResponse() { - return response; - } - - public void setResponse(String response) { - this.response = response; - } - - public DisableResult details(List details) { - this.details = details; - return this; - } - - public DisableResult addDetailsItem(RecurringDetail detailsItem) { - this.details.add(detailsItem); - return this; - } - - /** - * a list of one or more recurring payment details that were disabled - * @return details - **/ - public List getDetails() { - return details; - } - - public void setDetails(List details) { - this.details = details; - } - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @SerializedName("response") + private String response = null; + + @SerializedName("details") + private List details = new ArrayList(); + + public DisableResult response(String response) { + this.response = response; + return this; } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Depending on whether a specific recurring detail was in the request, result is either [detail-successfully-disabled] or [all-details-successfully-disabled] + * + * @return response + **/ + public String getResponse() { + return response; } - DisableResult disableResult = (DisableResult) o; - return Objects.equals(this.response, disableResult.response) && - Objects.equals(this.details, disableResult.details); - } - - @Override - public int hashCode() { - return Objects.hash(response, details); - } - - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class DisableResult {\n"); - - sb.append(" response: ").append(toIndentedString(response)).append("\n"); - sb.append(" details: ").append(toIndentedString(details)).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"; + + public void setResponse(String response) { + this.response = response; + } + + public DisableResult details(List details) { + this.details = details; + return this; + } + + public DisableResult addDetailsItem(RecurringDetail detailsItem) { + this.details.add(detailsItem); + return this; + } + + /** + * a list of one or more recurring payment details that were disabled + * + * @return details + **/ + public List getDetails() { + return details; + } + + public void setDetails(List details) { + this.details = details; } - return o.toString().replace("\n", "\n "); - } - + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DisableResult disableResult = (DisableResult) o; + return Objects.equals(this.response, disableResult.response) && Objects.equals(this.details, disableResult.details); + } + + @Override + public int hashCode() { + return Objects.hash(response, details); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DisableResult {\n"); + + sb.append(" response: ").append(toIndentedString(response)).append("\n"); + sb.append(" details: ").append(toIndentedString(details)).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/recurring/Recurring.java b/src/main/java/com/adyen/model/recurring/Recurring.java index 6141cf1e8..396475fbe 100644 --- a/src/main/java/com/adyen/model/recurring/Recurring.java +++ b/src/main/java/com/adyen/model/recurring/Recurring.java @@ -1,4 +1,4 @@ -/** +/* * ###### * ###### * ############ ####( ###### #####. ###### ############ ############ @@ -27,124 +27,125 @@ * Recurring */ public class Recurring { - /** - * how the recurring detail will be used, multiple values allowed as comma separated - */ - public enum ContractEnum { - @SerializedName("ONECLICK") - ONECLICK("ONECLICK"), - - @SerializedName("ONECLICK,RECURRING") - ONECLICK_RECURRING("ONECLICK,RECURRING"), - - @SerializedName("RECURRING") - RECURRING("RECURRING"), - - @SerializedName("PAYOUT") - PAYOUT("PAYOUT"), - - @SerializedName("ONECLICK,RECURRING,PAYOUT") - ONECLICK_RECURRING_PAYOUT("ONECLICK,RECURRING,PAYOUT"), - - @SerializedName("ONECLICK,PAYOUT") - ONECLICK_PAYOUT("ONECLICK,PAYOUT"), - - @SerializedName("RECURRING,PAYOUT") - RECURRING_PAYOUT("RECURRING,PAYOUT"); - - private String value; - - ContractEnum(String value) { - this.value = value; + /** + * how the recurring detail will be used, multiple values allowed as comma separated + */ + public enum ContractEnum { + @SerializedName("ONECLICK") + ONECLICK("ONECLICK"), + + @SerializedName("ONECLICK,RECURRING") + ONECLICK_RECURRING("ONECLICK,RECURRING"), + + @SerializedName("RECURRING") + RECURRING("RECURRING"), + + @SerializedName("PAYOUT") + PAYOUT("PAYOUT"), + + @SerializedName("ONECLICK,RECURRING,PAYOUT") + ONECLICK_RECURRING_PAYOUT("ONECLICK,RECURRING,PAYOUT"), + + @SerializedName("ONECLICK,PAYOUT") + ONECLICK_PAYOUT("ONECLICK,PAYOUT"), + + @SerializedName("RECURRING,PAYOUT") + RECURRING_PAYOUT("RECURRING,PAYOUT"); + + private String value; + + ContractEnum(String value) { + this.value = value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + } + + @SerializedName("contract") + private ContractEnum contract = null; + + @SerializedName("recurringDetailName") + private String recurringDetailName = null; + + public Recurring contract(ContractEnum contract) { + this.contract = contract; + return this; + } + + /** + * how the recurring detail will be used, multiple values allowed as comma separated + * + * @return contract + **/ + public ContractEnum getContract() { + return contract; + } + + public void setContract(ContractEnum contract) { + this.contract = contract; } + public Recurring recurringDetailName(String recurringDetailName) { + this.recurringDetailName = recurringDetailName; + return this; + } + + /** + * assign a descriptive name for this detail + * + * @return recurringDetailName + **/ + public String getRecurringDetailName() { + return recurringDetailName; + } + + public void setRecurringDetailName(String recurringDetailName) { + this.recurringDetailName = recurringDetailName; + } + + @Override - public String toString() { - return String.valueOf(value); + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Recurring recurring = (Recurring) o; + return Objects.equals(this.contract, recurring.contract) && Objects.equals(this.recurringDetailName, recurring.recurringDetailName); } - } - - @SerializedName("contract") - private ContractEnum contract = null; - - @SerializedName("recurringDetailName") - private String recurringDetailName = null; - - public Recurring contract(ContractEnum contract) { - this.contract = contract; - return this; - } - - /** - * how the recurring detail will be used, multiple values allowed as comma separated - * @return contract - **/ - public ContractEnum getContract() { - return contract; - } - - public void setContract(ContractEnum contract) { - this.contract = contract; - } - - public Recurring recurringDetailName(String recurringDetailName) { - this.recurringDetailName = recurringDetailName; - return this; - } - - /** - * assign a descriptive name for this detail - * @return recurringDetailName - **/ - public String getRecurringDetailName() { - return recurringDetailName; - } - - public void setRecurringDetailName(String recurringDetailName) { - this.recurringDetailName = recurringDetailName; - } - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + + @Override + public int hashCode() { + return Objects.hash(contract, recurringDetailName); } - if (o == null || getClass() != o.getClass()) { - return false; + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Recurring {\n"); + + sb.append(" contract: ").append(toIndentedString(contract)).append("\n"); + sb.append(" recurringDetailName: ").append(toIndentedString(recurringDetailName)).append("\n"); + sb.append("}"); + return sb.toString(); } - Recurring recurring = (Recurring) o; - return Objects.equals(this.contract, recurring.contract) && - Objects.equals(this.recurringDetailName, recurring.recurringDetailName); - } - - @Override - public int hashCode() { - return Objects.hash(contract, recurringDetailName); - } - - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class Recurring {\n"); - - sb.append(" contract: ").append(toIndentedString(contract)).append("\n"); - sb.append(" recurringDetailName: ").append(toIndentedString(recurringDetailName)).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"; + + /** + * 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 "); } - return o.toString().replace("\n", "\n "); - } - + } diff --git a/src/main/java/com/adyen/model/recurring/RecurringDetail.java b/src/main/java/com/adyen/model/recurring/RecurringDetail.java index 2bc3d9b20..3c256cbe2 100644 --- a/src/main/java/com/adyen/model/recurring/RecurringDetail.java +++ b/src/main/java/com/adyen/model/recurring/RecurringDetail.java @@ -1,4 +1,4 @@ -/** +/* * ###### * ###### * ############ ####( ###### #####. ###### ############ ############ diff --git a/src/main/java/com/adyen/model/recurring/StoreTokenRequest.java b/src/main/java/com/adyen/model/recurring/StoreTokenRequest.java new file mode 100644 index 000000000..63ca9d12d --- /dev/null +++ b/src/main/java/com/adyen/model/recurring/StoreTokenRequest.java @@ -0,0 +1,261 @@ +/* + * ###### + * ###### + * ############ ####( ###### #####. ###### ############ ############ + * ############# #####( ###### #####. ###### ############# ############# + * ###### #####( ###### #####. ###### ##### ###### ##### ###### + * ###### ###### #####( ###### #####. ###### ##### ##### ##### ###### + * ###### ###### #####( ###### #####. ###### ##### ##### ###### + * ############# ############# ############# ############# ##### ###### + * ############ ############ ############# ############ ##### ###### + * ###### + * ############# + * ############ + * + * Adyen Java API Library + * + * Copyright (c) 2017 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.recurring; + +import com.adyen.model.Card; +import com.google.gson.annotations.SerializedName; + +/** + * StoreTokenRequest - This type contains data that should be passed in either prepareStoreToken or storeToken calls. + */ +public class StoreTokenRequest { + + @SerializedName("card") + private Card card; + + @SerializedName("merchantAccount") + private String merchantAccount; + + @SerializedName("pspEchoData") + private String pspEchoData; + + @SerializedName("recurring") + private Recurring recurring; + + @SerializedName("selectedBrand") + private String selectedBrand; + + @SerializedName("shopperEmail") + private String shopperEmail; + + @SerializedName("shopperIP") + private String shopperIP; + + @SerializedName("shopperReference") + private String shopperReference; + + @SerializedName("shopperStatement") + private String shopperStatement; + + /** + * A container for card data. + * + * @return card + */ + public Card getCard() { + return card; + } + + public void setCard(Card card) { + this.card = card; + } + + public StoreTokenRequest card(Card card) { + this.card = card; + return this; + } + + /** + * The merchant account identifier you want to process the (transaction) request with. + * + * @return merchantAccount + */ + public String getMerchantAccount() { + return merchantAccount; + } + + public void setMerchantAccount(String merchantAccount) { + this.merchantAccount = merchantAccount; + } + + public StoreTokenRequest merchantAccount(String merchantAccount) { + this.merchantAccount = merchantAccount; + return this; + } + + /** + * The pspEchoData value received in the prepareStoreToken response. + * + * @return pspEchoData + */ + public String getPspEchoData() { + return pspEchoData; + } + + public void setPspEchoData(String pspEchoData) { + this.pspEchoData = pspEchoData; + } + + public StoreTokenRequest pspEchoData(String pspEchoData) { + this.pspEchoData = pspEchoData; + return this; + } + + /** + * A container for the type of recurring contract to be retrieved. The recurring.contract must be set to "RECURRING". + * + * @return recurring + */ + public Recurring getRecurring() { + return recurring; + } + + public void setRecurring(Recurring recurring) { + this.recurring = recurring; + } + + public StoreTokenRequest recurring(Recurring recurring) { + this.recurring = recurring; + return this; + } + + /** + * Some payment methods require defining a value for this field to specify how to process the transaction. + * + * @return selectedBrand + */ + public String getSelectedBrand() { + return selectedBrand; + } + + public void setSelectedBrand(String selectedBrand) { + this.selectedBrand = selectedBrand; + } + + public StoreTokenRequest selectedBrand(String selectedBrand) { + this.selectedBrand = selectedBrand; + return this; + } + + /** + * The shopper's email address. + * + * @return shopperEmail + */ + public String getShopperEmail() { + return shopperEmail; + } + + public void setShopperEmail(String shopperEmail) { + this.shopperEmail = shopperEmail; + } + + public StoreTokenRequest shopperEmail(String shopperEmail) { + this.shopperEmail = shopperEmail; + return this; + } + + /** + * The shopper's IP address. + * + * @return shopperIP + */ + public String getShopperIP() { + return shopperIP; + } + + public void setShopperIP(String shopperIP) { + this.shopperIP = shopperIP; + } + + public StoreTokenRequest shopperIP(String shopperIP) { + this.shopperIP = shopperIP; + return this; + } + + /** + * The shopper's reference for the payment transaction. + * + * @return shopperReference + */ + public String getShopperReference() { + return shopperReference; + } + + public void setShopperReference(String shopperReference) { + this.shopperReference = shopperReference; + } + + public StoreTokenRequest shopperReference(String shopperReference) { + this.shopperReference = shopperReference; + return this; + } + + /** + * The text to appear on a shopper's statement. + * + * @return shopperStatement + */ + public String getShopperStatement() { + return shopperStatement; + } + + public void setShopperStatement(String shopperStatement) { + this.shopperStatement = shopperStatement; + } + + public StoreTokenRequest shopperStatement(String shopperStatement) { + this.shopperStatement = shopperStatement; + return this; + } + + public StoreTokenRequest setCardData(String cardNumber, String cardHolder, String expiryMonth, String expiryYear, String cvc) { + Card card = new Card(); + card.setExpiryMonth(expiryMonth); + card.setExpiryYear(expiryYear); + card.setHolderName(cardHolder); + card.setNumber(cardNumber); + card.setCvc(cvc); + + this.setCard(card); + return this; + } + + public StoreTokenRequest setContractToRecurring() { + setRecurring(new Recurring().contract(Recurring.ContractEnum.RECURRING)); + return this; + } + + public StoreTokenRequest setContractToOneClick() { + setRecurring(new Recurring().contract(Recurring.ContractEnum.ONECLICK)); + return this; + } + + public StoreTokenRequest setContractToOneClickRecurring() { + setRecurring(new Recurring().contract(Recurring.ContractEnum.ONECLICK_RECURRING)); + return this; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append(this.getClass().getSimpleName()); + sb.append("[merchantAccount=").append(merchantAccount); + sb.append(", shopperReference=").append(shopperReference); + sb.append(", shopperEmail=").append(shopperEmail); + sb.append(", hasCard=").append(card != null); + sb.append(", selectedBrand=").append(selectedBrand); + sb.append(", shopperStatement=").append(shopperStatement); + sb.append("]"); + return sb.toString(); + } + +} diff --git a/src/main/java/com/adyen/model/recurring/StoreTokenResult.java b/src/main/java/com/adyen/model/recurring/StoreTokenResult.java new file mode 100644 index 000000000..3ac759f49 --- /dev/null +++ b/src/main/java/com/adyen/model/recurring/StoreTokenResult.java @@ -0,0 +1,203 @@ +/* + * ###### + * ###### + * ############ ####( ###### #####. ###### ############ ############ + * ############# #####( ###### #####. ###### ############# ############# + * ###### #####( ###### #####. ###### ##### ###### ##### ###### + * ###### ###### #####( ###### #####. ###### ##### ##### ##### ###### + * ###### ###### #####( ###### #####. ###### ##### ##### ###### + * ############# ############# ############# ############# ##### ###### + * ############ ############ ############# ############ ##### ###### + * ###### + * ############# + * ############ + * + * Adyen Java API Library + * + * Copyright (c) 2017 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.recurring; + +import com.google.gson.annotations.SerializedName; + +/** + * StoreTokenResult - This type contains data that can be returned in response to either prepareStoreToken or storeToken calls. + */ +public class StoreTokenResult { + + @SerializedName("alias") + private String alias; + + @SerializedName("aliasType") + private String aliasType; + + @SerializedName("pspEchoData") + private String pspEchoData; + + @SerializedName("pspReference") + private String pspReference; + + @SerializedName("recurringDetailReference") + private String recurringDetailReference; + + @SerializedName("redirectType") + private String redirectType; + + @SerializedName("redirectUrl") + private String redirectUrl; + + @SerializedName("result") + private String result; + + /** + * The alias of the credit card number. It is a unique alphanumeric identifier for the card. + * + * @return alias + */ + public String getAlias() { + return alias; + } + + public void setAlias(String alias) { + this.alias = alias; + } + + public StoreTokenResult alias(String alias) { + this.alias = alias; + return this; + } + + /** + * The alias type of the credit card number. Allowed values: Default and BinLetterRandomLastFour. The alias type depends on your account configuration. + * + * @return aliasType + */ + public String getAliasType() { + return aliasType; + } + + public void setAliasType(String aliasType) { + this.aliasType = aliasType; + } + + public StoreTokenResult aliasType(String aliasType) { + this.aliasType = aliasType; + return this; + } + + /** + * A data blob that must be submitted in the storeToken request. + * + * @return pspEchoData + */ + public String getPspEchoData() { + return pspEchoData; + } + + public void setPspEchoData(String pspEchoData) { + this.pspEchoData = pspEchoData; + } + + public StoreTokenResult pspEchoData(String pspEchoData) { + this.pspEchoData = pspEchoData; + return this; + } + + /** + * A reference to uniquely identify the request. + * + * @return pspReference + */ + public String getPspReference() { + return pspReference; + } + + public void setPspReference(String pspReference) { + this.pspReference = pspReference; + } + + public StoreTokenResult pspReference(String pspReference) { + this.pspReference = pspReference; + return this; + } + + /** + * The reference that uniquely identifies the recurring detail. + * + * @return recurringDetailReference + */ + public String getRecurringDetailReference() { + return recurringDetailReference; + } + + public void setRecurringDetailReference(String recurringDetailReference) { + this.recurringDetailReference = recurringDetailReference; + } + + public StoreTokenResult recurringDetailReference(String recurringDetailReference) { + this.recurringDetailReference = recurringDetailReference; + return this; + } + + public String getRedirectType() { + return redirectType; + } + + public void setRedirectType(String redirectType) { + this.redirectType = redirectType; + } + + public StoreTokenResult redirectType(String redirectType) { + this.redirectType = redirectType; + return this; + } + + public String getRedirectUrl() { + return redirectUrl; + } + + public void setRedirectUrl(String redirectUrl) { + this.redirectUrl = redirectUrl; + } + + public StoreTokenResult redirectUrl(String redirectUrl) { + this.redirectUrl = redirectUrl; + return this; + } + + /** + * + * @return result + */ + public String getResult() { + return result; + } + + public void setResult(String result) { + this.result = result; + } + + public StoreTokenResult result(String result) { + this.result = result; + return this; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append(this.getClass().getSimpleName()); + sb.append("["); + sb.append("pspReference=").append(pspReference); + sb.append(", recurringDetailReference=").append(recurringDetailReference); + sb.append(", result=").append(result); + sb.append(", alias=").append(alias); + sb.append(", aliasType=").append(aliasType); + sb.append(", redirectUrl=").append(redirectUrl); + sb.append(", redirectType=").append(redirectType); + sb.append("]"); + return sb.toString(); + } + +} diff --git a/src/main/java/com/adyen/serializer/DateSerializer.java b/src/main/java/com/adyen/serializer/DateSerializer.java index 72e9ab2e6..c7d3b6923 100644 --- a/src/main/java/com/adyen/serializer/DateSerializer.java +++ b/src/main/java/com/adyen/serializer/DateSerializer.java @@ -1,4 +1,4 @@ -/** +/* * ###### * ###### * ############ ####( ###### #####. ###### ############ ############ @@ -23,6 +23,7 @@ import java.lang.reflect.Type; import java.text.SimpleDateFormat; import java.util.Date; +import java.util.Locale; import java.util.TimeZone; import com.google.gson.JsonElement; import com.google.gson.JsonPrimitive; @@ -34,7 +35,7 @@ public class DateSerializer implements JsonSerializer { @Override public JsonElement serialize(Date date, Type typeOfSrc, JsonSerializationContext context) { - SimpleDateFormat formatter = new SimpleDateFormat(DATE_FORMAT); + SimpleDateFormat formatter = new SimpleDateFormat(DATE_FORMAT, Locale.ENGLISH); formatter.setTimeZone(TimeZone.getTimeZone("GMT")); return new JsonPrimitive(formatter.format(date)); } diff --git a/src/main/java/com/adyen/serializer/DateTimeGMTSerializer.java b/src/main/java/com/adyen/serializer/DateTimeGMTSerializer.java index 4ad623ca6..b4ca351a9 100644 --- a/src/main/java/com/adyen/serializer/DateTimeGMTSerializer.java +++ b/src/main/java/com/adyen/serializer/DateTimeGMTSerializer.java @@ -1,4 +1,4 @@ -/** +/* * ###### * ###### * ############ ####( ###### #####. ###### ############ ############ @@ -23,6 +23,7 @@ import java.lang.reflect.Type; import java.text.SimpleDateFormat; import java.util.Date; +import java.util.Locale; import java.util.TimeZone; import com.google.gson.JsonElement; import com.google.gson.JsonPrimitive; @@ -37,7 +38,7 @@ public class DateTimeGMTSerializer implements JsonSerializer { */ @Override public JsonElement serialize(Date date, Type typeOfSrc, JsonSerializationContext context) { - SimpleDateFormat formatter = new SimpleDateFormat(DATE_FORMAT); + SimpleDateFormat formatter = new SimpleDateFormat(DATE_FORMAT, Locale.ENGLISH); formatter.setTimeZone(TimeZone.getTimeZone("GMT")); return new JsonPrimitive(formatter.format(date)); } diff --git a/src/main/java/com/adyen/service/Checkout.java b/src/main/java/com/adyen/service/Checkout.java index 20ede3c9c..41a5523ec 100644 --- a/src/main/java/com/adyen/service/Checkout.java +++ b/src/main/java/com/adyen/service/Checkout.java @@ -24,9 +24,22 @@ import java.io.IOException; import com.adyen.ApiKeyAuthenticatedService; import com.adyen.Client; -import com.adyen.model.checkout.*; +import com.adyen.model.RequestOptions; +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.PaymentsRequest; +import com.adyen.model.checkout.PaymentsResponse; import com.adyen.service.exception.ApiException; -import com.adyen.service.resource.checkout.*; +import com.adyen.service.resource.checkout.PaymentMethods; +import com.adyen.service.resource.checkout.PaymentSession; +import com.adyen.service.resource.checkout.Payments; +import com.adyen.service.resource.checkout.PaymentsDetails; +import com.adyen.service.resource.checkout.PaymentsResult; import com.google.gson.reflect.TypeToken; @@ -57,11 +70,14 @@ public Checkout(Client client) { * @throws ApiException */ public PaymentsResponse payments(PaymentsRequest paymentsRequest) throws ApiException, IOException { + return payments(paymentsRequest, null); + } + + public PaymentsResponse payments(PaymentsRequest paymentsRequest, RequestOptions requestOptions) throws ApiException, IOException { String jsonRequest = GSON.toJson(paymentsRequest); - String jsonResult = payments.request(jsonRequest); + String jsonResult = payments.request(jsonRequest, requestOptions); return GSON.fromJson(jsonResult, new TypeToken() { }.getType()); - } /** @@ -107,8 +123,12 @@ public PaymentsResponse paymentsDetails(PaymentsDetailsRequest paymentsDetailsRe */ public PaymentSessionResponse paymentSession(PaymentSessionRequest paymentSessionRequest) throws ApiException, IOException { + return paymentSession(paymentSessionRequest, null); + } + + public PaymentSessionResponse paymentSession(PaymentSessionRequest paymentSessionRequest, RequestOptions requestOptions) throws ApiException, IOException { String jsonRequest = GSON.toJson(paymentSessionRequest); - String jsonResult = paymentSession.request(jsonRequest); + String jsonResult = paymentSession.request(jsonRequest, requestOptions); return GSON.fromJson(jsonResult, new TypeToken() { }.getType()); } diff --git a/src/main/java/com/adyen/service/Fund.java b/src/main/java/com/adyen/service/Fund.java index e9c7a1120..e8c3da6ed 100644 --- a/src/main/java/com/adyen/service/Fund.java +++ b/src/main/java/com/adyen/service/Fund.java @@ -62,7 +62,7 @@ public Fund(Client client) { } - public AccountHolderBalanceResponse AccountHolderBalance(AccountHolderBalanceRequest accountHolderBalanceRequest) throws Exception { + public AccountHolderBalanceResponse accountHolderBalance(AccountHolderBalanceRequest accountHolderBalanceRequest) throws Exception { String jsonRequest = GSON.toJson(accountHolderBalanceRequest); String jsonResult = accountHolderBalance.request(jsonRequest); diff --git a/src/main/java/com/adyen/service/HostedPaymentPages.java b/src/main/java/com/adyen/service/HostedPaymentPages.java index 279e4c996..c55894146 100644 --- a/src/main/java/com/adyen/service/HostedPaymentPages.java +++ b/src/main/java/com/adyen/service/HostedPaymentPages.java @@ -85,7 +85,7 @@ public SortedMap getPostParametersFromDLRequest(DirectoryLookupR postParameters.put(SESSION_VALIDITY, request.getSessionValidity()); postParameters.put(COUNTRY_CODE, request.getCountryCode()); - if(request.getShopperLocale() != null) { + if (request.getShopperLocale() != null) { postParameters.put(SHOPPER_LOCALE, request.getShopperLocale()); } diff --git a/src/main/java/com/adyen/service/Modification.java b/src/main/java/com/adyen/service/Modification.java index c2086c954..c659a3cc9 100644 --- a/src/main/java/com/adyen/service/Modification.java +++ b/src/main/java/com/adyen/service/Modification.java @@ -1,4 +1,4 @@ -/** +/* * ###### * ###### * ############ ####( ###### #####. ###### ############ ############ @@ -23,6 +23,7 @@ import java.io.IOException; import com.adyen.Client; import com.adyen.Service; +import com.adyen.model.RequestOptions; import com.adyen.model.modification.AbstractModificationRequest; import com.adyen.model.modification.CancelOrRefundRequest; import com.adyen.model.modification.CancelRequest; @@ -60,10 +61,12 @@ public Modification(Client client) { * @throws ApiException */ public ModificationResult capture(CaptureRequest captureRequest) throws IOException, ApiException { - String jsonRequest = serializeRequest(captureRequest); - - String jsonResult = capture.request(jsonRequest); + return capture(captureRequest, null); + } + public ModificationResult capture(CaptureRequest captureRequest, RequestOptions requestOptions) throws IOException, ApiException { + String jsonRequest = serializeRequest(captureRequest); + String jsonResult = capture.request(jsonRequest, requestOptions); return deserializeResponse(jsonResult); } @@ -76,10 +79,12 @@ public ModificationResult capture(CaptureRequest captureRequest) throws IOExcept * @throws ApiException */ public ModificationResult cancelOrRefund(CancelOrRefundRequest cancelOrRefundRequest) throws IOException, ApiException { - String jsonRequest = serializeRequest(cancelOrRefundRequest); - - String jsonResult = cancelOrRefund.request(jsonRequest); + return cancelOrRefund(cancelOrRefundRequest, null); + } + public ModificationResult cancelOrRefund(CancelOrRefundRequest cancelOrRefundRequest, RequestOptions requestOptions) throws IOException, ApiException { + String jsonRequest = serializeRequest(cancelOrRefundRequest); + String jsonResult = cancelOrRefund.request(jsonRequest, requestOptions); return deserializeResponse(jsonResult); } @@ -92,10 +97,12 @@ public ModificationResult cancelOrRefund(CancelOrRefundRequest cancelOrRefundReq * @throws ApiException */ public ModificationResult refund(RefundRequest refundRequest) throws IOException, ApiException { - String jsonRequest = serializeRequest(refundRequest); - - String jsonResult = refund.request(jsonRequest); + return refund(refundRequest, null); + } + public ModificationResult refund(RefundRequest refundRequest, RequestOptions requestOptions) throws IOException, ApiException { + String jsonRequest = serializeRequest(refundRequest); + String jsonResult = refund.request(jsonRequest, requestOptions); return deserializeResponse(jsonResult); } @@ -108,10 +115,13 @@ public ModificationResult refund(RefundRequest refundRequest) throws IOException * @throws ApiException */ public ModificationResult cancel(CancelRequest cancelRequest) throws IOException, ApiException { - String jsonRequest = serializeRequest(cancelRequest); + return cancel(cancelRequest, null); + } - String jsonResult = cancel.request(jsonRequest); + public ModificationResult cancel(CancelRequest cancelRequest, RequestOptions requestOptions) throws IOException, ApiException { + String jsonRequest = serializeRequest(cancelRequest); + String jsonResult = cancel.request(jsonRequest, requestOptions); return deserializeResponse(jsonResult); } diff --git a/src/main/java/com/adyen/service/Notification.java b/src/main/java/com/adyen/service/Notification.java index db77db79d..947f8137f 100644 --- a/src/main/java/com/adyen/service/Notification.java +++ b/src/main/java/com/adyen/service/Notification.java @@ -22,8 +22,23 @@ import com.adyen.Client; import com.adyen.Service; -import com.adyen.model.marketpay.notification.*; -import com.adyen.service.resource.notification.*; +import com.adyen.model.marketpay.notification.CreateNotificationConfigurationRequest; +import com.adyen.model.marketpay.notification.CreateNotificationConfigurationResponse; +import com.adyen.model.marketpay.notification.DeleteNotificationConfigurationRequest; +import com.adyen.model.marketpay.notification.DeleteNotificationConfigurationResponse; +import com.adyen.model.marketpay.notification.GetNotificationConfigurationListResponse; +import com.adyen.model.marketpay.notification.GetNotificationConfigurationRequest; +import com.adyen.model.marketpay.notification.GetNotificationConfigurationResponse; +import com.adyen.model.marketpay.notification.TestNotificationConfigurationRequest; +import com.adyen.model.marketpay.notification.TestNotificationConfigurationResponse; +import com.adyen.model.marketpay.notification.UpdateNotificationConfigurationRequest; +import com.adyen.model.marketpay.notification.UpdateNotificationConfigurationResponse; +import com.adyen.service.resource.notification.CreateNotificationConfiguration; +import com.adyen.service.resource.notification.DeleteNotificationConfigurations; +import com.adyen.service.resource.notification.GetNotificationConfiguration; +import com.adyen.service.resource.notification.GetNotificationConfigurationList; +import com.adyen.service.resource.notification.TestNotificationConfiguration; +import com.adyen.service.resource.notification.UpdateNotificationConfiguration; import com.google.gson.reflect.TypeToken; public class Notification extends Service { @@ -82,23 +97,23 @@ public DeleteNotificationConfigurationResponse deleteNotificationConfiguration(D return deleteNotificationConfigurationResponse; } - public TestNotificationConfigurationResponse testNotificationConfiguration(TestNotificationConfigurationRequest testNotificationConfigurationRequest) throws Exception{ - String jsonRequest = GSON.toJson(testNotificationConfigurationRequest); - String jsonResult = testNotificationConfiguration.request(jsonRequest); + public TestNotificationConfigurationResponse testNotificationConfiguration(TestNotificationConfigurationRequest testNotificationConfigurationRequest) throws Exception { + String jsonRequest = GSON.toJson(testNotificationConfigurationRequest); + String jsonResult = testNotificationConfiguration.request(jsonRequest); - TestNotificationConfigurationResponse testNotificationConfigurationResponse = GSON.fromJson(jsonResult, new TypeToken() { - }.getType()); + TestNotificationConfigurationResponse testNotificationConfigurationResponse = GSON.fromJson(jsonResult, new TypeToken() { + }.getType()); - return testNotificationConfigurationResponse; - } + return testNotificationConfigurationResponse; + } - public GetNotificationConfigurationListResponse getNotificationConfigurationList() throws Exception{ + public GetNotificationConfigurationListResponse getNotificationConfigurationList() throws Exception { String jsonResult = getNotificationConfigurationList.request("{}"); - GetNotificationConfigurationListResponse getNotificationConfigurationListResponse = GSON.fromJson(jsonResult, new TypeToken(){ + GetNotificationConfigurationListResponse getNotificationConfigurationListResponse = GSON.fromJson(jsonResult, new TypeToken() { }.getType()); return getNotificationConfigurationListResponse; - } + } } \ No newline at end of file diff --git a/src/main/java/com/adyen/service/Payment.java b/src/main/java/com/adyen/service/Payment.java index 88bf66dfb..97675538e 100644 --- a/src/main/java/com/adyen/service/Payment.java +++ b/src/main/java/com/adyen/service/Payment.java @@ -1,4 +1,4 @@ -/** +/* * ###### * ###### * ############ ####( ###### #####. ###### ############ ############ @@ -25,6 +25,7 @@ import com.adyen.model.PaymentRequest; import com.adyen.model.PaymentRequest3d; import com.adyen.model.PaymentResult; +import com.adyen.model.RequestOptions; import com.adyen.service.exception.ApiException; import com.adyen.service.resource.payment.Authorise; import com.adyen.service.resource.payment.Authorise3D; @@ -50,10 +51,12 @@ public Payment(Client client) { * @param paymentRequest */ public PaymentResult authorise(PaymentRequest paymentRequest) throws ApiException, IOException { - String jsonRequest = GSON.toJson(paymentRequest); - - String jsonResult = authorise.request(jsonRequest); + return authorise(paymentRequest, null); + } + public PaymentResult authorise(PaymentRequest paymentRequest, RequestOptions requestOptions) throws ApiException, IOException { + String jsonRequest = GSON.toJson(paymentRequest); + String jsonResult = authorise.request(jsonRequest, requestOptions); PaymentResult paymentResult = GSON.fromJson(jsonResult, new TypeToken() { }.getType()); diff --git a/src/main/java/com/adyen/service/Payout.java b/src/main/java/com/adyen/service/Payout.java index 88595bbf7..d596b2404 100644 --- a/src/main/java/com/adyen/service/Payout.java +++ b/src/main/java/com/adyen/service/Payout.java @@ -27,8 +27,6 @@ import com.adyen.model.payout.ConfirmThirdPartyResponse; import com.adyen.model.payout.DeclineThirdPartyRequest; import com.adyen.model.payout.DeclineThirdPartyResponse; -import com.adyen.model.payout.ModifyRequest; -import com.adyen.model.payout.ModifyResponse; import com.adyen.model.payout.StoreDetailAndSubmitRequest; import com.adyen.model.payout.StoreDetailAndSubmitResponse; import com.adyen.model.payout.StoreDetailRequest; diff --git a/src/main/java/com/adyen/service/Recurring.java b/src/main/java/com/adyen/service/Recurring.java index 8cb82324f..0a303cd13 100644 --- a/src/main/java/com/adyen/service/Recurring.java +++ b/src/main/java/com/adyen/service/Recurring.java @@ -1,4 +1,4 @@ -/** +/* * ###### * ###### * ############ ####( ###### #####. ###### ############ ############ @@ -27,20 +27,25 @@ import com.adyen.model.recurring.DisableResult; import com.adyen.model.recurring.RecurringDetailsRequest; import com.adyen.model.recurring.RecurringDetailsResult; +import com.adyen.model.recurring.StoreTokenRequest; +import com.adyen.model.recurring.StoreTokenResult; import com.adyen.service.exception.ApiException; import com.adyen.service.resource.recurring.Disable; import com.adyen.service.resource.recurring.ListRecurringDetails; +import com.adyen.service.resource.recurring.StoreToken; import com.google.gson.reflect.TypeToken; public class Recurring extends Service { private ListRecurringDetails listRecurringDetails; private Disable disable; + private StoreToken storeToken; public Recurring(Client client) { super(client); listRecurringDetails = new ListRecurringDetails(this); disable = new Disable(this); + storeToken = new StoreToken(this); } /** @@ -63,6 +68,7 @@ public RecurringDetailsResult listRecurringDetails(RecurringDetailsRequest reque /** * Issues a disable recurring contract API call + * * @param request * @return * @throws IOException @@ -77,4 +83,23 @@ public DisableResult disable(DisableRequest request) throws IOException, ApiExce }.getType()); return result; } + + /** + * Issues a storeToken API call + * + * @param request + * @return + * @throws IOException + * @throws ApiException + */ + public StoreTokenResult storeToken(StoreTokenRequest request) throws IOException, ApiException { + String jsonRequest = GSON.toJson(request); + + String jsonResult = storeToken.request(jsonRequest); + + StoreTokenResult result = GSON.fromJson(jsonResult, new TypeToken() { + }.getType()); + return result; + } + } diff --git a/src/main/java/com/adyen/service/Resource.java b/src/main/java/com/adyen/service/Resource.java index cc7208d8b..61a6b5131 100644 --- a/src/main/java/com/adyen/service/Resource.java +++ b/src/main/java/com/adyen/service/Resource.java @@ -27,6 +27,7 @@ import com.adyen.httpclient.ClientInterface; import com.adyen.httpclient.HTTPClientException; import com.adyen.model.ApiError; +import com.adyen.model.RequestOptions; import com.adyen.service.exception.ApiException; import com.google.gson.Gson; import com.google.gson.JsonSyntaxException; @@ -49,13 +50,20 @@ public Resource(Service service, String endpoint, List requiredFields) { * Request using json String */ public String request(String json) throws ApiException, IOException { + return request(json, null); + } + + /** + * Request using json String with additional request parameters like idempotency-key + */ + public String request(String json, RequestOptions requestOptions) throws ApiException, IOException { ClientInterface clientInterface = (ClientInterface) this.service.getClient().getHttpClient(); Config config = this.service.getClient().getConfig(); String responseBody; ApiException apiException; try { - return clientInterface.request(this.endpoint, json, config, this.service.isApiKeyRequired()); + return clientInterface.request(this.endpoint, json, config, this.service.isApiKeyRequired(), requestOptions); } catch (HTTPClientException e) { responseBody = e.getResponseBody(); apiException = new ApiException(e.getMessage(), e.getCode()); diff --git a/src/main/java/com/adyen/service/resource/modification/Capture.java b/src/main/java/com/adyen/service/resource/modification/Capture.java index 57f57c765..66c13c433 100644 --- a/src/main/java/com/adyen/service/resource/modification/Capture.java +++ b/src/main/java/com/adyen/service/resource/modification/Capture.java @@ -21,7 +21,6 @@ package com.adyen.service.resource.modification; import java.util.Arrays; -import java.util.List; import com.adyen.Client; import com.adyen.Service; import com.adyen.service.Resource; diff --git a/src/main/java/com/adyen/service/resource/recurring/StoreToken.java b/src/main/java/com/adyen/service/resource/recurring/StoreToken.java new file mode 100644 index 000000000..32c456b72 --- /dev/null +++ b/src/main/java/com/adyen/service/resource/recurring/StoreToken.java @@ -0,0 +1,37 @@ +/* + * ###### + * ###### + * ############ ####( ###### #####. ###### ############ ############ + * ############# #####( ###### #####. ###### ############# ############# + * ###### #####( ###### #####. ###### ##### ###### ##### ###### + * ###### ###### #####( ###### #####. ###### ##### ##### ##### ###### + * ###### ###### #####( ###### #####. ###### ##### ##### ###### + * ############# ############# ############# ############# ##### ###### + * ############ ############ ############# ############ ##### ###### + * ###### + * ############# + * ############ + * + * Adyen Java API Library + * + * Copyright (c) 2017 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.recurring; + +import java.util.Arrays; + +import com.adyen.Client; +import com.adyen.Service; +import com.adyen.service.Resource; + +public class StoreToken extends Resource { + + public StoreToken(Service service) { + super(service, service.getClient().getConfig().getEndpoint() + "/pal/servlet/Recurring/" + Client.RECURRING_API_VERSION + "/storeToken", + Arrays.asList("merchantAccount", "recurring.contract", "shopperReference")); + } + +} diff --git a/src/test/java/com/adyen/BaseTest.java b/src/test/java/com/adyen/BaseTest.java index beac69b75..6bd1563d7 100644 --- a/src/test/java/com/adyen/BaseTest.java +++ b/src/test/java/com/adyen/BaseTest.java @@ -49,7 +49,9 @@ protected Client createMockClientFromResponse(String response) { HttpURLConnectionClient httpURLConnectionClient = mock(HttpURLConnectionClient.class); try { when(httpURLConnectionClient.post(any(String.class), any(Map.class), any(Config.class))).thenReturn(response); - when(httpURLConnectionClient.request(any(String.class), any(String.class), any(Config.class), anyBoolean())).thenReturn(response); + when(httpURLConnectionClient.request(any(String.class), any(String.class), any(Config.class), anyBoolean(), any(RequestOptions.class))).thenReturn(response); + when(httpURLConnectionClient.request(any(String.class), any(String.class), any(Config.class), anyBoolean(), (RequestOptions) isNull())).thenReturn(response); + } catch (IOException | HTTPClientException e) { e.printStackTrace(); } @@ -217,7 +219,7 @@ protected Client createMockClientForErrors(int status, String fileName) { HttpURLConnectionClient httpURLConnectionClient = mock(HttpURLConnectionClient.class); HTTPClientException httpClientException = new HTTPClientException(status, "An error occured", new HashMap>(), response); try { - when(httpURLConnectionClient.request(any(String.class), any(String.class), any(Config.class), anyBoolean())).thenThrow(httpClientException); + when(httpURLConnectionClient.request(any(String.class), any(String.class), any(Config.class), anyBoolean(), (RequestOptions) isNull())).thenThrow(httpClientException); } catch (IOException | HTTPClientException e) { fail("Unexpected exception: " + e.getMessage()); } diff --git a/src/test/java/com/adyen/CheckoutTest.java b/src/test/java/com/adyen/CheckoutTest.java index af908d752..d8f3399a1 100644 --- a/src/test/java/com/adyen/CheckoutTest.java +++ b/src/test/java/com/adyen/CheckoutTest.java @@ -20,13 +20,26 @@ */ package com.adyen; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.Locale; +import java.util.TimeZone; +import org.junit.Test; import com.adyen.model.Amount; -import com.adyen.model.checkout.*; +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.PaymentsRequest; +import com.adyen.model.checkout.PaymentsResponse; import com.adyen.service.Checkout; -import org.junit.Test; - -import java.util.HashMap; - +import com.google.gson.annotations.SerializedName; +import static com.adyen.Service.GSON; import static com.adyen.enums.Environment.LIVE; import static junit.framework.TestCase.assertNull; import static org.junit.Assert.assertEquals; @@ -196,6 +209,39 @@ public void TestPaymentMethodsFailureMissingIdentifierOnLive() throws Exception } + @Test + public void TestPaymentMethodDetails() { + PaymentsRequest paymentsRequest = createPaymentsCheckoutRequest(); + String jsonRequest = GSON.toJson(paymentsRequest); + assertEquals( + "{\"amount\":{\"value\":1000,\"currency\":\"USD\"},\"merchantAccount\":\"MagentoMerchantTest\",\"paymentMethod\":{\"type\":\"scheme\",\"number\":\"4111111111111111\",\"expiryMonth\":\"10\",\"expiryYear\":\"2018\",\"holderName\":\"John Smith\",\"cvc\":\"737\"},\"reference\":\"Your order number\",\"returnUrl\":\"https://your-company.com/...\"}", + jsonRequest); + + TestPaymentMethodDetails testPaymentMethodDetails = new TestPaymentMethodDetails(); + testPaymentMethodDetails.setType("testType"); + testPaymentMethodDetails.setTestValue("testValue"); + paymentsRequest.setPaymentMethod(testPaymentMethodDetails); + + jsonRequest = GSON.toJson(paymentsRequest); + assertEquals( + "{\"amount\":{\"value\":1000,\"currency\":\"USD\"},\"merchantAccount\":\"MagentoMerchantTest\",\"paymentMethod\":{\"testKey\":\"testValue\",\"type\":\"testType\"},\"reference\":\"Your order number\",\"returnUrl\":\"https://your-company.com/...\"}", + jsonRequest); + } + + @Test + public void TestDateSerializers() throws ParseException { + PaymentsRequest paymentsRequest = new PaymentsRequest(); + + SimpleDateFormat fmt = new SimpleDateFormat("yyyy-MM-dd", Locale.ENGLISH); + fmt.setTimeZone(TimeZone.getTimeZone("GMT")); + + Date d = fmt.parse("2018-10-31"); + paymentsRequest.setDateOfBirth(d); + paymentsRequest.setDeliveryDate(d); + String jsonRequest = GSON.toJson(paymentsRequest); + assertEquals("{\"dateOfBirth\":\"2018-10-31\",\"deliveryDate\":\"2018-10-31T00:00:00.000Z\"}", jsonRequest); + } + /** * Returns a sample PaymentSessionRequest opbject with test data */ @@ -219,15 +265,7 @@ protected PaymentsRequest createPaymentsCheckoutRequest() { paymentsRequest.setReference("Your order number"); paymentsRequest.setAmount(createAmountObject("USD", 1000L)); - PaymentMethod paymentMethod = new PaymentMethod(); - paymentMethod.setType("scheme"); - paymentsRequest.setPaymentMethod(new HashMap()); - - paymentsRequest.putPaymentMethodItem("number", "4111111111111111"); - paymentsRequest.putPaymentMethodItem("expiryMonth", "08"); - paymentsRequest.putPaymentMethodItem("expiryYear", "2018"); - paymentsRequest.putPaymentMethodItem("holderName", "John Smith"); - paymentsRequest.putPaymentMethodItem("cvc", "737"); + paymentsRequest.addCardData("4111111111111111", "10", "2018", "737", "John Smith"); paymentsRequest.setReturnUrl("https://your-company.com/..."); paymentsRequest.setMerchantAccount("MagentoMerchantTest"); @@ -256,3 +294,29 @@ protected Amount createAmountObject(String currency, Long value) { return amount; } } + +class TestPaymentMethodDetails implements PaymentMethodDetails { + @SerializedName("testKey") + private String testValue; + + @SerializedName("type") + private String type; + + @Override + public String getType() { + return type; + } + + @Override + public void setType(String type) { + this.type = type; + } + + public String getTestValue() { + return testValue; + } + + public void setTestValue(String testValue) { + this.testValue = testValue; + } +} \ No newline at end of file diff --git a/src/test/java/com/adyen/MarketPayTest.java b/src/test/java/com/adyen/MarketPayTest.java index e3ad55ffa..2447576a0 100644 --- a/src/test/java/com/adyen/MarketPayTest.java +++ b/src/test/java/com/adyen/MarketPayTest.java @@ -23,6 +23,8 @@ import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.List; +import java.util.Locale; +import java.util.TimeZone; import org.junit.Test; import com.adyen.model.Address; import com.adyen.model.Amount; @@ -146,7 +148,9 @@ public void TestCreateSplitPayment() throws Exception { assertTrue(paymentResult.isAuthorised()); - SimpleDateFormat format = new SimpleDateFormat("M/yyyy"); + SimpleDateFormat format = new SimpleDateFormat("M/yyyy", Locale.ENGLISH); + format.setTimeZone(TimeZone.getTimeZone("GMT")); + assertEquals("8/2018", format.format(paymentResult.getExpiryDate())); assertEquals("411111", paymentResult.getCardBin()); @@ -277,7 +281,7 @@ public void TestAccountHolderBalanceSuccess() throws Exception { // create AccountHolderBalance Request AccountHolderBalanceRequest accountHolderBalanceRequest = new AccountHolderBalanceRequest(); accountHolderBalanceRequest.accountHolderCode("TestAccountHolder877209"); - AccountHolderBalanceResponse accountHolderBalanceResponse = fund.AccountHolderBalance(accountHolderBalanceRequest); + AccountHolderBalanceResponse accountHolderBalanceResponse = fund.accountHolderBalance(accountHolderBalanceRequest); assertEquals(new Long(42058), accountHolderBalanceResponse.getTotalBalance().getPendingBalance().get(0).getValue()); diff --git a/src/test/java/com/adyen/PaymentTest.java b/src/test/java/com/adyen/PaymentTest.java index 78d50221c..525f72e16 100644 --- a/src/test/java/com/adyen/PaymentTest.java +++ b/src/test/java/com/adyen/PaymentTest.java @@ -20,9 +20,12 @@ */ package com.adyen; +import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.HashMap; import java.util.List; +import java.util.Locale; +import java.util.TimeZone; import org.junit.Test; import com.adyen.constants.ApiConstants.AdditionalData; import com.adyen.constants.ApiConstants.RefusalReason; @@ -34,6 +37,7 @@ import com.adyen.model.PaymentRequest; import com.adyen.model.PaymentRequest3d; import com.adyen.model.PaymentResult; +import com.adyen.model.RequestOptions; import com.adyen.service.Payment; import com.adyen.service.exception.ApiException; import static com.adyen.constants.ApiConstants.SelectedBrand.BOLETO_SANTANDER; @@ -46,6 +50,7 @@ import static org.junit.Assert.fail; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyBoolean; +import static org.mockito.ArgumentMatchers.isNull; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; @@ -68,7 +73,9 @@ public void TestAuthoriseSuccessMocked() throws Exception { assertTrue(paymentResult.isAuthorised()); - SimpleDateFormat format = new SimpleDateFormat("M/yyyy"); + SimpleDateFormat format = new SimpleDateFormat("M/yyyy", Locale.ENGLISH); + format.setTimeZone(TimeZone.getTimeZone("GMT")); + assertEquals("8/2018", format.format(paymentResult.getExpiryDate())); assertEquals("411111", paymentResult.getCardBin()); @@ -203,7 +210,8 @@ public void TestError401Mocked() throws Exception { HttpURLConnectionClient httpURLConnectionClient = mock(HttpURLConnectionClient.class); HTTPClientException httpClientException = new HTTPClientException(401, "An error occured", new HashMap>(), null); - when(httpURLConnectionClient.request(any(String.class), any(String.class), any(Config.class), anyBoolean())).thenThrow(httpClientException); + when(httpURLConnectionClient.request(any(String.class), any(String.class), any(Config.class), anyBoolean(), any(RequestOptions.class))).thenThrow(httpClientException); + when(httpURLConnectionClient.request(any(String.class), any(String.class), any(Config.class), anyBoolean(), (RequestOptions) isNull())).thenThrow(httpClientException); Client client = new Client(); client.setHttpClient(httpURLConnectionClient); @@ -269,11 +277,14 @@ public void TestBoletoSuccess() throws Exception { "BQABAQB8k7t5uD2wSpo185nNeQ9CU50Zf6z/z9EdC5yFH3+1o/DQH3v3dtTxqXD2DrEdVH0Ro3r/+G9bdUzrCUjfMFh7YB32VL2oPqye9Ly/MWzj7bOaRrpGH5PaB8gE9LkIgo8WKqHix1cwsFm3aHiLBECjItOpUR/CBuiJBGPvseN7yrSdG5vQAUM9AQixpPkyCNokbnDZoa1y3+qihZa7vvzV/XylTXdgirxboVKpk07Wfvpad8Owg/K/ofDqUfrZ3SUovkJzpZ5wP2NtOz84zBV8dJ+9vZs+aor/E//s+EjKgNJt2s2uX0OfdE3h1n41RW2MlfQBtXLbgbxKVVSH5qfPELsZhr10A9y9VpCd9DOP6lEAAFchf10tGLvIKj2j4ktIErp0uLCbLqa1/AvmfQ9a6e0TClmsbtwKoZ9LvAPpzHqRcmidgyUM1Igk5YsHBD7L8pzoJS5hL+DKXMeUav6oP20v9huLS3Ps6EiK4fyg5kgptZPhSQ5UN3GrGSoefja1Ylw32EBovEiaK9rdKkT/eVf+wncwLTLUiMD26R7qRxbvwAg4G8VIv6dxvOsKf2RutfOoCBNH6VhgwXfIoe0bHqmpx4dGwrjkVThspdsZYhHFrZK58grIb4OyKORibOYxvsmYmRdWMDX9Y1X8uva8OYs=", paymentResult.getBoletoData()); - assertEquals("2017-05-22", new SimpleDateFormat("yyyy-MM-dd").format(paymentResult.getBoletoDueDate())); + DateFormat fmt = new SimpleDateFormat("yyyy-MM-dd", Locale.ENGLISH); + fmt.setTimeZone(TimeZone.getTimeZone("GMT")); + + assertEquals("2017-05-22", fmt.format(paymentResult.getBoletoDueDate())); assertEquals( "https://test.adyen.com/hpp/generationBoleto.shtml?data=BQABAQB8k7t5uD2wSpo185nNeQ9CU50Zf6z%2Fz9EdC5yFH3%2B1o%2FDQH3v3dtTxqXD2DrEdVH0Ro3r%2F%2BG9bdUzrCUjfMFh7YB32VL2oPqye9Ly%2FMWzj7bOaRrpGH5PaB8gE9LkIgo8WKqHix1cwsFm3aHiLBECjItOpUR%2FCBuiJBGPvseN7yrSdG5vQAUM9AQixpPkyCNokbnDZoa1y3%2BqihZa7vvzV%2FXylTXdgirxboVKpk07Wfvpad8Owg%2FK%2FofDqUfrZ3SUovkJzpZ5wP2NtOz84zBV8dJ%2B9vZs%2Baor%2FE%2F%2Fs%2BEjKgNJt2s2uX0OfdE3h1n41RW2MlfQBtXLbgbxKVVSH5qfPELsZhr10A9y9VpCd9DOP6lEAAFchf10tGLvIKj2j4ktIErp0uLCbLqa1%2FAvmfQ9a6e0TClmsbtwKoZ9LvAPpzHqRcmidgyUM1Igk5YsHBD7L8pzoJS5hL%2BDKXMeUav6oP20v9huLS3Ps6EiK4fyg5kgptZPhSQ5UN3GrGSoefja1Ylw32EBovEiaK9rdKkT%2FeVf%2BwncwLTLUiMD26R7qRxbvwAg4G8VIv6dxvOsKf2RutfOoCBNH6VhgwXfIoe0bHqmpx4dGwrjkVThspdsZYhHFrZK58grIb4OyKORibOYxvsmYmRdWMDX9Y1X8uva8OYs%3D", paymentResult.getBoletoUrl()); - assertEquals("2017-06-06", new SimpleDateFormat("yyyy-MM-dd").format(paymentResult.getBoletoExpirationDate())); + assertEquals("2017-06-06", fmt.format(paymentResult.getBoletoExpirationDate())); assertEquals(RECEIVED, paymentResult.getResultCode()); assertEquals("8814950120218231", paymentResult.getPspReference()); } diff --git a/src/test/java/com/adyen/RecurringTest.java b/src/test/java/com/adyen/RecurringTest.java index 809202677..88cbdc000 100644 --- a/src/test/java/com/adyen/RecurringTest.java +++ b/src/test/java/com/adyen/RecurringTest.java @@ -27,10 +27,13 @@ import com.adyen.model.recurring.RecurringDetail; import com.adyen.model.recurring.RecurringDetailsRequest; import com.adyen.model.recurring.RecurringDetailsResult; +import com.adyen.model.recurring.StoreTokenRequest; +import com.adyen.model.recurring.StoreTokenResult; import com.adyen.service.Recurring; import com.adyen.service.exception.ApiException; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotEquals; +import static org.junit.Assert.assertNotNull; import static org.junit.Assert.fail; public class RecurringTest extends BaseTest { @@ -52,6 +55,19 @@ private DisableRequest createDisableRequest() { return request; } + private StoreTokenRequest createStoreTokenRequest() { + StoreTokenRequest request = new StoreTokenRequest() + .shopperReference("test-123") + .merchantAccount("MerchantAccount") + .shopperEmail("johndoe@merchant.com") + .shopperStatement("this is your statement") + .shopperIP("192.168.1.1") + .setContractToOneClick() + .setCardData("5136333333333335", "John Doe", "08", "2018", "737"); + + return request; + } + @Test public void testListRecurringDetails() throws Exception { Client client = createMockClientFromFile("mocks/recurring/listRecurringDetails-success.json"); @@ -99,4 +115,38 @@ public void testDisable803() throws IOException { assertEquals("803", e.getError().getErrorCode()); } } + + @Test + public void testStoreToken() throws Exception { + Client client = createMockClientFromFile("mocks/recurring/storeToken-success.json"); + Recurring recurring = new Recurring(client); + + StoreTokenRequest request = createStoreTokenRequest(); + + StoreTokenResult result = recurring.storeToken(request); + assertNotNull(result); + assertEquals("Success", result.getResult()); + assertEquals("Default", result.getAliasType()); + assertEquals("8815398995557524", result.getPspReference()); + assertEquals("8315398995429067", result.getRecurringDetailReference()); + } + + @Test + public void testStoreToken101() throws IOException { + Client client = createMockClientForErrors(422, "mocks/recurring/storeToken-error-101.json"); + Recurring recurring = new Recurring(client); + + StoreTokenRequest request = createStoreTokenRequest(); + + @SuppressWarnings("unused") + StoreTokenResult result = null; + try { + result = recurring.storeToken(request); + fail("Exception expected!"); + } catch (ApiException e) { + assertNotEquals(200, e.getStatusCode()); + assertEquals("101", e.getError().getErrorCode()); + } + } + } diff --git a/src/test/java/com/adyen/service/ResourceTest.java b/src/test/java/com/adyen/service/ResourceTest.java index cf49f935e..0ac719aa3 100644 --- a/src/test/java/com/adyen/service/ResourceTest.java +++ b/src/test/java/com/adyen/service/ResourceTest.java @@ -59,7 +59,7 @@ public void setUp() { @Test public void testRequest() throws Exception { - when(clientInterfaceMock.request("", "request", null, false)).thenReturn("response"); + when(clientInterfaceMock.request("", "request", null, false, null)).thenReturn("response"); Resource resource = new Resource(serviceMock, "", null); String response = resource.request("request"); @@ -70,7 +70,7 @@ public void testRequest() throws Exception { @Test public void testRequestExceptionEmpty() throws IOException, HTTPClientException { try { - when(clientInterfaceMock.request("", "request", null, false)) + when(clientInterfaceMock.request("", "request", null, false, null)) .thenThrow(new HTTPClientException("message", 403, new HashMap>(), null)); Resource resource = new Resource(serviceMock, "", null); diff --git a/src/test/resources/mocks/recurring/storeToken-error-101.json b/src/test/resources/mocks/recurring/storeToken-error-101.json new file mode 100644 index 000000000..848c68cc6 --- /dev/null +++ b/src/test/resources/mocks/recurring/storeToken-error-101.json @@ -0,0 +1,6 @@ +{ + "status": 422, + "errorCode": "101", + "message": "Invalid card number", + "errorType": "validation" +} diff --git a/src/test/resources/mocks/recurring/storeToken-success.json b/src/test/resources/mocks/recurring/storeToken-success.json new file mode 100644 index 000000000..03457d7b6 --- /dev/null +++ b/src/test/resources/mocks/recurring/storeToken-success.json @@ -0,0 +1,7 @@ +{ + "alias": "P931324991331404", + "aliasType": "Default", + "pspReference": "8815398995557524", + "recurringDetailReference": "8315398995429067", + "result": "Success" +}