Skip to content

Commit 1eebd65

Browse files
committed
Generate BalanceControl API
1 parent 60dab31 commit 1eebd65

File tree

9 files changed

+522
-200
lines changed

9 files changed

+522
-200
lines changed
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
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+
import getJsonResponse from "../../helpers/getJsonResponse";
12+
import Service from "../../service";
13+
import Client from "../../client";
14+
import { IRequest } from "../../typings/requestOptions";
15+
import Resource from "../resource";
16+
17+
import { ObjectSerializer } from "../../typings/balanceControl/objectSerializer";
18+
import { BalanceTransferRequest } from "../../typings/balanceControl/models";
19+
import { BalanceTransferResponse } from "../../typings/balanceControl/models";
20+
21+
/**
22+
* API handler for BalanceControlApi
23+
*/
24+
export class BalanceControlApi extends Service {
25+
26+
private readonly API_BASEPATH: string = "https://pal-test.adyen.com/pal/servlet/BalanceControl/v1";
27+
private baseUrl: string;
28+
29+
public constructor(client: Client){
30+
super(client);
31+
this.baseUrl = this.createBaseUrl(this.API_BASEPATH);
32+
}
33+
34+
/**
35+
* @summary Start a balance transfer
36+
* @param balanceTransferRequest {@link BalanceTransferRequest }
37+
* @param requestOptions {@link IRequest.Options }
38+
* @return {@link BalanceTransferResponse }
39+
*
40+
* @deprecated since Adyen Balance Control API v1
41+
*/
42+
public async balanceTransfer(balanceTransferRequest: BalanceTransferRequest, requestOptions?: IRequest.Options): Promise<BalanceTransferResponse> {
43+
const endpoint = `${this.baseUrl}/balanceTransfer`;
44+
const resource = new Resource(this, endpoint);
45+
46+
const request: BalanceTransferRequest = ObjectSerializer.serialize(balanceTransferRequest, "BalanceTransferRequest", "");
47+
const response = await getJsonResponse<BalanceTransferRequest, BalanceTransferResponse>(
48+
resource,
49+
request,
50+
{ ...requestOptions, method: "POST" }
51+
);
52+
53+
return ObjectSerializer.deserialize(response, "BalanceTransferResponse", "");
54+
}
55+
56+
}

src/services/balanceControl/index.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
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 { BalanceControlApi } from "./balanceControlApi";
11+
12+
import Service from "../../service";
13+
import Client from "../../client";
14+
15+
export default class BalanceControlAPI extends Service {
16+
17+
public constructor(client: Client) {
18+
super(client);
19+
}
20+
21+
public get BalanceControlApi() {
22+
return new BalanceControlApi(this.client);
23+
}
24+
}

src/services/balanceControlApi.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ import { IRequest } from "../typings/requestOptions";
1616
import Resource from "./resource";
1717
import { ObjectSerializer } from "../typings/balanceControl/models";
1818

