Skip to content

Commit 445a3ed

Browse files
committed
Generate NegativeBalanceWarningWebhooks
1 parent 1241772 commit 445a3ed

8 files changed

+521
-213
lines changed

src/typings/negativeBalanceWarningWebhooks/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

Lines changed: 8 additions & 160 deletions
Original file line numberDiff line numberDiff line change
@@ -1,160 +1,8 @@
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-
11-
export * from './amount';
12-
export * from './negativeBalanceCompensationWarningNotificationData';
13-
export * from './negativeBalanceCompensationWarningNotificationRequest';
14-
export * from './resource';
15-
export * from './resourceReference';
16-
17-
18-
import { Amount } from './amount';
19-
import { NegativeBalanceCompensationWarningNotificationData } from './negativeBalanceCompensationWarningNotificationData';
20-
import { NegativeBalanceCompensationWarningNotificationRequest } from './negativeBalanceCompensationWarningNotificationRequest';
21-
import { Resource } from './resource';
22-
import { ResourceReference } from './resourceReference';
23-
24-
/* tslint:disable:no-unused-variable */
25-
let primitives = [
26-
"string",
27-
"boolean",
28-
"double",
29-
"integer",
30-
"long",
31-
"float",
32-
"number",
33-
"any"
34-
];
35-
36-
let enumsMap: {[index: string]: any} = {
37-
"NegativeBalanceCompensationWarningNotificationRequest.TypeEnum": NegativeBalanceCompensationWarningNotificationRequest.TypeEnum,
38-
}
39-
40-
let typeMap: {[index: string]: any} = {
41-
"Amount": Amount,
42-
"NegativeBalanceCompensationWarningNotificationData": NegativeBalanceCompensationWarningNotificationData,
43-
"NegativeBalanceCompensationWarningNotificationRequest": NegativeBalanceCompensationWarningNotificationRequest,
44-
"Resource": Resource,
45-
"ResourceReference": ResourceReference,
46-
}
47-
48-
export class ObjectSerializer {
49-
public static findCorrectType(data: any, expectedType: string) {
50-
if (data == undefined) {
51-
return expectedType;
52-
} else if (primitives.indexOf(expectedType.toLowerCase()) !== -1) {
53-
return expectedType;
54-
} else if (expectedType === "Date") {
55-
return expectedType;
56-
} else {
57-
if (enumsMap[expectedType]) {
58-
return expectedType;
59-
}
60-
61-
if (!typeMap[expectedType]) {
62-
return expectedType; // w/e we don't know the type
63-
}
64-
65-
// Check the discriminator
66-
let discriminatorProperty = typeMap[expectedType].discriminator;
67-
if (discriminatorProperty == null) {
68-
return expectedType; // the type does not have a discriminator. use it.
69-
} else {
70-
if (data[discriminatorProperty]) {
71-
var discriminatorType = data[discriminatorProperty];
72-
if(typeMap[discriminatorType]){
73-
return discriminatorType; // use the type given in the discriminator
74-
} else {
75-
return expectedType; // discriminator did not map to a type
76-
}
77-
} else {
78-
return expectedType; // discriminator was not present (or an empty string)
79-
}
80-
}
81-
}
82-
}
83-
84-
public static serialize(data: any, type: string) {
85-
if (data == undefined) {
86-
return data;
87-
} else if (primitives.indexOf(type.toLowerCase()) !== -1) {
88-
return data;
89-
} else if (type.lastIndexOf("Array<", 0) === 0) { // string.startsWith pre es6
90-
let subType: string = type.replace("Array<", ""); // Array<Type> => Type>
91-
subType = subType.substring(0, subType.length - 1); // Type> => Type
92-
let transformedData: any[] = [];
93-
for (let index = 0; index < data.length; index++) {
94-
let datum = data[index];
95-
transformedData.push(ObjectSerializer.serialize(datum, subType));
96-
}
97-
return transformedData;
98-
} else if (type === "Date") {
99-
return data.toISOString();
100-
} else if (type === "SaleToAcquirerData") {
101-
const dataString = JSON.stringify(data);
102-
return Buffer.from(dataString).toString("base64");
103-
} else {
104-
if (enumsMap[type]) {
105-
return data;
106-
}
107-
if (!typeMap[type]) { // in case we dont know the type
108-
return data;
109-
}
110-
111-
// Get the actual type of this object
112-
type = this.findCorrectType(data, type);
113-
114-
// get the map for the correct type.
115-
let attributeTypes = typeMap[type].getAttributeTypeMap();
116-
let instance: {[index: string]: any} = {};
117-
for (let index = 0; index < attributeTypes.length; index++) {
118-
let attributeType = attributeTypes[index];
119-
instance[attributeType.baseName] = ObjectSerializer.serialize(data[attributeType.name], attributeType.type);
120-
}
121-
return instance;
122-
}
123-
}
124-
125-
public static deserialize(data: any, type: string) {
126-
// polymorphism may change the actual type.
127-
type = ObjectSerializer.findCorrectType(data, type);
128-
if (data == undefined) {
129-
return data;
130-
} else if (primitives.indexOf(type.toLowerCase()) !== -1) {
131-
return data;
132-
} else if (type.lastIndexOf("Array<", 0) === 0) { // string.startsWith pre es6
133-
let subType: string = type.replace("Array<", ""); // Array<Type> => Type>
134-
subType = subType.substring(0, subType.length - 1); // Type> => Type
135-
let transformedData: any[] = [];
136-
for (let index = 0; index < data.length; index++) {
137-
let datum = data[index];
138-
transformedData.push(ObjectSerializer.deserialize(datum, subType));
139-
}
140-
return transformedData;
141-
} else if (type === "Date") {
142-
return new Date(data);
143-
} else {
144-
if (enumsMap[type]) {// is Enum
145-
return data;
146-
}
147-
148-
if (!typeMap[type]) { // dont know the type
149-
return data;
150-
}
151-
let instance = new typeMap[type]();
152-
let attributeTypes = typeMap[type].getAttributeTypeMap();
153-
for (let index = 0; index < attributeTypes.length; index++) {
154-
let attributeType = attributeTypes[index];
155-
instance[attributeType.name] = ObjectSerializer.deserialize(data[attributeType.baseName], attributeType.type);
156-
}
157-
return instance;
158-
}
159-
}
160-
}
1+
export * from "./amount"
2+
export * from "./negativeBalanceCompensationWarningNotificationData"
3+
export * from "./negativeBalanceCompensationWarningNotificationRequest"
4+
export * from "./resource"
5+
export * from "./resourceReference"
6+
7+
// serializing and deserializing typed objects
8+
export * from "./objectSerializer"

