forked from yosle/tropipayjs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.d.ts
113 lines (109 loc) · 3.65 KB
/
index.d.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
import { Axios } from 'axios';
interface PaymentLinkPayload {
reference: string;
concept: string;
favorite: boolean;
amount: number;
currency: string;
description: string;
singleUse: boolean;
reasonId: number;
expirationDays: number;
lang: string;
urlSuccess: string;
urlFailed: string;
urlNotification: string;
serviceDate: string;
client: {
name: string;
lastName: string;
address: string;
phone: string;
email: string;
countryId: number;
termsAndConditions: boolean;
};
directPayment: boolean;
paymentMethods?: string[];
}
interface PaymentLink extends PaymentLinkPayload {
expirationDate: string;
hasClient: boolean;
updatedAt: string;
createdAt: string;
qrImage: string;
shortUrl: string;
paymentUrl: string;
}
/**
* Tropipayjs is a Typescript/Javascript library for the Tropipay API.
*
* @author Yosleivy Baez Acosta
*
*/
declare type ServerMode = 'Development' | 'Production';
declare class Tropipay {
readonly clientId: string;
readonly clientSecret: string;
protected request: Axios;
protected accessToken: string | undefined;
protected refreshToken: string | undefined;
protected serverMode: ServerMode;
constructor(client_id: string, client_secret: string, server_mode?: ServerMode);
login(): Promise<LoginResponse>;
/**
* Create a paymentLink with the specified options.
* @param payload PaymentLinkPayload Object.
* @returns Promise<PaymentLink> or throws an Exception.
* @see https://tpp.stoplight.io/docs/tropipay-api-doc/b3A6ODgyNTM3OQ-create-a-new-pay-link-charge
*/
createPayLink(payload: PaymentLinkPayload): Promise<PaymentLink>;
/**
* Get all deposits in this account.
* @returns A Promise of an Array of AccountDeposits or throws an Exception
* @see https://tpp.stoplight.io/docs/tropipay-api-doc/b3A6OTgyOTQ1Mg-get-deposit-accounts-list
*/
getDepositAccounts(): Promise<AccountDeposits[] | Error>;
/**
* Get the list of all supported countries by Tropipay.
* @returns Array of Countries Data
* @see https://tpp.stoplight.io/docs/tropipay-api-doc/bfac21259e2ff-getting-users-countries-list
*/
countries(): Promise<Country[]>;
/**
* Get the list of all detination countries supported by Tropipay.
* Obtaining the list of valid countries to send funds to. Useful
* when adding new beneficiaries to some user.
*
* @returns Array of Country Objects
* @see https://tpp.stoplight.io/docs/tropipay-api-doc/3cfe5504f0524-getting-list-of-beneficiary-countries
*/
destinations(): Promise<Country[]>;
/**
* Get list of all the favorites accounts. This endpoint is not documented
* in the official Tropipay documentation.
* @returns
*/
favorites(): Promise<any>;
/**
* List all account movements. You can optionaly specify
* offset and limit params for pagination.
* @returns
*/
movements(offset?: number, limit?: number): Promise<any>;
/**
* Return profile data for this account.
* @returns
*/
profile(): Promise<any>;
/**
* Obtain current Tropipay conversion rate. For example USD to EUR
* targetCurrency must be 'EUR'
* @param originCurrency Target currency code supported by Tropipay.
* @param targetCurrency Must be 'EUR'? (not documented by Tropipay)
* @returns Conversion rate (number)
* @see https://tpp.stoplight.io/docs/tropipay-api-doc/85163f6f28b23-get-rate
*/
rates(originCurrency: string, targetCurrency?: string): Promise<number | Error>;
}
export { Tropipay };