-
Notifications
You must be signed in to change notification settings - Fork 63
/
storedValueApi.ts
148 lines (137 loc) · 7.29 KB
/
storedValueApi.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
/*
* The version of the OpenAPI document: v46
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit this class manually.
*/
import Client from "../client";
import getJsonResponse from "../helpers/getJsonResponse";
import Service from "../service";
import { StoredValueBalanceCheckRequest } from "../typings/storedValue/models";
import { StoredValueBalanceCheckResponse } from "../typings/storedValue/models";
import { StoredValueBalanceMergeRequest } from "../typings/storedValue/models";
import { StoredValueBalanceMergeResponse } from "../typings/storedValue/models";
import { StoredValueIssueRequest } from "../typings/storedValue/models";
import { StoredValueIssueResponse } from "../typings/storedValue/models";
import { StoredValueLoadRequest } from "../typings/storedValue/models";
import { StoredValueLoadResponse } from "../typings/storedValue/models";
import { StoredValueStatusChangeRequest } from "../typings/storedValue/models";
import { StoredValueStatusChangeResponse } from "../typings/storedValue/models";
import { StoredValueVoidRequest } from "../typings/storedValue/models";
import { StoredValueVoidResponse } from "../typings/storedValue/models";
import { IRequest } from "../typings/requestOptions";
import Resource from "./resource";
import { ObjectSerializer } from "../typings/storedValue/models";
export class StoredValueAPI extends Service {
private readonly API_BASEPATH: string = "https://pal-test.adyen.com/pal/servlet/StoredValue/v46";
private baseUrl: string;
public constructor(client: Client) {
super(client);
this.baseUrl = this.createBaseUrl(this.API_BASEPATH);
}
/**
* @summary Changes the status of the payment method.
* @param storedValueStatusChangeRequest {@link StoredValueStatusChangeRequest }
* @param requestOptions {@link IRequest.Options }
* @return {@link StoredValueStatusChangeResponse }
*/
public async changeStatus(storedValueStatusChangeRequest: StoredValueStatusChangeRequest, requestOptions?: IRequest.Options): Promise<StoredValueStatusChangeResponse> {
const endpoint = `${this.baseUrl}/changeStatus`;
const resource = new Resource(this, endpoint);
const request: StoredValueStatusChangeRequest = ObjectSerializer.serialize(storedValueStatusChangeRequest, "StoredValueStatusChangeRequest");
const response = await getJsonResponse<StoredValueStatusChangeRequest, StoredValueStatusChangeResponse>(
resource,
request,
{ ...requestOptions, method: "POST" }
);
return ObjectSerializer.deserialize(response, "StoredValueStatusChangeResponse");
}
/**
* @summary Checks the balance.
* @param storedValueBalanceCheckRequest {@link StoredValueBalanceCheckRequest }
* @param requestOptions {@link IRequest.Options }
* @return {@link StoredValueBalanceCheckResponse }
*/
public async checkBalance(storedValueBalanceCheckRequest: StoredValueBalanceCheckRequest, requestOptions?: IRequest.Options): Promise<StoredValueBalanceCheckResponse> {
const endpoint = `${this.baseUrl}/checkBalance`;
const resource = new Resource(this, endpoint);
const request: StoredValueBalanceCheckRequest = ObjectSerializer.serialize(storedValueBalanceCheckRequest, "StoredValueBalanceCheckRequest");
const response = await getJsonResponse<StoredValueBalanceCheckRequest, StoredValueBalanceCheckResponse>(
resource,
request,
{ ...requestOptions, method: "POST" }
);
return ObjectSerializer.deserialize(response, "StoredValueBalanceCheckResponse");
}
/**
* @summary Issues a new card.
* @param storedValueIssueRequest {@link StoredValueIssueRequest }
* @param requestOptions {@link IRequest.Options }
* @return {@link StoredValueIssueResponse }
*/
public async issue(storedValueIssueRequest: StoredValueIssueRequest, requestOptions?: IRequest.Options): Promise<StoredValueIssueResponse> {
const endpoint = `${this.baseUrl}/issue`;
const resource = new Resource(this, endpoint);
const request: StoredValueIssueRequest = ObjectSerializer.serialize(storedValueIssueRequest, "StoredValueIssueRequest");
const response = await getJsonResponse<StoredValueIssueRequest, StoredValueIssueResponse>(
resource,
request,
{ ...requestOptions, method: "POST" }
);
return ObjectSerializer.deserialize(response, "StoredValueIssueResponse");
}
/**
* @summary Loads the payment method.
* @param storedValueLoadRequest {@link StoredValueLoadRequest }
* @param requestOptions {@link IRequest.Options }
* @return {@link StoredValueLoadResponse }
*/
public async load(storedValueLoadRequest: StoredValueLoadRequest, requestOptions?: IRequest.Options): Promise<StoredValueLoadResponse> {
const endpoint = `${this.baseUrl}/load`;
const resource = new Resource(this, endpoint);
const request: StoredValueLoadRequest = ObjectSerializer.serialize(storedValueLoadRequest, "StoredValueLoadRequest");
const response = await getJsonResponse<StoredValueLoadRequest, StoredValueLoadResponse>(
resource,
request,
{ ...requestOptions, method: "POST" }
);
return ObjectSerializer.deserialize(response, "StoredValueLoadResponse");
}
/**
* @summary Merge the balance of two cards.
* @param storedValueBalanceMergeRequest {@link StoredValueBalanceMergeRequest }
* @param requestOptions {@link IRequest.Options }
* @return {@link StoredValueBalanceMergeResponse }
*/
public async mergeBalance(storedValueBalanceMergeRequest: StoredValueBalanceMergeRequest, requestOptions?: IRequest.Options): Promise<StoredValueBalanceMergeResponse> {
const endpoint = `${this.baseUrl}/mergeBalance`;
const resource = new Resource(this, endpoint);
const request: StoredValueBalanceMergeRequest = ObjectSerializer.serialize(storedValueBalanceMergeRequest, "StoredValueBalanceMergeRequest");
const response = await getJsonResponse<StoredValueBalanceMergeRequest, StoredValueBalanceMergeResponse>(
resource,
request,
{ ...requestOptions, method: "POST" }
);
return ObjectSerializer.deserialize(response, "StoredValueBalanceMergeResponse");
}
/**
* @summary Voids a transaction.
* @param storedValueVoidRequest {@link StoredValueVoidRequest }
* @param requestOptions {@link IRequest.Options }
* @return {@link StoredValueVoidResponse }
*/
public async voidTransaction(storedValueVoidRequest: StoredValueVoidRequest, requestOptions?: IRequest.Options): Promise<StoredValueVoidResponse> {
const endpoint = `${this.baseUrl}/voidTransaction`;
const resource = new Resource(this, endpoint);
const request: StoredValueVoidRequest = ObjectSerializer.serialize(storedValueVoidRequest, "StoredValueVoidRequest");
const response = await getJsonResponse<StoredValueVoidRequest, StoredValueVoidResponse>(
resource,
request,
{ ...requestOptions, method: "POST" }
);
return ObjectSerializer.deserialize(response, "StoredValueVoidResponse");
}
}
export default StoredValueAPI;