diff --git a/src/main/java/com/adyen/model/transfers/CapitalGrant.java b/src/main/java/com/adyen/model/transfers/CapitalGrant.java index cda663e06..94df0f44d 100644 --- a/src/main/java/com/adyen/model/transfers/CapitalGrant.java +++ b/src/main/java/com/adyen/model/transfers/CapitalGrant.java @@ -49,7 +49,7 @@ public class CapitalGrant { 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; @@ -226,7 +226,7 @@ public void setBalances(CapitalBalance balances) { * @param counterparty * @return the current {@code CapitalGrant} instance, allowing for method chaining */ - public CapitalGrant counterparty(Counterparty counterparty) { + public CapitalGrant counterparty(GrantCounterparty counterparty) { this.counterparty = counterparty; isSetCounterparty = true; // mark as set return this; @@ -239,7 +239,7 @@ public CapitalGrant counterparty(Counterparty counterparty) { */ @JsonProperty(JSON_PROPERTY_COUNTERPARTY) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Counterparty getCounterparty() { + public GrantCounterparty getCounterparty() { return counterparty; } @@ -250,7 +250,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 } diff --git a/src/main/java/com/adyen/model/transfers/CapitalGrantInfo.java b/src/main/java/com/adyen/model/transfers/CapitalGrantInfo.java index 79981429e..fb98a8794 100644 --- a/src/main/java/com/adyen/model/transfers/CapitalGrantInfo.java +++ b/src/main/java/com/adyen/model/transfers/CapitalGrantInfo.java @@ -27,7 +27,7 @@ }) public class CapitalGrantInfo { 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; @@ -58,7 +58,7 @@ public CapitalGrantInfo() {} * @param counterparty * @return the current {@code CapitalGrantInfo} instance, allowing for method chaining */ - public CapitalGrantInfo counterparty(Counterparty counterparty) { + public CapitalGrantInfo counterparty(GrantInfoCounterparty counterparty) { this.counterparty = counterparty; isSetCounterparty = true; // mark as set return this; @@ -71,7 +71,7 @@ public CapitalGrantInfo counterparty(Counterparty counterparty) { */ @JsonProperty(JSON_PROPERTY_COUNTERPARTY) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Counterparty getCounterparty() { + public GrantInfoCounterparty getCounterparty() { return counterparty; } @@ -82,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 } diff --git a/src/main/java/com/adyen/model/transfers/Counterparty.java b/src/main/java/com/adyen/model/transfers/GrantCounterparty.java similarity index 73% rename from src/main/java/com/adyen/model/transfers/Counterparty.java rename to src/main/java/com/adyen/model/transfers/GrantCounterparty.java index 1d02f4d09..6497c9493 100644 --- a/src/main/java/com/adyen/model/transfers/Counterparty.java +++ b/src/main/java/com/adyen/model/transfers/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,30 +50,24 @@ public class Counterparty { */ @JsonIgnore private boolean includeNullValues = false; - public Counterparty() {} + public GrantCounterparty() {} /** - * The identifier of the receiving account holder. The payout will default to the primary balance - * account of this account holder if no `balanceAccountId` is provided. + * The identifier of the receiving account holder. * - * @param accountHolderId The identifier of the receiving account holder. The payout will default - * to the primary balance account of this account holder if no `balanceAccountId` is - * provided. - * @return the current {@code Counterparty} instance, allowing for method chaining + * @param accountHolderId The identifier of the receiving account holder. + * @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 identifier of the receiving account holder. The payout will default to the primary balance - * account of this account holder if no `balanceAccountId` is provided. + * The identifier of the receiving account holder. * - * @return accountHolderId The identifier of the receiving account holder. The payout will default - * to the primary balance account of this account holder if no `balanceAccountId` is - * provided. + * @return accountHolderId The identifier of the receiving account holder. */ @JsonProperty(JSON_PROPERTY_ACCOUNT_HOLDER_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -82,12 +76,9 @@ public String getAccountHolderId() { } /** - * The identifier of the receiving account holder. The payout will default to the primary balance - * account of this account holder if no `balanceAccountId` is provided. + * The identifier of the receiving account holder. * - * @param accountHolderId The identifier of the receiving account holder. The payout will default - * to the primary balance account of this account holder if no `balanceAccountId` is - * provided. + * @param accountHolderId The identifier of the receiving account holder. */ @JsonProperty(JSON_PROPERTY_ACCOUNT_HOLDER_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -101,9 +92,9 @@ public void setAccountHolderId(String accountHolderId) { * * @param balanceAccountId The identifier of the balance account that belongs to the receiving * 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; @@ -140,9 +131,9 @@ public void setBalanceAccountId(String balanceAccountId) { * * @param transferInstrumentId The identifier of the transfer instrument that belongs to the legal * entity of the 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; @@ -178,7 +169,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; } @@ -195,7 +186,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) { @@ -204,13 +195,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 @@ -227,7 +219,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: ") @@ -278,18 +270,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/transfers/GrantInfoCounterparty.java b/src/main/java/com/adyen/model/transfers/GrantInfoCounterparty.java new file mode 100644 index 000000000..d277c3218 --- /dev/null +++ b/src/main/java/com/adyen/model/transfers/GrantInfoCounterparty.java @@ -0,0 +1,239 @@ +/* + * Transfers API + * + * The version of the OpenAPI document: 4 + * + * + * 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.transfers; + +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 identifier of the balance account that belongs to the receiving account holder. + * + * @param balanceAccountId The identifier of the balance account that belongs to the receiving + * 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 identifier of the balance account that belongs to the receiving account holder. + * + * @return balanceAccountId The identifier of the balance account that belongs to the receiving + * account holder. + */ + @JsonProperty(JSON_PROPERTY_BALANCE_ACCOUNT_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getBalanceAccountId() { + return balanceAccountId; + } + + /** + * The identifier of the balance account that belongs to the receiving account holder. + * + * @param balanceAccountId The identifier of the balance account that belongs to the receiving + * 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 identifier of the transfer instrument that belongs to the legal entity of the account + * holder. + * + * @param transferInstrumentId The identifier of the transfer instrument that belongs to the legal + * entity of the 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 identifier of the transfer instrument that belongs to the legal entity of the account + * holder. + * + * @return transferInstrumentId The identifier of the transfer instrument that belongs to the + * legal entity of the account holder. + */ + @JsonProperty(JSON_PROPERTY_TRANSFER_INSTRUMENT_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getTransferInstrumentId() { + return transferInstrumentId; + } + + /** + * The identifier of the transfer instrument that belongs to the legal entity of the account + * holder. + * + * @param transferInstrumentId The identifier of the transfer instrument that belongs to the legal + * entity of the 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/transfers/InterchangeData.java b/src/main/java/com/adyen/model/transfers/InterchangeData.java new file mode 100644 index 000000000..ea93fbac2 --- /dev/null +++ b/src/main/java/com/adyen/model/transfers/InterchangeData.java @@ -0,0 +1,346 @@ +/* + * Transfers API + * + * The version of the OpenAPI document: 4 + * + * + * 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.transfers; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonCreator; +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.annotation.JsonValue; +import com.fasterxml.jackson.core.JsonProcessingException; +import java.util.*; +import java.util.Arrays; +import java.util.logging.Logger; + +/** InterchangeData */ +@JsonPropertyOrder({ + InterchangeData.JSON_PROPERTY_INTERCHANGE_AMOUNT, + InterchangeData.JSON_PROPERTY_INTERCHANGE_RATE_INDICATOR, + InterchangeData.JSON_PROPERTY_TYPE +}) +public class InterchangeData { + public static final String JSON_PROPERTY_INTERCHANGE_AMOUNT = "interchangeAmount"; + private Amount interchangeAmount; + + /** Mark when the attribute has been explicitly set. */ + private boolean isSetInterchangeAmount = false; + + public static final String JSON_PROPERTY_INTERCHANGE_RATE_INDICATOR = "interchangeRateIndicator"; + private String interchangeRateIndicator; + + /** Mark when the attribute has been explicitly set. */ + private boolean isSetInterchangeRateIndicator = false; + + /** + * The type of events data. Possible values: - **interchangeData**: information about the + * interchange fee applied to a transaction. + */ + public enum TypeEnum { + INTERCHANGEDATA(String.valueOf("interchangeData")); + + private static final Logger LOG = Logger.getLogger(TypeEnum.class.getName()); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static TypeEnum fromValue(String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + // handling unexpected value + LOG.warning( + "TypeEnum: unexpected enum value '" + + value + + "' - Supported values are " + + Arrays.toString(TypeEnum.values())); + return null; + } + } + + public static final String JSON_PROPERTY_TYPE = "type"; + private TypeEnum type; + + /** Mark when the attribute has been explicitly set. */ + private boolean isSetType = false; + + /** + * Sets whether attributes with null values should be explicitly included in the JSON payload. + * Default is false. + */ + @JsonIgnore private boolean includeNullValues = false; + + public InterchangeData() {} + + /** + * interchangeAmount + * + * @param interchangeAmount + * @return the current {@code InterchangeData} instance, allowing for method chaining + */ + public InterchangeData interchangeAmount(Amount interchangeAmount) { + this.interchangeAmount = interchangeAmount; + isSetInterchangeAmount = true; // mark as set + return this; + } + + /** + * Get interchangeAmount + * + * @return interchangeAmount + */ + @JsonProperty(JSON_PROPERTY_INTERCHANGE_AMOUNT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Amount getInterchangeAmount() { + return interchangeAmount; + } + + /** + * interchangeAmount + * + * @param interchangeAmount + */ + @JsonProperty(JSON_PROPERTY_INTERCHANGE_AMOUNT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setInterchangeAmount(Amount interchangeAmount) { + this.interchangeAmount = interchangeAmount; + isSetInterchangeAmount = true; // mark as set + } + + /** + * A 3-character alphanumeric code assigned by Visa that identifies the specific interchange + * reimbursement program a transaction qualified for. The code is assigned based on the card type, + * entry mode, and security data provided. + * + * @param interchangeRateIndicator A 3-character alphanumeric code assigned by Visa that + * identifies the specific interchange reimbursement program a transaction qualified for. The + * code is assigned based on the card type, entry mode, and security data provided. + * @return the current {@code InterchangeData} instance, allowing for method chaining + */ + public InterchangeData interchangeRateIndicator(String interchangeRateIndicator) { + this.interchangeRateIndicator = interchangeRateIndicator; + isSetInterchangeRateIndicator = true; // mark as set + return this; + } + + /** + * A 3-character alphanumeric code assigned by Visa that identifies the specific interchange + * reimbursement program a transaction qualified for. The code is assigned based on the card type, + * entry mode, and security data provided. + * + * @return interchangeRateIndicator A 3-character alphanumeric code assigned by Visa that + * identifies the specific interchange reimbursement program a transaction qualified for. The + * code is assigned based on the card type, entry mode, and security data provided. + */ + @JsonProperty(JSON_PROPERTY_INTERCHANGE_RATE_INDICATOR) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getInterchangeRateIndicator() { + return interchangeRateIndicator; + } + + /** + * A 3-character alphanumeric code assigned by Visa that identifies the specific interchange + * reimbursement program a transaction qualified for. The code is assigned based on the card type, + * entry mode, and security data provided. + * + * @param interchangeRateIndicator A 3-character alphanumeric code assigned by Visa that + * identifies the specific interchange reimbursement program a transaction qualified for. The + * code is assigned based on the card type, entry mode, and security data provided. + */ + @JsonProperty(JSON_PROPERTY_INTERCHANGE_RATE_INDICATOR) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setInterchangeRateIndicator(String interchangeRateIndicator) { + this.interchangeRateIndicator = interchangeRateIndicator; + isSetInterchangeRateIndicator = true; // mark as set + } + + /** + * The type of events data. Possible values: - **interchangeData**: information about the + * interchange fee applied to a transaction. + * + * @param type The type of events data. Possible values: - **interchangeData**: information about + * the interchange fee applied to a transaction. + * @return the current {@code InterchangeData} instance, allowing for method chaining + */ + public InterchangeData type(TypeEnum type) { + this.type = type; + isSetType = true; // mark as set + return this; + } + + /** + * The type of events data. Possible values: - **interchangeData**: information about the + * interchange fee applied to a transaction. + * + * @return type The type of events data. Possible values: - **interchangeData**: information about + * the interchange fee applied to a transaction. + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public TypeEnum getType() { + return type; + } + + /** + * The type of events data. Possible values: - **interchangeData**: information about the + * interchange fee applied to a transaction. + * + * @param type The type of events data. Possible values: - **interchangeData**: information about + * the interchange fee applied to a transaction. + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setType(TypeEnum type) { + this.type = type; + isSetType = true; // mark as set + } + + /** + * Configures whether null values are explicitly serialized in the JSON payload. Default is false. + */ + public InterchangeData 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 InterchangeData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + InterchangeData interchangeData = (InterchangeData) o; + return Objects.equals(this.interchangeAmount, interchangeData.interchangeAmount) + && Objects.equals(this.isSetInterchangeAmount, interchangeData.isSetInterchangeAmount) + && Objects.equals(this.interchangeRateIndicator, interchangeData.interchangeRateIndicator) + && Objects.equals( + this.isSetInterchangeRateIndicator, interchangeData.isSetInterchangeRateIndicator) + && Objects.equals(this.type, interchangeData.type) + && Objects.equals(this.isSetType, interchangeData.isSetType); + } + + @Override + public int hashCode() { + return Objects.hash( + interchangeAmount, + isSetInterchangeAmount, + interchangeRateIndicator, + isSetInterchangeRateIndicator, + type, + isSetType); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class InterchangeData {\n"); + sb.append(" interchangeAmount: ").append(toIndentedString(interchangeAmount)).append("\n"); + sb.append(" interchangeRateIndicator: ") + .append(toIndentedString(interchangeRateIndicator)) + .append("\n"); + sb.append(" type: ").append(toIndentedString(type)).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 (isSetInterchangeAmount) { + addIfNull(nulls, JSON_PROPERTY_INTERCHANGE_AMOUNT, this.interchangeAmount); + } + if (isSetInterchangeRateIndicator) { + addIfNull(nulls, JSON_PROPERTY_INTERCHANGE_RATE_INDICATOR, this.interchangeRateIndicator); + } + if (isSetType) { + addIfNull(nulls, JSON_PROPERTY_TYPE, this.type); + } + + 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 InterchangeData given an JSON string + * + * @param jsonString JSON string + * @return An instance of InterchangeData + * @throws JsonProcessingException if the JSON string is invalid with respect to InterchangeData + */ + public static InterchangeData fromJson(String jsonString) throws JsonProcessingException { + return JSON.getMapper().readValue(jsonString, InterchangeData.class); + } + + /** + * Convert an instance of InterchangeData 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/transfers/Modification.java b/src/main/java/com/adyen/model/transfers/Modification.java index 9774b2afc..6f8109263 100644 --- a/src/main/java/com/adyen/model/transfers/Modification.java +++ b/src/main/java/com/adyen/model/transfers/Modification.java @@ -122,6 +122,8 @@ public enum StatusEnum { FEEPENDING(String.valueOf("feePending")), + INTERCHANGEADJUSTED(String.valueOf("interchangeAdjusted")), + INTERNALTRANSFER(String.valueOf("internalTransfer")), INTERNALTRANSFERPENDING(String.valueOf("internalTransferPending")), diff --git a/src/main/java/com/adyen/model/transfers/Transfer.java b/src/main/java/com/adyen/model/transfers/Transfer.java index 5015d2a24..948eec941 100644 --- a/src/main/java/com/adyen/model/transfers/Transfer.java +++ b/src/main/java/com/adyen/model/transfers/Transfer.java @@ -544,6 +544,8 @@ public enum StatusEnum { FEEPENDING(String.valueOf("feePending")), + INTERCHANGEADJUSTED(String.valueOf("interchangeAdjusted")), + INTERNALTRANSFER(String.valueOf("internalTransfer")), INTERNALTRANSFERPENDING(String.valueOf("internalTransferPending")), diff --git a/src/main/java/com/adyen/model/transfers/TransferData.java b/src/main/java/com/adyen/model/transfers/TransferData.java index deb53cab4..5bbb0933f 100644 --- a/src/main/java/com/adyen/model/transfers/TransferData.java +++ b/src/main/java/com/adyen/model/transfers/TransferData.java @@ -591,6 +591,8 @@ public enum StatusEnum { FEEPENDING(String.valueOf("feePending")), + INTERCHANGEADJUSTED(String.valueOf("interchangeAdjusted")), + INTERNALTRANSFER(String.valueOf("internalTransfer")), INTERNALTRANSFERPENDING(String.valueOf("internalTransferPending")), diff --git a/src/main/java/com/adyen/model/transfers/TransferEvent.java b/src/main/java/com/adyen/model/transfers/TransferEvent.java index e995ee504..eda91224e 100644 --- a/src/main/java/com/adyen/model/transfers/TransferEvent.java +++ b/src/main/java/com/adyen/model/transfers/TransferEvent.java @@ -400,6 +400,8 @@ public enum StatusEnum { FEEPENDING(String.valueOf("feePending")), + INTERCHANGEADJUSTED(String.valueOf("interchangeAdjusted")), + INTERNALTRANSFER(String.valueOf("internalTransfer")), INTERNALTRANSFERPENDING(String.valueOf("internalTransferPending")), @@ -521,6 +523,8 @@ public static StatusEnum fromValue(String value) { public enum TypeEnum { ACCOUNTING(String.valueOf("accounting")), + TRACING(String.valueOf("tracing")), + TRACKING(String.valueOf("tracking")); private static final Logger LOG = Logger.getLogger(TypeEnum.class.getName()); diff --git a/src/main/java/com/adyen/model/transfers/TransferEventEventsDataInner.java b/src/main/java/com/adyen/model/transfers/TransferEventEventsDataInner.java index 732f81f28..5897feb65 100644 --- a/src/main/java/com/adyen/model/transfers/TransferEventEventsDataInner.java +++ b/src/main/java/com/adyen/model/transfers/TransferEventEventsDataInner.java @@ -75,6 +75,32 @@ public TransferEventEventsDataInner deserialize(JsonParser jp, DeserializationCo boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS); int match = 0; JsonToken token = tree.traverse(jp.getCodec()).nextToken(); + // deserialize InterchangeData + try { + boolean attemptParsing = true; + if (attemptParsing) { + // Checks if the unique type of the oneOf json matches any of the object TypeEnum values + boolean typeMatch = false; + if (tree.findValue("type") != null) { + typeMatch = + Arrays.stream(InterchangeData.TypeEnum.values()) + .anyMatch((t) -> t.getValue().equals(tree.findValue("type").asText())); + } + + if (typeMatch) { + deserialized = tree.traverse(jp.getCodec()).readValueAs(InterchangeData.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + match++; + log.log(Level.FINER, "Input data matches schema 'InterchangeData'"); + } + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'InterchangeData'", e); + } + // deserialize IssuingTransactionData try { boolean attemptParsing = true; @@ -154,6 +180,11 @@ public TransferEventEventsDataInner() { super("oneOf", Boolean.FALSE); } + public TransferEventEventsDataInner(InterchangeData o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + public TransferEventEventsDataInner(IssuingTransactionData o) { super("oneOf", Boolean.FALSE); setActualInstance(o); @@ -165,6 +196,7 @@ public TransferEventEventsDataInner(MerchantPurchaseData o) { } static { + schemas.put("InterchangeData", new GenericType() {}); schemas.put("IssuingTransactionData", new GenericType() {}); schemas.put("MerchantPurchaseData", new GenericType() {}); JSON.registerDescendants( @@ -178,13 +210,18 @@ public Map> getSchemas() { /** * Set the instance that matches the oneOf child schema, check the instance parameter is valid - * against the oneOf child schemas: IssuingTransactionData, MerchantPurchaseData + * against the oneOf child schemas: InterchangeData, IssuingTransactionData, MerchantPurchaseData * *

It could be an instance of the 'oneOf' schemas. The oneOf child schemas may themselves be a * composed schema (allOf, anyOf, oneOf). */ @Override public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(InterchangeData.class, instance, new HashSet<>())) { + super.setActualInstance(instance); + return; + } + if (JSON.isInstanceOf(IssuingTransactionData.class, instance, new HashSet<>())) { super.setActualInstance(instance); return; @@ -196,20 +233,31 @@ public void setActualInstance(Object instance) { } throw new RuntimeException( - "Invalid instance type. Must be IssuingTransactionData, MerchantPurchaseData"); + "Invalid instance type. Must be InterchangeData, IssuingTransactionData, MerchantPurchaseData"); } /** - * Get the actual instance, which can be the following: IssuingTransactionData, + * Get the actual instance, which can be the following: InterchangeData, IssuingTransactionData, * MerchantPurchaseData * - * @return The actual instance (IssuingTransactionData, MerchantPurchaseData) + * @return The actual instance (InterchangeData, IssuingTransactionData, MerchantPurchaseData) */ @Override public Object getActualInstance() { return super.getActualInstance(); } + /** + * Get the actual instance of `InterchangeData`. If the actual instance is not `InterchangeData`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `InterchangeData` + * @throws ClassCastException if the instance is not `InterchangeData` + */ + public InterchangeData getInterchangeData() throws ClassCastException { + return (InterchangeData) super.getActualInstance(); + } + /** * Get the actual instance of `IssuingTransactionData`. If the actual instance is not * `IssuingTransactionData`, the ClassCastException will be thrown.