@crediblemark/buayar 0.8.4 → 0.8.6

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/dist/cli/index.js CHANGED
@@ -484,7 +484,7 @@ function printScaffoldSummary(result) {
484
484
  }
485
485
 
486
486
  // src/cli/index.ts
487
- var VERSION = "0.8.4";
487
+ var VERSION = "0.8.6";
488
488
  function parseArgs(argv) {
489
489
  const flags = [];
490
490
  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;
@@ -216,8 +222,47 @@ interface GetPaymentMethodsResult {
216
222
  error?: string;
217
223
  rawResponse: any;
218
224
  }
225
+ /**
226
+ * Deskriptor saluran pembayaran kanonikal siap-render untuk UI.
227
+ * Dibangun dari {@link PaymentMethod} via `buildPaymentMethodDescriptors()` di
228
+ * `core/descriptor.ts` sehingga konsumen (frontend, snapshot, CLI) selalu
229
+ * mendapat bentuk seragam tanpa perlu mapping ulang per provider.
230
+ */
231
+ interface PaymentMethodDescriptor {
232
+ /** Identifier uppercase yang dipakai sistem internal (mis. 'BCA_VA', 'QRIS', 'GOPAY') */
233
+ id: string;
234
+ /** Nama ramah pengguna */
235
+ name: string;
236
+ /** Tipe singkat untuk icon/badge rendering */
237
+ type: "qris" | "va" | "ewallet" | "retail" | "card" | "paylater" | "other";
238
+ /** Ikon emoji */
239
+ icon: string;
240
+ /** Badge teks (mis. "Instan Bebas Biaya") */
241
+ badge: string;
242
+ /** URL logo (opsional) */
243
+ image?: string;
244
+ /** Kategori resmi Buayar (Virtual Account, QRIS, E-Wallet, dll) */
245
+ category?: string;
246
+ /** Apakah channel tersedia (true) atau coming-soon (false) */
247
+ coming_soon?: boolean;
248
+ /** Fee admin (string deskriptif, mis. "0.7%" atau "IDR 4,000") */
249
+ totalFee?: string;
250
+ }
251
+ interface GetPaymentMethodDescriptorsResult {
252
+ success: boolean;
253
+ provider?: string;
254
+ descriptors: PaymentMethodDescriptor[];
255
+ error?: string;
256
+ generatedAt: string;
257
+ }
219
258
  interface CheckTransactionParams {
220
- /** Merchant order ID saat pembuatan transaksi */
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
+ */
221
266
  merchantOrderId: string;
222
267
  }
223
268
  interface CheckTransactionResult {
@@ -386,6 +431,11 @@ declare class IpaymuProvider extends BasePaymentProvider {
386
431
  createInvoice(params: CreateInvoiceParams, config: ProviderConfig): Promise<InvoiceResponse>;
387
432
  verifyCallback(body: any, config: ProviderConfig): Promise<VerifyCallbackResult>;
388
433
  getPaymentMethods(params: GetPaymentMethodsParams, config: ProviderConfig): Promise<GetPaymentMethodsResult>;
434
+ probePaymentMethods(config: ProviderConfig): Promise<{
435
+ success: boolean;
436
+ enabled: string[];
437
+ error?: string;
438
+ }>;
389
439
  checkTransaction(params: CheckTransactionParams, config: ProviderConfig): Promise<CheckTransactionResult>;
390
440
  }
391
441
 
@@ -395,6 +445,11 @@ declare class XenditProvider extends BasePaymentProvider {
395
445
  createInvoice(params: CreateInvoiceParams, config: ProviderConfig): Promise<InvoiceResponse>;
396
446
  verifyCallback(body: any, config: ProviderConfig): Promise<VerifyCallbackResult>;
397
447
  getPaymentMethods(params: GetPaymentMethodsParams, config: ProviderConfig): Promise<GetPaymentMethodsResult>;
448
+ probePaymentMethods(config: ProviderConfig): Promise<{
449
+ success: boolean;
450
+ enabled: string[];
451
+ error?: string;
452
+ }>;
398
453
  checkTransaction(params: CheckTransactionParams, config: ProviderConfig): Promise<CheckTransactionResult>;
399
454
  }
400
455
 
@@ -1222,10 +1277,10 @@ declare class ProviderRegistry {
1222
1277
  */
1223
1278
  detectFromEnv(env: Record<string, string | undefined>): string | undefined;
1224
1279
  /**
1225
- * Autodetect provider dari struktur payload webhook.
1280
+ * Autodetect provider dari struktur payload webhook dan header.
1226
1281
  * Mengembalikan nama provider jika dikenali, else undefined.
1227
1282
  */
1228
- detectFromWebhook(payload: any): string | undefined;
1283
+ detectFromWebhook(payload: any, headers?: Record<string, any>): string | undefined;
1229
1284
  }
1230
1285
  declare function buildDefaultDescriptors(): ProviderDescriptor[];
1231
1286
  declare const providerRegistry: ProviderRegistry;
@@ -1282,9 +1337,9 @@ declare class Buayar {
1282
1337
  */
1283
1338
  getCapabilities(name?: string): ProviderCapability | undefined;
1284
1339
  /**
1285
- * Deteksi nama provider dari struktur payload webhook.
1340
+ * Deteksi nama provider dari struktur payload webhook dan opsional headers.
1286
1341
  */
1287
- detectProviderFromPayload(payload: any): string | undefined;
1342
+ detectProviderFromPayload(payload: any, headers?: Record<string, string | string[] | undefined>): string | undefined;
1288
1343
  /**
1289
1344
  * Deteksi nama provider aktif dari variabel lingkungan (kredensial yang terisi).
1290
1345
  */
@@ -1309,6 +1364,13 @@ declare class Buayar {
1309
1364
  * Ambil daftar channel pembayaran aktif (Accordion-Ready)
1310
1365
  */
1311
1366
  getPaymentMethods(params?: GetPaymentMethodsParams, configOverride?: Partial<ProviderConfig>): Promise<GetPaymentMethodsResult>;
1367
+ /**
1368
+ * Ambil daftar channel pembayaran aktif dalam bentuk deskriptor kanonikal
1369
+ * siap-render (id, name, type, icon, badge, image, category, totalFee).
1370
+ * Wrapper di atas {@link Buayar.getPaymentMethods} + `buildPaymentMethodDescriptors`,
1371
+ * sehingga konsumen UI/snapshot tidak perlu melakukan mapping ulang per provider.
1372
+ */
1373
+ getPaymentMethodDescriptors(params?: GetPaymentMethodsParams, configOverride?: Partial<ProviderConfig>): Promise<GetPaymentMethodDescriptorsResult>;
1312
1374
  /**
1313
1375
  * Cek status transaksi pembayaran berdasarkan Order ID
1314
1376
  */
@@ -1320,6 +1382,14 @@ declare class Buayar {
1320
1382
  */
1321
1383
  verifyWebhook(payload: any, headers?: Record<string, string | string[] | undefined>, configOverride?: Partial<ProviderConfig>): Promise<VerifyCallbackResult>;
1322
1384
  handleWebhook(payload: any, headers?: Record<string, string | string[] | undefined>, configOverride?: Partial<ProviderConfig>): Promise<VerifyCallbackResult>;
1385
+ /**
1386
+ * Probe payment methods yang benar-benar aktif di akun merchant gateway.
1387
+ */
1388
+ probePaymentMethods(configOverride?: Partial<ProviderConfig>): Promise<{
1389
+ success: boolean;
1390
+ enabled: string[];
1391
+ error?: string;
1392
+ }>;
1323
1393
  /**
1324
1394
  * Unified Refund — berlaku untuk semua provider yang mendukung refund.
1325
1395
  * Provider tanpa fitur refund mengembalikan `{ supported: false }`, bukan error.
@@ -1489,6 +1559,26 @@ declare function toStripePaymentMethod(code?: string): string | undefined;
1489
1559
  */
1490
1560
  declare function toCanonicalPaymentMethod(provider: string, code?: string): string;
1491
1561
 
1562
+ type PaymentMethodDescriptorType = PaymentMethodDescriptor["type"];
1563
+ /**
1564
+ * Sandingkan kategori resmi Buayar menjadi tipe singkat UI.
1565
+ * Kategori bisa berbeda antar provider, oleh karena itu mapping dilakukan
1566
+ * di sini (sentral) agar konsumen tidak perlu tahu detail kategori per PG.
1567
+ */
1568
+ declare function mapCategoryToDescriptorType(category: string, paymentMethod?: string): PaymentMethodDescriptorType;
1569
+ /**
1570
+ * Bangun satu deskriptor kanonikal siap-render dari objek PaymentMethod.
1571
+ *
1572
+ * @param pm Hasil mentah provider (lihat `PaymentMethod`).
1573
+ * @param _providerName Nama provider aktif (disimpan untuk keperluan lattice
1574
+ * masa depan; saat ini mapping kategori sudah generik).
1575
+ */
1576
+ declare function buildPaymentMethodDescriptor(pm: PaymentMethod, _providerName?: string): PaymentMethodDescriptor;
1577
+ /**
1578
+ * Bangun daftar deskriptor kanonikal dari hasil `getPaymentMethods()`.
1579
+ */
1580
+ declare function buildPaymentMethodDescriptors(methods: PaymentMethod[], providerName?: string): PaymentMethodDescriptor[];
1581
+
1492
1582
  declare function getDuitkuInquirySignatures(merchantCode: string, orderId: string, amount: number, apiKey: string): {
1493
1583
  payloadSignature: string;
1494
1584
  timestamp: string;
@@ -1893,4 +1983,4 @@ declare function safeCompare(a: string, b: string): boolean;
1893
1983
  */
1894
1984
  declare function getPaymentMethodCategory(code: string, name?: string): "Virtual Account" | "QRIS" | "E-Wallet" | "Retail / Gerai" | "Kartu Kredit" | "Paylater / Cicilan" | "Lainnya";
1895
1985
 
1896
- 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 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, 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, buildPaypalBasicAuth, buildPayuBasicAuth, buildRazorpayBasicAuth, buildTwoCheckoutAuth, formatNicepayTimestamp, generateDokuHeaders, generateFaspaySignature, generateFinpaySignature, generateIpaymuSignature, generateNicepayToken, generateOyHeaders, generatePrismalinkSignature, generateSnapAsymmetricSignature, generateSnapSymmetricSignature, getDuitkuInquirySignatures, getDuitkuPaymentMethodsSignature, getDuitkuStatusSignatures, getPaymentMethodCategory, getXenditAuthHeader, hmacSha256, 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 };
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 };
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;
@@ -216,8 +222,47 @@ interface GetPaymentMethodsResult {
216
222
  error?: string;
217
223
  rawResponse: any;
218
224
  }
225
+ /**
226
+ * Deskriptor saluran pembayaran kanonikal siap-render untuk UI.
227
+ * Dibangun dari {@link PaymentMethod} via `buildPaymentMethodDescriptors()` di
228
+ * `core/descriptor.ts` sehingga konsumen (frontend, snapshot, CLI) selalu
229
+ * mendapat bentuk seragam tanpa perlu mapping ulang per provider.
230
+ */
231
+ interface PaymentMethodDescriptor {
232
+ /** Identifier uppercase yang dipakai sistem internal (mis. 'BCA_VA', 'QRIS', 'GOPAY') */
233
+ id: string;
234
+ /** Nama ramah pengguna */
235
+ name: string;
236
+ /** Tipe singkat untuk icon/badge rendering */
237
+ type: "qris" | "va" | "ewallet" | "retail" | "card" | "paylater" | "other";
238
+ /** Ikon emoji */
239
+ icon: string;
240
+ /** Badge teks (mis. "Instan Bebas Biaya") */
241
+ badge: string;
242
+ /** URL logo (opsional) */
243
+ image?: string;
244
+ /** Kategori resmi Buayar (Virtual Account, QRIS, E-Wallet, dll) */
245
+ category?: string;
246
+ /** Apakah channel tersedia (true) atau coming-soon (false) */
247
+ coming_soon?: boolean;
248
+ /** Fee admin (string deskriptif, mis. "0.7%" atau "IDR 4,000") */
249
+ totalFee?: string;
250
+ }
251
+ interface GetPaymentMethodDescriptorsResult {
252
+ success: boolean;
253
+ provider?: string;
254
+ descriptors: PaymentMethodDescriptor[];
255
+ error?: string;
256
+ generatedAt: string;
257
+ }
219
258
  interface CheckTransactionParams {
220
- /** Merchant order ID saat pembuatan transaksi */
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
+ */
221
266
  merchantOrderId: string;
222
267
  }
223
268
  interface CheckTransactionResult {
@@ -386,6 +431,11 @@ declare class IpaymuProvider extends BasePaymentProvider {
386
431
  createInvoice(params: CreateInvoiceParams, config: ProviderConfig): Promise<InvoiceResponse>;
387
432
  verifyCallback(body: any, config: ProviderConfig): Promise<VerifyCallbackResult>;
388
433
  getPaymentMethods(params: GetPaymentMethodsParams, config: ProviderConfig): Promise<GetPaymentMethodsResult>;
434
+ probePaymentMethods(config: ProviderConfig): Promise<{
435
+ success: boolean;
436
+ enabled: string[];
437
+ error?: string;
438
+ }>;
389
439
  checkTransaction(params: CheckTransactionParams, config: ProviderConfig): Promise<CheckTransactionResult>;
390
440
  }
391
441
 
@@ -395,6 +445,11 @@ declare class XenditProvider extends BasePaymentProvider {
395
445
  createInvoice(params: CreateInvoiceParams, config: ProviderConfig): Promise<InvoiceResponse>;
396
446
  verifyCallback(body: any, config: ProviderConfig): Promise<VerifyCallbackResult>;
397
447
  getPaymentMethods(params: GetPaymentMethodsParams, config: ProviderConfig): Promise<GetPaymentMethodsResult>;
448
+ probePaymentMethods(config: ProviderConfig): Promise<{
449
+ success: boolean;
450
+ enabled: string[];
451
+ error?: string;
452
+ }>;
398
453
  checkTransaction(params: CheckTransactionParams, config: ProviderConfig): Promise<CheckTransactionResult>;
399
454
  }
400
455
 
@@ -1222,10 +1277,10 @@ declare class ProviderRegistry {
1222
1277
  */
1223
1278
  detectFromEnv(env: Record<string, string | undefined>): string | undefined;
1224
1279
  /**
1225
- * Autodetect provider dari struktur payload webhook.
1280
+ * Autodetect provider dari struktur payload webhook dan header.
1226
1281
  * Mengembalikan nama provider jika dikenali, else undefined.
1227
1282
  */
1228
- detectFromWebhook(payload: any): string | undefined;
1283
+ detectFromWebhook(payload: any, headers?: Record<string, any>): string | undefined;
1229
1284
  }
1230
1285
  declare function buildDefaultDescriptors(): ProviderDescriptor[];
1231
1286
  declare const providerRegistry: ProviderRegistry;
@@ -1282,9 +1337,9 @@ declare class Buayar {
1282
1337
  */
1283
1338
  getCapabilities(name?: string): ProviderCapability | undefined;
1284
1339
  /**
1285
- * Deteksi nama provider dari struktur payload webhook.
1340
+ * Deteksi nama provider dari struktur payload webhook dan opsional headers.
1286
1341
  */
1287
- detectProviderFromPayload(payload: any): string | undefined;
1342
+ detectProviderFromPayload(payload: any, headers?: Record<string, string | string[] | undefined>): string | undefined;
1288
1343
  /**
1289
1344
  * Deteksi nama provider aktif dari variabel lingkungan (kredensial yang terisi).
1290
1345
  */
@@ -1309,6 +1364,13 @@ declare class Buayar {
1309
1364
  * Ambil daftar channel pembayaran aktif (Accordion-Ready)
1310
1365
  */
1311
1366
  getPaymentMethods(params?: GetPaymentMethodsParams, configOverride?: Partial<ProviderConfig>): Promise<GetPaymentMethodsResult>;
1367
+ /**
1368
+ * Ambil daftar channel pembayaran aktif dalam bentuk deskriptor kanonikal
1369
+ * siap-render (id, name, type, icon, badge, image, category, totalFee).
1370
+ * Wrapper di atas {@link Buayar.getPaymentMethods} + `buildPaymentMethodDescriptors`,
1371
+ * sehingga konsumen UI/snapshot tidak perlu melakukan mapping ulang per provider.
1372
+ */
1373
+ getPaymentMethodDescriptors(params?: GetPaymentMethodsParams, configOverride?: Partial<ProviderConfig>): Promise<GetPaymentMethodDescriptorsResult>;
1312
1374
  /**
1313
1375
  * Cek status transaksi pembayaran berdasarkan Order ID
1314
1376
  */
@@ -1320,6 +1382,14 @@ declare class Buayar {
1320
1382
  */
1321
1383
  verifyWebhook(payload: any, headers?: Record<string, string | string[] | undefined>, configOverride?: Partial<ProviderConfig>): Promise<VerifyCallbackResult>;
1322
1384
  handleWebhook(payload: any, headers?: Record<string, string | string[] | undefined>, configOverride?: Partial<ProviderConfig>): Promise<VerifyCallbackResult>;
1385
+ /**
1386
+ * Probe payment methods yang benar-benar aktif di akun merchant gateway.
1387
+ */
1388
+ probePaymentMethods(configOverride?: Partial<ProviderConfig>): Promise<{
1389
+ success: boolean;
1390
+ enabled: string[];
1391
+ error?: string;
1392
+ }>;
1323
1393
  /**
1324
1394
  * Unified Refund — berlaku untuk semua provider yang mendukung refund.
1325
1395
  * Provider tanpa fitur refund mengembalikan `{ supported: false }`, bukan error.
@@ -1489,6 +1559,26 @@ declare function toStripePaymentMethod(code?: string): string | undefined;
1489
1559
  */
1490
1560
  declare function toCanonicalPaymentMethod(provider: string, code?: string): string;
1491
1561
 
1562
+ type PaymentMethodDescriptorType = PaymentMethodDescriptor["type"];
1563
+ /**
1564
+ * Sandingkan kategori resmi Buayar menjadi tipe singkat UI.
1565
+ * Kategori bisa berbeda antar provider, oleh karena itu mapping dilakukan
1566
+ * di sini (sentral) agar konsumen tidak perlu tahu detail kategori per PG.
1567
+ */
1568
+ declare function mapCategoryToDescriptorType(category: string, paymentMethod?: string): PaymentMethodDescriptorType;
1569
+ /**
1570
+ * Bangun satu deskriptor kanonikal siap-render dari objek PaymentMethod.
1571
+ *
1572
+ * @param pm Hasil mentah provider (lihat `PaymentMethod`).
1573
+ * @param _providerName Nama provider aktif (disimpan untuk keperluan lattice
1574
+ * masa depan; saat ini mapping kategori sudah generik).
1575
+ */
1576
+ declare function buildPaymentMethodDescriptor(pm: PaymentMethod, _providerName?: string): PaymentMethodDescriptor;
1577
+ /**
1578
+ * Bangun daftar deskriptor kanonikal dari hasil `getPaymentMethods()`.
1579
+ */
1580
+ declare function buildPaymentMethodDescriptors(methods: PaymentMethod[], providerName?: string): PaymentMethodDescriptor[];
1581
+
1492
1582
  declare function getDuitkuInquirySignatures(merchantCode: string, orderId: string, amount: number, apiKey: string): {
1493
1583
  payloadSignature: string;
1494
1584
  timestamp: string;
@@ -1893,4 +1983,4 @@ declare function safeCompare(a: string, b: string): boolean;
1893
1983
  */
1894
1984
  declare function getPaymentMethodCategory(code: string, name?: string): "Virtual Account" | "QRIS" | "E-Wallet" | "Retail / Gerai" | "Kartu Kredit" | "Paylater / Cicilan" | "Lainnya";
1895
1985
 
1896
- 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 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, 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, buildPaypalBasicAuth, buildPayuBasicAuth, buildRazorpayBasicAuth, buildTwoCheckoutAuth, formatNicepayTimestamp, generateDokuHeaders, generateFaspaySignature, generateFinpaySignature, generateIpaymuSignature, generateNicepayToken, generateOyHeaders, generatePrismalinkSignature, generateSnapAsymmetricSignature, generateSnapSymmetricSignature, getDuitkuInquirySignatures, getDuitkuPaymentMethodsSignature, getDuitkuStatusSignatures, getPaymentMethodCategory, getXenditAuthHeader, hmacSha256, 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 };
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 };