diff --git a/Makefile b/Makefile index f2aba6e0b..b32a36100 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,7 @@ openapi-generator-cli:=java -jar $(openapi-generator-jar) generator:=java library:=jersey3 -modelGen:=balancecontrol balanceplatform binlookup checkout dataprotection legalentitymanagement management payment payout posterminalmanagement recurring transfers storedvalue configurationwebhooks reportwebhooks transferwebhooks +modelGen:=acswebhooks balancecontrol balanceplatform binlookup checkout dataprotection legalentitymanagement management payment payout posterminalmanagement recurring transfers storedvalue configurationwebhooks reportwebhooks transferwebhooks managementwebhooks models:=src/main/java/com/adyen/model output:=target/out @@ -39,9 +39,12 @@ marketpay/configuration: spec=NotificationConfigurationService-v6 marketpay/webhooks: spec=MarketPayNotificationService-v6 hop: spec=HopService-v6 # Balance Webhooks +acswebhooks: spec=BalancePlatformAcsNotification-v1 configurationwebhooks: spec=BalancePlatformConfigurationNotification-v1 reportwebhooks: spec=BalancePlatformReportNotification-v1 transferwebhooks: spec=BalancePlatformTransferNotification-v3 +# Management Webhooks +managementwebhooks: spec=ManagementNotificationService-v1 $(modelGen): target/spec $(openapi-generator-jar) rm -rf $(models)/$@ $(output) diff --git a/README.md b/README.md index 698556fa6..c21e01b7b 100644 --- a/README.md +++ b/README.md @@ -10,32 +10,34 @@ This is the officially supported Java library for using Adyen's APIs. The Library supports all APIs under the following services: -| API | Description | Service Name | Supported version | -|----------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------|-------------------| -| [BIN lookup API](https://docs.adyen.com/api-explorer/BinLookup/54/overview) | The BIN Lookup API provides endpoints for retrieving information based on a given BIN. | BinLookup | **v54** | -| [Capital API](https://docs.adyen.com/api-explorer/capital/3/overview) | Adyen Capital allows you to build an embedded financing offering for your users to serve their operational needs. | Capital | **v3** | -| [Checkout API](https://docs.adyen.com/api-explorer/Checkout/70/overview) | Our latest integration for accepting online payments. | Checkout | **v70** | -| [Configuration API](https://docs.adyen.com/api-explorer/balanceplatform/2/overview) | The Configuration API enables you to create a platform where you can onboard your users as account holders and create balance accounts, cards, and business accounts. | balanceplatform package subclasses | **v2** | -| [DataProtection API](https://docs.adyen.com/development-resources/data-protection-api) | Adyen Data Protection API provides a way for you to process [Subject Erasure Requests](https://gdpr-info.eu/art-17-gdpr/) as mandated in GDPR. Use our API to submit a request to delete shopper's data, including payment details and other related information (for example, delivery address or shopper email) | DataProtection | **v1** | -| [Legal Entity Management API](https://docs.adyen.com/api-explorer/legalentity/3/overview) | Manage legal entities that contain information required for verification. | legalentitymanagement package subclasses | **v3** | -| [Local/Cloud-based Terminal API](https://docs.adyen.com/point-of-sale/terminal-api-reference) | Our point-of-sale integration. | TerminalLocalAPI or TerminalCloudAPI | - | -| [Management API](https://docs.adyen.com/api-explorer/Management/1/overview) | Configure and manage your Adyen company and merchant accounts, stores, and payment terminals. | management package subclasses | **v1** | -| [Payments API](https://docs.adyen.com/api-explorer/Payment/68/overview) | Our classic integration for online payments. | Payment | **v68** | -| [Payouts API](https://docs.adyen.com/api-explorer/Payout/68/overview) | Endpoints for sending funds to your customers. | Payout | **v68** | -| [POS Terminal Management API](https://docs.adyen.com/api-explorer/postfmapi/1/overview) | Endpoints for managing your point-of-sale payment terminals. | TerminalManagement | **v1** | -| [Recurring API](https://docs.adyen.com/api-explorer/Recurring/68/overview) | Endpoints for managing saved payment details. | Recurring | **v68** | -| [Stored Value API](https://docs.adyen.com/payment-methods/gift-cards/stored-value-api) | Manage both online and point-of-sale gift cards and other stored-value cards. | StoredValue | **v46** | -| [Transfers API](https://docs.adyen.com/api-explorer/transfers/3/overview) | The Transfers API provides endpoints that can be used to get information about all your transactions, move funds within your balance platform or send funds from your balance platform to a transfer instrument. | Transfers | **v3** | -| [Webhooks](https://docs.adyen.com/api-explorer/Webhooks/1/overview) | Adyen uses webhooks to send notifications about payment status updates, newly available reports, and other events that can be subscribed to. For more information, refer to our [documentation](https://docs.adyen.com/development-resources/webhooks). | *Models only* | **v1** | +| API | Description | Service Name | Supported version | +|-----------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------|-------------------| +| [BIN lookup API](https://docs.adyen.com/api-explorer/BinLookup/54/overview) | The BIN Lookup API provides endpoints for retrieving information based on a given BIN. | BinLookup | **v54** | +| [Capital API](https://docs.adyen.com/api-explorer/capital/3/overview) | Adyen Capital allows you to build an embedded financing offering for your users to serve their operational needs. | Capital | **v3** | +| [Checkout API](https://docs.adyen.com/api-explorer/Checkout/70/overview) | Our latest integration for accepting online payments. | Checkout | **v70** | +| [Configuration API](https://docs.adyen.com/api-explorer/balanceplatform/2/overview) | The Configuration API enables you to create a platform where you can onboard your users as account holders and create balance accounts, cards, and business accounts. | balanceplatform package subclasses | **v2** | +| [DataProtection API](https://docs.adyen.com/development-resources/data-protection-api) | Adyen Data Protection API provides a way for you to process [Subject Erasure Requests](https://gdpr-info.eu/art-17-gdpr/) as mandated in GDPR. Use our API to submit a request to delete shopper's data, including payment details and other related information (for example, delivery address or shopper email) | DataProtection | **v1** | +| [Legal Entity Management API](https://docs.adyen.com/api-explorer/legalentity/3/overview) | Manage legal entities that contain information required for verification. | legalentitymanagement package subclasses | **v3** | +| [Local/Cloud-based Terminal API](https://docs.adyen.com/point-of-sale/terminal-api-reference) | Our point-of-sale integration. | TerminalLocalAPI or TerminalCloudAPI | - | +| [Management API](https://docs.adyen.com/api-explorer/Management/1/overview) | Configure and manage your Adyen company and merchant accounts, stores, and payment terminals. | management package subclasses | **v1** | +| [Payments API](https://docs.adyen.com/api-explorer/Payment/68/overview) | Our classic integration for online payments. | Payment | **v68** | +| [Payouts API](https://docs.adyen.com/api-explorer/Payout/68/overview) | Endpoints for sending funds to your customers. | Payout | **v68** | +| [POS Terminal Management API](https://docs.adyen.com/api-explorer/postfmapi/1/overview) | Endpoints for managing your point-of-sale payment terminals. | TerminalManagement | **v1** | +| [Recurring API](https://docs.adyen.com/api-explorer/Recurring/68/overview) | Endpoints for managing saved payment details. | Recurring | **v68** | +| [Stored Value API](https://docs.adyen.com/payment-methods/gift-cards/stored-value-api) | Manage both online and point-of-sale gift cards and other stored-value cards. | StoredValue | **v46** | +| [Transfers API](https://docs.adyen.com/api-explorer/transfers/3/overview) | The Transfers API provides endpoints that can be used to get information about all your transactions, move funds within your balance platform or send funds from your balance platform to a transfer instrument. | Transfers | **v3** | +| [Webhooks](https://docs.adyen.com/api-explorer/Webhooks/1/overview) | Adyen uses webhooks to send notifications about payment status updates, newly available reports, and other events that can be subscribed to. For more information, refer to our [documentation](https://docs.adyen.com/development-resources/webhooks). | *Models only* | **v1** | ## Supported Webhook versions The library supports all webhooks under the following model directories: -| Webhooks | Description | Model Name | Supported Version | -|---------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------|-------------------| -| [Configuration Webhooks](https://docs.adyen.com/api-explorer/balanceplatform-webhooks/1/overview) | You can use these webhooks to build your implementation. For example, you can use this information to update internal statuses when the status of a capability is changed. | [ConfigurationNotification](src/main/java/com/adyen/model/configurationNotification) | **v1** | -| [Transfer Webhooks](https://docs.adyen.com/api-explorer/transfer-webhooks/3/overview) | You can use these webhooks to build your implementation. For example, you can use this information to update balances in your own dashboards or to keep track of incoming funds. | [TransferNotification](src/main/java/com/adyen/model/transferNotification) | **v3** | -| [Report Webhooks](https://docs.adyen.com/api-explorer/report-webhooks/1/overview) | You can download reports programmatically by making an HTTP GET request, or manually from your Balance Platform Customer Area | [ReportNotification](src/main/java/com/adyen/model/reportNotification) | **v1** | -| [Notification Webhooks](https://docs.adyen.com/api-explorer/Webhooks/1/overview) | We use webhooks to send you updates about payment status updates, newly available reports, and other events that you can subscribe to. For more information, refer to our documentation | [Notification](src/main/java/com/adyen/model/notification) | **v1** | +| Webhooks | Description | Model Name | Supported Version | +|---------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------|-------------------| +| [Authentication Webhooks](https://docs.adyen.com/api-explorer/acs-webhook/1/overview) | Adyen sends this webhook when the process of cardholder authentication is finalized, whether it is completed successfully, fails, or expires. | [acswebhooks](src/main/java/com/adyen/model/acswebhooks) | **v1** | +| [Configuration Webhooks](https://docs.adyen.com/api-explorer/balanceplatform-webhooks/1/overview) | You can use these webhooks to build your implementation. For example, you can use this information to update internal statuses when the status of a capability is changed. | [configurationwebhooks](src/main/java/com/adyen/model/configurationwebhooks) | **v1** | +| [Transfer Webhooks](https://docs.adyen.com/api-explorer/transfer-webhooks/3/overview) | You can use these webhooks to build your implementation. For example, you can use this information to update balances in your own dashboards or to keep track of incoming funds. | [transferwebhooks](src/main/java/com/adyen/model/transferwebhooks) | **v3** | +| [Report Webhooks](https://docs.adyen.com/api-explorer/report-webhooks/1/overview) | You can download reports programmatically by making an HTTP GET request, or manually from your Balance Platform Customer Area | [reportwebhooks](src/main/java/com/adyen/model/reportwebhooks) | **v1** | +| [Notification Webhooks](https://docs.adyen.com/api-explorer/Webhooks/1/overview) | We use webhooks to send you updates about payment status updates, newly available reports, and other events that you can subscribe to. For more information, refer to our documentation | [notification](src/main/java/com/adyen/model/notification) | **v1** | +| [Management Webhooks](https://docs.adyen.com/api-explorer/ManagementNotification/1/overview) | Adyen uses webhooks to inform your system about events that happen with your Adyen company and merchant accounts, stores, payment terminals, and payment methods when using Management API | [managementwebhooks](src/main/java/com/adyen/model/managementwebhooks) | **v1** | For more information, refer to our [documentation](https://docs.adyen.com/) or the [API Explorer](https://docs.adyen.com/api-explorer/). @@ -56,7 +58,7 @@ You can use Maven and add this dependency to your project's POM: com.adyen adyen-java-api-library - 21.2.0 + 21.3.0 ``` @@ -163,7 +165,7 @@ if (notificationRequestItem.isPresent()) { } } ~~~~ -Or if you would like to deserialize the Banking Webhooks, first check if the payload is authentic: +If you would like to deserialize the Banking Webhooks, first check if the payload is authentic: ~~~~ java String payload = "WEBHOOK_PAYLOAD"; String signKey = "SIGNATURE_RETREIVED_FROM_CA"; @@ -184,6 +186,15 @@ webhookHandler.getBalanceAccountNotificationRequest().ifPresent((BalanceAccountN }); ~~~~ +To deserialize Management Webhooks instead, please use the specific webhook handler: +~~~~ java +ManagementWebhookHandler webhookHandler = new ManagementWebhookHandler(payload); +// onMerchantCreatedNotificationRequest +webhookHandler.getMerchantCreatedNotificationRequest().isPresent((MerchantCreatedNotificationRequest event) -> { +System.out.println(event.getData().getMerchantId()); +}); +~~~~ + ### Proxy configuration You can configure a proxy connection by injecting your own AdyenHttpClient on your client instance. diff --git a/pom.xml b/pom.xml index 117e1ed26..69f3c1aa2 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.adyen adyen-java-api-library jar - 21.2.0 + 21.3.0 Adyen Java API Library Adyen API Client Library for Java https://github.com/adyen/adyen-java-api-library @@ -218,7 +218,7 @@ org.mockito mockito-core - 5.4.0 + 5.5.0 test diff --git a/src/main/java/com/adyen/Client.java b/src/main/java/com/adyen/Client.java index d2de2e15b..822e91a40 100644 --- a/src/main/java/com/adyen/Client.java +++ b/src/main/java/com/adyen/Client.java @@ -30,10 +30,8 @@ public class Client { private ClientInterface httpClient; private Config config; - public static final String ENDPOINT_CERT_LIVE = "https://palcert-live.adyen.com"; public static final String LIB_NAME = "adyen-java-api-library"; - public static final String LIB_VERSION = "21.2.0"; - public static final String CHECKOUT_ENDPOINT_CERT_LIVE = "https://checkoutcert-live-%s.adyen.com/checkout"; + public static final String LIB_VERSION = "21.3.0"; public static final String TERMINAL_API_ENDPOINT_TEST = "https://terminal-api-test.adyen.com"; public static final String TERMINAL_API_ENDPOINT_LIVE = "https://terminal-api-live.adyen.com"; @@ -65,14 +63,6 @@ public Client(KeyStore trustStore, KeyStore clientKeyStore, String clientKeyStor this.config.setClientKeyStorePassword(clientKeyStorePassword); this.config.setClientKeyStore(clientKeyStore); this.config.setTrustKeyStore(trustStore); - this.config.setEndpoint(ENDPOINT_CERT_LIVE); - - if (region != null) { - this.config.setCheckoutEndpoint(String.format(CHECKOUT_ENDPOINT_CERT_LIVE, region.name().toLowerCase())); - } else { - // default to EU if not provided - this.config.setCheckoutEndpoint(String.format(CHECKOUT_ENDPOINT_CERT_LIVE, Region.EU.name().toLowerCase())); - } } public Client(String username, String password, Environment environment, String liveEndpointUrlPrefix, String applicationName) { diff --git a/src/main/java/com/adyen/Config.java b/src/main/java/com/adyen/Config.java index 7ef19e9b3..2b42b879d 100644 --- a/src/main/java/com/adyen/Config.java +++ b/src/main/java/com/adyen/Config.java @@ -35,9 +35,7 @@ public class Config { protected String username; protected String password; - protected String merchantAccount; protected Environment environment; - protected String endpoint; /** * Application name: used as HTTP client User-Agent @@ -47,9 +45,6 @@ public class Config { protected int connectionTimeoutMillis; protected int readTimeoutMillis; - //Checkout Specific - protected String checkoutEndpoint; - //Terminal API Specific protected String terminalApiCloudEndpoint; protected String terminalApiLocalEndpoint; @@ -81,14 +76,6 @@ public void setPassword(String password) { this.password = password; } - public String getMerchantAccount() { - return merchantAccount; - } - - public void setMerchantAccount(String merchantAccount) { - this.merchantAccount = merchantAccount; - } - public Environment getEnvironment() { return environment; } @@ -97,14 +84,6 @@ public void setEnvironment(Environment environment) { this.environment = environment; } - public String getEndpoint() { - return endpoint; - } - - public void setEndpoint(String endpoint) { - this.endpoint = endpoint; - } - public String getApplicationName() { return applicationName; } @@ -121,18 +100,6 @@ public void setApiKey(String apiKey) { this.apiKey = apiKey; } - public String getCheckoutEndpoint() { - if (checkoutEndpoint == null || checkoutEndpoint.isEmpty()) { - String message = "Please provide your unique live url prefix on the setEnvironment() call on the Client or provide checkoutEndpoint in your config object."; - throw new IllegalArgumentException(message); - } - return checkoutEndpoint; - } - - public void setCheckoutEndpoint(String checkoutEndpoint) { - this.checkoutEndpoint = checkoutEndpoint; - } - public String getTerminalApiCloudEndpoint() { return terminalApiCloudEndpoint; } diff --git a/src/main/java/com/adyen/model/acswebhooks/AbstractOpenApiSchema.java b/src/main/java/com/adyen/model/acswebhooks/AbstractOpenApiSchema.java new file mode 100644 index 000000000..d05ed2dfd --- /dev/null +++ b/src/main/java/com/adyen/model/acswebhooks/AbstractOpenApiSchema.java @@ -0,0 +1,147 @@ +/* + * Authentication webhooks + * + * The version of the OpenAPI document: 1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.adyen.model.acswebhooks; + +import java.util.Objects; +import java.lang.reflect.Type; +import java.util.Map; +import jakarta.ws.rs.core.GenericType; + +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Abstract class for oneOf,anyOf schemas defined in OpenAPI spec + */ + +public abstract class AbstractOpenApiSchema { + + // store the actual instance of the schema/object + private Object instance; + + // is nullable + private Boolean isNullable; + + // schema type (e.g. oneOf, anyOf) + private final String schemaType; + + public AbstractOpenApiSchema(String schemaType, Boolean isNullable) { + this.schemaType = schemaType; + this.isNullable = isNullable; + } + + /** + * Get the list of oneOf/anyOf composed schemas allowed to be stored in this object + * + * @return an instance of the actual schema/object + */ + public abstract Map getSchemas(); + + /** + * Get the actual instance + * + * @return an instance of the actual schema/object + */ + @JsonValue + public Object getActualInstance() {return instance;} + + /** + * Set the actual instance + * + * @param instance the actual instance of the schema/object + */ + public void setActualInstance(Object instance) {this.instance = instance;} + + /** + * Get the instant recursively when the schemas defined in oneOf/anyof happen to be oneOf/anyOf schema as well + * + * @return an instance of the actual schema/object + */ + public Object getActualInstanceRecursively() { + return getActualInstanceRecursively(this); + } + + private Object getActualInstanceRecursively(AbstractOpenApiSchema object) { + if (object.getActualInstance() == null) { + return null; + } else if (object.getActualInstance() instanceof AbstractOpenApiSchema) { + return getActualInstanceRecursively((AbstractOpenApiSchema)object.getActualInstance()); + } else { + return object.getActualInstance(); + } + } + + /** + * Get the schema type (e.g. anyOf, oneOf) + * + * @return the schema type + */ + public String getSchemaType() { + return schemaType; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ").append(getClass()).append(" {\n"); + sb.append(" instance: ").append(toIndentedString(instance)).append("\n"); + sb.append(" isNullable: ").append(toIndentedString(isNullable)).append("\n"); + sb.append(" schemaType: ").append(toIndentedString(schemaType)).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 "); + } + + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AbstractOpenApiSchema a = (AbstractOpenApiSchema) o; + return Objects.equals(this.instance, a.instance) && + Objects.equals(this.isNullable, a.isNullable) && + Objects.equals(this.schemaType, a.schemaType); + } + + @Override + public int hashCode() { + return Objects.hash(instance, isNullable, schemaType); + } + + /** + * Is nullable + * + * @return true if it's nullable + */ + public Boolean isNullable() { + if (Boolean.TRUE.equals(isNullable)) { + return Boolean.TRUE; + } else { + return Boolean.FALSE; + } + } + + + +} diff --git a/src/main/java/com/adyen/model/acswebhooks/Amount.java b/src/main/java/com/adyen/model/acswebhooks/Amount.java new file mode 100644 index 000000000..e1c20fcdf --- /dev/null +++ b/src/main/java/com/adyen/model/acswebhooks/Amount.java @@ -0,0 +1,159 @@ +/* + * Authentication webhooks + * + * The version of the OpenAPI document: 1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.adyen.model.acswebhooks; + +import java.util.Objects; +import java.util.Arrays; +import java.util.Map; +import java.util.HashMap; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.core.JsonProcessingException; + + +/** + * Amount + */ +@JsonPropertyOrder({ + Amount.JSON_PROPERTY_CURRENCY, + Amount.JSON_PROPERTY_VALUE +}) + +public class Amount { + public static final String JSON_PROPERTY_CURRENCY = "currency"; + private String currency; + + public static final String JSON_PROPERTY_VALUE = "value"; + private Long value; + + public Amount() { + } + + public Amount currency(String currency) { + this.currency = currency; + return this; + } + + /** + * The three-character [ISO currency code](https://docs.adyen.com/development-resources/currency-codes). + * @return currency + **/ + @ApiModelProperty(required = true, value = "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; + } + + + @JsonProperty(JSON_PROPERTY_CURRENCY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setCurrency(String currency) { + this.currency = currency; + } + + + public Amount value(Long value) { + this.value = value; + return this; + } + + /** + * The amount of the transaction, in [minor units](https://docs.adyen.com/development-resources/currency-codes). + * @return value + **/ + @ApiModelProperty(required = true, value = "The amount of the transaction, 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; + } + + + @JsonProperty(JSON_PROPERTY_VALUE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setValue(Long value) { + this.value = value; + } + + + /** + * Return true if this Amount object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Amount amount = (Amount) o; + return Objects.equals(this.currency, amount.currency) && + Objects.equals(this.value, amount.value); + } + + @Override + public int hashCode() { + return Objects.hash(currency, value); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Amount {\n"); + sb.append(" currency: ").append(toIndentedString(currency)).append("\n"); + sb.append(" value: ").append(toIndentedString(value)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +/** + * Create an instance of Amount given an JSON string + * + * @param jsonString JSON string + * @return An instance of Amount + * @throws JsonProcessingException if the JSON string is invalid with respect to Amount + */ + public static Amount fromJson(String jsonString) throws JsonProcessingException { + return JSON.getMapper().readValue(jsonString, Amount.class); + } +/** + * Convert an instance of Amount to an JSON string + * + * @return JSON string + */ + public String toJson() throws JsonProcessingException { + return JSON.getMapper().writeValueAsString(this); + } +} + diff --git a/src/main/java/com/adyen/model/acswebhooks/AuthenticationInfo.java b/src/main/java/com/adyen/model/acswebhooks/AuthenticationInfo.java new file mode 100644 index 000000000..491349535 --- /dev/null +++ b/src/main/java/com/adyen/model/acswebhooks/AuthenticationInfo.java @@ -0,0 +1,909 @@ +/* + * Authentication webhooks + * + * The version of the OpenAPI document: 1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.adyen.model.acswebhooks; + +import java.util.Objects; +import java.util.Arrays; +import java.util.Map; +import java.util.HashMap; +import com.adyen.model.acswebhooks.ChallengeInfo; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.time.OffsetDateTime; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.core.JsonProcessingException; + + +/** + * AuthenticationInfo + */ +@JsonPropertyOrder({ + AuthenticationInfo.JSON_PROPERTY_ACS_TRANS_ID, + AuthenticationInfo.JSON_PROPERTY_CHALLENGE, + AuthenticationInfo.JSON_PROPERTY_CHALLENGE_INDICATOR, + AuthenticationInfo.JSON_PROPERTY_CREATED_AT, + AuthenticationInfo.JSON_PROPERTY_DEVICE_CHANNEL, + AuthenticationInfo.JSON_PROPERTY_DS_TRANS_I_D, + AuthenticationInfo.JSON_PROPERTY_EXEMPTION_INDICATOR, + AuthenticationInfo.JSON_PROPERTY_IN_P_S_D2_SCOPE, + AuthenticationInfo.JSON_PROPERTY_MESSAGE_CATEGORY, + AuthenticationInfo.JSON_PROPERTY_MESSAGE_VERSION, + AuthenticationInfo.JSON_PROPERTY_RISK_SCORE, + AuthenticationInfo.JSON_PROPERTY_THREE_D_S_SERVER_TRANS_I_D, + AuthenticationInfo.JSON_PROPERTY_TRANS_STATUS, + AuthenticationInfo.JSON_PROPERTY_TRANS_STATUS_REASON, + AuthenticationInfo.JSON_PROPERTY_TYPE +}) + +public class AuthenticationInfo { + public static final String JSON_PROPERTY_ACS_TRANS_ID = "acsTransId"; + private String acsTransId; + + public static final String JSON_PROPERTY_CHALLENGE = "challenge"; + private ChallengeInfo challenge; + + /** + * Specifies a preference for receiving a challenge. Possible values: * **01**: No preference * **02**: No challenge requested * **03**: Challenge requested (preference) * **04**: Challenge requested (mandate) * **05**: No challenge requested (transactional risk analysis is already performed) * **07**: No challenge requested (SCA is already performed) * **08**: No challenge requested (trusted beneficiaries exemption of no challenge required) * **09**: Challenge requested (trusted beneficiaries prompt requested if challenge required) * **80**: No challenge requested (secure corporate payment with Mastercard) * **82**: No challenge requested (secure corporate payment with Visa) + */ + public enum ChallengeIndicatorEnum { + _01("01"), + + _02("02"), + + _03("03"), + + _04("04"), + + _05("05"), + + _07("07"), + + _08("08"), + + _09("09"), + + _80("80"), + + _82("82"); + + private String value; + + ChallengeIndicatorEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static ChallengeIndicatorEnum fromValue(String value) { + for (ChallengeIndicatorEnum b : ChallengeIndicatorEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_CHALLENGE_INDICATOR = "challengeIndicator"; + private ChallengeIndicatorEnum challengeIndicator; + + public static final String JSON_PROPERTY_CREATED_AT = "createdAt"; + private OffsetDateTime createdAt; + + /** + * Indicates the type of channel interface being used to initiate the transaction. Possible values: * **app** * **browser** * **3DSRequestorInitiated** (initiated by a merchant when the cardholder is not available) + */ + public enum DeviceChannelEnum { + APP("app"), + + BROWSER("browser"), + + THREEDSREQUESTORINITIATED("ThreeDSRequestorInitiated"); + + private String value; + + DeviceChannelEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static DeviceChannelEnum fromValue(String value) { + for (DeviceChannelEnum b : DeviceChannelEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_DEVICE_CHANNEL = "deviceChannel"; + private DeviceChannelEnum deviceChannel; + + public static final String JSON_PROPERTY_DS_TRANS_I_D = "dsTransID"; + private String dsTransID; + + /** + * Indicates the exemption type that was applied to the authentication by the issuer, if exemption applied. Possible values: * **lowValue** * **secureCorporate** * **trustedBeneficiary** * **transactionRiskAnalysis** * **acquirerExemption** * **noExemptionApplied** * **visaDAFExemption** + */ + public enum ExemptionIndicatorEnum { + LOWVALUE("lowValue"), + + SECURECORPORATE("secureCorporate"), + + TRUSTEDBENEFICIARY("trustedBeneficiary"), + + TRANSACTIONRISKANALYSIS("transactionRiskAnalysis"), + + ACQUIREREXEMPTION("acquirerExemption"), + + NOEXEMPTIONAPPLIED("noExemptionApplied"), + + VISADAFEXEMPTION("visaDAFExemption"); + + private String value; + + ExemptionIndicatorEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static ExemptionIndicatorEnum fromValue(String value) { + for (ExemptionIndicatorEnum b : ExemptionIndicatorEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_EXEMPTION_INDICATOR = "exemptionIndicator"; + private ExemptionIndicatorEnum exemptionIndicator; + + public static final String JSON_PROPERTY_IN_P_S_D2_SCOPE = "inPSD2Scope"; + private Boolean inPSD2Scope; + + /** + * Identifies the category of the message for a specific use case. Possible values: * **payment** * **nonPayment** + */ + public enum MessageCategoryEnum { + PAYMENT("payment"), + + NONPAYMENT("nonPayment"); + + private String value; + + MessageCategoryEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static MessageCategoryEnum fromValue(String value) { + for (MessageCategoryEnum b : MessageCategoryEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_MESSAGE_CATEGORY = "messageCategory"; + private MessageCategoryEnum messageCategory; + + public static final String JSON_PROPERTY_MESSAGE_VERSION = "messageVersion"; + private String messageVersion; + + public static final String JSON_PROPERTY_RISK_SCORE = "riskScore"; + private Integer riskScore; + + public static final String JSON_PROPERTY_THREE_D_S_SERVER_TRANS_I_D = "threeDSServerTransID"; + private String threeDSServerTransID; + + /** + * The `transStatus` value as defined in the 3D Secure 2 specification. Possible values: * **Y**: Authentication / Account verification successful. * **N**: Not Authenticated / Account not verified. Transaction denied. * **U**: Authentication / Account verification could not be performed. * **I**: Informational Only / 3D Secure Requestor challenge preference acknowledged. * **R**: Authentication / Account verification rejected by the Issuer. + */ + public enum TransStatusEnum { + Y("Y"), + + N("N"), + + R("R"), + + I("I"), + + U("U"); + + private String value; + + TransStatusEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static TransStatusEnum fromValue(String value) { + for (TransStatusEnum b : TransStatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_TRANS_STATUS = "transStatus"; + private TransStatusEnum transStatus; + + /** + * Provides information on why the `transStatus` field has the specified value. For possible values, refer to [our docs](https://docs.adyen.com/online-payments/3d-secure/api-reference#possible-transstatusreason-values). + */ + public enum TransStatusReasonEnum { + _01("01"), + + _02("02"), + + _03("03"), + + _04("04"), + + _05("05"), + + _06("06"), + + _07("07"), + + _08("08"), + + _09("09"), + + _10("10"), + + _11("11"), + + _12("12"), + + _13("13"), + + _14("14"), + + _15("15"), + + _16("16"), + + _17("17"), + + _18("18"), + + _19("19"), + + _20("20"), + + _21("21"), + + _22("22"), + + _23("23"), + + _24("24"), + + _25("25"), + + _26("26"), + + _80("80"), + + _81("81"), + + _82("82"), + + _83("83"), + + _84("84"), + + _85("85"), + + _86("86"), + + _87("87"), + + _88("88"); + + private String value; + + TransStatusReasonEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static TransStatusReasonEnum fromValue(String value) { + for (TransStatusReasonEnum b : TransStatusReasonEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_TRANS_STATUS_REASON = "transStatusReason"; + private TransStatusReasonEnum transStatusReason; + + /** + * The type of authentication performed. Possible values: * **frictionless** * **challenge** + */ + public enum TypeEnum { + FRICTIONLESS("frictionless"), + + CHALLENGE("challenge"); + + 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; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_TYPE = "type"; + private TypeEnum type; + + public AuthenticationInfo() { + } + + public AuthenticationInfo acsTransId(String acsTransId) { + this.acsTransId = acsTransId; + return this; + } + + /** + * Universally unique transaction identifier assigned by the Access Control Server (ACS) to identify a single transaction. + * @return acsTransId + **/ + @ApiModelProperty(required = true, value = "Universally unique transaction identifier assigned by the Access Control Server (ACS) to identify a single transaction.") + @JsonProperty(JSON_PROPERTY_ACS_TRANS_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getAcsTransId() { + return acsTransId; + } + + + @JsonProperty(JSON_PROPERTY_ACS_TRANS_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setAcsTransId(String acsTransId) { + this.acsTransId = acsTransId; + } + + + public AuthenticationInfo challenge(ChallengeInfo challenge) { + this.challenge = challenge; + return this; + } + + /** + * Get challenge + * @return challenge + **/ + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_CHALLENGE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public ChallengeInfo getChallenge() { + return challenge; + } + + + @JsonProperty(JSON_PROPERTY_CHALLENGE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setChallenge(ChallengeInfo challenge) { + this.challenge = challenge; + } + + + public AuthenticationInfo challengeIndicator(ChallengeIndicatorEnum challengeIndicator) { + this.challengeIndicator = challengeIndicator; + return this; + } + + /** + * Specifies a preference for receiving a challenge. Possible values: * **01**: No preference * **02**: No challenge requested * **03**: Challenge requested (preference) * **04**: Challenge requested (mandate) * **05**: No challenge requested (transactional risk analysis is already performed) * **07**: No challenge requested (SCA is already performed) * **08**: No challenge requested (trusted beneficiaries exemption of no challenge required) * **09**: Challenge requested (trusted beneficiaries prompt requested if challenge required) * **80**: No challenge requested (secure corporate payment with Mastercard) * **82**: No challenge requested (secure corporate payment with Visa) + * @return challengeIndicator + **/ + @ApiModelProperty(required = true, value = "Specifies a preference for receiving a challenge. Possible values: * **01**: No preference * **02**: No challenge requested * **03**: Challenge requested (preference) * **04**: Challenge requested (mandate) * **05**: No challenge requested (transactional risk analysis is already performed) * **07**: No challenge requested (SCA is already performed) * **08**: No challenge requested (trusted beneficiaries exemption of no challenge required) * **09**: Challenge requested (trusted beneficiaries prompt requested if challenge required) * **80**: No challenge requested (secure corporate payment with Mastercard) * **82**: No challenge requested (secure corporate payment with Visa) ") + @JsonProperty(JSON_PROPERTY_CHALLENGE_INDICATOR) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public ChallengeIndicatorEnum getChallengeIndicator() { + return challengeIndicator; + } + + + @JsonProperty(JSON_PROPERTY_CHALLENGE_INDICATOR) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setChallengeIndicator(ChallengeIndicatorEnum challengeIndicator) { + this.challengeIndicator = challengeIndicator; + } + + + public AuthenticationInfo createdAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * Date and time in UTC of the cardholder authentication. [ISO 8601](https://www.w3.org/TR/NOTE-datetime) format: YYYY-MM-DDThh:mm:ss+TZD, for example, **2020-12-18T10:15:30+01:00**. + * @return createdAt + **/ + @ApiModelProperty(required = true, value = "Date and time in UTC of the cardholder authentication. [ISO 8601](https://www.w3.org/TR/NOTE-datetime) format: YYYY-MM-DDThh:mm:ss+TZD, for example, **2020-12-18T10:15:30+01:00**.") + @JsonProperty(JSON_PROPERTY_CREATED_AT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + + @JsonProperty(JSON_PROPERTY_CREATED_AT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setCreatedAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + + public AuthenticationInfo deviceChannel(DeviceChannelEnum deviceChannel) { + this.deviceChannel = deviceChannel; + return this; + } + + /** + * Indicates the type of channel interface being used to initiate the transaction. Possible values: * **app** * **browser** * **3DSRequestorInitiated** (initiated by a merchant when the cardholder is not available) + * @return deviceChannel + **/ + @ApiModelProperty(required = true, value = "Indicates the type of channel interface being used to initiate the transaction. Possible values: * **app** * **browser** * **3DSRequestorInitiated** (initiated by a merchant when the cardholder is not available)") + @JsonProperty(JSON_PROPERTY_DEVICE_CHANNEL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public DeviceChannelEnum getDeviceChannel() { + return deviceChannel; + } + + + @JsonProperty(JSON_PROPERTY_DEVICE_CHANNEL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setDeviceChannel(DeviceChannelEnum deviceChannel) { + this.deviceChannel = deviceChannel; + } + + + public AuthenticationInfo dsTransID(String dsTransID) { + this.dsTransID = dsTransID; + return this; + } + + /** + * Universally unique transaction identifier assigned by the DS (card scheme) to identify a single transaction. + * @return dsTransID + **/ + @ApiModelProperty(required = true, value = "Universally unique transaction identifier assigned by the DS (card scheme) to identify a single transaction.") + @JsonProperty(JSON_PROPERTY_DS_TRANS_I_D) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getDsTransID() { + return dsTransID; + } + + + @JsonProperty(JSON_PROPERTY_DS_TRANS_I_D) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setDsTransID(String dsTransID) { + this.dsTransID = dsTransID; + } + + + public AuthenticationInfo exemptionIndicator(ExemptionIndicatorEnum exemptionIndicator) { + this.exemptionIndicator = exemptionIndicator; + return this; + } + + /** + * Indicates the exemption type that was applied to the authentication by the issuer, if exemption applied. Possible values: * **lowValue** * **secureCorporate** * **trustedBeneficiary** * **transactionRiskAnalysis** * **acquirerExemption** * **noExemptionApplied** * **visaDAFExemption** + * @return exemptionIndicator + **/ + @ApiModelProperty(value = "Indicates the exemption type that was applied to the authentication by the issuer, if exemption applied. Possible values: * **lowValue** * **secureCorporate** * **trustedBeneficiary** * **transactionRiskAnalysis** * **acquirerExemption** * **noExemptionApplied** * **visaDAFExemption** ") + @JsonProperty(JSON_PROPERTY_EXEMPTION_INDICATOR) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public ExemptionIndicatorEnum getExemptionIndicator() { + return exemptionIndicator; + } + + + @JsonProperty(JSON_PROPERTY_EXEMPTION_INDICATOR) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setExemptionIndicator(ExemptionIndicatorEnum exemptionIndicator) { + this.exemptionIndicator = exemptionIndicator; + } + + + public AuthenticationInfo inPSD2Scope(Boolean inPSD2Scope) { + this.inPSD2Scope = inPSD2Scope; + return this; + } + + /** + * Indicates if the purchase was in the PSD2 scope. + * @return inPSD2Scope + **/ + @ApiModelProperty(required = true, value = "Indicates if the purchase was in the PSD2 scope.") + @JsonProperty(JSON_PROPERTY_IN_P_S_D2_SCOPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Boolean getInPSD2Scope() { + return inPSD2Scope; + } + + + @JsonProperty(JSON_PROPERTY_IN_P_S_D2_SCOPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setInPSD2Scope(Boolean inPSD2Scope) { + this.inPSD2Scope = inPSD2Scope; + } + + + public AuthenticationInfo messageCategory(MessageCategoryEnum messageCategory) { + this.messageCategory = messageCategory; + return this; + } + + /** + * Identifies the category of the message for a specific use case. Possible values: * **payment** * **nonPayment** + * @return messageCategory + **/ + @ApiModelProperty(required = true, value = "Identifies the category of the message for a specific use case. Possible values: * **payment** * **nonPayment**") + @JsonProperty(JSON_PROPERTY_MESSAGE_CATEGORY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public MessageCategoryEnum getMessageCategory() { + return messageCategory; + } + + + @JsonProperty(JSON_PROPERTY_MESSAGE_CATEGORY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setMessageCategory(MessageCategoryEnum messageCategory) { + this.messageCategory = messageCategory; + } + + + public AuthenticationInfo messageVersion(String messageVersion) { + this.messageVersion = messageVersion; + return this; + } + + /** + * The `messageVersion` value as defined in the 3D Secure 2 specification. + * @return messageVersion + **/ + @ApiModelProperty(required = true, value = "The `messageVersion` value as defined in the 3D Secure 2 specification.") + @JsonProperty(JSON_PROPERTY_MESSAGE_VERSION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getMessageVersion() { + return messageVersion; + } + + + @JsonProperty(JSON_PROPERTY_MESSAGE_VERSION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setMessageVersion(String messageVersion) { + this.messageVersion = messageVersion; + } + + + public AuthenticationInfo riskScore(Integer riskScore) { + this.riskScore = riskScore; + return this; + } + + /** + * Risk score calculated from the transaction rules. + * @return riskScore + **/ + @ApiModelProperty(value = "Risk score calculated from the transaction rules.") + @JsonProperty(JSON_PROPERTY_RISK_SCORE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Integer getRiskScore() { + return riskScore; + } + + + @JsonProperty(JSON_PROPERTY_RISK_SCORE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setRiskScore(Integer riskScore) { + this.riskScore = riskScore; + } + + + public AuthenticationInfo threeDSServerTransID(String threeDSServerTransID) { + this.threeDSServerTransID = threeDSServerTransID; + return this; + } + + /** + * The `threeDSServerTransID` value as defined in the 3D Secure 2 specification. + * @return threeDSServerTransID + **/ + @ApiModelProperty(required = true, value = "The `threeDSServerTransID` value as defined in the 3D Secure 2 specification.") + @JsonProperty(JSON_PROPERTY_THREE_D_S_SERVER_TRANS_I_D) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getThreeDSServerTransID() { + return threeDSServerTransID; + } + + + @JsonProperty(JSON_PROPERTY_THREE_D_S_SERVER_TRANS_I_D) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setThreeDSServerTransID(String threeDSServerTransID) { + this.threeDSServerTransID = threeDSServerTransID; + } + + + public AuthenticationInfo transStatus(TransStatusEnum transStatus) { + this.transStatus = transStatus; + return this; + } + + /** + * The `transStatus` value as defined in the 3D Secure 2 specification. Possible values: * **Y**: Authentication / Account verification successful. * **N**: Not Authenticated / Account not verified. Transaction denied. * **U**: Authentication / Account verification could not be performed. * **I**: Informational Only / 3D Secure Requestor challenge preference acknowledged. * **R**: Authentication / Account verification rejected by the Issuer. + * @return transStatus + **/ + @ApiModelProperty(required = true, value = "The `transStatus` value as defined in the 3D Secure 2 specification. Possible values: * **Y**: Authentication / Account verification successful. * **N**: Not Authenticated / Account not verified. Transaction denied. * **U**: Authentication / Account verification could not be performed. * **I**: Informational Only / 3D Secure Requestor challenge preference acknowledged. * **R**: Authentication / Account verification rejected by the Issuer. ") + @JsonProperty(JSON_PROPERTY_TRANS_STATUS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public TransStatusEnum getTransStatus() { + return transStatus; + } + + + @JsonProperty(JSON_PROPERTY_TRANS_STATUS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setTransStatus(TransStatusEnum transStatus) { + this.transStatus = transStatus; + } + + + public AuthenticationInfo transStatusReason(TransStatusReasonEnum transStatusReason) { + this.transStatusReason = transStatusReason; + return this; + } + + /** + * Provides information on why the `transStatus` field has the specified value. For possible values, refer to [our docs](https://docs.adyen.com/online-payments/3d-secure/api-reference#possible-transstatusreason-values). + * @return transStatusReason + **/ + @ApiModelProperty(value = "Provides information on why the `transStatus` field has the specified value. For possible values, refer to [our docs](https://docs.adyen.com/online-payments/3d-secure/api-reference#possible-transstatusreason-values).") + @JsonProperty(JSON_PROPERTY_TRANS_STATUS_REASON) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public TransStatusReasonEnum getTransStatusReason() { + return transStatusReason; + } + + + @JsonProperty(JSON_PROPERTY_TRANS_STATUS_REASON) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setTransStatusReason(TransStatusReasonEnum transStatusReason) { + this.transStatusReason = transStatusReason; + } + + + public AuthenticationInfo type(TypeEnum type) { + this.type = type; + return this; + } + + /** + * The type of authentication performed. Possible values: * **frictionless** * **challenge** + * @return type + **/ + @ApiModelProperty(required = true, value = "The type of authentication performed. Possible values: * **frictionless** * **challenge**") + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public TypeEnum getType() { + return type; + } + + + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setType(TypeEnum type) { + this.type = type; + } + + + /** + * Return true if this AuthenticationInfo object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AuthenticationInfo authenticationInfo = (AuthenticationInfo) o; + return Objects.equals(this.acsTransId, authenticationInfo.acsTransId) && + Objects.equals(this.challenge, authenticationInfo.challenge) && + Objects.equals(this.challengeIndicator, authenticationInfo.challengeIndicator) && + Objects.equals(this.createdAt, authenticationInfo.createdAt) && + Objects.equals(this.deviceChannel, authenticationInfo.deviceChannel) && + Objects.equals(this.dsTransID, authenticationInfo.dsTransID) && + Objects.equals(this.exemptionIndicator, authenticationInfo.exemptionIndicator) && + Objects.equals(this.inPSD2Scope, authenticationInfo.inPSD2Scope) && + Objects.equals(this.messageCategory, authenticationInfo.messageCategory) && + Objects.equals(this.messageVersion, authenticationInfo.messageVersion) && + Objects.equals(this.riskScore, authenticationInfo.riskScore) && + Objects.equals(this.threeDSServerTransID, authenticationInfo.threeDSServerTransID) && + Objects.equals(this.transStatus, authenticationInfo.transStatus) && + Objects.equals(this.transStatusReason, authenticationInfo.transStatusReason) && + Objects.equals(this.type, authenticationInfo.type); + } + + @Override + public int hashCode() { + return Objects.hash(acsTransId, challenge, challengeIndicator, createdAt, deviceChannel, dsTransID, exemptionIndicator, inPSD2Scope, messageCategory, messageVersion, riskScore, threeDSServerTransID, transStatus, transStatusReason, type); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AuthenticationInfo {\n"); + sb.append(" acsTransId: ").append(toIndentedString(acsTransId)).append("\n"); + sb.append(" challenge: ").append(toIndentedString(challenge)).append("\n"); + sb.append(" challengeIndicator: ").append(toIndentedString(challengeIndicator)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" deviceChannel: ").append(toIndentedString(deviceChannel)).append("\n"); + sb.append(" dsTransID: ").append(toIndentedString(dsTransID)).append("\n"); + sb.append(" exemptionIndicator: ").append(toIndentedString(exemptionIndicator)).append("\n"); + sb.append(" inPSD2Scope: ").append(toIndentedString(inPSD2Scope)).append("\n"); + sb.append(" messageCategory: ").append(toIndentedString(messageCategory)).append("\n"); + sb.append(" messageVersion: ").append(toIndentedString(messageVersion)).append("\n"); + sb.append(" riskScore: ").append(toIndentedString(riskScore)).append("\n"); + sb.append(" threeDSServerTransID: ").append(toIndentedString(threeDSServerTransID)).append("\n"); + sb.append(" transStatus: ").append(toIndentedString(transStatus)).append("\n"); + sb.append(" transStatusReason: ").append(toIndentedString(transStatusReason)).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 AuthenticationInfo given an JSON string + * + * @param jsonString JSON string + * @return An instance of AuthenticationInfo + * @throws JsonProcessingException if the JSON string is invalid with respect to AuthenticationInfo + */ + public static AuthenticationInfo fromJson(String jsonString) throws JsonProcessingException { + return JSON.getMapper().readValue(jsonString, AuthenticationInfo.class); + } +/** + * Convert an instance of AuthenticationInfo 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/acswebhooks/AuthenticationNotificationData.java b/src/main/java/com/adyen/model/acswebhooks/AuthenticationNotificationData.java new file mode 100644 index 000000000..4ec2ae3e6 --- /dev/null +++ b/src/main/java/com/adyen/model/acswebhooks/AuthenticationNotificationData.java @@ -0,0 +1,322 @@ +/* + * Authentication webhooks + * + * The version of the OpenAPI document: 1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.adyen.model.acswebhooks; + +import java.util.Objects; +import java.util.Arrays; +import java.util.Map; +import java.util.HashMap; +import com.adyen.model.acswebhooks.AuthenticationInfo; +import com.adyen.model.acswebhooks.PurchaseInfo; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.core.JsonProcessingException; + + +/** + * AuthenticationNotificationData + */ +@JsonPropertyOrder({ + AuthenticationNotificationData.JSON_PROPERTY_AUTHENTICATION, + AuthenticationNotificationData.JSON_PROPERTY_BALANCE_PLATFORM, + AuthenticationNotificationData.JSON_PROPERTY_ID, + AuthenticationNotificationData.JSON_PROPERTY_PAYMENT_INSTRUMENT_ID, + AuthenticationNotificationData.JSON_PROPERTY_PURCHASE, + AuthenticationNotificationData.JSON_PROPERTY_STATUS +}) + +public class AuthenticationNotificationData { + public static final String JSON_PROPERTY_AUTHENTICATION = "authentication"; + private AuthenticationInfo authentication; + + public static final String JSON_PROPERTY_BALANCE_PLATFORM = "balancePlatform"; + private String balancePlatform; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_PAYMENT_INSTRUMENT_ID = "paymentInstrumentId"; + private String paymentInstrumentId; + + public static final String JSON_PROPERTY_PURCHASE = "purchase"; + private PurchaseInfo purchase; + + /** + * Outcome of the authentication. Allowed values: * authenticated * rejected * error + */ + public enum StatusEnum { + AUTHENTICATED("authenticated"), + + REJECTED("rejected"), + + ERROR("error"); + + 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; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_STATUS = "status"; + private StatusEnum status; + + public AuthenticationNotificationData() { + } + + public AuthenticationNotificationData authentication(AuthenticationInfo authentication) { + this.authentication = authentication; + return this; + } + + /** + * Get authentication + * @return authentication + **/ + @ApiModelProperty(required = true, value = "") + @JsonProperty(JSON_PROPERTY_AUTHENTICATION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public AuthenticationInfo getAuthentication() { + return authentication; + } + + + @JsonProperty(JSON_PROPERTY_AUTHENTICATION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setAuthentication(AuthenticationInfo authentication) { + this.authentication = authentication; + } + + + public AuthenticationNotificationData balancePlatform(String balancePlatform) { + this.balancePlatform = balancePlatform; + return this; + } + + /** + * The unique identifier of the balance platform. + * @return balancePlatform + **/ + @ApiModelProperty(value = "The unique identifier of the balance platform.") + @JsonProperty(JSON_PROPERTY_BALANCE_PLATFORM) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getBalancePlatform() { + return balancePlatform; + } + + + @JsonProperty(JSON_PROPERTY_BALANCE_PLATFORM) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setBalancePlatform(String balancePlatform) { + this.balancePlatform = balancePlatform; + } + + + public AuthenticationNotificationData id(String id) { + this.id = id; + return this; + } + + /** + * Unique identifier of the authentication. + * @return id + **/ + @ApiModelProperty(required = true, value = "Unique identifier of the authentication.") + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getId() { + return id; + } + + + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setId(String id) { + this.id = id; + } + + + public AuthenticationNotificationData paymentInstrumentId(String paymentInstrumentId) { + this.paymentInstrumentId = paymentInstrumentId; + return this; + } + + /** + * Unique identifier of the payment instrument that was used for the authentication. + * @return paymentInstrumentId + **/ + @ApiModelProperty(required = true, value = "Unique identifier of the payment instrument that was used for the authentication.") + @JsonProperty(JSON_PROPERTY_PAYMENT_INSTRUMENT_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getPaymentInstrumentId() { + return paymentInstrumentId; + } + + + @JsonProperty(JSON_PROPERTY_PAYMENT_INSTRUMENT_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setPaymentInstrumentId(String paymentInstrumentId) { + this.paymentInstrumentId = paymentInstrumentId; + } + + + public AuthenticationNotificationData purchase(PurchaseInfo purchase) { + this.purchase = purchase; + return this; + } + + /** + * Get purchase + * @return purchase + **/ + @ApiModelProperty(required = true, value = "") + @JsonProperty(JSON_PROPERTY_PURCHASE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public PurchaseInfo getPurchase() { + return purchase; + } + + + @JsonProperty(JSON_PROPERTY_PURCHASE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setPurchase(PurchaseInfo purchase) { + this.purchase = purchase; + } + + + public AuthenticationNotificationData status(StatusEnum status) { + this.status = status; + return this; + } + + /** + * Outcome of the authentication. Allowed values: * authenticated * rejected * error + * @return status + **/ + @ApiModelProperty(required = true, value = "Outcome of the authentication. Allowed values: * authenticated * rejected * error") + @JsonProperty(JSON_PROPERTY_STATUS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public StatusEnum getStatus() { + return status; + } + + + @JsonProperty(JSON_PROPERTY_STATUS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setStatus(StatusEnum status) { + this.status = status; + } + + + /** + * Return true if this AuthenticationNotificationData object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AuthenticationNotificationData authenticationNotificationData = (AuthenticationNotificationData) o; + return Objects.equals(this.authentication, authenticationNotificationData.authentication) && + Objects.equals(this.balancePlatform, authenticationNotificationData.balancePlatform) && + Objects.equals(this.id, authenticationNotificationData.id) && + Objects.equals(this.paymentInstrumentId, authenticationNotificationData.paymentInstrumentId) && + Objects.equals(this.purchase, authenticationNotificationData.purchase) && + Objects.equals(this.status, authenticationNotificationData.status); + } + + @Override + public int hashCode() { + return Objects.hash(authentication, balancePlatform, id, paymentInstrumentId, purchase, status); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AuthenticationNotificationData {\n"); + sb.append(" authentication: ").append(toIndentedString(authentication)).append("\n"); + sb.append(" balancePlatform: ").append(toIndentedString(balancePlatform)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" paymentInstrumentId: ").append(toIndentedString(paymentInstrumentId)).append("\n"); + sb.append(" purchase: ").append(toIndentedString(purchase)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).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 AuthenticationNotificationData given an JSON string + * + * @param jsonString JSON string + * @return An instance of AuthenticationNotificationData + * @throws JsonProcessingException if the JSON string is invalid with respect to AuthenticationNotificationData + */ + public static AuthenticationNotificationData fromJson(String jsonString) throws JsonProcessingException { + return JSON.getMapper().readValue(jsonString, AuthenticationNotificationData.class); + } +/** + * Convert an instance of AuthenticationNotificationData 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/acswebhooks/AuthenticationNotificationRequest.java b/src/main/java/com/adyen/model/acswebhooks/AuthenticationNotificationRequest.java new file mode 100644 index 000000000..039d000a7 --- /dev/null +++ b/src/main/java/com/adyen/model/acswebhooks/AuthenticationNotificationRequest.java @@ -0,0 +1,224 @@ +/* + * Authentication webhooks + * + * The version of the OpenAPI document: 1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.adyen.model.acswebhooks; + +import java.util.Objects; +import java.util.Arrays; +import java.util.Map; +import java.util.HashMap; +import com.adyen.model.acswebhooks.AuthenticationNotificationData; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.core.JsonProcessingException; + + +/** + * AuthenticationNotificationRequest + */ +@JsonPropertyOrder({ + AuthenticationNotificationRequest.JSON_PROPERTY_DATA, + AuthenticationNotificationRequest.JSON_PROPERTY_ENVIRONMENT, + AuthenticationNotificationRequest.JSON_PROPERTY_TYPE +}) + +public class AuthenticationNotificationRequest { + public static final String JSON_PROPERTY_DATA = "data"; + private AuthenticationNotificationData data; + + public static final String JSON_PROPERTY_ENVIRONMENT = "environment"; + private String environment; + + /** + * Type of notification. + */ + public enum TypeEnum { + BALANCEPLATFORM_AUTHENTICATION_CREATED("balancePlatform.authentication.created"); + + 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; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_TYPE = "type"; + private TypeEnum type; + + public AuthenticationNotificationRequest() { + } + + public AuthenticationNotificationRequest data(AuthenticationNotificationData data) { + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @ApiModelProperty(required = true, value = "") + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public AuthenticationNotificationData getData() { + return data; + } + + + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setData(AuthenticationNotificationData data) { + this.data = data; + } + + + public AuthenticationNotificationRequest environment(String environment) { + this.environment = environment; + return this; + } + + /** + * The environment from which the webhook originated. Possible values: **test**, **live**. + * @return environment + **/ + @ApiModelProperty(required = true, value = "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; + } + + + @JsonProperty(JSON_PROPERTY_ENVIRONMENT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setEnvironment(String environment) { + this.environment = environment; + } + + + public AuthenticationNotificationRequest type(TypeEnum type) { + this.type = type; + return this; + } + + /** + * Type of notification. + * @return type + **/ + @ApiModelProperty(required = true, value = "Type of notification.") + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public TypeEnum getType() { + return type; + } + + + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setType(TypeEnum type) { + this.type = type; + } + + + /** + * Return true if this AuthenticationNotificationRequest object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AuthenticationNotificationRequest authenticationNotificationRequest = (AuthenticationNotificationRequest) o; + return Objects.equals(this.data, authenticationNotificationRequest.data) && + Objects.equals(this.environment, authenticationNotificationRequest.environment) && + Objects.equals(this.type, authenticationNotificationRequest.type); + } + + @Override + public int hashCode() { + return Objects.hash(data, environment, type); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AuthenticationNotificationRequest {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" environment: ").append(toIndentedString(environment)).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 AuthenticationNotificationRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of AuthenticationNotificationRequest + * @throws JsonProcessingException if the JSON string is invalid with respect to AuthenticationNotificationRequest + */ + public static AuthenticationNotificationRequest fromJson(String jsonString) throws JsonProcessingException { + return JSON.getMapper().readValue(jsonString, AuthenticationNotificationRequest.class); + } +/** + * Convert an instance of AuthenticationNotificationRequest 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/acswebhooks/BalancePlatformNotificationResponse.java b/src/main/java/com/adyen/model/acswebhooks/BalancePlatformNotificationResponse.java new file mode 100644 index 000000000..98b24cd6f --- /dev/null +++ b/src/main/java/com/adyen/model/acswebhooks/BalancePlatformNotificationResponse.java @@ -0,0 +1,128 @@ +/* + * Authentication webhooks + * + * The version of the OpenAPI document: 1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.adyen.model.acswebhooks; + +import java.util.Objects; +import java.util.Arrays; +import java.util.Map; +import java.util.HashMap; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.core.JsonProcessingException; + + +/** + * BalancePlatformNotificationResponse + */ +@JsonPropertyOrder({ + BalancePlatformNotificationResponse.JSON_PROPERTY_NOTIFICATION_RESPONSE +}) + +public class BalancePlatformNotificationResponse { + public static final String JSON_PROPERTY_NOTIFICATION_RESPONSE = "notificationResponse"; + private String notificationResponse; + + public BalancePlatformNotificationResponse() { + } + + public BalancePlatformNotificationResponse notificationResponse(String notificationResponse) { + this.notificationResponse = notificationResponse; + return this; + } + + /** + * Respond with **HTTP 200 OK** and `[accepted]` in the response body to [accept the webhook](https://docs.adyen.com/development-resources/webhooks#accept-notifications). + * @return notificationResponse + **/ + @ApiModelProperty(value = "Respond with **HTTP 200 OK** and `[accepted]` in the response body to [accept the webhook](https://docs.adyen.com/development-resources/webhooks#accept-notifications).") + @JsonProperty(JSON_PROPERTY_NOTIFICATION_RESPONSE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getNotificationResponse() { + return notificationResponse; + } + + + @JsonProperty(JSON_PROPERTY_NOTIFICATION_RESPONSE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setNotificationResponse(String notificationResponse) { + this.notificationResponse = notificationResponse; + } + + + /** + * Return true if this BalancePlatformNotificationResponse object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BalancePlatformNotificationResponse balancePlatformNotificationResponse = (BalancePlatformNotificationResponse) o; + return Objects.equals(this.notificationResponse, balancePlatformNotificationResponse.notificationResponse); + } + + @Override + public int hashCode() { + return Objects.hash(notificationResponse); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BalancePlatformNotificationResponse {\n"); + sb.append(" notificationResponse: ").append(toIndentedString(notificationResponse)).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 BalancePlatformNotificationResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of BalancePlatformNotificationResponse + * @throws JsonProcessingException if the JSON string is invalid with respect to BalancePlatformNotificationResponse + */ + public static BalancePlatformNotificationResponse fromJson(String jsonString) throws JsonProcessingException { + return JSON.getMapper().readValue(jsonString, BalancePlatformNotificationResponse.class); + } +/** + * Convert an instance of BalancePlatformNotificationResponse 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/acswebhooks/ChallengeInfo.java b/src/main/java/com/adyen/model/acswebhooks/ChallengeInfo.java new file mode 100644 index 000000000..2f50ce836 --- /dev/null +++ b/src/main/java/com/adyen/model/acswebhooks/ChallengeInfo.java @@ -0,0 +1,364 @@ +/* + * Authentication webhooks + * + * The version of the OpenAPI document: 1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.adyen.model.acswebhooks; + +import java.util.Objects; +import java.util.Arrays; +import java.util.Map; +import java.util.HashMap; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.time.OffsetDateTime; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.core.JsonProcessingException; + + +/** + * ChallengeInfo + */ +@JsonPropertyOrder({ + ChallengeInfo.JSON_PROPERTY_CHALLENGE_CANCEL, + ChallengeInfo.JSON_PROPERTY_FLOW, + ChallengeInfo.JSON_PROPERTY_LAST_INTERACTION, + ChallengeInfo.JSON_PROPERTY_PHONE_NUMBER, + ChallengeInfo.JSON_PROPERTY_RESENDS, + ChallengeInfo.JSON_PROPERTY_RETRIES +}) + +public class ChallengeInfo { + /** + * Indicator informing the Access Control Server (ACS) and the Directory Server (DS) that the authentication has been cancelled. For possible values, refer to [3D Secure API reference](https://docs.adyen.com/online-payments/3d-secure/api-reference#mpidata). + */ + public enum ChallengeCancelEnum { + _01("01"), + + _02("02"), + + _03("03"), + + _04("04"), + + _05("05"), + + _06("06"), + + _07("07"); + + private String value; + + ChallengeCancelEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static ChallengeCancelEnum fromValue(String value) { + for (ChallengeCancelEnum b : ChallengeCancelEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_CHALLENGE_CANCEL = "challengeCancel"; + private ChallengeCancelEnum challengeCancel; + + /** + * The flow used in the challenge. Possible values: * **OTP_SMS**: one-time password (OTP) flow * **OOB**: out-of-band (OOB) flow + */ + public enum FlowEnum { + OTP_SMS("OTP_SMS"), + + OOB("OOB"); + + private String value; + + FlowEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static FlowEnum fromValue(String value) { + for (FlowEnum b : FlowEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_FLOW = "flow"; + private FlowEnum flow; + + public static final String JSON_PROPERTY_LAST_INTERACTION = "lastInteraction"; + private OffsetDateTime lastInteraction; + + public static final String JSON_PROPERTY_PHONE_NUMBER = "phoneNumber"; + private String phoneNumber; + + public static final String JSON_PROPERTY_RESENDS = "resends"; + private Integer resends; + + public static final String JSON_PROPERTY_RETRIES = "retries"; + private Integer retries; + + public ChallengeInfo() { + } + + public ChallengeInfo challengeCancel(ChallengeCancelEnum challengeCancel) { + this.challengeCancel = challengeCancel; + return this; + } + + /** + * Indicator informing the Access Control Server (ACS) and the Directory Server (DS) that the authentication has been cancelled. For possible values, refer to [3D Secure API reference](https://docs.adyen.com/online-payments/3d-secure/api-reference#mpidata). + * @return challengeCancel + **/ + @ApiModelProperty(value = "Indicator informing the Access Control Server (ACS) and the Directory Server (DS) that the authentication has been cancelled. For possible values, refer to [3D Secure API reference](https://docs.adyen.com/online-payments/3d-secure/api-reference#mpidata).") + @JsonProperty(JSON_PROPERTY_CHALLENGE_CANCEL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public ChallengeCancelEnum getChallengeCancel() { + return challengeCancel; + } + + + @JsonProperty(JSON_PROPERTY_CHALLENGE_CANCEL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setChallengeCancel(ChallengeCancelEnum challengeCancel) { + this.challengeCancel = challengeCancel; + } + + + public ChallengeInfo flow(FlowEnum flow) { + this.flow = flow; + return this; + } + + /** + * The flow used in the challenge. Possible values: * **OTP_SMS**: one-time password (OTP) flow * **OOB**: out-of-band (OOB) flow + * @return flow + **/ + @ApiModelProperty(required = true, value = "The flow used in the challenge. Possible values: * **OTP_SMS**: one-time password (OTP) flow * **OOB**: out-of-band (OOB) flow") + @JsonProperty(JSON_PROPERTY_FLOW) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public FlowEnum getFlow() { + return flow; + } + + + @JsonProperty(JSON_PROPERTY_FLOW) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setFlow(FlowEnum flow) { + this.flow = flow; + } + + + public ChallengeInfo lastInteraction(OffsetDateTime lastInteraction) { + this.lastInteraction = lastInteraction; + return this; + } + + /** + * The last time of interaction with the challenge. + * @return lastInteraction + **/ + @ApiModelProperty(required = true, value = "The last time of interaction with the challenge.") + @JsonProperty(JSON_PROPERTY_LAST_INTERACTION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public OffsetDateTime getLastInteraction() { + return lastInteraction; + } + + + @JsonProperty(JSON_PROPERTY_LAST_INTERACTION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setLastInteraction(OffsetDateTime lastInteraction) { + this.lastInteraction = lastInteraction; + } + + + public ChallengeInfo phoneNumber(String phoneNumber) { + this.phoneNumber = phoneNumber; + return this; + } + + /** + * The last four digits of the phone number used in the challenge. + * @return phoneNumber + **/ + @ApiModelProperty(value = "The last four digits of the phone number used in the challenge.") + @JsonProperty(JSON_PROPERTY_PHONE_NUMBER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getPhoneNumber() { + return phoneNumber; + } + + + @JsonProperty(JSON_PROPERTY_PHONE_NUMBER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setPhoneNumber(String phoneNumber) { + this.phoneNumber = phoneNumber; + } + + + public ChallengeInfo resends(Integer resends) { + this.resends = resends; + return this; + } + + /** + * The number of times the one-time password (OTP) was resent during the challenge. + * @return resends + **/ + @ApiModelProperty(value = "The number of times the one-time password (OTP) was resent during the challenge.") + @JsonProperty(JSON_PROPERTY_RESENDS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Integer getResends() { + return resends; + } + + + @JsonProperty(JSON_PROPERTY_RESENDS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setResends(Integer resends) { + this.resends = resends; + } + + + public ChallengeInfo retries(Integer retries) { + this.retries = retries; + return this; + } + + /** + * The number of retries used in the challenge. + * @return retries + **/ + @ApiModelProperty(value = "The number of retries used in the challenge.") + @JsonProperty(JSON_PROPERTY_RETRIES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Integer getRetries() { + return retries; + } + + + @JsonProperty(JSON_PROPERTY_RETRIES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setRetries(Integer retries) { + this.retries = retries; + } + + + /** + * Return true if this ChallengeInfo object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ChallengeInfo challengeInfo = (ChallengeInfo) o; + return Objects.equals(this.challengeCancel, challengeInfo.challengeCancel) && + Objects.equals(this.flow, challengeInfo.flow) && + Objects.equals(this.lastInteraction, challengeInfo.lastInteraction) && + Objects.equals(this.phoneNumber, challengeInfo.phoneNumber) && + Objects.equals(this.resends, challengeInfo.resends) && + Objects.equals(this.retries, challengeInfo.retries); + } + + @Override + public int hashCode() { + return Objects.hash(challengeCancel, flow, lastInteraction, phoneNumber, resends, retries); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ChallengeInfo {\n"); + sb.append(" challengeCancel: ").append(toIndentedString(challengeCancel)).append("\n"); + sb.append(" flow: ").append(toIndentedString(flow)).append("\n"); + sb.append(" lastInteraction: ").append(toIndentedString(lastInteraction)).append("\n"); + sb.append(" phoneNumber: ").append(toIndentedString(phoneNumber)).append("\n"); + sb.append(" resends: ").append(toIndentedString(resends)).append("\n"); + sb.append(" retries: ").append(toIndentedString(retries)).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 ChallengeInfo given an JSON string + * + * @param jsonString JSON string + * @return An instance of ChallengeInfo + * @throws JsonProcessingException if the JSON string is invalid with respect to ChallengeInfo + */ + public static ChallengeInfo fromJson(String jsonString) throws JsonProcessingException { + return JSON.getMapper().readValue(jsonString, ChallengeInfo.class); + } +/** + * Convert an instance of ChallengeInfo 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/acswebhooks/JSON.java b/src/main/java/com/adyen/model/acswebhooks/JSON.java new file mode 100644 index 000000000..807f193c8 --- /dev/null +++ b/src/main/java/com/adyen/model/acswebhooks/JSON.java @@ -0,0 +1,251 @@ +package com.adyen.model.acswebhooks; + +import com.adyen.serializer.ByteArraySerializer; +import com.fasterxml.jackson.annotation.*; +import com.fasterxml.jackson.databind.*; +import com.fasterxml.jackson.databind.json.JsonMapper; +import com.fasterxml.jackson.databind.module.SimpleModule; +import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; +import com.adyen.model.acswebhooks.*; + +import java.text.DateFormat; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; +import jakarta.ws.rs.core.GenericType; +import jakarta.ws.rs.ext.ContextResolver; + +public class JSON implements ContextResolver { + private static ObjectMapper mapper; + + public JSON() { + mapper = new ObjectMapper(); + mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); + JsonMapper.builder().configure(MapperFeature.ALLOW_COERCION_OF_SCALARS, false); + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + mapper.configure(DeserializationFeature.FAIL_ON_INVALID_SUBTYPE, true); + mapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS); + mapper.disable(DeserializationFeature.ADJUST_DATES_TO_CONTEXT_TIME_ZONE); + mapper.enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING); + mapper.enable(DeserializationFeature.READ_ENUMS_USING_TO_STRING); + mapper.registerModule(new JavaTimeModule()); + // Custom ByteSerializer + SimpleModule simpleModule = new SimpleModule(); + simpleModule.addSerializer(byte[].class, new ByteArraySerializer()); + mapper.registerModule(simpleModule); + } + + /** + * Set the date format for JSON (de)serialization with Date properties. + * @param dateFormat Date format + */ + public void setDateFormat(DateFormat dateFormat) { + mapper.setDateFormat(dateFormat); + } + + @Override + public ObjectMapper getContext(Class type) { + return mapper; + } + + /** + * Get the object mapper + * + * @return object mapper + */ + public static ObjectMapper getMapper() { return mapper; } + + /** + * Returns the target model class that should be used to deserialize the input data. + * The discriminator mappings are used to determine the target model class. + * + * @param node The input data. + * @param modelClass The class that contains the discriminator mappings. + */ + public static Class getClassForElement(JsonNode node, Class modelClass) { + ClassDiscriminatorMapping cdm = modelDiscriminators.get(modelClass); + if (cdm != null) { + return cdm.getClassForElement(node, new HashSet>()); + } + return null; + } + + /** + * Helper class to register the discriminator mappings. + */ + private static class ClassDiscriminatorMapping { + // The model class name. + Class modelClass; + // The name of the discriminator property. + String discriminatorName; + // The discriminator mappings for a model class. + Map> discriminatorMappings; + + // Constructs a new class discriminator. + ClassDiscriminatorMapping(Class cls, String propertyName, Map> mappings) { + modelClass = cls; + discriminatorName = propertyName; + discriminatorMappings = new HashMap>(); + if (mappings != null) { + discriminatorMappings.putAll(mappings); + } + } + + // Return the name of the discriminator property for this model class. + String getDiscriminatorPropertyName() { + return discriminatorName; + } + + // Return the discriminator value or null if the discriminator is not + // present in the payload. + String getDiscriminatorValue(JsonNode node) { + // Determine the value of the discriminator property in the input data. + if (discriminatorName != null) { + // Get the value of the discriminator property, if present in the input payload. + node = node.get(discriminatorName); + if (node != null && node.isValueNode()) { + String discrValue = node.asText(); + if (discrValue != null) { + return discrValue; + } + } + } + return null; + } + + /** + * Returns the target model class that should be used to deserialize the input data. + * This function can be invoked for anyOf/oneOf composed models with discriminator mappings. + * The discriminator mappings are used to determine the target model class. + * + * @param node The input data. + * @param visitedClasses The set of classes that have already been visited. + */ + Class getClassForElement(JsonNode node, Set> visitedClasses) { + if (visitedClasses.contains(modelClass)) { + // Class has already been visited. + return null; + } + // Determine the value of the discriminator property in the input data. + String discrValue = getDiscriminatorValue(node); + if (discrValue == null) { + return null; + } + Class cls = discriminatorMappings.get(discrValue); + // It may not be sufficient to return this cls directly because that target class + // may itself be a composed schema, possibly with its own discriminator. + visitedClasses.add(modelClass); + for (Class childClass : discriminatorMappings.values()) { + ClassDiscriminatorMapping childCdm = modelDiscriminators.get(childClass); + if (childCdm == null) { + continue; + } + if (!discriminatorName.equals(childCdm.discriminatorName)) { + discrValue = getDiscriminatorValue(node); + if (discrValue == null) { + continue; + } + } + if (childCdm != null) { + // Recursively traverse the discriminator mappings. + Class childDiscr = childCdm.getClassForElement(node, visitedClasses); + if (childDiscr != null) { + return childDiscr; + } + } + } + return cls; + } + } + + /** + * Returns true if inst is an instance of modelClass in the OpenAPI model hierarchy. + * + * The Java class hierarchy is not implemented the same way as the OpenAPI model hierarchy, + * so it's not possible to use the instanceof keyword. + * + * @param modelClass A OpenAPI model class. + * @param inst The instance object. + */ + public static boolean isInstanceOf(Class modelClass, Object inst, Set> visitedClasses) { + if (modelClass.isInstance(inst)) { + // This handles the 'allOf' use case with single parent inheritance. + return true; + } + if (visitedClasses.contains(modelClass)) { + // This is to prevent infinite recursion when the composed schemas have + // a circular dependency. + return false; + } + visitedClasses.add(modelClass); + + // Traverse the oneOf/anyOf composed schemas. + Map descendants = modelDescendants.get(modelClass); + if (descendants != null) { + for (GenericType childType : descendants.values()) { + if (isInstanceOf(childType.getRawType(), inst, visitedClasses)) { + return true; + } + } + } + return false; + } + + /** + * A map of discriminators for all model classes. + */ + private static Map, ClassDiscriminatorMapping> modelDiscriminators = new HashMap, ClassDiscriminatorMapping>(); + + /** + * A map of oneOf/anyOf descendants for each model class. + */ + private static Map, Map> modelDescendants = new HashMap, Map>(); + + /** + * Register a model class discriminator. + * + * @param modelClass the model class + * @param discriminatorPropertyName the name of the discriminator property + * @param mappings a map with the discriminator mappings. + */ + public static void registerDiscriminator(Class modelClass, String discriminatorPropertyName, Map> mappings) { + ClassDiscriminatorMapping m = new ClassDiscriminatorMapping(modelClass, discriminatorPropertyName, mappings); + modelDiscriminators.put(modelClass, m); + } + + /** + * Register the oneOf/anyOf descendants of the modelClass. + * + * @param modelClass the model class + * @param descendants a map of oneOf/anyOf descendants. + */ + public static void registerDescendants(Class modelClass, Map descendants) { + modelDescendants.put(modelClass, descendants); + } + + private static JSON json; + + static + { + json = new JSON(); + } + + /** + * Get the default JSON instance. + * + * @return the default JSON instance + */ + public static JSON getDefault() { + return json; + } + + /** + * Set the default JSON instance. + * + * @param json JSON instance to be used + */ + public static void setDefault(JSON json) { + JSON.json = json; + } +} diff --git a/src/main/java/com/adyen/model/acswebhooks/PurchaseInfo.java b/src/main/java/com/adyen/model/acswebhooks/PurchaseInfo.java new file mode 100644 index 000000000..5cc63b20d --- /dev/null +++ b/src/main/java/com/adyen/model/acswebhooks/PurchaseInfo.java @@ -0,0 +1,191 @@ +/* + * Authentication webhooks + * + * The version of the OpenAPI document: 1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.adyen.model.acswebhooks; + +import java.util.Objects; +import java.util.Arrays; +import java.util.Map; +import java.util.HashMap; +import com.adyen.model.acswebhooks.Amount; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.core.JsonProcessingException; + + +/** + * PurchaseInfo + */ +@JsonPropertyOrder({ + PurchaseInfo.JSON_PROPERTY_DATE, + PurchaseInfo.JSON_PROPERTY_MERCHANT_NAME, + PurchaseInfo.JSON_PROPERTY_ORIGINAL_AMOUNT +}) + +public class PurchaseInfo { + public static final String JSON_PROPERTY_DATE = "date"; + private String date; + + public static final String JSON_PROPERTY_MERCHANT_NAME = "merchantName"; + private String merchantName; + + public static final String JSON_PROPERTY_ORIGINAL_AMOUNT = "originalAmount"; + private Amount originalAmount; + + public PurchaseInfo() { + } + + public PurchaseInfo date(String date) { + this.date = date; + return this; + } + + /** + * Date of the purchase. + * @return date + **/ + @ApiModelProperty(required = true, value = "Date of the purchase.") + @JsonProperty(JSON_PROPERTY_DATE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getDate() { + return date; + } + + + @JsonProperty(JSON_PROPERTY_DATE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setDate(String date) { + this.date = date; + } + + + public PurchaseInfo merchantName(String merchantName) { + this.merchantName = merchantName; + return this; + } + + /** + * Name of the merchant. + * @return merchantName + **/ + @ApiModelProperty(required = true, value = "Name of the merchant.") + @JsonProperty(JSON_PROPERTY_MERCHANT_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getMerchantName() { + return merchantName; + } + + + @JsonProperty(JSON_PROPERTY_MERCHANT_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setMerchantName(String merchantName) { + this.merchantName = merchantName; + } + + + public PurchaseInfo originalAmount(Amount originalAmount) { + this.originalAmount = originalAmount; + return this; + } + + /** + * Get originalAmount + * @return originalAmount + **/ + @ApiModelProperty(required = true, value = "") + @JsonProperty(JSON_PROPERTY_ORIGINAL_AMOUNT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Amount getOriginalAmount() { + return originalAmount; + } + + + @JsonProperty(JSON_PROPERTY_ORIGINAL_AMOUNT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setOriginalAmount(Amount originalAmount) { + this.originalAmount = originalAmount; + } + + + /** + * Return true if this PurchaseInfo object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PurchaseInfo purchaseInfo = (PurchaseInfo) o; + return Objects.equals(this.date, purchaseInfo.date) && + Objects.equals(this.merchantName, purchaseInfo.merchantName) && + Objects.equals(this.originalAmount, purchaseInfo.originalAmount); + } + + @Override + public int hashCode() { + return Objects.hash(date, merchantName, originalAmount); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PurchaseInfo {\n"); + sb.append(" date: ").append(toIndentedString(date)).append("\n"); + sb.append(" merchantName: ").append(toIndentedString(merchantName)).append("\n"); + sb.append(" originalAmount: ").append(toIndentedString(originalAmount)).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 PurchaseInfo given an JSON string + * + * @param jsonString JSON string + * @return An instance of PurchaseInfo + * @throws JsonProcessingException if the JSON string is invalid with respect to PurchaseInfo + */ + public static PurchaseInfo fromJson(String jsonString) throws JsonProcessingException { + return JSON.getMapper().readValue(jsonString, PurchaseInfo.class); + } +/** + * Convert an instance of PurchaseInfo 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/acswebhooks/Resource.java b/src/main/java/com/adyen/model/acswebhooks/Resource.java new file mode 100644 index 000000000..8935640df --- /dev/null +++ b/src/main/java/com/adyen/model/acswebhooks/Resource.java @@ -0,0 +1,191 @@ +/* + * Authentication webhooks + * + * The version of the OpenAPI document: 1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.adyen.model.acswebhooks; + +import java.util.Objects; +import java.util.Arrays; +import java.util.Map; +import java.util.HashMap; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.time.OffsetDateTime; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.core.JsonProcessingException; + + +/** + * Resource + */ +@JsonPropertyOrder({ + Resource.JSON_PROPERTY_BALANCE_PLATFORM, + Resource.JSON_PROPERTY_CREATION_DATE, + Resource.JSON_PROPERTY_ID +}) + +public class Resource { + 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 Resource() { + } + + public Resource balancePlatform(String balancePlatform) { + this.balancePlatform = balancePlatform; + return this; + } + + /** + * The unique identifier of the balance platform. + * @return balancePlatform + **/ + @ApiModelProperty(value = "The unique identifier of the balance platform.") + @JsonProperty(JSON_PROPERTY_BALANCE_PLATFORM) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getBalancePlatform() { + return balancePlatform; + } + + + @JsonProperty(JSON_PROPERTY_BALANCE_PLATFORM) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setBalancePlatform(String balancePlatform) { + this.balancePlatform = balancePlatform; + } + + + public Resource creationDate(OffsetDateTime creationDate) { + this.creationDate = creationDate; + return this; + } + + /** + * The date and time when the event was triggered, in ISO 8601 extended format. For example, **2020-12-18T10:15:30+01:00**. + * @return creationDate + **/ + @ApiModelProperty(value = "The date and time when the event was triggered, in ISO 8601 extended format. For example, **2020-12-18T10:15:30+01:00**.") + @JsonProperty(JSON_PROPERTY_CREATION_DATE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public OffsetDateTime getCreationDate() { + return creationDate; + } + + + @JsonProperty(JSON_PROPERTY_CREATION_DATE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setCreationDate(OffsetDateTime creationDate) { + this.creationDate = creationDate; + } + + + public Resource id(String id) { + this.id = id; + return this; + } + + /** + * The ID of the resource. + * @return id + **/ + @ApiModelProperty(value = "The ID of the resource.") + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getId() { + return id; + } + + + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setId(String id) { + this.id = id; + } + + + /** + * Return true if this Resource object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Resource resource = (Resource) o; + return Objects.equals(this.balancePlatform, resource.balancePlatform) && + Objects.equals(this.creationDate, resource.creationDate) && + Objects.equals(this.id, resource.id); + } + + @Override + public int hashCode() { + return Objects.hash(balancePlatform, creationDate, id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Resource {\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("}"); + 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 Resource given an JSON string + * + * @param jsonString JSON string + * @return An instance of Resource + * @throws JsonProcessingException if the JSON string is invalid with respect to Resource + */ + public static Resource fromJson(String jsonString) throws JsonProcessingException { + return JSON.getMapper().readValue(jsonString, Resource.class); + } +/** + * Convert an instance of Resource 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/managementwebhooks/AbstractOpenApiSchema.java b/src/main/java/com/adyen/model/managementwebhooks/AbstractOpenApiSchema.java new file mode 100644 index 000000000..daa2febf2 --- /dev/null +++ b/src/main/java/com/adyen/model/managementwebhooks/AbstractOpenApiSchema.java @@ -0,0 +1,147 @@ +/* + * Management Webhooks + * + * The version of the OpenAPI document: 1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.adyen.model.managementwebhooks; + +import java.util.Objects; +import java.lang.reflect.Type; +import java.util.Map; +import jakarta.ws.rs.core.GenericType; + +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Abstract class for oneOf,anyOf schemas defined in OpenAPI spec + */ + +public abstract class AbstractOpenApiSchema { + + // store the actual instance of the schema/object + private Object instance; + + // is nullable + private Boolean isNullable; + + // schema type (e.g. oneOf, anyOf) + private final String schemaType; + + public AbstractOpenApiSchema(String schemaType, Boolean isNullable) { + this.schemaType = schemaType; + this.isNullable = isNullable; + } + + /** + * Get the list of oneOf/anyOf composed schemas allowed to be stored in this object + * + * @return an instance of the actual schema/object + */ + public abstract Map getSchemas(); + + /** + * Get the actual instance + * + * @return an instance of the actual schema/object + */ + @JsonValue + public Object getActualInstance() {return instance;} + + /** + * Set the actual instance + * + * @param instance the actual instance of the schema/object + */ + public void setActualInstance(Object instance) {this.instance = instance;} + + /** + * Get the instant recursively when the schemas defined in oneOf/anyof happen to be oneOf/anyOf schema as well + * + * @return an instance of the actual schema/object + */ + public Object getActualInstanceRecursively() { + return getActualInstanceRecursively(this); + } + + private Object getActualInstanceRecursively(AbstractOpenApiSchema object) { + if (object.getActualInstance() == null) { + return null; + } else if (object.getActualInstance() instanceof AbstractOpenApiSchema) { + return getActualInstanceRecursively((AbstractOpenApiSchema)object.getActualInstance()); + } else { + return object.getActualInstance(); + } + } + + /** + * Get the schema type (e.g. anyOf, oneOf) + * + * @return the schema type + */ + public String getSchemaType() { + return schemaType; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ").append(getClass()).append(" {\n"); + sb.append(" instance: ").append(toIndentedString(instance)).append("\n"); + sb.append(" isNullable: ").append(toIndentedString(isNullable)).append("\n"); + sb.append(" schemaType: ").append(toIndentedString(schemaType)).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 "); + } + + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AbstractOpenApiSchema a = (AbstractOpenApiSchema) o; + return Objects.equals(this.instance, a.instance) && + Objects.equals(this.isNullable, a.isNullable) && + Objects.equals(this.schemaType, a.schemaType); + } + + @Override + public int hashCode() { + return Objects.hash(instance, isNullable, schemaType); + } + + /** + * Is nullable + * + * @return true if it's nullable + */ + public Boolean isNullable() { + if (Boolean.TRUE.equals(isNullable)) { + return Boolean.TRUE; + } else { + return Boolean.FALSE; + } + } + + + +} diff --git a/src/main/java/com/adyen/model/managementwebhooks/AccountCapabilityData.java b/src/main/java/com/adyen/model/managementwebhooks/AccountCapabilityData.java new file mode 100644 index 000000000..1b9db6030 --- /dev/null +++ b/src/main/java/com/adyen/model/managementwebhooks/AccountCapabilityData.java @@ -0,0 +1,325 @@ +/* + * Management Webhooks + * + * The version of the OpenAPI document: 1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.adyen.model.managementwebhooks; + +import java.util.Objects; +import java.util.Arrays; +import java.util.Map; +import java.util.HashMap; +import com.adyen.model.managementwebhooks.CapabilityProblem; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.core.JsonProcessingException; + + +/** + * AccountCapabilityData + */ +@JsonPropertyOrder({ + AccountCapabilityData.JSON_PROPERTY_ALLOWED, + AccountCapabilityData.JSON_PROPERTY_ALLOWED_LEVEL, + AccountCapabilityData.JSON_PROPERTY_CAPABILITY, + AccountCapabilityData.JSON_PROPERTY_PROBLEMS, + AccountCapabilityData.JSON_PROPERTY_REQUESTED, + AccountCapabilityData.JSON_PROPERTY_REQUESTED_LEVEL, + AccountCapabilityData.JSON_PROPERTY_VERIFICATION_STATUS +}) + +public class AccountCapabilityData { + public static final String JSON_PROPERTY_ALLOWED = "allowed"; + private Boolean allowed; + + public static final String JSON_PROPERTY_ALLOWED_LEVEL = "allowedLevel"; + private String allowedLevel; + + public static final String JSON_PROPERTY_CAPABILITY = "capability"; + private String capability; + + public static final String JSON_PROPERTY_PROBLEMS = "problems"; + private List problems = null; + + public static final String JSON_PROPERTY_REQUESTED = "requested"; + private Boolean requested; + + public static final String JSON_PROPERTY_REQUESTED_LEVEL = "requestedLevel"; + private String requestedLevel; + + public static final String JSON_PROPERTY_VERIFICATION_STATUS = "verificationStatus"; + private String verificationStatus; + + public AccountCapabilityData() { + } + + public AccountCapabilityData allowed(Boolean allowed) { + this.allowed = allowed; + return this; + } + + /** + * Indicates whether the capability is allowed. Adyen sets this to **true** if the verification is successful. + * @return allowed + **/ + @ApiModelProperty(value = "Indicates whether the capability is allowed. Adyen sets this to **true** if the verification is successful.") + @JsonProperty(JSON_PROPERTY_ALLOWED) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Boolean getAllowed() { + return allowed; + } + + + @JsonProperty(JSON_PROPERTY_ALLOWED) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setAllowed(Boolean allowed) { + this.allowed = allowed; + } + + + public AccountCapabilityData allowedLevel(String allowedLevel) { + this.allowedLevel = allowedLevel; + return this; + } + + /** + * The allowed level of the capability. Some capabilities have different levels which correspond to thresholds. Higher levels may require additional checks and increased monitoring.Possible values: **notApplicable**, **low**, **medium**, **high**. + * @return allowedLevel + **/ + @ApiModelProperty(value = "The allowed level of the capability. Some capabilities have different levels which correspond to thresholds. Higher levels may require additional checks and increased monitoring.Possible values: **notApplicable**, **low**, **medium**, **high**.") + @JsonProperty(JSON_PROPERTY_ALLOWED_LEVEL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getAllowedLevel() { + return allowedLevel; + } + + + @JsonProperty(JSON_PROPERTY_ALLOWED_LEVEL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setAllowedLevel(String allowedLevel) { + this.allowedLevel = allowedLevel; + } + + + public AccountCapabilityData capability(String capability) { + this.capability = capability; + return this; + } + + /** + * The name of the capability. For example, **sendToTransferInstrument**. + * @return capability + **/ + @ApiModelProperty(value = "The name of the capability. For example, **sendToTransferInstrument**.") + @JsonProperty(JSON_PROPERTY_CAPABILITY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getCapability() { + return capability; + } + + + @JsonProperty(JSON_PROPERTY_CAPABILITY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setCapability(String capability) { + this.capability = capability; + } + + + public AccountCapabilityData problems(List problems) { + this.problems = problems; + return this; + } + + public AccountCapabilityData addProblemsItem(CapabilityProblem problemsItem) { + if (this.problems == null) { + this.problems = new ArrayList<>(); + } + this.problems.add(problemsItem); + return this; + } + + /** + * List of entities that has problems with verification. The information includes the details of the errors and the actions that you can take to resolve them. + * @return problems + **/ + @ApiModelProperty(value = "List of entities that has problems with verification. The information includes the details of the errors and the actions that you can take to resolve them.") + @JsonProperty(JSON_PROPERTY_PROBLEMS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public List getProblems() { + return problems; + } + + + @JsonProperty(JSON_PROPERTY_PROBLEMS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setProblems(List problems) { + this.problems = problems; + } + + + public AccountCapabilityData requested(Boolean requested) { + this.requested = requested; + return this; + } + + /** + * Indicates whether you requested the capability. + * @return requested + **/ + @ApiModelProperty(required = true, value = "Indicates whether you requested the capability.") + @JsonProperty(JSON_PROPERTY_REQUESTED) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Boolean getRequested() { + return requested; + } + + + @JsonProperty(JSON_PROPERTY_REQUESTED) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setRequested(Boolean requested) { + this.requested = requested; + } + + + public AccountCapabilityData requestedLevel(String requestedLevel) { + this.requestedLevel = requestedLevel; + return this; + } + + /** + * The level that you requested for the capability. Some capabilities have different levels which correspond to thresholds. Higher levels may require additional checks and increased monitoring.Possible values: **notApplicable**, **low**, **medium**, **high**. + * @return requestedLevel + **/ + @ApiModelProperty(required = true, value = "The level that you requested for the capability. Some capabilities have different levels which correspond to thresholds. Higher levels may require additional checks and increased monitoring.Possible values: **notApplicable**, **low**, **medium**, **high**.") + @JsonProperty(JSON_PROPERTY_REQUESTED_LEVEL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getRequestedLevel() { + return requestedLevel; + } + + + @JsonProperty(JSON_PROPERTY_REQUESTED_LEVEL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setRequestedLevel(String requestedLevel) { + this.requestedLevel = requestedLevel; + } + + + public AccountCapabilityData verificationStatus(String verificationStatus) { + this.verificationStatus = verificationStatus; + return this; + } + + /** + * The status of the verification checks for the capability. Possible values: * **pending**: Adyen is running the verification. * **invalid**: The verification failed. Check if the `errors` array contains more information. * **valid**: The verification was successful. * **rejected**: Adyen checked the information and found reasons to not allow the capability. + * @return verificationStatus + **/ + @ApiModelProperty(value = "The status of the verification checks for the capability. Possible values: * **pending**: Adyen is running the verification. * **invalid**: The verification failed. Check if the `errors` array contains more information. * **valid**: The verification was successful. * **rejected**: Adyen checked the information and found reasons to not allow the capability. ") + @JsonProperty(JSON_PROPERTY_VERIFICATION_STATUS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getVerificationStatus() { + return verificationStatus; + } + + + @JsonProperty(JSON_PROPERTY_VERIFICATION_STATUS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setVerificationStatus(String verificationStatus) { + this.verificationStatus = verificationStatus; + } + + + /** + * Return true if this AccountCapabilityData object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AccountCapabilityData accountCapabilityData = (AccountCapabilityData) o; + return Objects.equals(this.allowed, accountCapabilityData.allowed) && + Objects.equals(this.allowedLevel, accountCapabilityData.allowedLevel) && + Objects.equals(this.capability, accountCapabilityData.capability) && + Objects.equals(this.problems, accountCapabilityData.problems) && + Objects.equals(this.requested, accountCapabilityData.requested) && + Objects.equals(this.requestedLevel, accountCapabilityData.requestedLevel) && + Objects.equals(this.verificationStatus, accountCapabilityData.verificationStatus); + } + + @Override + public int hashCode() { + return Objects.hash(allowed, allowedLevel, capability, problems, requested, requestedLevel, verificationStatus); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AccountCapabilityData {\n"); + sb.append(" allowed: ").append(toIndentedString(allowed)).append("\n"); + sb.append(" allowedLevel: ").append(toIndentedString(allowedLevel)).append("\n"); + sb.append(" capability: ").append(toIndentedString(capability)).append("\n"); + sb.append(" problems: ").append(toIndentedString(problems)).append("\n"); + sb.append(" requested: ").append(toIndentedString(requested)).append("\n"); + sb.append(" requestedLevel: ").append(toIndentedString(requestedLevel)).append("\n"); + sb.append(" verificationStatus: ").append(toIndentedString(verificationStatus)).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 AccountCapabilityData given an JSON string + * + * @param jsonString JSON string + * @return An instance of AccountCapabilityData + * @throws JsonProcessingException if the JSON string is invalid with respect to AccountCapabilityData + */ + public static AccountCapabilityData fromJson(String jsonString) throws JsonProcessingException { + return JSON.getMapper().readValue(jsonString, AccountCapabilityData.class); + } +/** + * Convert an instance of AccountCapabilityData 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/managementwebhooks/AccountCreateNotificationData.java b/src/main/java/com/adyen/model/managementwebhooks/AccountCreateNotificationData.java new file mode 100644 index 000000000..07318b136 --- /dev/null +++ b/src/main/java/com/adyen/model/managementwebhooks/AccountCreateNotificationData.java @@ -0,0 +1,261 @@ +/* + * Management Webhooks + * + * The version of the OpenAPI document: 1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.adyen.model.managementwebhooks; + +import java.util.Objects; +import java.util.Arrays; +import java.util.Map; +import java.util.HashMap; +import com.adyen.model.managementwebhooks.AccountCapabilityData; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.core.JsonProcessingException; + + +/** + * AccountCreateNotificationData + */ +@JsonPropertyOrder({ + AccountCreateNotificationData.JSON_PROPERTY_CAPABILITIES, + AccountCreateNotificationData.JSON_PROPERTY_COMPANY_ID, + AccountCreateNotificationData.JSON_PROPERTY_LEGAL_ENTITY_ID, + AccountCreateNotificationData.JSON_PROPERTY_MERCHANT_ID, + AccountCreateNotificationData.JSON_PROPERTY_STATUS +}) + +public class AccountCreateNotificationData { + public static final String JSON_PROPERTY_CAPABILITIES = "capabilities"; + private Map capabilities = new HashMap<>(); + + public static final String JSON_PROPERTY_COMPANY_ID = "companyId"; + private String companyId; + + public static final String JSON_PROPERTY_LEGAL_ENTITY_ID = "legalEntityId"; + private String legalEntityId; + + public static final String JSON_PROPERTY_MERCHANT_ID = "merchantId"; + private String merchantId; + + public static final String JSON_PROPERTY_STATUS = "status"; + private String status; + + public AccountCreateNotificationData() { + } + + public AccountCreateNotificationData capabilities(Map capabilities) { + this.capabilities = capabilities; + return this; + } + + public AccountCreateNotificationData putCapabilitiesItem(String key, AccountCapabilityData capabilitiesItem) { + this.capabilities.put(key, capabilitiesItem); + return this; + } + + /** + * Key-value pairs that specify the actions that the merchant account can do and its settings. The key is a capability. For example, the **sendToTransferInstrument** is the capability required before you can pay out funds to the bank account. The value is an object containing the settings for the capability. + * @return capabilities + **/ + @ApiModelProperty(required = true, value = "Key-value pairs that specify the actions that the merchant account can do and its settings. The key is a capability. For example, the **sendToTransferInstrument** is the capability required before you can pay out funds to the bank account. The value is an object containing the settings for the capability.") + @JsonProperty(JSON_PROPERTY_CAPABILITIES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Map getCapabilities() { + return capabilities; + } + + + @JsonProperty(JSON_PROPERTY_CAPABILITIES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setCapabilities(Map capabilities) { + this.capabilities = capabilities; + } + + + public AccountCreateNotificationData companyId(String companyId) { + this.companyId = companyId; + return this; + } + + /** + * The unique identifier of the company account. + * @return companyId + **/ + @ApiModelProperty(required = true, value = "The unique identifier of the company account.") + @JsonProperty(JSON_PROPERTY_COMPANY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getCompanyId() { + return companyId; + } + + + @JsonProperty(JSON_PROPERTY_COMPANY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setCompanyId(String companyId) { + this.companyId = companyId; + } + + + public AccountCreateNotificationData legalEntityId(String legalEntityId) { + this.legalEntityId = legalEntityId; + return this; + } + + /** + * The unique identifier of the [legal entity](https://docs.adyen.com/api-explorer/legalentity/latest/post/legalEntities#responses-200-id). + * @return legalEntityId + **/ + @ApiModelProperty(value = "The unique identifier of the [legal entity](https://docs.adyen.com/api-explorer/legalentity/latest/post/legalEntities#responses-200-id).") + @JsonProperty(JSON_PROPERTY_LEGAL_ENTITY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getLegalEntityId() { + return legalEntityId; + } + + + @JsonProperty(JSON_PROPERTY_LEGAL_ENTITY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setLegalEntityId(String legalEntityId) { + this.legalEntityId = legalEntityId; + } + + + public AccountCreateNotificationData merchantId(String merchantId) { + this.merchantId = merchantId; + return this; + } + + /** + * The unique identifier of the merchant account. + * @return merchantId + **/ + @ApiModelProperty(required = true, value = "The unique identifier of the merchant account.") + @JsonProperty(JSON_PROPERTY_MERCHANT_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getMerchantId() { + return merchantId; + } + + + @JsonProperty(JSON_PROPERTY_MERCHANT_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setMerchantId(String merchantId) { + this.merchantId = merchantId; + } + + + public AccountCreateNotificationData status(String status) { + this.status = status; + return this; + } + + /** + * The status of the merchant account. Possible values: * **PreActive**: The merchant account has been created. Users cannot access the merchant account in the Customer Area. The account cannot process payments. * **Active**: Users can access the merchant account in the Customer Area. If the company account is also **Active**, then payment processing and payouts are enabled. * **InactiveWithModifications**: Users can access the merchant account in the Customer Area. The account cannot process new payments but can still modify payments, for example issue refunds. The account can still receive payouts. * **Inactive**: Users can access the merchant account in the Customer Area. Payment processing and payouts are disabled. * **Closed**: The account is closed and this cannot be reversed. Users cannot log in. Payment processing and payouts are disabled. + * @return status + **/ + @ApiModelProperty(required = true, value = "The status of the merchant account. Possible values: * **PreActive**: The merchant account has been created. Users cannot access the merchant account in the Customer Area. The account cannot process payments. * **Active**: Users can access the merchant account in the Customer Area. If the company account is also **Active**, then payment processing and payouts are enabled. * **InactiveWithModifications**: Users can access the merchant account in the Customer Area. The account cannot process new payments but can still modify payments, for example issue refunds. The account can still receive payouts. * **Inactive**: Users can access the merchant account in the Customer Area. Payment processing and payouts are disabled. * **Closed**: The account is closed and this cannot be reversed. Users cannot log in. Payment processing and payouts are disabled.") + @JsonProperty(JSON_PROPERTY_STATUS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getStatus() { + return status; + } + + + @JsonProperty(JSON_PROPERTY_STATUS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setStatus(String status) { + this.status = status; + } + + + /** + * Return true if this AccountCreateNotificationData object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AccountCreateNotificationData accountCreateNotificationData = (AccountCreateNotificationData) o; + return Objects.equals(this.capabilities, accountCreateNotificationData.capabilities) && + Objects.equals(this.companyId, accountCreateNotificationData.companyId) && + Objects.equals(this.legalEntityId, accountCreateNotificationData.legalEntityId) && + Objects.equals(this.merchantId, accountCreateNotificationData.merchantId) && + Objects.equals(this.status, accountCreateNotificationData.status); + } + + @Override + public int hashCode() { + return Objects.hash(capabilities, companyId, legalEntityId, merchantId, status); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AccountCreateNotificationData {\n"); + sb.append(" capabilities: ").append(toIndentedString(capabilities)).append("\n"); + sb.append(" companyId: ").append(toIndentedString(companyId)).append("\n"); + sb.append(" legalEntityId: ").append(toIndentedString(legalEntityId)).append("\n"); + sb.append(" merchantId: ").append(toIndentedString(merchantId)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).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 AccountCreateNotificationData given an JSON string + * + * @param jsonString JSON string + * @return An instance of AccountCreateNotificationData + * @throws JsonProcessingException if the JSON string is invalid with respect to AccountCreateNotificationData + */ + public static AccountCreateNotificationData fromJson(String jsonString) throws JsonProcessingException { + return JSON.getMapper().readValue(jsonString, AccountCreateNotificationData.class); + } +/** + * Convert an instance of AccountCreateNotificationData 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/managementwebhooks/AccountNotificationResponse.java b/src/main/java/com/adyen/model/managementwebhooks/AccountNotificationResponse.java new file mode 100644 index 000000000..dbd37f7ca --- /dev/null +++ b/src/main/java/com/adyen/model/managementwebhooks/AccountNotificationResponse.java @@ -0,0 +1,128 @@ +/* + * Management Webhooks + * + * The version of the OpenAPI document: 1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.adyen.model.managementwebhooks; + +import java.util.Objects; +import java.util.Arrays; +import java.util.Map; +import java.util.HashMap; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.core.JsonProcessingException; + + +/** + * AccountNotificationResponse + */ +@JsonPropertyOrder({ + AccountNotificationResponse.JSON_PROPERTY_NOTIFICATION_RESPONSE +}) + +public class AccountNotificationResponse { + public static final String JSON_PROPERTY_NOTIFICATION_RESPONSE = "notificationResponse"; + private String notificationResponse; + + public AccountNotificationResponse() { + } + + public AccountNotificationResponse notificationResponse(String notificationResponse) { + this.notificationResponse = notificationResponse; + return this; + } + + /** + * Respond with **HTTP 200 OK** and `[accepted]` in the response body to [accept the webhook](https://docs.adyen.com/development-resources/webhooks#accept-notifications). + * @return notificationResponse + **/ + @ApiModelProperty(value = "Respond with **HTTP 200 OK** and `[accepted]` in the response body to [accept the webhook](https://docs.adyen.com/development-resources/webhooks#accept-notifications).") + @JsonProperty(JSON_PROPERTY_NOTIFICATION_RESPONSE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getNotificationResponse() { + return notificationResponse; + } + + + @JsonProperty(JSON_PROPERTY_NOTIFICATION_RESPONSE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setNotificationResponse(String notificationResponse) { + this.notificationResponse = notificationResponse; + } + + + /** + * Return true if this AccountNotificationResponse object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AccountNotificationResponse accountNotificationResponse = (AccountNotificationResponse) o; + return Objects.equals(this.notificationResponse, accountNotificationResponse.notificationResponse); + } + + @Override + public int hashCode() { + return Objects.hash(notificationResponse); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AccountNotificationResponse {\n"); + sb.append(" notificationResponse: ").append(toIndentedString(notificationResponse)).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 AccountNotificationResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of AccountNotificationResponse + * @throws JsonProcessingException if the JSON string is invalid with respect to AccountNotificationResponse + */ + public static AccountNotificationResponse fromJson(String jsonString) throws JsonProcessingException { + return JSON.getMapper().readValue(jsonString, AccountNotificationResponse.class); + } +/** + * Convert an instance of AccountNotificationResponse 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/managementwebhooks/AccountUpdateNotificationData.java b/src/main/java/com/adyen/model/managementwebhooks/AccountUpdateNotificationData.java new file mode 100644 index 000000000..81a136990 --- /dev/null +++ b/src/main/java/com/adyen/model/managementwebhooks/AccountUpdateNotificationData.java @@ -0,0 +1,230 @@ +/* + * Management Webhooks + * + * The version of the OpenAPI document: 1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.adyen.model.managementwebhooks; + +import java.util.Objects; +import java.util.Arrays; +import java.util.Map; +import java.util.HashMap; +import com.adyen.model.managementwebhooks.AccountCapabilityData; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.core.JsonProcessingException; + + +/** + * AccountUpdateNotificationData + */ +@JsonPropertyOrder({ + AccountUpdateNotificationData.JSON_PROPERTY_CAPABILITIES, + AccountUpdateNotificationData.JSON_PROPERTY_LEGAL_ENTITY_ID, + AccountUpdateNotificationData.JSON_PROPERTY_MERCHANT_ID, + AccountUpdateNotificationData.JSON_PROPERTY_STATUS +}) + +public class AccountUpdateNotificationData { + public static final String JSON_PROPERTY_CAPABILITIES = "capabilities"; + private Map capabilities = new HashMap<>(); + + public static final String JSON_PROPERTY_LEGAL_ENTITY_ID = "legalEntityId"; + private String legalEntityId; + + public static final String JSON_PROPERTY_MERCHANT_ID = "merchantId"; + private String merchantId; + + public static final String JSON_PROPERTY_STATUS = "status"; + private String status; + + public AccountUpdateNotificationData() { + } + + public AccountUpdateNotificationData capabilities(Map capabilities) { + this.capabilities = capabilities; + return this; + } + + public AccountUpdateNotificationData putCapabilitiesItem(String key, AccountCapabilityData capabilitiesItem) { + this.capabilities.put(key, capabilitiesItem); + return this; + } + + /** + * Key-value pairs that specify what you can do with the merchant account and its settings. The key is a capability. For example, the **sendToTransferInstrument** is the capability required before you can pay out the funds of a merchant account to a [bank account](https://docs.adyen.com/api-explorer/legalentity/latest/post/transferInstruments). The value is an object containing the settings for the capability. + * @return capabilities + **/ + @ApiModelProperty(required = true, value = "Key-value pairs that specify what you can do with the merchant account and its settings. The key is a capability. For example, the **sendToTransferInstrument** is the capability required before you can pay out the funds of a merchant account to a [bank account](https://docs.adyen.com/api-explorer/legalentity/latest/post/transferInstruments). The value is an object containing the settings for the capability.") + @JsonProperty(JSON_PROPERTY_CAPABILITIES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Map getCapabilities() { + return capabilities; + } + + + @JsonProperty(JSON_PROPERTY_CAPABILITIES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setCapabilities(Map capabilities) { + this.capabilities = capabilities; + } + + + public AccountUpdateNotificationData legalEntityId(String legalEntityId) { + this.legalEntityId = legalEntityId; + return this; + } + + /** + * The unique identifier of the [legal entity](https://docs.adyen.com/api-explorer/legalentity/latest/post/legalEntities#responses-200-id). + * @return legalEntityId + **/ + @ApiModelProperty(value = "The unique identifier of the [legal entity](https://docs.adyen.com/api-explorer/legalentity/latest/post/legalEntities#responses-200-id).") + @JsonProperty(JSON_PROPERTY_LEGAL_ENTITY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getLegalEntityId() { + return legalEntityId; + } + + + @JsonProperty(JSON_PROPERTY_LEGAL_ENTITY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setLegalEntityId(String legalEntityId) { + this.legalEntityId = legalEntityId; + } + + + public AccountUpdateNotificationData merchantId(String merchantId) { + this.merchantId = merchantId; + return this; + } + + /** + * The unique identifier of the merchant account. + * @return merchantId + **/ + @ApiModelProperty(required = true, value = "The unique identifier of the merchant account.") + @JsonProperty(JSON_PROPERTY_MERCHANT_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getMerchantId() { + return merchantId; + } + + + @JsonProperty(JSON_PROPERTY_MERCHANT_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setMerchantId(String merchantId) { + this.merchantId = merchantId; + } + + + public AccountUpdateNotificationData status(String status) { + this.status = status; + return this; + } + + /** + * The status of the merchant account. Possible values: * **PreActive**: The merchant account has been created. Users cannot access the merchant account in the Customer Area. The account cannot process payments. * **Active**: Users can access the merchant account in the Customer Area. If the company account is also **Active**, then payment processing and payouts are enabled. * **InactiveWithModifications**: Users can access the merchant account in the Customer Area. The account cannot process new payments but can still modify payments, for example issue refunds. The account can still receive payouts. * **Inactive**: Users can access the merchant account in the Customer Area. Payment processing and payouts are disabled. * **Closed**: The account is closed and this cannot be reversed. Users cannot log in. Payment processing and payouts are disabled. + * @return status + **/ + @ApiModelProperty(required = true, value = "The status of the merchant account. Possible values: * **PreActive**: The merchant account has been created. Users cannot access the merchant account in the Customer Area. The account cannot process payments. * **Active**: Users can access the merchant account in the Customer Area. If the company account is also **Active**, then payment processing and payouts are enabled. * **InactiveWithModifications**: Users can access the merchant account in the Customer Area. The account cannot process new payments but can still modify payments, for example issue refunds. The account can still receive payouts. * **Inactive**: Users can access the merchant account in the Customer Area. Payment processing and payouts are disabled. * **Closed**: The account is closed and this cannot be reversed. Users cannot log in. Payment processing and payouts are disabled.") + @JsonProperty(JSON_PROPERTY_STATUS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getStatus() { + return status; + } + + + @JsonProperty(JSON_PROPERTY_STATUS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setStatus(String status) { + this.status = status; + } + + + /** + * Return true if this AccountUpdateNotificationData object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AccountUpdateNotificationData accountUpdateNotificationData = (AccountUpdateNotificationData) o; + return Objects.equals(this.capabilities, accountUpdateNotificationData.capabilities) && + Objects.equals(this.legalEntityId, accountUpdateNotificationData.legalEntityId) && + Objects.equals(this.merchantId, accountUpdateNotificationData.merchantId) && + Objects.equals(this.status, accountUpdateNotificationData.status); + } + + @Override + public int hashCode() { + return Objects.hash(capabilities, legalEntityId, merchantId, status); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AccountUpdateNotificationData {\n"); + sb.append(" capabilities: ").append(toIndentedString(capabilities)).append("\n"); + sb.append(" legalEntityId: ").append(toIndentedString(legalEntityId)).append("\n"); + sb.append(" merchantId: ").append(toIndentedString(merchantId)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).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 AccountUpdateNotificationData given an JSON string + * + * @param jsonString JSON string + * @return An instance of AccountUpdateNotificationData + * @throws JsonProcessingException if the JSON string is invalid with respect to AccountUpdateNotificationData + */ + public static AccountUpdateNotificationData fromJson(String jsonString) throws JsonProcessingException { + return JSON.getMapper().readValue(jsonString, AccountUpdateNotificationData.class); + } +/** + * Convert an instance of AccountUpdateNotificationData 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/managementwebhooks/CapabilityProblem.java b/src/main/java/com/adyen/model/managementwebhooks/CapabilityProblem.java new file mode 100644 index 000000000..1a7288c65 --- /dev/null +++ b/src/main/java/com/adyen/model/managementwebhooks/CapabilityProblem.java @@ -0,0 +1,171 @@ +/* + * Management Webhooks + * + * The version of the OpenAPI document: 1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.adyen.model.managementwebhooks; + +import java.util.Objects; +import java.util.Arrays; +import java.util.Map; +import java.util.HashMap; +import com.adyen.model.managementwebhooks.CapabilityProblemEntity; +import com.adyen.model.managementwebhooks.VerificationError; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.core.JsonProcessingException; + + +/** + * CapabilityProblem + */ +@JsonPropertyOrder({ + CapabilityProblem.JSON_PROPERTY_ENTITY, + CapabilityProblem.JSON_PROPERTY_VERIFICATION_ERRORS +}) + +public class CapabilityProblem { + public static final String JSON_PROPERTY_ENTITY = "entity"; + private CapabilityProblemEntity entity; + + public static final String JSON_PROPERTY_VERIFICATION_ERRORS = "verificationErrors"; + private List verificationErrors = null; + + public CapabilityProblem() { + } + + public CapabilityProblem entity(CapabilityProblemEntity entity) { + this.entity = entity; + return this; + } + + /** + * Get entity + * @return entity + **/ + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_ENTITY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public CapabilityProblemEntity getEntity() { + return entity; + } + + + @JsonProperty(JSON_PROPERTY_ENTITY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setEntity(CapabilityProblemEntity entity) { + this.entity = entity; + } + + + public CapabilityProblem verificationErrors(List verificationErrors) { + this.verificationErrors = verificationErrors; + return this; + } + + public CapabilityProblem addVerificationErrorsItem(VerificationError verificationErrorsItem) { + if (this.verificationErrors == null) { + this.verificationErrors = new ArrayList<>(); + } + this.verificationErrors.add(verificationErrorsItem); + return this; + } + + /** + * List of verification errors. + * @return verificationErrors + **/ + @ApiModelProperty(value = "List of verification errors.") + @JsonProperty(JSON_PROPERTY_VERIFICATION_ERRORS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public List getVerificationErrors() { + return verificationErrors; + } + + + @JsonProperty(JSON_PROPERTY_VERIFICATION_ERRORS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setVerificationErrors(List verificationErrors) { + this.verificationErrors = verificationErrors; + } + + + /** + * Return true if this CapabilityProblem object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CapabilityProblem capabilityProblem = (CapabilityProblem) o; + return Objects.equals(this.entity, capabilityProblem.entity) && + Objects.equals(this.verificationErrors, capabilityProblem.verificationErrors); + } + + @Override + public int hashCode() { + return Objects.hash(entity, verificationErrors); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CapabilityProblem {\n"); + sb.append(" entity: ").append(toIndentedString(entity)).append("\n"); + sb.append(" verificationErrors: ").append(toIndentedString(verificationErrors)).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 CapabilityProblem given an JSON string + * + * @param jsonString JSON string + * @return An instance of CapabilityProblem + * @throws JsonProcessingException if the JSON string is invalid with respect to CapabilityProblem + */ + public static CapabilityProblem fromJson(String jsonString) throws JsonProcessingException { + return JSON.getMapper().readValue(jsonString, CapabilityProblem.class); + } +/** + * Convert an instance of CapabilityProblem 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/managementwebhooks/CapabilityProblemEntity.java b/src/main/java/com/adyen/model/managementwebhooks/CapabilityProblemEntity.java new file mode 100644 index 000000000..62822707b --- /dev/null +++ b/src/main/java/com/adyen/model/managementwebhooks/CapabilityProblemEntity.java @@ -0,0 +1,269 @@ +/* + * Management Webhooks + * + * The version of the OpenAPI document: 1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.adyen.model.managementwebhooks; + +import java.util.Objects; +import java.util.Arrays; +import java.util.Map; +import java.util.HashMap; +import com.adyen.model.managementwebhooks.CapabilityProblemEntityRecursive; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.core.JsonProcessingException; + + +/** + * CapabilityProblemEntity + */ +@JsonPropertyOrder({ + CapabilityProblemEntity.JSON_PROPERTY_DOCUMENTS, + CapabilityProblemEntity.JSON_PROPERTY_ID, + CapabilityProblemEntity.JSON_PROPERTY_OWNER, + CapabilityProblemEntity.JSON_PROPERTY_TYPE +}) + +public class CapabilityProblemEntity { + public static final String JSON_PROPERTY_DOCUMENTS = "documents"; + private List documents = null; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_OWNER = "owner"; + private CapabilityProblemEntityRecursive owner; + + /** + * The type of entity. Possible values: **LegalEntity**, **BankAccount**, or **Document**. + */ + public enum TypeEnum { + BANKACCOUNT("BankAccount"), + + DOCUMENT("Document"), + + LEGALENTITY("LegalEntity"); + + 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; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_TYPE = "type"; + private TypeEnum type; + + public CapabilityProblemEntity() { + } + + public CapabilityProblemEntity documents(List documents) { + this.documents = documents; + return this; + } + + public CapabilityProblemEntity addDocumentsItem(String documentsItem) { + if (this.documents == null) { + this.documents = new ArrayList<>(); + } + this.documents.add(documentsItem); + return this; + } + + /** + * List of document IDs to which the verification errors related to the capabilities correspond to. + * @return documents + **/ + @ApiModelProperty(value = "List of document IDs to which the verification errors related to the capabilities correspond to.") + @JsonProperty(JSON_PROPERTY_DOCUMENTS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public List getDocuments() { + return documents; + } + + + @JsonProperty(JSON_PROPERTY_DOCUMENTS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setDocuments(List documents) { + this.documents = documents; + } + + + public CapabilityProblemEntity id(String id) { + this.id = id; + return this; + } + + /** + * The ID of the entity. + * @return id + **/ + @ApiModelProperty(value = "The ID of the entity.") + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getId() { + return id; + } + + + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setId(String id) { + this.id = id; + } + + + public CapabilityProblemEntity owner(CapabilityProblemEntityRecursive owner) { + this.owner = owner; + return this; + } + + /** + * Get owner + * @return owner + **/ + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_OWNER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public CapabilityProblemEntityRecursive getOwner() { + return owner; + } + + + @JsonProperty(JSON_PROPERTY_OWNER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setOwner(CapabilityProblemEntityRecursive owner) { + this.owner = owner; + } + + + public CapabilityProblemEntity type(TypeEnum type) { + this.type = type; + return this; + } + + /** + * The type of entity. Possible values: **LegalEntity**, **BankAccount**, or **Document**. + * @return type + **/ + @ApiModelProperty(value = "The type of entity. Possible values: **LegalEntity**, **BankAccount**, or **Document**.") + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public TypeEnum getType() { + return type; + } + + + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setType(TypeEnum type) { + this.type = type; + } + + + /** + * Return true if this CapabilityProblemEntity object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CapabilityProblemEntity capabilityProblemEntity = (CapabilityProblemEntity) o; + return Objects.equals(this.documents, capabilityProblemEntity.documents) && + Objects.equals(this.id, capabilityProblemEntity.id) && + Objects.equals(this.owner, capabilityProblemEntity.owner) && + Objects.equals(this.type, capabilityProblemEntity.type); + } + + @Override + public int hashCode() { + return Objects.hash(documents, id, owner, type); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CapabilityProblemEntity {\n"); + sb.append(" documents: ").append(toIndentedString(documents)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" owner: ").append(toIndentedString(owner)).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 CapabilityProblemEntity given an JSON string + * + * @param jsonString JSON string + * @return An instance of CapabilityProblemEntity + * @throws JsonProcessingException if the JSON string is invalid with respect to CapabilityProblemEntity + */ + public static CapabilityProblemEntity fromJson(String jsonString) throws JsonProcessingException { + return JSON.getMapper().readValue(jsonString, CapabilityProblemEntity.class); + } +/** + * Convert an instance of CapabilityProblemEntity 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/managementwebhooks/CapabilityProblemEntityRecursive.java b/src/main/java/com/adyen/model/managementwebhooks/CapabilityProblemEntityRecursive.java new file mode 100644 index 000000000..9a0aea1e7 --- /dev/null +++ b/src/main/java/com/adyen/model/managementwebhooks/CapabilityProblemEntityRecursive.java @@ -0,0 +1,238 @@ +/* + * Management Webhooks + * + * The version of the OpenAPI document: 1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.adyen.model.managementwebhooks; + +import java.util.Objects; +import java.util.Arrays; +import java.util.Map; +import java.util.HashMap; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.core.JsonProcessingException; + + +/** + * CapabilityProblemEntityRecursive + */ +@JsonPropertyOrder({ + CapabilityProblemEntityRecursive.JSON_PROPERTY_DOCUMENTS, + CapabilityProblemEntityRecursive.JSON_PROPERTY_ID, + CapabilityProblemEntityRecursive.JSON_PROPERTY_TYPE +}) +@JsonTypeName("CapabilityProblemEntity-recursive") + +public class CapabilityProblemEntityRecursive { + public static final String JSON_PROPERTY_DOCUMENTS = "documents"; + private List documents = null; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + /** + * The type of entity. Possible values: **LegalEntity**, **BankAccount**, or **Document**. + */ + public enum TypeEnum { + BANKACCOUNT("BankAccount"), + + DOCUMENT("Document"), + + LEGALENTITY("LegalEntity"); + + 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; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_TYPE = "type"; + private TypeEnum type; + + public CapabilityProblemEntityRecursive() { + } + + public CapabilityProblemEntityRecursive documents(List documents) { + this.documents = documents; + return this; + } + + public CapabilityProblemEntityRecursive addDocumentsItem(String documentsItem) { + if (this.documents == null) { + this.documents = new ArrayList<>(); + } + this.documents.add(documentsItem); + return this; + } + + /** + * List of document IDs to which the verification errors related to the capabilities correspond to. + * @return documents + **/ + @ApiModelProperty(value = "List of document IDs to which the verification errors related to the capabilities correspond to.") + @JsonProperty(JSON_PROPERTY_DOCUMENTS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public List getDocuments() { + return documents; + } + + + @JsonProperty(JSON_PROPERTY_DOCUMENTS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setDocuments(List documents) { + this.documents = documents; + } + + + public CapabilityProblemEntityRecursive id(String id) { + this.id = id; + return this; + } + + /** + * The ID of the entity. + * @return id + **/ + @ApiModelProperty(value = "The ID of the entity.") + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getId() { + return id; + } + + + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setId(String id) { + this.id = id; + } + + + public CapabilityProblemEntityRecursive type(TypeEnum type) { + this.type = type; + return this; + } + + /** + * The type of entity. Possible values: **LegalEntity**, **BankAccount**, or **Document**. + * @return type + **/ + @ApiModelProperty(value = "The type of entity. Possible values: **LegalEntity**, **BankAccount**, or **Document**.") + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public TypeEnum getType() { + return type; + } + + + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setType(TypeEnum type) { + this.type = type; + } + + + /** + * Return true if this CapabilityProblemEntity-recursive object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CapabilityProblemEntityRecursive capabilityProblemEntityRecursive = (CapabilityProblemEntityRecursive) o; + return Objects.equals(this.documents, capabilityProblemEntityRecursive.documents) && + Objects.equals(this.id, capabilityProblemEntityRecursive.id) && + Objects.equals(this.type, capabilityProblemEntityRecursive.type); + } + + @Override + public int hashCode() { + return Objects.hash(documents, id, type); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CapabilityProblemEntityRecursive {\n"); + sb.append(" documents: ").append(toIndentedString(documents)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +/** + * Create an instance of CapabilityProblemEntityRecursive given an JSON string + * + * @param jsonString JSON string + * @return An instance of CapabilityProblemEntityRecursive + * @throws JsonProcessingException if the JSON string is invalid with respect to CapabilityProblemEntityRecursive + */ + public static CapabilityProblemEntityRecursive fromJson(String jsonString) throws JsonProcessingException { + return JSON.getMapper().readValue(jsonString, CapabilityProblemEntityRecursive.class); + } +/** + * Convert an instance of CapabilityProblemEntityRecursive 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/managementwebhooks/JSON.java b/src/main/java/com/adyen/model/managementwebhooks/JSON.java new file mode 100644 index 000000000..6568e459e --- /dev/null +++ b/src/main/java/com/adyen/model/managementwebhooks/JSON.java @@ -0,0 +1,251 @@ +package com.adyen.model.managementwebhooks; + +import com.adyen.serializer.ByteArraySerializer; +import com.fasterxml.jackson.annotation.*; +import com.fasterxml.jackson.databind.*; +import com.fasterxml.jackson.databind.json.JsonMapper; +import com.fasterxml.jackson.databind.module.SimpleModule; +import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; +import com.adyen.model.managementwebhooks.*; + +import java.text.DateFormat; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; +import jakarta.ws.rs.core.GenericType; +import jakarta.ws.rs.ext.ContextResolver; + +public class JSON implements ContextResolver { + private static ObjectMapper mapper; + + public JSON() { + mapper = new ObjectMapper(); + mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); + JsonMapper.builder().configure(MapperFeature.ALLOW_COERCION_OF_SCALARS, false); + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + mapper.configure(DeserializationFeature.FAIL_ON_INVALID_SUBTYPE, true); + mapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS); + mapper.disable(DeserializationFeature.ADJUST_DATES_TO_CONTEXT_TIME_ZONE); + mapper.enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING); + mapper.enable(DeserializationFeature.READ_ENUMS_USING_TO_STRING); + mapper.registerModule(new JavaTimeModule()); + // Custom ByteSerializer + SimpleModule simpleModule = new SimpleModule(); + simpleModule.addSerializer(byte[].class, new ByteArraySerializer()); + mapper.registerModule(simpleModule); + } + + /** + * Set the date format for JSON (de)serialization with Date properties. + * @param dateFormat Date format + */ + public void setDateFormat(DateFormat dateFormat) { + mapper.setDateFormat(dateFormat); + } + + @Override + public ObjectMapper getContext(Class type) { + return mapper; + } + + /** + * Get the object mapper + * + * @return object mapper + */ + public static ObjectMapper getMapper() { return mapper; } + + /** + * Returns the target model class that should be used to deserialize the input data. + * The discriminator mappings are used to determine the target model class. + * + * @param node The input data. + * @param modelClass The class that contains the discriminator mappings. + */ + public static Class getClassForElement(JsonNode node, Class modelClass) { + ClassDiscriminatorMapping cdm = modelDiscriminators.get(modelClass); + if (cdm != null) { + return cdm.getClassForElement(node, new HashSet>()); + } + return null; + } + + /** + * Helper class to register the discriminator mappings. + */ + private static class ClassDiscriminatorMapping { + // The model class name. + Class modelClass; + // The name of the discriminator property. + String discriminatorName; + // The discriminator mappings for a model class. + Map> discriminatorMappings; + + // Constructs a new class discriminator. + ClassDiscriminatorMapping(Class cls, String propertyName, Map> mappings) { + modelClass = cls; + discriminatorName = propertyName; + discriminatorMappings = new HashMap>(); + if (mappings != null) { + discriminatorMappings.putAll(mappings); + } + } + + // Return the name of the discriminator property for this model class. + String getDiscriminatorPropertyName() { + return discriminatorName; + } + + // Return the discriminator value or null if the discriminator is not + // present in the payload. + String getDiscriminatorValue(JsonNode node) { + // Determine the value of the discriminator property in the input data. + if (discriminatorName != null) { + // Get the value of the discriminator property, if present in the input payload. + node = node.get(discriminatorName); + if (node != null && node.isValueNode()) { + String discrValue = node.asText(); + if (discrValue != null) { + return discrValue; + } + } + } + return null; + } + + /** + * Returns the target model class that should be used to deserialize the input data. + * This function can be invoked for anyOf/oneOf composed models with discriminator mappings. + * The discriminator mappings are used to determine the target model class. + * + * @param node The input data. + * @param visitedClasses The set of classes that have already been visited. + */ + Class getClassForElement(JsonNode node, Set> visitedClasses) { + if (visitedClasses.contains(modelClass)) { + // Class has already been visited. + return null; + } + // Determine the value of the discriminator property in the input data. + String discrValue = getDiscriminatorValue(node); + if (discrValue == null) { + return null; + } + Class cls = discriminatorMappings.get(discrValue); + // It may not be sufficient to return this cls directly because that target class + // may itself be a composed schema, possibly with its own discriminator. + visitedClasses.add(modelClass); + for (Class childClass : discriminatorMappings.values()) { + ClassDiscriminatorMapping childCdm = modelDiscriminators.get(childClass); + if (childCdm == null) { + continue; + } + if (!discriminatorName.equals(childCdm.discriminatorName)) { + discrValue = getDiscriminatorValue(node); + if (discrValue == null) { + continue; + } + } + if (childCdm != null) { + // Recursively traverse the discriminator mappings. + Class childDiscr = childCdm.getClassForElement(node, visitedClasses); + if (childDiscr != null) { + return childDiscr; + } + } + } + return cls; + } + } + + /** + * Returns true if inst is an instance of modelClass in the OpenAPI model hierarchy. + * + * The Java class hierarchy is not implemented the same way as the OpenAPI model hierarchy, + * so it's not possible to use the instanceof keyword. + * + * @param modelClass A OpenAPI model class. + * @param inst The instance object. + */ + public static boolean isInstanceOf(Class modelClass, Object inst, Set> visitedClasses) { + if (modelClass.isInstance(inst)) { + // This handles the 'allOf' use case with single parent inheritance. + return true; + } + if (visitedClasses.contains(modelClass)) { + // This is to prevent infinite recursion when the composed schemas have + // a circular dependency. + return false; + } + visitedClasses.add(modelClass); + + // Traverse the oneOf/anyOf composed schemas. + Map descendants = modelDescendants.get(modelClass); + if (descendants != null) { + for (GenericType childType : descendants.values()) { + if (isInstanceOf(childType.getRawType(), inst, visitedClasses)) { + return true; + } + } + } + return false; + } + + /** + * A map of discriminators for all model classes. + */ + private static Map, ClassDiscriminatorMapping> modelDiscriminators = new HashMap, ClassDiscriminatorMapping>(); + + /** + * A map of oneOf/anyOf descendants for each model class. + */ + private static Map, Map> modelDescendants = new HashMap, Map>(); + + /** + * Register a model class discriminator. + * + * @param modelClass the model class + * @param discriminatorPropertyName the name of the discriminator property + * @param mappings a map with the discriminator mappings. + */ + public static void registerDiscriminator(Class modelClass, String discriminatorPropertyName, Map> mappings) { + ClassDiscriminatorMapping m = new ClassDiscriminatorMapping(modelClass, discriminatorPropertyName, mappings); + modelDiscriminators.put(modelClass, m); + } + + /** + * Register the oneOf/anyOf descendants of the modelClass. + * + * @param modelClass the model class + * @param descendants a map of oneOf/anyOf descendants. + */ + public static void registerDescendants(Class modelClass, Map descendants) { + modelDescendants.put(modelClass, descendants); + } + + private static JSON json; + + static + { + json = new JSON(); + } + + /** + * Get the default JSON instance. + * + * @return the default JSON instance + */ + public static JSON getDefault() { + return json; + } + + /** + * Set the default JSON instance. + * + * @param json JSON instance to be used + */ + public static void setDefault(JSON json) { + JSON.json = json; + } +} diff --git a/src/main/java/com/adyen/model/managementwebhooks/MerchantCreatedNotificationRequest.java b/src/main/java/com/adyen/model/managementwebhooks/MerchantCreatedNotificationRequest.java new file mode 100644 index 000000000..5192e27f4 --- /dev/null +++ b/src/main/java/com/adyen/model/managementwebhooks/MerchantCreatedNotificationRequest.java @@ -0,0 +1,256 @@ +/* + * Management Webhooks + * + * The version of the OpenAPI document: 1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.adyen.model.managementwebhooks; + +import java.util.Objects; +import java.util.Arrays; +import java.util.Map; +import java.util.HashMap; +import com.adyen.model.managementwebhooks.AccountCreateNotificationData; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.time.OffsetDateTime; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.core.JsonProcessingException; + + +/** + * MerchantCreatedNotificationRequest + */ +@JsonPropertyOrder({ + MerchantCreatedNotificationRequest.JSON_PROPERTY_CREATED_AT, + MerchantCreatedNotificationRequest.JSON_PROPERTY_DATA, + MerchantCreatedNotificationRequest.JSON_PROPERTY_ENVIRONMENT, + MerchantCreatedNotificationRequest.JSON_PROPERTY_TYPE +}) + +public class MerchantCreatedNotificationRequest { + public static final String JSON_PROPERTY_CREATED_AT = "createdAt"; + private OffsetDateTime createdAt; + + public static final String JSON_PROPERTY_DATA = "data"; + private AccountCreateNotificationData data; + + public static final String JSON_PROPERTY_ENVIRONMENT = "environment"; + private String environment; + + /** + * Type of notification. + */ + public enum TypeEnum { + MERCHANT_CREATED("merchant.created"); + + 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; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_TYPE = "type"; + private TypeEnum type; + + public MerchantCreatedNotificationRequest() { + } + + public MerchantCreatedNotificationRequest createdAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * Timestamp for when the webhook was created. + * @return createdAt + **/ + @ApiModelProperty(required = true, value = "Timestamp for when the webhook was created.") + @JsonProperty(JSON_PROPERTY_CREATED_AT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + + @JsonProperty(JSON_PROPERTY_CREATED_AT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setCreatedAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + + public MerchantCreatedNotificationRequest data(AccountCreateNotificationData data) { + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @ApiModelProperty(required = true, value = "") + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public AccountCreateNotificationData getData() { + return data; + } + + + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setData(AccountCreateNotificationData data) { + this.data = data; + } + + + public MerchantCreatedNotificationRequest environment(String environment) { + this.environment = environment; + return this; + } + + /** + * The environment from which the webhook originated. Possible values: **test**, **live**. + * @return environment + **/ + @ApiModelProperty(required = true, value = "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; + } + + + @JsonProperty(JSON_PROPERTY_ENVIRONMENT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setEnvironment(String environment) { + this.environment = environment; + } + + + public MerchantCreatedNotificationRequest type(TypeEnum type) { + this.type = type; + return this; + } + + /** + * Type of notification. + * @return type + **/ + @ApiModelProperty(required = true, value = "Type of notification.") + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public TypeEnum getType() { + return type; + } + + + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setType(TypeEnum type) { + this.type = type; + } + + + /** + * Return true if this MerchantCreatedNotificationRequest object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MerchantCreatedNotificationRequest merchantCreatedNotificationRequest = (MerchantCreatedNotificationRequest) o; + return Objects.equals(this.createdAt, merchantCreatedNotificationRequest.createdAt) && + Objects.equals(this.data, merchantCreatedNotificationRequest.data) && + Objects.equals(this.environment, merchantCreatedNotificationRequest.environment) && + Objects.equals(this.type, merchantCreatedNotificationRequest.type); + } + + @Override + public int hashCode() { + return Objects.hash(createdAt, data, environment, type); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MerchantCreatedNotificationRequest {\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" environment: ").append(toIndentedString(environment)).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 MerchantCreatedNotificationRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of MerchantCreatedNotificationRequest + * @throws JsonProcessingException if the JSON string is invalid with respect to MerchantCreatedNotificationRequest + */ + public static MerchantCreatedNotificationRequest fromJson(String jsonString) throws JsonProcessingException { + return JSON.getMapper().readValue(jsonString, MerchantCreatedNotificationRequest.class); + } +/** + * Convert an instance of MerchantCreatedNotificationRequest 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/managementwebhooks/MerchantUpdatedNotificationRequest.java b/src/main/java/com/adyen/model/managementwebhooks/MerchantUpdatedNotificationRequest.java new file mode 100644 index 000000000..2b2ba66c7 --- /dev/null +++ b/src/main/java/com/adyen/model/managementwebhooks/MerchantUpdatedNotificationRequest.java @@ -0,0 +1,256 @@ +/* + * Management Webhooks + * + * The version of the OpenAPI document: 1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.adyen.model.managementwebhooks; + +import java.util.Objects; +import java.util.Arrays; +import java.util.Map; +import java.util.HashMap; +import com.adyen.model.managementwebhooks.AccountUpdateNotificationData; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.time.OffsetDateTime; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.core.JsonProcessingException; + + +/** + * MerchantUpdatedNotificationRequest + */ +@JsonPropertyOrder({ + MerchantUpdatedNotificationRequest.JSON_PROPERTY_CREATED_AT, + MerchantUpdatedNotificationRequest.JSON_PROPERTY_DATA, + MerchantUpdatedNotificationRequest.JSON_PROPERTY_ENVIRONMENT, + MerchantUpdatedNotificationRequest.JSON_PROPERTY_TYPE +}) + +public class MerchantUpdatedNotificationRequest { + public static final String JSON_PROPERTY_CREATED_AT = "createdAt"; + private OffsetDateTime createdAt; + + public static final String JSON_PROPERTY_DATA = "data"; + private AccountUpdateNotificationData data; + + public static final String JSON_PROPERTY_ENVIRONMENT = "environment"; + private String environment; + + /** + * Type of notification. + */ + public enum TypeEnum { + MERCHANT_UPDATED("merchant.updated"); + + 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; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_TYPE = "type"; + private TypeEnum type; + + public MerchantUpdatedNotificationRequest() { + } + + public MerchantUpdatedNotificationRequest createdAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * Timestamp for when the webhook was created. + * @return createdAt + **/ + @ApiModelProperty(required = true, value = "Timestamp for when the webhook was created.") + @JsonProperty(JSON_PROPERTY_CREATED_AT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + + @JsonProperty(JSON_PROPERTY_CREATED_AT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setCreatedAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + + public MerchantUpdatedNotificationRequest data(AccountUpdateNotificationData data) { + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @ApiModelProperty(required = true, value = "") + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public AccountUpdateNotificationData getData() { + return data; + } + + + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setData(AccountUpdateNotificationData data) { + this.data = data; + } + + + public MerchantUpdatedNotificationRequest environment(String environment) { + this.environment = environment; + return this; + } + + /** + * The environment from which the webhook originated. Possible values: **test**, **live**. + * @return environment + **/ + @ApiModelProperty(required = true, value = "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; + } + + + @JsonProperty(JSON_PROPERTY_ENVIRONMENT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setEnvironment(String environment) { + this.environment = environment; + } + + + public MerchantUpdatedNotificationRequest type(TypeEnum type) { + this.type = type; + return this; + } + + /** + * Type of notification. + * @return type + **/ + @ApiModelProperty(required = true, value = "Type of notification.") + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public TypeEnum getType() { + return type; + } + + + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setType(TypeEnum type) { + this.type = type; + } + + + /** + * Return true if this MerchantUpdatedNotificationRequest object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MerchantUpdatedNotificationRequest merchantUpdatedNotificationRequest = (MerchantUpdatedNotificationRequest) o; + return Objects.equals(this.createdAt, merchantUpdatedNotificationRequest.createdAt) && + Objects.equals(this.data, merchantUpdatedNotificationRequest.data) && + Objects.equals(this.environment, merchantUpdatedNotificationRequest.environment) && + Objects.equals(this.type, merchantUpdatedNotificationRequest.type); + } + + @Override + public int hashCode() { + return Objects.hash(createdAt, data, environment, type); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MerchantUpdatedNotificationRequest {\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" environment: ").append(toIndentedString(environment)).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 MerchantUpdatedNotificationRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of MerchantUpdatedNotificationRequest + * @throws JsonProcessingException if the JSON string is invalid with respect to MerchantUpdatedNotificationRequest + */ + public static MerchantUpdatedNotificationRequest fromJson(String jsonString) throws JsonProcessingException { + return JSON.getMapper().readValue(jsonString, MerchantUpdatedNotificationRequest.class); + } +/** + * Convert an instance of MerchantUpdatedNotificationRequest 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/managementwebhooks/MidServiceNotificationData.java b/src/main/java/com/adyen/model/managementwebhooks/MidServiceNotificationData.java new file mode 100644 index 000000000..b2b2e8e5c --- /dev/null +++ b/src/main/java/com/adyen/model/managementwebhooks/MidServiceNotificationData.java @@ -0,0 +1,450 @@ +/* + * Management Webhooks + * + * The version of the OpenAPI document: 1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.adyen.model.managementwebhooks; + +import java.util.Objects; +import java.util.Arrays; +import java.util.Map; +import java.util.HashMap; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.core.JsonProcessingException; + + +/** + * MidServiceNotificationData + */ +@JsonPropertyOrder({ + MidServiceNotificationData.JSON_PROPERTY_ALLOWED, + MidServiceNotificationData.JSON_PROPERTY_ENABLED, + MidServiceNotificationData.JSON_PROPERTY_ID, + MidServiceNotificationData.JSON_PROPERTY_MERCHANT_ID, + MidServiceNotificationData.JSON_PROPERTY_REFERENCE, + MidServiceNotificationData.JSON_PROPERTY_RESULT, + MidServiceNotificationData.JSON_PROPERTY_STORE_ID, + MidServiceNotificationData.JSON_PROPERTY_TYPE, + MidServiceNotificationData.JSON_PROPERTY_VERIFICATION_STATUS +}) + +public class MidServiceNotificationData { + public static final String JSON_PROPERTY_ALLOWED = "allowed"; + private Boolean allowed; + + public static final String JSON_PROPERTY_ENABLED = "enabled"; + private Boolean enabled; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_MERCHANT_ID = "merchantId"; + private String merchantId; + + public static final String JSON_PROPERTY_REFERENCE = "reference"; + private String reference; + + /** + * The result of the request to create a payment method. + */ + public enum ResultEnum { + SUCCESS("SUCCESS"), + + FAILURE("FAILURE"); + + private String value; + + ResultEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static ResultEnum fromValue(String value) { + for (ResultEnum b : ResultEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_RESULT = "result"; + private ResultEnum result; + + public static final String JSON_PROPERTY_STORE_ID = "storeId"; + private String storeId; + + public static final String JSON_PROPERTY_TYPE = "type"; + private String type; + + /** + * Payment method status. Possible values: * **valid** * **pending** * **invalid** * **rejected** + */ + public enum VerificationStatusEnum { + VALID("valid"), + + PENDING("pending"), + + INVALID("invalid"), + + REJECTED("rejected"); + + private String value; + + VerificationStatusEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static VerificationStatusEnum fromValue(String value) { + for (VerificationStatusEnum b : VerificationStatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_VERIFICATION_STATUS = "verificationStatus"; + private VerificationStatusEnum verificationStatus; + + public MidServiceNotificationData() { + } + + public MidServiceNotificationData allowed(Boolean allowed) { + this.allowed = allowed; + return this; + } + + /** + * Indicates whether receiving payments is allowed. This value is set to **true** by Adyen after screening your merchant account. + * @return allowed + **/ + @ApiModelProperty(value = "Indicates whether receiving payments is allowed. This value is set to **true** by Adyen after screening your merchant account.") + @JsonProperty(JSON_PROPERTY_ALLOWED) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Boolean getAllowed() { + return allowed; + } + + + @JsonProperty(JSON_PROPERTY_ALLOWED) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setAllowed(Boolean allowed) { + this.allowed = allowed; + } + + + public MidServiceNotificationData enabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Indicates whether the payment method is enabled (**true**) or disabled (**false**). + * @return enabled + **/ + @ApiModelProperty(value = "Indicates whether the payment method is enabled (**true**) or disabled (**false**).") + @JsonProperty(JSON_PROPERTY_ENABLED) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Boolean getEnabled() { + return enabled; + } + + + @JsonProperty(JSON_PROPERTY_ENABLED) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setEnabled(Boolean enabled) { + this.enabled = enabled; + } + + + public MidServiceNotificationData id(String id) { + this.id = id; + return this; + } + + /** + * The identifier of the resource. + * @return id + **/ + @ApiModelProperty(required = true, value = "The identifier of the resource.") + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getId() { + return id; + } + + + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setId(String id) { + this.id = id; + } + + + public MidServiceNotificationData merchantId(String merchantId) { + this.merchantId = merchantId; + return this; + } + + /** + * The identifier of the merchant account. + * @return merchantId + **/ + @ApiModelProperty(required = true, value = "The identifier of the merchant account.") + @JsonProperty(JSON_PROPERTY_MERCHANT_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getMerchantId() { + return merchantId; + } + + + @JsonProperty(JSON_PROPERTY_MERCHANT_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setMerchantId(String merchantId) { + this.merchantId = merchantId; + } + + + public MidServiceNotificationData reference(String reference) { + this.reference = reference; + return this; + } + + /** + * Your reference for the payment method. + * @return reference + **/ + @ApiModelProperty(value = "Your reference for the payment method.") + @JsonProperty(JSON_PROPERTY_REFERENCE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getReference() { + return reference; + } + + + @JsonProperty(JSON_PROPERTY_REFERENCE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setReference(String reference) { + this.reference = reference; + } + + + public MidServiceNotificationData result(ResultEnum result) { + this.result = result; + return this; + } + + /** + * The result of the request to create a payment method. + * @return result + **/ + @ApiModelProperty(required = true, value = "The result of the request to create a payment method.") + @JsonProperty(JSON_PROPERTY_RESULT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public ResultEnum getResult() { + return result; + } + + + @JsonProperty(JSON_PROPERTY_RESULT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setResult(ResultEnum result) { + this.result = result; + } + + + public MidServiceNotificationData storeId(String storeId) { + this.storeId = storeId; + return this; + } + + /** + * The identifier of the [store](https://docs.adyen.com/api-explorer/#/ManagementService/latest/post/merchants/{id}/paymentMethodSettings__reqParam_storeId), if any. + * @return storeId + **/ + @ApiModelProperty(value = "The identifier of the [store](https://docs.adyen.com/api-explorer/#/ManagementService/latest/post/merchants/{id}/paymentMethodSettings__reqParam_storeId), if any.") + @JsonProperty(JSON_PROPERTY_STORE_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getStoreId() { + return storeId; + } + + + @JsonProperty(JSON_PROPERTY_STORE_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setStoreId(String storeId) { + this.storeId = storeId; + } + + + public MidServiceNotificationData type(String type) { + this.type = type; + return this; + } + + /** + * Payment method [variant](https://docs.adyen.com/development-resources/paymentmethodvariant#management-api). + * @return type + **/ + @ApiModelProperty(required = true, value = "Payment method [variant](https://docs.adyen.com/development-resources/paymentmethodvariant#management-api).") + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getType() { + return type; + } + + + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setType(String type) { + this.type = type; + } + + + public MidServiceNotificationData verificationStatus(VerificationStatusEnum verificationStatus) { + this.verificationStatus = verificationStatus; + return this; + } + + /** + * Payment method status. Possible values: * **valid** * **pending** * **invalid** * **rejected** + * @return verificationStatus + **/ + @ApiModelProperty(value = "Payment method status. Possible values: * **valid** * **pending** * **invalid** * **rejected**") + @JsonProperty(JSON_PROPERTY_VERIFICATION_STATUS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public VerificationStatusEnum getVerificationStatus() { + return verificationStatus; + } + + + @JsonProperty(JSON_PROPERTY_VERIFICATION_STATUS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setVerificationStatus(VerificationStatusEnum verificationStatus) { + this.verificationStatus = verificationStatus; + } + + + /** + * Return true if this MidServiceNotificationData object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MidServiceNotificationData midServiceNotificationData = (MidServiceNotificationData) o; + return Objects.equals(this.allowed, midServiceNotificationData.allowed) && + Objects.equals(this.enabled, midServiceNotificationData.enabled) && + Objects.equals(this.id, midServiceNotificationData.id) && + Objects.equals(this.merchantId, midServiceNotificationData.merchantId) && + Objects.equals(this.reference, midServiceNotificationData.reference) && + Objects.equals(this.result, midServiceNotificationData.result) && + Objects.equals(this.storeId, midServiceNotificationData.storeId) && + Objects.equals(this.type, midServiceNotificationData.type) && + Objects.equals(this.verificationStatus, midServiceNotificationData.verificationStatus); + } + + @Override + public int hashCode() { + return Objects.hash(allowed, enabled, id, merchantId, reference, result, storeId, type, verificationStatus); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MidServiceNotificationData {\n"); + sb.append(" allowed: ").append(toIndentedString(allowed)).append("\n"); + sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" merchantId: ").append(toIndentedString(merchantId)).append("\n"); + sb.append(" reference: ").append(toIndentedString(reference)).append("\n"); + sb.append(" result: ").append(toIndentedString(result)).append("\n"); + sb.append(" storeId: ").append(toIndentedString(storeId)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" verificationStatus: ").append(toIndentedString(verificationStatus)).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 MidServiceNotificationData given an JSON string + * + * @param jsonString JSON string + * @return An instance of MidServiceNotificationData + * @throws JsonProcessingException if the JSON string is invalid with respect to MidServiceNotificationData + */ + public static MidServiceNotificationData fromJson(String jsonString) throws JsonProcessingException { + return JSON.getMapper().readValue(jsonString, MidServiceNotificationData.class); + } +/** + * Convert an instance of MidServiceNotificationData 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/managementwebhooks/PaymentMethodCreatedNotificationRequest.java b/src/main/java/com/adyen/model/managementwebhooks/PaymentMethodCreatedNotificationRequest.java new file mode 100644 index 000000000..d4586db39 --- /dev/null +++ b/src/main/java/com/adyen/model/managementwebhooks/PaymentMethodCreatedNotificationRequest.java @@ -0,0 +1,256 @@ +/* + * Management Webhooks + * + * The version of the OpenAPI document: 1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.adyen.model.managementwebhooks; + +import java.util.Objects; +import java.util.Arrays; +import java.util.Map; +import java.util.HashMap; +import com.adyen.model.managementwebhooks.MidServiceNotificationData; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.time.OffsetDateTime; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.core.JsonProcessingException; + + +/** + * PaymentMethodCreatedNotificationRequest + */ +@JsonPropertyOrder({ + PaymentMethodCreatedNotificationRequest.JSON_PROPERTY_CREATED_AT, + PaymentMethodCreatedNotificationRequest.JSON_PROPERTY_DATA, + PaymentMethodCreatedNotificationRequest.JSON_PROPERTY_ENVIRONMENT, + PaymentMethodCreatedNotificationRequest.JSON_PROPERTY_TYPE +}) + +public class PaymentMethodCreatedNotificationRequest { + public static final String JSON_PROPERTY_CREATED_AT = "createdAt"; + private OffsetDateTime createdAt; + + public static final String JSON_PROPERTY_DATA = "data"; + private MidServiceNotificationData data; + + public static final String JSON_PROPERTY_ENVIRONMENT = "environment"; + private String environment; + + /** + * Type of notification. + */ + public enum TypeEnum { + PAYMENTMETHOD_CREATED("paymentMethod.created"); + + 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; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_TYPE = "type"; + private TypeEnum type; + + public PaymentMethodCreatedNotificationRequest() { + } + + public PaymentMethodCreatedNotificationRequest createdAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * Timestamp for when the webhook was created. + * @return createdAt + **/ + @ApiModelProperty(required = true, value = "Timestamp for when the webhook was created.") + @JsonProperty(JSON_PROPERTY_CREATED_AT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + + @JsonProperty(JSON_PROPERTY_CREATED_AT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setCreatedAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + + public PaymentMethodCreatedNotificationRequest data(MidServiceNotificationData data) { + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @ApiModelProperty(required = true, value = "") + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public MidServiceNotificationData getData() { + return data; + } + + + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setData(MidServiceNotificationData data) { + this.data = data; + } + + + public PaymentMethodCreatedNotificationRequest environment(String environment) { + this.environment = environment; + return this; + } + + /** + * The environment from which the webhook originated. Possible values: **test**, **live**. + * @return environment + **/ + @ApiModelProperty(required = true, value = "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; + } + + + @JsonProperty(JSON_PROPERTY_ENVIRONMENT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setEnvironment(String environment) { + this.environment = environment; + } + + + public PaymentMethodCreatedNotificationRequest type(TypeEnum type) { + this.type = type; + return this; + } + + /** + * Type of notification. + * @return type + **/ + @ApiModelProperty(required = true, value = "Type of notification.") + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public TypeEnum getType() { + return type; + } + + + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setType(TypeEnum type) { + this.type = type; + } + + + /** + * Return true if this PaymentMethodCreatedNotificationRequest object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PaymentMethodCreatedNotificationRequest paymentMethodCreatedNotificationRequest = (PaymentMethodCreatedNotificationRequest) o; + return Objects.equals(this.createdAt, paymentMethodCreatedNotificationRequest.createdAt) && + Objects.equals(this.data, paymentMethodCreatedNotificationRequest.data) && + Objects.equals(this.environment, paymentMethodCreatedNotificationRequest.environment) && + Objects.equals(this.type, paymentMethodCreatedNotificationRequest.type); + } + + @Override + public int hashCode() { + return Objects.hash(createdAt, data, environment, type); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PaymentMethodCreatedNotificationRequest {\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" environment: ").append(toIndentedString(environment)).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 PaymentMethodCreatedNotificationRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of PaymentMethodCreatedNotificationRequest + * @throws JsonProcessingException if the JSON string is invalid with respect to PaymentMethodCreatedNotificationRequest + */ + public static PaymentMethodCreatedNotificationRequest fromJson(String jsonString) throws JsonProcessingException { + return JSON.getMapper().readValue(jsonString, PaymentMethodCreatedNotificationRequest.class); + } +/** + * Convert an instance of PaymentMethodCreatedNotificationRequest 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/managementwebhooks/PaymentMethodNotificationResponse.java b/src/main/java/com/adyen/model/managementwebhooks/PaymentMethodNotificationResponse.java new file mode 100644 index 000000000..86180735c --- /dev/null +++ b/src/main/java/com/adyen/model/managementwebhooks/PaymentMethodNotificationResponse.java @@ -0,0 +1,128 @@ +/* + * Management Webhooks + * + * The version of the OpenAPI document: 1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.adyen.model.managementwebhooks; + +import java.util.Objects; +import java.util.Arrays; +import java.util.Map; +import java.util.HashMap; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.core.JsonProcessingException; + + +/** + * PaymentMethodNotificationResponse + */ +@JsonPropertyOrder({ + PaymentMethodNotificationResponse.JSON_PROPERTY_NOTIFICATION_RESPONSE +}) + +public class PaymentMethodNotificationResponse { + public static final String JSON_PROPERTY_NOTIFICATION_RESPONSE = "notificationResponse"; + private String notificationResponse; + + public PaymentMethodNotificationResponse() { + } + + public PaymentMethodNotificationResponse notificationResponse(String notificationResponse) { + this.notificationResponse = notificationResponse; + return this; + } + + /** + * Respond with **HTTP 200 OK** and `[accepted]` in the response body to [accept the webhook](https://docs.adyen.com/development-resources/webhooks#accept-notifications). + * @return notificationResponse + **/ + @ApiModelProperty(value = "Respond with **HTTP 200 OK** and `[accepted]` in the response body to [accept the webhook](https://docs.adyen.com/development-resources/webhooks#accept-notifications).") + @JsonProperty(JSON_PROPERTY_NOTIFICATION_RESPONSE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getNotificationResponse() { + return notificationResponse; + } + + + @JsonProperty(JSON_PROPERTY_NOTIFICATION_RESPONSE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setNotificationResponse(String notificationResponse) { + this.notificationResponse = notificationResponse; + } + + + /** + * Return true if this PaymentMethodNotificationResponse object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PaymentMethodNotificationResponse paymentMethodNotificationResponse = (PaymentMethodNotificationResponse) o; + return Objects.equals(this.notificationResponse, paymentMethodNotificationResponse.notificationResponse); + } + + @Override + public int hashCode() { + return Objects.hash(notificationResponse); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PaymentMethodNotificationResponse {\n"); + sb.append(" notificationResponse: ").append(toIndentedString(notificationResponse)).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 PaymentMethodNotificationResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of PaymentMethodNotificationResponse + * @throws JsonProcessingException if the JSON string is invalid with respect to PaymentMethodNotificationResponse + */ + public static PaymentMethodNotificationResponse fromJson(String jsonString) throws JsonProcessingException { + return JSON.getMapper().readValue(jsonString, PaymentMethodNotificationResponse.class); + } +/** + * Convert an instance of PaymentMethodNotificationResponse 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/managementwebhooks/RemediatingAction.java b/src/main/java/com/adyen/model/managementwebhooks/RemediatingAction.java new file mode 100644 index 000000000..316a29102 --- /dev/null +++ b/src/main/java/com/adyen/model/managementwebhooks/RemediatingAction.java @@ -0,0 +1,159 @@ +/* + * Management Webhooks + * + * The version of the OpenAPI document: 1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.adyen.model.managementwebhooks; + +import java.util.Objects; +import java.util.Arrays; +import java.util.Map; +import java.util.HashMap; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.core.JsonProcessingException; + + +/** + * RemediatingAction + */ +@JsonPropertyOrder({ + RemediatingAction.JSON_PROPERTY_CODE, + RemediatingAction.JSON_PROPERTY_MESSAGE +}) + +public class RemediatingAction { + public static final String JSON_PROPERTY_CODE = "code"; + private String code; + + public static final String JSON_PROPERTY_MESSAGE = "message"; + private String message; + + public RemediatingAction() { + } + + public RemediatingAction code(String code) { + this.code = code; + return this; + } + + /** + * The remediating action code. + * @return code + **/ + @ApiModelProperty(value = "The remediating action code.") + @JsonProperty(JSON_PROPERTY_CODE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getCode() { + return code; + } + + + @JsonProperty(JSON_PROPERTY_CODE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setCode(String code) { + this.code = code; + } + + + public RemediatingAction message(String message) { + this.message = message; + return this; + } + + /** + * A description of how you can resolve the verification error. + * @return message + **/ + @ApiModelProperty(value = "A description of how you can resolve the verification error.") + @JsonProperty(JSON_PROPERTY_MESSAGE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getMessage() { + return message; + } + + + @JsonProperty(JSON_PROPERTY_MESSAGE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setMessage(String message) { + this.message = message; + } + + + /** + * Return true if this RemediatingAction object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RemediatingAction remediatingAction = (RemediatingAction) o; + return Objects.equals(this.code, remediatingAction.code) && + Objects.equals(this.message, remediatingAction.message); + } + + @Override + public int hashCode() { + return Objects.hash(code, message); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RemediatingAction {\n"); + sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append(" message: ").append(toIndentedString(message)).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 RemediatingAction given an JSON string + * + * @param jsonString JSON string + * @return An instance of RemediatingAction + * @throws JsonProcessingException if the JSON string is invalid with respect to RemediatingAction + */ + public static RemediatingAction fromJson(String jsonString) throws JsonProcessingException { + return JSON.getMapper().readValue(jsonString, RemediatingAction.class); + } +/** + * Convert an instance of RemediatingAction 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/managementwebhooks/VerificationError.java b/src/main/java/com/adyen/model/managementwebhooks/VerificationError.java new file mode 100644 index 000000000..82bba2d9a --- /dev/null +++ b/src/main/java/com/adyen/model/managementwebhooks/VerificationError.java @@ -0,0 +1,309 @@ +/* + * Management Webhooks + * + * The version of the OpenAPI document: 1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.adyen.model.managementwebhooks; + +import java.util.Objects; +import java.util.Arrays; +import java.util.Map; +import java.util.HashMap; +import com.adyen.model.managementwebhooks.RemediatingAction; +import com.adyen.model.managementwebhooks.VerificationErrorRecursive; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.core.JsonProcessingException; + + +/** + * VerificationError + */ +@JsonPropertyOrder({ + VerificationError.JSON_PROPERTY_CODE, + VerificationError.JSON_PROPERTY_MESSAGE, + VerificationError.JSON_PROPERTY_REMEDIATING_ACTIONS, + VerificationError.JSON_PROPERTY_SUB_ERRORS, + VerificationError.JSON_PROPERTY_TYPE +}) + +public class VerificationError { + public static final String JSON_PROPERTY_CODE = "code"; + private String code; + + public static final String JSON_PROPERTY_MESSAGE = "message"; + private String message; + + public static final String JSON_PROPERTY_REMEDIATING_ACTIONS = "remediatingActions"; + private List remediatingActions = null; + + public static final String JSON_PROPERTY_SUB_ERRORS = "subErrors"; + private List subErrors = null; + + /** + * The type of verification error. Possible values: **invalidInput**, **dataMissing**, and **pendingStatus**. + */ + public enum TypeEnum { + DATAMISSING("dataMissing"), + + INVALIDINPUT("invalidInput"), + + PENDINGSTATUS("pendingStatus"); + + 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; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_TYPE = "type"; + private TypeEnum type; + + public VerificationError() { + } + + public VerificationError code(String code) { + this.code = code; + return this; + } + + /** + * The verification error code. + * @return code + **/ + @ApiModelProperty(value = "The verification error code.") + @JsonProperty(JSON_PROPERTY_CODE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getCode() { + return code; + } + + + @JsonProperty(JSON_PROPERTY_CODE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setCode(String code) { + this.code = code; + } + + + public VerificationError message(String message) { + this.message = message; + return this; + } + + /** + * The verification error message. + * @return message + **/ + @ApiModelProperty(value = "The verification error message.") + @JsonProperty(JSON_PROPERTY_MESSAGE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getMessage() { + return message; + } + + + @JsonProperty(JSON_PROPERTY_MESSAGE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setMessage(String message) { + this.message = message; + } + + + public VerificationError remediatingActions(List remediatingActions) { + this.remediatingActions = remediatingActions; + return this; + } + + public VerificationError addRemediatingActionsItem(RemediatingAction remediatingActionsItem) { + if (this.remediatingActions == null) { + this.remediatingActions = new ArrayList<>(); + } + this.remediatingActions.add(remediatingActionsItem); + return this; + } + + /** + * The actions that you can take to resolve the verification error. + * @return remediatingActions + **/ + @ApiModelProperty(value = "The actions that you can take to resolve the verification error.") + @JsonProperty(JSON_PROPERTY_REMEDIATING_ACTIONS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public List getRemediatingActions() { + return remediatingActions; + } + + + @JsonProperty(JSON_PROPERTY_REMEDIATING_ACTIONS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setRemediatingActions(List remediatingActions) { + this.remediatingActions = remediatingActions; + } + + + public VerificationError subErrors(List subErrors) { + this.subErrors = subErrors; + return this; + } + + public VerificationError addSubErrorsItem(VerificationErrorRecursive subErrorsItem) { + if (this.subErrors == null) { + this.subErrors = new ArrayList<>(); + } + this.subErrors.add(subErrorsItem); + return this; + } + + /** + * More granular information about the verification error. + * @return subErrors + **/ + @ApiModelProperty(value = "More granular information about the verification error.") + @JsonProperty(JSON_PROPERTY_SUB_ERRORS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public List getSubErrors() { + return subErrors; + } + + + @JsonProperty(JSON_PROPERTY_SUB_ERRORS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setSubErrors(List subErrors) { + this.subErrors = subErrors; + } + + + public VerificationError type(TypeEnum type) { + this.type = type; + return this; + } + + /** + * The type of verification error. Possible values: **invalidInput**, **dataMissing**, and **pendingStatus**. + * @return type + **/ + @ApiModelProperty(value = "The type of verification error. Possible values: **invalidInput**, **dataMissing**, and **pendingStatus**.") + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public TypeEnum getType() { + return type; + } + + + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setType(TypeEnum type) { + this.type = type; + } + + + /** + * Return true if this VerificationError object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + VerificationError verificationError = (VerificationError) o; + return Objects.equals(this.code, verificationError.code) && + Objects.equals(this.message, verificationError.message) && + Objects.equals(this.remediatingActions, verificationError.remediatingActions) && + Objects.equals(this.subErrors, verificationError.subErrors) && + Objects.equals(this.type, verificationError.type); + } + + @Override + public int hashCode() { + return Objects.hash(code, message, remediatingActions, subErrors, type); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class VerificationError {\n"); + sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append(" message: ").append(toIndentedString(message)).append("\n"); + sb.append(" remediatingActions: ").append(toIndentedString(remediatingActions)).append("\n"); + sb.append(" subErrors: ").append(toIndentedString(subErrors)).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 VerificationError given an JSON string + * + * @param jsonString JSON string + * @return An instance of VerificationError + * @throws JsonProcessingException if the JSON string is invalid with respect to VerificationError + */ + public static VerificationError fromJson(String jsonString) throws JsonProcessingException { + return JSON.getMapper().readValue(jsonString, VerificationError.class); + } +/** + * Convert an instance of VerificationError 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/managementwebhooks/VerificationErrorRecursive.java b/src/main/java/com/adyen/model/managementwebhooks/VerificationErrorRecursive.java new file mode 100644 index 000000000..b31e55d5a --- /dev/null +++ b/src/main/java/com/adyen/model/managementwebhooks/VerificationErrorRecursive.java @@ -0,0 +1,270 @@ +/* + * Management Webhooks + * + * The version of the OpenAPI document: 1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.adyen.model.managementwebhooks; + +import java.util.Objects; +import java.util.Arrays; +import java.util.Map; +import java.util.HashMap; +import com.adyen.model.managementwebhooks.RemediatingAction; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.core.JsonProcessingException; + + +/** + * VerificationErrorRecursive + */ +@JsonPropertyOrder({ + VerificationErrorRecursive.JSON_PROPERTY_CODE, + VerificationErrorRecursive.JSON_PROPERTY_MESSAGE, + VerificationErrorRecursive.JSON_PROPERTY_TYPE, + VerificationErrorRecursive.JSON_PROPERTY_REMEDIATING_ACTIONS +}) +@JsonTypeName("VerificationError-recursive") + +public class VerificationErrorRecursive { + public static final String JSON_PROPERTY_CODE = "code"; + private String code; + + public static final String JSON_PROPERTY_MESSAGE = "message"; + private String message; + + /** + * The type of verification error. Possible values: **invalidInput**, **dataMissing**, and **pendingStatus**. + */ + public enum TypeEnum { + DATAMISSING("dataMissing"), + + INVALIDINPUT("invalidInput"), + + PENDINGSTATUS("pendingStatus"); + + 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; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_TYPE = "type"; + private TypeEnum type; + + public static final String JSON_PROPERTY_REMEDIATING_ACTIONS = "remediatingActions"; + private List remediatingActions = null; + + public VerificationErrorRecursive() { + } + + public VerificationErrorRecursive code(String code) { + this.code = code; + return this; + } + + /** + * The verification error code. + * @return code + **/ + @ApiModelProperty(value = "The verification error code.") + @JsonProperty(JSON_PROPERTY_CODE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getCode() { + return code; + } + + + @JsonProperty(JSON_PROPERTY_CODE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setCode(String code) { + this.code = code; + } + + + public VerificationErrorRecursive message(String message) { + this.message = message; + return this; + } + + /** + * The verification error message. + * @return message + **/ + @ApiModelProperty(value = "The verification error message.") + @JsonProperty(JSON_PROPERTY_MESSAGE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getMessage() { + return message; + } + + + @JsonProperty(JSON_PROPERTY_MESSAGE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setMessage(String message) { + this.message = message; + } + + + public VerificationErrorRecursive type(TypeEnum type) { + this.type = type; + return this; + } + + /** + * The type of verification error. Possible values: **invalidInput**, **dataMissing**, and **pendingStatus**. + * @return type + **/ + @ApiModelProperty(value = "The type of verification error. Possible values: **invalidInput**, **dataMissing**, and **pendingStatus**.") + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public TypeEnum getType() { + return type; + } + + + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setType(TypeEnum type) { + this.type = type; + } + + + public VerificationErrorRecursive remediatingActions(List remediatingActions) { + this.remediatingActions = remediatingActions; + return this; + } + + public VerificationErrorRecursive addRemediatingActionsItem(RemediatingAction remediatingActionsItem) { + if (this.remediatingActions == null) { + this.remediatingActions = new ArrayList<>(); + } + this.remediatingActions.add(remediatingActionsItem); + return this; + } + + /** + * The actions that you can take to resolve the verification error. + * @return remediatingActions + **/ + @ApiModelProperty(value = "The actions that you can take to resolve the verification error.") + @JsonProperty(JSON_PROPERTY_REMEDIATING_ACTIONS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public List getRemediatingActions() { + return remediatingActions; + } + + + @JsonProperty(JSON_PROPERTY_REMEDIATING_ACTIONS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setRemediatingActions(List remediatingActions) { + this.remediatingActions = remediatingActions; + } + + + /** + * Return true if this VerificationError-recursive object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + VerificationErrorRecursive verificationErrorRecursive = (VerificationErrorRecursive) o; + return Objects.equals(this.code, verificationErrorRecursive.code) && + Objects.equals(this.message, verificationErrorRecursive.message) && + Objects.equals(this.type, verificationErrorRecursive.type) && + Objects.equals(this.remediatingActions, verificationErrorRecursive.remediatingActions); + } + + @Override + public int hashCode() { + return Objects.hash(code, message, type, remediatingActions); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class VerificationErrorRecursive {\n"); + sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append(" message: ").append(toIndentedString(message)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" remediatingActions: ").append(toIndentedString(remediatingActions)).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 VerificationErrorRecursive given an JSON string + * + * @param jsonString JSON string + * @return An instance of VerificationErrorRecursive + * @throws JsonProcessingException if the JSON string is invalid with respect to VerificationErrorRecursive + */ + public static VerificationErrorRecursive fromJson(String jsonString) throws JsonProcessingException { + return JSON.getMapper().readValue(jsonString, VerificationErrorRecursive.class); + } +/** + * Convert an instance of VerificationErrorRecursive 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/terminal/SaleToAcquirerData.java b/src/main/java/com/adyen/model/terminal/SaleToAcquirerData.java index ef42a5418..837045f81 100644 --- a/src/main/java/com/adyen/model/terminal/SaleToAcquirerData.java +++ b/src/main/java/com/adyen/model/terminal/SaleToAcquirerData.java @@ -52,6 +52,7 @@ public class SaleToAcquirerData { private String authorisationType; private String ssc; private RecurringProcessingModelEnum recurringProcessingModel; + private String redemptionType; private static final Gson PRETTY_PRINT_GSON = new GsonBuilder().setPrettyPrinting().create(); public SaleToAcquirerData() { @@ -207,6 +208,15 @@ public String getSsc() { public void setSsc(String ssc) { this.ssc = ssc; } + + public String getRedemptionType() { + return redemptionType; + } + + public void setRedemptionType(String redemptionType) { + this.redemptionType = redemptionType; + } + public static Gson getPrettyPrintGson() { return PRETTY_PRINT_GSON; } @@ -235,12 +245,13 @@ public boolean equals(Object o) { Objects.equals(additionalData, that.additionalData) && Objects.equals(authorisationType, that.authorisationType) && Objects.equals(ssc, that.ssc) && - Objects.equals(recurringProcessingModel, that.recurringProcessingModel); + Objects.equals(recurringProcessingModel, that.recurringProcessingModel) && + Objects.equals(redemptionType, that.redemptionType); } @Override public int hashCode() { - return Objects.hash(metadata, shopperEmail, shopperReference, recurringContract, shopperStatement, recurringDetailName, recurringTokenService, store, merchantAccount, currency, applicationInfo, tenderOption, additionalData, authorisationType, ssc, recurringProcessingModel); + return Objects.hash(metadata, shopperEmail, shopperReference, recurringContract, shopperStatement, recurringDetailName, recurringTokenService, store, merchantAccount, currency, applicationInfo, tenderOption, additionalData, authorisationType, ssc, recurringProcessingModel, redemptionType); } @Override @@ -261,7 +272,8 @@ public String toString() { ", additionalData=" + additionalData + ", authorisationType=" + authorisationType + ", ssc='" + ssc + '\'' + - ", recurringProcessingModel=" + recurringProcessingModel + + ", recurringProcessingModel=" + recurringProcessingModel + '\'' + + ", redemptionType=" + redemptionType + '}'; } diff --git a/src/main/java/com/adyen/notification/BankingWebhookHandler.java b/src/main/java/com/adyen/notification/BankingWebhookHandler.java index d2e96046f..a5d08a639 100644 --- a/src/main/java/com/adyen/notification/BankingWebhookHandler.java +++ b/src/main/java/com/adyen/notification/BankingWebhookHandler.java @@ -1,5 +1,6 @@ package com.adyen.notification; +import com.adyen.model.acswebhooks.AuthenticationNotificationRequest; import com.adyen.model.configurationwebhooks.AccountHolderNotificationRequest; import com.adyen.model.configurationwebhooks.BalanceAccountNotificationRequest; import com.adyen.model.configurationwebhooks.CardOrderNotificationRequest; @@ -17,6 +18,9 @@ public BankingWebhookHandler(String payload) { this.payload = payload; } + public Optional getAuthenticationNotificationRequest() { + return getOptionalField(AuthenticationNotificationRequest.class); + } public Optional getAccountHolderNotificationRequest() { return getOptionalField(AccountHolderNotificationRequest.class); } diff --git a/src/main/java/com/adyen/notification/ManagementWebhookHandler.java b/src/main/java/com/adyen/notification/ManagementWebhookHandler.java new file mode 100644 index 000000000..1645c86c1 --- /dev/null +++ b/src/main/java/com/adyen/notification/ManagementWebhookHandler.java @@ -0,0 +1,36 @@ +package com.adyen.notification; + +import com.adyen.model.managementwebhooks.MerchantCreatedNotificationRequest; +import com.adyen.model.managementwebhooks.MerchantUpdatedNotificationRequest; +import com.adyen.model.managementwebhooks.PaymentMethodCreatedNotificationRequest; +import com.adyen.model.transferwebhooks.JSON; + +import java.util.Optional; + +public class ManagementWebhookHandler { + private final String payload; + + public ManagementWebhookHandler(String payload) { + this.payload = payload; + } + + public Optional getMerchantCreatedNotificationRequest() { + return getOptionalField(MerchantCreatedNotificationRequest.class); + } + public Optional getMerchantUpdatedNotificationRequest() { + return getOptionalField(MerchantUpdatedNotificationRequest.class); + } + + public Optional getPaymentMethodCreatedNotificationRequest() { + return getOptionalField(PaymentMethodCreatedNotificationRequest.class); + } + + private Optional getOptionalField(Class clazz) { + try { + T val = JSON.getMapper().readValue(payload, clazz); + return Optional.ofNullable(val); + } catch (Exception e) { + return Optional.empty(); + } + } +} diff --git a/src/main/java/com/adyen/util/HMACValidator.java b/src/main/java/com/adyen/util/HMACValidator.java index 23979495c..54d833871 100644 --- a/src/main/java/com/adyen/util/HMACValidator.java +++ b/src/main/java/com/adyen/util/HMACValidator.java @@ -73,7 +73,7 @@ public String calculateHMAC(NotificationRequestItem notificationRequestItem, Str return calculateHMAC(getDataToSign(notificationRequestItem), key); } - // Calculate HMAC for BankingWebhooks (Generic webhooks) + // Calculate HMAC for BankingWebhooks and ManagementWebhooks (Generic webhooks) public boolean validateHMAC(String hmacKey, String hmacSignature, String payload) throws SignatureException { String calculatedSign = calculateHMAC(payload, hmacSignature); final byte [] expectedSign = calculatedSign.getBytes(StandardCharsets.UTF_8); diff --git a/src/test/java/com/adyen/BaseTest.java b/src/test/java/com/adyen/BaseTest.java index c29b2932e..0ddee2809 100644 --- a/src/test/java/com/adyen/BaseTest.java +++ b/src/test/java/com/adyen/BaseTest.java @@ -94,7 +94,6 @@ protected Client createMockClientFromResponse(String response) { client.setHttpClient(adyenHttpClient); Config config = new Config(); - config.setCheckoutEndpoint(CHECKOUT_ENDPOINT_TEST); client.setConfig(config); return client; @@ -320,7 +319,6 @@ protected Client createMockClientForErrors(int status, String fileName) { Client client = new Client(); client.setHttpClient(adyenHttpClient); Config config = new Config(); - config.setCheckoutEndpoint(CHECKOUT_ENDPOINT_TEST); client.setConfig(config); return client; diff --git a/src/test/java/com/adyen/ClientTest.java b/src/test/java/com/adyen/ClientTest.java index 7ff3e0b30..3fd9e2f7f 100644 --- a/src/test/java/com/adyen/ClientTest.java +++ b/src/test/java/com/adyen/ClientTest.java @@ -42,17 +42,6 @@ public void testConfigLiveClient() { Assert.assertEquals(Environment.LIVE, client.getConfig().getEnvironment()); } - @Test - public void testConfigLiveNoPrefixCheckoutClient() { - Config config = new Config(); - config.setEnvironment(Environment.LIVE); - config.setApiKey(apiKey); - IllegalArgumentException ex = Assert.assertThrows(IllegalArgumentException.class, () -> { - new Client(config).getConfig().getCheckoutEndpoint(); - }); - Assert.assertEquals(ex.getMessage(), "Please provide your unique live url prefix on the setEnvironment() call on the Client or provide checkoutEndpoint in your config object."); - } - @Test public void testClientCertificateAuth() { Client client = new Client(trustStore, clientKeyStore, clientKeyStorePassword, apiKey, null); @@ -64,7 +53,6 @@ public void testClientCertificateAuth_AU() { Client client = new Client(trustStore, clientKeyStore, clientKeyStorePassword, apiKey, Region.AU); Assert.assertEquals(Environment.LIVE, client.getConfig().getEnvironment()); - Assert.assertEquals("https://checkoutcert-live-au.adyen.com/checkout", client.getConfig().getCheckoutEndpoint()); assertCommonEndpoints(client.getConfig()); } @@ -73,12 +61,10 @@ public void testClientCertificateAuth_US() { Client client = new Client(trustStore, clientKeyStore, clientKeyStorePassword, apiKey, Region.US); Assert.assertEquals(Environment.LIVE, client.getConfig().getEnvironment()); - Assert.assertEquals("https://checkoutcert-live-us.adyen.com/checkout", client.getConfig().getCheckoutEndpoint()); assertCommonEndpoints(client.getConfig()); } private void assertCommonEndpoints(Config config) { - Assert.assertEquals(Client.ENDPOINT_CERT_LIVE, config.getEndpoint()); Assert.assertEquals(Client.TERMINAL_API_ENDPOINT_LIVE, config.getTerminalApiCloudEndpoint()); } } \ No newline at end of file diff --git a/src/test/java/com/adyen/WebhookTest.java b/src/test/java/com/adyen/WebhookTest.java index b9d2b61c1..f8d3528a2 100644 --- a/src/test/java/com/adyen/WebhookTest.java +++ b/src/test/java/com/adyen/WebhookTest.java @@ -20,9 +20,13 @@ */ package com.adyen; +import com.adyen.model.acswebhooks.AuthenticationNotificationRequest; import com.adyen.model.balanceplatform.BankAccountIdentificationValidationRequest; import com.adyen.model.configurationwebhooks.AccountHolderNotificationRequest; import com.adyen.model.configurationwebhooks.BalanceAccountNotificationRequest; +import com.adyen.model.managementwebhooks.MerchantCreatedNotificationRequest; +import com.adyen.model.managementwebhooks.MerchantUpdatedNotificationRequest; +import com.adyen.model.managementwebhooks.PaymentMethodCreatedNotificationRequest; import com.adyen.model.nexo.DeviceType; import com.adyen.model.nexo.DisplayOutput; import com.adyen.model.nexo.EventNotification; @@ -32,8 +36,10 @@ import com.adyen.model.notification.NotificationRequestItem; import com.adyen.model.terminal.TerminalAPIRequest; import com.adyen.notification.BankingWebhookHandler; +import com.adyen.notification.ManagementWebhookHandler; import com.adyen.notification.WebhookHandler; import com.adyen.util.HMACValidator; +import com.fasterxml.jackson.core.JsonProcessingException; import com.google.gson.JsonParser; import org.junit.Assert; import org.junit.Before; @@ -247,7 +253,7 @@ public void testBankingWebhook() { String jsonRequest = "{ \"data\": {\"balancePlatform\": \"YOUR_BALANCE_PLATFORM\",\"accountHolder\": {\"contactDetails\": {\"address\": {\"country\": \"NL\",\"houseNumberOrName\": \"274\",\"postalCode\": \"1020CD\",\"street\": \"Brannan Street\"},\"email\": \"s.hopper@example.com\",\"phone\": {\"number\": \"+315551231234\",\"type\": \"Mobile\"}},\"description\": \"S.Hopper - Staff 123\",\"id\": \"AH00000000000000000000001\",\"status\": \"Active\"}},\"environment\": \"test\",\"type\": \"balancePlatform.accountHolder.created\"}"; BankingWebhookHandler webhookHandler = new BankingWebhookHandler(jsonRequest); AccountHolderNotificationRequest accountHolderNotificationRequest = webhookHandler.getAccountHolderNotificationRequest().get(); -Assert.assertEquals(accountHolderNotificationRequest.getData().getAccountHolder().getId(), "AH00000000000000000000001"); +Assert.assertEquals("AH00000000000000000000001", accountHolderNotificationRequest.getData().getAccountHolder().getId()); } @Test @@ -269,6 +275,56 @@ public void testBankingWebhookHmacValidator() throws SignatureException { Assert.assertTrue(response); } + @Test + public void testBankingWebhookAcsParsing() { + String notification = "{\n" + + " \"data\" : {\n" + + " \"balancePlatform\" : \"YOUR_BALANCE_PLATFORM\",\n" + + " \"creationDate\" : \"2023-01-19T17:07:59+01:00\",\n" + + " \"id\" : \"a8fc7a40-6e48-498a-bdc2-494daf0f490a\",\n" + + " \"authentication\" : {\n" + + " \"acsTransId\" : \"a8fc7a40-6e48-498a-bdc2-494daf0f490a\",\n" + + " \"challenge\" : {\n" + + " \"flow\" : \"OTP_SMS\",\n" + + " \"lastInteraction\" : \"2023-01-19T17:37:13+01:00\",\n" + + " \"phoneNumber\" : \"******6789\",\n" + + " \"resends\" : 0,\n" + + " \"retries\" : 2\n" + + " },\n" + + " \"challengeIndicator\" : \"01\",\n" + + " \"createdAt\" : \"2023-01-19T17:07:17+01:00\",\n" + + " \"deviceChannel\" : \"app\",\n" + + " \"dsTransID\" : \"59de4e30-7f84-4a77-aaf8-1ca493092ef9\",\n" + + " \"exemptionIndicator\" : \"noExemptionApplied\",\n" + + " \"inPSD2Scope\" : false,\n" + + " \"messageCategory\" : \"payment\",\n" + + " \"messageVersion\" : \"2.2.0\",\n" + + " \"threeDSServerTransID\" : \"8bc0fdbd-5c8a-4bed-a171-9d10347e7798\",\n" + + " \"transStatus\" : \"N\",\n" + + " \"transStatusReason\" : \"19\",\n" + + " \"type\" : \"challenge\"\n" + + " },\n" + + " \"paymentInstrumentId\" : \"PI3227C223222B5BPCMFXD2XG\",\n" + + " \"purchase\" : {\n" + + " \"date\" : \"2022-12-22T15:49:03+01:00\",\n" + + " \"merchantName\" : \"TeaShop_NL\",\n" + + " \"originalAmount\" : {\n" + + " \"currency\" : \"EUR\",\n" + + " \"value\" : 1000\n" + + " }\n" + + " },\n" + + " \"status\" : \"rejected\"\n" + + " },\n" + + " \"environment\" : \"test\",\n" + + " \"type\" : \"balancePlatform.authentication.created\"\n" + + " }"; + BankingWebhookHandler webhookHandler = new BankingWebhookHandler(notification); + Assert.assertTrue(webhookHandler.getAuthenticationNotificationRequest().isPresent()); + AuthenticationNotificationRequest request = webhookHandler.getAuthenticationNotificationRequest().get(); + Assert.assertEquals("a8fc7a40-6e48-498a-bdc2-494daf0f490a", request.getData().getId()); + Assert.assertFalse(webhookHandler.getBalanceAccountNotificationRequest().isPresent()); + } + @Test public void testDonationWebhookJackson() throws SignatureException, IOException { String notification = "{\n" + @@ -293,7 +349,80 @@ public void testDonationWebhookJackson() throws SignatureException, IOException "}"; WebhookHandler webhookHolder = new WebhookHandler(); NotificationRequest notificationRequest = webhookHolder.handleNotificationJsonJackson(notification); - Assert.assertEquals(notificationRequest.getNotificationItemContainers().get(0).getNotificationItem().getAmount().getCurrency(), "EUR"); - Assert.assertEquals(notificationRequest.getNotificationItemContainers().get(0).getNotificationItem().getAdditionalData().get("originalMerchantAccountCode"), "LengrandECOM"); + Assert.assertEquals("EUR", notificationRequest.getNotificationItemContainers().get(0).getNotificationItem().getAmount().getCurrency()); + Assert.assertEquals("LengrandECOM", notificationRequest.getNotificationItemContainers().get(0).getNotificationItem().getAdditionalData().get("originalMerchantAccountCode")); + } + + @Test + public void testManagementWebhookPaymentMethodCreatedParsing() { + String notification = "{\n" + + " \"createdAt\": \"2022-01-24T14:59:11+01:00\",\n" + + " \"data\": {\n" + + " \"id\": \"PM3224R223224K5FH4M2K9B86\",\n" + + " \"merchantId\": \"MERCHANT_ACCOUNT\",\n" + + " \"result\": \"SUCCESS\",\n" + + " \"storeId\": \"ST322LJ223223K5F4SQNR9XL5\",\n" + + " \"type\": \"visa\"\n" + + " },\n" + + " \"environment\": \"test\",\n" + + " \"type\": \"paymentMethod.created\"\n" + + "}"; + ManagementWebhookHandler webhookHandler = new ManagementWebhookHandler(notification); + Assert.assertTrue(webhookHandler.getPaymentMethodCreatedNotificationRequest().isPresent()); + PaymentMethodCreatedNotificationRequest request = webhookHandler.getPaymentMethodCreatedNotificationRequest().get(); + Assert.assertEquals("PM3224R223224K5FH4M2K9B86", request.getData().getId()); + Assert.assertEquals(PaymentMethodCreatedNotificationRequest.TypeEnum.PAYMENTMETHOD_CREATED, request.getType()); + } + + @Test + public void testManagementWebhookMerchantUpdatedParsing() { + String notification = "{\n" + + " \"type\": \"merchant.updated\",\n" + + " \"environment\": \"test\",\n" + + " \"createdAt\": \"2022-09-20T13:42:31+02:00\",\n" + + " \"data\": {\n" + + " \"capabilities\": {\n" + + " \"receivePayments\": {\n" + + " \"allowed\": true,\n" + + " \"requested\": true,\n" + + " \"requestedLevel\": \"notApplicable\",\n" + + " \"verificationStatus\": \"valid\"\n" + + " }\n" + + " },\n" + + " \"legalEntityId\": \"LE322KH223222F5GNNW694PZN\",\n" + + " \"merchantId\": \"YOUR_MERCHANT_ID\",\n" + + " \"status\": \"PreActive\"\n" + + " }\n" + + "}"; + ManagementWebhookHandler webhookHandler = new ManagementWebhookHandler(notification); + Assert.assertTrue(webhookHandler.getMerchantUpdatedNotificationRequest().isPresent()); + MerchantUpdatedNotificationRequest request = webhookHandler.getMerchantUpdatedNotificationRequest().get(); + Assert.assertEquals("LE322KH223222F5GNNW694PZN", request.getData().getLegalEntityId()); + Assert.assertEquals(MerchantUpdatedNotificationRequest.TypeEnum.MERCHANT_UPDATED, request.getType()); + } + + @Test + public void testManagementWebhookMerchantCreatedParsing() { + String notification = "{\n" + + " \"type\": \"merchant.created\",\n" + + " \"environment\": \"test\",\n" + + " \"createdAt\": \"2022-08-12T10:50:01+02:00\",\n" + + " \"data\": {\n" + + " \"capabilities\": {\n" + + " \"sendToTransferInstrument\": {\n" + + " \"requested\": true,\n" + + " \"requestedLevel\": \"notApplicable\"\n" + + " }\n" + + " },\n" + + " \"companyId\": \"YOUR_COMPANY_ID\",\n" + + " \"merchantId\": \"MC3224X22322535GH8D537TJR\",\n" + + " \"status\": \"PreActive\"\n" + + " }\n" + + "}"; + ManagementWebhookHandler webhookHandler = new ManagementWebhookHandler(notification); + Assert.assertTrue(webhookHandler.getMerchantCreatedNotificationRequest().isPresent()); + MerchantCreatedNotificationRequest request = webhookHandler.getMerchantCreatedNotificationRequest().get(); + Assert.assertEquals("MC3224X22322535GH8D537TJR", request.getData().getMerchantId()); + Assert.assertEquals(MerchantCreatedNotificationRequest.TypeEnum.MERCHANT_CREATED, request.getType()); } }