diff --git a/Makefile b/Makefile index 21daa7fd9..b32a36100 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,7 @@ openapi-generator-cli:=java -jar $(openapi-generator-jar) generator:=java library:=jersey3 -modelGen:=acswebhooks 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 @@ -43,6 +43,8 @@ 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 ad205b773..75aa7f6a6 100644 --- a/README.md +++ b/README.md @@ -30,13 +30,14 @@ The Library supports all APIs under the following services: ## Supported Webhook versions The library supports all webhooks under the following model directories: -| 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** | +| 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/). @@ -164,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"; @@ -185,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/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/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/WebhookTest.java b/src/test/java/com/adyen/WebhookTest.java index 2a3b523f7..f8d3528a2 100644 --- a/src/test/java/com/adyen/WebhookTest.java +++ b/src/test/java/com/adyen/WebhookTest.java @@ -24,6 +24,9 @@ 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; @@ -33,6 +36,7 @@ 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; @@ -249,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 @@ -317,7 +321,7 @@ public void testBankingWebhookAcsParsing() { BankingWebhookHandler webhookHandler = new BankingWebhookHandler(notification); Assert.assertTrue(webhookHandler.getAuthenticationNotificationRequest().isPresent()); AuthenticationNotificationRequest request = webhookHandler.getAuthenticationNotificationRequest().get(); - Assert.assertEquals(request.getData().getId(), "a8fc7a40-6e48-498a-bdc2-494daf0f490a"); + Assert.assertEquals("a8fc7a40-6e48-498a-bdc2-494daf0f490a", request.getData().getId()); Assert.assertFalse(webhookHandler.getBalanceAccountNotificationRequest().isPresent()); } @@ -345,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()); } }