-
Notifications
You must be signed in to change notification settings - Fork 57
/
paymentInstruments.ts
48 lines (43 loc) · 2.11 KB
/
paymentInstruments.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
import getJsonResponse from "../../helpers/getJsonResponse";
import Service from "../../service";
import { ObjectSerializer, PaymentInstrument, PaymentInstrumentInfo, PaymentInstrumentUpdateRequest, TransactionRulesResponse } from "../../typings/balancePlatform/models";
import BalancePlatformResource from "../resource/balancePlaftformResource";
class PaymentInstruments extends Service {
public async create(request: PaymentInstrumentInfo): Promise<PaymentInstrument> {
const resource = new BalancePlatformResource(this, `/paymentInstruments`);
const response = await getJsonResponse<PaymentInstrumentInfo, PaymentInstrument>(
resource,
request,
{ method: "POST" }
);
return ObjectSerializer.deserialize(response, "PaymentInstrument");
}
public async retrieve(id: string): Promise<PaymentInstrument> {
const resource = new BalancePlatformResource(this, `/paymentInstruments/${id}`);
const response = await getJsonResponse<string, PaymentInstrument>(
resource,
'',
{ method: "GET" }
);
return ObjectSerializer.deserialize(response, "PaymentInstrument");
}
public async update(id: string, request: PaymentInstrumentUpdateRequest): Promise<PaymentInstrument> {
const resource = new BalancePlatformResource(this, `/paymentInstruments/${id}`);
const response = await getJsonResponse<PaymentInstrumentUpdateRequest, PaymentInstrument>(
resource,
request,
{ method: "PATCH" }
);
return ObjectSerializer.deserialize(response, "PaymentInstrument");
}
public async listTransactionRules(id: string): Promise<TransactionRulesResponse> {
const resource = new BalancePlatformResource(this, `/paymentInstruments/${id}/transactionRules`);
const response = await getJsonResponse<string, TransactionRulesResponse>(
resource,
'',
{ method: "GET" }
);
return ObjectSerializer.deserialize(response, "TransactionRulesResponse");
}
}
export default PaymentInstruments;