-
Notifications
You must be signed in to change notification settings - Fork 11
/
index.d.ts
100 lines (99 loc) · 1.9 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
export interface IFlowApiConfig {
apiKey: string;
secretKey: string;
apiURL: string;
baseURL?: string;
}
export enum PaymentMethod {
WEBPAY = 1,
SERVIPAG = 2,
MULTICAJA = 3,
ONEPAY = 4,
CRYPOMONEDA = 5,
TODOS_LOS_MEDIOS = 9,
}
export enum FlowStatus {
PENDING_PAYMENT = 1,
PAID = 2,
REJECTED = 3,
CANCELED = 4,
}
export interface IFlowGetStatus {
token: string;
}
export interface IFlowSendParams {
commerceOrder: string;
subject: string;
currency: string;
amount: number;
email: string;
paymentMethod: PaymentMethod;
urlConfirmation: string;
urlReturn: string;
}
export interface IFlowPaymentStatus {
flowOrder: number;
commerceOrder: string;
requestDate: string;
status: FlowStatus;
subject: string;
currency: string;
amount: number;
payer: string;
optional: {
[key: string]: string;
};
pending_info: {
media: string;
date: string;
};
paymentData: {
date: string;
media: string;
conversionDate: string;
conversionRate: number;
amount: number;
currency: string;
fee: number;
balance: number;
transferDate: string;
};
}
export interface IFlowPaymentCreate {
url: string;
token: string;
flowOrder: number;
}
type HTTPMethod = "GET" | "POST";
export interface IFlowApi {
new (n: IFlowApiConfig): IFlowApi;
send(
service: string,
params: IFlowSendParams | IFlowGetStatus,
method: HTTPMethod
): Promise<IFlowPaymentStatus | IFlowPaymentCreate>;
getPack(params: IFlowSendParams, method: HTTPMethod): string;
sign(params: IFlowSendParams): string;
httpGet(
url: string,
data: string,
sign: string
): Promise<{
output: any;
info: {
http_code: number;
};
}>;
httpPost(
url: string,
data: string,
sign: string
): Promise<{
output: any;
info: {
http_code: number;
};
}>;
}
declare const FlowApi: IFlowApi;
export default FlowApi;