[checkout] Code generation: update services and models#2013
Conversation
There was a problem hiding this comment.
Code Review
This pull request updates the Adyen Checkout API Java SDK models to version 72, introducing several new payment and service details models (such as AuPayDetails, CarRental, DBaraiDetails, Healthcare, and TemporaryServices) while removing obsolete error entities. It also updates existing models with new fields, Javadoc documentation, and discriminator mappings. Feedback on the changes highlights a type mismatch in TemporaryServices.java where hourRate is defined as an Integer despite a documented maximum value that requires a Long. Additionally, in CheckoutPaymentMethod.java, the use of tree.findValue('type') for deserializing AuPayDetails and DBaraiDetails should be replaced with tree.get('type') to avoid false positives from recursive JSON tree searches.
| public static final String JSON_PROPERTY_HOUR_RATE = "hourRate"; | ||
| private Integer hourRate; |
There was a problem hiding this comment.
There is a type mismatch between the Javadoc description (which states a maximum value of 10000000000) and the Java field type Integer (which has a maximum value of 2147483647). If a value exceeding Integer.MAX_VALUE is received, it will cause deserialization or overflow issues.
Although this file is auto-generated, the OpenAPI specification should be updated to define this field as a 64-bit integer (int64), which will generate a Long in Java. Please also update the corresponding builder, getter, and setter methods to use Long instead of Integer.
| public static final String JSON_PROPERTY_HOUR_RATE = "hourRate"; | |
| private Integer hourRate; | |
| public static final String JSON_PROPERTY_HOUR_RATE = "hourRate"; | |
| private Long hourRate; |
| boolean typeMatch = false; | ||
| if (tree.findValue("type") != null) { | ||
| typeMatch = | ||
| Arrays.stream(AuPayDetails.TypeEnum.values()) | ||
| .anyMatch((t) -> t.getValue().equals(tree.findValue("type").asText())); | ||
| } |
There was a problem hiding this comment.
Using tree.findValue("type") recursively searches the entire JSON tree for any property named "type". If the root object does not have a "type" property but a nested object does, this can lead to a false positive match and incorrect deserialization. Using tree.get("type") is safer as it only checks the direct properties of the root object.
| boolean typeMatch = false; | |
| if (tree.findValue("type") != null) { | |
| typeMatch = | |
| Arrays.stream(AuPayDetails.TypeEnum.values()) | |
| .anyMatch((t) -> t.getValue().equals(tree.findValue("type").asText())); | |
| } | |
| boolean typeMatch = false; | |
| if (tree.get("type") != null) { | |
| typeMatch = | |
| Arrays.stream(AuPayDetails.TypeEnum.values()) | |
| .anyMatch((t) -> t.getValue().equals(tree.get("type").asText())); | |
| } |
| boolean typeMatch = false; | ||
| if (tree.findValue("type") != null) { | ||
| typeMatch = | ||
| Arrays.stream(DBaraiDetails.TypeEnum.values()) | ||
| .anyMatch((t) -> t.getValue().equals(tree.findValue("type").asText())); | ||
| } |
There was a problem hiding this comment.
Using tree.findValue("type") recursively searches the entire JSON tree for any property named "type". If the root object does not have a "type" property but a nested object does, this can lead to a false positive match and incorrect deserialization. Using tree.get("type") is safer as it only checks the direct properties of the root object.
| boolean typeMatch = false; | |
| if (tree.findValue("type") != null) { | |
| typeMatch = | |
| Arrays.stream(DBaraiDetails.TypeEnum.values()) | |
| .anyMatch((t) -> t.getValue().equals(tree.findValue("type").asText())); | |
| } | |
| boolean typeMatch = false; | |
| if (tree.get("type") != null) { | |
| typeMatch = | |
| Arrays.stream(DBaraiDetails.TypeEnum.values()) | |
| .anyMatch((t) -> t.getValue().equals(tree.get("type").asText())); | |
| } |
| BANKTRANSFER_IBAN(String.valueOf("bankTransfer_IBAN")), | ||
|
|
||
| PAYBRIGHT(String.valueOf("paybright")), | ||
|
|
There was a problem hiding this comment.
Breaking change. Verified that paybright has been deprecated for a while
|
|
||
| /** Standardized error response following RFC-7807 format */ | ||
| @JsonPropertyOrder({ | ||
| DefaultErrorResponseEntity.JSON_PROPERTY_DETAIL, |
There was a problem hiding this comment.
breaking change, verified the error type has been updated to CheckoutErrorResponseEntity
42eaa0f to
aaaec73
Compare
|
| InvalidField.JSON_PROPERTY_NAME, | ||
| InvalidField.JSON_PROPERTY_VALUE | ||
| }) | ||
| public class InvalidField { |
There was a problem hiding this comment.
breaking change, verified the error type has been updated to CheckoutErrorResponseEntity



This PR contains the automated changes for the
checkoutservice.The commit history of this PR reflects the
adyen-openapicommits that have been applied.Breaking Changes 🛠️
PaymentDetailspaybrightvalue from the type (TypeEnum) enum.Checkout error modelDefaultErrorResponseEntityandInvalidField, replaced by the newCheckoutErrorResponseEntity.New Features 💎
New payment methods
AuPayDetails(aupay) andDBaraiDetails(dbarai), registered as oneOf variants and discriminator mappings inCheckoutPaymentMethod.Enhanced Scheme Data
CarRental,Healthcare,Lodging,TemporaryServices,Folio,Room,PickupInfo,ReturnInfo,RentalSurcharges.EnhancedSchemeData— newcarRental,healthcare,lodging, andtemporaryServicesfields.CardBrandDetails— newhealthcarefield.Third-party token redundancy
ThirdPartyTokenRedundancyInfo.thirdPartyTokenRedundancyInfofield toPaymentRequest,CreateCheckoutSessionRequest, andCreateCheckoutSessionResponse.Order tracking / shipping on line items
LineItem— newshippingCompany,shippingMethod,trackingNumber,trackingUri,returnShippingCompany,returnTrackingNumber, andreturnTrackingUrifields.PayPal update order
PaypalUpdateOrderRequest— newdeliveryAddress,discountAmount, andshippingAmountfields.Other new fields
CreateCheckoutSessionRequest— newshopperConversionIdfield.StoredPaymentMethod— new externalToken field.KlarnaDetailsandRivertyDetails— newmerchantDatafield.Other Changes
CheckoutPaymentMethodandDonationPaymentMethod(template-level, no spec change).Airline,Leg,Passenger,ItemDetailLine,LevelTwoThree,Ticket,Agency,TravelAgency,Destination(no structural change).