@crediblemark/buayar 0.8.1 → 0.8.3
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 +25 -2
- package/dist/index.d.ts +25 -2
- package/dist/index.js +75 -5
- package/dist/index.mjs +72 -5
- package/docs/ipaymu.md +8 -3
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
type CanonicalPaymentMethod = "bca_va" | "mandiri_va" | "bni_va" | "bri_va" | "permata_va" | "cimb_va" | "danamon_va" | "bsi_va" | "seabank_va" | "muamalat_va" | "bag_va" | "artajasa_va" | "qris" | "gopay_qris" | "shopeepay_qris" | "nobu_qris" | "gopay" | "shopeepay" | "ovo" | "dana" | "linkaja" | "jenius" | "alfamart" | "indomaret" | "pos" | "credit_card" | "kredivo" | "akulaku" | "indodana" | string;
|
|
1
|
+
type CanonicalPaymentMethod = "bca_va" | "mandiri_va" | "bni_va" | "bri_va" | "permata_va" | "cimb_va" | "danamon_va" | "bsi_va" | "seabank_va" | "muamalat_va" | "bag_va" | "btn_va" | "artajasa_va" | "qris" | "gopay_qris" | "shopeepay_qris" | "nobu_qris" | "gopay" | "shopeepay" | "ovo" | "dana" | "linkaja" | "jenius" | "alfamart" | "indomaret" | "pos" | "credit_card" | "kredivo" | "akulaku" | "indodana" | "cod" | string;
|
|
2
2
|
|
|
3
3
|
interface CustomerDetails {
|
|
4
4
|
name: string;
|
|
@@ -1523,6 +1523,29 @@ declare function generateIpaymuSignature(method: "GET" | "POST", va: string, api
|
|
|
1523
1523
|
signature: string;
|
|
1524
1524
|
timestamp: string;
|
|
1525
1525
|
};
|
|
1526
|
+
/**
|
|
1527
|
+
* Normalisasi payload callback iPaymu agar identik dengan apa yang
|
|
1528
|
+
* ditandatangani iPaymu (merujuk dokumentasi resmi callback):
|
|
1529
|
+
* - trx_id / status_code / transaction_status_code / paid_off → Integer
|
|
1530
|
+
* - is_escrow → Boolean
|
|
1531
|
+
* - additional_info "[]" (string) → [] (array); tambah [] saat field tidak ada
|
|
1532
|
+
* - field lain → String
|
|
1533
|
+
* - field "signature" (bila ikut terkirim di body) dibuang dari perhitungan
|
|
1534
|
+
*/
|
|
1535
|
+
declare function normalizeIpaymuCallback(payload: any): Record<string, any>;
|
|
1536
|
+
/**
|
|
1537
|
+
* Bangun string JSON yang ditandatangani iPaymu untuk verifikasi callback:
|
|
1538
|
+
* - key diurutkan ascending (A-Z) dengan sort case-sensitif
|
|
1539
|
+
* - forward slash di-escape menjadi "\/" sesuai standar PHP json_encode
|
|
1540
|
+
*/
|
|
1541
|
+
declare function buildIpaymuCallbackString(payload: any): string;
|
|
1542
|
+
/**
|
|
1543
|
+
* Verifikasi signature callback iPaymu.
|
|
1544
|
+
* Secret key = Nomor VA (Merchant VA) akun iPaymu; dibandingkan dengan
|
|
1545
|
+
* nilai header X-Signature menggunakan perbandingan timing-safe.
|
|
1546
|
+
* Tanpa header signature atau secret → INVALID.
|
|
1547
|
+
*/
|
|
1548
|
+
declare function verifyIpaymuCallbackSignature(payload: any, secretKey: string, xSignature?: string): boolean;
|
|
1526
1549
|
/**
|
|
1527
1550
|
* Verifikasi callback webhook dari iPaymu
|
|
1528
1551
|
*/
|
|
@@ -1870,4 +1893,4 @@ declare function safeCompare(a: string, b: string): boolean;
|
|
|
1870
1893
|
*/
|
|
1871
1894
|
declare function getPaymentMethodCategory(code: string, name?: string): "Virtual Account" | "QRIS" | "E-Wallet" | "Retail / Gerai" | "Kartu Kredit" | "Paylater / Cicilan" | "Lainnya";
|
|
1872
1895
|
|
|
1873
|
-
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, buildPaypalBasicAuth, buildPayuBasicAuth, buildRazorpayBasicAuth, buildTwoCheckoutAuth, formatNicepayTimestamp, generateDokuHeaders, generateFaspaySignature, generateFinpaySignature, generateIpaymuSignature, generateNicepayToken, generateOyHeaders, generatePrismalinkSignature, generateSnapAsymmetricSignature, generateSnapSymmetricSignature, getDuitkuInquirySignatures, getDuitkuPaymentMethodsSignature, getDuitkuStatusSignatures, getPaymentMethodCategory, getXenditAuthHeader, hmacSha256, md5, minifyJson, 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, verifyNicepayWebhook, verifyOyWebhook, verifyPaypalWebhookSimple, verifyPayuWebhook, verifyPrismalinkSignature, verifyRazorpayWebhook, verifySnapWebhookSignature, verifySquareWebhook, verifyStripeWebhook, verifyTwoCheckoutWebhook, verifyXenditWebhookToken };
|
|
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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
type CanonicalPaymentMethod = "bca_va" | "mandiri_va" | "bni_va" | "bri_va" | "permata_va" | "cimb_va" | "danamon_va" | "bsi_va" | "seabank_va" | "muamalat_va" | "bag_va" | "artajasa_va" | "qris" | "gopay_qris" | "shopeepay_qris" | "nobu_qris" | "gopay" | "shopeepay" | "ovo" | "dana" | "linkaja" | "jenius" | "alfamart" | "indomaret" | "pos" | "credit_card" | "kredivo" | "akulaku" | "indodana" | string;
|
|
1
|
+
type CanonicalPaymentMethod = "bca_va" | "mandiri_va" | "bni_va" | "bri_va" | "permata_va" | "cimb_va" | "danamon_va" | "bsi_va" | "seabank_va" | "muamalat_va" | "bag_va" | "btn_va" | "artajasa_va" | "qris" | "gopay_qris" | "shopeepay_qris" | "nobu_qris" | "gopay" | "shopeepay" | "ovo" | "dana" | "linkaja" | "jenius" | "alfamart" | "indomaret" | "pos" | "credit_card" | "kredivo" | "akulaku" | "indodana" | "cod" | string;
|
|
2
2
|
|
|
3
3
|
interface CustomerDetails {
|
|
4
4
|
name: string;
|
|
@@ -1523,6 +1523,29 @@ declare function generateIpaymuSignature(method: "GET" | "POST", va: string, api
|
|
|
1523
1523
|
signature: string;
|
|
1524
1524
|
timestamp: string;
|
|
1525
1525
|
};
|
|
1526
|
+
/**
|
|
1527
|
+
* Normalisasi payload callback iPaymu agar identik dengan apa yang
|
|
1528
|
+
* ditandatangani iPaymu (merujuk dokumentasi resmi callback):
|
|
1529
|
+
* - trx_id / status_code / transaction_status_code / paid_off → Integer
|
|
1530
|
+
* - is_escrow → Boolean
|
|
1531
|
+
* - additional_info "[]" (string) → [] (array); tambah [] saat field tidak ada
|
|
1532
|
+
* - field lain → String
|
|
1533
|
+
* - field "signature" (bila ikut terkirim di body) dibuang dari perhitungan
|
|
1534
|
+
*/
|
|
1535
|
+
declare function normalizeIpaymuCallback(payload: any): Record<string, any>;
|
|
1536
|
+
/**
|
|
1537
|
+
* Bangun string JSON yang ditandatangani iPaymu untuk verifikasi callback:
|
|
1538
|
+
* - key diurutkan ascending (A-Z) dengan sort case-sensitif
|
|
1539
|
+
* - forward slash di-escape menjadi "\/" sesuai standar PHP json_encode
|
|
1540
|
+
*/
|
|
1541
|
+
declare function buildIpaymuCallbackString(payload: any): string;
|
|
1542
|
+
/**
|
|
1543
|
+
* Verifikasi signature callback iPaymu.
|
|
1544
|
+
* Secret key = Nomor VA (Merchant VA) akun iPaymu; dibandingkan dengan
|
|
1545
|
+
* nilai header X-Signature menggunakan perbandingan timing-safe.
|
|
1546
|
+
* Tanpa header signature atau secret → INVALID.
|
|
1547
|
+
*/
|
|
1548
|
+
declare function verifyIpaymuCallbackSignature(payload: any, secretKey: string, xSignature?: string): boolean;
|
|
1526
1549
|
/**
|
|
1527
1550
|
* Verifikasi callback webhook dari iPaymu
|
|
1528
1551
|
*/
|
|
@@ -1870,4 +1893,4 @@ declare function safeCompare(a: string, b: string): boolean;
|
|
|
1870
1893
|
*/
|
|
1871
1894
|
declare function getPaymentMethodCategory(code: string, name?: string): "Virtual Account" | "QRIS" | "E-Wallet" | "Retail / Gerai" | "Kartu Kredit" | "Paylater / Cicilan" | "Lainnya";
|
|
1872
1895
|
|
|
1873
|
-
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, buildPaypalBasicAuth, buildPayuBasicAuth, buildRazorpayBasicAuth, buildTwoCheckoutAuth, formatNicepayTimestamp, generateDokuHeaders, generateFaspaySignature, generateFinpaySignature, generateIpaymuSignature, generateNicepayToken, generateOyHeaders, generatePrismalinkSignature, generateSnapAsymmetricSignature, generateSnapSymmetricSignature, getDuitkuInquirySignatures, getDuitkuPaymentMethodsSignature, getDuitkuStatusSignatures, getPaymentMethodCategory, getXenditAuthHeader, hmacSha256, md5, minifyJson, 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, verifyNicepayWebhook, verifyOyWebhook, verifyPaypalWebhookSimple, verifyPayuWebhook, verifyPrismalinkSignature, verifyRazorpayWebhook, verifySnapWebhookSignature, verifySquareWebhook, verifyStripeWebhook, verifyTwoCheckoutWebhook, verifyXenditWebhookToken };
|
|
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 };
|
package/dist/index.js
CHANGED
|
@@ -93,6 +93,7 @@ __export(index_exports, {
|
|
|
93
93
|
buildBraintreeBasicAuth: () => buildBraintreeBasicAuth,
|
|
94
94
|
buildCoreChargePayload: () => buildCoreChargePayload,
|
|
95
95
|
buildDefaultDescriptors: () => buildDefaultDescriptors,
|
|
96
|
+
buildIpaymuCallbackString: () => buildIpaymuCallbackString,
|
|
96
97
|
buildPaypalBasicAuth: () => buildPaypalBasicAuth,
|
|
97
98
|
buildPayuBasicAuth: () => buildPayuBasicAuth,
|
|
98
99
|
buildRazorpayBasicAuth: () => buildRazorpayBasicAuth,
|
|
@@ -115,6 +116,7 @@ __export(index_exports, {
|
|
|
115
116
|
hmacSha256: () => hmacSha256,
|
|
116
117
|
md5: () => md5,
|
|
117
118
|
minifyJson: () => minifyJson,
|
|
119
|
+
normalizeIpaymuCallback: () => normalizeIpaymuCallback,
|
|
118
120
|
parseCoreChargeResponse: () => parseCoreChargeResponse,
|
|
119
121
|
paymentManager: () => paymentManager,
|
|
120
122
|
providerRegistry: () => providerRegistry,
|
|
@@ -148,6 +150,7 @@ __export(index_exports, {
|
|
|
148
150
|
verifyFaspaySignature: () => verifyFaspaySignature,
|
|
149
151
|
verifyFinpaySignature: () => verifyFinpaySignature,
|
|
150
152
|
verifyIpaymuCallback: () => verifyIpaymuCallback,
|
|
153
|
+
verifyIpaymuCallbackSignature: () => verifyIpaymuCallbackSignature,
|
|
151
154
|
verifyNicepayWebhook: () => verifyNicepayWebhook,
|
|
152
155
|
verifyOyWebhook: () => verifyOyWebhook,
|
|
153
156
|
verifyPaypalWebhookSimple: () => verifyPaypalWebhookSimple,
|
|
@@ -288,16 +291,20 @@ var CANONICAL_TO_IPAYMU = {
|
|
|
288
291
|
danamon_va: { paymentMethod: "va", paymentChannel: "danamon" },
|
|
289
292
|
bsi_va: { paymentMethod: "va", paymentChannel: "bsi" },
|
|
290
293
|
bag_va: { paymentMethod: "va", paymentChannel: "bag" },
|
|
294
|
+
btn_va: { paymentMethod: "va", paymentChannel: "btn" },
|
|
291
295
|
muamalat_va: { paymentMethod: "va", paymentChannel: "bmi" },
|
|
292
296
|
bmi_va: { paymentMethod: "va", paymentChannel: "bmi" },
|
|
293
297
|
qris: { paymentMethod: "qris", paymentChannel: "mpm" },
|
|
294
298
|
gopay_qris: { paymentMethod: "qris", paymentChannel: "mpm" },
|
|
295
299
|
shopeepay_qris: { paymentMethod: "qris", paymentChannel: "mpm" },
|
|
300
|
+
dana: { paymentMethod: "ewallet", paymentChannel: "dana" },
|
|
301
|
+
shopeepay: { paymentMethod: "ewallet", paymentChannel: "shopeepay" },
|
|
296
302
|
alfamart: { paymentMethod: "cstore", paymentChannel: "alfamart" },
|
|
297
303
|
indomaret: { paymentMethod: "cstore", paymentChannel: "indomaret" },
|
|
298
304
|
credit_card: { paymentMethod: "cc", paymentChannel: "cc" },
|
|
299
305
|
akulaku: { paymentMethod: "paylater", paymentChannel: "akulaku" },
|
|
300
|
-
kredivo: { paymentMethod: "paylater", paymentChannel: "kredivo" }
|
|
306
|
+
kredivo: { paymentMethod: "paylater", paymentChannel: "kredivo" },
|
|
307
|
+
cod: { paymentMethod: "cod", paymentChannel: "cod" }
|
|
301
308
|
};
|
|
302
309
|
var CANONICAL_TO_XENDIT = {
|
|
303
310
|
bca_va: { type: "VIRTUAL_ACCOUNT", channel_code: "BCA" },
|
|
@@ -482,6 +489,9 @@ function toIpaymuPaymentMethod(code) {
|
|
|
482
489
|
if (lower.includes("alfa") || lower.includes("indo")) {
|
|
483
490
|
return { paymentMethod: "cstore", paymentChannel: lower };
|
|
484
491
|
}
|
|
492
|
+
if (lower.includes("dana") || lower.includes("shopee") || lower.includes("ovo") || lower.includes("gopay") || lower.includes("linkaja")) {
|
|
493
|
+
return { paymentMethod: "ewallet", paymentChannel: lower };
|
|
494
|
+
}
|
|
485
495
|
return { paymentMethod: lower };
|
|
486
496
|
}
|
|
487
497
|
function toXenditPaymentMethod(code) {
|
|
@@ -1721,6 +1731,44 @@ function generateIpaymuSignature(method, va, apiKey, body) {
|
|
|
1721
1731
|
const signature = hmacSha256(stringToSign, apiKey);
|
|
1722
1732
|
return { signature, timestamp };
|
|
1723
1733
|
}
|
|
1734
|
+
function normalizeIpaymuCallback(payload) {
|
|
1735
|
+
const result = {};
|
|
1736
|
+
for (const key of Object.keys(payload || {})) {
|
|
1737
|
+
const val = payload[key];
|
|
1738
|
+
if (key === "is_escrow") {
|
|
1739
|
+
result[key] = val === "true" || val === "1" || val === 1 || val === true;
|
|
1740
|
+
} else if (["trx_id", "status_code", "transaction_status_code", "paid_off"].includes(key)) {
|
|
1741
|
+
const intVal = parseInt(String(val), 10);
|
|
1742
|
+
result[key] = Number.isNaN(intVal) ? 0 : intVal;
|
|
1743
|
+
} else if (key === "additional_info") {
|
|
1744
|
+
result[key] = val === "[]" || val === "null" ? [] : val;
|
|
1745
|
+
} else if (key === "signature") {
|
|
1746
|
+
continue;
|
|
1747
|
+
} else {
|
|
1748
|
+
result[key] = String(val);
|
|
1749
|
+
}
|
|
1750
|
+
}
|
|
1751
|
+
if (!Object.prototype.hasOwnProperty.call(result, "additional_info")) {
|
|
1752
|
+
result.additional_info = [];
|
|
1753
|
+
}
|
|
1754
|
+
return result;
|
|
1755
|
+
}
|
|
1756
|
+
function buildIpaymuCallbackString(payload) {
|
|
1757
|
+
const normalized = normalizeIpaymuCallback(payload);
|
|
1758
|
+
const sorted = {};
|
|
1759
|
+
for (const key of Object.keys(normalized).sort((a, b) => a.localeCompare(b))) {
|
|
1760
|
+
sorted[key] = normalized[key];
|
|
1761
|
+
}
|
|
1762
|
+
let json = JSON.stringify(sorted);
|
|
1763
|
+
json = json.replace(/\//g, "\\/");
|
|
1764
|
+
return json;
|
|
1765
|
+
}
|
|
1766
|
+
function verifyIpaymuCallbackSignature(payload, secretKey, xSignature) {
|
|
1767
|
+
if (!secretKey || !xSignature) return false;
|
|
1768
|
+
const stringToSign = buildIpaymuCallbackString(payload);
|
|
1769
|
+
const computed = hmacSha256(stringToSign, secretKey);
|
|
1770
|
+
return safeCompare(String(xSignature).toLowerCase(), computed.toLowerCase());
|
|
1771
|
+
}
|
|
1724
1772
|
function verifyIpaymuCallback(payload) {
|
|
1725
1773
|
const status = (payload.status || "").toLowerCase();
|
|
1726
1774
|
const statusCode = payload.status_code !== void 0 ? String(payload.status_code) : "";
|
|
@@ -1839,13 +1887,23 @@ var IpaymuProvider = class extends BasePaymentProvider {
|
|
|
1839
1887
|
if (ipaymuMethod?.paymentMethod === "va") {
|
|
1840
1888
|
res.vaNumber = resData.PaymentNo;
|
|
1841
1889
|
res.vaBank = ipaymuMethod.paymentChannel;
|
|
1890
|
+
res.mode = "va";
|
|
1842
1891
|
} else if (ipaymuMethod?.paymentMethod === "cstore") {
|
|
1843
1892
|
res.paymentCode = resData.PaymentNo;
|
|
1893
|
+
res.mode = "retail";
|
|
1844
1894
|
}
|
|
1845
1895
|
}
|
|
1846
1896
|
if (resData.QrString || resData.QrImage) {
|
|
1847
1897
|
res.qrString = resData.QrString;
|
|
1848
1898
|
res.qrCodeUrl = resData.QrImage || resData.QrTemplate;
|
|
1899
|
+
res.mode = "qris";
|
|
1900
|
+
}
|
|
1901
|
+
if (ipaymuMethod?.paymentMethod === "ewallet") {
|
|
1902
|
+
res.mode = "ewallet";
|
|
1903
|
+
if (resData.Url) {
|
|
1904
|
+
res.deeplink = resData.Url;
|
|
1905
|
+
res.paymentUrl = resData.Url;
|
|
1906
|
+
}
|
|
1849
1907
|
}
|
|
1850
1908
|
if (resData.Expired) {
|
|
1851
1909
|
res.expiresAt = new Date(resData.Expired);
|
|
@@ -1876,15 +1934,20 @@ var IpaymuProvider = class extends BasePaymentProvider {
|
|
|
1876
1934
|
const { isPaid, isPending, isFailed } = verifyIpaymuCallback(body);
|
|
1877
1935
|
const orderId = body.reference_id || body.referenceId || body.trx_id || "";
|
|
1878
1936
|
const amount = body.amount || body.total || 0;
|
|
1937
|
+
const secretKey = config.merchantCode || config.merchantId || "";
|
|
1938
|
+
const headers = config.extra?.headers || {};
|
|
1939
|
+
const rawSig = headers["x-signature"] ?? headers["X-Signature"] ?? "";
|
|
1940
|
+
const xSignature = Array.isArray(rawSig) ? rawSig[0] : rawSig;
|
|
1941
|
+
const isValid = verifyIpaymuCallbackSignature(body, secretKey, xSignature);
|
|
1879
1942
|
return {
|
|
1880
|
-
isValid
|
|
1943
|
+
isValid,
|
|
1881
1944
|
provider: "ipaymu",
|
|
1882
1945
|
orderId: String(orderId),
|
|
1883
1946
|
amount: Number(amount) || 0,
|
|
1884
1947
|
status: isPaid ? "paid" : isPending ? "pending" : "failed",
|
|
1885
|
-
isPaid,
|
|
1886
|
-
isPending,
|
|
1887
|
-
isFailed,
|
|
1948
|
+
isPaid: isValid && isPaid,
|
|
1949
|
+
isPending: isValid && isPending,
|
|
1950
|
+
isFailed: !isValid || isFailed,
|
|
1888
1951
|
isExpired: (body.status || "").toLowerCase() === "expired",
|
|
1889
1952
|
statusCode: String(body.status_code || body.status || ""),
|
|
1890
1953
|
rawPayload: body
|
|
@@ -1932,6 +1995,8 @@ var IpaymuProvider = class extends BasePaymentProvider {
|
|
|
1932
1995
|
else if (groupCode === "cc") category = "Kartu Kredit";
|
|
1933
1996
|
else if (groupCode === "paylater") category = "Paylater / Cicilan";
|
|
1934
1997
|
else if (groupCode === "cod") category = "COD";
|
|
1998
|
+
else if (groupCode === "ewallet" || groupCode === "ewallet-asia") category = "E-Wallet";
|
|
1999
|
+
else if (groupCode === "debitonline") category = "Debit Online";
|
|
1935
2000
|
else category = groupName;
|
|
1936
2001
|
for (const ch of channels) {
|
|
1937
2002
|
const chCode = (ch.Code || "").toLowerCase();
|
|
@@ -1940,6 +2005,8 @@ var IpaymuProvider = class extends BasePaymentProvider {
|
|
|
1940
2005
|
canonicalCode = chCode === "bag" ? "bag_va" : chCode === "bmi" ? "muamalat_va" : `${chCode}_va`;
|
|
1941
2006
|
} else if (groupCode === "cc") {
|
|
1942
2007
|
canonicalCode = "credit_card";
|
|
2008
|
+
} else if (groupCode === "qris") {
|
|
2009
|
+
canonicalCode = "qris";
|
|
1943
2010
|
}
|
|
1944
2011
|
let totalFee = "-";
|
|
1945
2012
|
if (ch.TransactionFee) {
|
|
@@ -10457,6 +10524,7 @@ var buayar = new Buayar();
|
|
|
10457
10524
|
buildBraintreeBasicAuth,
|
|
10458
10525
|
buildCoreChargePayload,
|
|
10459
10526
|
buildDefaultDescriptors,
|
|
10527
|
+
buildIpaymuCallbackString,
|
|
10460
10528
|
buildPaypalBasicAuth,
|
|
10461
10529
|
buildPayuBasicAuth,
|
|
10462
10530
|
buildRazorpayBasicAuth,
|
|
@@ -10479,6 +10547,7 @@ var buayar = new Buayar();
|
|
|
10479
10547
|
hmacSha256,
|
|
10480
10548
|
md5,
|
|
10481
10549
|
minifyJson,
|
|
10550
|
+
normalizeIpaymuCallback,
|
|
10482
10551
|
parseCoreChargeResponse,
|
|
10483
10552
|
paymentManager,
|
|
10484
10553
|
providerRegistry,
|
|
@@ -10512,6 +10581,7 @@ var buayar = new Buayar();
|
|
|
10512
10581
|
verifyFaspaySignature,
|
|
10513
10582
|
verifyFinpaySignature,
|
|
10514
10583
|
verifyIpaymuCallback,
|
|
10584
|
+
verifyIpaymuCallbackSignature,
|
|
10515
10585
|
verifyNicepayWebhook,
|
|
10516
10586
|
verifyOyWebhook,
|
|
10517
10587
|
verifyPaypalWebhookSimple,
|
package/dist/index.mjs
CHANGED
|
@@ -124,16 +124,20 @@ var CANONICAL_TO_IPAYMU = {
|
|
|
124
124
|
danamon_va: { paymentMethod: "va", paymentChannel: "danamon" },
|
|
125
125
|
bsi_va: { paymentMethod: "va", paymentChannel: "bsi" },
|
|
126
126
|
bag_va: { paymentMethod: "va", paymentChannel: "bag" },
|
|
127
|
+
btn_va: { paymentMethod: "va", paymentChannel: "btn" },
|
|
127
128
|
muamalat_va: { paymentMethod: "va", paymentChannel: "bmi" },
|
|
128
129
|
bmi_va: { paymentMethod: "va", paymentChannel: "bmi" },
|
|
129
130
|
qris: { paymentMethod: "qris", paymentChannel: "mpm" },
|
|
130
131
|
gopay_qris: { paymentMethod: "qris", paymentChannel: "mpm" },
|
|
131
132
|
shopeepay_qris: { paymentMethod: "qris", paymentChannel: "mpm" },
|
|
133
|
+
dana: { paymentMethod: "ewallet", paymentChannel: "dana" },
|
|
134
|
+
shopeepay: { paymentMethod: "ewallet", paymentChannel: "shopeepay" },
|
|
132
135
|
alfamart: { paymentMethod: "cstore", paymentChannel: "alfamart" },
|
|
133
136
|
indomaret: { paymentMethod: "cstore", paymentChannel: "indomaret" },
|
|
134
137
|
credit_card: { paymentMethod: "cc", paymentChannel: "cc" },
|
|
135
138
|
akulaku: { paymentMethod: "paylater", paymentChannel: "akulaku" },
|
|
136
|
-
kredivo: { paymentMethod: "paylater", paymentChannel: "kredivo" }
|
|
139
|
+
kredivo: { paymentMethod: "paylater", paymentChannel: "kredivo" },
|
|
140
|
+
cod: { paymentMethod: "cod", paymentChannel: "cod" }
|
|
137
141
|
};
|
|
138
142
|
var CANONICAL_TO_XENDIT = {
|
|
139
143
|
bca_va: { type: "VIRTUAL_ACCOUNT", channel_code: "BCA" },
|
|
@@ -318,6 +322,9 @@ function toIpaymuPaymentMethod(code) {
|
|
|
318
322
|
if (lower.includes("alfa") || lower.includes("indo")) {
|
|
319
323
|
return { paymentMethod: "cstore", paymentChannel: lower };
|
|
320
324
|
}
|
|
325
|
+
if (lower.includes("dana") || lower.includes("shopee") || lower.includes("ovo") || lower.includes("gopay") || lower.includes("linkaja")) {
|
|
326
|
+
return { paymentMethod: "ewallet", paymentChannel: lower };
|
|
327
|
+
}
|
|
321
328
|
return { paymentMethod: lower };
|
|
322
329
|
}
|
|
323
330
|
function toXenditPaymentMethod(code) {
|
|
@@ -1557,6 +1564,44 @@ function generateIpaymuSignature(method, va, apiKey, body) {
|
|
|
1557
1564
|
const signature = hmacSha256(stringToSign, apiKey);
|
|
1558
1565
|
return { signature, timestamp };
|
|
1559
1566
|
}
|
|
1567
|
+
function normalizeIpaymuCallback(payload) {
|
|
1568
|
+
const result = {};
|
|
1569
|
+
for (const key of Object.keys(payload || {})) {
|
|
1570
|
+
const val = payload[key];
|
|
1571
|
+
if (key === "is_escrow") {
|
|
1572
|
+
result[key] = val === "true" || val === "1" || val === 1 || val === true;
|
|
1573
|
+
} else if (["trx_id", "status_code", "transaction_status_code", "paid_off"].includes(key)) {
|
|
1574
|
+
const intVal = parseInt(String(val), 10);
|
|
1575
|
+
result[key] = Number.isNaN(intVal) ? 0 : intVal;
|
|
1576
|
+
} else if (key === "additional_info") {
|
|
1577
|
+
result[key] = val === "[]" || val === "null" ? [] : val;
|
|
1578
|
+
} else if (key === "signature") {
|
|
1579
|
+
continue;
|
|
1580
|
+
} else {
|
|
1581
|
+
result[key] = String(val);
|
|
1582
|
+
}
|
|
1583
|
+
}
|
|
1584
|
+
if (!Object.prototype.hasOwnProperty.call(result, "additional_info")) {
|
|
1585
|
+
result.additional_info = [];
|
|
1586
|
+
}
|
|
1587
|
+
return result;
|
|
1588
|
+
}
|
|
1589
|
+
function buildIpaymuCallbackString(payload) {
|
|
1590
|
+
const normalized = normalizeIpaymuCallback(payload);
|
|
1591
|
+
const sorted = {};
|
|
1592
|
+
for (const key of Object.keys(normalized).sort((a, b) => a.localeCompare(b))) {
|
|
1593
|
+
sorted[key] = normalized[key];
|
|
1594
|
+
}
|
|
1595
|
+
let json = JSON.stringify(sorted);
|
|
1596
|
+
json = json.replace(/\//g, "\\/");
|
|
1597
|
+
return json;
|
|
1598
|
+
}
|
|
1599
|
+
function verifyIpaymuCallbackSignature(payload, secretKey, xSignature) {
|
|
1600
|
+
if (!secretKey || !xSignature) return false;
|
|
1601
|
+
const stringToSign = buildIpaymuCallbackString(payload);
|
|
1602
|
+
const computed = hmacSha256(stringToSign, secretKey);
|
|
1603
|
+
return safeCompare(String(xSignature).toLowerCase(), computed.toLowerCase());
|
|
1604
|
+
}
|
|
1560
1605
|
function verifyIpaymuCallback(payload) {
|
|
1561
1606
|
const status = (payload.status || "").toLowerCase();
|
|
1562
1607
|
const statusCode = payload.status_code !== void 0 ? String(payload.status_code) : "";
|
|
@@ -1675,13 +1720,23 @@ var IpaymuProvider = class extends BasePaymentProvider {
|
|
|
1675
1720
|
if (ipaymuMethod?.paymentMethod === "va") {
|
|
1676
1721
|
res.vaNumber = resData.PaymentNo;
|
|
1677
1722
|
res.vaBank = ipaymuMethod.paymentChannel;
|
|
1723
|
+
res.mode = "va";
|
|
1678
1724
|
} else if (ipaymuMethod?.paymentMethod === "cstore") {
|
|
1679
1725
|
res.paymentCode = resData.PaymentNo;
|
|
1726
|
+
res.mode = "retail";
|
|
1680
1727
|
}
|
|
1681
1728
|
}
|
|
1682
1729
|
if (resData.QrString || resData.QrImage) {
|
|
1683
1730
|
res.qrString = resData.QrString;
|
|
1684
1731
|
res.qrCodeUrl = resData.QrImage || resData.QrTemplate;
|
|
1732
|
+
res.mode = "qris";
|
|
1733
|
+
}
|
|
1734
|
+
if (ipaymuMethod?.paymentMethod === "ewallet") {
|
|
1735
|
+
res.mode = "ewallet";
|
|
1736
|
+
if (resData.Url) {
|
|
1737
|
+
res.deeplink = resData.Url;
|
|
1738
|
+
res.paymentUrl = resData.Url;
|
|
1739
|
+
}
|
|
1685
1740
|
}
|
|
1686
1741
|
if (resData.Expired) {
|
|
1687
1742
|
res.expiresAt = new Date(resData.Expired);
|
|
@@ -1712,15 +1767,20 @@ var IpaymuProvider = class extends BasePaymentProvider {
|
|
|
1712
1767
|
const { isPaid, isPending, isFailed } = verifyIpaymuCallback(body);
|
|
1713
1768
|
const orderId = body.reference_id || body.referenceId || body.trx_id || "";
|
|
1714
1769
|
const amount = body.amount || body.total || 0;
|
|
1770
|
+
const secretKey = config.merchantCode || config.merchantId || "";
|
|
1771
|
+
const headers = config.extra?.headers || {};
|
|
1772
|
+
const rawSig = headers["x-signature"] ?? headers["X-Signature"] ?? "";
|
|
1773
|
+
const xSignature = Array.isArray(rawSig) ? rawSig[0] : rawSig;
|
|
1774
|
+
const isValid = verifyIpaymuCallbackSignature(body, secretKey, xSignature);
|
|
1715
1775
|
return {
|
|
1716
|
-
isValid
|
|
1776
|
+
isValid,
|
|
1717
1777
|
provider: "ipaymu",
|
|
1718
1778
|
orderId: String(orderId),
|
|
1719
1779
|
amount: Number(amount) || 0,
|
|
1720
1780
|
status: isPaid ? "paid" : isPending ? "pending" : "failed",
|
|
1721
|
-
isPaid,
|
|
1722
|
-
isPending,
|
|
1723
|
-
isFailed,
|
|
1781
|
+
isPaid: isValid && isPaid,
|
|
1782
|
+
isPending: isValid && isPending,
|
|
1783
|
+
isFailed: !isValid || isFailed,
|
|
1724
1784
|
isExpired: (body.status || "").toLowerCase() === "expired",
|
|
1725
1785
|
statusCode: String(body.status_code || body.status || ""),
|
|
1726
1786
|
rawPayload: body
|
|
@@ -1768,6 +1828,8 @@ var IpaymuProvider = class extends BasePaymentProvider {
|
|
|
1768
1828
|
else if (groupCode === "cc") category = "Kartu Kredit";
|
|
1769
1829
|
else if (groupCode === "paylater") category = "Paylater / Cicilan";
|
|
1770
1830
|
else if (groupCode === "cod") category = "COD";
|
|
1831
|
+
else if (groupCode === "ewallet" || groupCode === "ewallet-asia") category = "E-Wallet";
|
|
1832
|
+
else if (groupCode === "debitonline") category = "Debit Online";
|
|
1771
1833
|
else category = groupName;
|
|
1772
1834
|
for (const ch of channels) {
|
|
1773
1835
|
const chCode = (ch.Code || "").toLowerCase();
|
|
@@ -1776,6 +1838,8 @@ var IpaymuProvider = class extends BasePaymentProvider {
|
|
|
1776
1838
|
canonicalCode = chCode === "bag" ? "bag_va" : chCode === "bmi" ? "muamalat_va" : `${chCode}_va`;
|
|
1777
1839
|
} else if (groupCode === "cc") {
|
|
1778
1840
|
canonicalCode = "credit_card";
|
|
1841
|
+
} else if (groupCode === "qris") {
|
|
1842
|
+
canonicalCode = "qris";
|
|
1779
1843
|
}
|
|
1780
1844
|
let totalFee = "-";
|
|
1781
1845
|
if (ch.TransactionFee) {
|
|
@@ -10292,6 +10356,7 @@ export {
|
|
|
10292
10356
|
buildBraintreeBasicAuth,
|
|
10293
10357
|
buildCoreChargePayload,
|
|
10294
10358
|
buildDefaultDescriptors,
|
|
10359
|
+
buildIpaymuCallbackString,
|
|
10295
10360
|
buildPaypalBasicAuth,
|
|
10296
10361
|
buildPayuBasicAuth,
|
|
10297
10362
|
buildRazorpayBasicAuth,
|
|
@@ -10314,6 +10379,7 @@ export {
|
|
|
10314
10379
|
hmacSha256,
|
|
10315
10380
|
md5,
|
|
10316
10381
|
minifyJson,
|
|
10382
|
+
normalizeIpaymuCallback,
|
|
10317
10383
|
parseCoreChargeResponse,
|
|
10318
10384
|
paymentManager,
|
|
10319
10385
|
providerRegistry,
|
|
@@ -10347,6 +10413,7 @@ export {
|
|
|
10347
10413
|
verifyFaspaySignature,
|
|
10348
10414
|
verifyFinpaySignature,
|
|
10349
10415
|
verifyIpaymuCallback,
|
|
10416
|
+
verifyIpaymuCallbackSignature,
|
|
10350
10417
|
verifyNicepayWebhook,
|
|
10351
10418
|
verifyOyWebhook,
|
|
10352
10419
|
verifyPaypalWebhookSimple,
|
package/docs/ipaymu.md
CHANGED
|
@@ -249,12 +249,17 @@ const banks = await client.getBankList();
|
|
|
249
249
|
|
|
250
250
|
## 9. Webhook & Verifikasi Notifikasi Callback
|
|
251
251
|
|
|
252
|
-
Saat pembeli menyelesaikan pembayaran, iPaymu mengirimkan HTTP POST request ke `notifyUrl
|
|
252
|
+
Saat pembeli menyelesaikan pembayaran, iPaymu mengirimkan HTTP POST request ke `notifyUrl`.
|
|
253
|
+
Callback **harus** membawa header `X-Signature`; Buayar memverifikasinya dengan
|
|
254
|
+
**HMAC-SHA256** atas payload callback yang dinormalisasi (sort kunci A–Z + escape slash)
|
|
255
|
+
menggunakan **Merchant VA** sebagai secret key. Callback tanpa `X-Signature` yang sah
|
|
256
|
+
akan selalu ditolak (`isValid === false`).
|
|
253
257
|
|
|
254
258
|
```typescript
|
|
255
|
-
// Di handler Express.js / Next.js API route:
|
|
259
|
+
// Di handler Express.js / Next.js API route + REST framework apapun (Elysia/Hono/...):
|
|
256
260
|
app.post("/api/payment/webhook", (req, res) => {
|
|
257
|
-
|
|
261
|
+
// Header request (termasuk `x-signature`) WAJIB diferuskan:
|
|
262
|
+
const result = buayar.verifyWebhook(req.body, req.headers);
|
|
258
263
|
|
|
259
264
|
if (result.isValid && result.isPaid) {
|
|
260
265
|
console.log("Pembayaran Berhasil untuk Order ID:", result.orderId);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@crediblemark/buayar",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.3",
|
|
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",
|