Skip to content

Commit a197728

Browse files
[balancecontrol] Automated update from Adyen/adyen-openapi@0a007ce
1 parent cbb82e2 commit a197728

File tree

3 files changed

+327
-6
lines changed

3 files changed

+327
-6
lines changed

src/main/java/com/adyen/model/balancecontrol/Amount.java

Lines changed: 69 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111

1212
package com.adyen.model.balancecontrol;
1313

14+
import com.fasterxml.jackson.annotation.JsonAnyGetter;
15+
import com.fasterxml.jackson.annotation.JsonIgnore;
1416
import com.fasterxml.jackson.annotation.JsonInclude;
1517
import com.fasterxml.jackson.annotation.JsonProperty;
1618
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
@@ -23,9 +25,21 @@ public class Amount {
2325
public static final String JSON_PROPERTY_CURRENCY = "currency";
2426
private String currency;
2527

28+
/** Mark when the attribute has been explicitly set. */
29+
private boolean isSetCurrency = false;
30+
2631
public static final String JSON_PROPERTY_VALUE = "value";
2732
private Long value;
2833

34+
/** Mark when the attribute has been explicitly set. */
35+
private boolean isSetValue = false;
36+
37+
/**
38+
* Sets whether attributes with null values should be explicitly included in the JSON payload.
39+
* Default is false.
40+
*/
41+
@JsonIgnore private boolean includeNullValues = false;
42+
2943
public Amount() {}
3044

3145
/**
@@ -38,6 +52,7 @@ public Amount() {}
3852
*/
3953
public Amount currency(String currency) {
4054
this.currency = currency;
55+
isSetCurrency = true; // mark as set
4156
return this;
4257
}
4358

@@ -65,6 +80,7 @@ public String getCurrency() {
6580
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
6681
public void setCurrency(String currency) {
6782
this.currency = currency;
83+
isSetCurrency = true; // mark as set
6884
}
6985

7086
/**
@@ -77,6 +93,7 @@ public void setCurrency(String currency) {
7793
*/
7894
public Amount value(Long value) {
7995
this.value = value;
96+
isSetValue = true; // mark as set
8097
return this;
8198
}
8299

@@ -104,6 +121,27 @@ public Long getValue() {
104121
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
105122
public void setValue(Long value) {
106123
this.value = value;
124+
isSetValue = true; // mark as set
125+
}
126+
127+
/**
128+
* Configures whether null values are explicitly serialized in the JSON payload. Default is false.
129+
*/
130+
public Amount includeNullValues(boolean includeNullValues) {
131+
this.includeNullValues = includeNullValues;
132+
return this;
133+
}
134+
135+
/** Returns whether null values are explicitly serialized in the JSON payload. */
136+
public boolean isIncludeNullValues() {
137+
return includeNullValues;
138+
}
139+
140+
/**
141+
* Sets whether null values should be explicitly serialized in the JSON payload. Default is false.
142+
*/
143+
public void setIncludeNullValues(boolean includeNullValues) {
144+
this.includeNullValues = includeNullValues;
107145
}
108146

109147
/** Return true if this Amount object is equal to o. */
@@ -117,12 +155,14 @@ public boolean equals(Object o) {
117155
}
118156
Amount amount = (Amount) o;
119157
return Objects.equals(this.currency, amount.currency)
120-
&& Objects.equals(this.value, amount.value);
158+
&& Objects.equals(this.isSetCurrency, amount.isSetCurrency)
159+
&& Objects.equals(this.value, amount.value)
160+
&& Objects.equals(this.isSetValue, amount.isSetValue);
121161
}
122162

123163
@Override
124164
public int hashCode() {
125-
return Objects.hash(currency, value);
165+
return Objects.hash(currency, isSetCurrency, value, isSetValue);
126166
}
127167

128168
@Override
@@ -145,6 +185,33 @@ private String toIndentedString(Object o) {
145185
return o.toString().replace("\n", "\n ");
146186
}
147187

188+
/** Returns a map of properties to be merged into the JSON payload as explicit null values. */
189+
@JsonInclude(JsonInclude.Include.ALWAYS)
190+
@JsonAnyGetter
191+
public Map<String, Object> getExplicitNulls() {
192+
if (!this.includeNullValues) {
193+
return Collections.emptyMap();
194+
}
195+
196+
Map<String, Object> nulls = new HashMap<>();
197+
198+
if (isSetCurrency) {
199+
addIfNull(nulls, JSON_PROPERTY_CURRENCY, this.currency);
200+
}
201+
if (isSetValue) {
202+
addIfNull(nulls, JSON_PROPERTY_VALUE, this.value);
203+
}
204+
205+
return nulls;
206+
}
207+
208+
// add to map when value is null
209+
private void addIfNull(Map<String, Object> map, String key, Object value) {
210+
if (value == null) {
211+
map.put(key, null);
212+
}
213+
}
214+
148215
/**
149216
* Create an instance of Amount given an JSON string
150217
*

src/main/java/com/adyen/model/balancecontrol/BalanceTransferRequest.java

Lines changed: 117 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@
1111

1212
package com.adyen.model.balancecontrol;
1313

14+
import com.fasterxml.jackson.annotation.JsonAnyGetter;
1415
import com.fasterxml.jackson.annotation.JsonCreator;
16+
import com.fasterxml.jackson.annotation.JsonIgnore;
1517
import com.fasterxml.jackson.annotation.JsonInclude;
1618
import com.fasterxml.jackson.annotation.JsonProperty;
1719
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
@@ -34,18 +36,33 @@ public class BalanceTransferRequest {
3436
public static final String JSON_PROPERTY_AMOUNT = "amount";
3537
private Amount amount;
3638

39+
/** Mark when the attribute has been explicitly set. */
40+
private boolean isSetAmount = false;
41+
3742
public static final String JSON_PROPERTY_DESCRIPTION = "description";
3843
private String description;
3944

45+
/** Mark when the attribute has been explicitly set. */
46+
private boolean isSetDescription = false;
47+
4048
public static final String JSON_PROPERTY_FROM_MERCHANT = "fromMerchant";
4149
private String fromMerchant;
4250

51+
/** Mark when the attribute has been explicitly set. */
52+
private boolean isSetFromMerchant = false;
53+
4354
public static final String JSON_PROPERTY_REFERENCE = "reference";
4455
private String reference;
4556

57+
/** Mark when the attribute has been explicitly set. */
58+
private boolean isSetReference = false;
59+
4660
public static final String JSON_PROPERTY_TO_MERCHANT = "toMerchant";
4761
private String toMerchant;
4862

63+
/** Mark when the attribute has been explicitly set. */
64+
private boolean isSetToMerchant = false;
65+
4966
/**
5067
* The type of balance transfer. Possible values: **tax**, **fee**, **terminalSale**, **credit**,
5168
* **debit**, and **adjustment**.
@@ -101,6 +118,15 @@ public static TypeEnum fromValue(String value) {
101118
public static final String JSON_PROPERTY_TYPE = "type";
102119
private TypeEnum type;
103120

121+
/** Mark when the attribute has been explicitly set. */
122+
private boolean isSetType = false;
123+
124+
/**
125+
* Sets whether attributes with null values should be explicitly included in the JSON payload.
126+
* Default is false.
127+
*/
128+
@JsonIgnore private boolean includeNullValues = false;
129+
104130
public BalanceTransferRequest() {}
105131

106132
/**
@@ -111,6 +137,7 @@ public BalanceTransferRequest() {}
111137
*/
112138
public BalanceTransferRequest amount(Amount amount) {
113139
this.amount = amount;
140+
isSetAmount = true; // mark as set
114141
return this;
115142
}
116143

@@ -134,6 +161,7 @@ public Amount getAmount() {
134161
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
135162
public void setAmount(Amount amount) {
136163
this.amount = amount;
164+
isSetAmount = true; // mark as set
137165
}
138166

139167
/**
@@ -147,6 +175,7 @@ public void setAmount(Amount amount) {
147175
*/
148176
public BalanceTransferRequest description(String description) {
149177
this.description = description;
178+
isSetDescription = true; // mark as set
150179
return this;
151180
}
152181

@@ -176,6 +205,7 @@ public String getDescription() {
176205
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
177206
public void setDescription(String description) {
178207
this.description = description;
208+
isSetDescription = true; // mark as set
179209
}
180210

181211
/**
@@ -187,6 +217,7 @@ public void setDescription(String description) {
187217
*/
188218
public BalanceTransferRequest fromMerchant(String fromMerchant) {
189219
this.fromMerchant = fromMerchant;
220+
isSetFromMerchant = true; // mark as set
190221
return this;
191222
}
192223

@@ -212,6 +243,7 @@ public String getFromMerchant() {
212243
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
213244
public void setFromMerchant(String fromMerchant) {
214245
this.fromMerchant = fromMerchant;
246+
isSetFromMerchant = true; // mark as set
215247
}
216248

217249
/**
@@ -224,6 +256,7 @@ public void setFromMerchant(String fromMerchant) {
224256
*/
225257
public BalanceTransferRequest reference(String reference) {
226258
this.reference = reference;
259+
isSetReference = true; // mark as set
227260
return this;
228261
}
229262

@@ -251,6 +284,7 @@ public String getReference() {
251284
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
252285
public void setReference(String reference) {
253286
this.reference = reference;
287+
isSetReference = true; // mark as set
254288
}
255289

256290
/**
@@ -262,6 +296,7 @@ public void setReference(String reference) {
262296
*/
263297
public BalanceTransferRequest toMerchant(String toMerchant) {
264298
this.toMerchant = toMerchant;
299+
isSetToMerchant = true; // mark as set
265300
return this;
266301
}
267302

@@ -287,6 +322,7 @@ public String getToMerchant() {
287322
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
288323
public void setToMerchant(String toMerchant) {
289324
this.toMerchant = toMerchant;
325+
isSetToMerchant = true; // mark as set
290326
}
291327

292328
/**
@@ -299,6 +335,7 @@ public void setToMerchant(String toMerchant) {
299335
*/
300336
public BalanceTransferRequest type(TypeEnum type) {
301337
this.type = type;
338+
isSetType = true; // mark as set
302339
return this;
303340
}
304341

@@ -326,6 +363,27 @@ public TypeEnum getType() {
326363
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
327364
public void setType(TypeEnum type) {
328365
this.type = type;
366+
isSetType = true; // mark as set
367+
}
368+
369+
/**
370+
* Configures whether null values are explicitly serialized in the JSON payload. Default is false.
371+
*/
372+
public BalanceTransferRequest includeNullValues(boolean includeNullValues) {
373+
this.includeNullValues = includeNullValues;
374+
return this;
375+
}
376+
377+
/** Returns whether null values are explicitly serialized in the JSON payload. */
378+
public boolean isIncludeNullValues() {
379+
return includeNullValues;
380+
}
381+
382+
/**
383+
* Sets whether null values should be explicitly serialized in the JSON payload. Default is false.
384+
*/
385+
public void setIncludeNullValues(boolean includeNullValues) {
386+
this.includeNullValues = includeNullValues;
329387
}
330388

331389
/** Return true if this BalanceTransferRequest object is equal to o. */
@@ -339,16 +397,34 @@ public boolean equals(Object o) {
339397
}
340398
BalanceTransferRequest balanceTransferRequest = (BalanceTransferRequest) o;
341399
return Objects.equals(this.amount, balanceTransferRequest.amount)
400+
&& Objects.equals(this.isSetAmount, balanceTransferRequest.isSetAmount)
342401
&& Objects.equals(this.description, balanceTransferRequest.description)
402+
&& Objects.equals(this.isSetDescription, balanceTransferRequest.isSetDescription)
343403
&& Objects.equals(this.fromMerchant, balanceTransferRequest.fromMerchant)
404+
&& Objects.equals(this.isSetFromMerchant, balanceTransferRequest.isSetFromMerchant)
344405
&& Objects.equals(this.reference, balanceTransferRequest.reference)
406+
&& Objects.equals(this.isSetReference, balanceTransferRequest.isSetReference)
345407
&& Objects.equals(this.toMerchant, balanceTransferRequest.toMerchant)
346-
&& Objects.equals(this.type, balanceTransferRequest.type);
408+
&& Objects.equals(this.isSetToMerchant, balanceTransferRequest.isSetToMerchant)
409+
&& Objects.equals(this.type, balanceTransferRequest.type)
410+
&& Objects.equals(this.isSetType, balanceTransferRequest.isSetType);
347411
}
348412

349413
@Override
350414
public int hashCode() {
351-
return Objects.hash(amount, description, fromMerchant, reference, toMerchant, type);
415+
return Objects.hash(
416+
amount,
417+
isSetAmount,
418+
description,
419+
isSetDescription,
420+
fromMerchant,
421+
isSetFromMerchant,
422+
reference,
423+
isSetReference,
424+
toMerchant,
425+
isSetToMerchant,
426+
type,
427+
isSetType);
352428
}
353429

354430
@Override
@@ -375,6 +451,45 @@ private String toIndentedString(Object o) {
375451
return o.toString().replace("\n", "\n ");
376452
}
377453

454+
/** Returns a map of properties to be merged into the JSON payload as explicit null values. */
455+
@JsonInclude(JsonInclude.Include.ALWAYS)
456+
@JsonAnyGetter
457+
public Map<String, Object> getExplicitNulls() {
458+
if (!this.includeNullValues) {
459+
return Collections.emptyMap();
460+
}
461+
462+
Map<String, Object> nulls = new HashMap<>();
463+
464+
if (isSetAmount) {
465+
addIfNull(nulls, JSON_PROPERTY_AMOUNT, this.amount);
466+
}
467+
if (isSetDescription) {
468+
addIfNull(nulls, JSON_PROPERTY_DESCRIPTION, this.description);
469+
}
470+
if (isSetFromMerchant) {
471+
addIfNull(nulls, JSON_PROPERTY_FROM_MERCHANT, this.fromMerchant);
472+
}
473+
if (isSetReference) {
474+
addIfNull(nulls, JSON_PROPERTY_REFERENCE, this.reference);
475+
}
476+
if (isSetToMerchant) {
477+
addIfNull(nulls, JSON_PROPERTY_TO_MERCHANT, this.toMerchant);
478+
}
479+
if (isSetType) {
480+
addIfNull(nulls, JSON_PROPERTY_TYPE, this.type);
481+
}
482+
483+
return nulls;
484+
}
485+
486+
// add to map when value is null
487+
private void addIfNull(Map<String, Object> map, String key, Object value) {
488+
if (value == null) {
489+
map.put(key, null);
490+
}
491+
}
492+
378493
/**
379494
* Create an instance of BalanceTransferRequest given an JSON string
380495
*

0 commit comments

Comments
 (0)