@crediblemark/buayar 0.8.3 → 0.8.5
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 +1 -1
- package/dist/index.d.mts +61 -1
- package/dist/index.d.ts +61 -1
- package/dist/index.js +111 -0
- package/dist/index.mjs +108 -0
- package/docs/ipaymu.md +37 -0
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -216,6 +216,39 @@ interface GetPaymentMethodsResult {
|
|
|
216
216
|
error?: string;
|
|
217
217
|
rawResponse: any;
|
|
218
218
|
}
|
|
219
|
+
/**
|
|
220
|
+
* Deskriptor saluran pembayaran kanonikal siap-render untuk UI.
|
|
221
|
+
* Dibangun dari {@link PaymentMethod} via `buildPaymentMethodDescriptors()` di
|
|
222
|
+
* `core/descriptor.ts` sehingga konsumen (frontend, snapshot, CLI) selalu
|
|
223
|
+
* mendapat bentuk seragam tanpa perlu mapping ulang per provider.
|
|
224
|
+
*/
|
|
225
|
+
interface PaymentMethodDescriptor {
|
|
226
|
+
/** Identifier uppercase yang dipakai sistem internal (mis. 'BCA_VA', 'QRIS', 'GOPAY') */
|
|
227
|
+
id: string;
|
|
228
|
+
/** Nama ramah pengguna */
|
|
229
|
+
name: string;
|
|
230
|
+
/** Tipe singkat untuk icon/badge rendering */
|
|
231
|
+
type: "qris" | "va" | "ewallet" | "retail" | "card" | "paylater" | "other";
|
|
232
|
+
/** Ikon emoji */
|
|
233
|
+
icon: string;
|
|
234
|
+
/** Badge teks (mis. "Instan Bebas Biaya") */
|
|
235
|
+
badge: string;
|
|
236
|
+
/** URL logo (opsional) */
|
|
237
|
+
image?: string;
|
|
238
|
+
/** Kategori resmi Buayar (Virtual Account, QRIS, E-Wallet, dll) */
|
|
239
|
+
category?: string;
|
|
240
|
+
/** Apakah channel tersedia (true) atau coming-soon (false) */
|
|
241
|
+
coming_soon?: boolean;
|
|
242
|
+
/** Fee admin (string deskriptif, mis. "0.7%" atau "IDR 4,000") */
|
|
243
|
+
totalFee?: string;
|
|
244
|
+
}
|
|
245
|
+
interface GetPaymentMethodDescriptorsResult {
|
|
246
|
+
success: boolean;
|
|
247
|
+
provider?: string;
|
|
248
|
+
descriptors: PaymentMethodDescriptor[];
|
|
249
|
+
error?: string;
|
|
250
|
+
generatedAt: string;
|
|
251
|
+
}
|
|
219
252
|
interface CheckTransactionParams {
|
|
220
253
|
/** Merchant order ID saat pembuatan transaksi */
|
|
221
254
|
merchantOrderId: string;
|
|
@@ -1309,6 +1342,13 @@ declare class Buayar {
|
|
|
1309
1342
|
* Ambil daftar channel pembayaran aktif (Accordion-Ready)
|
|
1310
1343
|
*/
|
|
1311
1344
|
getPaymentMethods(params?: GetPaymentMethodsParams, configOverride?: Partial<ProviderConfig>): Promise<GetPaymentMethodsResult>;
|
|
1345
|
+
/**
|
|
1346
|
+
* Ambil daftar channel pembayaran aktif dalam bentuk deskriptor kanonikal
|
|
1347
|
+
* siap-render (id, name, type, icon, badge, image, category, totalFee).
|
|
1348
|
+
* Wrapper di atas {@link Buayar.getPaymentMethods} + `buildPaymentMethodDescriptors`,
|
|
1349
|
+
* sehingga konsumen UI/snapshot tidak perlu melakukan mapping ulang per provider.
|
|
1350
|
+
*/
|
|
1351
|
+
getPaymentMethodDescriptors(params?: GetPaymentMethodsParams, configOverride?: Partial<ProviderConfig>): Promise<GetPaymentMethodDescriptorsResult>;
|
|
1312
1352
|
/**
|
|
1313
1353
|
* Cek status transaksi pembayaran berdasarkan Order ID
|
|
1314
1354
|
*/
|
|
@@ -1489,6 +1529,26 @@ declare function toStripePaymentMethod(code?: string): string | undefined;
|
|
|
1489
1529
|
*/
|
|
1490
1530
|
declare function toCanonicalPaymentMethod(provider: string, code?: string): string;
|
|
1491
1531
|
|
|
1532
|
+
type PaymentMethodDescriptorType = PaymentMethodDescriptor["type"];
|
|
1533
|
+
/**
|
|
1534
|
+
* Sandingkan kategori resmi Buayar menjadi tipe singkat UI.
|
|
1535
|
+
* Kategori bisa berbeda antar provider, oleh karena itu mapping dilakukan
|
|
1536
|
+
* di sini (sentral) agar konsumen tidak perlu tahu detail kategori per PG.
|
|
1537
|
+
*/
|
|
1538
|
+
declare function mapCategoryToDescriptorType(category: string, paymentMethod?: string): PaymentMethodDescriptorType;
|
|
1539
|
+
/**
|
|
1540
|
+
* Bangun satu deskriptor kanonikal siap-render dari objek PaymentMethod.
|
|
1541
|
+
*
|
|
1542
|
+
* @param pm Hasil mentah provider (lihat `PaymentMethod`).
|
|
1543
|
+
* @param _providerName Nama provider aktif (disimpan untuk keperluan lattice
|
|
1544
|
+
* masa depan; saat ini mapping kategori sudah generik).
|
|
1545
|
+
*/
|
|
1546
|
+
declare function buildPaymentMethodDescriptor(pm: PaymentMethod, _providerName?: string): PaymentMethodDescriptor;
|
|
1547
|
+
/**
|
|
1548
|
+
* Bangun daftar deskriptor kanonikal dari hasil `getPaymentMethods()`.
|
|
1549
|
+
*/
|
|
1550
|
+
declare function buildPaymentMethodDescriptors(methods: PaymentMethod[], providerName?: string): PaymentMethodDescriptor[];
|
|
1551
|
+
|
|
1492
1552
|
declare function getDuitkuInquirySignatures(merchantCode: string, orderId: string, amount: number, apiKey: string): {
|
|
1493
1553
|
payloadSignature: string;
|
|
1494
1554
|
timestamp: string;
|
|
@@ -1893,4 +1953,4 @@ declare function safeCompare(a: string, b: string): boolean;
|
|
|
1893
1953
|
*/
|
|
1894
1954
|
declare function getPaymentMethodCategory(code: string, name?: string): "Virtual Account" | "QRIS" | "E-Wallet" | "Retail / Gerai" | "Kartu Kredit" | "Paylater / Cicilan" | "Lainnya";
|
|
1895
1955
|
|
|
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 };
|
|
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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -216,6 +216,39 @@ interface GetPaymentMethodsResult {
|
|
|
216
216
|
error?: string;
|
|
217
217
|
rawResponse: any;
|
|
218
218
|
}
|
|
219
|
+
/**
|
|
220
|
+
* Deskriptor saluran pembayaran kanonikal siap-render untuk UI.
|
|
221
|
+
* Dibangun dari {@link PaymentMethod} via `buildPaymentMethodDescriptors()` di
|
|
222
|
+
* `core/descriptor.ts` sehingga konsumen (frontend, snapshot, CLI) selalu
|
|
223
|
+
* mendapat bentuk seragam tanpa perlu mapping ulang per provider.
|
|
224
|
+
*/
|
|
225
|
+
interface PaymentMethodDescriptor {
|
|
226
|
+
/** Identifier uppercase yang dipakai sistem internal (mis. 'BCA_VA', 'QRIS', 'GOPAY') */
|
|
227
|
+
id: string;
|
|
228
|
+
/** Nama ramah pengguna */
|
|
229
|
+
name: string;
|
|
230
|
+
/** Tipe singkat untuk icon/badge rendering */
|
|
231
|
+
type: "qris" | "va" | "ewallet" | "retail" | "card" | "paylater" | "other";
|
|
232
|
+
/** Ikon emoji */
|
|
233
|
+
icon: string;
|
|
234
|
+
/** Badge teks (mis. "Instan Bebas Biaya") */
|
|
235
|
+
badge: string;
|
|
236
|
+
/** URL logo (opsional) */
|
|
237
|
+
image?: string;
|
|
238
|
+
/** Kategori resmi Buayar (Virtual Account, QRIS, E-Wallet, dll) */
|
|
239
|
+
category?: string;
|
|
240
|
+
/** Apakah channel tersedia (true) atau coming-soon (false) */
|
|
241
|
+
coming_soon?: boolean;
|
|
242
|
+
/** Fee admin (string deskriptif, mis. "0.7%" atau "IDR 4,000") */
|
|
243
|
+
totalFee?: string;
|
|
244
|
+
}
|
|
245
|
+
interface GetPaymentMethodDescriptorsResult {
|
|
246
|
+
success: boolean;
|
|
247
|
+
provider?: string;
|
|
248
|
+
descriptors: PaymentMethodDescriptor[];
|
|
249
|
+
error?: string;
|
|
250
|
+
generatedAt: string;
|
|
251
|
+
}
|
|
219
252
|
interface CheckTransactionParams {
|
|
220
253
|
/** Merchant order ID saat pembuatan transaksi */
|
|
221
254
|
merchantOrderId: string;
|
|
@@ -1309,6 +1342,13 @@ declare class Buayar {
|
|
|
1309
1342
|
* Ambil daftar channel pembayaran aktif (Accordion-Ready)
|
|
1310
1343
|
*/
|
|
1311
1344
|
getPaymentMethods(params?: GetPaymentMethodsParams, configOverride?: Partial<ProviderConfig>): Promise<GetPaymentMethodsResult>;
|
|
1345
|
+
/**
|
|
1346
|
+
* Ambil daftar channel pembayaran aktif dalam bentuk deskriptor kanonikal
|
|
1347
|
+
* siap-render (id, name, type, icon, badge, image, category, totalFee).
|
|
1348
|
+
* Wrapper di atas {@link Buayar.getPaymentMethods} + `buildPaymentMethodDescriptors`,
|
|
1349
|
+
* sehingga konsumen UI/snapshot tidak perlu melakukan mapping ulang per provider.
|
|
1350
|
+
*/
|
|
1351
|
+
getPaymentMethodDescriptors(params?: GetPaymentMethodsParams, configOverride?: Partial<ProviderConfig>): Promise<GetPaymentMethodDescriptorsResult>;
|
|
1312
1352
|
/**
|
|
1313
1353
|
* Cek status transaksi pembayaran berdasarkan Order ID
|
|
1314
1354
|
*/
|
|
@@ -1489,6 +1529,26 @@ declare function toStripePaymentMethod(code?: string): string | undefined;
|
|
|
1489
1529
|
*/
|
|
1490
1530
|
declare function toCanonicalPaymentMethod(provider: string, code?: string): string;
|
|
1491
1531
|
|
|
1532
|
+
type PaymentMethodDescriptorType = PaymentMethodDescriptor["type"];
|
|
1533
|
+
/**
|
|
1534
|
+
* Sandingkan kategori resmi Buayar menjadi tipe singkat UI.
|
|
1535
|
+
* Kategori bisa berbeda antar provider, oleh karena itu mapping dilakukan
|
|
1536
|
+
* di sini (sentral) agar konsumen tidak perlu tahu detail kategori per PG.
|
|
1537
|
+
*/
|
|
1538
|
+
declare function mapCategoryToDescriptorType(category: string, paymentMethod?: string): PaymentMethodDescriptorType;
|
|
1539
|
+
/**
|
|
1540
|
+
* Bangun satu deskriptor kanonikal siap-render dari objek PaymentMethod.
|
|
1541
|
+
*
|
|
1542
|
+
* @param pm Hasil mentah provider (lihat `PaymentMethod`).
|
|
1543
|
+
* @param _providerName Nama provider aktif (disimpan untuk keperluan lattice
|
|
1544
|
+
* masa depan; saat ini mapping kategori sudah generik).
|
|
1545
|
+
*/
|
|
1546
|
+
declare function buildPaymentMethodDescriptor(pm: PaymentMethod, _providerName?: string): PaymentMethodDescriptor;
|
|
1547
|
+
/**
|
|
1548
|
+
* Bangun daftar deskriptor kanonikal dari hasil `getPaymentMethods()`.
|
|
1549
|
+
*/
|
|
1550
|
+
declare function buildPaymentMethodDescriptors(methods: PaymentMethod[], providerName?: string): PaymentMethodDescriptor[];
|
|
1551
|
+
|
|
1492
1552
|
declare function getDuitkuInquirySignatures(merchantCode: string, orderId: string, amount: number, apiKey: string): {
|
|
1493
1553
|
payloadSignature: string;
|
|
1494
1554
|
timestamp: string;
|
|
@@ -1893,4 +1953,4 @@ declare function safeCompare(a: string, b: string): boolean;
|
|
|
1893
1953
|
*/
|
|
1894
1954
|
declare function getPaymentMethodCategory(code: string, name?: string): "Virtual Account" | "QRIS" | "E-Wallet" | "Retail / Gerai" | "Kartu Kredit" | "Paylater / Cicilan" | "Lainnya";
|
|
1895
1955
|
|
|
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 };
|
|
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 };
|
package/dist/index.js
CHANGED
|
@@ -94,6 +94,8 @@ __export(index_exports, {
|
|
|
94
94
|
buildCoreChargePayload: () => buildCoreChargePayload,
|
|
95
95
|
buildDefaultDescriptors: () => buildDefaultDescriptors,
|
|
96
96
|
buildIpaymuCallbackString: () => buildIpaymuCallbackString,
|
|
97
|
+
buildPaymentMethodDescriptor: () => buildPaymentMethodDescriptor,
|
|
98
|
+
buildPaymentMethodDescriptors: () => buildPaymentMethodDescriptors,
|
|
97
99
|
buildPaypalBasicAuth: () => buildPaypalBasicAuth,
|
|
98
100
|
buildPayuBasicAuth: () => buildPayuBasicAuth,
|
|
99
101
|
buildRazorpayBasicAuth: () => buildRazorpayBasicAuth,
|
|
@@ -114,6 +116,7 @@ __export(index_exports, {
|
|
|
114
116
|
getPaymentMethodCategory: () => getPaymentMethodCategory,
|
|
115
117
|
getXenditAuthHeader: () => getXenditAuthHeader,
|
|
116
118
|
hmacSha256: () => hmacSha256,
|
|
119
|
+
mapCategoryToDescriptorType: () => mapCategoryToDescriptorType,
|
|
117
120
|
md5: () => md5,
|
|
118
121
|
minifyJson: () => minifyJson,
|
|
119
122
|
normalizeIpaymuCallback: () => normalizeIpaymuCallback,
|
|
@@ -2030,6 +2033,10 @@ var IpaymuProvider = class extends BasePaymentProvider {
|
|
|
2030
2033
|
feeDetail: ch.TransactionFee
|
|
2031
2034
|
}
|
|
2032
2035
|
};
|
|
2036
|
+
const health = String(ch.HealthStatus || "").toLowerCase();
|
|
2037
|
+
const feature = String(ch.FeatureStatus || "").toLowerCase();
|
|
2038
|
+
const explicitlyUnavailable = feature !== "" && feature !== "active" || health !== "" && health !== "online";
|
|
2039
|
+
if (explicitlyUnavailable) continue;
|
|
2033
2040
|
methods.push(pm);
|
|
2034
2041
|
if (!categories[category]) categories[category] = [];
|
|
2035
2042
|
categories[category].push(pm);
|
|
@@ -9845,6 +9852,80 @@ var PaymentManager = class {
|
|
|
9845
9852
|
};
|
|
9846
9853
|
var paymentManager = new PaymentManager();
|
|
9847
9854
|
|
|
9855
|
+
// src/core/descriptor.ts
|
|
9856
|
+
function mapCategoryToDescriptorType(category, paymentMethod) {
|
|
9857
|
+
const cat = (category || "").toLowerCase();
|
|
9858
|
+
const method = (paymentMethod || "").toLowerCase();
|
|
9859
|
+
const isVa = cat === "virtual account" || method.includes("_va");
|
|
9860
|
+
const isQr = cat === "qris" || method === "qris";
|
|
9861
|
+
const isEwallet = cat === "e-wallet" || cat === "ewallet" || method === "ewallet";
|
|
9862
|
+
const isRetail = cat === "retail / gerai" || cat === "cstore" || method === "cstore";
|
|
9863
|
+
const isCard = cat === "kartu kredit" || cat === "cc";
|
|
9864
|
+
const isPaylater = cat === "paylater / cicilan" || cat === "paylater" || method === "paylater";
|
|
9865
|
+
if (isQr) return "qris";
|
|
9866
|
+
if (isVa) return "va";
|
|
9867
|
+
if (isEwallet) return "ewallet";
|
|
9868
|
+
if (isRetail) return "retail";
|
|
9869
|
+
if (isCard) return "card";
|
|
9870
|
+
if (isPaylater) return "paylater";
|
|
9871
|
+
return "other";
|
|
9872
|
+
}
|
|
9873
|
+
function iconForType(type) {
|
|
9874
|
+
switch (type) {
|
|
9875
|
+
case "qris":
|
|
9876
|
+
case "ewallet":
|
|
9877
|
+
return "\u{1F4F1}";
|
|
9878
|
+
case "va":
|
|
9879
|
+
return "\u{1F3E6}";
|
|
9880
|
+
case "retail":
|
|
9881
|
+
return "\u{1F3EA}";
|
|
9882
|
+
case "card":
|
|
9883
|
+
case "paylater":
|
|
9884
|
+
default:
|
|
9885
|
+
return "\u{1F4B3}";
|
|
9886
|
+
}
|
|
9887
|
+
}
|
|
9888
|
+
function badgeForType(type) {
|
|
9889
|
+
switch (type) {
|
|
9890
|
+
case "qris":
|
|
9891
|
+
return "Instan Bebas Biaya";
|
|
9892
|
+
case "va":
|
|
9893
|
+
return "Otomatis 24 Jam";
|
|
9894
|
+
case "ewallet":
|
|
9895
|
+
return "E-Wallet Instan";
|
|
9896
|
+
case "retail":
|
|
9897
|
+
return "Gerai Retail";
|
|
9898
|
+
case "card":
|
|
9899
|
+
return "Visa / Mastercard";
|
|
9900
|
+
case "paylater":
|
|
9901
|
+
return "Cicilan PayLater";
|
|
9902
|
+
default:
|
|
9903
|
+
return "Tersedia Otomatis";
|
|
9904
|
+
}
|
|
9905
|
+
}
|
|
9906
|
+
function buildPaymentMethodDescriptor(pm, _providerName) {
|
|
9907
|
+
const category = pm.category || "";
|
|
9908
|
+
const code = (pm.code || pm.paymentMethod || "").toUpperCase();
|
|
9909
|
+
const type = mapCategoryToDescriptorType(category, pm.paymentMethod);
|
|
9910
|
+
const icon = iconForType(type);
|
|
9911
|
+
let badge = badgeForType(type);
|
|
9912
|
+
const feeDisplay = pm.totalFee && pm.totalFee !== "-" ? pm.totalFee : "";
|
|
9913
|
+
return {
|
|
9914
|
+
id: code,
|
|
9915
|
+
name: pm.paymentName,
|
|
9916
|
+
type,
|
|
9917
|
+
icon,
|
|
9918
|
+
badge: feeDisplay ? `${badge} \u2022 Fee ${feeDisplay}` : badge,
|
|
9919
|
+
image: pm.paymentImage || void 0,
|
|
9920
|
+
category,
|
|
9921
|
+
coming_soon: false,
|
|
9922
|
+
totalFee: feeDisplay || void 0
|
|
9923
|
+
};
|
|
9924
|
+
}
|
|
9925
|
+
function buildPaymentMethodDescriptors(methods, providerName) {
|
|
9926
|
+
return methods.map((pm) => buildPaymentMethodDescriptor(pm, providerName));
|
|
9927
|
+
}
|
|
9928
|
+
|
|
9848
9929
|
// src/core/providerRegistry.ts
|
|
9849
9930
|
var ProviderRegistry = class {
|
|
9850
9931
|
descriptors = /* @__PURE__ */ new Map();
|
|
@@ -10306,6 +10387,33 @@ var Buayar = class {
|
|
|
10306
10387
|
const providerName = configOverride?.provider || this.provider;
|
|
10307
10388
|
return this.manager.getPaymentMethods(providerName, params || { amount: 1e4 }, mergedConfig);
|
|
10308
10389
|
}
|
|
10390
|
+
/**
|
|
10391
|
+
* Ambil daftar channel pembayaran aktif dalam bentuk deskriptor kanonikal
|
|
10392
|
+
* siap-render (id, name, type, icon, badge, image, category, totalFee).
|
|
10393
|
+
* Wrapper di atas {@link Buayar.getPaymentMethods} + `buildPaymentMethodDescriptors`,
|
|
10394
|
+
* sehingga konsumen UI/snapshot tidak perlu melakukan mapping ulang per provider.
|
|
10395
|
+
*/
|
|
10396
|
+
async getPaymentMethodDescriptors(params, configOverride) {
|
|
10397
|
+
const mergedConfig = { ...this.config, ...configOverride };
|
|
10398
|
+
const providerName = configOverride?.provider || this.provider;
|
|
10399
|
+
const generatedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
10400
|
+
const res = await this.manager.getPaymentMethods(providerName, params || { amount: 1e4 }, mergedConfig);
|
|
10401
|
+
if (!res.success) {
|
|
10402
|
+
return {
|
|
10403
|
+
success: false,
|
|
10404
|
+
provider: providerName,
|
|
10405
|
+
descriptors: [],
|
|
10406
|
+
error: res.error || "Failed to fetch payment methods",
|
|
10407
|
+
generatedAt
|
|
10408
|
+
};
|
|
10409
|
+
}
|
|
10410
|
+
return {
|
|
10411
|
+
success: true,
|
|
10412
|
+
provider: providerName,
|
|
10413
|
+
descriptors: buildPaymentMethodDescriptors(res.methods, providerName),
|
|
10414
|
+
generatedAt
|
|
10415
|
+
};
|
|
10416
|
+
}
|
|
10309
10417
|
/**
|
|
10310
10418
|
* Cek status transaksi pembayaran berdasarkan Order ID
|
|
10311
10419
|
*/
|
|
@@ -10525,6 +10633,8 @@ var buayar = new Buayar();
|
|
|
10525
10633
|
buildCoreChargePayload,
|
|
10526
10634
|
buildDefaultDescriptors,
|
|
10527
10635
|
buildIpaymuCallbackString,
|
|
10636
|
+
buildPaymentMethodDescriptor,
|
|
10637
|
+
buildPaymentMethodDescriptors,
|
|
10528
10638
|
buildPaypalBasicAuth,
|
|
10529
10639
|
buildPayuBasicAuth,
|
|
10530
10640
|
buildRazorpayBasicAuth,
|
|
@@ -10545,6 +10655,7 @@ var buayar = new Buayar();
|
|
|
10545
10655
|
getPaymentMethodCategory,
|
|
10546
10656
|
getXenditAuthHeader,
|
|
10547
10657
|
hmacSha256,
|
|
10658
|
+
mapCategoryToDescriptorType,
|
|
10548
10659
|
md5,
|
|
10549
10660
|
minifyJson,
|
|
10550
10661
|
normalizeIpaymuCallback,
|
package/dist/index.mjs
CHANGED
|
@@ -1863,6 +1863,10 @@ var IpaymuProvider = class extends BasePaymentProvider {
|
|
|
1863
1863
|
feeDetail: ch.TransactionFee
|
|
1864
1864
|
}
|
|
1865
1865
|
};
|
|
1866
|
+
const health = String(ch.HealthStatus || "").toLowerCase();
|
|
1867
|
+
const feature = String(ch.FeatureStatus || "").toLowerCase();
|
|
1868
|
+
const explicitlyUnavailable = feature !== "" && feature !== "active" || health !== "" && health !== "online";
|
|
1869
|
+
if (explicitlyUnavailable) continue;
|
|
1866
1870
|
methods.push(pm);
|
|
1867
1871
|
if (!categories[category]) categories[category] = [];
|
|
1868
1872
|
categories[category].push(pm);
|
|
@@ -9678,6 +9682,80 @@ var PaymentManager = class {
|
|
|
9678
9682
|
};
|
|
9679
9683
|
var paymentManager = new PaymentManager();
|
|
9680
9684
|
|
|
9685
|
+
// src/core/descriptor.ts
|
|
9686
|
+
function mapCategoryToDescriptorType(category, paymentMethod) {
|
|
9687
|
+
const cat = (category || "").toLowerCase();
|
|
9688
|
+
const method = (paymentMethod || "").toLowerCase();
|
|
9689
|
+
const isVa = cat === "virtual account" || method.includes("_va");
|
|
9690
|
+
const isQr = cat === "qris" || method === "qris";
|
|
9691
|
+
const isEwallet = cat === "e-wallet" || cat === "ewallet" || method === "ewallet";
|
|
9692
|
+
const isRetail = cat === "retail / gerai" || cat === "cstore" || method === "cstore";
|
|
9693
|
+
const isCard = cat === "kartu kredit" || cat === "cc";
|
|
9694
|
+
const isPaylater = cat === "paylater / cicilan" || cat === "paylater" || method === "paylater";
|
|
9695
|
+
if (isQr) return "qris";
|
|
9696
|
+
if (isVa) return "va";
|
|
9697
|
+
if (isEwallet) return "ewallet";
|
|
9698
|
+
if (isRetail) return "retail";
|
|
9699
|
+
if (isCard) return "card";
|
|
9700
|
+
if (isPaylater) return "paylater";
|
|
9701
|
+
return "other";
|
|
9702
|
+
}
|
|
9703
|
+
function iconForType(type) {
|
|
9704
|
+
switch (type) {
|
|
9705
|
+
case "qris":
|
|
9706
|
+
case "ewallet":
|
|
9707
|
+
return "\u{1F4F1}";
|
|
9708
|
+
case "va":
|
|
9709
|
+
return "\u{1F3E6}";
|
|
9710
|
+
case "retail":
|
|
9711
|
+
return "\u{1F3EA}";
|
|
9712
|
+
case "card":
|
|
9713
|
+
case "paylater":
|
|
9714
|
+
default:
|
|
9715
|
+
return "\u{1F4B3}";
|
|
9716
|
+
}
|
|
9717
|
+
}
|
|
9718
|
+
function badgeForType(type) {
|
|
9719
|
+
switch (type) {
|
|
9720
|
+
case "qris":
|
|
9721
|
+
return "Instan Bebas Biaya";
|
|
9722
|
+
case "va":
|
|
9723
|
+
return "Otomatis 24 Jam";
|
|
9724
|
+
case "ewallet":
|
|
9725
|
+
return "E-Wallet Instan";
|
|
9726
|
+
case "retail":
|
|
9727
|
+
return "Gerai Retail";
|
|
9728
|
+
case "card":
|
|
9729
|
+
return "Visa / Mastercard";
|
|
9730
|
+
case "paylater":
|
|
9731
|
+
return "Cicilan PayLater";
|
|
9732
|
+
default:
|
|
9733
|
+
return "Tersedia Otomatis";
|
|
9734
|
+
}
|
|
9735
|
+
}
|
|
9736
|
+
function buildPaymentMethodDescriptor(pm, _providerName) {
|
|
9737
|
+
const category = pm.category || "";
|
|
9738
|
+
const code = (pm.code || pm.paymentMethod || "").toUpperCase();
|
|
9739
|
+
const type = mapCategoryToDescriptorType(category, pm.paymentMethod);
|
|
9740
|
+
const icon = iconForType(type);
|
|
9741
|
+
let badge = badgeForType(type);
|
|
9742
|
+
const feeDisplay = pm.totalFee && pm.totalFee !== "-" ? pm.totalFee : "";
|
|
9743
|
+
return {
|
|
9744
|
+
id: code,
|
|
9745
|
+
name: pm.paymentName,
|
|
9746
|
+
type,
|
|
9747
|
+
icon,
|
|
9748
|
+
badge: feeDisplay ? `${badge} \u2022 Fee ${feeDisplay}` : badge,
|
|
9749
|
+
image: pm.paymentImage || void 0,
|
|
9750
|
+
category,
|
|
9751
|
+
coming_soon: false,
|
|
9752
|
+
totalFee: feeDisplay || void 0
|
|
9753
|
+
};
|
|
9754
|
+
}
|
|
9755
|
+
function buildPaymentMethodDescriptors(methods, providerName) {
|
|
9756
|
+
return methods.map((pm) => buildPaymentMethodDescriptor(pm, providerName));
|
|
9757
|
+
}
|
|
9758
|
+
|
|
9681
9759
|
// src/core/providerRegistry.ts
|
|
9682
9760
|
var ProviderRegistry = class {
|
|
9683
9761
|
descriptors = /* @__PURE__ */ new Map();
|
|
@@ -10139,6 +10217,33 @@ var Buayar = class {
|
|
|
10139
10217
|
const providerName = configOverride?.provider || this.provider;
|
|
10140
10218
|
return this.manager.getPaymentMethods(providerName, params || { amount: 1e4 }, mergedConfig);
|
|
10141
10219
|
}
|
|
10220
|
+
/**
|
|
10221
|
+
* Ambil daftar channel pembayaran aktif dalam bentuk deskriptor kanonikal
|
|
10222
|
+
* siap-render (id, name, type, icon, badge, image, category, totalFee).
|
|
10223
|
+
* Wrapper di atas {@link Buayar.getPaymentMethods} + `buildPaymentMethodDescriptors`,
|
|
10224
|
+
* sehingga konsumen UI/snapshot tidak perlu melakukan mapping ulang per provider.
|
|
10225
|
+
*/
|
|
10226
|
+
async getPaymentMethodDescriptors(params, configOverride) {
|
|
10227
|
+
const mergedConfig = { ...this.config, ...configOverride };
|
|
10228
|
+
const providerName = configOverride?.provider || this.provider;
|
|
10229
|
+
const generatedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
10230
|
+
const res = await this.manager.getPaymentMethods(providerName, params || { amount: 1e4 }, mergedConfig);
|
|
10231
|
+
if (!res.success) {
|
|
10232
|
+
return {
|
|
10233
|
+
success: false,
|
|
10234
|
+
provider: providerName,
|
|
10235
|
+
descriptors: [],
|
|
10236
|
+
error: res.error || "Failed to fetch payment methods",
|
|
10237
|
+
generatedAt
|
|
10238
|
+
};
|
|
10239
|
+
}
|
|
10240
|
+
return {
|
|
10241
|
+
success: true,
|
|
10242
|
+
provider: providerName,
|
|
10243
|
+
descriptors: buildPaymentMethodDescriptors(res.methods, providerName),
|
|
10244
|
+
generatedAt
|
|
10245
|
+
};
|
|
10246
|
+
}
|
|
10142
10247
|
/**
|
|
10143
10248
|
* Cek status transaksi pembayaran berdasarkan Order ID
|
|
10144
10249
|
*/
|
|
@@ -10357,6 +10462,8 @@ export {
|
|
|
10357
10462
|
buildCoreChargePayload,
|
|
10358
10463
|
buildDefaultDescriptors,
|
|
10359
10464
|
buildIpaymuCallbackString,
|
|
10465
|
+
buildPaymentMethodDescriptor,
|
|
10466
|
+
buildPaymentMethodDescriptors,
|
|
10360
10467
|
buildPaypalBasicAuth,
|
|
10361
10468
|
buildPayuBasicAuth,
|
|
10362
10469
|
buildRazorpayBasicAuth,
|
|
@@ -10377,6 +10484,7 @@ export {
|
|
|
10377
10484
|
getPaymentMethodCategory,
|
|
10378
10485
|
getXenditAuthHeader,
|
|
10379
10486
|
hmacSha256,
|
|
10487
|
+
mapCategoryToDescriptorType,
|
|
10380
10488
|
md5,
|
|
10381
10489
|
minifyJson,
|
|
10382
10490
|
normalizeIpaymuCallback,
|
package/docs/ipaymu.md
CHANGED
|
@@ -80,6 +80,43 @@ if (result.success) {
|
|
|
80
80
|
}
|
|
81
81
|
```
|
|
82
82
|
|
|
83
|
+
> **Automatis filter availability:** Buayar hanya mengembalikan saluran yang benar-benar
|
|
84
|
+
> tersedia — saluran dengan `FeatureStatus` selain `"active"` (mis. `inactive`, `disabled`, `suspended`)
|
|
85
|
+
> atau `HealthStatus` selain `"online"` (mis. `offline`, `maintenance`) **otomatis dibuang** dari daftar.
|
|
86
|
+
> Jadi metode yang muncul selalu berasal dari data real-time iPaymu, bukan asumsi.
|
|
87
|
+
|
|
88
|
+
### 3a. Deskriptor Kanonikal Siap-Render (`getPaymentMethodDescriptors`)
|
|
89
|
+
|
|
90
|
+
Untuk konsumen UI/snapshot yang butuh bentuk seragam tanpa mapping manual per provider, gunakan `getPaymentMethodDescriptors()`:
|
|
91
|
+
|
|
92
|
+
```typescript
|
|
93
|
+
const snap = await buayar.getPaymentMethodDescriptors({ amount: 100000 });
|
|
94
|
+
|
|
95
|
+
if (snap.success) {
|
|
96
|
+
console.log("Provider:", snap.provider);
|
|
97
|
+
console.log("Dibuat pada:", snap.generatedAt);
|
|
98
|
+
console.log("Total:", snap.descriptors.length);
|
|
99
|
+
|
|
100
|
+
// Contoh: siap disimpan sebagai JSON flipbook oleh frontend
|
|
101
|
+
console.log(snap.descriptors[0]);
|
|
102
|
+
/*
|
|
103
|
+
{
|
|
104
|
+
id: "BCA_VA",
|
|
105
|
+
name: "Virtual Account BCA",
|
|
106
|
+
type: "va",
|
|
107
|
+
icon: "🏦",
|
|
108
|
+
badge: "Otomatis 24 Jam • Fee 0.7%",
|
|
109
|
+
image: "https://my.ipaymu.com/images/banks/bca.png",
|
|
110
|
+
category: "Virtual Account",
|
|
111
|
+
coming_soon: false,
|
|
112
|
+
totalFee: "0.7%"
|
|
113
|
+
}
|
|
114
|
+
*/
|
|
115
|
+
}
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
`type` adalah salah satu dari `qris | va | ewallet | retail | card | paylater | other`, siap dipakai untuk ikon/badge. Mapping kategori → tipe dilakukan sentral di `buildPaymentMethodDescriptors()` (ekspor dari `core/descriptor`), jadi semua konsumen mendapat hasil identik.
|
|
119
|
+
|
|
83
120
|
---
|
|
84
121
|
|
|
85
122
|
## 4. Pembuatan Tagihan (Invoice)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@crediblemark/buayar",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.5",
|
|
4
4
|
"description": "Unified Payment Gateway SDK for Node.js & TypeScript — 19 providers (Midtrans, Xendit, Duitku, Stripe, PayPal, Adyen, Razorpay, Square, Checkout.com, PayU, Braintree, 2Checkout, DOKU, iPaymu, PrismaLink, Faspay, Finpay, Nicepay, OY!) with zero-code switching via .env",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|