[balanceplatform] Code generation: update services and models#2016
[balanceplatform] Code generation: update services and models#2016AdyenAutomationBot wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces support for recurring top-ups in the balance platform SDK, adding several new DTO models, updating transaction rules with a bypass option, and implementing the RecurringTopUpsApi service. It also adds a delete endpoint to the SCA device management API. Feedback on these changes highlights opportunities to improve efficiency by avoiding unnecessary boxing of primitive booleans in AmountDTO, enhancing robustness with null checks on request bodies in RecurringTopUpsApi, and restoring type safety by using String instead of Object for the beneficiary reference in PatchableCreateRecurringTopUp.
| && Objects.equals(this.isSetCurrency, amountDTO.isSetCurrency) | ||
| && Objects.equals(this.value, amountDTO.value) | ||
| && Objects.equals(this.isSetValue, amountDTO.isSetValue); | ||
| } |
There was a problem hiding this comment.
Using Objects.equals on primitive boolean fields like isSetCurrency and isSetValue causes unnecessary boxing to Boolean objects. For primitive fields, direct comparison using == is more efficient and idiomatic in Java.
return Objects.equals(this.currency, amountDTO.currency)
&& this.isSetCurrency == amountDTO.isSetCurrency
&& Objects.equals(this.value, amountDTO.value)
&& this.isSetValue == amountDTO.isSetValue;| if (balanceAccountId == null) { | ||
| throw new IllegalArgumentException("Please provide the balanceAccountId path parameter"); | ||
| } | ||
| pathParams.put("balanceAccountId", balanceAccountId); | ||
|
|
||
| String requestBody = createRecurringTopUp.toJson(); |
There was a problem hiding this comment.
If createRecurringTopUp is null, calling createRecurringTopUp.toJson() will throw a NullPointerException. It is safer to perform a null check and throw an IllegalArgumentException, similar to the path parameter check.
| if (balanceAccountId == null) { | |
| throw new IllegalArgumentException("Please provide the balanceAccountId path parameter"); | |
| } | |
| pathParams.put("balanceAccountId", balanceAccountId); | |
| String requestBody = createRecurringTopUp.toJson(); | |
| if (balanceAccountId == null) { | |
| throw new IllegalArgumentException("Please provide the balanceAccountId path parameter"); | |
| } | |
| pathParams.put("balanceAccountId", balanceAccountId); | |
| if (createRecurringTopUp == null) { | |
| throw new IllegalArgumentException("Please provide the createRecurringTopUp request body"); | |
| } | |
| String requestBody = createRecurringTopUp.toJson(); |
| if (balanceAccountId == null) { | ||
| throw new IllegalArgumentException("Please provide the balanceAccountId path parameter"); | ||
| } | ||
| pathParams.put("balanceAccountId", balanceAccountId); | ||
| if (topUpId == null) { | ||
| throw new IllegalArgumentException("Please provide the topUpId path parameter"); | ||
| } | ||
| pathParams.put("topUpId", topUpId); | ||
|
|
||
| String requestBody = patchableCreateRecurringTopUp.toJson(); |
There was a problem hiding this comment.
If patchableCreateRecurringTopUp is null, calling patchableCreateRecurringTopUp.toJson() will throw a NullPointerException. It is safer to perform a null check and throw an IllegalArgumentException.
if (balanceAccountId == null) {
throw new IllegalArgumentException("Please provide the balanceAccountId path parameter");
}
pathParams.put("balanceAccountId", balanceAccountId);
if (topUpId == null) {
throw new IllegalArgumentException("Please provide the topUpId path parameter");
}
pathParams.put("topUpId", topUpId);
if (patchableCreateRecurringTopUp == null) {
throw new IllegalArgumentException("Please provide the patchableCreateRecurringTopUp request body");
}
String requestBody = patchableCreateRecurringTopUp.toJson();| public static final String JSON_PROPERTY_REFERENCE_FOR_BENEFICIARY = "referenceForBeneficiary"; | ||
| private Object referenceForBeneficiary; |
There was a problem hiding this comment.
The field referenceForBeneficiary is defined as Object here, whereas in CreateRecurringTopUp and RecurringTopUp it is defined as String. Using Object loses type safety and forces users to cast or pass arbitrary objects. If this is due to nullability in the OpenAPI spec, consider configuring the generator to map nullable strings to String instead of Object.
|
| */ | ||
| @JsonIgnore private boolean includeNullValues = false; | ||
|
|
||
| public PatchableSchedule() {} |
There was a problem hiding this comment.
This naming doesn't follow our conventions and must be fixed at the spec. Marking this as do-not-merge for now.



This PR contains the automated changes for the
balanceplatformservice.The commit history of this PR reflects the
adyen-openapicommits that have been applied.