diff --git a/sdk-generation-log/transfers.json b/sdk-generation-log/transfers.json index 244d92230..a3a1e6ca7 100644 --- a/sdk-generation-log/transfers.json +++ b/sdk-generation-log/transfers.json @@ -1,8 +1,8 @@ { "service": "transfers", "project": "java", - "generatedAt": "2026-05-14T14:22:14Z", - "openapiCommitSha": "cbc5406a2df1f24d50e40742f18342f7ca7f21fc", - "automationCommitSha": "6f06b47d0661f0891defe6b85461d2c367fbd284", - "libraryCommitSha": "5790580db2f8a931a68baba2bff9760b8aed2067" + "generatedAt": "2026-07-21T09:54:33Z", + "openapiCommitSha": "c2ff0637d25d1c34aa1b19113e1b4e5eaa289960", + "automationCommitSha": "0c108bd8050cf480d2710b78b770afdfbdd89397", + "libraryCommitSha": "f551ee17270c3a4bd05b2fb69754e184592e1ce9" } diff --git a/src/main/java/com/adyen/model/transfers/BankAccountV3AccountIdentification.java b/src/main/java/com/adyen/model/transfers/BankAccountV3AccountIdentification.java index fedff8f80..1a51eb0a2 100644 --- a/src/main/java/com/adyen/model/transfers/BankAccountV3AccountIdentification.java +++ b/src/main/java/com/adyen/model/transfers/BankAccountV3AccountIdentification.java @@ -639,6 +639,42 @@ public BankAccountV3AccountIdentification(USLocalAccountIdentification o) { schemas.put("USLocalAccountIdentification", new GenericType() {}); JSON.registerDescendants( BankAccountV3AccountIdentification.class, Collections.unmodifiableMap(schemas)); + // Initialize and register the discriminator mappings. + Map> mappings = new HashMap<>(); + mappings.put("auLocal", AULocalAccountIdentification.class); + mappings.put("brLocal", BRLocalAccountIdentification.class); + mappings.put("caLocal", CALocalAccountIdentification.class); + mappings.put("czLocal", CZLocalAccountIdentification.class); + mappings.put("dkLocal", DKLocalAccountIdentification.class); + mappings.put("hkLocal", HKLocalAccountIdentification.class); + mappings.put("huLocal", HULocalAccountIdentification.class); + mappings.put("iban", IbanAccountIdentification.class); + mappings.put("noLocal", NOLocalAccountIdentification.class); + mappings.put("numberAndBic", NumberAndBicAccountIdentification.class); + mappings.put("nzLocal", NZLocalAccountIdentification.class); + mappings.put("plLocal", PLLocalAccountIdentification.class); + mappings.put("seLocal", SELocalAccountIdentification.class); + mappings.put("sgLocal", SGLocalAccountIdentification.class); + mappings.put("ukLocal", UKLocalAccountIdentification.class); + mappings.put("usLocal", USLocalAccountIdentification.class); + mappings.put("AULocalAccountIdentification", AULocalAccountIdentification.class); + mappings.put("BRLocalAccountIdentification", BRLocalAccountIdentification.class); + mappings.put("CALocalAccountIdentification", CALocalAccountIdentification.class); + mappings.put("CZLocalAccountIdentification", CZLocalAccountIdentification.class); + mappings.put("DKLocalAccountIdentification", DKLocalAccountIdentification.class); + mappings.put("HKLocalAccountIdentification", HKLocalAccountIdentification.class); + mappings.put("HULocalAccountIdentification", HULocalAccountIdentification.class); + mappings.put("IbanAccountIdentification", IbanAccountIdentification.class); + mappings.put("NOLocalAccountIdentification", NOLocalAccountIdentification.class); + mappings.put("NZLocalAccountIdentification", NZLocalAccountIdentification.class); + mappings.put("NumberAndBicAccountIdentification", NumberAndBicAccountIdentification.class); + mappings.put("PLLocalAccountIdentification", PLLocalAccountIdentification.class); + mappings.put("SELocalAccountIdentification", SELocalAccountIdentification.class); + mappings.put("SGLocalAccountIdentification", SGLocalAccountIdentification.class); + mappings.put("UKLocalAccountIdentification", UKLocalAccountIdentification.class); + mappings.put("USLocalAccountIdentification", USLocalAccountIdentification.class); + mappings.put("BankAccountV3_accountIdentification", BankAccountV3AccountIdentification.class); + JSON.registerDiscriminator(BankAccountV3AccountIdentification.class, "type", mappings); } @Override diff --git a/src/main/java/com/adyen/model/transfers/CashOut.java b/src/main/java/com/adyen/model/transfers/CashOut.java new file mode 100644 index 000000000..8753b33fa --- /dev/null +++ b/src/main/java/com/adyen/model/transfers/CashOut.java @@ -0,0 +1,680 @@ +/* + * 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.*; +import java.util.ArrayList; +import java.util.List; + +/** CashOut */ +@JsonPropertyOrder({ + CashOut.JSON_PROPERTY_AMOUNT, + CashOut.JSON_PROPERTY_COUNTERPARTY, + CashOut.JSON_PROPERTY_DESCRIPTION, + CashOut.JSON_PROPERTY_FEE, + CashOut.JSON_PROPERTY_ID, + CashOut.JSON_PROPERTY_INSTRUCTING_BALANCE_ACCOUNT_ID, + CashOut.JSON_PROPERTY_REFERENCE_FOR_BENEFICIARY, + CashOut.JSON_PROPERTY_TRANSFER_INSTRUMENT_ID, + CashOut.JSON_PROPERTY_TRANSFERS +}) +public class CashOut { + 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 CashOutInfoCounterparty counterparty; + + /** Mark when the attribute has been explicitly set. */ + private boolean isSetCounterparty = false; + + public static final String JSON_PROPERTY_DESCRIPTION = "description"; + private String description; + + /** Mark when the attribute has been explicitly set. */ + private boolean isSetDescription = false; + + public static final String JSON_PROPERTY_FEE = "fee"; + private Fee fee; + + /** Mark when the attribute has been explicitly set. */ + private boolean isSetFee = false; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + /** Mark when the attribute has been explicitly set. */ + private boolean isSetId = false; + + public static final String JSON_PROPERTY_INSTRUCTING_BALANCE_ACCOUNT_ID = + "instructingBalanceAccountId"; + private String instructingBalanceAccountId; + + /** Mark when the attribute has been explicitly set. */ + private boolean isSetInstructingBalanceAccountId = false; + + public static final String JSON_PROPERTY_REFERENCE_FOR_BENEFICIARY = "referenceForBeneficiary"; + private String referenceForBeneficiary; + + /** Mark when the attribute has been explicitly set. */ + private boolean isSetReferenceForBeneficiary = false; + + public static final String JSON_PROPERTY_TRANSFER_INSTRUMENT_ID = "transferInstrumentId"; + /* deprecated */ + @Deprecated private String transferInstrumentId; + + /** Mark when the attribute has been explicitly set. */ + private boolean isSetTransferInstrumentId = false; + + public static final String JSON_PROPERTY_TRANSFERS = "transfers"; + private List transfers; + + /** Mark when the attribute has been explicitly set. */ + private boolean isSetTransfers = false; + + /** + * Sets whether attributes with null values should be explicitly included in the JSON payload. + * Default is false. + */ + @JsonIgnore private boolean includeNullValues = false; + + public CashOut() {} + + /** + * amount + * + * @param amount + * @return the current {@code CashOut} instance, allowing for method chaining + */ + public CashOut 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 CashOut} instance, allowing for method chaining + */ + public CashOut counterparty(CashOutInfoCounterparty counterparty) { + this.counterparty = counterparty; + isSetCounterparty = true; // mark as set + return this; + } + + /** + * Get counterparty + * + * @return counterparty + */ + @JsonProperty(JSON_PROPERTY_COUNTERPARTY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public CashOutInfoCounterparty getCounterparty() { + return counterparty; + } + + /** + * counterparty + * + * @param counterparty + */ + @JsonProperty(JSON_PROPERTY_COUNTERPARTY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setCounterparty(CashOutInfoCounterparty counterparty) { + this.counterparty = counterparty; + isSetCounterparty = true; // mark as set + } + + /** + * Allowed and returned only when you provide the `counterparty.transferInstrumentId` + * field. Your description of the cashout transfer. This description is used by most banks as the + * transfer description. We recommend sending a maximum of 140 characters, otherwise the + * description may be truncated. If you do not provide a description, Adyen generates a + * description automatically. This generated description is not returned in the response. + * Supported characters: **[a-z] [A-Z] [0-9] / - ? : ( ) . , ' + Space**. + * + * @param description Allowed and returned only when you provide the + * `counterparty.transferInstrumentId` field. Your description of the cashout + * transfer. This description is used by most banks as the transfer description. We recommend + * sending a maximum of 140 characters, otherwise the description may be truncated. If you do + * not provide a description, Adyen generates a description automatically. This generated + * description is not returned in the response. Supported characters: **[a-z] [A-Z] [0-9] / - + * ? : ( ) . , ' + Space**. + * @return the current {@code CashOut} instance, allowing for method chaining + */ + public CashOut description(String description) { + this.description = description; + isSetDescription = true; // mark as set + return this; + } + + /** + * Allowed and returned only when you provide the `counterparty.transferInstrumentId` + * field. Your description of the cashout transfer. This description is used by most banks as the + * transfer description. We recommend sending a maximum of 140 characters, otherwise the + * description may be truncated. If you do not provide a description, Adyen generates a + * description automatically. This generated description is not returned in the response. + * Supported characters: **[a-z] [A-Z] [0-9] / - ? : ( ) . , ' + Space**. + * + * @return description Allowed and returned only when you provide the + * `counterparty.transferInstrumentId` field. Your description of the cashout + * transfer. This description is used by most banks as the transfer description. We recommend + * sending a maximum of 140 characters, otherwise the description may be truncated. If you do + * not provide a description, Adyen generates a description automatically. This generated + * description is not returned in the response. Supported characters: **[a-z] [A-Z] [0-9] / - + * ? : ( ) . , ' + Space**. + */ + @JsonProperty(JSON_PROPERTY_DESCRIPTION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getDescription() { + return description; + } + + /** + * Allowed and returned only when you provide the `counterparty.transferInstrumentId` + * field. Your description of the cashout transfer. This description is used by most banks as the + * transfer description. We recommend sending a maximum of 140 characters, otherwise the + * description may be truncated. If you do not provide a description, Adyen generates a + * description automatically. This generated description is not returned in the response. + * Supported characters: **[a-z] [A-Z] [0-9] / - ? : ( ) . , ' + Space**. + * + * @param description Allowed and returned only when you provide the + * `counterparty.transferInstrumentId` field. Your description of the cashout + * transfer. This description is used by most banks as the transfer description. We recommend + * sending a maximum of 140 characters, otherwise the description may be truncated. If you do + * not provide a description, Adyen generates a description automatically. This generated + * description is not returned in the response. Supported characters: **[a-z] [A-Z] [0-9] / - + * ? : ( ) . , ' + Space**. + */ + @JsonProperty(JSON_PROPERTY_DESCRIPTION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setDescription(String description) { + this.description = description; + isSetDescription = true; // mark as set + } + + /** + * fee + * + * @param fee + * @return the current {@code CashOut} instance, allowing for method chaining + */ + public CashOut fee(Fee fee) { + this.fee = fee; + isSetFee = true; // mark as set + return this; + } + + /** + * Get fee + * + * @return fee + */ + @JsonProperty(JSON_PROPERTY_FEE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Fee getFee() { + return fee; + } + + /** + * fee + * + * @param fee + */ + @JsonProperty(JSON_PROPERTY_FEE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setFee(Fee fee) { + this.fee = fee; + isSetFee = true; // mark as set + } + + /** + * The unique identifier of the cashout reference. + * + * @param id The unique identifier of the cashout reference. + * @return the current {@code CashOut} instance, allowing for method chaining + */ + public CashOut id(String id) { + this.id = id; + isSetId = true; // mark as set + return this; + } + + /** + * The unique identifier of the cashout reference. + * + * @return id The unique identifier of the cashout reference. + */ + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getId() { + return id; + } + + /** + * The unique identifier of the cashout reference. + * + * @param id The unique identifier of the cashout reference. + */ + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setId(String id) { + this.id = id; + isSetId = true; // mark as set + } + + /** + * The unique identifier of the balance account that initiates the cashout request. + * + * @param instructingBalanceAccountId The unique identifier of the balance account that initiates + * the cashout request. + * @return the current {@code CashOut} instance, allowing for method chaining + */ + public CashOut instructingBalanceAccountId(String instructingBalanceAccountId) { + this.instructingBalanceAccountId = instructingBalanceAccountId; + isSetInstructingBalanceAccountId = true; // mark as set + return this; + } + + /** + * The unique identifier of the balance account that initiates the cashout request. + * + * @return instructingBalanceAccountId The unique identifier of the balance account that initiates + * the cashout request. + */ + @JsonProperty(JSON_PROPERTY_INSTRUCTING_BALANCE_ACCOUNT_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getInstructingBalanceAccountId() { + return instructingBalanceAccountId; + } + + /** + * The unique identifier of the balance account that initiates the cashout request. + * + * @param instructingBalanceAccountId The unique identifier of the balance account that initiates + * the cashout request. + */ + @JsonProperty(JSON_PROPERTY_INSTRUCTING_BALANCE_ACCOUNT_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setInstructingBalanceAccountId(String instructingBalanceAccountId) { + this.instructingBalanceAccountId = instructingBalanceAccountId; + isSetInstructingBalanceAccountId = true; // mark as set + } + + /** + * Allowed and returned only when you provide the `counterparty.transferInstrumentId` + * field. The reference that is sent to the recipient of a cashout transfer. This reference is + * also sent in all webhooks related to the cashout transfer, so you can use it to track the + * status of the transfer. If you do not provide a reference for the beneficiary, Adyen generates + * one automatically. This generated reference for the beneficiary is not returned in the + * response. Supported characters: **a-z**, **A-Z**, **0-9**. + * + * @param referenceForBeneficiary Allowed and returned only when you provide the + * `counterparty.transferInstrumentId` field. The reference that is sent to the + * recipient of a cashout transfer. This reference is also sent in all webhooks related to the + * cashout transfer, so you can use it to track the status of the transfer. If you do not + * provide a reference for the beneficiary, Adyen generates one automatically. This generated + * reference for the beneficiary is not returned in the response. Supported characters: + * **a-z**, **A-Z**, **0-9**. + * @return the current {@code CashOut} instance, allowing for method chaining + */ + public CashOut referenceForBeneficiary(String referenceForBeneficiary) { + this.referenceForBeneficiary = referenceForBeneficiary; + isSetReferenceForBeneficiary = true; // mark as set + return this; + } + + /** + * Allowed and returned only when you provide the `counterparty.transferInstrumentId` + * field. The reference that is sent to the recipient of a cashout transfer. This reference is + * also sent in all webhooks related to the cashout transfer, so you can use it to track the + * status of the transfer. If you do not provide a reference for the beneficiary, Adyen generates + * one automatically. This generated reference for the beneficiary is not returned in the + * response. Supported characters: **a-z**, **A-Z**, **0-9**. + * + * @return referenceForBeneficiary Allowed and returned only when you provide the + * `counterparty.transferInstrumentId` field. The reference that is sent to the + * recipient of a cashout transfer. This reference is also sent in all webhooks related to the + * cashout transfer, so you can use it to track the status of the transfer. If you do not + * provide a reference for the beneficiary, Adyen generates one automatically. This generated + * reference for the beneficiary is not returned in the response. Supported characters: + * **a-z**, **A-Z**, **0-9**. + */ + @JsonProperty(JSON_PROPERTY_REFERENCE_FOR_BENEFICIARY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getReferenceForBeneficiary() { + return referenceForBeneficiary; + } + + /** + * Allowed and returned only when you provide the `counterparty.transferInstrumentId` + * field. The reference that is sent to the recipient of a cashout transfer. This reference is + * also sent in all webhooks related to the cashout transfer, so you can use it to track the + * status of the transfer. If you do not provide a reference for the beneficiary, Adyen generates + * one automatically. This generated reference for the beneficiary is not returned in the + * response. Supported characters: **a-z**, **A-Z**, **0-9**. + * + * @param referenceForBeneficiary Allowed and returned only when you provide the + * `counterparty.transferInstrumentId` field. The reference that is sent to the + * recipient of a cashout transfer. This reference is also sent in all webhooks related to the + * cashout transfer, so you can use it to track the status of the transfer. If you do not + * provide a reference for the beneficiary, Adyen generates one automatically. This generated + * reference for the beneficiary is not returned in the response. Supported characters: + * **a-z**, **A-Z**, **0-9**. + */ + @JsonProperty(JSON_PROPERTY_REFERENCE_FOR_BENEFICIARY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setReferenceForBeneficiary(String referenceForBeneficiary) { + this.referenceForBeneficiary = referenceForBeneficiary; + isSetReferenceForBeneficiary = true; // mark as set + } + + /** + * **Use `counterparty.transferInstrumentId` instead.** The unique identifier of the + * counterparty transfer instrument. + * + * @param transferInstrumentId **Use `counterparty.transferInstrumentId` instead.** The + * unique identifier of the counterparty transfer instrument. + * @return the current {@code CashOut} instance, allowing for method chaining + * @deprecated + */ + @Deprecated + public CashOut transferInstrumentId(String transferInstrumentId) { + this.transferInstrumentId = transferInstrumentId; + isSetTransferInstrumentId = true; // mark as set + return this; + } + + /** + * **Use `counterparty.transferInstrumentId` instead.** The unique identifier of the + * counterparty transfer instrument. + * + * @return transferInstrumentId **Use `counterparty.transferInstrumentId` instead.** The + * unique identifier of the counterparty transfer instrument. + * @deprecated + */ + @Deprecated + @JsonProperty(JSON_PROPERTY_TRANSFER_INSTRUMENT_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getTransferInstrumentId() { + return transferInstrumentId; + } + + /** + * **Use `counterparty.transferInstrumentId` instead.** The unique identifier of the + * counterparty transfer instrument. + * + * @param transferInstrumentId **Use `counterparty.transferInstrumentId` instead.** The + * unique identifier of the counterparty transfer instrument. + * @deprecated + */ + @Deprecated + @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 + } + + /** + * The list of transfers related to cashout. + * + * @param transfers The list of transfers related to cashout. + * @return the current {@code CashOut} instance, allowing for method chaining + */ + public CashOut transfers(List transfers) { + this.transfers = transfers; + isSetTransfers = true; // mark as set + return this; + } + + public CashOut addTransfersItem(CashOutTransfer transfersItem) { + if (this.transfers == null) { + this.transfers = new ArrayList<>(); + } + this.transfers.add(transfersItem); + return this; + } + + /** + * The list of transfers related to cashout. + * + * @return transfers The list of transfers related to cashout. + */ + @JsonProperty(JSON_PROPERTY_TRANSFERS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getTransfers() { + return transfers; + } + + /** + * The list of transfers related to cashout. + * + * @param transfers The list of transfers related to cashout. + */ + @JsonProperty(JSON_PROPERTY_TRANSFERS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setTransfers(List transfers) { + this.transfers = transfers; + isSetTransfers = true; // mark as set + } + + /** + * Configures whether null values are explicitly serialized in the JSON payload. Default is false. + */ + public CashOut 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 CashOut object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CashOut cashOut = (CashOut) o; + return Objects.equals(this.amount, cashOut.amount) + && Objects.equals(this.isSetAmount, cashOut.isSetAmount) + && Objects.equals(this.counterparty, cashOut.counterparty) + && Objects.equals(this.isSetCounterparty, cashOut.isSetCounterparty) + && Objects.equals(this.description, cashOut.description) + && Objects.equals(this.isSetDescription, cashOut.isSetDescription) + && Objects.equals(this.fee, cashOut.fee) + && Objects.equals(this.isSetFee, cashOut.isSetFee) + && Objects.equals(this.id, cashOut.id) + && Objects.equals(this.isSetId, cashOut.isSetId) + && Objects.equals(this.instructingBalanceAccountId, cashOut.instructingBalanceAccountId) + && Objects.equals( + this.isSetInstructingBalanceAccountId, cashOut.isSetInstructingBalanceAccountId) + && Objects.equals(this.referenceForBeneficiary, cashOut.referenceForBeneficiary) + && Objects.equals(this.isSetReferenceForBeneficiary, cashOut.isSetReferenceForBeneficiary) + && Objects.equals(this.transferInstrumentId, cashOut.transferInstrumentId) + && Objects.equals(this.isSetTransferInstrumentId, cashOut.isSetTransferInstrumentId) + && Objects.equals(this.transfers, cashOut.transfers) + && Objects.equals(this.isSetTransfers, cashOut.isSetTransfers); + } + + @Override + public int hashCode() { + return Objects.hash( + amount, + isSetAmount, + counterparty, + isSetCounterparty, + description, + isSetDescription, + fee, + isSetFee, + id, + isSetId, + instructingBalanceAccountId, + isSetInstructingBalanceAccountId, + referenceForBeneficiary, + isSetReferenceForBeneficiary, + transferInstrumentId, + isSetTransferInstrumentId, + transfers, + isSetTransfers); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CashOut {\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" counterparty: ").append(toIndentedString(counterparty)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" fee: ").append(toIndentedString(fee)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" instructingBalanceAccountId: ") + .append(toIndentedString(instructingBalanceAccountId)) + .append("\n"); + sb.append(" referenceForBeneficiary: ") + .append(toIndentedString(referenceForBeneficiary)) + .append("\n"); + sb.append(" transferInstrumentId: ") + .append(toIndentedString(transferInstrumentId)) + .append("\n"); + sb.append(" transfers: ").append(toIndentedString(transfers)).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 (isSetAmount) { + addIfNull(nulls, JSON_PROPERTY_AMOUNT, this.amount); + } + if (isSetCounterparty) { + addIfNull(nulls, JSON_PROPERTY_COUNTERPARTY, this.counterparty); + } + if (isSetDescription) { + addIfNull(nulls, JSON_PROPERTY_DESCRIPTION, this.description); + } + if (isSetFee) { + addIfNull(nulls, JSON_PROPERTY_FEE, this.fee); + } + if (isSetId) { + addIfNull(nulls, JSON_PROPERTY_ID, this.id); + } + if (isSetInstructingBalanceAccountId) { + addIfNull( + nulls, JSON_PROPERTY_INSTRUCTING_BALANCE_ACCOUNT_ID, this.instructingBalanceAccountId); + } + if (isSetReferenceForBeneficiary) { + addIfNull(nulls, JSON_PROPERTY_REFERENCE_FOR_BENEFICIARY, this.referenceForBeneficiary); + } + if (isSetTransferInstrumentId) { + addIfNull(nulls, JSON_PROPERTY_TRANSFER_INSTRUMENT_ID, this.transferInstrumentId); + } + if (isSetTransfers) { + addIfNull(nulls, JSON_PROPERTY_TRANSFERS, this.transfers); + } + + 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 CashOut given an JSON string + * + * @param jsonString JSON string + * @return An instance of CashOut + * @throws JsonProcessingException if the JSON string is invalid with respect to CashOut + */ + public static CashOut fromJson(String jsonString) throws JsonProcessingException { + return JSON.getMapper().readValue(jsonString, CashOut.class); + } + + /** + * Convert an instance of CashOut 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/CashOutInfo.java b/src/main/java/com/adyen/model/transfers/CashOutInfo.java new file mode 100644 index 000000000..223558a7a --- /dev/null +++ b/src/main/java/com/adyen/model/transfers/CashOutInfo.java @@ -0,0 +1,604 @@ +/* + * 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.core.JsonProcessingException; +import java.util.*; + +/** CashOutInfo */ +@JsonPropertyOrder({ + CashOutInfo.JSON_PROPERTY_AMOUNT, + CashOutInfo.JSON_PROPERTY_COUNTERPARTY, + CashOutInfo.JSON_PROPERTY_DESCRIPTION, + CashOutInfo.JSON_PROPERTY_FEE, + CashOutInfo.JSON_PROPERTY_ID, + CashOutInfo.JSON_PROPERTY_INSTRUCTING_BALANCE_ACCOUNT_ID, + CashOutInfo.JSON_PROPERTY_REFERENCE_FOR_BENEFICIARY, + CashOutInfo.JSON_PROPERTY_TRANSFER_INSTRUMENT_ID +}) +public class CashOutInfo { + 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 CashOutInfoCounterparty counterparty; + + /** Mark when the attribute has been explicitly set. */ + private boolean isSetCounterparty = false; + + public static final String JSON_PROPERTY_DESCRIPTION = "description"; + private String description; + + /** Mark when the attribute has been explicitly set. */ + private boolean isSetDescription = false; + + public static final String JSON_PROPERTY_FEE = "fee"; + private Fee fee; + + /** Mark when the attribute has been explicitly set. */ + private boolean isSetFee = false; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + /** Mark when the attribute has been explicitly set. */ + private boolean isSetId = false; + + public static final String JSON_PROPERTY_INSTRUCTING_BALANCE_ACCOUNT_ID = + "instructingBalanceAccountId"; + private String instructingBalanceAccountId; + + /** Mark when the attribute has been explicitly set. */ + private boolean isSetInstructingBalanceAccountId = false; + + public static final String JSON_PROPERTY_REFERENCE_FOR_BENEFICIARY = "referenceForBeneficiary"; + private String referenceForBeneficiary; + + /** Mark when the attribute has been explicitly set. */ + private boolean isSetReferenceForBeneficiary = false; + + public static final String JSON_PROPERTY_TRANSFER_INSTRUMENT_ID = "transferInstrumentId"; + /* deprecated */ + @Deprecated 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 CashOutInfo() {} + + @JsonCreator + public CashOutInfo(@JsonProperty(JSON_PROPERTY_ID) String id) { + this(); + this.id = id; + } + + /** + * amount + * + * @param amount + * @return the current {@code CashOutInfo} instance, allowing for method chaining + */ + public CashOutInfo 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 CashOutInfo} instance, allowing for method chaining + */ + public CashOutInfo counterparty(CashOutInfoCounterparty counterparty) { + this.counterparty = counterparty; + isSetCounterparty = true; // mark as set + return this; + } + + /** + * Get counterparty + * + * @return counterparty + */ + @JsonProperty(JSON_PROPERTY_COUNTERPARTY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public CashOutInfoCounterparty getCounterparty() { + return counterparty; + } + + /** + * counterparty + * + * @param counterparty + */ + @JsonProperty(JSON_PROPERTY_COUNTERPARTY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setCounterparty(CashOutInfoCounterparty counterparty) { + this.counterparty = counterparty; + isSetCounterparty = true; // mark as set + } + + /** + * Allowed and returned only when you provide the `counterparty.transferInstrumentId` + * field. Your description of the cashout transfer. This description is used by most banks as the + * transfer description. We recommend sending a maximum of 140 characters, otherwise the + * description may be truncated. If you do not provide a description, Adyen generates a + * description automatically. This generated description is not returned in the response. + * Supported characters: **[a-z] [A-Z] [0-9] / - ? : ( ) . , ' + Space**. + * + * @param description Allowed and returned only when you provide the + * `counterparty.transferInstrumentId` field. Your description of the cashout + * transfer. This description is used by most banks as the transfer description. We recommend + * sending a maximum of 140 characters, otherwise the description may be truncated. If you do + * not provide a description, Adyen generates a description automatically. This generated + * description is not returned in the response. Supported characters: **[a-z] [A-Z] [0-9] / - + * ? : ( ) . , ' + Space**. + * @return the current {@code CashOutInfo} instance, allowing for method chaining + */ + public CashOutInfo description(String description) { + this.description = description; + isSetDescription = true; // mark as set + return this; + } + + /** + * Allowed and returned only when you provide the `counterparty.transferInstrumentId` + * field. Your description of the cashout transfer. This description is used by most banks as the + * transfer description. We recommend sending a maximum of 140 characters, otherwise the + * description may be truncated. If you do not provide a description, Adyen generates a + * description automatically. This generated description is not returned in the response. + * Supported characters: **[a-z] [A-Z] [0-9] / - ? : ( ) . , ' + Space**. + * + * @return description Allowed and returned only when you provide the + * `counterparty.transferInstrumentId` field. Your description of the cashout + * transfer. This description is used by most banks as the transfer description. We recommend + * sending a maximum of 140 characters, otherwise the description may be truncated. If you do + * not provide a description, Adyen generates a description automatically. This generated + * description is not returned in the response. Supported characters: **[a-z] [A-Z] [0-9] / - + * ? : ( ) . , ' + Space**. + */ + @JsonProperty(JSON_PROPERTY_DESCRIPTION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getDescription() { + return description; + } + + /** + * Allowed and returned only when you provide the `counterparty.transferInstrumentId` + * field. Your description of the cashout transfer. This description is used by most banks as the + * transfer description. We recommend sending a maximum of 140 characters, otherwise the + * description may be truncated. If you do not provide a description, Adyen generates a + * description automatically. This generated description is not returned in the response. + * Supported characters: **[a-z] [A-Z] [0-9] / - ? : ( ) . , ' + Space**. + * + * @param description Allowed and returned only when you provide the + * `counterparty.transferInstrumentId` field. Your description of the cashout + * transfer. This description is used by most banks as the transfer description. We recommend + * sending a maximum of 140 characters, otherwise the description may be truncated. If you do + * not provide a description, Adyen generates a description automatically. This generated + * description is not returned in the response. Supported characters: **[a-z] [A-Z] [0-9] / - + * ? : ( ) . , ' + Space**. + */ + @JsonProperty(JSON_PROPERTY_DESCRIPTION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setDescription(String description) { + this.description = description; + isSetDescription = true; // mark as set + } + + /** + * fee + * + * @param fee + * @return the current {@code CashOutInfo} instance, allowing for method chaining + */ + public CashOutInfo fee(Fee fee) { + this.fee = fee; + isSetFee = true; // mark as set + return this; + } + + /** + * Get fee + * + * @return fee + */ + @JsonProperty(JSON_PROPERTY_FEE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Fee getFee() { + return fee; + } + + /** + * fee + * + * @param fee + */ + @JsonProperty(JSON_PROPERTY_FEE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setFee(Fee fee) { + this.fee = fee; + isSetFee = true; // mark as set + } + + /** + * The ID of the resource. + * + * @return id The ID of the resource. + */ + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getId() { + return id; + } + + /** + * The unique identifier of the balance account that initiates the cashout request. + * + * @param instructingBalanceAccountId The unique identifier of the balance account that initiates + * the cashout request. + * @return the current {@code CashOutInfo} instance, allowing for method chaining + */ + public CashOutInfo instructingBalanceAccountId(String instructingBalanceAccountId) { + this.instructingBalanceAccountId = instructingBalanceAccountId; + isSetInstructingBalanceAccountId = true; // mark as set + return this; + } + + /** + * The unique identifier of the balance account that initiates the cashout request. + * + * @return instructingBalanceAccountId The unique identifier of the balance account that initiates + * the cashout request. + */ + @JsonProperty(JSON_PROPERTY_INSTRUCTING_BALANCE_ACCOUNT_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getInstructingBalanceAccountId() { + return instructingBalanceAccountId; + } + + /** + * The unique identifier of the balance account that initiates the cashout request. + * + * @param instructingBalanceAccountId The unique identifier of the balance account that initiates + * the cashout request. + */ + @JsonProperty(JSON_PROPERTY_INSTRUCTING_BALANCE_ACCOUNT_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setInstructingBalanceAccountId(String instructingBalanceAccountId) { + this.instructingBalanceAccountId = instructingBalanceAccountId; + isSetInstructingBalanceAccountId = true; // mark as set + } + + /** + * Allowed and returned only when you provide the `counterparty.transferInstrumentId` + * field. The reference that is sent to the recipient of a cashout transfer. This reference is + * also sent in all webhooks related to the cashout transfer, so you can use it to track the + * status of the transfer. If you do not provide a reference for the beneficiary, Adyen generates + * one automatically. This generated reference for the beneficiary is not returned in the + * response. Supported characters: **a-z**, **A-Z**, **0-9**. + * + * @param referenceForBeneficiary Allowed and returned only when you provide the + * `counterparty.transferInstrumentId` field. The reference that is sent to the + * recipient of a cashout transfer. This reference is also sent in all webhooks related to the + * cashout transfer, so you can use it to track the status of the transfer. If you do not + * provide a reference for the beneficiary, Adyen generates one automatically. This generated + * reference for the beneficiary is not returned in the response. Supported characters: + * **a-z**, **A-Z**, **0-9**. + * @return the current {@code CashOutInfo} instance, allowing for method chaining + */ + public CashOutInfo referenceForBeneficiary(String referenceForBeneficiary) { + this.referenceForBeneficiary = referenceForBeneficiary; + isSetReferenceForBeneficiary = true; // mark as set + return this; + } + + /** + * Allowed and returned only when you provide the `counterparty.transferInstrumentId` + * field. The reference that is sent to the recipient of a cashout transfer. This reference is + * also sent in all webhooks related to the cashout transfer, so you can use it to track the + * status of the transfer. If you do not provide a reference for the beneficiary, Adyen generates + * one automatically. This generated reference for the beneficiary is not returned in the + * response. Supported characters: **a-z**, **A-Z**, **0-9**. + * + * @return referenceForBeneficiary Allowed and returned only when you provide the + * `counterparty.transferInstrumentId` field. The reference that is sent to the + * recipient of a cashout transfer. This reference is also sent in all webhooks related to the + * cashout transfer, so you can use it to track the status of the transfer. If you do not + * provide a reference for the beneficiary, Adyen generates one automatically. This generated + * reference for the beneficiary is not returned in the response. Supported characters: + * **a-z**, **A-Z**, **0-9**. + */ + @JsonProperty(JSON_PROPERTY_REFERENCE_FOR_BENEFICIARY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getReferenceForBeneficiary() { + return referenceForBeneficiary; + } + + /** + * Allowed and returned only when you provide the `counterparty.transferInstrumentId` + * field. The reference that is sent to the recipient of a cashout transfer. This reference is + * also sent in all webhooks related to the cashout transfer, so you can use it to track the + * status of the transfer. If you do not provide a reference for the beneficiary, Adyen generates + * one automatically. This generated reference for the beneficiary is not returned in the + * response. Supported characters: **a-z**, **A-Z**, **0-9**. + * + * @param referenceForBeneficiary Allowed and returned only when you provide the + * `counterparty.transferInstrumentId` field. The reference that is sent to the + * recipient of a cashout transfer. This reference is also sent in all webhooks related to the + * cashout transfer, so you can use it to track the status of the transfer. If you do not + * provide a reference for the beneficiary, Adyen generates one automatically. This generated + * reference for the beneficiary is not returned in the response. Supported characters: + * **a-z**, **A-Z**, **0-9**. + */ + @JsonProperty(JSON_PROPERTY_REFERENCE_FOR_BENEFICIARY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setReferenceForBeneficiary(String referenceForBeneficiary) { + this.referenceForBeneficiary = referenceForBeneficiary; + isSetReferenceForBeneficiary = true; // mark as set + } + + /** + * **Use `counterparty.transferInstrumentId` instead.** The unique identifier of the + * counterparty transfer instrument. + * + * @param transferInstrumentId **Use `counterparty.transferInstrumentId` instead.** The + * unique identifier of the counterparty transfer instrument. + * @return the current {@code CashOutInfo} instance, allowing for method chaining + * @deprecated + */ + @Deprecated + public CashOutInfo transferInstrumentId(String transferInstrumentId) { + this.transferInstrumentId = transferInstrumentId; + isSetTransferInstrumentId = true; // mark as set + return this; + } + + /** + * **Use `counterparty.transferInstrumentId` instead.** The unique identifier of the + * counterparty transfer instrument. + * + * @return transferInstrumentId **Use `counterparty.transferInstrumentId` instead.** The + * unique identifier of the counterparty transfer instrument. + * @deprecated + */ + @Deprecated + @JsonProperty(JSON_PROPERTY_TRANSFER_INSTRUMENT_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getTransferInstrumentId() { + return transferInstrumentId; + } + + /** + * **Use `counterparty.transferInstrumentId` instead.** The unique identifier of the + * counterparty transfer instrument. + * + * @param transferInstrumentId **Use `counterparty.transferInstrumentId` instead.** The + * unique identifier of the counterparty transfer instrument. + * @deprecated + */ + @Deprecated + @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 CashOutInfo 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 CashOutInfo object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CashOutInfo cashOutInfo = (CashOutInfo) o; + return Objects.equals(this.amount, cashOutInfo.amount) + && Objects.equals(this.isSetAmount, cashOutInfo.isSetAmount) + && Objects.equals(this.counterparty, cashOutInfo.counterparty) + && Objects.equals(this.isSetCounterparty, cashOutInfo.isSetCounterparty) + && Objects.equals(this.description, cashOutInfo.description) + && Objects.equals(this.isSetDescription, cashOutInfo.isSetDescription) + && Objects.equals(this.fee, cashOutInfo.fee) + && Objects.equals(this.isSetFee, cashOutInfo.isSetFee) + && Objects.equals(this.id, cashOutInfo.id) + && Objects.equals(this.isSetId, cashOutInfo.isSetId) + && Objects.equals(this.instructingBalanceAccountId, cashOutInfo.instructingBalanceAccountId) + && Objects.equals( + this.isSetInstructingBalanceAccountId, cashOutInfo.isSetInstructingBalanceAccountId) + && Objects.equals(this.referenceForBeneficiary, cashOutInfo.referenceForBeneficiary) + && Objects.equals( + this.isSetReferenceForBeneficiary, cashOutInfo.isSetReferenceForBeneficiary) + && Objects.equals(this.transferInstrumentId, cashOutInfo.transferInstrumentId) + && Objects.equals(this.isSetTransferInstrumentId, cashOutInfo.isSetTransferInstrumentId); + } + + @Override + public int hashCode() { + return Objects.hash( + amount, + isSetAmount, + counterparty, + isSetCounterparty, + description, + isSetDescription, + fee, + isSetFee, + id, + isSetId, + instructingBalanceAccountId, + isSetInstructingBalanceAccountId, + referenceForBeneficiary, + isSetReferenceForBeneficiary, + transferInstrumentId, + isSetTransferInstrumentId); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CashOutInfo {\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" counterparty: ").append(toIndentedString(counterparty)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" fee: ").append(toIndentedString(fee)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" instructingBalanceAccountId: ") + .append(toIndentedString(instructingBalanceAccountId)) + .append("\n"); + sb.append(" referenceForBeneficiary: ") + .append(toIndentedString(referenceForBeneficiary)) + .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 (isSetAmount) { + addIfNull(nulls, JSON_PROPERTY_AMOUNT, this.amount); + } + if (isSetCounterparty) { + addIfNull(nulls, JSON_PROPERTY_COUNTERPARTY, this.counterparty); + } + if (isSetDescription) { + addIfNull(nulls, JSON_PROPERTY_DESCRIPTION, this.description); + } + if (isSetFee) { + addIfNull(nulls, JSON_PROPERTY_FEE, this.fee); + } + if (isSetId) { + addIfNull(nulls, JSON_PROPERTY_ID, this.id); + } + if (isSetInstructingBalanceAccountId) { + addIfNull( + nulls, JSON_PROPERTY_INSTRUCTING_BALANCE_ACCOUNT_ID, this.instructingBalanceAccountId); + } + if (isSetReferenceForBeneficiary) { + addIfNull(nulls, JSON_PROPERTY_REFERENCE_FOR_BENEFICIARY, this.referenceForBeneficiary); + } + 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 CashOutInfo given an JSON string + * + * @param jsonString JSON string + * @return An instance of CashOutInfo + * @throws JsonProcessingException if the JSON string is invalid with respect to CashOutInfo + */ + public static CashOutInfo fromJson(String jsonString) throws JsonProcessingException { + return JSON.getMapper().readValue(jsonString, CashOutInfo.class); + } + + /** + * Convert an instance of CashOutInfo 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/CashOutInfoCounterparty.java b/src/main/java/com/adyen/model/transfers/CashOutInfoCounterparty.java new file mode 100644 index 000000000..5bef90256 --- /dev/null +++ b/src/main/java/com/adyen/model/transfers/CashOutInfoCounterparty.java @@ -0,0 +1,191 @@ +/* + * 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.*; + +/** CashOutInfoCounterparty */ +@JsonPropertyOrder({CashOutInfoCounterparty.JSON_PROPERTY_TRANSFER_INSTRUMENT_ID}) +public class CashOutInfoCounterparty { + 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 CashOutInfoCounterparty() {} + + /** + * The unique identifier of the counterparty transfer instrument. If you do not provide this + * field, the cashout funds remain in the instructing balance account after the cashout transfer + * is settled. + * + * @param transferInstrumentId The unique identifier of the counterparty transfer instrument. If + * you do not provide this field, the cashout funds remain in the instructing balance account + * after the cashout transfer is settled. + * @return the current {@code CashOutInfoCounterparty} instance, allowing for method chaining + */ + public CashOutInfoCounterparty transferInstrumentId(String transferInstrumentId) { + this.transferInstrumentId = transferInstrumentId; + isSetTransferInstrumentId = true; // mark as set + return this; + } + + /** + * The unique identifier of the counterparty transfer instrument. If you do not provide this + * field, the cashout funds remain in the instructing balance account after the cashout transfer + * is settled. + * + * @return transferInstrumentId The unique identifier of the counterparty transfer instrument. If + * you do not provide this field, the cashout funds remain in the instructing balance account + * after the cashout transfer is settled. + */ + @JsonProperty(JSON_PROPERTY_TRANSFER_INSTRUMENT_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getTransferInstrumentId() { + return transferInstrumentId; + } + + /** + * The unique identifier of the counterparty transfer instrument. If you do not provide this + * field, the cashout funds remain in the instructing balance account after the cashout transfer + * is settled. + * + * @param transferInstrumentId The unique identifier of the counterparty transfer instrument. If + * you do not provide this field, the cashout funds remain in the instructing balance account + * after the cashout transfer is settled. + */ + @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 CashOutInfoCounterparty 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 CashOutInfoCounterparty object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CashOutInfoCounterparty cashOutInfoCounterparty = (CashOutInfoCounterparty) o; + return Objects.equals(this.transferInstrumentId, cashOutInfoCounterparty.transferInstrumentId) + && Objects.equals( + this.isSetTransferInstrumentId, cashOutInfoCounterparty.isSetTransferInstrumentId); + } + + @Override + public int hashCode() { + return Objects.hash(transferInstrumentId, isSetTransferInstrumentId); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CashOutInfoCounterparty {\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 (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 CashOutInfoCounterparty given an JSON string + * + * @param jsonString JSON string + * @return An instance of CashOutInfoCounterparty + * @throws JsonProcessingException if the JSON string is invalid with respect to + * CashOutInfoCounterparty + */ + public static CashOutInfoCounterparty fromJson(String jsonString) throws JsonProcessingException { + return JSON.getMapper().readValue(jsonString, CashOutInfoCounterparty.class); + } + + /** + * Convert an instance of CashOutInfoCounterparty 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/CashOutTransfer.java b/src/main/java/com/adyen/model/transfers/CashOutTransfer.java new file mode 100644 index 000000000..33ca43c5b --- /dev/null +++ b/src/main/java/com/adyen/model/transfers/CashOutTransfer.java @@ -0,0 +1,337 @@ +/* + * 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; + +/** CashOutTransfer */ +@JsonPropertyOrder({ + CashOutTransfer.JSON_PROPERTY_AMOUNT, + CashOutTransfer.JSON_PROPERTY_ID, + CashOutTransfer.JSON_PROPERTY_TYPE +}) +public class CashOutTransfer { + 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_ID = "id"; + private String id; + + /** Mark when the attribute has been explicitly set. */ + private boolean isSetId = false; + + /** + * The type of the cashout transfer. Possible values: - **cashoutRepayment**: Corresponds to the + * transfer created to deduct the cashout amount after settlement. - **cashoutFee**: Corresponds + * to the transfer created to debit the cashout fee form the user's balance account. + */ + public enum TypeEnum { + CASHOUTREPAYMENT(String.valueOf("cashoutRepayment")), + + CASHOUTFEE(String.valueOf("cashoutFee")); + + 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 CashOutTransfer() {} + + /** + * amount + * + * @param amount + * @return the current {@code CashOutTransfer} instance, allowing for method chaining + */ + public CashOutTransfer 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 + } + + /** + * The reference of the cashout transfer. + * + * @param id The reference of the cashout transfer. + * @return the current {@code CashOutTransfer} instance, allowing for method chaining + */ + public CashOutTransfer id(String id) { + this.id = id; + isSetId = true; // mark as set + return this; + } + + /** + * The reference of the cashout transfer. + * + * @return id The reference of the cashout transfer. + */ + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getId() { + return id; + } + + /** + * The reference of the cashout transfer. + * + * @param id The reference of the cashout transfer. + */ + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setId(String id) { + this.id = id; + isSetId = true; // mark as set + } + + /** + * The type of the cashout transfer. Possible values: - **cashoutRepayment**: Corresponds to the + * transfer created to deduct the cashout amount after settlement. - **cashoutFee**: Corresponds + * to the transfer created to debit the cashout fee form the user's balance account. + * + * @param type The type of the cashout transfer. Possible values: - **cashoutRepayment**: + * Corresponds to the transfer created to deduct the cashout amount after settlement. - + * **cashoutFee**: Corresponds to the transfer created to debit the cashout fee form the + * user's balance account. + * @return the current {@code CashOutTransfer} instance, allowing for method chaining + */ + public CashOutTransfer type(TypeEnum type) { + this.type = type; + isSetType = true; // mark as set + return this; + } + + /** + * The type of the cashout transfer. Possible values: - **cashoutRepayment**: Corresponds to the + * transfer created to deduct the cashout amount after settlement. - **cashoutFee**: Corresponds + * to the transfer created to debit the cashout fee form the user's balance account. + * + * @return type The type of the cashout transfer. Possible values: - **cashoutRepayment**: + * Corresponds to the transfer created to deduct the cashout amount after settlement. - + * **cashoutFee**: Corresponds to the transfer created to debit the cashout fee form the + * user's balance account. + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public TypeEnum getType() { + return type; + } + + /** + * The type of the cashout transfer. Possible values: - **cashoutRepayment**: Corresponds to the + * transfer created to deduct the cashout amount after settlement. - **cashoutFee**: Corresponds + * to the transfer created to debit the cashout fee form the user's balance account. + * + * @param type The type of the cashout transfer. Possible values: - **cashoutRepayment**: + * Corresponds to the transfer created to deduct the cashout amount after settlement. - + * **cashoutFee**: Corresponds to the transfer created to debit the cashout fee form the + * user's balance account. + */ + @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 CashOutTransfer 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 CashOutTransfer object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CashOutTransfer cashOutTransfer = (CashOutTransfer) o; + return Objects.equals(this.amount, cashOutTransfer.amount) + && Objects.equals(this.isSetAmount, cashOutTransfer.isSetAmount) + && Objects.equals(this.id, cashOutTransfer.id) + && Objects.equals(this.isSetId, cashOutTransfer.isSetId) + && Objects.equals(this.type, cashOutTransfer.type) + && Objects.equals(this.isSetType, cashOutTransfer.isSetType); + } + + @Override + public int hashCode() { + return Objects.hash(amount, isSetAmount, id, isSetId, type, isSetType); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CashOutTransfer {\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).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 (isSetAmount) { + addIfNull(nulls, JSON_PROPERTY_AMOUNT, this.amount); + } + if (isSetId) { + addIfNull(nulls, JSON_PROPERTY_ID, this.id); + } + 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 CashOutTransfer given an JSON string + * + * @param jsonString JSON string + * @return An instance of CashOutTransfer + * @throws JsonProcessingException if the JSON string is invalid with respect to CashOutTransfer + */ + public static CashOutTransfer fromJson(String jsonString) throws JsonProcessingException { + return JSON.getMapper().readValue(jsonString, CashOutTransfer.class); + } + + /** + * Convert an instance of CashOutTransfer 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/DefaultErrorResponseEntity.java b/src/main/java/com/adyen/model/transfers/DefaultErrorResponseEntity.java new file mode 100644 index 000000000..47bcac886 --- /dev/null +++ b/src/main/java/com/adyen/model/transfers/DefaultErrorResponseEntity.java @@ -0,0 +1,547 @@ +/* + * 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.*; +import java.util.ArrayList; +import java.util.List; + +/** Standardized error response following RFC-7807 format */ +@JsonPropertyOrder({ + DefaultErrorResponseEntity.JSON_PROPERTY_DETAIL, + DefaultErrorResponseEntity.JSON_PROPERTY_ERROR_CODE, + DefaultErrorResponseEntity.JSON_PROPERTY_INSTANCE, + DefaultErrorResponseEntity.JSON_PROPERTY_INVALID_FIELDS, + DefaultErrorResponseEntity.JSON_PROPERTY_REQUEST_ID, + DefaultErrorResponseEntity.JSON_PROPERTY_STATUS, + DefaultErrorResponseEntity.JSON_PROPERTY_TITLE, + DefaultErrorResponseEntity.JSON_PROPERTY_TYPE +}) +public class DefaultErrorResponseEntity { + public static final String JSON_PROPERTY_DETAIL = "detail"; + private String detail; + + /** Mark when the attribute has been explicitly set. */ + private boolean isSetDetail = false; + + public static final String JSON_PROPERTY_ERROR_CODE = "errorCode"; + private String errorCode; + + /** Mark when the attribute has been explicitly set. */ + private boolean isSetErrorCode = false; + + public static final String JSON_PROPERTY_INSTANCE = "instance"; + private String instance; + + /** Mark when the attribute has been explicitly set. */ + private boolean isSetInstance = false; + + public static final String JSON_PROPERTY_INVALID_FIELDS = "invalidFields"; + private List invalidFields; + + /** Mark when the attribute has been explicitly set. */ + private boolean isSetInvalidFields = false; + + public static final String JSON_PROPERTY_REQUEST_ID = "requestId"; + private String requestId; + + /** Mark when the attribute has been explicitly set. */ + private boolean isSetRequestId = false; + + public static final String JSON_PROPERTY_STATUS = "status"; + private Integer status; + + /** Mark when the attribute has been explicitly set. */ + private boolean isSetStatus = false; + + public static final String JSON_PROPERTY_TITLE = "title"; + private String title; + + /** Mark when the attribute has been explicitly set. */ + private boolean isSetTitle = false; + + public static final String JSON_PROPERTY_TYPE = "type"; + private String 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 DefaultErrorResponseEntity() {} + + /** + * A human-readable explanation specific to this occurrence of the problem. + * + * @param detail A human-readable explanation specific to this occurrence of the problem. + * @return the current {@code DefaultErrorResponseEntity} instance, allowing for method chaining + */ + public DefaultErrorResponseEntity detail(String detail) { + this.detail = detail; + isSetDetail = true; // mark as set + return this; + } + + /** + * A human-readable explanation specific to this occurrence of the problem. + * + * @return detail A human-readable explanation specific to this occurrence of the problem. + */ + @JsonProperty(JSON_PROPERTY_DETAIL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getDetail() { + return detail; + } + + /** + * A human-readable explanation specific to this occurrence of the problem. + * + * @param detail A human-readable explanation specific to this occurrence of the problem. + */ + @JsonProperty(JSON_PROPERTY_DETAIL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setDetail(String detail) { + this.detail = detail; + isSetDetail = true; // mark as set + } + + /** + * Unique business error code. + * + * @param errorCode Unique business error code. + * @return the current {@code DefaultErrorResponseEntity} instance, allowing for method chaining + */ + public DefaultErrorResponseEntity errorCode(String errorCode) { + this.errorCode = errorCode; + isSetErrorCode = true; // mark as set + return this; + } + + /** + * Unique business error code. + * + * @return errorCode Unique business error code. + */ + @JsonProperty(JSON_PROPERTY_ERROR_CODE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getErrorCode() { + return errorCode; + } + + /** + * Unique business error code. + * + * @param errorCode Unique business error code. + */ + @JsonProperty(JSON_PROPERTY_ERROR_CODE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setErrorCode(String errorCode) { + this.errorCode = errorCode; + isSetErrorCode = true; // mark as set + } + + /** + * A URI that identifies the specific occurrence of the problem if applicable. + * + * @param instance A URI that identifies the specific occurrence of the problem if applicable. + * @return the current {@code DefaultErrorResponseEntity} instance, allowing for method chaining + */ + public DefaultErrorResponseEntity instance(String instance) { + this.instance = instance; + isSetInstance = true; // mark as set + return this; + } + + /** + * A URI that identifies the specific occurrence of the problem if applicable. + * + * @return instance A URI that identifies the specific occurrence of the problem if applicable. + */ + @JsonProperty(JSON_PROPERTY_INSTANCE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getInstance() { + return instance; + } + + /** + * A URI that identifies the specific occurrence of the problem if applicable. + * + * @param instance A URI that identifies the specific occurrence of the problem if applicable. + */ + @JsonProperty(JSON_PROPERTY_INSTANCE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setInstance(String instance) { + this.instance = instance; + isSetInstance = true; // mark as set + } + + /** + * Array of fields with validation errors when applicable. + * + * @param invalidFields Array of fields with validation errors when applicable. + * @return the current {@code DefaultErrorResponseEntity} instance, allowing for method chaining + */ + public DefaultErrorResponseEntity invalidFields(List invalidFields) { + this.invalidFields = invalidFields; + isSetInvalidFields = true; // mark as set + return this; + } + + public DefaultErrorResponseEntity addInvalidFieldsItem(InvalidField invalidFieldsItem) { + if (this.invalidFields == null) { + this.invalidFields = new ArrayList<>(); + } + this.invalidFields.add(invalidFieldsItem); + return this; + } + + /** + * Array of fields with validation errors when applicable. + * + * @return invalidFields Array of fields with validation errors when applicable. + */ + @JsonProperty(JSON_PROPERTY_INVALID_FIELDS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getInvalidFields() { + return invalidFields; + } + + /** + * Array of fields with validation errors when applicable. + * + * @param invalidFields Array of fields with validation errors when applicable. + */ + @JsonProperty(JSON_PROPERTY_INVALID_FIELDS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setInvalidFields(List invalidFields) { + this.invalidFields = invalidFields; + isSetInvalidFields = true; // mark as set + } + + /** + * The unique reference for the request. + * + * @param requestId The unique reference for the request. + * @return the current {@code DefaultErrorResponseEntity} instance, allowing for method chaining + */ + public DefaultErrorResponseEntity requestId(String requestId) { + this.requestId = requestId; + isSetRequestId = true; // mark as set + return this; + } + + /** + * The unique reference for the request. + * + * @return requestId The unique reference for the request. + */ + @JsonProperty(JSON_PROPERTY_REQUEST_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getRequestId() { + return requestId; + } + + /** + * The unique reference for the request. + * + * @param requestId The unique reference for the request. + */ + @JsonProperty(JSON_PROPERTY_REQUEST_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setRequestId(String requestId) { + this.requestId = requestId; + isSetRequestId = true; // mark as set + } + + /** + * The HTTP status code. + * + * @param status The HTTP status code. + * @return the current {@code DefaultErrorResponseEntity} instance, allowing for method chaining + */ + public DefaultErrorResponseEntity status(Integer status) { + this.status = status; + isSetStatus = true; // mark as set + return this; + } + + /** + * The HTTP status code. + * + * @return status The HTTP status code. + */ + @JsonProperty(JSON_PROPERTY_STATUS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Integer getStatus() { + return status; + } + + /** + * The HTTP status code. + * + * @param status The HTTP status code. + */ + @JsonProperty(JSON_PROPERTY_STATUS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setStatus(Integer status) { + this.status = status; + isSetStatus = true; // mark as set + } + + /** + * A short, human-readable summary of the problem type. + * + * @param title A short, human-readable summary of the problem type. + * @return the current {@code DefaultErrorResponseEntity} instance, allowing for method chaining + */ + public DefaultErrorResponseEntity title(String title) { + this.title = title; + isSetTitle = true; // mark as set + return this; + } + + /** + * A short, human-readable summary of the problem type. + * + * @return title A short, human-readable summary of the problem type. + */ + @JsonProperty(JSON_PROPERTY_TITLE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getTitle() { + return title; + } + + /** + * A short, human-readable summary of the problem type. + * + * @param title A short, human-readable summary of the problem type. + */ + @JsonProperty(JSON_PROPERTY_TITLE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setTitle(String title) { + this.title = title; + isSetTitle = true; // mark as set + } + + /** + * A URI that identifies the validation error type. It points to human-readable documentation for + * the problem type. + * + * @param type A URI that identifies the validation error type. It points to human-readable + * documentation for the problem type. + * @return the current {@code DefaultErrorResponseEntity} instance, allowing for method chaining + */ + public DefaultErrorResponseEntity type(String type) { + this.type = type; + isSetType = true; // mark as set + return this; + } + + /** + * A URI that identifies the validation error type. It points to human-readable documentation for + * the problem type. + * + * @return type A URI that identifies the validation error type. It points to human-readable + * documentation for the problem type. + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getType() { + return type; + } + + /** + * A URI that identifies the validation error type. It points to human-readable documentation for + * the problem type. + * + * @param type A URI that identifies the validation error type. It points to human-readable + * documentation for the problem type. + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setType(String type) { + this.type = type; + isSetType = true; // mark as set + } + + /** + * Configures whether null values are explicitly serialized in the JSON payload. Default is false. + */ + public DefaultErrorResponseEntity 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 DefaultErrorResponseEntity object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DefaultErrorResponseEntity defaultErrorResponseEntity = (DefaultErrorResponseEntity) o; + return Objects.equals(this.detail, defaultErrorResponseEntity.detail) + && Objects.equals(this.isSetDetail, defaultErrorResponseEntity.isSetDetail) + && Objects.equals(this.errorCode, defaultErrorResponseEntity.errorCode) + && Objects.equals(this.isSetErrorCode, defaultErrorResponseEntity.isSetErrorCode) + && Objects.equals(this.instance, defaultErrorResponseEntity.instance) + && Objects.equals(this.isSetInstance, defaultErrorResponseEntity.isSetInstance) + && Objects.equals(this.invalidFields, defaultErrorResponseEntity.invalidFields) + && Objects.equals(this.isSetInvalidFields, defaultErrorResponseEntity.isSetInvalidFields) + && Objects.equals(this.requestId, defaultErrorResponseEntity.requestId) + && Objects.equals(this.isSetRequestId, defaultErrorResponseEntity.isSetRequestId) + && Objects.equals(this.status, defaultErrorResponseEntity.status) + && Objects.equals(this.isSetStatus, defaultErrorResponseEntity.isSetStatus) + && Objects.equals(this.title, defaultErrorResponseEntity.title) + && Objects.equals(this.isSetTitle, defaultErrorResponseEntity.isSetTitle) + && Objects.equals(this.type, defaultErrorResponseEntity.type) + && Objects.equals(this.isSetType, defaultErrorResponseEntity.isSetType); + } + + @Override + public int hashCode() { + return Objects.hash( + detail, + isSetDetail, + errorCode, + isSetErrorCode, + instance, + isSetInstance, + invalidFields, + isSetInvalidFields, + requestId, + isSetRequestId, + status, + isSetStatus, + title, + isSetTitle, + type, + isSetType); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DefaultErrorResponseEntity {\n"); + sb.append(" detail: ").append(toIndentedString(detail)).append("\n"); + sb.append(" errorCode: ").append(toIndentedString(errorCode)).append("\n"); + sb.append(" instance: ").append(toIndentedString(instance)).append("\n"); + sb.append(" invalidFields: ").append(toIndentedString(invalidFields)).append("\n"); + sb.append(" requestId: ").append(toIndentedString(requestId)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" title: ").append(toIndentedString(title)).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 (isSetDetail) { + addIfNull(nulls, JSON_PROPERTY_DETAIL, this.detail); + } + if (isSetErrorCode) { + addIfNull(nulls, JSON_PROPERTY_ERROR_CODE, this.errorCode); + } + if (isSetInstance) { + addIfNull(nulls, JSON_PROPERTY_INSTANCE, this.instance); + } + if (isSetInvalidFields) { + addIfNull(nulls, JSON_PROPERTY_INVALID_FIELDS, this.invalidFields); + } + if (isSetRequestId) { + addIfNull(nulls, JSON_PROPERTY_REQUEST_ID, this.requestId); + } + if (isSetStatus) { + addIfNull(nulls, JSON_PROPERTY_STATUS, this.status); + } + if (isSetTitle) { + addIfNull(nulls, JSON_PROPERTY_TITLE, this.title); + } + 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 DefaultErrorResponseEntity given an JSON string + * + * @param jsonString JSON string + * @return An instance of DefaultErrorResponseEntity + * @throws JsonProcessingException if the JSON string is invalid with respect to + * DefaultErrorResponseEntity + */ + public static DefaultErrorResponseEntity fromJson(String jsonString) + throws JsonProcessingException { + return JSON.getMapper().readValue(jsonString, DefaultErrorResponseEntity.class); + } + + /** + * Convert an instance of DefaultErrorResponseEntity 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/NetworkReason.java b/src/main/java/com/adyen/model/transfers/NetworkReason.java new file mode 100644 index 000000000..567e5b391 --- /dev/null +++ b/src/main/java/com/adyen/model/transfers/NetworkReason.java @@ -0,0 +1,334 @@ +/* + * 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; + +/** NetworkReason */ +@JsonPropertyOrder({ + NetworkReason.JSON_PROPERTY_CODE, + NetworkReason.JSON_PROPERTY_DESCRIPTION, + NetworkReason.JSON_PROPERTY_NAMESPACE +}) +public class NetworkReason { + public static final String JSON_PROPERTY_CODE = "code"; + private String code; + + /** Mark when the attribute has been explicitly set. */ + private boolean isSetCode = false; + + public static final String JSON_PROPERTY_DESCRIPTION = "description"; + private String description; + + /** Mark when the attribute has been explicitly set. */ + private boolean isSetDescription = false; + + /** + * The namespace that corresponds to the reason code. Possible values: * **ukFpsRejectionCode** * + * **ukFpsReturnReasonCode** * **usAchReturnReasonCode** * **iso8583ResponseCode** + */ + public enum NamespaceEnum { + ISO8583RESPONSECODE(String.valueOf("iso8583ResponseCode")), + + UKFPSREJECTIONCODE(String.valueOf("ukFpsRejectionCode")), + + UKFPSRETURNREASONCODE(String.valueOf("ukFpsReturnReasonCode")), + + USACHRETURNREASONCODE(String.valueOf("usAchReturnReasonCode")); + + private static final Logger LOG = Logger.getLogger(NamespaceEnum.class.getName()); + + private String value; + + NamespaceEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static NamespaceEnum fromValue(String value) { + for (NamespaceEnum b : NamespaceEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + // handling unexpected value + LOG.warning( + "NamespaceEnum: unexpected enum value '" + + value + + "' - Supported values are " + + Arrays.toString(NamespaceEnum.values())); + return null; + } + } + + public static final String JSON_PROPERTY_NAMESPACE = "namespace"; + private NamespaceEnum namespace; + + /** Mark when the attribute has been explicitly set. */ + private boolean isSetNamespace = false; + + /** + * Sets whether attributes with null values should be explicitly included in the JSON payload. + * Default is false. + */ + @JsonIgnore private boolean includeNullValues = false; + + public NetworkReason() {} + + /** + * The reason code provided by the network. + * + * @param code The reason code provided by the network. + * @return the current {@code NetworkReason} instance, allowing for method chaining + */ + public NetworkReason code(String code) { + this.code = code; + isSetCode = true; // mark as set + return this; + } + + /** + * The reason code provided by the network. + * + * @return code The reason code provided by the network. + */ + @JsonProperty(JSON_PROPERTY_CODE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getCode() { + return code; + } + + /** + * The reason code provided by the network. + * + * @param code The reason code provided by the network. + */ + @JsonProperty(JSON_PROPERTY_CODE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setCode(String code) { + this.code = code; + isSetCode = true; // mark as set + } + + /** + * The description of the reason code. + * + * @param description The description of the reason code. + * @return the current {@code NetworkReason} instance, allowing for method chaining + */ + public NetworkReason description(String description) { + this.description = description; + isSetDescription = true; // mark as set + return this; + } + + /** + * The description of the reason code. + * + * @return description The description of the reason code. + */ + @JsonProperty(JSON_PROPERTY_DESCRIPTION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getDescription() { + return description; + } + + /** + * The description of the reason code. + * + * @param description The description of the reason code. + */ + @JsonProperty(JSON_PROPERTY_DESCRIPTION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setDescription(String description) { + this.description = description; + isSetDescription = true; // mark as set + } + + /** + * The namespace that corresponds to the reason code. Possible values: * **ukFpsRejectionCode** * + * **ukFpsReturnReasonCode** * **usAchReturnReasonCode** * **iso8583ResponseCode** + * + * @param namespace The namespace that corresponds to the reason code. Possible values: * + * **ukFpsRejectionCode** * **ukFpsReturnReasonCode** * **usAchReturnReasonCode** * + * **iso8583ResponseCode** + * @return the current {@code NetworkReason} instance, allowing for method chaining + */ + public NetworkReason namespace(NamespaceEnum namespace) { + this.namespace = namespace; + isSetNamespace = true; // mark as set + return this; + } + + /** + * The namespace that corresponds to the reason code. Possible values: * **ukFpsRejectionCode** * + * **ukFpsReturnReasonCode** * **usAchReturnReasonCode** * **iso8583ResponseCode** + * + * @return namespace The namespace that corresponds to the reason code. Possible values: * + * **ukFpsRejectionCode** * **ukFpsReturnReasonCode** * **usAchReturnReasonCode** * + * **iso8583ResponseCode** + */ + @JsonProperty(JSON_PROPERTY_NAMESPACE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public NamespaceEnum getNamespace() { + return namespace; + } + + /** + * The namespace that corresponds to the reason code. Possible values: * **ukFpsRejectionCode** * + * **ukFpsReturnReasonCode** * **usAchReturnReasonCode** * **iso8583ResponseCode** + * + * @param namespace The namespace that corresponds to the reason code. Possible values: * + * **ukFpsRejectionCode** * **ukFpsReturnReasonCode** * **usAchReturnReasonCode** * + * **iso8583ResponseCode** + */ + @JsonProperty(JSON_PROPERTY_NAMESPACE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setNamespace(NamespaceEnum namespace) { + this.namespace = namespace; + isSetNamespace = true; // mark as set + } + + /** + * Configures whether null values are explicitly serialized in the JSON payload. Default is false. + */ + public NetworkReason 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 NetworkReason object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + NetworkReason networkReason = (NetworkReason) o; + return Objects.equals(this.code, networkReason.code) + && Objects.equals(this.isSetCode, networkReason.isSetCode) + && Objects.equals(this.description, networkReason.description) + && Objects.equals(this.isSetDescription, networkReason.isSetDescription) + && Objects.equals(this.namespace, networkReason.namespace) + && Objects.equals(this.isSetNamespace, networkReason.isSetNamespace); + } + + @Override + public int hashCode() { + return Objects.hash(code, isSetCode, description, isSetDescription, namespace, isSetNamespace); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class NetworkReason {\n"); + sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" namespace: ").append(toIndentedString(namespace)).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 (isSetCode) { + addIfNull(nulls, JSON_PROPERTY_CODE, this.code); + } + if (isSetDescription) { + addIfNull(nulls, JSON_PROPERTY_DESCRIPTION, this.description); + } + if (isSetNamespace) { + addIfNull(nulls, JSON_PROPERTY_NAMESPACE, this.namespace); + } + + 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 NetworkReason given an JSON string + * + * @param jsonString JSON string + * @return An instance of NetworkReason + * @throws JsonProcessingException if the JSON string is invalid with respect to NetworkReason + */ + public static NetworkReason fromJson(String jsonString) throws JsonProcessingException { + return JSON.getMapper().readValue(jsonString, NetworkReason.class); + } + + /** + * Convert an instance of NetworkReason 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/Transfer.java b/src/main/java/com/adyen/model/transfers/Transfer.java index d06893ded..d5cc5642e 100644 --- a/src/main/java/com/adyen/model/transfers/Transfer.java +++ b/src/main/java/com/adyen/model/transfers/Transfer.java @@ -468,11 +468,11 @@ public static ReasonEnum fromValue(String value) { /** * The result of the transfer. For example: - **received**: an outgoing transfer request is * created. - **refused**: the transfer request is rejected by Adyen for one of the following - * reasons: - Lack of funds in the balance account. - Transfer limit exceeded. - Transaction rule - * requirements violated. - **authorised**: the transfer request is authorized and the funds are - * reserved. - **booked**: the funds are deducted from your user's balance account. - - * **failed**: the transfer is rejected by the counterparty's bank. - **returned**: the - * transfer is returned by the counterparty's bank. + * reasons: - Transfer limit exceeded. - Transaction rule requirements violated. - **authorised**: + * the transfer request is authorized and the funds are reserved. - **booked**: the funds are + * deducted from your user's balance account. - **failed**: the transfer is rejected by the + * counterparty's bank. - **returned**: the transfer is returned by the counterparty's + * bank. */ public enum StatusEnum { APPROVALPENDING(String.valueOf("approvalPending")), @@ -1542,20 +1542,19 @@ public void setReview(TransferReview review) { /** * The result of the transfer. For example: - **received**: an outgoing transfer request is * created. - **refused**: the transfer request is rejected by Adyen for one of the following - * reasons: - Lack of funds in the balance account. - Transfer limit exceeded. - Transaction rule - * requirements violated. - **authorised**: the transfer request is authorized and the funds are - * reserved. - **booked**: the funds are deducted from your user's balance account. - - * **failed**: the transfer is rejected by the counterparty's bank. - **returned**: the - * transfer is returned by the counterparty's bank. + * reasons: - Transfer limit exceeded. - Transaction rule requirements violated. - **authorised**: + * the transfer request is authorized and the funds are reserved. - **booked**: the funds are + * deducted from your user's balance account. - **failed**: the transfer is rejected by the + * counterparty's bank. - **returned**: the transfer is returned by the counterparty's + * bank. * * @param status The result of the transfer. For example: - **received**: an outgoing transfer * request is created. - **refused**: the transfer request is rejected by Adyen for one of the - * following reasons: - Lack of funds in the balance account. - Transfer limit exceeded. - - * Transaction rule requirements violated. - **authorised**: the transfer request is - * authorized and the funds are reserved. - **booked**: the funds are deducted from your - * user's balance account. - **failed**: the transfer is rejected by the - * counterparty's bank. - **returned**: the transfer is returned by the counterparty's - * bank. + * following reasons: - Transfer limit exceeded. - Transaction rule requirements violated. - + * **authorised**: the transfer request is authorized and the funds are reserved. - + * **booked**: the funds are deducted from your user's balance account. - **failed**: the + * transfer is rejected by the counterparty's bank. - **returned**: the transfer is + * returned by the counterparty's bank. * @return the current {@code Transfer} instance, allowing for method chaining */ public Transfer status(StatusEnum status) { @@ -1567,20 +1566,19 @@ public Transfer status(StatusEnum status) { /** * The result of the transfer. For example: - **received**: an outgoing transfer request is * created. - **refused**: the transfer request is rejected by Adyen for one of the following - * reasons: - Lack of funds in the balance account. - Transfer limit exceeded. - Transaction rule - * requirements violated. - **authorised**: the transfer request is authorized and the funds are - * reserved. - **booked**: the funds are deducted from your user's balance account. - - * **failed**: the transfer is rejected by the counterparty's bank. - **returned**: the - * transfer is returned by the counterparty's bank. + * reasons: - Transfer limit exceeded. - Transaction rule requirements violated. - **authorised**: + * the transfer request is authorized and the funds are reserved. - **booked**: the funds are + * deducted from your user's balance account. - **failed**: the transfer is rejected by the + * counterparty's bank. - **returned**: the transfer is returned by the counterparty's + * bank. * * @return status The result of the transfer. For example: - **received**: an outgoing transfer * request is created. - **refused**: the transfer request is rejected by Adyen for one of the - * following reasons: - Lack of funds in the balance account. - Transfer limit exceeded. - - * Transaction rule requirements violated. - **authorised**: the transfer request is - * authorized and the funds are reserved. - **booked**: the funds are deducted from your - * user's balance account. - **failed**: the transfer is rejected by the - * counterparty's bank. - **returned**: the transfer is returned by the counterparty's - * bank. + * following reasons: - Transfer limit exceeded. - Transaction rule requirements violated. - + * **authorised**: the transfer request is authorized and the funds are reserved. - + * **booked**: the funds are deducted from your user's balance account. - **failed**: the + * transfer is rejected by the counterparty's bank. - **returned**: the transfer is + * returned by the counterparty's bank. */ @JsonProperty(JSON_PROPERTY_STATUS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -1591,20 +1589,19 @@ public StatusEnum getStatus() { /** * The result of the transfer. For example: - **received**: an outgoing transfer request is * created. - **refused**: the transfer request is rejected by Adyen for one of the following - * reasons: - Lack of funds in the balance account. - Transfer limit exceeded. - Transaction rule - * requirements violated. - **authorised**: the transfer request is authorized and the funds are - * reserved. - **booked**: the funds are deducted from your user's balance account. - - * **failed**: the transfer is rejected by the counterparty's bank. - **returned**: the - * transfer is returned by the counterparty's bank. + * reasons: - Transfer limit exceeded. - Transaction rule requirements violated. - **authorised**: + * the transfer request is authorized and the funds are reserved. - **booked**: the funds are + * deducted from your user's balance account. - **failed**: the transfer is rejected by the + * counterparty's bank. - **returned**: the transfer is returned by the counterparty's + * bank. * * @param status The result of the transfer. For example: - **received**: an outgoing transfer * request is created. - **refused**: the transfer request is rejected by Adyen for one of the - * following reasons: - Lack of funds in the balance account. - Transfer limit exceeded. - - * Transaction rule requirements violated. - **authorised**: the transfer request is - * authorized and the funds are reserved. - **booked**: the funds are deducted from your - * user's balance account. - **failed**: the transfer is rejected by the - * counterparty's bank. - **returned**: the transfer is returned by the counterparty's - * bank. + * following reasons: - Transfer limit exceeded. - Transaction rule requirements violated. - + * **authorised**: the transfer request is authorized and the funds are reserved. - + * **booked**: the funds are deducted from your user's balance account. - **failed**: the + * transfer is rejected by the counterparty's bank. - **returned**: the transfer is + * returned by the counterparty's bank. */ @JsonProperty(JSON_PROPERTY_STATUS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) diff --git a/src/main/java/com/adyen/model/transfers/TransferCategoryData.java b/src/main/java/com/adyen/model/transfers/TransferCategoryData.java index 7b9ba6d8c..7953af02f 100644 --- a/src/main/java/com/adyen/model/transfers/TransferCategoryData.java +++ b/src/main/java/com/adyen/model/transfers/TransferCategoryData.java @@ -229,6 +229,18 @@ public TransferCategoryData(PlatformPayment o) { schemas.put("IssuedCard", new GenericType() {}); schemas.put("PlatformPayment", new GenericType() {}); JSON.registerDescendants(TransferCategoryData.class, Collections.unmodifiableMap(schemas)); + // Initialize and register the discriminator mappings. + Map> mappings = new HashMap<>(); + mappings.put("bank", BankCategoryData.class); + mappings.put("internal", InternalCategoryData.class); + mappings.put("issuedCard", IssuedCard.class); + mappings.put("platformPayment", PlatformPayment.class); + mappings.put("BankCategoryData", BankCategoryData.class); + mappings.put("InternalCategoryData", InternalCategoryData.class); + mappings.put("IssuedCard", IssuedCard.class); + mappings.put("PlatformPayment", PlatformPayment.class); + mappings.put("Transfer_categoryData", TransferCategoryData.class); + JSON.registerDiscriminator(TransferCategoryData.class, "type", mappings); } @Override diff --git a/src/main/java/com/adyen/model/transfers/TransferData.java b/src/main/java/com/adyen/model/transfers/TransferData.java index b09c704be..3ec915bcb 100644 --- a/src/main/java/com/adyen/model/transfers/TransferData.java +++ b/src/main/java/com/adyen/model/transfers/TransferData.java @@ -46,6 +46,7 @@ TransferData.JSON_PROPERTY_EXECUTION_DATE, TransferData.JSON_PROPERTY_EXTERNAL_REASON, TransferData.JSON_PROPERTY_ID, + TransferData.JSON_PROPERTY_NETWORK_REASON, TransferData.JSON_PROPERTY_PAYMENT_INSTRUMENT, TransferData.JSON_PROPERTY_REASON, TransferData.JSON_PROPERTY_REFERENCE, @@ -53,6 +54,7 @@ TransferData.JSON_PROPERTY_REVIEW, TransferData.JSON_PROPERTY_SEQUENCE_NUMBER, TransferData.JSON_PROPERTY_STATUS, + TransferData.JSON_PROPERTY_TRACING, TransferData.JSON_PROPERTY_TRACKING, TransferData.JSON_PROPERTY_TRANSACTION_RULES_RESULT, TransferData.JSON_PROPERTY_TYPE, @@ -268,6 +270,12 @@ public static DirectionEnum fromValue(String value) { /** Mark when the attribute has been explicitly set. */ private boolean isSetId = false; + public static final String JSON_PROPERTY_NETWORK_REASON = "networkReason"; + private NetworkReason networkReason; + + /** Mark when the attribute has been explicitly set. */ + private boolean isSetNetworkReason = false; + public static final String JSON_PROPERTY_PAYMENT_INSTRUMENT = "paymentInstrument"; private PaymentInstrument paymentInstrument; @@ -515,11 +523,11 @@ public static ReasonEnum fromValue(String value) { /** * The result of the transfer. For example: - **received**: an outgoing transfer request is * created. - **refused**: the transfer request is rejected by Adyen for one of the following - * reasons: - Lack of funds in the balance account. - Transfer limit exceeded. - Transaction rule - * requirements violated. - **authorised**: the transfer request is authorized and the funds are - * reserved. - **booked**: the funds are deducted from your user's balance account. - - * **failed**: the transfer is rejected by the counterparty's bank. - **returned**: the - * transfer is returned by the counterparty's bank. + * reasons: - Transfer limit exceeded. - Transaction rule requirements violated. - **authorised**: + * the transfer request is authorized and the funds are reserved. - **booked**: the funds are + * deducted from your user's balance account. - **failed**: the transfer is rejected by the + * counterparty's bank. - **returned**: the transfer is returned by the counterparty's + * bank. */ public enum StatusEnum { APPROVALPENDING(String.valueOf("approvalPending")), @@ -703,6 +711,12 @@ public static StatusEnum fromValue(String value) { /** Mark when the attribute has been explicitly set. */ private boolean isSetStatus = false; + public static final String JSON_PROPERTY_TRACING = "tracing"; + private TransferDataTracing tracing; + + /** Mark when the attribute has been explicitly set. */ + private boolean isSetTracing = false; + public static final String JSON_PROPERTY_TRACKING = "tracking"; private TransferDataTracking tracking; @@ -1596,6 +1610,41 @@ public void setId(String id) { isSetId = true; // mark as set } + /** + * networkReason + * + * @param networkReason + * @return the current {@code TransferData} instance, allowing for method chaining + */ + public TransferData networkReason(NetworkReason networkReason) { + this.networkReason = networkReason; + isSetNetworkReason = true; // mark as set + return this; + } + + /** + * Get networkReason + * + * @return networkReason + */ + @JsonProperty(JSON_PROPERTY_NETWORK_REASON) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public NetworkReason getNetworkReason() { + return networkReason; + } + + /** + * networkReason + * + * @param networkReason + */ + @JsonProperty(JSON_PROPERTY_NETWORK_REASON) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setNetworkReason(NetworkReason networkReason) { + this.networkReason = networkReason; + isSetNetworkReason = true; // mark as set + } + /** * paymentInstrument * @@ -1851,20 +1900,19 @@ public void setSequenceNumber(Integer sequenceNumber) { /** * The result of the transfer. For example: - **received**: an outgoing transfer request is * created. - **refused**: the transfer request is rejected by Adyen for one of the following - * reasons: - Lack of funds in the balance account. - Transfer limit exceeded. - Transaction rule - * requirements violated. - **authorised**: the transfer request is authorized and the funds are - * reserved. - **booked**: the funds are deducted from your user's balance account. - - * **failed**: the transfer is rejected by the counterparty's bank. - **returned**: the - * transfer is returned by the counterparty's bank. + * reasons: - Transfer limit exceeded. - Transaction rule requirements violated. - **authorised**: + * the transfer request is authorized and the funds are reserved. - **booked**: the funds are + * deducted from your user's balance account. - **failed**: the transfer is rejected by the + * counterparty's bank. - **returned**: the transfer is returned by the counterparty's + * bank. * * @param status The result of the transfer. For example: - **received**: an outgoing transfer * request is created. - **refused**: the transfer request is rejected by Adyen for one of the - * following reasons: - Lack of funds in the balance account. - Transfer limit exceeded. - - * Transaction rule requirements violated. - **authorised**: the transfer request is - * authorized and the funds are reserved. - **booked**: the funds are deducted from your - * user's balance account. - **failed**: the transfer is rejected by the - * counterparty's bank. - **returned**: the transfer is returned by the counterparty's - * bank. + * following reasons: - Transfer limit exceeded. - Transaction rule requirements violated. - + * **authorised**: the transfer request is authorized and the funds are reserved. - + * **booked**: the funds are deducted from your user's balance account. - **failed**: the + * transfer is rejected by the counterparty's bank. - **returned**: the transfer is + * returned by the counterparty's bank. * @return the current {@code TransferData} instance, allowing for method chaining */ public TransferData status(StatusEnum status) { @@ -1876,20 +1924,19 @@ public TransferData status(StatusEnum status) { /** * The result of the transfer. For example: - **received**: an outgoing transfer request is * created. - **refused**: the transfer request is rejected by Adyen for one of the following - * reasons: - Lack of funds in the balance account. - Transfer limit exceeded. - Transaction rule - * requirements violated. - **authorised**: the transfer request is authorized and the funds are - * reserved. - **booked**: the funds are deducted from your user's balance account. - - * **failed**: the transfer is rejected by the counterparty's bank. - **returned**: the - * transfer is returned by the counterparty's bank. + * reasons: - Transfer limit exceeded. - Transaction rule requirements violated. - **authorised**: + * the transfer request is authorized and the funds are reserved. - **booked**: the funds are + * deducted from your user's balance account. - **failed**: the transfer is rejected by the + * counterparty's bank. - **returned**: the transfer is returned by the counterparty's + * bank. * * @return status The result of the transfer. For example: - **received**: an outgoing transfer * request is created. - **refused**: the transfer request is rejected by Adyen for one of the - * following reasons: - Lack of funds in the balance account. - Transfer limit exceeded. - - * Transaction rule requirements violated. - **authorised**: the transfer request is - * authorized and the funds are reserved. - **booked**: the funds are deducted from your - * user's balance account. - **failed**: the transfer is rejected by the - * counterparty's bank. - **returned**: the transfer is returned by the counterparty's - * bank. + * following reasons: - Transfer limit exceeded. - Transaction rule requirements violated. - + * **authorised**: the transfer request is authorized and the funds are reserved. - + * **booked**: the funds are deducted from your user's balance account. - **failed**: the + * transfer is rejected by the counterparty's bank. - **returned**: the transfer is + * returned by the counterparty's bank. */ @JsonProperty(JSON_PROPERTY_STATUS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -1900,20 +1947,19 @@ public StatusEnum getStatus() { /** * The result of the transfer. For example: - **received**: an outgoing transfer request is * created. - **refused**: the transfer request is rejected by Adyen for one of the following - * reasons: - Lack of funds in the balance account. - Transfer limit exceeded. - Transaction rule - * requirements violated. - **authorised**: the transfer request is authorized and the funds are - * reserved. - **booked**: the funds are deducted from your user's balance account. - - * **failed**: the transfer is rejected by the counterparty's bank. - **returned**: the - * transfer is returned by the counterparty's bank. + * reasons: - Transfer limit exceeded. - Transaction rule requirements violated. - **authorised**: + * the transfer request is authorized and the funds are reserved. - **booked**: the funds are + * deducted from your user's balance account. - **failed**: the transfer is rejected by the + * counterparty's bank. - **returned**: the transfer is returned by the counterparty's + * bank. * * @param status The result of the transfer. For example: - **received**: an outgoing transfer * request is created. - **refused**: the transfer request is rejected by Adyen for one of the - * following reasons: - Lack of funds in the balance account. - Transfer limit exceeded. - - * Transaction rule requirements violated. - **authorised**: the transfer request is - * authorized and the funds are reserved. - **booked**: the funds are deducted from your - * user's balance account. - **failed**: the transfer is rejected by the - * counterparty's bank. - **returned**: the transfer is returned by the counterparty's - * bank. + * following reasons: - Transfer limit exceeded. - Transaction rule requirements violated. - + * **authorised**: the transfer request is authorized and the funds are reserved. - + * **booked**: the funds are deducted from your user's balance account. - **failed**: the + * transfer is rejected by the counterparty's bank. - **returned**: the transfer is + * returned by the counterparty's bank. */ @JsonProperty(JSON_PROPERTY_STATUS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -1922,6 +1968,41 @@ public void setStatus(StatusEnum status) { isSetStatus = true; // mark as set } + /** + * tracing + * + * @param tracing + * @return the current {@code TransferData} instance, allowing for method chaining + */ + public TransferData tracing(TransferDataTracing tracing) { + this.tracing = tracing; + isSetTracing = true; // mark as set + return this; + } + + /** + * Get tracing + * + * @return tracing + */ + @JsonProperty(JSON_PROPERTY_TRACING) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public TransferDataTracing getTracing() { + return tracing; + } + + /** + * tracing + * + * @param tracing + */ + @JsonProperty(JSON_PROPERTY_TRACING) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setTracing(TransferDataTracing tracing) { + this.tracing = tracing; + isSetTracing = true; // mark as set + } + /** * tracking * @@ -2176,6 +2257,8 @@ public boolean equals(Object o) { && Objects.equals(this.isSetExternalReason, transferData.isSetExternalReason) && Objects.equals(this.id, transferData.id) && Objects.equals(this.isSetId, transferData.isSetId) + && Objects.equals(this.networkReason, transferData.networkReason) + && Objects.equals(this.isSetNetworkReason, transferData.isSetNetworkReason) && Objects.equals(this.paymentInstrument, transferData.paymentInstrument) && Objects.equals(this.isSetPaymentInstrument, transferData.isSetPaymentInstrument) && Objects.equals(this.reason, transferData.reason) @@ -2191,6 +2274,8 @@ public boolean equals(Object o) { && Objects.equals(this.isSetSequenceNumber, transferData.isSetSequenceNumber) && Objects.equals(this.status, transferData.status) && Objects.equals(this.isSetStatus, transferData.isSetStatus) + && Objects.equals(this.tracing, transferData.tracing) + && Objects.equals(this.isSetTracing, transferData.isSetTracing) && Objects.equals(this.tracking, transferData.tracking) && Objects.equals(this.isSetTracking, transferData.isSetTracking) && Objects.equals(this.transactionRulesResult, transferData.transactionRulesResult) @@ -2243,6 +2328,8 @@ public int hashCode() { isSetExternalReason, id, isSetId, + networkReason, + isSetNetworkReason, paymentInstrument, isSetPaymentInstrument, reason, @@ -2257,6 +2344,8 @@ public int hashCode() { isSetSequenceNumber, status, isSetStatus, + tracing, + isSetTracing, tracking, isSetTracking, transactionRulesResult, @@ -2293,6 +2382,7 @@ public String toString() { sb.append(" executionDate: ").append(toIndentedString(executionDate)).append("\n"); sb.append(" externalReason: ").append(toIndentedString(externalReason)).append("\n"); sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" networkReason: ").append(toIndentedString(networkReason)).append("\n"); sb.append(" paymentInstrument: ").append(toIndentedString(paymentInstrument)).append("\n"); sb.append(" reason: ").append(toIndentedString(reason)).append("\n"); sb.append(" reference: ").append(toIndentedString(reference)).append("\n"); @@ -2302,6 +2392,7 @@ public String toString() { sb.append(" review: ").append(toIndentedString(review)).append("\n"); sb.append(" sequenceNumber: ").append(toIndentedString(sequenceNumber)).append("\n"); sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" tracing: ").append(toIndentedString(tracing)).append("\n"); sb.append(" tracking: ").append(toIndentedString(tracking)).append("\n"); sb.append(" transactionRulesResult: ") .append(toIndentedString(transactionRulesResult)) @@ -2387,6 +2478,9 @@ public Map getExplicitNulls() { if (isSetId) { addIfNull(nulls, JSON_PROPERTY_ID, this.id); } + if (isSetNetworkReason) { + addIfNull(nulls, JSON_PROPERTY_NETWORK_REASON, this.networkReason); + } if (isSetPaymentInstrument) { addIfNull(nulls, JSON_PROPERTY_PAYMENT_INSTRUMENT, this.paymentInstrument); } @@ -2408,6 +2502,9 @@ public Map getExplicitNulls() { if (isSetStatus) { addIfNull(nulls, JSON_PROPERTY_STATUS, this.status); } + if (isSetTracing) { + addIfNull(nulls, JSON_PROPERTY_TRACING, this.tracing); + } if (isSetTracking) { addIfNull(nulls, JSON_PROPERTY_TRACKING, this.tracking); } diff --git a/src/main/java/com/adyen/model/transfers/TransferDataTracing.java b/src/main/java/com/adyen/model/transfers/TransferDataTracing.java new file mode 100644 index 000000000..361ef650b --- /dev/null +++ b/src/main/java/com/adyen/model/transfers/TransferDataTracing.java @@ -0,0 +1,255 @@ +/* + * 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.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.JsonToken; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.MapperFeature; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import jakarta.ws.rs.core.GenericType; +import java.io.IOException; +import java.util.*; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashSet; +import java.util.logging.Level; +import java.util.logging.Logger; + +@JsonDeserialize(using = TransferDataTracing.TransferDataTracingDeserializer.class) +@JsonSerialize(using = TransferDataTracing.TransferDataTracingSerializer.class) +public class TransferDataTracing extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(TransferDataTracing.class.getName()); + + public static class TransferDataTracingSerializer extends StdSerializer { + public TransferDataTracingSerializer(Class t) { + super(t); + } + + public TransferDataTracingSerializer() { + this(null); + } + + @Override + public void serialize( + TransferDataTracing value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.getActualInstance()); + } + } + + public static class TransferDataTracingDeserializer extends StdDeserializer { + public TransferDataTracingDeserializer() { + this(TransferDataTracing.class); + } + + public TransferDataTracingDeserializer(Class vc) { + super(vc); + } + + @Override + public TransferDataTracing deserialize(JsonParser jp, DeserializationContext ctxt) + throws IOException, JsonProcessingException { + JsonNode tree = jp.readValueAsTree(); + Object deserialized = null; + boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS); + int match = 0; + JsonToken token = tree.traverse(jp.getCodec()).nextToken(); + // deserialize UKFpsTracingData + 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(UKFpsTracingData.TypeEnum.values()) + .anyMatch((t) -> t.getValue().equals(tree.findValue("type").asText())); + } + + if (typeMatch) { + deserialized = tree.traverse(jp.getCodec()).readValueAs(UKFpsTracingData.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 'UKFpsTracingData'"); + } + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'UKFpsTracingData'", e); + } + + // deserialize USAchTracingData + 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(USAchTracingData.TypeEnum.values()) + .anyMatch((t) -> t.getValue().equals(tree.findValue("type").asText())); + } + + if (typeMatch) { + deserialized = tree.traverse(jp.getCodec()).readValueAs(USAchTracingData.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 'USAchTracingData'"); + } + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'USAchTracingData'", e); + } + + if (match == 1) { + TransferDataTracing ret = new TransferDataTracing(); + ret.setActualInstance(deserialized); + return ret; + } + throw new IOException( + String.format( + "Failed deserialization for TransferDataTracing: %d classes match result, expected 1", + match)); + } + + /** Handle deserialization of the 'null' value. */ + @Override + public TransferDataTracing getNullValue(DeserializationContext ctxt) + throws JsonMappingException { + throw new JsonMappingException(ctxt.getParser(), "TransferDataTracing cannot be null"); + } + } + + // store a list of schema names defined in oneOf + public static final Map> schemas = new HashMap<>(); + + public TransferDataTracing() { + super("oneOf", Boolean.FALSE); + } + + public TransferDataTracing(UKFpsTracingData o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public TransferDataTracing(USAchTracingData o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("UKFpsTracingData", new GenericType() {}); + schemas.put("USAchTracingData", new GenericType() {}); + JSON.registerDescendants(TransferDataTracing.class, Collections.unmodifiableMap(schemas)); + // Initialize and register the discriminator mappings. + Map> mappings = new HashMap<>(); + mappings.put("ukFps", UKFpsTracingData.class); + mappings.put("usAch", USAchTracingData.class); + mappings.put("UKFpsTracingData", UKFpsTracingData.class); + mappings.put("USAchTracingData", USAchTracingData.class); + mappings.put("TransferData_tracing", TransferDataTracing.class); + JSON.registerDiscriminator(TransferDataTracing.class, "type", mappings); + } + + @Override + public Map> getSchemas() { + return TransferDataTracing.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check the instance parameter is valid + * against the oneOf child schemas: UKFpsTracingData, USAchTracingData + * + *

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(UKFpsTracingData.class, instance, new HashSet<>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(USAchTracingData.class, instance, new HashSet<>())) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be UKFpsTracingData, USAchTracingData"); + } + + /** + * Get the actual instance, which can be the following: UKFpsTracingData, USAchTracingData + * + * @return The actual instance (UKFpsTracingData, USAchTracingData) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `UKFpsTracingData`. If the actual instance is not + * `UKFpsTracingData`, the ClassCastException will be thrown. + * + * @return The actual instance of `UKFpsTracingData` + * @throws ClassCastException if the instance is not `UKFpsTracingData` + */ + public UKFpsTracingData getUKFpsTracingData() throws ClassCastException { + return (UKFpsTracingData) super.getActualInstance(); + } + + /** + * Get the actual instance of `USAchTracingData`. If the actual instance is not + * `USAchTracingData`, the ClassCastException will be thrown. + * + * @return The actual instance of `USAchTracingData` + * @throws ClassCastException if the instance is not `USAchTracingData` + */ + public USAchTracingData getUSAchTracingData() throws ClassCastException { + return (USAchTracingData) super.getActualInstance(); + } + + /** + * Create an instance of TransferDataTracing given an JSON string + * + * @param jsonString JSON string + * @return An instance of TransferDataTracing + * @throws IOException if the JSON string is invalid with respect to TransferDataTracing + */ + public static TransferDataTracing fromJson(String jsonString) throws IOException { + return JSON.getMapper().readValue(jsonString, TransferDataTracing.class); + } + + /** + * Convert an instance of TransferDataTracing 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/TransferDataTracking.java b/src/main/java/com/adyen/model/transfers/TransferDataTracking.java index 1feb2c1d1..a8cafef99 100644 --- a/src/main/java/com/adyen/model/transfers/TransferDataTracking.java +++ b/src/main/java/com/adyen/model/transfers/TransferDataTracking.java @@ -198,6 +198,16 @@ public TransferDataTracking(InternalReviewTrackingData o) { schemas.put("EstimationTrackingData", new GenericType() {}); schemas.put("InternalReviewTrackingData", new GenericType() {}); JSON.registerDescendants(TransferDataTracking.class, Collections.unmodifiableMap(schemas)); + // Initialize and register the discriminator mappings. + Map> mappings = new HashMap<>(); + mappings.put("confirmation", ConfirmationTrackingData.class); + mappings.put("estimation", EstimationTrackingData.class); + mappings.put("internalReview", InternalReviewTrackingData.class); + mappings.put("ConfirmationTrackingData", ConfirmationTrackingData.class); + mappings.put("EstimationTrackingData", EstimationTrackingData.class); + mappings.put("InternalReviewTrackingData", InternalReviewTrackingData.class); + mappings.put("TransferData_tracking", TransferDataTracking.class); + JSON.registerDiscriminator(TransferDataTracking.class, "type", mappings); } @Override diff --git a/src/main/java/com/adyen/model/transfers/TransferEvent.java b/src/main/java/com/adyen/model/transfers/TransferEvent.java index 129cd898b..84b3f29c4 100644 --- a/src/main/java/com/adyen/model/transfers/TransferEvent.java +++ b/src/main/java/com/adyen/model/transfers/TransferEvent.java @@ -41,6 +41,7 @@ TransferEvent.JSON_PROPERTY_ORIGINAL_AMOUNT, TransferEvent.JSON_PROPERTY_REASON, TransferEvent.JSON_PROPERTY_STATUS, + TransferEvent.JSON_PROPERTY_TRACING_DATA, TransferEvent.JSON_PROPERTY_TRACKING_DATA, TransferEvent.JSON_PROPERTY_TRANSACTION_ID, TransferEvent.JSON_PROPERTY_TYPE, @@ -511,6 +512,12 @@ public static StatusEnum fromValue(String value) { /** Mark when the attribute has been explicitly set. */ private boolean isSetStatus = false; + public static final String JSON_PROPERTY_TRACING_DATA = "tracingData"; + private TransferEventTracingData tracingData; + + /** Mark when the attribute has been explicitly set. */ + private boolean isSetTracingData = false; + public static final String JSON_PROPERTY_TRACKING_DATA = "trackingData"; private TransferEventTrackingData trackingData; @@ -1081,6 +1088,41 @@ public void setStatus(StatusEnum status) { isSetStatus = true; // mark as set } + /** + * tracingData + * + * @param tracingData + * @return the current {@code TransferEvent} instance, allowing for method chaining + */ + public TransferEvent tracingData(TransferEventTracingData tracingData) { + this.tracingData = tracingData; + isSetTracingData = true; // mark as set + return this; + } + + /** + * Get tracingData + * + * @return tracingData + */ + @JsonProperty(JSON_PROPERTY_TRACING_DATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public TransferEventTracingData getTracingData() { + return tracingData; + } + + /** + * tracingData + * + * @param tracingData + */ + @JsonProperty(JSON_PROPERTY_TRACING_DATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setTracingData(TransferEventTracingData tracingData) { + this.tracingData = tracingData; + isSetTracingData = true; // mark as set + } + /** * trackingData * @@ -1324,6 +1366,8 @@ public boolean equals(Object o) { && Objects.equals(this.isSetReason, transferEvent.isSetReason) && Objects.equals(this.status, transferEvent.status) && Objects.equals(this.isSetStatus, transferEvent.isSetStatus) + && Objects.equals(this.tracingData, transferEvent.tracingData) + && Objects.equals(this.isSetTracingData, transferEvent.isSetTracingData) && Objects.equals(this.trackingData, transferEvent.trackingData) && Objects.equals(this.isSetTrackingData, transferEvent.isSetTrackingData) && Objects.equals(this.transactionId, transferEvent.transactionId) @@ -1365,6 +1409,8 @@ public int hashCode() { isSetReason, status, isSetStatus, + tracingData, + isSetTracingData, trackingData, isSetTrackingData, transactionId, @@ -1396,6 +1442,7 @@ public String toString() { sb.append(" originalAmount: ").append(toIndentedString(originalAmount)).append("\n"); sb.append(" reason: ").append(toIndentedString(reason)).append("\n"); sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" tracingData: ").append(toIndentedString(tracingData)).append("\n"); sb.append(" trackingData: ").append(toIndentedString(trackingData)).append("\n"); sb.append(" transactionId: ").append(toIndentedString(transactionId)).append("\n"); sb.append(" type: ").append(toIndentedString(type)).append("\n"); @@ -1464,6 +1511,9 @@ public Map getExplicitNulls() { if (isSetStatus) { addIfNull(nulls, JSON_PROPERTY_STATUS, this.status); } + if (isSetTracingData) { + addIfNull(nulls, JSON_PROPERTY_TRACING_DATA, this.tracingData); + } if (isSetTrackingData) { addIfNull(nulls, JSON_PROPERTY_TRACKING_DATA, this.trackingData); } diff --git a/src/main/java/com/adyen/model/transfers/TransferEventEventsDataInner.java b/src/main/java/com/adyen/model/transfers/TransferEventEventsDataInner.java index 5897feb65..cc42d38e8 100644 --- a/src/main/java/com/adyen/model/transfers/TransferEventEventsDataInner.java +++ b/src/main/java/com/adyen/model/transfers/TransferEventEventsDataInner.java @@ -201,6 +201,16 @@ public TransferEventEventsDataInner(MerchantPurchaseData o) { schemas.put("MerchantPurchaseData", new GenericType() {}); JSON.registerDescendants( TransferEventEventsDataInner.class, Collections.unmodifiableMap(schemas)); + // Initialize and register the discriminator mappings. + Map> mappings = new HashMap<>(); + mappings.put("interchangeData", InterchangeData.class); + mappings.put("issuingTransactionData", IssuingTransactionData.class); + mappings.put("merchantPurchaseData", MerchantPurchaseData.class); + mappings.put("InterchangeData", InterchangeData.class); + mappings.put("IssuingTransactionData", IssuingTransactionData.class); + mappings.put("MerchantPurchaseData", MerchantPurchaseData.class); + mappings.put("TransferEvent_eventsData_inner", TransferEventEventsDataInner.class); + JSON.registerDiscriminator(TransferEventEventsDataInner.class, "type", mappings); } @Override diff --git a/src/main/java/com/adyen/model/transfers/TransferEventTracingData.java b/src/main/java/com/adyen/model/transfers/TransferEventTracingData.java new file mode 100644 index 000000000..53b95df1d --- /dev/null +++ b/src/main/java/com/adyen/model/transfers/TransferEventTracingData.java @@ -0,0 +1,257 @@ +/* + * 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.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.JsonToken; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.MapperFeature; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import jakarta.ws.rs.core.GenericType; +import java.io.IOException; +import java.util.*; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashSet; +import java.util.logging.Level; +import java.util.logging.Logger; + +@JsonDeserialize(using = TransferEventTracingData.TransferEventTracingDataDeserializer.class) +@JsonSerialize(using = TransferEventTracingData.TransferEventTracingDataSerializer.class) +public class TransferEventTracingData extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(TransferEventTracingData.class.getName()); + + public static class TransferEventTracingDataSerializer + extends StdSerializer { + public TransferEventTracingDataSerializer(Class t) { + super(t); + } + + public TransferEventTracingDataSerializer() { + this(null); + } + + @Override + public void serialize( + TransferEventTracingData value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.getActualInstance()); + } + } + + public static class TransferEventTracingDataDeserializer + extends StdDeserializer { + public TransferEventTracingDataDeserializer() { + this(TransferEventTracingData.class); + } + + public TransferEventTracingDataDeserializer(Class vc) { + super(vc); + } + + @Override + public TransferEventTracingData deserialize(JsonParser jp, DeserializationContext ctxt) + throws IOException, JsonProcessingException { + JsonNode tree = jp.readValueAsTree(); + Object deserialized = null; + boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS); + int match = 0; + JsonToken token = tree.traverse(jp.getCodec()).nextToken(); + // deserialize UKFpsTracingData + 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(UKFpsTracingData.TypeEnum.values()) + .anyMatch((t) -> t.getValue().equals(tree.findValue("type").asText())); + } + + if (typeMatch) { + deserialized = tree.traverse(jp.getCodec()).readValueAs(UKFpsTracingData.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 'UKFpsTracingData'"); + } + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'UKFpsTracingData'", e); + } + + // deserialize USAchTracingData + 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(USAchTracingData.TypeEnum.values()) + .anyMatch((t) -> t.getValue().equals(tree.findValue("type").asText())); + } + + if (typeMatch) { + deserialized = tree.traverse(jp.getCodec()).readValueAs(USAchTracingData.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 'USAchTracingData'"); + } + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'USAchTracingData'", e); + } + + if (match == 1) { + TransferEventTracingData ret = new TransferEventTracingData(); + ret.setActualInstance(deserialized); + return ret; + } + throw new IOException( + String.format( + "Failed deserialization for TransferEventTracingData: %d classes match result, expected 1", + match)); + } + + /** Handle deserialization of the 'null' value. */ + @Override + public TransferEventTracingData getNullValue(DeserializationContext ctxt) + throws JsonMappingException { + throw new JsonMappingException(ctxt.getParser(), "TransferEventTracingData cannot be null"); + } + } + + // store a list of schema names defined in oneOf + public static final Map> schemas = new HashMap<>(); + + public TransferEventTracingData() { + super("oneOf", Boolean.FALSE); + } + + public TransferEventTracingData(UKFpsTracingData o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public TransferEventTracingData(USAchTracingData o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("UKFpsTracingData", new GenericType() {}); + schemas.put("USAchTracingData", new GenericType() {}); + JSON.registerDescendants(TransferEventTracingData.class, Collections.unmodifiableMap(schemas)); + // Initialize and register the discriminator mappings. + Map> mappings = new HashMap<>(); + mappings.put("ukFps", UKFpsTracingData.class); + mappings.put("usAch", USAchTracingData.class); + mappings.put("UKFpsTracingData", UKFpsTracingData.class); + mappings.put("USAchTracingData", USAchTracingData.class); + mappings.put("TransferEvent_tracingData", TransferEventTracingData.class); + JSON.registerDiscriminator(TransferEventTracingData.class, "type", mappings); + } + + @Override + public Map> getSchemas() { + return TransferEventTracingData.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check the instance parameter is valid + * against the oneOf child schemas: UKFpsTracingData, USAchTracingData + * + *

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(UKFpsTracingData.class, instance, new HashSet<>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(USAchTracingData.class, instance, new HashSet<>())) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be UKFpsTracingData, USAchTracingData"); + } + + /** + * Get the actual instance, which can be the following: UKFpsTracingData, USAchTracingData + * + * @return The actual instance (UKFpsTracingData, USAchTracingData) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `UKFpsTracingData`. If the actual instance is not + * `UKFpsTracingData`, the ClassCastException will be thrown. + * + * @return The actual instance of `UKFpsTracingData` + * @throws ClassCastException if the instance is not `UKFpsTracingData` + */ + public UKFpsTracingData getUKFpsTracingData() throws ClassCastException { + return (UKFpsTracingData) super.getActualInstance(); + } + + /** + * Get the actual instance of `USAchTracingData`. If the actual instance is not + * `USAchTracingData`, the ClassCastException will be thrown. + * + * @return The actual instance of `USAchTracingData` + * @throws ClassCastException if the instance is not `USAchTracingData` + */ + public USAchTracingData getUSAchTracingData() throws ClassCastException { + return (USAchTracingData) super.getActualInstance(); + } + + /** + * Create an instance of TransferEventTracingData given an JSON string + * + * @param jsonString JSON string + * @return An instance of TransferEventTracingData + * @throws IOException if the JSON string is invalid with respect to TransferEventTracingData + */ + public static TransferEventTracingData fromJson(String jsonString) throws IOException { + return JSON.getMapper().readValue(jsonString, TransferEventTracingData.class); + } + + /** + * Convert an instance of TransferEventTracingData 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/TransferEventTrackingData.java b/src/main/java/com/adyen/model/transfers/TransferEventTrackingData.java index 90f80c6e2..6a1027998 100644 --- a/src/main/java/com/adyen/model/transfers/TransferEventTrackingData.java +++ b/src/main/java/com/adyen/model/transfers/TransferEventTrackingData.java @@ -199,6 +199,16 @@ public TransferEventTrackingData(InternalReviewTrackingData o) { schemas.put("EstimationTrackingData", new GenericType() {}); schemas.put("InternalReviewTrackingData", new GenericType() {}); JSON.registerDescendants(TransferEventTrackingData.class, Collections.unmodifiableMap(schemas)); + // Initialize and register the discriminator mappings. + Map> mappings = new HashMap<>(); + mappings.put("confirmation", ConfirmationTrackingData.class); + mappings.put("estimation", EstimationTrackingData.class); + mappings.put("internalReview", InternalReviewTrackingData.class); + mappings.put("ConfirmationTrackingData", ConfirmationTrackingData.class); + mappings.put("EstimationTrackingData", EstimationTrackingData.class); + mappings.put("InternalReviewTrackingData", InternalReviewTrackingData.class); + mappings.put("TransferEvent_trackingData", TransferEventTrackingData.class); + JSON.registerDiscriminator(TransferEventTrackingData.class, "type", mappings); } @Override diff --git a/src/main/java/com/adyen/model/transfers/UKFpsTracingData.java b/src/main/java/com/adyen/model/transfers/UKFpsTracingData.java new file mode 100644 index 000000000..87db8f8f9 --- /dev/null +++ b/src/main/java/com/adyen/model/transfers/UKFpsTracingData.java @@ -0,0 +1,271 @@ +/* + * 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; + +/** UKFpsTracingData */ +@JsonPropertyOrder({UKFpsTracingData.JSON_PROPERTY_FPID, UKFpsTracingData.JSON_PROPERTY_TYPE}) +public class UKFpsTracingData { + public static final String JSON_PROPERTY_FPID = "fpid"; + private String fpid; + + /** Mark when the attribute has been explicitly set. */ + private boolean isSetFpid = false; + + /** **ukFps** */ + public enum TypeEnum { + UKFPS(String.valueOf("ukFps")); + + 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 UKFpsTracingData() {} + + /** + * The FPS trace number. This is a unique identifier assigned to transfers processed by + * [FPS](https://www.bankofengland.co.uk/payment-systems/services/faster-payments-service). + * + * @param fpid The FPS trace number. This is a unique identifier assigned to transfers processed + * by [FPS](https://www.bankofengland.co.uk/payment-systems/services/faster-payments-service). + * @return the current {@code UKFpsTracingData} instance, allowing for method chaining + */ + public UKFpsTracingData fpid(String fpid) { + this.fpid = fpid; + isSetFpid = true; // mark as set + return this; + } + + /** + * The FPS trace number. This is a unique identifier assigned to transfers processed by + * [FPS](https://www.bankofengland.co.uk/payment-systems/services/faster-payments-service). + * + * @return fpid The FPS trace number. This is a unique identifier assigned to transfers processed + * by [FPS](https://www.bankofengland.co.uk/payment-systems/services/faster-payments-service). + */ + @JsonProperty(JSON_PROPERTY_FPID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getFpid() { + return fpid; + } + + /** + * The FPS trace number. This is a unique identifier assigned to transfers processed by + * [FPS](https://www.bankofengland.co.uk/payment-systems/services/faster-payments-service). + * + * @param fpid The FPS trace number. This is a unique identifier assigned to transfers processed + * by [FPS](https://www.bankofengland.co.uk/payment-systems/services/faster-payments-service). + */ + @JsonProperty(JSON_PROPERTY_FPID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setFpid(String fpid) { + this.fpid = fpid; + isSetFpid = true; // mark as set + } + + /** + * **ukFps** + * + * @param type **ukFps** + * @return the current {@code UKFpsTracingData} instance, allowing for method chaining + */ + public UKFpsTracingData type(TypeEnum type) { + this.type = type; + isSetType = true; // mark as set + return this; + } + + /** + * **ukFps** + * + * @return type **ukFps** + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public TypeEnum getType() { + return type; + } + + /** + * **ukFps** + * + * @param type **ukFps** + */ + @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 UKFpsTracingData 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 UKFpsTracingData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UKFpsTracingData ukFpsTracingData = (UKFpsTracingData) o; + return Objects.equals(this.fpid, ukFpsTracingData.fpid) + && Objects.equals(this.isSetFpid, ukFpsTracingData.isSetFpid) + && Objects.equals(this.type, ukFpsTracingData.type) + && Objects.equals(this.isSetType, ukFpsTracingData.isSetType); + } + + @Override + public int hashCode() { + return Objects.hash(fpid, isSetFpid, type, isSetType); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UKFpsTracingData {\n"); + sb.append(" fpid: ").append(toIndentedString(fpid)).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 (isSetFpid) { + addIfNull(nulls, JSON_PROPERTY_FPID, this.fpid); + } + 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 UKFpsTracingData given an JSON string + * + * @param jsonString JSON string + * @return An instance of UKFpsTracingData + * @throws JsonProcessingException if the JSON string is invalid with respect to UKFpsTracingData + */ + public static UKFpsTracingData fromJson(String jsonString) throws JsonProcessingException { + return JSON.getMapper().readValue(jsonString, UKFpsTracingData.class); + } + + /** + * Convert an instance of UKFpsTracingData 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/USAchTracingData.java b/src/main/java/com/adyen/model/transfers/USAchTracingData.java new file mode 100644 index 000000000..9d25dd8dc --- /dev/null +++ b/src/main/java/com/adyen/model/transfers/USAchTracingData.java @@ -0,0 +1,277 @@ +/* + * 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; + +/** USAchTracingData */ +@JsonPropertyOrder({ + USAchTracingData.JSON_PROPERTY_TRACE_NUMBER, + USAchTracingData.JSON_PROPERTY_TYPE +}) +public class USAchTracingData { + public static final String JSON_PROPERTY_TRACE_NUMBER = "traceNumber"; + private String traceNumber; + + /** Mark when the attribute has been explicitly set. */ + private boolean isSetTraceNumber = false; + + /** **usAch** */ + public enum TypeEnum { + USACH(String.valueOf("usAch")); + + 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 USAchTracingData() {} + + /** + * The ACH trace number. This is a unique 15-digit identifier assigned to transfers processed by + * [ACH](https://fiscal.treasury.gov/payments-from-government/automated-clearing-house-ach). + * + * @param traceNumber The ACH trace number. This is a unique 15-digit identifier assigned to + * transfers processed by + * [ACH](https://fiscal.treasury.gov/payments-from-government/automated-clearing-house-ach). + * @return the current {@code USAchTracingData} instance, allowing for method chaining + */ + public USAchTracingData traceNumber(String traceNumber) { + this.traceNumber = traceNumber; + isSetTraceNumber = true; // mark as set + return this; + } + + /** + * The ACH trace number. This is a unique 15-digit identifier assigned to transfers processed by + * [ACH](https://fiscal.treasury.gov/payments-from-government/automated-clearing-house-ach). + * + * @return traceNumber The ACH trace number. This is a unique 15-digit identifier assigned to + * transfers processed by + * [ACH](https://fiscal.treasury.gov/payments-from-government/automated-clearing-house-ach). + */ + @JsonProperty(JSON_PROPERTY_TRACE_NUMBER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getTraceNumber() { + return traceNumber; + } + + /** + * The ACH trace number. This is a unique 15-digit identifier assigned to transfers processed by + * [ACH](https://fiscal.treasury.gov/payments-from-government/automated-clearing-house-ach). + * + * @param traceNumber The ACH trace number. This is a unique 15-digit identifier assigned to + * transfers processed by + * [ACH](https://fiscal.treasury.gov/payments-from-government/automated-clearing-house-ach). + */ + @JsonProperty(JSON_PROPERTY_TRACE_NUMBER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setTraceNumber(String traceNumber) { + this.traceNumber = traceNumber; + isSetTraceNumber = true; // mark as set + } + + /** + * **usAch** + * + * @param type **usAch** + * @return the current {@code USAchTracingData} instance, allowing for method chaining + */ + public USAchTracingData type(TypeEnum type) { + this.type = type; + isSetType = true; // mark as set + return this; + } + + /** + * **usAch** + * + * @return type **usAch** + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public TypeEnum getType() { + return type; + } + + /** + * **usAch** + * + * @param type **usAch** + */ + @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 USAchTracingData 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 USAchTracingData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + USAchTracingData usAchTracingData = (USAchTracingData) o; + return Objects.equals(this.traceNumber, usAchTracingData.traceNumber) + && Objects.equals(this.isSetTraceNumber, usAchTracingData.isSetTraceNumber) + && Objects.equals(this.type, usAchTracingData.type) + && Objects.equals(this.isSetType, usAchTracingData.isSetType); + } + + @Override + public int hashCode() { + return Objects.hash(traceNumber, isSetTraceNumber, type, isSetType); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class USAchTracingData {\n"); + sb.append(" traceNumber: ").append(toIndentedString(traceNumber)).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 (isSetTraceNumber) { + addIfNull(nulls, JSON_PROPERTY_TRACE_NUMBER, this.traceNumber); + } + 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 USAchTracingData given an JSON string + * + * @param jsonString JSON string + * @return An instance of USAchTracingData + * @throws JsonProcessingException if the JSON string is invalid with respect to USAchTracingData + */ + public static USAchTracingData fromJson(String jsonString) throws JsonProcessingException { + return JSON.getMapper().readValue(jsonString, USAchTracingData.class); + } + + /** + * Convert an instance of USAchTracingData 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/service/transfers/CashOutApi.java b/src/main/java/com/adyen/service/transfers/CashOutApi.java new file mode 100644 index 000000000..1c1c305f1 --- /dev/null +++ b/src/main/java/com/adyen/service/transfers/CashOutApi.java @@ -0,0 +1,81 @@ +/* + * 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.service.transfers; + +import com.adyen.Client; +import com.adyen.Service; +import com.adyen.constants.ApiConstants; +import com.adyen.model.RequestOptions; +import com.adyen.model.transfers.CashOut; +import com.adyen.model.transfers.CashOutInfo; +import com.adyen.service.exception.ApiException; +import com.adyen.service.resource.Resource; +import java.io.IOException; + +public class CashOutApi extends Service { + + public static final String API_VERSION = "4"; + + protected String baseURL; + + /** + * CashOut constructor in {@link com.adyen.service.transfers package}. + * + * @param client {@link Client } (required) + */ + public CashOutApi(Client client) { + super(client); + this.baseURL = createBaseURL("https://balanceplatform-api-test.adyen.com/btl/v4"); + } + + /** + * CashOut constructor in {@link com.adyen.service.transfers package}. Please use this constructor + * only if you would like to pass along your own url for routing or testing purposes. The latest + * API version is defined in this class as a constant. + * + * @param client {@link Client } (required) + * @param baseURL {@link String } (required) + */ + public CashOutApi(Client client, String baseURL) { + super(client); + this.baseURL = baseURL; + } + + /** + * Initiate a cashout + * + * @param cashOutInfo {@link CashOutInfo } (required) + * @return {@link CashOut } + * @throws ApiException if fails to make API call + */ + public CashOut initiateCashout(CashOutInfo cashOutInfo) throws ApiException, IOException { + return initiateCashout(cashOutInfo, null); + } + + /** + * Initiate a cashout + * + * @param cashOutInfo {@link CashOutInfo } (required) + * @param requestOptions {@link RequestOptions } Object to store additional HTTP headers such as + * idempotency-keys (optional) + * @return {@link CashOut } + * @throws ApiException if fails to make API call + */ + public CashOut initiateCashout(CashOutInfo cashOutInfo, RequestOptions requestOptions) + throws ApiException, IOException { + String requestBody = cashOutInfo.toJson(); + Resource resource = new Resource(this, this.baseURL + "/cashouts", null); + String jsonResult = + resource.request(requestBody, requestOptions, ApiConstants.HttpMethod.POST, null); + return CashOut.fromJson(jsonResult); + } +} diff --git a/src/test/java/com/adyen/TransfersTest.java b/src/test/java/com/adyen/TransfersTest.java index e40ba458e..b8a663163 100644 --- a/src/test/java/com/adyen/TransfersTest.java +++ b/src/test/java/com/adyen/TransfersTest.java @@ -2,7 +2,9 @@ import static org.junit.jupiter.api.Assertions.*; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.mockito.Mockito.verify; +import com.adyen.constants.ApiConstants; import com.adyen.enums.Environment; import com.adyen.model.transfers.*; import com.adyen.service.transfers.*; @@ -44,7 +46,7 @@ public void baseUrlOnLive() throws NoSuchFieldException, IllegalAccessException } @Test - public void ApproveInitiatedTransfersTest() throws Exception { + public void approveInitiatedTransfersTest() throws Exception { Client client = createMockClientFromResponse(""); TransfersApi transfers = new TransfersApi(client); ApproveTransfersRequest approveTransfersRequest = new ApproveTransfersRequest(); @@ -53,7 +55,7 @@ public void ApproveInitiatedTransfersTest() throws Exception { } @Test - public void GetAllTransfersTest() throws Exception { + public void getAllTransfersTest() throws Exception { Client client = createMockClientFromFile("mocks/transfers/get-all-transfers-success.json"); TransfersApi transfers = new TransfersApi(client); FindTransfersResponse response = @@ -71,7 +73,7 @@ public void GetAllTransfersTest() throws Exception { } @Test - public void GetTransferTest() throws Exception { + public void getTransferTest() throws Exception { Client client = createMockClientFromFile("mocks/transfers/get-transfer-success.json"); TransfersApi transfers = new TransfersApi(client); @@ -93,10 +95,31 @@ public void GetTransferTest() throws Exception { assertInstanceOf( InterchangeData.class, response.getEvents().get(0).getEventsData().get(0).getActualInstance()); + + // check networkReason and tracing (new TransferData fields) + assertEquals( + new NetworkReason() + .code("R01") + .description("Insufficient funds") + .namespace(NetworkReason.NamespaceEnum.USACHRETURNREASONCODE), + response.getNetworkReason()); + assertNotNull(response.getTracing()); + assertInstanceOf(USAchTracingData.class, response.getTracing().getActualInstance()); + USAchTracingData tracing = response.getTracing().getUSAchTracingData(); + assertEquals("091000010000001", tracing.getTraceNumber()); + assertEquals(USAchTracingData.TypeEnum.USACH, tracing.getType()); + + // check tracingData (new TransferEvent field) + TransferEventTracingData eventTracingData = response.getEvents().get(0).getTracingData(); + assertNotNull(eventTracingData); + assertInstanceOf(UKFpsTracingData.class, eventTracingData.getActualInstance()); + UKFpsTracingData eventTracing = eventTracingData.getUKFpsTracingData(); + assertEquals("FP123456789", eventTracing.getFpid()); + assertEquals(UKFpsTracingData.TypeEnum.UKFPS, eventTracing.getType()); } @Test - public void TransferTest() throws Exception { + public void transferTest() throws Exception { Client client = createMockClientFromFile("mocks/transfers/post-transfers-payout-cross-border-200.json"); @@ -112,7 +135,71 @@ public void TransferTest() throws Exception { } @Test - public void GetAllTransactionsTest() throws Exception { + public void initiateCashoutTest() throws Exception { + Client client = createMockClientFromFile("mocks/transfers/post-cashouts-200.json"); + CashOutApi cashOut = new CashOutApi(client); + + CashOutInfo cashOutInfo = + new CashOutInfo() + .instructingBalanceAccountId("BA00000000000000000000001") + .amount(new Amount().currency("EUR").value(50000L)); + + CashOut response = cashOut.initiateCashout(cashOutInfo); + + assertEquals("CO00000000000000000000001", response.getId()); + assertEquals("BA00000000000000000000001", response.getInstructingBalanceAccountId()); + assertEquals(new Amount().currency("EUR").value(50000L), response.getAmount()); + assertEquals( + new CashOutInfoCounterparty().transferInstrumentId("SE00000000000000000000001"), + response.getCounterparty()); + assertEquals("Cashout to bank account", response.getDescription()); + assertEquals("CASHOUT-REF-001", response.getReferenceForBeneficiary()); + assertEquals(new Fee().amount(new Amount().currency("EUR").value(500L)), response.getFee()); + + assertEquals(2, response.getTransfers().size()); + assertEquals( + new CashOutTransfer() + .id("400F6060JMB1I0AB") + .type(CashOutTransfer.TypeEnum.CASHOUTREPAYMENT) + .amount(new Amount().currency("EUR").value(50500L)), + response.getTransfers().get(0)); + assertEquals( + new CashOutTransfer() + .id("400F6060JMB1I0AA") + .type(CashOutTransfer.TypeEnum.CASHOUTFEE) + .amount(new Amount().currency("EUR").value(500L)), + response.getTransfers().get(1)); + + verify(client.getHttpClient()) + .request( + "https://balanceplatform-api-test.adyen.com/btl/v4/cashouts", + cashOutInfo.toJson(), + client.getConfig(), + false, + null, + ApiConstants.HttpMethod.POST, + null); + } + + @Test + public void defaultErrorResponseEntityTest() throws Exception { + String json = + "{\"type\":\"https://docs.adyen.com/errors/forbidden\",\"title\":\"Forbidden\"," + + "\"status\":403,\"detail\":\"Insufficient permissions\",\"errorCode\":\"00_401\"," + + "\"instance\":\"/cashouts\",\"requestId\":\"REQ123\"}"; + DefaultErrorResponseEntity error = DefaultErrorResponseEntity.fromJson(json); + + assertEquals("https://docs.adyen.com/errors/forbidden", error.getType()); + assertEquals("Forbidden", error.getTitle()); + assertEquals(Integer.valueOf(403), error.getStatus()); + assertEquals("Insufficient permissions", error.getDetail()); + assertEquals("00_401", error.getErrorCode()); + assertEquals("/cashouts", error.getInstance()); + assertEquals("REQ123", error.getRequestId()); + } + + @Test + public void getAllTransactionsTest() throws Exception { Client client = createMockClientFromFile("mocks/transfers/get-transactions-success-200.json"); TransactionsApi transactions = new TransactionsApi(client); TransactionSearchResponse response = transactions.getAllTransactions(null, null); @@ -123,7 +210,7 @@ public void GetAllTransactionsTest() throws Exception { } @Test - public void GetTransactionTest() throws Exception { + public void getTransactionTest() throws Exception { Client client = createMockClientFromFile("mocks/transfers/get-transactions-id-success-200.json"); TransactionsApi transactions = new TransactionsApi(client); diff --git a/src/test/resources/mocks/transfers/get-transfer-success.json b/src/test/resources/mocks/transfers/get-transfer-success.json index 9aaa8522a..515694437 100644 --- a/src/test/resources/mocks/transfers/get-transfer-success.json +++ b/src/test/resources/mocks/transfers/get-transfer-success.json @@ -26,6 +26,15 @@ "reason": "approved", "reference": "312M2060T6S4UOIF", "status": "booked", + "networkReason": { + "code": "R01", + "description": "Insufficient funds", + "namespace": "usAchReturnReasonCode" + }, + "tracing": { + "type": "usAch", + "traceNumber": "091000010000001" + }, "balances": [ { "balance": -5400, @@ -48,6 +57,10 @@ "interchangeRateIndicator": "x" } ], + "tracingData": { + "type": "ukFps", + "fpid": "FP123456789" + }, "mutations": [ { "currency": "EUR", diff --git a/src/test/resources/mocks/transfers/post-cashouts-200.json b/src/test/resources/mocks/transfers/post-cashouts-200.json new file mode 100644 index 000000000..6345d8959 --- /dev/null +++ b/src/test/resources/mocks/transfers/post-cashouts-200.json @@ -0,0 +1,37 @@ +{ + "id": "CO00000000000000000000001", + "instructingBalanceAccountId": "BA00000000000000000000001", + "amount": { + "currency": "EUR", + "value": 50000 + }, + "counterparty": { + "transferInstrumentId": "SE00000000000000000000001" + }, + "description": "Cashout to bank account", + "referenceForBeneficiary": "CASHOUT-REF-001", + "fee": { + "amount": { + "currency": "EUR", + "value": 500 + } + }, + "transfers": [ + { + "id": "400F6060JMB1I0AB", + "type": "cashoutRepayment", + "amount": { + "currency": "EUR", + "value": 50500 + } + }, + { + "id": "400F6060JMB1I0AA", + "type": "cashoutFee", + "amount": { + "currency": "EUR", + "value": 500 + } + } + ] +}