diff --git a/src/main/java/com/adyen/model/capital/Amount.java b/src/main/java/com/adyen/model/capital/Amount.java index 96588cdf7..d7df3b1fd 100644 --- a/src/main/java/com/adyen/model/capital/Amount.java +++ b/src/main/java/com/adyen/model/capital/Amount.java @@ -44,10 +44,12 @@ public Amount() {} /** * The three-character [ISO currency - * code](https://docs.adyen.com/development-resources/currency-codes#currency-codes). + * code](https://docs.adyen.com/development-resources/currency-codes#currency-codes) of the + * amount. * * @param currency The three-character [ISO currency - * code](https://docs.adyen.com/development-resources/currency-codes#currency-codes). + * code](https://docs.adyen.com/development-resources/currency-codes#currency-codes) of the + * amount. * @return the current {@code Amount} instance, allowing for method chaining */ public Amount currency(String currency) { @@ -58,10 +60,12 @@ public Amount currency(String currency) { /** * The three-character [ISO currency - * code](https://docs.adyen.com/development-resources/currency-codes#currency-codes). + * code](https://docs.adyen.com/development-resources/currency-codes#currency-codes) of the + * amount. * * @return currency The three-character [ISO currency - * code](https://docs.adyen.com/development-resources/currency-codes#currency-codes). + * code](https://docs.adyen.com/development-resources/currency-codes#currency-codes) of the + * amount. */ @JsonProperty(JSON_PROPERTY_CURRENCY) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -71,10 +75,12 @@ public String getCurrency() { /** * The three-character [ISO currency - * code](https://docs.adyen.com/development-resources/currency-codes#currency-codes). + * code](https://docs.adyen.com/development-resources/currency-codes#currency-codes) of the + * amount. * * @param currency The three-character [ISO currency - * code](https://docs.adyen.com/development-resources/currency-codes#currency-codes). + * code](https://docs.adyen.com/development-resources/currency-codes#currency-codes) of the + * amount. */ @JsonProperty(JSON_PROPERTY_CURRENCY) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -84,10 +90,10 @@ public void setCurrency(String currency) { } /** - * The amount of the transaction, in [minor + * The numeric value of the amount, in [minor * units](https://docs.adyen.com/development-resources/currency-codes#minor-units). * - * @param value The amount of the transaction, in [minor + * @param value The numeric value of the amount, in [minor * units](https://docs.adyen.com/development-resources/currency-codes#minor-units). * @return the current {@code Amount} instance, allowing for method chaining */ @@ -98,10 +104,10 @@ public Amount value(Long value) { } /** - * The amount of the transaction, in [minor + * The numeric value of the amount, in [minor * units](https://docs.adyen.com/development-resources/currency-codes#minor-units). * - * @return value The amount of the transaction, in [minor + * @return value The numeric value of the amount, in [minor * units](https://docs.adyen.com/development-resources/currency-codes#minor-units). */ @JsonProperty(JSON_PROPERTY_VALUE) @@ -111,10 +117,10 @@ public Long getValue() { } /** - * The amount of the transaction, in [minor + * The numeric value of the amount, in [minor * units](https://docs.adyen.com/development-resources/currency-codes#minor-units). * - * @param value The amount of the transaction, in [minor + * @param value The numeric value of the amount, in [minor * units](https://docs.adyen.com/development-resources/currency-codes#minor-units). */ @JsonProperty(JSON_PROPERTY_VALUE) diff --git a/src/main/java/com/adyen/model/capital/Grant.java b/src/main/java/com/adyen/model/capital/Grant.java index 2171905db..4da3e88f7 100644 --- a/src/main/java/com/adyen/model/capital/Grant.java +++ b/src/main/java/com/adyen/model/capital/Grant.java @@ -21,7 +21,6 @@ /** Grant */ @JsonPropertyOrder({ - Grant.JSON_PROPERTY_AMOUNT, Grant.JSON_PROPERTY_BALANCES, Grant.JSON_PROPERTY_COUNTERPARTY, Grant.JSON_PROPERTY_GRANT_ACCOUNT_ID, @@ -30,12 +29,6 @@ Grant.JSON_PROPERTY_STATUS }) public class Grant { - public static final String JSON_PROPERTY_AMOUNT = "amount"; - private Amount amount; - - /** Mark when the attribute has been explicitly set. */ - private boolean isSetAmount = false; - public static final String JSON_PROPERTY_BALANCES = "balances"; private Balance balances; @@ -43,7 +36,7 @@ public class Grant { private boolean isSetBalances = false; public static final String JSON_PROPERTY_COUNTERPARTY = "counterparty"; - private Counterparty counterparty; + private GrantCounterparty counterparty; /** Mark when the attribute has been explicitly set. */ private boolean isSetCounterparty = false; @@ -80,41 +73,6 @@ public class Grant { public Grant() {} - /** - * amount - * - * @param amount - * @return the current {@code Grant} instance, allowing for method chaining - */ - public Grant amount(Amount amount) { - this.amount = amount; - isSetAmount = true; // mark as set - return this; - } - - /** - * Get amount - * - * @return amount - */ - @JsonProperty(JSON_PROPERTY_AMOUNT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Amount getAmount() { - return amount; - } - - /** - * amount - * - * @param amount - */ - @JsonProperty(JSON_PROPERTY_AMOUNT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setAmount(Amount amount) { - this.amount = amount; - isSetAmount = true; // mark as set - } - /** * balances * @@ -156,7 +114,7 @@ public void setBalances(Balance balances) { * @param counterparty * @return the current {@code Grant} instance, allowing for method chaining */ - public Grant counterparty(Counterparty counterparty) { + public Grant counterparty(GrantCounterparty counterparty) { this.counterparty = counterparty; isSetCounterparty = true; // mark as set return this; @@ -169,7 +127,7 @@ public Grant counterparty(Counterparty counterparty) { */ @JsonProperty(JSON_PROPERTY_COUNTERPARTY) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Counterparty getCounterparty() { + public GrantCounterparty getCounterparty() { return counterparty; } @@ -180,7 +138,7 @@ public Counterparty getCounterparty() { */ @JsonProperty(JSON_PROPERTY_COUNTERPARTY) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setCounterparty(Counterparty counterparty) { + public void setCounterparty(GrantCounterparty counterparty) { this.counterparty = counterparty; isSetCounterparty = true; // mark as set } @@ -361,9 +319,7 @@ public boolean equals(Object o) { return false; } Grant grant = (Grant) o; - return Objects.equals(this.amount, grant.amount) - && Objects.equals(this.isSetAmount, grant.isSetAmount) - && Objects.equals(this.balances, grant.balances) + return Objects.equals(this.balances, grant.balances) && Objects.equals(this.isSetBalances, grant.isSetBalances) && Objects.equals(this.counterparty, grant.counterparty) && Objects.equals(this.isSetCounterparty, grant.isSetCounterparty) @@ -380,8 +336,6 @@ public boolean equals(Object o) { @Override public int hashCode() { return Objects.hash( - amount, - isSetAmount, balances, isSetBalances, counterparty, @@ -400,7 +354,6 @@ public int hashCode() { public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class Grant {\n"); - sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); sb.append(" balances: ").append(toIndentedString(balances)).append("\n"); sb.append(" counterparty: ").append(toIndentedString(counterparty)).append("\n"); sb.append(" grantAccountId: ").append(toIndentedString(grantAccountId)).append("\n"); @@ -431,9 +384,6 @@ public Map getExplicitNulls() { Map nulls = new HashMap<>(); - if (isSetAmount) { - addIfNull(nulls, JSON_PROPERTY_AMOUNT, this.amount); - } if (isSetBalances) { addIfNull(nulls, JSON_PROPERTY_BALANCES, this.balances); } diff --git a/src/main/java/com/adyen/model/capital/Counterparty.java b/src/main/java/com/adyen/model/capital/GrantCounterparty.java similarity index 76% rename from src/main/java/com/adyen/model/capital/Counterparty.java rename to src/main/java/com/adyen/model/capital/GrantCounterparty.java index 84cc5ee2c..b9d3904f0 100644 --- a/src/main/java/com/adyen/model/capital/Counterparty.java +++ b/src/main/java/com/adyen/model/capital/GrantCounterparty.java @@ -19,13 +19,13 @@ import com.fasterxml.jackson.core.JsonProcessingException; import java.util.*; -/** Counterparty */ +/** GrantCounterparty */ @JsonPropertyOrder({ - Counterparty.JSON_PROPERTY_ACCOUNT_HOLDER_ID, - Counterparty.JSON_PROPERTY_BALANCE_ACCOUNT_ID, - Counterparty.JSON_PROPERTY_TRANSFER_INSTRUMENT_ID + GrantCounterparty.JSON_PROPERTY_ACCOUNT_HOLDER_ID, + GrantCounterparty.JSON_PROPERTY_BALANCE_ACCOUNT_ID, + GrantCounterparty.JSON_PROPERTY_TRANSFER_INSTRUMENT_ID }) -public class Counterparty { +public class GrantCounterparty { public static final String JSON_PROPERTY_ACCOUNT_HOLDER_ID = "accountHolderId"; private String accountHolderId; @@ -50,32 +50,24 @@ public class Counterparty { */ @JsonIgnore private boolean includeNullValues = false; - public Counterparty() {} + public GrantCounterparty() {} /** - * The unique identifier of the account holder that receives the grant. If no - * `balanceAccountId` is provided, the grant funds are disbursed to the primary balance - * account of this account holder. + * The unique identifier of the account holder that receives the grant. * - * @param accountHolderId The unique identifier of the account holder that receives the grant. If - * no `balanceAccountId` is provided, the grant funds are disbursed to the primary - * balance account of this account holder. - * @return the current {@code Counterparty} instance, allowing for method chaining + * @param accountHolderId The unique identifier of the account holder that receives the grant. + * @return the current {@code GrantCounterparty} instance, allowing for method chaining */ - public Counterparty accountHolderId(String accountHolderId) { + public GrantCounterparty accountHolderId(String accountHolderId) { this.accountHolderId = accountHolderId; isSetAccountHolderId = true; // mark as set return this; } /** - * The unique identifier of the account holder that receives the grant. If no - * `balanceAccountId` is provided, the grant funds are disbursed to the primary balance - * account of this account holder. + * The unique identifier of the account holder that receives the grant. * - * @return accountHolderId The unique identifier of the account holder that receives the grant. If - * no `balanceAccountId` is provided, the grant funds are disbursed to the primary - * balance account of this account holder. + * @return accountHolderId The unique identifier of the account holder that receives the grant. */ @JsonProperty(JSON_PROPERTY_ACCOUNT_HOLDER_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -84,13 +76,9 @@ public String getAccountHolderId() { } /** - * The unique identifier of the account holder that receives the grant. If no - * `balanceAccountId` is provided, the grant funds are disbursed to the primary balance - * account of this account holder. + * The unique identifier of the account holder that receives the grant. * - * @param accountHolderId The unique identifier of the account holder that receives the grant. If - * no `balanceAccountId` is provided, the grant funds are disbursed to the primary - * balance account of this account holder. + * @param accountHolderId The unique identifier of the account holder that receives the grant. */ @JsonProperty(JSON_PROPERTY_ACCOUNT_HOLDER_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -105,9 +93,9 @@ public void setAccountHolderId(String accountHolderId) { * * @param balanceAccountId The unique identifier of the balance account where the funds are * disbursed. The balance account must belong to the specified account holder. - * @return the current {@code Counterparty} instance, allowing for method chaining + * @return the current {@code GrantCounterparty} instance, allowing for method chaining */ - public Counterparty balanceAccountId(String balanceAccountId) { + public GrantCounterparty balanceAccountId(String balanceAccountId) { this.balanceAccountId = balanceAccountId; isSetBalanceAccountId = true; // mark as set return this; @@ -147,9 +135,9 @@ public void setBalanceAccountId(String balanceAccountId) { * @param transferInstrumentId The unique identifier of the transfer instrument where the funds * are disbursed. The transfer instrument must belong to the legal entity of the specified * account holder. - * @return the current {@code Counterparty} instance, allowing for method chaining + * @return the current {@code GrantCounterparty} instance, allowing for method chaining */ - public Counterparty transferInstrumentId(String transferInstrumentId) { + public GrantCounterparty transferInstrumentId(String transferInstrumentId) { this.transferInstrumentId = transferInstrumentId; isSetTransferInstrumentId = true; // mark as set return this; @@ -187,7 +175,7 @@ public void setTransferInstrumentId(String transferInstrumentId) { /** * Configures whether null values are explicitly serialized in the JSON payload. Default is false. */ - public Counterparty includeNullValues(boolean includeNullValues) { + public GrantCounterparty includeNullValues(boolean includeNullValues) { this.includeNullValues = includeNullValues; return this; } @@ -204,7 +192,7 @@ public void setIncludeNullValues(boolean includeNullValues) { this.includeNullValues = includeNullValues; } - /** Return true if this Counterparty object is equal to o. */ + /** Return true if this GrantCounterparty object is equal to o. */ @Override public boolean equals(Object o) { if (this == o) { @@ -213,13 +201,14 @@ public boolean equals(Object o) { if (o == null || getClass() != o.getClass()) { return false; } - Counterparty counterparty = (Counterparty) o; - return Objects.equals(this.accountHolderId, counterparty.accountHolderId) - && Objects.equals(this.isSetAccountHolderId, counterparty.isSetAccountHolderId) - && Objects.equals(this.balanceAccountId, counterparty.balanceAccountId) - && Objects.equals(this.isSetBalanceAccountId, counterparty.isSetBalanceAccountId) - && Objects.equals(this.transferInstrumentId, counterparty.transferInstrumentId) - && Objects.equals(this.isSetTransferInstrumentId, counterparty.isSetTransferInstrumentId); + GrantCounterparty grantCounterparty = (GrantCounterparty) o; + return Objects.equals(this.accountHolderId, grantCounterparty.accountHolderId) + && Objects.equals(this.isSetAccountHolderId, grantCounterparty.isSetAccountHolderId) + && Objects.equals(this.balanceAccountId, grantCounterparty.balanceAccountId) + && Objects.equals(this.isSetBalanceAccountId, grantCounterparty.isSetBalanceAccountId) + && Objects.equals(this.transferInstrumentId, grantCounterparty.transferInstrumentId) + && Objects.equals( + this.isSetTransferInstrumentId, grantCounterparty.isSetTransferInstrumentId); } @Override @@ -236,7 +225,7 @@ public int hashCode() { @Override public String toString() { StringBuilder sb = new StringBuilder(); - sb.append("class Counterparty {\n"); + sb.append("class GrantCounterparty {\n"); sb.append(" accountHolderId: ").append(toIndentedString(accountHolderId)).append("\n"); sb.append(" balanceAccountId: ").append(toIndentedString(balanceAccountId)).append("\n"); sb.append(" transferInstrumentId: ") @@ -287,18 +276,18 @@ private void addIfNull(Map map, String key, Object value) { } /** - * Create an instance of Counterparty given an JSON string + * Create an instance of GrantCounterparty given an JSON string * * @param jsonString JSON string - * @return An instance of Counterparty - * @throws JsonProcessingException if the JSON string is invalid with respect to Counterparty + * @return An instance of GrantCounterparty + * @throws JsonProcessingException if the JSON string is invalid with respect to GrantCounterparty */ - public static Counterparty fromJson(String jsonString) throws JsonProcessingException { - return JSON.getMapper().readValue(jsonString, Counterparty.class); + public static GrantCounterparty fromJson(String jsonString) throws JsonProcessingException { + return JSON.getMapper().readValue(jsonString, GrantCounterparty.class); } /** - * Convert an instance of Counterparty to an JSON string + * Convert an instance of GrantCounterparty to an JSON string * * @return JSON string */ diff --git a/src/main/java/com/adyen/model/capital/GrantInfo.java b/src/main/java/com/adyen/model/capital/GrantInfo.java index 256425a7b..8a284d2a2 100644 --- a/src/main/java/com/adyen/model/capital/GrantInfo.java +++ b/src/main/java/com/adyen/model/capital/GrantInfo.java @@ -21,20 +21,13 @@ /** GrantInfo */ @JsonPropertyOrder({ - GrantInfo.JSON_PROPERTY_AMOUNT, GrantInfo.JSON_PROPERTY_COUNTERPARTY, GrantInfo.JSON_PROPERTY_GRANT_ACCOUNT_ID, GrantInfo.JSON_PROPERTY_GRANT_OFFER_ID }) public class GrantInfo { - public static final String JSON_PROPERTY_AMOUNT = "amount"; - private Amount amount; - - /** Mark when the attribute has been explicitly set. */ - private boolean isSetAmount = false; - public static final String JSON_PROPERTY_COUNTERPARTY = "counterparty"; - private Counterparty counterparty; + private GrantInfoCounterparty counterparty; /** Mark when the attribute has been explicitly set. */ private boolean isSetCounterparty = false; @@ -59,48 +52,13 @@ public class GrantInfo { public GrantInfo() {} - /** - * amount - * - * @param amount - * @return the current {@code GrantInfo} instance, allowing for method chaining - */ - public GrantInfo amount(Amount amount) { - this.amount = amount; - isSetAmount = true; // mark as set - return this; - } - - /** - * Get amount - * - * @return amount - */ - @JsonProperty(JSON_PROPERTY_AMOUNT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Amount getAmount() { - return amount; - } - - /** - * amount - * - * @param amount - */ - @JsonProperty(JSON_PROPERTY_AMOUNT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setAmount(Amount amount) { - this.amount = amount; - isSetAmount = true; // mark as set - } - /** * counterparty * * @param counterparty * @return the current {@code GrantInfo} instance, allowing for method chaining */ - public GrantInfo counterparty(Counterparty counterparty) { + public GrantInfo counterparty(GrantInfoCounterparty counterparty) { this.counterparty = counterparty; isSetCounterparty = true; // mark as set return this; @@ -113,7 +71,7 @@ public GrantInfo counterparty(Counterparty counterparty) { */ @JsonProperty(JSON_PROPERTY_COUNTERPARTY) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Counterparty getCounterparty() { + public GrantInfoCounterparty getCounterparty() { return counterparty; } @@ -124,7 +82,7 @@ public Counterparty getCounterparty() { */ @JsonProperty(JSON_PROPERTY_COUNTERPARTY) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setCounterparty(Counterparty counterparty) { + public void setCounterparty(GrantInfoCounterparty counterparty) { this.counterparty = counterparty; isSetCounterparty = true; // mark as set } @@ -235,9 +193,7 @@ public boolean equals(Object o) { return false; } GrantInfo grantInfo = (GrantInfo) o; - return Objects.equals(this.amount, grantInfo.amount) - && Objects.equals(this.isSetAmount, grantInfo.isSetAmount) - && Objects.equals(this.counterparty, grantInfo.counterparty) + return Objects.equals(this.counterparty, grantInfo.counterparty) && Objects.equals(this.isSetCounterparty, grantInfo.isSetCounterparty) && Objects.equals(this.grantAccountId, grantInfo.grantAccountId) && Objects.equals(this.isSetGrantAccountId, grantInfo.isSetGrantAccountId) @@ -248,8 +204,6 @@ public boolean equals(Object o) { @Override public int hashCode() { return Objects.hash( - amount, - isSetAmount, counterparty, isSetCounterparty, grantAccountId, @@ -262,7 +216,6 @@ public int hashCode() { public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class GrantInfo {\n"); - sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); sb.append(" counterparty: ").append(toIndentedString(counterparty)).append("\n"); sb.append(" grantAccountId: ").append(toIndentedString(grantAccountId)).append("\n"); sb.append(" grantOfferId: ").append(toIndentedString(grantOfferId)).append("\n"); @@ -290,9 +243,6 @@ public Map getExplicitNulls() { Map nulls = new HashMap<>(); - if (isSetAmount) { - addIfNull(nulls, JSON_PROPERTY_AMOUNT, this.amount); - } if (isSetCounterparty) { addIfNull(nulls, JSON_PROPERTY_COUNTERPARTY, this.counterparty); } diff --git a/src/main/java/com/adyen/model/capital/GrantInfoCounterparty.java b/src/main/java/com/adyen/model/capital/GrantInfoCounterparty.java new file mode 100644 index 000000000..ccf4839a3 --- /dev/null +++ b/src/main/java/com/adyen/model/capital/GrantInfoCounterparty.java @@ -0,0 +1,245 @@ +/* + * Capital API + * + * 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.capital; + +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; +import com.fasterxml.jackson.core.JsonProcessingException; +import java.util.*; + +/** GrantInfoCounterparty */ +@JsonPropertyOrder({ + GrantInfoCounterparty.JSON_PROPERTY_BALANCE_ACCOUNT_ID, + GrantInfoCounterparty.JSON_PROPERTY_TRANSFER_INSTRUMENT_ID +}) +public class GrantInfoCounterparty { + public static final String JSON_PROPERTY_BALANCE_ACCOUNT_ID = "balanceAccountId"; + private String balanceAccountId; + + /** Mark when the attribute has been explicitly set. */ + private boolean isSetBalanceAccountId = false; + + public static final String JSON_PROPERTY_TRANSFER_INSTRUMENT_ID = "transferInstrumentId"; + private String transferInstrumentId; + + /** Mark when the attribute has been explicitly set. */ + private boolean isSetTransferInstrumentId = false; + + /** + * Sets whether attributes with null values should be explicitly included in the JSON payload. + * Default is false. + */ + @JsonIgnore private boolean includeNullValues = false; + + public GrantInfoCounterparty() {} + + /** + * The unique identifier of the balance account where the funds are disbursed. The balance account + * must belong to the specified account holder. + * + * @param balanceAccountId The unique identifier of the balance account where the funds are + * disbursed. The balance account must belong to the specified account holder. + * @return the current {@code GrantInfoCounterparty} instance, allowing for method chaining + */ + public GrantInfoCounterparty balanceAccountId(String balanceAccountId) { + this.balanceAccountId = balanceAccountId; + isSetBalanceAccountId = true; // mark as set + return this; + } + + /** + * The unique identifier of the balance account where the funds are disbursed. The balance account + * must belong to the specified account holder. + * + * @return balanceAccountId The unique identifier of the balance account where the funds are + * disbursed. The balance account must belong to the specified account holder. + */ + @JsonProperty(JSON_PROPERTY_BALANCE_ACCOUNT_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getBalanceAccountId() { + return balanceAccountId; + } + + /** + * The unique identifier of the balance account where the funds are disbursed. The balance account + * must belong to the specified account holder. + * + * @param balanceAccountId The unique identifier of the balance account where the funds are + * disbursed. The balance account must belong to the specified account holder. + */ + @JsonProperty(JSON_PROPERTY_BALANCE_ACCOUNT_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setBalanceAccountId(String balanceAccountId) { + this.balanceAccountId = balanceAccountId; + isSetBalanceAccountId = true; // mark as set + } + + /** + * The unique identifier of the transfer instrument where the funds are disbursed. The transfer + * instrument must belong to the legal entity of the specified account holder. + * + * @param transferInstrumentId The unique identifier of the transfer instrument where the funds + * are disbursed. The transfer instrument must belong to the legal entity of the specified + * account holder. + * @return the current {@code GrantInfoCounterparty} instance, allowing for method chaining + */ + public GrantInfoCounterparty transferInstrumentId(String transferInstrumentId) { + this.transferInstrumentId = transferInstrumentId; + isSetTransferInstrumentId = true; // mark as set + return this; + } + + /** + * The unique identifier of the transfer instrument where the funds are disbursed. The transfer + * instrument must belong to the legal entity of the specified account holder. + * + * @return transferInstrumentId The unique identifier of the transfer instrument where the funds + * are disbursed. The transfer instrument must belong to the legal entity of the specified + * account holder. + */ + @JsonProperty(JSON_PROPERTY_TRANSFER_INSTRUMENT_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getTransferInstrumentId() { + return transferInstrumentId; + } + + /** + * The unique identifier of the transfer instrument where the funds are disbursed. The transfer + * instrument must belong to the legal entity of the specified account holder. + * + * @param transferInstrumentId The unique identifier of the transfer instrument where the funds + * are disbursed. The transfer instrument must belong to the legal entity of the specified + * account holder. + */ + @JsonProperty(JSON_PROPERTY_TRANSFER_INSTRUMENT_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setTransferInstrumentId(String transferInstrumentId) { + this.transferInstrumentId = transferInstrumentId; + isSetTransferInstrumentId = true; // mark as set + } + + /** + * Configures whether null values are explicitly serialized in the JSON payload. Default is false. + */ + public GrantInfoCounterparty 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 GrantInfoCounterparty object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GrantInfoCounterparty grantInfoCounterparty = (GrantInfoCounterparty) o; + return Objects.equals(this.balanceAccountId, grantInfoCounterparty.balanceAccountId) + && Objects.equals(this.isSetBalanceAccountId, grantInfoCounterparty.isSetBalanceAccountId) + && Objects.equals(this.transferInstrumentId, grantInfoCounterparty.transferInstrumentId) + && Objects.equals( + this.isSetTransferInstrumentId, grantInfoCounterparty.isSetTransferInstrumentId); + } + + @Override + public int hashCode() { + return Objects.hash( + balanceAccountId, isSetBalanceAccountId, transferInstrumentId, isSetTransferInstrumentId); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GrantInfoCounterparty {\n"); + sb.append(" balanceAccountId: ").append(toIndentedString(balanceAccountId)).append("\n"); + sb.append(" transferInstrumentId: ") + .append(toIndentedString(transferInstrumentId)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + 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 (isSetBalanceAccountId) { + addIfNull(nulls, JSON_PROPERTY_BALANCE_ACCOUNT_ID, this.balanceAccountId); + } + if (isSetTransferInstrumentId) { + addIfNull(nulls, JSON_PROPERTY_TRANSFER_INSTRUMENT_ID, this.transferInstrumentId); + } + + 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 GrantInfoCounterparty given an JSON string + * + * @param jsonString JSON string + * @return An instance of GrantInfoCounterparty + * @throws JsonProcessingException if the JSON string is invalid with respect to + * GrantInfoCounterparty + */ + public static GrantInfoCounterparty fromJson(String jsonString) throws JsonProcessingException { + return JSON.getMapper().readValue(jsonString, GrantInfoCounterparty.class); + } + + /** + * Convert an instance of GrantInfoCounterparty to an JSON string + * + * @return JSON string + */ + public String toJson() throws JsonProcessingException { + return JSON.getMapper().writeValueAsString(this); + } +} diff --git a/src/main/java/com/adyen/model/capital/Status.java b/src/main/java/com/adyen/model/capital/Status.java index e7f5a3dda..f3e28379a 100644 --- a/src/main/java/com/adyen/model/capital/Status.java +++ b/src/main/java/com/adyen/model/capital/Status.java @@ -36,8 +36,8 @@ public class Status { /** * The code for the status of the grant. Possible values: - **Pending** - **Active** - **Repaid** - * - **WrittenOff** - **Failed** - **Revoked** - **Requested** - **Underwriting** - **Reviewing** - * - **Assessed** - **Approved** - **Rejected** - **Cancelled** + * - **WrittenOff** - **Failed** - **Revoked** - **Requested** - **Reviewing** - **Approved** - + * **Rejected** - **Cancelled** */ public enum CodeEnum { PENDING(String.valueOf("Pending")), @@ -54,12 +54,8 @@ public enum CodeEnum { REQUESTED(String.valueOf("Requested")), - UNDERWRITING(String.valueOf("Underwriting")), - REVIEWING(String.valueOf("Reviewing")), - ASSESSED(String.valueOf("Assessed")), - APPROVED(String.valueOf("Approved")), REJECTED(String.valueOf("Rejected")), @@ -160,12 +156,12 @@ public void setActions(List actions) { /** * The code for the status of the grant. Possible values: - **Pending** - **Active** - **Repaid** - * - **WrittenOff** - **Failed** - **Revoked** - **Requested** - **Underwriting** - **Reviewing** - * - **Assessed** - **Approved** - **Rejected** - **Cancelled** + * - **WrittenOff** - **Failed** - **Revoked** - **Requested** - **Reviewing** - **Approved** - + * **Rejected** - **Cancelled** * * @param code The code for the status of the grant. Possible values: - **Pending** - **Active** - - * **Repaid** - **WrittenOff** - **Failed** - **Revoked** - **Requested** - **Underwriting** - - * **Reviewing** - **Assessed** - **Approved** - **Rejected** - **Cancelled** + * **Repaid** - **WrittenOff** - **Failed** - **Revoked** - **Requested** - **Reviewing** - + * **Approved** - **Rejected** - **Cancelled** * @return the current {@code Status} instance, allowing for method chaining */ public Status code(CodeEnum code) { @@ -176,12 +172,12 @@ public Status code(CodeEnum code) { /** * The code for the status of the grant. Possible values: - **Pending** - **Active** - **Repaid** - * - **WrittenOff** - **Failed** - **Revoked** - **Requested** - **Underwriting** - **Reviewing** - * - **Assessed** - **Approved** - **Rejected** - **Cancelled** + * - **WrittenOff** - **Failed** - **Revoked** - **Requested** - **Reviewing** - **Approved** - + * **Rejected** - **Cancelled** * * @return code The code for the status of the grant. Possible values: - **Pending** - **Active** - * - **Repaid** - **WrittenOff** - **Failed** - **Revoked** - **Requested** - **Underwriting** - * - **Reviewing** - **Assessed** - **Approved** - **Rejected** - **Cancelled** + * - **Repaid** - **WrittenOff** - **Failed** - **Revoked** - **Requested** - **Reviewing** - + * **Approved** - **Rejected** - **Cancelled** */ @JsonProperty(JSON_PROPERTY_CODE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -191,12 +187,12 @@ public CodeEnum getCode() { /** * The code for the status of the grant. Possible values: - **Pending** - **Active** - **Repaid** - * - **WrittenOff** - **Failed** - **Revoked** - **Requested** - **Underwriting** - **Reviewing** - * - **Assessed** - **Approved** - **Rejected** - **Cancelled** + * - **WrittenOff** - **Failed** - **Revoked** - **Requested** - **Reviewing** - **Approved** - + * **Rejected** - **Cancelled** * * @param code The code for the status of the grant. Possible values: - **Pending** - **Active** - - * **Repaid** - **WrittenOff** - **Failed** - **Revoked** - **Requested** - **Underwriting** - - * **Reviewing** - **Assessed** - **Approved** - **Rejected** - **Cancelled** + * **Repaid** - **WrittenOff** - **Failed** - **Revoked** - **Requested** - **Reviewing** - + * **Approved** - **Rejected** - **Cancelled** */ @JsonProperty(JSON_PROPERTY_CODE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) diff --git a/src/test/java/com/adyen/service/capital/GrantsApiTest.java b/src/test/java/com/adyen/service/capital/GrantsApiTest.java index c0c8d476e..61a208cb7 100644 --- a/src/test/java/com/adyen/service/capital/GrantsApiTest.java +++ b/src/test/java/com/adyen/service/capital/GrantsApiTest.java @@ -43,13 +43,12 @@ void testGetGrant() throws Exception { Assertions.assertEquals("GR00000000000000000000001", response.getId()); Assertions.assertEquals("CG00000000000000000000001", response.getGrantAccountId()); Assertions.assertEquals("GO00000000000000000000001", response.getGrantOfferId()); - Assertions.assertEquals(new Amount().currency("EUR").value(10000L), response.getAmount()); Assertions.assertEquals(new Status().code(Status.CodeEnum.ACTIVE), response.getStatus()); Assertions.assertEquals( new Balance().currency("EUR").principal(10000L).fee(1000L).total(11000L), response.getBalances()); Assertions.assertEquals( - new Counterparty() + new GrantCounterparty() .accountHolderId("AH00000000000000000000001") .balanceAccountId("BA00000000000000000000001"), response.getCounterparty()); @@ -103,13 +102,12 @@ void testRequestGrant() throws Exception { Assertions.assertEquals("GR00000000000000000000001", response.getId()); Assertions.assertEquals("CG00000000000000000000001", response.getGrantAccountId()); Assertions.assertEquals("0000000000000001", response.getGrantOfferId()); - Assertions.assertEquals(new Amount().currency("EUR").value(1000000L), response.getAmount()); Assertions.assertEquals(new Status().code(Status.CodeEnum.PENDING), response.getStatus()); Assertions.assertEquals( new Balance().currency("EUR").principal(1000000L).fee(120000L).total(1120000L), response.getBalances()); Assertions.assertEquals( - new Counterparty() + new GrantCounterparty() .accountHolderId("AH00000000000000000000001") .balanceAccountId("BA00000000000000000000001"), response.getCounterparty());