forked from AbacatePay/abacatepay-nodejs-sdk
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtypes.d.ts
76 lines (67 loc) · 1.52 KB
/
types.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
export type BillingStatus = 'PENDING' | 'EXPIRED' | 'CANCELLED' | 'PAID' | 'REFUNDED';
export type BillingMethods = 'PIX';
export type BillingKind = 'ONE_TIME';
export type IBilling = {
id: string;
url: string;
amount: number;
status: BillingStatus;
devMode: boolean;
methods: BillingMethods[];
products: { productId: string; quantity: number }[];
frequency: BillingKind;
nextBilling: string | null;
customer?: {
id: string;
metadata: ICustomerMetadata;
};
accountId: string;
storeId: string;
createdAt: string;
updatedAt: string;
};
export type IBillingMetadata = {
fee: number;
returnUrl?: string;
completionUrl?: string;
};
export type ICustomerMetadata = {
name?: string;
cellphone?: string;
email: string;
taxId?: string;
};
export type CreateBillingData = {
frequency: BillingKind;
methods: BillingMethods[];
products: {
externalId: string;
name: string;
quantity: number;
price: number;
description?: string;
}[];
returnUrl: string;
completionUrl: string;
customerId?: string;
};
export type CreateBillingResponse = {
error: string
} | {
error: null
billing: IBilling
};
export type ListBillingResponse = {
error: string
} | {
error: null
billings: IBilling[]
};
export interface IAbacatePayBilling {
create(data: CreateBillingData): Promise<CreateBillingResponse>;
list(): Promise<ListBillingResponse>;
}
export interface IAbacatePay {
billing: IAbacatePayBilling;
}
export default function AbacatePay(apiKey: string): IAbacatePay;