Skip to content

Commit e38a883

Browse files
committed
Generate BalanceWebhooks models
1 parent dbbaa4b commit e38a883

9 files changed

+1851
-0
lines changed
Lines changed: 238 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,238 @@
1+
/*
2+
* Balance webhook
3+
*
4+
* The version of the OpenAPI document: 1
5+
*
6+
*
7+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
8+
* https://openapi-generator.tech
9+
* Do not edit the class manually.
10+
*/
11+
12+
package com.adyen.model.balancewebhooks;
13+
14+
import com.fasterxml.jackson.annotation.JsonAnyGetter;
15+
import com.fasterxml.jackson.annotation.JsonIgnore;
16+
import com.fasterxml.jackson.annotation.JsonInclude;
17+
import com.fasterxml.jackson.annotation.JsonProperty;
18+
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
19+
import com.fasterxml.jackson.core.JsonProcessingException;
20+
import java.util.*;
21+
22+
/** Amount */
23+
@JsonPropertyOrder({Amount.JSON_PROPERTY_CURRENCY, Amount.JSON_PROPERTY_VALUE})
24+
public class Amount {
25+
public static final String JSON_PROPERTY_CURRENCY = "currency";
26+
private String currency;
27+
28+
/** Mark when the attribute has been explicitly set. */
29+
private boolean isSetCurrency = false;
30+
31+
public static final String JSON_PROPERTY_VALUE = "value";
32+
private Long value;
33+
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+
43+
public Amount() {}
44+
45+
/**
46+
* The three-character [ISO currency
47+
* code](https://docs.adyen.com/development-resources/currency-codes#currency-codes) of the
48+
* amount.
49+
*
50+
* @param currency The three-character [ISO currency
51+
* code](https://docs.adyen.com/development-resources/currency-codes#currency-codes) of the
52+
* amount.
53+
* @return the current {@code Amount} instance, allowing for method chaining
54+
*/
55+
public Amount currency(String currency) {
56+
this.currency = currency;
57+
isSetCurrency = true; // mark as set
58+
return this;
59+
}
60+
61+
/**
62+
* The three-character [ISO currency
63+
* code](https://docs.adyen.com/development-resources/currency-codes#currency-codes) of the
64+
* amount.
65+
*
66+
* @return currency The three-character [ISO currency
67+
* code](https://docs.adyen.com/development-resources/currency-codes#currency-codes) of the
68+
* amount.
69+
*/
70+
@JsonProperty(JSON_PROPERTY_CURRENCY)
71+
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
72+
public String getCurrency() {
73+
return currency;
74+
}
75+
76+
/**
77+
* The three-character [ISO currency
78+
* code](https://docs.adyen.com/development-resources/currency-codes#currency-codes) of the
79+
* amount.
80+
*
81+
* @param currency The three-character [ISO currency
82+
* code](https://docs.adyen.com/development-resources/currency-codes#currency-codes) of the
83+
* amount.
84+
*/
85+
@JsonProperty(JSON_PROPERTY_CURRENCY)
86+
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
87+
public void setCurrency(String currency) {
88+
this.currency = currency;
89+
isSetCurrency = true; // mark as set
90+
}
91+
92+
/**
93+
* The numeric value of the amount, in [minor
94+
* units](https://docs.adyen.com/development-resources/currency-codes#minor-units).
95+
*
96+
* @param value The numeric value of the amount, in [minor
97+
* units](https://docs.adyen.com/development-resources/currency-codes#minor-units).
98+
* @return the current {@code Amount} instance, allowing for method chaining
99+
*/
100+
public Amount value(Long value) {
101+
this.value = value;
102+
isSetValue = true; // mark as set
103+
return this;
104+
}
105+
106+
/**
107+
* The numeric value of the amount, in [minor
108+
* units](https://docs.adyen.com/development-resources/currency-codes#minor-units).
109+
*
110+
* @return value The numeric value of the amount, in [minor
111+
* units](https://docs.adyen.com/development-resources/currency-codes#minor-units).
112+
*/
113+
@JsonProperty(JSON_PROPERTY_VALUE)
114+
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
115+
public Long getValue() {
116+
return value;
117+
}
118+
119+
/**
120+
* The numeric value of the amount, in [minor
121+
* units](https://docs.adyen.com/development-resources/currency-codes#minor-units).
122+
*
123+
* @param value The numeric value of the amount, in [minor
124+
* units](https://docs.adyen.com/development-resources/currency-codes#minor-units).
125+
*/
126+
@JsonProperty(JSON_PROPERTY_VALUE)
127+
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
128+
public void setValue(Long value) {
129+
this.value = value;
130+
isSetValue = true; // mark as set
131+
}
132+
133+
/**
134+
* Configures whether null values are explicitly serialized in the JSON payload. Default is false.
135+
*/
136+
public Amount includeNullValues(boolean includeNullValues) {
137+
this.includeNullValues = includeNullValues;
138+
return this;
139+
}
140+
141+
/** Returns whether null values are explicitly serialized in the JSON payload. */
142+
public boolean isIncludeNullValues() {
143+
return includeNullValues;
144+
}
145+
146+
/**
147+
* Sets whether null values should be explicitly serialized in the JSON payload. Default is false.
148+
*/
149+
public void setIncludeNullValues(boolean includeNullValues) {
150+
this.includeNullValues = includeNullValues;
151+
}
152+
153+
/** Return true if this Amount object is equal to o. */
154+
@Override
155+
public boolean equals(Object o) {
156+
if (this == o) {
157+
return true;
158+
}
159+
if (o == null || getClass() != o.getClass()) {
160+
return false;
161+
}
162+
Amount amount = (Amount) o;
163+
return Objects.equals(this.currency, amount.currency)
164+
&& Objects.equals(this.value, amount.value);
165+
}
166+
167+
@Override
168+
public int hashCode() {
169+
return Objects.hash(currency, value);
170+
}
171+
172+
@Override
173+
public String toString() {
174+
StringBuilder sb = new StringBuilder();
175+
sb.append("class Amount {\n");
176+
sb.append(" currency: ").append(toIndentedString(currency)).append("\n");
177+
sb.append(" value: ").append(toIndentedString(value)).append("\n");
178+
sb.append("}");
179+
return sb.toString();
180+
}
181+
182+
/**
183+
* Convert the given object to string with each line indented by 4 spaces (except the first line).
184+
*/
185+
private String toIndentedString(Object o) {
186+
if (o == null) {
187+
return "null";
188+
}
189+
return o.toString().replace("\n", "\n ");
190+
}
191+
192+
/** Returns a map of properties to be merged into the JSON payload as explicit null values. */
193+
@JsonInclude(JsonInclude.Include.ALWAYS)
194+
@JsonAnyGetter
195+
public Map<String, Object> getExplicitNulls() {
196+
if (!this.includeNullValues) {
197+
return Collections.emptyMap();
198+
}
199+
200+
Map<String, Object> nulls = new HashMap<>();
201+
202+
if (isSetCurrency) {
203+
addIfNull(nulls, JSON_PROPERTY_CURRENCY, this.currency);
204+
}
205+
if (isSetValue) {
206+
addIfNull(nulls, JSON_PROPERTY_VALUE, this.value);
207+
}
208+
209+
return nulls;
210+
}
211+
212+
// add to map when value is null
213+
private void addIfNull(Map<String, Object> map, String key, Object value) {
214+
if (value == null) {
215+
map.put(key, null);
216+
}
217+
}
218+
219+
/**
220+
* Create an instance of Amount given an JSON string
221+
*
222+
* @param jsonString JSON string
223+
* @return An instance of Amount
224+
* @throws JsonProcessingException if the JSON string is invalid with respect to Amount
225+
*/
226+
public static Amount fromJson(String jsonString) throws JsonProcessingException {
227+
return JSON.getMapper().readValue(jsonString, Amount.class);
228+
}
229+
230+
/**
231+
* Convert an instance of Amount to an JSON string
232+
*
233+
* @return JSON string
234+
*/
235+
public String toJson() throws JsonProcessingException {
236+
return JSON.getMapper().writeValueAsString(this);
237+
}
238+
}

0 commit comments

Comments
 (0)