19+
/**
20+
* The service has been moved to a different package 'balanceControl'
21+
* @deprecated Use services/balanceControl/balanceControlAPI
22+
*/
1923
export class BalanceControlAPI extends Service {
2024

2125
private readonly API_BASEPATH: string = "https://pal-test.adyen.com/pal/servlet/BalanceControl/v1";
@@ -27,6 +31,8 @@ export class BalanceControlAPI extends Service {
2731
}
2832

2933
/**
34+
* @deprecated Use services/balanceControl/BalanceControlAPI
35+
*
3036
* @summary Start a balance transfer
3137
* @param balanceTransferRequest {@link BalanceTransferRequest }
3238
* @param requestOptions {@link IRequest.Options }
@@ -35,13 +41,13 @@ export class BalanceControlAPI extends Service {
3541
public async balanceTransfer(balanceTransferRequest: BalanceTransferRequest, requestOptions?: IRequest.Options): Promise<BalanceTransferResponse> {
3642
const endpoint = `${this.baseUrl}/balanceTransfer`;
3743
const resource = new Resource(this, endpoint);
38-
const request: BalanceTransferRequest = ObjectSerializer.serialize(balanceTransferRequest, "BalanceTransferRequest");
44+
const request: BalanceTransferRequest = ObjectSerializer.serialize(balanceTransferRequest, "BalanceTransferRequest", "");
3945
const response = await getJsonResponse<BalanceTransferRequest, BalanceTransferResponse>(
4046
resource,
4147
request,
4248
{ ...requestOptions, method: "POST" }
4349
);
44-
return ObjectSerializer.deserialize(response, "BalanceTransferResponse");
50+
return ObjectSerializer.deserialize(response, "BalanceTransferResponse", "");
4551
}
4652
}
4753

src/services/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// barrel file to (re)export default exports from individual services
22
// this file is not autogenerated (add/remove services manually)
33

4-
export { default as BalanceControlAPI } from "./balanceControlApi";
4+
export { default as BalanceControlAPI } from "./balanceControl";
55
export { default as BalancePlatformAPI } from "./balancePlatform";
66
export { default as BinLookupAPI } from "./binLookup";
77
export { default as CheckoutAPI } from "./checkout";

src/typings/balanceControl/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/balanceControl/balanceTransferRequest.ts

Lines changed: 27 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,68 +7,80 @@
77
* Do not edit this class manually.
88
*/
99

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

1213
export class BalanceTransferRequest {
13-
'amount': Amount;
14+
"amount": Amount;
1415
/**
1516
* A human-readable description for the transfer. You can use alphanumeric characters and hyphens. We recommend sending a maximum of 140 characters, otherwise the description may be truncated.
1617
*/
17-
'description'?: string;
18+
"description"?: string;
1819
/**
1920
* The unique identifier of the source merchant account from which funds are deducted.
2021
*/
21-
'fromMerchant': string;
22+
"fromMerchant": string;
2223
/**
2324
* A reference for the balance transfer. If you don\'t provide this in the request, Adyen generates a unique reference. Maximum length: 80 characters.
2425
*/
25-
'reference'?: string;
26+
"reference"?: string;
2627
/**
2728
* The unique identifier of the destination merchant account from which funds are transferred.
2829
*/
29-
'toMerchant': string;
30+
"toMerchant": string;
3031
/**
3132
* The type of balance transfer. Possible values: **tax**, **fee**, **terminalSale**, **credit**, **debit**, and **adjustment**.
3233
*/
33-
'type': BalanceTransferRequest.TypeEnum;
34+
"type": BalanceTransferRequest.TypeEnum;
35+
36+
static readonly discriminator: string | undefined = undefined;
3437

35-
static discriminator: string | undefined = undefined;
38+
static readonly mapping: {[index: string]: string} | undefined = undefined;
3639

37-
static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [
40+
static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [
3841
{
3942
"name": "amount",
4043
"baseName": "amount",
41-
"type": "Amount"
44+
"type": "Amount",
45+
"format": ""
4246
},
4347
{
4448
"name": "description",
4549
"baseName": "description",
46-
"type": "string"
50+
"type": "string",
51+
"format": ""
4752
},
4853
{
4954
"name": "fromMerchant",
5055
"baseName": "fromMerchant",
51-
"type": "string"
56+
"type": "string",
57+
"format": ""
5258
},
5359
{
5460
"name": "reference",
5561
"baseName": "reference",
56-
"type": "string"
62+
"type": "string",
63+
"format": ""
5764
},
5865
{
5966
"name": "toMerchant",
6067
"baseName": "toMerchant",
61-
"type": "string"
68+
"type": "string",
69+
"format": ""
6270
},
6371
{
6472
"name": "type",
6573
"baseName": "type",
66-
"type": "BalanceTransferRequest.TypeEnum"
74+
"type": "BalanceTransferRequest.TypeEnum",
75+
"format": ""
6776
} ];
6877

6978
static getAttributeTypeMap() {
7079
return BalanceTransferRequest.attributeTypeMap;
7180
}
81+
82+
public constructor() {
83+
}
7284
}
7385

7486
export namespace BalanceTransferRequest {

src/typings/balanceControl/balanceTransferResponse.ts

Lines changed: 36 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -7,95 +7,110 @@
77
* Do not edit this class manually.
88
*/
99

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

1213
export class BalanceTransferResponse {
13-
'amount': Amount;
14+
"amount": Amount;
1415
/**
1516
* The date when the balance transfer was requested.
1617
*/
17-
'createdAt': Date;
18+
"createdAt": Date;
1819
/**
1920
* A human-readable description for the transfer. You can use alphanumeric characters and hyphens. We recommend sending a maximum of 140 characters, otherwise the description may be truncated.
2021
*/
21-
'description'?: string;
22+
"description"?: string;
2223
/**
2324
* The unique identifier of the source merchant account from which funds are deducted.
2425
*/
25-
'fromMerchant': string;
26+
"fromMerchant": string;
2627
/**
2728
* Adyen\'s 16-character string reference associated with the balance transfer.
2829
*/
29-
'pspReference': string;
30+
"pspReference": string;
3031
/**
3132
* A reference for the balance transfer. If you don\'t provide this in the request, Adyen generates a unique reference. Maximum length: 80 characters.
3233
*/
33-
'reference'?: string;
34+
"reference"?: string;
3435
/**
3536
* The status of the balance transfer. Possible values: **transferred**, **failed**, **error**, and **notEnoughBalance**.
3637
*/
37-
'status': BalanceTransferResponse.StatusEnum;
38+
"status": BalanceTransferResponse.StatusEnum;
3839
/**
3940
* The unique identifier of the destination merchant account from which funds are transferred.
4041
*/
41-
'toMerchant': string;
42+
"toMerchant": string;
4243
/**
4344
* The type of balance transfer. Possible values: **tax**, **fee**, **terminalSale**, **credit**, **debit**, and **adjustment**.
4445
*/
45-
'type': BalanceTransferResponse.TypeEnum;
46+
"type": BalanceTransferResponse.TypeEnum;
47+
48+
static readonly discriminator: string | undefined = undefined;
4649

47-
static discriminator: string | undefined = undefined;
50+
static readonly mapping: {[index: string]: string} | undefined = undefined;
4851

49-
static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [
52+
static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [
5053
{
5154
"name": "amount",
5255
"baseName": "amount",
53-
"type": "Amount"
56+
"type": "Amount",
57+
"format": ""
5458
},
5559
{
5660
"name": "createdAt",
5761
"baseName": "createdAt",
58-
"type": "Date"
62+
"type": "Date",
63+
"format": "date-time"
5964
},
6065
{
6166
"name": "description",
6267
"baseName": "description",
63-
"type": "string"
68+
"type": "string",
69+
"format": ""
6470
},
6571
{
6672
"name": "fromMerchant",
6773
"baseName": "fromMerchant",
68-
"type": "string"
74+
"type": "string",
75+
"format": ""
6976
},
7077
{
7178
"name": "pspReference",
7279
"baseName": "pspReference",
73-
"type": "string"
80+
"type": "string",
81+
"format": ""
7482
},
7583
{
7684
"name": "reference",
7785
"baseName": "reference",
78-
"type": "string"
86+
"type": "string",
87+
"format": ""
7988
},
8089
{
8190
"name": "status",
8291
"baseName": "status",
83-
"type": "BalanceTransferResponse.StatusEnum"
92+
"type": "BalanceTransferResponse.StatusEnum",
93+
"format": ""
8494
},
8595
{
8696
"name": "toMerchant",
8797
"baseName": "toMerchant",
88-
"type": "string"
98+
"type": "string",
99+
"format": ""
89100
},
90101
{
91102
"name": "type",
92103
"baseName": "type",
93-
"type": "BalanceTransferResponse.TypeEnum"
104+
"type": "BalanceTransferResponse.TypeEnum",
105+
"format": ""
94106
} ];
95107

96108
static getAttributeTypeMap() {
97109
return BalanceTransferResponse.attributeTypeMap;
98110
}
111+
112+
public constructor() {
113+
}
99114
}
100115

101116
export namespace BalanceTransferResponse {

0 commit comments

Comments
 (0)