This repository has been archived by the owner on Aug 28, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Account.ts
50 lines (41 loc) · 1.43 KB
/
Account.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
import { Proxy } from './Proxy';
import { METHODS, BALANCE_TYPES } from '../constants/Request';
import { SubmitParams, AccountActivationCardPayload } from '../types/Request';
import {
AccountActivationCardResponse,
AccountBalanceResponse,
AccountUsernamesResponse,
} from '../types/Response';
export class Account extends Proxy {
public getBalance(): Promise<AccountBalanceResponse> {
const path = `/user_balance`;
const method = METHODS.GET;
return this.submit(<SubmitParams>{ path, method });
}
/* Get available sender names. No params */
public getUserNames(): Promise<AccountUsernamesResponse> {
const path = `/user_names`;
const method = METHODS.GET;
return this.submit(<SubmitParams>{ path, method });
}
/* Get available Viber sender names. No params */
public getViberNames(): Promise<AccountUsernamesResponse> {
const path = `/viber_user_names`;
const method = METHODS.GET;
return this.submit(<SubmitParams>{ path, method });
}
/* Activates prepaid card */
public activatePayCard(params: {
cardNo: string;
balanceType: BALANCE_TYPES;
}): Promise<AccountActivationCardResponse> {
const { cardNo, balanceType } = params;
const path = `/paycard_activate`;
const method = METHODS.GET;
const payload: AccountActivationCardPayload = {
cardno: cardNo,
balance_type: balanceType,
};
return this.submit(<SubmitParams>{ path, method, payload });
}
}