@crediblemark/buayar 0.8.5 → 0.8.7
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 +11 -7
- package/dist/cli/index.js +7 -3
- package/dist/index.d.mts +132 -8
- package/dist/index.d.ts +132 -8
- package/dist/index.js +593 -22
- package/dist/index.mjs +586 -22
- package/docs/AUDIT-BUG-DAN-PREMATURE.md +166 -0
- package/docs/guide.md +30 -4
- package/docs/ipaymu.md +22 -7
- package/docs/sumopod.md +359 -0
- package/package.json +5 -4
package/README.md
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
## 🇬🇧 English
|
|
12
12
|
|
|
13
|
-
**`@crediblemark/buayar`** is a **Unified Payment Gateway SDK** for Node.js and TypeScript, supporting **
|
|
13
|
+
**`@crediblemark/buayar`** is a **Unified Payment Gateway SDK** for Node.js and TypeScript, supporting **20 payment providers** (11 Indonesian + 9 International) through a single, consistent API.
|
|
14
14
|
|
|
15
15
|
> 💡 **Zero-Code PG Switcher:** Switch your active payment provider — e.g. from Midtrans to Stripe — **without changing a single line in your controller or service layer**. Just update the credentials in your `.env` file.
|
|
16
16
|
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
|
|
29
29
|
### 📦 Supported Providers
|
|
30
30
|
|
|
31
|
-
#### 🇮🇩 Indonesian (
|
|
31
|
+
#### 🇮🇩 Indonesian (11)
|
|
32
32
|
|
|
33
33
|
| Provider | Status | Redirect | Direct API | Webhook | Client |
|
|
34
34
|
|---|:---:|:---:|:---:|:---:|:---:|
|
|
@@ -42,6 +42,7 @@
|
|
|
42
42
|
| Finpay | - | ✅ | ✅ | HMAC-SHA512 | `FinpayClient` |
|
|
43
43
|
| Nicepay | - | ✅ | ✅ | SHA-256 | `NicepayClient` |
|
|
44
44
|
| OY! Bisnis | - | ✅ | ✅ | Header Auth | `OyClient` |
|
|
45
|
+
| [SumoPod](docs/sumopod.md) | Tested | ✅ Payments v1 | ✅ QRIS API | Svix / Token | `SumopodClient` |
|
|
45
46
|
|
|
46
47
|
#### 🌍 International (9)
|
|
47
48
|
|
|
@@ -61,7 +62,7 @@
|
|
|
61
62
|
|
|
62
63
|
#### Universal (Recommended)
|
|
63
64
|
```env
|
|
64
|
-
# (optional) Active provider: any of the
|
|
65
|
+
# (optional) Active provider: any of the 20 supported names
|
|
65
66
|
# If empty, the provider is AUTO-DETECTED from filled credentials.
|
|
66
67
|
BUAYAR_PROVIDER=midtrans
|
|
67
68
|
|
|
@@ -84,7 +85,7 @@ Check what a provider actually supports — no docs digging:
|
|
|
84
85
|
```ts
|
|
85
86
|
import { buayar } from "@crediblemark/buayar";
|
|
86
87
|
|
|
87
|
-
buayar.listProviders(); // all
|
|
88
|
+
buayar.listProviders(); // all 20 registered providers
|
|
88
89
|
buayar.detectProviderFromEnv(process.env); // guess active provider from .env
|
|
89
90
|
buayar.detectProviderFromPayload(payload); // guess provider from webhook payload
|
|
90
91
|
buayar.getCapabilities("duitku");
|
|
@@ -118,6 +119,7 @@ You don't need provider-specific variable names. Simply use unified **`BUAYAR_*`
|
|
|
118
119
|
| **PayU** | `payu` | MD5 Key | POS ID | POS ID |
|
|
119
120
|
| **Braintree** | `braintree` | Private Key | Merchant ID | Public Key |
|
|
120
121
|
| **2Checkout** | `twocheckout` | Secret Key | Merchant Code | Secret Word (`BUAYAR_WEBHOOK_SECRET`) |
|
|
122
|
+
| **[SumoPod](docs/sumopod.md)** | `sumopod` | API Key (`X-Api-Key`) | *(not needed)* | Webhook Secret / Token (`BUAYAR_WEBHOOK_SECRET`) |
|
|
121
123
|
|
|
122
124
|
### 📖 Usage
|
|
123
125
|
|
|
@@ -204,7 +206,7 @@ BUAYAR_WEBHOOK_SECRET=whsec_...
|
|
|
204
206
|
|
|
205
207
|
## 🇮🇩 Bahasa Indonesia
|
|
206
208
|
|
|
207
|
-
**`@crediblemark/buayar`** adalah **Unified Payment Gateway SDK** untuk Node.js dan TypeScript yang mendukung **
|
|
209
|
+
**`@crediblemark/buayar`** adalah **Unified Payment Gateway SDK** untuk Node.js dan TypeScript yang mendukung **20 payment provider** (11 Indonesia + 9 Internasional) melalui satu arsitektur API yang seragam.
|
|
208
210
|
|
|
209
211
|
> 💡 **Zero-Code PG Switcher:** Berganti provider payment gateway (misal dari Midtrans ke Duitku atau sebaliknya) **tanpa perlu merombak kode controller/service aplikasi**. Cukup ubah kredensial di file `.env`!
|
|
210
212
|
|
|
@@ -222,7 +224,7 @@ BUAYAR_WEBHOOK_SECRET=whsec_...
|
|
|
222
224
|
|
|
223
225
|
### 📦 Provider yang Didukung
|
|
224
226
|
|
|
225
|
-
#### 🇮🇩 Lokal Indonesia (
|
|
227
|
+
#### 🇮🇩 Lokal Indonesia (11)
|
|
226
228
|
|
|
227
229
|
* **Midtrans** — Snap API (Redirect/Popup) & Core API Direct Charge. Verifikasi SHA-512. `MidtransClient`.
|
|
228
230
|
* **Duitku** — Redirect Checkout & Direct Inquiry API. Verifikasi MD5. `DuitkuClient` (Disbursement, Inquiry Rekening, Saldo).
|
|
@@ -234,6 +236,7 @@ BUAYAR_WEBHOOK_SECRET=whsec_...
|
|
|
234
236
|
* **Finpay** — Payment Initiate & Direct API. HMAC-SHA512. `FinpayClient`.
|
|
235
237
|
* **Nicepay** — Order Regist & One-Step API. SHA-256 merchantToken. `NicepayClient`.
|
|
236
238
|
* **OY! Bisnis** — Payment Checkout v2 & Direct VA/QRIS. Header Auth. `OyClient` (Inquiry, Saldo, Disbursement).
|
|
239
|
+
* **SumoPod** `[Tested]` — Payment Link API v1 & QRIS. Verifikasi Svix HMAC-SHA256 / X-Webhook-Token. `SumopodClient`. *Lihat [panduan lengkap SumoPod](docs/sumopod.md)*.
|
|
237
240
|
|
|
238
241
|
#### 🌍 Internasional (9)
|
|
239
242
|
|
|
@@ -251,7 +254,7 @@ BUAYAR_WEBHOOK_SECRET=whsec_...
|
|
|
251
254
|
|
|
252
255
|
#### Universal (Direkomendasikan)
|
|
253
256
|
```env
|
|
254
|
-
# (opsional) Provider aktif (
|
|
257
|
+
# (opsional) Provider aktif (20 pilihan). Bila kosong, AUTO-DIDETEKSI
|
|
255
258
|
# dari kredensial yang terisi. Set var ini sama untuk semua provider.
|
|
256
259
|
BUAYAR_PROVIDER=midtrans
|
|
257
260
|
|
|
@@ -292,6 +295,7 @@ Anda **tidak perlu** membuat nama variabel khusus per provider. Cukup gunakan se
|
|
|
292
295
|
| **PayU** | `payu` | MD5 Key | POS ID | POS ID |
|
|
293
296
|
| **Braintree** | `braintree` | Private Key | Merchant ID | Public Key |
|
|
294
297
|
| **2Checkout** | `twocheckout` | Secret Key | Merchant Code | Secret Word (`BUAYAR_WEBHOOK_SECRET`) |
|
|
298
|
+
| **[SumoPod](docs/sumopod.md)** | `sumopod` | API Key (`X-Api-Key`) | *(tidak perlu)* | Webhook Secret (`BUAYAR_WEBHOOK_SECRET`) / Token (`BUAYAR_WEBHOOK_TOKEN`) |
|
|
295
299
|
|
|
296
300
|
### 📖 Panduan Penggunaan
|
|
297
301
|
|
package/dist/cli/index.js
CHANGED
|
@@ -37,7 +37,7 @@ var DOT_ENV_TEMPLATE = `# \u2500\u2500 @crediblemark/buayar \xB7 Konfigurasi \u2
|
|
|
37
37
|
# (opsional) Nama provider aktif. Bila dikosongkan, otomatis dideteksi.
|
|
38
38
|
# midtrans | duitku | ipaymu | xendit | doku | prismalink | faspay | finpay
|
|
39
39
|
# nicepay | oy | stripe | paypal | adyen | checkoutcom | razorpay | square
|
|
40
|
-
# payu | braintree | twocheckout
|
|
40
|
+
# payu | braintree | twocheckout | sumopod
|
|
41
41
|
# BUAYAR_PROVIDER=midtrans
|
|
42
42
|
|
|
43
43
|
# Kredensial Universal \u2014 dipetakan otomatis sesuai provider aktif.
|
|
@@ -100,6 +100,9 @@ BUAYAR_RETURN_URL=http://localhost:3000/payment/success
|
|
|
100
100
|
# TWOCHECKOUT_MERCHANT_CODE=
|
|
101
101
|
# TWOCHECKOUT_SECRET_KEY=
|
|
102
102
|
# TWOCHECKOUT_SECRET_WORD=
|
|
103
|
+
# SUMOPOD_API_KEY=
|
|
104
|
+
# SUMOPOD_WEBHOOK_SECRET=
|
|
105
|
+
# SUMOPOD_WEBHOOK_TOKEN=
|
|
103
106
|
`;
|
|
104
107
|
var CONFIG_TEMPLATE = `// src/payment/buayar.ts
|
|
105
108
|
// Inisialisasi Buayar \u2014 baca otomatis dari process.env (.env)
|
|
@@ -365,7 +368,8 @@ var PROVIDERS = [
|
|
|
365
368
|
"square",
|
|
366
369
|
"payu",
|
|
367
370
|
"braintree",
|
|
368
|
-
"twocheckout"
|
|
371
|
+
"twocheckout",
|
|
372
|
+
"sumopod"
|
|
369
373
|
];
|
|
370
374
|
var FRAMEWORKS = ["express", "hono", "nextjs"];
|
|
371
375
|
function getRouteTemplate(framework) {
|
|
@@ -484,7 +488,7 @@ function printScaffoldSummary(result) {
|
|
|
484
488
|
}
|
|
485
489
|
|
|
486
490
|
// src/cli/index.ts
|
|
487
|
-
var VERSION = "0.8.
|
|
491
|
+
var VERSION = "0.8.7";
|
|
488
492
|
function parseArgs(argv) {
|
|
489
493
|
const flags = [];
|
|
490
494
|
const rest = [];
|
package/dist/index.d.mts
CHANGED
|
@@ -139,8 +139,12 @@ interface VerifyCallbackResult {
|
|
|
139
139
|
transactionTime?: Date | string;
|
|
140
140
|
/** Raw payload callback asli dari webhook */
|
|
141
141
|
rawPayload: any;
|
|
142
|
+
/** Pesan error jika verifikasi callback gagal */
|
|
143
|
+
error?: string;
|
|
142
144
|
}
|
|
143
145
|
interface ProviderConfig {
|
|
146
|
+
/** Nama provider target (opsional, jika ingin override per panggilan fungsi) */
|
|
147
|
+
provider?: string;
|
|
144
148
|
merchantCode?: string;
|
|
145
149
|
apiKey?: string;
|
|
146
150
|
sandbox?: boolean;
|
|
@@ -200,6 +204,8 @@ interface PaymentMethod {
|
|
|
200
204
|
category: "Virtual Account" | "QRIS" | "E-Wallet" | "Retail / Gerai" | "Kartu Kredit" | "Paylater / Cicilan" | "Lainnya" | string;
|
|
201
205
|
code?: string;
|
|
202
206
|
extra?: any;
|
|
207
|
+
/** Tandai channel sebagai coming soon / belum tersedia */
|
|
208
|
+
coming_soon?: boolean;
|
|
203
209
|
feeDetail?: {
|
|
204
210
|
flat: number;
|
|
205
211
|
percent: number;
|
|
@@ -250,7 +256,13 @@ interface GetPaymentMethodDescriptorsResult {
|
|
|
250
256
|
generatedAt: string;
|
|
251
257
|
}
|
|
252
258
|
interface CheckTransactionParams {
|
|
253
|
-
/**
|
|
259
|
+
/**
|
|
260
|
+
* ID transaksi untuk pengecekan status.
|
|
261
|
+
*
|
|
262
|
+
* **iPaymu:** Harus berisi `TransactionId` numerik dari response `createInvoice`
|
|
263
|
+
* (`invoice.reference`), BUKAN `orderId`/`order_number` merchant.
|
|
264
|
+
* Endpoint iPaymu `/api/v2/transaction` hanya menerima ID numerik milik iPaymu.
|
|
265
|
+
*/
|
|
254
266
|
merchantOrderId: string;
|
|
255
267
|
}
|
|
256
268
|
interface CheckTransactionResult {
|
|
@@ -419,6 +431,11 @@ declare class IpaymuProvider extends BasePaymentProvider {
|
|
|
419
431
|
createInvoice(params: CreateInvoiceParams, config: ProviderConfig): Promise<InvoiceResponse>;
|
|
420
432
|
verifyCallback(body: any, config: ProviderConfig): Promise<VerifyCallbackResult>;
|
|
421
433
|
getPaymentMethods(params: GetPaymentMethodsParams, config: ProviderConfig): Promise<GetPaymentMethodsResult>;
|
|
434
|
+
probePaymentMethods(config: ProviderConfig): Promise<{
|
|
435
|
+
success: boolean;
|
|
436
|
+
enabled: string[];
|
|
437
|
+
error?: string;
|
|
438
|
+
}>;
|
|
422
439
|
checkTransaction(params: CheckTransactionParams, config: ProviderConfig): Promise<CheckTransactionResult>;
|
|
423
440
|
}
|
|
424
441
|
|
|
@@ -428,6 +445,11 @@ declare class XenditProvider extends BasePaymentProvider {
|
|
|
428
445
|
createInvoice(params: CreateInvoiceParams, config: ProviderConfig): Promise<InvoiceResponse>;
|
|
429
446
|
verifyCallback(body: any, config: ProviderConfig): Promise<VerifyCallbackResult>;
|
|
430
447
|
getPaymentMethods(params: GetPaymentMethodsParams, config: ProviderConfig): Promise<GetPaymentMethodsResult>;
|
|
448
|
+
probePaymentMethods(config: ProviderConfig): Promise<{
|
|
449
|
+
success: boolean;
|
|
450
|
+
enabled: string[];
|
|
451
|
+
error?: string;
|
|
452
|
+
}>;
|
|
431
453
|
checkTransaction(params: CheckTransactionParams, config: ProviderConfig): Promise<CheckTransactionResult>;
|
|
432
454
|
}
|
|
433
455
|
|
|
@@ -603,6 +625,15 @@ declare class TwoCheckoutProvider extends BasePaymentProvider {
|
|
|
603
625
|
checkTransaction(params: CheckTransactionParams, config: ProviderConfig): Promise<CheckTransactionResult>;
|
|
604
626
|
}
|
|
605
627
|
|
|
628
|
+
declare class SumopodProvider extends BasePaymentProvider {
|
|
629
|
+
readonly name = "sumopod";
|
|
630
|
+
private getBaseUrl;
|
|
631
|
+
createInvoice(params: CreateInvoiceParams, config: ProviderConfig): Promise<InvoiceResponse>;
|
|
632
|
+
verifyCallback(body: any, config: ProviderConfig): Promise<VerifyCallbackResult>;
|
|
633
|
+
getPaymentMethods(params: GetPaymentMethodsParams, config: ProviderConfig): Promise<GetPaymentMethodsResult>;
|
|
634
|
+
checkTransaction(params: CheckTransactionParams, config: ProviderConfig): Promise<CheckTransactionResult>;
|
|
635
|
+
}
|
|
636
|
+
|
|
606
637
|
interface DuitkuDisbursementParams {
|
|
607
638
|
bankCode: string;
|
|
608
639
|
bankAccount: string;
|
|
@@ -1158,6 +1189,49 @@ declare class TwoCheckoutClient {
|
|
|
1158
1189
|
listOrders(page?: number, limit?: number): Promise<any>;
|
|
1159
1190
|
}
|
|
1160
1191
|
|
|
1192
|
+
interface SumopodCreatePaymentParams {
|
|
1193
|
+
order_id: string;
|
|
1194
|
+
amount: number;
|
|
1195
|
+
currency?: string;
|
|
1196
|
+
expires_in_hours?: number;
|
|
1197
|
+
success_return_url?: string;
|
|
1198
|
+
cancel_return_url?: string;
|
|
1199
|
+
payment_method_type_code?: string;
|
|
1200
|
+
[key: string]: any;
|
|
1201
|
+
}
|
|
1202
|
+
interface SumopodPaymentResponse {
|
|
1203
|
+
payment_id: string;
|
|
1204
|
+
order_id: string;
|
|
1205
|
+
amount: number;
|
|
1206
|
+
fee?: number;
|
|
1207
|
+
net_amount?: number;
|
|
1208
|
+
payment_link_url: string;
|
|
1209
|
+
status: string;
|
|
1210
|
+
expires_at?: string;
|
|
1211
|
+
[key: string]: any;
|
|
1212
|
+
}
|
|
1213
|
+
declare class SumopodClient {
|
|
1214
|
+
private apiKey;
|
|
1215
|
+
private baseUrl;
|
|
1216
|
+
constructor(config: ProviderConfig | {
|
|
1217
|
+
apiKey?: string;
|
|
1218
|
+
customBaseUrl?: string;
|
|
1219
|
+
sandbox?: boolean;
|
|
1220
|
+
});
|
|
1221
|
+
/**
|
|
1222
|
+
* HTTP request helper dengan header autentikasi X-Api-Key SumoPod
|
|
1223
|
+
*/
|
|
1224
|
+
request(method: "GET" | "POST", endpoint: string, body?: any): Promise<any>;
|
|
1225
|
+
/**
|
|
1226
|
+
* Buat payment link / sesi pembayaran baru di SumoPod
|
|
1227
|
+
*/
|
|
1228
|
+
createPayment(params: SumopodCreatePaymentParams): Promise<SumopodPaymentResponse>;
|
|
1229
|
+
/**
|
|
1230
|
+
* Ambil detail status pembayaran berdasarkan ID pembayaran
|
|
1231
|
+
*/
|
|
1232
|
+
getPayment(paymentId: string): Promise<SumopodPaymentResponse>;
|
|
1233
|
+
}
|
|
1234
|
+
|
|
1161
1235
|
declare class PaymentManager {
|
|
1162
1236
|
private providers;
|
|
1163
1237
|
constructor();
|
|
@@ -1201,6 +1275,8 @@ declare class PaymentManager {
|
|
|
1201
1275
|
getBraintreeClient(config: ProviderConfig): BraintreeClient;
|
|
1202
1276
|
getTwoCheckoutProvider(): TwoCheckoutProvider;
|
|
1203
1277
|
getTwoCheckoutClient(config: ProviderConfig): TwoCheckoutClient;
|
|
1278
|
+
getSumopodProvider(): SumopodProvider;
|
|
1279
|
+
getSumopodClient(config: ProviderConfig): SumopodClient;
|
|
1204
1280
|
createInvoice(providerName: string, params: CreateInvoiceParams, config: ProviderConfig): Promise<InvoiceResponse>;
|
|
1205
1281
|
verifyCallback(providerName: string, body: any, config: ProviderConfig): Promise<VerifyCallbackResult>;
|
|
1206
1282
|
getPaymentMethods(providerName: string, params: GetPaymentMethodsParams, config: ProviderConfig): Promise<GetPaymentMethodsResult>;
|
|
@@ -1255,10 +1331,10 @@ declare class ProviderRegistry {
|
|
|
1255
1331
|
*/
|
|
1256
1332
|
detectFromEnv(env: Record<string, string | undefined>): string | undefined;
|
|
1257
1333
|
/**
|
|
1258
|
-
* Autodetect provider dari struktur payload webhook.
|
|
1334
|
+
* Autodetect provider dari struktur payload webhook dan header.
|
|
1259
1335
|
* Mengembalikan nama provider jika dikenali, else undefined.
|
|
1260
1336
|
*/
|
|
1261
|
-
detectFromWebhook(payload: any): string | undefined;
|
|
1337
|
+
detectFromWebhook(payload: any, headers?: Record<string, any>): string | undefined;
|
|
1262
1338
|
}
|
|
1263
1339
|
declare function buildDefaultDescriptors(): ProviderDescriptor[];
|
|
1264
1340
|
declare const providerRegistry: ProviderRegistry;
|
|
@@ -1271,9 +1347,9 @@ declare function resolveConfigFromEnv(customConfig?: BuayarConfig): BuayarConfig
|
|
|
1271
1347
|
* Antarmuka tingkat tinggi untuk membuat transaksi, query channel pembayaran,
|
|
1272
1348
|
* pengecekan status, dan verifikasi webhook universal tanpa perlu rombak kode.
|
|
1273
1349
|
*
|
|
1274
|
-
* Mendukung
|
|
1350
|
+
* Mendukung 20 Payment Gateway: Midtrans, Duitku, iPaymu, Xendit, DOKU, PrismaLink,
|
|
1275
1351
|
* Faspay, Finpay, Nicepay, OY! Bisnis, Stripe, PayPal, Adyen, Checkout.com,
|
|
1276
|
-
* Razorpay, Square, PayU, Braintree, 2Checkout/Verifone.
|
|
1352
|
+
* Razorpay, Square, PayU, Braintree, 2Checkout/Verifone, SumoPod.
|
|
1277
1353
|
*/
|
|
1278
1354
|
declare class Buayar {
|
|
1279
1355
|
private manager;
|
|
@@ -1315,9 +1391,9 @@ declare class Buayar {
|
|
|
1315
1391
|
*/
|
|
1316
1392
|
getCapabilities(name?: string): ProviderCapability | undefined;
|
|
1317
1393
|
/**
|
|
1318
|
-
* Deteksi nama provider dari struktur payload webhook.
|
|
1394
|
+
* Deteksi nama provider dari struktur payload webhook dan opsional headers.
|
|
1319
1395
|
*/
|
|
1320
|
-
detectProviderFromPayload(payload: any): string | undefined;
|
|
1396
|
+
detectProviderFromPayload(payload: any, headers?: Record<string, string | string[] | undefined>): string | undefined;
|
|
1321
1397
|
/**
|
|
1322
1398
|
* Deteksi nama provider aktif dari variabel lingkungan (kredensial yang terisi).
|
|
1323
1399
|
*/
|
|
@@ -1360,6 +1436,14 @@ declare class Buayar {
|
|
|
1360
1436
|
*/
|
|
1361
1437
|
verifyWebhook(payload: any, headers?: Record<string, string | string[] | undefined>, configOverride?: Partial<ProviderConfig>): Promise<VerifyCallbackResult>;
|
|
1362
1438
|
handleWebhook(payload: any, headers?: Record<string, string | string[] | undefined>, configOverride?: Partial<ProviderConfig>): Promise<VerifyCallbackResult>;
|
|
1439
|
+
/**
|
|
1440
|
+
* Probe payment methods yang benar-benar aktif di akun merchant gateway.
|
|
1441
|
+
*/
|
|
1442
|
+
probePaymentMethods(configOverride?: Partial<ProviderConfig>): Promise<{
|
|
1443
|
+
success: boolean;
|
|
1444
|
+
enabled: string[];
|
|
1445
|
+
error?: string;
|
|
1446
|
+
}>;
|
|
1363
1447
|
/**
|
|
1364
1448
|
* Unified Refund — berlaku untuk semua provider yang mendukung refund.
|
|
1365
1449
|
* Provider tanpa fitur refund mengembalikan `{ supported: false }`, bukan error.
|
|
@@ -1394,6 +1478,7 @@ declare class Buayar {
|
|
|
1394
1478
|
getPayuClient(configOverride?: Partial<ProviderConfig>): PayuClient;
|
|
1395
1479
|
getBraintreeClient(configOverride?: Partial<ProviderConfig>): BraintreeClient;
|
|
1396
1480
|
getTwoCheckoutClient(configOverride?: Partial<ProviderConfig>): TwoCheckoutClient;
|
|
1481
|
+
getSumopodClient(configOverride?: Partial<ProviderConfig>): SumopodClient;
|
|
1397
1482
|
}
|
|
1398
1483
|
declare const buayar: Buayar;
|
|
1399
1484
|
|
|
@@ -1524,6 +1609,18 @@ declare function toOyPaymentMethod(code?: string): {
|
|
|
1524
1609
|
* Ubah method code apapun ke format Stripe
|
|
1525
1610
|
*/
|
|
1526
1611
|
declare function toStripePaymentMethod(code?: string): string | undefined;
|
|
1612
|
+
/**
|
|
1613
|
+
* Mapping dari Canonical Payment Method ke kode SumoPod
|
|
1614
|
+
*/
|
|
1615
|
+
declare const CANONICAL_TO_SUMOPOD: Record<string, string>;
|
|
1616
|
+
/**
|
|
1617
|
+
* Mapping dari kode SumoPod ke Canonical Payment Method
|
|
1618
|
+
*/
|
|
1619
|
+
declare const SUMOPOD_TO_CANONICAL: Record<string, string>;
|
|
1620
|
+
/**
|
|
1621
|
+
* Ubah method code apapun ke format SumoPod
|
|
1622
|
+
*/
|
|
1623
|
+
declare function toSumopodPaymentMethod(code?: string): string | undefined;
|
|
1527
1624
|
/**
|
|
1528
1625
|
* Ubah method code apapun ke format canonical standar Buayar
|
|
1529
1626
|
*/
|
|
@@ -1766,6 +1863,33 @@ declare function generateOyHeaders(username: string, apiKey: string): Record<str
|
|
|
1766
1863
|
*/
|
|
1767
1864
|
declare function verifyOyWebhook(headers: Record<string, string | string[] | undefined>, expectedUsername: string): boolean;
|
|
1768
1865
|
|
|
1866
|
+
/**
|
|
1867
|
+
* Memverifikasi signature webhook Svix dari SumoPod.
|
|
1868
|
+
*
|
|
1869
|
+
* SumoPod menyertakan tiga header HTTP:
|
|
1870
|
+
* - `svix-id`: ID unik pesan webhook
|
|
1871
|
+
* - `svix-timestamp`: Unix timestamp (detik) saat webhook dikirim
|
|
1872
|
+
* - `svix-signature`: Satu atau lebih signature "v1,<base64>" dipisahkan spasi
|
|
1873
|
+
*
|
|
1874
|
+
* @param secret Secret signing dari tab Settings (dimulai dengan "whsec_")
|
|
1875
|
+
* @param svixId Nilai header `svix-id`
|
|
1876
|
+
* @param svixTimestamp Nilai header `svix-timestamp`
|
|
1877
|
+
* @param svixSignature Nilai header `svix-signature`
|
|
1878
|
+
* @param rawBody Request body mentah / unparsed string
|
|
1879
|
+
* @param toleranceSeconds Toleransi replay attack dalam detik (default 300 detik = 5 menit). Set 0 untuk nonaktifkan.
|
|
1880
|
+
*/
|
|
1881
|
+
declare function verifySumopodSvixSignature(secret: string, svixId: string, svixTimestamp: string, svixSignature: string, rawBody: string, toleranceSeconds?: number): boolean;
|
|
1882
|
+
/**
|
|
1883
|
+
* Memverifikasi header `x-webhook-token` SumoPod secara timing-safe.
|
|
1884
|
+
*
|
|
1885
|
+
* Alternatif yang lebih sederhana dari verifikasi signature HMAC:
|
|
1886
|
+
* bandingkan token proyek langsung dengan header `x-webhook-token`.
|
|
1887
|
+
*
|
|
1888
|
+
* @param expectedToken Token rahasia webhook (mis. "whtok_...")
|
|
1889
|
+
* @param receivedToken Nilai header `x-webhook-token` yang diterima
|
|
1890
|
+
*/
|
|
1891
|
+
declare function verifySumopodToken(expectedToken: string, receivedToken: string): boolean;
|
|
1892
|
+
|
|
1769
1893
|
/**
|
|
1770
1894
|
* Serializer helper untuk format URL-encoded form data Stripe
|
|
1771
1895
|
* Mendukung nested object dan array seperti line_items[0][price_data][unit_amount]
|
|
@@ -1953,4 +2077,4 @@ declare function safeCompare(a: string, b: string): boolean;
|
|
|
1953
2077
|
*/
|
|
1954
2078
|
declare function getPaymentMethodCategory(code: string, name?: string): "Virtual Account" | "QRIS" | "E-Wallet" | "Retail / Gerai" | "Kartu Kredit" | "Paylater / Cicilan" | "Lainnya";
|
|
1955
2079
|
|
|
1956
|
-
export { AdyenClient, AdyenProvider, BasePaymentProvider, BraintreeClient, BraintreeProvider, 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 CheckBalanceResult, type CheckTransactionParams, type CheckTransactionResult, CheckoutComClient, CheckoutComProvider, type CreateInvoiceParams, type CustomerDetails, DUITKU_TO_CANONICAL, type DisburseParams, type DisburseResult, DokuClient, DokuProvider, DuitkuClient, type DuitkuDisbursementParams, DuitkuProvider, type EWalletResponse, FaspayClient, FaspayProvider, FinpayClient, FinpayProvider, type GetPaymentMethodDescriptorsResult, 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 PaymentMethodDescriptor, type PaymentMethodDescriptorType, type PaymentMethodItem, type PaymentMode, PaypalClient, PaypalProvider, PayuClient, PayuProvider, PrismalinkClient, PrismalinkProvider, type ProviderCapability, type ProviderConfig, type ProviderDescriptor, ProviderRegistry, type QrisResponse, RazorpayClient, RazorpayProvider, type RefundParams, type RefundResult, SnapApiError, SnapClient, type SnapClientOptions, SquareClient, SquareProvider, StripeClient, StripeProvider, TwoCheckoutClient, TwoCheckoutProvider, type VerifyCallbackResult, type VirtualAccountResponse, XenditClient, type XenditDisbursementParams, XenditProvider, buayar, buildBraintreeBasicAuth, buildCoreChargePayload, buildDefaultDescriptors, buildIpaymuCallbackString, buildPaymentMethodDescriptor, buildPaymentMethodDescriptors, buildPaypalBasicAuth, buildPayuBasicAuth, buildRazorpayBasicAuth, buildTwoCheckoutAuth, formatNicepayTimestamp, generateDokuHeaders, generateFaspaySignature, generateFinpaySignature, generateIpaymuSignature, generateNicepayToken, generateOyHeaders, generatePrismalinkSignature, generateSnapAsymmetricSignature, generateSnapSymmetricSignature, getDuitkuInquirySignatures, getDuitkuPaymentMethodsSignature, getDuitkuStatusSignatures, getPaymentMethodCategory, getXenditAuthHeader, hmacSha256, mapCategoryToDescriptorType, md5, minifyJson, normalizeIpaymuCallback, parseCoreChargeResponse, paymentManager, providerRegistry, resolveConfigFromEnv, safeCompare, serializePaypalParams, serializeStripeParams, sha256, sha256Hex, sha512, snapErrorHint, snapExternalId, snapTimestamp, snapUtcTimestamp, toCanonicalPaymentMethod, toDokuPaymentMethod, toDuitkuPaymentMethod, toFaspayPaymentMethod, toFinpayPaymentMethod, toIpaymuPaymentMethod, toNicepayPaymentMethod, toOyPaymentMethod, toPrismalinkPaymentMethod, toStripePaymentMethod, toXenditPaymentMethod, verifyAdyenWebhook, verifyBraintreeWebhook, verifyCheckoutComWebhook, verifyDokuWebhookSignature, verifyDuitkuCallbackSignature, verifyFaspaySignature, verifyFinpaySignature, verifyIpaymuCallback, verifyIpaymuCallbackSignature, verifyNicepayWebhook, verifyOyWebhook, verifyPaypalWebhookSimple, verifyPayuWebhook, verifyPrismalinkSignature, verifyRazorpayWebhook, verifySnapWebhookSignature, verifySquareWebhook, verifyStripeWebhook, verifyTwoCheckoutWebhook, verifyXenditWebhookToken };
|
|
2080
|
+
export { AdyenClient, AdyenProvider, BasePaymentProvider, BraintreeClient, BraintreeProvider, 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_SUMOPOD, CANONICAL_TO_XENDIT, CORE_API_METHODS, type CanonicalPaymentMethod, type CheckBalanceResult, type CheckTransactionParams, type CheckTransactionResult, CheckoutComClient, CheckoutComProvider, type CreateInvoiceParams, type CustomerDetails, DUITKU_TO_CANONICAL, type DisburseParams, type DisburseResult, DokuClient, DokuProvider, DuitkuClient, type DuitkuDisbursementParams, DuitkuProvider, type EWalletResponse, FaspayClient, FaspayProvider, FinpayClient, FinpayProvider, type GetPaymentMethodDescriptorsResult, 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 PaymentMethodDescriptor, type PaymentMethodDescriptorType, type PaymentMethodItem, type PaymentMode, PaypalClient, PaypalProvider, PayuClient, PayuProvider, PrismalinkClient, PrismalinkProvider, type ProviderCapability, type ProviderConfig, type ProviderDescriptor, ProviderRegistry, type QrisResponse, RazorpayClient, RazorpayProvider, type RefundParams, type RefundResult, SUMOPOD_TO_CANONICAL, SnapApiError, SnapClient, type SnapClientOptions, SquareClient, SquareProvider, StripeClient, StripeProvider, SumopodClient, type SumopodCreatePaymentParams, type SumopodPaymentResponse, SumopodProvider, TwoCheckoutClient, TwoCheckoutProvider, type VerifyCallbackResult, type VirtualAccountResponse, XenditClient, type XenditDisbursementParams, XenditProvider, buayar, buildBraintreeBasicAuth, buildCoreChargePayload, buildDefaultDescriptors, buildIpaymuCallbackString, buildPaymentMethodDescriptor, buildPaymentMethodDescriptors, buildPaypalBasicAuth, buildPayuBasicAuth, buildRazorpayBasicAuth, buildTwoCheckoutAuth, formatNicepayTimestamp, generateDokuHeaders, generateFaspaySignature, generateFinpaySignature, generateIpaymuSignature, generateNicepayToken, generateOyHeaders, generatePrismalinkSignature, generateSnapAsymmetricSignature, generateSnapSymmetricSignature, getDuitkuInquirySignatures, getDuitkuPaymentMethodsSignature, getDuitkuStatusSignatures, getPaymentMethodCategory, getXenditAuthHeader, hmacSha256, mapCategoryToDescriptorType, md5, minifyJson, normalizeIpaymuCallback, parseCoreChargeResponse, paymentManager, providerRegistry, resolveConfigFromEnv, safeCompare, serializePaypalParams, serializeStripeParams, sha256, sha256Hex, sha512, snapErrorHint, snapExternalId, snapTimestamp, snapUtcTimestamp, toCanonicalPaymentMethod, toDokuPaymentMethod, toDuitkuPaymentMethod, toFaspayPaymentMethod, toFinpayPaymentMethod, toIpaymuPaymentMethod, toNicepayPaymentMethod, toOyPaymentMethod, toPrismalinkPaymentMethod, toStripePaymentMethod, toSumopodPaymentMethod, toXenditPaymentMethod, verifyAdyenWebhook, verifyBraintreeWebhook, verifyCheckoutComWebhook, verifyDokuWebhookSignature, verifyDuitkuCallbackSignature, verifyFaspaySignature, verifyFinpaySignature, verifyIpaymuCallback, verifyIpaymuCallbackSignature, verifyNicepayWebhook, verifyOyWebhook, verifyPaypalWebhookSimple, verifyPayuWebhook, verifyPrismalinkSignature, verifyRazorpayWebhook, verifySnapWebhookSignature, verifySquareWebhook, verifyStripeWebhook, verifySumopodSvixSignature, verifySumopodToken, verifyTwoCheckoutWebhook, verifyXenditWebhookToken };
|
package/dist/index.d.ts
CHANGED
|
@@ -139,8 +139,12 @@ interface VerifyCallbackResult {
|
|
|
139
139
|
transactionTime?: Date | string;
|
|
140
140
|
/** Raw payload callback asli dari webhook */
|
|
141
141
|
rawPayload: any;
|
|
142
|
+
/** Pesan error jika verifikasi callback gagal */
|
|
143
|
+
error?: string;
|
|
142
144
|
}
|
|
143
145
|
interface ProviderConfig {
|
|
146
|
+
/** Nama provider target (opsional, jika ingin override per panggilan fungsi) */
|
|
147
|
+
provider?: string;
|
|
144
148
|
merchantCode?: string;
|
|
145
149
|
apiKey?: string;
|
|
146
150
|
sandbox?: boolean;
|
|
@@ -200,6 +204,8 @@ interface PaymentMethod {
|
|
|
200
204
|
category: "Virtual Account" | "QRIS" | "E-Wallet" | "Retail / Gerai" | "Kartu Kredit" | "Paylater / Cicilan" | "Lainnya" | string;
|
|
201
205
|
code?: string;
|
|
202
206
|
extra?: any;
|
|
207
|
+
/** Tandai channel sebagai coming soon / belum tersedia */
|
|
208
|
+
coming_soon?: boolean;
|
|
203
209
|
feeDetail?: {
|
|
204
210
|
flat: number;
|
|
205
211
|
percent: number;
|
|
@@ -250,7 +256,13 @@ interface GetPaymentMethodDescriptorsResult {
|
|
|
250
256
|
generatedAt: string;
|
|
251
257
|
}
|
|
252
258
|
interface CheckTransactionParams {
|
|
253
|
-
/**
|
|
259
|
+
/**
|
|
260
|
+
* ID transaksi untuk pengecekan status.
|
|
261
|
+
*
|
|
262
|
+
* **iPaymu:** Harus berisi `TransactionId` numerik dari response `createInvoice`
|
|
263
|
+
* (`invoice.reference`), BUKAN `orderId`/`order_number` merchant.
|
|
264
|
+
* Endpoint iPaymu `/api/v2/transaction` hanya menerima ID numerik milik iPaymu.
|
|
265
|
+
*/
|
|
254
266
|
merchantOrderId: string;
|
|
255
267
|
}
|
|
256
268
|
interface CheckTransactionResult {
|
|
@@ -419,6 +431,11 @@ declare class IpaymuProvider extends BasePaymentProvider {
|
|
|
419
431
|
createInvoice(params: CreateInvoiceParams, config: ProviderConfig): Promise<InvoiceResponse>;
|
|
420
432
|
verifyCallback(body: any, config: ProviderConfig): Promise<VerifyCallbackResult>;
|
|
421
433
|
getPaymentMethods(params: GetPaymentMethodsParams, config: ProviderConfig): Promise<GetPaymentMethodsResult>;
|
|
434
|
+
probePaymentMethods(config: ProviderConfig): Promise<{
|
|
435
|
+
success: boolean;
|
|
436
|
+
enabled: string[];
|
|
437
|
+
error?: string;
|
|
438
|
+
}>;
|
|
422
439
|
checkTransaction(params: CheckTransactionParams, config: ProviderConfig): Promise<CheckTransactionResult>;
|
|
423
440
|
}
|
|
424
441
|
|
|
@@ -428,6 +445,11 @@ declare class XenditProvider extends BasePaymentProvider {
|
|
|
428
445
|
createInvoice(params: CreateInvoiceParams, config: ProviderConfig): Promise<InvoiceResponse>;
|
|
429
446
|
verifyCallback(body: any, config: ProviderConfig): Promise<VerifyCallbackResult>;
|
|
430
447
|
getPaymentMethods(params: GetPaymentMethodsParams, config: ProviderConfig): Promise<GetPaymentMethodsResult>;
|
|
448
|
+
probePaymentMethods(config: ProviderConfig): Promise<{
|
|
449
|
+
success: boolean;
|
|
450
|
+
enabled: string[];
|
|
451
|
+
error?: string;
|
|
452
|
+
}>;
|
|
431
453
|
checkTransaction(params: CheckTransactionParams, config: ProviderConfig): Promise<CheckTransactionResult>;
|
|
432
454
|
}
|
|
433
455
|
|
|
@@ -603,6 +625,15 @@ declare class TwoCheckoutProvider extends BasePaymentProvider {
|
|
|
603
625
|
checkTransaction(params: CheckTransactionParams, config: ProviderConfig): Promise<CheckTransactionResult>;
|
|
604
626
|
}
|
|
605
627
|
|
|
628
|
+
declare class SumopodProvider extends BasePaymentProvider {
|
|
629
|
+
readonly name = "sumopod";
|
|
630
|
+
private getBaseUrl;
|
|
631
|
+
createInvoice(params: CreateInvoiceParams, config: ProviderConfig): Promise<InvoiceResponse>;
|
|
632
|
+
verifyCallback(body: any, config: ProviderConfig): Promise<VerifyCallbackResult>;
|
|
633
|
+
getPaymentMethods(params: GetPaymentMethodsParams, config: ProviderConfig): Promise<GetPaymentMethodsResult>;
|
|
634
|
+
checkTransaction(params: CheckTransactionParams, config: ProviderConfig): Promise<CheckTransactionResult>;
|
|
635
|
+
}
|
|
636
|
+
|
|
606
637
|
interface DuitkuDisbursementParams {
|
|
607
638
|
bankCode: string;
|
|
608
639
|
bankAccount: string;
|
|
@@ -1158,6 +1189,49 @@ declare class TwoCheckoutClient {
|
|
|
1158
1189
|
listOrders(page?: number, limit?: number): Promise<any>;
|
|
1159
1190
|
}
|
|
1160
1191
|
|
|
1192
|
+
interface SumopodCreatePaymentParams {
|
|
1193
|
+
order_id: string;
|
|
1194
|
+
amount: number;
|
|
1195
|
+
currency?: string;
|
|
1196
|
+
expires_in_hours?: number;
|
|
1197
|
+
success_return_url?: string;
|
|
1198
|
+
cancel_return_url?: string;
|
|
1199
|
+
payment_method_type_code?: string;
|
|
1200
|
+
[key: string]: any;
|
|
1201
|
+
}
|
|
1202
|
+
interface SumopodPaymentResponse {
|
|
1203
|
+
payment_id: string;
|
|
1204
|
+
order_id: string;
|
|
1205
|
+
amount: number;
|
|
1206
|
+
fee?: number;
|
|
1207
|
+
net_amount?: number;
|
|
1208
|
+
payment_link_url: string;
|
|
1209
|
+
status: string;
|
|
1210
|
+
expires_at?: string;
|
|
1211
|
+
[key: string]: any;
|
|
1212
|
+
}
|
|
1213
|
+
declare class SumopodClient {
|
|
1214
|
+
private apiKey;
|
|
1215
|
+
private baseUrl;
|
|
1216
|
+
constructor(config: ProviderConfig | {
|
|
1217
|
+
apiKey?: string;
|
|
1218
|
+
customBaseUrl?: string;
|
|
1219
|
+
sandbox?: boolean;
|
|
1220
|
+
});
|
|
1221
|
+
/**
|
|
1222
|
+
* HTTP request helper dengan header autentikasi X-Api-Key SumoPod
|
|
1223
|
+
*/
|
|
1224
|
+
request(method: "GET" | "POST", endpoint: string, body?: any): Promise<any>;
|
|
1225
|
+
/**
|
|
1226
|
+
* Buat payment link / sesi pembayaran baru di SumoPod
|
|
1227
|
+
*/
|
|
1228
|
+
createPayment(params: SumopodCreatePaymentParams): Promise<SumopodPaymentResponse>;
|
|
1229
|
+
/**
|
|
1230
|
+
* Ambil detail status pembayaran berdasarkan ID pembayaran
|
|
1231
|
+
*/
|
|
1232
|
+
getPayment(paymentId: string): Promise<SumopodPaymentResponse>;
|
|
1233
|
+
}
|
|
1234
|
+
|
|
1161
1235
|
declare class PaymentManager {
|
|
1162
1236
|
private providers;
|
|
1163
1237
|
constructor();
|
|
@@ -1201,6 +1275,8 @@ declare class PaymentManager {
|
|
|
1201
1275
|
getBraintreeClient(config: ProviderConfig): BraintreeClient;
|
|
1202
1276
|
getTwoCheckoutProvider(): TwoCheckoutProvider;
|
|
1203
1277
|
getTwoCheckoutClient(config: ProviderConfig): TwoCheckoutClient;
|
|
1278
|
+
getSumopodProvider(): SumopodProvider;
|
|
1279
|
+
getSumopodClient(config: ProviderConfig): SumopodClient;
|
|
1204
1280
|
createInvoice(providerName: string, params: CreateInvoiceParams, config: ProviderConfig): Promise<InvoiceResponse>;
|
|
1205
1281
|
verifyCallback(providerName: string, body: any, config: ProviderConfig): Promise<VerifyCallbackResult>;
|
|
1206
1282
|
getPaymentMethods(providerName: string, params: GetPaymentMethodsParams, config: ProviderConfig): Promise<GetPaymentMethodsResult>;
|
|
@@ -1255,10 +1331,10 @@ declare class ProviderRegistry {
|
|
|
1255
1331
|
*/
|
|
1256
1332
|
detectFromEnv(env: Record<string, string | undefined>): string | undefined;
|
|
1257
1333
|
/**
|
|
1258
|
-
* Autodetect provider dari struktur payload webhook.
|
|
1334
|
+
* Autodetect provider dari struktur payload webhook dan header.
|
|
1259
1335
|
* Mengembalikan nama provider jika dikenali, else undefined.
|
|
1260
1336
|
*/
|
|
1261
|
-
detectFromWebhook(payload: any): string | undefined;
|
|
1337
|
+
detectFromWebhook(payload: any, headers?: Record<string, any>): string | undefined;
|
|
1262
1338
|
}
|
|
1263
1339
|
declare function buildDefaultDescriptors(): ProviderDescriptor[];
|
|
1264
1340
|
declare const providerRegistry: ProviderRegistry;
|
|
@@ -1271,9 +1347,9 @@ declare function resolveConfigFromEnv(customConfig?: BuayarConfig): BuayarConfig
|
|
|
1271
1347
|
* Antarmuka tingkat tinggi untuk membuat transaksi, query channel pembayaran,
|
|
1272
1348
|
* pengecekan status, dan verifikasi webhook universal tanpa perlu rombak kode.
|
|
1273
1349
|
*
|
|
1274
|
-
* Mendukung
|
|
1350
|
+
* Mendukung 20 Payment Gateway: Midtrans, Duitku, iPaymu, Xendit, DOKU, PrismaLink,
|
|
1275
1351
|
* Faspay, Finpay, Nicepay, OY! Bisnis, Stripe, PayPal, Adyen, Checkout.com,
|
|
1276
|
-
* Razorpay, Square, PayU, Braintree, 2Checkout/Verifone.
|
|
1352
|
+
* Razorpay, Square, PayU, Braintree, 2Checkout/Verifone, SumoPod.
|
|
1277
1353
|
*/
|
|
1278
1354
|
declare class Buayar {
|
|
1279
1355
|
private manager;
|
|
@@ -1315,9 +1391,9 @@ declare class Buayar {
|
|
|
1315
1391
|
*/
|
|
1316
1392
|
getCapabilities(name?: string): ProviderCapability | undefined;
|
|
1317
1393
|
/**
|
|
1318
|
-
* Deteksi nama provider dari struktur payload webhook.
|
|
1394
|
+
* Deteksi nama provider dari struktur payload webhook dan opsional headers.
|
|
1319
1395
|
*/
|
|
1320
|
-
detectProviderFromPayload(payload: any): string | undefined;
|
|
1396
|
+
detectProviderFromPayload(payload: any, headers?: Record<string, string | string[] | undefined>): string | undefined;
|
|
1321
1397
|
/**
|
|
1322
1398
|
* Deteksi nama provider aktif dari variabel lingkungan (kredensial yang terisi).
|
|
1323
1399
|
*/
|
|
@@ -1360,6 +1436,14 @@ declare class Buayar {
|
|
|
1360
1436
|
*/
|
|
1361
1437
|
verifyWebhook(payload: any, headers?: Record<string, string | string[] | undefined>, configOverride?: Partial<ProviderConfig>): Promise<VerifyCallbackResult>;
|
|
1362
1438
|
handleWebhook(payload: any, headers?: Record<string, string | string[] | undefined>, configOverride?: Partial<ProviderConfig>): Promise<VerifyCallbackResult>;
|
|
1439
|
+
/**
|
|
1440
|
+
* Probe payment methods yang benar-benar aktif di akun merchant gateway.
|
|
1441
|
+
*/
|
|
1442
|
+
probePaymentMethods(configOverride?: Partial<ProviderConfig>): Promise<{
|
|
1443
|
+
success: boolean;
|
|
1444
|
+
enabled: string[];
|
|
1445
|
+
error?: string;
|
|
1446
|
+
}>;
|
|
1363
1447
|
/**
|
|
1364
1448
|
* Unified Refund — berlaku untuk semua provider yang mendukung refund.
|
|
1365
1449
|
* Provider tanpa fitur refund mengembalikan `{ supported: false }`, bukan error.
|
|
@@ -1394,6 +1478,7 @@ declare class Buayar {
|
|
|
1394
1478
|
getPayuClient(configOverride?: Partial<ProviderConfig>): PayuClient;
|
|
1395
1479
|
getBraintreeClient(configOverride?: Partial<ProviderConfig>): BraintreeClient;
|
|
1396
1480
|
getTwoCheckoutClient(configOverride?: Partial<ProviderConfig>): TwoCheckoutClient;
|
|
1481
|
+
getSumopodClient(configOverride?: Partial<ProviderConfig>): SumopodClient;
|
|
1397
1482
|
}
|
|
1398
1483
|
declare const buayar: Buayar;
|
|
1399
1484
|
|
|
@@ -1524,6 +1609,18 @@ declare function toOyPaymentMethod(code?: string): {
|
|
|
1524
1609
|
* Ubah method code apapun ke format Stripe
|
|
1525
1610
|
*/
|
|
1526
1611
|
declare function toStripePaymentMethod(code?: string): string | undefined;
|
|
1612
|
+
/**
|
|
1613
|
+
* Mapping dari Canonical Payment Method ke kode SumoPod
|
|
1614
|
+
*/
|
|
1615
|
+
declare const CANONICAL_TO_SUMOPOD: Record<string, string>;
|
|
1616
|
+
/**
|
|
1617
|
+
* Mapping dari kode SumoPod ke Canonical Payment Method
|
|
1618
|
+
*/
|
|
1619
|
+
declare const SUMOPOD_TO_CANONICAL: Record<string, string>;
|
|
1620
|
+
/**
|
|
1621
|
+
* Ubah method code apapun ke format SumoPod
|
|
1622
|
+
*/
|
|
1623
|
+
declare function toSumopodPaymentMethod(code?: string): string | undefined;
|
|
1527
1624
|
/**
|
|
1528
1625
|
* Ubah method code apapun ke format canonical standar Buayar
|
|
1529
1626
|
*/
|
|
@@ -1766,6 +1863,33 @@ declare function generateOyHeaders(username: string, apiKey: string): Record<str
|
|
|
1766
1863
|
*/
|
|
1767
1864
|
declare function verifyOyWebhook(headers: Record<string, string | string[] | undefined>, expectedUsername: string): boolean;
|
|
1768
1865
|
|
|
1866
|
+
/**
|
|
1867
|
+
* Memverifikasi signature webhook Svix dari SumoPod.
|
|
1868
|
+
*
|
|
1869
|
+
* SumoPod menyertakan tiga header HTTP:
|
|
1870
|
+
* - `svix-id`: ID unik pesan webhook
|
|
1871
|
+
* - `svix-timestamp`: Unix timestamp (detik) saat webhook dikirim
|
|
1872
|
+
* - `svix-signature`: Satu atau lebih signature "v1,<base64>" dipisahkan spasi
|
|
1873
|
+
*
|
|
1874
|
+
* @param secret Secret signing dari tab Settings (dimulai dengan "whsec_")
|
|
1875
|
+
* @param svixId Nilai header `svix-id`
|
|
1876
|
+
* @param svixTimestamp Nilai header `svix-timestamp`
|
|
1877
|
+
* @param svixSignature Nilai header `svix-signature`
|
|
1878
|
+
* @param rawBody Request body mentah / unparsed string
|
|
1879
|
+
* @param toleranceSeconds Toleransi replay attack dalam detik (default 300 detik = 5 menit). Set 0 untuk nonaktifkan.
|
|
1880
|
+
*/
|
|
1881
|
+
declare function verifySumopodSvixSignature(secret: string, svixId: string, svixTimestamp: string, svixSignature: string, rawBody: string, toleranceSeconds?: number): boolean;
|
|
1882
|
+
/**
|
|
1883
|
+
* Memverifikasi header `x-webhook-token` SumoPod secara timing-safe.
|
|
1884
|
+
*
|
|
1885
|
+
* Alternatif yang lebih sederhana dari verifikasi signature HMAC:
|
|
1886
|
+
* bandingkan token proyek langsung dengan header `x-webhook-token`.
|
|
1887
|
+
*
|
|
1888
|
+
* @param expectedToken Token rahasia webhook (mis. "whtok_...")
|
|
1889
|
+
* @param receivedToken Nilai header `x-webhook-token` yang diterima
|
|
1890
|
+
*/
|
|
1891
|
+
declare function verifySumopodToken(expectedToken: string, receivedToken: string): boolean;
|
|
1892
|
+
|
|
1769
1893
|
/**
|
|
1770
1894
|
* Serializer helper untuk format URL-encoded form data Stripe
|
|
1771
1895
|
* Mendukung nested object dan array seperti line_items[0][price_data][unit_amount]
|
|
@@ -1953,4 +2077,4 @@ declare function safeCompare(a: string, b: string): boolean;
|
|
|
1953
2077
|
*/
|
|
1954
2078
|
declare function getPaymentMethodCategory(code: string, name?: string): "Virtual Account" | "QRIS" | "E-Wallet" | "Retail / Gerai" | "Kartu Kredit" | "Paylater / Cicilan" | "Lainnya";
|
|
1955
2079
|
|
|
1956
|
-
export { AdyenClient, AdyenProvider, BasePaymentProvider, BraintreeClient, BraintreeProvider, 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 CheckBalanceResult, type CheckTransactionParams, type CheckTransactionResult, CheckoutComClient, CheckoutComProvider, type CreateInvoiceParams, type CustomerDetails, DUITKU_TO_CANONICAL, type DisburseParams, type DisburseResult, DokuClient, DokuProvider, DuitkuClient, type DuitkuDisbursementParams, DuitkuProvider, type EWalletResponse, FaspayClient, FaspayProvider, FinpayClient, FinpayProvider, type GetPaymentMethodDescriptorsResult, 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 PaymentMethodDescriptor, type PaymentMethodDescriptorType, type PaymentMethodItem, type PaymentMode, PaypalClient, PaypalProvider, PayuClient, PayuProvider, PrismalinkClient, PrismalinkProvider, type ProviderCapability, type ProviderConfig, type ProviderDescriptor, ProviderRegistry, type QrisResponse, RazorpayClient, RazorpayProvider, type RefundParams, type RefundResult, SnapApiError, SnapClient, type SnapClientOptions, SquareClient, SquareProvider, StripeClient, StripeProvider, TwoCheckoutClient, TwoCheckoutProvider, type VerifyCallbackResult, type VirtualAccountResponse, XenditClient, type XenditDisbursementParams, XenditProvider, buayar, buildBraintreeBasicAuth, buildCoreChargePayload, buildDefaultDescriptors, buildIpaymuCallbackString, buildPaymentMethodDescriptor, buildPaymentMethodDescriptors, buildPaypalBasicAuth, buildPayuBasicAuth, buildRazorpayBasicAuth, buildTwoCheckoutAuth, formatNicepayTimestamp, generateDokuHeaders, generateFaspaySignature, generateFinpaySignature, generateIpaymuSignature, generateNicepayToken, generateOyHeaders, generatePrismalinkSignature, generateSnapAsymmetricSignature, generateSnapSymmetricSignature, getDuitkuInquirySignatures, getDuitkuPaymentMethodsSignature, getDuitkuStatusSignatures, getPaymentMethodCategory, getXenditAuthHeader, hmacSha256, mapCategoryToDescriptorType, md5, minifyJson, normalizeIpaymuCallback, parseCoreChargeResponse, paymentManager, providerRegistry, resolveConfigFromEnv, safeCompare, serializePaypalParams, serializeStripeParams, sha256, sha256Hex, sha512, snapErrorHint, snapExternalId, snapTimestamp, snapUtcTimestamp, toCanonicalPaymentMethod, toDokuPaymentMethod, toDuitkuPaymentMethod, toFaspayPaymentMethod, toFinpayPaymentMethod, toIpaymuPaymentMethod, toNicepayPaymentMethod, toOyPaymentMethod, toPrismalinkPaymentMethod, toStripePaymentMethod, toXenditPaymentMethod, verifyAdyenWebhook, verifyBraintreeWebhook, verifyCheckoutComWebhook, verifyDokuWebhookSignature, verifyDuitkuCallbackSignature, verifyFaspaySignature, verifyFinpaySignature, verifyIpaymuCallback, verifyIpaymuCallbackSignature, verifyNicepayWebhook, verifyOyWebhook, verifyPaypalWebhookSimple, verifyPayuWebhook, verifyPrismalinkSignature, verifyRazorpayWebhook, verifySnapWebhookSignature, verifySquareWebhook, verifyStripeWebhook, verifyTwoCheckoutWebhook, verifyXenditWebhookToken };
|
|
2080
|
+
export { AdyenClient, AdyenProvider, BasePaymentProvider, BraintreeClient, BraintreeProvider, 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_SUMOPOD, CANONICAL_TO_XENDIT, CORE_API_METHODS, type CanonicalPaymentMethod, type CheckBalanceResult, type CheckTransactionParams, type CheckTransactionResult, CheckoutComClient, CheckoutComProvider, type CreateInvoiceParams, type CustomerDetails, DUITKU_TO_CANONICAL, type DisburseParams, type DisburseResult, DokuClient, DokuProvider, DuitkuClient, type DuitkuDisbursementParams, DuitkuProvider, type EWalletResponse, FaspayClient, FaspayProvider, FinpayClient, FinpayProvider, type GetPaymentMethodDescriptorsResult, 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 PaymentMethodDescriptor, type PaymentMethodDescriptorType, type PaymentMethodItem, type PaymentMode, PaypalClient, PaypalProvider, PayuClient, PayuProvider, PrismalinkClient, PrismalinkProvider, type ProviderCapability, type ProviderConfig, type ProviderDescriptor, ProviderRegistry, type QrisResponse, RazorpayClient, RazorpayProvider, type RefundParams, type RefundResult, SUMOPOD_TO_CANONICAL, SnapApiError, SnapClient, type SnapClientOptions, SquareClient, SquareProvider, StripeClient, StripeProvider, SumopodClient, type SumopodCreatePaymentParams, type SumopodPaymentResponse, SumopodProvider, TwoCheckoutClient, TwoCheckoutProvider, type VerifyCallbackResult, type VirtualAccountResponse, XenditClient, type XenditDisbursementParams, XenditProvider, buayar, buildBraintreeBasicAuth, buildCoreChargePayload, buildDefaultDescriptors, buildIpaymuCallbackString, buildPaymentMethodDescriptor, buildPaymentMethodDescriptors, buildPaypalBasicAuth, buildPayuBasicAuth, buildRazorpayBasicAuth, buildTwoCheckoutAuth, formatNicepayTimestamp, generateDokuHeaders, generateFaspaySignature, generateFinpaySignature, generateIpaymuSignature, generateNicepayToken, generateOyHeaders, generatePrismalinkSignature, generateSnapAsymmetricSignature, generateSnapSymmetricSignature, getDuitkuInquirySignatures, getDuitkuPaymentMethodsSignature, getDuitkuStatusSignatures, getPaymentMethodCategory, getXenditAuthHeader, hmacSha256, mapCategoryToDescriptorType, md5, minifyJson, normalizeIpaymuCallback, parseCoreChargeResponse, paymentManager, providerRegistry, resolveConfigFromEnv, safeCompare, serializePaypalParams, serializeStripeParams, sha256, sha256Hex, sha512, snapErrorHint, snapExternalId, snapTimestamp, snapUtcTimestamp, toCanonicalPaymentMethod, toDokuPaymentMethod, toDuitkuPaymentMethod, toFaspayPaymentMethod, toFinpayPaymentMethod, toIpaymuPaymentMethod, toNicepayPaymentMethod, toOyPaymentMethod, toPrismalinkPaymentMethod, toStripePaymentMethod, toSumopodPaymentMethod, toXenditPaymentMethod, verifyAdyenWebhook, verifyBraintreeWebhook, verifyCheckoutComWebhook, verifyDokuWebhookSignature, verifyDuitkuCallbackSignature, verifyFaspaySignature, verifyFinpaySignature, verifyIpaymuCallback, verifyIpaymuCallbackSignature, verifyNicepayWebhook, verifyOyWebhook, verifyPaypalWebhookSimple, verifyPayuWebhook, verifyPrismalinkSignature, verifyRazorpayWebhook, verifySnapWebhookSignature, verifySquareWebhook, verifyStripeWebhook, verifySumopodSvixSignature, verifySumopodToken, verifyTwoCheckoutWebhook, verifyXenditWebhookToken };
|