From 21c53f07977fa1ec62330091f0ed1efc32a27b0c Mon Sep 17 00:00:00 2001 From: AdyenAutomationBot <38424300+AdyenAutomationBot@users.noreply.github.com> Date: Thu, 14 May 2026 14:22:14 +0000 Subject: [PATCH 1/3] [capital] Automated update from Adyen/adyen-openapi@cbc5406 --- sdk-generation-log/capital.json | 8 + .../capital/AdditionalBankIdentification.java | 134 +++- .../model/capital/CALocalBankAccountType.java | 11 +- .../capital/CalculateGrantOfferRequest.java | 177 +++++ .../model/capital/CalculatedGrantOffer.java | 532 +++++++++++++++ .../capital/CreateGrantOfferRequest.java | 176 +++++ .../model/capital/DisbursementRepayment.java | 9 +- .../DisbursementRepaymentInfoUpdate.java | 9 +- .../com/adyen/model/capital/DynamicOffer.java | 631 ++++++++++++++++++ .../model/capital/DynamicOfferRepayment.java | 176 +++++ ...ificationTypes.java => FinancingType.java} | 33 +- .../model/capital/FundsCollectionType.java | 11 +- .../capital/GetDynamicOffersResponse.java | 190 ++++++ .../java/com/adyen/model/capital/Grant.java | 24 +- .../com/adyen/model/capital/GrantInfo.java | 24 +- .../com/adyen/model/capital/GrantOffer.java | 56 +- .../com/adyen/model/capital/GrantOffers.java | 12 +- .../capital/IbanAccountIdentification.java | 52 +- .../com/adyen/model/capital/InvalidField.java | 104 +-- .../model/capital/USLocalBankAccountType.java | 11 +- .../service/capital/DynamicOffersApi.java | 191 ++++++ .../adyen/service/capital/GrantOffersApi.java | 20 +- 22 files changed, 2438 insertions(+), 153 deletions(-) create mode 100644 sdk-generation-log/capital.json create mode 100644 src/main/java/com/adyen/model/capital/CalculateGrantOfferRequest.java create mode 100644 src/main/java/com/adyen/model/capital/CalculatedGrantOffer.java create mode 100644 src/main/java/com/adyen/model/capital/CreateGrantOfferRequest.java create mode 100644 src/main/java/com/adyen/model/capital/DynamicOffer.java create mode 100644 src/main/java/com/adyen/model/capital/DynamicOfferRepayment.java rename src/main/java/com/adyen/model/capital/{AdditionalBankIdentificationTypes.java => FinancingType.java} (51%) create mode 100644 src/main/java/com/adyen/model/capital/GetDynamicOffersResponse.java create mode 100644 src/main/java/com/adyen/service/capital/DynamicOffersApi.java diff --git a/sdk-generation-log/capital.json b/sdk-generation-log/capital.json new file mode 100644 index 000000000..1833439f6 --- /dev/null +++ b/sdk-generation-log/capital.json @@ -0,0 +1,8 @@ +{ + "service": "capital", + "project": "java", + "generatedAt": "2026-05-14T14:22:14Z", + "openapiCommitSha": "cbc5406a2df1f24d50e40742f18342f7ca7f21fc", + "automationCommitSha": "6f06b47d0661f0891defe6b85461d2c367fbd284", + "libraryCommitSha": "5790580db2f8a931a68baba2bff9760b8aed2067" +} diff --git a/src/main/java/com/adyen/model/capital/AdditionalBankIdentification.java b/src/main/java/com/adyen/model/capital/AdditionalBankIdentification.java index e1a11933d..89739d8ab 100644 --- a/src/main/java/com/adyen/model/capital/AdditionalBankIdentification.java +++ b/src/main/java/com/adyen/model/capital/AdditionalBankIdentification.java @@ -12,12 +12,16 @@ package com.adyen.model.capital; 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; /** AdditionalBankIdentification */ @JsonPropertyOrder({ @@ -31,8 +35,64 @@ public class AdditionalBankIdentification { /** Mark when the attribute has been explicitly set. */ private boolean isSetCode = false; + /** + * The type of additional bank identification, depending on the country. Possible values: * + * **auBsbCode**: The 6-digit [Australian Bank State Branch (BSB) + * code](https://en.wikipedia.org/wiki/Bank_state_branch), without separators or spaces. * + * **caRoutingNumber**: The 9-digit [Canadian routing + * number](https://en.wikipedia.org/wiki/Routing_number_(Canada)), in EFT format, without + * separators or spaces. * **gbSortCode**: The 6-digit [UK sort + * code](https://en.wikipedia.org/wiki/Sort_code), without separators or spaces * + * **usRoutingNumber**: The 9-digit [routing + * number](https://en.wikipedia.org/wiki/ABA_routing_transit_number), without separators or + * spaces. + */ + public enum TypeEnum { + AUBSBCODE(String.valueOf("auBsbCode")), + + CAROUTINGNUMBER(String.valueOf("caRoutingNumber")), + + GBSORTCODE(String.valueOf("gbSortCode")), + + USROUTINGNUMBER(String.valueOf("usRoutingNumber")); + + 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 AdditionalBankIdentificationTypes type; + private TypeEnum type; /** Mark when the attribute has been explicitly set. */ private boolean isSetType = false; @@ -81,36 +141,90 @@ public void setCode(String code) { } /** - * type + * The type of additional bank identification, depending on the country. Possible values: * + * **auBsbCode**: The 6-digit [Australian Bank State Branch (BSB) + * code](https://en.wikipedia.org/wiki/Bank_state_branch), without separators or spaces. * + * **caRoutingNumber**: The 9-digit [Canadian routing + * number](https://en.wikipedia.org/wiki/Routing_number_(Canada)), in EFT format, without + * separators or spaces. * **gbSortCode**: The 6-digit [UK sort + * code](https://en.wikipedia.org/wiki/Sort_code), without separators or spaces * + * **usRoutingNumber**: The 9-digit [routing + * number](https://en.wikipedia.org/wiki/ABA_routing_transit_number), without separators or + * spaces. * - * @param type + * @param type The type of additional bank identification, depending on the country. Possible + * values: * **auBsbCode**: The 6-digit [Australian Bank State Branch (BSB) + * code](https://en.wikipedia.org/wiki/Bank_state_branch), without separators or spaces. * + * **caRoutingNumber**: The 9-digit [Canadian routing + * number](https://en.wikipedia.org/wiki/Routing_number_(Canada)), in EFT format, without + * separators or spaces. * **gbSortCode**: The 6-digit [UK sort + * code](https://en.wikipedia.org/wiki/Sort_code), without separators or spaces * + * **usRoutingNumber**: The 9-digit [routing + * number](https://en.wikipedia.org/wiki/ABA_routing_transit_number), without separators or + * spaces. * @return the current {@code AdditionalBankIdentification} instance, allowing for method chaining */ - public AdditionalBankIdentification type(AdditionalBankIdentificationTypes type) { + public AdditionalBankIdentification type(TypeEnum type) { this.type = type; isSetType = true; // mark as set return this; } /** - * Get type + * The type of additional bank identification, depending on the country. Possible values: * + * **auBsbCode**: The 6-digit [Australian Bank State Branch (BSB) + * code](https://en.wikipedia.org/wiki/Bank_state_branch), without separators or spaces. * + * **caRoutingNumber**: The 9-digit [Canadian routing + * number](https://en.wikipedia.org/wiki/Routing_number_(Canada)), in EFT format, without + * separators or spaces. * **gbSortCode**: The 6-digit [UK sort + * code](https://en.wikipedia.org/wiki/Sort_code), without separators or spaces * + * **usRoutingNumber**: The 9-digit [routing + * number](https://en.wikipedia.org/wiki/ABA_routing_transit_number), without separators or + * spaces. * - * @return type + * @return type The type of additional bank identification, depending on the country. Possible + * values: * **auBsbCode**: The 6-digit [Australian Bank State Branch (BSB) + * code](https://en.wikipedia.org/wiki/Bank_state_branch), without separators or spaces. * + * **caRoutingNumber**: The 9-digit [Canadian routing + * number](https://en.wikipedia.org/wiki/Routing_number_(Canada)), in EFT format, without + * separators or spaces. * **gbSortCode**: The 6-digit [UK sort + * code](https://en.wikipedia.org/wiki/Sort_code), without separators or spaces * + * **usRoutingNumber**: The 9-digit [routing + * number](https://en.wikipedia.org/wiki/ABA_routing_transit_number), without separators or + * spaces. */ @JsonProperty(JSON_PROPERTY_TYPE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public AdditionalBankIdentificationTypes getType() { + public TypeEnum getType() { return type; } /** - * type + * The type of additional bank identification, depending on the country. Possible values: * + * **auBsbCode**: The 6-digit [Australian Bank State Branch (BSB) + * code](https://en.wikipedia.org/wiki/Bank_state_branch), without separators or spaces. * + * **caRoutingNumber**: The 9-digit [Canadian routing + * number](https://en.wikipedia.org/wiki/Routing_number_(Canada)), in EFT format, without + * separators or spaces. * **gbSortCode**: The 6-digit [UK sort + * code](https://en.wikipedia.org/wiki/Sort_code), without separators or spaces * + * **usRoutingNumber**: The 9-digit [routing + * number](https://en.wikipedia.org/wiki/ABA_routing_transit_number), without separators or + * spaces. * - * @param type + * @param type The type of additional bank identification, depending on the country. Possible + * values: * **auBsbCode**: The 6-digit [Australian Bank State Branch (BSB) + * code](https://en.wikipedia.org/wiki/Bank_state_branch), without separators or spaces. * + * **caRoutingNumber**: The 9-digit [Canadian routing + * number](https://en.wikipedia.org/wiki/Routing_number_(Canada)), in EFT format, without + * separators or spaces. * **gbSortCode**: The 6-digit [UK sort + * code](https://en.wikipedia.org/wiki/Sort_code), without separators or spaces * + * **usRoutingNumber**: The 9-digit [routing + * number](https://en.wikipedia.org/wiki/ABA_routing_transit_number), without separators or + * spaces. */ @JsonProperty(JSON_PROPERTY_TYPE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setType(AdditionalBankIdentificationTypes type) { + public void setType(TypeEnum type) { this.type = type; isSetType = true; // mark as set } diff --git a/src/main/java/com/adyen/model/capital/CALocalBankAccountType.java b/src/main/java/com/adyen/model/capital/CALocalBankAccountType.java index 04cc9b81b..7df16ab5c 100644 --- a/src/main/java/com/adyen/model/capital/CALocalBankAccountType.java +++ b/src/main/java/com/adyen/model/capital/CALocalBankAccountType.java @@ -14,6 +14,7 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; import java.util.*; +import java.util.logging.Logger; /** Gets or Sets CALocalBankAccountType */ public enum CALocalBankAccountType { @@ -21,6 +22,8 @@ public enum CALocalBankAccountType { SAVINGS("savings"); + private static final Logger LOG = Logger.getLogger(CALocalBankAccountType.class.getName()); + private String value; CALocalBankAccountType(String value) { @@ -44,6 +47,12 @@ public static CALocalBankAccountType fromValue(String value) { return b; } } - throw new IllegalArgumentException("Unexpected value '" + value + "'"); + // handling unexpected value + LOG.warning( + "CALocalBankAccountType: unexpected enum value '" + + value + + "' - Supported values are " + + Arrays.toString(CALocalBankAccountType.values())); + return null; } } diff --git a/src/main/java/com/adyen/model/capital/CalculateGrantOfferRequest.java b/src/main/java/com/adyen/model/capital/CalculateGrantOfferRequest.java new file mode 100644 index 000000000..d007a4670 --- /dev/null +++ b/src/main/java/com/adyen/model/capital/CalculateGrantOfferRequest.java @@ -0,0 +1,177 @@ +/* + * Capital API + * + * The version of the OpenAPI document: 1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.adyen.model.capital; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.core.JsonProcessingException; +import java.util.*; + +/** CalculateGrantOfferRequest */ +@JsonPropertyOrder({CalculateGrantOfferRequest.JSON_PROPERTY_AMOUNT}) +public class CalculateGrantOfferRequest { + public static final String JSON_PROPERTY_AMOUNT = "amount"; + private Amount amount; + + /** Mark when the attribute has been explicitly set. */ + private boolean isSetAmount = false; + + /** + * Sets whether attributes with null values should be explicitly included in the JSON payload. + * Default is false. + */ + @JsonIgnore private boolean includeNullValues = false; + + public CalculateGrantOfferRequest() {} + + /** + * amount + * + * @param amount + * @return the current {@code CalculateGrantOfferRequest} instance, allowing for method chaining + */ + public CalculateGrantOfferRequest 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 + } + + /** + * Configures whether null values are explicitly serialized in the JSON payload. Default is false. + */ + public CalculateGrantOfferRequest 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 CalculateGrantOfferRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CalculateGrantOfferRequest calculateGrantOfferRequest = (CalculateGrantOfferRequest) o; + return Objects.equals(this.amount, calculateGrantOfferRequest.amount) + && Objects.equals(this.isSetAmount, calculateGrantOfferRequest.isSetAmount); + } + + @Override + public int hashCode() { + return Objects.hash(amount, isSetAmount); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CalculateGrantOfferRequest {\n"); + sb.append(" amount: ").append(toIndentedString(amount)).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); + } + + 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 CalculateGrantOfferRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of CalculateGrantOfferRequest + * @throws JsonProcessingException if the JSON string is invalid with respect to + * CalculateGrantOfferRequest + */ + public static CalculateGrantOfferRequest fromJson(String jsonString) + throws JsonProcessingException { + return JSON.getMapper().readValue(jsonString, CalculateGrantOfferRequest.class); + } + + /** + * Convert an instance of CalculateGrantOfferRequest to an JSON string + * + * @return JSON string + */ + public String toJson() throws JsonProcessingException { + return JSON.getMapper().writeValueAsString(this); + } +} diff --git a/src/main/java/com/adyen/model/capital/CalculatedGrantOffer.java b/src/main/java/com/adyen/model/capital/CalculatedGrantOffer.java new file mode 100644 index 000000000..7b161390b --- /dev/null +++ b/src/main/java/com/adyen/model/capital/CalculatedGrantOffer.java @@ -0,0 +1,532 @@ +/* + * Capital API + * + * The version of the OpenAPI document: 1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.adyen.model.capital; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.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.time.OffsetDateTime; +import java.util.*; +import java.util.Arrays; +import java.util.logging.Logger; + +/** CalculatedGrantOffer */ +@JsonPropertyOrder({ + CalculatedGrantOffer.JSON_PROPERTY_ACCOUNT_HOLDER_ID, + CalculatedGrantOffer.JSON_PROPERTY_AMOUNT, + CalculatedGrantOffer.JSON_PROPERTY_CONTRACT_TYPE, + CalculatedGrantOffer.JSON_PROPERTY_EXPIRES_AT, + CalculatedGrantOffer.JSON_PROPERTY_FEE, + CalculatedGrantOffer.JSON_PROPERTY_REPAYMENT, + CalculatedGrantOffer.JSON_PROPERTY_STARTS_AT +}) +public class CalculatedGrantOffer { + public static final String JSON_PROPERTY_ACCOUNT_HOLDER_ID = "accountHolderId"; + private String accountHolderId; + + /** Mark when the attribute has been explicitly set. */ + private boolean isSetAccountHolderId = false; + + public static final String JSON_PROPERTY_AMOUNT = "amount"; + private Amount amount; + + /** Mark when the attribute has been explicitly set. */ + private boolean isSetAmount = false; + + /** The contract type of the offer. Possible values: * **loan** * **cashAdvance** */ + public enum ContractTypeEnum { + CASHADVANCE(String.valueOf("cashAdvance")), + + LOAN(String.valueOf("loan")); + + private static final Logger LOG = Logger.getLogger(ContractTypeEnum.class.getName()); + + private String value; + + ContractTypeEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static ContractTypeEnum fromValue(String value) { + for (ContractTypeEnum b : ContractTypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + // handling unexpected value + LOG.warning( + "ContractTypeEnum: unexpected enum value '" + + value + + "' - Supported values are " + + Arrays.toString(ContractTypeEnum.values())); + return null; + } + } + + public static final String JSON_PROPERTY_CONTRACT_TYPE = "contractType"; + private ContractTypeEnum contractType; + + /** Mark when the attribute has been explicitly set. */ + private boolean isSetContractType = false; + + public static final String JSON_PROPERTY_EXPIRES_AT = "expiresAt"; + private OffsetDateTime expiresAt; + + /** Mark when the attribute has been explicitly set. */ + private boolean isSetExpiresAt = false; + + public static final String JSON_PROPERTY_FEE = "fee"; + private GrantOfferFee fee; + + /** Mark when the attribute has been explicitly set. */ + private boolean isSetFee = false; + + public static final String JSON_PROPERTY_REPAYMENT = "repayment"; + private Repayment repayment; + + /** Mark when the attribute has been explicitly set. */ + private boolean isSetRepayment = false; + + public static final String JSON_PROPERTY_STARTS_AT = "startsAt"; + private OffsetDateTime startsAt; + + /** Mark when the attribute has been explicitly set. */ + private boolean isSetStartsAt = false; + + /** + * Sets whether attributes with null values should be explicitly included in the JSON payload. + * Default is false. + */ + @JsonIgnore private boolean includeNullValues = false; + + public CalculatedGrantOffer() {} + + /** + * The unique identifier of the account holder that the dynamic offer is for. + * + * @param accountHolderId The unique identifier of the account holder that the dynamic offer is + * for. + * @return the current {@code CalculatedGrantOffer} instance, allowing for method chaining + */ + public CalculatedGrantOffer accountHolderId(String accountHolderId) { + this.accountHolderId = accountHolderId; + isSetAccountHolderId = true; // mark as set + return this; + } + + /** + * The unique identifier of the account holder that the dynamic offer is for. + * + * @return accountHolderId The unique identifier of the account holder that the dynamic offer is + * for. + */ + @JsonProperty(JSON_PROPERTY_ACCOUNT_HOLDER_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getAccountHolderId() { + return accountHolderId; + } + + /** + * The unique identifier of the account holder that the dynamic offer is for. + * + * @param accountHolderId The unique identifier of the account holder that the dynamic offer is + * for. + */ + @JsonProperty(JSON_PROPERTY_ACCOUNT_HOLDER_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setAccountHolderId(String accountHolderId) { + this.accountHolderId = accountHolderId; + isSetAccountHolderId = true; // mark as set + } + + /** + * amount + * + * @param amount + * @return the current {@code CalculatedGrantOffer} instance, allowing for method chaining + */ + public CalculatedGrantOffer 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 contract type of the offer. Possible values: * **loan** * **cashAdvance** + * + * @param contractType The contract type of the offer. Possible values: * **loan** * + * **cashAdvance** + * @return the current {@code CalculatedGrantOffer} instance, allowing for method chaining + */ + public CalculatedGrantOffer contractType(ContractTypeEnum contractType) { + this.contractType = contractType; + isSetContractType = true; // mark as set + return this; + } + + /** + * The contract type of the offer. Possible values: * **loan** * **cashAdvance** + * + * @return contractType The contract type of the offer. Possible values: * **loan** * + * **cashAdvance** + */ + @JsonProperty(JSON_PROPERTY_CONTRACT_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public ContractTypeEnum getContractType() { + return contractType; + } + + /** + * The contract type of the offer. Possible values: * **loan** * **cashAdvance** + * + * @param contractType The contract type of the offer. Possible values: * **loan** * + * **cashAdvance** + */ + @JsonProperty(JSON_PROPERTY_CONTRACT_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setContractType(ContractTypeEnum contractType) { + this.contractType = contractType; + isSetContractType = true; // mark as set + } + + /** + * The expiration date and time of the offer validity period. + * + * @param expiresAt The expiration date and time of the offer validity period. + * @return the current {@code CalculatedGrantOffer} instance, allowing for method chaining + */ + public CalculatedGrantOffer expiresAt(OffsetDateTime expiresAt) { + this.expiresAt = expiresAt; + isSetExpiresAt = true; // mark as set + return this; + } + + /** + * The expiration date and time of the offer validity period. + * + * @return expiresAt The expiration date and time of the offer validity period. + */ + @JsonProperty(JSON_PROPERTY_EXPIRES_AT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OffsetDateTime getExpiresAt() { + return expiresAt; + } + + /** + * The expiration date and time of the offer validity period. + * + * @param expiresAt The expiration date and time of the offer validity period. + */ + @JsonProperty(JSON_PROPERTY_EXPIRES_AT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setExpiresAt(OffsetDateTime expiresAt) { + this.expiresAt = expiresAt; + isSetExpiresAt = true; // mark as set + } + + /** + * fee + * + * @param fee + * @return the current {@code CalculatedGrantOffer} instance, allowing for method chaining + */ + public CalculatedGrantOffer fee(GrantOfferFee 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 GrantOfferFee getFee() { + return fee; + } + + /** + * fee + * + * @param fee + */ + @JsonProperty(JSON_PROPERTY_FEE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setFee(GrantOfferFee fee) { + this.fee = fee; + isSetFee = true; // mark as set + } + + /** + * repayment + * + * @param repayment + * @return the current {@code CalculatedGrantOffer} instance, allowing for method chaining + */ + public CalculatedGrantOffer repayment(Repayment repayment) { + this.repayment = repayment; + isSetRepayment = true; // mark as set + return this; + } + + /** + * Get repayment + * + * @return repayment + */ + @JsonProperty(JSON_PROPERTY_REPAYMENT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Repayment getRepayment() { + return repayment; + } + + /** + * repayment + * + * @param repayment + */ + @JsonProperty(JSON_PROPERTY_REPAYMENT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setRepayment(Repayment repayment) { + this.repayment = repayment; + isSetRepayment = true; // mark as set + } + + /** + * The starting date and time of the offer validity period. + * + * @param startsAt The starting date and time of the offer validity period. + * @return the current {@code CalculatedGrantOffer} instance, allowing for method chaining + */ + public CalculatedGrantOffer startsAt(OffsetDateTime startsAt) { + this.startsAt = startsAt; + isSetStartsAt = true; // mark as set + return this; + } + + /** + * The starting date and time of the offer validity period. + * + * @return startsAt The starting date and time of the offer validity period. + */ + @JsonProperty(JSON_PROPERTY_STARTS_AT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OffsetDateTime getStartsAt() { + return startsAt; + } + + /** + * The starting date and time of the offer validity period. + * + * @param startsAt The starting date and time of the offer validity period. + */ + @JsonProperty(JSON_PROPERTY_STARTS_AT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setStartsAt(OffsetDateTime startsAt) { + this.startsAt = startsAt; + isSetStartsAt = true; // mark as set + } + + /** + * Configures whether null values are explicitly serialized in the JSON payload. Default is false. + */ + public CalculatedGrantOffer 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 CalculatedGrantOffer object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CalculatedGrantOffer calculatedGrantOffer = (CalculatedGrantOffer) o; + return Objects.equals(this.accountHolderId, calculatedGrantOffer.accountHolderId) + && Objects.equals(this.isSetAccountHolderId, calculatedGrantOffer.isSetAccountHolderId) + && Objects.equals(this.amount, calculatedGrantOffer.amount) + && Objects.equals(this.isSetAmount, calculatedGrantOffer.isSetAmount) + && Objects.equals(this.contractType, calculatedGrantOffer.contractType) + && Objects.equals(this.isSetContractType, calculatedGrantOffer.isSetContractType) + && Objects.equals(this.expiresAt, calculatedGrantOffer.expiresAt) + && Objects.equals(this.isSetExpiresAt, calculatedGrantOffer.isSetExpiresAt) + && Objects.equals(this.fee, calculatedGrantOffer.fee) + && Objects.equals(this.isSetFee, calculatedGrantOffer.isSetFee) + && Objects.equals(this.repayment, calculatedGrantOffer.repayment) + && Objects.equals(this.isSetRepayment, calculatedGrantOffer.isSetRepayment) + && Objects.equals(this.startsAt, calculatedGrantOffer.startsAt) + && Objects.equals(this.isSetStartsAt, calculatedGrantOffer.isSetStartsAt); + } + + @Override + public int hashCode() { + return Objects.hash( + accountHolderId, + isSetAccountHolderId, + amount, + isSetAmount, + contractType, + isSetContractType, + expiresAt, + isSetExpiresAt, + fee, + isSetFee, + repayment, + isSetRepayment, + startsAt, + isSetStartsAt); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CalculatedGrantOffer {\n"); + sb.append(" accountHolderId: ").append(toIndentedString(accountHolderId)).append("\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" contractType: ").append(toIndentedString(contractType)).append("\n"); + sb.append(" expiresAt: ").append(toIndentedString(expiresAt)).append("\n"); + sb.append(" fee: ").append(toIndentedString(fee)).append("\n"); + sb.append(" repayment: ").append(toIndentedString(repayment)).append("\n"); + sb.append(" startsAt: ").append(toIndentedString(startsAt)).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 (isSetAccountHolderId) { + addIfNull(nulls, JSON_PROPERTY_ACCOUNT_HOLDER_ID, this.accountHolderId); + } + if (isSetAmount) { + addIfNull(nulls, JSON_PROPERTY_AMOUNT, this.amount); + } + if (isSetContractType) { + addIfNull(nulls, JSON_PROPERTY_CONTRACT_TYPE, this.contractType); + } + if (isSetExpiresAt) { + addIfNull(nulls, JSON_PROPERTY_EXPIRES_AT, this.expiresAt); + } + if (isSetFee) { + addIfNull(nulls, JSON_PROPERTY_FEE, this.fee); + } + if (isSetRepayment) { + addIfNull(nulls, JSON_PROPERTY_REPAYMENT, this.repayment); + } + if (isSetStartsAt) { + addIfNull(nulls, JSON_PROPERTY_STARTS_AT, this.startsAt); + } + + 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 CalculatedGrantOffer given an JSON string + * + * @param jsonString JSON string + * @return An instance of CalculatedGrantOffer + * @throws JsonProcessingException if the JSON string is invalid with respect to + * CalculatedGrantOffer + */ + public static CalculatedGrantOffer fromJson(String jsonString) throws JsonProcessingException { + return JSON.getMapper().readValue(jsonString, CalculatedGrantOffer.class); + } + + /** + * Convert an instance of CalculatedGrantOffer to an JSON string + * + * @return JSON string + */ + public String toJson() throws JsonProcessingException { + return JSON.getMapper().writeValueAsString(this); + } +} diff --git a/src/main/java/com/adyen/model/capital/CreateGrantOfferRequest.java b/src/main/java/com/adyen/model/capital/CreateGrantOfferRequest.java new file mode 100644 index 000000000..1e4f07354 --- /dev/null +++ b/src/main/java/com/adyen/model/capital/CreateGrantOfferRequest.java @@ -0,0 +1,176 @@ +/* + * Capital API + * + * The version of the OpenAPI document: 1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.adyen.model.capital; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.core.JsonProcessingException; +import java.util.*; + +/** CreateGrantOfferRequest */ +@JsonPropertyOrder({CreateGrantOfferRequest.JSON_PROPERTY_AMOUNT}) +public class CreateGrantOfferRequest { + public static final String JSON_PROPERTY_AMOUNT = "amount"; + private Amount amount; + + /** Mark when the attribute has been explicitly set. */ + private boolean isSetAmount = false; + + /** + * Sets whether attributes with null values should be explicitly included in the JSON payload. + * Default is false. + */ + @JsonIgnore private boolean includeNullValues = false; + + public CreateGrantOfferRequest() {} + + /** + * amount + * + * @param amount + * @return the current {@code CreateGrantOfferRequest} instance, allowing for method chaining + */ + public CreateGrantOfferRequest 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 + } + + /** + * Configures whether null values are explicitly serialized in the JSON payload. Default is false. + */ + public CreateGrantOfferRequest 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 CreateGrantOfferRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateGrantOfferRequest createGrantOfferRequest = (CreateGrantOfferRequest) o; + return Objects.equals(this.amount, createGrantOfferRequest.amount) + && Objects.equals(this.isSetAmount, createGrantOfferRequest.isSetAmount); + } + + @Override + public int hashCode() { + return Objects.hash(amount, isSetAmount); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateGrantOfferRequest {\n"); + sb.append(" amount: ").append(toIndentedString(amount)).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); + } + + 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 CreateGrantOfferRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateGrantOfferRequest + * @throws JsonProcessingException if the JSON string is invalid with respect to + * CreateGrantOfferRequest + */ + public static CreateGrantOfferRequest fromJson(String jsonString) throws JsonProcessingException { + return JSON.getMapper().readValue(jsonString, CreateGrantOfferRequest.class); + } + + /** + * Convert an instance of CreateGrantOfferRequest to an JSON string + * + * @return JSON string + */ + public String toJson() throws JsonProcessingException { + return JSON.getMapper().writeValueAsString(this); + } +} diff --git a/src/main/java/com/adyen/model/capital/DisbursementRepayment.java b/src/main/java/com/adyen/model/capital/DisbursementRepayment.java index 4f6bbca7c..fb5ad25b3 100644 --- a/src/main/java/com/adyen/model/capital/DisbursementRepayment.java +++ b/src/main/java/com/adyen/model/capital/DisbursementRepayment.java @@ -32,7 +32,8 @@ public class DisbursementRepayment { private boolean isSetBasisPoints = false; public static final String JSON_PROPERTY_UPDATE_DESCRIPTION = "updateDescription"; - private String updateDescription; + /* deprecated */ + @Deprecated private String updateDescription; /** Mark when the attribute has been explicitly set. */ private boolean isSetUpdateDescription = false; @@ -97,7 +98,9 @@ public void setBasisPoints(Integer basisPoints) { * * @param updateDescription * @return the current {@code DisbursementRepayment} instance, allowing for method chaining + * @deprecated */ + @Deprecated public DisbursementRepayment updateDescription(String updateDescription) { this.updateDescription = updateDescription; isSetUpdateDescription = true; // mark as set @@ -108,7 +111,9 @@ public DisbursementRepayment updateDescription(String updateDescription) { * Get updateDescription * * @return updateDescription + * @deprecated */ + @Deprecated @JsonProperty(JSON_PROPERTY_UPDATE_DESCRIPTION) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getUpdateDescription() { @@ -119,7 +124,9 @@ public String getUpdateDescription() { * updateDescription * * @param updateDescription + * @deprecated */ + @Deprecated @JsonProperty(JSON_PROPERTY_UPDATE_DESCRIPTION) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setUpdateDescription(String updateDescription) { diff --git a/src/main/java/com/adyen/model/capital/DisbursementRepaymentInfoUpdate.java b/src/main/java/com/adyen/model/capital/DisbursementRepaymentInfoUpdate.java index 3d2c0c4d9..b88a2130d 100644 --- a/src/main/java/com/adyen/model/capital/DisbursementRepaymentInfoUpdate.java +++ b/src/main/java/com/adyen/model/capital/DisbursementRepaymentInfoUpdate.java @@ -32,7 +32,8 @@ public class DisbursementRepaymentInfoUpdate { private boolean isSetBasisPoints = false; public static final String JSON_PROPERTY_UPDATE_DESCRIPTION = "updateDescription"; - private String updateDescription; + /* deprecated */ + @Deprecated private String updateDescription; /** Mark when the attribute has been explicitly set. */ private boolean isSetUpdateDescription = false; @@ -99,7 +100,9 @@ public void setBasisPoints(Integer basisPoints) { * @param updateDescription * @return the current {@code DisbursementRepaymentInfoUpdate} instance, allowing for method * chaining + * @deprecated */ + @Deprecated public DisbursementRepaymentInfoUpdate updateDescription(String updateDescription) { this.updateDescription = updateDescription; isSetUpdateDescription = true; // mark as set @@ -110,7 +113,9 @@ public DisbursementRepaymentInfoUpdate updateDescription(String updateDescriptio * Get updateDescription * * @return updateDescription + * @deprecated */ + @Deprecated @JsonProperty(JSON_PROPERTY_UPDATE_DESCRIPTION) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getUpdateDescription() { @@ -121,7 +126,9 @@ public String getUpdateDescription() { * updateDescription * * @param updateDescription + * @deprecated */ + @Deprecated @JsonProperty(JSON_PROPERTY_UPDATE_DESCRIPTION) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setUpdateDescription(String updateDescription) { diff --git a/src/main/java/com/adyen/model/capital/DynamicOffer.java b/src/main/java/com/adyen/model/capital/DynamicOffer.java new file mode 100644 index 000000000..480aaaac7 --- /dev/null +++ b/src/main/java/com/adyen/model/capital/DynamicOffer.java @@ -0,0 +1,631 @@ +/* + * Capital API + * + * The version of the OpenAPI document: 1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.adyen.model.capital; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.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.time.OffsetDateTime; +import java.util.*; +import java.util.Arrays; +import java.util.logging.Logger; + +/** DynamicOffer */ +@JsonPropertyOrder({ + DynamicOffer.JSON_PROPERTY_ACCOUNT_HOLDER_ID, + DynamicOffer.JSON_PROPERTY_CONTRACT_TYPE, + DynamicOffer.JSON_PROPERTY_EXPIRES_AT, + DynamicOffer.JSON_PROPERTY_FINANCING_TYPE, + DynamicOffer.JSON_PROPERTY_ID, + DynamicOffer.JSON_PROPERTY_MAXIMUM_AMOUNT, + DynamicOffer.JSON_PROPERTY_MINIMUM_AMOUNT, + DynamicOffer.JSON_PROPERTY_REPAYMENT, + DynamicOffer.JSON_PROPERTY_STARTS_AT +}) +public class DynamicOffer { + public static final String JSON_PROPERTY_ACCOUNT_HOLDER_ID = "accountHolderId"; + private String accountHolderId; + + /** Mark when the attribute has been explicitly set. */ + private boolean isSetAccountHolderId = false; + + /** The contract type of the offer. Possible values: * **loan** * **cashAdvance** */ + public enum ContractTypeEnum { + CASHADVANCE(String.valueOf("cashAdvance")), + + LOAN(String.valueOf("loan")); + + private static final Logger LOG = Logger.getLogger(ContractTypeEnum.class.getName()); + + private String value; + + ContractTypeEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static ContractTypeEnum fromValue(String value) { + for (ContractTypeEnum b : ContractTypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + // handling unexpected value + LOG.warning( + "ContractTypeEnum: unexpected enum value '" + + value + + "' - Supported values are " + + Arrays.toString(ContractTypeEnum.values())); + return null; + } + } + + public static final String JSON_PROPERTY_CONTRACT_TYPE = "contractType"; + private ContractTypeEnum contractType; + + /** Mark when the attribute has been explicitly set. */ + private boolean isSetContractType = false; + + public static final String JSON_PROPERTY_EXPIRES_AT = "expiresAt"; + private OffsetDateTime expiresAt; + + /** Mark when the attribute has been explicitly set. */ + private boolean isSetExpiresAt = false; + + public static final String JSON_PROPERTY_FINANCING_TYPE = "financingType"; + private FinancingType financingType; + + /** Mark when the attribute has been explicitly set. */ + private boolean isSetFinancingType = 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_MAXIMUM_AMOUNT = "maximumAmount"; + private Amount maximumAmount; + + /** Mark when the attribute has been explicitly set. */ + private boolean isSetMaximumAmount = false; + + public static final String JSON_PROPERTY_MINIMUM_AMOUNT = "minimumAmount"; + private Amount minimumAmount; + + /** Mark when the attribute has been explicitly set. */ + private boolean isSetMinimumAmount = false; + + public static final String JSON_PROPERTY_REPAYMENT = "repayment"; + private DynamicOfferRepayment repayment; + + /** Mark when the attribute has been explicitly set. */ + private boolean isSetRepayment = false; + + public static final String JSON_PROPERTY_STARTS_AT = "startsAt"; + private OffsetDateTime startsAt; + + /** Mark when the attribute has been explicitly set. */ + private boolean isSetStartsAt = false; + + /** + * Sets whether attributes with null values should be explicitly included in the JSON payload. + * Default is false. + */ + @JsonIgnore private boolean includeNullValues = false; + + public DynamicOffer() {} + + /** + * The unique identifier of the account holder that the dynamic offer is for. + * + * @param accountHolderId The unique identifier of the account holder that the dynamic offer is + * for. + * @return the current {@code DynamicOffer} instance, allowing for method chaining + */ + public DynamicOffer accountHolderId(String accountHolderId) { + this.accountHolderId = accountHolderId; + isSetAccountHolderId = true; // mark as set + return this; + } + + /** + * The unique identifier of the account holder that the dynamic offer is for. + * + * @return accountHolderId The unique identifier of the account holder that the dynamic offer is + * for. + */ + @JsonProperty(JSON_PROPERTY_ACCOUNT_HOLDER_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getAccountHolderId() { + return accountHolderId; + } + + /** + * The unique identifier of the account holder that the dynamic offer is for. + * + * @param accountHolderId The unique identifier of the account holder that the dynamic offer is + * for. + */ + @JsonProperty(JSON_PROPERTY_ACCOUNT_HOLDER_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setAccountHolderId(String accountHolderId) { + this.accountHolderId = accountHolderId; + isSetAccountHolderId = true; // mark as set + } + + /** + * The contract type of the offer. Possible values: * **loan** * **cashAdvance** + * + * @param contractType The contract type of the offer. Possible values: * **loan** * + * **cashAdvance** + * @return the current {@code DynamicOffer} instance, allowing for method chaining + */ + public DynamicOffer contractType(ContractTypeEnum contractType) { + this.contractType = contractType; + isSetContractType = true; // mark as set + return this; + } + + /** + * The contract type of the offer. Possible values: * **loan** * **cashAdvance** + * + * @return contractType The contract type of the offer. Possible values: * **loan** * + * **cashAdvance** + */ + @JsonProperty(JSON_PROPERTY_CONTRACT_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public ContractTypeEnum getContractType() { + return contractType; + } + + /** + * The contract type of the offer. Possible values: * **loan** * **cashAdvance** + * + * @param contractType The contract type of the offer. Possible values: * **loan** * + * **cashAdvance** + */ + @JsonProperty(JSON_PROPERTY_CONTRACT_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setContractType(ContractTypeEnum contractType) { + this.contractType = contractType; + isSetContractType = true; // mark as set + } + + /** + * The expiration date and time of the offer validity period. + * + * @param expiresAt The expiration date and time of the offer validity period. + * @return the current {@code DynamicOffer} instance, allowing for method chaining + */ + public DynamicOffer expiresAt(OffsetDateTime expiresAt) { + this.expiresAt = expiresAt; + isSetExpiresAt = true; // mark as set + return this; + } + + /** + * The expiration date and time of the offer validity period. + * + * @return expiresAt The expiration date and time of the offer validity period. + */ + @JsonProperty(JSON_PROPERTY_EXPIRES_AT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OffsetDateTime getExpiresAt() { + return expiresAt; + } + + /** + * The expiration date and time of the offer validity period. + * + * @param expiresAt The expiration date and time of the offer validity period. + */ + @JsonProperty(JSON_PROPERTY_EXPIRES_AT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setExpiresAt(OffsetDateTime expiresAt) { + this.expiresAt = expiresAt; + isSetExpiresAt = true; // mark as set + } + + /** + * financingType + * + * @param financingType + * @return the current {@code DynamicOffer} instance, allowing for method chaining + */ + public DynamicOffer financingType(FinancingType financingType) { + this.financingType = financingType; + isSetFinancingType = true; // mark as set + return this; + } + + /** + * Get financingType + * + * @return financingType + */ + @JsonProperty(JSON_PROPERTY_FINANCING_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public FinancingType getFinancingType() { + return financingType; + } + + /** + * financingType + * + * @param financingType + */ + @JsonProperty(JSON_PROPERTY_FINANCING_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setFinancingType(FinancingType financingType) { + this.financingType = financingType; + isSetFinancingType = true; // mark as set + } + + /** + * The unique identifier of the dynamic offer. + * + * @param id The unique identifier of the dynamic offer. + * @return the current {@code DynamicOffer} instance, allowing for method chaining + */ + public DynamicOffer id(String id) { + this.id = id; + isSetId = true; // mark as set + return this; + } + + /** + * The unique identifier of the dynamic offer. + * + * @return id The unique identifier of the dynamic offer. + */ + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getId() { + return id; + } + + /** + * The unique identifier of the dynamic offer. + * + * @param id The unique identifier of the dynamic offer. + */ + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setId(String id) { + this.id = id; + isSetId = true; // mark as set + } + + /** + * maximumAmount + * + * @param maximumAmount + * @return the current {@code DynamicOffer} instance, allowing for method chaining + */ + public DynamicOffer maximumAmount(Amount maximumAmount) { + this.maximumAmount = maximumAmount; + isSetMaximumAmount = true; // mark as set + return this; + } + + /** + * Get maximumAmount + * + * @return maximumAmount + */ + @JsonProperty(JSON_PROPERTY_MAXIMUM_AMOUNT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Amount getMaximumAmount() { + return maximumAmount; + } + + /** + * maximumAmount + * + * @param maximumAmount + */ + @JsonProperty(JSON_PROPERTY_MAXIMUM_AMOUNT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setMaximumAmount(Amount maximumAmount) { + this.maximumAmount = maximumAmount; + isSetMaximumAmount = true; // mark as set + } + + /** + * minimumAmount + * + * @param minimumAmount + * @return the current {@code DynamicOffer} instance, allowing for method chaining + */ + public DynamicOffer minimumAmount(Amount minimumAmount) { + this.minimumAmount = minimumAmount; + isSetMinimumAmount = true; // mark as set + return this; + } + + /** + * Get minimumAmount + * + * @return minimumAmount + */ + @JsonProperty(JSON_PROPERTY_MINIMUM_AMOUNT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Amount getMinimumAmount() { + return minimumAmount; + } + + /** + * minimumAmount + * + * @param minimumAmount + */ + @JsonProperty(JSON_PROPERTY_MINIMUM_AMOUNT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setMinimumAmount(Amount minimumAmount) { + this.minimumAmount = minimumAmount; + isSetMinimumAmount = true; // mark as set + } + + /** + * repayment + * + * @param repayment + * @return the current {@code DynamicOffer} instance, allowing for method chaining + */ + public DynamicOffer repayment(DynamicOfferRepayment repayment) { + this.repayment = repayment; + isSetRepayment = true; // mark as set + return this; + } + + /** + * Get repayment + * + * @return repayment + */ + @JsonProperty(JSON_PROPERTY_REPAYMENT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public DynamicOfferRepayment getRepayment() { + return repayment; + } + + /** + * repayment + * + * @param repayment + */ + @JsonProperty(JSON_PROPERTY_REPAYMENT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setRepayment(DynamicOfferRepayment repayment) { + this.repayment = repayment; + isSetRepayment = true; // mark as set + } + + /** + * The starting date and time of the offer validity period. + * + * @param startsAt The starting date and time of the offer validity period. + * @return the current {@code DynamicOffer} instance, allowing for method chaining + */ + public DynamicOffer startsAt(OffsetDateTime startsAt) { + this.startsAt = startsAt; + isSetStartsAt = true; // mark as set + return this; + } + + /** + * The starting date and time of the offer validity period. + * + * @return startsAt The starting date and time of the offer validity period. + */ + @JsonProperty(JSON_PROPERTY_STARTS_AT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OffsetDateTime getStartsAt() { + return startsAt; + } + + /** + * The starting date and time of the offer validity period. + * + * @param startsAt The starting date and time of the offer validity period. + */ + @JsonProperty(JSON_PROPERTY_STARTS_AT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setStartsAt(OffsetDateTime startsAt) { + this.startsAt = startsAt; + isSetStartsAt = true; // mark as set + } + + /** + * Configures whether null values are explicitly serialized in the JSON payload. Default is false. + */ + public DynamicOffer 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 DynamicOffer object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DynamicOffer dynamicOffer = (DynamicOffer) o; + return Objects.equals(this.accountHolderId, dynamicOffer.accountHolderId) + && Objects.equals(this.isSetAccountHolderId, dynamicOffer.isSetAccountHolderId) + && Objects.equals(this.contractType, dynamicOffer.contractType) + && Objects.equals(this.isSetContractType, dynamicOffer.isSetContractType) + && Objects.equals(this.expiresAt, dynamicOffer.expiresAt) + && Objects.equals(this.isSetExpiresAt, dynamicOffer.isSetExpiresAt) + && Objects.equals(this.financingType, dynamicOffer.financingType) + && Objects.equals(this.isSetFinancingType, dynamicOffer.isSetFinancingType) + && Objects.equals(this.id, dynamicOffer.id) + && Objects.equals(this.isSetId, dynamicOffer.isSetId) + && Objects.equals(this.maximumAmount, dynamicOffer.maximumAmount) + && Objects.equals(this.isSetMaximumAmount, dynamicOffer.isSetMaximumAmount) + && Objects.equals(this.minimumAmount, dynamicOffer.minimumAmount) + && Objects.equals(this.isSetMinimumAmount, dynamicOffer.isSetMinimumAmount) + && Objects.equals(this.repayment, dynamicOffer.repayment) + && Objects.equals(this.isSetRepayment, dynamicOffer.isSetRepayment) + && Objects.equals(this.startsAt, dynamicOffer.startsAt) + && Objects.equals(this.isSetStartsAt, dynamicOffer.isSetStartsAt); + } + + @Override + public int hashCode() { + return Objects.hash( + accountHolderId, + isSetAccountHolderId, + contractType, + isSetContractType, + expiresAt, + isSetExpiresAt, + financingType, + isSetFinancingType, + id, + isSetId, + maximumAmount, + isSetMaximumAmount, + minimumAmount, + isSetMinimumAmount, + repayment, + isSetRepayment, + startsAt, + isSetStartsAt); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DynamicOffer {\n"); + sb.append(" accountHolderId: ").append(toIndentedString(accountHolderId)).append("\n"); + sb.append(" contractType: ").append(toIndentedString(contractType)).append("\n"); + sb.append(" expiresAt: ").append(toIndentedString(expiresAt)).append("\n"); + sb.append(" financingType: ").append(toIndentedString(financingType)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" maximumAmount: ").append(toIndentedString(maximumAmount)).append("\n"); + sb.append(" minimumAmount: ").append(toIndentedString(minimumAmount)).append("\n"); + sb.append(" repayment: ").append(toIndentedString(repayment)).append("\n"); + sb.append(" startsAt: ").append(toIndentedString(startsAt)).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 (isSetAccountHolderId) { + addIfNull(nulls, JSON_PROPERTY_ACCOUNT_HOLDER_ID, this.accountHolderId); + } + if (isSetContractType) { + addIfNull(nulls, JSON_PROPERTY_CONTRACT_TYPE, this.contractType); + } + if (isSetExpiresAt) { + addIfNull(nulls, JSON_PROPERTY_EXPIRES_AT, this.expiresAt); + } + if (isSetFinancingType) { + addIfNull(nulls, JSON_PROPERTY_FINANCING_TYPE, this.financingType); + } + if (isSetId) { + addIfNull(nulls, JSON_PROPERTY_ID, this.id); + } + if (isSetMaximumAmount) { + addIfNull(nulls, JSON_PROPERTY_MAXIMUM_AMOUNT, this.maximumAmount); + } + if (isSetMinimumAmount) { + addIfNull(nulls, JSON_PROPERTY_MINIMUM_AMOUNT, this.minimumAmount); + } + if (isSetRepayment) { + addIfNull(nulls, JSON_PROPERTY_REPAYMENT, this.repayment); + } + if (isSetStartsAt) { + addIfNull(nulls, JSON_PROPERTY_STARTS_AT, this.startsAt); + } + + 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 DynamicOffer given an JSON string + * + * @param jsonString JSON string + * @return An instance of DynamicOffer + * @throws JsonProcessingException if the JSON string is invalid with respect to DynamicOffer + */ + public static DynamicOffer fromJson(String jsonString) throws JsonProcessingException { + return JSON.getMapper().readValue(jsonString, DynamicOffer.class); + } + + /** + * Convert an instance of DynamicOffer to an JSON string + * + * @return JSON string + */ + public String toJson() throws JsonProcessingException { + return JSON.getMapper().writeValueAsString(this); + } +} diff --git a/src/main/java/com/adyen/model/capital/DynamicOfferRepayment.java b/src/main/java/com/adyen/model/capital/DynamicOfferRepayment.java new file mode 100644 index 000000000..b9aa1e107 --- /dev/null +++ b/src/main/java/com/adyen/model/capital/DynamicOfferRepayment.java @@ -0,0 +1,176 @@ +/* + * Capital API + * + * The version of the OpenAPI document: 1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.adyen.model.capital; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.core.JsonProcessingException; +import java.util.*; + +/** DynamicOfferRepayment */ +@JsonPropertyOrder({DynamicOfferRepayment.JSON_PROPERTY_TERM}) +public class DynamicOfferRepayment { + public static final String JSON_PROPERTY_TERM = "term"; + private RepaymentTerm term; + + /** Mark when the attribute has been explicitly set. */ + private boolean isSetTerm = false; + + /** + * Sets whether attributes with null values should be explicitly included in the JSON payload. + * Default is false. + */ + @JsonIgnore private boolean includeNullValues = false; + + public DynamicOfferRepayment() {} + + /** + * term + * + * @param term + * @return the current {@code DynamicOfferRepayment} instance, allowing for method chaining + */ + public DynamicOfferRepayment term(RepaymentTerm term) { + this.term = term; + isSetTerm = true; // mark as set + return this; + } + + /** + * Get term + * + * @return term + */ + @JsonProperty(JSON_PROPERTY_TERM) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public RepaymentTerm getTerm() { + return term; + } + + /** + * term + * + * @param term + */ + @JsonProperty(JSON_PROPERTY_TERM) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setTerm(RepaymentTerm term) { + this.term = term; + isSetTerm = true; // mark as set + } + + /** + * Configures whether null values are explicitly serialized in the JSON payload. Default is false. + */ + public DynamicOfferRepayment 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 DynamicOfferRepayment object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DynamicOfferRepayment dynamicOfferRepayment = (DynamicOfferRepayment) o; + return Objects.equals(this.term, dynamicOfferRepayment.term) + && Objects.equals(this.isSetTerm, dynamicOfferRepayment.isSetTerm); + } + + @Override + public int hashCode() { + return Objects.hash(term, isSetTerm); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DynamicOfferRepayment {\n"); + sb.append(" term: ").append(toIndentedString(term)).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 (isSetTerm) { + addIfNull(nulls, JSON_PROPERTY_TERM, this.term); + } + + 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 DynamicOfferRepayment given an JSON string + * + * @param jsonString JSON string + * @return An instance of DynamicOfferRepayment + * @throws JsonProcessingException if the JSON string is invalid with respect to + * DynamicOfferRepayment + */ + public static DynamicOfferRepayment fromJson(String jsonString) throws JsonProcessingException { + return JSON.getMapper().readValue(jsonString, DynamicOfferRepayment.class); + } + + /** + * Convert an instance of DynamicOfferRepayment to an JSON string + * + * @return JSON string + */ + public String toJson() throws JsonProcessingException { + return JSON.getMapper().writeValueAsString(this); + } +} diff --git a/src/main/java/com/adyen/model/capital/AdditionalBankIdentificationTypes.java b/src/main/java/com/adyen/model/capital/FinancingType.java similarity index 51% rename from src/main/java/com/adyen/model/capital/AdditionalBankIdentificationTypes.java rename to src/main/java/com/adyen/model/capital/FinancingType.java index 21da23da9..360dcc7b2 100644 --- a/src/main/java/com/adyen/model/capital/AdditionalBankIdentificationTypes.java +++ b/src/main/java/com/adyen/model/capital/FinancingType.java @@ -14,26 +14,19 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; import java.util.*; +import java.util.logging.Logger; -/** Gets or Sets AdditionalBankIdentificationTypes */ -public enum AdditionalBankIdentificationTypes { - AUBSBCODE("auBsbCode"), +/** Gets or Sets FinancingType */ +public enum FinancingType { + HARDWAREFINANCING("hardwareFinancing"), - CAROUTINGNUMBER("caRoutingNumber"), + BUSINESSFINANCING("businessFinancing"); - GBSORTCODE("gbSortCode"), - - HKBANKCODE("hkBankCode"), - - JPZENGINCODE("jpZenginCode"), - - NZBANKBRANCHCODE("nzBankBranchCode"), - - USROUTINGNUMBER("usRoutingNumber"); + private static final Logger LOG = Logger.getLogger(FinancingType.class.getName()); private String value; - AdditionalBankIdentificationTypes(String value) { + FinancingType(String value) { this.value = value; } @@ -48,12 +41,18 @@ public String toString() { } @JsonCreator - public static AdditionalBankIdentificationTypes fromValue(String value) { - for (AdditionalBankIdentificationTypes b : AdditionalBankIdentificationTypes.values()) { + public static FinancingType fromValue(String value) { + for (FinancingType b : FinancingType.values()) { if (b.value.equals(value)) { return b; } } - throw new IllegalArgumentException("Unexpected value '" + value + "'"); + // handling unexpected value + LOG.warning( + "FinancingType: unexpected enum value '" + + value + + "' - Supported values are " + + Arrays.toString(FinancingType.values())); + return null; } } diff --git a/src/main/java/com/adyen/model/capital/FundsCollectionType.java b/src/main/java/com/adyen/model/capital/FundsCollectionType.java index 9ca548f92..bc225f39d 100644 --- a/src/main/java/com/adyen/model/capital/FundsCollectionType.java +++ b/src/main/java/com/adyen/model/capital/FundsCollectionType.java @@ -14,6 +14,7 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; import java.util.*; +import java.util.logging.Logger; /** Gets or Sets FundsCollectionType */ public enum FundsCollectionType { @@ -21,6 +22,8 @@ public enum FundsCollectionType { REVOCATION("Revocation"); + private static final Logger LOG = Logger.getLogger(FundsCollectionType.class.getName()); + private String value; FundsCollectionType(String value) { @@ -44,6 +47,12 @@ public static FundsCollectionType fromValue(String value) { return b; } } - throw new IllegalArgumentException("Unexpected value '" + value + "'"); + // handling unexpected value + LOG.warning( + "FundsCollectionType: unexpected enum value '" + + value + + "' - Supported values are " + + Arrays.toString(FundsCollectionType.values())); + return null; } } diff --git a/src/main/java/com/adyen/model/capital/GetDynamicOffersResponse.java b/src/main/java/com/adyen/model/capital/GetDynamicOffersResponse.java new file mode 100644 index 000000000..9912374f2 --- /dev/null +++ b/src/main/java/com/adyen/model/capital/GetDynamicOffersResponse.java @@ -0,0 +1,190 @@ +/* + * Capital API + * + * The version of the OpenAPI document: 1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.adyen.model.capital; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.core.JsonProcessingException; +import java.util.*; +import java.util.ArrayList; +import java.util.List; + +/** GetDynamicOffersResponse */ +@JsonPropertyOrder({GetDynamicOffersResponse.JSON_PROPERTY_DYNAMIC_OFFERS}) +public class GetDynamicOffersResponse { + public static final String JSON_PROPERTY_DYNAMIC_OFFERS = "dynamicOffers"; + private List dynamicOffers; + + /** Mark when the attribute has been explicitly set. */ + private boolean isSetDynamicOffers = false; + + /** + * Sets whether attributes with null values should be explicitly included in the JSON payload. + * Default is false. + */ + @JsonIgnore private boolean includeNullValues = false; + + public GetDynamicOffersResponse() {} + + /** + * Contains a list of available dynamic offers for the specified account holder. + * + * @param dynamicOffers Contains a list of available dynamic offers for the specified account + * holder. + * @return the current {@code GetDynamicOffersResponse} instance, allowing for method chaining + */ + public GetDynamicOffersResponse dynamicOffers(List dynamicOffers) { + this.dynamicOffers = dynamicOffers; + isSetDynamicOffers = true; // mark as set + return this; + } + + public GetDynamicOffersResponse addDynamicOffersItem(DynamicOffer dynamicOffersItem) { + if (this.dynamicOffers == null) { + this.dynamicOffers = new ArrayList<>(); + } + this.dynamicOffers.add(dynamicOffersItem); + return this; + } + + /** + * Contains a list of available dynamic offers for the specified account holder. + * + * @return dynamicOffers Contains a list of available dynamic offers for the specified account + * holder. + */ + @JsonProperty(JSON_PROPERTY_DYNAMIC_OFFERS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getDynamicOffers() { + return dynamicOffers; + } + + /** + * Contains a list of available dynamic offers for the specified account holder. + * + * @param dynamicOffers Contains a list of available dynamic offers for the specified account + * holder. + */ + @JsonProperty(JSON_PROPERTY_DYNAMIC_OFFERS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setDynamicOffers(List dynamicOffers) { + this.dynamicOffers = dynamicOffers; + isSetDynamicOffers = true; // mark as set + } + + /** + * Configures whether null values are explicitly serialized in the JSON payload. Default is false. + */ + public GetDynamicOffersResponse 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 GetDynamicOffersResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetDynamicOffersResponse getDynamicOffersResponse = (GetDynamicOffersResponse) o; + return Objects.equals(this.dynamicOffers, getDynamicOffersResponse.dynamicOffers) + && Objects.equals(this.isSetDynamicOffers, getDynamicOffersResponse.isSetDynamicOffers); + } + + @Override + public int hashCode() { + return Objects.hash(dynamicOffers, isSetDynamicOffers); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetDynamicOffersResponse {\n"); + sb.append(" dynamicOffers: ").append(toIndentedString(dynamicOffers)).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 (isSetDynamicOffers) { + addIfNull(nulls, JSON_PROPERTY_DYNAMIC_OFFERS, this.dynamicOffers); + } + + 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 GetDynamicOffersResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetDynamicOffersResponse + * @throws JsonProcessingException if the JSON string is invalid with respect to + * GetDynamicOffersResponse + */ + public static GetDynamicOffersResponse fromJson(String jsonString) + throws JsonProcessingException { + return JSON.getMapper().readValue(jsonString, GetDynamicOffersResponse.class); + } + + /** + * Convert an instance of GetDynamicOffersResponse to an JSON string + * + * @return JSON string + */ + public String toJson() throws JsonProcessingException { + return JSON.getMapper().writeValueAsString(this); + } +} diff --git a/src/main/java/com/adyen/model/capital/Grant.java b/src/main/java/com/adyen/model/capital/Grant.java index 4da3e88f7..3fc842eb3 100644 --- a/src/main/java/com/adyen/model/capital/Grant.java +++ b/src/main/java/com/adyen/model/capital/Grant.java @@ -179,11 +179,11 @@ public void setGrantAccountId(String grantAccountId) { } /** - * The unique identifier of the selected grant offer. Adyen uses the details of the selected grant - * offer to create a grant. + * The unique identifier of the selected offer. Adyen uses the details of the selected offer to + * create a grant. * - * @param grantOfferId The unique identifier of the selected grant offer. Adyen uses the details - * of the selected grant offer to create a grant. + * @param grantOfferId The unique identifier of the selected offer. Adyen uses the details of the + * selected offer to create a grant. * @return the current {@code Grant} instance, allowing for method chaining */ public Grant grantOfferId(String grantOfferId) { @@ -193,11 +193,11 @@ public Grant grantOfferId(String grantOfferId) { } /** - * The unique identifier of the selected grant offer. Adyen uses the details of the selected grant - * offer to create a grant. + * The unique identifier of the selected offer. Adyen uses the details of the selected offer to + * create a grant. * - * @return grantOfferId The unique identifier of the selected grant offer. Adyen uses the details - * of the selected grant offer to create a grant. + * @return grantOfferId The unique identifier of the selected offer. Adyen uses the details of the + * selected offer to create a grant. */ @JsonProperty(JSON_PROPERTY_GRANT_OFFER_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -206,11 +206,11 @@ public String getGrantOfferId() { } /** - * The unique identifier of the selected grant offer. Adyen uses the details of the selected grant - * offer to create a grant. + * The unique identifier of the selected offer. Adyen uses the details of the selected offer to + * create a grant. * - * @param grantOfferId The unique identifier of the selected grant offer. Adyen uses the details - * of the selected grant offer to create a grant. + * @param grantOfferId The unique identifier of the selected offer. Adyen uses the details of the + * selected offer to create a grant. */ @JsonProperty(JSON_PROPERTY_GRANT_OFFER_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) diff --git a/src/main/java/com/adyen/model/capital/GrantInfo.java b/src/main/java/com/adyen/model/capital/GrantInfo.java index 8a284d2a2..36d682b43 100644 --- a/src/main/java/com/adyen/model/capital/GrantInfo.java +++ b/src/main/java/com/adyen/model/capital/GrantInfo.java @@ -123,11 +123,11 @@ public void setGrantAccountId(String grantAccountId) { } /** - * The unique identifier of the selected grant offer. Adyen uses the details of the selected grant - * offer to create a grant. + * The unique identifier of the selected offer. Adyen uses the details of the selected offer to + * create a grant. * - * @param grantOfferId The unique identifier of the selected grant offer. Adyen uses the details - * of the selected grant offer to create a grant. + * @param grantOfferId The unique identifier of the selected offer. Adyen uses the details of the + * selected offer to create a grant. * @return the current {@code GrantInfo} instance, allowing for method chaining */ public GrantInfo grantOfferId(String grantOfferId) { @@ -137,11 +137,11 @@ public GrantInfo grantOfferId(String grantOfferId) { } /** - * The unique identifier of the selected grant offer. Adyen uses the details of the selected grant - * offer to create a grant. + * The unique identifier of the selected offer. Adyen uses the details of the selected offer to + * create a grant. * - * @return grantOfferId The unique identifier of the selected grant offer. Adyen uses the details - * of the selected grant offer to create a grant. + * @return grantOfferId The unique identifier of the selected offer. Adyen uses the details of the + * selected offer to create a grant. */ @JsonProperty(JSON_PROPERTY_GRANT_OFFER_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -150,11 +150,11 @@ public String getGrantOfferId() { } /** - * The unique identifier of the selected grant offer. Adyen uses the details of the selected grant - * offer to create a grant. + * The unique identifier of the selected offer. Adyen uses the details of the selected offer to + * create a grant. * - * @param grantOfferId The unique identifier of the selected grant offer. Adyen uses the details - * of the selected grant offer to create a grant. + * @param grantOfferId The unique identifier of the selected offer. Adyen uses the details of the + * selected offer to create a grant. */ @JsonProperty(JSON_PROPERTY_GRANT_OFFER_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) diff --git a/src/main/java/com/adyen/model/capital/GrantOffer.java b/src/main/java/com/adyen/model/capital/GrantOffer.java index 8d118734c..db9b41acf 100644 --- a/src/main/java/com/adyen/model/capital/GrantOffer.java +++ b/src/main/java/com/adyen/model/capital/GrantOffer.java @@ -48,7 +48,7 @@ public class GrantOffer { /** Mark when the attribute has been explicitly set. */ private boolean isSetAmount = false; - /** The contract type of the grant offer. Possible values: **cashAdvance**, **loan**. */ + /** The contract type of the offer. Possible values: * **loan** * **cashAdvance** */ public enum ContractTypeEnum { CASHADVANCE(String.valueOf("cashAdvance")), @@ -207,10 +207,10 @@ public void setAmount(Amount amount) { } /** - * The contract type of the grant offer. Possible values: **cashAdvance**, **loan**. + * The contract type of the offer. Possible values: * **loan** * **cashAdvance** * - * @param contractType The contract type of the grant offer. Possible values: **cashAdvance**, - * **loan**. + * @param contractType The contract type of the offer. Possible values: * **loan** * + * **cashAdvance** * @return the current {@code GrantOffer} instance, allowing for method chaining */ public GrantOffer contractType(ContractTypeEnum contractType) { @@ -220,10 +220,10 @@ public GrantOffer contractType(ContractTypeEnum contractType) { } /** - * The contract type of the grant offer. Possible values: **cashAdvance**, **loan**. + * The contract type of the offer. Possible values: * **loan** * **cashAdvance** * - * @return contractType The contract type of the grant offer. Possible values: **cashAdvance**, - * **loan**. + * @return contractType The contract type of the offer. Possible values: * **loan** * + * **cashAdvance** */ @JsonProperty(JSON_PROPERTY_CONTRACT_TYPE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -232,10 +232,10 @@ public ContractTypeEnum getContractType() { } /** - * The contract type of the grant offer. Possible values: **cashAdvance**, **loan**. + * The contract type of the offer. Possible values: * **loan** * **cashAdvance** * - * @param contractType The contract type of the grant offer. Possible values: **cashAdvance**, - * **loan**. + * @param contractType The contract type of the offer. Possible values: * **loan** * + * **cashAdvance** */ @JsonProperty(JSON_PROPERTY_CONTRACT_TYPE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -245,9 +245,9 @@ public void setContractType(ContractTypeEnum contractType) { } /** - * The date when the grant offer expires. + * The expiration date and time of the offer validity period. * - * @param expiresAt The date when the grant offer expires. + * @param expiresAt The expiration date and time of the offer validity period. * @return the current {@code GrantOffer} instance, allowing for method chaining */ public GrantOffer expiresAt(OffsetDateTime expiresAt) { @@ -257,9 +257,9 @@ public GrantOffer expiresAt(OffsetDateTime expiresAt) { } /** - * The date when the grant offer expires. + * The expiration date and time of the offer validity period. * - * @return expiresAt The date when the grant offer expires. + * @return expiresAt The expiration date and time of the offer validity period. */ @JsonProperty(JSON_PROPERTY_EXPIRES_AT) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -268,9 +268,9 @@ public OffsetDateTime getExpiresAt() { } /** - * The date when the grant offer expires. + * The expiration date and time of the offer validity period. * - * @param expiresAt The date when the grant offer expires. + * @param expiresAt The expiration date and time of the offer validity period. */ @JsonProperty(JSON_PROPERTY_EXPIRES_AT) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -315,9 +315,9 @@ public void setFee(GrantOfferFee fee) { } /** - * The unique identifier of the grant offer. + * The unique identifier of the offer. * - * @param id The unique identifier of the grant offer. + * @param id The unique identifier of the offer. * @return the current {@code GrantOffer} instance, allowing for method chaining */ public GrantOffer id(String id) { @@ -327,9 +327,9 @@ public GrantOffer id(String id) { } /** - * The unique identifier of the grant offer. + * The unique identifier of the offer. * - * @return id The unique identifier of the grant offer. + * @return id The unique identifier of the offer. */ @JsonProperty(JSON_PROPERTY_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -338,9 +338,9 @@ public String getId() { } /** - * The unique identifier of the grant offer. + * The unique identifier of the offer. * - * @param id The unique identifier of the grant offer. + * @param id The unique identifier of the offer. */ @JsonProperty(JSON_PROPERTY_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -385,9 +385,9 @@ public void setRepayment(Repayment repayment) { } /** - * The date when the grant offer becomes available. + * The starting date and time of the offer validity period. * - * @param startsAt The date when the grant offer becomes available. + * @param startsAt The starting date and time of the offer validity period. * @return the current {@code GrantOffer} instance, allowing for method chaining */ public GrantOffer startsAt(OffsetDateTime startsAt) { @@ -397,9 +397,9 @@ public GrantOffer startsAt(OffsetDateTime startsAt) { } /** - * The date when the grant offer becomes available. + * The starting date and time of the offer validity period. * - * @return startsAt The date when the grant offer becomes available. + * @return startsAt The starting date and time of the offer validity period. */ @JsonProperty(JSON_PROPERTY_STARTS_AT) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -408,9 +408,9 @@ public OffsetDateTime getStartsAt() { } /** - * The date when the grant offer becomes available. + * The starting date and time of the offer validity period. * - * @param startsAt The date when the grant offer becomes available. + * @param startsAt The starting date and time of the offer validity period. */ @JsonProperty(JSON_PROPERTY_STARTS_AT) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) diff --git a/src/main/java/com/adyen/model/capital/GrantOffers.java b/src/main/java/com/adyen/model/capital/GrantOffers.java index 9bcf10695..ab491c022 100644 --- a/src/main/java/com/adyen/model/capital/GrantOffers.java +++ b/src/main/java/com/adyen/model/capital/GrantOffers.java @@ -39,9 +39,9 @@ public class GrantOffers { public GrantOffers() {} /** - * Contains a list of available grant offers for the specified account holder. + * Contains a list of available offers for the specified account holder. * - * @param grantOffers Contains a list of available grant offers for the specified account holder. + * @param grantOffers Contains a list of available offers for the specified account holder. * @return the current {@code GrantOffers} instance, allowing for method chaining */ public GrantOffers grantOffers(List grantOffers) { @@ -59,9 +59,9 @@ public GrantOffers addGrantOffersItem(GrantOffer grantOffersItem) { } /** - * Contains a list of available grant offers for the specified account holder. + * Contains a list of available offers for the specified account holder. * - * @return grantOffers Contains a list of available grant offers for the specified account holder. + * @return grantOffers Contains a list of available offers for the specified account holder. */ @JsonProperty(JSON_PROPERTY_GRANT_OFFERS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -70,9 +70,9 @@ public List getGrantOffers() { } /** - * Contains a list of available grant offers for the specified account holder. + * Contains a list of available offers for the specified account holder. * - * @param grantOffers Contains a list of available grant offers for the specified account holder. + * @param grantOffers Contains a list of available offers for the specified account holder. */ @JsonProperty(JSON_PROPERTY_GRANT_OFFERS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) diff --git a/src/main/java/com/adyen/model/capital/IbanAccountIdentification.java b/src/main/java/com/adyen/model/capital/IbanAccountIdentification.java index 811743216..7f54349a9 100644 --- a/src/main/java/com/adyen/model/capital/IbanAccountIdentification.java +++ b/src/main/java/com/adyen/model/capital/IbanAccountIdentification.java @@ -23,6 +23,7 @@ /** IbanAccountIdentification */ @JsonPropertyOrder({ + IbanAccountIdentification.JSON_PROPERTY_BIC, IbanAccountIdentification.JSON_PROPERTY_IBAN, IbanAccountIdentification.JSON_PROPERTY_TYPE }) @@ -38,6 +39,12 @@ property = "type", visible = true) public class IbanAccountIdentification extends BankAccountIdentification { + public static final String JSON_PROPERTY_BIC = "bic"; + private String bic; + + /** Mark when the attribute has been explicitly set. */ + private boolean isSetBic = false; + public static final String JSON_PROPERTY_IBAN = "iban"; private String iban; @@ -58,6 +65,41 @@ public class IbanAccountIdentification extends BankAccountIdentification { public IbanAccountIdentification() {} + /** + * The bank's 8- or 11-character BIC or SWIFT code. + * + * @param bic The bank's 8- or 11-character BIC or SWIFT code. + * @return the current {@code IbanAccountIdentification} instance, allowing for method chaining + */ + public IbanAccountIdentification bic(String bic) { + this.bic = bic; + isSetBic = true; // mark as set + return this; + } + + /** + * The bank's 8- or 11-character BIC or SWIFT code. + * + * @return bic The bank's 8- or 11-character BIC or SWIFT code. + */ + @JsonProperty(JSON_PROPERTY_BIC) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getBic() { + return bic; + } + + /** + * The bank's 8- or 11-character BIC or SWIFT code. + * + * @param bic The bank's 8- or 11-character BIC or SWIFT code. + */ + @JsonProperty(JSON_PROPERTY_BIC) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setBic(String bic) { + this.bic = bic; + isSetBic = true; // mark as set + } + /** * The international bank account number as defined in the * [ISO-13616](https://www.iso.org/standard/81090.html) standard. @@ -164,7 +206,9 @@ public boolean equals(Object o) { return false; } IbanAccountIdentification ibanAccountIdentification = (IbanAccountIdentification) o; - return Objects.equals(this.iban, ibanAccountIdentification.iban) + return Objects.equals(this.bic, ibanAccountIdentification.bic) + && Objects.equals(this.isSetBic, ibanAccountIdentification.isSetBic) + && Objects.equals(this.iban, ibanAccountIdentification.iban) && Objects.equals(this.isSetIban, ibanAccountIdentification.isSetIban) && Objects.equals(this.type, ibanAccountIdentification.type) && Objects.equals(this.isSetType, ibanAccountIdentification.isSetType) @@ -173,7 +217,7 @@ public boolean equals(Object o) { @Override public int hashCode() { - return Objects.hash(iban, isSetIban, type, isSetType, super.hashCode()); + return Objects.hash(bic, isSetBic, iban, isSetIban, type, isSetType, super.hashCode()); } @Override @@ -181,6 +225,7 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class IbanAccountIdentification {\n"); sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" bic: ").append(toIndentedString(bic)).append("\n"); sb.append(" iban: ").append(toIndentedString(iban)).append("\n"); sb.append(" type: ").append(toIndentedString(type)).append("\n"); sb.append("}"); @@ -214,6 +259,9 @@ public Map getExplicitNulls() { Map nulls = new HashMap<>(); + if (isSetBic) { + addIfNull(nulls, JSON_PROPERTY_BIC, this.bic); + } if (isSetIban) { addIfNull(nulls, JSON_PROPERTY_IBAN, this.iban); } diff --git a/src/main/java/com/adyen/model/capital/InvalidField.java b/src/main/java/com/adyen/model/capital/InvalidField.java index 25f8a29de..b5d4b952d 100644 --- a/src/main/java/com/adyen/model/capital/InvalidField.java +++ b/src/main/java/com/adyen/model/capital/InvalidField.java @@ -21,11 +21,17 @@ /** InvalidField */ @JsonPropertyOrder({ + InvalidField.JSON_PROPERTY_MESSAGE, InvalidField.JSON_PROPERTY_NAME, - InvalidField.JSON_PROPERTY_VALUE, - InvalidField.JSON_PROPERTY_MESSAGE + InvalidField.JSON_PROPERTY_VALUE }) public class InvalidField { + public static final String JSON_PROPERTY_MESSAGE = "message"; + private String message; + + /** Mark when the attribute has been explicitly set. */ + private boolean isSetMessage = false; + public static final String JSON_PROPERTY_NAME = "name"; private String name; @@ -38,12 +44,6 @@ public class InvalidField { /** Mark when the attribute has been explicitly set. */ private boolean isSetValue = false; - public static final String JSON_PROPERTY_MESSAGE = "message"; - private String message; - - /** Mark when the attribute has been explicitly set. */ - private boolean isSetMessage = false; - /** * Sets whether attributes with null values should be explicitly included in the JSON payload. * Default is false. @@ -52,6 +52,41 @@ public class InvalidField { public InvalidField() {} + /** + * Description of the validation error. + * + * @param message Description of the validation error. + * @return the current {@code InvalidField} instance, allowing for method chaining + */ + public InvalidField message(String message) { + this.message = message; + isSetMessage = true; // mark as set + return this; + } + + /** + * Description of the validation error. + * + * @return message Description of the validation error. + */ + @JsonProperty(JSON_PROPERTY_MESSAGE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getMessage() { + return message; + } + + /** + * Description of the validation error. + * + * @param message Description of the validation error. + */ + @JsonProperty(JSON_PROPERTY_MESSAGE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setMessage(String message) { + this.message = message; + isSetMessage = true; // mark as set + } + /** * The field that has an invalid value. * @@ -122,41 +157,6 @@ public void setValue(String value) { isSetValue = true; // mark as set } - /** - * Description of the validation error. - * - * @param message Description of the validation error. - * @return the current {@code InvalidField} instance, allowing for method chaining - */ - public InvalidField message(String message) { - this.message = message; - isSetMessage = true; // mark as set - return this; - } - - /** - * Description of the validation error. - * - * @return message Description of the validation error. - */ - @JsonProperty(JSON_PROPERTY_MESSAGE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getMessage() { - return message; - } - - /** - * Description of the validation error. - * - * @param message Description of the validation error. - */ - @JsonProperty(JSON_PROPERTY_MESSAGE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setMessage(String message) { - this.message = message; - isSetMessage = true; // mark as set - } - /** * Configures whether null values are explicitly serialized in the JSON payload. Default is false. */ @@ -187,26 +187,26 @@ public boolean equals(Object o) { return false; } InvalidField invalidField = (InvalidField) o; - return Objects.equals(this.name, invalidField.name) + return Objects.equals(this.message, invalidField.message) + && Objects.equals(this.isSetMessage, invalidField.isSetMessage) + && Objects.equals(this.name, invalidField.name) && Objects.equals(this.isSetName, invalidField.isSetName) && Objects.equals(this.value, invalidField.value) - && Objects.equals(this.isSetValue, invalidField.isSetValue) - && Objects.equals(this.message, invalidField.message) - && Objects.equals(this.isSetMessage, invalidField.isSetMessage); + && Objects.equals(this.isSetValue, invalidField.isSetValue); } @Override public int hashCode() { - return Objects.hash(name, isSetName, value, isSetValue, message, isSetMessage); + return Objects.hash(message, isSetMessage, name, isSetName, value, isSetValue); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class InvalidField {\n"); + sb.append(" message: ").append(toIndentedString(message)).append("\n"); sb.append(" name: ").append(toIndentedString(name)).append("\n"); sb.append(" value: ").append(toIndentedString(value)).append("\n"); - sb.append(" message: ").append(toIndentedString(message)).append("\n"); sb.append("}"); return sb.toString(); } @@ -231,15 +231,15 @@ public Map getExplicitNulls() { Map nulls = new HashMap<>(); + if (isSetMessage) { + addIfNull(nulls, JSON_PROPERTY_MESSAGE, this.message); + } if (isSetName) { addIfNull(nulls, JSON_PROPERTY_NAME, this.name); } if (isSetValue) { addIfNull(nulls, JSON_PROPERTY_VALUE, this.value); } - if (isSetMessage) { - addIfNull(nulls, JSON_PROPERTY_MESSAGE, this.message); - } return nulls; } diff --git a/src/main/java/com/adyen/model/capital/USLocalBankAccountType.java b/src/main/java/com/adyen/model/capital/USLocalBankAccountType.java index 6fc8a28fd..177bfb863 100644 --- a/src/main/java/com/adyen/model/capital/USLocalBankAccountType.java +++ b/src/main/java/com/adyen/model/capital/USLocalBankAccountType.java @@ -14,6 +14,7 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; import java.util.*; +import java.util.logging.Logger; /** Gets or Sets USLocalBankAccountType */ public enum USLocalBankAccountType { @@ -21,6 +22,8 @@ public enum USLocalBankAccountType { SAVINGS("savings"); + private static final Logger LOG = Logger.getLogger(USLocalBankAccountType.class.getName()); + private String value; USLocalBankAccountType(String value) { @@ -44,6 +47,12 @@ public static USLocalBankAccountType fromValue(String value) { return b; } } - throw new IllegalArgumentException("Unexpected value '" + value + "'"); + // handling unexpected value + LOG.warning( + "USLocalBankAccountType: unexpected enum value '" + + value + + "' - Supported values are " + + Arrays.toString(USLocalBankAccountType.values())); + return null; } } diff --git a/src/main/java/com/adyen/service/capital/DynamicOffersApi.java b/src/main/java/com/adyen/service/capital/DynamicOffersApi.java new file mode 100644 index 000000000..09d512533 --- /dev/null +++ b/src/main/java/com/adyen/service/capital/DynamicOffersApi.java @@ -0,0 +1,191 @@ +/* + * Capital API + * + * The version of the OpenAPI document: 1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.adyen.service.capital; + +import com.adyen.Client; +import com.adyen.Service; +import com.adyen.constants.ApiConstants; +import com.adyen.model.RequestOptions; +import com.adyen.model.capital.CalculateGrantOfferRequest; +import com.adyen.model.capital.CalculatedGrantOffer; +import com.adyen.model.capital.CreateGrantOfferRequest; +import com.adyen.model.capital.FinancingType; +import com.adyen.model.capital.GetDynamicOffersResponse; +import com.adyen.model.capital.GrantOffer; +import com.adyen.service.exception.ApiException; +import com.adyen.service.resource.Resource; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; + +public class DynamicOffersApi extends Service { + + public static final String API_VERSION = "1"; + + protected String baseURL; + + /** + * Dynamic offers constructor in {@link com.adyen.service.capital package}. + * + * @param client {@link Client } (required) + */ + public DynamicOffersApi(Client client) { + super(client); + this.baseURL = createBaseURL("https://balanceplatform-api-test.adyen.com/capital/v1"); + } + + /** + * Dynamic offers constructor in {@link com.adyen.service.capital 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 DynamicOffersApi(Client client, String baseURL) { + super(client); + this.baseURL = baseURL; + } + + /** + * Calculate a preliminary offer for a selected financing amount + * + * @param id {@link String } The unique identifier of the dynamic offer from which the user + * selected the financing amount. (required) + * @param calculateGrantOfferRequest {@link CalculateGrantOfferRequest } (required) + * @return {@link CalculatedGrantOffer } + * @throws ApiException if fails to make API call + */ + public CalculatedGrantOffer calculatePreliminaryOfferFromDynamicOffer( + String id, CalculateGrantOfferRequest calculateGrantOfferRequest) + throws ApiException, IOException { + return calculatePreliminaryOfferFromDynamicOffer(id, calculateGrantOfferRequest, null); + } + + /** + * Calculate a preliminary offer for a selected financing amount + * + * @param id {@link String } The unique identifier of the dynamic offer from which the user + * selected the financing amount. (required) + * @param calculateGrantOfferRequest {@link CalculateGrantOfferRequest } (required) + * @param requestOptions {@link RequestOptions } Object to store additional HTTP headers such as + * idempotency-keys (optional) + * @return {@link CalculatedGrantOffer } + * @throws ApiException if fails to make API call + */ + public CalculatedGrantOffer calculatePreliminaryOfferFromDynamicOffer( + String id, + CalculateGrantOfferRequest calculateGrantOfferRequest, + RequestOptions requestOptions) + throws ApiException, IOException { + // Add path params + Map pathParams = new HashMap<>(); + if (id == null) { + throw new IllegalArgumentException("Please provide the id path parameter"); + } + pathParams.put("id", id); + + String requestBody = calculateGrantOfferRequest.toJson(); + Resource resource = new Resource(this, this.baseURL + "/dynamicOffers/{id}/calculate", null); + String jsonResult = + resource.request(requestBody, requestOptions, ApiConstants.HttpMethod.POST, pathParams); + return CalculatedGrantOffer.fromJson(jsonResult); + } + + /** + * Create a static offer for a selected financing amount + * + * @param id {@link String } The unique identifier of the dynamic offer from which the user + * selected the financing amount. (required) + * @param createGrantOfferRequest {@link CreateGrantOfferRequest } (required) + * @return {@link GrantOffer } + * @throws ApiException if fails to make API call + */ + public GrantOffer createStaticOfferFromDynamicOffer( + String id, CreateGrantOfferRequest createGrantOfferRequest) throws ApiException, IOException { + return createStaticOfferFromDynamicOffer(id, createGrantOfferRequest, null); + } + + /** + * Create a static offer for a selected financing amount + * + * @param id {@link String } The unique identifier of the dynamic offer from which the user + * selected the financing amount. (required) + * @param createGrantOfferRequest {@link CreateGrantOfferRequest } (required) + * @param requestOptions {@link RequestOptions } Object to store additional HTTP headers such as + * idempotency-keys (optional) + * @return {@link GrantOffer } + * @throws ApiException if fails to make API call + */ + public GrantOffer createStaticOfferFromDynamicOffer( + String id, CreateGrantOfferRequest createGrantOfferRequest, RequestOptions requestOptions) + throws ApiException, IOException { + // Add path params + Map pathParams = new HashMap<>(); + if (id == null) { + throw new IllegalArgumentException("Please provide the id path parameter"); + } + pathParams.put("id", id); + + String requestBody = createGrantOfferRequest.toJson(); + Resource resource = new Resource(this, this.baseURL + "/dynamicOffers/{id}/grantOffer", null); + String jsonResult = + resource.request(requestBody, requestOptions, ApiConstants.HttpMethod.POST, pathParams); + return GrantOffer.fromJson(jsonResult); + } + + /** + * Get all available dynamic offers + * + * @param accountHolderId {@link String } Query: The unique identifier of the account holder that + * the dynamic offer is for. (required) + * @return {@link GetDynamicOffersResponse } + * @throws ApiException if fails to make API call + */ + public GetDynamicOffersResponse getAllDynamicOffers(String accountHolderId) + throws ApiException, IOException { + return getAllDynamicOffers(accountHolderId, null, null); + } + + /** + * Get all available dynamic offers + * + * @param accountHolderId {@link String } Query: The unique identifier of the account holder that + * the dynamic offer is for. (required) + * @param financingType {@link FinancingType } Query: The type of financing that the offer is for. + * If the value is not specified, returns all available types. Possible values: + * **businessFinancing** (optional) + * @param requestOptions {@link RequestOptions } Object to store additional HTTP headers such as + * idempotency-keys (optional) + * @return {@link GetDynamicOffersResponse } + * @throws ApiException if fails to make API call + */ + public GetDynamicOffersResponse getAllDynamicOffers( + String accountHolderId, FinancingType financingType, RequestOptions requestOptions) + throws ApiException, IOException { + // Add query params + Map queryParams = new HashMap<>(); + if (accountHolderId != null) { + queryParams.put("accountHolderId", accountHolderId); + } + if (financingType != null) { + queryParams.put("financingType", financingType.toString()); + } + + String requestBody = null; + Resource resource = new Resource(this, this.baseURL + "/dynamicOffers", null); + String jsonResult = + resource.request( + requestBody, requestOptions, ApiConstants.HttpMethod.GET, null, queryParams); + return GetDynamicOffersResponse.fromJson(jsonResult); + } +} diff --git a/src/main/java/com/adyen/service/capital/GrantOffersApi.java b/src/main/java/com/adyen/service/capital/GrantOffersApi.java index 28e2d0357..bbae5316c 100644 --- a/src/main/java/com/adyen/service/capital/GrantOffersApi.java +++ b/src/main/java/com/adyen/service/capital/GrantOffersApi.java @@ -53,20 +53,22 @@ public GrantOffersApi(Client client, String baseURL) { } /** - * Get all available grant offers + * Get all available static offers * + * @param accountHolderId {@link String } Query: The unique identifier of the account holder for + * which you want to get the available static offers. (required) * @return {@link GrantOffers } * @throws ApiException if fails to make API call */ - public GrantOffers getAllGrantOffers() throws ApiException, IOException { - return getAllGrantOffers(null, null); + public GrantOffers getAllGrantOffers(String accountHolderId) throws ApiException, IOException { + return getAllGrantOffers(accountHolderId, null); } /** - * Get all available grant offers + * Get all available static offers * * @param accountHolderId {@link String } Query: The unique identifier of the account holder for - * which you want to get the available grant offers. (optional) + * which you want to get the available static offers. (required) * @param requestOptions {@link RequestOptions } Object to store additional HTTP headers such as * idempotency-keys (optional) * @return {@link GrantOffers } @@ -89,9 +91,9 @@ public GrantOffers getAllGrantOffers(String accountHolderId, RequestOptions requ } /** - * Get the details of a grant offer + * Get the details of a static offer * - * @param id {@link String } The unique identifier of the grant offer. (required) + * @param id {@link String } The unique identifier of the static offer. (required) * @return {@link GrantOffer } * @throws ApiException if fails to make API call */ @@ -100,9 +102,9 @@ public GrantOffer getGrantOffer(String id) throws ApiException, IOException { } /** - * Get the details of a grant offer + * Get the details of a static offer * - * @param id {@link String } The unique identifier of the grant offer. (required) + * @param id {@link String } The unique identifier of the static offer. (required) * @param requestOptions {@link RequestOptions } Object to store additional HTTP headers such as * idempotency-keys (optional) * @return {@link GrantOffer } From 299368bec84ded1e56977739ddd1591bf9a892df Mon Sep 17 00:00:00 2001 From: Jeanderson Barros Candido <2225536+jeandersonbc@users.noreply.github.com> Date: Mon, 18 May 2026 10:51:21 +0200 Subject: [PATCH 2/3] test(capital): strengthen GrantOffersApi test coverage for RequestOptions The original getAllGrantOffers method had an overloaded version with no params which was removed on latest updates, causing the compilation error in the CI pipeline. After fixing the test, the two methods became identical. For this reason, this commit replaces the duplicate testGetAllGrantOffersWithQueryParam (which was identical to testGetAllGrantOffers) with testGetAllGrantOffersWithRequestOptions, verifying that idempotency keys are correctly forwarded through the 2-arg overload of getAllGrantOffers. --- .../service/capital/GrantOffersApiTest.java | 34 ++++++++++++------- 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/src/test/java/com/adyen/service/capital/GrantOffersApiTest.java b/src/test/java/com/adyen/service/capital/GrantOffersApiTest.java index a43cac3a3..81b6c837b 100644 --- a/src/test/java/com/adyen/service/capital/GrantOffersApiTest.java +++ b/src/test/java/com/adyen/service/capital/GrantOffersApiTest.java @@ -20,46 +20,56 @@ */ package com.adyen.service.capital; +import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.verify; import com.adyen.BaseTest; import com.adyen.Client; import com.adyen.constants.ApiConstants; +import com.adyen.model.RequestOptions; import com.adyen.model.capital.Amount; import com.adyen.model.capital.GrantOffer; import com.adyen.model.capital.GrantOffers; import java.util.Map; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; public class GrantOffersApiTest extends BaseTest { @Test - void testGetAllGrantOffersWithQueryParam() throws Exception { + void testGetAllGrantOffersWithRequestOptions() throws Exception { Client client = createMockClientFromFile("mocks/capital/grant-offers-success.json"); GrantOffersApi grantOffersApi = new GrantOffersApi(client); - GrantOffers response = grantOffersApi.getAllGrantOffers("AH00000000000000000000001", null); + RequestOptions requestOptions = + new RequestOptions().idempotencyKey("99361789-5204-4576-b123-4f9a1b2c3d45"); + GrantOffers response = + grantOffersApi.getAllGrantOffers("AH00000000000000000000001", requestOptions); Assertions.assertNotNull(response); Assertions.assertEquals(1, response.getGrantOffers().size()); Assertions.assertEquals("GO00000000000000000000001", response.getGrantOffers().get(0).getId()); + ArgumentCaptor optionsCaptor = ArgumentCaptor.forClass(RequestOptions.class); verify(client.getHttpClient()) .request( - "https://balanceplatform-api-test.adyen.com/capital/v1/grantOffers", - null, - client.getConfig(), - false, - null, - ApiConstants.HttpMethod.GET, - Map.of("accountHolderId", "AH00000000000000000000001")); + eq("https://balanceplatform-api-test.adyen.com/capital/v1/grantOffers"), + eq(null), + eq(client.getConfig()), + eq(false), + optionsCaptor.capture(), + eq(ApiConstants.HttpMethod.GET), + eq(Map.of("accountHolderId", "AH00000000000000000000001"))); + Assertions.assertNotNull(optionsCaptor.getValue().getIdempotencyKey()); + Assertions.assertEquals( + "99361789-5204-4576-b123-4f9a1b2c3d45", optionsCaptor.getValue().getIdempotencyKey()); } @Test void testGetAllGrantOffers() throws Exception { Client client = createMockClientFromFile("mocks/capital/grant-offers-success.json"); GrantOffersApi grantOffersApi = new GrantOffersApi(client); - GrantOffers response = grantOffersApi.getAllGrantOffers(); + GrantOffers response = grantOffersApi.getAllGrantOffers("AH00000000000000000000001"); Assertions.assertNotNull(response); Assertions.assertEquals(1, response.getGrantOffers().size()); @@ -73,7 +83,7 @@ void testGetAllGrantOffers() throws Exception { false, null, ApiConstants.HttpMethod.GET, - Map.of()); + Map.of("accountHolderId", "AH00000000000000000000001")); } @Test @@ -99,7 +109,7 @@ void testGetGrantOffer() throws Exception { } @Test - void testGetGrantOfferParams() { + void testGetGrantOfferFailsWhenMissingRequired() { Client client = createMockClientFromFile("mocks/capital/get-grant-offer-success.json"); GrantOffersApi grantOffersApi = new GrantOffersApi(client); Assertions.assertThrows( From 17e03514a0329e276ba87aba5611a7df1c4ece9a Mon Sep 17 00:00:00 2001 From: Jeanderson Barros Candido <2225536+jeandersonbc@users.noreply.github.com> Date: Mon, 18 May 2026 14:21:02 +0200 Subject: [PATCH 3/3] test(capital): add DynamicOffersApi test coverage - Add DynamicOffersApiTest covering all three endpoints (getAllDynamicOffers, calculatePreliminaryOfferFromDynamicOffer, createStaticOfferFromDynamicOffer), including RequestOptions and missing-id validation variants, with corresponding mock JSON fixtures. - Also fix GrantOffersApiTest to use isNull() instead of eq(null) alongside ArgumentCaptor, consistent with Mockito matcher rules. --- .../service/capital/DynamicOffersApiTest.java | 249 ++++++++++++++++++ .../service/capital/GrantOffersApiTest.java | 3 +- .../calculate-preliminary-offer-success.json | 30 +++ .../capital/create-static-offer-success.json | 31 +++ .../capital/get-dynamic-offers-success.json | 20 ++ 5 files changed, 332 insertions(+), 1 deletion(-) create mode 100644 src/test/java/com/adyen/service/capital/DynamicOffersApiTest.java create mode 100644 src/test/resources/mocks/capital/calculate-preliminary-offer-success.json create mode 100644 src/test/resources/mocks/capital/create-static-offer-success.json create mode 100644 src/test/resources/mocks/capital/get-dynamic-offers-success.json diff --git a/src/test/java/com/adyen/service/capital/DynamicOffersApiTest.java b/src/test/java/com/adyen/service/capital/DynamicOffersApiTest.java new file mode 100644 index 000000000..521fd16fd --- /dev/null +++ b/src/test/java/com/adyen/service/capital/DynamicOffersApiTest.java @@ -0,0 +1,249 @@ +/* + * ###### + * ###### + * ############ ####( ###### #####. ###### ############ ############ + * ############# #####( ###### #####. ###### ############# ############# + * ###### #####( ###### #####. ###### ##### ###### ##### ###### + * ###### ###### #####( ###### #####. ###### ##### ##### ##### ###### + * ###### ###### #####( ###### #####. ###### ##### ##### ###### + * ############# ############# ############# ############# ##### ###### + * ############ ############ ############# ############ ##### ###### + * ###### + * ############# + * ############ + * + * Adyen Java API Library + * + * Copyright (c) 2026 Adyen B.V. + * This file is open source and available under the MIT license. + * See the LICENSE file for more info. + */ +package com.adyen.service.capital; + +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.ArgumentMatchers.isNull; +import static org.mockito.Mockito.verify; + +import com.adyen.BaseTest; +import com.adyen.Client; +import com.adyen.constants.ApiConstants; +import com.adyen.model.RequestOptions; +import com.adyen.model.capital.Amount; +import com.adyen.model.capital.CalculateGrantOfferRequest; +import com.adyen.model.capital.CalculatedGrantOffer; +import com.adyen.model.capital.CreateGrantOfferRequest; +import com.adyen.model.capital.FinancingType; +import com.adyen.model.capital.GetDynamicOffersResponse; +import com.adyen.model.capital.GrantOffer; +import java.util.Map; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; + +public class DynamicOffersApiTest extends BaseTest { + + @Test + void testGetAllDynamicOffers() throws Exception { + Client client = createMockClientFromFile("mocks/capital/get-dynamic-offers-success.json"); + DynamicOffersApi dynamicOffersApi = new DynamicOffersApi(client); + GetDynamicOffersResponse response = + dynamicOffersApi.getAllDynamicOffers("AH00000000000000000000001"); + + Assertions.assertNotNull(response); + Assertions.assertEquals(1, response.getDynamicOffers().size()); + Assertions.assertEquals( + "DO00000000000000000000001", response.getDynamicOffers().get(0).getId()); + Assertions.assertEquals( + "AH00000000000000000000001", response.getDynamicOffers().get(0).getAccountHolderId()); + + verify(client.getHttpClient()) + .request( + "https://balanceplatform-api-test.adyen.com/capital/v1/dynamicOffers", + null, + client.getConfig(), + false, + null, + ApiConstants.HttpMethod.GET, + Map.of("accountHolderId", "AH00000000000000000000001")); + } + + @Test + void testGetAllDynamicOffersWithFinancingType() throws Exception { + Client client = createMockClientFromFile("mocks/capital/get-dynamic-offers-success.json"); + DynamicOffersApi dynamicOffersApi = new DynamicOffersApi(client); + GetDynamicOffersResponse response = + dynamicOffersApi.getAllDynamicOffers( + "AH00000000000000000000001", FinancingType.BUSINESSFINANCING, null); + + Assertions.assertNotNull(response); + Assertions.assertEquals(1, response.getDynamicOffers().size()); + + verify(client.getHttpClient()) + .request( + "https://balanceplatform-api-test.adyen.com/capital/v1/dynamicOffers", + null, + client.getConfig(), + false, + null, + ApiConstants.HttpMethod.GET, + Map.of( + "accountHolderId", "AH00000000000000000000001", + "financingType", "businessFinancing")); + } + + @Test + void testGetAllDynamicOffersWithRequestOptions() throws Exception { + Client client = createMockClientFromFile("mocks/capital/get-dynamic-offers-success.json"); + DynamicOffersApi dynamicOffersApi = new DynamicOffersApi(client); + RequestOptions requestOptions = + new RequestOptions().idempotencyKey("99361789-5204-4576-b123-4f9a1b2c3d45"); + GetDynamicOffersResponse response = + dynamicOffersApi.getAllDynamicOffers("AH00000000000000000000001", null, requestOptions); + + Assertions.assertNotNull(response); + + ArgumentCaptor optionsCaptor = ArgumentCaptor.forClass(RequestOptions.class); + verify(client.getHttpClient()) + .request( + eq("https://balanceplatform-api-test.adyen.com/capital/v1/dynamicOffers"), + eq(null), + eq(client.getConfig()), + eq(false), + optionsCaptor.capture(), + eq(ApiConstants.HttpMethod.GET), + eq(Map.of("accountHolderId", "AH00000000000000000000001"))); + Assertions.assertEquals( + "99361789-5204-4576-b123-4f9a1b2c3d45", optionsCaptor.getValue().getIdempotencyKey()); + } + + @Test + void testCalculatePreliminaryOfferFromDynamicOffer() throws Exception { + Client client = + createMockClientFromFile("mocks/capital/calculate-preliminary-offer-success.json"); + DynamicOffersApi dynamicOffersApi = new DynamicOffersApi(client); + CalculateGrantOfferRequest request = + new CalculateGrantOfferRequest().amount(new Amount().currency("EUR").value(10000L)); + CalculatedGrantOffer response = + dynamicOffersApi.calculatePreliminaryOfferFromDynamicOffer( + "DO00000000000000000000001", request); + + Assertions.assertNotNull(response); + Assertions.assertEquals("AH00000000000000000000001", response.getAccountHolderId()); + Assertions.assertEquals(new Amount().currency("EUR").value(10000L), response.getAmount()); + + verify(client.getHttpClient()) + .request( + "https://balanceplatform-api-test.adyen.com/capital/v1/dynamicOffers/DO00000000000000000000001/calculate", + "{\"amount\":{\"currency\":\"EUR\",\"value\":10000}}", + client.getConfig(), + false, + null, + ApiConstants.HttpMethod.POST, + null); + } + + @Test + void testCalculatePreliminaryOfferFromDynamicOfferWithRequestOptions() throws Exception { + Client client = + createMockClientFromFile("mocks/capital/calculate-preliminary-offer-success.json"); + DynamicOffersApi dynamicOffersApi = new DynamicOffersApi(client); + CalculateGrantOfferRequest request = + new CalculateGrantOfferRequest().amount(new Amount().currency("EUR").value(10000L)); + RequestOptions requestOptions = + new RequestOptions().idempotencyKey("99361789-5204-4576-b123-4f9a1b2c3d45"); + CalculatedGrantOffer response = + dynamicOffersApi.calculatePreliminaryOfferFromDynamicOffer( + "DO00000000000000000000001", request, requestOptions); + + Assertions.assertNotNull(response); + + ArgumentCaptor optionsCaptor = ArgumentCaptor.forClass(RequestOptions.class); + verify(client.getHttpClient()) + .request( + eq( + "https://balanceplatform-api-test.adyen.com/capital/v1/dynamicOffers/DO00000000000000000000001/calculate"), + eq("{\"amount\":{\"currency\":\"EUR\",\"value\":10000}}"), + eq(client.getConfig()), + eq(false), + optionsCaptor.capture(), + eq(ApiConstants.HttpMethod.POST), + isNull()); + Assertions.assertEquals( + "99361789-5204-4576-b123-4f9a1b2c3d45", optionsCaptor.getValue().getIdempotencyKey()); + } + + @Test + void testCalculatePreliminaryOfferFailsWhenMissingId() { + Client client = + createMockClientFromFile("mocks/capital/calculate-preliminary-offer-success.json"); + DynamicOffersApi dynamicOffersApi = new DynamicOffersApi(client); + CalculateGrantOfferRequest request = new CalculateGrantOfferRequest(); + Assertions.assertThrows( + IllegalArgumentException.class, + () -> dynamicOffersApi.calculatePreliminaryOfferFromDynamicOffer(null, request)); + } + + @Test + void testCreateStaticOfferFromDynamicOffer() throws Exception { + Client client = createMockClientFromFile("mocks/capital/create-static-offer-success.json"); + DynamicOffersApi dynamicOffersApi = new DynamicOffersApi(client); + CreateGrantOfferRequest request = + new CreateGrantOfferRequest().amount(new Amount().currency("EUR").value(10000L)); + GrantOffer response = + dynamicOffersApi.createStaticOfferFromDynamicOffer("DO00000000000000000000001", request); + + Assertions.assertNotNull(response); + Assertions.assertEquals("GO00000000000000000000002", response.getId()); + Assertions.assertEquals("AH00000000000000000000001", response.getAccountHolderId()); + Assertions.assertEquals(new Amount().currency("EUR").value(10000L), response.getAmount()); + + verify(client.getHttpClient()) + .request( + "https://balanceplatform-api-test.adyen.com/capital/v1/dynamicOffers/DO00000000000000000000001/grantOffer", + "{\"amount\":{\"currency\":\"EUR\",\"value\":10000}}", + client.getConfig(), + false, + null, + ApiConstants.HttpMethod.POST, + null); + } + + @Test + void testCreateStaticOfferFromDynamicOfferWithRequestOptions() throws Exception { + Client client = createMockClientFromFile("mocks/capital/create-static-offer-success.json"); + DynamicOffersApi dynamicOffersApi = new DynamicOffersApi(client); + CreateGrantOfferRequest request = + new CreateGrantOfferRequest().amount(new Amount().currency("EUR").value(10000L)); + RequestOptions requestOptions = + new RequestOptions().idempotencyKey("99361789-5204-4576-b123-4f9a1b2c3d45"); + GrantOffer response = + dynamicOffersApi.createStaticOfferFromDynamicOffer( + "DO00000000000000000000001", request, requestOptions); + + Assertions.assertNotNull(response); + + ArgumentCaptor optionsCaptor = ArgumentCaptor.forClass(RequestOptions.class); + verify(client.getHttpClient()) + .request( + eq( + "https://balanceplatform-api-test.adyen.com/capital/v1/dynamicOffers/DO00000000000000000000001/grantOffer"), + eq("{\"amount\":{\"currency\":\"EUR\",\"value\":10000}}"), + eq(client.getConfig()), + eq(false), + optionsCaptor.capture(), + eq(ApiConstants.HttpMethod.POST), + isNull()); + Assertions.assertEquals( + "99361789-5204-4576-b123-4f9a1b2c3d45", optionsCaptor.getValue().getIdempotencyKey()); + } + + @Test + void testCreateStaticOfferFailsWhenMissingId() { + Client client = createMockClientFromFile("mocks/capital/create-static-offer-success.json"); + DynamicOffersApi dynamicOffersApi = new DynamicOffersApi(client); + CreateGrantOfferRequest request = new CreateGrantOfferRequest(); + Assertions.assertThrows( + IllegalArgumentException.class, + () -> dynamicOffersApi.createStaticOfferFromDynamicOffer(null, request)); + } +} diff --git a/src/test/java/com/adyen/service/capital/GrantOffersApiTest.java b/src/test/java/com/adyen/service/capital/GrantOffersApiTest.java index 81b6c837b..8f9534433 100644 --- a/src/test/java/com/adyen/service/capital/GrantOffersApiTest.java +++ b/src/test/java/com/adyen/service/capital/GrantOffersApiTest.java @@ -21,6 +21,7 @@ package com.adyen.service.capital; import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.ArgumentMatchers.isNull; import static org.mockito.Mockito.verify; import com.adyen.BaseTest; @@ -54,7 +55,7 @@ void testGetAllGrantOffersWithRequestOptions() throws Exception { verify(client.getHttpClient()) .request( eq("https://balanceplatform-api-test.adyen.com/capital/v1/grantOffers"), - eq(null), + isNull(), eq(client.getConfig()), eq(false), optionsCaptor.capture(), diff --git a/src/test/resources/mocks/capital/calculate-preliminary-offer-success.json b/src/test/resources/mocks/capital/calculate-preliminary-offer-success.json new file mode 100644 index 000000000..4a2754d01 --- /dev/null +++ b/src/test/resources/mocks/capital/calculate-preliminary-offer-success.json @@ -0,0 +1,30 @@ +{ + "accountHolderId": "AH00000000000000000000001", + "contractType": "cashAdvance", + "amount": { + "currency": "EUR", + "value": 10000 + }, + "fee": { + "amount": { + "currency": "EUR", + "value": 1000 + }, + "aprBasisPoints": 1200 + }, + "repayment": { + "basisPoints": 1000, + "term": { + "estimatedDays": 180, + "maximumDays": 365 + }, + "threshold": { + "amount": { + "currency": "EUR", + "value": 1000 + } + } + }, + "startsAt": "2024-01-01T00:00:00Z", + "expiresAt": "2024-01-31T23:59:59Z" +} diff --git a/src/test/resources/mocks/capital/create-static-offer-success.json b/src/test/resources/mocks/capital/create-static-offer-success.json new file mode 100644 index 000000000..d06debc56 --- /dev/null +++ b/src/test/resources/mocks/capital/create-static-offer-success.json @@ -0,0 +1,31 @@ +{ + "id": "GO00000000000000000000002", + "accountHolderId": "AH00000000000000000000001", + "contractType": "cashAdvance", + "amount": { + "currency": "EUR", + "value": 10000 + }, + "fee": { + "amount": { + "currency": "EUR", + "value": 1000 + }, + "aprBasisPoints": 1200 + }, + "repayment": { + "basisPoints": 1000, + "term": { + "estimatedDays": 180, + "maximumDays": 365 + }, + "threshold": { + "amount": { + "currency": "EUR", + "value": 1000 + } + } + }, + "startsAt": "2024-01-01T00:00:00Z", + "expiresAt": "2024-01-31T23:59:59Z" +} diff --git a/src/test/resources/mocks/capital/get-dynamic-offers-success.json b/src/test/resources/mocks/capital/get-dynamic-offers-success.json new file mode 100644 index 000000000..e0a576b5b --- /dev/null +++ b/src/test/resources/mocks/capital/get-dynamic-offers-success.json @@ -0,0 +1,20 @@ +{ + "dynamicOffers": [ + { + "id": "DO00000000000000000000001", + "accountHolderId": "AH00000000000000000000001", + "contractType": "cashAdvance", + "financingType": "businessFinancing", + "minimumAmount": { + "currency": "EUR", + "value": 5000 + }, + "maximumAmount": { + "currency": "EUR", + "value": 50000 + }, + "startsAt": "2024-01-01T00:00:00Z", + "expiresAt": "2024-01-31T23:59:59Z" + } + ] +}