Skip to content

Commit 3e48255

Browse files
authored
OpenAPI Generator v7: add Webhooks (#1469)
* Generate AcsWebhooks * Generate ReportWebhooks * Generate ConfigurationWebhooks * Generate TransferWebhooks * Generate TransactionWebhooks * Generate NegativeBalanceWarningWebhooks * Deprecate former WebhookHandler implementation * Update tests * Generate including javadoc * Add javadoc for WebhookHandler template * Generate DisputeWebhooks * Generate ManagementWebhooks * Deprecate former ManagementWebhook handler * Update tests
1 parent ced34c6 commit 3e48255

File tree

197 files changed

+5467
-5514
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

197 files changed

+5467
-5514
lines changed

src/main/java/com/adyen/model/acswebhooks/AbstractOpenApiSchema.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
/**
2222
* Abstract class for oneOf,anyOf schemas defined in OpenAPI spec
2323
*/
24-
2524
public abstract class AbstractOpenApiSchema {
2625

2726
// store the actual instance of the schema/object
@@ -33,6 +32,11 @@ public abstract class AbstractOpenApiSchema {
3332
// schema type (e.g. oneOf, anyOf)
3433
private final String schemaType;
3534

35+
/**
36+
*
37+
* @param schemaType the schema type
38+
* @param isNullable whether the instance is nullable
39+
*/
3640
public AbstractOpenApiSchema(String schemaType, Boolean isNullable) {
3741
this.schemaType = schemaType;
3842
this.isNullable = isNullable;
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
/*
2+
* Authentication webhooks
3+
*
4+
* The version of the OpenAPI document: 1
5+
*
6+
*
7+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
8+
* https://openapi-generator.tech
9+
* Do not edit the class manually.
10+
*/
11+
12+
package com.adyen.model.acswebhooks;
13+
14+
import java.util.Optional;
15+
import java.util.logging.Logger;
16+
17+
/**
18+
* Handler for processing AcsWebhooks.
19+
* <p>
20+
* This class provides functionality to deserialize the payload of AcsWebhooks events.
21+
*/
22+
public class AcsWebhooksHandler {
23+
24+
private static final Logger LOG = Logger.getLogger(AcsWebhooksHandler.class.getName());
25+
26+
private final String payload;
27+
28+
/**
29+
* Constructs a new handler for the given webhook payload
30+
*
31+
* @param payload the raw JSON payload from the webhook
32+
*/
33+
public AcsWebhooksHandler(String payload) {
34+
this.payload = payload;
35+
}
36+
37+
/**
38+
* Attempts to deserialize the webhook payload into a AuthenticationNotificationRequest
39+
*
40+
* @return an Optional containing the deserialized object, or empty if deserialization fails
41+
*/
42+
public Optional<AuthenticationNotificationRequest> getAuthenticationNotificationRequest() {
43+
return getOptionalField(AuthenticationNotificationRequest.class);
44+
}
45+
46+
/**
47+
* Attempts to deserialize the webhook payload into a RelayedAuthenticationRequest
48+
*
49+
* @return an Optional containing the deserialized object, or empty if deserialization fails
50+
*/
51+
public Optional<RelayedAuthenticationRequest> getRelayedAuthenticationRequest() {
52+
return getOptionalField(RelayedAuthenticationRequest.class);
53+
}
54+
55+
/**
56+
* Deserializes the payload into the specified class type.
57+
*
58+
* @param clazz the class to deserialize into
59+
* @param <T> the type of the class
60+
* @return an Optional containing the deserialized object, or empty if an error occurs
61+
*/
62+
private <T> Optional<T> getOptionalField(Class<T> clazz) {
63+
try {
64+
T val = JSON.getMapper().readValue(payload, clazz);
65+
return Optional.ofNullable(val);
66+
} catch (Exception e) {
67+
// an error has occurred during deserialization (object not found, deserialization error)
68+
LOG.warning("Object not found or unexpected error trying to access: " + clazz.getName());
69+
LOG.warning("Deserialization error: " + e.getMessage());
70+
return Optional.empty();
71+
}
72+
}
73+
74+
}

src/main/java/com/adyen/model/acswebhooks/Amount.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public Amount() {
4646
/**
4747
* The three-character [ISO currency code](https://docs.adyen.com/development-resources/currency-codes#currency-codes).
4848
*
49-
* @param currency
49+
* @param currency The three-character [ISO currency code](https://docs.adyen.com/development-resources/currency-codes#currency-codes).
5050
* @return the current {@code Amount} instance, allowing for method chaining
5151
*/
5252
public Amount currency(String currency) {
@@ -56,7 +56,7 @@ public Amount currency(String currency) {
5656

5757
/**
5858
* The three-character [ISO currency code](https://docs.adyen.com/development-resources/currency-codes#currency-codes).
59-
* @return currency
59+
* @return currency The three-character [ISO currency code](https://docs.adyen.com/development-resources/currency-codes#currency-codes).
6060
*/
6161
@JsonProperty(JSON_PROPERTY_CURRENCY)
6262
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
@@ -67,7 +67,7 @@ public String getCurrency() {
6767
/**
6868
* The three-character [ISO currency code](https://docs.adyen.com/development-resources/currency-codes#currency-codes).
6969
*
70-
* @param currency
70+
* @param currency The three-character [ISO currency code](https://docs.adyen.com/development-resources/currency-codes#currency-codes).
7171
*/
7272
@JsonProperty(JSON_PROPERTY_CURRENCY)
7373
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
@@ -78,7 +78,7 @@ public void setCurrency(String currency) {
7878
/**
7979
* The amount of the transaction, in [minor units](https://docs.adyen.com/development-resources/currency-codes#minor-units).
8080
*
81-
* @param value
81+
* @param value The amount of the transaction, in [minor units](https://docs.adyen.com/development-resources/currency-codes#minor-units).
8282
* @return the current {@code Amount} instance, allowing for method chaining
8383
*/
8484
public Amount value(Long value) {
@@ -88,7 +88,7 @@ public Amount value(Long value) {
8888

8989
/**
9090
* The amount of the transaction, in [minor units](https://docs.adyen.com/development-resources/currency-codes#minor-units).
91-
* @return value
91+
* @return value The amount of the transaction, in [minor units](https://docs.adyen.com/development-resources/currency-codes#minor-units).
9292
*/
9393
@JsonProperty(JSON_PROPERTY_VALUE)
9494
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
@@ -99,7 +99,7 @@ public Long getValue() {
9999
/**
100100
* The amount of the transaction, in [minor units](https://docs.adyen.com/development-resources/currency-codes#minor-units).
101101
*
102-
* @param value
102+
* @param value The amount of the transaction, in [minor units](https://docs.adyen.com/development-resources/currency-codes#minor-units).
103103
*/
104104
@JsonProperty(JSON_PROPERTY_VALUE)
105105
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

src/main/java/com/adyen/model/acswebhooks/AuthenticationDecision.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ public AuthenticationDecision() {
7777
/**
7878
* The status of the authentication. Possible values: * **refused** * **proceed** For more information, refer to [Authenticate cardholders using the Authentication SDK](https://docs.adyen.com/issuing/3d-secure/oob-auth-sdk/authenticate-cardholders/).
7979
*
80-
* @param status
80+
* @param status The status of the authentication. Possible values: * **refused** * **proceed** For more information, refer to [Authenticate cardholders using the Authentication SDK](https://docs.adyen.com/issuing/3d-secure/oob-auth-sdk/authenticate-cardholders/).
8181
* @return the current {@code AuthenticationDecision} instance, allowing for method chaining
8282
*/
8383
public AuthenticationDecision status(StatusEnum status) {
@@ -87,7 +87,7 @@ public AuthenticationDecision status(StatusEnum status) {
8787

8888
/**
8989
* The status of the authentication. Possible values: * **refused** * **proceed** For more information, refer to [Authenticate cardholders using the Authentication SDK](https://docs.adyen.com/issuing/3d-secure/oob-auth-sdk/authenticate-cardholders/).
90-
* @return status
90+
* @return status The status of the authentication. Possible values: * **refused** * **proceed** For more information, refer to [Authenticate cardholders using the Authentication SDK](https://docs.adyen.com/issuing/3d-secure/oob-auth-sdk/authenticate-cardholders/).
9191
*/
9292
@JsonProperty(JSON_PROPERTY_STATUS)
9393
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
@@ -98,7 +98,7 @@ public StatusEnum getStatus() {
9898
/**
9999
* The status of the authentication. Possible values: * **refused** * **proceed** For more information, refer to [Authenticate cardholders using the Authentication SDK](https://docs.adyen.com/issuing/3d-secure/oob-auth-sdk/authenticate-cardholders/).
100100
*
101-
* @param status
101+
* @param status The status of the authentication. Possible values: * **refused** * **proceed** For more information, refer to [Authenticate cardholders using the Authentication SDK](https://docs.adyen.com/issuing/3d-secure/oob-auth-sdk/authenticate-cardholders/).
102102
*/
103103
@JsonProperty(JSON_PROPERTY_STATUS)
104104
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

0 commit comments

Comments
 (0)