diff --git a/src/main/java/com/adyen/model/checkout/CheckoutForwardRequest.java b/src/main/java/com/adyen/model/checkout/CheckoutForwardRequest.java index 2f6c0cc86..ec7b99ca5 100644 --- a/src/main/java/com/adyen/model/checkout/CheckoutForwardRequest.java +++ b/src/main/java/com/adyen/model/checkout/CheckoutForwardRequest.java @@ -23,6 +23,7 @@ @JsonPropertyOrder({ CheckoutForwardRequest.JSON_PROPERTY_BASE_URL, CheckoutForwardRequest.JSON_PROPERTY_MERCHANT_ACCOUNT, + CheckoutForwardRequest.JSON_PROPERTY_MERCHANT_REFERENCE, CheckoutForwardRequest.JSON_PROPERTY_OPTIONS, CheckoutForwardRequest.JSON_PROPERTY_PAYMENT_METHOD, CheckoutForwardRequest.JSON_PROPERTY_REQUEST, @@ -42,6 +43,12 @@ public class CheckoutForwardRequest { /** Mark when the attribute has been explicitly set. */ private boolean isSetMerchantAccount = false; + public static final String JSON_PROPERTY_MERCHANT_REFERENCE = "merchantReference"; + private String merchantReference; + + /** Mark when the attribute has been explicitly set. */ + private boolean isSetMerchantReference = false; + public static final String JSON_PROPERTY_OPTIONS = "options"; private CheckoutForwardRequestOptions options; @@ -156,6 +163,41 @@ public void setMerchantAccount(String merchantAccount) { isSetMerchantAccount = true; // mark as set } + /** + * Merchant defined payment reference. + * + * @param merchantReference Merchant defined payment reference. + * @return the current {@code CheckoutForwardRequest} instance, allowing for method chaining + */ + public CheckoutForwardRequest merchantReference(String merchantReference) { + this.merchantReference = merchantReference; + isSetMerchantReference = true; // mark as set + return this; + } + + /** + * Merchant defined payment reference. + * + * @return merchantReference Merchant defined payment reference. + */ + @JsonProperty(JSON_PROPERTY_MERCHANT_REFERENCE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getMerchantReference() { + return merchantReference; + } + + /** + * Merchant defined payment reference. + * + * @param merchantReference Merchant defined payment reference. + */ + @JsonProperty(JSON_PROPERTY_MERCHANT_REFERENCE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setMerchantReference(String merchantReference) { + this.merchantReference = merchantReference; + isSetMerchantReference = true; // mark as set + } + /** * options * @@ -389,6 +431,9 @@ public boolean equals(Object o) { && Objects.equals(this.isSetBaseUrl, checkoutForwardRequest.isSetBaseUrl) && Objects.equals(this.merchantAccount, checkoutForwardRequest.merchantAccount) && Objects.equals(this.isSetMerchantAccount, checkoutForwardRequest.isSetMerchantAccount) + && Objects.equals(this.merchantReference, checkoutForwardRequest.merchantReference) + && Objects.equals( + this.isSetMerchantReference, checkoutForwardRequest.isSetMerchantReference) && Objects.equals(this.options, checkoutForwardRequest.options) && Objects.equals(this.isSetOptions, checkoutForwardRequest.isSetOptions) && Objects.equals(this.paymentMethod, checkoutForwardRequest.paymentMethod) @@ -409,6 +454,8 @@ public int hashCode() { isSetBaseUrl, merchantAccount, isSetMerchantAccount, + merchantReference, + isSetMerchantReference, options, isSetOptions, paymentMethod, @@ -427,6 +474,7 @@ public String toString() { sb.append("class CheckoutForwardRequest {\n"); sb.append(" baseUrl: ").append(toIndentedString(baseUrl)).append("\n"); sb.append(" merchantAccount: ").append(toIndentedString(merchantAccount)).append("\n"); + sb.append(" merchantReference: ").append(toIndentedString(merchantReference)).append("\n"); sb.append(" options: ").append(toIndentedString(options)).append("\n"); sb.append(" paymentMethod: ").append(toIndentedString(paymentMethod)).append("\n"); sb.append(" request: ").append(toIndentedString(request)).append("\n"); @@ -464,6 +512,9 @@ public Map getExplicitNulls() { if (isSetMerchantAccount) { addIfNull(nulls, JSON_PROPERTY_MERCHANT_ACCOUNT, this.merchantAccount); } + if (isSetMerchantReference) { + addIfNull(nulls, JSON_PROPERTY_MERCHANT_REFERENCE, this.merchantReference); + } if (isSetOptions) { addIfNull(nulls, JSON_PROPERTY_OPTIONS, this.options); } diff --git a/src/main/java/com/adyen/model/checkout/CheckoutForwardResponse.java b/src/main/java/com/adyen/model/checkout/CheckoutForwardResponse.java index 59161dc8f..4ea5f10f6 100644 --- a/src/main/java/com/adyen/model/checkout/CheckoutForwardResponse.java +++ b/src/main/java/com/adyen/model/checkout/CheckoutForwardResponse.java @@ -21,11 +21,18 @@ /** CheckoutForwardResponse */ @JsonPropertyOrder({ + CheckoutForwardResponse.JSON_PROPERTY_MERCHANT_REFERENCE, CheckoutForwardResponse.JSON_PROPERTY_PSP_REFERENCE, CheckoutForwardResponse.JSON_PROPERTY_RESPONSE, CheckoutForwardResponse.JSON_PROPERTY_STORED_PAYMENT_METHOD_ID }) public class CheckoutForwardResponse { + public static final String JSON_PROPERTY_MERCHANT_REFERENCE = "merchantReference"; + private String merchantReference; + + /** Mark when the attribute has been explicitly set. */ + private boolean isSetMerchantReference = false; + public static final String JSON_PROPERTY_PSP_REFERENCE = "pspReference"; private String pspReference; @@ -52,6 +59,41 @@ public class CheckoutForwardResponse { public CheckoutForwardResponse() {} + /** + * Merchant defined payment reference. + * + * @param merchantReference Merchant defined payment reference. + * @return the current {@code CheckoutForwardResponse} instance, allowing for method chaining + */ + public CheckoutForwardResponse merchantReference(String merchantReference) { + this.merchantReference = merchantReference; + isSetMerchantReference = true; // mark as set + return this; + } + + /** + * Merchant defined payment reference. + * + * @return merchantReference Merchant defined payment reference. + */ + @JsonProperty(JSON_PROPERTY_MERCHANT_REFERENCE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getMerchantReference() { + return merchantReference; + } + + /** + * Merchant defined payment reference. + * + * @param merchantReference Merchant defined payment reference. + */ + @JsonProperty(JSON_PROPERTY_MERCHANT_REFERENCE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setMerchantReference(String merchantReference) { + this.merchantReference = merchantReference; + isSetMerchantReference = true; // mark as set + } + /** * Adyen's 16-character reference associated with the transaction/request. This value is * globally unique. Use this reference when you communicate with us about this request. @@ -196,7 +238,10 @@ public boolean equals(Object o) { return false; } CheckoutForwardResponse checkoutForwardResponse = (CheckoutForwardResponse) o; - return Objects.equals(this.pspReference, checkoutForwardResponse.pspReference) + return Objects.equals(this.merchantReference, checkoutForwardResponse.merchantReference) + && Objects.equals( + this.isSetMerchantReference, checkoutForwardResponse.isSetMerchantReference) + && Objects.equals(this.pspReference, checkoutForwardResponse.pspReference) && Objects.equals(this.isSetPspReference, checkoutForwardResponse.isSetPspReference) && Objects.equals(this.response, checkoutForwardResponse.response) && Objects.equals(this.isSetResponse, checkoutForwardResponse.isSetResponse) @@ -208,6 +253,8 @@ public boolean equals(Object o) { @Override public int hashCode() { return Objects.hash( + merchantReference, + isSetMerchantReference, pspReference, isSetPspReference, response, @@ -220,6 +267,7 @@ public int hashCode() { public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class CheckoutForwardResponse {\n"); + sb.append(" merchantReference: ").append(toIndentedString(merchantReference)).append("\n"); sb.append(" pspReference: ").append(toIndentedString(pspReference)).append("\n"); sb.append(" response: ").append(toIndentedString(response)).append("\n"); sb.append(" storedPaymentMethodId: ") @@ -249,6 +297,9 @@ public Map getExplicitNulls() { Map nulls = new HashMap<>(); + if (isSetMerchantReference) { + addIfNull(nulls, JSON_PROPERTY_MERCHANT_REFERENCE, this.merchantReference); + } if (isSetPspReference) { addIfNull(nulls, JSON_PROPERTY_PSP_REFERENCE, this.pspReference); } diff --git a/src/main/java/com/adyen/model/checkout/StoredPaymentMethodDetails.java b/src/main/java/com/adyen/model/checkout/StoredPaymentMethodDetails.java index ffa613449..02aa911a6 100644 --- a/src/main/java/com/adyen/model/checkout/StoredPaymentMethodDetails.java +++ b/src/main/java/com/adyen/model/checkout/StoredPaymentMethodDetails.java @@ -59,6 +59,30 @@ public class StoredPaymentMethodDetails { /** The payment method type. */ public enum TypeEnum { + ALIPAY_PLUS(String.valueOf("alipay_plus")), + + ALIPAY_PLUS_ALIPAY_CN(String.valueOf("alipay_plus_alipay_cn")), + + ALIPAY_PLUS_ALIPAY_HK(String.valueOf("alipay_plus_alipay_hk")), + + ALIPAY_PLUS_DANA(String.valueOf("alipay_plus_dana")), + + ALIPAY_PLUS_GCASH(String.valueOf("alipay_plus_gcash")), + + ALIPAY_PLUS_KAKAOPAY(String.valueOf("alipay_plus_kakaopay")), + + ALIPAY_PLUS_KPLUS(String.valueOf("alipay_plus_kplus")), + + ALIPAY_PLUS_NAVERPAY(String.valueOf("alipay_plus_naverpay")), + + ALIPAY_PLUS_RABBITLINEPAY(String.valueOf("alipay_plus_rabbitlinepay")), + + ALIPAY_PLUS_TOSSPAY(String.valueOf("alipay_plus_tosspay")), + + ALIPAY_PLUS_TOUCHNGO(String.valueOf("alipay_plus_touchngo")), + + ALIPAY_PLUS_TRUEMONEY(String.valueOf("alipay_plus_truemoney")), + BCMC_MOBILE(String.valueOf("bcmc_mobile")), BCMC_MOBILE_QR(String.valueOf("bcmc_mobile_QR")), diff --git a/src/main/java/com/adyen/model/checkout/StoredPaymentMethodResource.java b/src/main/java/com/adyen/model/checkout/StoredPaymentMethodResource.java index 5162f59ac..910856472 100644 --- a/src/main/java/com/adyen/model/checkout/StoredPaymentMethodResource.java +++ b/src/main/java/com/adyen/model/checkout/StoredPaymentMethodResource.java @@ -24,6 +24,7 @@ /** StoredPaymentMethodResource */ @JsonPropertyOrder({ StoredPaymentMethodResource.JSON_PROPERTY_BRAND, + StoredPaymentMethodResource.JSON_PROPERTY_CARD_BIN, StoredPaymentMethodResource.JSON_PROPERTY_EXPIRY_MONTH, StoredPaymentMethodResource.JSON_PROPERTY_EXPIRY_YEAR, StoredPaymentMethodResource.JSON_PROPERTY_EXTERNAL_RESPONSE_CODE, @@ -49,6 +50,12 @@ public class StoredPaymentMethodResource { /** Mark when the attribute has been explicitly set. */ private boolean isSetBrand = false; + public static final String JSON_PROPERTY_CARD_BIN = "cardBin"; + private String cardBin; + + /** Mark when the attribute has been explicitly set. */ + private boolean isSetCardBin = false; + public static final String JSON_PROPERTY_EXPIRY_MONTH = "expiryMonth"; private String expiryMonth; @@ -195,6 +202,41 @@ public void setBrand(String brand) { isSetBrand = true; // mark as set } + /** + * The bank identification number (BIN) of the card. + * + * @param cardBin The bank identification number (BIN) of the card. + * @return the current {@code StoredPaymentMethodResource} instance, allowing for method chaining + */ + public StoredPaymentMethodResource cardBin(String cardBin) { + this.cardBin = cardBin; + isSetCardBin = true; // mark as set + return this; + } + + /** + * The bank identification number (BIN) of the card. + * + * @return cardBin The bank identification number (BIN) of the card. + */ + @JsonProperty(JSON_PROPERTY_CARD_BIN) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getCardBin() { + return cardBin; + } + + /** + * The bank identification number (BIN) of the card. + * + * @param cardBin The bank identification number (BIN) of the card. + */ + @JsonProperty(JSON_PROPERTY_CARD_BIN) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setCardBin(String cardBin) { + this.cardBin = cardBin; + isSetCardBin = true; // mark as set + } + /** * The month the card expires. * @@ -917,6 +959,8 @@ public boolean equals(Object o) { StoredPaymentMethodResource storedPaymentMethodResource = (StoredPaymentMethodResource) o; return Objects.equals(this.brand, storedPaymentMethodResource.brand) && Objects.equals(this.isSetBrand, storedPaymentMethodResource.isSetBrand) + && Objects.equals(this.cardBin, storedPaymentMethodResource.cardBin) + && Objects.equals(this.isSetCardBin, storedPaymentMethodResource.isSetCardBin) && Objects.equals(this.expiryMonth, storedPaymentMethodResource.expiryMonth) && Objects.equals(this.isSetExpiryMonth, storedPaymentMethodResource.isSetExpiryMonth) && Objects.equals(this.expiryYear, storedPaymentMethodResource.expiryYear) @@ -969,6 +1013,8 @@ public int hashCode() { return Objects.hash( brand, isSetBrand, + cardBin, + isSetCardBin, expiryMonth, isSetExpiryMonth, expiryYear, @@ -1010,6 +1056,7 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class StoredPaymentMethodResource {\n"); sb.append(" brand: ").append(toIndentedString(brand)).append("\n"); + sb.append(" cardBin: ").append(toIndentedString(cardBin)).append("\n"); sb.append(" expiryMonth: ").append(toIndentedString(expiryMonth)).append("\n"); sb.append(" expiryYear: ").append(toIndentedString(expiryYear)).append("\n"); sb.append(" externalResponseCode: ") @@ -1060,6 +1107,9 @@ public Map getExplicitNulls() { if (isSetBrand) { addIfNull(nulls, JSON_PROPERTY_BRAND, this.brand); } + if (isSetCardBin) { + addIfNull(nulls, JSON_PROPERTY_CARD_BIN, this.cardBin); + } if (isSetExpiryMonth) { addIfNull(nulls, JSON_PROPERTY_EXPIRY_MONTH, this.expiryMonth); } diff --git a/src/test/java/com/adyen/CheckoutTest.java b/src/test/java/com/adyen/CheckoutTest.java index b81e95531..396880cdc 100644 --- a/src/test/java/com/adyen/CheckoutTest.java +++ b/src/test/java/com/adyen/CheckoutTest.java @@ -889,7 +889,7 @@ public void testForwardCardDetails() throws Exception { CheckoutForwardResponse response = recurringApi.forward(checkoutForwardRequest); - assertNull(response.getStoredPaymentMethodId()); // card is not tokenized + assertNull(response.getStoredPaymentMethodId()); // card is not tokenized assertNotNull(response.getResponse()); assertEquals(200, (int) response.getResponse().getStatus()); assertTrue(response.getResponse().getBody().contains("PAYMENT_METHOD_ID"));