From 1d142d345a6f1b43715cf249e85a3bc02b2d2e2c Mon Sep 17 00:00:00 2001 From: AdyenAutomationBot <38424300+AdyenAutomationBot@users.noreply.github.com> Date: Mon, 9 Mar 2026 13:31:53 +0000 Subject: [PATCH] [acswebhooks] Automated update from Adyen/adyen-openapi@37c03ec --- .../model/acswebhooks/AcsWebhooksHandler.java | 100 --------- .../com/adyen/model/acswebhooks/JSON.java | 2 +- .../AbstractOpenApiSchema.java | 2 +- .../model/{acswebhooks => java}/Amount.java | 73 ++++++- .../AuthenticationDecision.java | 64 +++++- .../AuthenticationInfo.java | 206 +++++++++++++++++- .../AuthenticationNotificationData.java | 124 ++++++++++- .../AuthenticationNotificationRequest.java | 92 +++++++- .../BalancePlatformNotificationResponse.java | 66 +++++- .../{acswebhooks => java}/ChallengeInfo.java | 121 +++++++++- .../model/{acswebhooks => java}/Purchase.java | 83 ++++++- .../{acswebhooks => java}/PurchaseInfo.java | 83 ++++++- .../RelayedAuthenticationRequest.java | 134 +++++++++++- .../RelayedAuthenticationResponse.java | 66 +++++- .../model/{acswebhooks => java}/Resource.java | 83 ++++++- .../{acswebhooks => java}/ServiceError.java | 110 +++++++++- 16 files changed, 1268 insertions(+), 141 deletions(-) delete mode 100644 src/main/java/com/adyen/model/acswebhooks/AcsWebhooksHandler.java rename src/main/java/com/adyen/model/{acswebhooks => java}/AbstractOpenApiSchema.java (99%) rename src/main/java/com/adyen/model/{acswebhooks => java}/Amount.java (69%) rename src/main/java/com/adyen/model/{acswebhooks => java}/AuthenticationDecision.java (75%) rename src/main/java/com/adyen/model/{acswebhooks => java}/AuthenticationInfo.java (85%) rename src/main/java/com/adyen/model/{acswebhooks => java}/AuthenticationNotificationData.java (73%) rename src/main/java/com/adyen/model/{acswebhooks => java}/AuthenticationNotificationRequest.java (73%) rename src/main/java/com/adyen/model/{acswebhooks => java}/BalancePlatformNotificationResponse.java (67%) rename src/main/java/com/adyen/model/{acswebhooks => java}/ChallengeInfo.java (81%) rename src/main/java/com/adyen/model/{acswebhooks => java}/Purchase.java (65%) rename src/main/java/com/adyen/model/{acswebhooks => java}/PurchaseInfo.java (66%) rename src/main/java/com/adyen/model/{acswebhooks => java}/RelayedAuthenticationRequest.java (75%) rename src/main/java/com/adyen/model/{acswebhooks => java}/RelayedAuthenticationResponse.java (62%) rename src/main/java/com/adyen/model/{acswebhooks => java}/Resource.java (68%) rename src/main/java/com/adyen/model/{acswebhooks => java}/ServiceError.java (68%) diff --git a/src/main/java/com/adyen/model/acswebhooks/AcsWebhooksHandler.java b/src/main/java/com/adyen/model/acswebhooks/AcsWebhooksHandler.java deleted file mode 100644 index c716fceef..000000000 --- a/src/main/java/com/adyen/model/acswebhooks/AcsWebhooksHandler.java +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Authentication webhooks - * - * The version of the OpenAPI document: 1 - * - * - * 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.acswebhooks; - -import java.util.Optional; -import java.util.logging.Logger; - -/** - * Handler for processing AcsWebhooks. - * - *

This class provides functionality to deserialize the payload of AcsWebhooks events. - */ -public class AcsWebhooksHandler { - - private static final Logger LOG = Logger.getLogger(AcsWebhooksHandler.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 AcsWebhooksHandler(String payload) { - this.payload = payload; - } - - /** - * Attempts to deserialize the webhook payload into a AuthenticationNotificationRequest - * - * @return an Optional containing the deserialized object, or empty if deserialization fails - */ - public Optional getAuthenticationNotificationRequest() { - - var optionalAuthenticationNotificationRequest = - getOptionalField(AuthenticationNotificationRequest.class); - - if (optionalAuthenticationNotificationRequest.isPresent()) { - // verify event type - for (var value : AuthenticationNotificationRequest.TypeEnum.values()) { - if (value.equals(optionalAuthenticationNotificationRequest.get().getType())) { - // found matching event type - return optionalAuthenticationNotificationRequest; - } - } - } - - return Optional.empty(); - } - - /** - * Attempts to deserialize the webhook payload into a RelayedAuthenticationRequest - * - * @return an Optional containing the deserialized object, or empty if deserialization fails - */ - public Optional getRelayedAuthenticationRequest() { - - var optionalRelayedAuthenticationRequest = getOptionalField(RelayedAuthenticationRequest.class); - - if (optionalRelayedAuthenticationRequest.isPresent()) { - // verify event type - for (var value : RelayedAuthenticationRequest.TypeEnum.values()) { - if (value.equals(optionalRelayedAuthenticationRequest.get().getType())) { - // found matching event type - return optionalRelayedAuthenticationRequest; - } - } - } - - 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(); - } - } -} diff --git a/src/main/java/com/adyen/model/acswebhooks/JSON.java b/src/main/java/com/adyen/model/acswebhooks/JSON.java index 5b711524c..abe09e65a 100644 --- a/src/main/java/com/adyen/model/acswebhooks/JSON.java +++ b/src/main/java/com/adyen/model/acswebhooks/JSON.java @@ -1,4 +1,4 @@ -package com.adyen.model.acswebhooks; +package com.adyen.model.java; import com.adyen.serializer.ByteArrayDeserializer; import com.adyen.serializer.ByteArraySerializer; diff --git a/src/main/java/com/adyen/model/acswebhooks/AbstractOpenApiSchema.java b/src/main/java/com/adyen/model/java/AbstractOpenApiSchema.java similarity index 99% rename from src/main/java/com/adyen/model/acswebhooks/AbstractOpenApiSchema.java rename to src/main/java/com/adyen/model/java/AbstractOpenApiSchema.java index bbee8bb88..dd09da397 100644 --- a/src/main/java/com/adyen/model/acswebhooks/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.acswebhooks; +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/acswebhooks/Amount.java b/src/main/java/com/adyen/model/java/Amount.java similarity index 69% rename from src/main/java/com/adyen/model/acswebhooks/Amount.java rename to src/main/java/com/adyen/model/java/Amount.java index d732861aa..075968c5b 100644 --- a/src/main/java/com/adyen/model/acswebhooks/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.acswebhooks; +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/acswebhooks/AuthenticationDecision.java b/src/main/java/com/adyen/model/java/AuthenticationDecision.java similarity index 75% rename from src/main/java/com/adyen/model/acswebhooks/AuthenticationDecision.java rename to src/main/java/com/adyen/model/java/AuthenticationDecision.java index 78d30b6d5..e4656059a 100644 --- a/src/main/java/com/adyen/model/acswebhooks/AuthenticationDecision.java +++ b/src/main/java/com/adyen/model/java/AuthenticationDecision.java @@ -9,9 +9,11 @@ * Do not edit the class manually. */ -package com.adyen.model.acswebhooks; +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; @@ -72,6 +74,15 @@ 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; + + /** + * Sets whether attributes with null values should be explicitly included in the JSON payload. + * Default is false. + */ + @JsonIgnore private boolean includeNullValues = false; + public AuthenticationDecision() {} /** @@ -86,6 +97,7 @@ public AuthenticationDecision() {} */ public AuthenticationDecision status(StatusEnum status) { this.status = status; + isSetStatus = true; // mark as set return this; } @@ -117,6 +129,27 @@ public StatusEnum getStatus() { @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setStatus(StatusEnum status) { this.status = status; + isSetStatus = true; // mark as set + } + + /** + * Configures whether null values are explicitly serialized in the JSON payload. Default is false. + */ + public AuthenticationDecision 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 AuthenticationDecision object is equal to o. */ @@ -129,12 +162,13 @@ public boolean equals(Object o) { return false; } AuthenticationDecision authenticationDecision = (AuthenticationDecision) o; - return Objects.equals(this.status, authenticationDecision.status); + return Objects.equals(this.status, authenticationDecision.status) + && Objects.equals(this.isSetStatus, authenticationDecision.isSetStatus); } @Override public int hashCode() { - return Objects.hash(status); + return Objects.hash(status, isSetStatus); } @Override @@ -156,6 +190,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 (isSetStatus) { + addIfNull(nulls, JSON_PROPERTY_STATUS, this.status); + } + + 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 AuthenticationDecision given an JSON string * diff --git a/src/main/java/com/adyen/model/acswebhooks/AuthenticationInfo.java b/src/main/java/com/adyen/model/java/AuthenticationInfo.java similarity index 85% rename from src/main/java/com/adyen/model/acswebhooks/AuthenticationInfo.java rename to src/main/java/com/adyen/model/java/AuthenticationInfo.java index 612f7db9c..42c947bc8 100644 --- a/src/main/java/com/adyen/model/acswebhooks/AuthenticationInfo.java +++ b/src/main/java/com/adyen/model/java/AuthenticationInfo.java @@ -9,9 +9,11 @@ * Do not edit the class manually. */ -package com.adyen.model.acswebhooks; +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; @@ -44,9 +46,15 @@ public class AuthenticationInfo { public static final String JSON_PROPERTY_ACS_TRANS_ID = "acsTransId"; private String acsTransId; + /** Mark when the attribute has been explicitly set. */ + private boolean isSetAcsTransId = false; + public static final String JSON_PROPERTY_CHALLENGE = "challenge"; private ChallengeInfo challenge; + /** Mark when the attribute has been explicitly set. */ + private boolean isSetChallenge = false; + /** * Specifies a preference for receiving a challenge. Possible values: * **01**: No preference * * **02**: No challenge requested * **03**: Challenge requested (preference) * **04**: Challenge @@ -116,9 +124,15 @@ public static ChallengeIndicatorEnum fromValue(String value) { public static final String JSON_PROPERTY_CHALLENGE_INDICATOR = "challengeIndicator"; private ChallengeIndicatorEnum challengeIndicator; + /** Mark when the attribute has been explicitly set. */ + private boolean isSetChallengeIndicator = false; + public static final String JSON_PROPERTY_CREATED_AT = "createdAt"; private OffsetDateTime createdAt; + /** Mark when the attribute has been explicitly set. */ + private boolean isSetCreatedAt = false; + /** * Indicates the type of channel interface being used to initiate the transaction. Possible * values: * **app** * **browser** * **3DSRequestorInitiated** (initiated by a merchant when the @@ -169,9 +183,15 @@ public static DeviceChannelEnum fromValue(String value) { public static final String JSON_PROPERTY_DEVICE_CHANNEL = "deviceChannel"; private DeviceChannelEnum deviceChannel; + /** Mark when the attribute has been explicitly set. */ + private boolean isSetDeviceChannel = false; + public static final String JSON_PROPERTY_DS_TRANS_I_D = "dsTransID"; private String dsTransID; + /** Mark when the attribute has been explicitly set. */ + private boolean isSetDsTransID = false; + /** * Indicates the exemption type that was applied to the authentication by the issuer, if exemption * applied. Possible values: * **lowValue** * **secureCorporate** * **trustedBeneficiary** * @@ -231,9 +251,15 @@ public static ExemptionIndicatorEnum fromValue(String value) { public static final String JSON_PROPERTY_EXEMPTION_INDICATOR = "exemptionIndicator"; private ExemptionIndicatorEnum exemptionIndicator; + /** Mark when the attribute has been explicitly set. */ + private boolean isSetExemptionIndicator = false; + public static final String JSON_PROPERTY_IN_P_S_D2_SCOPE = "inPSD2Scope"; private Boolean inPSD2Scope; + /** Mark when the attribute has been explicitly set. */ + private boolean isSetInPSD2Scope = false; + /** * Identifies the category of the message for a specific use case. Possible values: * **payment** * * **nonPayment** @@ -281,15 +307,27 @@ public static MessageCategoryEnum fromValue(String value) { public static final String JSON_PROPERTY_MESSAGE_CATEGORY = "messageCategory"; private MessageCategoryEnum messageCategory; + /** Mark when the attribute has been explicitly set. */ + private boolean isSetMessageCategory = false; + public static final String JSON_PROPERTY_MESSAGE_VERSION = "messageVersion"; private String messageVersion; + /** Mark when the attribute has been explicitly set. */ + private boolean isSetMessageVersion = false; + public static final String JSON_PROPERTY_RISK_SCORE = "riskScore"; private Integer riskScore; + /** Mark when the attribute has been explicitly set. */ + private boolean isSetRiskScore = false; + public static final String JSON_PROPERTY_THREE_D_S_SERVER_TRANS_I_D = "threeDSServerTransID"; private String threeDSServerTransID; + /** Mark when the attribute has been explicitly set. */ + private boolean isSetThreeDSServerTransID = false; + /** * The `transStatus` value as defined in the 3D Secure 2 specification. Possible values: * * **Y**: Authentication / Account verification successful. * **N**: Not Authenticated / Account @@ -346,6 +384,9 @@ public static TransStatusEnum fromValue(String value) { public static final String JSON_PROPERTY_TRANS_STATUS = "transStatus"; private TransStatusEnum transStatus; + /** Mark when the attribute has been explicitly set. */ + private boolean isSetTransStatus = false; + /** * Provides information on why the `transStatus` field has the specified value. For * possible values, refer to [our @@ -460,6 +501,9 @@ public static TransStatusReasonEnum fromValue(String value) { public static final String JSON_PROPERTY_TRANS_STATUS_REASON = "transStatusReason"; private TransStatusReasonEnum transStatusReason; + /** Mark when the attribute has been explicitly set. */ + private boolean isSetTransStatusReason = false; + /** The type of authentication performed. Possible values: * **frictionless** * **challenge** */ public enum TypeEnum { FRICTIONLESS(String.valueOf("frictionless")), @@ -504,6 +548,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 AuthenticationInfo() {} /** @@ -516,6 +569,7 @@ public AuthenticationInfo() {} */ public AuthenticationInfo acsTransId(String acsTransId) { this.acsTransId = acsTransId; + isSetAcsTransId = true; // mark as set return this; } @@ -543,6 +597,7 @@ public String getAcsTransId() { @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setAcsTransId(String acsTransId) { this.acsTransId = acsTransId; + isSetAcsTransId = true; // mark as set } /** @@ -553,6 +608,7 @@ public void setAcsTransId(String acsTransId) { */ public AuthenticationInfo challenge(ChallengeInfo challenge) { this.challenge = challenge; + isSetChallenge = true; // mark as set return this; } @@ -576,6 +632,7 @@ public ChallengeInfo getChallenge() { @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setChallenge(ChallengeInfo challenge) { this.challenge = challenge; + isSetChallenge = true; // mark as set } /** @@ -600,6 +657,7 @@ public void setChallenge(ChallengeInfo challenge) { */ public AuthenticationInfo challengeIndicator(ChallengeIndicatorEnum challengeIndicator) { this.challengeIndicator = challengeIndicator; + isSetChallengeIndicator = true; // mark as set return this; } @@ -651,6 +709,7 @@ public ChallengeIndicatorEnum getChallengeIndicator() { @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setChallengeIndicator(ChallengeIndicatorEnum challengeIndicator) { this.challengeIndicator = challengeIndicator; + isSetChallengeIndicator = true; // mark as set } /** @@ -665,6 +724,7 @@ public void setChallengeIndicator(ChallengeIndicatorEnum challengeIndicator) { */ public AuthenticationInfo createdAt(OffsetDateTime createdAt) { this.createdAt = createdAt; + isSetCreatedAt = true; // mark as set return this; } @@ -696,6 +756,7 @@ public OffsetDateTime getCreatedAt() { @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setCreatedAt(OffsetDateTime createdAt) { this.createdAt = createdAt; + isSetCreatedAt = true; // mark as set } /** @@ -710,6 +771,7 @@ public void setCreatedAt(OffsetDateTime createdAt) { */ public AuthenticationInfo deviceChannel(DeviceChannelEnum deviceChannel) { this.deviceChannel = deviceChannel; + isSetDeviceChannel = true; // mark as set return this; } @@ -741,6 +803,7 @@ public DeviceChannelEnum getDeviceChannel() { @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setDeviceChannel(DeviceChannelEnum deviceChannel) { this.deviceChannel = deviceChannel; + isSetDeviceChannel = true; // mark as set } /** @@ -753,6 +816,7 @@ public void setDeviceChannel(DeviceChannelEnum deviceChannel) { */ public AuthenticationInfo dsTransID(String dsTransID) { this.dsTransID = dsTransID; + isSetDsTransID = true; // mark as set return this; } @@ -780,6 +844,7 @@ public String getDsTransID() { @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setDsTransID(String dsTransID) { this.dsTransID = dsTransID; + isSetDsTransID = true; // mark as set } /** @@ -796,6 +861,7 @@ public void setDsTransID(String dsTransID) { */ public AuthenticationInfo exemptionIndicator(ExemptionIndicatorEnum exemptionIndicator) { this.exemptionIndicator = exemptionIndicator; + isSetExemptionIndicator = true; // mark as set return this; } @@ -831,6 +897,7 @@ public ExemptionIndicatorEnum getExemptionIndicator() { @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setExemptionIndicator(ExemptionIndicatorEnum exemptionIndicator) { this.exemptionIndicator = exemptionIndicator; + isSetExemptionIndicator = true; // mark as set } /** @@ -841,6 +908,7 @@ public void setExemptionIndicator(ExemptionIndicatorEnum exemptionIndicator) { */ public AuthenticationInfo inPSD2Scope(Boolean inPSD2Scope) { this.inPSD2Scope = inPSD2Scope; + isSetInPSD2Scope = true; // mark as set return this; } @@ -864,6 +932,7 @@ public Boolean getInPSD2Scope() { @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setInPSD2Scope(Boolean inPSD2Scope) { this.inPSD2Scope = inPSD2Scope; + isSetInPSD2Scope = true; // mark as set } /** @@ -876,6 +945,7 @@ public void setInPSD2Scope(Boolean inPSD2Scope) { */ public AuthenticationInfo messageCategory(MessageCategoryEnum messageCategory) { this.messageCategory = messageCategory; + isSetMessageCategory = true; // mark as set return this; } @@ -903,6 +973,7 @@ public MessageCategoryEnum getMessageCategory() { @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setMessageCategory(MessageCategoryEnum messageCategory) { this.messageCategory = messageCategory; + isSetMessageCategory = true; // mark as set } /** @@ -914,6 +985,7 @@ public void setMessageCategory(MessageCategoryEnum messageCategory) { */ public AuthenticationInfo messageVersion(String messageVersion) { this.messageVersion = messageVersion; + isSetMessageVersion = true; // mark as set return this; } @@ -939,6 +1011,7 @@ public String getMessageVersion() { @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setMessageVersion(String messageVersion) { this.messageVersion = messageVersion; + isSetMessageVersion = true; // mark as set } /** @@ -949,6 +1022,7 @@ public void setMessageVersion(String messageVersion) { */ public AuthenticationInfo riskScore(Integer riskScore) { this.riskScore = riskScore; + isSetRiskScore = true; // mark as set return this; } @@ -972,6 +1046,7 @@ public Integer getRiskScore() { @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setRiskScore(Integer riskScore) { this.riskScore = riskScore; + isSetRiskScore = true; // mark as set } /** @@ -983,6 +1058,7 @@ public void setRiskScore(Integer riskScore) { */ public AuthenticationInfo threeDSServerTransID(String threeDSServerTransID) { this.threeDSServerTransID = threeDSServerTransID; + isSetThreeDSServerTransID = true; // mark as set return this; } @@ -1008,6 +1084,7 @@ public String getThreeDSServerTransID() { @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setThreeDSServerTransID(String threeDSServerTransID) { this.threeDSServerTransID = threeDSServerTransID; + isSetThreeDSServerTransID = true; // mark as set } /** @@ -1027,6 +1104,7 @@ public void setThreeDSServerTransID(String threeDSServerTransID) { */ public AuthenticationInfo transStatus(TransStatusEnum transStatus) { this.transStatus = transStatus; + isSetTransStatus = true; // mark as set return this; } @@ -1068,6 +1146,7 @@ public TransStatusEnum getTransStatus() { @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setTransStatus(TransStatusEnum transStatus) { this.transStatus = transStatus; + isSetTransStatus = true; // mark as set } /** @@ -1082,6 +1161,7 @@ public void setTransStatus(TransStatusEnum transStatus) { */ public AuthenticationInfo transStatusReason(TransStatusReasonEnum transStatusReason) { this.transStatusReason = transStatusReason; + isSetTransStatusReason = true; // mark as set return this; } @@ -1113,6 +1193,7 @@ public TransStatusReasonEnum getTransStatusReason() { @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setTransStatusReason(TransStatusReasonEnum transStatusReason) { this.transStatusReason = transStatusReason; + isSetTransStatusReason = true; // mark as set } /** @@ -1124,6 +1205,7 @@ public void setTransStatusReason(TransStatusReasonEnum transStatusReason) { */ public AuthenticationInfo type(TypeEnum type) { this.type = type; + isSetType = true; // mark as set return this; } @@ -1149,6 +1231,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 AuthenticationInfo 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 AuthenticationInfo object is equal to o. */ @@ -1162,40 +1265,71 @@ public boolean equals(Object o) { } AuthenticationInfo authenticationInfo = (AuthenticationInfo) o; return Objects.equals(this.acsTransId, authenticationInfo.acsTransId) + && Objects.equals(this.isSetAcsTransId, authenticationInfo.isSetAcsTransId) && Objects.equals(this.challenge, authenticationInfo.challenge) + && Objects.equals(this.isSetChallenge, authenticationInfo.isSetChallenge) && Objects.equals(this.challengeIndicator, authenticationInfo.challengeIndicator) + && Objects.equals(this.isSetChallengeIndicator, authenticationInfo.isSetChallengeIndicator) && Objects.equals(this.createdAt, authenticationInfo.createdAt) + && Objects.equals(this.isSetCreatedAt, authenticationInfo.isSetCreatedAt) && Objects.equals(this.deviceChannel, authenticationInfo.deviceChannel) + && Objects.equals(this.isSetDeviceChannel, authenticationInfo.isSetDeviceChannel) && Objects.equals(this.dsTransID, authenticationInfo.dsTransID) + && Objects.equals(this.isSetDsTransID, authenticationInfo.isSetDsTransID) && Objects.equals(this.exemptionIndicator, authenticationInfo.exemptionIndicator) + && Objects.equals(this.isSetExemptionIndicator, authenticationInfo.isSetExemptionIndicator) && Objects.equals(this.inPSD2Scope, authenticationInfo.inPSD2Scope) + && Objects.equals(this.isSetInPSD2Scope, authenticationInfo.isSetInPSD2Scope) && Objects.equals(this.messageCategory, authenticationInfo.messageCategory) + && Objects.equals(this.isSetMessageCategory, authenticationInfo.isSetMessageCategory) && Objects.equals(this.messageVersion, authenticationInfo.messageVersion) + && Objects.equals(this.isSetMessageVersion, authenticationInfo.isSetMessageVersion) && Objects.equals(this.riskScore, authenticationInfo.riskScore) + && Objects.equals(this.isSetRiskScore, authenticationInfo.isSetRiskScore) && Objects.equals(this.threeDSServerTransID, authenticationInfo.threeDSServerTransID) + && Objects.equals( + this.isSetThreeDSServerTransID, authenticationInfo.isSetThreeDSServerTransID) && Objects.equals(this.transStatus, authenticationInfo.transStatus) + && Objects.equals(this.isSetTransStatus, authenticationInfo.isSetTransStatus) && Objects.equals(this.transStatusReason, authenticationInfo.transStatusReason) - && Objects.equals(this.type, authenticationInfo.type); + && Objects.equals(this.isSetTransStatusReason, authenticationInfo.isSetTransStatusReason) + && Objects.equals(this.type, authenticationInfo.type) + && Objects.equals(this.isSetType, authenticationInfo.isSetType); } @Override public int hashCode() { return Objects.hash( acsTransId, + isSetAcsTransId, challenge, + isSetChallenge, challengeIndicator, + isSetChallengeIndicator, createdAt, + isSetCreatedAt, deviceChannel, + isSetDeviceChannel, dsTransID, + isSetDsTransID, exemptionIndicator, + isSetExemptionIndicator, inPSD2Scope, + isSetInPSD2Scope, messageCategory, + isSetMessageCategory, messageVersion, + isSetMessageVersion, riskScore, + isSetRiskScore, threeDSServerTransID, + isSetThreeDSServerTransID, transStatus, + isSetTransStatus, transStatusReason, - type); + isSetTransStatusReason, + type, + isSetType); } @Override @@ -1233,6 +1367,72 @@ 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 (isSetAcsTransId) { + addIfNull(nulls, JSON_PROPERTY_ACS_TRANS_ID, this.acsTransId); + } + if (isSetChallenge) { + addIfNull(nulls, JSON_PROPERTY_CHALLENGE, this.challenge); + } + if (isSetChallengeIndicator) { + addIfNull(nulls, JSON_PROPERTY_CHALLENGE_INDICATOR, this.challengeIndicator); + } + if (isSetCreatedAt) { + addIfNull(nulls, JSON_PROPERTY_CREATED_AT, this.createdAt); + } + if (isSetDeviceChannel) { + addIfNull(nulls, JSON_PROPERTY_DEVICE_CHANNEL, this.deviceChannel); + } + if (isSetDsTransID) { + addIfNull(nulls, JSON_PROPERTY_DS_TRANS_I_D, this.dsTransID); + } + if (isSetExemptionIndicator) { + addIfNull(nulls, JSON_PROPERTY_EXEMPTION_INDICATOR, this.exemptionIndicator); + } + if (isSetInPSD2Scope) { + addIfNull(nulls, JSON_PROPERTY_IN_P_S_D2_SCOPE, this.inPSD2Scope); + } + if (isSetMessageCategory) { + addIfNull(nulls, JSON_PROPERTY_MESSAGE_CATEGORY, this.messageCategory); + } + if (isSetMessageVersion) { + addIfNull(nulls, JSON_PROPERTY_MESSAGE_VERSION, this.messageVersion); + } + if (isSetRiskScore) { + addIfNull(nulls, JSON_PROPERTY_RISK_SCORE, this.riskScore); + } + if (isSetThreeDSServerTransID) { + addIfNull(nulls, JSON_PROPERTY_THREE_D_S_SERVER_TRANS_I_D, this.threeDSServerTransID); + } + if (isSetTransStatus) { + addIfNull(nulls, JSON_PROPERTY_TRANS_STATUS, this.transStatus); + } + if (isSetTransStatusReason) { + addIfNull(nulls, JSON_PROPERTY_TRANS_STATUS_REASON, this.transStatusReason); + } + 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 AuthenticationInfo given an JSON string * diff --git a/src/main/java/com/adyen/model/acswebhooks/AuthenticationNotificationData.java b/src/main/java/com/adyen/model/java/AuthenticationNotificationData.java similarity index 73% rename from src/main/java/com/adyen/model/acswebhooks/AuthenticationNotificationData.java rename to src/main/java/com/adyen/model/java/AuthenticationNotificationData.java index d7acf3076..ccbd17119 100644 --- a/src/main/java/com/adyen/model/acswebhooks/AuthenticationNotificationData.java +++ b/src/main/java/com/adyen/model/java/AuthenticationNotificationData.java @@ -9,9 +9,11 @@ * Do not edit the class manually. */ -package com.adyen.model.acswebhooks; +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; @@ -34,18 +36,33 @@ public class AuthenticationNotificationData { public static final String JSON_PROPERTY_AUTHENTICATION = "authentication"; private AuthenticationInfo authentication; + /** Mark when the attribute has been explicitly set. */ + private boolean isSetAuthentication = 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_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_ID = "paymentInstrumentId"; private String paymentInstrumentId; + /** Mark when the attribute has been explicitly set. */ + private boolean isSetPaymentInstrumentId = false; + public static final String JSON_PROPERTY_PURCHASE = "purchase"; private PurchaseInfo purchase; + /** Mark when the attribute has been explicitly set. */ + private boolean isSetPurchase = false; + /** Outcome of the authentication. Allowed values: * authenticated * rejected * error */ public enum StatusEnum { AUTHENTICATED(String.valueOf("authenticated")), @@ -92,6 +109,15 @@ 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; + + /** + * Sets whether attributes with null values should be explicitly included in the JSON payload. + * Default is false. + */ + @JsonIgnore private boolean includeNullValues = false; + public AuthenticationNotificationData() {} /** @@ -103,6 +129,7 @@ public AuthenticationNotificationData() {} */ public AuthenticationNotificationData authentication(AuthenticationInfo authentication) { this.authentication = authentication; + isSetAuthentication = true; // mark as set return this; } @@ -126,6 +153,7 @@ public AuthenticationInfo getAuthentication() { @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setAuthentication(AuthenticationInfo authentication) { this.authentication = authentication; + isSetAuthentication = true; // mark as set } /** @@ -137,6 +165,7 @@ public void setAuthentication(AuthenticationInfo authentication) { */ public AuthenticationNotificationData balancePlatform(String balancePlatform) { this.balancePlatform = balancePlatform; + isSetBalancePlatform = true; // mark as set return this; } @@ -160,6 +189,7 @@ public String getBalancePlatform() { @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setBalancePlatform(String balancePlatform) { this.balancePlatform = balancePlatform; + isSetBalancePlatform = true; // mark as set } /** @@ -171,6 +201,7 @@ public void setBalancePlatform(String balancePlatform) { */ public AuthenticationNotificationData id(String id) { this.id = id; + isSetId = true; // mark as set return this; } @@ -194,6 +225,7 @@ public String getId() { @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setId(String id) { this.id = id; + isSetId = true; // mark as set } /** @@ -206,6 +238,7 @@ public void setId(String id) { */ public AuthenticationNotificationData paymentInstrumentId(String paymentInstrumentId) { this.paymentInstrumentId = paymentInstrumentId; + isSetPaymentInstrumentId = true; // mark as set return this; } @@ -231,6 +264,7 @@ public String getPaymentInstrumentId() { @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setPaymentInstrumentId(String paymentInstrumentId) { this.paymentInstrumentId = paymentInstrumentId; + isSetPaymentInstrumentId = true; // mark as set } /** @@ -242,6 +276,7 @@ public void setPaymentInstrumentId(String paymentInstrumentId) { */ public AuthenticationNotificationData purchase(PurchaseInfo purchase) { this.purchase = purchase; + isSetPurchase = true; // mark as set return this; } @@ -265,6 +300,7 @@ public PurchaseInfo getPurchase() { @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setPurchase(PurchaseInfo purchase) { this.purchase = purchase; + isSetPurchase = true; // mark as set } /** @@ -276,6 +312,7 @@ public void setPurchase(PurchaseInfo purchase) { */ public AuthenticationNotificationData status(StatusEnum status) { this.status = status; + isSetStatus = true; // mark as set return this; } @@ -300,6 +337,27 @@ public StatusEnum getStatus() { @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setStatus(StatusEnum status) { this.status = status; + isSetStatus = true; // mark as set + } + + /** + * Configures whether null values are explicitly serialized in the JSON payload. Default is false. + */ + public AuthenticationNotificationData 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 AuthenticationNotificationData object is equal to o. */ @@ -314,17 +372,38 @@ public boolean equals(Object o) { AuthenticationNotificationData authenticationNotificationData = (AuthenticationNotificationData) o; return Objects.equals(this.authentication, authenticationNotificationData.authentication) + && Objects.equals( + this.isSetAuthentication, authenticationNotificationData.isSetAuthentication) && Objects.equals(this.balancePlatform, authenticationNotificationData.balancePlatform) + && Objects.equals( + this.isSetBalancePlatform, authenticationNotificationData.isSetBalancePlatform) && Objects.equals(this.id, authenticationNotificationData.id) + && Objects.equals(this.isSetId, authenticationNotificationData.isSetId) && Objects.equals( this.paymentInstrumentId, authenticationNotificationData.paymentInstrumentId) + && Objects.equals( + this.isSetPaymentInstrumentId, authenticationNotificationData.isSetPaymentInstrumentId) && Objects.equals(this.purchase, authenticationNotificationData.purchase) - && Objects.equals(this.status, authenticationNotificationData.status); + && Objects.equals(this.isSetPurchase, authenticationNotificationData.isSetPurchase) + && Objects.equals(this.status, authenticationNotificationData.status) + && Objects.equals(this.isSetStatus, authenticationNotificationData.isSetStatus); } @Override public int hashCode() { - return Objects.hash(authentication, balancePlatform, id, paymentInstrumentId, purchase, status); + return Objects.hash( + authentication, + isSetAuthentication, + balancePlatform, + isSetBalancePlatform, + id, + isSetId, + paymentInstrumentId, + isSetPaymentInstrumentId, + purchase, + isSetPurchase, + status, + isSetStatus); } @Override @@ -353,6 +432,45 @@ 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 (isSetAuthentication) { + addIfNull(nulls, JSON_PROPERTY_AUTHENTICATION, this.authentication); + } + if (isSetBalancePlatform) { + addIfNull(nulls, JSON_PROPERTY_BALANCE_PLATFORM, this.balancePlatform); + } + if (isSetId) { + addIfNull(nulls, JSON_PROPERTY_ID, this.id); + } + if (isSetPaymentInstrumentId) { + addIfNull(nulls, JSON_PROPERTY_PAYMENT_INSTRUMENT_ID, this.paymentInstrumentId); + } + if (isSetPurchase) { + addIfNull(nulls, JSON_PROPERTY_PURCHASE, this.purchase); + } + if (isSetStatus) { + addIfNull(nulls, JSON_PROPERTY_STATUS, this.status); + } + + 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 AuthenticationNotificationData given an JSON string * diff --git a/src/main/java/com/adyen/model/acswebhooks/AuthenticationNotificationRequest.java b/src/main/java/com/adyen/model/java/AuthenticationNotificationRequest.java similarity index 73% rename from src/main/java/com/adyen/model/acswebhooks/AuthenticationNotificationRequest.java rename to src/main/java/com/adyen/model/java/AuthenticationNotificationRequest.java index 076294fdf..67ca1caf6 100644 --- a/src/main/java/com/adyen/model/acswebhooks/AuthenticationNotificationRequest.java +++ b/src/main/java/com/adyen/model/java/AuthenticationNotificationRequest.java @@ -9,9 +9,11 @@ * Do not edit the class manually. */ -package com.adyen.model.acswebhooks; +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 AuthenticationNotificationRequest { public static final String JSON_PROPERTY_DATA = "data"; private AuthenticationNotificationData 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 notification. */ public enum TypeEnum { BALANCEPLATFORM_AUTHENTICATION_CREATED( @@ -82,6 +93,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 AuthenticationNotificationRequest() {} /** @@ -93,6 +113,7 @@ public AuthenticationNotificationRequest() {} */ public AuthenticationNotificationRequest data(AuthenticationNotificationData data) { this.data = data; + isSetData = true; // mark as set return this; } @@ -116,6 +137,7 @@ public AuthenticationNotificationData getData() { @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setData(AuthenticationNotificationData data) { this.data = data; + isSetData = true; // mark as set } /** @@ -128,6 +150,7 @@ public void setData(AuthenticationNotificationData data) { */ public AuthenticationNotificationRequest environment(String environment) { this.environment = environment; + isSetEnvironment = true; // mark as set return this; } @@ -153,6 +176,7 @@ public String getEnvironment() { @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setEnvironment(String environment) { this.environment = environment; + isSetEnvironment = true; // mark as set } /** @@ -164,6 +188,7 @@ public void setEnvironment(String environment) { */ public AuthenticationNotificationRequest timestamp(OffsetDateTime timestamp) { this.timestamp = timestamp; + isSetTimestamp = true; // mark as set return this; } @@ -187,6 +212,7 @@ public OffsetDateTime getTimestamp() { @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setTimestamp(OffsetDateTime timestamp) { this.timestamp = timestamp; + isSetTimestamp = true; // mark as set } /** @@ -198,6 +224,7 @@ public void setTimestamp(OffsetDateTime timestamp) { */ public AuthenticationNotificationRequest type(TypeEnum type) { this.type = type; + isSetType = true; // mark as set return this; } @@ -221,6 +248,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 AuthenticationNotificationRequest 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 AuthenticationNotificationRequest object is equal to o. */ @@ -235,14 +283,19 @@ public boolean equals(Object o) { AuthenticationNotificationRequest authenticationNotificationRequest = (AuthenticationNotificationRequest) o; return Objects.equals(this.data, authenticationNotificationRequest.data) + && Objects.equals(this.isSetData, authenticationNotificationRequest.isSetData) && Objects.equals(this.environment, authenticationNotificationRequest.environment) + && Objects.equals(this.isSetEnvironment, authenticationNotificationRequest.isSetEnvironment) && Objects.equals(this.timestamp, authenticationNotificationRequest.timestamp) - && Objects.equals(this.type, authenticationNotificationRequest.type); + && Objects.equals(this.isSetTimestamp, authenticationNotificationRequest.isSetTimestamp) + && Objects.equals(this.type, authenticationNotificationRequest.type) + && Objects.equals(this.isSetType, authenticationNotificationRequest.isSetType); } @Override public int hashCode() { - return Objects.hash(data, environment, timestamp, type); + return Objects.hash( + data, isSetData, environment, isSetEnvironment, timestamp, isSetTimestamp, type, isSetType); } @Override @@ -267,6 +320,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 AuthenticationNotificationRequest given an JSON string * diff --git a/src/main/java/com/adyen/model/acswebhooks/BalancePlatformNotificationResponse.java b/src/main/java/com/adyen/model/java/BalancePlatformNotificationResponse.java similarity index 67% rename from src/main/java/com/adyen/model/acswebhooks/BalancePlatformNotificationResponse.java rename to src/main/java/com/adyen/model/java/BalancePlatformNotificationResponse.java index 88b15bd90..9d5180673 100644 --- a/src/main/java/com/adyen/model/acswebhooks/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.acswebhooks; +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/acswebhooks/ChallengeInfo.java b/src/main/java/com/adyen/model/java/ChallengeInfo.java similarity index 81% rename from src/main/java/com/adyen/model/acswebhooks/ChallengeInfo.java rename to src/main/java/com/adyen/model/java/ChallengeInfo.java index 65f350b04..0703b3f1e 100644 --- a/src/main/java/com/adyen/model/acswebhooks/ChallengeInfo.java +++ b/src/main/java/com/adyen/model/java/ChallengeInfo.java @@ -9,9 +9,11 @@ * Do not edit the class manually. */ -package com.adyen.model.acswebhooks; +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; @@ -98,6 +100,9 @@ public static ChallengeCancelEnum fromValue(String value) { public static final String JSON_PROPERTY_CHALLENGE_CANCEL = "challengeCancel"; private ChallengeCancelEnum challengeCancel; + /** Mark when the attribute has been explicitly set. */ + private boolean isSetChallengeCancel = false; + /** * The flow used in the challenge. Possible values: * **PWD_OTP_PHONE_FL**: one-time password * (OTP) flow via SMS * **PWD_OTP_EMAIL_FL**: one-time password (OTP) flow via email * @@ -148,18 +153,39 @@ public static FlowEnum fromValue(String value) { public static final String JSON_PROPERTY_FLOW = "flow"; private FlowEnum flow; + /** Mark when the attribute has been explicitly set. */ + private boolean isSetFlow = false; + public static final String JSON_PROPERTY_LAST_INTERACTION = "lastInteraction"; private OffsetDateTime lastInteraction; + /** Mark when the attribute has been explicitly set. */ + private boolean isSetLastInteraction = false; + public static final String JSON_PROPERTY_PHONE_NUMBER = "phoneNumber"; private String phoneNumber; + /** Mark when the attribute has been explicitly set. */ + private boolean isSetPhoneNumber = false; + public static final String JSON_PROPERTY_RESENDS = "resends"; private Integer resends; + /** Mark when the attribute has been explicitly set. */ + private boolean isSetResends = false; + public static final String JSON_PROPERTY_RETRIES = "retries"; private Integer retries; + /** Mark when the attribute has been explicitly set. */ + private boolean isSetRetries = false; + + /** + * Sets whether attributes with null values should be explicitly included in the JSON payload. + * Default is false. + */ + @JsonIgnore private boolean includeNullValues = false; + public ChallengeInfo() {} /** @@ -182,6 +208,7 @@ public ChallengeInfo() {} */ public ChallengeInfo challengeCancel(ChallengeCancelEnum challengeCancel) { this.challengeCancel = challengeCancel; + isSetChallengeCancel = true; // mark as set return this; } @@ -229,6 +256,7 @@ public ChallengeCancelEnum getChallengeCancel() { @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setChallengeCancel(ChallengeCancelEnum challengeCancel) { this.challengeCancel = challengeCancel; + isSetChallengeCancel = true; // mark as set } /** @@ -243,6 +271,7 @@ public void setChallengeCancel(ChallengeCancelEnum challengeCancel) { */ public ChallengeInfo flow(FlowEnum flow) { this.flow = flow; + isSetFlow = true; // mark as set return this; } @@ -274,6 +303,7 @@ public FlowEnum getFlow() { @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setFlow(FlowEnum flow) { this.flow = flow; + isSetFlow = true; // mark as set } /** @@ -284,6 +314,7 @@ public void setFlow(FlowEnum flow) { */ public ChallengeInfo lastInteraction(OffsetDateTime lastInteraction) { this.lastInteraction = lastInteraction; + isSetLastInteraction = true; // mark as set return this; } @@ -307,6 +338,7 @@ public OffsetDateTime getLastInteraction() { @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setLastInteraction(OffsetDateTime lastInteraction) { this.lastInteraction = lastInteraction; + isSetLastInteraction = true; // mark as set } /** @@ -317,6 +349,7 @@ public void setLastInteraction(OffsetDateTime lastInteraction) { */ public ChallengeInfo phoneNumber(String phoneNumber) { this.phoneNumber = phoneNumber; + isSetPhoneNumber = true; // mark as set return this; } @@ -340,6 +373,7 @@ public String getPhoneNumber() { @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setPhoneNumber(String phoneNumber) { this.phoneNumber = phoneNumber; + isSetPhoneNumber = true; // mark as set } /** @@ -350,6 +384,7 @@ public void setPhoneNumber(String phoneNumber) { */ public ChallengeInfo resends(Integer resends) { this.resends = resends; + isSetResends = true; // mark as set return this; } @@ -374,6 +409,7 @@ public Integer getResends() { @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setResends(Integer resends) { this.resends = resends; + isSetResends = true; // mark as set } /** @@ -384,6 +420,7 @@ public void setResends(Integer resends) { */ public ChallengeInfo retries(Integer retries) { this.retries = retries; + isSetRetries = true; // mark as set return this; } @@ -407,6 +444,27 @@ public Integer getRetries() { @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setRetries(Integer retries) { this.retries = retries; + isSetRetries = true; // mark as set + } + + /** + * Configures whether null values are explicitly serialized in the JSON payload. Default is false. + */ + public ChallengeInfo 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 ChallengeInfo object is equal to o. */ @@ -420,16 +478,34 @@ public boolean equals(Object o) { } ChallengeInfo challengeInfo = (ChallengeInfo) o; return Objects.equals(this.challengeCancel, challengeInfo.challengeCancel) + && Objects.equals(this.isSetChallengeCancel, challengeInfo.isSetChallengeCancel) && Objects.equals(this.flow, challengeInfo.flow) + && Objects.equals(this.isSetFlow, challengeInfo.isSetFlow) && Objects.equals(this.lastInteraction, challengeInfo.lastInteraction) + && Objects.equals(this.isSetLastInteraction, challengeInfo.isSetLastInteraction) && Objects.equals(this.phoneNumber, challengeInfo.phoneNumber) + && Objects.equals(this.isSetPhoneNumber, challengeInfo.isSetPhoneNumber) && Objects.equals(this.resends, challengeInfo.resends) - && Objects.equals(this.retries, challengeInfo.retries); + && Objects.equals(this.isSetResends, challengeInfo.isSetResends) + && Objects.equals(this.retries, challengeInfo.retries) + && Objects.equals(this.isSetRetries, challengeInfo.isSetRetries); } @Override public int hashCode() { - return Objects.hash(challengeCancel, flow, lastInteraction, phoneNumber, resends, retries); + return Objects.hash( + challengeCancel, + isSetChallengeCancel, + flow, + isSetFlow, + lastInteraction, + isSetLastInteraction, + phoneNumber, + isSetPhoneNumber, + resends, + isSetResends, + retries, + isSetRetries); } @Override @@ -456,6 +532,45 @@ 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 (isSetChallengeCancel) { + addIfNull(nulls, JSON_PROPERTY_CHALLENGE_CANCEL, this.challengeCancel); + } + if (isSetFlow) { + addIfNull(nulls, JSON_PROPERTY_FLOW, this.flow); + } + if (isSetLastInteraction) { + addIfNull(nulls, JSON_PROPERTY_LAST_INTERACTION, this.lastInteraction); + } + if (isSetPhoneNumber) { + addIfNull(nulls, JSON_PROPERTY_PHONE_NUMBER, this.phoneNumber); + } + if (isSetResends) { + addIfNull(nulls, JSON_PROPERTY_RESENDS, this.resends); + } + if (isSetRetries) { + addIfNull(nulls, JSON_PROPERTY_RETRIES, this.retries); + } + + 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 ChallengeInfo given an JSON string * diff --git a/src/main/java/com/adyen/model/acswebhooks/Purchase.java b/src/main/java/com/adyen/model/java/Purchase.java similarity index 65% rename from src/main/java/com/adyen/model/acswebhooks/Purchase.java rename to src/main/java/com/adyen/model/java/Purchase.java index f3d4e8ca9..4ef58e71b 100644 --- a/src/main/java/com/adyen/model/acswebhooks/Purchase.java +++ b/src/main/java/com/adyen/model/java/Purchase.java @@ -9,8 +9,10 @@ * Do not edit the class manually. */ -package com.adyen.model.acswebhooks; +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 Purchase { public static final String JSON_PROPERTY_DATE = "date"; private OffsetDateTime date; + /** Mark when the attribute has been explicitly set. */ + private boolean isSetDate = false; + public static final String JSON_PROPERTY_MERCHANT_NAME = "merchantName"; private String merchantName; + /** Mark when the attribute has been explicitly set. */ + private boolean isSetMerchantName = false; + public static final String JSON_PROPERTY_ORIGINAL_AMOUNT = "originalAmount"; private Amount originalAmount; + /** Mark when the attribute has been explicitly set. */ + private boolean isSetOriginalAmount = false; + + /** + * Sets whether attributes with null values should be explicitly included in the JSON payload. + * Default is false. + */ + @JsonIgnore private boolean includeNullValues = false; + public Purchase() {} /** @@ -44,6 +61,7 @@ public Purchase() {} */ public Purchase date(OffsetDateTime date) { this.date = date; + isSetDate = true; // mark as set return this; } @@ -67,6 +85,7 @@ public OffsetDateTime getDate() { @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setDate(OffsetDateTime date) { this.date = date; + isSetDate = true; // mark as set } /** @@ -77,6 +96,7 @@ public void setDate(OffsetDateTime date) { */ public Purchase merchantName(String merchantName) { this.merchantName = merchantName; + isSetMerchantName = true; // mark as set return this; } @@ -100,6 +120,7 @@ public String getMerchantName() { @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setMerchantName(String merchantName) { this.merchantName = merchantName; + isSetMerchantName = true; // mark as set } /** @@ -110,6 +131,7 @@ public void setMerchantName(String merchantName) { */ public Purchase originalAmount(Amount originalAmount) { this.originalAmount = originalAmount; + isSetOriginalAmount = true; // mark as set return this; } @@ -133,6 +155,27 @@ public Amount getOriginalAmount() { @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setOriginalAmount(Amount originalAmount) { this.originalAmount = originalAmount; + isSetOriginalAmount = true; // mark as set + } + + /** + * Configures whether null values are explicitly serialized in the JSON payload. Default is false. + */ + public Purchase 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 Purchase object is equal to o. */ @@ -146,13 +189,17 @@ public boolean equals(Object o) { } Purchase purchase = (Purchase) o; return Objects.equals(this.date, purchase.date) + && Objects.equals(this.isSetDate, purchase.isSetDate) && Objects.equals(this.merchantName, purchase.merchantName) - && Objects.equals(this.originalAmount, purchase.originalAmount); + && Objects.equals(this.isSetMerchantName, purchase.isSetMerchantName) + && Objects.equals(this.originalAmount, purchase.originalAmount) + && Objects.equals(this.isSetOriginalAmount, purchase.isSetOriginalAmount); } @Override public int hashCode() { - return Objects.hash(date, merchantName, originalAmount); + return Objects.hash( + date, isSetDate, merchantName, isSetMerchantName, originalAmount, isSetOriginalAmount); } @Override @@ -176,6 +223,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 (isSetDate) { + addIfNull(nulls, JSON_PROPERTY_DATE, this.date); + } + if (isSetMerchantName) { + addIfNull(nulls, JSON_PROPERTY_MERCHANT_NAME, this.merchantName); + } + if (isSetOriginalAmount) { + addIfNull(nulls, JSON_PROPERTY_ORIGINAL_AMOUNT, this.originalAmount); + } + + 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 Purchase given an JSON string * diff --git a/src/main/java/com/adyen/model/acswebhooks/PurchaseInfo.java b/src/main/java/com/adyen/model/java/PurchaseInfo.java similarity index 66% rename from src/main/java/com/adyen/model/acswebhooks/PurchaseInfo.java rename to src/main/java/com/adyen/model/java/PurchaseInfo.java index 640bb6338..5823fb370 100644 --- a/src/main/java/com/adyen/model/acswebhooks/PurchaseInfo.java +++ b/src/main/java/com/adyen/model/java/PurchaseInfo.java @@ -9,8 +9,10 @@ * Do not edit the class manually. */ -package com.adyen.model.acswebhooks; +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 PurchaseInfo { public static final String JSON_PROPERTY_DATE = "date"; private String date; + /** Mark when the attribute has been explicitly set. */ + private boolean isSetDate = false; + public static final String JSON_PROPERTY_MERCHANT_NAME = "merchantName"; private String merchantName; + /** Mark when the attribute has been explicitly set. */ + private boolean isSetMerchantName = false; + public static final String JSON_PROPERTY_ORIGINAL_AMOUNT = "originalAmount"; private Amount originalAmount; + /** Mark when the attribute has been explicitly set. */ + private boolean isSetOriginalAmount = false; + + /** + * Sets whether attributes with null values should be explicitly included in the JSON payload. + * Default is false. + */ + @JsonIgnore private boolean includeNullValues = false; + public PurchaseInfo() {} /** @@ -43,6 +60,7 @@ public PurchaseInfo() {} */ public PurchaseInfo date(String date) { this.date = date; + isSetDate = true; // mark as set return this; } @@ -66,6 +84,7 @@ public String getDate() { @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setDate(String date) { this.date = date; + isSetDate = true; // mark as set } /** @@ -76,6 +95,7 @@ public void setDate(String date) { */ public PurchaseInfo merchantName(String merchantName) { this.merchantName = merchantName; + isSetMerchantName = true; // mark as set return this; } @@ -99,6 +119,7 @@ public String getMerchantName() { @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setMerchantName(String merchantName) { this.merchantName = merchantName; + isSetMerchantName = true; // mark as set } /** @@ -109,6 +130,7 @@ public void setMerchantName(String merchantName) { */ public PurchaseInfo originalAmount(Amount originalAmount) { this.originalAmount = originalAmount; + isSetOriginalAmount = true; // mark as set return this; } @@ -132,6 +154,27 @@ public Amount getOriginalAmount() { @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setOriginalAmount(Amount originalAmount) { this.originalAmount = originalAmount; + isSetOriginalAmount = true; // mark as set + } + + /** + * Configures whether null values are explicitly serialized in the JSON payload. Default is false. + */ + public PurchaseInfo 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 PurchaseInfo object is equal to o. */ @@ -145,13 +188,17 @@ public boolean equals(Object o) { } PurchaseInfo purchaseInfo = (PurchaseInfo) o; return Objects.equals(this.date, purchaseInfo.date) + && Objects.equals(this.isSetDate, purchaseInfo.isSetDate) && Objects.equals(this.merchantName, purchaseInfo.merchantName) - && Objects.equals(this.originalAmount, purchaseInfo.originalAmount); + && Objects.equals(this.isSetMerchantName, purchaseInfo.isSetMerchantName) + && Objects.equals(this.originalAmount, purchaseInfo.originalAmount) + && Objects.equals(this.isSetOriginalAmount, purchaseInfo.isSetOriginalAmount); } @Override public int hashCode() { - return Objects.hash(date, merchantName, originalAmount); + return Objects.hash( + date, isSetDate, merchantName, isSetMerchantName, originalAmount, isSetOriginalAmount); } @Override @@ -175,6 +222,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 (isSetDate) { + addIfNull(nulls, JSON_PROPERTY_DATE, this.date); + } + if (isSetMerchantName) { + addIfNull(nulls, JSON_PROPERTY_MERCHANT_NAME, this.merchantName); + } + if (isSetOriginalAmount) { + addIfNull(nulls, JSON_PROPERTY_ORIGINAL_AMOUNT, this.originalAmount); + } + + 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 PurchaseInfo given an JSON string * diff --git a/src/main/java/com/adyen/model/acswebhooks/RelayedAuthenticationRequest.java b/src/main/java/com/adyen/model/java/RelayedAuthenticationRequest.java similarity index 75% rename from src/main/java/com/adyen/model/acswebhooks/RelayedAuthenticationRequest.java rename to src/main/java/com/adyen/model/java/RelayedAuthenticationRequest.java index 87f6ce555..2cad29d58 100644 --- a/src/main/java/com/adyen/model/acswebhooks/RelayedAuthenticationRequest.java +++ b/src/main/java/com/adyen/model/java/RelayedAuthenticationRequest.java @@ -9,9 +9,11 @@ * Do not edit the class manually. */ -package com.adyen.model.acswebhooks; +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; @@ -36,21 +38,39 @@ public class RelayedAuthenticationRequest { 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_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_ID = "paymentInstrumentId"; private String paymentInstrumentId; + /** Mark when the attribute has been explicitly set. */ + private boolean isSetPaymentInstrumentId = false; + public static final String JSON_PROPERTY_PURCHASE = "purchase"; private Purchase purchase; + /** Mark when the attribute has been explicitly set. */ + private boolean isSetPurchase = false; + public static final String JSON_PROPERTY_THREE_D_S_REQUESTOR_APP_U_R_L = "threeDSRequestorAppURL"; private String threeDSRequestorAppURL; + /** Mark when the attribute has been explicitly set. */ + private boolean isSetThreeDSRequestorAppURL = 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 notification. */ public enum TypeEnum { BALANCEPLATFORM_AUTHENTICATION_RELAYED( @@ -94,6 +114,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 RelayedAuthenticationRequest() {} /** @@ -105,6 +134,7 @@ public RelayedAuthenticationRequest() {} */ public RelayedAuthenticationRequest environment(String environment) { this.environment = environment; + isSetEnvironment = true; // mark as set return this; } @@ -130,6 +160,7 @@ public String getEnvironment() { @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setEnvironment(String environment) { this.environment = environment; + isSetEnvironment = true; // mark as set } /** @@ -140,6 +171,7 @@ public void setEnvironment(String environment) { */ public RelayedAuthenticationRequest id(String id) { this.id = id; + isSetId = true; // mark as set return this; } @@ -163,6 +195,7 @@ public String getId() { @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setId(String id) { this.id = id; + isSetId = true; // mark as set } /** @@ -177,6 +210,7 @@ public void setId(String id) { */ public RelayedAuthenticationRequest paymentInstrumentId(String paymentInstrumentId) { this.paymentInstrumentId = paymentInstrumentId; + isSetPaymentInstrumentId = true; // mark as set return this; } @@ -208,6 +242,7 @@ public String getPaymentInstrumentId() { @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setPaymentInstrumentId(String paymentInstrumentId) { this.paymentInstrumentId = paymentInstrumentId; + isSetPaymentInstrumentId = true; // mark as set } /** @@ -218,6 +253,7 @@ public void setPaymentInstrumentId(String paymentInstrumentId) { */ public RelayedAuthenticationRequest purchase(Purchase purchase) { this.purchase = purchase; + isSetPurchase = true; // mark as set return this; } @@ -241,6 +277,7 @@ public Purchase getPurchase() { @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setPurchase(Purchase purchase) { this.purchase = purchase; + isSetPurchase = true; // mark as set } /** @@ -253,6 +290,7 @@ public void setPurchase(Purchase purchase) { */ public RelayedAuthenticationRequest threeDSRequestorAppURL(String threeDSRequestorAppURL) { this.threeDSRequestorAppURL = threeDSRequestorAppURL; + isSetThreeDSRequestorAppURL = true; // mark as set return this; } @@ -280,6 +318,7 @@ public String getThreeDSRequestorAppURL() { @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setThreeDSRequestorAppURL(String threeDSRequestorAppURL) { this.threeDSRequestorAppURL = threeDSRequestorAppURL; + isSetThreeDSRequestorAppURL = true; // mark as set } /** @@ -290,6 +329,7 @@ public void setThreeDSRequestorAppURL(String threeDSRequestorAppURL) { */ public RelayedAuthenticationRequest timestamp(OffsetDateTime timestamp) { this.timestamp = timestamp; + isSetTimestamp = true; // mark as set return this; } @@ -313,6 +353,7 @@ public OffsetDateTime getTimestamp() { @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setTimestamp(OffsetDateTime timestamp) { this.timestamp = timestamp; + isSetTimestamp = true; // mark as set } /** @@ -323,6 +364,7 @@ public void setTimestamp(OffsetDateTime timestamp) { */ public RelayedAuthenticationRequest type(TypeEnum type) { this.type = type; + isSetType = true; // mark as set return this; } @@ -346,6 +388,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 RelayedAuthenticationRequest 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 RelayedAuthenticationRequest object is equal to o. */ @@ -359,20 +422,43 @@ public boolean equals(Object o) { } RelayedAuthenticationRequest relayedAuthenticationRequest = (RelayedAuthenticationRequest) o; return Objects.equals(this.environment, relayedAuthenticationRequest.environment) + && Objects.equals(this.isSetEnvironment, relayedAuthenticationRequest.isSetEnvironment) && Objects.equals(this.id, relayedAuthenticationRequest.id) + && Objects.equals(this.isSetId, relayedAuthenticationRequest.isSetId) && Objects.equals( this.paymentInstrumentId, relayedAuthenticationRequest.paymentInstrumentId) + && Objects.equals( + this.isSetPaymentInstrumentId, relayedAuthenticationRequest.isSetPaymentInstrumentId) && Objects.equals(this.purchase, relayedAuthenticationRequest.purchase) + && Objects.equals(this.isSetPurchase, relayedAuthenticationRequest.isSetPurchase) && Objects.equals( this.threeDSRequestorAppURL, relayedAuthenticationRequest.threeDSRequestorAppURL) + && Objects.equals( + this.isSetThreeDSRequestorAppURL, + relayedAuthenticationRequest.isSetThreeDSRequestorAppURL) && Objects.equals(this.timestamp, relayedAuthenticationRequest.timestamp) - && Objects.equals(this.type, relayedAuthenticationRequest.type); + && Objects.equals(this.isSetTimestamp, relayedAuthenticationRequest.isSetTimestamp) + && Objects.equals(this.type, relayedAuthenticationRequest.type) + && Objects.equals(this.isSetType, relayedAuthenticationRequest.isSetType); } @Override public int hashCode() { return Objects.hash( - environment, id, paymentInstrumentId, purchase, threeDSRequestorAppURL, timestamp, type); + environment, + isSetEnvironment, + id, + isSetId, + paymentInstrumentId, + isSetPaymentInstrumentId, + purchase, + isSetPurchase, + threeDSRequestorAppURL, + isSetThreeDSRequestorAppURL, + timestamp, + isSetTimestamp, + type, + isSetType); } @Override @@ -404,6 +490,48 @@ 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 (isSetEnvironment) { + addIfNull(nulls, JSON_PROPERTY_ENVIRONMENT, this.environment); + } + if (isSetId) { + addIfNull(nulls, JSON_PROPERTY_ID, this.id); + } + if (isSetPaymentInstrumentId) { + addIfNull(nulls, JSON_PROPERTY_PAYMENT_INSTRUMENT_ID, this.paymentInstrumentId); + } + if (isSetPurchase) { + addIfNull(nulls, JSON_PROPERTY_PURCHASE, this.purchase); + } + if (isSetThreeDSRequestorAppURL) { + addIfNull(nulls, JSON_PROPERTY_THREE_D_S_REQUESTOR_APP_U_R_L, this.threeDSRequestorAppURL); + } + 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 RelayedAuthenticationRequest given an JSON string * diff --git a/src/main/java/com/adyen/model/acswebhooks/RelayedAuthenticationResponse.java b/src/main/java/com/adyen/model/java/RelayedAuthenticationResponse.java similarity index 62% rename from src/main/java/com/adyen/model/acswebhooks/RelayedAuthenticationResponse.java rename to src/main/java/com/adyen/model/java/RelayedAuthenticationResponse.java index edb1533bf..00aa5302e 100644 --- a/src/main/java/com/adyen/model/acswebhooks/RelayedAuthenticationResponse.java +++ b/src/main/java/com/adyen/model/java/RelayedAuthenticationResponse.java @@ -9,8 +9,10 @@ * Do not edit the class manually. */ -package com.adyen.model.acswebhooks; +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 RelayedAuthenticationResponse { public static final String JSON_PROPERTY_AUTHENTICATION_DECISION = "authenticationDecision"; private AuthenticationDecision authenticationDecision; + /** Mark when the attribute has been explicitly set. */ + private boolean isSetAuthenticationDecision = false; + + /** + * Sets whether attributes with null values should be explicitly included in the JSON payload. + * Default is false. + */ + @JsonIgnore private boolean includeNullValues = false; + public RelayedAuthenticationResponse() {} /** @@ -35,6 +46,7 @@ public RelayedAuthenticationResponse() {} public RelayedAuthenticationResponse authenticationDecision( AuthenticationDecision authenticationDecision) { this.authenticationDecision = authenticationDecision; + isSetAuthenticationDecision = true; // mark as set return this; } @@ -58,6 +70,27 @@ public AuthenticationDecision getAuthenticationDecision() { @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setAuthenticationDecision(AuthenticationDecision authenticationDecision) { this.authenticationDecision = authenticationDecision; + isSetAuthenticationDecision = true; // mark as set + } + + /** + * Configures whether null values are explicitly serialized in the JSON payload. Default is false. + */ + public RelayedAuthenticationResponse 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 RelayedAuthenticationResponse object is equal to o. */ @@ -71,12 +104,15 @@ public boolean equals(Object o) { } RelayedAuthenticationResponse relayedAuthenticationResponse = (RelayedAuthenticationResponse) o; return Objects.equals( - this.authenticationDecision, relayedAuthenticationResponse.authenticationDecision); + this.authenticationDecision, relayedAuthenticationResponse.authenticationDecision) + && Objects.equals( + this.isSetAuthenticationDecision, + relayedAuthenticationResponse.isSetAuthenticationDecision); } @Override public int hashCode() { - return Objects.hash(authenticationDecision); + return Objects.hash(authenticationDecision, isSetAuthenticationDecision); } @Override @@ -100,6 +136,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 (isSetAuthenticationDecision) { + addIfNull(nulls, JSON_PROPERTY_AUTHENTICATION_DECISION, this.authenticationDecision); + } + + 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 RelayedAuthenticationResponse given an JSON string * diff --git a/src/main/java/com/adyen/model/acswebhooks/Resource.java b/src/main/java/com/adyen/model/java/Resource.java similarity index 68% rename from src/main/java/com/adyen/model/acswebhooks/Resource.java rename to src/main/java/com/adyen/model/java/Resource.java index 37bb6def5..2f175bf43 100644 --- a/src/main/java/com/adyen/model/acswebhooks/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.acswebhooks; +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/acswebhooks/ServiceError.java b/src/main/java/com/adyen/model/java/ServiceError.java similarity index 68% rename from src/main/java/com/adyen/model/acswebhooks/ServiceError.java rename to src/main/java/com/adyen/model/java/ServiceError.java index d70fd8386..ec4ccd2c7 100644 --- a/src/main/java/com/adyen/model/acswebhooks/ServiceError.java +++ b/src/main/java/com/adyen/model/java/ServiceError.java @@ -9,8 +9,10 @@ * Do not edit the class manually. */ -package com.adyen.model.acswebhooks; +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; @@ -29,18 +31,39 @@ public class ServiceError { public static final String JSON_PROPERTY_ERROR_CODE = "errorCode"; private String errorCode; + /** Mark when the attribute has been explicitly set. */ + private boolean isSetErrorCode = false; + public static final String JSON_PROPERTY_ERROR_TYPE = "errorType"; private String errorType; + /** Mark when the attribute has been explicitly set. */ + private boolean isSetErrorType = false; + public static final String JSON_PROPERTY_MESSAGE = "message"; private String message; + /** Mark when the attribute has been explicitly set. */ + private boolean isSetMessage = false; + public static final String JSON_PROPERTY_PSP_REFERENCE = "pspReference"; private String pspReference; + /** Mark when the attribute has been explicitly set. */ + private boolean isSetPspReference = false; + public static final String JSON_PROPERTY_STATUS = "status"; private Integer status; + /** Mark when the attribute has been explicitly set. */ + private boolean isSetStatus = false; + + /** + * Sets whether attributes with null values should be explicitly included in the JSON payload. + * Default is false. + */ + @JsonIgnore private boolean includeNullValues = false; + public ServiceError() {} /** @@ -51,6 +74,7 @@ public ServiceError() {} */ public ServiceError errorCode(String errorCode) { this.errorCode = errorCode; + isSetErrorCode = true; // mark as set return this; } @@ -74,6 +98,7 @@ public String getErrorCode() { @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setErrorCode(String errorCode) { this.errorCode = errorCode; + isSetErrorCode = true; // mark as set } /** @@ -84,6 +109,7 @@ public void setErrorCode(String errorCode) { */ public ServiceError errorType(String errorType) { this.errorType = errorType; + isSetErrorType = true; // mark as set return this; } @@ -107,6 +133,7 @@ public String getErrorType() { @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setErrorType(String errorType) { this.errorType = errorType; + isSetErrorType = true; // mark as set } /** @@ -117,6 +144,7 @@ public void setErrorType(String errorType) { */ public ServiceError message(String message) { this.message = message; + isSetMessage = true; // mark as set return this; } @@ -140,6 +168,7 @@ public String getMessage() { @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setMessage(String message) { this.message = message; + isSetMessage = true; // mark as set } /** @@ -150,6 +179,7 @@ public void setMessage(String message) { */ public ServiceError pspReference(String pspReference) { this.pspReference = pspReference; + isSetPspReference = true; // mark as set return this; } @@ -173,6 +203,7 @@ public String getPspReference() { @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setPspReference(String pspReference) { this.pspReference = pspReference; + isSetPspReference = true; // mark as set } /** @@ -183,6 +214,7 @@ public void setPspReference(String pspReference) { */ public ServiceError status(Integer status) { this.status = status; + isSetStatus = true; // mark as set return this; } @@ -206,6 +238,27 @@ public Integer getStatus() { @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setStatus(Integer status) { this.status = status; + isSetStatus = true; // mark as set + } + + /** + * Configures whether null values are explicitly serialized in the JSON payload. Default is false. + */ + public ServiceError 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 ServiceError object is equal to o. */ @@ -219,15 +272,30 @@ public boolean equals(Object o) { } ServiceError serviceError = (ServiceError) o; return Objects.equals(this.errorCode, serviceError.errorCode) + && Objects.equals(this.isSetErrorCode, serviceError.isSetErrorCode) && Objects.equals(this.errorType, serviceError.errorType) + && Objects.equals(this.isSetErrorType, serviceError.isSetErrorType) && Objects.equals(this.message, serviceError.message) + && Objects.equals(this.isSetMessage, serviceError.isSetMessage) && Objects.equals(this.pspReference, serviceError.pspReference) - && Objects.equals(this.status, serviceError.status); + && Objects.equals(this.isSetPspReference, serviceError.isSetPspReference) + && Objects.equals(this.status, serviceError.status) + && Objects.equals(this.isSetStatus, serviceError.isSetStatus); } @Override public int hashCode() { - return Objects.hash(errorCode, errorType, message, pspReference, status); + return Objects.hash( + errorCode, + isSetErrorCode, + errorType, + isSetErrorType, + message, + isSetMessage, + pspReference, + isSetPspReference, + status, + isSetStatus); } @Override @@ -253,6 +321,42 @@ 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 (isSetErrorCode) { + addIfNull(nulls, JSON_PROPERTY_ERROR_CODE, this.errorCode); + } + if (isSetErrorType) { + addIfNull(nulls, JSON_PROPERTY_ERROR_TYPE, this.errorType); + } + if (isSetMessage) { + addIfNull(nulls, JSON_PROPERTY_MESSAGE, this.message); + } + if (isSetPspReference) { + addIfNull(nulls, JSON_PROPERTY_PSP_REFERENCE, this.pspReference); + } + if (isSetStatus) { + addIfNull(nulls, JSON_PROPERTY_STATUS, this.status); + } + + 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 ServiceError given an JSON string *