1111
1212package com .adyen .model .payment ;
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 ;
@@ -34,6 +36,9 @@ public class AdditionalData3DSecure {
3436 public static final String JSON_PROPERTY_ALLOW3_D_S2 = "allow3DS2" ;
3537 private String allow3DS2 ;
3638
39+ /** Mark when the attribute has been explicitly set. */
40+ private boolean isSetAllow3DS2 = false ;
41+
3742 /**
3843 * Dimensions of the 3DS2 challenge window to be displayed to the cardholder. Possible values: *
3944 * **01** - size of 250x400 * **02** - size of 390x400 * **03** - size of 500x600 * **04** - size
@@ -88,18 +93,39 @@ public static ChallengeWindowSizeEnum fromValue(String value) {
8893 public static final String JSON_PROPERTY_CHALLENGE_WINDOW_SIZE = "challengeWindowSize" ;
8994 private ChallengeWindowSizeEnum challengeWindowSize ;
9095
96+ /** Mark when the attribute has been explicitly set. */
97+ private boolean isSetChallengeWindowSize = false ;
98+
9199 public static final String JSON_PROPERTY_EXECUTE_THREE_D = "executeThreeD" ;
92100 private String executeThreeD ;
93101
102+ /** Mark when the attribute has been explicitly set. */
103+ private boolean isSetExecuteThreeD = false ;
104+
94105 public static final String JSON_PROPERTY_MPI_IMPLEMENTATION_TYPE = "mpiImplementationType" ;
95106 private String mpiImplementationType ;
96107
108+ /** Mark when the attribute has been explicitly set. */
109+ private boolean isSetMpiImplementationType = false ;
110+
97111 public static final String JSON_PROPERTY_SCA_EXEMPTION = "scaExemption" ;
98112 private String scaExemption ;
99113
114+ /** Mark when the attribute has been explicitly set. */
115+ private boolean isSetScaExemption = false ;
116+
100117 public static final String JSON_PROPERTY_THREE_D_S_VERSION = "threeDSVersion" ;
101118 private String threeDSVersion ;
102119
120+ /** Mark when the attribute has been explicitly set. */
121+ private boolean isSetThreeDSVersion = false ;
122+
123+ /**
124+ * Sets whether attributes with null values should be explicitly included in the JSON payload.
125+ * Default is false.
126+ */
127+ @ JsonIgnore private boolean includeNullValues = false ;
128+
103129 public AdditionalData3DSecure () {}
104130
105131 /**
@@ -132,6 +158,7 @@ public AdditionalData3DSecure() {}
132158 */
133159 public AdditionalData3DSecure allow3DS2 (String allow3DS2 ) {
134160 this .allow3DS2 = allow3DS2 ;
161+ isSetAllow3DS2 = true ; // mark as set
135162 return this ;
136163 }
137164
@@ -199,6 +226,7 @@ public String getAllow3DS2() {
199226 @ JsonInclude (value = JsonInclude .Include .USE_DEFAULTS )
200227 public void setAllow3DS2 (String allow3DS2 ) {
201228 this .allow3DS2 = allow3DS2 ;
229+ isSetAllow3DS2 = true ; // mark as set
202230 }
203231
204232 /**
@@ -213,6 +241,7 @@ public void setAllow3DS2(String allow3DS2) {
213241 */
214242 public AdditionalData3DSecure challengeWindowSize (ChallengeWindowSizeEnum challengeWindowSize ) {
215243 this .challengeWindowSize = challengeWindowSize ;
244+ isSetChallengeWindowSize = true ; // mark as set
216245 return this ;
217246 }
218247
@@ -244,6 +273,7 @@ public ChallengeWindowSizeEnum getChallengeWindowSize() {
244273 @ JsonInclude (value = JsonInclude .Include .USE_DEFAULTS )
245274 public void setChallengeWindowSize (ChallengeWindowSizeEnum challengeWindowSize ) {
246275 this .challengeWindowSize = challengeWindowSize ;
276+ isSetChallengeWindowSize = true ; // mark as set
247277 }
248278
249279 /**
@@ -263,6 +293,7 @@ public void setChallengeWindowSize(ChallengeWindowSizeEnum challengeWindowSize)
263293 */
264294 public AdditionalData3DSecure executeThreeD (String executeThreeD ) {
265295 this .executeThreeD = executeThreeD ;
296+ isSetExecuteThreeD = true ; // mark as set
266297 return this ;
267298 }
268299
@@ -304,6 +335,7 @@ public String getExecuteThreeD() {
304335 @ JsonInclude (value = JsonInclude .Include .USE_DEFAULTS )
305336 public void setExecuteThreeD (String executeThreeD ) {
306337 this .executeThreeD = executeThreeD ;
338+ isSetExecuteThreeD = true ; // mark as set
307339 }
308340
309341 /**
@@ -314,6 +346,7 @@ public void setExecuteThreeD(String executeThreeD) {
314346 */
315347 public AdditionalData3DSecure mpiImplementationType (String mpiImplementationType ) {
316348 this .mpiImplementationType = mpiImplementationType ;
349+ isSetMpiImplementationType = true ; // mark as set
317350 return this ;
318351 }
319352
@@ -337,6 +370,7 @@ public String getMpiImplementationType() {
337370 @ JsonInclude (value = JsonInclude .Include .USE_DEFAULTS )
338371 public void setMpiImplementationType (String mpiImplementationType ) {
339372 this .mpiImplementationType = mpiImplementationType ;
373+ isSetMpiImplementationType = true ; // mark as set
340374 }
341375
342376 /**
@@ -353,6 +387,7 @@ public void setMpiImplementationType(String mpiImplementationType) {
353387 */
354388 public AdditionalData3DSecure scaExemption (String scaExemption ) {
355389 this .scaExemption = scaExemption ;
390+ isSetScaExemption = true ; // mark as set
356391 return this ;
357392 }
358393
@@ -388,6 +423,7 @@ public String getScaExemption() {
388423 @ JsonInclude (value = JsonInclude .Include .USE_DEFAULTS )
389424 public void setScaExemption (String scaExemption ) {
390425 this .scaExemption = scaExemption ;
426+ isSetScaExemption = true ; // mark as set
391427 }
392428
393429 /**
@@ -412,6 +448,7 @@ public void setScaExemption(String scaExemption) {
412448 */
413449 public AdditionalData3DSecure threeDSVersion (String threeDSVersion ) {
414450 this .threeDSVersion = threeDSVersion ;
451+ isSetThreeDSVersion = true ; // mark as set
415452 return this ;
416453 }
417454
@@ -463,6 +500,27 @@ public String getThreeDSVersion() {
463500 @ JsonInclude (value = JsonInclude .Include .USE_DEFAULTS )
464501 public void setThreeDSVersion (String threeDSVersion ) {
465502 this .threeDSVersion = threeDSVersion ;
503+ isSetThreeDSVersion = true ; // mark as set
504+ }
505+
506+ /**
507+ * Configures whether null values are explicitly serialized in the JSON payload. Default is false.
508+ */
509+ public AdditionalData3DSecure includeNullValues (boolean includeNullValues ) {
510+ this .includeNullValues = includeNullValues ;
511+ return this ;
512+ }
513+
514+ /** Returns whether null values are explicitly serialized in the JSON payload. */
515+ public boolean isIncludeNullValues () {
516+ return includeNullValues ;
517+ }
518+
519+ /**
520+ * Sets whether null values should be explicitly serialized in the JSON payload. Default is false.
521+ */
522+ public void setIncludeNullValues (boolean includeNullValues ) {
523+ this .includeNullValues = includeNullValues ;
466524 }
467525
468526 /** Return true if this AdditionalData3DSecure object is equal to o. */
@@ -476,22 +534,36 @@ public boolean equals(Object o) {
476534 }
477535 AdditionalData3DSecure additionalData3DSecure = (AdditionalData3DSecure ) o ;
478536 return Objects .equals (this .allow3DS2 , additionalData3DSecure .allow3DS2 )
537+ && Objects .equals (this .isSetAllow3DS2 , additionalData3DSecure .isSetAllow3DS2 )
479538 && Objects .equals (this .challengeWindowSize , additionalData3DSecure .challengeWindowSize )
539+ && Objects .equals (
540+ this .isSetChallengeWindowSize , additionalData3DSecure .isSetChallengeWindowSize )
480541 && Objects .equals (this .executeThreeD , additionalData3DSecure .executeThreeD )
542+ && Objects .equals (this .isSetExecuteThreeD , additionalData3DSecure .isSetExecuteThreeD )
481543 && Objects .equals (this .mpiImplementationType , additionalData3DSecure .mpiImplementationType )
544+ && Objects .equals (
545+ this .isSetMpiImplementationType , additionalData3DSecure .isSetMpiImplementationType )
482546 && Objects .equals (this .scaExemption , additionalData3DSecure .scaExemption )
483- && Objects .equals (this .threeDSVersion , additionalData3DSecure .threeDSVersion );
547+ && Objects .equals (this .isSetScaExemption , additionalData3DSecure .isSetScaExemption )
548+ && Objects .equals (this .threeDSVersion , additionalData3DSecure .threeDSVersion )
549+ && Objects .equals (this .isSetThreeDSVersion , additionalData3DSecure .isSetThreeDSVersion );
484550 }
485551
486552 @ Override
487553 public int hashCode () {
488554 return Objects .hash (
489555 allow3DS2 ,
556+ isSetAllow3DS2 ,
490557 challengeWindowSize ,
558+ isSetChallengeWindowSize ,
491559 executeThreeD ,
560+ isSetExecuteThreeD ,
492561 mpiImplementationType ,
562+ isSetMpiImplementationType ,
493563 scaExemption ,
494- threeDSVersion );
564+ isSetScaExemption ,
565+ threeDSVersion ,
566+ isSetThreeDSVersion );
495567 }
496568
497569 @ Override
@@ -522,6 +594,45 @@ private String toIndentedString(Object o) {
522594 return o .toString ().replace ("\n " , "\n " );
523595 }
524596
597+ /** Returns a map of properties to be merged into the JSON payload as explicit null values. */
598+ @ JsonInclude (JsonInclude .Include .ALWAYS )
599+ @ JsonAnyGetter
600+ public Map <String , Object > getExplicitNulls () {
601+ if (!this .includeNullValues ) {
602+ return Collections .emptyMap ();
603+ }
604+
605+ Map <String , Object > nulls = new HashMap <>();
606+
607+ if (isSetAllow3DS2 ) {
608+ addIfNull (nulls , JSON_PROPERTY_ALLOW3_D_S2 , this .allow3DS2 );
609+ }
610+ if (isSetChallengeWindowSize ) {
611+ addIfNull (nulls , JSON_PROPERTY_CHALLENGE_WINDOW_SIZE , this .challengeWindowSize );
612+ }
613+ if (isSetExecuteThreeD ) {
614+ addIfNull (nulls , JSON_PROPERTY_EXECUTE_THREE_D , this .executeThreeD );
615+ }
616+ if (isSetMpiImplementationType ) {
617+ addIfNull (nulls , JSON_PROPERTY_MPI_IMPLEMENTATION_TYPE , this .mpiImplementationType );
618+ }
619+ if (isSetScaExemption ) {
620+ addIfNull (nulls , JSON_PROPERTY_SCA_EXEMPTION , this .scaExemption );
621+ }
622+ if (isSetThreeDSVersion ) {
623+ addIfNull (nulls , JSON_PROPERTY_THREE_D_S_VERSION , this .threeDSVersion );
624+ }
625+
626+ return nulls ;
627+ }
628+
629+ // add to map when value is null
630+ private void addIfNull (Map <String , Object > map , String key , Object value ) {
631+ if (value == null ) {
632+ map .put (key , null );
633+ }
634+ }
635+
525636 /**
526637 * Create an instance of AdditionalData3DSecure given an JSON string
527638 *
0 commit comments