diff --git a/sdk-generation-log/configurationwebhooks.json b/sdk-generation-log/configurationwebhooks.json index e9d72b807..5b6c2322f 100644 --- a/sdk-generation-log/configurationwebhooks.json +++ b/sdk-generation-log/configurationwebhooks.json @@ -1,8 +1,8 @@ { "service": "configurationwebhooks", "project": "java", - "generatedAt": "2026-06-02T15:30:09Z", - "openapiCommitSha": "f3894fd6b47d9076841b04852378251de3bba2de", - "automationCommitSha": "6f06b47d0661f0891defe6b85461d2c367fbd284", - "libraryCommitSha": "9539e092f2160ca341916c804f01f0f699a64415" + "generatedAt": "2026-07-23T13:25:47Z", + "openapiCommitSha": "06d031500a5565d326553c6b0d14c3c79d13a1eb", + "automationCommitSha": "0c108bd8050cf480d2710b78b770afdfbdd89397", + "libraryCommitSha": "7f01d8c3c98591abf7cf85a4db7b7ff76aa7e66b" } diff --git a/src/main/java/com/adyen/model/configurationwebhooks/ConfigurationWebhooksHandler.java b/src/main/java/com/adyen/model/configurationwebhooks/ConfigurationWebhooksHandler.java index d7c3e90b2..1d7cab026 100644 --- a/src/main/java/com/adyen/model/configurationwebhooks/ConfigurationWebhooksHandler.java +++ b/src/main/java/com/adyen/model/configurationwebhooks/ConfigurationWebhooksHandler.java @@ -310,6 +310,53 @@ public Optional getScoreNotificationRequest() { return Optional.empty(); } + /** + * Attempts to deserialize the webhook payload into a TopUpConfigurationEventRequest + * + * @return an Optional containing the deserialized object, or empty if deserialization fails + */ + public Optional getTopUpConfigurationEventRequest() { + + var optionalTopUpConfigurationEventRequest = + getOptionalField(TopUpConfigurationEventRequest.class); + + if (optionalTopUpConfigurationEventRequest.isPresent()) { + // verify event type + for (var value : TopUpConfigurationEventRequest.TypeEnum.values()) { + if (value.equals(optionalTopUpConfigurationEventRequest.get().getType())) { + // found matching event type + return optionalTopUpConfigurationEventRequest; + } + } + } + + return Optional.empty(); + } + + /** + * Attempts to deserialize the webhook payload into a TopUpConfigurationUpdatedEventRequest + * + * @return an Optional containing the deserialized object, or empty if deserialization fails + */ + public Optional + getTopUpConfigurationUpdatedEventRequest() { + + var optionalTopUpConfigurationUpdatedEventRequest = + getOptionalField(TopUpConfigurationUpdatedEventRequest.class); + + if (optionalTopUpConfigurationUpdatedEventRequest.isPresent()) { + // verify event type + for (var value : TopUpConfigurationUpdatedEventRequest.TypeEnum.values()) { + if (value.equals(optionalTopUpConfigurationUpdatedEventRequest.get().getType())) { + // found matching event type + return optionalTopUpConfigurationUpdatedEventRequest; + } + } + } + + return Optional.empty(); + } + /** * Deserializes the payload into the specified class type. * diff --git a/src/main/java/com/adyen/model/configurationwebhooks/Mandate.java b/src/main/java/com/adyen/model/configurationwebhooks/Mandate.java index 45b7efe31..03a1c3772 100644 --- a/src/main/java/com/adyen/model/configurationwebhooks/Mandate.java +++ b/src/main/java/com/adyen/model/configurationwebhooks/Mandate.java @@ -17,6 +17,7 @@ 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; @@ -40,7 +41,7 @@ public class Mandate { private MandateBankAccount counterparty; public static final String JSON_PROPERTY_CREATED_AT = "createdAt"; - private Object createdAt; + private OffsetDateTime createdAt; public static final String JSON_PROPERTY_ID = "id"; private String id; @@ -137,7 +138,7 @@ public static TypeEnum fromValue(String value) { private TypeEnum type; public static final String JSON_PROPERTY_UPDATED_AT = "updatedAt"; - private Object updatedAt; + private OffsetDateTime updatedAt; public Mandate() {} @@ -211,35 +212,35 @@ public void setCounterparty(MandateBankAccount counterparty) { } /** - * createdAt + * The date when the mandate was created. * - * @param createdAt + * @param createdAt The date when the mandate was created. * @return the current {@code Mandate} instance, allowing for method chaining */ - public Mandate createdAt(Object createdAt) { + public Mandate createdAt(OffsetDateTime createdAt) { this.createdAt = createdAt; return this; } /** - * Get createdAt + * The date when the mandate was created. * - * @return createdAt + * @return createdAt The date when the mandate was created. */ @JsonProperty(JSON_PROPERTY_CREATED_AT) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Object getCreatedAt() { + public OffsetDateTime getCreatedAt() { return createdAt; } /** - * createdAt + * The date when the mandate was created. * - * @param createdAt + * @param createdAt The date when the mandate was created. */ @JsonProperty(JSON_PROPERTY_CREATED_AT) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setCreatedAt(Object createdAt) { + public void setCreatedAt(OffsetDateTime createdAt) { this.createdAt = createdAt; } @@ -382,35 +383,35 @@ public void setType(TypeEnum type) { } /** - * updatedAt + * The date when the mandate was updated. * - * @param updatedAt + * @param updatedAt The date when the mandate was updated. * @return the current {@code Mandate} instance, allowing for method chaining */ - public Mandate updatedAt(Object updatedAt) { + public Mandate updatedAt(OffsetDateTime updatedAt) { this.updatedAt = updatedAt; return this; } /** - * Get updatedAt + * The date when the mandate was updated. * - * @return updatedAt + * @return updatedAt The date when the mandate was updated. */ @JsonProperty(JSON_PROPERTY_UPDATED_AT) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Object getUpdatedAt() { + public OffsetDateTime getUpdatedAt() { return updatedAt; } /** - * updatedAt + * The date when the mandate was updated. * - * @param updatedAt + * @param updatedAt The date when the mandate was updated. */ @JsonProperty(JSON_PROPERTY_UPDATED_AT) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setUpdatedAt(Object updatedAt) { + public void setUpdatedAt(OffsetDateTime updatedAt) { this.updatedAt = updatedAt; } diff --git a/src/main/java/com/adyen/model/configurationwebhooks/MandateBankAccountAccountIdentification.java b/src/main/java/com/adyen/model/configurationwebhooks/MandateBankAccountAccountIdentification.java index 4a1ffca1a..bf95a3302 100644 --- a/src/main/java/com/adyen/model/configurationwebhooks/MandateBankAccountAccountIdentification.java +++ b/src/main/java/com/adyen/model/configurationwebhooks/MandateBankAccountAccountIdentification.java @@ -152,6 +152,13 @@ public MandateBankAccountAccountIdentification(UKLocalMandateAccountIdentificati new GenericType() {}); JSON.registerDescendants( MandateBankAccountAccountIdentification.class, Collections.unmodifiableMap(schemas)); + // Initialize and register the discriminator mappings. + Map> mappings = new HashMap<>(); + mappings.put("ukLocal", UKLocalMandateAccountIdentification.class); + mappings.put("UKLocalMandateAccountIdentification", UKLocalMandateAccountIdentification.class); + mappings.put( + "MandateBankAccount_accountIdentification", MandateBankAccountAccountIdentification.class); + JSON.registerDiscriminator(MandateBankAccountAccountIdentification.class, "type", mappings); } @Override diff --git a/src/main/java/com/adyen/model/configurationwebhooks/PaymentInstrumentAdditionalBankAccountIdentificationsInner.java b/src/main/java/com/adyen/model/configurationwebhooks/PaymentInstrumentAdditionalBankAccountIdentificationsInner.java index c157a56b3..f97c3213d 100644 --- a/src/main/java/com/adyen/model/configurationwebhooks/PaymentInstrumentAdditionalBankAccountIdentificationsInner.java +++ b/src/main/java/com/adyen/model/configurationwebhooks/PaymentInstrumentAdditionalBankAccountIdentificationsInner.java @@ -151,6 +151,15 @@ public PaymentInstrumentAdditionalBankAccountIdentificationsInner(IbanAccountIde JSON.registerDescendants( PaymentInstrumentAdditionalBankAccountIdentificationsInner.class, Collections.unmodifiableMap(schemas)); + // Initialize and register the discriminator mappings. + Map> mappings = new HashMap<>(); + mappings.put("iban", IbanAccountIdentification.class); + mappings.put("IbanAccountIdentification", IbanAccountIdentification.class); + mappings.put( + "PaymentInstrument_additionalBankAccountIdentifications_inner", + PaymentInstrumentAdditionalBankAccountIdentificationsInner.class); + JSON.registerDiscriminator( + PaymentInstrumentAdditionalBankAccountIdentificationsInner.class, "type", mappings); } @Override diff --git a/src/main/java/com/adyen/model/configurationwebhooks/TopUpConfigurationEventRequest.java b/src/main/java/com/adyen/model/configurationwebhooks/TopUpConfigurationEventRequest.java new file mode 100644 index 000000000..bf7eacdfa --- /dev/null +++ b/src/main/java/com/adyen/model/configurationwebhooks/TopUpConfigurationEventRequest.java @@ -0,0 +1,294 @@ +/* + * Configuration webhooks + * + * The version of the OpenAPI document: 2 + * + * + * 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.configurationwebhooks; + +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; + +/** TopUpConfigurationEventRequest */ +@JsonPropertyOrder({ + TopUpConfigurationEventRequest.JSON_PROPERTY_DATA, + TopUpConfigurationEventRequest.JSON_PROPERTY_ENVIRONMENT, + TopUpConfigurationEventRequest.JSON_PROPERTY_TIMESTAMP, + TopUpConfigurationEventRequest.JSON_PROPERTY_TYPE +}) +public class TopUpConfigurationEventRequest { + public static final String JSON_PROPERTY_DATA = "data"; + private TopUpWebhookData 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_RECURRINGTOPUP_CREATED( + String.valueOf("balancePlatform.balanceAccount.recurringTopUp.created")), + + BALANCEPLATFORM_BALANCEACCOUNT_RECURRINGTOPUP_DELETED( + String.valueOf("balancePlatform.balanceAccount.recurringTopUp.deleted")); + + 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 TopUpConfigurationEventRequest() {} + + /** + * data + * + * @param data + * @return the current {@code TopUpConfigurationEventRequest} instance, allowing for method + * chaining + */ + public TopUpConfigurationEventRequest data(TopUpWebhookData data) { + this.data = data; + return this; + } + + /** + * Get data + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public TopUpWebhookData getData() { + return data; + } + + /** + * data + * + * @param data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setData(TopUpWebhookData 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 TopUpConfigurationEventRequest} instance, allowing for method + * chaining + */ + public TopUpConfigurationEventRequest 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 TopUpConfigurationEventRequest} instance, allowing for method + * chaining + */ + public TopUpConfigurationEventRequest 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 TopUpConfigurationEventRequest} instance, allowing for method + * chaining + */ + public TopUpConfigurationEventRequest 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 TopUpConfigurationEventRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TopUpConfigurationEventRequest topUpConfigurationEventRequest = + (TopUpConfigurationEventRequest) o; + return Objects.equals(this.data, topUpConfigurationEventRequest.data) + && Objects.equals(this.environment, topUpConfigurationEventRequest.environment) + && Objects.equals(this.timestamp, topUpConfigurationEventRequest.timestamp) + && Objects.equals(this.type, topUpConfigurationEventRequest.type); + } + + @Override + public int hashCode() { + return Objects.hash(data, environment, timestamp, type); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TopUpConfigurationEventRequest {\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 TopUpConfigurationEventRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of TopUpConfigurationEventRequest + * @throws JsonProcessingException if the JSON string is invalid with respect to + * TopUpConfigurationEventRequest + */ + public static TopUpConfigurationEventRequest fromJson(String jsonString) + throws JsonProcessingException { + return JSON.getMapper().readValue(jsonString, TopUpConfigurationEventRequest.class); + } + + /** + * Convert an instance of TopUpConfigurationEventRequest 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/configurationwebhooks/TopUpConfigurationUpdatedEventRequest.java b/src/main/java/com/adyen/model/configurationwebhooks/TopUpConfigurationUpdatedEventRequest.java new file mode 100644 index 000000000..755ee378d --- /dev/null +++ b/src/main/java/com/adyen/model/configurationwebhooks/TopUpConfigurationUpdatedEventRequest.java @@ -0,0 +1,291 @@ +/* + * Configuration webhooks + * + * The version of the OpenAPI document: 2 + * + * + * 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.configurationwebhooks; + +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; + +/** TopUpConfigurationUpdatedEventRequest */ +@JsonPropertyOrder({ + TopUpConfigurationUpdatedEventRequest.JSON_PROPERTY_DATA, + TopUpConfigurationUpdatedEventRequest.JSON_PROPERTY_ENVIRONMENT, + TopUpConfigurationUpdatedEventRequest.JSON_PROPERTY_TIMESTAMP, + TopUpConfigurationUpdatedEventRequest.JSON_PROPERTY_TYPE +}) +public class TopUpConfigurationUpdatedEventRequest { + public static final String JSON_PROPERTY_DATA = "data"; + private TopUpUpdatedWebhookData 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_RECURRINGTOPUP_UPDATED( + String.valueOf("balancePlatform.balanceAccount.recurringTopUp.updated")); + + 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 TopUpConfigurationUpdatedEventRequest() {} + + /** + * data + * + * @param data + * @return the current {@code TopUpConfigurationUpdatedEventRequest} instance, allowing for method + * chaining + */ + public TopUpConfigurationUpdatedEventRequest data(TopUpUpdatedWebhookData data) { + this.data = data; + return this; + } + + /** + * Get data + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public TopUpUpdatedWebhookData getData() { + return data; + } + + /** + * data + * + * @param data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setData(TopUpUpdatedWebhookData 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 TopUpConfigurationUpdatedEventRequest} instance, allowing for method + * chaining + */ + public TopUpConfigurationUpdatedEventRequest 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 TopUpConfigurationUpdatedEventRequest} instance, allowing for method + * chaining + */ + public TopUpConfigurationUpdatedEventRequest 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 TopUpConfigurationUpdatedEventRequest} instance, allowing for method + * chaining + */ + public TopUpConfigurationUpdatedEventRequest 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 TopUpConfigurationUpdatedEventRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TopUpConfigurationUpdatedEventRequest topUpConfigurationUpdatedEventRequest = + (TopUpConfigurationUpdatedEventRequest) o; + return Objects.equals(this.data, topUpConfigurationUpdatedEventRequest.data) + && Objects.equals(this.environment, topUpConfigurationUpdatedEventRequest.environment) + && Objects.equals(this.timestamp, topUpConfigurationUpdatedEventRequest.timestamp) + && Objects.equals(this.type, topUpConfigurationUpdatedEventRequest.type); + } + + @Override + public int hashCode() { + return Objects.hash(data, environment, timestamp, type); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TopUpConfigurationUpdatedEventRequest {\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 TopUpConfigurationUpdatedEventRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of TopUpConfigurationUpdatedEventRequest + * @throws JsonProcessingException if the JSON string is invalid with respect to + * TopUpConfigurationUpdatedEventRequest + */ + public static TopUpConfigurationUpdatedEventRequest fromJson(String jsonString) + throws JsonProcessingException { + return JSON.getMapper().readValue(jsonString, TopUpConfigurationUpdatedEventRequest.class); + } + + /** + * Convert an instance of TopUpConfigurationUpdatedEventRequest 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/configurationwebhooks/TopUpUpdatedWebhookData.java b/src/main/java/com/adyen/model/configurationwebhooks/TopUpUpdatedWebhookData.java new file mode 100644 index 000000000..8687ad64f --- /dev/null +++ b/src/main/java/com/adyen/model/configurationwebhooks/TopUpUpdatedWebhookData.java @@ -0,0 +1,292 @@ +/* + * Configuration webhooks + * + * The version of the OpenAPI document: 2 + * + * + * 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.configurationwebhooks; + +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.*; + +/** TopUpUpdatedWebhookData */ +@JsonPropertyOrder({ + TopUpUpdatedWebhookData.JSON_PROPERTY_ACCOUNT_ID, + TopUpUpdatedWebhookData.JSON_PROPERTY_BALANCE_PLATFORM, + TopUpUpdatedWebhookData.JSON_PROPERTY_CREATION_DATE, + TopUpUpdatedWebhookData.JSON_PROPERTY_ID, + TopUpUpdatedWebhookData.JSON_PROPERTY_WEBHOOK_TOP_UP_CONFIGURATION +}) +public class TopUpUpdatedWebhookData { + public static final String JSON_PROPERTY_ACCOUNT_ID = "accountId"; + private String accountId; + + public static final String JSON_PROPERTY_BALANCE_PLATFORM = "balancePlatform"; + private String balancePlatform; + + 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_WEBHOOK_TOP_UP_CONFIGURATION = + "webhookTopUpConfiguration"; + private WebhookTopUpConfigurationUpdated webhookTopUpConfiguration; + + public TopUpUpdatedWebhookData() {} + + /** + * The unique identifier of the balance account for which the recurring top-up is configured. + * + * @param accountId The unique identifier of the balance account for which the recurring top-up is + * configured. + * @return the current {@code TopUpUpdatedWebhookData} instance, allowing for method chaining + */ + public TopUpUpdatedWebhookData accountId(String accountId) { + this.accountId = accountId; + return this; + } + + /** + * The unique identifier of the balance account for which the recurring top-up is configured. + * + * @return accountId The unique identifier of the balance account for which the recurring top-up + * is configured. + */ + @JsonProperty(JSON_PROPERTY_ACCOUNT_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getAccountId() { + return accountId; + } + + /** + * The unique identifier of the balance account for which the recurring top-up is configured. + * + * @param accountId The unique identifier of the balance account for which the recurring top-up is + * configured. + */ + @JsonProperty(JSON_PROPERTY_ACCOUNT_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setAccountId(String accountId) { + this.accountId = accountId; + } + + /** + * The unique identifier of the balance platform. + * + * @param balancePlatform The unique identifier of the balance platform. + * @return the current {@code TopUpUpdatedWebhookData} instance, allowing for method chaining + */ + public TopUpUpdatedWebhookData 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 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 TopUpUpdatedWebhookData} instance, allowing for method chaining + */ + public TopUpUpdatedWebhookData 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. + * + * @param id The ID of the resource. + * @return the current {@code TopUpUpdatedWebhookData} instance, allowing for method chaining + */ + public TopUpUpdatedWebhookData id(String id) { + this.id = id; + return this; + } + + /** + * 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 ID of the resource. + * + * @param id The ID of the resource. + */ + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setId(String id) { + this.id = id; + } + + /** + * webhookTopUpConfiguration + * + * @param webhookTopUpConfiguration + * @return the current {@code TopUpUpdatedWebhookData} instance, allowing for method chaining + */ + public TopUpUpdatedWebhookData webhookTopUpConfiguration( + WebhookTopUpConfigurationUpdated webhookTopUpConfiguration) { + this.webhookTopUpConfiguration = webhookTopUpConfiguration; + return this; + } + + /** + * Get webhookTopUpConfiguration + * + * @return webhookTopUpConfiguration + */ + @JsonProperty(JSON_PROPERTY_WEBHOOK_TOP_UP_CONFIGURATION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public WebhookTopUpConfigurationUpdated getWebhookTopUpConfiguration() { + return webhookTopUpConfiguration; + } + + /** + * webhookTopUpConfiguration + * + * @param webhookTopUpConfiguration + */ + @JsonProperty(JSON_PROPERTY_WEBHOOK_TOP_UP_CONFIGURATION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setWebhookTopUpConfiguration( + WebhookTopUpConfigurationUpdated webhookTopUpConfiguration) { + this.webhookTopUpConfiguration = webhookTopUpConfiguration; + } + + /** Return true if this TopUpUpdatedWebhookData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TopUpUpdatedWebhookData topUpUpdatedWebhookData = (TopUpUpdatedWebhookData) o; + return Objects.equals(this.accountId, topUpUpdatedWebhookData.accountId) + && Objects.equals(this.balancePlatform, topUpUpdatedWebhookData.balancePlatform) + && Objects.equals(this.creationDate, topUpUpdatedWebhookData.creationDate) + && Objects.equals(this.id, topUpUpdatedWebhookData.id) + && Objects.equals( + this.webhookTopUpConfiguration, topUpUpdatedWebhookData.webhookTopUpConfiguration); + } + + @Override + public int hashCode() { + return Objects.hash(accountId, balancePlatform, creationDate, id, webhookTopUpConfiguration); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TopUpUpdatedWebhookData {\n"); + sb.append(" accountId: ").append(toIndentedString(accountId)).append("\n"); + sb.append(" balancePlatform: ").append(toIndentedString(balancePlatform)).append("\n"); + sb.append(" creationDate: ").append(toIndentedString(creationDate)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" webhookTopUpConfiguration: ") + .append(toIndentedString(webhookTopUpConfiguration)) + .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 TopUpUpdatedWebhookData given an JSON string + * + * @param jsonString JSON string + * @return An instance of TopUpUpdatedWebhookData + * @throws JsonProcessingException if the JSON string is invalid with respect to + * TopUpUpdatedWebhookData + */ + public static TopUpUpdatedWebhookData fromJson(String jsonString) throws JsonProcessingException { + return JSON.getMapper().readValue(jsonString, TopUpUpdatedWebhookData.class); + } + + /** + * Convert an instance of TopUpUpdatedWebhookData 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/configurationwebhooks/TopUpWebhookData.java b/src/main/java/com/adyen/model/configurationwebhooks/TopUpWebhookData.java new file mode 100644 index 000000000..a9668cb0b --- /dev/null +++ b/src/main/java/com/adyen/model/configurationwebhooks/TopUpWebhookData.java @@ -0,0 +1,290 @@ +/* + * Configuration webhooks + * + * The version of the OpenAPI document: 2 + * + * + * 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.configurationwebhooks; + +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.*; + +/** TopUpWebhookData */ +@JsonPropertyOrder({ + TopUpWebhookData.JSON_PROPERTY_ACCOUNT_ID, + TopUpWebhookData.JSON_PROPERTY_BALANCE_PLATFORM, + TopUpWebhookData.JSON_PROPERTY_CREATION_DATE, + TopUpWebhookData.JSON_PROPERTY_ID, + TopUpWebhookData.JSON_PROPERTY_WEBHOOK_TOP_UP_CONFIGURATION +}) +public class TopUpWebhookData { + public static final String JSON_PROPERTY_ACCOUNT_ID = "accountId"; + private String accountId; + + public static final String JSON_PROPERTY_BALANCE_PLATFORM = "balancePlatform"; + private String balancePlatform; + + 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_WEBHOOK_TOP_UP_CONFIGURATION = + "webhookTopUpConfiguration"; + private WebhookTopUpConfiguration webhookTopUpConfiguration; + + public TopUpWebhookData() {} + + /** + * The unique identifier of the balance account for which the recurring top-up is configured. + * + * @param accountId The unique identifier of the balance account for which the recurring top-up is + * configured. + * @return the current {@code TopUpWebhookData} instance, allowing for method chaining + */ + public TopUpWebhookData accountId(String accountId) { + this.accountId = accountId; + return this; + } + + /** + * The unique identifier of the balance account for which the recurring top-up is configured. + * + * @return accountId The unique identifier of the balance account for which the recurring top-up + * is configured. + */ + @JsonProperty(JSON_PROPERTY_ACCOUNT_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getAccountId() { + return accountId; + } + + /** + * The unique identifier of the balance account for which the recurring top-up is configured. + * + * @param accountId The unique identifier of the balance account for which the recurring top-up is + * configured. + */ + @JsonProperty(JSON_PROPERTY_ACCOUNT_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setAccountId(String accountId) { + this.accountId = accountId; + } + + /** + * The unique identifier of the balance platform. + * + * @param balancePlatform The unique identifier of the balance platform. + * @return the current {@code TopUpWebhookData} instance, allowing for method chaining + */ + public TopUpWebhookData 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 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 TopUpWebhookData} instance, allowing for method chaining + */ + public TopUpWebhookData 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. + * + * @param id The ID of the resource. + * @return the current {@code TopUpWebhookData} instance, allowing for method chaining + */ + public TopUpWebhookData id(String id) { + this.id = id; + return this; + } + + /** + * 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 ID of the resource. + * + * @param id The ID of the resource. + */ + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setId(String id) { + this.id = id; + } + + /** + * webhookTopUpConfiguration + * + * @param webhookTopUpConfiguration + * @return the current {@code TopUpWebhookData} instance, allowing for method chaining + */ + public TopUpWebhookData webhookTopUpConfiguration( + WebhookTopUpConfiguration webhookTopUpConfiguration) { + this.webhookTopUpConfiguration = webhookTopUpConfiguration; + return this; + } + + /** + * Get webhookTopUpConfiguration + * + * @return webhookTopUpConfiguration + */ + @JsonProperty(JSON_PROPERTY_WEBHOOK_TOP_UP_CONFIGURATION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public WebhookTopUpConfiguration getWebhookTopUpConfiguration() { + return webhookTopUpConfiguration; + } + + /** + * webhookTopUpConfiguration + * + * @param webhookTopUpConfiguration + */ + @JsonProperty(JSON_PROPERTY_WEBHOOK_TOP_UP_CONFIGURATION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setWebhookTopUpConfiguration(WebhookTopUpConfiguration webhookTopUpConfiguration) { + this.webhookTopUpConfiguration = webhookTopUpConfiguration; + } + + /** Return true if this TopUpWebhookData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TopUpWebhookData topUpWebhookData = (TopUpWebhookData) o; + return Objects.equals(this.accountId, topUpWebhookData.accountId) + && Objects.equals(this.balancePlatform, topUpWebhookData.balancePlatform) + && Objects.equals(this.creationDate, topUpWebhookData.creationDate) + && Objects.equals(this.id, topUpWebhookData.id) + && Objects.equals( + this.webhookTopUpConfiguration, topUpWebhookData.webhookTopUpConfiguration); + } + + @Override + public int hashCode() { + return Objects.hash(accountId, balancePlatform, creationDate, id, webhookTopUpConfiguration); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TopUpWebhookData {\n"); + sb.append(" accountId: ").append(toIndentedString(accountId)).append("\n"); + sb.append(" balancePlatform: ").append(toIndentedString(balancePlatform)).append("\n"); + sb.append(" creationDate: ").append(toIndentedString(creationDate)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" webhookTopUpConfiguration: ") + .append(toIndentedString(webhookTopUpConfiguration)) + .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 TopUpWebhookData given an JSON string + * + * @param jsonString JSON string + * @return An instance of TopUpWebhookData + * @throws JsonProcessingException if the JSON string is invalid with respect to TopUpWebhookData + */ + public static TopUpWebhookData fromJson(String jsonString) throws JsonProcessingException { + return JSON.getMapper().readValue(jsonString, TopUpWebhookData.class); + } + + /** + * Convert an instance of TopUpWebhookData 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/configurationwebhooks/WebhookAmount.java b/src/main/java/com/adyen/model/configurationwebhooks/WebhookAmount.java new file mode 100644 index 000000000..6c9757d66 --- /dev/null +++ b/src/main/java/com/adyen/model/configurationwebhooks/WebhookAmount.java @@ -0,0 +1,164 @@ +/* + * Configuration webhooks + * + * The version of the OpenAPI document: 2 + * + * + * 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.configurationwebhooks; + +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.*; + +/** WebhookAmount */ +@JsonPropertyOrder({WebhookAmount.JSON_PROPERTY_CURRENCY, WebhookAmount.JSON_PROPERTY_VALUE}) +public class WebhookAmount { + public static final String JSON_PROPERTY_CURRENCY = "currency"; + private String currency; + + public static final String JSON_PROPERTY_VALUE = "value"; + private Long value; + + public WebhookAmount() {} + + /** + * The three-character [ISO currency + * code](https://docs.adyen.com/development-resources/currency-codes). + * + * @param currency The three-character [ISO currency + * code](https://docs.adyen.com/development-resources/currency-codes). + * @return the current {@code WebhookAmount} instance, allowing for method chaining + */ + public WebhookAmount currency(String currency) { + this.currency = currency; + return this; + } + + /** + * The three-character [ISO currency + * code](https://docs.adyen.com/development-resources/currency-codes). + * + * @return currency The three-character [ISO currency + * code](https://docs.adyen.com/development-resources/currency-codes). + */ + @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). + * + * @param currency The three-character [ISO currency + * code](https://docs.adyen.com/development-resources/currency-codes). + */ + @JsonProperty(JSON_PROPERTY_CURRENCY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setCurrency(String currency) { + this.currency = currency; + } + + /** + * The amount, in [minor units](https://docs.adyen.com/development-resources/currency-codes). + * + * @param value The amount, in [minor + * units](https://docs.adyen.com/development-resources/currency-codes). + * @return the current {@code WebhookAmount} instance, allowing for method chaining + */ + public WebhookAmount value(Long value) { + this.value = value; + return this; + } + + /** + * The amount, in [minor units](https://docs.adyen.com/development-resources/currency-codes). + * + * @return value The amount, in [minor + * units](https://docs.adyen.com/development-resources/currency-codes). + */ + @JsonProperty(JSON_PROPERTY_VALUE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getValue() { + return value; + } + + /** + * The amount, in [minor units](https://docs.adyen.com/development-resources/currency-codes). + * + * @param value The amount, in [minor + * units](https://docs.adyen.com/development-resources/currency-codes). + */ + @JsonProperty(JSON_PROPERTY_VALUE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setValue(Long value) { + this.value = value; + } + + /** Return true if this WebhookAmount object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + WebhookAmount webhookAmount = (WebhookAmount) o; + return Objects.equals(this.currency, webhookAmount.currency) + && Objects.equals(this.value, webhookAmount.value); + } + + @Override + public int hashCode() { + return Objects.hash(currency, value); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class WebhookAmount {\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 WebhookAmount given an JSON string + * + * @param jsonString JSON string + * @return An instance of WebhookAmount + * @throws JsonProcessingException if the JSON string is invalid with respect to WebhookAmount + */ + public static WebhookAmount fromJson(String jsonString) throws JsonProcessingException { + return JSON.getMapper().readValue(jsonString, WebhookAmount.class); + } + + /** + * Convert an instance of WebhookAmount 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/configurationwebhooks/WebhookTopUpAmount.java b/src/main/java/com/adyen/model/configurationwebhooks/WebhookTopUpAmount.java new file mode 100644 index 000000000..bc1ceb8bb --- /dev/null +++ b/src/main/java/com/adyen/model/configurationwebhooks/WebhookTopUpAmount.java @@ -0,0 +1,159 @@ +/* + * Configuration webhooks + * + * The version of the OpenAPI document: 2 + * + * + * 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.configurationwebhooks; + +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.*; + +/** WebhookTopUpAmount */ +@JsonPropertyOrder({ + WebhookTopUpAmount.JSON_PROPERTY_FIXED_AMOUNT, + WebhookTopUpAmount.JSON_PROPERTY_TARGET_AMOUNT +}) +public class WebhookTopUpAmount { + public static final String JSON_PROPERTY_FIXED_AMOUNT = "fixedAmount"; + private WebhookAmount fixedAmount; + + public static final String JSON_PROPERTY_TARGET_AMOUNT = "targetAmount"; + private WebhookAmount targetAmount; + + public WebhookTopUpAmount() {} + + /** + * fixedAmount + * + * @param fixedAmount + * @return the current {@code WebhookTopUpAmount} instance, allowing for method chaining + */ + public WebhookTopUpAmount fixedAmount(WebhookAmount fixedAmount) { + this.fixedAmount = fixedAmount; + return this; + } + + /** + * Get fixedAmount + * + * @return fixedAmount + */ + @JsonProperty(JSON_PROPERTY_FIXED_AMOUNT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public WebhookAmount getFixedAmount() { + return fixedAmount; + } + + /** + * fixedAmount + * + * @param fixedAmount + */ + @JsonProperty(JSON_PROPERTY_FIXED_AMOUNT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setFixedAmount(WebhookAmount fixedAmount) { + this.fixedAmount = fixedAmount; + } + + /** + * targetAmount + * + * @param targetAmount + * @return the current {@code WebhookTopUpAmount} instance, allowing for method chaining + */ + public WebhookTopUpAmount targetAmount(WebhookAmount targetAmount) { + this.targetAmount = targetAmount; + return this; + } + + /** + * Get targetAmount + * + * @return targetAmount + */ + @JsonProperty(JSON_PROPERTY_TARGET_AMOUNT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public WebhookAmount getTargetAmount() { + return targetAmount; + } + + /** + * targetAmount + * + * @param targetAmount + */ + @JsonProperty(JSON_PROPERTY_TARGET_AMOUNT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setTargetAmount(WebhookAmount targetAmount) { + this.targetAmount = targetAmount; + } + + /** Return true if this WebhookTopUpAmount object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + WebhookTopUpAmount webhookTopUpAmount = (WebhookTopUpAmount) o; + return Objects.equals(this.fixedAmount, webhookTopUpAmount.fixedAmount) + && Objects.equals(this.targetAmount, webhookTopUpAmount.targetAmount); + } + + @Override + public int hashCode() { + return Objects.hash(fixedAmount, targetAmount); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class WebhookTopUpAmount {\n"); + sb.append(" fixedAmount: ").append(toIndentedString(fixedAmount)).append("\n"); + sb.append(" targetAmount: ").append(toIndentedString(targetAmount)).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 WebhookTopUpAmount given an JSON string + * + * @param jsonString JSON string + * @return An instance of WebhookTopUpAmount + * @throws JsonProcessingException if the JSON string is invalid with respect to + * WebhookTopUpAmount + */ + public static WebhookTopUpAmount fromJson(String jsonString) throws JsonProcessingException { + return JSON.getMapper().readValue(jsonString, WebhookTopUpAmount.class); + } + + /** + * Convert an instance of WebhookTopUpAmount 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/configurationwebhooks/WebhookTopUpConfiguration.java b/src/main/java/com/adyen/model/configurationwebhooks/WebhookTopUpConfiguration.java new file mode 100644 index 000000000..7bce3eac6 --- /dev/null +++ b/src/main/java/com/adyen/model/configurationwebhooks/WebhookTopUpConfiguration.java @@ -0,0 +1,489 @@ +/* + * Configuration webhooks + * + * The version of the OpenAPI document: 2 + * + * + * 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.configurationwebhooks; + +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.util.*; +import java.util.Arrays; +import java.util.logging.Logger; + +/** WebhookTopUpConfiguration */ +@JsonPropertyOrder({ + WebhookTopUpConfiguration.JSON_PROPERTY_COUNTERPARTY, + WebhookTopUpConfiguration.JSON_PROPERTY_DESCRIPTION, + WebhookTopUpConfiguration.JSON_PROPERTY_ID, + WebhookTopUpConfiguration.JSON_PROPERTY_MANDATE, + WebhookTopUpConfiguration.JSON_PROPERTY_REFERENCE_FOR_BENEFICIARY, + WebhookTopUpConfiguration.JSON_PROPERTY_STATUS, + WebhookTopUpConfiguration.JSON_PROPERTY_TOP_UP_AMOUNT, + WebhookTopUpConfiguration.JSON_PROPERTY_TRIGGER +}) +public class WebhookTopUpConfiguration { + public static final String JSON_PROPERTY_COUNTERPARTY = "counterparty"; + private WebhookTopUpCounterparty counterparty; + + 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_MANDATE = "mandate"; + private WebhookTopUpMandate mandate; + + public static final String JSON_PROPERTY_REFERENCE_FOR_BENEFICIARY = "referenceForBeneficiary"; + private String referenceForBeneficiary; + + /** + * The status of the top-up configuration. Possible values: * **active**: the top-up is enabled + * and funds are pulled in. * **inactive**: the top-up is disabled and cannot be triggered. + */ + public enum StatusEnum { + ACTIVE(String.valueOf("active")), + + INACTIVE(String.valueOf("inactive")); + + private static final Logger LOG = Logger.getLogger(StatusEnum.class.getName()); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + // handling unexpected value + LOG.warning( + "StatusEnum: unexpected enum value '" + + value + + "' - Supported values are " + + Arrays.toString(StatusEnum.values())); + return null; + } + } + + public static final String JSON_PROPERTY_STATUS = "status"; + private StatusEnum status; + + public static final String JSON_PROPERTY_TOP_UP_AMOUNT = "topUpAmount"; + private WebhookTopUpAmount topUpAmount; + + public static final String JSON_PROPERTY_TRIGGER = "trigger"; + private WebhookTopUpTrigger trigger; + + public WebhookTopUpConfiguration() {} + + /** + * counterparty + * + * @param counterparty + * @return the current {@code WebhookTopUpConfiguration} instance, allowing for method chaining + */ + public WebhookTopUpConfiguration counterparty(WebhookTopUpCounterparty counterparty) { + this.counterparty = counterparty; + return this; + } + + /** + * Get counterparty + * + * @return counterparty + */ + @JsonProperty(JSON_PROPERTY_COUNTERPARTY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public WebhookTopUpCounterparty getCounterparty() { + return counterparty; + } + + /** + * counterparty + * + * @param counterparty + */ + @JsonProperty(JSON_PROPERTY_COUNTERPARTY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setCounterparty(WebhookTopUpCounterparty counterparty) { + this.counterparty = counterparty; + } + + /** + * The message that is used in the top-up transfer's description body with a maximum length of + * 140 characters. If the message is longer after replacing placeholders, the message is cut off + * at 140 characters. + * + * @param description The message that is used in the top-up transfer's description body with + * a maximum length of 140 characters. If the message is longer after replacing placeholders, + * the message is cut off at 140 characters. + * @return the current {@code WebhookTopUpConfiguration} instance, allowing for method chaining + */ + public WebhookTopUpConfiguration description(String description) { + this.description = description; + return this; + } + + /** + * The message that is used in the top-up transfer's description body with a maximum length of + * 140 characters. If the message is longer after replacing placeholders, the message is cut off + * at 140 characters. + * + * @return description The message that is used in the top-up transfer's description body with + * a maximum length of 140 characters. If the message is longer after replacing placeholders, + * the message is cut off at 140 characters. + */ + @JsonProperty(JSON_PROPERTY_DESCRIPTION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getDescription() { + return description; + } + + /** + * The message that is used in the top-up transfer's description body with a maximum length of + * 140 characters. If the message is longer after replacing placeholders, the message is cut off + * at 140 characters. + * + * @param description The message that is used in the top-up transfer's description body with + * a maximum length of 140 characters. If the message is longer after replacing placeholders, + * the message is cut off at 140 characters. + */ + @JsonProperty(JSON_PROPERTY_DESCRIPTION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setDescription(String description) { + this.description = description; + } + + /** + * The unique identifier of the recurring top-up configuration. + * + * @param id The unique identifier of the recurring top-up configuration. + * @return the current {@code WebhookTopUpConfiguration} instance, allowing for method chaining + */ + public WebhookTopUpConfiguration id(String id) { + this.id = id; + return this; + } + + /** + * The unique identifier of the recurring top-up configuration. + * + * @return id The unique identifier of the recurring top-up configuration. + */ + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getId() { + return id; + } + + /** + * The unique identifier of the recurring top-up configuration. + * + * @param id The unique identifier of the recurring top-up configuration. + */ + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setId(String id) { + this.id = id; + } + + /** + * mandate + * + * @param mandate + * @return the current {@code WebhookTopUpConfiguration} instance, allowing for method chaining + */ + public WebhookTopUpConfiguration mandate(WebhookTopUpMandate mandate) { + this.mandate = mandate; + return this; + } + + /** + * Get mandate + * + * @return mandate + */ + @JsonProperty(JSON_PROPERTY_MANDATE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public WebhookTopUpMandate getMandate() { + return mandate; + } + + /** + * mandate + * + * @param mandate + */ + @JsonProperty(JSON_PROPERTY_MANDATE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setMandate(WebhookTopUpMandate mandate) { + this.mandate = mandate; + } + + /** + * A reference that is sent to the recipient. This reference is also sent in all webhooks related + * to the transfer, so you can use it to track statuses for both parties involved in the funds + * movement. Supported characters: **a-z**, **A-Z**, **0-9**. + * + * @param referenceForBeneficiary A reference that is sent to the recipient. This reference is + * also sent in all webhooks related to the transfer, so you can use it to track statuses for + * both parties involved in the funds movement. Supported characters: **a-z**, **A-Z**, + * **0-9**. + * @return the current {@code WebhookTopUpConfiguration} instance, allowing for method chaining + */ + public WebhookTopUpConfiguration referenceForBeneficiary(String referenceForBeneficiary) { + this.referenceForBeneficiary = referenceForBeneficiary; + return this; + } + + /** + * A reference that is sent to the recipient. This reference is also sent in all webhooks related + * to the transfer, so you can use it to track statuses for both parties involved in the funds + * movement. Supported characters: **a-z**, **A-Z**, **0-9**. + * + * @return referenceForBeneficiary A reference that is sent to the recipient. This reference is + * also sent in all webhooks related to the transfer, so you can use it to track statuses for + * both parties involved in the funds movement. Supported characters: **a-z**, **A-Z**, + * **0-9**. + */ + @JsonProperty(JSON_PROPERTY_REFERENCE_FOR_BENEFICIARY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getReferenceForBeneficiary() { + return referenceForBeneficiary; + } + + /** + * A reference that is sent to the recipient. This reference is also sent in all webhooks related + * to the transfer, so you can use it to track statuses for both parties involved in the funds + * movement. Supported characters: **a-z**, **A-Z**, **0-9**. + * + * @param referenceForBeneficiary A reference that is sent to the recipient. This reference is + * also sent in all webhooks related to the transfer, so you can use it to track statuses for + * both parties involved in the funds movement. Supported characters: **a-z**, **A-Z**, + * **0-9**. + */ + @JsonProperty(JSON_PROPERTY_REFERENCE_FOR_BENEFICIARY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setReferenceForBeneficiary(String referenceForBeneficiary) { + this.referenceForBeneficiary = referenceForBeneficiary; + } + + /** + * The status of the top-up configuration. Possible values: * **active**: the top-up is enabled + * and funds are pulled in. * **inactive**: the top-up is disabled and cannot be triggered. + * + * @param status The status of the top-up configuration. Possible values: * **active**: the top-up + * is enabled and funds are pulled in. * **inactive**: the top-up is disabled and cannot be + * triggered. + * @return the current {@code WebhookTopUpConfiguration} instance, allowing for method chaining + */ + public WebhookTopUpConfiguration status(StatusEnum status) { + this.status = status; + return this; + } + + /** + * The status of the top-up configuration. Possible values: * **active**: the top-up is enabled + * and funds are pulled in. * **inactive**: the top-up is disabled and cannot be triggered. + * + * @return status The status of the top-up configuration. Possible values: * **active**: the + * top-up is enabled and funds are pulled in. * **inactive**: the top-up is disabled and + * cannot be triggered. + */ + @JsonProperty(JSON_PROPERTY_STATUS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public StatusEnum getStatus() { + return status; + } + + /** + * The status of the top-up configuration. Possible values: * **active**: the top-up is enabled + * and funds are pulled in. * **inactive**: the top-up is disabled and cannot be triggered. + * + * @param status The status of the top-up configuration. Possible values: * **active**: the top-up + * is enabled and funds are pulled in. * **inactive**: the top-up is disabled and cannot be + * triggered. + */ + @JsonProperty(JSON_PROPERTY_STATUS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setStatus(StatusEnum status) { + this.status = status; + } + + /** + * topUpAmount + * + * @param topUpAmount + * @return the current {@code WebhookTopUpConfiguration} instance, allowing for method chaining + */ + public WebhookTopUpConfiguration topUpAmount(WebhookTopUpAmount topUpAmount) { + this.topUpAmount = topUpAmount; + return this; + } + + /** + * Get topUpAmount + * + * @return topUpAmount + */ + @JsonProperty(JSON_PROPERTY_TOP_UP_AMOUNT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public WebhookTopUpAmount getTopUpAmount() { + return topUpAmount; + } + + /** + * topUpAmount + * + * @param topUpAmount + */ + @JsonProperty(JSON_PROPERTY_TOP_UP_AMOUNT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setTopUpAmount(WebhookTopUpAmount topUpAmount) { + this.topUpAmount = topUpAmount; + } + + /** + * trigger + * + * @param trigger + * @return the current {@code WebhookTopUpConfiguration} instance, allowing for method chaining + */ + public WebhookTopUpConfiguration trigger(WebhookTopUpTrigger trigger) { + this.trigger = trigger; + return this; + } + + /** + * Get trigger + * + * @return trigger + */ + @JsonProperty(JSON_PROPERTY_TRIGGER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public WebhookTopUpTrigger getTrigger() { + return trigger; + } + + /** + * trigger + * + * @param trigger + */ + @JsonProperty(JSON_PROPERTY_TRIGGER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setTrigger(WebhookTopUpTrigger trigger) { + this.trigger = trigger; + } + + /** Return true if this WebhookTopUpConfiguration object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + WebhookTopUpConfiguration webhookTopUpConfiguration = (WebhookTopUpConfiguration) o; + return Objects.equals(this.counterparty, webhookTopUpConfiguration.counterparty) + && Objects.equals(this.description, webhookTopUpConfiguration.description) + && Objects.equals(this.id, webhookTopUpConfiguration.id) + && Objects.equals(this.mandate, webhookTopUpConfiguration.mandate) + && Objects.equals( + this.referenceForBeneficiary, webhookTopUpConfiguration.referenceForBeneficiary) + && Objects.equals(this.status, webhookTopUpConfiguration.status) + && Objects.equals(this.topUpAmount, webhookTopUpConfiguration.topUpAmount) + && Objects.equals(this.trigger, webhookTopUpConfiguration.trigger); + } + + @Override + public int hashCode() { + return Objects.hash( + counterparty, + description, + id, + mandate, + referenceForBeneficiary, + status, + topUpAmount, + trigger); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class WebhookTopUpConfiguration {\n"); + sb.append(" counterparty: ").append(toIndentedString(counterparty)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" mandate: ").append(toIndentedString(mandate)).append("\n"); + sb.append(" referenceForBeneficiary: ") + .append(toIndentedString(referenceForBeneficiary)) + .append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" topUpAmount: ").append(toIndentedString(topUpAmount)).append("\n"); + sb.append(" trigger: ").append(toIndentedString(trigger)).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 WebhookTopUpConfiguration given an JSON string + * + * @param jsonString JSON string + * @return An instance of WebhookTopUpConfiguration + * @throws JsonProcessingException if the JSON string is invalid with respect to + * WebhookTopUpConfiguration + */ + public static WebhookTopUpConfiguration fromJson(String jsonString) + throws JsonProcessingException { + return JSON.getMapper().readValue(jsonString, WebhookTopUpConfiguration.class); + } + + /** + * Convert an instance of WebhookTopUpConfiguration 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/configurationwebhooks/WebhookTopUpConfigurationUpdated.java b/src/main/java/com/adyen/model/configurationwebhooks/WebhookTopUpConfigurationUpdated.java new file mode 100644 index 000000000..61fa2d720 --- /dev/null +++ b/src/main/java/com/adyen/model/configurationwebhooks/WebhookTopUpConfigurationUpdated.java @@ -0,0 +1,620 @@ +/* + * Configuration webhooks + * + * The version of the OpenAPI document: 2 + * + * + * 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.configurationwebhooks; + +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.util.*; +import java.util.Arrays; +import java.util.logging.Logger; + +/** WebhookTopUpConfigurationUpdated */ +@JsonPropertyOrder({ + WebhookTopUpConfigurationUpdated.JSON_PROPERTY_COUNTERPARTY, + WebhookTopUpConfigurationUpdated.JSON_PROPERTY_DESCRIPTION, + WebhookTopUpConfigurationUpdated.JSON_PROPERTY_DISABLED_REASON, + WebhookTopUpConfigurationUpdated.JSON_PROPERTY_ID, + WebhookTopUpConfigurationUpdated.JSON_PROPERTY_MANDATE, + WebhookTopUpConfigurationUpdated.JSON_PROPERTY_REASON_DETAIL, + WebhookTopUpConfigurationUpdated.JSON_PROPERTY_REFERENCE_FOR_BENEFICIARY, + WebhookTopUpConfigurationUpdated.JSON_PROPERTY_STATUS, + WebhookTopUpConfigurationUpdated.JSON_PROPERTY_TOP_UP_AMOUNT, + WebhookTopUpConfigurationUpdated.JSON_PROPERTY_TRIGGER +}) +public class WebhookTopUpConfigurationUpdated { + public static final String JSON_PROPERTY_COUNTERPARTY = "counterparty"; + private WebhookTopUpCounterparty counterparty; + + public static final String JSON_PROPERTY_DESCRIPTION = "description"; + private String description; + + public static final String JSON_PROPERTY_DISABLED_REASON = "disabledReason"; + private String disabledReason; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_MANDATE = "mandate"; + private WebhookTopUpMandate mandate; + + public static final String JSON_PROPERTY_REASON_DETAIL = "reasonDetail"; + private String reasonDetail; + + public static final String JSON_PROPERTY_REFERENCE_FOR_BENEFICIARY = "referenceForBeneficiary"; + private String referenceForBeneficiary; + + /** + * The status of the top-up configuration. Possible values: * **active**: the top-up is enabled + * and funds are pulled in. * **inactive**: the top-up is disabled and cannot be triggered. + */ + public enum StatusEnum { + ACTIVE(String.valueOf("active")), + + INACTIVE(String.valueOf("inactive")); + + private static final Logger LOG = Logger.getLogger(StatusEnum.class.getName()); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + // handling unexpected value + LOG.warning( + "StatusEnum: unexpected enum value '" + + value + + "' - Supported values are " + + Arrays.toString(StatusEnum.values())); + return null; + } + } + + public static final String JSON_PROPERTY_STATUS = "status"; + private StatusEnum status; + + public static final String JSON_PROPERTY_TOP_UP_AMOUNT = "topUpAmount"; + private WebhookTopUpAmount topUpAmount; + + public static final String JSON_PROPERTY_TRIGGER = "trigger"; + private WebhookTopUpTrigger trigger; + + public WebhookTopUpConfigurationUpdated() {} + + /** + * counterparty + * + * @param counterparty + * @return the current {@code WebhookTopUpConfigurationUpdated} instance, allowing for method + * chaining + */ + public WebhookTopUpConfigurationUpdated counterparty(WebhookTopUpCounterparty counterparty) { + this.counterparty = counterparty; + return this; + } + + /** + * Get counterparty + * + * @return counterparty + */ + @JsonProperty(JSON_PROPERTY_COUNTERPARTY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public WebhookTopUpCounterparty getCounterparty() { + return counterparty; + } + + /** + * counterparty + * + * @param counterparty + */ + @JsonProperty(JSON_PROPERTY_COUNTERPARTY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setCounterparty(WebhookTopUpCounterparty counterparty) { + this.counterparty = counterparty; + } + + /** + * The message that is used in the top-up transfer's description body with a maximum length of + * 140 characters. If the message is longer after replacing placeholders, the message is cut off + * at 140 characters. + * + * @param description The message that is used in the top-up transfer's description body with + * a maximum length of 140 characters. If the message is longer after replacing placeholders, + * the message is cut off at 140 characters. + * @return the current {@code WebhookTopUpConfigurationUpdated} instance, allowing for method + * chaining + */ + public WebhookTopUpConfigurationUpdated description(String description) { + this.description = description; + return this; + } + + /** + * The message that is used in the top-up transfer's description body with a maximum length of + * 140 characters. If the message is longer after replacing placeholders, the message is cut off + * at 140 characters. + * + * @return description The message that is used in the top-up transfer's description body with + * a maximum length of 140 characters. If the message is longer after replacing placeholders, + * the message is cut off at 140 characters. + */ + @JsonProperty(JSON_PROPERTY_DESCRIPTION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getDescription() { + return description; + } + + /** + * The message that is used in the top-up transfer's description body with a maximum length of + * 140 characters. If the message is longer after replacing placeholders, the message is cut off + * at 140 characters. + * + * @param description The message that is used in the top-up transfer's description body with + * a maximum length of 140 characters. If the message is longer after replacing placeholders, + * the message is cut off at 140 characters. + */ + @JsonProperty(JSON_PROPERTY_DESCRIPTION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setDescription(String description) { + this.description = description; + } + + /** + * A machine-readable code identifying the reason the system deactivated the top-up configuration. + * This field is only populated when the status is `inactive`. Possible values: * + * **transferInstrumentDoesNotExist** * **directDebitNotSupported** * + * **accountHierarchyNotActive** * **mandateNotFound** * **mandateNotActive** * + * **directDebitAmountThresholdExceeded** * **topUpNotSupported** * **routeNotFound** * + * **counterpartyAccountBlocked** * **counterpartyAccountInvalid** * **unknown** + * + * @param disabledReason A machine-readable code identifying the reason the system deactivated the + * top-up configuration. This field is only populated when the status is `inactive`. + * Possible values: * **transferInstrumentDoesNotExist** * **directDebitNotSupported** * + * **accountHierarchyNotActive** * **mandateNotFound** * **mandateNotActive** * + * **directDebitAmountThresholdExceeded** * **topUpNotSupported** * **routeNotFound** * + * **counterpartyAccountBlocked** * **counterpartyAccountInvalid** * **unknown** + * @return the current {@code WebhookTopUpConfigurationUpdated} instance, allowing for method + * chaining + */ + public WebhookTopUpConfigurationUpdated disabledReason(String disabledReason) { + this.disabledReason = disabledReason; + return this; + } + + /** + * A machine-readable code identifying the reason the system deactivated the top-up configuration. + * This field is only populated when the status is `inactive`. Possible values: * + * **transferInstrumentDoesNotExist** * **directDebitNotSupported** * + * **accountHierarchyNotActive** * **mandateNotFound** * **mandateNotActive** * + * **directDebitAmountThresholdExceeded** * **topUpNotSupported** * **routeNotFound** * + * **counterpartyAccountBlocked** * **counterpartyAccountInvalid** * **unknown** + * + * @return disabledReason A machine-readable code identifying the reason the system deactivated + * the top-up configuration. This field is only populated when the status is + * `inactive`. Possible values: * **transferInstrumentDoesNotExist** * + * **directDebitNotSupported** * **accountHierarchyNotActive** * **mandateNotFound** * + * **mandateNotActive** * **directDebitAmountThresholdExceeded** * **topUpNotSupported** * + * **routeNotFound** * **counterpartyAccountBlocked** * **counterpartyAccountInvalid** * + * **unknown** + */ + @JsonProperty(JSON_PROPERTY_DISABLED_REASON) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getDisabledReason() { + return disabledReason; + } + + /** + * A machine-readable code identifying the reason the system deactivated the top-up configuration. + * This field is only populated when the status is `inactive`. Possible values: * + * **transferInstrumentDoesNotExist** * **directDebitNotSupported** * + * **accountHierarchyNotActive** * **mandateNotFound** * **mandateNotActive** * + * **directDebitAmountThresholdExceeded** * **topUpNotSupported** * **routeNotFound** * + * **counterpartyAccountBlocked** * **counterpartyAccountInvalid** * **unknown** + * + * @param disabledReason A machine-readable code identifying the reason the system deactivated the + * top-up configuration. This field is only populated when the status is `inactive`. + * Possible values: * **transferInstrumentDoesNotExist** * **directDebitNotSupported** * + * **accountHierarchyNotActive** * **mandateNotFound** * **mandateNotActive** * + * **directDebitAmountThresholdExceeded** * **topUpNotSupported** * **routeNotFound** * + * **counterpartyAccountBlocked** * **counterpartyAccountInvalid** * **unknown** + */ + @JsonProperty(JSON_PROPERTY_DISABLED_REASON) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setDisabledReason(String disabledReason) { + this.disabledReason = disabledReason; + } + + /** + * The unique identifier of the recurring top-up configuration. + * + * @param id The unique identifier of the recurring top-up configuration. + * @return the current {@code WebhookTopUpConfigurationUpdated} instance, allowing for method + * chaining + */ + public WebhookTopUpConfigurationUpdated id(String id) { + this.id = id; + return this; + } + + /** + * The unique identifier of the recurring top-up configuration. + * + * @return id The unique identifier of the recurring top-up configuration. + */ + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getId() { + return id; + } + + /** + * The unique identifier of the recurring top-up configuration. + * + * @param id The unique identifier of the recurring top-up configuration. + */ + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setId(String id) { + this.id = id; + } + + /** + * mandate + * + * @param mandate + * @return the current {@code WebhookTopUpConfigurationUpdated} instance, allowing for method + * chaining + */ + public WebhookTopUpConfigurationUpdated mandate(WebhookTopUpMandate mandate) { + this.mandate = mandate; + return this; + } + + /** + * Get mandate + * + * @return mandate + */ + @JsonProperty(JSON_PROPERTY_MANDATE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public WebhookTopUpMandate getMandate() { + return mandate; + } + + /** + * mandate + * + * @param mandate + */ + @JsonProperty(JSON_PROPERTY_MANDATE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setMandate(WebhookTopUpMandate mandate) { + this.mandate = mandate; + } + + /** + * A human-readable description providing the specific reason or context for why the configuration + * was disabled. This field is only populated when the status is `inactive`. + * + * @param reasonDetail A human-readable description providing the specific reason or context for + * why the configuration was disabled. This field is only populated when the status is + * `inactive`. + * @return the current {@code WebhookTopUpConfigurationUpdated} instance, allowing for method + * chaining + */ + public WebhookTopUpConfigurationUpdated reasonDetail(String reasonDetail) { + this.reasonDetail = reasonDetail; + return this; + } + + /** + * A human-readable description providing the specific reason or context for why the configuration + * was disabled. This field is only populated when the status is `inactive`. + * + * @return reasonDetail A human-readable description providing the specific reason or context for + * why the configuration was disabled. This field is only populated when the status is + * `inactive`. + */ + @JsonProperty(JSON_PROPERTY_REASON_DETAIL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getReasonDetail() { + return reasonDetail; + } + + /** + * A human-readable description providing the specific reason or context for why the configuration + * was disabled. This field is only populated when the status is `inactive`. + * + * @param reasonDetail A human-readable description providing the specific reason or context for + * why the configuration was disabled. This field is only populated when the status is + * `inactive`. + */ + @JsonProperty(JSON_PROPERTY_REASON_DETAIL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setReasonDetail(String reasonDetail) { + this.reasonDetail = reasonDetail; + } + + /** + * A reference that is sent to the recipient. This reference is also sent in all webhooks related + * to the transfer, so you can use it to track statuses for both parties involved in the funds + * movement. Supported characters: **a-z**, **A-Z**, **0-9**. + * + * @param referenceForBeneficiary A reference that is sent to the recipient. This reference is + * also sent in all webhooks related to the transfer, so you can use it to track statuses for + * both parties involved in the funds movement. Supported characters: **a-z**, **A-Z**, + * **0-9**. + * @return the current {@code WebhookTopUpConfigurationUpdated} instance, allowing for method + * chaining + */ + public WebhookTopUpConfigurationUpdated referenceForBeneficiary(String referenceForBeneficiary) { + this.referenceForBeneficiary = referenceForBeneficiary; + return this; + } + + /** + * A reference that is sent to the recipient. This reference is also sent in all webhooks related + * to the transfer, so you can use it to track statuses for both parties involved in the funds + * movement. Supported characters: **a-z**, **A-Z**, **0-9**. + * + * @return referenceForBeneficiary A reference that is sent to the recipient. This reference is + * also sent in all webhooks related to the transfer, so you can use it to track statuses for + * both parties involved in the funds movement. Supported characters: **a-z**, **A-Z**, + * **0-9**. + */ + @JsonProperty(JSON_PROPERTY_REFERENCE_FOR_BENEFICIARY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getReferenceForBeneficiary() { + return referenceForBeneficiary; + } + + /** + * A reference that is sent to the recipient. This reference is also sent in all webhooks related + * to the transfer, so you can use it to track statuses for both parties involved in the funds + * movement. Supported characters: **a-z**, **A-Z**, **0-9**. + * + * @param referenceForBeneficiary A reference that is sent to the recipient. This reference is + * also sent in all webhooks related to the transfer, so you can use it to track statuses for + * both parties involved in the funds movement. Supported characters: **a-z**, **A-Z**, + * **0-9**. + */ + @JsonProperty(JSON_PROPERTY_REFERENCE_FOR_BENEFICIARY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setReferenceForBeneficiary(String referenceForBeneficiary) { + this.referenceForBeneficiary = referenceForBeneficiary; + } + + /** + * The status of the top-up configuration. Possible values: * **active**: the top-up is enabled + * and funds are pulled in. * **inactive**: the top-up is disabled and cannot be triggered. + * + * @param status The status of the top-up configuration. Possible values: * **active**: the top-up + * is enabled and funds are pulled in. * **inactive**: the top-up is disabled and cannot be + * triggered. + * @return the current {@code WebhookTopUpConfigurationUpdated} instance, allowing for method + * chaining + */ + public WebhookTopUpConfigurationUpdated status(StatusEnum status) { + this.status = status; + return this; + } + + /** + * The status of the top-up configuration. Possible values: * **active**: the top-up is enabled + * and funds are pulled in. * **inactive**: the top-up is disabled and cannot be triggered. + * + * @return status The status of the top-up configuration. Possible values: * **active**: the + * top-up is enabled and funds are pulled in. * **inactive**: the top-up is disabled and + * cannot be triggered. + */ + @JsonProperty(JSON_PROPERTY_STATUS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public StatusEnum getStatus() { + return status; + } + + /** + * The status of the top-up configuration. Possible values: * **active**: the top-up is enabled + * and funds are pulled in. * **inactive**: the top-up is disabled and cannot be triggered. + * + * @param status The status of the top-up configuration. Possible values: * **active**: the top-up + * is enabled and funds are pulled in. * **inactive**: the top-up is disabled and cannot be + * triggered. + */ + @JsonProperty(JSON_PROPERTY_STATUS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setStatus(StatusEnum status) { + this.status = status; + } + + /** + * topUpAmount + * + * @param topUpAmount + * @return the current {@code WebhookTopUpConfigurationUpdated} instance, allowing for method + * chaining + */ + public WebhookTopUpConfigurationUpdated topUpAmount(WebhookTopUpAmount topUpAmount) { + this.topUpAmount = topUpAmount; + return this; + } + + /** + * Get topUpAmount + * + * @return topUpAmount + */ + @JsonProperty(JSON_PROPERTY_TOP_UP_AMOUNT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public WebhookTopUpAmount getTopUpAmount() { + return topUpAmount; + } + + /** + * topUpAmount + * + * @param topUpAmount + */ + @JsonProperty(JSON_PROPERTY_TOP_UP_AMOUNT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setTopUpAmount(WebhookTopUpAmount topUpAmount) { + this.topUpAmount = topUpAmount; + } + + /** + * trigger + * + * @param trigger + * @return the current {@code WebhookTopUpConfigurationUpdated} instance, allowing for method + * chaining + */ + public WebhookTopUpConfigurationUpdated trigger(WebhookTopUpTrigger trigger) { + this.trigger = trigger; + return this; + } + + /** + * Get trigger + * + * @return trigger + */ + @JsonProperty(JSON_PROPERTY_TRIGGER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public WebhookTopUpTrigger getTrigger() { + return trigger; + } + + /** + * trigger + * + * @param trigger + */ + @JsonProperty(JSON_PROPERTY_TRIGGER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setTrigger(WebhookTopUpTrigger trigger) { + this.trigger = trigger; + } + + /** Return true if this WebhookTopUpConfigurationUpdated object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + WebhookTopUpConfigurationUpdated webhookTopUpConfigurationUpdated = + (WebhookTopUpConfigurationUpdated) o; + return Objects.equals(this.counterparty, webhookTopUpConfigurationUpdated.counterparty) + && Objects.equals(this.description, webhookTopUpConfigurationUpdated.description) + && Objects.equals(this.disabledReason, webhookTopUpConfigurationUpdated.disabledReason) + && Objects.equals(this.id, webhookTopUpConfigurationUpdated.id) + && Objects.equals(this.mandate, webhookTopUpConfigurationUpdated.mandate) + && Objects.equals(this.reasonDetail, webhookTopUpConfigurationUpdated.reasonDetail) + && Objects.equals( + this.referenceForBeneficiary, webhookTopUpConfigurationUpdated.referenceForBeneficiary) + && Objects.equals(this.status, webhookTopUpConfigurationUpdated.status) + && Objects.equals(this.topUpAmount, webhookTopUpConfigurationUpdated.topUpAmount) + && Objects.equals(this.trigger, webhookTopUpConfigurationUpdated.trigger); + } + + @Override + public int hashCode() { + return Objects.hash( + counterparty, + description, + disabledReason, + id, + mandate, + reasonDetail, + referenceForBeneficiary, + status, + topUpAmount, + trigger); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class WebhookTopUpConfigurationUpdated {\n"); + sb.append(" counterparty: ").append(toIndentedString(counterparty)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" disabledReason: ").append(toIndentedString(disabledReason)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" mandate: ").append(toIndentedString(mandate)).append("\n"); + sb.append(" reasonDetail: ").append(toIndentedString(reasonDetail)).append("\n"); + sb.append(" referenceForBeneficiary: ") + .append(toIndentedString(referenceForBeneficiary)) + .append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" topUpAmount: ").append(toIndentedString(topUpAmount)).append("\n"); + sb.append(" trigger: ").append(toIndentedString(trigger)).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 WebhookTopUpConfigurationUpdated given an JSON string + * + * @param jsonString JSON string + * @return An instance of WebhookTopUpConfigurationUpdated + * @throws JsonProcessingException if the JSON string is invalid with respect to + * WebhookTopUpConfigurationUpdated + */ + public static WebhookTopUpConfigurationUpdated fromJson(String jsonString) + throws JsonProcessingException { + return JSON.getMapper().readValue(jsonString, WebhookTopUpConfigurationUpdated.class); + } + + /** + * Convert an instance of WebhookTopUpConfigurationUpdated 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/configurationwebhooks/WebhookTopUpCounterparty.java b/src/main/java/com/adyen/model/configurationwebhooks/WebhookTopUpCounterparty.java new file mode 100644 index 000000000..db6bfa186 --- /dev/null +++ b/src/main/java/com/adyen/model/configurationwebhooks/WebhookTopUpCounterparty.java @@ -0,0 +1,124 @@ +/* + * Configuration webhooks + * + * The version of the OpenAPI document: 2 + * + * + * 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.configurationwebhooks; + +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.*; + +/** WebhookTopUpCounterparty */ +@JsonPropertyOrder({WebhookTopUpCounterparty.JSON_PROPERTY_TRANSFER_INSTRUMENT_ID}) +public class WebhookTopUpCounterparty { + public static final String JSON_PROPERTY_TRANSFER_INSTRUMENT_ID = "transferInstrumentId"; + private String transferInstrumentId; + + public WebhookTopUpCounterparty() {} + + /** + * The unique identifier of the transfer instrument that is the source of the funds. + * + * @param transferInstrumentId The unique identifier of the transfer instrument that is the source + * of the funds. + * @return the current {@code WebhookTopUpCounterparty} instance, allowing for method chaining + */ + public WebhookTopUpCounterparty transferInstrumentId(String transferInstrumentId) { + this.transferInstrumentId = transferInstrumentId; + return this; + } + + /** + * The unique identifier of the transfer instrument that is the source of the funds. + * + * @return transferInstrumentId The unique identifier of the transfer instrument that is the + * source of the funds. + */ + @JsonProperty(JSON_PROPERTY_TRANSFER_INSTRUMENT_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getTransferInstrumentId() { + return transferInstrumentId; + } + + /** + * The unique identifier of the transfer instrument that is the source of the funds. + * + * @param transferInstrumentId The unique identifier of the transfer instrument that is the source + * of the funds. + */ + @JsonProperty(JSON_PROPERTY_TRANSFER_INSTRUMENT_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setTransferInstrumentId(String transferInstrumentId) { + this.transferInstrumentId = transferInstrumentId; + } + + /** Return true if this WebhookTopUpCounterparty object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + WebhookTopUpCounterparty webhookTopUpCounterparty = (WebhookTopUpCounterparty) o; + return Objects.equals(this.transferInstrumentId, webhookTopUpCounterparty.transferInstrumentId); + } + + @Override + public int hashCode() { + return Objects.hash(transferInstrumentId); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class WebhookTopUpCounterparty {\n"); + sb.append(" transferInstrumentId: ") + .append(toIndentedString(transferInstrumentId)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Create an instance of WebhookTopUpCounterparty given an JSON string + * + * @param jsonString JSON string + * @return An instance of WebhookTopUpCounterparty + * @throws JsonProcessingException if the JSON string is invalid with respect to + * WebhookTopUpCounterparty + */ + public static WebhookTopUpCounterparty fromJson(String jsonString) + throws JsonProcessingException { + return JSON.getMapper().readValue(jsonString, WebhookTopUpCounterparty.class); + } + + /** + * Convert an instance of WebhookTopUpCounterparty 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/configurationwebhooks/WebhookTopUpMandate.java b/src/main/java/com/adyen/model/configurationwebhooks/WebhookTopUpMandate.java new file mode 100644 index 000000000..62fd29d4c --- /dev/null +++ b/src/main/java/com/adyen/model/configurationwebhooks/WebhookTopUpMandate.java @@ -0,0 +1,166 @@ +/* + * Configuration webhooks + * + * The version of the OpenAPI document: 2 + * + * + * 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.configurationwebhooks; + +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.*; + +/** WebhookTopUpMandate */ +@JsonPropertyOrder({ + WebhookTopUpMandate.JSON_PROPERTY_CREATION_DATE, + WebhookTopUpMandate.JSON_PROPERTY_REFERENCE +}) +public class WebhookTopUpMandate { + public static final String JSON_PROPERTY_CREATION_DATE = "creationDate"; + private OffsetDateTime creationDate; + + public static final String JSON_PROPERTY_REFERENCE = "reference"; + private String reference; + + public WebhookTopUpMandate() {} + + /** + * The date when the mandate was created, in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) + * format. + * + * @param creationDate The date when the mandate was created, in [ISO + * 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + * @return the current {@code WebhookTopUpMandate} instance, allowing for method chaining + */ + public WebhookTopUpMandate creationDate(OffsetDateTime creationDate) { + this.creationDate = creationDate; + return this; + } + + /** + * The date when the mandate was created, in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) + * format. + * + * @return creationDate The date when the mandate was created, in [ISO + * 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + */ + @JsonProperty(JSON_PROPERTY_CREATION_DATE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OffsetDateTime getCreationDate() { + return creationDate; + } + + /** + * The date when the mandate was created, in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) + * format. + * + * @param creationDate The date when the mandate was created, in [ISO + * 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + */ + @JsonProperty(JSON_PROPERTY_CREATION_DATE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setCreationDate(OffsetDateTime creationDate) { + this.creationDate = creationDate; + } + + /** + * The unique identifier of the mandate. + * + * @param reference The unique identifier of the mandate. + * @return the current {@code WebhookTopUpMandate} instance, allowing for method chaining + */ + public WebhookTopUpMandate reference(String reference) { + this.reference = reference; + return this; + } + + /** + * The unique identifier of the mandate. + * + * @return reference The unique identifier of the mandate. + */ + @JsonProperty(JSON_PROPERTY_REFERENCE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getReference() { + return reference; + } + + /** + * The unique identifier of the mandate. + * + * @param reference The unique identifier of the mandate. + */ + @JsonProperty(JSON_PROPERTY_REFERENCE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setReference(String reference) { + this.reference = reference; + } + + /** Return true if this WebhookTopUpMandate object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + WebhookTopUpMandate webhookTopUpMandate = (WebhookTopUpMandate) o; + return Objects.equals(this.creationDate, webhookTopUpMandate.creationDate) + && Objects.equals(this.reference, webhookTopUpMandate.reference); + } + + @Override + public int hashCode() { + return Objects.hash(creationDate, reference); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class WebhookTopUpMandate {\n"); + sb.append(" creationDate: ").append(toIndentedString(creationDate)).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 WebhookTopUpMandate given an JSON string + * + * @param jsonString JSON string + * @return An instance of WebhookTopUpMandate + * @throws JsonProcessingException if the JSON string is invalid with respect to + * WebhookTopUpMandate + */ + public static WebhookTopUpMandate fromJson(String jsonString) throws JsonProcessingException { + return JSON.getMapper().readValue(jsonString, WebhookTopUpMandate.class); + } + + /** + * Convert an instance of WebhookTopUpMandate 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/configurationwebhooks/WebhookTopUpTrigger.java b/src/main/java/com/adyen/model/configurationwebhooks/WebhookTopUpTrigger.java new file mode 100644 index 000000000..5f26fedf2 --- /dev/null +++ b/src/main/java/com/adyen/model/configurationwebhooks/WebhookTopUpTrigger.java @@ -0,0 +1,225 @@ +/* + * Configuration webhooks + * + * The version of the OpenAPI document: 2 + * + * + * 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.configurationwebhooks; + +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.util.*; +import java.util.Arrays; +import java.util.logging.Logger; + +/** WebhookTopUpTrigger */ +@JsonPropertyOrder({ + WebhookTopUpTrigger.JSON_PROPERTY_SCHEDULE, + WebhookTopUpTrigger.JSON_PROPERTY_THRESHOLD +}) +public class WebhookTopUpTrigger { + /** + * The schedule for recurring top-ups. Defines when the top-up should be triggered based on time. + * Possible values: * **weekly**: triggers the top-up once per week. * **monthly**: triggers the + * top-up once per month. * **weekdays**: triggers the top-up on weekdays only. + */ + public enum ScheduleEnum { + MONTHLY(String.valueOf("monthly")), + + WEEKDAYS(String.valueOf("weekdays")), + + WEEKLY(String.valueOf("weekly")); + + private static final Logger LOG = Logger.getLogger(ScheduleEnum.class.getName()); + + private String value; + + ScheduleEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static ScheduleEnum fromValue(String value) { + for (ScheduleEnum b : ScheduleEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + // handling unexpected value + LOG.warning( + "ScheduleEnum: unexpected enum value '" + + value + + "' - Supported values are " + + Arrays.toString(ScheduleEnum.values())); + return null; + } + } + + public static final String JSON_PROPERTY_SCHEDULE = "schedule"; + private ScheduleEnum schedule; + + public static final String JSON_PROPERTY_THRESHOLD = "threshold"; + private WebhookAmount threshold; + + public WebhookTopUpTrigger() {} + + /** + * The schedule for recurring top-ups. Defines when the top-up should be triggered based on time. + * Possible values: * **weekly**: triggers the top-up once per week. * **monthly**: triggers the + * top-up once per month. * **weekdays**: triggers the top-up on weekdays only. + * + * @param schedule The schedule for recurring top-ups. Defines when the top-up should be triggered + * based on time. Possible values: * **weekly**: triggers the top-up once per week. * + * **monthly**: triggers the top-up once per month. * **weekdays**: triggers the top-up on + * weekdays only. + * @return the current {@code WebhookTopUpTrigger} instance, allowing for method chaining + */ + public WebhookTopUpTrigger schedule(ScheduleEnum schedule) { + this.schedule = schedule; + return this; + } + + /** + * The schedule for recurring top-ups. Defines when the top-up should be triggered based on time. + * Possible values: * **weekly**: triggers the top-up once per week. * **monthly**: triggers the + * top-up once per month. * **weekdays**: triggers the top-up on weekdays only. + * + * @return schedule The schedule for recurring top-ups. Defines when the top-up should be + * triggered based on time. Possible values: * **weekly**: triggers the top-up once per week. + * * **monthly**: triggers the top-up once per month. * **weekdays**: triggers the top-up on + * weekdays only. + */ + @JsonProperty(JSON_PROPERTY_SCHEDULE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public ScheduleEnum getSchedule() { + return schedule; + } + + /** + * The schedule for recurring top-ups. Defines when the top-up should be triggered based on time. + * Possible values: * **weekly**: triggers the top-up once per week. * **monthly**: triggers the + * top-up once per month. * **weekdays**: triggers the top-up on weekdays only. + * + * @param schedule The schedule for recurring top-ups. Defines when the top-up should be triggered + * based on time. Possible values: * **weekly**: triggers the top-up once per week. * + * **monthly**: triggers the top-up once per month. * **weekdays**: triggers the top-up on + * weekdays only. + */ + @JsonProperty(JSON_PROPERTY_SCHEDULE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setSchedule(ScheduleEnum schedule) { + this.schedule = schedule; + } + + /** + * threshold + * + * @param threshold + * @return the current {@code WebhookTopUpTrigger} instance, allowing for method chaining + */ + public WebhookTopUpTrigger threshold(WebhookAmount threshold) { + this.threshold = threshold; + return this; + } + + /** + * Get threshold + * + * @return threshold + */ + @JsonProperty(JSON_PROPERTY_THRESHOLD) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public WebhookAmount getThreshold() { + return threshold; + } + + /** + * threshold + * + * @param threshold + */ + @JsonProperty(JSON_PROPERTY_THRESHOLD) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setThreshold(WebhookAmount threshold) { + this.threshold = threshold; + } + + /** Return true if this WebhookTopUpTrigger object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + WebhookTopUpTrigger webhookTopUpTrigger = (WebhookTopUpTrigger) o; + return Objects.equals(this.schedule, webhookTopUpTrigger.schedule) + && Objects.equals(this.threshold, webhookTopUpTrigger.threshold); + } + + @Override + public int hashCode() { + return Objects.hash(schedule, threshold); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class WebhookTopUpTrigger {\n"); + sb.append(" schedule: ").append(toIndentedString(schedule)).append("\n"); + sb.append(" threshold: ").append(toIndentedString(threshold)).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 WebhookTopUpTrigger given an JSON string + * + * @param jsonString JSON string + * @return An instance of WebhookTopUpTrigger + * @throws JsonProcessingException if the JSON string is invalid with respect to + * WebhookTopUpTrigger + */ + public static WebhookTopUpTrigger fromJson(String jsonString) throws JsonProcessingException { + return JSON.getMapper().readValue(jsonString, WebhookTopUpTrigger.class); + } + + /** + * Convert an instance of WebhookTopUpTrigger 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 e3285f5c9..b90dd4974 100644 --- a/src/test/java/com/adyen/webhooks/BalancePlatformWebhooksTest.java +++ b/src/test/java/com/adyen/webhooks/BalancePlatformWebhooksTest.java @@ -28,6 +28,7 @@ import com.adyen.model.transferwebhooks.TransferWebhooksHandler; import com.adyen.util.HMACValidator; import java.security.SignatureException; +import java.time.OffsetDateTime; import java.util.Optional; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; @@ -619,6 +620,11 @@ public void testMandateCreatedNotificationRequest() { assertEquals(Mandate.StatusEnum.APPROVED, request.getData().getMandate().getStatus()); assertEquals(Mandate.TypeEnum.BACS, request.getData().getMandate().getType()); + // createdAt and updatedAt are now deserialized as OffsetDateTime + OffsetDateTime expectedDate = OffsetDateTime.parse("2025-09-04T13:40:41.581Z"); + assertEquals(expectedDate, request.getData().getMandate().getCreatedAt()); + assertEquals(expectedDate, request.getData().getMandate().getUpdatedAt()); + assertNotNull(request.getData().getMandate().getCounterparty()); assertNotNull(request.getData().getMandate().getCounterparty().getAccountHolder()); assertEquals( @@ -638,4 +644,173 @@ public void testMandateCreatedNotificationRequest() { assertEquals("405081", ukLocalAccountId.getSortCode()); assertEquals(UKLocalMandateAccountIdentification.TypeEnum.UKLOCAL, ukLocalAccountId.getType()); } + + @Test + public void testMandateNotificationWithInvalidDates() { + String json = + "{\"data\":{\"balancePlatform\":\"YOUR_BALANCE_PLATFORM\",\"mandate\":{" + + "\"id\":\"MNDT000000000000000000000001\",\"status\":\"approved\",\"type\":\"bacs\"," + + "\"createdAt\":\"not-a-date\",\"updatedAt\":\"not-a-date\"}}," + + "\"environment\":\"test\",\"type\":\"balancePlatform.mandate.created\"}"; + + ConfigurationWebhooksHandler handler = new ConfigurationWebhooksHandler(json); + // createdAt/updatedAt are now OffsetDateTime, an invalid date fails deserialization + assertFalse(handler.getMandateNotificationRequest().isPresent()); + } + + @Test + public void testMandateNotificationWithUnknownAccountIdentificationType() { + String json = + "{\"data\":{\"balancePlatform\":\"YOUR_BALANCE_PLATFORM\",\"mandate\":{" + + "\"id\":\"MNDT000000000000000000000001\",\"status\":\"approved\",\"type\":\"bacs\"," + + "\"counterparty\":{\"accountIdentification\":{\"type\":\"unknownType\"}}}}," + + "\"environment\":\"test\",\"type\":\"balancePlatform.mandate.created\"}"; + + ConfigurationWebhooksHandler handler = new ConfigurationWebhooksHandler(json); + // an unknown account identification discriminator type fails deserialization + assertFalse(handler.getMandateNotificationRequest().isPresent()); + } + + @Test + public void testPaymentInstrumentIbanAdditionalBankAccountIdentification() { + String json = + getFileContents( + "mocks/balancePlatform-webhooks/configuration-paymentInstrument-created.json"); + + ConfigurationWebhooksHandler handler = new ConfigurationWebhooksHandler(json); + Optional optionalRequest = handler.getPaymentNotificationRequest(); + assertTrue(optionalRequest.isPresent()); + + PaymentNotificationRequest request = optionalRequest.get(); + assertEquals( + PaymentNotificationRequest.TypeEnum.BALANCEPLATFORM_PAYMENTINSTRUMENT_CREATED, + request.getType()); + assertEquals("test", request.getEnvironment()); + + PaymentInstrument paymentInstrument = request.getData().getPaymentInstrument(); + assertNotNull(paymentInstrument); + assertEquals("PI00000000000000000001", paymentInstrument.getId()); + assertNotNull(paymentInstrument.getAdditionalBankAccountIdentifications()); + assertEquals(1, paymentInstrument.getAdditionalBankAccountIdentifications().size()); + + // the discriminator (type=iban) resolves to IbanAccountIdentification + IbanAccountIdentification ibanAccountIdentification = + paymentInstrument + .getAdditionalBankAccountIdentifications() + .get(0) + .getIbanAccountIdentification(); + assertNotNull(ibanAccountIdentification); + assertEquals("NL11ADYB00000000", ibanAccountIdentification.getIban()); + assertEquals(IbanAccountIdentification.TypeEnum.IBAN, ibanAccountIdentification.getType()); + } + + @Test + public void testPaymentInstrumentUnknownAdditionalBankAccountIdentificationType() { + String json = + "{\"data\":{\"balancePlatform\":\"YOUR_BALANCE_PLATFORM\",\"paymentInstrument\":{" + + "\"id\":\"PI00000000000000000001\",\"balanceAccountId\":\"BA00000000000000000001\"," + + "\"issuingCountryCode\":\"NL\",\"status\":\"active\",\"type\":\"bankAccount\"," + + "\"additionalBankAccountIdentifications\":[{\"type\":\"unknownType\"}]}}," + + "\"environment\":\"test\",\"type\":\"balancePlatform.paymentInstrument.created\"}"; + + ConfigurationWebhooksHandler handler = new ConfigurationWebhooksHandler(json); + // an unknown additional bank account identification discriminator type fails deserialization + assertFalse(handler.getPaymentNotificationRequest().isPresent()); + } + + @Test + public void testTopUpConfigurationCreatedNotificationRequest() { + String json = + getFileContents( + "mocks/balancePlatform-webhooks/balanceplatform-recurringTopUp-created.json"); + + ConfigurationWebhooksHandler handler = new ConfigurationWebhooksHandler(json); + Optional optionalRequest = + handler.getTopUpConfigurationEventRequest(); + assertTrue(optionalRequest.isPresent()); + + TopUpConfigurationEventRequest request = optionalRequest.get(); + assertEquals( + TopUpConfigurationEventRequest.TypeEnum + .BALANCEPLATFORM_BALANCEACCOUNT_RECURRINGTOPUP_CREATED, + request.getType()); + assertEquals("test", request.getEnvironment()); + assertNotNull(request.getTimestamp()); + + TopUpWebhookData data = request.getData(); + assertNotNull(data); + assertEquals("BA00000000000000000001", data.getAccountId()); + assertEquals("YOUR_BALANCE_PLATFORM", data.getBalancePlatform()); + assertNotNull(data.getCreationDate()); + + WebhookTopUpConfiguration config = data.getWebhookTopUpConfiguration(); + assertNotNull(config); + assertEquals("TU4227C224555B5FTD2NT2JV4WN5", config.getId()); + assertEquals("Top up when balance is low", config.getDescription()); + assertEquals("TopUpFromSavings", config.getReferenceForBeneficiary()); + assertEquals(WebhookTopUpConfiguration.StatusEnum.ACTIVE, config.getStatus()); + + assertNotNull(config.getCounterparty()); + assertEquals("SE00000000000000000001", config.getCounterparty().getTransferInstrumentId()); + + assertNotNull(config.getMandate()); + assertEquals("MND00000000000000000001", config.getMandate().getReference()); + assertNotNull(config.getMandate().getCreationDate()); + + assertNotNull(config.getTopUpAmount()); + assertEquals("EUR", config.getTopUpAmount().getFixedAmount().getCurrency()); + assertEquals(Long.valueOf(10000), config.getTopUpAmount().getFixedAmount().getValue()); + + assertNotNull(config.getTrigger()); + assertEquals(WebhookTopUpTrigger.ScheduleEnum.WEEKLY, config.getTrigger().getSchedule()); + assertEquals(Long.valueOf(5000), config.getTrigger().getThreshold().getValue()); + } + + @Test + public void testTopUpConfigurationUpdatedNotificationRequest() { + String json = + getFileContents( + "mocks/balancePlatform-webhooks/balanceplatform-recurringTopUp-updated.json"); + + ConfigurationWebhooksHandler handler = new ConfigurationWebhooksHandler(json); + Optional optionalRequest = + handler.getTopUpConfigurationUpdatedEventRequest(); + assertTrue(optionalRequest.isPresent()); + + TopUpConfigurationUpdatedEventRequest request = optionalRequest.get(); + assertEquals( + TopUpConfigurationUpdatedEventRequest.TypeEnum + .BALANCEPLATFORM_BALANCEACCOUNT_RECURRINGTOPUP_UPDATED, + request.getType()); + assertEquals("test", request.getEnvironment()); + assertNotNull(request.getTimestamp()); + + TopUpUpdatedWebhookData data = request.getData(); + assertNotNull(data); + assertEquals("BA00000000000000000001", data.getAccountId()); + assertEquals("YOUR_BALANCE_PLATFORM", data.getBalancePlatform()); + + WebhookTopUpConfigurationUpdated config = data.getWebhookTopUpConfiguration(); + assertNotNull(config); + assertEquals("Top up when balance is low - updated", config.getDescription()); + assertEquals(WebhookTopUpConfigurationUpdated.StatusEnum.INACTIVE, config.getStatus()); + assertEquals("counterpartyAccountBlocked", config.getDisabledReason()); + assertEquals("The counterparty account is blocked.", config.getReasonDetail()); + assertEquals(Long.valueOf(15000), config.getTopUpAmount().getFixedAmount().getValue()); + assertEquals(WebhookTopUpTrigger.ScheduleEnum.MONTHLY, config.getTrigger().getSchedule()); + assertEquals(Long.valueOf(3000), config.getTrigger().getThreshold().getValue()); + } + + @Test + public void testTopUpConfigurationWithUnknownTypeReturnsEmpty() { + String json = + "{\"data\":{\"balancePlatform\":\"YOUR_BALANCE_PLATFORM\"}," + + "\"environment\":\"test\"," + + "\"type\":\"balancePlatform.balanceAccount.recurringTopUp.unknown\"}"; + + ConfigurationWebhooksHandler handler = new ConfigurationWebhooksHandler(json); + // an unknown event type does not match the TopUp created/updated type enums + assertFalse(handler.getTopUpConfigurationEventRequest().isPresent()); + assertFalse(handler.getTopUpConfigurationUpdatedEventRequest().isPresent()); + } } diff --git a/src/test/resources/mocks/balancePlatform-webhooks/balanceplatform-recurringTopUp-created.json b/src/test/resources/mocks/balancePlatform-webhooks/balanceplatform-recurringTopUp-created.json new file mode 100644 index 000000000..672ef456d --- /dev/null +++ b/src/test/resources/mocks/balancePlatform-webhooks/balanceplatform-recurringTopUp-created.json @@ -0,0 +1,36 @@ +{ + "data": { + "balancePlatform": "YOUR_BALANCE_PLATFORM", + "creationDate": "2026-04-17T10:30:00+01:00", + "accountId": "BA00000000000000000001", + "webhookTopUpConfiguration": { + "id": "TU4227C224555B5FTD2NT2JV4WN5", + "description": "Top up when balance is low", + "status": "active", + "topUpAmount": { + "fixedAmount": { + "currency": "EUR", + "value": 10000 + } + }, + "trigger": { + "schedule": "weekly", + "threshold": { + "currency": "EUR", + "value": 5000 + } + }, + "counterparty": { + "transferInstrumentId": "SE00000000000000000001" + }, + "referenceForBeneficiary": "TopUpFromSavings", + "mandate": { + "reference": "MND00000000000000000001", + "creationDate": "2026-04-17T10:30:00+01:00" + } + } + }, + "environment": "test", + "timestamp": "2026-04-17T10:30:00+01:00", + "type": "balancePlatform.balanceAccount.recurringTopUp.created" +} diff --git a/src/test/resources/mocks/balancePlatform-webhooks/balanceplatform-recurringTopUp-updated.json b/src/test/resources/mocks/balancePlatform-webhooks/balanceplatform-recurringTopUp-updated.json new file mode 100644 index 000000000..eb1a7b7d3 --- /dev/null +++ b/src/test/resources/mocks/balancePlatform-webhooks/balanceplatform-recurringTopUp-updated.json @@ -0,0 +1,38 @@ +{ + "data": { + "balancePlatform": "YOUR_BALANCE_PLATFORM", + "creationDate": "2026-04-17T10:30:00+01:00", + "accountId": "BA00000000000000000001", + "webhookTopUpConfiguration": { + "id": "TU4227C224555B5FTD2NT2JV4WN5", + "description": "Top up when balance is low - updated", + "status": "inactive", + "topUpAmount": { + "fixedAmount": { + "currency": "EUR", + "value": 15000 + } + }, + "trigger": { + "schedule": "monthly", + "threshold": { + "currency": "EUR", + "value": 3000 + } + }, + "counterparty": { + "transferInstrumentId": "SE00000000000000000001" + }, + "referenceForBeneficiary": "TopUpFromSavings", + "mandate": { + "reference": "MND00000000000000000001", + "creationDate": "2026-04-17T10:30:00+01:00" + }, + "disabledReason": "counterpartyAccountBlocked", + "reasonDetail": "The counterparty account is blocked." + } + }, + "environment": "test", + "timestamp": "2026-04-17T14:45:00+01:00", + "type": "balancePlatform.balanceAccount.recurringTopUp.updated" +} diff --git a/src/test/resources/mocks/balancePlatform-webhooks/configuration-paymentInstrument-created.json b/src/test/resources/mocks/balancePlatform-webhooks/configuration-paymentInstrument-created.json new file mode 100644 index 000000000..4e0db3f62 --- /dev/null +++ b/src/test/resources/mocks/balancePlatform-webhooks/configuration-paymentInstrument-created.json @@ -0,0 +1,25 @@ +{ + "data": { + "balancePlatform": "YOUR_BALANCE_PLATFORM", + "paymentInstrument": { + "balanceAccountId": "BA00000000000000000001", + "issuingCountryCode": "NL", + "status": "active", + "type": "bankAccount", + "bankAccount": { + "type": "iban", + "iban": "NL11ADYB00000000" + }, + "additionalBankAccountIdentifications": [ + { + "type": "iban", + "iban": "NL11ADYB00000000" + } + ], + "id": "PI00000000000000000001" + } + }, + "environment": "test", + "timestamp": "2026-03-24T09:30:12+01:00", + "type": "balancePlatform.paymentInstrument.created" +}