Skip to content

Commit 0527fb1

Browse files
AdyenAutomationBotAdyenAutomationBotgcatanese
authored
Code generation: update services and models (#1560)
* false[adyen-sdk-automation] automated change * style(fmt): code formatted * Revert ShopperName creation * Add testUpiQrCode --------- Co-authored-by: AdyenAutomationBot <AdyenAutomationBot 38424300+AdyenAutomationBot@users.noreply.github.com> Co-authored-by: gcatanese <gcatanese@yahoo.com>
1 parent 3d02450 commit 0527fb1

File tree

10 files changed

+686
-21
lines changed

10 files changed

+686
-21
lines changed

src/main/java/com/adyen/httpclient/AdyenCustomRedirectStrategy.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,12 @@
77
import org.apache.hc.core5.http.HttpResponse;
88
import org.apache.hc.core5.http.protocol.HttpContext;
99

10-
/**
11-
* Implements a custom redirect strategy when the API returns 308
12-
*/
10+
/** Implements a custom redirect strategy when the API returns 308 */
1311
public class AdyenCustomRedirectStrategy extends DefaultRedirectStrategy {
1412

1513
/**
1614
* Override getLocationURI to validate the location header
15+
*
1716
* @param request the request
1817
* @param response the response
1918
* @param context the context

src/main/java/com/adyen/model/checkout/AdditionalDataLevel23.java

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -948,14 +948,15 @@ public void setEnhancedSchemeDataShipFromPostalCode(String enhancedSchemeDataShi
948948
* The amount of state or provincial [tax included in the total transaction
949949
* amount](https://docs.adyen.com/payment-methods/cards/enhanced-scheme-data/l2-l3#requirements-to-send-level-2-3-esd),
950950
* in [minor units](https://docs.adyen.com/development-resources/currency-codes). * For example,
951-
* 2000 means USD 20.00. * Encoding: Numeric * Max length: 12 characters * Must not be all zeros.
951+
* 2000 means USD 20.00. * Encoding: Numeric * Max length: 12 characters * For L2 data: must not
952+
* be all zeroes. * For L3 data: can be zero.
952953
*
953954
* @param enhancedSchemeDataTotalTaxAmount The amount of state or provincial [tax included in the
954955
* total transaction
955956
* amount](https://docs.adyen.com/payment-methods/cards/enhanced-scheme-data/l2-l3#requirements-to-send-level-2-3-esd),
956957
* in [minor units](https://docs.adyen.com/development-resources/currency-codes). * For
957-
* example, 2000 means USD 20.00. * Encoding: Numeric * Max length: 12 characters * Must not
958-
* be all zeros.
958+
* example, 2000 means USD 20.00. * Encoding: Numeric * Max length: 12 characters * For L2
959+
* data: must not be all zeroes. * For L3 data: can be zero.
959960
* @return the current {@code AdditionalDataLevel23} instance, allowing for method chaining
960961
*/
961962
public AdditionalDataLevel23 enhancedSchemeDataTotalTaxAmount(
@@ -968,14 +969,15 @@ public AdditionalDataLevel23 enhancedSchemeDataTotalTaxAmount(
968969
* The amount of state or provincial [tax included in the total transaction
969970
* amount](https://docs.adyen.com/payment-methods/cards/enhanced-scheme-data/l2-l3#requirements-to-send-level-2-3-esd),
970971
* in [minor units](https://docs.adyen.com/development-resources/currency-codes). * For example,
971-
* 2000 means USD 20.00. * Encoding: Numeric * Max length: 12 characters * Must not be all zeros.
972+
* 2000 means USD 20.00. * Encoding: Numeric * Max length: 12 characters * For L2 data: must not
973+
* be all zeroes. * For L3 data: can be zero.
972974
*
973975
* @return enhancedSchemeDataTotalTaxAmount The amount of state or provincial [tax included in the
974976
* total transaction
975977
* amount](https://docs.adyen.com/payment-methods/cards/enhanced-scheme-data/l2-l3#requirements-to-send-level-2-3-esd),
976978
* in [minor units](https://docs.adyen.com/development-resources/currency-codes). * For
977-
* example, 2000 means USD 20.00. * Encoding: Numeric * Max length: 12 characters * Must not
978-
* be all zeros.
979+
* example, 2000 means USD 20.00. * Encoding: Numeric * Max length: 12 characters * For L2
980+
* data: must not be all zeroes. * For L3 data: can be zero.
979981
*/
980982
@JsonProperty(JSON_PROPERTY_ENHANCED_SCHEME_DATA_TOTAL_TAX_AMOUNT)
981983
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
@@ -987,14 +989,15 @@ public String getEnhancedSchemeDataTotalTaxAmount() {
987989
* The amount of state or provincial [tax included in the total transaction
988990
* amount](https://docs.adyen.com/payment-methods/cards/enhanced-scheme-data/l2-l3#requirements-to-send-level-2-3-esd),
989991
* in [minor units](https://docs.adyen.com/development-resources/currency-codes). * For example,
990-
* 2000 means USD 20.00. * Encoding: Numeric * Max length: 12 characters * Must not be all zeros.
992+
* 2000 means USD 20.00. * Encoding: Numeric * Max length: 12 characters * For L2 data: must not
993+
* be all zeroes. * For L3 data: can be zero.
991994
*
992995
* @param enhancedSchemeDataTotalTaxAmount The amount of state or provincial [tax included in the
993996
* total transaction
994997
* amount](https://docs.adyen.com/payment-methods/cards/enhanced-scheme-data/l2-l3#requirements-to-send-level-2-3-esd),
995998
* in [minor units](https://docs.adyen.com/development-resources/currency-codes). * For
996-
* example, 2000 means USD 20.00. * Encoding: Numeric * Max length: 12 characters * Must not
997-
* be all zeros.
999+
* example, 2000 means USD 20.00. * Encoding: Numeric * Max length: 12 characters * For L2
1000+
* data: must not be all zeroes. * For L3 data: can be zero.
9981001
*/
9991002
@JsonProperty(JSON_PROPERTY_ENHANCED_SCHEME_DATA_TOTAL_TAX_AMOUNT)
10001003
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

src/main/java/com/adyen/model/checkout/CheckoutPaymentMethod.java

Lines changed: 54 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1300,6 +1300,32 @@ public CheckoutPaymentMethod deserialize(JsonParser jp, DeserializationContext c
13001300
log.log(Level.FINER, "Input data does not match schema 'UpiIntentDetails'", e);
13011301
}
13021302

1303+
// deserialize UpiQrDetails
1304+
try {
1305+
boolean attemptParsing = true;
1306+
if (attemptParsing) {
1307+
// Checks if the unique type of the oneOf json matches any of the object TypeEnum values
1308+
boolean typeMatch = false;
1309+
if (tree.findValue("type") != null) {
1310+
typeMatch =
1311+
Arrays.stream(UpiQrDetails.TypeEnum.values())
1312+
.anyMatch((t) -> t.getValue().equals(tree.findValue("type").asText()));
1313+
}
1314+
1315+
if (typeMatch) {
1316+
deserialized = tree.traverse(jp.getCodec()).readValueAs(UpiQrDetails.class);
1317+
// TODO: there is no validation against JSON schema constraints
1318+
// (min, max, enum, pattern...), this does not perform a strict JSON
1319+
// validation, which means the 'match' count may be higher than it should be.
1320+
match++;
1321+
log.log(Level.FINER, "Input data matches schema 'UpiQrDetails'");
1322+
}
1323+
}
1324+
} catch (Exception e) {
1325+
// deserialization failed, continue
1326+
log.log(Level.FINER, "Input data does not match schema 'UpiQrDetails'", e);
1327+
}
1328+
13031329
// deserialize VippsDetails
13041330
try {
13051331
boolean attemptParsing = true;
@@ -1692,6 +1718,11 @@ public CheckoutPaymentMethod(UpiIntentDetails o) {
16921718
setActualInstance(o);
16931719
}
16941720

1721+
public CheckoutPaymentMethod(UpiQrDetails o) {
1722+
super("oneOf", Boolean.FALSE);
1723+
setActualInstance(o);
1724+
}
1725+
16951726
public CheckoutPaymentMethod(VippsDetails o) {
16961727
super("oneOf", Boolean.FALSE);
16971728
setActualInstance(o);
@@ -1768,6 +1799,7 @@ public CheckoutPaymentMethod(ZipDetails o) {
17681799
schemas.put("TwintDetails", new GenericType<TwintDetails>() {});
17691800
schemas.put("UpiCollectDetails", new GenericType<UpiCollectDetails>() {});
17701801
schemas.put("UpiIntentDetails", new GenericType<UpiIntentDetails>() {});
1802+
schemas.put("UpiQrDetails", new GenericType<UpiQrDetails>() {});
17711803
schemas.put("VippsDetails", new GenericType<VippsDetails>() {});
17721804
schemas.put("VisaCheckoutDetails", new GenericType<VisaCheckoutDetails>() {});
17731805
schemas.put("WeChatPayDetails", new GenericType<WeChatPayDetails>() {});
@@ -1792,8 +1824,8 @@ public Map<String, GenericType<?>> getSchemas() {
17921824
* PayByBankAISDirectDebitDetails, PayByBankDetails, PayPalDetails, PayPayDetails, PayToDetails,
17931825
* PayUUpiDetails, PayWithGoogleDetails, PaymentDetails, PixDetails, PseDetails,
17941826
* RakutenPayDetails, RatepayDetails, RivertyDetails, SamsungPayDetails, SepaDirectDebitDetails,
1795-
* StoredPaymentMethodDetails, TwintDetails, UpiCollectDetails, UpiIntentDetails, VippsDetails,
1796-
* VisaCheckoutDetails, WeChatPayDetails, WeChatPayMiniProgramDetails, ZipDetails
1827+
* StoredPaymentMethodDetails, TwintDetails, UpiCollectDetails, UpiIntentDetails, UpiQrDetails,
1828+
* VippsDetails, VisaCheckoutDetails, WeChatPayDetails, WeChatPayMiniProgramDetails, ZipDetails
17971829
*
17981830
* <p>It could be an instance of the 'oneOf' schemas. The oneOf child schemas may themselves be a
17991831
* composed schema (allOf, anyOf, oneOf).
@@ -2035,6 +2067,11 @@ public void setActualInstance(Object instance) {
20352067
return;
20362068
}
20372069

2070+
if (JSON.isInstanceOf(UpiQrDetails.class, instance, new HashSet<>())) {
2071+
super.setActualInstance(instance);
2072+
return;
2073+
}
2074+
20382075
if (JSON.isInstanceOf(VippsDetails.class, instance, new HashSet<>())) {
20392076
super.setActualInstance(instance);
20402077
return;
@@ -2061,7 +2098,7 @@ public void setActualInstance(Object instance) {
20612098
}
20622099

20632100
throw new RuntimeException(
2064-
"Invalid instance type. Must be AchDetails, AffirmDetails, AfterpayDetails, AmazonPayDetails, AncvDetails, AndroidPayDetails, ApplePayDetails, BacsDirectDebitDetails, BillDeskDetails, BlikDetails, CardDetails, CashAppDetails, CellulantDetails, DokuDetails, DragonpayDetails, EBankingFinlandDetails, EcontextVoucherDetails, EftDetails, FastlaneDetails, GenericIssuerPaymentMethodDetails, GooglePayDetails, IdealDetails, KlarnaDetails, MasterpassDetails, MbwayDetails, MobilePayDetails, MolPayDetails, OpenInvoiceDetails, PayByBankAISDirectDebitDetails, PayByBankDetails, PayPalDetails, PayPayDetails, PayToDetails, PayUUpiDetails, PayWithGoogleDetails, PaymentDetails, PixDetails, PseDetails, RakutenPayDetails, RatepayDetails, RivertyDetails, SamsungPayDetails, SepaDirectDebitDetails, StoredPaymentMethodDetails, TwintDetails, UpiCollectDetails, UpiIntentDetails, VippsDetails, VisaCheckoutDetails, WeChatPayDetails, WeChatPayMiniProgramDetails, ZipDetails");
2101+
"Invalid instance type. Must be AchDetails, AffirmDetails, AfterpayDetails, AmazonPayDetails, AncvDetails, AndroidPayDetails, ApplePayDetails, BacsDirectDebitDetails, BillDeskDetails, BlikDetails, CardDetails, CashAppDetails, CellulantDetails, DokuDetails, DragonpayDetails, EBankingFinlandDetails, EcontextVoucherDetails, EftDetails, FastlaneDetails, GenericIssuerPaymentMethodDetails, GooglePayDetails, IdealDetails, KlarnaDetails, MasterpassDetails, MbwayDetails, MobilePayDetails, MolPayDetails, OpenInvoiceDetails, PayByBankAISDirectDebitDetails, PayByBankDetails, PayPalDetails, PayPayDetails, PayToDetails, PayUUpiDetails, PayWithGoogleDetails, PaymentDetails, PixDetails, PseDetails, RakutenPayDetails, RatepayDetails, RivertyDetails, SamsungPayDetails, SepaDirectDebitDetails, StoredPaymentMethodDetails, TwintDetails, UpiCollectDetails, UpiIntentDetails, UpiQrDetails, VippsDetails, VisaCheckoutDetails, WeChatPayDetails, WeChatPayMiniProgramDetails, ZipDetails");
20652102
}
20662103

20672104
/**
@@ -2075,8 +2112,8 @@ public void setActualInstance(Object instance) {
20752112
* PayByBankDetails, PayPalDetails, PayPayDetails, PayToDetails, PayUUpiDetails,
20762113
* PayWithGoogleDetails, PaymentDetails, PixDetails, PseDetails, RakutenPayDetails,
20772114
* RatepayDetails, RivertyDetails, SamsungPayDetails, SepaDirectDebitDetails,
2078-
* StoredPaymentMethodDetails, TwintDetails, UpiCollectDetails, UpiIntentDetails, VippsDetails,
2079-
* VisaCheckoutDetails, WeChatPayDetails, WeChatPayMiniProgramDetails, ZipDetails
2115+
* StoredPaymentMethodDetails, TwintDetails, UpiCollectDetails, UpiIntentDetails, UpiQrDetails,
2116+
* VippsDetails, VisaCheckoutDetails, WeChatPayDetails, WeChatPayMiniProgramDetails, ZipDetails
20802117
*
20812118
* @return The actual instance (AchDetails, AffirmDetails, AfterpayDetails, AmazonPayDetails,
20822119
* AncvDetails, AndroidPayDetails, ApplePayDetails, BacsDirectDebitDetails, BillDeskDetails,
@@ -2088,7 +2125,7 @@ public void setActualInstance(Object instance) {
20882125
* PayToDetails, PayUUpiDetails, PayWithGoogleDetails, PaymentDetails, PixDetails, PseDetails,
20892126
* RakutenPayDetails, RatepayDetails, RivertyDetails, SamsungPayDetails,
20902127
* SepaDirectDebitDetails, StoredPaymentMethodDetails, TwintDetails, UpiCollectDetails,
2091-
* UpiIntentDetails, VippsDetails, VisaCheckoutDetails, WeChatPayDetails,
2128+
* UpiIntentDetails, UpiQrDetails, VippsDetails, VisaCheckoutDetails, WeChatPayDetails,
20922129
* WeChatPayMiniProgramDetails, ZipDetails)
20932130
*/
20942131
@Override
@@ -2615,6 +2652,17 @@ public UpiIntentDetails getUpiIntentDetails() throws ClassCastException {
26152652
return (UpiIntentDetails) super.getActualInstance();
26162653
}
26172654

2655+
/**
2656+
* Get the actual instance of `UpiQrDetails`. If the actual instance is not `UpiQrDetails`, the
2657+
* ClassCastException will be thrown.
2658+
*
2659+
* @return The actual instance of `UpiQrDetails`
2660+
* @throws ClassCastException if the instance is not `UpiQrDetails`
2661+
*/
2662+
public UpiQrDetails getUpiQrDetails() throws ClassCastException {
2663+
return (UpiQrDetails) super.getActualInstance();
2664+
}
2665+
26182666
/**
26192667
* Get the actual instance of `VippsDetails`. If the actual instance is not `VippsDetails`, the
26202668
* ClassCastException will be thrown.

src/main/java/com/adyen/model/checkout/PaymentDetails.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ public enum TypeEnum {
4646

4747
AFFIRM_POS(String.valueOf("affirm_pos")),
4848

49+
IRIS(String.valueOf("iris")),
50+
4951
TRUSTLY(String.valueOf("trustly")),
5052

5153
TRUSTLYVECTOR(String.valueOf("trustlyvector")),
@@ -86,8 +88,6 @@ public enum TypeEnum {
8688

8789
PAYU_IN_NB(String.valueOf("payu_IN_nb")),
8890

89-
UPI_QR(String.valueOf("upi_qr")),
90-
9191
PAYTM(String.valueOf("paytm")),
9292

9393
MOLPAY_EBANKING_VN(String.valueOf("molpay_ebanking_VN")),

src/main/java/com/adyen/model/checkout/UpiIntentDetails.java

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
/** UpiIntentDetails */
2525
@JsonPropertyOrder({
2626
UpiIntentDetails.JSON_PROPERTY_APP_ID,
27+
UpiIntentDetails.JSON_PROPERTY_BILLING_SEQUENCE_NUMBER,
2728
UpiIntentDetails.JSON_PROPERTY_CHECKOUT_ATTEMPT_ID,
2829
UpiIntentDetails.JSON_PROPERTY_RECURRING_DETAIL_REFERENCE,
2930
UpiIntentDetails.JSON_PROPERTY_SHOPPER_NOTIFICATION_REFERENCE,
@@ -34,6 +35,9 @@ public class UpiIntentDetails {
3435
public static final String JSON_PROPERTY_APP_ID = "appId";
3536
private String appId;
3637

38+
public static final String JSON_PROPERTY_BILLING_SEQUENCE_NUMBER = "billingSequenceNumber";
39+
private String billingSequenceNumber;
40+
3741
public static final String JSON_PROPERTY_CHECKOUT_ATTEMPT_ID = "checkoutAttemptId";
3842
private String checkoutAttemptId;
3943

@@ -125,6 +129,48 @@ public void setAppId(String appId) {
125129
this.appId = appId;
126130
}
127131

132+
/**
133+
* The sequence number for the debit. For example, send **2** if this is the second debit for the
134+
* subscription. The sequence number is included in the notification sent to the shopper.
135+
*
136+
* @param billingSequenceNumber The sequence number for the debit. For example, send **2** if this
137+
* is the second debit for the subscription. The sequence number is included in the
138+
* notification sent to the shopper.
139+
* @return the current {@code UpiIntentDetails} instance, allowing for method chaining
140+
*/
141+
public UpiIntentDetails billingSequenceNumber(String billingSequenceNumber) {
142+
this.billingSequenceNumber = billingSequenceNumber;
143+
return this;
144+
}
145+
146+
/**
147+
* The sequence number for the debit. For example, send **2** if this is the second debit for the
148+
* subscription. The sequence number is included in the notification sent to the shopper.
149+
*
150+
* @return billingSequenceNumber The sequence number for the debit. For example, send **2** if
151+
* this is the second debit for the subscription. The sequence number is included in the
152+
* notification sent to the shopper.
153+
*/
154+
@JsonProperty(JSON_PROPERTY_BILLING_SEQUENCE_NUMBER)
155+
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
156+
public String getBillingSequenceNumber() {
157+
return billingSequenceNumber;
158+
}
159+
160+
/**
161+
* The sequence number for the debit. For example, send **2** if this is the second debit for the
162+
* subscription. The sequence number is included in the notification sent to the shopper.
163+
*
164+
* @param billingSequenceNumber The sequence number for the debit. For example, send **2** if this
165+
* is the second debit for the subscription. The sequence number is included in the
166+
* notification sent to the shopper.
167+
*/
168+
@JsonProperty(JSON_PROPERTY_BILLING_SEQUENCE_NUMBER)
169+
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
170+
public void setBillingSequenceNumber(String billingSequenceNumber) {
171+
this.billingSequenceNumber = billingSequenceNumber;
172+
}
173+
128174
/**
129175
* The checkout attempt identifier.
130176
*
@@ -325,6 +371,7 @@ public boolean equals(Object o) {
325371
}
326372
UpiIntentDetails upiIntentDetails = (UpiIntentDetails) o;
327373
return Objects.equals(this.appId, upiIntentDetails.appId)
374+
&& Objects.equals(this.billingSequenceNumber, upiIntentDetails.billingSequenceNumber)
328375
&& Objects.equals(this.checkoutAttemptId, upiIntentDetails.checkoutAttemptId)
329376
&& Objects.equals(this.recurringDetailReference, upiIntentDetails.recurringDetailReference)
330377
&& Objects.equals(
@@ -337,6 +384,7 @@ public boolean equals(Object o) {
337384
public int hashCode() {
338385
return Objects.hash(
339386
appId,
387+
billingSequenceNumber,
340388
checkoutAttemptId,
341389
recurringDetailReference,
342390
shopperNotificationReference,
@@ -349,6 +397,9 @@ public String toString() {
349397
StringBuilder sb = new StringBuilder();
350398
sb.append("class UpiIntentDetails {\n");
351399
sb.append(" appId: ").append(toIndentedString(appId)).append("\n");
400+
sb.append(" billingSequenceNumber: ")
401+
.append(toIndentedString(billingSequenceNumber))
402+
.append("\n");
352403
sb.append(" checkoutAttemptId: ").append(toIndentedString(checkoutAttemptId)).append("\n");
353404
sb.append(" recurringDetailReference: ")
354405
.append(toIndentedString(recurringDetailReference))

0 commit comments

Comments
 (0)