src/typings/negativeBalanceWarningWebhooks/negativeBalanceCompensationWarningNotificationData.ts

Lines changed: 34 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -7,83 +7,97 @@
77
* Do not edit this class manually.
88
*/
99

10-
import { Amount } from './amount';
11-
import { ResourceReference } from './resourceReference';
10+
import { Amount } from "./amount";
11+
import { ResourceReference } from "./resourceReference";
12+
1213

1314
export class NegativeBalanceCompensationWarningNotificationData {
14-
'accountHolder'?: ResourceReference | null;
15-
'amount'?: Amount | null;
15+
"accountHolder"?: ResourceReference;
16+
"amount"?: Amount;
1617
/**
1718
* The unique identifier of the balance platform.
1819
*/
19-
'balancePlatform'?: string;
20+
"balancePlatform"?: string;
2021
/**
2122
* The date and time when the event was triggered, in ISO 8601 extended format. For example, **2020-12-18T10:15:30+01:00**.
2223
*/
23-
'creationDate'?: Date;
24+
"creationDate"?: Date;
2425
/**
2526
* The ID of the resource.
2627
*/
27-
'id'?: string;
28+
"id"?: string;
2829
/**
2930
* The balance account ID of the account that will be used to compensate the balance account whose balance is negative.
3031
*/
31-
'liableBalanceAccountId'?: string;
32+
"liableBalanceAccountId"?: string;
3233
/**
3334
* The date the balance for the account became negative.
3435
*/
35-
'negativeBalanceSince'?: Date;
36+
"negativeBalanceSince"?: Date;
3637
/**
3738
* The date when a compensation transfer to the account is scheduled to happen.
3839
*/
39-
'scheduledCompensationAt'?: Date;
40+
"scheduledCompensationAt"?: Date;
41+
42+
static readonly discriminator: string | undefined = undefined;
4043

41-
static discriminator: string | undefined = undefined;
44+
static readonly mapping: {[index: string]: string} | undefined = undefined;
4245

43-
static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [
46+
static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [
4447
{
4548
"name": "accountHolder",
4649
"baseName": "accountHolder",
47-
"type": "ResourceReference | null"
50+
"type": "ResourceReference",
51+
"format": ""
4852
},
4953
{
5054
"name": "amount",
5155
"baseName": "amount",
52-
"type": "Amount | null"
56+
"type": "Amount",
57+
"format": ""
5358
},
5459
{
5560
"name": "balancePlatform",
5661
"baseName": "balancePlatform",
57-
"type": "string"
62+
"type": "string",
63+
"format": ""
5864
},
5965
{
6066
"name": "creationDate",
6167
"baseName": "creationDate",
62-
"type": "Date"
68+
"type": "Date",
69+
"format": "date-time"
6370
},
6471
{
6572
"name": "id",
6673
"baseName": "id",
67-
"type": "string"
74+
"type": "string",
75+
"format": ""
6876
},
6977
{
7078
"name": "liableBalanceAccountId",
7179
"baseName": "liableBalanceAccountId",
72-
"type": "string"
80+
"type": "string",
81+
"format": ""
7382
},
7483
{
7584
"name": "negativeBalanceSince",
7685
"baseName": "negativeBalanceSince",
77-
"type": "Date"
86+
"type": "Date",
87+
"format": "date-time"
7888
},
7989
{
8090
"name": "scheduledCompensationAt",
8191
"baseName": "scheduledCompensationAt",
82-
"type": "Date"
92+
"type": "Date",
93+
"format": "date-time"
8394
} ];
8495

8596
static getAttributeTypeMap() {
8697
return NegativeBalanceCompensationWarningNotificationData.attributeTypeMap;
8798
}
99+
100+
public constructor() {
101+
}
88102
}
89103

0 commit comments

Comments
 (0)