From 28d46de995c8f82e13bb92cf42523874cf765d2f Mon Sep 17 00:00:00 2001 From: AdyenAutomationBot <38424300+AdyenAutomationBot@users.noreply.github.com> Date: Fri, 7 Aug 2026 15:19:46 +0000 Subject: [PATCH] [checkout] Automated update from Adyen/adyen-openapi@3a16b41 --- sdk-generation-log/checkout.json | 8 +- .../adyen/model/checkout/AffirmDetails.java | 57 ++- .../model/checkout/CheckoutPaymentMethod.java | 2 +- .../CheckoutSessionPatchSessionRequest.java | 325 +++++++++++++ .../CheckoutSessionPatchSessionResponse.java | 180 +++++++ .../checkout/DonationCampaignsRequest.java | 50 ++ .../model/checkout/DonationPaymentMethod.java | 58 ++- .../adyen/model/checkout/PaymentDetails.java | 2 - .../checkout/SepaDirectDebitDonations.java | 454 ++++++++++++++++++ .../model/checkout/SessionAmountUpdate.java | 238 +++++++++ .../checkout/StoredPaymentMethodDetails.java | 4 +- .../adyen/service/checkout/PaymentsApi.java | 47 ++ 12 files changed, 1412 insertions(+), 13 deletions(-) create mode 100644 src/main/java/com/adyen/model/checkout/CheckoutSessionPatchSessionRequest.java create mode 100644 src/main/java/com/adyen/model/checkout/CheckoutSessionPatchSessionResponse.java create mode 100644 src/main/java/com/adyen/model/checkout/SepaDirectDebitDonations.java create mode 100644 src/main/java/com/adyen/model/checkout/SessionAmountUpdate.java diff --git a/sdk-generation-log/checkout.json b/sdk-generation-log/checkout.json index 7698d7972..67bd10143 100644 --- a/sdk-generation-log/checkout.json +++ b/sdk-generation-log/checkout.json @@ -1,8 +1,8 @@ { "service": "checkout", "project": "java", - "generatedAt": "2026-07-22T11:25:22Z", - "openapiCommitSha": "c6f0131e5551226fd523852ff6f5ad1df6c72ee2", - "automationCommitSha": "0c108bd8050cf480d2710b78b770afdfbdd89397", - "libraryCommitSha": "913f166177824e57c26c5f0543b46144219ca6af" + "generatedAt": "2026-08-07T15:19:45Z", + "openapiCommitSha": "3a16b41f17d1bda097a8e25cfe3646f4af2042ec", + "automationCommitSha": "09e65f31d70416e30f8464ec7cf29e94eda443fc", + "libraryCommitSha": "ef0f827bf1e2d31bdc55f7cc4860ffef20601f42" } diff --git a/src/main/java/com/adyen/model/checkout/AffirmDetails.java b/src/main/java/com/adyen/model/checkout/AffirmDetails.java index 8b8ac1864..048d45d60 100644 --- a/src/main/java/com/adyen/model/checkout/AffirmDetails.java +++ b/src/main/java/com/adyen/model/checkout/AffirmDetails.java @@ -26,6 +26,7 @@ /** AffirmDetails */ @JsonPropertyOrder({ AffirmDetails.JSON_PROPERTY_CHECKOUT_ATTEMPT_ID, + AffirmDetails.JSON_PROPERTY_FINANCING_PROGRAM, AffirmDetails.JSON_PROPERTY_SDK_DATA, AffirmDetails.JSON_PROPERTY_TYPE }) @@ -36,6 +37,12 @@ public class AffirmDetails { /** Mark when the attribute has been explicitly set. */ private boolean isSetCheckoutAttemptId = false; + public static final String JSON_PROPERTY_FINANCING_PROGRAM = "financingProgram"; + private String financingProgram; + + /** Mark when the attribute has been explicitly set. */ + private boolean isSetFinancingProgram = false; + public static final String JSON_PROPERTY_SDK_DATA = "sdkData"; private String sdkData; @@ -130,6 +137,41 @@ public void setCheckoutAttemptId(String checkoutAttemptId) { isSetCheckoutAttemptId = true; // mark as set } + /** + * The Affirm financing program to apply to this transaction. + * + * @param financingProgram The Affirm financing program to apply to this transaction. + * @return the current {@code AffirmDetails} instance, allowing for method chaining + */ + public AffirmDetails financingProgram(String financingProgram) { + this.financingProgram = financingProgram; + isSetFinancingProgram = true; // mark as set + return this; + } + + /** + * The Affirm financing program to apply to this transaction. + * + * @return financingProgram The Affirm financing program to apply to this transaction. + */ + @JsonProperty(JSON_PROPERTY_FINANCING_PROGRAM) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getFinancingProgram() { + return financingProgram; + } + + /** + * The Affirm financing program to apply to this transaction. + * + * @param financingProgram The Affirm financing program to apply to this transaction. + */ + @JsonProperty(JSON_PROPERTY_FINANCING_PROGRAM) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setFinancingProgram(String financingProgram) { + this.financingProgram = financingProgram; + isSetFinancingProgram = true; // mark as set + } + /** * Base64-encoded JSON object containing SDK related parameters required by the SDK * @@ -233,6 +275,8 @@ public boolean equals(Object o) { AffirmDetails affirmDetails = (AffirmDetails) o; return Objects.equals(this.checkoutAttemptId, affirmDetails.checkoutAttemptId) && Objects.equals(this.isSetCheckoutAttemptId, affirmDetails.isSetCheckoutAttemptId) + && Objects.equals(this.financingProgram, affirmDetails.financingProgram) + && Objects.equals(this.isSetFinancingProgram, affirmDetails.isSetFinancingProgram) && Objects.equals(this.sdkData, affirmDetails.sdkData) && Objects.equals(this.isSetSdkData, affirmDetails.isSetSdkData) && Objects.equals(this.type, affirmDetails.type) @@ -242,7 +286,14 @@ public boolean equals(Object o) { @Override public int hashCode() { return Objects.hash( - checkoutAttemptId, isSetCheckoutAttemptId, sdkData, isSetSdkData, type, isSetType); + checkoutAttemptId, + isSetCheckoutAttemptId, + financingProgram, + isSetFinancingProgram, + sdkData, + isSetSdkData, + type, + isSetType); } @Override @@ -250,6 +301,7 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class AffirmDetails {\n"); sb.append(" checkoutAttemptId: ").append(toIndentedString(checkoutAttemptId)).append("\n"); + sb.append(" financingProgram: ").append(toIndentedString(financingProgram)).append("\n"); sb.append(" sdkData: ").append(toIndentedString(sdkData)).append("\n"); sb.append(" type: ").append(toIndentedString(type)).append("\n"); sb.append("}"); @@ -279,6 +331,9 @@ public Map getExplicitNulls() { if (isSetCheckoutAttemptId) { addIfNull(nulls, JSON_PROPERTY_CHECKOUT_ATTEMPT_ID, this.checkoutAttemptId); } + if (isSetFinancingProgram) { + addIfNull(nulls, JSON_PROPERTY_FINANCING_PROGRAM, this.financingProgram); + } if (isSetSdkData) { addIfNull(nulls, JSON_PROPERTY_SDK_DATA, this.sdkData); } diff --git a/src/main/java/com/adyen/model/checkout/CheckoutPaymentMethod.java b/src/main/java/com/adyen/model/checkout/CheckoutPaymentMethod.java index a391ab24b..93f9ee297 100644 --- a/src/main/java/com/adyen/model/checkout/CheckoutPaymentMethod.java +++ b/src/main/java/com/adyen/model/checkout/CheckoutPaymentMethod.java @@ -2146,7 +2146,7 @@ public CheckoutPaymentMethod(ZipDetails o) { mappings.put("gcash", StoredPaymentMethodDetails.class); mappings.put("giftcard", CardDetails.class); mappings.put("googlepay", GooglePayDetails.class); - mappings.put("gopay_wallet", PaymentDetails.class); + mappings.put("gopay_wallet", StoredPaymentMethodDetails.class); mappings.put("grabpay_ID", StoredPaymentMethodDetails.class); mappings.put("grabpay_MY", StoredPaymentMethodDetails.class); mappings.put("grabpay_PH", StoredPaymentMethodDetails.class); diff --git a/src/main/java/com/adyen/model/checkout/CheckoutSessionPatchSessionRequest.java b/src/main/java/com/adyen/model/checkout/CheckoutSessionPatchSessionRequest.java new file mode 100644 index 000000000..e90749ed4 --- /dev/null +++ b/src/main/java/com/adyen/model/checkout/CheckoutSessionPatchSessionRequest.java @@ -0,0 +1,325 @@ +/* + * Adyen Checkout API + * + * The version of the OpenAPI document: 72 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.adyen.model.checkout; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.core.JsonProcessingException; +import java.util.*; + +/** CheckoutSessionPatchSessionRequest */ +@JsonPropertyOrder({ + CheckoutSessionPatchSessionRequest.JSON_PROPERTY_AMOUNT, + CheckoutSessionPatchSessionRequest.JSON_PROPERTY_PAYABLE, + CheckoutSessionPatchSessionRequest.JSON_PROPERTY_SESSION_DATA +}) +public class CheckoutSessionPatchSessionRequest { + public static final String JSON_PROPERTY_AMOUNT = "amount"; + private SessionAmountUpdate amount; + + /** Mark when the attribute has been explicitly set. */ + private boolean isSetAmount = false; + + public static final String JSON_PROPERTY_PAYABLE = "payable"; + private Boolean payable; + + /** Mark when the attribute has been explicitly set. */ + private boolean isSetPayable = false; + + public static final String JSON_PROPERTY_SESSION_DATA = "sessionData"; + private String sessionData; + + /** Mark when the attribute has been explicitly set. */ + private boolean isSetSessionData = false; + + /** + * Sets whether attributes with null values should be explicitly included in the JSON payload. + * Default is false. + */ + @JsonIgnore private boolean includeNullValues = false; + + public CheckoutSessionPatchSessionRequest() {} + + /** + * amount + * + * @param amount + * @return the current {@code CheckoutSessionPatchSessionRequest} instance, allowing for method + * chaining + */ + public CheckoutSessionPatchSessionRequest amount(SessionAmountUpdate amount) { + this.amount = amount; + isSetAmount = true; // mark as set + return this; + } + + /** + * Get amount + * + * @return amount + */ + @JsonProperty(JSON_PROPERTY_AMOUNT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public SessionAmountUpdate getAmount() { + return amount; + } + + /** + * amount + * + * @param amount + */ + @JsonProperty(JSON_PROPERTY_AMOUNT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setAmount(SessionAmountUpdate amount) { + this.amount = amount; + isSetAmount = true; // mark as set + } + + /** + * Indicates if the session is payable. If the payment amount is final, set this to **true** to + * indicate that the session is payable, so that the shopper can proceed to submit the payment. + * When you set this to **true**, you can no longer update the session. If you set this to + * **false**, you must make another request to update the session and set this to **true** before + * the shopper can submit the payment. + * + * @param payable Indicates if the session is payable. If the payment amount is final, set this to + * **true** to indicate that the session is payable, so that the shopper can proceed to submit + * the payment. When you set this to **true**, you can no longer update the session. If you + * set this to **false**, you must make another request to update the session and set this to + * **true** before the shopper can submit the payment. + * @return the current {@code CheckoutSessionPatchSessionRequest} instance, allowing for method + * chaining + */ + public CheckoutSessionPatchSessionRequest payable(Boolean payable) { + this.payable = payable; + isSetPayable = true; // mark as set + return this; + } + + /** + * Indicates if the session is payable. If the payment amount is final, set this to **true** to + * indicate that the session is payable, so that the shopper can proceed to submit the payment. + * When you set this to **true**, you can no longer update the session. If you set this to + * **false**, you must make another request to update the session and set this to **true** before + * the shopper can submit the payment. + * + * @return payable Indicates if the session is payable. If the payment amount is final, set this + * to **true** to indicate that the session is payable, so that the shopper can proceed to + * submit the payment. When you set this to **true**, you can no longer update the session. If + * you set this to **false**, you must make another request to update the session and set this + * to **true** before the shopper can submit the payment. + */ + @JsonProperty(JSON_PROPERTY_PAYABLE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Boolean getPayable() { + return payable; + } + + /** + * Indicates if the session is payable. If the payment amount is final, set this to **true** to + * indicate that the session is payable, so that the shopper can proceed to submit the payment. + * When you set this to **true**, you can no longer update the session. If you set this to + * **false**, you must make another request to update the session and set this to **true** before + * the shopper can submit the payment. + * + * @param payable Indicates if the session is payable. If the payment amount is final, set this to + * **true** to indicate that the session is payable, so that the shopper can proceed to submit + * the payment. When you set this to **true**, you can no longer update the session. If you + * set this to **false**, you must make another request to update the session and set this to + * **true** before the shopper can submit the payment. + */ + @JsonProperty(JSON_PROPERTY_PAYABLE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setPayable(Boolean payable) { + this.payable = payable; + isSetPayable = true; // mark as set + } + + /** + * The encoded payment session data from the `beforeSubmit` callback from + * [Drop-in](https://docs.adyen.com/online-payments/build-your-integration/sessions-flow?platform=Web&integration=Drop-in#update-the-session-amount) + * or [the + * Component](https://docs.adyen.com/online-payments/build-your-integration/sessions-flow?platform=Web&integration=Components#update-the-session-amount). + * + * @param sessionData The encoded payment session data from the `beforeSubmit` callback + * from + * [Drop-in](https://docs.adyen.com/online-payments/build-your-integration/sessions-flow?platform=Web&integration=Drop-in#update-the-session-amount) + * or [the + * Component](https://docs.adyen.com/online-payments/build-your-integration/sessions-flow?platform=Web&integration=Components#update-the-session-amount). + * @return the current {@code CheckoutSessionPatchSessionRequest} instance, allowing for method + * chaining + */ + public CheckoutSessionPatchSessionRequest sessionData(String sessionData) { + this.sessionData = sessionData; + isSetSessionData = true; // mark as set + return this; + } + + /** + * The encoded payment session data from the `beforeSubmit` callback from + * [Drop-in](https://docs.adyen.com/online-payments/build-your-integration/sessions-flow?platform=Web&integration=Drop-in#update-the-session-amount) + * or [the + * Component](https://docs.adyen.com/online-payments/build-your-integration/sessions-flow?platform=Web&integration=Components#update-the-session-amount). + * + * @return sessionData The encoded payment session data from the `beforeSubmit` callback + * from + * [Drop-in](https://docs.adyen.com/online-payments/build-your-integration/sessions-flow?platform=Web&integration=Drop-in#update-the-session-amount) + * or [the + * Component](https://docs.adyen.com/online-payments/build-your-integration/sessions-flow?platform=Web&integration=Components#update-the-session-amount). + */ + @JsonProperty(JSON_PROPERTY_SESSION_DATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getSessionData() { + return sessionData; + } + + /** + * The encoded payment session data from the `beforeSubmit` callback from + * [Drop-in](https://docs.adyen.com/online-payments/build-your-integration/sessions-flow?platform=Web&integration=Drop-in#update-the-session-amount) + * or [the + * Component](https://docs.adyen.com/online-payments/build-your-integration/sessions-flow?platform=Web&integration=Components#update-the-session-amount). + * + * @param sessionData The encoded payment session data from the `beforeSubmit` callback + * from + * [Drop-in](https://docs.adyen.com/online-payments/build-your-integration/sessions-flow?platform=Web&integration=Drop-in#update-the-session-amount) + * or [the + * Component](https://docs.adyen.com/online-payments/build-your-integration/sessions-flow?platform=Web&integration=Components#update-the-session-amount). + */ + @JsonProperty(JSON_PROPERTY_SESSION_DATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setSessionData(String sessionData) { + this.sessionData = sessionData; + isSetSessionData = true; // mark as set + } + + /** + * Configures whether null values are explicitly serialized in the JSON payload. Default is false. + */ + public CheckoutSessionPatchSessionRequest includeNullValues(boolean includeNullValues) { + this.includeNullValues = includeNullValues; + return this; + } + + /** Returns whether null values are explicitly serialized in the JSON payload. */ + public boolean isIncludeNullValues() { + return includeNullValues; + } + + /** + * Sets whether null values should be explicitly serialized in the JSON payload. Default is false. + */ + public void setIncludeNullValues(boolean includeNullValues) { + this.includeNullValues = includeNullValues; + } + + /** Return true if this CheckoutSessionPatchSessionRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CheckoutSessionPatchSessionRequest checkoutSessionPatchSessionRequest = + (CheckoutSessionPatchSessionRequest) o; + return Objects.equals(this.amount, checkoutSessionPatchSessionRequest.amount) + && Objects.equals(this.isSetAmount, checkoutSessionPatchSessionRequest.isSetAmount) + && Objects.equals(this.payable, checkoutSessionPatchSessionRequest.payable) + && Objects.equals(this.isSetPayable, checkoutSessionPatchSessionRequest.isSetPayable) + && Objects.equals(this.sessionData, checkoutSessionPatchSessionRequest.sessionData) + && Objects.equals( + this.isSetSessionData, checkoutSessionPatchSessionRequest.isSetSessionData); + } + + @Override + public int hashCode() { + return Objects.hash(amount, isSetAmount, payable, isSetPayable, sessionData, isSetSessionData); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CheckoutSessionPatchSessionRequest {\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" payable: ").append(toIndentedString(payable)).append("\n"); + sb.append(" sessionData: ").append(toIndentedString(sessionData)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** Returns a map of properties to be merged into the JSON payload as explicit null values. */ + @JsonInclude(JsonInclude.Include.ALWAYS) + @JsonAnyGetter + public Map getExplicitNulls() { + if (!this.includeNullValues) { + return Collections.emptyMap(); + } + + Map nulls = new HashMap<>(); + + if (isSetAmount) { + addIfNull(nulls, JSON_PROPERTY_AMOUNT, this.amount); + } + if (isSetPayable) { + addIfNull(nulls, JSON_PROPERTY_PAYABLE, this.payable); + } + if (isSetSessionData) { + addIfNull(nulls, JSON_PROPERTY_SESSION_DATA, this.sessionData); + } + + return nulls; + } + + // add to map when value is null + private void addIfNull(Map map, String key, Object value) { + if (value == null) { + map.put(key, null); + } + } + + /** + * Create an instance of CheckoutSessionPatchSessionRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of CheckoutSessionPatchSessionRequest + * @throws JsonProcessingException if the JSON string is invalid with respect to + * CheckoutSessionPatchSessionRequest + */ + public static CheckoutSessionPatchSessionRequest fromJson(String jsonString) + throws JsonProcessingException { + return JSON.getMapper().readValue(jsonString, CheckoutSessionPatchSessionRequest.class); + } + + /** + * Convert an instance of CheckoutSessionPatchSessionRequest to an JSON string + * + * @return JSON string + */ + public String toJson() throws JsonProcessingException { + return JSON.getMapper().writeValueAsString(this); + } +} diff --git a/src/main/java/com/adyen/model/checkout/CheckoutSessionPatchSessionResponse.java b/src/main/java/com/adyen/model/checkout/CheckoutSessionPatchSessionResponse.java new file mode 100644 index 000000000..6be5e8dee --- /dev/null +++ b/src/main/java/com/adyen/model/checkout/CheckoutSessionPatchSessionResponse.java @@ -0,0 +1,180 @@ +/* + * Adyen Checkout API + * + * The version of the OpenAPI document: 72 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.adyen.model.checkout; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.core.JsonProcessingException; +import java.util.*; + +/** CheckoutSessionPatchSessionResponse */ +@JsonPropertyOrder({CheckoutSessionPatchSessionResponse.JSON_PROPERTY_SESSION_DATA}) +public class CheckoutSessionPatchSessionResponse { + public static final String JSON_PROPERTY_SESSION_DATA = "sessionData"; + private String sessionData; + + /** Mark when the attribute has been explicitly set. */ + private boolean isSetSessionData = false; + + /** + * Sets whether attributes with null values should be explicitly included in the JSON payload. + * Default is false. + */ + @JsonIgnore private boolean includeNullValues = false; + + public CheckoutSessionPatchSessionResponse() {} + + /** + * sessionData + * + * @param sessionData + * @return the current {@code CheckoutSessionPatchSessionResponse} instance, allowing for method + * chaining + */ + public CheckoutSessionPatchSessionResponse sessionData(String sessionData) { + this.sessionData = sessionData; + isSetSessionData = true; // mark as set + return this; + } + + /** + * Get sessionData + * + * @return sessionData + */ + @JsonProperty(JSON_PROPERTY_SESSION_DATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getSessionData() { + return sessionData; + } + + /** + * sessionData + * + * @param sessionData + */ + @JsonProperty(JSON_PROPERTY_SESSION_DATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setSessionData(String sessionData) { + this.sessionData = sessionData; + isSetSessionData = true; // mark as set + } + + /** + * Configures whether null values are explicitly serialized in the JSON payload. Default is false. + */ + public CheckoutSessionPatchSessionResponse includeNullValues(boolean includeNullValues) { + this.includeNullValues = includeNullValues; + return this; + } + + /** Returns whether null values are explicitly serialized in the JSON payload. */ + public boolean isIncludeNullValues() { + return includeNullValues; + } + + /** + * Sets whether null values should be explicitly serialized in the JSON payload. Default is false. + */ + public void setIncludeNullValues(boolean includeNullValues) { + this.includeNullValues = includeNullValues; + } + + /** Return true if this CheckoutSessionPatchSessionResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CheckoutSessionPatchSessionResponse checkoutSessionPatchSessionResponse = + (CheckoutSessionPatchSessionResponse) o; + return Objects.equals(this.sessionData, checkoutSessionPatchSessionResponse.sessionData) + && Objects.equals( + this.isSetSessionData, checkoutSessionPatchSessionResponse.isSetSessionData); + } + + @Override + public int hashCode() { + return Objects.hash(sessionData, isSetSessionData); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CheckoutSessionPatchSessionResponse {\n"); + sb.append(" sessionData: ").append(toIndentedString(sessionData)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** Returns a map of properties to be merged into the JSON payload as explicit null values. */ + @JsonInclude(JsonInclude.Include.ALWAYS) + @JsonAnyGetter + public Map getExplicitNulls() { + if (!this.includeNullValues) { + return Collections.emptyMap(); + } + + Map nulls = new HashMap<>(); + + if (isSetSessionData) { + addIfNull(nulls, JSON_PROPERTY_SESSION_DATA, this.sessionData); + } + + return nulls; + } + + // add to map when value is null + private void addIfNull(Map map, String key, Object value) { + if (value == null) { + map.put(key, null); + } + } + + /** + * Create an instance of CheckoutSessionPatchSessionResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of CheckoutSessionPatchSessionResponse + * @throws JsonProcessingException if the JSON string is invalid with respect to + * CheckoutSessionPatchSessionResponse + */ + public static CheckoutSessionPatchSessionResponse fromJson(String jsonString) + throws JsonProcessingException { + return JSON.getMapper().readValue(jsonString, CheckoutSessionPatchSessionResponse.class); + } + + /** + * Convert an instance of CheckoutSessionPatchSessionResponse to an JSON string + * + * @return JSON string + */ + public String toJson() throws JsonProcessingException { + return JSON.getMapper().writeValueAsString(this); + } +} diff --git a/src/main/java/com/adyen/model/checkout/DonationCampaignsRequest.java b/src/main/java/com/adyen/model/checkout/DonationCampaignsRequest.java index d30749f5a..048985aa3 100644 --- a/src/main/java/com/adyen/model/checkout/DonationCampaignsRequest.java +++ b/src/main/java/com/adyen/model/checkout/DonationCampaignsRequest.java @@ -22,6 +22,7 @@ /** DonationCampaignsRequest */ @JsonPropertyOrder({ DonationCampaignsRequest.JSON_PROPERTY_CURRENCY, + DonationCampaignsRequest.JSON_PROPERTY_LABEL, DonationCampaignsRequest.JSON_PROPERTY_LOCALE, DonationCampaignsRequest.JSON_PROPERTY_MERCHANT_ACCOUNT, DonationCampaignsRequest.JSON_PROPERTY_STORE @@ -33,6 +34,12 @@ public class DonationCampaignsRequest { /** Mark when the attribute has been explicitly set. */ private boolean isSetCurrency = false; + public static final String JSON_PROPERTY_LABEL = "label"; + private String label; + + /** Mark when the attribute has been explicitly set. */ + private boolean isSetLabel = false; + public static final String JSON_PROPERTY_LOCALE = "locale"; private String locale; @@ -100,6 +107,41 @@ public void setCurrency(String currency) { isSetCurrency = true; // mark as set } + /** + * The label that is assigned to the donation campaign. + * + * @param label The label that is assigned to the donation campaign. + * @return the current {@code DonationCampaignsRequest} instance, allowing for method chaining + */ + public DonationCampaignsRequest label(String label) { + this.label = label; + isSetLabel = true; // mark as set + return this; + } + + /** + * The label that is assigned to the donation campaign. + * + * @return label The label that is assigned to the donation campaign. + */ + @JsonProperty(JSON_PROPERTY_LABEL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getLabel() { + return label; + } + + /** + * The label that is assigned to the donation campaign. + * + * @param label The label that is assigned to the donation campaign. + */ + @JsonProperty(JSON_PROPERTY_LABEL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setLabel(String label) { + this.label = label; + isSetLabel = true; // mark as set + } + /** * Locale on the shopper interaction device. * @@ -276,6 +318,8 @@ public boolean equals(Object o) { DonationCampaignsRequest donationCampaignsRequest = (DonationCampaignsRequest) o; return Objects.equals(this.currency, donationCampaignsRequest.currency) && Objects.equals(this.isSetCurrency, donationCampaignsRequest.isSetCurrency) + && Objects.equals(this.label, donationCampaignsRequest.label) + && Objects.equals(this.isSetLabel, donationCampaignsRequest.isSetLabel) && Objects.equals(this.locale, donationCampaignsRequest.locale) && Objects.equals(this.isSetLocale, donationCampaignsRequest.isSetLocale) && Objects.equals(this.merchantAccount, donationCampaignsRequest.merchantAccount) @@ -289,6 +333,8 @@ public int hashCode() { return Objects.hash( currency, isSetCurrency, + label, + isSetLabel, locale, isSetLocale, merchantAccount, @@ -302,6 +348,7 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class DonationCampaignsRequest {\n"); sb.append(" currency: ").append(toIndentedString(currency)).append("\n"); + sb.append(" label: ").append(toIndentedString(label)).append("\n"); sb.append(" locale: ").append(toIndentedString(locale)).append("\n"); sb.append(" merchantAccount: ").append(toIndentedString(merchantAccount)).append("\n"); sb.append(" store: ").append(toIndentedString(store)).append("\n"); @@ -332,6 +379,9 @@ public Map getExplicitNulls() { if (isSetCurrency) { addIfNull(nulls, JSON_PROPERTY_CURRENCY, this.currency); } + if (isSetLabel) { + addIfNull(nulls, JSON_PROPERTY_LABEL, this.label); + } if (isSetLocale) { addIfNull(nulls, JSON_PROPERTY_LOCALE, this.locale); } diff --git a/src/main/java/com/adyen/model/checkout/DonationPaymentMethod.java b/src/main/java/com/adyen/model/checkout/DonationPaymentMethod.java index df1c19b50..fa7ff9544 100644 --- a/src/main/java/com/adyen/model/checkout/DonationPaymentMethod.java +++ b/src/main/java/com/adyen/model/checkout/DonationPaymentMethod.java @@ -203,6 +203,32 @@ public DonationPaymentMethod deserialize(JsonParser jp, DeserializationContext c log.log(Level.FINER, "Input data does not match schema 'PayWithGoogleDonations'", e); } + // deserialize SepaDirectDebitDonations + try { + boolean attemptParsing = true; + if (attemptParsing) { + // Checks if the unique type of the oneOf json matches any of the object TypeEnum values + boolean typeMatch = false; + if (tree.findValue("type") != null) { + typeMatch = + Arrays.stream(SepaDirectDebitDonations.TypeEnum.values()) + .anyMatch((t) -> t.getValue().equals(tree.findValue("type").asText())); + } + + if (typeMatch) { + deserialized = tree.traverse(jp.getCodec()).readValueAs(SepaDirectDebitDonations.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + match++; + log.log(Level.FINER, "Input data matches schema 'SepaDirectDebitDonations'"); + } + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'SepaDirectDebitDonations'", e); + } + if (match == 1) { DonationPaymentMethod ret = new DonationPaymentMethod(); ret.setActualInstance(deserialized); @@ -254,12 +280,18 @@ public DonationPaymentMethod(PayWithGoogleDonations o) { setActualInstance(o); } + public DonationPaymentMethod(SepaDirectDebitDonations o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + static { schemas.put("ApplePayDonations", new GenericType() {}); schemas.put("CardDonations", new GenericType() {}); schemas.put("GooglePayDonations", new GenericType() {}); schemas.put("IdealDonations", new GenericType() {}); schemas.put("PayWithGoogleDonations", new GenericType() {}); + schemas.put("SepaDirectDebitDonations", new GenericType() {}); JSON.registerDescendants(DonationPaymentMethod.class, Collections.unmodifiableMap(schemas)); // Initialize and register the discriminator mappings. Map> mappings = new HashMap<>(); @@ -270,11 +302,13 @@ public DonationPaymentMethod(PayWithGoogleDonations o) { mappings.put("networkToken", CardDonations.class); mappings.put("paywithgoogle", PayWithGoogleDonations.class); mappings.put("scheme", CardDonations.class); + mappings.put("sepadirectdebit", SepaDirectDebitDonations.class); mappings.put("ApplePayDonations", ApplePayDonations.class); mappings.put("CardDonations", CardDonations.class); mappings.put("GooglePayDonations", GooglePayDonations.class); mappings.put("IdealDonations", IdealDonations.class); mappings.put("PayWithGoogleDonations", PayWithGoogleDonations.class); + mappings.put("SepaDirectDebitDonations", SepaDirectDebitDonations.class); mappings.put("DonationPaymentMethod", DonationPaymentMethod.class); JSON.registerDiscriminator(DonationPaymentMethod.class, "type", mappings); } @@ -287,7 +321,7 @@ public Map> getSchemas() { /** * Set the instance that matches the oneOf child schema, check the instance parameter is valid * against the oneOf child schemas: ApplePayDonations, CardDonations, GooglePayDonations, - * IdealDonations, PayWithGoogleDonations + * IdealDonations, PayWithGoogleDonations, SepaDirectDebitDonations * *

It could be an instance of the 'oneOf' schemas. The oneOf child schemas may themselves be a * composed schema (allOf, anyOf, oneOf). @@ -319,16 +353,21 @@ public void setActualInstance(Object instance) { return; } + if (JSON.isInstanceOf(SepaDirectDebitDonations.class, instance, new HashSet<>())) { + super.setActualInstance(instance); + return; + } + throw new RuntimeException( - "Invalid instance type. Must be ApplePayDonations, CardDonations, GooglePayDonations, IdealDonations, PayWithGoogleDonations"); + "Invalid instance type. Must be ApplePayDonations, CardDonations, GooglePayDonations, IdealDonations, PayWithGoogleDonations, SepaDirectDebitDonations"); } /** * Get the actual instance, which can be the following: ApplePayDonations, CardDonations, - * GooglePayDonations, IdealDonations, PayWithGoogleDonations + * GooglePayDonations, IdealDonations, PayWithGoogleDonations, SepaDirectDebitDonations * * @return The actual instance (ApplePayDonations, CardDonations, GooglePayDonations, - * IdealDonations, PayWithGoogleDonations) + * IdealDonations, PayWithGoogleDonations, SepaDirectDebitDonations) */ @Override public Object getActualInstance() { @@ -390,6 +429,17 @@ public PayWithGoogleDonations getPayWithGoogleDonations() throws ClassCastExcept return (PayWithGoogleDonations) super.getActualInstance(); } + /** + * Get the actual instance of `SepaDirectDebitDonations`. If the actual instance is not + * `SepaDirectDebitDonations`, the ClassCastException will be thrown. + * + * @return The actual instance of `SepaDirectDebitDonations` + * @throws ClassCastException if the instance is not `SepaDirectDebitDonations` + */ + public SepaDirectDebitDonations getSepaDirectDebitDonations() throws ClassCastException { + return (SepaDirectDebitDonations) super.getActualInstance(); + } + /** * Create an instance of DonationPaymentMethod given an JSON string * diff --git a/src/main/java/com/adyen/model/checkout/PaymentDetails.java b/src/main/java/com/adyen/model/checkout/PaymentDetails.java index 6ade94348..232115ab2 100644 --- a/src/main/java/com/adyen/model/checkout/PaymentDetails.java +++ b/src/main/java/com/adyen/model/checkout/PaymentDetails.java @@ -156,8 +156,6 @@ public enum TypeEnum { OMANNET(String.valueOf("omannet")), - GOPAY_WALLET(String.valueOf("gopay_wallet")), - KCP_NAVERPAY(String.valueOf("kcp_naverpay")), FAWRY(String.valueOf("fawry")), diff --git a/src/main/java/com/adyen/model/checkout/SepaDirectDebitDonations.java b/src/main/java/com/adyen/model/checkout/SepaDirectDebitDonations.java new file mode 100644 index 000000000..86f34597a --- /dev/null +++ b/src/main/java/com/adyen/model/checkout/SepaDirectDebitDonations.java @@ -0,0 +1,454 @@ +/* + * Adyen Checkout API + * + * The version of the OpenAPI document: 72 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.adyen.model.checkout; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.core.JsonProcessingException; +import java.util.*; +import java.util.Arrays; +import java.util.logging.Logger; + +/** SepaDirectDebitDonations */ +@JsonPropertyOrder({ + SepaDirectDebitDonations.JSON_PROPERTY_CHECKOUT_ATTEMPT_ID, + SepaDirectDebitDonations.JSON_PROPERTY_RECURRING_DETAIL_REFERENCE, + SepaDirectDebitDonations.JSON_PROPERTY_SDK_DATA, + SepaDirectDebitDonations.JSON_PROPERTY_STORED_PAYMENT_METHOD_ID, + SepaDirectDebitDonations.JSON_PROPERTY_TYPE +}) +public class SepaDirectDebitDonations { + public static final String JSON_PROPERTY_CHECKOUT_ATTEMPT_ID = "checkoutAttemptId"; + private String checkoutAttemptId; + + /** Mark when the attribute has been explicitly set. */ + private boolean isSetCheckoutAttemptId = false; + + public static final String JSON_PROPERTY_RECURRING_DETAIL_REFERENCE = "recurringDetailReference"; + /* deprecated since Adyen Checkout API v49: Use `storedPaymentMethodId` instead. */ + @Deprecated private String recurringDetailReference; + + /** Mark when the attribute has been explicitly set. */ + private boolean isSetRecurringDetailReference = false; + + public static final String JSON_PROPERTY_SDK_DATA = "sdkData"; + private String sdkData; + + /** Mark when the attribute has been explicitly set. */ + private boolean isSetSdkData = false; + + public static final String JSON_PROPERTY_STORED_PAYMENT_METHOD_ID = "storedPaymentMethodId"; + private String storedPaymentMethodId; + + /** Mark when the attribute has been explicitly set. */ + private boolean isSetStoredPaymentMethodId = false; + + /** **sepadirectdebit** */ + public enum TypeEnum { + SEPADIRECTDEBIT(String.valueOf("sepadirectdebit")); + + private static final Logger LOG = Logger.getLogger(TypeEnum.class.getName()); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static TypeEnum fromValue(String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + // handling unexpected value + LOG.warning( + "TypeEnum: unexpected enum value '" + + value + + "' - Supported values are " + + Arrays.toString(TypeEnum.values())); + return null; + } + } + + public static final String JSON_PROPERTY_TYPE = "type"; + private TypeEnum type; + + /** Mark when the attribute has been explicitly set. */ + private boolean isSetType = false; + + /** + * Sets whether attributes with null values should be explicitly included in the JSON payload. + * Default is false. + */ + @JsonIgnore private boolean includeNullValues = false; + + public SepaDirectDebitDonations() {} + + /** + * The checkout attempt identifier. + * + * @param checkoutAttemptId The checkout attempt identifier. + * @return the current {@code SepaDirectDebitDonations} instance, allowing for method chaining + */ + public SepaDirectDebitDonations checkoutAttemptId(String checkoutAttemptId) { + this.checkoutAttemptId = checkoutAttemptId; + isSetCheckoutAttemptId = true; // mark as set + return this; + } + + /** + * The checkout attempt identifier. + * + * @return checkoutAttemptId The checkout attempt identifier. + */ + @JsonProperty(JSON_PROPERTY_CHECKOUT_ATTEMPT_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getCheckoutAttemptId() { + return checkoutAttemptId; + } + + /** + * The checkout attempt identifier. + * + * @param checkoutAttemptId The checkout attempt identifier. + */ + @JsonProperty(JSON_PROPERTY_CHECKOUT_ATTEMPT_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setCheckoutAttemptId(String checkoutAttemptId) { + this.checkoutAttemptId = checkoutAttemptId; + isSetCheckoutAttemptId = true; // mark as set + } + + /** + * This is the `recurringDetailReference` returned in the response when you created the + * token. + * + * @param recurringDetailReference This is the `recurringDetailReference` returned in + * the response when you created the token. + * @return the current {@code SepaDirectDebitDonations} instance, allowing for method chaining + * @deprecated since Adyen Checkout API v49 Use `storedPaymentMethodId` instead. + */ + @Deprecated + public SepaDirectDebitDonations recurringDetailReference(String recurringDetailReference) { + this.recurringDetailReference = recurringDetailReference; + isSetRecurringDetailReference = true; // mark as set + return this; + } + + /** + * This is the `recurringDetailReference` returned in the response when you created the + * token. + * + * @return recurringDetailReference This is the `recurringDetailReference` returned in + * the response when you created the token. + * @deprecated since Adyen Checkout API v49 Use `storedPaymentMethodId` instead. + */ + @Deprecated + @JsonProperty(JSON_PROPERTY_RECURRING_DETAIL_REFERENCE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getRecurringDetailReference() { + return recurringDetailReference; + } + + /** + * This is the `recurringDetailReference` returned in the response when you created the + * token. + * + * @param recurringDetailReference This is the `recurringDetailReference` returned in + * the response when you created the token. + * @deprecated since Adyen Checkout API v49 Use `storedPaymentMethodId` instead. + */ + @Deprecated + @JsonProperty(JSON_PROPERTY_RECURRING_DETAIL_REFERENCE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setRecurringDetailReference(String recurringDetailReference) { + this.recurringDetailReference = recurringDetailReference; + isSetRecurringDetailReference = true; // mark as set + } + + /** + * Base64-encoded JSON object containing SDK related parameters required by the SDK + * + * @param sdkData Base64-encoded JSON object containing SDK related parameters required by the SDK + * @return the current {@code SepaDirectDebitDonations} instance, allowing for method chaining + */ + public SepaDirectDebitDonations sdkData(String sdkData) { + this.sdkData = sdkData; + isSetSdkData = true; // mark as set + return this; + } + + /** + * Base64-encoded JSON object containing SDK related parameters required by the SDK + * + * @return sdkData Base64-encoded JSON object containing SDK related parameters required by the + * SDK + */ + @JsonProperty(JSON_PROPERTY_SDK_DATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getSdkData() { + return sdkData; + } + + /** + * Base64-encoded JSON object containing SDK related parameters required by the SDK + * + * @param sdkData Base64-encoded JSON object containing SDK related parameters required by the SDK + */ + @JsonProperty(JSON_PROPERTY_SDK_DATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setSdkData(String sdkData) { + this.sdkData = sdkData; + isSetSdkData = true; // mark as set + } + + /** + * This is the `recurringDetailReference` returned in the response when you created the + * token. + * + * @param storedPaymentMethodId This is the `recurringDetailReference` returned in the + * response when you created the token. + * @return the current {@code SepaDirectDebitDonations} instance, allowing for method chaining + */ + public SepaDirectDebitDonations storedPaymentMethodId(String storedPaymentMethodId) { + this.storedPaymentMethodId = storedPaymentMethodId; + isSetStoredPaymentMethodId = true; // mark as set + return this; + } + + /** + * This is the `recurringDetailReference` returned in the response when you created the + * token. + * + * @return storedPaymentMethodId This is the `recurringDetailReference` returned in the + * response when you created the token. + */ + @JsonProperty(JSON_PROPERTY_STORED_PAYMENT_METHOD_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getStoredPaymentMethodId() { + return storedPaymentMethodId; + } + + /** + * This is the `recurringDetailReference` returned in the response when you created the + * token. + * + * @param storedPaymentMethodId This is the `recurringDetailReference` returned in the + * response when you created the token. + */ + @JsonProperty(JSON_PROPERTY_STORED_PAYMENT_METHOD_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setStoredPaymentMethodId(String storedPaymentMethodId) { + this.storedPaymentMethodId = storedPaymentMethodId; + isSetStoredPaymentMethodId = true; // mark as set + } + + /** + * **sepadirectdebit** + * + * @param type **sepadirectdebit** + * @return the current {@code SepaDirectDebitDonations} instance, allowing for method chaining + */ + public SepaDirectDebitDonations type(TypeEnum type) { + this.type = type; + isSetType = true; // mark as set + return this; + } + + /** + * **sepadirectdebit** + * + * @return type **sepadirectdebit** + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public TypeEnum getType() { + return type; + } + + /** + * **sepadirectdebit** + * + * @param type **sepadirectdebit** + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setType(TypeEnum type) { + this.type = type; + isSetType = true; // mark as set + } + + /** + * Configures whether null values are explicitly serialized in the JSON payload. Default is false. + */ + public SepaDirectDebitDonations includeNullValues(boolean includeNullValues) { + this.includeNullValues = includeNullValues; + return this; + } + + /** Returns whether null values are explicitly serialized in the JSON payload. */ + public boolean isIncludeNullValues() { + return includeNullValues; + } + + /** + * Sets whether null values should be explicitly serialized in the JSON payload. Default is false. + */ + public void setIncludeNullValues(boolean includeNullValues) { + this.includeNullValues = includeNullValues; + } + + /** Return true if this SepaDirectDebitDonations object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SepaDirectDebitDonations sepaDirectDebitDonations = (SepaDirectDebitDonations) o; + return Objects.equals(this.checkoutAttemptId, sepaDirectDebitDonations.checkoutAttemptId) + && Objects.equals( + this.isSetCheckoutAttemptId, sepaDirectDebitDonations.isSetCheckoutAttemptId) + && Objects.equals( + this.recurringDetailReference, sepaDirectDebitDonations.recurringDetailReference) + && Objects.equals( + this.isSetRecurringDetailReference, + sepaDirectDebitDonations.isSetRecurringDetailReference) + && Objects.equals(this.sdkData, sepaDirectDebitDonations.sdkData) + && Objects.equals(this.isSetSdkData, sepaDirectDebitDonations.isSetSdkData) + && Objects.equals( + this.storedPaymentMethodId, sepaDirectDebitDonations.storedPaymentMethodId) + && Objects.equals( + this.isSetStoredPaymentMethodId, sepaDirectDebitDonations.isSetStoredPaymentMethodId) + && Objects.equals(this.type, sepaDirectDebitDonations.type) + && Objects.equals(this.isSetType, sepaDirectDebitDonations.isSetType); + } + + @Override + public int hashCode() { + return Objects.hash( + checkoutAttemptId, + isSetCheckoutAttemptId, + recurringDetailReference, + isSetRecurringDetailReference, + sdkData, + isSetSdkData, + storedPaymentMethodId, + isSetStoredPaymentMethodId, + type, + isSetType); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SepaDirectDebitDonations {\n"); + sb.append(" checkoutAttemptId: ").append(toIndentedString(checkoutAttemptId)).append("\n"); + sb.append(" recurringDetailReference: ") + .append(toIndentedString(recurringDetailReference)) + .append("\n"); + sb.append(" sdkData: ").append(toIndentedString(sdkData)).append("\n"); + sb.append(" storedPaymentMethodId: ") + .append(toIndentedString(storedPaymentMethodId)) + .append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** Returns a map of properties to be merged into the JSON payload as explicit null values. */ + @JsonInclude(JsonInclude.Include.ALWAYS) + @JsonAnyGetter + public Map getExplicitNulls() { + if (!this.includeNullValues) { + return Collections.emptyMap(); + } + + Map nulls = new HashMap<>(); + + if (isSetCheckoutAttemptId) { + addIfNull(nulls, JSON_PROPERTY_CHECKOUT_ATTEMPT_ID, this.checkoutAttemptId); + } + if (isSetRecurringDetailReference) { + addIfNull(nulls, JSON_PROPERTY_RECURRING_DETAIL_REFERENCE, this.recurringDetailReference); + } + if (isSetSdkData) { + addIfNull(nulls, JSON_PROPERTY_SDK_DATA, this.sdkData); + } + if (isSetStoredPaymentMethodId) { + addIfNull(nulls, JSON_PROPERTY_STORED_PAYMENT_METHOD_ID, this.storedPaymentMethodId); + } + if (isSetType) { + addIfNull(nulls, JSON_PROPERTY_TYPE, this.type); + } + + return nulls; + } + + // add to map when value is null + private void addIfNull(Map map, String key, Object value) { + if (value == null) { + map.put(key, null); + } + } + + /** + * Create an instance of SepaDirectDebitDonations given an JSON string + * + * @param jsonString JSON string + * @return An instance of SepaDirectDebitDonations + * @throws JsonProcessingException if the JSON string is invalid with respect to + * SepaDirectDebitDonations + */ + public static SepaDirectDebitDonations fromJson(String jsonString) + throws JsonProcessingException { + return JSON.getMapper().readValue(jsonString, SepaDirectDebitDonations.class); + } + + /** + * Convert an instance of SepaDirectDebitDonations to an JSON string + * + * @return JSON string + */ + public String toJson() throws JsonProcessingException { + return JSON.getMapper().writeValueAsString(this); + } +} diff --git a/src/main/java/com/adyen/model/checkout/SessionAmountUpdate.java b/src/main/java/com/adyen/model/checkout/SessionAmountUpdate.java new file mode 100644 index 000000000..1b2fe267f --- /dev/null +++ b/src/main/java/com/adyen/model/checkout/SessionAmountUpdate.java @@ -0,0 +1,238 @@ +/* + * Adyen Checkout API + * + * The version of the OpenAPI document: 72 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.adyen.model.checkout; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.core.JsonProcessingException; +import java.util.*; + +/** SessionAmountUpdate */ +@JsonPropertyOrder({ + SessionAmountUpdate.JSON_PROPERTY_CURRENCY, + SessionAmountUpdate.JSON_PROPERTY_VALUE +}) +public class SessionAmountUpdate { + public static final String JSON_PROPERTY_CURRENCY = "currency"; + private String currency; + + /** Mark when the attribute has been explicitly set. */ + private boolean isSetCurrency = false; + + public static final String JSON_PROPERTY_VALUE = "value"; + private Long value; + + /** Mark when the attribute has been explicitly set. */ + private boolean isSetValue = false; + + /** + * Sets whether attributes with null values should be explicitly included in the JSON payload. + * Default is false. + */ + @JsonIgnore private boolean includeNullValues = false; + + public SessionAmountUpdate() {} + + /** + * The three-character [ISO currency + * code](https://docs.adyen.com/development-resources/currency-codes). + * + * @param currency The three-character [ISO currency + * code](https://docs.adyen.com/development-resources/currency-codes). + * @return the current {@code SessionAmountUpdate} instance, allowing for method chaining + */ + public SessionAmountUpdate currency(String currency) { + this.currency = currency; + isSetCurrency = true; // mark as set + return this; + } + + /** + * The three-character [ISO currency + * code](https://docs.adyen.com/development-resources/currency-codes). + * + * @return currency The three-character [ISO currency + * code](https://docs.adyen.com/development-resources/currency-codes). + */ + @JsonProperty(JSON_PROPERTY_CURRENCY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getCurrency() { + return currency; + } + + /** + * The three-character [ISO currency + * code](https://docs.adyen.com/development-resources/currency-codes). + * + * @param currency The three-character [ISO currency + * code](https://docs.adyen.com/development-resources/currency-codes). + */ + @JsonProperty(JSON_PROPERTY_CURRENCY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setCurrency(String currency) { + this.currency = currency; + isSetCurrency = true; // mark as set + } + + /** + * The amount of the transaction, in [minor + * units](https://docs.adyen.com/development-resources/currency-codes). + * + * @param value The amount of the transaction, in [minor + * units](https://docs.adyen.com/development-resources/currency-codes). + * @return the current {@code SessionAmountUpdate} instance, allowing for method chaining + */ + public SessionAmountUpdate value(Long value) { + this.value = value; + isSetValue = true; // mark as set + return this; + } + + /** + * The amount of the transaction, in [minor + * units](https://docs.adyen.com/development-resources/currency-codes). + * + * @return value The amount of the transaction, in [minor + * units](https://docs.adyen.com/development-resources/currency-codes). + */ + @JsonProperty(JSON_PROPERTY_VALUE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getValue() { + return value; + } + + /** + * The amount of the transaction, in [minor + * units](https://docs.adyen.com/development-resources/currency-codes). + * + * @param value The amount of the transaction, in [minor + * units](https://docs.adyen.com/development-resources/currency-codes). + */ + @JsonProperty(JSON_PROPERTY_VALUE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setValue(Long value) { + this.value = value; + isSetValue = true; // mark as set + } + + /** + * Configures whether null values are explicitly serialized in the JSON payload. Default is false. + */ + public SessionAmountUpdate includeNullValues(boolean includeNullValues) { + this.includeNullValues = includeNullValues; + return this; + } + + /** Returns whether null values are explicitly serialized in the JSON payload. */ + public boolean isIncludeNullValues() { + return includeNullValues; + } + + /** + * Sets whether null values should be explicitly serialized in the JSON payload. Default is false. + */ + public void setIncludeNullValues(boolean includeNullValues) { + this.includeNullValues = includeNullValues; + } + + /** Return true if this SessionAmountUpdate object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SessionAmountUpdate sessionAmountUpdate = (SessionAmountUpdate) o; + return Objects.equals(this.currency, sessionAmountUpdate.currency) + && Objects.equals(this.isSetCurrency, sessionAmountUpdate.isSetCurrency) + && Objects.equals(this.value, sessionAmountUpdate.value) + && Objects.equals(this.isSetValue, sessionAmountUpdate.isSetValue); + } + + @Override + public int hashCode() { + return Objects.hash(currency, isSetCurrency, value, isSetValue); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SessionAmountUpdate {\n"); + sb.append(" currency: ").append(toIndentedString(currency)).append("\n"); + sb.append(" value: ").append(toIndentedString(value)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** Returns a map of properties to be merged into the JSON payload as explicit null values. */ + @JsonInclude(JsonInclude.Include.ALWAYS) + @JsonAnyGetter + public Map getExplicitNulls() { + if (!this.includeNullValues) { + return Collections.emptyMap(); + } + + Map nulls = new HashMap<>(); + + if (isSetCurrency) { + addIfNull(nulls, JSON_PROPERTY_CURRENCY, this.currency); + } + if (isSetValue) { + addIfNull(nulls, JSON_PROPERTY_VALUE, this.value); + } + + return nulls; + } + + // add to map when value is null + private void addIfNull(Map map, String key, Object value) { + if (value == null) { + map.put(key, null); + } + } + + /** + * Create an instance of SessionAmountUpdate given an JSON string + * + * @param jsonString JSON string + * @return An instance of SessionAmountUpdate + * @throws JsonProcessingException if the JSON string is invalid with respect to + * SessionAmountUpdate + */ + public static SessionAmountUpdate fromJson(String jsonString) throws JsonProcessingException { + return JSON.getMapper().readValue(jsonString, SessionAmountUpdate.class); + } + + /** + * Convert an instance of SessionAmountUpdate to an JSON string + * + * @return JSON string + */ + public String toJson() throws JsonProcessingException { + return JSON.getMapper().writeValueAsString(this); + } +} diff --git a/src/main/java/com/adyen/model/checkout/StoredPaymentMethodDetails.java b/src/main/java/com/adyen/model/checkout/StoredPaymentMethodDetails.java index ba1c3c5af..5a62f6d41 100644 --- a/src/main/java/com/adyen/model/checkout/StoredPaymentMethodDetails.java +++ b/src/main/java/com/adyen/model/checkout/StoredPaymentMethodDetails.java @@ -117,7 +117,9 @@ public enum TypeEnum { TRUEMONEY(String.valueOf("truemoney")), - PAYSAFECARD(String.valueOf("paysafecard")); + PAYSAFECARD(String.valueOf("paysafecard")), + + GOPAY_WALLET(String.valueOf("gopay_wallet")); private static final Logger LOG = Logger.getLogger(TypeEnum.class.getName()); diff --git a/src/main/java/com/adyen/service/checkout/PaymentsApi.java b/src/main/java/com/adyen/service/checkout/PaymentsApi.java index e43c94e47..686d98f7f 100644 --- a/src/main/java/com/adyen/service/checkout/PaymentsApi.java +++ b/src/main/java/com/adyen/service/checkout/PaymentsApi.java @@ -17,6 +17,8 @@ import com.adyen.model.RequestOptions; import com.adyen.model.checkout.CardDetailsRequest; import com.adyen.model.checkout.CardDetailsResponse; +import com.adyen.model.checkout.CheckoutSessionPatchSessionRequest; +import com.adyen.model.checkout.CheckoutSessionPatchSessionResponse; import com.adyen.model.checkout.CreateCheckoutSessionRequest; import com.adyen.model.checkout.CreateCheckoutSessionResponse; import com.adyen.model.checkout.PaymentDetailsRequest; @@ -262,4 +264,49 @@ public CreateCheckoutSessionResponse sessions( resource.request(requestBody, requestOptions, ApiConstants.HttpMethod.POST, null); return CreateCheckoutSessionResponse.fromJson(jsonResult); } + + /** + * Update a payment session + * + * @param sessionId {@link String } (required) + * @param checkoutSessionPatchSessionRequest {@link CheckoutSessionPatchSessionRequest } + * (required) + * @return {@link CheckoutSessionPatchSessionResponse } + * @throws ApiException if fails to make API call + */ + public CheckoutSessionPatchSessionResponse updateSession( + String sessionId, CheckoutSessionPatchSessionRequest checkoutSessionPatchSessionRequest) + throws ApiException, IOException { + return updateSession(sessionId, checkoutSessionPatchSessionRequest, null); + } + + /** + * Update a payment session + * + * @param sessionId {@link String } (required) + * @param checkoutSessionPatchSessionRequest {@link CheckoutSessionPatchSessionRequest } + * (required) + * @param requestOptions {@link RequestOptions } Object to store additional HTTP headers such as + * idempotency-keys (optional) + * @return {@link CheckoutSessionPatchSessionResponse } + * @throws ApiException if fails to make API call + */ + public CheckoutSessionPatchSessionResponse updateSession( + String sessionId, + CheckoutSessionPatchSessionRequest checkoutSessionPatchSessionRequest, + RequestOptions requestOptions) + throws ApiException, IOException { + // Add path params + Map pathParams = new HashMap<>(); + if (sessionId == null) { + throw new IllegalArgumentException("Please provide the sessionId path parameter"); + } + pathParams.put("sessionId", sessionId); + + String requestBody = checkoutSessionPatchSessionRequest.toJson(); + Resource resource = new Resource(this, this.baseURL + "/sessions/{sessionId}", null); + String jsonResult = + resource.request(requestBody, requestOptions, ApiConstants.HttpMethod.PATCH, pathParams); + return CheckoutSessionPatchSessionResponse.fromJson(jsonResult); + } }