@crediblemark/buayar 0.2.1 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +292 -251
- package/dist/index.d.mts +338 -6
- package/dist/index.d.ts +338 -6
- package/dist/index.js +3039 -249
- package/dist/index.mjs +3009 -249
- package/package.json +43 -2
package/dist/index.d.ts
CHANGED
|
@@ -222,7 +222,7 @@ declare class MidtransClient {
|
|
|
222
222
|
sandbox?: boolean;
|
|
223
223
|
});
|
|
224
224
|
private getApiBaseUrl;
|
|
225
|
-
request(method: "GET" | "POST" | "PATCH" | "DELETE", path: string, body
|
|
225
|
+
request(method: "GET" | "POST" | "PATCH" | "DELETE", path: string, body?: any): Promise<any>;
|
|
226
226
|
cancelTransaction(orderId: string): Promise<any>;
|
|
227
227
|
refundTransaction(orderId: string, payload: {
|
|
228
228
|
refund_key?: string;
|
|
@@ -349,6 +349,87 @@ declare class StripeProvider extends BasePaymentProvider {
|
|
|
349
349
|
checkTransaction(params: CheckTransactionParams, config: ProviderConfig): Promise<CheckTransactionResult>;
|
|
350
350
|
}
|
|
351
351
|
|
|
352
|
+
declare class PaypalProvider extends BasePaymentProvider {
|
|
353
|
+
readonly name = "paypal";
|
|
354
|
+
private getSandbox;
|
|
355
|
+
private getBaseUrl;
|
|
356
|
+
/** OAuth2 Client Credentials — dapatkan access token */
|
|
357
|
+
private getAccessToken;
|
|
358
|
+
createInvoice(params: CreateInvoiceParams, config: ProviderConfig): Promise<InvoiceResponse>;
|
|
359
|
+
verifyCallback(body: any, config: ProviderConfig): Promise<VerifyCallbackResult>;
|
|
360
|
+
getPaymentMethods(params: GetPaymentMethodsParams, config: ProviderConfig): Promise<GetPaymentMethodsResult>;
|
|
361
|
+
checkTransaction(params: CheckTransactionParams, config: ProviderConfig): Promise<CheckTransactionResult>;
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
declare class AdyenProvider extends BasePaymentProvider {
|
|
365
|
+
readonly name = "adyen";
|
|
366
|
+
private getBaseUrl;
|
|
367
|
+
createInvoice(params: CreateInvoiceParams, config: ProviderConfig): Promise<InvoiceResponse>;
|
|
368
|
+
verifyCallback(body: any, config: ProviderConfig): Promise<VerifyCallbackResult>;
|
|
369
|
+
getPaymentMethods(params: GetPaymentMethodsParams, config: ProviderConfig): Promise<GetPaymentMethodsResult>;
|
|
370
|
+
checkTransaction(params: CheckTransactionParams, config: ProviderConfig): Promise<CheckTransactionResult>;
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
declare class CheckoutComProvider extends BasePaymentProvider {
|
|
374
|
+
readonly name = "checkoutcom";
|
|
375
|
+
private getBaseUrl;
|
|
376
|
+
createInvoice(params: CreateInvoiceParams, config: ProviderConfig): Promise<InvoiceResponse>;
|
|
377
|
+
verifyCallback(body: any, config: ProviderConfig): Promise<VerifyCallbackResult>;
|
|
378
|
+
getPaymentMethods(params: GetPaymentMethodsParams, config: ProviderConfig): Promise<GetPaymentMethodsResult>;
|
|
379
|
+
checkTransaction(params: CheckTransactionParams, config: ProviderConfig): Promise<CheckTransactionResult>;
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
declare class RazorpayProvider extends BasePaymentProvider {
|
|
383
|
+
readonly name = "razorpay";
|
|
384
|
+
private getBaseUrl;
|
|
385
|
+
private buildHeaders;
|
|
386
|
+
createInvoice(params: CreateInvoiceParams, config: ProviderConfig): Promise<InvoiceResponse>;
|
|
387
|
+
verifyCallback(body: any, config: ProviderConfig): Promise<VerifyCallbackResult>;
|
|
388
|
+
getPaymentMethods(params: GetPaymentMethodsParams, config: ProviderConfig): Promise<GetPaymentMethodsResult>;
|
|
389
|
+
checkTransaction(params: CheckTransactionParams, config: ProviderConfig): Promise<CheckTransactionResult>;
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
declare class SquareProvider extends BasePaymentProvider {
|
|
393
|
+
readonly name = "square";
|
|
394
|
+
private getBaseUrl;
|
|
395
|
+
private buildHeaders;
|
|
396
|
+
createInvoice(params: CreateInvoiceParams, config: ProviderConfig): Promise<InvoiceResponse>;
|
|
397
|
+
verifyCallback(body: any, config: ProviderConfig): Promise<VerifyCallbackResult>;
|
|
398
|
+
getPaymentMethods(params: GetPaymentMethodsParams, config: ProviderConfig): Promise<GetPaymentMethodsResult>;
|
|
399
|
+
checkTransaction(params: CheckTransactionParams, config: ProviderConfig): Promise<CheckTransactionResult>;
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
declare class PayuProvider extends BasePaymentProvider {
|
|
403
|
+
readonly name = "payu";
|
|
404
|
+
private getBaseUrl;
|
|
405
|
+
/** OAuth2 Bearer Token untuk PayU */
|
|
406
|
+
private getAccessToken;
|
|
407
|
+
createInvoice(params: CreateInvoiceParams, config: ProviderConfig): Promise<InvoiceResponse>;
|
|
408
|
+
verifyCallback(body: any, config: ProviderConfig): Promise<VerifyCallbackResult>;
|
|
409
|
+
getPaymentMethods(params: GetPaymentMethodsParams, config: ProviderConfig): Promise<GetPaymentMethodsResult>;
|
|
410
|
+
checkTransaction(params: CheckTransactionParams, config: ProviderConfig): Promise<CheckTransactionResult>;
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
declare class BraintreeProvider extends BasePaymentProvider {
|
|
414
|
+
readonly name = "braintree";
|
|
415
|
+
private getBaseUrl;
|
|
416
|
+
private buildHeaders;
|
|
417
|
+
createInvoice(params: CreateInvoiceParams, config: ProviderConfig): Promise<InvoiceResponse>;
|
|
418
|
+
verifyCallback(body: any, config: ProviderConfig): Promise<VerifyCallbackResult>;
|
|
419
|
+
getPaymentMethods(params: GetPaymentMethodsParams, config: ProviderConfig): Promise<GetPaymentMethodsResult>;
|
|
420
|
+
checkTransaction(params: CheckTransactionParams, config: ProviderConfig): Promise<CheckTransactionResult>;
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
declare class TwoCheckoutProvider extends BasePaymentProvider {
|
|
424
|
+
readonly name = "twocheckout";
|
|
425
|
+
private getBaseUrl;
|
|
426
|
+
private buildHeaders;
|
|
427
|
+
createInvoice(params: CreateInvoiceParams, config: ProviderConfig): Promise<InvoiceResponse>;
|
|
428
|
+
verifyCallback(body: any, config: ProviderConfig): Promise<VerifyCallbackResult>;
|
|
429
|
+
getPaymentMethods(params: GetPaymentMethodsParams, config: ProviderConfig): Promise<GetPaymentMethodsResult>;
|
|
430
|
+
checkTransaction(params: CheckTransactionParams, config: ProviderConfig): Promise<CheckTransactionResult>;
|
|
431
|
+
}
|
|
432
|
+
|
|
352
433
|
interface DuitkuDisbursementParams {
|
|
353
434
|
bankCode: string;
|
|
354
435
|
bankAccount: string;
|
|
@@ -672,6 +753,135 @@ declare class StripeClient {
|
|
|
672
753
|
createRefund(paymentIntentId: string, amount?: number): Promise<any>;
|
|
673
754
|
}
|
|
674
755
|
|
|
756
|
+
declare class PaypalClient {
|
|
757
|
+
private config;
|
|
758
|
+
constructor(config: ProviderConfig);
|
|
759
|
+
private getBaseUrl;
|
|
760
|
+
private getAccessToken;
|
|
761
|
+
/** Ambil detail order PayPal berdasarkan Order ID */
|
|
762
|
+
getOrder(orderId: string): Promise<any>;
|
|
763
|
+
/** Capture order PayPal (mengeksekusi pembayaran yang sudah diapprove buyer) */
|
|
764
|
+
captureOrder(orderId: string): Promise<any>;
|
|
765
|
+
/** Refund capture PayPal */
|
|
766
|
+
refundCapture(captureId: string, amount?: number, currency?: string): Promise<any>;
|
|
767
|
+
/** Cek saldo akun PayPal merchant (hanya tersedia di account via Seller REST API) */
|
|
768
|
+
checkBalance(): Promise<any>;
|
|
769
|
+
/** Verifikasi webhook via PayPal Webhook Verification API */
|
|
770
|
+
verifyWebhookSignature(webhookId: string, body: any, headers: Record<string, string>): Promise<boolean>;
|
|
771
|
+
}
|
|
772
|
+
|
|
773
|
+
declare class AdyenClient {
|
|
774
|
+
private config;
|
|
775
|
+
constructor(config: ProviderConfig);
|
|
776
|
+
private getBaseUrl;
|
|
777
|
+
private buildHeaders;
|
|
778
|
+
/** Ambil detail payment berdasarkan PSP Reference */
|
|
779
|
+
getPaymentDetails(pspReference: string): Promise<any>;
|
|
780
|
+
/** Batalkan payment (sebelum capture) */
|
|
781
|
+
cancelPayment(pspReference: string, merchantAccount?: string): Promise<any>;
|
|
782
|
+
/** Refund payment yang sudah di-capture */
|
|
783
|
+
refundPayment(pspReference: string, amount: number, currency: string, merchantAccount?: string): Promise<any>;
|
|
784
|
+
/** Capture authorized payment */
|
|
785
|
+
capturePayment(pspReference: string, amount: number, currency: string, merchantAccount?: string): Promise<any>;
|
|
786
|
+
/** Ambil daftar payment methods yang tersedia */
|
|
787
|
+
getAvailablePaymentMethods(merchantAccount: string, countryCode: string, currency: string, amount: number): Promise<any>;
|
|
788
|
+
}
|
|
789
|
+
|
|
790
|
+
declare class CheckoutComClient {
|
|
791
|
+
private config;
|
|
792
|
+
constructor(config: ProviderConfig);
|
|
793
|
+
private getBaseUrl;
|
|
794
|
+
private buildHeaders;
|
|
795
|
+
/** Ambil detail payment berdasarkan Payment ID */
|
|
796
|
+
getPaymentDetails(paymentId: string): Promise<any>;
|
|
797
|
+
/** Void (batalkan) payment yang belum di-capture */
|
|
798
|
+
voidPayment(paymentId: string, reference?: string): Promise<any>;
|
|
799
|
+
/** Refund payment yang sudah di-capture */
|
|
800
|
+
refundPayment(paymentId: string, amount?: number, reference?: string): Promise<any>;
|
|
801
|
+
/** Cek saldo merchant di Checkout.com */
|
|
802
|
+
checkBalance(): Promise<any>;
|
|
803
|
+
/** Ambil daftar payment links */
|
|
804
|
+
listPaymentLinks(): Promise<any>;
|
|
805
|
+
}
|
|
806
|
+
|
|
807
|
+
declare class RazorpayClient {
|
|
808
|
+
private config;
|
|
809
|
+
constructor(config: ProviderConfig);
|
|
810
|
+
private getBaseUrl;
|
|
811
|
+
private buildHeaders;
|
|
812
|
+
/** Ambil detail payment */
|
|
813
|
+
fetchPayment(paymentId: string): Promise<any>;
|
|
814
|
+
/** Capture authorized payment */
|
|
815
|
+
capturePayment(paymentId: string, amount: number, currency?: string): Promise<any>;
|
|
816
|
+
/** Buat refund untuk payment */
|
|
817
|
+
createRefund(paymentId: string, amount?: number, notes?: Record<string, string>): Promise<any>;
|
|
818
|
+
/** Cek saldo akun Razorpay */
|
|
819
|
+
checkBalance(): Promise<any>;
|
|
820
|
+
/** Ambil daftar semua payment */
|
|
821
|
+
listPayments(from?: number, to?: number, count?: number): Promise<any>;
|
|
822
|
+
}
|
|
823
|
+
|
|
824
|
+
declare class SquareClient {
|
|
825
|
+
private config;
|
|
826
|
+
constructor(config: ProviderConfig);
|
|
827
|
+
private getBaseUrl;
|
|
828
|
+
private buildHeaders;
|
|
829
|
+
/** Ambil detail payment Square */
|
|
830
|
+
getPayment(paymentId: string): Promise<any>;
|
|
831
|
+
/** Batalkan payment Square */
|
|
832
|
+
cancelPayment(paymentId: string): Promise<any>;
|
|
833
|
+
/** Refund payment Square */
|
|
834
|
+
refundPayment(paymentId: string, amount: number, currency: string, idempotencyKey: string, reason?: string): Promise<any>;
|
|
835
|
+
/** Ambil saldo location Square */
|
|
836
|
+
retrieveBalance(locationId?: string): Promise<any>;
|
|
837
|
+
/** List semua locations merchant */
|
|
838
|
+
listLocations(): Promise<any>;
|
|
839
|
+
}
|
|
840
|
+
|
|
841
|
+
declare class PayuClient {
|
|
842
|
+
private config;
|
|
843
|
+
private accessToken;
|
|
844
|
+
constructor(config: ProviderConfig);
|
|
845
|
+
private getBaseUrl;
|
|
846
|
+
private getToken;
|
|
847
|
+
/** Ambil detail order PayU */
|
|
848
|
+
getOrder(orderId: string): Promise<any>;
|
|
849
|
+
/** Batalkan order PayU */
|
|
850
|
+
cancelOrder(orderId: string): Promise<any>;
|
|
851
|
+
/** Refund order PayU */
|
|
852
|
+
refundOrder(orderId: string, amount?: number, description?: string): Promise<any>;
|
|
853
|
+
}
|
|
854
|
+
|
|
855
|
+
declare class BraintreeClient {
|
|
856
|
+
private config;
|
|
857
|
+
constructor(config: ProviderConfig);
|
|
858
|
+
private getBaseUrl;
|
|
859
|
+
private buildHeaders;
|
|
860
|
+
/** Generate Client Token untuk frontend Drop-in UI */
|
|
861
|
+
getClientToken(customerId?: string): Promise<string>;
|
|
862
|
+
/** Ambil detail transaction */
|
|
863
|
+
findTransaction(transactionId: string): Promise<any>;
|
|
864
|
+
/** Refund transaction Braintree */
|
|
865
|
+
refundTransaction(transactionId: string, amount?: number): Promise<any>;
|
|
866
|
+
/** Void (batalkan) transaction sebelum settlement */
|
|
867
|
+
voidTransaction(transactionId: string): Promise<any>;
|
|
868
|
+
}
|
|
869
|
+
|
|
870
|
+
declare class TwoCheckoutClient {
|
|
871
|
+
private config;
|
|
872
|
+
constructor(config: ProviderConfig);
|
|
873
|
+
private getBaseUrl;
|
|
874
|
+
private buildHeaders;
|
|
875
|
+
/** Ambil detail order 2Checkout berdasarkan Reference Number */
|
|
876
|
+
getOrder(refNo: string): Promise<any>;
|
|
877
|
+
/** Refund order 2Checkout */
|
|
878
|
+
refundOrder(refNo: string, amount: number, comment?: string): Promise<any>;
|
|
879
|
+
/** Ambil detail subscription */
|
|
880
|
+
getSubscription(subscriptionRef: string): Promise<any>;
|
|
881
|
+
/** List semua orders merchant */
|
|
882
|
+
listOrders(page?: number, limit?: number): Promise<any>;
|
|
883
|
+
}
|
|
884
|
+
|
|
675
885
|
declare class PaymentManager {
|
|
676
886
|
private providers;
|
|
677
887
|
constructor();
|
|
@@ -699,6 +909,22 @@ declare class PaymentManager {
|
|
|
699
909
|
getOyClient(config: ProviderConfig): OyClient;
|
|
700
910
|
getStripeProvider(): StripeProvider;
|
|
701
911
|
getStripeClient(config: ProviderConfig): StripeClient;
|
|
912
|
+
getPaypalProvider(): PaypalProvider;
|
|
913
|
+
getPaypalClient(config: ProviderConfig): PaypalClient;
|
|
914
|
+
getAdyenProvider(): AdyenProvider;
|
|
915
|
+
getAdyenClient(config: ProviderConfig): AdyenClient;
|
|
916
|
+
getCheckoutComProvider(): CheckoutComProvider;
|
|
917
|
+
getCheckoutComClient(config: ProviderConfig): CheckoutComClient;
|
|
918
|
+
getRazorpayProvider(): RazorpayProvider;
|
|
919
|
+
getRazorpayClient(config: ProviderConfig): RazorpayClient;
|
|
920
|
+
getSquareProvider(): SquareProvider;
|
|
921
|
+
getSquareClient(config: ProviderConfig): SquareClient;
|
|
922
|
+
getPayuProvider(): PayuProvider;
|
|
923
|
+
getPayuClient(config: ProviderConfig): PayuClient;
|
|
924
|
+
getBraintreeProvider(): BraintreeProvider;
|
|
925
|
+
getBraintreeClient(config: ProviderConfig): BraintreeClient;
|
|
926
|
+
getTwoCheckoutProvider(): TwoCheckoutProvider;
|
|
927
|
+
getTwoCheckoutClient(config: ProviderConfig): TwoCheckoutClient;
|
|
702
928
|
createInvoice(providerName: string, params: CreateInvoiceParams, config: ProviderConfig): Promise<InvoiceResponse>;
|
|
703
929
|
verifyCallback(providerName: string, body: any, config: ProviderConfig): Promise<VerifyCallbackResult>;
|
|
704
930
|
getPaymentMethods(providerName: string, params: GetPaymentMethodsParams, config: ProviderConfig): Promise<GetPaymentMethodsResult>;
|
|
@@ -722,6 +948,10 @@ declare function resolveConfigFromEnv(customConfig?: BuayarConfig): BuayarConfig
|
|
|
722
948
|
*
|
|
723
949
|
* Antarmuka tingkat tinggi untuk membuat transaksi, query channel pembayaran,
|
|
724
950
|
* pengecekan status, dan verifikasi webhook universal tanpa perlu rombak kode.
|
|
951
|
+
*
|
|
952
|
+
* Mendukung 19 Payment Gateway: Midtrans, Duitku, iPaymu, Xendit, DOKU, PrismaLink,
|
|
953
|
+
* Faspay, Finpay, Nicepay, OY! Bisnis, Stripe, PayPal, Adyen, Checkout.com,
|
|
954
|
+
* Razorpay, Square, PayU, Braintree, 2Checkout/Verifone.
|
|
725
955
|
*/
|
|
726
956
|
declare class Buayar {
|
|
727
957
|
private manager;
|
|
@@ -736,7 +966,7 @@ declare class Buayar {
|
|
|
736
966
|
*/
|
|
737
967
|
setConfig(config: Partial<BuayarConfig>): void;
|
|
738
968
|
/**
|
|
739
|
-
* Dapatkan nama provider aktif
|
|
969
|
+
* Dapatkan nama provider aktif
|
|
740
970
|
*/
|
|
741
971
|
get provider(): string;
|
|
742
972
|
/**
|
|
@@ -777,6 +1007,14 @@ declare class Buayar {
|
|
|
777
1007
|
getNicepayClient(configOverride?: Partial<ProviderConfig>): NicepayClient;
|
|
778
1008
|
getOyClient(configOverride?: Partial<ProviderConfig>): OyClient;
|
|
779
1009
|
getStripeClient(configOverride?: Partial<ProviderConfig>): StripeClient;
|
|
1010
|
+
getPaypalClient(configOverride?: Partial<ProviderConfig>): PaypalClient;
|
|
1011
|
+
getAdyenClient(configOverride?: Partial<ProviderConfig>): AdyenClient;
|
|
1012
|
+
getCheckoutComClient(configOverride?: Partial<ProviderConfig>): CheckoutComClient;
|
|
1013
|
+
getRazorpayClient(configOverride?: Partial<ProviderConfig>): RazorpayClient;
|
|
1014
|
+
getSquareClient(configOverride?: Partial<ProviderConfig>): SquareClient;
|
|
1015
|
+
getPayuClient(configOverride?: Partial<ProviderConfig>): PayuClient;
|
|
1016
|
+
getBraintreeClient(configOverride?: Partial<ProviderConfig>): BraintreeClient;
|
|
1017
|
+
getTwoCheckoutClient(configOverride?: Partial<ProviderConfig>): TwoCheckoutClient;
|
|
780
1018
|
}
|
|
781
1019
|
declare const buayar: Buayar;
|
|
782
1020
|
|
|
@@ -1040,11 +1278,102 @@ declare function verifyOyWebhook(headers: Record<string, string | string[] | und
|
|
|
1040
1278
|
*/
|
|
1041
1279
|
declare function serializeStripeParams(obj: any, prefix?: string): string;
|
|
1042
1280
|
/**
|
|
1043
|
-
* Verifikasi webhook signature Stripe (stripe-signature header)
|
|
1281
|
+
* Verifikasi webhook signature Stripe (stripe-signature header).
|
|
1282
|
+
*
|
|
1044
1283
|
* Format header: t=1492774577,v1=5257a869e7ecebeda32affa62cd323fa9d214e1b50613e039f08f6362ced773d
|
|
1284
|
+
*
|
|
1285
|
+
* Keamanan:
|
|
1286
|
+
* - Jika signatureHeader atau webhookSecret tidak ada → return false (TIDAK pernah return true).
|
|
1287
|
+
* Gunakan flag `skipVerification: true` secara eksplisit di kode test jika ingin bypass.
|
|
1288
|
+
* - Pemeriksaan timestamp (replay attack protection): jika selisih antara
|
|
1289
|
+
* timestamp header dan waktu sekarang melebihi `toleranceSeconds`, return false.
|
|
1290
|
+
* - Perbandingan signature menggunakan `safeCompare` (timing-safe via crypto.timingSafeEqual).
|
|
1291
|
+
*
|
|
1292
|
+
* @param rawPayload Body request mentah (string atau object; jika object akan di-JSON.stringify)
|
|
1293
|
+
* @param signatureHeader Nilai header `stripe-signature`
|
|
1294
|
+
* @param webhookSecret Webhook Signing Secret dari dashboard Stripe (`whsec_...`)
|
|
1295
|
+
* @param toleranceSeconds Toleransi selisih timestamp (default: 300 detik / 5 menit)
|
|
1296
|
+
* @returns true jika signature valid dan timestamp dalam toleransi; false selainnya
|
|
1045
1297
|
*/
|
|
1046
1298
|
declare function verifyStripeWebhook(rawPayload: string | any, signatureHeader: string, webhookSecret: string, toleranceSeconds?: number): boolean;
|
|
1047
1299
|
|
|
1300
|
+
/**
|
|
1301
|
+
* Encode Basic Auth untuk PayPal REST API (client_id:client_secret)
|
|
1302
|
+
*/
|
|
1303
|
+
declare function buildPaypalBasicAuth(clientId: string, clientSecret: string): string;
|
|
1304
|
+
/**
|
|
1305
|
+
* Verifikasi PayPal webhook signature (simplified HMAC via transmission-sig header).
|
|
1306
|
+
* Full cert-chain verification tersedia via POST /v1/notifications/verify-webhook-signature.
|
|
1307
|
+
*/
|
|
1308
|
+
declare function verifyPaypalWebhookSimple(transmissionId: string, timestamp: string, webhookId: string, body: string, transmissionSig: string, certUrl: string): boolean;
|
|
1309
|
+
/**
|
|
1310
|
+
* Serialize object ke URL-encoded query string (shallow)
|
|
1311
|
+
*/
|
|
1312
|
+
declare function serializePaypalParams(obj: Record<string, any>): string;
|
|
1313
|
+
|
|
1314
|
+
/**
|
|
1315
|
+
* Verifikasi Adyen webhook signature (HMAC-SHA256).
|
|
1316
|
+
* Adyen menggunakan sorted key-value string dari notification item.
|
|
1317
|
+
*/
|
|
1318
|
+
declare function verifyAdyenWebhook(notificationItem: any, hmacKey: string): boolean;
|
|
1319
|
+
|
|
1320
|
+
/**
|
|
1321
|
+
* Verifikasi Checkout.com webhook signature (HMAC-SHA256).
|
|
1322
|
+
* Header: Cko-Signature: sha256=<hex_digest>
|
|
1323
|
+
*/
|
|
1324
|
+
declare function verifyCheckoutComWebhook(body: string, signatureHeader: string, secret: string): boolean;
|
|
1325
|
+
|
|
1326
|
+
/**
|
|
1327
|
+
* Verifikasi Razorpay webhook signature (HMAC-SHA256).
|
|
1328
|
+
* Header: X-Razorpay-Signature
|
|
1329
|
+
*/
|
|
1330
|
+
declare function verifyRazorpayWebhook(rawBody: string, signature: string, webhookSecret: string): boolean;
|
|
1331
|
+
/**
|
|
1332
|
+
* Buat Basic Auth header untuk Razorpay (key_id:key_secret)
|
|
1333
|
+
*/
|
|
1334
|
+
declare function buildRazorpayBasicAuth(keyId: string, keySecret: string): string;
|
|
1335
|
+
|
|
1336
|
+
/**
|
|
1337
|
+
* Verifikasi Square webhook signature (HMAC-SHA256).
|
|
1338
|
+
* Header: x-square-hmacsha256-signature
|
|
1339
|
+
* Signature = Base64(HMAC-SHA256(signatureKey, notificationUrl + body))
|
|
1340
|
+
*/
|
|
1341
|
+
declare function verifySquareWebhook(rawBody: string, signatureHeader: string, signatureKey: string, notificationUrl: string): boolean;
|
|
1342
|
+
|
|
1343
|
+
/**
|
|
1344
|
+
* Verifikasi PayU webhook signature (MD5 atau SHA-256 dari OpenPayU-Signature header).
|
|
1345
|
+
* Format header: sender=checkout;signature=<md5_hash>;algorithm=MD5;version=2.1
|
|
1346
|
+
*/
|
|
1347
|
+
declare function verifyPayuWebhook(rawBody: string, signatureHeader: string, md5Key: string): boolean;
|
|
1348
|
+
/**
|
|
1349
|
+
* Build Basic Auth untuk PayU Token endpoint
|
|
1350
|
+
*/
|
|
1351
|
+
declare function buildPayuBasicAuth(clientId: string, clientSecret: string): string;
|
|
1352
|
+
|
|
1353
|
+
/**
|
|
1354
|
+
* Verifikasi Braintree webhook signature (SHA1 HMAC dari bt_payload).
|
|
1355
|
+
* Header contains: bt_signature=public_key|sha1_hmac & bt_payload=base64_encoded
|
|
1356
|
+
*/
|
|
1357
|
+
declare function verifyBraintreeWebhook(btSignature: string, btPayload: string, privateKey: string): boolean;
|
|
1358
|
+
/**
|
|
1359
|
+
* Build Basic Auth untuk Braintree API (public_key:private_key)
|
|
1360
|
+
*/
|
|
1361
|
+
declare function buildBraintreeBasicAuth(publicKey: string, privateKey: string): string;
|
|
1362
|
+
|
|
1363
|
+
/**
|
|
1364
|
+
* Build 2Checkout API Authentication header.
|
|
1365
|
+
* Format: code=MERCHANT_CODE date=DATE hash=HMAC-SHA256(MERCHANT_CODE + date + secretKey)
|
|
1366
|
+
*/
|
|
1367
|
+
declare function buildTwoCheckoutAuth(merchantCode: string, secretKey: string): {
|
|
1368
|
+
header: string;
|
|
1369
|
+
date: string;
|
|
1370
|
+
};
|
|
1371
|
+
/**
|
|
1372
|
+
* Verifikasi 2Checkout IPN/webhook (MD5 hash).
|
|
1373
|
+
* hash = MD5(secretWord + saleId + productId + invoiceId)
|
|
1374
|
+
*/
|
|
1375
|
+
declare function verifyTwoCheckoutWebhook(secretWord: string, saleId: string, productId: string, invoiceId: string, providedHash: string): boolean;
|
|
1376
|
+
|
|
1048
1377
|
/**
|
|
1049
1378
|
* Generate MD5 hash string (lowercase)
|
|
1050
1379
|
*/
|
|
@@ -1058,11 +1387,14 @@ declare function sha256(data: string): string;
|
|
|
1058
1387
|
*/
|
|
1059
1388
|
declare function sha512(data: string): string;
|
|
1060
1389
|
/**
|
|
1061
|
-
* Generate HMAC-SHA256 hash string (lowercase)
|
|
1390
|
+
* Generate HMAC-SHA256 hash string (lowercase hex)
|
|
1062
1391
|
*/
|
|
1063
1392
|
declare function hmacSha256(data: string, secret: string): string;
|
|
1064
1393
|
/**
|
|
1065
|
-
* Timing-safe string comparison
|
|
1394
|
+
* Timing-safe string comparison menggunakan crypto.timingSafeEqual
|
|
1395
|
+
* untuk mencegah timing attack pada perbandingan signature / token.
|
|
1396
|
+
* Menggunakan SHA-256 digest untuk memastikan kedua buffer selalu berukuran 32 bytes,
|
|
1397
|
+
* mencegah kebocoran informasi panjang string dan mengatasi penanganan string non-hex / ganjil oleh Buffer.from.
|
|
1066
1398
|
*/
|
|
1067
1399
|
declare function safeCompare(a: string, b: string): boolean;
|
|
1068
1400
|
|
|
@@ -1071,4 +1403,4 @@ declare function safeCompare(a: string, b: string): boolean;
|
|
|
1071
1403
|
*/
|
|
1072
1404
|
declare function getPaymentMethodCategory(code: string, name?: string): "Virtual Account" | "QRIS" | "E-Wallet" | "Retail / Gerai" | "Kartu Kredit" | "Paylater / Cicilan" | "Lainnya";
|
|
1073
1405
|
|
|
1074
|
-
export { BasePaymentProvider, 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 CheckTransactionParams, type CheckTransactionResult, type CreateInvoiceParams, type CustomerDetails, DUITKU_TO_CANONICAL, DokuClient, DokuProvider, DuitkuClient, type DuitkuDisbursementParams, DuitkuProvider, 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, PrismalinkClient, PrismalinkProvider, type ProviderConfig, StripeClient, StripeProvider, type VerifyCallbackResult, XenditClient, type XenditDisbursementParams, XenditProvider, buayar, buildCoreChargePayload, formatNicepayTimestamp, generateDokuHeaders, generateFaspaySignature, generateFinpaySignature, generateIpaymuSignature, generateNicepayToken, generateOyHeaders, generatePrismalinkSignature, getDuitkuInquirySignatures, getDuitkuPaymentMethodsSignature, getDuitkuStatusSignatures, getPaymentMethodCategory, getXenditAuthHeader, hmacSha256, md5, parseCoreChargeResponse, paymentManager, resolveConfigFromEnv, safeCompare, serializeStripeParams, sha256, sha512, toCanonicalPaymentMethod, toDokuPaymentMethod, toDuitkuPaymentMethod, toFaspayPaymentMethod, toFinpayPaymentMethod, toIpaymuPaymentMethod, toNicepayPaymentMethod, toOyPaymentMethod, toPrismalinkPaymentMethod, toStripePaymentMethod, toXenditPaymentMethod, verifyDokuWebhookSignature, verifyDuitkuCallbackSignature, verifyFaspaySignature, verifyFinpaySignature, verifyIpaymuCallback, verifyNicepayWebhook, verifyOyWebhook, verifyPrismalinkSignature, verifyStripeWebhook, verifyXenditWebhookToken };
|
|
1406
|
+
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 CheckTransactionParams, type CheckTransactionResult, CheckoutComClient, CheckoutComProvider, type CreateInvoiceParams, type CustomerDetails, DUITKU_TO_CANONICAL, DokuClient, DokuProvider, DuitkuClient, type DuitkuDisbursementParams, DuitkuProvider, 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, PaypalClient, PaypalProvider, PayuClient, PayuProvider, PrismalinkClient, PrismalinkProvider, type ProviderConfig, RazorpayClient, RazorpayProvider, SquareClient, SquareProvider, StripeClient, StripeProvider, TwoCheckoutClient, TwoCheckoutProvider, type VerifyCallbackResult, XenditClient, type XenditDisbursementParams, XenditProvider, buayar, buildBraintreeBasicAuth, buildCoreChargePayload, buildPaypalBasicAuth, buildPayuBasicAuth, buildRazorpayBasicAuth, buildTwoCheckoutAuth, formatNicepayTimestamp, generateDokuHeaders, generateFaspaySignature, generateFinpaySignature, generateIpaymuSignature, generateNicepayToken, generateOyHeaders, generatePrismalinkSignature, getDuitkuInquirySignatures, getDuitkuPaymentMethodsSignature, getDuitkuStatusSignatures, getPaymentMethodCategory, getXenditAuthHeader, hmacSha256, md5, parseCoreChargeResponse, paymentManager, resolveConfigFromEnv, safeCompare, serializePaypalParams, serializeStripeParams, sha256, sha512, 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, verifySquareWebhook, verifyStripeWebhook, verifyTwoCheckoutWebhook, verifyXenditWebhookToken };
|