@crediblemark/buayar 0.1.10 → 0.2.1
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/README.md +270 -100
- package/dist/index.d.mts +925 -40
- package/dist/index.d.ts +925 -40
- package/dist/index.js +6084 -478
- package/dist/index.mjs +6005 -477
- package/package.json +5 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,81 +1,186 @@
|
|
|
1
|
+
type CanonicalPaymentMethod = "bca_va" | "mandiri_va" | "bni_va" | "bri_va" | "permata_va" | "cimb_va" | "danamon_va" | "bsi_va" | "seabank_va" | "muamalat_va" | "artajasa_va" | "qris" | "gopay_qris" | "shopeepay_qris" | "nobu_qris" | "gopay" | "shopeepay" | "ovo" | "dana" | "linkaja" | "jenius" | "alfamart" | "indomaret" | "pos" | "credit_card" | "kredivo" | "akulaku" | "indodana" | string;
|
|
2
|
+
|
|
3
|
+
interface CustomerDetails {
|
|
4
|
+
name: string;
|
|
5
|
+
email: string;
|
|
6
|
+
phone?: string;
|
|
7
|
+
}
|
|
1
8
|
interface CreateInvoiceParams {
|
|
2
9
|
orderId: string;
|
|
3
10
|
amount: number;
|
|
4
11
|
productDetails: string;
|
|
5
|
-
customer:
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
customer: CustomerDetails;
|
|
13
|
+
returnUrl?: string;
|
|
14
|
+
callbackUrl?: string;
|
|
15
|
+
/**
|
|
16
|
+
* Payment method code.
|
|
17
|
+
* Mendukung Canonical Code (contoh: "bca_va", "mandiri_va", "qris", "gopay", "shopeepay", "alfamart", "indomaret")
|
|
18
|
+
* atau kode raw spesifik provider (contoh Duitku: "BC", "M2", "SP").
|
|
19
|
+
* Jika dikosongkan, akan beralih ke Mode Semi Integrasi (Redirect Checkout).
|
|
20
|
+
*/
|
|
21
|
+
paymentMethod?: CanonicalPaymentMethod | string;
|
|
22
|
+
/**
|
|
23
|
+
* Kode mata uang ISO 4217 (opsional). Default: 'IDR'.
|
|
24
|
+
* Contoh: 'idr', 'usd', 'sgd'
|
|
25
|
+
*/
|
|
26
|
+
currency?: string;
|
|
27
|
+
/** Parameter kustom tambahan untuk provider spesifik (opsional) */
|
|
15
28
|
providerParams?: any;
|
|
16
29
|
}
|
|
30
|
+
interface MandiriBillInfo {
|
|
31
|
+
billerCode?: string;
|
|
32
|
+
billKey?: string;
|
|
33
|
+
}
|
|
17
34
|
interface InvoiceResponse {
|
|
18
35
|
success: boolean;
|
|
36
|
+
/** Provider yang memproses invoice ini ('midtrans' | 'duitku') */
|
|
37
|
+
provider?: string;
|
|
38
|
+
/** Order ID unik dari merchant */
|
|
39
|
+
orderId?: string;
|
|
40
|
+
/** Nominal transaksi */
|
|
41
|
+
amount?: number;
|
|
42
|
+
/** URL Checkout / Redirect untuk mode Semi-Integrasi */
|
|
19
43
|
paymentUrl?: string;
|
|
44
|
+
/** Reference number dari Payment Gateway */
|
|
20
45
|
reference?: string;
|
|
21
|
-
/** Virtual Account
|
|
46
|
+
/** Nomor Virtual Account (untuk metode Bank Transfer / VA) */
|
|
22
47
|
vaNumber?: string;
|
|
23
|
-
/**
|
|
48
|
+
/** Nama Bank dari Virtual Account (misal: "bca", "bni", "bri", "mandiri", "permata") */
|
|
49
|
+
vaBank?: string;
|
|
50
|
+
/** Raw EMVCo QRIS string standar nasional untuk dirender ke Canvas / SVG QR */
|
|
24
51
|
qrString?: string;
|
|
25
|
-
/**
|
|
52
|
+
/** URL Gambar QR Code langsung */
|
|
26
53
|
qrCodeUrl?: string;
|
|
27
|
-
/**
|
|
54
|
+
/** Kode pembayaran gerai retail (Indomaret / Alfamart) */
|
|
28
55
|
paymentCode?: string;
|
|
56
|
+
/** Deep link URL untuk membuka langsung aplikasi e-wallet (GoPay, ShopeePay, DANA) di mobile */
|
|
57
|
+
deeplink?: string;
|
|
58
|
+
/** Informasi biller khusus Mandiri E-Channel */
|
|
59
|
+
billInfo?: MandiriBillInfo;
|
|
60
|
+
/** Waktu kedaluwarsa tagihan pembayaran */
|
|
61
|
+
expiresAt?: Date | string;
|
|
62
|
+
/** Raw response asli dari API provider */
|
|
29
63
|
rawResponse: any;
|
|
64
|
+
/** Pesan error jika gagal */
|
|
30
65
|
error?: string;
|
|
31
66
|
}
|
|
32
67
|
interface VerifyCallbackResult {
|
|
33
68
|
isValid: boolean;
|
|
69
|
+
provider?: string;
|
|
34
70
|
orderId: string;
|
|
35
71
|
amount: number;
|
|
36
|
-
|
|
72
|
+
/** Status transaksi terstandarisasi */
|
|
73
|
+
status: "paid" | "pending" | "failed" | "expired";
|
|
74
|
+
/** Boolean helper: bernilai true jika transaksi sukses terbayar */
|
|
75
|
+
isPaid: boolean;
|
|
76
|
+
/** Boolean helper: bernilai true jika transaksi masih menunggu pembayaran */
|
|
77
|
+
isPending: boolean;
|
|
78
|
+
/** Boolean helper: bernilai true jika transaksi gagal/dibatalkan */
|
|
79
|
+
isFailed: boolean;
|
|
80
|
+
/** Boolean helper: bernilai true jika transaksi telah kedaluwarsa */
|
|
81
|
+
isExpired: boolean;
|
|
82
|
+
/** Kode status asli dari provider */
|
|
83
|
+
statusCode?: string;
|
|
84
|
+
/** Waktu transaksi dicatat */
|
|
85
|
+
transactionTime?: Date | string;
|
|
86
|
+
/** Raw payload callback asli dari webhook */
|
|
37
87
|
rawPayload: any;
|
|
38
88
|
}
|
|
39
89
|
interface ProviderConfig {
|
|
40
|
-
merchantCode
|
|
41
|
-
apiKey
|
|
42
|
-
sandbox
|
|
90
|
+
merchantCode?: string;
|
|
91
|
+
apiKey?: string;
|
|
92
|
+
sandbox?: boolean;
|
|
93
|
+
clientKey?: string;
|
|
94
|
+
serverKey?: string;
|
|
95
|
+
merchantId?: string;
|
|
96
|
+
projectId?: string;
|
|
97
|
+
publicKey?: string;
|
|
98
|
+
privateKey?: string;
|
|
99
|
+
secretKey?: string;
|
|
100
|
+
customBaseUrl?: string;
|
|
101
|
+
callbackUrl?: string;
|
|
102
|
+
returnUrl?: string;
|
|
103
|
+
/** Wadah konfigurasi ekstra fleksibel untuk custom provider */
|
|
104
|
+
extra?: Record<string, any>;
|
|
105
|
+
}
|
|
106
|
+
interface BuayarConfig extends ProviderConfig {
|
|
107
|
+
/**
|
|
108
|
+
* Nama provider aktif.
|
|
109
|
+
* Contoh: "midtrans" | "duitku"
|
|
110
|
+
* Jika tidak diisi, otomatis membaca process.env.PAYMENT_PROVIDER atau process.env.BUAYAR_PROVIDER
|
|
111
|
+
*/
|
|
112
|
+
provider?: string;
|
|
43
113
|
}
|
|
44
114
|
interface GetPaymentMethodsParams {
|
|
45
|
-
/**
|
|
46
|
-
amount
|
|
115
|
+
/** Nominal transaksi (integer) untuk menghitung fee admin dinamis */
|
|
116
|
+
amount?: number;
|
|
117
|
+
}
|
|
118
|
+
interface PaymentMethodItem {
|
|
119
|
+
/** Kode canonical Buayar, contoh: "bca_va", "qris", "gopay" */
|
|
120
|
+
code: string;
|
|
121
|
+
/** Kode asli bawaan provider, contoh: "BC", "SP", "bank_transfer" */
|
|
122
|
+
providerCode: string;
|
|
123
|
+
/** Nama metode pembayaran yang ramah pengguna, contoh: "BCA Virtual Account" */
|
|
124
|
+
name: string;
|
|
125
|
+
/** URL logo icon metode pembayaran */
|
|
126
|
+
image: string;
|
|
127
|
+
/** Biaya admin transaksi */
|
|
128
|
+
fee: {
|
|
129
|
+
flat: number;
|
|
130
|
+
percent: number;
|
|
131
|
+
totalFee: number;
|
|
132
|
+
};
|
|
133
|
+
/** Minimum & Maksimum transaksi yang diperbolehkan */
|
|
134
|
+
minAmount?: number;
|
|
135
|
+
maxAmount?: number;
|
|
136
|
+
/** Status ketersediaan channel */
|
|
137
|
+
isOnline: boolean;
|
|
138
|
+
/** Kategori grup untuk Accordion UI */
|
|
139
|
+
category: "Virtual Account" | "QRIS" | "E-Wallet" | "Retail / Gerai" | "Kartu Kredit" | "Paylater / Cicilan" | "Lainnya";
|
|
47
140
|
}
|
|
48
141
|
interface PaymentMethod {
|
|
49
|
-
/** Provider-specific method code, e.g. "BT", "I1", "OL" */
|
|
50
142
|
paymentMethod: string;
|
|
51
|
-
/** Human-readable name, e.g. "BCA Virtual Account" */
|
|
52
143
|
paymentName: string;
|
|
53
|
-
/** URL to payment method logo/image */
|
|
54
144
|
paymentImage: string;
|
|
55
|
-
/** Total transaction fee in IDR (string from API) */
|
|
56
145
|
totalFee: string;
|
|
57
|
-
/** Categorized payment channel (Virtual Account, QRIS, E-Wallet, Retail / Gerai, Kartu Kredit, Paylater / Cicilan, Lainnya) */
|
|
58
146
|
category: "Virtual Account" | "QRIS" | "E-Wallet" | "Retail / Gerai" | "Kartu Kredit" | "Paylater / Cicilan" | "Lainnya";
|
|
147
|
+
code?: string;
|
|
148
|
+
feeDetail?: {
|
|
149
|
+
flat: number;
|
|
150
|
+
percent: number;
|
|
151
|
+
totalFee: number;
|
|
152
|
+
};
|
|
59
153
|
}
|
|
60
154
|
interface GetPaymentMethodsResult {
|
|
61
155
|
success: boolean;
|
|
156
|
+
provider?: string;
|
|
157
|
+
/** Daftar seluruh channel metode pembayaran */
|
|
62
158
|
methods: PaymentMethod[];
|
|
159
|
+
/** Pengelompokan channel per kategori yang sudah siap dirender sebagai Accordion UI */
|
|
160
|
+
categories?: Record<string, PaymentMethod[]>;
|
|
63
161
|
error?: string;
|
|
64
162
|
rawResponse: any;
|
|
65
163
|
}
|
|
66
164
|
interface CheckTransactionParams {
|
|
67
|
-
/**
|
|
165
|
+
/** Merchant order ID saat pembuatan transaksi */
|
|
68
166
|
merchantOrderId: string;
|
|
69
167
|
}
|
|
70
168
|
interface CheckTransactionResult {
|
|
71
169
|
success: boolean;
|
|
170
|
+
provider?: string;
|
|
72
171
|
orderId: string;
|
|
73
172
|
reference: string;
|
|
74
173
|
amount: number;
|
|
75
174
|
/** "00" = success/paid, "01" = pending, "02" = failed/expired */
|
|
76
175
|
statusCode: string;
|
|
77
|
-
status: "paid" | "pending" | "failed";
|
|
176
|
+
status: "paid" | "pending" | "failed" | "expired";
|
|
177
|
+
isPaid: boolean;
|
|
178
|
+
isPending: boolean;
|
|
179
|
+
isFailed: boolean;
|
|
180
|
+
isExpired: boolean;
|
|
78
181
|
statusMessage: string;
|
|
182
|
+
paymentType?: string;
|
|
183
|
+
transactionTime?: Date | string;
|
|
79
184
|
error?: string;
|
|
80
185
|
rawResponse: any;
|
|
81
186
|
}
|
|
@@ -94,13 +199,28 @@ declare abstract class BasePaymentProvider {
|
|
|
94
199
|
}>;
|
|
95
200
|
}
|
|
96
201
|
|
|
202
|
+
declare class DuitkuProvider extends BasePaymentProvider {
|
|
203
|
+
readonly name = "duitku";
|
|
204
|
+
private getBaseUrl;
|
|
205
|
+
createInvoice(params: CreateInvoiceParams, config: ProviderConfig): Promise<InvoiceResponse>;
|
|
206
|
+
verifyCallback(body: any, config: ProviderConfig): Promise<VerifyCallbackResult>;
|
|
207
|
+
getPaymentMethods(params: GetPaymentMethodsParams, config: ProviderConfig): Promise<GetPaymentMethodsResult>;
|
|
208
|
+
checkTransaction(params: CheckTransactionParams, config: ProviderConfig): Promise<CheckTransactionResult>;
|
|
209
|
+
probePaymentMethods(config: ProviderConfig): Promise<{
|
|
210
|
+
success: boolean;
|
|
211
|
+
enabled: string[];
|
|
212
|
+
error?: string;
|
|
213
|
+
}>;
|
|
214
|
+
}
|
|
215
|
+
|
|
97
216
|
declare class MidtransClient {
|
|
98
217
|
private apiKey;
|
|
99
218
|
private sandbox;
|
|
100
|
-
constructor(config: {
|
|
101
|
-
apiKey
|
|
102
|
-
|
|
103
|
-
|
|
219
|
+
constructor(config: ProviderConfig | {
|
|
220
|
+
apiKey?: string;
|
|
221
|
+
serverKey?: string;
|
|
222
|
+
sandbox?: boolean;
|
|
223
|
+
});
|
|
104
224
|
private getApiBaseUrl;
|
|
105
225
|
request(method: "GET" | "POST" | "PATCH" | "DELETE", path: string, body: any): Promise<any>;
|
|
106
226
|
cancelTransaction(orderId: string): Promise<any>;
|
|
@@ -140,9 +260,6 @@ declare class MidtransProvider extends BasePaymentProvider {
|
|
|
140
260
|
verifyCallback(body: any, config: ProviderConfig): Promise<VerifyCallbackResult>;
|
|
141
261
|
getPaymentMethods(params: GetPaymentMethodsParams, config: ProviderConfig): Promise<GetPaymentMethodsResult>;
|
|
142
262
|
checkTransaction(params: CheckTransactionParams, config: ProviderConfig): Promise<CheckTransactionResult>;
|
|
143
|
-
/**
|
|
144
|
-
* Get an instance of MidtransClient to perform transaction actions, subscriptions, invoicing, etc.
|
|
145
|
-
*/
|
|
146
263
|
getClient(config: ProviderConfig): MidtransClient;
|
|
147
264
|
probePaymentMethods(config: ProviderConfig): Promise<{
|
|
148
265
|
success: boolean;
|
|
@@ -151,21 +268,409 @@ declare class MidtransProvider extends BasePaymentProvider {
|
|
|
151
268
|
}>;
|
|
152
269
|
}
|
|
153
270
|
|
|
154
|
-
declare class
|
|
155
|
-
readonly name = "
|
|
271
|
+
declare class IpaymuProvider extends BasePaymentProvider {
|
|
272
|
+
readonly name = "ipaymu";
|
|
156
273
|
private getBaseUrl;
|
|
157
274
|
createInvoice(params: CreateInvoiceParams, config: ProviderConfig): Promise<InvoiceResponse>;
|
|
158
275
|
verifyCallback(body: any, config: ProviderConfig): Promise<VerifyCallbackResult>;
|
|
159
276
|
getPaymentMethods(params: GetPaymentMethodsParams, config: ProviderConfig): Promise<GetPaymentMethodsResult>;
|
|
160
277
|
checkTransaction(params: CheckTransactionParams, config: ProviderConfig): Promise<CheckTransactionResult>;
|
|
161
|
-
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
declare class XenditProvider extends BasePaymentProvider {
|
|
281
|
+
readonly name = "xendit";
|
|
282
|
+
private getBaseUrl;
|
|
283
|
+
createInvoice(params: CreateInvoiceParams, config: ProviderConfig): Promise<InvoiceResponse>;
|
|
284
|
+
verifyCallback(body: any, config: ProviderConfig): Promise<VerifyCallbackResult>;
|
|
285
|
+
getPaymentMethods(params: GetPaymentMethodsParams, config: ProviderConfig): Promise<GetPaymentMethodsResult>;
|
|
286
|
+
checkTransaction(params: CheckTransactionParams, config: ProviderConfig): Promise<CheckTransactionResult>;
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
declare class DokuProvider extends BasePaymentProvider {
|
|
290
|
+
readonly name = "doku";
|
|
291
|
+
private getBaseUrl;
|
|
292
|
+
createInvoice(params: CreateInvoiceParams, config: ProviderConfig): Promise<InvoiceResponse>;
|
|
293
|
+
verifyCallback(body: any, config: ProviderConfig): Promise<VerifyCallbackResult>;
|
|
294
|
+
getPaymentMethods(params: GetPaymentMethodsParams, config: ProviderConfig): Promise<GetPaymentMethodsResult>;
|
|
295
|
+
checkTransaction(params: CheckTransactionParams, config: ProviderConfig): Promise<CheckTransactionResult>;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
declare class PrismalinkProvider extends BasePaymentProvider {
|
|
299
|
+
readonly name = "prismalink";
|
|
300
|
+
private getBaseUrl;
|
|
301
|
+
createInvoice(params: CreateInvoiceParams, config: ProviderConfig): Promise<InvoiceResponse>;
|
|
302
|
+
verifyCallback(body: any, config: ProviderConfig): Promise<VerifyCallbackResult>;
|
|
303
|
+
getPaymentMethods(params: GetPaymentMethodsParams, config: ProviderConfig): Promise<GetPaymentMethodsResult>;
|
|
304
|
+
checkTransaction(params: CheckTransactionParams, config: ProviderConfig): Promise<CheckTransactionResult>;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
declare class FaspayProvider extends BasePaymentProvider {
|
|
308
|
+
readonly name = "faspay";
|
|
309
|
+
private getBaseUrl;
|
|
310
|
+
createInvoice(params: CreateInvoiceParams, config: ProviderConfig): Promise<InvoiceResponse>;
|
|
311
|
+
verifyCallback(body: any, config: ProviderConfig): Promise<VerifyCallbackResult>;
|
|
312
|
+
getPaymentMethods(params: GetPaymentMethodsParams, config: ProviderConfig): Promise<GetPaymentMethodsResult>;
|
|
313
|
+
checkTransaction(params: CheckTransactionParams, config: ProviderConfig): Promise<CheckTransactionResult>;
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
declare class FinpayProvider extends BasePaymentProvider {
|
|
317
|
+
readonly name = "finpay";
|
|
318
|
+
private getBaseUrl;
|
|
319
|
+
createInvoice(params: CreateInvoiceParams, config: ProviderConfig): Promise<InvoiceResponse>;
|
|
320
|
+
verifyCallback(body: any, config: ProviderConfig): Promise<VerifyCallbackResult>;
|
|
321
|
+
getPaymentMethods(params: GetPaymentMethodsParams, config: ProviderConfig): Promise<GetPaymentMethodsResult>;
|
|
322
|
+
checkTransaction(params: CheckTransactionParams, config: ProviderConfig): Promise<CheckTransactionResult>;
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
declare class NicepayProvider extends BasePaymentProvider {
|
|
326
|
+
readonly name = "nicepay";
|
|
327
|
+
private getBaseUrl;
|
|
328
|
+
createInvoice(params: CreateInvoiceParams, config: ProviderConfig): Promise<InvoiceResponse>;
|
|
329
|
+
verifyCallback(body: any, config: ProviderConfig): Promise<VerifyCallbackResult>;
|
|
330
|
+
getPaymentMethods(params: GetPaymentMethodsParams, config: ProviderConfig): Promise<GetPaymentMethodsResult>;
|
|
331
|
+
checkTransaction(params: CheckTransactionParams, config: ProviderConfig): Promise<CheckTransactionResult>;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
declare class OyProvider extends BasePaymentProvider {
|
|
335
|
+
readonly name = "oy";
|
|
336
|
+
private getBaseUrl;
|
|
337
|
+
createInvoice(params: CreateInvoiceParams, config: ProviderConfig): Promise<InvoiceResponse>;
|
|
338
|
+
verifyCallback(body: any, config: ProviderConfig): Promise<VerifyCallbackResult>;
|
|
339
|
+
getPaymentMethods(params: GetPaymentMethodsParams, config: ProviderConfig): Promise<GetPaymentMethodsResult>;
|
|
340
|
+
checkTransaction(params: CheckTransactionParams, config: ProviderConfig): Promise<CheckTransactionResult>;
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
declare class StripeProvider extends BasePaymentProvider {
|
|
344
|
+
readonly name = "stripe";
|
|
345
|
+
private getBaseUrl;
|
|
346
|
+
createInvoice(params: CreateInvoiceParams, config: ProviderConfig): Promise<InvoiceResponse>;
|
|
347
|
+
verifyCallback(body: any, config: ProviderConfig): Promise<VerifyCallbackResult>;
|
|
348
|
+
getPaymentMethods(params: GetPaymentMethodsParams, config: ProviderConfig): Promise<GetPaymentMethodsResult>;
|
|
349
|
+
checkTransaction(params: CheckTransactionParams, config: ProviderConfig): Promise<CheckTransactionResult>;
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
interface DuitkuDisbursementParams {
|
|
353
|
+
bankCode: string;
|
|
354
|
+
bankAccount: string;
|
|
355
|
+
amount: number;
|
|
356
|
+
purpose: string;
|
|
357
|
+
merchantOrderId: string;
|
|
358
|
+
senderName?: string;
|
|
359
|
+
senderPhone?: string;
|
|
360
|
+
callbackUrl?: string;
|
|
361
|
+
}
|
|
362
|
+
declare class DuitkuClient {
|
|
363
|
+
private merchantCode;
|
|
364
|
+
private apiKey;
|
|
365
|
+
private sandbox;
|
|
366
|
+
constructor(config: ProviderConfig | {
|
|
367
|
+
merchantCode?: string;
|
|
368
|
+
apiKey?: string;
|
|
369
|
+
sandbox?: boolean;
|
|
370
|
+
});
|
|
371
|
+
private getPassportBaseUrl;
|
|
372
|
+
private getApiBaseUrl;
|
|
373
|
+
/**
|
|
374
|
+
* Request helper generic dengan kalkulasi signature Duitku otomatis
|
|
375
|
+
*/
|
|
376
|
+
request(method: "GET" | "POST", endpoint: string, body?: any, options?: {
|
|
377
|
+
baseUrl?: "passport" | "api";
|
|
378
|
+
customHeaders?: Record<string, string>;
|
|
379
|
+
}): Promise<any>;
|
|
380
|
+
/**
|
|
381
|
+
* Cek status transaksi pembayaran berdasarkan merchant order ID
|
|
382
|
+
*/
|
|
383
|
+
checkTransaction(merchantOrderId: string): Promise<any>;
|
|
384
|
+
/**
|
|
385
|
+
* Ambil daftar channel pembayaran aktif dan kalkulasi fee dinamis
|
|
386
|
+
*/
|
|
387
|
+
getPaymentMethods(amount?: number): Promise<any>;
|
|
388
|
+
/**
|
|
389
|
+
* Cek saldo merchant (Balance Inquiry)
|
|
390
|
+
*/
|
|
391
|
+
checkBalance(): Promise<{
|
|
162
392
|
success: boolean;
|
|
163
|
-
|
|
393
|
+
balance?: number;
|
|
394
|
+
rawResponse: any;
|
|
164
395
|
error?: string;
|
|
165
396
|
}>;
|
|
397
|
+
/**
|
|
398
|
+
* Mengambil daftar bank yang didukung untuk transfer / penarikan dana
|
|
399
|
+
*/
|
|
400
|
+
listBanks(): Promise<any>;
|
|
401
|
+
/**
|
|
402
|
+
* Validasi nama pemilik rekening bank sebelum eksekusi transfer (Bank Account Inquiry)
|
|
403
|
+
*/
|
|
404
|
+
inquiryBankAccount(bankCode: string, bankAccount: string): Promise<any>;
|
|
405
|
+
/**
|
|
406
|
+
* Eksekusi transfer dana / payout (Disbursement Transfer)
|
|
407
|
+
*/
|
|
408
|
+
disburse(params: DuitkuDisbursementParams): Promise<any>;
|
|
409
|
+
/**
|
|
410
|
+
* Cek status disbursement berdasarkan merchant order ID
|
|
411
|
+
*/
|
|
412
|
+
checkDisbursementStatus(merchantOrderId: string): Promise<any>;
|
|
166
413
|
}
|
|
167
414
|
|
|
168
|
-
declare
|
|
415
|
+
declare class IpaymuClient {
|
|
416
|
+
private va;
|
|
417
|
+
private apiKey;
|
|
418
|
+
private sandbox;
|
|
419
|
+
constructor(config: ProviderConfig | {
|
|
420
|
+
merchantCode?: string;
|
|
421
|
+
merchantId?: string;
|
|
422
|
+
apiKey?: string;
|
|
423
|
+
sandbox?: boolean;
|
|
424
|
+
});
|
|
425
|
+
private getBaseUrl;
|
|
426
|
+
/**
|
|
427
|
+
* Helper request bertanda tangan iPaymu v2
|
|
428
|
+
*/
|
|
429
|
+
request(method: "GET" | "POST", endpoint: string, body?: any): Promise<any>;
|
|
430
|
+
/**
|
|
431
|
+
* Cek saldo merchant iPaymu
|
|
432
|
+
*/
|
|
433
|
+
checkBalance(): Promise<{
|
|
434
|
+
success: boolean;
|
|
435
|
+
balance?: number;
|
|
436
|
+
rawResponse: any;
|
|
437
|
+
error?: string;
|
|
438
|
+
}>;
|
|
439
|
+
/**
|
|
440
|
+
* Cek detail transaksi iPaymu
|
|
441
|
+
*/
|
|
442
|
+
checkTransaction(transactionId: string): Promise<any>;
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
interface XenditDisbursementParams {
|
|
446
|
+
externalId: string;
|
|
447
|
+
bankCode: string;
|
|
448
|
+
accountHolderName: string;
|
|
449
|
+
accountNumber: string;
|
|
450
|
+
description: string;
|
|
451
|
+
amount: number;
|
|
452
|
+
}
|
|
453
|
+
declare class XenditClient {
|
|
454
|
+
private apiKey;
|
|
455
|
+
constructor(config: ProviderConfig | {
|
|
456
|
+
apiKey?: string;
|
|
457
|
+
secretKey?: string;
|
|
458
|
+
});
|
|
459
|
+
private getBaseUrl;
|
|
460
|
+
/**
|
|
461
|
+
* HTTP Request helper bertanda tangan Basic Auth Xendit
|
|
462
|
+
*/
|
|
463
|
+
request(method: "GET" | "POST" | "PATCH", endpoint: string, body?: any): Promise<any>;
|
|
464
|
+
/**
|
|
465
|
+
* Cek Saldo Merchant Xendit
|
|
466
|
+
*/
|
|
467
|
+
checkBalance(accountType?: "CASH" | "HOLDING" | "TAX"): Promise<{
|
|
468
|
+
success: boolean;
|
|
469
|
+
balance?: number;
|
|
470
|
+
rawResponse: any;
|
|
471
|
+
error?: string;
|
|
472
|
+
}>;
|
|
473
|
+
/**
|
|
474
|
+
* Memaksa sebuah invoice kadaluwarsa (Expire Invoice)
|
|
475
|
+
*/
|
|
476
|
+
expireInvoice(invoiceId: string): Promise<any>;
|
|
477
|
+
/**
|
|
478
|
+
* Eksekusi transfer dana / disbursement
|
|
479
|
+
*/
|
|
480
|
+
createDisbursement(params: XenditDisbursementParams): Promise<any>;
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
declare class DokuClient {
|
|
484
|
+
private clientId;
|
|
485
|
+
private secretKey;
|
|
486
|
+
private sandbox;
|
|
487
|
+
constructor(config: ProviderConfig | {
|
|
488
|
+
merchantCode?: string;
|
|
489
|
+
clientId?: string;
|
|
490
|
+
apiKey?: string;
|
|
491
|
+
secretKey?: string;
|
|
492
|
+
sandbox?: boolean;
|
|
493
|
+
});
|
|
494
|
+
private getBaseUrl;
|
|
495
|
+
/**
|
|
496
|
+
* Helper request bertanda tangan DOKU Jokul v2
|
|
497
|
+
*/
|
|
498
|
+
request(method: "GET" | "POST", endpoint: string, body?: any): Promise<any>;
|
|
499
|
+
/**
|
|
500
|
+
* Cek status transaksi pesanan di DOKU
|
|
501
|
+
*/
|
|
502
|
+
checkTransaction(invoiceNumber: string): Promise<any>;
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
declare class PrismalinkClient {
|
|
506
|
+
private merchantId;
|
|
507
|
+
private secretKey;
|
|
508
|
+
private sandbox;
|
|
509
|
+
constructor(config: ProviderConfig | {
|
|
510
|
+
merchantCode?: string;
|
|
511
|
+
merchantId?: string;
|
|
512
|
+
apiKey?: string;
|
|
513
|
+
secretKey?: string;
|
|
514
|
+
sandbox?: boolean;
|
|
515
|
+
});
|
|
516
|
+
private getBaseUrl;
|
|
517
|
+
/**
|
|
518
|
+
* Helper HTTP Request ke API PrismaLink
|
|
519
|
+
*/
|
|
520
|
+
request(method: "GET" | "POST", endpoint: string, body?: any): Promise<any>;
|
|
521
|
+
/**
|
|
522
|
+
* Cek status transaksi pesanan di PrismaLink
|
|
523
|
+
*/
|
|
524
|
+
checkTransaction(orderId: string): Promise<any>;
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
declare class FaspayClient {
|
|
528
|
+
private merchantId;
|
|
529
|
+
private userId;
|
|
530
|
+
private password;
|
|
531
|
+
private sandbox;
|
|
532
|
+
constructor(config: ProviderConfig | {
|
|
533
|
+
merchantCode?: string;
|
|
534
|
+
merchantId?: string;
|
|
535
|
+
userId?: string;
|
|
536
|
+
clientKey?: string;
|
|
537
|
+
apiKey?: string;
|
|
538
|
+
password?: string;
|
|
539
|
+
sandbox?: boolean;
|
|
540
|
+
});
|
|
541
|
+
private getBaseUrl;
|
|
542
|
+
/**
|
|
543
|
+
* Helper HTTP Request ke endpoint Faspay
|
|
544
|
+
*/
|
|
545
|
+
request(endpoint: string, payload: any): Promise<any>;
|
|
546
|
+
/**
|
|
547
|
+
* Cek status pembayaran tagihan Faspay
|
|
548
|
+
*/
|
|
549
|
+
checkTransaction(billNo: string): Promise<any>;
|
|
550
|
+
/**
|
|
551
|
+
* Batalkan tagihan pembayaran Faspay
|
|
552
|
+
*/
|
|
553
|
+
cancelTransaction(billNo: string, paymentChannel: string): Promise<any>;
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
declare class FinpayClient {
|
|
557
|
+
private merchantId;
|
|
558
|
+
private merchantKey;
|
|
559
|
+
private sandbox;
|
|
560
|
+
constructor(config: ProviderConfig | {
|
|
561
|
+
merchantCode?: string;
|
|
562
|
+
merchantId?: string;
|
|
563
|
+
apiKey?: string;
|
|
564
|
+
serverKey?: string;
|
|
565
|
+
secretKey?: string;
|
|
566
|
+
sandbox?: boolean;
|
|
567
|
+
});
|
|
568
|
+
private getBaseUrl;
|
|
569
|
+
/**
|
|
570
|
+
* Helper HTTP Request ke Finpay API
|
|
571
|
+
*/
|
|
572
|
+
request(endpoint: string, payload: any): Promise<any>;
|
|
573
|
+
/**
|
|
574
|
+
* Cek status transaksi pembayaran Finpay
|
|
575
|
+
*/
|
|
576
|
+
checkTransaction(orderId: string): Promise<any>;
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
declare class NicepayClient {
|
|
580
|
+
private iMid;
|
|
581
|
+
private merchantKey;
|
|
582
|
+
private sandbox;
|
|
583
|
+
constructor(config: ProviderConfig | {
|
|
584
|
+
merchantCode?: string;
|
|
585
|
+
merchantId?: string;
|
|
586
|
+
iMid?: string;
|
|
587
|
+
apiKey?: string;
|
|
588
|
+
serverKey?: string;
|
|
589
|
+
secretKey?: string;
|
|
590
|
+
sandbox?: boolean;
|
|
591
|
+
});
|
|
592
|
+
private getBaseUrl;
|
|
593
|
+
/**
|
|
594
|
+
* Helper HTTP Request ke Nicepay API
|
|
595
|
+
*/
|
|
596
|
+
request(endpoint: string, payload: any): Promise<any>;
|
|
597
|
+
/**
|
|
598
|
+
* Cek status transaksi pembayaran di Nicepay
|
|
599
|
+
*/
|
|
600
|
+
checkTransaction(referenceNo: string, amount?: number): Promise<any>;
|
|
601
|
+
/**
|
|
602
|
+
* Batalkan transaksi di Nicepay
|
|
603
|
+
*/
|
|
604
|
+
cancelTransaction(tXid: string, payMethod: string, cancelMsg?: string): Promise<any>;
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
declare class OyClient {
|
|
608
|
+
private username;
|
|
609
|
+
private apiKey;
|
|
610
|
+
private sandbox;
|
|
611
|
+
constructor(config: ProviderConfig | {
|
|
612
|
+
merchantCode?: string;
|
|
613
|
+
username?: string;
|
|
614
|
+
clientKey?: string;
|
|
615
|
+
apiKey?: string;
|
|
616
|
+
serverKey?: string;
|
|
617
|
+
secretKey?: string;
|
|
618
|
+
sandbox?: boolean;
|
|
619
|
+
});
|
|
620
|
+
private getBaseUrl;
|
|
621
|
+
/**
|
|
622
|
+
* Helper HTTP Request ke OY! Bisnis API
|
|
623
|
+
*/
|
|
624
|
+
request(method: "GET" | "POST", endpoint: string, body?: any): Promise<any>;
|
|
625
|
+
/**
|
|
626
|
+
* Cek status transaksi pembayaran
|
|
627
|
+
*/
|
|
628
|
+
checkTransaction(partnerTxId: string): Promise<any>;
|
|
629
|
+
/**
|
|
630
|
+
* Cek saldo akun OY! Bisnis
|
|
631
|
+
*/
|
|
632
|
+
checkBalance(): Promise<any>;
|
|
633
|
+
/**
|
|
634
|
+
* Kirim dana / Transfer uang (Disbursement / Remittance)
|
|
635
|
+
*/
|
|
636
|
+
remit(params: {
|
|
637
|
+
recipientBank: string;
|
|
638
|
+
recipientAccount: string;
|
|
639
|
+
amount: number;
|
|
640
|
+
note?: string;
|
|
641
|
+
partnerTrxId: string;
|
|
642
|
+
}): Promise<any>;
|
|
643
|
+
}
|
|
644
|
+
|
|
645
|
+
declare class StripeClient {
|
|
646
|
+
private secretKey;
|
|
647
|
+
constructor(config: ProviderConfig | {
|
|
648
|
+
apiKey?: string;
|
|
649
|
+
serverKey?: string;
|
|
650
|
+
secretKey?: string;
|
|
651
|
+
});
|
|
652
|
+
private getBaseUrl;
|
|
653
|
+
/**
|
|
654
|
+
* Helper HTTP Request ke Stripe API
|
|
655
|
+
*/
|
|
656
|
+
request(method: "GET" | "POST" | "DELETE", endpoint: string, body?: any): Promise<any>;
|
|
657
|
+
/**
|
|
658
|
+
* Ambil detail Checkout Session
|
|
659
|
+
*/
|
|
660
|
+
retrieveCheckoutSession(sessionId: string): Promise<any>;
|
|
661
|
+
/**
|
|
662
|
+
* Ambil detail Payment Intent
|
|
663
|
+
*/
|
|
664
|
+
retrievePaymentIntent(paymentIntentId: string): Promise<any>;
|
|
665
|
+
/**
|
|
666
|
+
* Cek saldo akun Stripe (Balance)
|
|
667
|
+
*/
|
|
668
|
+
checkBalance(): Promise<any>;
|
|
669
|
+
/**
|
|
670
|
+
* Buat refund dana
|
|
671
|
+
*/
|
|
672
|
+
createRefund(paymentIntentId: string, amount?: number): Promise<any>;
|
|
673
|
+
}
|
|
169
674
|
|
|
170
675
|
declare class PaymentManager {
|
|
171
676
|
private providers;
|
|
@@ -174,6 +679,26 @@ declare class PaymentManager {
|
|
|
174
679
|
getProvider(name: string): BasePaymentProvider;
|
|
175
680
|
getMidtransProvider(): MidtransProvider;
|
|
176
681
|
getMidtransClient(config: ProviderConfig): MidtransClient;
|
|
682
|
+
getDuitkuProvider(): DuitkuProvider;
|
|
683
|
+
getDuitkuClient(config: ProviderConfig): DuitkuClient;
|
|
684
|
+
getIpaymuProvider(): IpaymuProvider;
|
|
685
|
+
getIpaymuClient(config: ProviderConfig): IpaymuClient;
|
|
686
|
+
getXenditProvider(): XenditProvider;
|
|
687
|
+
getXenditClient(config: ProviderConfig): XenditClient;
|
|
688
|
+
getDokuProvider(): DokuProvider;
|
|
689
|
+
getDokuClient(config: ProviderConfig): DokuClient;
|
|
690
|
+
getPrismalinkProvider(): PrismalinkProvider;
|
|
691
|
+
getPrismalinkClient(config: ProviderConfig): PrismalinkClient;
|
|
692
|
+
getFaspayProvider(): FaspayProvider;
|
|
693
|
+
getFaspayClient(config: ProviderConfig): FaspayClient;
|
|
694
|
+
getFinpayProvider(): FinpayProvider;
|
|
695
|
+
getFinpayClient(config: ProviderConfig): FinpayClient;
|
|
696
|
+
getNicepayProvider(): NicepayProvider;
|
|
697
|
+
getNicepayClient(config: ProviderConfig): NicepayClient;
|
|
698
|
+
getOyProvider(): OyProvider;
|
|
699
|
+
getOyClient(config: ProviderConfig): OyClient;
|
|
700
|
+
getStripeProvider(): StripeProvider;
|
|
701
|
+
getStripeClient(config: ProviderConfig): StripeClient;
|
|
177
702
|
createInvoice(providerName: string, params: CreateInvoiceParams, config: ProviderConfig): Promise<InvoiceResponse>;
|
|
178
703
|
verifyCallback(providerName: string, body: any, config: ProviderConfig): Promise<VerifyCallbackResult>;
|
|
179
704
|
getPaymentMethods(providerName: string, params: GetPaymentMethodsParams, config: ProviderConfig): Promise<GetPaymentMethodsResult>;
|
|
@@ -186,4 +711,364 @@ declare class PaymentManager {
|
|
|
186
711
|
}
|
|
187
712
|
declare const paymentManager: PaymentManager;
|
|
188
713
|
|
|
189
|
-
|
|
714
|
+
/**
|
|
715
|
+
* Resolver konfigurasi kredensial otomatis dari Environment Variables.
|
|
716
|
+
* Mendukung variabel universal Buayar / PG serta variabel spesifik masing-masing provider.
|
|
717
|
+
*/
|
|
718
|
+
declare function resolveConfigFromEnv(customConfig?: BuayarConfig): BuayarConfig;
|
|
719
|
+
|
|
720
|
+
/**
|
|
721
|
+
* Buayar - Unified Payment Gateway Client
|
|
722
|
+
*
|
|
723
|
+
* Antarmuka tingkat tinggi untuk membuat transaksi, query channel pembayaran,
|
|
724
|
+
* pengecekan status, dan verifikasi webhook universal tanpa perlu rombak kode.
|
|
725
|
+
*/
|
|
726
|
+
declare class Buayar {
|
|
727
|
+
private manager;
|
|
728
|
+
private config;
|
|
729
|
+
constructor(config?: BuayarConfig, manager?: PaymentManager);
|
|
730
|
+
/**
|
|
731
|
+
* Dapatkan salinan konfigurasi aktif saat ini
|
|
732
|
+
*/
|
|
733
|
+
getConfig(): BuayarConfig;
|
|
734
|
+
/**
|
|
735
|
+
* Perbarui konfigurasi saat runtime
|
|
736
|
+
*/
|
|
737
|
+
setConfig(config: Partial<BuayarConfig>): void;
|
|
738
|
+
/**
|
|
739
|
+
* Dapatkan nama provider aktif ('midtrans' | 'duitku' | 'ipaymu' | 'xendit' | 'doku' | 'prismalink' | 'faspay' | 'finpay' | 'nicepay' | 'oy' | 'stripe' | ...)
|
|
740
|
+
*/
|
|
741
|
+
get provider(): string;
|
|
742
|
+
/**
|
|
743
|
+
* Registrasi provider custom ke dalam PaymentManager
|
|
744
|
+
*/
|
|
745
|
+
registerProvider(provider: BasePaymentProvider): void;
|
|
746
|
+
/**
|
|
747
|
+
* Ambil instance provider kelas dasar
|
|
748
|
+
*/
|
|
749
|
+
getProvider(name?: string): BasePaymentProvider;
|
|
750
|
+
/**
|
|
751
|
+
* Buat transaksi pembayaran baru (Mendukung Semi dan Full Integrasi)
|
|
752
|
+
*/
|
|
753
|
+
createInvoice(params: CreateInvoiceParams, configOverride?: Partial<ProviderConfig>): Promise<InvoiceResponse>;
|
|
754
|
+
/**
|
|
755
|
+
* Ambil daftar channel pembayaran aktif (Accordion-Ready)
|
|
756
|
+
*/
|
|
757
|
+
getPaymentMethods(params?: GetPaymentMethodsParams, configOverride?: Partial<ProviderConfig>): Promise<GetPaymentMethodsResult>;
|
|
758
|
+
/**
|
|
759
|
+
* Cek status transaksi pembayaran berdasarkan Order ID
|
|
760
|
+
*/
|
|
761
|
+
checkTransaction(params: CheckTransactionParams, configOverride?: Partial<ProviderConfig>): Promise<CheckTransactionResult>;
|
|
762
|
+
/**
|
|
763
|
+
* Universal Webhook Handler
|
|
764
|
+
*
|
|
765
|
+
* Memverifikasi keabsahan signature notifikasi pembayaran masuk dan menormalisasi payload menjadi format seragam.
|
|
766
|
+
*/
|
|
767
|
+
verifyWebhook(payload: any, headers?: Record<string, string | string[] | undefined>, configOverride?: Partial<ProviderConfig>): Promise<VerifyCallbackResult>;
|
|
768
|
+
handleWebhook(payload: any, headers?: Record<string, string | string[] | undefined>, configOverride?: Partial<ProviderConfig>): Promise<VerifyCallbackResult>;
|
|
769
|
+
getMidtransClient(configOverride?: Partial<ProviderConfig>): MidtransClient;
|
|
770
|
+
getDuitkuClient(configOverride?: Partial<ProviderConfig>): DuitkuClient;
|
|
771
|
+
getIpaymuClient(configOverride?: Partial<ProviderConfig>): IpaymuClient;
|
|
772
|
+
getXenditClient(configOverride?: Partial<ProviderConfig>): XenditClient;
|
|
773
|
+
getDokuClient(configOverride?: Partial<ProviderConfig>): DokuClient;
|
|
774
|
+
getPrismalinkClient(configOverride?: Partial<ProviderConfig>): PrismalinkClient;
|
|
775
|
+
getFaspayClient(configOverride?: Partial<ProviderConfig>): FaspayClient;
|
|
776
|
+
getFinpayClient(configOverride?: Partial<ProviderConfig>): FinpayClient;
|
|
777
|
+
getNicepayClient(configOverride?: Partial<ProviderConfig>): NicepayClient;
|
|
778
|
+
getOyClient(configOverride?: Partial<ProviderConfig>): OyClient;
|
|
779
|
+
getStripeClient(configOverride?: Partial<ProviderConfig>): StripeClient;
|
|
780
|
+
}
|
|
781
|
+
declare const buayar: Buayar;
|
|
782
|
+
|
|
783
|
+
/**
|
|
784
|
+
* Mapping dari Canonical Payment Method ke kode internal Duitku
|
|
785
|
+
*/
|
|
786
|
+
declare const CANONICAL_TO_DUITKU: Record<string, string>;
|
|
787
|
+
/**
|
|
788
|
+
* Mapping dari kode internal Duitku ke Canonical Payment Method
|
|
789
|
+
*/
|
|
790
|
+
declare const DUITKU_TO_CANONICAL: Record<string, string>;
|
|
791
|
+
/**
|
|
792
|
+
* Mapping dari Canonical Payment Method ke parameter charge Midtrans Core API
|
|
793
|
+
*/
|
|
794
|
+
declare const CANONICAL_TO_MIDTRANS: Record<string, {
|
|
795
|
+
payment_type: string;
|
|
796
|
+
bank?: string;
|
|
797
|
+
}>;
|
|
798
|
+
/**
|
|
799
|
+
* Mapping dari Canonical Payment Method ke parameter direct iPaymu
|
|
800
|
+
*/
|
|
801
|
+
declare const CANONICAL_TO_IPAYMU: Record<string, {
|
|
802
|
+
paymentMethod: string;
|
|
803
|
+
paymentChannel: string;
|
|
804
|
+
}>;
|
|
805
|
+
/**
|
|
806
|
+
* Mapping dari Canonical Payment Method ke parameter Payment Requests API Xendit
|
|
807
|
+
*/
|
|
808
|
+
declare const CANONICAL_TO_XENDIT: Record<string, {
|
|
809
|
+
type: string;
|
|
810
|
+
channel_code?: string;
|
|
811
|
+
}>;
|
|
812
|
+
/**
|
|
813
|
+
* Mapping dari Canonical Payment Method ke endpoint Direct DOKU Jokul
|
|
814
|
+
*/
|
|
815
|
+
declare const CANONICAL_TO_DOKU: Record<string, {
|
|
816
|
+
endpoint: string;
|
|
817
|
+
type: "va" | "qris" | "cstore" | "ewallet";
|
|
818
|
+
bank?: string;
|
|
819
|
+
}>;
|
|
820
|
+
/**
|
|
821
|
+
* Mapping dari Canonical Payment Method ke kode channel PrismaLink
|
|
822
|
+
*/
|
|
823
|
+
declare const CANONICAL_TO_PRISMALINK: Record<string, string>;
|
|
824
|
+
/**
|
|
825
|
+
* Mapping dari Canonical Payment Method ke kode channel Faspay
|
|
826
|
+
*/
|
|
827
|
+
declare const CANONICAL_TO_FASPAY: Record<string, string>;
|
|
828
|
+
/**
|
|
829
|
+
* Mapping dari Canonical Payment Method ke kode channel Finpay
|
|
830
|
+
*/
|
|
831
|
+
declare const CANONICAL_TO_FINPAY: Record<string, string>;
|
|
832
|
+
/**
|
|
833
|
+
* Mapping dari Canonical Payment Method ke konfigurasi Nicepay
|
|
834
|
+
*/
|
|
835
|
+
declare const CANONICAL_TO_NICEPAY: Record<string, {
|
|
836
|
+
payMethod: string;
|
|
837
|
+
bankCd?: string;
|
|
838
|
+
mitraCd?: string;
|
|
839
|
+
}>;
|
|
840
|
+
/**
|
|
841
|
+
* Mapping dari Canonical Payment Method ke konfigurasi OY! Bisnis
|
|
842
|
+
*/
|
|
843
|
+
declare const CANONICAL_TO_OY: Record<string, {
|
|
844
|
+
type: "va" | "qris" | "ewallet" | "cstore";
|
|
845
|
+
bank_code?: string;
|
|
846
|
+
channel?: string;
|
|
847
|
+
}>;
|
|
848
|
+
/**
|
|
849
|
+
* Mapping dari Canonical Payment Method ke payment_method_types Stripe
|
|
850
|
+
*/
|
|
851
|
+
declare const CANONICAL_TO_STRIPE: Record<string, string>;
|
|
852
|
+
/**
|
|
853
|
+
* Ubah method code apapun (baik canonical maupun kode raw provider) ke kode Duitku yang valid
|
|
854
|
+
*/
|
|
855
|
+
declare function toDuitkuPaymentMethod(code?: string): string | undefined;
|
|
856
|
+
/**
|
|
857
|
+
* Ubah method code apapun ke format iPaymu direct channel
|
|
858
|
+
*/
|
|
859
|
+
declare function toIpaymuPaymentMethod(code?: string): {
|
|
860
|
+
paymentMethod: string;
|
|
861
|
+
paymentChannel?: string;
|
|
862
|
+
} | undefined;
|
|
863
|
+
/**
|
|
864
|
+
* Ubah method code apapun ke format Payment Request Xendit
|
|
865
|
+
*/
|
|
866
|
+
declare function toXenditPaymentMethod(code?: string): {
|
|
867
|
+
type: string;
|
|
868
|
+
channel_code?: string;
|
|
869
|
+
} | undefined;
|
|
870
|
+
/**
|
|
871
|
+
* Ubah method code apapun ke format Direct API DOKU Jokul
|
|
872
|
+
*/
|
|
873
|
+
declare function toDokuPaymentMethod(code?: string): {
|
|
874
|
+
endpoint: string;
|
|
875
|
+
type: "va" | "qris" | "cstore" | "ewallet";
|
|
876
|
+
bank?: string;
|
|
877
|
+
} | undefined;
|
|
878
|
+
/**
|
|
879
|
+
* Ubah method code apapun ke format channel PrismaLink
|
|
880
|
+
*/
|
|
881
|
+
declare function toPrismalinkPaymentMethod(code?: string): string | undefined;
|
|
882
|
+
/**
|
|
883
|
+
* Ubah method code apapun ke format payment channel Faspay
|
|
884
|
+
*/
|
|
885
|
+
declare function toFaspayPaymentMethod(code?: string): string | undefined;
|
|
886
|
+
/**
|
|
887
|
+
* Ubah method code apapun ke format channel Finpay
|
|
888
|
+
*/
|
|
889
|
+
declare function toFinpayPaymentMethod(code?: string): string | undefined;
|
|
890
|
+
/**
|
|
891
|
+
* Ubah method code apapun ke format Nicepay
|
|
892
|
+
*/
|
|
893
|
+
declare function toNicepayPaymentMethod(code?: string): {
|
|
894
|
+
payMethod: string;
|
|
895
|
+
bankCd?: string;
|
|
896
|
+
mitraCd?: string;
|
|
897
|
+
} | undefined;
|
|
898
|
+
/**
|
|
899
|
+
* Ubah method code apapun ke format OY! Bisnis
|
|
900
|
+
*/
|
|
901
|
+
declare function toOyPaymentMethod(code?: string): {
|
|
902
|
+
type: "va" | "qris" | "ewallet" | "cstore";
|
|
903
|
+
bank_code?: string;
|
|
904
|
+
channel?: string;
|
|
905
|
+
} | undefined;
|
|
906
|
+
/**
|
|
907
|
+
* Ubah method code apapun ke format Stripe
|
|
908
|
+
*/
|
|
909
|
+
declare function toStripePaymentMethod(code?: string): string | undefined;
|
|
910
|
+
/**
|
|
911
|
+
* Ubah method code apapun ke format canonical standar Buayar
|
|
912
|
+
*/
|
|
913
|
+
declare function toCanonicalPaymentMethod(provider: string, code?: string): string;
|
|
914
|
+
|
|
915
|
+
declare function getDuitkuInquirySignatures(merchantCode: string, orderId: string, amount: number, apiKey: string): {
|
|
916
|
+
payloadSignature: string;
|
|
917
|
+
timestamp: string;
|
|
918
|
+
headerSignature: string;
|
|
919
|
+
};
|
|
920
|
+
declare function verifyDuitkuCallbackSignature(body: any, apiKey: string): boolean;
|
|
921
|
+
declare function getDuitkuPaymentMethodsSignature(merchantCode: string, amount: number, datetime: string, apiKey: string): string;
|
|
922
|
+
declare function getDuitkuStatusSignatures(merchantCode: string, orderId: string, apiKey: string): {
|
|
923
|
+
timestamp: string;
|
|
924
|
+
headerSignature: string;
|
|
925
|
+
bodySignature: string;
|
|
926
|
+
};
|
|
927
|
+
|
|
928
|
+
declare const CORE_API_METHODS: string[];
|
|
929
|
+
declare function buildCoreChargePayload(method: string, params: CreateInvoiceParams, config: ProviderConfig, integerAmount: number): {
|
|
930
|
+
payload?: any;
|
|
931
|
+
error?: string;
|
|
932
|
+
};
|
|
933
|
+
declare function parseCoreChargeResponse(method: string, data: any, orderId: string, integerAmount: number): InvoiceResponse;
|
|
934
|
+
|
|
935
|
+
declare const MIDTRANS_STATIC_METHODS: PaymentMethod[];
|
|
936
|
+
declare const MIDTRANS_PROBE_PAYLOADS: Record<string, any>;
|
|
937
|
+
|
|
938
|
+
/**
|
|
939
|
+
* Generate signature for iPaymu API v2 requests
|
|
940
|
+
*
|
|
941
|
+
* Signature formula:
|
|
942
|
+
* stringToSign = HTTP_METHOD + ":" + VA + ":" + SHA256(RAW_BODY).toLowerCase() + ":" + API_KEY
|
|
943
|
+
* signature = HMAC_SHA256(stringToSign, API_KEY)
|
|
944
|
+
*/
|
|
945
|
+
declare function generateIpaymuSignature(method: "GET" | "POST", va: string, apiKey: string, body?: any): {
|
|
946
|
+
signature: string;
|
|
947
|
+
timestamp: string;
|
|
948
|
+
};
|
|
949
|
+
/**
|
|
950
|
+
* Verifikasi callback webhook dari iPaymu
|
|
951
|
+
*/
|
|
952
|
+
declare function verifyIpaymuCallback(payload: any): {
|
|
953
|
+
isPaid: boolean;
|
|
954
|
+
isPending: boolean;
|
|
955
|
+
isFailed: boolean;
|
|
956
|
+
};
|
|
957
|
+
|
|
958
|
+
/**
|
|
959
|
+
* Buat Basic Auth Header untuk API Xendit (Secret API Key + ":")
|
|
960
|
+
*/
|
|
961
|
+
declare function getXenditAuthHeader(secretKey: string): string;
|
|
962
|
+
/**
|
|
963
|
+
* Verifikasi webhook callback token dari header x-callback-token Xendit
|
|
964
|
+
*/
|
|
965
|
+
declare function verifyXenditWebhookToken(headerToken?: string, expectedToken?: string): boolean;
|
|
966
|
+
|
|
967
|
+
/**
|
|
968
|
+
* Generate DOKU Jokul v2 Request Headers & Signature
|
|
969
|
+
*
|
|
970
|
+
* Digest = Base64(SHA256(RAW_BODY))
|
|
971
|
+
* ComponentSignature = Client-Id:{clientId}\nRequest-Id:{requestId}\nRequest-Timestamp:{timestamp}\nRequest-Target:{requestTarget}\nDigest:{digest}
|
|
972
|
+
* Signature = "HMACSHA256=" + Base64(HMAC_SHA256(ComponentSignature, secretKey))
|
|
973
|
+
*/
|
|
974
|
+
declare function generateDokuHeaders(clientId: string, secretKey: string, requestTarget: string, body?: any, customRequestId?: string): {
|
|
975
|
+
"Client-Id": string;
|
|
976
|
+
"Request-Id": string;
|
|
977
|
+
"Request-Timestamp": string;
|
|
978
|
+
"Signature": string;
|
|
979
|
+
"Digest"?: string;
|
|
980
|
+
};
|
|
981
|
+
/**
|
|
982
|
+
* Verifikasi webhook signature DOKU Jokul
|
|
983
|
+
*/
|
|
984
|
+
declare function verifyDokuWebhookSignature(headers: Record<string, string | string[] | undefined>, body: any, clientId: string, secretKey: string, requestTarget?: string): boolean;
|
|
985
|
+
|
|
986
|
+
/**
|
|
987
|
+
* Generate signature PrismaLink
|
|
988
|
+
*
|
|
989
|
+
* Signature formula: SHA256(merchantId + orderId + amount + secretKey)
|
|
990
|
+
*/
|
|
991
|
+
declare function generatePrismalinkSignature(merchantId: string, orderId: string, amount: number, secretKey: string): string;
|
|
992
|
+
/**
|
|
993
|
+
* Verifikasi webhook signature dari callback PrismaLink
|
|
994
|
+
*/
|
|
995
|
+
declare function verifyPrismalinkSignature(merchantId: string, orderId: string, amount: number, secretKey: string, incomingSignature: string): boolean;
|
|
996
|
+
|
|
997
|
+
/**
|
|
998
|
+
* Generate signature Faspay (SHA1(MD5(username + password + bill_no)))
|
|
999
|
+
*/
|
|
1000
|
+
declare function generateFaspaySignature(userId: string, password: string, billNo: string): string;
|
|
1001
|
+
/**
|
|
1002
|
+
* Verifikasi callback webhook notification Faspay
|
|
1003
|
+
*/
|
|
1004
|
+
declare function verifyFaspaySignature(userId: string, password: string, billNo: string, paymentStatusCode: string, incomingSignature: string): boolean;
|
|
1005
|
+
|
|
1006
|
+
/**
|
|
1007
|
+
* Generate signature Finpay HMAC-SHA512
|
|
1008
|
+
*/
|
|
1009
|
+
declare function generateFinpaySignature(merchantId: string, orderId: string, amount: number, merchantKey: string): string;
|
|
1010
|
+
/**
|
|
1011
|
+
* Verifikasi webhook signature notifikasi Finpay
|
|
1012
|
+
*/
|
|
1013
|
+
declare function verifyFinpaySignature(merchantId: string, orderId: string, amount: number, merchantKey: string, incomingSignature: string): boolean;
|
|
1014
|
+
|
|
1015
|
+
/**
|
|
1016
|
+
* Format date ke format Nicepay: YYYYMMDDHHmmss (14 karakter)
|
|
1017
|
+
*/
|
|
1018
|
+
declare function formatNicepayTimestamp(date?: Date): string;
|
|
1019
|
+
/**
|
|
1020
|
+
* Generate merchantToken Nicepay: SHA256(timeStamp + iMid + referenceNo + amt + merchantKey)
|
|
1021
|
+
*/
|
|
1022
|
+
declare function generateNicepayToken(timeStamp: string, iMid: string, referenceNo: string, amt: number | string, merchantKey: string): string;
|
|
1023
|
+
/**
|
|
1024
|
+
* Verifikasi webhook callback signature dari dbProcessUrl Nicepay
|
|
1025
|
+
*/
|
|
1026
|
+
declare function verifyNicepayWebhook(timeStamp: string, iMid: string, referenceNo: string, amt: number | string, merchantKey: string, incomingToken: string): boolean;
|
|
1027
|
+
|
|
1028
|
+
/**
|
|
1029
|
+
* Generate header autentikasi OY! Bisnis
|
|
1030
|
+
*/
|
|
1031
|
+
declare function generateOyHeaders(username: string, apiKey: string): Record<string, string>;
|
|
1032
|
+
/**
|
|
1033
|
+
* Verifikasi webhook callback OY! Bisnis
|
|
1034
|
+
*/
|
|
1035
|
+
declare function verifyOyWebhook(headers: Record<string, string | string[] | undefined>, expectedUsername: string): boolean;
|
|
1036
|
+
|
|
1037
|
+
/**
|
|
1038
|
+
* Serializer helper untuk format URL-encoded form data Stripe
|
|
1039
|
+
* Mendukung nested object dan array seperti line_items[0][price_data][unit_amount]
|
|
1040
|
+
*/
|
|
1041
|
+
declare function serializeStripeParams(obj: any, prefix?: string): string;
|
|
1042
|
+
/**
|
|
1043
|
+
* Verifikasi webhook signature Stripe (stripe-signature header)
|
|
1044
|
+
* Format header: t=1492774577,v1=5257a869e7ecebeda32affa62cd323fa9d214e1b50613e039f08f6362ced773d
|
|
1045
|
+
*/
|
|
1046
|
+
declare function verifyStripeWebhook(rawPayload: string | any, signatureHeader: string, webhookSecret: string, toleranceSeconds?: number): boolean;
|
|
1047
|
+
|
|
1048
|
+
/**
|
|
1049
|
+
* Generate MD5 hash string (lowercase)
|
|
1050
|
+
*/
|
|
1051
|
+
declare function md5(data: string): string;
|
|
1052
|
+
/**
|
|
1053
|
+
* Generate SHA-256 hash string (lowercase)
|
|
1054
|
+
*/
|
|
1055
|
+
declare function sha256(data: string): string;
|
|
1056
|
+
/**
|
|
1057
|
+
* Generate SHA-512 hash string (lowercase)
|
|
1058
|
+
*/
|
|
1059
|
+
declare function sha512(data: string): string;
|
|
1060
|
+
/**
|
|
1061
|
+
* Generate HMAC-SHA256 hash string (lowercase)
|
|
1062
|
+
*/
|
|
1063
|
+
declare function hmacSha256(data: string, secret: string): string;
|
|
1064
|
+
/**
|
|
1065
|
+
* Timing-safe string comparison to prevent timing attacks on signatures
|
|
1066
|
+
*/
|
|
1067
|
+
declare function safeCompare(a: string, b: string): boolean;
|
|
1068
|
+
|
|
1069
|
+
/**
|
|
1070
|
+
* Helper to categorize raw payment method code & name into unified accordion ready groups
|
|
1071
|
+
*/
|
|
1072
|
+
declare function getPaymentMethodCategory(code: string, name?: string): "Virtual Account" | "QRIS" | "E-Wallet" | "Retail / Gerai" | "Kartu Kredit" | "Paylater / Cicilan" | "Lainnya";
|
|
1073
|
+
|
|
1074
|
+
export { BasePaymentProvider, Buayar, type BuayarConfig, CANONICAL_TO_DOKU, CANONICAL_TO_DUITKU, CANONICAL_TO_FASPAY, CANONICAL_TO_FINPAY, CANONICAL_TO_IPAYMU, CANONICAL_TO_MIDTRANS, CANONICAL_TO_NICEPAY, CANONICAL_TO_OY, CANONICAL_TO_PRISMALINK, CANONICAL_TO_STRIPE, CANONICAL_TO_XENDIT, CORE_API_METHODS, type CanonicalPaymentMethod, type CheckTransactionParams, type CheckTransactionResult, type CreateInvoiceParams, type CustomerDetails, DUITKU_TO_CANONICAL, DokuClient, DokuProvider, DuitkuClient, type DuitkuDisbursementParams, DuitkuProvider, FaspayClient, FaspayProvider, FinpayClient, FinpayProvider, type GetPaymentMethodsParams, type GetPaymentMethodsResult, type InvoiceResponse, IpaymuClient, IpaymuProvider, MIDTRANS_PROBE_PAYLOADS, MIDTRANS_STATIC_METHODS, type MandiriBillInfo, MidtransClient, MidtransProvider, NicepayClient, NicepayProvider, OyClient, OyProvider, PaymentManager, type PaymentMethod, type PaymentMethodItem, PrismalinkClient, PrismalinkProvider, type ProviderConfig, StripeClient, StripeProvider, type VerifyCallbackResult, XenditClient, type XenditDisbursementParams, XenditProvider, buayar, buildCoreChargePayload, formatNicepayTimestamp, generateDokuHeaders, generateFaspaySignature, generateFinpaySignature, generateIpaymuSignature, generateNicepayToken, generateOyHeaders, generatePrismalinkSignature, getDuitkuInquirySignatures, getDuitkuPaymentMethodsSignature, getDuitkuStatusSignatures, getPaymentMethodCategory, getXenditAuthHeader, hmacSha256, md5, parseCoreChargeResponse, paymentManager, resolveConfigFromEnv, safeCompare, serializeStripeParams, sha256, sha512, toCanonicalPaymentMethod, toDokuPaymentMethod, toDuitkuPaymentMethod, toFaspayPaymentMethod, toFinpayPaymentMethod, toIpaymuPaymentMethod, toNicepayPaymentMethod, toOyPaymentMethod, toPrismalinkPaymentMethod, toStripePaymentMethod, toXenditPaymentMethod, verifyDokuWebhookSignature, verifyDuitkuCallbackSignature, verifyFaspaySignature, verifyFinpaySignature, verifyIpaymuCallback, verifyNicepayWebhook, verifyOyWebhook, verifyPrismalinkSignature, verifyStripeWebhook, verifyXenditWebhookToken };
|