-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.d.ts
97 lines (82 loc) · 2.89 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
// Payment Interfaces
export interface IPaymentResult {
payment_url : string
}
export type IPaymentError =
| 'INVALID_API_CALL'
| 'INVALID_API_KEY'
| 'NOT_AUTHORIZED'
| 'INVALID_AMOUNT'
| 'LESS_THAN_WAGE_AMOUNT'
| 'TOO_LESS_AMOUNT'
| 'TOO_MUCH_AMOUNT'
| 'INVALID_REFERENCE'
| 'INVALID_TRUSTED_PAN'
| 'INVALID_CALLBACK'
| 'INVALID_PARAM'
| 'ALREADY_PAID'
| 'MISMATCHED_DATA'
| 'NO_REG_TERMINAL'
| 'NO_AVAILABLE_GATEWAY'
| 'SERVICE_ERROR'
| 'NETWORK_ERROR';
export interface IPaymentSuccesResponse {
ok : boolean,
result : IWebpayResult,
}
export interface IPaymentErrorResponse {
ok : boolean,
error : IPaymentError
}
export type IPaymentResponse = IPaymentSuccesResponse | IPaymentErrorResponse;
/**
* @param {string} api_key - The bahamta api-key: 'webpay:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx:zzzzzzzz-zzzz-zzzz-zzzz-zzzzzzzzzzzz'
* @param {string} reference - The order number (should be unique): 'order#1004'
* @param {number} amount_irr - The amount of money in Rials: 100000
* @param {string} callback_url - Call back url for bahamta recall (should start with http or https) : 'https://mydomain.ir/checkout/order#1004'
* @param {string} payer_mobile - The payer mobile number: '98912*******'
* @param {string} trusted_pan - The trusted credit cards number list: '6219234531241234,623254******5645,5453612376879876'
* @returns {Promise} - Promise object represents server response success=({ok: true, result}), failure = ({ok: false, error})
*/
export function payment(api_key: string, reference: string, amount_irr: number, callback_url: string, payer_mobile?: string, trusted_pan?: string): Promise<IPaymentResponse>;
// Verify InterFaces
export type IVerifyError =
| 'INVALID_API_CALL'
| 'INVALID_API_KEY'
| 'NOT_AUTHORIZED'
| 'INVALID_AMOUNT'
| 'INVALID_REFERENCE'
| 'INVALID_PARAM'
| 'UNKNOWN_BILL'
| 'MISMATCHED_DATA'
| 'NOT_CONFIRMED'
| 'SERVICE_ERROR'
| 'NETWORK_ERROR';
export interface IVerifyResult {
state : string,
total : number,
wage : number,
gateway : string,
terminal : string,
pay_ref : string,
pay_trace : string,
pay_pan : string,
pay_cid : string,
pay_time : Date
}
export interface IVerifySuccesResponse {
ok : boolean,
result : IVerifyResult,
}
export interface IVerifyErrorResponse {
ok : boolean,
error : IVerifyError
}
export type IVerifyResponse = IVerifySuccesResponse | IVerifyErrorResponse;
/**
* @param {string} api_key - The bahamta api-key: 'webpay:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx:zzzzzzzz-zzzz-zzzz-zzzz-zzzzzzzzzzzz'
* @param {string} reference - The order number (should be unique): 'order#1004'
* @param {number} amount_irr - The amount of money in Rials: 100000
* @returns {Promise} - Promise object represents server response success=({ok: true, result}), failure = ({ok: false, error})
*/
export function verify(api_key: string, reference: string, amount_irr: number): Promise<IVerifyResponse>;