diff --git a/src/main/java/com/adyen/model/balancewebhooks/Amount.java b/src/main/java/com/adyen/model/balancewebhooks/Amount.java new file mode 100644 index 000000000..c18d98158 --- /dev/null +++ b/src/main/java/com/adyen/model/balancewebhooks/Amount.java @@ -0,0 +1,173 @@ +/* + * Balance webhook + * + * 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.balancewebhooks; + +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.*; + +/** Amount */ +@JsonPropertyOrder({Amount.JSON_PROPERTY_CURRENCY, Amount.JSON_PROPERTY_VALUE}) +public class Amount { + public static final String JSON_PROPERTY_CURRENCY = "currency"; + private String currency; + + public static final String JSON_PROPERTY_VALUE = "value"; + private Long value; + + public Amount() {} + + /** + * The three-character [ISO currency + * code](https://docs.adyen.com/development-resources/currency-codes#currency-codes) of the + * amount. + * + * @param currency The three-character [ISO currency + * code](https://docs.adyen.com/development-resources/currency-codes#currency-codes) of the + * amount. + * @return the current {@code Amount} instance, allowing for method chaining + */ + public Amount currency(String currency) { + this.currency = currency; + return this; + } + + /** + * The three-character [ISO currency + * code](https://docs.adyen.com/development-resources/currency-codes#currency-codes) of the + * amount. + * + * @return currency The three-character [ISO currency + * code](https://docs.adyen.com/development-resources/currency-codes#currency-codes) of the + * amount. + */ + @JsonProperty(JSON_PROPERTY_CURRENCY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getCurrency() { + return currency; + } + + /** + * The three-character [ISO currency + * code](https://docs.adyen.com/development-resources/currency-codes#currency-codes) of the + * amount. + * + * @param currency The three-character [ISO currency + * code](https://docs.adyen.com/development-resources/currency-codes#currency-codes) of the + * amount. + */ + @JsonProperty(JSON_PROPERTY_CURRENCY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setCurrency(String currency) { + this.currency = currency; + } + + /** + * The numeric value of the amount, in [minor + * units](https://docs.adyen.com/development-resources/currency-codes#minor-units). + * + * @param value The numeric value of the amount, in [minor + * units](https://docs.adyen.com/development-resources/currency-codes#minor-units). + * @return the current {@code Amount} instance, allowing for method chaining + */ + public Amount value(Long value) { + this.value = value; + return this; + } + + /** + * The numeric value of the amount, in [minor + * units](https://docs.adyen.com/development-resources/currency-codes#minor-units). + * + * @return value The numeric value of the amount, in [minor + * units](https://docs.adyen.com/development-resources/currency-codes#minor-units). + */ + @JsonProperty(JSON_PROPERTY_VALUE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getValue() { + return value; + } + + /** + * The numeric value of the amount, in [minor + * units](https://docs.adyen.com/development-resources/currency-codes#minor-units). + * + * @param value The numeric value of the amount, in [minor + * units](https://docs.adyen.com/development-resources/currency-codes#minor-units). + */ + @JsonProperty(JSON_PROPERTY_VALUE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setValue(Long value) { + this.value = value; + } + + /** Return true if this Amount object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Amount amount = (Amount) o; + return Objects.equals(this.currency, amount.currency) + && Objects.equals(this.value, amount.value); + } + + @Override + public int hashCode() { + return Objects.hash(currency, value); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Amount {\n"); + sb.append(" currency: ").append(toIndentedString(currency)).append("\n"); + sb.append(" value: ").append(toIndentedString(value)).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 "); + } + + /** + * Create an instance of Amount given an JSON string + * + * @param jsonString JSON string + * @return An instance of Amount + * @throws JsonProcessingException if the JSON string is invalid with respect to Amount + */ + public static Amount fromJson(String jsonString) throws JsonProcessingException { + return JSON.getMapper().readValue(jsonString, Amount.class); + } + + /** + * Convert an instance of Amount 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/balancewebhooks/BalanceWebhooksHandler.java b/src/main/java/com/adyen/model/balancewebhooks/BalanceWebhooksHandler.java index eedb9fc25..da61aa0d2 100644 --- a/src/main/java/com/adyen/model/balancewebhooks/BalanceWebhooksHandler.java +++ b/src/main/java/com/adyen/model/balancewebhooks/BalanceWebhooksHandler.java @@ -58,6 +58,30 @@ public BalanceWebhooksHandler(String payload) { return Optional.empty(); } + /** + * Attempts to deserialize the webhook payload into a ReleasedBlockedBalanceNotificationRequest + * + * @return an Optional containing the deserialized object, or empty if deserialization fails + */ + public Optional + getReleasedBlockedBalanceNotificationRequest() { + + var optionalReleasedBlockedBalanceNotificationRequest = + getOptionalField(ReleasedBlockedBalanceNotificationRequest.class); + + if (optionalReleasedBlockedBalanceNotificationRequest.isPresent()) { + // verify event type + for (var value : ReleasedBlockedBalanceNotificationRequest.TypeEnum.values()) { + if (value.equals(optionalReleasedBlockedBalanceNotificationRequest.get().getType())) { + // found matching event type + return optionalReleasedBlockedBalanceNotificationRequest; + } + } + } + + return Optional.empty(); + } + /** * Deserializes the payload into the specified class type. * diff --git a/src/main/java/com/adyen/model/balancewebhooks/ReleaseBlockedBalanceNotificationData.java b/src/main/java/com/adyen/model/balancewebhooks/ReleaseBlockedBalanceNotificationData.java new file mode 100644 index 000000000..1862a7806 --- /dev/null +++ b/src/main/java/com/adyen/model/balancewebhooks/ReleaseBlockedBalanceNotificationData.java @@ -0,0 +1,497 @@ +/* + * Balance webhook + * + * 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.balancewebhooks; + +import com.fasterxml.jackson.annotation.JsonCreator; +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.time.OffsetDateTime; +import java.util.*; + +/** ReleaseBlockedBalanceNotificationData */ +@JsonPropertyOrder({ + ReleaseBlockedBalanceNotificationData.JSON_PROPERTY_ACCOUNT_HOLDER, + ReleaseBlockedBalanceNotificationData.JSON_PROPERTY_AMOUNT, + ReleaseBlockedBalanceNotificationData.JSON_PROPERTY_BALANCE_ACCOUNT, + ReleaseBlockedBalanceNotificationData.JSON_PROPERTY_BALANCE_PLATFORM, + ReleaseBlockedBalanceNotificationData.JSON_PROPERTY_BATCH_REFERENCE, + ReleaseBlockedBalanceNotificationData.JSON_PROPERTY_BLOCKED_BALANCE_AFTER, + ReleaseBlockedBalanceNotificationData.JSON_PROPERTY_BLOCKED_BALANCE_BEFORE, + ReleaseBlockedBalanceNotificationData.JSON_PROPERTY_CREATION_DATE, + ReleaseBlockedBalanceNotificationData.JSON_PROPERTY_ID, + ReleaseBlockedBalanceNotificationData.JSON_PROPERTY_VALUE_DATE +}) +public class ReleaseBlockedBalanceNotificationData { + public static final String JSON_PROPERTY_ACCOUNT_HOLDER = "accountHolder"; + private ResourceReference accountHolder; + + public static final String JSON_PROPERTY_AMOUNT = "amount"; + private Amount amount; + + public static final String JSON_PROPERTY_BALANCE_ACCOUNT = "balanceAccount"; + private ResourceReference balanceAccount; + + public static final String JSON_PROPERTY_BALANCE_PLATFORM = "balancePlatform"; + private String balancePlatform; + + public static final String JSON_PROPERTY_BATCH_REFERENCE = "batchReference"; + private String batchReference; + + public static final String JSON_PROPERTY_BLOCKED_BALANCE_AFTER = "blockedBalanceAfter"; + private Amount blockedBalanceAfter; + + public static final String JSON_PROPERTY_BLOCKED_BALANCE_BEFORE = "blockedBalanceBefore"; + private Amount blockedBalanceBefore; + + public static final String JSON_PROPERTY_CREATION_DATE = "creationDate"; + private OffsetDateTime creationDate; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_VALUE_DATE = "valueDate"; + private OffsetDateTime valueDate; + + public ReleaseBlockedBalanceNotificationData() {} + + @JsonCreator + public ReleaseBlockedBalanceNotificationData(@JsonProperty(JSON_PROPERTY_ID) String id) { + this(); + this.id = id; + } + + /** + * accountHolder + * + * @param accountHolder + * @return the current {@code ReleaseBlockedBalanceNotificationData} instance, allowing for method + * chaining + */ + public ReleaseBlockedBalanceNotificationData accountHolder(ResourceReference accountHolder) { + this.accountHolder = accountHolder; + return this; + } + + /** + * Get accountHolder + * + * @return accountHolder + */ + @JsonProperty(JSON_PROPERTY_ACCOUNT_HOLDER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public ResourceReference getAccountHolder() { + return accountHolder; + } + + /** + * accountHolder + * + * @param accountHolder + */ + @JsonProperty(JSON_PROPERTY_ACCOUNT_HOLDER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setAccountHolder(ResourceReference accountHolder) { + this.accountHolder = accountHolder; + } + + /** + * amount + * + * @param amount + * @return the current {@code ReleaseBlockedBalanceNotificationData} instance, allowing for method + * chaining + */ + public ReleaseBlockedBalanceNotificationData amount(Amount amount) { + this.amount = amount; + 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; + } + + /** + * balanceAccount + * + * @param balanceAccount + * @return the current {@code ReleaseBlockedBalanceNotificationData} instance, allowing for method + * chaining + */ + public ReleaseBlockedBalanceNotificationData balanceAccount(ResourceReference balanceAccount) { + this.balanceAccount = balanceAccount; + return this; + } + + /** + * Get balanceAccount + * + * @return balanceAccount + */ + @JsonProperty(JSON_PROPERTY_BALANCE_ACCOUNT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public ResourceReference getBalanceAccount() { + return balanceAccount; + } + + /** + * balanceAccount + * + * @param balanceAccount + */ + @JsonProperty(JSON_PROPERTY_BALANCE_ACCOUNT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setBalanceAccount(ResourceReference balanceAccount) { + this.balanceAccount = balanceAccount; + } + + /** + * The unique identifier of the balance platform. + * + * @param balancePlatform The unique identifier of the balance platform. + * @return the current {@code ReleaseBlockedBalanceNotificationData} instance, allowing for method + * chaining + */ + public ReleaseBlockedBalanceNotificationData balancePlatform(String balancePlatform) { + this.balancePlatform = balancePlatform; + return this; + } + + /** + * The unique identifier of the balance platform. + * + * @return balancePlatform The unique identifier of the balance platform. + */ + @JsonProperty(JSON_PROPERTY_BALANCE_PLATFORM) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getBalancePlatform() { + return balancePlatform; + } + + /** + * The unique identifier of the balance platform. + * + * @param balancePlatform The unique identifier of the balance platform. + */ + @JsonProperty(JSON_PROPERTY_BALANCE_PLATFORM) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setBalancePlatform(String balancePlatform) { + this.balancePlatform = balancePlatform; + } + + /** + * The reference of the batch that was released. + * + * @param batchReference The reference of the batch that was released. + * @return the current {@code ReleaseBlockedBalanceNotificationData} instance, allowing for method + * chaining + */ + public ReleaseBlockedBalanceNotificationData batchReference(String batchReference) { + this.batchReference = batchReference; + return this; + } + + /** + * The reference of the batch that was released. + * + * @return batchReference The reference of the batch that was released. + */ + @JsonProperty(JSON_PROPERTY_BATCH_REFERENCE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getBatchReference() { + return batchReference; + } + + /** + * The reference of the batch that was released. + * + * @param batchReference The reference of the batch that was released. + */ + @JsonProperty(JSON_PROPERTY_BATCH_REFERENCE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setBatchReference(String batchReference) { + this.batchReference = batchReference; + } + + /** + * blockedBalanceAfter + * + * @param blockedBalanceAfter + * @return the current {@code ReleaseBlockedBalanceNotificationData} instance, allowing for method + * chaining + */ + public ReleaseBlockedBalanceNotificationData blockedBalanceAfter(Amount blockedBalanceAfter) { + this.blockedBalanceAfter = blockedBalanceAfter; + return this; + } + + /** + * Get blockedBalanceAfter + * + * @return blockedBalanceAfter + */ + @JsonProperty(JSON_PROPERTY_BLOCKED_BALANCE_AFTER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Amount getBlockedBalanceAfter() { + return blockedBalanceAfter; + } + + /** + * blockedBalanceAfter + * + * @param blockedBalanceAfter + */ + @JsonProperty(JSON_PROPERTY_BLOCKED_BALANCE_AFTER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setBlockedBalanceAfter(Amount blockedBalanceAfter) { + this.blockedBalanceAfter = blockedBalanceAfter; + } + + /** + * blockedBalanceBefore + * + * @param blockedBalanceBefore + * @return the current {@code ReleaseBlockedBalanceNotificationData} instance, allowing for method + * chaining + */ + public ReleaseBlockedBalanceNotificationData blockedBalanceBefore(Amount blockedBalanceBefore) { + this.blockedBalanceBefore = blockedBalanceBefore; + return this; + } + + /** + * Get blockedBalanceBefore + * + * @return blockedBalanceBefore + */ + @JsonProperty(JSON_PROPERTY_BLOCKED_BALANCE_BEFORE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Amount getBlockedBalanceBefore() { + return blockedBalanceBefore; + } + + /** + * blockedBalanceBefore + * + * @param blockedBalanceBefore + */ + @JsonProperty(JSON_PROPERTY_BLOCKED_BALANCE_BEFORE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setBlockedBalanceBefore(Amount blockedBalanceBefore) { + this.blockedBalanceBefore = blockedBalanceBefore; + } + + /** + * The date and time when the event was triggered, in ISO 8601 extended format. For example, + * **2025-03-19T10:15:30+01:00**. + * + * @param creationDate The date and time when the event was triggered, in ISO 8601 extended + * format. For example, **2025-03-19T10:15:30+01:00**. + * @return the current {@code ReleaseBlockedBalanceNotificationData} instance, allowing for method + * chaining + */ + public ReleaseBlockedBalanceNotificationData creationDate(OffsetDateTime creationDate) { + this.creationDate = creationDate; + return this; + } + + /** + * The date and time when the event was triggered, in ISO 8601 extended format. For example, + * **2025-03-19T10:15:30+01:00**. + * + * @return creationDate The date and time when the event was triggered, in ISO 8601 extended + * format. For example, **2025-03-19T10:15:30+01:00**. + */ + @JsonProperty(JSON_PROPERTY_CREATION_DATE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OffsetDateTime getCreationDate() { + return creationDate; + } + + /** + * The date and time when the event was triggered, in ISO 8601 extended format. For example, + * **2025-03-19T10:15:30+01:00**. + * + * @param creationDate The date and time when the event was triggered, in ISO 8601 extended + * format. For example, **2025-03-19T10:15:30+01:00**. + */ + @JsonProperty(JSON_PROPERTY_CREATION_DATE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setCreationDate(OffsetDateTime creationDate) { + this.creationDate = creationDate; + } + + /** + * The ID of the resource. + * + * @return id The ID of the resource. + */ + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getId() { + return id; + } + + /** + * The date and time when the amount was released, in ISO 8601 extended format. For example, + * **2025-03-19T10:15:30+01:00**. + * + * @param valueDate The date and time when the amount was released, in ISO 8601 extended format. + * For example, **2025-03-19T10:15:30+01:00**. + * @return the current {@code ReleaseBlockedBalanceNotificationData} instance, allowing for method + * chaining + */ + public ReleaseBlockedBalanceNotificationData valueDate(OffsetDateTime valueDate) { + this.valueDate = valueDate; + return this; + } + + /** + * The date and time when the amount was released, in ISO 8601 extended format. For example, + * **2025-03-19T10:15:30+01:00**. + * + * @return valueDate The date and time when the amount was released, in ISO 8601 extended format. + * For example, **2025-03-19T10:15:30+01:00**. + */ + @JsonProperty(JSON_PROPERTY_VALUE_DATE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OffsetDateTime getValueDate() { + return valueDate; + } + + /** + * The date and time when the amount was released, in ISO 8601 extended format. For example, + * **2025-03-19T10:15:30+01:00**. + * + * @param valueDate The date and time when the amount was released, in ISO 8601 extended format. + * For example, **2025-03-19T10:15:30+01:00**. + */ + @JsonProperty(JSON_PROPERTY_VALUE_DATE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setValueDate(OffsetDateTime valueDate) { + this.valueDate = valueDate; + } + + /** Return true if this ReleaseBlockedBalanceNotificationData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ReleaseBlockedBalanceNotificationData releaseBlockedBalanceNotificationData = + (ReleaseBlockedBalanceNotificationData) o; + return Objects.equals(this.accountHolder, releaseBlockedBalanceNotificationData.accountHolder) + && Objects.equals(this.amount, releaseBlockedBalanceNotificationData.amount) + && Objects.equals(this.balanceAccount, releaseBlockedBalanceNotificationData.balanceAccount) + && Objects.equals( + this.balancePlatform, releaseBlockedBalanceNotificationData.balancePlatform) + && Objects.equals(this.batchReference, releaseBlockedBalanceNotificationData.batchReference) + && Objects.equals( + this.blockedBalanceAfter, releaseBlockedBalanceNotificationData.blockedBalanceAfter) + && Objects.equals( + this.blockedBalanceBefore, releaseBlockedBalanceNotificationData.blockedBalanceBefore) + && Objects.equals(this.creationDate, releaseBlockedBalanceNotificationData.creationDate) + && Objects.equals(this.id, releaseBlockedBalanceNotificationData.id) + && Objects.equals(this.valueDate, releaseBlockedBalanceNotificationData.valueDate); + } + + @Override + public int hashCode() { + return Objects.hash( + accountHolder, + amount, + balanceAccount, + balancePlatform, + batchReference, + blockedBalanceAfter, + blockedBalanceBefore, + creationDate, + id, + valueDate); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ReleaseBlockedBalanceNotificationData {\n"); + sb.append(" accountHolder: ").append(toIndentedString(accountHolder)).append("\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" balanceAccount: ").append(toIndentedString(balanceAccount)).append("\n"); + sb.append(" balancePlatform: ").append(toIndentedString(balancePlatform)).append("\n"); + sb.append(" batchReference: ").append(toIndentedString(batchReference)).append("\n"); + sb.append(" blockedBalanceAfter: ") + .append(toIndentedString(blockedBalanceAfter)) + .append("\n"); + sb.append(" blockedBalanceBefore: ") + .append(toIndentedString(blockedBalanceBefore)) + .append("\n"); + sb.append(" creationDate: ").append(toIndentedString(creationDate)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" valueDate: ").append(toIndentedString(valueDate)).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 "); + } + + /** + * Create an instance of ReleaseBlockedBalanceNotificationData given an JSON string + * + * @param jsonString JSON string + * @return An instance of ReleaseBlockedBalanceNotificationData + * @throws JsonProcessingException if the JSON string is invalid with respect to + * ReleaseBlockedBalanceNotificationData + */ + public static ReleaseBlockedBalanceNotificationData fromJson(String jsonString) + throws JsonProcessingException { + return JSON.getMapper().readValue(jsonString, ReleaseBlockedBalanceNotificationData.class); + } + + /** + * Convert an instance of ReleaseBlockedBalanceNotificationData 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/balancewebhooks/ReleasedBlockedBalanceNotificationRequest.java b/src/main/java/com/adyen/model/balancewebhooks/ReleasedBlockedBalanceNotificationRequest.java new file mode 100644 index 000000000..0a2b31ea3 --- /dev/null +++ b/src/main/java/com/adyen/model/balancewebhooks/ReleasedBlockedBalanceNotificationRequest.java @@ -0,0 +1,292 @@ +/* + * Balance webhook + * + * 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.balancewebhooks; + +import com.fasterxml.jackson.annotation.JsonCreator; +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; + +/** ReleasedBlockedBalanceNotificationRequest */ +@JsonPropertyOrder({ + ReleasedBlockedBalanceNotificationRequest.JSON_PROPERTY_DATA, + ReleasedBlockedBalanceNotificationRequest.JSON_PROPERTY_ENVIRONMENT, + ReleasedBlockedBalanceNotificationRequest.JSON_PROPERTY_TIMESTAMP, + ReleasedBlockedBalanceNotificationRequest.JSON_PROPERTY_TYPE +}) +public class ReleasedBlockedBalanceNotificationRequest { + public static final String JSON_PROPERTY_DATA = "data"; + private ReleaseBlockedBalanceNotificationData data; + + public static final String JSON_PROPERTY_ENVIRONMENT = "environment"; + private String environment; + + public static final String JSON_PROPERTY_TIMESTAMP = "timestamp"; + private OffsetDateTime timestamp; + + /** Type of webhook. */ + public enum TypeEnum { + BALANCEPLATFORM_BALANCEACCOUNT_BALANCE_BLOCK_RELEASED( + String.valueOf("balancePlatform.balanceAccount.balance.block.released")); + + private static final Logger LOG = Logger.getLogger(TypeEnum.class.getName()); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static TypeEnum fromValue(String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + // handling unexpected value + LOG.warning( + "TypeEnum: unexpected enum value '" + + value + + "' - Supported values are " + + Arrays.toString(TypeEnum.values())); + return null; + } + } + + public static final String JSON_PROPERTY_TYPE = "type"; + private TypeEnum type; + + public ReleasedBlockedBalanceNotificationRequest() {} + + /** + * data + * + * @param data + * @return the current {@code ReleasedBlockedBalanceNotificationRequest} instance, allowing for + * method chaining + */ + public ReleasedBlockedBalanceNotificationRequest data( + ReleaseBlockedBalanceNotificationData data) { + this.data = data; + return this; + } + + /** + * Get data + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public ReleaseBlockedBalanceNotificationData getData() { + return data; + } + + /** + * data + * + * @param data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setData(ReleaseBlockedBalanceNotificationData data) { + this.data = data; + } + + /** + * The environment from which the webhook originated. Possible values: **test**, **live**. + * + * @param environment The environment from which the webhook originated. Possible values: + * **test**, **live**. + * @return the current {@code ReleasedBlockedBalanceNotificationRequest} instance, allowing for + * method chaining + */ + public ReleasedBlockedBalanceNotificationRequest environment(String environment) { + this.environment = environment; + return this; + } + + /** + * The environment from which the webhook originated. Possible values: **test**, **live**. + * + * @return environment The environment from which the webhook originated. Possible values: + * **test**, **live**. + */ + @JsonProperty(JSON_PROPERTY_ENVIRONMENT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getEnvironment() { + return environment; + } + + /** + * The environment from which the webhook originated. Possible values: **test**, **live**. + * + * @param environment The environment from which the webhook originated. Possible values: + * **test**, **live**. + */ + @JsonProperty(JSON_PROPERTY_ENVIRONMENT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setEnvironment(String environment) { + this.environment = environment; + } + + /** + * When the event was queued. + * + * @param timestamp When the event was queued. + * @return the current {@code ReleasedBlockedBalanceNotificationRequest} instance, allowing for + * method chaining + */ + public ReleasedBlockedBalanceNotificationRequest timestamp(OffsetDateTime timestamp) { + this.timestamp = timestamp; + return this; + } + + /** + * When the event was queued. + * + * @return timestamp When the event was queued. + */ + @JsonProperty(JSON_PROPERTY_TIMESTAMP) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OffsetDateTime getTimestamp() { + return timestamp; + } + + /** + * When the event was queued. + * + * @param timestamp When the event was queued. + */ + @JsonProperty(JSON_PROPERTY_TIMESTAMP) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setTimestamp(OffsetDateTime timestamp) { + this.timestamp = timestamp; + } + + /** + * Type of webhook. + * + * @param type Type of webhook. + * @return the current {@code ReleasedBlockedBalanceNotificationRequest} instance, allowing for + * method chaining + */ + public ReleasedBlockedBalanceNotificationRequest type(TypeEnum type) { + this.type = type; + return this; + } + + /** + * Type of webhook. + * + * @return type Type of webhook. + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public TypeEnum getType() { + return type; + } + + /** + * Type of webhook. + * + * @param type Type of webhook. + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setType(TypeEnum type) { + this.type = type; + } + + /** Return true if this ReleasedBlockedBalanceNotificationRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ReleasedBlockedBalanceNotificationRequest releasedBlockedBalanceNotificationRequest = + (ReleasedBlockedBalanceNotificationRequest) o; + return Objects.equals(this.data, releasedBlockedBalanceNotificationRequest.data) + && Objects.equals(this.environment, releasedBlockedBalanceNotificationRequest.environment) + && Objects.equals(this.timestamp, releasedBlockedBalanceNotificationRequest.timestamp) + && Objects.equals(this.type, releasedBlockedBalanceNotificationRequest.type); + } + + @Override + public int hashCode() { + return Objects.hash(data, environment, timestamp, type); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ReleasedBlockedBalanceNotificationRequest {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" environment: ").append(toIndentedString(environment)).append("\n"); + sb.append(" timestamp: ").append(toIndentedString(timestamp)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Create an instance of ReleasedBlockedBalanceNotificationRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of ReleasedBlockedBalanceNotificationRequest + * @throws JsonProcessingException if the JSON string is invalid with respect to + * ReleasedBlockedBalanceNotificationRequest + */ + public static ReleasedBlockedBalanceNotificationRequest fromJson(String jsonString) + throws JsonProcessingException { + return JSON.getMapper().readValue(jsonString, ReleasedBlockedBalanceNotificationRequest.class); + } + + /** + * Convert an instance of ReleasedBlockedBalanceNotificationRequest 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/balancewebhooks/ResourceReference.java b/src/main/java/com/adyen/model/balancewebhooks/ResourceReference.java new file mode 100644 index 000000000..450849788 --- /dev/null +++ b/src/main/java/com/adyen/model/balancewebhooks/ResourceReference.java @@ -0,0 +1,197 @@ +/* + * Balance webhook + * + * 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.balancewebhooks; + +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.*; + +/** ResourceReference */ +@JsonPropertyOrder({ + ResourceReference.JSON_PROPERTY_DESCRIPTION, + ResourceReference.JSON_PROPERTY_ID, + ResourceReference.JSON_PROPERTY_REFERENCE +}) +public class ResourceReference { + public static final String JSON_PROPERTY_DESCRIPTION = "description"; + private String description; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_REFERENCE = "reference"; + private String reference; + + public ResourceReference() {} + + /** + * The description of the resource. + * + * @param description The description of the resource. + * @return the current {@code ResourceReference} instance, allowing for method chaining + */ + public ResourceReference description(String description) { + this.description = description; + return this; + } + + /** + * The description of the resource. + * + * @return description The description of the resource. + */ + @JsonProperty(JSON_PROPERTY_DESCRIPTION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getDescription() { + return description; + } + + /** + * The description of the resource. + * + * @param description The description of the resource. + */ + @JsonProperty(JSON_PROPERTY_DESCRIPTION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setDescription(String description) { + this.description = description; + } + + /** + * The unique identifier of the resource. + * + * @param id The unique identifier of the resource. + * @return the current {@code ResourceReference} instance, allowing for method chaining + */ + public ResourceReference id(String id) { + this.id = id; + return this; + } + + /** + * The unique identifier of the resource. + * + * @return id The unique identifier of the resource. + */ + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getId() { + return id; + } + + /** + * The unique identifier of the resource. + * + * @param id The unique identifier of the resource. + */ + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setId(String id) { + this.id = id; + } + + /** + * The reference for the resource. + * + * @param reference The reference for the resource. + * @return the current {@code ResourceReference} instance, allowing for method chaining + */ + public ResourceReference reference(String reference) { + this.reference = reference; + return this; + } + + /** + * The reference for the resource. + * + * @return reference The reference for the resource. + */ + @JsonProperty(JSON_PROPERTY_REFERENCE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getReference() { + return reference; + } + + /** + * The reference for the resource. + * + * @param reference The reference for the resource. + */ + @JsonProperty(JSON_PROPERTY_REFERENCE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setReference(String reference) { + this.reference = reference; + } + + /** Return true if this ResourceReference object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ResourceReference resourceReference = (ResourceReference) o; + return Objects.equals(this.description, resourceReference.description) + && Objects.equals(this.id, resourceReference.id) + && Objects.equals(this.reference, resourceReference.reference); + } + + @Override + public int hashCode() { + return Objects.hash(description, id, reference); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ResourceReference {\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" reference: ").append(toIndentedString(reference)).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 "); + } + + /** + * Create an instance of ResourceReference given an JSON string + * + * @param jsonString JSON string + * @return An instance of ResourceReference + * @throws JsonProcessingException if the JSON string is invalid with respect to ResourceReference + */ + public static ResourceReference fromJson(String jsonString) throws JsonProcessingException { + return JSON.getMapper().readValue(jsonString, ResourceReference.class); + } + + /** + * Convert an instance of ResourceReference to an JSON string + * + * @return JSON string + */ + public String toJson() throws JsonProcessingException { + return JSON.getMapper().writeValueAsString(this); + } +} diff --git a/src/test/java/com/adyen/webhooks/BalancePlatformWebhooksTest.java b/src/test/java/com/adyen/webhooks/BalancePlatformWebhooksTest.java index 75bb8f435..1c0556442 100644 --- a/src/test/java/com/adyen/webhooks/BalancePlatformWebhooksTest.java +++ b/src/test/java/com/adyen/webhooks/BalancePlatformWebhooksTest.java @@ -8,6 +8,7 @@ import com.adyen.model.acswebhooks.RelayedAuthenticationRequest; import com.adyen.model.balancewebhooks.BalanceAccountBalanceNotificationRequest; import com.adyen.model.balancewebhooks.BalanceWebhooksHandler; +import com.adyen.model.balancewebhooks.ReleasedBlockedBalanceNotificationRequest; import com.adyen.model.configurationwebhooks.*; import com.adyen.model.disputewebhooks.DisputeNotificationRequest; import com.adyen.model.disputewebhooks.DisputeWebhooksHandler; @@ -328,6 +329,34 @@ public void testBalanceAccountBalanceNotificationRequest() { assertFalse(balanceAccountBalanceNotificationRequest.getData().getSettingIds().isEmpty()); } + @Test + public void testBalanceAccountBalanceBlockReleasedNotificationRequest() { + String json = + getFileContents( + "mocks/balancePlatform-webhooks/balancePlatform-balanceAccount-balance-block-released.json"); + + Optional + releasedBlockedBalanceNotificationRequestOptional = + new BalanceWebhooksHandler(json).getReleasedBlockedBalanceNotificationRequest(); + assertTrue(releasedBlockedBalanceNotificationRequestOptional.isPresent()); + + ReleasedBlockedBalanceNotificationRequest releasedBlockedBalanceNotificationRequest = + releasedBlockedBalanceNotificationRequestOptional.get(); + assertNotNull(releasedBlockedBalanceNotificationRequest.getData()); + + assertEquals( + ReleasedBlockedBalanceNotificationRequest.TypeEnum + .BALANCEPLATFORM_BALANCEACCOUNT_BALANCE_BLOCK_RELEASED, + releasedBlockedBalanceNotificationRequest.getType()); + assertEquals( + "BATCH_REF_20250925", + releasedBlockedBalanceNotificationRequest.getData().getBatchReference()); + assertNotNull(releasedBlockedBalanceNotificationRequest.getData().getBalanceAccount()); + assertEquals( + "BA00000000000000000001", + releasedBlockedBalanceNotificationRequest.getData().getBalanceAccount().getId()); + } + @Test public void testNetworkTokenCreatedNotificationRequest() { String json = diff --git a/src/test/resources/mocks/balancePlatform-webhooks/balancePlatform-balanceAccount-balance-block-released.json b/src/test/resources/mocks/balancePlatform-webhooks/balancePlatform-balanceAccount-balance-block-released.json new file mode 100644 index 000000000..0b41d8990 --- /dev/null +++ b/src/test/resources/mocks/balancePlatform-webhooks/balancePlatform-balanceAccount-balance-block-released.json @@ -0,0 +1,33 @@ +{ + "data": { + "accountHolder": { + "description": "Account holder for retail operations", + "id": "AH00000000000000000001", + "reference": "Store_001" + }, + "amount": { + "currency": "EUR", + "value": 25000 + }, + "balanceAccount": { + "description": "Main operating account", + "id": "BA00000000000000000001", + "reference": "OP_ACCT_MAIN" + }, + "balancePlatform": "YOUR_BALANCE_PLATFORM", + "batchReference": "BATCH_REF_20250925", + "blockedBalanceAfter": { + "currency": "EUR", + "value": -75000 + }, + "blockedBalanceBefore": { + "currency": "EUR", + "value": -100000 + }, + "creationDate": "2025-09-25T14:30:00Z", + "valueDate": "2025-09-25T14:35:00Z" + }, + "environment": "test", + "timestamp": "2025-09-25T14:35:00Z", + "type": "balancePlatform.balanceAccount.balance.block.released" +} \ No newline at end of file