From 33aad37b25b43117dce991c2a1ca09ab4eaecb6d Mon Sep 17 00:00:00 2001 From: AdyenAutomationBot <38424300+AdyenAutomationBot@users.noreply.github.com> Date: Mon, 9 Mar 2026 13:31:52 +0000 Subject: [PATCH] [transactionwebhooks] Automated update from Adyen/adyen-openapi@37c03ec --- .../AbstractOpenApiSchema.java | 2 +- .../{transactionwebhooks => java}/Amount.java | 73 ++++++- .../BalancePlatformNotificationResponse.java | 66 ++++++- .../BankCategoryData.java | 73 ++++++- .../InternalCategoryData.java | 92 ++++++++- .../IssuedCard.java | 147 +++++++++++++- .../PaymentInstrument.java | 99 +++++++++- .../PlatformPayment.java | 120 ++++++++++- .../RelayedAuthorisationData.java | 73 ++++++- .../Resource.java | 83 +++++++- .../ResourceReference.java | 82 +++++++- .../ThreeDSecure.java | 64 +++++- .../Transaction.java | 186 +++++++++++++++++- .../TransactionNotificationRequestV4.java | 92 ++++++++- .../TransferNotificationValidationFact.java | 73 ++++++- .../TransferView.java | 82 +++++++- .../TransferViewCategoryData.java | 2 +- .../adyen/model/transactionwebhooks/JSON.java | 2 +- .../TransactionWebhooksHandler.java | 78 -------- 19 files changed, 1363 insertions(+), 126 deletions(-) rename src/main/java/com/adyen/model/{transactionwebhooks => java}/AbstractOpenApiSchema.java (98%) rename src/main/java/com/adyen/model/{transactionwebhooks => java}/Amount.java (69%) rename src/main/java/com/adyen/model/{transactionwebhooks => java}/BalancePlatformNotificationResponse.java (67%) rename src/main/java/com/adyen/model/{transactionwebhooks => java}/BankCategoryData.java (84%) rename src/main/java/com/adyen/model/{transactionwebhooks => java}/InternalCategoryData.java (70%) rename src/main/java/com/adyen/model/{transactionwebhooks => java}/IssuedCard.java (81%) rename src/main/java/com/adyen/model/{transactionwebhooks => java}/PaymentInstrument.java (68%) rename src/main/java/com/adyen/model/{transactionwebhooks => java}/PlatformPayment.java (85%) rename src/main/java/com/adyen/model/{transactionwebhooks => java}/RelayedAuthorisationData.java (70%) rename src/main/java/com/adyen/model/{transactionwebhooks => java}/Resource.java (68%) rename src/main/java/com/adyen/model/{transactionwebhooks => java}/ResourceReference.java (67%) rename src/main/java/com/adyen/model/{transactionwebhooks => java}/ThreeDSecure.java (63%) rename src/main/java/com/adyen/model/{transactionwebhooks => java}/Transaction.java (77%) rename src/main/java/com/adyen/model/{transactionwebhooks => java}/TransactionNotificationRequestV4.java (72%) rename src/main/java/com/adyen/model/{transactionwebhooks => java}/TransferNotificationValidationFact.java (67%) rename src/main/java/com/adyen/model/{transactionwebhooks => java}/TransferView.java (71%) rename src/main/java/com/adyen/model/{transactionwebhooks => java}/TransferViewCategoryData.java (99%) delete mode 100644 src/main/java/com/adyen/model/transactionwebhooks/TransactionWebhooksHandler.java diff --git a/src/main/java/com/adyen/model/transactionwebhooks/AbstractOpenApiSchema.java b/src/main/java/com/adyen/model/java/AbstractOpenApiSchema.java similarity index 98% rename from src/main/java/com/adyen/model/transactionwebhooks/AbstractOpenApiSchema.java rename to src/main/java/com/adyen/model/java/AbstractOpenApiSchema.java index e707b4965..b3a74d283 100644 --- a/src/main/java/com/adyen/model/transactionwebhooks/AbstractOpenApiSchema.java +++ b/src/main/java/com/adyen/model/java/AbstractOpenApiSchema.java @@ -9,7 +9,7 @@ * Do not edit the class manually. */ -package com.adyen.model.transactionwebhooks; +package com.adyen.model.java; import com.fasterxml.jackson.annotation.JsonValue; import jakarta.ws.rs.core.GenericType; diff --git a/src/main/java/com/adyen/model/transactionwebhooks/Amount.java b/src/main/java/com/adyen/model/java/Amount.java similarity index 69% rename from src/main/java/com/adyen/model/transactionwebhooks/Amount.java rename to src/main/java/com/adyen/model/java/Amount.java index cde08ff1b..153a869d5 100644 --- a/src/main/java/com/adyen/model/transactionwebhooks/Amount.java +++ b/src/main/java/com/adyen/model/java/Amount.java @@ -9,8 +9,10 @@ * Do not edit the class manually. */ -package com.adyen.model.transactionwebhooks; +package com.adyen.model.java; +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; @@ -23,9 +25,21 @@ public class Amount { 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 Amount() {} /** @@ -40,6 +54,7 @@ public Amount() {} */ public Amount currency(String currency) { this.currency = currency; + isSetCurrency = true; // mark as set return this; } @@ -71,6 +86,7 @@ public String getCurrency() { @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setCurrency(String currency) { this.currency = currency; + isSetCurrency = true; // mark as set } /** @@ -83,6 +99,7 @@ public void setCurrency(String currency) { */ public Amount value(Long value) { this.value = value; + isSetValue = true; // mark as set return this; } @@ -110,6 +127,27 @@ public Long getValue() { @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 Amount 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 Amount object is equal to o. */ @@ -123,12 +161,14 @@ public boolean equals(Object o) { } Amount amount = (Amount) o; return Objects.equals(this.currency, amount.currency) - && Objects.equals(this.value, amount.value); + && Objects.equals(this.isSetCurrency, amount.isSetCurrency) + && Objects.equals(this.value, amount.value) + && Objects.equals(this.isSetValue, amount.isSetValue); } @Override public int hashCode() { - return Objects.hash(currency, value); + return Objects.hash(currency, isSetCurrency, value, isSetValue); } @Override @@ -151,6 +191,33 @@ private String toIndentedString(Object o) { 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 Amount given an JSON string * diff --git a/src/main/java/com/adyen/model/transactionwebhooks/BalancePlatformNotificationResponse.java b/src/main/java/com/adyen/model/java/BalancePlatformNotificationResponse.java similarity index 67% rename from src/main/java/com/adyen/model/transactionwebhooks/BalancePlatformNotificationResponse.java rename to src/main/java/com/adyen/model/java/BalancePlatformNotificationResponse.java index 639e14f1e..4bab9bc48 100644 --- a/src/main/java/com/adyen/model/transactionwebhooks/BalancePlatformNotificationResponse.java +++ b/src/main/java/com/adyen/model/java/BalancePlatformNotificationResponse.java @@ -9,8 +9,10 @@ * Do not edit the class manually. */ -package com.adyen.model.transactionwebhooks; +package com.adyen.model.java; +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; @@ -23,6 +25,15 @@ public class BalancePlatformNotificationResponse { public static final String JSON_PROPERTY_NOTIFICATION_RESPONSE = "notificationResponse"; private String notificationResponse; + /** Mark when the attribute has been explicitly set. */ + private boolean isSetNotificationResponse = false; + + /** + * Sets whether attributes with null values should be explicitly included in the JSON payload. + * Default is false. + */ + @JsonIgnore private boolean includeNullValues = false; + public BalancePlatformNotificationResponse() {} /** @@ -36,6 +47,7 @@ public BalancePlatformNotificationResponse() {} */ public BalancePlatformNotificationResponse notificationResponse(String notificationResponse) { this.notificationResponse = notificationResponse; + isSetNotificationResponse = true; // mark as set return this; } @@ -63,6 +75,27 @@ public String getNotificationResponse() { @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setNotificationResponse(String notificationResponse) { this.notificationResponse = notificationResponse; + isSetNotificationResponse = true; // mark as set + } + + /** + * Configures whether null values are explicitly serialized in the JSON payload. Default is false. + */ + public BalancePlatformNotificationResponse 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 BalancePlatformNotificationResponse object is equal to o. */ @@ -77,12 +110,15 @@ public boolean equals(Object o) { BalancePlatformNotificationResponse balancePlatformNotificationResponse = (BalancePlatformNotificationResponse) o; return Objects.equals( - this.notificationResponse, balancePlatformNotificationResponse.notificationResponse); + this.notificationResponse, balancePlatformNotificationResponse.notificationResponse) + && Objects.equals( + this.isSetNotificationResponse, + balancePlatformNotificationResponse.isSetNotificationResponse); } @Override public int hashCode() { - return Objects.hash(notificationResponse); + return Objects.hash(notificationResponse, isSetNotificationResponse); } @Override @@ -106,6 +142,30 @@ private String toIndentedString(Object o) { 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 (isSetNotificationResponse) { + addIfNull(nulls, JSON_PROPERTY_NOTIFICATION_RESPONSE, this.notificationResponse); + } + + 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 BalancePlatformNotificationResponse given an JSON string * diff --git a/src/main/java/com/adyen/model/transactionwebhooks/BankCategoryData.java b/src/main/java/com/adyen/model/java/BankCategoryData.java similarity index 84% rename from src/main/java/com/adyen/model/transactionwebhooks/BankCategoryData.java rename to src/main/java/com/adyen/model/java/BankCategoryData.java index 3e5ae9030..b6bb170e3 100644 --- a/src/main/java/com/adyen/model/transactionwebhooks/BankCategoryData.java +++ b/src/main/java/com/adyen/model/java/BankCategoryData.java @@ -9,9 +9,11 @@ * Do not edit the class manually. */ -package com.adyen.model.transactionwebhooks; +package com.adyen.model.java; +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; @@ -88,6 +90,9 @@ public static PriorityEnum fromValue(String value) { public static final String JSON_PROPERTY_PRIORITY = "priority"; private PriorityEnum priority; + /** Mark when the attribute has been explicitly set. */ + private boolean isSetPriority = false; + /** **bank** */ public enum TypeEnum { BANK(String.valueOf("bank")); @@ -130,6 +135,15 @@ public static TypeEnum fromValue(String value) { 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 BankCategoryData() {} /** @@ -160,6 +174,7 @@ public BankCategoryData() {} */ public BankCategoryData priority(PriorityEnum priority) { this.priority = priority; + isSetPriority = true; // mark as set return this; } @@ -223,6 +238,7 @@ public PriorityEnum getPriority() { @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setPriority(PriorityEnum priority) { this.priority = priority; + isSetPriority = true; // mark as set } /** @@ -233,6 +249,7 @@ public void setPriority(PriorityEnum priority) { */ public BankCategoryData type(TypeEnum type) { this.type = type; + isSetType = true; // mark as set return this; } @@ -256,6 +273,27 @@ public TypeEnum getType() { @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 BankCategoryData 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 BankCategoryData object is equal to o. */ @@ -269,12 +307,14 @@ public boolean equals(Object o) { } BankCategoryData bankCategoryData = (BankCategoryData) o; return Objects.equals(this.priority, bankCategoryData.priority) - && Objects.equals(this.type, bankCategoryData.type); + && Objects.equals(this.isSetPriority, bankCategoryData.isSetPriority) + && Objects.equals(this.type, bankCategoryData.type) + && Objects.equals(this.isSetType, bankCategoryData.isSetType); } @Override public int hashCode() { - return Objects.hash(priority, type); + return Objects.hash(priority, isSetPriority, type, isSetType); } @Override @@ -297,6 +337,33 @@ private String toIndentedString(Object o) { 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 (isSetPriority) { + addIfNull(nulls, JSON_PROPERTY_PRIORITY, this.priority); + } + 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 BankCategoryData given an JSON string * diff --git a/src/main/java/com/adyen/model/transactionwebhooks/InternalCategoryData.java b/src/main/java/com/adyen/model/java/InternalCategoryData.java similarity index 70% rename from src/main/java/com/adyen/model/transactionwebhooks/InternalCategoryData.java rename to src/main/java/com/adyen/model/java/InternalCategoryData.java index 73fed0ff6..096cfe4d4 100644 --- a/src/main/java/com/adyen/model/transactionwebhooks/InternalCategoryData.java +++ b/src/main/java/com/adyen/model/java/InternalCategoryData.java @@ -9,9 +9,11 @@ * Do not edit the class manually. */ -package com.adyen.model.transactionwebhooks; +package com.adyen.model.java; +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; @@ -32,9 +34,15 @@ public class InternalCategoryData { "modificationMerchantReference"; private String modificationMerchantReference; + /** Mark when the attribute has been explicitly set. */ + private boolean isSetModificationMerchantReference = false; + public static final String JSON_PROPERTY_MODIFICATION_PSP_REFERENCE = "modificationPspReference"; private String modificationPspReference; + /** Mark when the attribute has been explicitly set. */ + private boolean isSetModificationPspReference = false; + /** **internal** */ public enum TypeEnum { INTERNAL(String.valueOf("internal")); @@ -77,6 +85,15 @@ public static TypeEnum fromValue(String value) { 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 InternalCategoryData() {} /** @@ -88,6 +105,7 @@ public InternalCategoryData() {} */ public InternalCategoryData modificationMerchantReference(String modificationMerchantReference) { this.modificationMerchantReference = modificationMerchantReference; + isSetModificationMerchantReference = true; // mark as set return this; } @@ -113,6 +131,7 @@ public String getModificationMerchantReference() { @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setModificationMerchantReference(String modificationMerchantReference) { this.modificationMerchantReference = modificationMerchantReference; + isSetModificationMerchantReference = true; // mark as set } /** @@ -123,6 +142,7 @@ public void setModificationMerchantReference(String modificationMerchantReferenc */ public InternalCategoryData modificationPspReference(String modificationPspReference) { this.modificationPspReference = modificationPspReference; + isSetModificationPspReference = true; // mark as set return this; } @@ -146,6 +166,7 @@ public String getModificationPspReference() { @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setModificationPspReference(String modificationPspReference) { this.modificationPspReference = modificationPspReference; + isSetModificationPspReference = true; // mark as set } /** @@ -156,6 +177,7 @@ public void setModificationPspReference(String modificationPspReference) { */ public InternalCategoryData type(TypeEnum type) { this.type = type; + isSetType = true; // mark as set return this; } @@ -179,6 +201,27 @@ public TypeEnum getType() { @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 InternalCategoryData 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 InternalCategoryData object is equal to o. */ @@ -193,14 +236,26 @@ public boolean equals(Object o) { InternalCategoryData internalCategoryData = (InternalCategoryData) o; return Objects.equals( this.modificationMerchantReference, internalCategoryData.modificationMerchantReference) + && Objects.equals( + this.isSetModificationMerchantReference, + internalCategoryData.isSetModificationMerchantReference) && Objects.equals( this.modificationPspReference, internalCategoryData.modificationPspReference) - && Objects.equals(this.type, internalCategoryData.type); + && Objects.equals( + this.isSetModificationPspReference, internalCategoryData.isSetModificationPspReference) + && Objects.equals(this.type, internalCategoryData.type) + && Objects.equals(this.isSetType, internalCategoryData.isSetType); } @Override public int hashCode() { - return Objects.hash(modificationMerchantReference, modificationPspReference, type); + return Objects.hash( + modificationMerchantReference, + isSetModificationMerchantReference, + modificationPspReference, + isSetModificationPspReference, + type, + isSetType); } @Override @@ -228,6 +283,37 @@ private String toIndentedString(Object o) { 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 (isSetModificationMerchantReference) { + addIfNull( + nulls, JSON_PROPERTY_MODIFICATION_MERCHANT_REFERENCE, this.modificationMerchantReference); + } + if (isSetModificationPspReference) { + addIfNull(nulls, JSON_PROPERTY_MODIFICATION_PSP_REFERENCE, this.modificationPspReference); + } + 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 InternalCategoryData given an JSON string * diff --git a/src/main/java/com/adyen/model/transactionwebhooks/IssuedCard.java b/src/main/java/com/adyen/model/java/IssuedCard.java similarity index 81% rename from src/main/java/com/adyen/model/transactionwebhooks/IssuedCard.java rename to src/main/java/com/adyen/model/java/IssuedCard.java index 4be8f2aae..caf30bba3 100644 --- a/src/main/java/com/adyen/model/transactionwebhooks/IssuedCard.java +++ b/src/main/java/com/adyen/model/java/IssuedCard.java @@ -9,9 +9,11 @@ * Do not edit the class manually. */ -package com.adyen.model.transactionwebhooks; +package com.adyen.model.java; +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; @@ -39,6 +41,9 @@ public class IssuedCard { public static final String JSON_PROPERTY_AUTHORISATION_TYPE = "authorisationType"; private String authorisationType; + /** Mark when the attribute has been explicitly set. */ + private boolean isSetAuthorisationType = false; + /** * Indicates the method used for entering the PAN to initiate a transaction. Possible values: * **manual**, **chip**, **magstripe**, **contactless**, **cof**, **ecommerce**, **token**. @@ -96,6 +101,9 @@ public static PanEntryModeEnum fromValue(String value) { public static final String JSON_PROPERTY_PAN_ENTRY_MODE = "panEntryMode"; private PanEntryModeEnum panEntryMode; + /** Mark when the attribute has been explicitly set. */ + private boolean isSetPanEntryMode = false; + /** * Contains information about how the payment was processed. For example, **ecommerce** for online * or **pos** for in-person payments. @@ -155,19 +163,34 @@ public static ProcessingTypeEnum fromValue(String value) { public static final String JSON_PROPERTY_PROCESSING_TYPE = "processingType"; private ProcessingTypeEnum processingType; + /** Mark when the attribute has been explicitly set. */ + private boolean isSetProcessingType = false; + public static final String JSON_PROPERTY_RELAYED_AUTHORISATION_DATA = "relayedAuthorisationData"; private RelayedAuthorisationData relayedAuthorisationData; + /** Mark when the attribute has been explicitly set. */ + private boolean isSetRelayedAuthorisationData = false; + public static final String JSON_PROPERTY_SCHEME_TRACE_ID = "schemeTraceId"; private String schemeTraceId; + /** Mark when the attribute has been explicitly set. */ + private boolean isSetSchemeTraceId = false; + public static final String JSON_PROPERTY_SCHEME_UNIQUE_TRANSACTION_ID = "schemeUniqueTransactionId"; private String schemeUniqueTransactionId; + /** Mark when the attribute has been explicitly set. */ + private boolean isSetSchemeUniqueTransactionId = false; + public static final String JSON_PROPERTY_THREE_D_SECURE = "threeDSecure"; private ThreeDSecure threeDSecure; + /** Mark when the attribute has been explicitly set. */ + private boolean isSetThreeDSecure = false; + /** **issuedCard** */ public enum TypeEnum { ISSUEDCARD(String.valueOf("issuedCard")); @@ -210,9 +233,21 @@ public static TypeEnum fromValue(String value) { public static final String JSON_PROPERTY_TYPE = "type"; private TypeEnum type; + /** Mark when the attribute has been explicitly set. */ + private boolean isSetType = false; + public static final String JSON_PROPERTY_VALIDATION_FACTS = "validationFacts"; private List validationFacts; + /** Mark when the attribute has been explicitly set. */ + private boolean isSetValidationFacts = false; + + /** + * Sets whether attributes with null values should be explicitly included in the JSON payload. + * Default is false. + */ + @JsonIgnore private boolean includeNullValues = false; + public IssuedCard() {} /** @@ -225,6 +260,7 @@ public IssuedCard() {} */ public IssuedCard authorisationType(String authorisationType) { this.authorisationType = authorisationType; + isSetAuthorisationType = true; // mark as set return this; } @@ -252,6 +288,7 @@ public String getAuthorisationType() { @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setAuthorisationType(String authorisationType) { this.authorisationType = authorisationType; + isSetAuthorisationType = true; // mark as set } /** @@ -265,6 +302,7 @@ public void setAuthorisationType(String authorisationType) { */ public IssuedCard panEntryMode(PanEntryModeEnum panEntryMode) { this.panEntryMode = panEntryMode; + isSetPanEntryMode = true; // mark as set return this; } @@ -294,6 +332,7 @@ public PanEntryModeEnum getPanEntryMode() { @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setPanEntryMode(PanEntryModeEnum panEntryMode) { this.panEntryMode = panEntryMode; + isSetPanEntryMode = true; // mark as set } /** @@ -306,6 +345,7 @@ public void setPanEntryMode(PanEntryModeEnum panEntryMode) { */ public IssuedCard processingType(ProcessingTypeEnum processingType) { this.processingType = processingType; + isSetProcessingType = true; // mark as set return this; } @@ -333,6 +373,7 @@ public ProcessingTypeEnum getProcessingType() { @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setProcessingType(ProcessingTypeEnum processingType) { this.processingType = processingType; + isSetProcessingType = true; // mark as set } /** @@ -343,6 +384,7 @@ public void setProcessingType(ProcessingTypeEnum processingType) { */ public IssuedCard relayedAuthorisationData(RelayedAuthorisationData relayedAuthorisationData) { this.relayedAuthorisationData = relayedAuthorisationData; + isSetRelayedAuthorisationData = true; // mark as set return this; } @@ -366,6 +408,7 @@ public RelayedAuthorisationData getRelayedAuthorisationData() { @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setRelayedAuthorisationData(RelayedAuthorisationData relayedAuthorisationData) { this.relayedAuthorisationData = relayedAuthorisationData; + isSetRelayedAuthorisationData = true; // mark as set } /** @@ -384,6 +427,7 @@ public void setRelayedAuthorisationData(RelayedAuthorisationData relayedAuthoris */ public IssuedCard schemeTraceId(String schemeTraceId) { this.schemeTraceId = schemeTraceId; + isSetSchemeTraceId = true; // mark as set return this; } @@ -423,6 +467,7 @@ public String getSchemeTraceId() { @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setSchemeTraceId(String schemeTraceId) { this.schemeTraceId = schemeTraceId; + isSetSchemeTraceId = true; // mark as set } /** @@ -435,6 +480,7 @@ public void setSchemeTraceId(String schemeTraceId) { */ public IssuedCard schemeUniqueTransactionId(String schemeUniqueTransactionId) { this.schemeUniqueTransactionId = schemeUniqueTransactionId; + isSetSchemeUniqueTransactionId = true; // mark as set return this; } @@ -462,6 +508,7 @@ public String getSchemeUniqueTransactionId() { @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setSchemeUniqueTransactionId(String schemeUniqueTransactionId) { this.schemeUniqueTransactionId = schemeUniqueTransactionId; + isSetSchemeUniqueTransactionId = true; // mark as set } /** @@ -472,6 +519,7 @@ public void setSchemeUniqueTransactionId(String schemeUniqueTransactionId) { */ public IssuedCard threeDSecure(ThreeDSecure threeDSecure) { this.threeDSecure = threeDSecure; + isSetThreeDSecure = true; // mark as set return this; } @@ -495,6 +543,7 @@ public ThreeDSecure getThreeDSecure() { @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setThreeDSecure(ThreeDSecure threeDSecure) { this.threeDSecure = threeDSecure; + isSetThreeDSecure = true; // mark as set } /** @@ -505,6 +554,7 @@ public void setThreeDSecure(ThreeDSecure threeDSecure) { */ public IssuedCard type(TypeEnum type) { this.type = type; + isSetType = true; // mark as set return this; } @@ -528,6 +578,7 @@ public TypeEnum getType() { @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setType(TypeEnum type) { this.type = type; + isSetType = true; // mark as set } /** @@ -540,6 +591,7 @@ public void setType(TypeEnum type) { */ public IssuedCard validationFacts(List validationFacts) { this.validationFacts = validationFacts; + isSetValidationFacts = true; // mark as set return this; } @@ -575,6 +627,27 @@ public List getValidationFacts() { @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setValidationFacts(List validationFacts) { this.validationFacts = validationFacts; + isSetValidationFacts = true; // mark as set + } + + /** + * Configures whether null values are explicitly serialized in the JSON payload. Default is false. + */ + public IssuedCard 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 IssuedCard object is equal to o. */ @@ -588,28 +661,48 @@ public boolean equals(Object o) { } IssuedCard issuedCard = (IssuedCard) o; return Objects.equals(this.authorisationType, issuedCard.authorisationType) + && Objects.equals(this.isSetAuthorisationType, issuedCard.isSetAuthorisationType) && Objects.equals(this.panEntryMode, issuedCard.panEntryMode) + && Objects.equals(this.isSetPanEntryMode, issuedCard.isSetPanEntryMode) && Objects.equals(this.processingType, issuedCard.processingType) + && Objects.equals(this.isSetProcessingType, issuedCard.isSetProcessingType) && Objects.equals(this.relayedAuthorisationData, issuedCard.relayedAuthorisationData) + && Objects.equals( + this.isSetRelayedAuthorisationData, issuedCard.isSetRelayedAuthorisationData) && Objects.equals(this.schemeTraceId, issuedCard.schemeTraceId) + && Objects.equals(this.isSetSchemeTraceId, issuedCard.isSetSchemeTraceId) && Objects.equals(this.schemeUniqueTransactionId, issuedCard.schemeUniqueTransactionId) + && Objects.equals( + this.isSetSchemeUniqueTransactionId, issuedCard.isSetSchemeUniqueTransactionId) && Objects.equals(this.threeDSecure, issuedCard.threeDSecure) + && Objects.equals(this.isSetThreeDSecure, issuedCard.isSetThreeDSecure) && Objects.equals(this.type, issuedCard.type) - && Objects.equals(this.validationFacts, issuedCard.validationFacts); + && Objects.equals(this.isSetType, issuedCard.isSetType) + && Objects.equals(this.validationFacts, issuedCard.validationFacts) + && Objects.equals(this.isSetValidationFacts, issuedCard.isSetValidationFacts); } @Override public int hashCode() { return Objects.hash( authorisationType, + isSetAuthorisationType, panEntryMode, + isSetPanEntryMode, processingType, + isSetProcessingType, relayedAuthorisationData, + isSetRelayedAuthorisationData, schemeTraceId, + isSetSchemeTraceId, schemeUniqueTransactionId, + isSetSchemeUniqueTransactionId, threeDSecure, + isSetThreeDSecure, type, - validationFacts); + isSetType, + validationFacts, + isSetValidationFacts); } @Override @@ -643,6 +736,54 @@ private String toIndentedString(Object o) { 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 (isSetAuthorisationType) { + addIfNull(nulls, JSON_PROPERTY_AUTHORISATION_TYPE, this.authorisationType); + } + if (isSetPanEntryMode) { + addIfNull(nulls, JSON_PROPERTY_PAN_ENTRY_MODE, this.panEntryMode); + } + if (isSetProcessingType) { + addIfNull(nulls, JSON_PROPERTY_PROCESSING_TYPE, this.processingType); + } + if (isSetRelayedAuthorisationData) { + addIfNull(nulls, JSON_PROPERTY_RELAYED_AUTHORISATION_DATA, this.relayedAuthorisationData); + } + if (isSetSchemeTraceId) { + addIfNull(nulls, JSON_PROPERTY_SCHEME_TRACE_ID, this.schemeTraceId); + } + if (isSetSchemeUniqueTransactionId) { + addIfNull(nulls, JSON_PROPERTY_SCHEME_UNIQUE_TRANSACTION_ID, this.schemeUniqueTransactionId); + } + if (isSetThreeDSecure) { + addIfNull(nulls, JSON_PROPERTY_THREE_D_SECURE, this.threeDSecure); + } + if (isSetType) { + addIfNull(nulls, JSON_PROPERTY_TYPE, this.type); + } + if (isSetValidationFacts) { + addIfNull(nulls, JSON_PROPERTY_VALIDATION_FACTS, this.validationFacts); + } + + 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 IssuedCard given an JSON string * diff --git a/src/main/java/com/adyen/model/transactionwebhooks/PaymentInstrument.java b/src/main/java/com/adyen/model/java/PaymentInstrument.java similarity index 68% rename from src/main/java/com/adyen/model/transactionwebhooks/PaymentInstrument.java rename to src/main/java/com/adyen/model/java/PaymentInstrument.java index ad51ffa3c..412720f94 100644 --- a/src/main/java/com/adyen/model/transactionwebhooks/PaymentInstrument.java +++ b/src/main/java/com/adyen/model/java/PaymentInstrument.java @@ -9,8 +9,10 @@ * Do not edit the class manually. */ -package com.adyen.model.transactionwebhooks; +package com.adyen.model.java; +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; @@ -28,15 +30,33 @@ public class PaymentInstrument { public static final String JSON_PROPERTY_DESCRIPTION = "description"; private String description; + /** Mark when the attribute has been explicitly set. */ + private boolean isSetDescription = false; + public static final String JSON_PROPERTY_ID = "id"; private String id; + /** Mark when the attribute has been explicitly set. */ + private boolean isSetId = false; + public static final String JSON_PROPERTY_REFERENCE = "reference"; private String reference; + /** Mark when the attribute has been explicitly set. */ + private boolean isSetReference = false; + public static final String JSON_PROPERTY_TOKEN_TYPE = "tokenType"; private String tokenType; + /** Mark when the attribute has been explicitly set. */ + private boolean isSetTokenType = false; + + /** + * Sets whether attributes with null values should be explicitly included in the JSON payload. + * Default is false. + */ + @JsonIgnore private boolean includeNullValues = false; + public PaymentInstrument() {} /** @@ -47,6 +67,7 @@ public PaymentInstrument() {} */ public PaymentInstrument description(String description) { this.description = description; + isSetDescription = true; // mark as set return this; } @@ -70,6 +91,7 @@ public String getDescription() { @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setDescription(String description) { this.description = description; + isSetDescription = true; // mark as set } /** @@ -80,6 +102,7 @@ public void setDescription(String description) { */ public PaymentInstrument id(String id) { this.id = id; + isSetId = true; // mark as set return this; } @@ -103,6 +126,7 @@ public String getId() { @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setId(String id) { this.id = id; + isSetId = true; // mark as set } /** @@ -113,6 +137,7 @@ public void setId(String id) { */ public PaymentInstrument reference(String reference) { this.reference = reference; + isSetReference = true; // mark as set return this; } @@ -136,6 +161,7 @@ public String getReference() { @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setReference(String reference) { this.reference = reference; + isSetReference = true; // mark as set } /** @@ -146,6 +172,7 @@ public void setReference(String reference) { */ public PaymentInstrument tokenType(String tokenType) { this.tokenType = tokenType; + isSetTokenType = true; // mark as set return this; } @@ -169,6 +196,27 @@ public String getTokenType() { @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setTokenType(String tokenType) { this.tokenType = tokenType; + isSetTokenType = true; // mark as set + } + + /** + * Configures whether null values are explicitly serialized in the JSON payload. Default is false. + */ + public PaymentInstrument 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 PaymentInstrument object is equal to o. */ @@ -182,14 +230,26 @@ public boolean equals(Object o) { } PaymentInstrument paymentInstrument = (PaymentInstrument) o; return Objects.equals(this.description, paymentInstrument.description) + && Objects.equals(this.isSetDescription, paymentInstrument.isSetDescription) && Objects.equals(this.id, paymentInstrument.id) + && Objects.equals(this.isSetId, paymentInstrument.isSetId) && Objects.equals(this.reference, paymentInstrument.reference) - && Objects.equals(this.tokenType, paymentInstrument.tokenType); + && Objects.equals(this.isSetReference, paymentInstrument.isSetReference) + && Objects.equals(this.tokenType, paymentInstrument.tokenType) + && Objects.equals(this.isSetTokenType, paymentInstrument.isSetTokenType); } @Override public int hashCode() { - return Objects.hash(description, id, reference, tokenType); + return Objects.hash( + description, + isSetDescription, + id, + isSetId, + reference, + isSetReference, + tokenType, + isSetTokenType); } @Override @@ -214,6 +274,39 @@ private String toIndentedString(Object o) { 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 (isSetDescription) { + addIfNull(nulls, JSON_PROPERTY_DESCRIPTION, this.description); + } + if (isSetId) { + addIfNull(nulls, JSON_PROPERTY_ID, this.id); + } + if (isSetReference) { + addIfNull(nulls, JSON_PROPERTY_REFERENCE, this.reference); + } + if (isSetTokenType) { + addIfNull(nulls, JSON_PROPERTY_TOKEN_TYPE, this.tokenType); + } + + 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 PaymentInstrument given an JSON string * diff --git a/src/main/java/com/adyen/model/transactionwebhooks/PlatformPayment.java b/src/main/java/com/adyen/model/java/PlatformPayment.java similarity index 85% rename from src/main/java/com/adyen/model/transactionwebhooks/PlatformPayment.java rename to src/main/java/com/adyen/model/java/PlatformPayment.java index f69bf5ac3..05a43d72e 100644 --- a/src/main/java/com/adyen/model/transactionwebhooks/PlatformPayment.java +++ b/src/main/java/com/adyen/model/java/PlatformPayment.java @@ -9,9 +9,11 @@ * Do not edit the class manually. */ -package com.adyen.model.transactionwebhooks; +package com.adyen.model.java; +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; @@ -35,12 +37,21 @@ public class PlatformPayment { "modificationMerchantReference"; private String modificationMerchantReference; + /** Mark when the attribute has been explicitly set. */ + private boolean isSetModificationMerchantReference = false; + public static final String JSON_PROPERTY_MODIFICATION_PSP_REFERENCE = "modificationPspReference"; private String modificationPspReference; + /** Mark when the attribute has been explicitly set. */ + private boolean isSetModificationPspReference = false; + public static final String JSON_PROPERTY_PAYMENT_MERCHANT_REFERENCE = "paymentMerchantReference"; private String paymentMerchantReference; + /** Mark when the attribute has been explicitly set. */ + private boolean isSetPaymentMerchantReference = false; + /** * Specifies the nature of the transfer. This parameter helps categorize transfers so you can * reconcile transactions at a later time, using the Balance Platform Accounting Report for @@ -139,9 +150,15 @@ public static PlatformPaymentTypeEnum fromValue(String value) { public static final String JSON_PROPERTY_PLATFORM_PAYMENT_TYPE = "platformPaymentType"; private PlatformPaymentTypeEnum platformPaymentType; + /** Mark when the attribute has been explicitly set. */ + private boolean isSetPlatformPaymentType = false; + public static final String JSON_PROPERTY_PSP_PAYMENT_REFERENCE = "pspPaymentReference"; private String pspPaymentReference; + /** Mark when the attribute has been explicitly set. */ + private boolean isSetPspPaymentReference = false; + /** **platformPayment** */ public enum TypeEnum { PLATFORMPAYMENT(String.valueOf("platformPayment")); @@ -184,6 +201,15 @@ public static TypeEnum fromValue(String value) { 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 PlatformPayment() {} /** @@ -195,6 +221,7 @@ public PlatformPayment() {} */ public PlatformPayment modificationMerchantReference(String modificationMerchantReference) { this.modificationMerchantReference = modificationMerchantReference; + isSetModificationMerchantReference = true; // mark as set return this; } @@ -220,6 +247,7 @@ public String getModificationMerchantReference() { @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setModificationMerchantReference(String modificationMerchantReference) { this.modificationMerchantReference = modificationMerchantReference; + isSetModificationMerchantReference = true; // mark as set } /** @@ -230,6 +258,7 @@ public void setModificationMerchantReference(String modificationMerchantReferenc */ public PlatformPayment modificationPspReference(String modificationPspReference) { this.modificationPspReference = modificationPspReference; + isSetModificationPspReference = true; // mark as set return this; } @@ -253,6 +282,7 @@ public String getModificationPspReference() { @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setModificationPspReference(String modificationPspReference) { this.modificationPspReference = modificationPspReference; + isSetModificationPspReference = true; // mark as set } /** @@ -263,6 +293,7 @@ public void setModificationPspReference(String modificationPspReference) { */ public PlatformPayment paymentMerchantReference(String paymentMerchantReference) { this.paymentMerchantReference = paymentMerchantReference; + isSetPaymentMerchantReference = true; // mark as set return this; } @@ -286,6 +317,7 @@ public String getPaymentMerchantReference() { @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setPaymentMerchantReference(String paymentMerchantReference) { this.paymentMerchantReference = paymentMerchantReference; + isSetPaymentMerchantReference = true; // mark as set } /** @@ -338,6 +370,7 @@ public void setPaymentMerchantReference(String paymentMerchantReference) { */ public PlatformPayment platformPaymentType(PlatformPaymentTypeEnum platformPaymentType) { this.platformPaymentType = platformPaymentType; + isSetPlatformPaymentType = true; // mark as set return this; } @@ -445,6 +478,7 @@ public PlatformPaymentTypeEnum getPlatformPaymentType() { @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setPlatformPaymentType(PlatformPaymentTypeEnum platformPaymentType) { this.platformPaymentType = platformPaymentType; + isSetPlatformPaymentType = true; // mark as set } /** @@ -455,6 +489,7 @@ public void setPlatformPaymentType(PlatformPaymentTypeEnum platformPaymentType) */ public PlatformPayment pspPaymentReference(String pspPaymentReference) { this.pspPaymentReference = pspPaymentReference; + isSetPspPaymentReference = true; // mark as set return this; } @@ -478,6 +513,7 @@ public String getPspPaymentReference() { @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setPspPaymentReference(String pspPaymentReference) { this.pspPaymentReference = pspPaymentReference; + isSetPspPaymentReference = true; // mark as set } /** @@ -488,6 +524,7 @@ public void setPspPaymentReference(String pspPaymentReference) { */ public PlatformPayment type(TypeEnum type) { this.type = type; + isSetType = true; // mark as set return this; } @@ -511,6 +548,27 @@ public TypeEnum getType() { @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 PlatformPayment 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 PlatformPayment object is equal to o. */ @@ -525,22 +583,38 @@ public boolean equals(Object o) { PlatformPayment platformPayment = (PlatformPayment) o; return Objects.equals( this.modificationMerchantReference, platformPayment.modificationMerchantReference) + && Objects.equals( + this.isSetModificationMerchantReference, + platformPayment.isSetModificationMerchantReference) && Objects.equals(this.modificationPspReference, platformPayment.modificationPspReference) + && Objects.equals( + this.isSetModificationPspReference, platformPayment.isSetModificationPspReference) && Objects.equals(this.paymentMerchantReference, platformPayment.paymentMerchantReference) + && Objects.equals( + this.isSetPaymentMerchantReference, platformPayment.isSetPaymentMerchantReference) && Objects.equals(this.platformPaymentType, platformPayment.platformPaymentType) + && Objects.equals(this.isSetPlatformPaymentType, platformPayment.isSetPlatformPaymentType) && Objects.equals(this.pspPaymentReference, platformPayment.pspPaymentReference) - && Objects.equals(this.type, platformPayment.type); + && Objects.equals(this.isSetPspPaymentReference, platformPayment.isSetPspPaymentReference) + && Objects.equals(this.type, platformPayment.type) + && Objects.equals(this.isSetType, platformPayment.isSetType); } @Override public int hashCode() { return Objects.hash( modificationMerchantReference, + isSetModificationMerchantReference, modificationPspReference, + isSetModificationPspReference, paymentMerchantReference, + isSetPaymentMerchantReference, platformPaymentType, + isSetPlatformPaymentType, pspPaymentReference, - type); + isSetPspPaymentReference, + type, + isSetType); } @Override @@ -577,6 +651,46 @@ private String toIndentedString(Object o) { 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 (isSetModificationMerchantReference) { + addIfNull( + nulls, JSON_PROPERTY_MODIFICATION_MERCHANT_REFERENCE, this.modificationMerchantReference); + } + if (isSetModificationPspReference) { + addIfNull(nulls, JSON_PROPERTY_MODIFICATION_PSP_REFERENCE, this.modificationPspReference); + } + if (isSetPaymentMerchantReference) { + addIfNull(nulls, JSON_PROPERTY_PAYMENT_MERCHANT_REFERENCE, this.paymentMerchantReference); + } + if (isSetPlatformPaymentType) { + addIfNull(nulls, JSON_PROPERTY_PLATFORM_PAYMENT_TYPE, this.platformPaymentType); + } + if (isSetPspPaymentReference) { + addIfNull(nulls, JSON_PROPERTY_PSP_PAYMENT_REFERENCE, this.pspPaymentReference); + } + 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 PlatformPayment given an JSON string * diff --git a/src/main/java/com/adyen/model/transactionwebhooks/RelayedAuthorisationData.java b/src/main/java/com/adyen/model/java/RelayedAuthorisationData.java similarity index 70% rename from src/main/java/com/adyen/model/transactionwebhooks/RelayedAuthorisationData.java rename to src/main/java/com/adyen/model/java/RelayedAuthorisationData.java index 00a7565d7..a3a6a5506 100644 --- a/src/main/java/com/adyen/model/transactionwebhooks/RelayedAuthorisationData.java +++ b/src/main/java/com/adyen/model/java/RelayedAuthorisationData.java @@ -9,8 +9,10 @@ * Do not edit the class manually. */ -package com.adyen.model.transactionwebhooks; +package com.adyen.model.java; +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; @@ -28,9 +30,21 @@ public class RelayedAuthorisationData { public static final String JSON_PROPERTY_METADATA = "metadata"; private Map metadata; + /** Mark when the attribute has been explicitly set. */ + private boolean isSetMetadata = false; + public static final String JSON_PROPERTY_REFERENCE = "reference"; private String reference; + /** Mark when the attribute has been explicitly set. */ + private boolean isSetReference = false; + + /** + * Sets whether attributes with null values should be explicitly included in the JSON payload. + * Default is false. + */ + @JsonIgnore private boolean includeNullValues = false; + public RelayedAuthorisationData() {} /** @@ -43,6 +57,7 @@ public RelayedAuthorisationData() {} */ public RelayedAuthorisationData metadata(Map metadata) { this.metadata = metadata; + isSetMetadata = true; // mark as set return this; } @@ -78,6 +93,7 @@ public Map getMetadata() { @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setMetadata(Map metadata) { this.metadata = metadata; + isSetMetadata = true; // mark as set } /** @@ -88,6 +104,7 @@ public void setMetadata(Map metadata) { */ public RelayedAuthorisationData reference(String reference) { this.reference = reference; + isSetReference = true; // mark as set return this; } @@ -111,6 +128,27 @@ public String getReference() { @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setReference(String reference) { this.reference = reference; + isSetReference = true; // mark as set + } + + /** + * Configures whether null values are explicitly serialized in the JSON payload. Default is false. + */ + public RelayedAuthorisationData 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 RelayedAuthorisationData object is equal to o. */ @@ -124,12 +162,14 @@ public boolean equals(Object o) { } RelayedAuthorisationData relayedAuthorisationData = (RelayedAuthorisationData) o; return Objects.equals(this.metadata, relayedAuthorisationData.metadata) - && Objects.equals(this.reference, relayedAuthorisationData.reference); + && Objects.equals(this.isSetMetadata, relayedAuthorisationData.isSetMetadata) + && Objects.equals(this.reference, relayedAuthorisationData.reference) + && Objects.equals(this.isSetReference, relayedAuthorisationData.isSetReference); } @Override public int hashCode() { - return Objects.hash(metadata, reference); + return Objects.hash(metadata, isSetMetadata, reference, isSetReference); } @Override @@ -152,6 +192,33 @@ private String toIndentedString(Object o) { 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 (isSetMetadata) { + addIfNull(nulls, JSON_PROPERTY_METADATA, this.metadata); + } + if (isSetReference) { + addIfNull(nulls, JSON_PROPERTY_REFERENCE, this.reference); + } + + 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 RelayedAuthorisationData given an JSON string * diff --git a/src/main/java/com/adyen/model/transactionwebhooks/Resource.java b/src/main/java/com/adyen/model/java/Resource.java similarity index 68% rename from src/main/java/com/adyen/model/transactionwebhooks/Resource.java rename to src/main/java/com/adyen/model/java/Resource.java index 925b9380f..32bcd222f 100644 --- a/src/main/java/com/adyen/model/transactionwebhooks/Resource.java +++ b/src/main/java/com/adyen/model/java/Resource.java @@ -9,8 +9,10 @@ * Do not edit the class manually. */ -package com.adyen.model.transactionwebhooks; +package com.adyen.model.java; +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; @@ -28,12 +30,27 @@ public class Resource { public static final String JSON_PROPERTY_BALANCE_PLATFORM = "balancePlatform"; private String balancePlatform; + /** Mark when the attribute has been explicitly set. */ + private boolean isSetBalancePlatform = false; + public static final String JSON_PROPERTY_CREATION_DATE = "creationDate"; private OffsetDateTime creationDate; + /** Mark when the attribute has been explicitly set. */ + private boolean isSetCreationDate = false; + public static final String JSON_PROPERTY_ID = "id"; private String id; + /** Mark when the attribute has been explicitly set. */ + private boolean isSetId = false; + + /** + * Sets whether attributes with null values should be explicitly included in the JSON payload. + * Default is false. + */ + @JsonIgnore private boolean includeNullValues = false; + public Resource() {} /** @@ -44,6 +61,7 @@ public Resource() {} */ public Resource balancePlatform(String balancePlatform) { this.balancePlatform = balancePlatform; + isSetBalancePlatform = true; // mark as set return this; } @@ -67,6 +85,7 @@ public String getBalancePlatform() { @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setBalancePlatform(String balancePlatform) { this.balancePlatform = balancePlatform; + isSetBalancePlatform = true; // mark as set } /** @@ -79,6 +98,7 @@ public void setBalancePlatform(String balancePlatform) { */ public Resource creationDate(OffsetDateTime creationDate) { this.creationDate = creationDate; + isSetCreationDate = true; // mark as set return this; } @@ -106,6 +126,7 @@ public OffsetDateTime getCreationDate() { @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setCreationDate(OffsetDateTime creationDate) { this.creationDate = creationDate; + isSetCreationDate = true; // mark as set } /** @@ -116,6 +137,7 @@ public void setCreationDate(OffsetDateTime creationDate) { */ public Resource id(String id) { this.id = id; + isSetId = true; // mark as set return this; } @@ -139,6 +161,27 @@ public String getId() { @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setId(String id) { this.id = id; + isSetId = true; // mark as set + } + + /** + * Configures whether null values are explicitly serialized in the JSON payload. Default is false. + */ + public Resource 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 Resource object is equal to o. */ @@ -152,13 +195,17 @@ public boolean equals(Object o) { } Resource resource = (Resource) o; return Objects.equals(this.balancePlatform, resource.balancePlatform) + && Objects.equals(this.isSetBalancePlatform, resource.isSetBalancePlatform) && Objects.equals(this.creationDate, resource.creationDate) - && Objects.equals(this.id, resource.id); + && Objects.equals(this.isSetCreationDate, resource.isSetCreationDate) + && Objects.equals(this.id, resource.id) + && Objects.equals(this.isSetId, resource.isSetId); } @Override public int hashCode() { - return Objects.hash(balancePlatform, creationDate, id); + return Objects.hash( + balancePlatform, isSetBalancePlatform, creationDate, isSetCreationDate, id, isSetId); } @Override @@ -182,6 +229,36 @@ private String toIndentedString(Object o) { 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 (isSetBalancePlatform) { + addIfNull(nulls, JSON_PROPERTY_BALANCE_PLATFORM, this.balancePlatform); + } + if (isSetCreationDate) { + addIfNull(nulls, JSON_PROPERTY_CREATION_DATE, this.creationDate); + } + if (isSetId) { + addIfNull(nulls, JSON_PROPERTY_ID, this.id); + } + + 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 Resource given an JSON string * diff --git a/src/main/java/com/adyen/model/transactionwebhooks/ResourceReference.java b/src/main/java/com/adyen/model/java/ResourceReference.java similarity index 67% rename from src/main/java/com/adyen/model/transactionwebhooks/ResourceReference.java rename to src/main/java/com/adyen/model/java/ResourceReference.java index da124b0c4..3ac9e51dc 100644 --- a/src/main/java/com/adyen/model/transactionwebhooks/ResourceReference.java +++ b/src/main/java/com/adyen/model/java/ResourceReference.java @@ -9,8 +9,10 @@ * Do not edit the class manually. */ -package com.adyen.model.transactionwebhooks; +package com.adyen.model.java; +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; @@ -27,12 +29,27 @@ public class ResourceReference { public static final String JSON_PROPERTY_DESCRIPTION = "description"; private String description; + /** Mark when the attribute has been explicitly set. */ + private boolean isSetDescription = false; + public static final String JSON_PROPERTY_ID = "id"; private String id; + /** Mark when the attribute has been explicitly set. */ + private boolean isSetId = false; + public static final String JSON_PROPERTY_REFERENCE = "reference"; private String reference; + /** Mark when the attribute has been explicitly set. */ + private boolean isSetReference = false; + + /** + * Sets whether attributes with null values should be explicitly included in the JSON payload. + * Default is false. + */ + @JsonIgnore private boolean includeNullValues = false; + public ResourceReference() {} /** @@ -43,6 +60,7 @@ public ResourceReference() {} */ public ResourceReference description(String description) { this.description = description; + isSetDescription = true; // mark as set return this; } @@ -66,6 +84,7 @@ public String getDescription() { @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setDescription(String description) { this.description = description; + isSetDescription = true; // mark as set } /** @@ -76,6 +95,7 @@ public void setDescription(String description) { */ public ResourceReference id(String id) { this.id = id; + isSetId = true; // mark as set return this; } @@ -99,6 +119,7 @@ public String getId() { @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setId(String id) { this.id = id; + isSetId = true; // mark as set } /** @@ -109,6 +130,7 @@ public void setId(String id) { */ public ResourceReference reference(String reference) { this.reference = reference; + isSetReference = true; // mark as set return this; } @@ -132,6 +154,27 @@ public String getReference() { @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setReference(String reference) { this.reference = reference; + isSetReference = true; // mark as set + } + + /** + * Configures whether null values are explicitly serialized in the JSON payload. Default is false. + */ + public ResourceReference 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 ResourceReference object is equal to o. */ @@ -145,13 +188,16 @@ public boolean equals(Object o) { } ResourceReference resourceReference = (ResourceReference) o; return Objects.equals(this.description, resourceReference.description) + && Objects.equals(this.isSetDescription, resourceReference.isSetDescription) && Objects.equals(this.id, resourceReference.id) - && Objects.equals(this.reference, resourceReference.reference); + && Objects.equals(this.isSetId, resourceReference.isSetId) + && Objects.equals(this.reference, resourceReference.reference) + && Objects.equals(this.isSetReference, resourceReference.isSetReference); } @Override public int hashCode() { - return Objects.hash(description, id, reference); + return Objects.hash(description, isSetDescription, id, isSetId, reference, isSetReference); } @Override @@ -175,6 +221,36 @@ private String toIndentedString(Object o) { 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 (isSetDescription) { + addIfNull(nulls, JSON_PROPERTY_DESCRIPTION, this.description); + } + if (isSetId) { + addIfNull(nulls, JSON_PROPERTY_ID, this.id); + } + if (isSetReference) { + addIfNull(nulls, JSON_PROPERTY_REFERENCE, this.reference); + } + + 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 ResourceReference given an JSON string * diff --git a/src/main/java/com/adyen/model/transactionwebhooks/ThreeDSecure.java b/src/main/java/com/adyen/model/java/ThreeDSecure.java similarity index 63% rename from src/main/java/com/adyen/model/transactionwebhooks/ThreeDSecure.java rename to src/main/java/com/adyen/model/java/ThreeDSecure.java index 1754e5771..a041eb25d 100644 --- a/src/main/java/com/adyen/model/transactionwebhooks/ThreeDSecure.java +++ b/src/main/java/com/adyen/model/java/ThreeDSecure.java @@ -9,8 +9,10 @@ * Do not edit the class manually. */ -package com.adyen.model.transactionwebhooks; +package com.adyen.model.java; +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; @@ -23,6 +25,15 @@ public class ThreeDSecure { public static final String JSON_PROPERTY_ACS_TRANSACTION_ID = "acsTransactionId"; private String acsTransactionId; + /** Mark when the attribute has been explicitly set. */ + private boolean isSetAcsTransactionId = false; + + /** + * Sets whether attributes with null values should be explicitly included in the JSON payload. + * Default is false. + */ + @JsonIgnore private boolean includeNullValues = false; + public ThreeDSecure() {} /** @@ -33,6 +44,7 @@ public ThreeDSecure() {} */ public ThreeDSecure acsTransactionId(String acsTransactionId) { this.acsTransactionId = acsTransactionId; + isSetAcsTransactionId = true; // mark as set return this; } @@ -56,6 +68,27 @@ public String getAcsTransactionId() { @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setAcsTransactionId(String acsTransactionId) { this.acsTransactionId = acsTransactionId; + isSetAcsTransactionId = true; // mark as set + } + + /** + * Configures whether null values are explicitly serialized in the JSON payload. Default is false. + */ + public ThreeDSecure 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 ThreeDSecure object is equal to o. */ @@ -68,12 +101,13 @@ public boolean equals(Object o) { return false; } ThreeDSecure threeDSecure = (ThreeDSecure) o; - return Objects.equals(this.acsTransactionId, threeDSecure.acsTransactionId); + return Objects.equals(this.acsTransactionId, threeDSecure.acsTransactionId) + && Objects.equals(this.isSetAcsTransactionId, threeDSecure.isSetAcsTransactionId); } @Override public int hashCode() { - return Objects.hash(acsTransactionId); + return Objects.hash(acsTransactionId, isSetAcsTransactionId); } @Override @@ -95,6 +129,30 @@ private String toIndentedString(Object o) { 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 (isSetAcsTransactionId) { + addIfNull(nulls, JSON_PROPERTY_ACS_TRANSACTION_ID, this.acsTransactionId); + } + + 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 ThreeDSecure given an JSON string * diff --git a/src/main/java/com/adyen/model/transactionwebhooks/Transaction.java b/src/main/java/com/adyen/model/java/Transaction.java similarity index 77% rename from src/main/java/com/adyen/model/transactionwebhooks/Transaction.java rename to src/main/java/com/adyen/model/java/Transaction.java index e583a0cdc..1ed6f761c 100644 --- a/src/main/java/com/adyen/model/transactionwebhooks/Transaction.java +++ b/src/main/java/com/adyen/model/java/Transaction.java @@ -9,9 +9,11 @@ * Do not edit the class manually. */ -package com.adyen.model.transactionwebhooks; +package com.adyen.model.java; +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; @@ -42,33 +44,63 @@ public class Transaction { public static final String JSON_PROPERTY_ACCOUNT_HOLDER = "accountHolder"; private ResourceReference accountHolder; + /** Mark when the attribute has been explicitly set. */ + private boolean isSetAccountHolder = false; + public static final String JSON_PROPERTY_AMOUNT = "amount"; private Amount amount; + /** Mark when the attribute has been explicitly set. */ + private boolean isSetAmount = false; + public static final String JSON_PROPERTY_BALANCE_ACCOUNT = "balanceAccount"; private ResourceReference balanceAccount; + /** Mark when the attribute has been explicitly set. */ + private boolean isSetBalanceAccount = false; + public static final String JSON_PROPERTY_BALANCE_PLATFORM = "balancePlatform"; private String balancePlatform; + /** Mark when the attribute has been explicitly set. */ + private boolean isSetBalancePlatform = false; + public static final String JSON_PROPERTY_BOOKING_DATE = "bookingDate"; private OffsetDateTime bookingDate; + /** Mark when the attribute has been explicitly set. */ + private boolean isSetBookingDate = false; + public static final String JSON_PROPERTY_CREATION_DATE = "creationDate"; private OffsetDateTime creationDate; + /** Mark when the attribute has been explicitly set. */ + private boolean isSetCreationDate = false; + public static final String JSON_PROPERTY_DESCRIPTION = "description"; private String description; + /** Mark when the attribute has been explicitly set. */ + private boolean isSetDescription = false; + public static final String JSON_PROPERTY_ID = "id"; private String id; + /** Mark when the attribute has been explicitly set. */ + private boolean isSetId = false; + public static final String JSON_PROPERTY_PAYMENT_INSTRUMENT = "paymentInstrument"; private PaymentInstrument paymentInstrument; + /** Mark when the attribute has been explicitly set. */ + private boolean isSetPaymentInstrument = false; + public static final String JSON_PROPERTY_REFERENCE_FOR_BENEFICIARY = "referenceForBeneficiary"; private String referenceForBeneficiary; + /** Mark when the attribute has been explicitly set. */ + private boolean isSetReferenceForBeneficiary = false; + /** * The status of the transaction. Possible values: * **pending**: The transaction is still * pending. * **booked**: The transaction has been booked to the balance account. @@ -116,12 +148,27 @@ public static StatusEnum fromValue(String value) { public static final String JSON_PROPERTY_STATUS = "status"; private StatusEnum status; + /** Mark when the attribute has been explicitly set. */ + private boolean isSetStatus = false; + public static final String JSON_PROPERTY_TRANSFER = "transfer"; private TransferView transfer; + /** Mark when the attribute has been explicitly set. */ + private boolean isSetTransfer = false; + public static final String JSON_PROPERTY_VALUE_DATE = "valueDate"; private OffsetDateTime valueDate; + /** Mark when the attribute has been explicitly set. */ + private boolean isSetValueDate = false; + + /** + * Sets whether attributes with null values should be explicitly included in the JSON payload. + * Default is false. + */ + @JsonIgnore private boolean includeNullValues = false; + public Transaction() {} /** @@ -132,6 +179,7 @@ public Transaction() {} */ public Transaction accountHolder(ResourceReference accountHolder) { this.accountHolder = accountHolder; + isSetAccountHolder = true; // mark as set return this; } @@ -155,6 +203,7 @@ public ResourceReference getAccountHolder() { @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setAccountHolder(ResourceReference accountHolder) { this.accountHolder = accountHolder; + isSetAccountHolder = true; // mark as set } /** @@ -165,6 +214,7 @@ public void setAccountHolder(ResourceReference accountHolder) { */ public Transaction amount(Amount amount) { this.amount = amount; + isSetAmount = true; // mark as set return this; } @@ -188,6 +238,7 @@ public Amount getAmount() { @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setAmount(Amount amount) { this.amount = amount; + isSetAmount = true; // mark as set } /** @@ -198,6 +249,7 @@ public void setAmount(Amount amount) { */ public Transaction balanceAccount(ResourceReference balanceAccount) { this.balanceAccount = balanceAccount; + isSetBalanceAccount = true; // mark as set return this; } @@ -221,6 +273,7 @@ public ResourceReference getBalanceAccount() { @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setBalanceAccount(ResourceReference balanceAccount) { this.balanceAccount = balanceAccount; + isSetBalanceAccount = true; // mark as set } /** @@ -231,6 +284,7 @@ public void setBalanceAccount(ResourceReference balanceAccount) { */ public Transaction balancePlatform(String balancePlatform) { this.balancePlatform = balancePlatform; + isSetBalancePlatform = true; // mark as set return this; } @@ -254,6 +308,7 @@ public String getBalancePlatform() { @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setBalancePlatform(String balancePlatform) { this.balancePlatform = balancePlatform; + isSetBalancePlatform = true; // mark as set } /** @@ -264,6 +319,7 @@ public void setBalancePlatform(String balancePlatform) { */ public Transaction bookingDate(OffsetDateTime bookingDate) { this.bookingDate = bookingDate; + isSetBookingDate = true; // mark as set return this; } @@ -287,6 +343,7 @@ public OffsetDateTime getBookingDate() { @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setBookingDate(OffsetDateTime bookingDate) { this.bookingDate = bookingDate; + isSetBookingDate = true; // mark as set } /** @@ -299,6 +356,7 @@ public void setBookingDate(OffsetDateTime bookingDate) { */ public Transaction creationDate(OffsetDateTime creationDate) { this.creationDate = creationDate; + isSetCreationDate = true; // mark as set return this; } @@ -326,6 +384,7 @@ public OffsetDateTime getCreationDate() { @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setCreationDate(OffsetDateTime creationDate) { this.creationDate = creationDate; + isSetCreationDate = true; // mark as set } /** @@ -336,6 +395,7 @@ public void setCreationDate(OffsetDateTime creationDate) { */ public Transaction description(String description) { this.description = description; + isSetDescription = true; // mark as set return this; } @@ -359,6 +419,7 @@ public String getDescription() { @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setDescription(String description) { this.description = description; + isSetDescription = true; // mark as set } /** @@ -369,6 +430,7 @@ public void setDescription(String description) { */ public Transaction id(String id) { this.id = id; + isSetId = true; // mark as set return this; } @@ -392,6 +454,7 @@ public String getId() { @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setId(String id) { this.id = id; + isSetId = true; // mark as set } /** @@ -402,6 +465,7 @@ public void setId(String id) { */ public Transaction paymentInstrument(PaymentInstrument paymentInstrument) { this.paymentInstrument = paymentInstrument; + isSetPaymentInstrument = true; // mark as set return this; } @@ -425,6 +489,7 @@ public PaymentInstrument getPaymentInstrument() { @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setPaymentInstrument(PaymentInstrument paymentInstrument) { this.paymentInstrument = paymentInstrument; + isSetPaymentInstrument = true; // mark as set } /** @@ -444,6 +509,7 @@ public void setPaymentInstrument(PaymentInstrument paymentInstrument) { */ public Transaction referenceForBeneficiary(String referenceForBeneficiary) { this.referenceForBeneficiary = referenceForBeneficiary; + isSetReferenceForBeneficiary = true; // mark as set return this; } @@ -485,6 +551,7 @@ public String getReferenceForBeneficiary() { @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setReferenceForBeneficiary(String referenceForBeneficiary) { this.referenceForBeneficiary = referenceForBeneficiary; + isSetReferenceForBeneficiary = true; // mark as set } /** @@ -497,6 +564,7 @@ public void setReferenceForBeneficiary(String referenceForBeneficiary) { */ public Transaction status(StatusEnum status) { this.status = status; + isSetStatus = true; // mark as set return this; } @@ -524,6 +592,7 @@ public StatusEnum getStatus() { @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setStatus(StatusEnum status) { this.status = status; + isSetStatus = true; // mark as set } /** @@ -534,6 +603,7 @@ public void setStatus(StatusEnum status) { */ public Transaction transfer(TransferView transfer) { this.transfer = transfer; + isSetTransfer = true; // mark as set return this; } @@ -557,6 +627,7 @@ public TransferView getTransfer() { @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setTransfer(TransferView transfer) { this.transfer = transfer; + isSetTransfer = true; // mark as set } /** @@ -567,6 +638,7 @@ public void setTransfer(TransferView transfer) { */ public Transaction valueDate(OffsetDateTime valueDate) { this.valueDate = valueDate; + isSetValueDate = true; // mark as set return this; } @@ -590,6 +662,27 @@ public OffsetDateTime getValueDate() { @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setValueDate(OffsetDateTime valueDate) { this.valueDate = valueDate; + isSetValueDate = true; // mark as set + } + + /** + * Configures whether null values are explicitly serialized in the JSON payload. Default is false. + */ + public Transaction 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 Transaction object is equal to o. */ @@ -603,36 +696,63 @@ public boolean equals(Object o) { } Transaction transaction = (Transaction) o; return Objects.equals(this.accountHolder, transaction.accountHolder) + && Objects.equals(this.isSetAccountHolder, transaction.isSetAccountHolder) && Objects.equals(this.amount, transaction.amount) + && Objects.equals(this.isSetAmount, transaction.isSetAmount) && Objects.equals(this.balanceAccount, transaction.balanceAccount) + && Objects.equals(this.isSetBalanceAccount, transaction.isSetBalanceAccount) && Objects.equals(this.balancePlatform, transaction.balancePlatform) + && Objects.equals(this.isSetBalancePlatform, transaction.isSetBalancePlatform) && Objects.equals(this.bookingDate, transaction.bookingDate) + && Objects.equals(this.isSetBookingDate, transaction.isSetBookingDate) && Objects.equals(this.creationDate, transaction.creationDate) + && Objects.equals(this.isSetCreationDate, transaction.isSetCreationDate) && Objects.equals(this.description, transaction.description) + && Objects.equals(this.isSetDescription, transaction.isSetDescription) && Objects.equals(this.id, transaction.id) + && Objects.equals(this.isSetId, transaction.isSetId) && Objects.equals(this.paymentInstrument, transaction.paymentInstrument) + && Objects.equals(this.isSetPaymentInstrument, transaction.isSetPaymentInstrument) && Objects.equals(this.referenceForBeneficiary, transaction.referenceForBeneficiary) + && Objects.equals( + this.isSetReferenceForBeneficiary, transaction.isSetReferenceForBeneficiary) && Objects.equals(this.status, transaction.status) + && Objects.equals(this.isSetStatus, transaction.isSetStatus) && Objects.equals(this.transfer, transaction.transfer) - && Objects.equals(this.valueDate, transaction.valueDate); + && Objects.equals(this.isSetTransfer, transaction.isSetTransfer) + && Objects.equals(this.valueDate, transaction.valueDate) + && Objects.equals(this.isSetValueDate, transaction.isSetValueDate); } @Override public int hashCode() { return Objects.hash( accountHolder, + isSetAccountHolder, amount, + isSetAmount, balanceAccount, + isSetBalanceAccount, balancePlatform, + isSetBalancePlatform, bookingDate, + isSetBookingDate, creationDate, + isSetCreationDate, description, + isSetDescription, id, + isSetId, paymentInstrument, + isSetPaymentInstrument, referenceForBeneficiary, + isSetReferenceForBeneficiary, status, + isSetStatus, transfer, - valueDate); + isSetTransfer, + valueDate, + isSetValueDate); } @Override @@ -668,6 +788,66 @@ private String toIndentedString(Object o) { 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 (isSetAccountHolder) { + addIfNull(nulls, JSON_PROPERTY_ACCOUNT_HOLDER, this.accountHolder); + } + if (isSetAmount) { + addIfNull(nulls, JSON_PROPERTY_AMOUNT, this.amount); + } + if (isSetBalanceAccount) { + addIfNull(nulls, JSON_PROPERTY_BALANCE_ACCOUNT, this.balanceAccount); + } + if (isSetBalancePlatform) { + addIfNull(nulls, JSON_PROPERTY_BALANCE_PLATFORM, this.balancePlatform); + } + if (isSetBookingDate) { + addIfNull(nulls, JSON_PROPERTY_BOOKING_DATE, this.bookingDate); + } + if (isSetCreationDate) { + addIfNull(nulls, JSON_PROPERTY_CREATION_DATE, this.creationDate); + } + if (isSetDescription) { + addIfNull(nulls, JSON_PROPERTY_DESCRIPTION, this.description); + } + if (isSetId) { + addIfNull(nulls, JSON_PROPERTY_ID, this.id); + } + if (isSetPaymentInstrument) { + addIfNull(nulls, JSON_PROPERTY_PAYMENT_INSTRUMENT, this.paymentInstrument); + } + if (isSetReferenceForBeneficiary) { + addIfNull(nulls, JSON_PROPERTY_REFERENCE_FOR_BENEFICIARY, this.referenceForBeneficiary); + } + if (isSetStatus) { + addIfNull(nulls, JSON_PROPERTY_STATUS, this.status); + } + if (isSetTransfer) { + addIfNull(nulls, JSON_PROPERTY_TRANSFER, this.transfer); + } + if (isSetValueDate) { + addIfNull(nulls, JSON_PROPERTY_VALUE_DATE, this.valueDate); + } + + 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 Transaction given an JSON string * diff --git a/src/main/java/com/adyen/model/transactionwebhooks/TransactionNotificationRequestV4.java b/src/main/java/com/adyen/model/java/TransactionNotificationRequestV4.java similarity index 72% rename from src/main/java/com/adyen/model/transactionwebhooks/TransactionNotificationRequestV4.java rename to src/main/java/com/adyen/model/java/TransactionNotificationRequestV4.java index 0caf28581..f1a7e5def 100644 --- a/src/main/java/com/adyen/model/transactionwebhooks/TransactionNotificationRequestV4.java +++ b/src/main/java/com/adyen/model/java/TransactionNotificationRequestV4.java @@ -9,9 +9,11 @@ * Do not edit the class manually. */ -package com.adyen.model.transactionwebhooks; +package com.adyen.model.java; +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; @@ -33,12 +35,21 @@ public class TransactionNotificationRequestV4 { public static final String JSON_PROPERTY_DATA = "data"; private Transaction data; + /** Mark when the attribute has been explicitly set. */ + private boolean isSetData = false; + public static final String JSON_PROPERTY_ENVIRONMENT = "environment"; private String environment; + /** Mark when the attribute has been explicitly set. */ + private boolean isSetEnvironment = false; + public static final String JSON_PROPERTY_TIMESTAMP = "timestamp"; private OffsetDateTime timestamp; + /** Mark when the attribute has been explicitly set. */ + private boolean isSetTimestamp = false; + /** Type of the webhook. */ public enum TypeEnum { BALANCEPLATFORM_TRANSACTION_CREATED(String.valueOf("balancePlatform.transaction.created")); @@ -81,6 +92,15 @@ public static TypeEnum fromValue(String value) { 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 TransactionNotificationRequestV4() {} /** @@ -92,6 +112,7 @@ public TransactionNotificationRequestV4() {} */ public TransactionNotificationRequestV4 data(Transaction data) { this.data = data; + isSetData = true; // mark as set return this; } @@ -115,6 +136,7 @@ public Transaction getData() { @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setData(Transaction data) { this.data = data; + isSetData = true; // mark as set } /** @@ -127,6 +149,7 @@ public void setData(Transaction data) { */ public TransactionNotificationRequestV4 environment(String environment) { this.environment = environment; + isSetEnvironment = true; // mark as set return this; } @@ -152,6 +175,7 @@ public String getEnvironment() { @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setEnvironment(String environment) { this.environment = environment; + isSetEnvironment = true; // mark as set } /** @@ -163,6 +187,7 @@ public void setEnvironment(String environment) { */ public TransactionNotificationRequestV4 timestamp(OffsetDateTime timestamp) { this.timestamp = timestamp; + isSetTimestamp = true; // mark as set return this; } @@ -186,6 +211,7 @@ public OffsetDateTime getTimestamp() { @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setTimestamp(OffsetDateTime timestamp) { this.timestamp = timestamp; + isSetTimestamp = true; // mark as set } /** @@ -197,6 +223,7 @@ public void setTimestamp(OffsetDateTime timestamp) { */ public TransactionNotificationRequestV4 type(TypeEnum type) { this.type = type; + isSetType = true; // mark as set return this; } @@ -220,6 +247,27 @@ public TypeEnum getType() { @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 TransactionNotificationRequestV4 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 TransactionNotificationRequestV4 object is equal to o. */ @@ -234,14 +282,19 @@ public boolean equals(Object o) { TransactionNotificationRequestV4 transactionNotificationRequestV4 = (TransactionNotificationRequestV4) o; return Objects.equals(this.data, transactionNotificationRequestV4.data) + && Objects.equals(this.isSetData, transactionNotificationRequestV4.isSetData) && Objects.equals(this.environment, transactionNotificationRequestV4.environment) + && Objects.equals(this.isSetEnvironment, transactionNotificationRequestV4.isSetEnvironment) && Objects.equals(this.timestamp, transactionNotificationRequestV4.timestamp) - && Objects.equals(this.type, transactionNotificationRequestV4.type); + && Objects.equals(this.isSetTimestamp, transactionNotificationRequestV4.isSetTimestamp) + && Objects.equals(this.type, transactionNotificationRequestV4.type) + && Objects.equals(this.isSetType, transactionNotificationRequestV4.isSetType); } @Override public int hashCode() { - return Objects.hash(data, environment, timestamp, type); + return Objects.hash( + data, isSetData, environment, isSetEnvironment, timestamp, isSetTimestamp, type, isSetType); } @Override @@ -266,6 +319,39 @@ private String toIndentedString(Object o) { 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 (isSetData) { + addIfNull(nulls, JSON_PROPERTY_DATA, this.data); + } + if (isSetEnvironment) { + addIfNull(nulls, JSON_PROPERTY_ENVIRONMENT, this.environment); + } + if (isSetTimestamp) { + addIfNull(nulls, JSON_PROPERTY_TIMESTAMP, this.timestamp); + } + 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 TransactionNotificationRequestV4 given an JSON string * diff --git a/src/main/java/com/adyen/model/transactionwebhooks/TransferNotificationValidationFact.java b/src/main/java/com/adyen/model/java/TransferNotificationValidationFact.java similarity index 67% rename from src/main/java/com/adyen/model/transactionwebhooks/TransferNotificationValidationFact.java rename to src/main/java/com/adyen/model/java/TransferNotificationValidationFact.java index f12636eac..8df196849 100644 --- a/src/main/java/com/adyen/model/transactionwebhooks/TransferNotificationValidationFact.java +++ b/src/main/java/com/adyen/model/java/TransferNotificationValidationFact.java @@ -9,8 +9,10 @@ * Do not edit the class manually. */ -package com.adyen.model.transactionwebhooks; +package com.adyen.model.java; +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; @@ -26,9 +28,21 @@ public class TransferNotificationValidationFact { public static final String JSON_PROPERTY_RESULT = "result"; private String result; + /** Mark when the attribute has been explicitly set. */ + private boolean isSetResult = false; + public static final String JSON_PROPERTY_TYPE = "type"; private String 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 TransferNotificationValidationFact() {} /** @@ -40,6 +54,7 @@ public TransferNotificationValidationFact() {} */ public TransferNotificationValidationFact result(String result) { this.result = result; + isSetResult = true; // mark as set return this; } @@ -63,6 +78,7 @@ public String getResult() { @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setResult(String result) { this.result = result; + isSetResult = true; // mark as set } /** @@ -74,6 +90,7 @@ public void setResult(String result) { */ public TransferNotificationValidationFact type(String type) { this.type = type; + isSetType = true; // mark as set return this; } @@ -97,6 +114,27 @@ public String getType() { @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setType(String type) { this.type = type; + isSetType = true; // mark as set + } + + /** + * Configures whether null values are explicitly serialized in the JSON payload. Default is false. + */ + public TransferNotificationValidationFact 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 TransferNotificationValidationFact object is equal to o. */ @@ -111,12 +149,14 @@ public boolean equals(Object o) { TransferNotificationValidationFact transferNotificationValidationFact = (TransferNotificationValidationFact) o; return Objects.equals(this.result, transferNotificationValidationFact.result) - && Objects.equals(this.type, transferNotificationValidationFact.type); + && Objects.equals(this.isSetResult, transferNotificationValidationFact.isSetResult) + && Objects.equals(this.type, transferNotificationValidationFact.type) + && Objects.equals(this.isSetType, transferNotificationValidationFact.isSetType); } @Override public int hashCode() { - return Objects.hash(result, type); + return Objects.hash(result, isSetResult, type, isSetType); } @Override @@ -139,6 +179,33 @@ private String toIndentedString(Object o) { 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 (isSetResult) { + addIfNull(nulls, JSON_PROPERTY_RESULT, this.result); + } + 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 TransferNotificationValidationFact given an JSON string * diff --git a/src/main/java/com/adyen/model/transactionwebhooks/TransferView.java b/src/main/java/com/adyen/model/java/TransferView.java similarity index 71% rename from src/main/java/com/adyen/model/transactionwebhooks/TransferView.java rename to src/main/java/com/adyen/model/java/TransferView.java index dfb76fec0..efe0c4d07 100644 --- a/src/main/java/com/adyen/model/transactionwebhooks/TransferView.java +++ b/src/main/java/com/adyen/model/java/TransferView.java @@ -9,8 +9,10 @@ * Do not edit the class manually. */ -package com.adyen.model.transactionwebhooks; +package com.adyen.model.java; +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; @@ -27,12 +29,27 @@ public class TransferView { public static final String JSON_PROPERTY_CATEGORY_DATA = "categoryData"; private TransferViewCategoryData categoryData; + /** Mark when the attribute has been explicitly set. */ + private boolean isSetCategoryData = false; + public static final String JSON_PROPERTY_ID = "id"; private String id; + /** Mark when the attribute has been explicitly set. */ + private boolean isSetId = false; + public static final String JSON_PROPERTY_REFERENCE = "reference"; private String reference; + /** Mark when the attribute has been explicitly set. */ + private boolean isSetReference = false; + + /** + * Sets whether attributes with null values should be explicitly included in the JSON payload. + * Default is false. + */ + @JsonIgnore private boolean includeNullValues = false; + public TransferView() {} /** @@ -43,6 +60,7 @@ public TransferView() {} */ public TransferView categoryData(TransferViewCategoryData categoryData) { this.categoryData = categoryData; + isSetCategoryData = true; // mark as set return this; } @@ -66,6 +84,7 @@ public TransferViewCategoryData getCategoryData() { @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setCategoryData(TransferViewCategoryData categoryData) { this.categoryData = categoryData; + isSetCategoryData = true; // mark as set } /** @@ -76,6 +95,7 @@ public void setCategoryData(TransferViewCategoryData categoryData) { */ public TransferView id(String id) { this.id = id; + isSetId = true; // mark as set return this; } @@ -99,6 +119,7 @@ public String getId() { @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setId(String id) { this.id = id; + isSetId = true; // mark as set } /** @@ -115,6 +136,7 @@ public void setId(String id) { */ public TransferView reference(String reference) { this.reference = reference; + isSetReference = true; // mark as set return this; } @@ -150,6 +172,27 @@ public String getReference() { @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setReference(String reference) { this.reference = reference; + isSetReference = true; // mark as set + } + + /** + * Configures whether null values are explicitly serialized in the JSON payload. Default is false. + */ + public TransferView 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 TransferView object is equal to o. */ @@ -163,13 +206,16 @@ public boolean equals(Object o) { } TransferView transferView = (TransferView) o; return Objects.equals(this.categoryData, transferView.categoryData) + && Objects.equals(this.isSetCategoryData, transferView.isSetCategoryData) && Objects.equals(this.id, transferView.id) - && Objects.equals(this.reference, transferView.reference); + && Objects.equals(this.isSetId, transferView.isSetId) + && Objects.equals(this.reference, transferView.reference) + && Objects.equals(this.isSetReference, transferView.isSetReference); } @Override public int hashCode() { - return Objects.hash(categoryData, id, reference); + return Objects.hash(categoryData, isSetCategoryData, id, isSetId, reference, isSetReference); } @Override @@ -193,6 +239,36 @@ private String toIndentedString(Object o) { 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 (isSetCategoryData) { + addIfNull(nulls, JSON_PROPERTY_CATEGORY_DATA, this.categoryData); + } + if (isSetId) { + addIfNull(nulls, JSON_PROPERTY_ID, this.id); + } + if (isSetReference) { + addIfNull(nulls, JSON_PROPERTY_REFERENCE, this.reference); + } + + 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 TransferView given an JSON string * diff --git a/src/main/java/com/adyen/model/transactionwebhooks/TransferViewCategoryData.java b/src/main/java/com/adyen/model/java/TransferViewCategoryData.java similarity index 99% rename from src/main/java/com/adyen/model/transactionwebhooks/TransferViewCategoryData.java rename to src/main/java/com/adyen/model/java/TransferViewCategoryData.java index 5773a5ecb..667c17074 100644 --- a/src/main/java/com/adyen/model/transactionwebhooks/TransferViewCategoryData.java +++ b/src/main/java/com/adyen/model/java/TransferViewCategoryData.java @@ -9,7 +9,7 @@ * Do not edit the class manually. */ -package com.adyen.model.transactionwebhooks; +package com.adyen.model.java; import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.core.JsonParser; diff --git a/src/main/java/com/adyen/model/transactionwebhooks/JSON.java b/src/main/java/com/adyen/model/transactionwebhooks/JSON.java index 2dd25328b..abe09e65a 100644 --- a/src/main/java/com/adyen/model/transactionwebhooks/JSON.java +++ b/src/main/java/com/adyen/model/transactionwebhooks/JSON.java @@ -1,4 +1,4 @@ -package com.adyen.model.transactionwebhooks; +package com.adyen.model.java; import com.adyen.serializer.ByteArrayDeserializer; import com.adyen.serializer.ByteArraySerializer; diff --git a/src/main/java/com/adyen/model/transactionwebhooks/TransactionWebhooksHandler.java b/src/main/java/com/adyen/model/transactionwebhooks/TransactionWebhooksHandler.java deleted file mode 100644 index 082072fa5..000000000 --- a/src/main/java/com/adyen/model/transactionwebhooks/TransactionWebhooksHandler.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Transaction webhooks - * - * The version of the OpenAPI document: 4 - * - * - * 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.transactionwebhooks; - -import java.util.Optional; -import java.util.logging.Logger; - -/** - * Handler for processing TransactionWebhooks. - * - *

This class provides functionality to deserialize the payload of TransactionWebhooks events. - */ -public class TransactionWebhooksHandler { - - private static final Logger LOG = Logger.getLogger(TransactionWebhooksHandler.class.getName()); - - private final String payload; - - /** - * Constructs a new handler for the given webhook payload - * - * @param payload the raw JSON payload from the webhook - */ - public TransactionWebhooksHandler(String payload) { - this.payload = payload; - } - - /** - * Attempts to deserialize the webhook payload into a TransactionNotificationRequestV4 - * - * @return an Optional containing the deserialized object, or empty if deserialization fails - */ - public Optional getTransactionNotificationRequestV4() { - - var optionalTransactionNotificationRequestV4 = - getOptionalField(TransactionNotificationRequestV4.class); - - if (optionalTransactionNotificationRequestV4.isPresent()) { - // verify event type - for (var value : TransactionNotificationRequestV4.TypeEnum.values()) { - if (value.equals(optionalTransactionNotificationRequestV4.get().getType())) { - // found matching event type - return optionalTransactionNotificationRequestV4; - } - } - } - - return Optional.empty(); - } - - /** - * Deserializes the payload into the specified class type. - * - * @param clazz the class to deserialize into - * @param the type of the class - * @return an Optional containing the deserialized object, or empty if an error occurs - */ - private Optional getOptionalField(Class clazz) { - try { - T val = JSON.getMapper().readValue(payload, clazz); - return Optional.ofNullable(val); - } catch (Exception e) { - // an error has occurred during deserialization (object not found, deserialization error) - LOG.warning("Object not found or unexpected error trying to access: " + clazz.getName()); - LOG.warning("Deserialization error: " + e.getMessage()); - return Optional.empty(); - } - } -}