Skip to content

Commit f324273

Browse files
committed
Generate DisputeWebhooks
1 parent 445a3ed commit f324273

File tree

7 files changed

+483
-199
lines changed

7 files changed

+483
-199
lines changed

src/typings/disputeWebhooks/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/disputeWebhooks/balancePlatformNotificationResponse.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,25 @@ export class BalancePlatformNotificationResponse {
1212
/**
1313
* Respond with any **2xx** HTTP status code to [accept the webhook](https://docs.adyen.com/development-resources/webhooks#accept-notifications).
1414
*/
15-
'notificationResponse'?: string;
15+
"notificationResponse"?: string;
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": "notificationResponse",
2224
"baseName": "notificationResponse",
23-
"type": "string"
25+
"type": "string",
26+
"format": ""
2427
} ];
2528

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

src/typings/disputeWebhooks/disputeEventNotification.ts

Lines changed: 39 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -7,104 +7,120 @@
77
* Do not edit this class manually.
88
*/
99

10-
import { Amount } from './amount';
10+
import { Amount } from "./amount";
11+
1112

1213
export class DisputeEventNotification {
1314
/**
1415
* The unique Acquirer Reference Number (arn) generated by the card scheme for each capture. You can use the arn to trace the transaction through its lifecycle.
1516
*/
16-
'arn'?: string;
17+
"arn"?: string;
1718
/**
1819
* The unique identifier of the balance platform.
1920
*/
20-
'balancePlatform'?: string;
21+
"balancePlatform"?: string;
2122
/**
2223
* The date and time when the event was triggered, in ISO 8601 extended format. For example, **2020-12-18T10:15:30+01:00**.
2324
*/
24-
'creationDate'?: Date;
25+
"creationDate"?: Date;
2526
/**
2627
* Contains information about the dispute.
2728
*/
28-
'description'?: string;
29-
'disputedAmount'?: Amount | null;
29+
"description"?: string;
30+
"disputedAmount"?: Amount;
3031
/**
3132
* The ID of the resource.
3233
*/
33-
'id'?: string;
34+
"id"?: string;
3435
/**
3536
* The current status of the dispute.
3637
*/
37-
'status'?: string;
38+
"status"?: string;
3839
/**
3940
* Additional information about the status of the dispute, when available.
4041
*/
41-
'statusDetail'?: string;
42+
"statusDetail"?: string;
4243
/**
4344
* The unique reference of the transaction for which the dispute is requested.
4445
*/
45-
'transactionId'?: string;
46+
"transactionId"?: string;
4647
/**
4748
* The type of dispute raised for the transaction.
4849
*/
49-
'type'?: DisputeEventNotification.TypeEnum;
50+
"type"?: DisputeEventNotification.TypeEnum;
51+
52+
static readonly discriminator: string | undefined = undefined;
5053

51-
static discriminator: string | undefined = undefined;
54+
static readonly mapping: {[index: string]: string} | undefined = undefined;
5255

53-
static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [
56+
static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [
5457
{
5558
"name": "arn",
5659
"baseName": "arn",
57-
"type": "string"
60+
"type": "string",
61+
"format": ""
5862
},
5963
{
6064
"name": "balancePlatform",
6165
"baseName": "balancePlatform",
62-
"type": "string"
66+
"type": "string",
67+
"format": ""
6368
},
6469
{
6570
"name": "creationDate",
6671
"baseName": "creationDate",
67-
"type": "Date"
72+
"type": "Date",
73+
"format": "date-time"
6874
},
6975
{
7076
"name": "description",
7177
"baseName": "description",
72-
"type": "string"
78+
"type": "string",
79+
"format": ""
7380
},
7481
{
7582
"name": "disputedAmount",
7683
"baseName": "disputedAmount",
77-
"type": "Amount | null"
84+
"type": "Amount",
85+
"format": ""
7886
},
7987
{
8088
"name": "id",
8189
"baseName": "id",
82-
"type": "string"
90+
"type": "string",
91+
"format": ""
8392
},
8493
{
8594
"name": "status",
8695
"baseName": "status",
87-
"type": "string"
96+
"type": "string",
97+
"format": ""
8898
},
8999
{
90100
"name": "statusDetail",
91101
"baseName": "statusDetail",
92-
"type": "string"
102+
"type": "string",
103+
"format": ""
93104
},
94105
{
95106
"name": "transactionId",
96107
"baseName": "transactionId",
97-
"type": "string"
108+
"type": "string",
109+
"format": ""
98110
},
99111
{
100112
"name": "type",
101113
"baseName": "type",
102-
"type": "DisputeEventNotification.TypeEnum"
114+
"type": "DisputeEventNotification.TypeEnum",
115+
"format": ""
103116
} ];
104117

105118
static getAttributeTypeMap() {
106119
return DisputeEventNotification.attributeTypeMap;
107120
}
121+
122+
public constructor() {
123+
}
108124
}
109125

110126
export namespace DisputeEventNotification {

src/typings/disputeWebhooks/disputeNotificationRequest.ts

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,37 +7,45 @@
77
* Do not edit this class manually.
88
*/
99

10-
import { DisputeEventNotification } from './disputeEventNotification';
10+
import { DisputeEventNotification } from "./disputeEventNotification";
11+
1112

1213
export class DisputeNotificationRequest {
13-
'data': DisputeEventNotification;
14+
"data": DisputeEventNotification;
1415
/**
1516
* Type of webhook.
1617
*/
17-
'type': DisputeNotificationRequest.TypeEnum;
18+
"type": DisputeNotificationRequest.TypeEnum;
19+
20+
static readonly discriminator: string | undefined = undefined;
1821

19-
static discriminator: string | undefined = undefined;
22+
static readonly mapping: {[index: string]: string} | undefined = undefined;
2023

21-
static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [
24+
static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [
2225
{
2326
"name": "data",
2427
"baseName": "data",
25-
"type": "DisputeEventNotification"
28+
"type": "DisputeEventNotification",
29+
"format": ""
2630
},
2731
{
2832
"name": "type",
2933
"baseName": "type",
30-
"type": "DisputeNotificationRequest.TypeEnum"
34+
"type": "DisputeNotificationRequest.TypeEnum",
35+
"format": ""
3136
} ];
3237

3338
static getAttributeTypeMap() {
3439
return DisputeNotificationRequest.attributeTypeMap;
3540
}
41+
42+
public constructor() {
43+
}
3644
}
3745

3846
export namespace DisputeNotificationRequest {
3947
export enum TypeEnum {
40-
Created = 'balancePlatform.dispute.created',
41-
Updated = 'balancePlatform.dispute.updated'
48+
BalancePlatformDisputeCreated = 'balancePlatform.dispute.created',
49+
BalancePlatformDisputeUpdated = 'balancePlatform.dispute.updated'
4250
}
4351
}
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
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 { disputeWebhooks } 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+
18+
/**
19+
* Handler for processing DisputeWebhooks.
20+
*
21+
* This class provides functionality to deserialize the payload of DisputeWebhooks events.
22+
*/
23+
export class DisputeWebhooksHandler {
24+
25+
private readonly payload: Record<string, any>;
26+
27+
public constructor(jsonPayload: string) {
28+
this.payload = JSON.parse(jsonPayload);
29+
}
30+
31+
/**
32+
* This method checks the type of the webhook payload and returns the appropriate deserialized object.
33+
*
34+
* @returns A deserialized object of type GenericWebhook.
35+
* @throws Error if the type is not recognized.
36+
*/
37+
public getGenericWebhook(): GenericWebhook {
38+
39+
const type = this.payload["type"];
40+
41+
throw new Error("Could not parse the json payload: " + this.payload);
42+
43+
}
44+
45+
}

0 commit comments

Comments
 (0)