1111
1212package com .adyen .model .checkout ;
1313
14+ import com .fasterxml .jackson .annotation .JsonAnyGetter ;
1415import com .fasterxml .jackson .annotation .JsonCreator ;
16+ import com .fasterxml .jackson .annotation .JsonIgnore ;
1517import com .fasterxml .jackson .annotation .JsonInclude ;
1618import com .fasterxml .jackson .annotation .JsonProperty ;
1719import com .fasterxml .jackson .annotation .JsonPropertyOrder ;
@@ -36,6 +38,9 @@ public class AdditionalData3DSecure {
3638 // `authenticationData.threeDSRequestData.nativeThreeDS` instead.
3739 private String allow3DS2 ;
3840
41+ /** Mark when the attribute has been explicitly set. */
42+ private boolean isSetAllow3DS2 = false ;
43+
3944 /**
4045 * Dimensions of the 3DS2 challenge window to be displayed to the cardholder. Possible values: *
4146 * **01** - size of 250x400 * **02** - size of 390x400 * **03** - size of 500x600 * **04** - size
@@ -90,20 +95,41 @@ public static ChallengeWindowSizeEnum fromValue(String value) {
9095 public static final String JSON_PROPERTY_CHALLENGE_WINDOW_SIZE = "challengeWindowSize" ;
9196 private ChallengeWindowSizeEnum challengeWindowSize ;
9297
98+ /** Mark when the attribute has been explicitly set. */
99+ private boolean isSetChallengeWindowSize = false ;
100+
93101 public static final String JSON_PROPERTY_EXECUTE_THREE_D = "executeThreeD" ;
94102 @ Deprecated // deprecated since Adyen Checkout API v69: Use
95103 // [`authenticationData.attemptAuthentication`](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments?target=_blank#request-authenticationData-attemptAuthentication) instead
96104 private String executeThreeD ;
97105
106+ /** Mark when the attribute has been explicitly set. */
107+ private boolean isSetExecuteThreeD = false ;
108+
98109 public static final String JSON_PROPERTY_MPI_IMPLEMENTATION_TYPE = "mpiImplementationType" ;
99110 private String mpiImplementationType ;
100111
112+ /** Mark when the attribute has been explicitly set. */
113+ private boolean isSetMpiImplementationType = false ;
114+
101115 public static final String JSON_PROPERTY_SCA_EXEMPTION = "scaExemption" ;
102116 private String scaExemption ;
103117
118+ /** Mark when the attribute has been explicitly set. */
119+ private boolean isSetScaExemption = false ;
120+
104121 public static final String JSON_PROPERTY_THREE_D_S_VERSION = "threeDSVersion" ;
105122 private String threeDSVersion ;
106123
124+ /** Mark when the attribute has been explicitly set. */
125+ private boolean isSetThreeDSVersion = false ;
126+
127+ /**
128+ * Sets whether attributes with null values should be explicitly included in the JSON payload.
129+ * Default is false.
130+ */
131+ @ JsonIgnore private boolean includeNullValues = false ;
132+
107133 public AdditionalData3DSecure () {}
108134
109135 /**
@@ -140,6 +166,7 @@ public AdditionalData3DSecure() {}
140166 // `authenticationData.threeDSRequestData.nativeThreeDS` instead.
141167 public AdditionalData3DSecure allow3DS2 (String allow3DS2 ) {
142168 this .allow3DS2 = allow3DS2 ;
169+ isSetAllow3DS2 = true ; // mark as set
143170 return this ;
144171 }
145172
@@ -215,6 +242,7 @@ public String getAllow3DS2() {
215242 @ JsonInclude (value = JsonInclude .Include .USE_DEFAULTS )
216243 public void setAllow3DS2 (String allow3DS2 ) {
217244 this .allow3DS2 = allow3DS2 ;
245+ isSetAllow3DS2 = true ; // mark as set
218246 }
219247
220248 /**
@@ -229,6 +257,7 @@ public void setAllow3DS2(String allow3DS2) {
229257 */
230258 public AdditionalData3DSecure challengeWindowSize (ChallengeWindowSizeEnum challengeWindowSize ) {
231259 this .challengeWindowSize = challengeWindowSize ;
260+ isSetChallengeWindowSize = true ; // mark as set
232261 return this ;
233262 }
234263
@@ -260,6 +289,7 @@ public ChallengeWindowSizeEnum getChallengeWindowSize() {
260289 @ JsonInclude (value = JsonInclude .Include .USE_DEFAULTS )
261290 public void setChallengeWindowSize (ChallengeWindowSizeEnum challengeWindowSize ) {
262291 this .challengeWindowSize = challengeWindowSize ;
292+ isSetChallengeWindowSize = true ; // mark as set
263293 }
264294
265295 /**
@@ -284,6 +314,7 @@ public void setChallengeWindowSize(ChallengeWindowSizeEnum challengeWindowSize)
284314 // [`authenticationData.attemptAuthentication`](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments?target=_blank#request-authenticationData-attemptAuthentication) instead
285315 public AdditionalData3DSecure executeThreeD (String executeThreeD ) {
286316 this .executeThreeD = executeThreeD ;
317+ isSetExecuteThreeD = true ; // mark as set
287318 return this ;
288319 }
289320
@@ -335,6 +366,7 @@ public String getExecuteThreeD() {
335366 @ JsonInclude (value = JsonInclude .Include .USE_DEFAULTS )
336367 public void setExecuteThreeD (String executeThreeD ) {
337368 this .executeThreeD = executeThreeD ;
369+ isSetExecuteThreeD = true ; // mark as set
338370 }
339371
340372 /**
@@ -345,6 +377,7 @@ public void setExecuteThreeD(String executeThreeD) {
345377 */
346378 public AdditionalData3DSecure mpiImplementationType (String mpiImplementationType ) {
347379 this .mpiImplementationType = mpiImplementationType ;
380+ isSetMpiImplementationType = true ; // mark as set
348381 return this ;
349382 }
350383
@@ -368,6 +401,7 @@ public String getMpiImplementationType() {
368401 @ JsonInclude (value = JsonInclude .Include .USE_DEFAULTS )
369402 public void setMpiImplementationType (String mpiImplementationType ) {
370403 this .mpiImplementationType = mpiImplementationType ;
404+ isSetMpiImplementationType = true ; // mark as set
371405 }
372406
373407 /**
@@ -384,6 +418,7 @@ public void setMpiImplementationType(String mpiImplementationType) {
384418 */
385419 public AdditionalData3DSecure scaExemption (String scaExemption ) {
386420 this .scaExemption = scaExemption ;
421+ isSetScaExemption = true ; // mark as set
387422 return this ;
388423 }
389424
@@ -419,6 +454,7 @@ public String getScaExemption() {
419454 @ JsonInclude (value = JsonInclude .Include .USE_DEFAULTS )
420455 public void setScaExemption (String scaExemption ) {
421456 this .scaExemption = scaExemption ;
457+ isSetScaExemption = true ; // mark as set
422458 }
423459
424460 /**
@@ -443,6 +479,7 @@ public void setScaExemption(String scaExemption) {
443479 */
444480 public AdditionalData3DSecure threeDSVersion (String threeDSVersion ) {
445481 this .threeDSVersion = threeDSVersion ;
482+ isSetThreeDSVersion = true ; // mark as set
446483 return this ;
447484 }
448485
@@ -494,6 +531,27 @@ public String getThreeDSVersion() {
494531 @ JsonInclude (value = JsonInclude .Include .USE_DEFAULTS )
495532 public void setThreeDSVersion (String threeDSVersion ) {
496533 this .threeDSVersion = threeDSVersion ;
534+ isSetThreeDSVersion = true ; // mark as set
535+ }
536+
537+ /**
538+ * Configures whether null values are explicitly serialized in the JSON payload. Default is false.
539+ */
540+ public AdditionalData3DSecure includeNullValues (boolean includeNullValues ) {
541+ this .includeNullValues = includeNullValues ;
542+ return this ;
543+ }
544+
545+ /** Returns whether null values are explicitly serialized in the JSON payload. */
546+ public boolean isIncludeNullValues () {
547+ return includeNullValues ;
548+ }
549+
550+ /**
551+ * Sets whether null values should be explicitly serialized in the JSON payload. Default is false.
552+ */
553+ public void setIncludeNullValues (boolean includeNullValues ) {
554+ this .includeNullValues = includeNullValues ;
497555 }
498556
499557 /** Return true if this AdditionalData3DSecure object is equal to o. */
@@ -507,22 +565,36 @@ public boolean equals(Object o) {
507565 }
508566 AdditionalData3DSecure additionalData3DSecure = (AdditionalData3DSecure ) o ;
509567 return Objects .equals (this .allow3DS2 , additionalData3DSecure .allow3DS2 )
568+ && Objects .equals (this .isSetAllow3DS2 , additionalData3DSecure .isSetAllow3DS2 )
510569 && Objects .equals (this .challengeWindowSize , additionalData3DSecure .challengeWindowSize )
570+ && Objects .equals (
571+ this .isSetChallengeWindowSize , additionalData3DSecure .isSetChallengeWindowSize )
511572 && Objects .equals (this .executeThreeD , additionalData3DSecure .executeThreeD )
573+ && Objects .equals (this .isSetExecuteThreeD , additionalData3DSecure .isSetExecuteThreeD )
512574 && Objects .equals (this .mpiImplementationType , additionalData3DSecure .mpiImplementationType )
575+ && Objects .equals (
576+ this .isSetMpiImplementationType , additionalData3DSecure .isSetMpiImplementationType )
513577 && Objects .equals (this .scaExemption , additionalData3DSecure .scaExemption )
514- && Objects .equals (this .threeDSVersion , additionalData3DSecure .threeDSVersion );
578+ && Objects .equals (this .isSetScaExemption , additionalData3DSecure .isSetScaExemption )
579+ && Objects .equals (this .threeDSVersion , additionalData3DSecure .threeDSVersion )
580+ && Objects .equals (this .isSetThreeDSVersion , additionalData3DSecure .isSetThreeDSVersion );
515581 }
516582
517583 @ Override
518584 public int hashCode () {
519585 return Objects .hash (
520586 allow3DS2 ,
587+ isSetAllow3DS2 ,
521588 challengeWindowSize ,
589+ isSetChallengeWindowSize ,
522590 executeThreeD ,
591+ isSetExecuteThreeD ,
523592 mpiImplementationType ,
593+ isSetMpiImplementationType ,
524594 scaExemption ,
525- threeDSVersion );
595+ isSetScaExemption ,
596+ threeDSVersion ,
597+ isSetThreeDSVersion );
526598 }
527599
528600 @ Override
@@ -553,6 +625,45 @@ private String toIndentedString(Object o) {
553625 return o .toString ().replace ("\n " , "\n " );
554626 }
555627
628+ /** Returns a map of properties to be merged into the JSON payload as explicit null values. */
629+ @ JsonInclude (JsonInclude .Include .ALWAYS )
630+ @ JsonAnyGetter
631+ public Map <String , Object > getExplicitNulls () {
632+ if (!this .includeNullValues ) {
633+ return Collections .emptyMap ();
634+ }
635+
636+ Map <String , Object > nulls = new HashMap <>();
637+
638+ if (isSetAllow3DS2 ) {
639+ addIfNull (nulls , JSON_PROPERTY_ALLOW3_D_S2 , this .allow3DS2 );
640+ }
641+ if (isSetChallengeWindowSize ) {
642+ addIfNull (nulls , JSON_PROPERTY_CHALLENGE_WINDOW_SIZE , this .challengeWindowSize );
643+ }
644+ if (isSetExecuteThreeD ) {
645+ addIfNull (nulls , JSON_PROPERTY_EXECUTE_THREE_D , this .executeThreeD );
646+ }
647+ if (isSetMpiImplementationType ) {
648+ addIfNull (nulls , JSON_PROPERTY_MPI_IMPLEMENTATION_TYPE , this .mpiImplementationType );
649+ }
650+ if (isSetScaExemption ) {
651+ addIfNull (nulls , JSON_PROPERTY_SCA_EXEMPTION , this .scaExemption );
652+ }
653+ if (isSetThreeDSVersion ) {
654+ addIfNull (nulls , JSON_PROPERTY_THREE_D_S_VERSION , this .threeDSVersion );
655+ }
656+
657+ return nulls ;
658+ }
659+
660+ // add to map when value is null
661+ private void addIfNull (Map <String , Object > map , String key , Object value ) {
662+ if (value == null ) {
663+ map .put (key , null );
664+ }
665+ }
666+
556667 /**
557668 * Create an instance of AdditionalData3DSecure given an JSON string
558669 *
0 commit comments