From b974d265c02f80513c0a75aa612c1e1b8c9d9402 Mon Sep 17 00:00:00 2001 From: renatoma Date: Wed, 22 May 2019 11:34:51 +0200 Subject: [PATCH 1/2] Adding missing fields on Checkout PaymentsRequest --- .../adyen/model/checkout/PaymentsRequest.java | 93 +++++++++++++++---- 1 file changed, 77 insertions(+), 16 deletions(-) diff --git a/src/main/java/com/adyen/model/checkout/PaymentsRequest.java b/src/main/java/com/adyen/model/checkout/PaymentsRequest.java index 180d67918..a61c5a83f 100755 --- a/src/main/java/com/adyen/model/checkout/PaymentsRequest.java +++ b/src/main/java/com/adyen/model/checkout/PaymentsRequest.java @@ -58,8 +58,6 @@ public class PaymentsRequest { private AccountInfo accountInfo = null; @SerializedName("additionalData") private Map additionalData = null; - @SerializedName("allowedPaymentMethods") - private List allowedPaymentMethods = null; @SerializedName("amount") private Amount amount = null; @SerializedName("billingAddress") @@ -160,6 +158,17 @@ public class PaymentsRequest { @SerializedName("recurringProcessingModel") private RecurringProcessingModelEnum recurringProcessingModel = null; + @SerializedName("merchantData") + private String merchantData = null; + + @SerializedName("mpiData") + private ThreeDSecureData mpiData = null; + + @SerializedName("redirectFromIssuerMethod") + private String redirectFromIssuerMethod = null; + + @SerializedName("redirectToIssuerMethod") + private String redirectToIssuerMethod = null; public PaymentsRequest() { if (this.applicationInfo == null) { @@ -196,14 +205,6 @@ public void setAccountInfo(AccountInfo accountInfo) { this.accountInfo = accountInfo; } - public List getAllowedPaymentMethods() { - return allowedPaymentMethods; - } - - public void setAllowedPaymentMethods(List allowedPaymentMethods) { - this.allowedPaymentMethods = allowedPaymentMethods; - } - public Boolean getEnableOneClick() { return enableOneClick; } @@ -1070,6 +1071,58 @@ public PaymentsRequest origin(String origin) { return this; } + /** + * Holds different merchant data points like product, purchase, customer, and so on. It takes data in a JSON string. + * + * @return the merchant data + */ + public String getMerchantData() { + return merchantData; + } + + public void setMerchantData(String merchantData) { + this.merchantData = merchantData; + } + + /** + * Authentication data produced by an MPI (Mastercard SecureCode or Verified By Visa). + * + * @return the mpi data + */ + public ThreeDSecureData getMpiData() { + return mpiData; + } + + public void setMpiData(ThreeDSecureData mpiData) { + this.mpiData = mpiData; + } + + /** + * Specifies the redirect method (GET or POST) when redirecting back from the issuer. + * + * @return the redirect from issuer method + */ + public String getRedirectFromIssuerMethod() { + return redirectFromIssuerMethod; + } + + public void setRedirectFromIssuerMethod(String redirectFromIssuerMethod) { + this.redirectFromIssuerMethod = redirectFromIssuerMethod; + } + + /** + * Specifies the redirect method (GET or POST) when redirecting to the issuer. + * + * @return the redirect to issuer method + */ + public String getRedirectToIssuerMethod() { + return redirectToIssuerMethod; + } + + public void setRedirectToIssuerMethod(String redirectToIssuerMethod) { + this.redirectToIssuerMethod = redirectToIssuerMethod; + } + @Override public boolean equals(Object o) { if (this == o) { @@ -1120,13 +1173,15 @@ public boolean equals(Object o) { && Objects.equals(this.telephoneNumber, paymentsRequest.telephoneNumber) && Objects.equals(this.splits, paymentsRequest.splits) && Objects.equals(this.accountInfo, paymentsRequest.accountInfo) - && Objects.equals(this.allowedPaymentMethods, paymentsRequest.allowedPaymentMethods) && Objects.equals(this.trustedShopper, paymentsRequest.trustedShopper) && Objects.equals(this.merchantRiskIndicator, paymentsRequest.merchantRiskIndicator) && Objects.equals(this.threeDS2RequestData, paymentsRequest.threeDS2RequestData) && Objects.equals(this.trustedShopper, paymentsRequest.trustedShopper) - && Objects.equals(this.origin, paymentsRequest.origin); - + && Objects.equals(this.origin, paymentsRequest.origin) + && Objects.equals(this.metadata, paymentsRequest.metadata) + && Objects.equals(this.mpiData, paymentsRequest.mpiData) + && Objects.equals(this.redirectFromIssuerMethod, paymentsRequest.redirectFromIssuerMethod) + && Objects.equals(this.redirectToIssuerMethod, paymentsRequest.redirectToIssuerMethod); } @Override @@ -1171,11 +1226,14 @@ public int hashCode() { applicationInfo, telephoneNumber, accountInfo, - allowedPaymentMethods, splits, trustedShopper, blockedPaymentMethods, - configId); + configId, + metadata, + mpiData, + redirectFromIssuerMethod, + redirectToIssuerMethod); } @Override @@ -1224,13 +1282,16 @@ public String toString() { + " accountInfo: " + toIndentedString(accountInfo) + "\n" + " trustedShopper: " + toIndentedString(trustedShopper) + "\n" + " splits: " + toIndentedString(splits) + "\n" - + " allowedPaymentMethods: " + toIndentedString(allowedPaymentMethods) + "\n" + " merchantRiskIndicator: " + toIndentedString(merchantRiskIndicator) + "\n" + " threeDS2RequestData: " + toIndentedString(threeDS2RequestData) + "\n" + " trustedShopper: " + toIndentedString(trustedShopper) + "\n" + " blockedPaymentMethods: " + toIndentedString(blockedPaymentMethods) + "\n" + " configId: " + toIndentedString(configId) + "\n" + " origin: " + toIndentedString(origin) + "\n" + + " metadata: " + toIndentedString(metadata) + "\n" + + " mpiData: " + toIndentedString(mpiData) + "\n" + + " redirectFromIssuerMethod: " + toIndentedString(redirectFromIssuerMethod) + "\n" + + " redirectToIssuerMethod: " + toIndentedString(redirectToIssuerMethod) + "\n" + "}"; } From 747fd5790f3b9ce7ee7323e14ff941945690151e Mon Sep 17 00:00:00 2001 From: renatoma Date: Wed, 22 May 2019 11:56:43 +0200 Subject: [PATCH 2/2] Fix equals and hashCode --- .../adyen/model/checkout/PaymentsRequest.java | 55 ++++++++++++++----- 1 file changed, 41 insertions(+), 14 deletions(-) diff --git a/src/main/java/com/adyen/model/checkout/PaymentsRequest.java b/src/main/java/com/adyen/model/checkout/PaymentsRequest.java index a61c5a83f..f4626843c 100755 --- a/src/main/java/com/adyen/model/checkout/PaymentsRequest.java +++ b/src/main/java/com/adyen/model/checkout/PaymentsRequest.java @@ -20,8 +20,6 @@ */ package com.adyen.model.checkout; -import static com.adyen.constants.ApiConstants.PaymentMethodType.TYPE_SCHEME; - import com.adyen.Util.Util; import com.adyen.model.AccountInfo; import com.adyen.model.Address; @@ -41,6 +39,7 @@ import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; + import java.io.IOException; import java.util.ArrayList; import java.util.Date; @@ -49,6 +48,8 @@ import java.util.Map; import java.util.Objects; +import static com.adyen.constants.ApiConstants.PaymentMethodType.TYPE_SCHEME; + /** * PaymentsRequest */ @@ -1084,6 +1085,11 @@ public void setMerchantData(String merchantData) { this.merchantData = merchantData; } + public PaymentsRequest merchantData(String merchantData) { + this.merchantData = merchantData; + return this; + } + /** * Authentication data produced by an MPI (Mastercard SecureCode or Verified By Visa). * @@ -1097,6 +1103,11 @@ public void setMpiData(ThreeDSecureData mpiData) { this.mpiData = mpiData; } + public PaymentsRequest mpiData(ThreeDSecureData mpiData) { + this.mpiData = mpiData; + return this; + } + /** * Specifies the redirect method (GET or POST) when redirecting back from the issuer. * @@ -1110,6 +1121,11 @@ public void setRedirectFromIssuerMethod(String redirectFromIssuerMethod) { this.redirectFromIssuerMethod = redirectFromIssuerMethod; } + public PaymentsRequest redirectFromIssuerMethod(String redirectFromIssuerMethod) { + this.redirectFromIssuerMethod = redirectFromIssuerMethod; + return this; + } + /** * Specifies the redirect method (GET or POST) when redirecting to the issuer. * @@ -1123,6 +1139,11 @@ public void setRedirectToIssuerMethod(String redirectToIssuerMethod) { this.redirectToIssuerMethod = redirectToIssuerMethod; } + public PaymentsRequest redirectToIssuerMethod(String redirectToIssuerMethod) { + this.redirectToIssuerMethod = redirectToIssuerMethod; + return this; + } + @Override public boolean equals(Object o) { if (this == o) { @@ -1132,7 +1153,8 @@ public boolean equals(Object o) { return false; } PaymentsRequest paymentsRequest = (PaymentsRequest) o; - return Objects.equals(this.additionalData, paymentsRequest.additionalData) + return Objects.equals(this.accountInfo, paymentsRequest.accountInfo) + && Objects.equals(this.additionalData, paymentsRequest.additionalData) && Objects.equals(this.amount, paymentsRequest.amount) && Objects.equals(this.billingAddress, paymentsRequest.billingAddress) && Objects.equals(this.captureDelayHours, paymentsRequest.captureDelayHours) @@ -1158,7 +1180,6 @@ public boolean equals(Object o) { && Objects.equals(this.paymentMethod, paymentsRequest.paymentMethod) && Objects.equals(this.reference, paymentsRequest.reference) && Objects.equals(this.returnUrl, paymentsRequest.returnUrl) - && Objects.equals(this.recurringProcessingModel, paymentsRequest.recurringProcessingModel) && Objects.equals(this.sessionValidity, paymentsRequest.sessionValidity) && Objects.equals(this.shopperEmail, paymentsRequest.shopperEmail) && Objects.equals(this.shopperIP, paymentsRequest.shopperIP) @@ -1168,17 +1189,19 @@ 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.telephoneNumber, paymentsRequest.telephoneNumber) + && Objects.equals(this.browserInfo, paymentsRequest.browserInfo) && Objects.equals(this.deviceFingerprint, paymentsRequest.deviceFingerprint) && Objects.equals(this.applicationInfo, paymentsRequest.applicationInfo) - && Objects.equals(this.telephoneNumber, paymentsRequest.telephoneNumber) && Objects.equals(this.splits, paymentsRequest.splits) - && Objects.equals(this.accountInfo, paymentsRequest.accountInfo) - && Objects.equals(this.trustedShopper, paymentsRequest.trustedShopper) && Objects.equals(this.merchantRiskIndicator, paymentsRequest.merchantRiskIndicator) && Objects.equals(this.threeDS2RequestData, paymentsRequest.threeDS2RequestData) && Objects.equals(this.trustedShopper, paymentsRequest.trustedShopper) && Objects.equals(this.origin, paymentsRequest.origin) - && Objects.equals(this.metadata, paymentsRequest.metadata) + && Objects.equals(this.configId, paymentsRequest.configId) + && Objects.equals(this.blockedPaymentMethods, paymentsRequest.blockedPaymentMethods) + && Objects.equals(this.recurringProcessingModel, paymentsRequest.recurringProcessingModel) + && Objects.equals(this.merchantData, paymentsRequest.merchantData) && Objects.equals(this.mpiData, paymentsRequest.mpiData) && Objects.equals(this.redirectFromIssuerMethod, paymentsRequest.redirectFromIssuerMethod) && Objects.equals(this.redirectToIssuerMethod, paymentsRequest.redirectToIssuerMethod); @@ -1186,7 +1209,8 @@ public boolean equals(Object o) { @Override public int hashCode() { - return Objects.hash(additionalData, + return Objects.hash(accountInfo, + additionalData, amount, billingAddress, captureDelayHours, @@ -1212,7 +1236,6 @@ public int hashCode() { paymentMethod, reference, returnUrl, - recurringProcessingModel, sessionValidity, shopperEmail, shopperIP, @@ -1222,15 +1245,19 @@ public int hashCode() { shopperReference, shopperStatement, socialSecurityNumber, + telephoneNumber, + browserInfo, deviceFingerprint, applicationInfo, - telephoneNumber, - accountInfo, splits, + merchantRiskIndicator, + threeDS2RequestData, trustedShopper, - blockedPaymentMethods, + origin, configId, - metadata, + blockedPaymentMethods, + recurringProcessingModel, + merchantData, mpiData, redirectFromIssuerMethod, redirectToIssuerMethod);