@rikology/adonisjs-xendit 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +29 -0
- package/LICENSE.md +9 -0
- package/README.md +537 -0
- package/build/configure.d.ts +6 -0
- package/build/configure.js +45 -0
- package/build/index.d.ts +16 -0
- package/build/index.js +70 -0
- package/build/providers/xendit_provider.d.ts +12 -0
- package/build/providers/xendit_provider.js +19 -0
- package/build/src/clients/balance_client.d.ts +8 -0
- package/build/src/clients/credit_card_client.d.ts +10 -0
- package/build/src/clients/direct_debit_client.d.ts +10 -0
- package/build/src/clients/disbursement_client.d.ts +10 -0
- package/build/src/clients/ewallet_client.d.ts +11 -0
- package/build/src/clients/invoice_client.d.ts +12 -0
- package/build/src/clients/qris_client.d.ts +9 -0
- package/build/src/clients/retail_outlet_client.d.ts +9 -0
- package/build/src/clients/va_client.d.ts +10 -0
- package/build/src/define_config.d.ts +21 -0
- package/build/src/http_client.d.ts +15 -0
- package/build/src/types.d.ts +609 -0
- package/build/src/types.js +1 -0
- package/build/src/webhook.d.ts +5 -0
- package/build/src/xendit_exception.d.ts +37 -0
- package/build/src/xendit_exception.js +2 -0
- package/build/src/xendit_manager.d.ts +23 -0
- package/build/stubs/config/xendit.stub +12 -0
- package/build/stubs/main.d.ts +5 -0
- package/build/xendit_exception-kaFnYOo7.js +81 -0
- package/build/xendit_manager-DOa0yE8A.js +332 -0
- package/package.json +188 -0
|
@@ -0,0 +1,609 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configuration for the Xendit payment provider
|
|
3
|
+
*/
|
|
4
|
+
export type XenditConfig = {
|
|
5
|
+
secretKey: string;
|
|
6
|
+
environment: 'sandbox' | 'production';
|
|
7
|
+
callbackToken?: string;
|
|
8
|
+
timeoutMs?: number;
|
|
9
|
+
};
|
|
10
|
+
export interface XenditMetadata {
|
|
11
|
+
[key: string]: string | number | boolean | null | undefined;
|
|
12
|
+
}
|
|
13
|
+
export type XenditCurrency = 'IDR' | 'PHP' | 'USD' | 'VND' | 'THB' | 'MYR' | 'SGD' | 'EUR' | 'GBP' | 'HKD' | 'AUD';
|
|
14
|
+
export type XenditCountry = 'ID' | 'PH' | 'VN' | 'TH' | 'MY';
|
|
15
|
+
export type InvoiceStatus = 'PENDING' | 'PAID' | 'SETTLED' | 'EXPIRED';
|
|
16
|
+
export type PaymentChannelCategory = 'BANK_TRANSFER' | 'EWALLET' | 'QR_CODE' | 'RETAIL_OUTLET' | 'DIRECT_DEBIT' | 'CREDIT_CARD' | 'PAYLATER';
|
|
17
|
+
export interface CreateInvoiceRequest {
|
|
18
|
+
external_id: string;
|
|
19
|
+
amount: number;
|
|
20
|
+
payer_email?: string;
|
|
21
|
+
description?: string;
|
|
22
|
+
invoice_duration?: number;
|
|
23
|
+
should_send_email?: boolean;
|
|
24
|
+
customer?: CustomerObject;
|
|
25
|
+
customer_notification_preference?: NotificationPreference;
|
|
26
|
+
success_redirect_url?: string;
|
|
27
|
+
failure_redirect_url?: string;
|
|
28
|
+
currency?: XenditCurrency;
|
|
29
|
+
items?: InvoiceItem[];
|
|
30
|
+
fixed_va?: boolean;
|
|
31
|
+
locale?: string;
|
|
32
|
+
reminder_date?: string;
|
|
33
|
+
metadata?: XenditMetadata;
|
|
34
|
+
}
|
|
35
|
+
export interface ListInvoicesParams {
|
|
36
|
+
external_id?: string;
|
|
37
|
+
status?: InvoiceStatus;
|
|
38
|
+
limit?: number;
|
|
39
|
+
created_after?: string;
|
|
40
|
+
created_before?: string;
|
|
41
|
+
paid_after?: string;
|
|
42
|
+
paid_before?: string;
|
|
43
|
+
last_invoice_date?: string;
|
|
44
|
+
}
|
|
45
|
+
export interface Invoice {
|
|
46
|
+
id: string;
|
|
47
|
+
external_id: string;
|
|
48
|
+
user_id: string;
|
|
49
|
+
status: InvoiceStatus;
|
|
50
|
+
merchant_name: string;
|
|
51
|
+
merchant_profile_picture_url: string;
|
|
52
|
+
amount: number;
|
|
53
|
+
payer_email?: string;
|
|
54
|
+
description?: string;
|
|
55
|
+
invoice_url: string;
|
|
56
|
+
expiry_date: string;
|
|
57
|
+
available_banks: Bank[];
|
|
58
|
+
available_retail_outlets: RetailOutletInfo[];
|
|
59
|
+
available_ewallets: EwalletInfo[];
|
|
60
|
+
available_qr_codes: QrCodeInfo[];
|
|
61
|
+
available_direct_debits: DirectDebitInfo[];
|
|
62
|
+
available_paylaters: PaylaterInfo[];
|
|
63
|
+
should_exclude_credit_card?: boolean;
|
|
64
|
+
should_send_email: boolean;
|
|
65
|
+
created: string;
|
|
66
|
+
updated: string;
|
|
67
|
+
success_redirect_url?: string;
|
|
68
|
+
failure_redirect_url?: string;
|
|
69
|
+
should_authenticate_credit_card?: boolean;
|
|
70
|
+
currency: XenditCurrency;
|
|
71
|
+
items?: InvoiceItem[];
|
|
72
|
+
fixed_va?: boolean;
|
|
73
|
+
reminder_date?: string;
|
|
74
|
+
customer?: CustomerObject;
|
|
75
|
+
customer_notification_preference?: NotificationPreference;
|
|
76
|
+
metadata?: XenditMetadata;
|
|
77
|
+
paid_at?: string;
|
|
78
|
+
paid_amount?: number;
|
|
79
|
+
adjusted_received_amount?: number;
|
|
80
|
+
payment_method?: string;
|
|
81
|
+
payment_channel?: string;
|
|
82
|
+
payment_destination?: string;
|
|
83
|
+
}
|
|
84
|
+
export interface InvoiceItem {
|
|
85
|
+
name: string;
|
|
86
|
+
quantity: number;
|
|
87
|
+
price: number;
|
|
88
|
+
category?: string;
|
|
89
|
+
url?: string;
|
|
90
|
+
}
|
|
91
|
+
export interface CustomerObject {
|
|
92
|
+
id?: string;
|
|
93
|
+
given_names?: string;
|
|
94
|
+
surname?: string;
|
|
95
|
+
email?: string;
|
|
96
|
+
mobile_number?: string;
|
|
97
|
+
address?: CustomerAddress;
|
|
98
|
+
}
|
|
99
|
+
export interface CustomerAddress {
|
|
100
|
+
country: string;
|
|
101
|
+
street_line_1?: string;
|
|
102
|
+
street_line_2?: string;
|
|
103
|
+
city?: string;
|
|
104
|
+
province?: string;
|
|
105
|
+
state?: string;
|
|
106
|
+
postal_code?: string;
|
|
107
|
+
}
|
|
108
|
+
export interface NotificationPreference {
|
|
109
|
+
invoice_created?: ('SMS' | 'EMAIL' | 'WA')[];
|
|
110
|
+
invoice_reminder?: ('SMS' | 'EMAIL' | 'WA')[];
|
|
111
|
+
invoice_paid?: ('SMS' | 'EMAIL' | 'WA')[];
|
|
112
|
+
}
|
|
113
|
+
export interface Bank {
|
|
114
|
+
bank_code: string;
|
|
115
|
+
collection_type: string;
|
|
116
|
+
bank_branch?: string;
|
|
117
|
+
bank_account_number?: string;
|
|
118
|
+
account_holder_name: string;
|
|
119
|
+
transfer_amount?: number;
|
|
120
|
+
}
|
|
121
|
+
export interface RetailOutletInfo {
|
|
122
|
+
retail_outlet_name: string;
|
|
123
|
+
transfer_amount: number;
|
|
124
|
+
}
|
|
125
|
+
export interface EwalletInfo {
|
|
126
|
+
ewallet_type: string;
|
|
127
|
+
}
|
|
128
|
+
export interface QrCodeInfo {
|
|
129
|
+
qr_code_type: string;
|
|
130
|
+
}
|
|
131
|
+
export interface DirectDebitInfo {
|
|
132
|
+
direct_debit_type: string;
|
|
133
|
+
}
|
|
134
|
+
export interface PaylaterInfo {
|
|
135
|
+
paylater_type: string;
|
|
136
|
+
}
|
|
137
|
+
export type VirtualAccountChannelCode = 'BNI' | 'BRI' | 'MANDIRI' | 'BCA' | 'PERMATA' | 'CIMB' | 'BSI' | 'SAHABAT_SAMPOERNA' | 'BANK_TRANSFER' | 'BANK_JAGO' | 'BANK_JTRUST' | 'BANK_MAYBANK' | 'BANK_NEO' | 'BANK_OCBC' | 'BANK_SINARMAS' | 'BANK_UOB';
|
|
138
|
+
export type VirtualAccountStatus = 'ACTIVE' | 'INACTIVE' | 'EXPIRED';
|
|
139
|
+
export interface CreateVirtualAccountRequest {
|
|
140
|
+
external_id: string;
|
|
141
|
+
bank_code: VirtualAccountChannelCode;
|
|
142
|
+
name: string;
|
|
143
|
+
is_single_use?: boolean;
|
|
144
|
+
is_closed?: boolean;
|
|
145
|
+
expected_amount?: number;
|
|
146
|
+
expiration_date?: string;
|
|
147
|
+
suggested_amount?: number;
|
|
148
|
+
description?: string;
|
|
149
|
+
metadata?: XenditMetadata;
|
|
150
|
+
currency?: XenditCurrency;
|
|
151
|
+
alternative_display_types?: string[];
|
|
152
|
+
}
|
|
153
|
+
export interface VirtualAccount {
|
|
154
|
+
id: string;
|
|
155
|
+
external_id: string;
|
|
156
|
+
user_id: string;
|
|
157
|
+
bank_code: VirtualAccountChannelCode;
|
|
158
|
+
account_number: string;
|
|
159
|
+
name: string;
|
|
160
|
+
is_single_use: boolean;
|
|
161
|
+
is_closed: boolean;
|
|
162
|
+
expiration_date?: string;
|
|
163
|
+
expected_amount?: number;
|
|
164
|
+
suggested_amount?: number;
|
|
165
|
+
description?: string;
|
|
166
|
+
status: VirtualAccountStatus;
|
|
167
|
+
currency: XenditCurrency;
|
|
168
|
+
metadata?: XenditMetadata;
|
|
169
|
+
alternative_display_types?: string[];
|
|
170
|
+
}
|
|
171
|
+
export interface UpdateVirtualAccountRequest {
|
|
172
|
+
name?: string;
|
|
173
|
+
suggested_amount?: number;
|
|
174
|
+
expected_amount?: number;
|
|
175
|
+
expiration_date?: string;
|
|
176
|
+
description?: string;
|
|
177
|
+
is_single_use?: boolean;
|
|
178
|
+
status?: VirtualAccountStatus;
|
|
179
|
+
metadata?: XenditMetadata;
|
|
180
|
+
}
|
|
181
|
+
export interface VAPayment {
|
|
182
|
+
id: string;
|
|
183
|
+
payment_id: string;
|
|
184
|
+
business_id: string;
|
|
185
|
+
reference_id: string;
|
|
186
|
+
bank_code: VirtualAccountChannelCode;
|
|
187
|
+
account_number: string;
|
|
188
|
+
currency: XenditCurrency;
|
|
189
|
+
status: 'PENDING' | 'SETTLED';
|
|
190
|
+
amount?: number;
|
|
191
|
+
paid_amount?: number;
|
|
192
|
+
paid_at?: string;
|
|
193
|
+
sender_name?: string;
|
|
194
|
+
updated: string;
|
|
195
|
+
created: string;
|
|
196
|
+
}
|
|
197
|
+
export type EWalletChannelCode = 'ID_OVO' | 'ID_DANA' | 'ID_LINKAJA' | 'ID_SHOPEEPAY' | 'ID_GO_PAY' | 'ID_ASTRAPAY' | 'ID_JENIUS' | 'ID_NEXCASH' | 'ID_SAKUKU' | 'PH_GCASH' | 'PH_PAYMAYA' | 'PH_GRABPAY' | 'VN_MOMO' | 'VN_ZALOPAY' | 'TH_TRUEMONEY' | 'MY_TOUCHNGO' | 'MY_GRABPAY';
|
|
198
|
+
export type EWalletStatus = 'PENDING' | 'SUCCEEDED' | 'FAILED' | 'EXPIRED';
|
|
199
|
+
export interface CreateEWalletChargeRequest {
|
|
200
|
+
reference_id: string;
|
|
201
|
+
currency: XenditCurrency;
|
|
202
|
+
amount: number;
|
|
203
|
+
checkout_method?: 'ONE_TIME_PAYMENT' | 'TOKENIZATION';
|
|
204
|
+
channel_code: EWalletChannelCode;
|
|
205
|
+
channel_properties?: EWalletChannelProperties;
|
|
206
|
+
basket?: BasketItem[];
|
|
207
|
+
metadata?: XenditMetadata;
|
|
208
|
+
customer_id?: string;
|
|
209
|
+
billing_information?: BillingInformation;
|
|
210
|
+
shipping_information?: ShippingInformation;
|
|
211
|
+
success_redirect_url?: string;
|
|
212
|
+
failure_redirect_url?: string;
|
|
213
|
+
}
|
|
214
|
+
export interface EWalletChannelProperties {
|
|
215
|
+
mobile_number?: string;
|
|
216
|
+
success_redirect_url?: string;
|
|
217
|
+
failure_redirect_url?: string;
|
|
218
|
+
cancel_redirect_url?: string;
|
|
219
|
+
require_auth?: boolean;
|
|
220
|
+
}
|
|
221
|
+
export interface BasketItem {
|
|
222
|
+
reference_id?: string;
|
|
223
|
+
name: string;
|
|
224
|
+
category?: string;
|
|
225
|
+
market?: string;
|
|
226
|
+
price: number;
|
|
227
|
+
quantity: number;
|
|
228
|
+
type?: string;
|
|
229
|
+
sub_category?: string;
|
|
230
|
+
description?: string;
|
|
231
|
+
url?: string;
|
|
232
|
+
}
|
|
233
|
+
export interface EWalletCharge {
|
|
234
|
+
id: string;
|
|
235
|
+
business_id: string;
|
|
236
|
+
reference_id: string;
|
|
237
|
+
status: EWalletStatus;
|
|
238
|
+
currency: XenditCurrency;
|
|
239
|
+
charge_amount: number;
|
|
240
|
+
capture_amount?: number;
|
|
241
|
+
refunded_amount?: number;
|
|
242
|
+
channel_code: EWalletChannelCode;
|
|
243
|
+
channel_properties?: EWalletChannelProperties;
|
|
244
|
+
actions?: EWalletAction[];
|
|
245
|
+
basket?: BasketItem[];
|
|
246
|
+
metadata?: XenditMetadata;
|
|
247
|
+
customer_id?: string;
|
|
248
|
+
billing_information?: BillingInformation;
|
|
249
|
+
shipping_information?: ShippingInformation;
|
|
250
|
+
payment_method_id?: string;
|
|
251
|
+
failure_code?: string;
|
|
252
|
+
created: string;
|
|
253
|
+
updated: string;
|
|
254
|
+
}
|
|
255
|
+
export interface EWalletAction {
|
|
256
|
+
name: string;
|
|
257
|
+
method: 'GET' | 'POST';
|
|
258
|
+
url: string;
|
|
259
|
+
}
|
|
260
|
+
export interface BillingInformation {
|
|
261
|
+
country: string;
|
|
262
|
+
street_line_1?: string;
|
|
263
|
+
street_line_2?: string;
|
|
264
|
+
city?: string;
|
|
265
|
+
province?: string;
|
|
266
|
+
state?: string;
|
|
267
|
+
postal_code?: string;
|
|
268
|
+
}
|
|
269
|
+
export interface ShippingInformation {
|
|
270
|
+
country: string;
|
|
271
|
+
street_line_1?: string;
|
|
272
|
+
street_line_2?: string;
|
|
273
|
+
city?: string;
|
|
274
|
+
province?: string;
|
|
275
|
+
state?: string;
|
|
276
|
+
postal_code?: string;
|
|
277
|
+
}
|
|
278
|
+
export type QRCodeType = 'DYNAMIC' | 'STATIC';
|
|
279
|
+
export type QRCodeStatus = 'ACTIVE' | 'INACTIVE';
|
|
280
|
+
export interface CreateQRCodeRequest {
|
|
281
|
+
external_id: string;
|
|
282
|
+
type: QRCodeType;
|
|
283
|
+
amount?: number;
|
|
284
|
+
callback_url?: string;
|
|
285
|
+
currency?: XenditCurrency;
|
|
286
|
+
metadata?: XenditMetadata;
|
|
287
|
+
}
|
|
288
|
+
export interface QRCode {
|
|
289
|
+
id: string;
|
|
290
|
+
external_id: string;
|
|
291
|
+
type: QRCodeType;
|
|
292
|
+
status: QRCodeStatus;
|
|
293
|
+
amount?: number;
|
|
294
|
+
qr_string: string;
|
|
295
|
+
callback_url?: string;
|
|
296
|
+
currency: XenditCurrency;
|
|
297
|
+
reference_id?: string;
|
|
298
|
+
metadata?: XenditMetadata;
|
|
299
|
+
created: string;
|
|
300
|
+
updated: string;
|
|
301
|
+
expires_at?: string;
|
|
302
|
+
}
|
|
303
|
+
export interface QRCodePayment {
|
|
304
|
+
id: string;
|
|
305
|
+
external_id: string;
|
|
306
|
+
amount: number;
|
|
307
|
+
currency: XenditCurrency;
|
|
308
|
+
qr_code: QRCode;
|
|
309
|
+
status: string;
|
|
310
|
+
payment_detail: QRCodePaymentDetail;
|
|
311
|
+
created: string;
|
|
312
|
+
}
|
|
313
|
+
export interface QRCodePaymentDetail {
|
|
314
|
+
rrn?: string;
|
|
315
|
+
source?: string;
|
|
316
|
+
}
|
|
317
|
+
export interface SimulateQRCodeRequest {
|
|
318
|
+
amount: number;
|
|
319
|
+
}
|
|
320
|
+
export type RetailOutletChannelCode = 'ALFAMART' | 'ALFAMIDI' | 'INDOMARET' | 'CEBUANA' | 'ECPAY' | 'PALAWAN' | 'MLHUILLIER' | 'LBC' | 'DP_ALFAMART' | 'DP_ALFAMIDI' | 'DP_INDOMARET';
|
|
321
|
+
export type RetailOutletStatus = 'ACTIVE' | 'INACTIVE' | 'EXPIRED';
|
|
322
|
+
export interface CreateRetailOutletRequest {
|
|
323
|
+
external_id: string;
|
|
324
|
+
retail_outlet_name: RetailOutletChannelCode;
|
|
325
|
+
name: string;
|
|
326
|
+
expected_amount?: number;
|
|
327
|
+
payment_code?: string;
|
|
328
|
+
expiration_date?: string;
|
|
329
|
+
is_single_use?: boolean;
|
|
330
|
+
description?: string;
|
|
331
|
+
metadata?: XenditMetadata;
|
|
332
|
+
currency?: XenditCurrency;
|
|
333
|
+
}
|
|
334
|
+
export interface RetailOutlet {
|
|
335
|
+
id: string;
|
|
336
|
+
external_id: string;
|
|
337
|
+
user_id: string;
|
|
338
|
+
retail_outlet_name: RetailOutletChannelCode;
|
|
339
|
+
name: string;
|
|
340
|
+
payment_code: string;
|
|
341
|
+
expected_amount?: number;
|
|
342
|
+
status: RetailOutletStatus;
|
|
343
|
+
is_single_use: boolean;
|
|
344
|
+
expiration_date?: string;
|
|
345
|
+
description?: string;
|
|
346
|
+
currency: XenditCurrency;
|
|
347
|
+
metadata?: XenditMetadata;
|
|
348
|
+
created: string;
|
|
349
|
+
updated: string;
|
|
350
|
+
}
|
|
351
|
+
export interface UpdateRetailOutletRequest {
|
|
352
|
+
name?: string;
|
|
353
|
+
expected_amount?: number;
|
|
354
|
+
expiration_date?: string;
|
|
355
|
+
description?: string;
|
|
356
|
+
is_single_use?: boolean;
|
|
357
|
+
status?: RetailOutletStatus;
|
|
358
|
+
metadata?: XenditMetadata;
|
|
359
|
+
}
|
|
360
|
+
export type CreditCardStatus = 'PENDING' | 'SUCCEEDED' | 'FAILED' | 'REVERSED' | 'REFUNDED' | 'VOIDED' | 'AUTHORIZED';
|
|
361
|
+
export interface CreateCreditCardChargeRequest {
|
|
362
|
+
token_id: string;
|
|
363
|
+
external_id: string;
|
|
364
|
+
amount: number;
|
|
365
|
+
authentication_id?: string;
|
|
366
|
+
billing_details?: CreditCardBillingDetails;
|
|
367
|
+
shipping_details?: CreditCardShippingDetails;
|
|
368
|
+
currency?: XenditCurrency;
|
|
369
|
+
capture?: boolean;
|
|
370
|
+
card_cvn?: string;
|
|
371
|
+
descriptor?: string;
|
|
372
|
+
installment?: CreditCardInstallment;
|
|
373
|
+
metadata?: XenditMetadata;
|
|
374
|
+
}
|
|
375
|
+
export interface CreditCardBillingDetails {
|
|
376
|
+
given_names?: string;
|
|
377
|
+
surname?: string;
|
|
378
|
+
email?: string;
|
|
379
|
+
phone?: string;
|
|
380
|
+
address?: CustomerAddress;
|
|
381
|
+
}
|
|
382
|
+
export interface CreditCardShippingDetails {
|
|
383
|
+
given_names?: string;
|
|
384
|
+
surname?: string;
|
|
385
|
+
email?: string;
|
|
386
|
+
phone?: string;
|
|
387
|
+
address?: CustomerAddress;
|
|
388
|
+
tracking_number?: string;
|
|
389
|
+
}
|
|
390
|
+
export interface CreditCardInstallment {
|
|
391
|
+
count: number;
|
|
392
|
+
interval?: string;
|
|
393
|
+
}
|
|
394
|
+
export interface CreditCardCharge {
|
|
395
|
+
id: string;
|
|
396
|
+
external_id: string;
|
|
397
|
+
user_id: string;
|
|
398
|
+
status: CreditCardStatus;
|
|
399
|
+
amount: number;
|
|
400
|
+
merchant_fee?: number;
|
|
401
|
+
fee_merchant?: number;
|
|
402
|
+
currency: XenditCurrency;
|
|
403
|
+
card_brand?: string;
|
|
404
|
+
card_type?: string;
|
|
405
|
+
masked_card_number?: string;
|
|
406
|
+
bank?: string;
|
|
407
|
+
descriptor?: string;
|
|
408
|
+
approval_code?: string;
|
|
409
|
+
authentication_id?: string;
|
|
410
|
+
token_id?: string;
|
|
411
|
+
business_id?: string;
|
|
412
|
+
capture_amount?: number;
|
|
413
|
+
fee_capture_amount?: number;
|
|
414
|
+
refunded_amount?: number;
|
|
415
|
+
installment?: CreditCardInstallment;
|
|
416
|
+
billing_details?: CreditCardBillingDetails;
|
|
417
|
+
shipping_details?: CreditCardShippingDetails;
|
|
418
|
+
metadata?: XenditMetadata;
|
|
419
|
+
created: string;
|
|
420
|
+
updated: string;
|
|
421
|
+
}
|
|
422
|
+
export interface CreateCreditCardAuthRequest {
|
|
423
|
+
token_id: string;
|
|
424
|
+
external_id: string;
|
|
425
|
+
amount: number;
|
|
426
|
+
card_cvn?: string;
|
|
427
|
+
currency?: XenditCurrency;
|
|
428
|
+
descriptor?: string;
|
|
429
|
+
billing_details?: CreditCardBillingDetails;
|
|
430
|
+
shipping_details?: CreditCardShippingDetails;
|
|
431
|
+
metadata?: XenditMetadata;
|
|
432
|
+
}
|
|
433
|
+
export interface CreditCardAuth {
|
|
434
|
+
id: string;
|
|
435
|
+
external_id: string;
|
|
436
|
+
user_id: string;
|
|
437
|
+
status: CreditCardStatus;
|
|
438
|
+
amount: number;
|
|
439
|
+
currency: XenditCurrency;
|
|
440
|
+
card_brand?: string;
|
|
441
|
+
card_type?: string;
|
|
442
|
+
masked_card_number?: string;
|
|
443
|
+
bank?: string;
|
|
444
|
+
descriptor?: string;
|
|
445
|
+
token_id?: string;
|
|
446
|
+
metadata?: XenditMetadata;
|
|
447
|
+
created: string;
|
|
448
|
+
updated: string;
|
|
449
|
+
}
|
|
450
|
+
export interface CreateCreditCardRefundRequest {
|
|
451
|
+
external_id: string;
|
|
452
|
+
amount: number;
|
|
453
|
+
metadata?: XenditMetadata;
|
|
454
|
+
}
|
|
455
|
+
export interface CreditCardRefund {
|
|
456
|
+
id: string;
|
|
457
|
+
external_id: string;
|
|
458
|
+
user_id: string;
|
|
459
|
+
charge_id: string;
|
|
460
|
+
status: 'PENDING' | 'SUCCEEDED' | 'FAILED';
|
|
461
|
+
amount: number;
|
|
462
|
+
failure_reason?: string;
|
|
463
|
+
metadata?: XenditMetadata;
|
|
464
|
+
created: string;
|
|
465
|
+
updated: string;
|
|
466
|
+
}
|
|
467
|
+
export type DirectDebitChannelCode = 'BCA_ONEKLIK' | 'BCA_KLIKPAY' | 'BRI' | 'MANDIRI' | 'MANDIRI_SNAP' | 'BNI' | 'PERMATA' | 'BJB' | 'BSI' | 'BTN' | 'BANK_TRANSFER' | 'BANK_JAGO';
|
|
468
|
+
export type DirectDebitStatus = 'PENDING' | 'SUCCEEDED' | 'FAILED' | 'ACTIVE';
|
|
469
|
+
export interface CreateDirectDebitPaymentMethodRequest {
|
|
470
|
+
customer_id: string;
|
|
471
|
+
channel_code: DirectDebitChannelCode;
|
|
472
|
+
properties?: Record<string, string>;
|
|
473
|
+
metadata?: XenditMetadata;
|
|
474
|
+
}
|
|
475
|
+
export interface ValidateDirectDebitOTPRequest {
|
|
476
|
+
otp_code: string;
|
|
477
|
+
}
|
|
478
|
+
export interface DirectDebitPaymentMethod {
|
|
479
|
+
id: string;
|
|
480
|
+
business_id: string;
|
|
481
|
+
reference_id: string;
|
|
482
|
+
customer_id: string;
|
|
483
|
+
status: DirectDebitStatus;
|
|
484
|
+
channel_code: string;
|
|
485
|
+
properties?: Record<string, string>;
|
|
486
|
+
metadata?: XenditMetadata;
|
|
487
|
+
created: string;
|
|
488
|
+
updated: string;
|
|
489
|
+
}
|
|
490
|
+
export interface CreateDirectDebitPaymentRequest {
|
|
491
|
+
reference_id: string;
|
|
492
|
+
payment_method_id: string;
|
|
493
|
+
currency: XenditCurrency;
|
|
494
|
+
amount: number;
|
|
495
|
+
callback_url?: string;
|
|
496
|
+
enable_otp?: boolean;
|
|
497
|
+
device?: DirectDebitDevice;
|
|
498
|
+
success_redirect_url?: string;
|
|
499
|
+
failure_redirect_url?: string;
|
|
500
|
+
metadata?: XenditMetadata;
|
|
501
|
+
}
|
|
502
|
+
export interface DirectDebitDevice {
|
|
503
|
+
id: string;
|
|
504
|
+
ip_address?: string;
|
|
505
|
+
user_agent?: string;
|
|
506
|
+
fingerprint?: string;
|
|
507
|
+
}
|
|
508
|
+
export interface DirectDebitPayment {
|
|
509
|
+
id: string;
|
|
510
|
+
reference_id: string;
|
|
511
|
+
business_id: string;
|
|
512
|
+
currency: XenditCurrency;
|
|
513
|
+
amount: number;
|
|
514
|
+
country: string;
|
|
515
|
+
status: DirectDebitStatus;
|
|
516
|
+
payment_method_id: string;
|
|
517
|
+
channel_code: string;
|
|
518
|
+
failure_code?: string;
|
|
519
|
+
description?: string;
|
|
520
|
+
callback_url?: string;
|
|
521
|
+
enable_otp?: boolean;
|
|
522
|
+
device?: DirectDebitDevice;
|
|
523
|
+
metadata?: XenditMetadata;
|
|
524
|
+
actions?: DirectDebitAction[];
|
|
525
|
+
created: string;
|
|
526
|
+
updated: string;
|
|
527
|
+
}
|
|
528
|
+
export interface DirectDebitAction {
|
|
529
|
+
name: string;
|
|
530
|
+
method: 'GET' | 'POST';
|
|
531
|
+
url: string;
|
|
532
|
+
}
|
|
533
|
+
export type DisbursementChannelCode = 'BCA' | 'BNI' | 'BRI' | 'MANDIRI' | 'PERMATA' | 'CIMB' | 'BANK_TRANSFER' | 'ALFAMART' | 'OVO' | 'DANA' | 'LINKAJA' | 'SHOPEEPAY';
|
|
534
|
+
export type DisbursementStatus = 'PENDING' | 'SUCCEEDED' | 'FAILED';
|
|
535
|
+
export interface CreateDisbursementRequest {
|
|
536
|
+
external_id: string;
|
|
537
|
+
amount: number;
|
|
538
|
+
bank_code: DisbursementChannelCode;
|
|
539
|
+
account_holder_name: string;
|
|
540
|
+
account_number: string;
|
|
541
|
+
description?: string;
|
|
542
|
+
email_to?: string[];
|
|
543
|
+
email_cc?: string[];
|
|
544
|
+
email_bcc?: string[];
|
|
545
|
+
metadata?: XenditMetadata;
|
|
546
|
+
}
|
|
547
|
+
export interface Disbursement {
|
|
548
|
+
id: string;
|
|
549
|
+
user_id: string;
|
|
550
|
+
external_id: string;
|
|
551
|
+
amount: number;
|
|
552
|
+
bank_code: DisbursementChannelCode;
|
|
553
|
+
account_holder_name: string;
|
|
554
|
+
account_number: string;
|
|
555
|
+
status: DisbursementStatus;
|
|
556
|
+
description?: string;
|
|
557
|
+
failure_code?: string;
|
|
558
|
+
email_to?: string[];
|
|
559
|
+
email_cc?: string[];
|
|
560
|
+
email_bcc?: string[];
|
|
561
|
+
metadata?: XenditMetadata;
|
|
562
|
+
transaction_fee?: number;
|
|
563
|
+
created: string;
|
|
564
|
+
updated: string;
|
|
565
|
+
completed_at?: string;
|
|
566
|
+
estimated_arrival_time?: string;
|
|
567
|
+
}
|
|
568
|
+
export interface CreateBatchDisbursementRequest {
|
|
569
|
+
reference: string;
|
|
570
|
+
disbursements: CreateDisbursementRequest[];
|
|
571
|
+
}
|
|
572
|
+
export interface BatchDisbursement {
|
|
573
|
+
id: string;
|
|
574
|
+
reference: string;
|
|
575
|
+
total_disbursed_amount: number;
|
|
576
|
+
total_uploaded_amount: number;
|
|
577
|
+
status: string;
|
|
578
|
+
created: string;
|
|
579
|
+
updated: string;
|
|
580
|
+
}
|
|
581
|
+
export interface DisbursementBank {
|
|
582
|
+
name: string;
|
|
583
|
+
code: DisbursementChannelCode;
|
|
584
|
+
can_disburse: boolean;
|
|
585
|
+
}
|
|
586
|
+
export type BalanceAccountType = 'CASH' | 'HOLDING' | 'TAX';
|
|
587
|
+
export interface GetBalanceRequest {
|
|
588
|
+
account_type?: BalanceAccountType;
|
|
589
|
+
currency?: XenditCurrency;
|
|
590
|
+
at_timestamp?: string;
|
|
591
|
+
}
|
|
592
|
+
export interface Balance {
|
|
593
|
+
balance: number;
|
|
594
|
+
}
|
|
595
|
+
export interface XenditApiError {
|
|
596
|
+
error_code: string;
|
|
597
|
+
message: string;
|
|
598
|
+
status_code?: number;
|
|
599
|
+
errors?: XenditValidationErrorDetail[];
|
|
600
|
+
}
|
|
601
|
+
export interface XenditValidationErrorDetail {
|
|
602
|
+
path: string;
|
|
603
|
+
message: string;
|
|
604
|
+
}
|
|
605
|
+
export type XenditWebhookEventName = 'invoice.paid' | 'invoice.expired' | 'va.paid' | 'disbursement.created' | 'disbursement.completed' | 'disbursement.failed' | 'ewallet.payment' | 'card_charge.succeeded' | 'card_charge.failed' | 'qris.payment' | 'retail_outlet.payment' | 'direct_debit.payment' | 'fva.created' | 'recurring_payment.stopped' | 'payment_method.activated' | 'payment_method.expired';
|
|
606
|
+
export interface XenditWebhookEvent {
|
|
607
|
+
event: XenditWebhookEventName;
|
|
608
|
+
data: Record<string, unknown>;
|
|
609
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { XenditApiError } from './types.ts';
|
|
2
|
+
export declare class XenditException extends Error {
|
|
3
|
+
/**
|
|
4
|
+
* HTTP status code or 0 for network errors
|
|
5
|
+
*/
|
|
6
|
+
readonly status: number;
|
|
7
|
+
/**
|
|
8
|
+
* Xendit error code (e.g. 'INVALID_AMOUNT', 'UNAUTHORIZED')
|
|
9
|
+
*/
|
|
10
|
+
readonly code: string;
|
|
11
|
+
/**
|
|
12
|
+
* The raw JSON response body from Xendit API, if available
|
|
13
|
+
*/
|
|
14
|
+
readonly rawResponse?: XenditApiError;
|
|
15
|
+
constructor(status: number, code: string, message: string, rawResponse?: XenditApiError);
|
|
16
|
+
}
|
|
17
|
+
export declare class XenditValidationError extends XenditException {
|
|
18
|
+
constructor(code: string, message: string, rawResponse?: XenditApiError);
|
|
19
|
+
}
|
|
20
|
+
export declare class XenditAuthenticationError extends XenditException {
|
|
21
|
+
constructor(code: string, message: string, rawResponse?: XenditApiError);
|
|
22
|
+
}
|
|
23
|
+
export declare class XenditNotFoundError extends XenditException {
|
|
24
|
+
constructor(code: string, message: string, rawResponse?: XenditApiError);
|
|
25
|
+
}
|
|
26
|
+
export declare class XenditConflictError extends XenditException {
|
|
27
|
+
constructor(code: string, message: string, rawResponse?: XenditApiError);
|
|
28
|
+
}
|
|
29
|
+
export declare class XenditRateLimitError extends XenditException {
|
|
30
|
+
constructor(code: string, message: string, rawResponse?: XenditApiError);
|
|
31
|
+
}
|
|
32
|
+
export declare class XenditServerError extends XenditException {
|
|
33
|
+
constructor(code: string, message: string, rawResponse?: XenditApiError);
|
|
34
|
+
}
|
|
35
|
+
export declare class XenditNetworkError extends XenditException {
|
|
36
|
+
constructor(code: string, message: string, rawResponse?: XenditApiError);
|
|
37
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { a as XenditNotFoundError, c as XenditValidationError, i as XenditNetworkError, n as XenditConflictError, o as XenditRateLimitError, r as XenditException, s as XenditServerError, t as XenditAuthenticationError } from "../xendit_exception-kaFnYOo7.js";
|
|
2
|
+
export { XenditAuthenticationError, XenditConflictError, XenditException, XenditNetworkError, XenditNotFoundError, XenditRateLimitError, XenditServerError, XenditValidationError };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { XenditConfig } from './types.ts';
|
|
2
|
+
import { BalanceClient } from './clients/balance_client.ts';
|
|
3
|
+
import { CreditCardClient } from './clients/credit_card_client.ts';
|
|
4
|
+
import { DirectDebitClient } from './clients/direct_debit_client.ts';
|
|
5
|
+
import { DisbursementClient } from './clients/disbursement_client.ts';
|
|
6
|
+
import { EWalletClient } from './clients/ewallet_client.ts';
|
|
7
|
+
import { InvoiceClient } from './clients/invoice_client.ts';
|
|
8
|
+
import { QrisClient } from './clients/qris_client.ts';
|
|
9
|
+
import { RetailOutletClient } from './clients/retail_outlet_client.ts';
|
|
10
|
+
import { VirtualAccountClient } from './clients/va_client.ts';
|
|
11
|
+
export declare class XenditManager {
|
|
12
|
+
#private;
|
|
13
|
+
constructor(config: XenditConfig);
|
|
14
|
+
invoice(): InvoiceClient;
|
|
15
|
+
va(): VirtualAccountClient;
|
|
16
|
+
ewallet(): EWalletClient;
|
|
17
|
+
qris(): QrisClient;
|
|
18
|
+
retailOutlet(): RetailOutletClient;
|
|
19
|
+
creditCard(): CreditCardClient;
|
|
20
|
+
directDebit(): DirectDebitClient;
|
|
21
|
+
disbursement(): DisbursementClient;
|
|
22
|
+
balance(): BalanceClient;
|
|
23
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{{{
|
|
2
|
+
exports({ to: app.configPath('xendit.ts') })
|
|
3
|
+
}}}
|
|
4
|
+
import env from '#start/env'
|
|
5
|
+
import { defineConfig } from '@rikology/adonisjs-xendit'
|
|
6
|
+
|
|
7
|
+
export default defineConfig({
|
|
8
|
+
secretKey: env.get('XENDIT_SECRET_KEY'),
|
|
9
|
+
environment: env.get('XENDIT_ENVIRONMENT', 'sandbox'),
|
|
10
|
+
callbackToken: env.get('XENDIT_CALLBACK_TOKEN'),
|
|
11
|
+
timeoutMs: 30000,
|
|
12
|
+
})
|