Skip to content

Commit 4209400

Browse files
authored
Merge pull request #1531 from Adyen/sdk-automation/models
Code generation: update services and models
2 parents 923e30b + fa9e95c commit 4209400

37 files changed

+1801
-136
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ The library supports all webhooks under the following model directories:
5353
| [Management Webhooks](https://docs.adyen.com/api-explorer/ManagementNotification/3/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/typings/managementWebhooks) | **v3** |
5454
| [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/typings/notification) | **v1** |
5555
| [Transaction Webhooks](https://docs.adyen.com/api-explorer/transaction-webhooks/4/overview) | Adyen sends webhooks to inform your system about incoming and outgoing transfers in your platform. 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. | [TransactionWebhooks](src/typings/transactionWebhooks) | **v4** |
56+
| [Tokenization Webhooks](https://docs.adyen.com/api-explorer/Tokenization-webhooks/1/overview) | Adyen sends webhooks to inform you about the creation and changes to the recurring tokens. | [tokenizationwebhooks](src/main/java/com/adyen/model/tokenizationwebhooks) | **v1** |
5657

5758
For more information, refer to our [documentation](https://docs.adyen.com/) or the [API Explorer](https://docs.adyen.com/api-explorer/).
5859

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
import { TokenizationAlreadyExistingDetailsNotificationRequest } from "../../typings/tokenizationWebhooks/tokenizationAlreadyExistingDetailsNotificationRequest";
2+
import { TokenizationCreatedDetailsNotificationRequest } from "../../typings/tokenizationWebhooks/tokenizationCreatedDetailsNotificationRequest";
3+
import { TokenizationDisabledDetailsNotificationRequest } from "../../typings/tokenizationWebhooks/tokenizationDisabledDetailsNotificationRequest";
4+
import { TokenizationUpdatedDetailsNotificationRequest } from "../../typings/tokenizationWebhooks/tokenizationUpdatedDetailsNotificationRequest";
5+
import { TokenizationWebhooksHandler } from "../../typings/tokenizationWebhooks/tokenizationWebhooksHandler";
6+
7+
describe("TokenizationWebhooksHandler", () => {
8+
it("should deserialize TokenizationAlreadyExistingDetailsNotificationRequest", () => {
9+
const json = {
10+
"createdAt": "2025-06-30T16:40:23+02:00",
11+
"eventId": "QBQQ9DLNRHHKGK38",
12+
"environment": "test",
13+
"data": {
14+
"merchantAccount": "YOUR_MERCHANT_ACCOUNT",
15+
"storedPaymentMethodId": "M5N7TQ4TG5PFWR50",
16+
"type": "visastandarddebit",
17+
"operation": "alreadyExisting",
18+
"shopperReference": "YOUR_SHOPPER_REFERENCE"
19+
},
20+
"type": "recurring.token.alreadyExisting"
21+
};
22+
const handler = new TokenizationWebhooksHandler(JSON.stringify(json));
23+
const request = handler.getTokenizationAlreadyExistingDetailsNotificationRequest();
24+
expect(request).toBeTruthy();
25+
expect(request.type).toBe(TokenizationAlreadyExistingDetailsNotificationRequest.TypeEnum.RecurringTokenAlreadyExisting);
26+
expect(request.data.type).toBe("visastandarddebit");
27+
// test GenericWebhook
28+
const genericWebhook = handler.getGenericWebhook();
29+
expect(genericWebhook).toBeInstanceOf(TokenizationAlreadyExistingDetailsNotificationRequest);
30+
expect(genericWebhook.type).toBe("recurring.token.alreadyExisting");
31+
});
32+
33+
it("should deserialize TokenizationCreatedDetailsNotificationRequest", () => {
34+
const json = {
35+
"createdAt": "2025-06-30T16:40:23+02:00",
36+
"eventId": "QBQQ9DLNRHHKGK38",
37+
"environment": "test",
38+
"data": {
39+
"merchantAccount": "YOUR_MERCHANT_ACCOUNT",
40+
"storedPaymentMethodId": "M5N7TQ4TG5PFWR50",
41+
"type": "visastandarddebit",
42+
"operation": "created",
43+
"shopperReference": "YOUR_SHOPPER_REFERENCE"
44+
},
45+
"type": "recurring.token.created"
46+
};
47+
const handler = new TokenizationWebhooksHandler(JSON.stringify(json));
48+
const request = handler.getTokenizationCreatedDetailsNotificationRequest();
49+
expect(request).toBeTruthy();
50+
expect(request.type).toBe(TokenizationCreatedDetailsNotificationRequest.TypeEnum.RecurringTokenCreated);
51+
expect(request.data.type).toBe("visastandarddebit");
52+
// test GenericWebhook
53+
const genericWebhook = handler.getGenericWebhook();
54+
expect(genericWebhook).toBeInstanceOf(TokenizationCreatedDetailsNotificationRequest);
55+
expect(genericWebhook.type).toBe("recurring.token.created");
56+
});
57+
58+
it("should deserialize TokenizationUpdatedDetailsNotificationRequest", () => {
59+
const json = {
60+
"createdAt": "2025-06-30T16:40:23+02:00",
61+
"eventId": "QBQQ9DLNRHHKGK38",
62+
"environment": "test",
63+
"data": {
64+
"merchantAccount": "YOUR_MERCHANT_ACCOUNT",
65+
"storedPaymentMethodId": "M5N7TQ4TG5PFWR50",
66+
"type": "visastandarddebit",
67+
"operation": "updated",
68+
"shopperReference": "YOUR_SHOPPER_REFERENCE"
69+
},
70+
"type": "recurring.token.updated"
71+
};
72+
const handler = new TokenizationWebhooksHandler(JSON.stringify(json));
73+
const request = handler.getTokenizationUpdatedDetailsNotificationRequest();
74+
expect(request).toBeTruthy();
75+
expect(request.type).toBe(TokenizationUpdatedDetailsNotificationRequest.TypeEnum.RecurringTokenUpdated);
76+
expect(request.data.type).toBe("visastandarddebit");
77+
// test GenericWebhook
78+
const genericWebhook = handler.getGenericWebhook();
79+
expect(genericWebhook).toBeInstanceOf(TokenizationUpdatedDetailsNotificationRequest);
80+
expect(genericWebhook.type).toBe("recurring.token.updated");
81+
});
82+
83+
it("should deserialize TokenizationDisabledDetailsNotificationRequest", () => {
84+
const json = {
85+
"createdAt": "2025-06-30T16:40:23+02:00",
86+
"eventId": "QBQQ9DLNRHHKGK38",
87+
"environment": "test",
88+
"data": {
89+
"merchantAccount": "YOUR_MERCHANT_ACCOUNT",
90+
"storedPaymentMethodId": "M5N7TQ4TG5PFWR50",
91+
"type": "visastandarddebit",
92+
"shopperReference": "YOUR_SHOPPER_REFERENCE"
93+
},
94+
"type": "recurring.token.disabled"
95+
};
96+
const handler = new TokenizationWebhooksHandler(JSON.stringify(json));
97+
const request = handler.getTokenizationDisabledDetailsNotificationRequest();
98+
expect(request).toBeTruthy();
99+
expect(request.type).toBe(TokenizationDisabledDetailsNotificationRequest.TypeEnum.RecurringTokenDisabled);
100+
expect(request.data.type).toBe("visastandarddebit");
101+
// test GenericWebhook
102+
const genericWebhook = handler.getGenericWebhook();
103+
expect(genericWebhook).toBeInstanceOf(TokenizationDisabledDetailsNotificationRequest);
104+
expect(genericWebhook.type).toBe("recurring.token.disabled");
105+
});
106+
107+
it("should throw error for unknown type", () => {
108+
const json = {
109+
type: "unknown.type",
110+
data: {}
111+
};
112+
const handler = new TokenizationWebhooksHandler(JSON.stringify(json));
113+
expect(() => handler.getGenericWebhook()).toThrow("Could not parse the json payload");
114+
});
115+
116+
it("should throw SyntaxError for invalid JSON", () => {
117+
expect(() => new TokenizationWebhooksHandler("{ invalid json }")).toThrow(SyntaxError);
118+
});
119+
});

src/typings/checkout/authenticationData.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export class AuthenticationData {
1616
*/
1717
"attemptAuthentication"?: AuthenticationData.AttemptAuthenticationEnum;
1818
/**
19-
* If set to true, you will only perform the [3D Secure 2 authentication](https://docs.adyen.com/online-payments/3d-secure/other-3ds-flows/authentication-only), and not the payment authorisation. Default: **false**.
19+
* Required to trigger the [authentication-only flow](https://docs.adyen.com/online-payments/3d-secure/authentication-only/). If set to **true**, you will only perform the 3D Secure 2 authentication, and will not proceed to the payment authorization. Default: **false**.
2020
*/
2121
"authenticationOnly"?: boolean;
2222
"threeDSRequestData"?: ThreeDSRequestData | null;

src/typings/checkout/balanceCheckRequest.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,11 +106,11 @@ export class BalanceCheckRequest {
106106
*/
107107
"sessionId"?: string;
108108
/**
109-
* The shopper\'s email address. We recommend that you provide this data, as it is used in velocity fraud checks. > For 3D Secure 2 transactions, schemes require `shopperEmail` for all browser-based and mobile implementations.
109+
* The shopper\'s email address. We recommend that you provide this data, as it is used in velocity fraud checks. > Required for Visa and JCB transactions that require 3D Secure 2 authentication if you did not include the `telephoneNumber`.
110110
*/
111111
"shopperEmail"?: string;
112112
/**
113-
* The shopper\'s IP address. In general, we recommend that you provide this data, as it is used in a number of risk checks (for instance, number of payment attempts or location-based checks). > For 3D Secure 2 transactions, schemes require `shopperIP` for all browser-based implementations. This field is also mandatory for some merchants depending on your business model. For more information, [contact Support](https://www.adyen.help/hc/en-us/requests/new).
113+
* The shopper\'s IP address. We recommend that you provide this data, as it is used in a number of risk checks (for instance, number of payment attempts or location-based checks).> Required for Visa and JCB transactions that require 3D Secure 2 authentication for all web and mobile integrations, if you did not include the `shopperEmail`. For native mobile integrations, the field is required to support cases where authentication is routed to the redirect flow. This field is also mandatory for some merchants depending on your business model. For more information, [contact Support](https://www.adyen.help/hc/en-us/requests/new).
114114
*/
115115
"shopperIP"?: string;
116116
/**
@@ -143,12 +143,12 @@ export class BalanceCheckRequest {
143143
*/
144144
"store"?: string;
145145
/**
146-
* The shopper\'s telephone number.
146+
* The shopper\'s telephone number. > Required for Visa and JCB transactions that require 3D Secure 2 authentication, if you did not include the `shopperEmail`. The phone number must include a plus sign (+) and a country code (1-3 digits), followed by the number (4-15 digits). If the value you provide does not follow the guidelines, we drop the value and do not submit it for authentication.
147147
*/
148148
"telephoneNumber"?: string;
149149
"threeDS2RequestData"?: ThreeDS2RequestData | null;
150150
/**
151-
* If set to true, you will only perform the [3D Secure 2 authentication](https://docs.adyen.com/online-payments/3d-secure/other-3ds-flows/authentication-only), and not the payment authorisation.
151+
* Required to trigger the [authentication-only flow](https://docs.adyen.com/online-payments/3d-secure/authentication-only/). If set to **true**, you will only perform the 3D Secure 2 authentication, and will not proceed to the payment authorization.Default: **false**.
152152
*
153153
* @deprecated since Adyen Checkout API v69
154154
* Use `authenticationData.authenticationOnly` instead.

src/typings/checkout/createCheckoutSessionRequest.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ export class CreateCheckoutSessionRequest {
142142
*/
143143
"reference": string;
144144
/**
145-
* The URL to return to in case of a redirection. The format depends on the channel. * For web, include the protocol `http://` or `https://`. You can also include your own additional query parameters, for example, shopper ID or order reference number. Example: `https://your-company.com/checkout?shopperOrder=12xy` * For iOS, use the custom URL for your app. To know more about setting custom URL schemes, refer to the [Apple Developer documentation](https://developer.apple.com/documentation/uikit/inter-process_communication/allowing_apps_and_websites_to_link_to_your_content/defining_a_custom_url_scheme_for_your_app). Example: `my-app://` * For Android, use a custom URL handled by an Activity on your app. You can configure it with an [intent filter](https://developer.android.com/guide/components/intents-filters). Example: `my-app://your.package.name` If the URL to return to includes non-ASCII characters, like spaces or special letters, URL encode the value. > The URL must not include personally identifiable information (PII), for example name or email address.
145+
* The URL to return to in case of a redirection. The format depends on the channel. * For web, include the protocol `http://` or `https://`. You can also include your own additional query parameters, for example, shopper ID or order reference number. Example: `https://your-company.com/checkout?shopperOrder=12xy` * For iOS, use the custom URL for your app. To know more about setting custom URL schemes, refer to the [Apple Developer documentation](https://developer.apple.com/documentation/uikit/inter-process_communication/allowing_apps_and_websites_to_link_to_your_content/defining_a_custom_url_scheme_for_your_app). Example: `my-app://` * For Android, use a custom URL handled by an Activity on your app. You can configure it with an [intent filter](https://developer.android.com/guide/components/intents-filters). Example: `my-app://your.package.name` If the URL to return to includes non-ASCII characters, like spaces or special letters, URL encode the value. We strongly recommend that you use a maximum of 1024 characters. > The URL must not include personally identifiable information (PII), for example name or email address.
146146
*/
147147
"returnUrl": string;
148148
"riskData"?: RiskData | null;
@@ -151,7 +151,7 @@ export class CreateCheckoutSessionRequest {
151151
*/
152152
"shopperEmail"?: string;
153153
/**
154-
* The shopper\'s IP address. In general, we recommend that you provide this data, as it is used in a number of risk checks (for instance, number of payment attempts or location-based checks). > For 3D Secure 2 transactions, schemes require `shopperIP` for all browser-based implementations. This field is also mandatory for some merchants depending on your business model. For more information, [contact Support](https://www.adyen.help/hc/en-us/requests/new).
154+
* The shopper\'s IP address. We recommend that you provide this data, as it is used in a number of risk checks (for instance, number of payment attempts or location-based checks).> Required for Visa and JCB transactions that require 3D Secure 2 authentication for all web and mobile integrations, if you did not include the `shopperEmail`. For native mobile integrations, the field is required to support cases where authentication is routed to the redirect flow. This field is also mandatory for some merchants depending on your business model. For more information, [contact Support](https://www.adyen.help/hc/en-us/requests/new).
155155
*/
156156
"shopperIP"?: string;
157157
/**
@@ -208,7 +208,7 @@ export class CreateCheckoutSessionRequest {
208208
*/
209209
"storePaymentMethodMode"?: CreateCheckoutSessionRequest.StorePaymentMethodModeEnum;
210210
/**
211-
* The shopper\'s telephone number.
211+
* The shopper\'s telephone number. > Required for Visa and JCB transactions that require 3D Secure 2 authentication, if you did not include the `shopperEmail`. The phone number must include a plus sign (+) and a country code (1-3 digits), followed by the number (4-15 digits). If the value you provide does not follow the guidelines, we drop the value and do not submit it for authentication.
212212
*/
213213
"telephoneNumber"?: string;
214214
/**
@@ -217,7 +217,7 @@ export class CreateCheckoutSessionRequest {
217217
"themeId"?: string;
218218
"threeDS2RequestData"?: CheckoutSessionThreeDS2RequestData | null;
219219
/**
220-
* If set to true, you will only perform the [3D Secure 2 authentication](https://docs.adyen.com/online-payments/3d-secure/other-3ds-flows/authentication-only), and not the payment authorisation.
220+
* Required to trigger the [authentication-only flow](https://docs.adyen.com/online-payments/3d-secure/authentication-only/). If set to **true**, you will only perform the 3D Secure 2 authentication, and will not proceed to the payment authorization.Default: **false**.
221221
*
222222
* @deprecated since Adyen Checkout API v69
223223
* Use `authenticationData.authenticationOnly` instead.

0 commit comments

Comments
 (0)