@crediblemark/buayar 0.8.6 → 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 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 **19 payment providers** (10 Indonesian + 9 International) through a single, consistent API.
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 (10)
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 19 supported names
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 19 registered providers
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 **19 payment provider** (10 Indonesia + 9 Internasional) melalui satu arsitektur API yang seragam.
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 (10)
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 (19 pilihan). Bila kosong, AUTO-DIDETEKSI
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.6";
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
@@ -625,6 +625,15 @@ declare class TwoCheckoutProvider extends BasePaymentProvider {
625
625
  checkTransaction(params: CheckTransactionParams, config: ProviderConfig): Promise<CheckTransactionResult>;
626
626
  }
627
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
+
628
637
  interface DuitkuDisbursementParams {
629
638
  bankCode: string;
630
639
  bankAccount: string;
@@ -1180,6 +1189,49 @@ declare class TwoCheckoutClient {
1180
1189
  listOrders(page?: number, limit?: number): Promise<any>;
1181
1190
  }
1182
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
+
1183
1235
  declare class PaymentManager {
1184
1236
  private providers;
1185
1237
  constructor();
@@ -1223,6 +1275,8 @@ declare class PaymentManager {
1223
1275
  getBraintreeClient(config: ProviderConfig): BraintreeClient;
1224
1276
  getTwoCheckoutProvider(): TwoCheckoutProvider;
1225
1277
  getTwoCheckoutClient(config: ProviderConfig): TwoCheckoutClient;
1278
+ getSumopodProvider(): SumopodProvider;
1279
+ getSumopodClient(config: ProviderConfig): SumopodClient;
1226
1280
  createInvoice(providerName: string, params: CreateInvoiceParams, config: ProviderConfig): Promise<InvoiceResponse>;
1227
1281
  verifyCallback(providerName: string, body: any, config: ProviderConfig): Promise<VerifyCallbackResult>;
1228
1282
  getPaymentMethods(providerName: string, params: GetPaymentMethodsParams, config: ProviderConfig): Promise<GetPaymentMethodsResult>;
@@ -1293,9 +1347,9 @@ declare function resolveConfigFromEnv(customConfig?: BuayarConfig): BuayarConfig
1293
1347
  * Antarmuka tingkat tinggi untuk membuat transaksi, query channel pembayaran,
1294
1348
  * pengecekan status, dan verifikasi webhook universal tanpa perlu rombak kode.
1295
1349
  *
1296
- * Mendukung 19 Payment Gateway: Midtrans, Duitku, iPaymu, Xendit, DOKU, PrismaLink,
1350
+ * Mendukung 20 Payment Gateway: Midtrans, Duitku, iPaymu, Xendit, DOKU, PrismaLink,
1297
1351
  * Faspay, Finpay, Nicepay, OY! Bisnis, Stripe, PayPal, Adyen, Checkout.com,
1298
- * Razorpay, Square, PayU, Braintree, 2Checkout/Verifone.
1352
+ * Razorpay, Square, PayU, Braintree, 2Checkout/Verifone, SumoPod.
1299
1353
  */
1300
1354
  declare class Buayar {
1301
1355
  private manager;
@@ -1424,6 +1478,7 @@ declare class Buayar {
1424
1478
  getPayuClient(configOverride?: Partial<ProviderConfig>): PayuClient;
1425
1479
  getBraintreeClient(configOverride?: Partial<ProviderConfig>): BraintreeClient;
1426
1480
  getTwoCheckoutClient(configOverride?: Partial<ProviderConfig>): TwoCheckoutClient;
1481
+ getSumopodClient(configOverride?: Partial<ProviderConfig>): SumopodClient;
1427
1482
  }
1428
1483
  declare const buayar: Buayar;
1429
1484
 
@@ -1554,6 +1609,18 @@ declare function toOyPaymentMethod(code?: string): {
1554
1609
  * Ubah method code apapun ke format Stripe
1555
1610
  */
1556
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;
1557
1624
  /**
1558
1625
  * Ubah method code apapun ke format canonical standar Buayar
1559
1626
  */
@@ -1796,6 +1863,33 @@ declare function generateOyHeaders(username: string, apiKey: string): Record<str
1796
1863
  */
1797
1864
  declare function verifyOyWebhook(headers: Record<string, string | string[] | undefined>, expectedUsername: string): boolean;
1798
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
+
1799
1893
  /**
1800
1894
  * Serializer helper untuk format URL-encoded form data Stripe
1801
1895
  * Mendukung nested object dan array seperti line_items[0][price_data][unit_amount]
@@ -1983,4 +2077,4 @@ declare function safeCompare(a: string, b: string): boolean;
1983
2077
  */
1984
2078
  declare function getPaymentMethodCategory(code: string, name?: string): "Virtual Account" | "QRIS" | "E-Wallet" | "Retail / Gerai" | "Kartu Kredit" | "Paylater / Cicilan" | "Lainnya";
1985
2079
 
1986
- 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
@@ -625,6 +625,15 @@ declare class TwoCheckoutProvider extends BasePaymentProvider {
625
625
  checkTransaction(params: CheckTransactionParams, config: ProviderConfig): Promise<CheckTransactionResult>;
626
626
  }
627
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
+
628
637
  interface DuitkuDisbursementParams {
629
638
  bankCode: string;
630
639
  bankAccount: string;
@@ -1180,6 +1189,49 @@ declare class TwoCheckoutClient {
1180
1189
  listOrders(page?: number, limit?: number): Promise<any>;
1181
1190
  }
1182
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
+
1183
1235
  declare class PaymentManager {
1184
1236
  private providers;
1185
1237
  constructor();
@@ -1223,6 +1275,8 @@ declare class PaymentManager {
1223
1275
  getBraintreeClient(config: ProviderConfig): BraintreeClient;
1224
1276
  getTwoCheckoutProvider(): TwoCheckoutProvider;
1225
1277
  getTwoCheckoutClient(config: ProviderConfig): TwoCheckoutClient;
1278
+ getSumopodProvider(): SumopodProvider;
1279
+ getSumopodClient(config: ProviderConfig): SumopodClient;
1226
1280
  createInvoice(providerName: string, params: CreateInvoiceParams, config: ProviderConfig): Promise<InvoiceResponse>;
1227
1281
  verifyCallback(providerName: string, body: any, config: ProviderConfig): Promise<VerifyCallbackResult>;
1228
1282
  getPaymentMethods(providerName: string, params: GetPaymentMethodsParams, config: ProviderConfig): Promise<GetPaymentMethodsResult>;
@@ -1293,9 +1347,9 @@ declare function resolveConfigFromEnv(customConfig?: BuayarConfig): BuayarConfig
1293
1347
  * Antarmuka tingkat tinggi untuk membuat transaksi, query channel pembayaran,
1294
1348
  * pengecekan status, dan verifikasi webhook universal tanpa perlu rombak kode.
1295
1349
  *
1296
- * Mendukung 19 Payment Gateway: Midtrans, Duitku, iPaymu, Xendit, DOKU, PrismaLink,
1350
+ * Mendukung 20 Payment Gateway: Midtrans, Duitku, iPaymu, Xendit, DOKU, PrismaLink,
1297
1351
  * Faspay, Finpay, Nicepay, OY! Bisnis, Stripe, PayPal, Adyen, Checkout.com,
1298
- * Razorpay, Square, PayU, Braintree, 2Checkout/Verifone.
1352
+ * Razorpay, Square, PayU, Braintree, 2Checkout/Verifone, SumoPod.
1299
1353
  */
1300
1354
  declare class Buayar {
1301
1355
  private manager;
@@ -1424,6 +1478,7 @@ declare class Buayar {
1424
1478
  getPayuClient(configOverride?: Partial<ProviderConfig>): PayuClient;
1425
1479
  getBraintreeClient(configOverride?: Partial<ProviderConfig>): BraintreeClient;
1426
1480
  getTwoCheckoutClient(configOverride?: Partial<ProviderConfig>): TwoCheckoutClient;
1481
+ getSumopodClient(configOverride?: Partial<ProviderConfig>): SumopodClient;
1427
1482
  }
1428
1483
  declare const buayar: Buayar;
1429
1484
 
@@ -1554,6 +1609,18 @@ declare function toOyPaymentMethod(code?: string): {
1554
1609
  * Ubah method code apapun ke format Stripe
1555
1610
  */
1556
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;
1557
1624
  /**
1558
1625
  * Ubah method code apapun ke format canonical standar Buayar
1559
1626
  */
@@ -1796,6 +1863,33 @@ declare function generateOyHeaders(username: string, apiKey: string): Record<str
1796
1863
  */
1797
1864
  declare function verifyOyWebhook(headers: Record<string, string | string[] | undefined>, expectedUsername: string): boolean;
1798
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
+
1799
1893
  /**
1800
1894
  * Serializer helper untuk format URL-encoded form data Stripe
1801
1895
  * Mendukung nested object dan array seperti line_items[0][price_data][unit_amount]
@@ -1983,4 +2077,4 @@ declare function safeCompare(a: string, b: string): boolean;
1983
2077
  */
1984
2078
  declare function getPaymentMethodCategory(code: string, name?: string): "Virtual Account" | "QRIS" | "E-Wallet" | "Retail / Gerai" | "Kartu Kredit" | "Paylater / Cicilan" | "Lainnya";
1985
2079
 
1986
- 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 };