Skip to content

Commit 03704a9

Browse files
committed
Generate AcsWebhooks
1 parent 01713be commit 03704a9

16 files changed

+739
-339
lines changed
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
/*
2+
* The version of the OpenAPI document: v1
3+
*
4+
*
5+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
6+
* https://openapi-generator.tech
7+
* Do not edit this class manually.
8+
*/
9+
10+
import { acsWebhooks } from "..";
11+
12+
/**
13+
* Union type for all supported webhook requests.
14+
* Allows generic handling of configuration-related webhook events.
15+
*/
16+
export type GenericWebhook =
17+
| acsWebhooks.AuthenticationNotificationRequest
18+
| acsWebhooks.RelayedAuthenticationRequest;
19+
20+
/**
21+
* Handler for processing AcsWebhooks.
22+
*
23+
* This class provides functionality to deserialize the payload of AcsWebhooks events.
24+
*/
25+
export class AcsWebhooksHandler {
26+
27+
private readonly payload: Record<string, any>;
28+
29+
public constructor(jsonPayload: string) {
30+
this.payload = JSON.parse(jsonPayload);
31+
}
32+
33+
/**
34+
* This method checks the type of the webhook payload and returns the appropriate deserialized object.
35+
*
36+
* @returns A deserialized object of type GenericWebhook.
37+
* @throws Error if the type is not recognized.
38+
*/
39+
public getGenericWebhook(): GenericWebhook {
40+
41+
const type = this.payload["type"];
42+
43+
if(Object.values(acsWebhooks.AuthenticationNotificationRequest.TypeEnum).includes(type)) {
44+
return this.getAuthenticationNotificationRequest();
45+
}
46+
47+
if(Object.values(acsWebhooks.RelayedAuthenticationRequest.TypeEnum).includes(type)) {
48+
return this.getRelayedAuthenticationRequest();
49+
}
50+
51+
throw new Error("Could not parse the json payload: " + this.payload);
52+
53+
}
54+
55+
/**
56+
* Deserialize the webhook payload into a AuthenticationNotificationRequest
57+
*
58+
* @returns Deserialized AuthenticationNotificationRequest object.
59+
*/
60+
public getAuthenticationNotificationRequest(): acsWebhooks.AuthenticationNotificationRequest {
61+
return acsWebhooks.ObjectSerializer.deserialize(this.payload, "AuthenticationNotificationRequest");
62+
}
63+
64+
/**
65+
* Deserialize the webhook payload into a RelayedAuthenticationRequest
66+
*
67+
* @returns Deserialized RelayedAuthenticationRequest object.
68+
*/
69+
public getRelayedAuthenticationRequest(): acsWebhooks.RelayedAuthenticationRequest {
70+
return acsWebhooks.ObjectSerializer.deserialize(this.payload, "RelayedAuthenticationRequest");
71+
}
72+
73+
}

src/typings/acsWebhooks/amount.ts

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,28 +12,35 @@ export class Amount {
1212
/**
1313
* The three-character [ISO currency code](https://docs.adyen.com/development-resources/currency-codes#currency-codes).
1414
*/
15-
'currency': string;
15+
"currency": string;
1616
/**
1717
* The amount of the transaction, in [minor units](https://docs.adyen.com/development-resources/currency-codes#minor-units).
1818
*/
19-
'value': number;
19+
"value": number;
2020

21-
static discriminator: string | undefined = undefined;
21+
static readonly discriminator: string | undefined = undefined;
2222

23-
static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [
23+
static readonly mapping: {[index: string]: string} | undefined = undefined;
24+
25+
static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [
2426
{
2527
"name": "currency",
2628
"baseName": "currency",
27-
"type": "string"
29+
"type": "string",
30+
"format": ""
2831
},
2932
{
3033
"name": "value",
3134
"baseName": "value",
32-
"type": "number"
35+
"type": "number",
36+
"format": "int64"
3337
} ];
3438

3539
static getAttributeTypeMap() {
3640
return Amount.attributeTypeMap;
3741
}
42+
43+
public constructor() {
44+
}
3845
}
3946

src/typings/acsWebhooks/authenticationDecision.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,26 @@ export class AuthenticationDecision {
1212
/**
1313
* 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/).
1414
*/
15-
'status': AuthenticationDecision.StatusEnum;
15+
"status": AuthenticationDecision.StatusEnum;
1616

17-
static discriminator: string | undefined = undefined;
17+
static readonly discriminator: string | undefined = undefined;
1818

19-
static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [
19+
static readonly mapping: {[index: string]: string} | undefined = undefined;
20+
21+
static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [
2022
{
2123
"name": "status",
2224
"baseName": "status",
23-
"type": "AuthenticationDecision.StatusEnum"
25+
"type": "AuthenticationDecision.StatusEnum",
26+
"format": ""
2427
} ];
2528

2629
static getAttributeTypeMap() {
2730
return AuthenticationDecision.attributeTypeMap;
2831
}
32+
33+
public constructor() {
34+
}
2935
}
3036

3137
export namespace AuthenticationDecision {

src/typings/acsWebhooks/authenticationInfo.ts

Lines changed: 54 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -7,149 +7,170 @@
77
* Do not edit this class manually.
88
*/
99

10-
import { ChallengeInfo } from './challengeInfo';
10+
import { ChallengeInfo } from "./challengeInfo";
11+
1112

1213
export class AuthenticationInfo {
1314
/**
1415
* Universally unique transaction identifier assigned by the Access Control Server (ACS) to identify a single transaction.
1516
*/
16-
'acsTransId': string;
17-
'challenge'?: ChallengeInfo | null;
17+
"acsTransId": string;
18+
"challenge"?: ChallengeInfo;
1819
/**
1920
* Specifies a preference for receiving a challenge. Possible values: * **01**: No preference * **02**: No challenge requested * **03**: Challenge requested (preference) * **04**: Challenge requested (mandate) * **05**: No challenge requested (transactional risk analysis is already performed) * **07**: No challenge requested (SCA is already performed) * **08**: No challenge requested (trusted beneficiaries exemption of no challenge required) * **09**: Challenge requested (trusted beneficiaries prompt requested if challenge required) * **80**: No challenge requested (secure corporate payment with Mastercard) * **82**: No challenge requested (secure corporate payment with Visa)
2021
*/
21-
'challengeIndicator': AuthenticationInfo.ChallengeIndicatorEnum;
22+
"challengeIndicator": AuthenticationInfo.ChallengeIndicatorEnum;
2223
/**
2324
* Date and time in UTC of the cardholder authentication. [ISO 8601](https://www.w3.org/TR/NOTE-datetime) format: YYYY-MM-DDThh:mm:ss+TZD, for example, **2020-12-18T10:15:30+01:00**.
2425
*/
25-
'createdAt': Date;
26+
"createdAt": Date;
2627
/**
2728
* Indicates the type of channel interface being used to initiate the transaction. Possible values: * **app** * **browser** * **3DSRequestorInitiated** (initiated by a merchant when the cardholder is not available)
2829
*/
29-
'deviceChannel': AuthenticationInfo.DeviceChannelEnum;
30+
"deviceChannel": AuthenticationInfo.DeviceChannelEnum;
3031
/**
3132
* Universally unique transaction identifier assigned by the DS (card scheme) to identify a single transaction.
3233
*/
33-
'dsTransID': string;
34+
"dsTransID": string;
3435
/**
3536
* Indicates the exemption type that was applied to the authentication by the issuer, if exemption applied. Possible values: * **lowValue** * **secureCorporate** * **trustedBeneficiary** * **transactionRiskAnalysis** * **acquirerExemption** * **noExemptionApplied** * **visaDAFExemption**
3637
*/
37-
'exemptionIndicator'?: AuthenticationInfo.ExemptionIndicatorEnum;
38+
"exemptionIndicator"?: AuthenticationInfo.ExemptionIndicatorEnum;
3839
/**
3940
* Indicates if the purchase was in the PSD2 scope.
4041
*/
41-
'inPSD2Scope': boolean;
42+
"inPSD2Scope": boolean;
4243
/**
4344
* Identifies the category of the message for a specific use case. Possible values: * **payment** * **nonPayment**
4445
*/
45-
'messageCategory': AuthenticationInfo.MessageCategoryEnum;
46+
"messageCategory": AuthenticationInfo.MessageCategoryEnum;
4647
/**
4748
* The `messageVersion` value as defined in the 3D Secure 2 specification.
4849
*/
49-
'messageVersion': string;
50+
"messageVersion": string;
5051
/**
5152
* Risk score calculated from the transaction rules.
5253
*/
53-
'riskScore'?: number;
54+
"riskScore"?: number;
5455
/**
5556
* The `threeDSServerTransID` value as defined in the 3D Secure 2 specification.
5657
*/
57-
'threeDSServerTransID': string;
58+
"threeDSServerTransID": string;
5859
/**
5960
* The `transStatus` value as defined in the 3D Secure 2 specification. Possible values: * **Y**: Authentication / Account verification successful. * **N**: Not Authenticated / Account not verified. Transaction denied. * **U**: Authentication / Account verification could not be performed. * **I**: Informational Only / 3D Secure Requestor challenge preference acknowledged. * **R**: Authentication / Account verification rejected by the Issuer.
6061
*/
61-
'transStatus': AuthenticationInfo.TransStatusEnum;
62+
"transStatus": AuthenticationInfo.TransStatusEnum;
6263
/**
6364
* Provides information on why the `transStatus` field has the specified value. For possible values, refer to [our docs](https://docs.adyen.com/online-payments/3d-secure/api-reference#possible-transstatusreason-values).
6465
*/
65-
'transStatusReason'?: AuthenticationInfo.TransStatusReasonEnum;
66+
"transStatusReason"?: AuthenticationInfo.TransStatusReasonEnum;
6667
/**
6768
* The type of authentication performed. Possible values: * **frictionless** * **challenge**
6869
*/
69-
'type': AuthenticationInfo.TypeEnum;
70+
"type": AuthenticationInfo.TypeEnum;
71+
72+
static readonly discriminator: string | undefined = undefined;
7073

71-
static discriminator: string | undefined = undefined;
74+
static readonly mapping: {[index: string]: string} | undefined = undefined;
7275

73-
static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [
76+
static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [
7477
{
7578
"name": "acsTransId",
7679
"baseName": "acsTransId",
77-
"type": "string"
80+
"type": "string",
81+
"format": ""
7882
},
7983
{
8084
"name": "challenge",
8185
"baseName": "challenge",
82-
"type": "ChallengeInfo | null"
86+
"type": "ChallengeInfo",
87+
"format": ""
8388
},
8489
{
8590
"name": "challengeIndicator",
8691
"baseName": "challengeIndicator",
87-
"type": "AuthenticationInfo.ChallengeIndicatorEnum"
92+
"type": "AuthenticationInfo.ChallengeIndicatorEnum",
93+
"format": ""
8894
},
8995
{
9096
"name": "createdAt",
9197
"baseName": "createdAt",
92-
"type": "Date"
98+
"type": "Date",
99+
"format": "date-time"
93100
},
94101
{
95102
"name": "deviceChannel",
96103
"baseName": "deviceChannel",
97-
"type": "AuthenticationInfo.DeviceChannelEnum"
104+
"type": "AuthenticationInfo.DeviceChannelEnum",
105+
"format": ""
98106
},
99107
{
100108
"name": "dsTransID",
101109
"baseName": "dsTransID",
102-
"type": "string"
110+
"type": "string",
111+
"format": ""
103112
},
104113
{
105114
"name": "exemptionIndicator",
106115
"baseName": "exemptionIndicator",
107-
"type": "AuthenticationInfo.ExemptionIndicatorEnum"
116+
"type": "AuthenticationInfo.ExemptionIndicatorEnum",
117+
"format": ""
108118
},
109119
{
110120
"name": "inPSD2Scope",
111121
"baseName": "inPSD2Scope",
112-
"type": "boolean"
122+
"type": "boolean",
123+
"format": ""
113124
},
114125
{
115126
"name": "messageCategory",
116127
"baseName": "messageCategory",
117-
"type": "AuthenticationInfo.MessageCategoryEnum"
128+
"type": "AuthenticationInfo.MessageCategoryEnum",
129+
"format": ""
118130
},
119131
{
120132
"name": "messageVersion",
121133
"baseName": "messageVersion",
122-
"type": "string"
134+
"type": "string",
135+
"format": ""
123136
},
124137
{
125138
"name": "riskScore",
126139
"baseName": "riskScore",
127-
"type": "number"
140+
"type": "number",
141+
"format": "int32"
128142
},
129143
{
130144
"name": "threeDSServerTransID",
131145
"baseName": "threeDSServerTransID",
132-
"type": "string"
146+
"type": "string",
147+
"format": ""
133148
},
134149
{
135150
"name": "transStatus",
136151
"baseName": "transStatus",
137-
"type": "AuthenticationInfo.TransStatusEnum"
152+
"type": "AuthenticationInfo.TransStatusEnum",
153+
"format": ""
138154
},
139155
{
140156
"name": "transStatusReason",
141157
"baseName": "transStatusReason",
142-
"type": "AuthenticationInfo.TransStatusReasonEnum"
158+
"type": "AuthenticationInfo.TransStatusReasonEnum",
159+
"format": ""
143160
},
144161
{
145162
"name": "type",
146163
"baseName": "type",
147-
"type": "AuthenticationInfo.TypeEnum"
164+
"type": "AuthenticationInfo.TypeEnum",
165+
"format": ""
148166
} ];
149167

150168
static getAttributeTypeMap() {
151169
return AuthenticationInfo.attributeTypeMap;
152170
}
171+
172+
public constructor() {
173+
}
153174
}
154175

155176
export namespace AuthenticationInfo {

0 commit comments

Comments
 (0)