@pague-dev/sdk-node 1.3.0 → 2.1.0
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/index.cjs +3 -1
- package/dist/index.d.cts +76 -4
- package/dist/index.d.mts +76 -4
- package/dist/index.mjs +3 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -226,7 +226,9 @@ function isValidWebhookEvent(event) {
|
|
|
226
226
|
"payment_expired",
|
|
227
227
|
"refund_completed",
|
|
228
228
|
"withdrawal_completed",
|
|
229
|
-
"withdrawal_failed"
|
|
229
|
+
"withdrawal_failed",
|
|
230
|
+
"withdrawal_reversed",
|
|
231
|
+
"balance_block_created"
|
|
230
232
|
].includes(obj.event);
|
|
231
233
|
}
|
|
232
234
|
/**
|
package/dist/index.d.cts
CHANGED
|
@@ -385,7 +385,7 @@ declare class Pdev {
|
|
|
385
385
|
/**
|
|
386
386
|
* Available webhook event types
|
|
387
387
|
*/
|
|
388
|
-
type WebhookEventType = 'payment_completed' | 'payment_expired' | 'refund_completed' | 'withdrawal_completed' | 'withdrawal_failed';
|
|
388
|
+
type WebhookEventType = 'payment_completed' | 'payment_expired' | 'refund_completed' | 'withdrawal_completed' | 'withdrawal_failed' | 'withdrawal_reversed' | 'balance_block_created';
|
|
389
389
|
/**
|
|
390
390
|
* Base webhook payload structure
|
|
391
391
|
*/
|
|
@@ -432,8 +432,14 @@ interface PaymentCompletedData {
|
|
|
432
432
|
interface PaymentExpiredData {
|
|
433
433
|
/** Transaction identifier */
|
|
434
434
|
transactionId: string;
|
|
435
|
+
/** Environment where the transaction occurred */
|
|
436
|
+
environment: 'production' | 'sandbox';
|
|
435
437
|
/** Payment amount */
|
|
436
438
|
amount: number;
|
|
439
|
+
/** Platform fees (always 0 for expired payments) */
|
|
440
|
+
feeAmount: number;
|
|
441
|
+
/** Net amount (always 0 for expired payments) */
|
|
442
|
+
netAmount: number;
|
|
437
443
|
/** Currency code (e.g., "BRL") */
|
|
438
444
|
currency: string;
|
|
439
445
|
/** Payment method used (e.g., "pix") */
|
|
@@ -465,10 +471,14 @@ interface RefundCompletedData {
|
|
|
465
471
|
netAmount: number;
|
|
466
472
|
/** Currency code (e.g., "BRL") */
|
|
467
473
|
currency: string;
|
|
474
|
+
/** Payment method of the original transaction */
|
|
475
|
+
paymentMethod: string;
|
|
468
476
|
/** Refund status */
|
|
469
477
|
status: 'completed';
|
|
470
478
|
/** ISO 8601 timestamp of when refund was completed */
|
|
471
|
-
|
|
479
|
+
refundedAt: string;
|
|
480
|
+
/** Your external reference ID from the original payment (optional) */
|
|
481
|
+
externalReference?: string;
|
|
472
482
|
/** Custom metadata from the original payment */
|
|
473
483
|
metadata?: Record<string, unknown>;
|
|
474
484
|
}
|
|
@@ -520,6 +530,35 @@ interface WithdrawalFailedData {
|
|
|
520
530
|
/** Custom metadata from the withdrawal request */
|
|
521
531
|
metadata?: Record<string, unknown>;
|
|
522
532
|
}
|
|
533
|
+
/**
|
|
534
|
+
* Data payload for withdrawal_reversed event
|
|
535
|
+
*/
|
|
536
|
+
interface WithdrawalReversedData {
|
|
537
|
+
/** Reversal transaction identifier */
|
|
538
|
+
reversalTransactionId: string;
|
|
539
|
+
/** Original withdrawal transaction ID that was reversed */
|
|
540
|
+
originalTransactionId: string;
|
|
541
|
+
/** Environment where the transaction occurred */
|
|
542
|
+
environment: 'production' | 'sandbox';
|
|
543
|
+
/** Reversal amount */
|
|
544
|
+
amount: number;
|
|
545
|
+
/** Fees charged for the reversal */
|
|
546
|
+
feeAmount: number;
|
|
547
|
+
/** Net amount after fees */
|
|
548
|
+
netAmount: number;
|
|
549
|
+
/** Currency code (e.g., "BRL") */
|
|
550
|
+
currency: string;
|
|
551
|
+
/** Payment method (e.g., "pix") */
|
|
552
|
+
paymentMethod: string;
|
|
553
|
+
/** Reversal status */
|
|
554
|
+
status: 'completed';
|
|
555
|
+
/** ISO 8601 timestamp of when withdrawal was reversed */
|
|
556
|
+
reversedAt: string;
|
|
557
|
+
/** Your external reference ID from the original withdrawal (optional) */
|
|
558
|
+
externalReference?: string;
|
|
559
|
+
/** Custom metadata from the original withdrawal */
|
|
560
|
+
metadata?: Record<string, unknown>;
|
|
561
|
+
}
|
|
523
562
|
/**
|
|
524
563
|
* Payment completed webhook event
|
|
525
564
|
*/
|
|
@@ -540,10 +579,43 @@ type WithdrawalCompletedEvent = WebhookPayload<'withdrawal_completed', Withdrawa
|
|
|
540
579
|
* Withdrawal failed webhook event
|
|
541
580
|
*/
|
|
542
581
|
type WithdrawalFailedEvent = WebhookPayload<'withdrawal_failed', WithdrawalFailedData>;
|
|
582
|
+
/**
|
|
583
|
+
* Withdrawal reversed webhook event
|
|
584
|
+
*/
|
|
585
|
+
type WithdrawalReversedEvent = WebhookPayload<'withdrawal_reversed', WithdrawalReversedData>;
|
|
586
|
+
/**
|
|
587
|
+
* Data payload for balance_block_created event
|
|
588
|
+
*/
|
|
589
|
+
interface BalanceBlockCreatedData {
|
|
590
|
+
/** Balance block identifier */
|
|
591
|
+
blockId: string;
|
|
592
|
+
/** Transaction ID of the blocked transaction */
|
|
593
|
+
transactionId: string;
|
|
594
|
+
/** Environment where the block was created */
|
|
595
|
+
environment: 'production' | 'sandbox';
|
|
596
|
+
/** Blocked amount in BRL */
|
|
597
|
+
amount: number;
|
|
598
|
+
/** Currency code (e.g., "BRL") */
|
|
599
|
+
currency: string;
|
|
600
|
+
/** Type of block (med, judicial, administrative) */
|
|
601
|
+
blockType: 'med' | 'judicial' | 'administrative';
|
|
602
|
+
/** Block reference number */
|
|
603
|
+
referenceNumber: string;
|
|
604
|
+
/** Reason for the block */
|
|
605
|
+
reason: string;
|
|
606
|
+
/** Block status */
|
|
607
|
+
status: 'awaiting_response';
|
|
608
|
+
/** ISO 8601 timestamp of when block was created */
|
|
609
|
+
createdAt: string;
|
|
610
|
+
}
|
|
611
|
+
/**
|
|
612
|
+
* Balance block created webhook event
|
|
613
|
+
*/
|
|
614
|
+
type BalanceBlockCreatedEvent = WebhookPayload<'balance_block_created', BalanceBlockCreatedData>;
|
|
543
615
|
/**
|
|
544
616
|
* Union type of all possible webhook events
|
|
545
617
|
*/
|
|
546
|
-
type WebhookEvent = PaymentCompletedEvent | PaymentExpiredEvent | RefundCompletedEvent | WithdrawalCompletedEvent | WithdrawalFailedEvent;
|
|
618
|
+
type WebhookEvent = PaymentCompletedEvent | PaymentExpiredEvent | RefundCompletedEvent | WithdrawalCompletedEvent | WithdrawalFailedEvent | WithdrawalReversedEvent | BalanceBlockCreatedEvent;
|
|
547
619
|
/**
|
|
548
620
|
* Webhook headers sent with each request
|
|
549
621
|
*/
|
|
@@ -633,4 +705,4 @@ interface WebhookHeaders {
|
|
|
633
705
|
declare function verifyWebhookSignature(payload: string, signature: string, secret: string): boolean;
|
|
634
706
|
declare function parseWebhook(payload: string): WebhookEvent | null;
|
|
635
707
|
//#endregion
|
|
636
|
-
export { AccountDetail, AccountInfo, AccountStatus, BalanceAmount, BalanceDetail, Charge, ChargeStatus, CompanyDetail, CompanyStatus, CreateChargeOptions, CreateChargeResponse, CreateCustomerOptions, CreateCustomerResponse, CreatePixCustomer, CreatePixOptions, CreatePixResponse, CreateProjectOptions, CreateProjectResponse, CreateStaticQrCodeOptions, CreateStaticQrCodeResponse, CreateWithdrawalOptions, CreateWithdrawalResponse, Customer, DocumentType, type ErrorResponse, GetChargeResponse, GetTransactionResponse, ListChargesOptions, ListChargesResponse, ListCustomersOptions, ListCustomersResponse, ListProjectsOptions, ListProjectsResponse, NotificationType, type PaginatedResponse, type PaginationOptions, PaymentCompletedData, PaymentCompletedEvent, PaymentExpiredData, PaymentExpiredEvent, PaymentMethod, Pdev, PixCharge, PixKeyType, PixStatus, Project, RefundCompletedData, RefundCompletedEvent, type Response, SortBy, SortOrder, StaticQrCode, Transaction, TransactionPaymentMethod, TransactionStatus, TransactionType, WebhookEvent, WebhookEventType, WebhookHeaders, WebhookPayload, Withdrawal, WithdrawalCompletedData, WithdrawalCompletedEvent, WithdrawalFailedData, WithdrawalFailedEvent, WithdrawalStatus, parseWebhook, verifyWebhookSignature };
|
|
708
|
+
export { AccountDetail, AccountInfo, AccountStatus, BalanceAmount, BalanceBlockCreatedData, BalanceBlockCreatedEvent, BalanceDetail, Charge, ChargeStatus, CompanyDetail, CompanyStatus, CreateChargeOptions, CreateChargeResponse, CreateCustomerOptions, CreateCustomerResponse, CreatePixCustomer, CreatePixOptions, CreatePixResponse, CreateProjectOptions, CreateProjectResponse, CreateStaticQrCodeOptions, CreateStaticQrCodeResponse, CreateWithdrawalOptions, CreateWithdrawalResponse, Customer, DocumentType, type ErrorResponse, GetChargeResponse, GetTransactionResponse, ListChargesOptions, ListChargesResponse, ListCustomersOptions, ListCustomersResponse, ListProjectsOptions, ListProjectsResponse, NotificationType, type PaginatedResponse, type PaginationOptions, PaymentCompletedData, PaymentCompletedEvent, PaymentExpiredData, PaymentExpiredEvent, PaymentMethod, Pdev, PixCharge, PixKeyType, PixStatus, Project, RefundCompletedData, RefundCompletedEvent, type Response, SortBy, SortOrder, StaticQrCode, Transaction, TransactionPaymentMethod, TransactionStatus, TransactionType, WebhookEvent, WebhookEventType, WebhookHeaders, WebhookPayload, Withdrawal, WithdrawalCompletedData, WithdrawalCompletedEvent, WithdrawalFailedData, WithdrawalFailedEvent, WithdrawalReversedData, WithdrawalReversedEvent, WithdrawalStatus, parseWebhook, verifyWebhookSignature };
|
package/dist/index.d.mts
CHANGED
|
@@ -385,7 +385,7 @@ declare class Pdev {
|
|
|
385
385
|
/**
|
|
386
386
|
* Available webhook event types
|
|
387
387
|
*/
|
|
388
|
-
type WebhookEventType = 'payment_completed' | 'payment_expired' | 'refund_completed' | 'withdrawal_completed' | 'withdrawal_failed';
|
|
388
|
+
type WebhookEventType = 'payment_completed' | 'payment_expired' | 'refund_completed' | 'withdrawal_completed' | 'withdrawal_failed' | 'withdrawal_reversed' | 'balance_block_created';
|
|
389
389
|
/**
|
|
390
390
|
* Base webhook payload structure
|
|
391
391
|
*/
|
|
@@ -432,8 +432,14 @@ interface PaymentCompletedData {
|
|
|
432
432
|
interface PaymentExpiredData {
|
|
433
433
|
/** Transaction identifier */
|
|
434
434
|
transactionId: string;
|
|
435
|
+
/** Environment where the transaction occurred */
|
|
436
|
+
environment: 'production' | 'sandbox';
|
|
435
437
|
/** Payment amount */
|
|
436
438
|
amount: number;
|
|
439
|
+
/** Platform fees (always 0 for expired payments) */
|
|
440
|
+
feeAmount: number;
|
|
441
|
+
/** Net amount (always 0 for expired payments) */
|
|
442
|
+
netAmount: number;
|
|
437
443
|
/** Currency code (e.g., "BRL") */
|
|
438
444
|
currency: string;
|
|
439
445
|
/** Payment method used (e.g., "pix") */
|
|
@@ -465,10 +471,14 @@ interface RefundCompletedData {
|
|
|
465
471
|
netAmount: number;
|
|
466
472
|
/** Currency code (e.g., "BRL") */
|
|
467
473
|
currency: string;
|
|
474
|
+
/** Payment method of the original transaction */
|
|
475
|
+
paymentMethod: string;
|
|
468
476
|
/** Refund status */
|
|
469
477
|
status: 'completed';
|
|
470
478
|
/** ISO 8601 timestamp of when refund was completed */
|
|
471
|
-
|
|
479
|
+
refundedAt: string;
|
|
480
|
+
/** Your external reference ID from the original payment (optional) */
|
|
481
|
+
externalReference?: string;
|
|
472
482
|
/** Custom metadata from the original payment */
|
|
473
483
|
metadata?: Record<string, unknown>;
|
|
474
484
|
}
|
|
@@ -520,6 +530,35 @@ interface WithdrawalFailedData {
|
|
|
520
530
|
/** Custom metadata from the withdrawal request */
|
|
521
531
|
metadata?: Record<string, unknown>;
|
|
522
532
|
}
|
|
533
|
+
/**
|
|
534
|
+
* Data payload for withdrawal_reversed event
|
|
535
|
+
*/
|
|
536
|
+
interface WithdrawalReversedData {
|
|
537
|
+
/** Reversal transaction identifier */
|
|
538
|
+
reversalTransactionId: string;
|
|
539
|
+
/** Original withdrawal transaction ID that was reversed */
|
|
540
|
+
originalTransactionId: string;
|
|
541
|
+
/** Environment where the transaction occurred */
|
|
542
|
+
environment: 'production' | 'sandbox';
|
|
543
|
+
/** Reversal amount */
|
|
544
|
+
amount: number;
|
|
545
|
+
/** Fees charged for the reversal */
|
|
546
|
+
feeAmount: number;
|
|
547
|
+
/** Net amount after fees */
|
|
548
|
+
netAmount: number;
|
|
549
|
+
/** Currency code (e.g., "BRL") */
|
|
550
|
+
currency: string;
|
|
551
|
+
/** Payment method (e.g., "pix") */
|
|
552
|
+
paymentMethod: string;
|
|
553
|
+
/** Reversal status */
|
|
554
|
+
status: 'completed';
|
|
555
|
+
/** ISO 8601 timestamp of when withdrawal was reversed */
|
|
556
|
+
reversedAt: string;
|
|
557
|
+
/** Your external reference ID from the original withdrawal (optional) */
|
|
558
|
+
externalReference?: string;
|
|
559
|
+
/** Custom metadata from the original withdrawal */
|
|
560
|
+
metadata?: Record<string, unknown>;
|
|
561
|
+
}
|
|
523
562
|
/**
|
|
524
563
|
* Payment completed webhook event
|
|
525
564
|
*/
|
|
@@ -540,10 +579,43 @@ type WithdrawalCompletedEvent = WebhookPayload<'withdrawal_completed', Withdrawa
|
|
|
540
579
|
* Withdrawal failed webhook event
|
|
541
580
|
*/
|
|
542
581
|
type WithdrawalFailedEvent = WebhookPayload<'withdrawal_failed', WithdrawalFailedData>;
|
|
582
|
+
/**
|
|
583
|
+
* Withdrawal reversed webhook event
|
|
584
|
+
*/
|
|
585
|
+
type WithdrawalReversedEvent = WebhookPayload<'withdrawal_reversed', WithdrawalReversedData>;
|
|
586
|
+
/**
|
|
587
|
+
* Data payload for balance_block_created event
|
|
588
|
+
*/
|
|
589
|
+
interface BalanceBlockCreatedData {
|
|
590
|
+
/** Balance block identifier */
|
|
591
|
+
blockId: string;
|
|
592
|
+
/** Transaction ID of the blocked transaction */
|
|
593
|
+
transactionId: string;
|
|
594
|
+
/** Environment where the block was created */
|
|
595
|
+
environment: 'production' | 'sandbox';
|
|
596
|
+
/** Blocked amount in BRL */
|
|
597
|
+
amount: number;
|
|
598
|
+
/** Currency code (e.g., "BRL") */
|
|
599
|
+
currency: string;
|
|
600
|
+
/** Type of block (med, judicial, administrative) */
|
|
601
|
+
blockType: 'med' | 'judicial' | 'administrative';
|
|
602
|
+
/** Block reference number */
|
|
603
|
+
referenceNumber: string;
|
|
604
|
+
/** Reason for the block */
|
|
605
|
+
reason: string;
|
|
606
|
+
/** Block status */
|
|
607
|
+
status: 'awaiting_response';
|
|
608
|
+
/** ISO 8601 timestamp of when block was created */
|
|
609
|
+
createdAt: string;
|
|
610
|
+
}
|
|
611
|
+
/**
|
|
612
|
+
* Balance block created webhook event
|
|
613
|
+
*/
|
|
614
|
+
type BalanceBlockCreatedEvent = WebhookPayload<'balance_block_created', BalanceBlockCreatedData>;
|
|
543
615
|
/**
|
|
544
616
|
* Union type of all possible webhook events
|
|
545
617
|
*/
|
|
546
|
-
type WebhookEvent = PaymentCompletedEvent | PaymentExpiredEvent | RefundCompletedEvent | WithdrawalCompletedEvent | WithdrawalFailedEvent;
|
|
618
|
+
type WebhookEvent = PaymentCompletedEvent | PaymentExpiredEvent | RefundCompletedEvent | WithdrawalCompletedEvent | WithdrawalFailedEvent | WithdrawalReversedEvent | BalanceBlockCreatedEvent;
|
|
547
619
|
/**
|
|
548
620
|
* Webhook headers sent with each request
|
|
549
621
|
*/
|
|
@@ -633,4 +705,4 @@ interface WebhookHeaders {
|
|
|
633
705
|
declare function verifyWebhookSignature(payload: string, signature: string, secret: string): boolean;
|
|
634
706
|
declare function parseWebhook(payload: string): WebhookEvent | null;
|
|
635
707
|
//#endregion
|
|
636
|
-
export { AccountDetail, AccountInfo, AccountStatus, BalanceAmount, BalanceDetail, Charge, ChargeStatus, CompanyDetail, CompanyStatus, CreateChargeOptions, CreateChargeResponse, CreateCustomerOptions, CreateCustomerResponse, CreatePixCustomer, CreatePixOptions, CreatePixResponse, CreateProjectOptions, CreateProjectResponse, CreateStaticQrCodeOptions, CreateStaticQrCodeResponse, CreateWithdrawalOptions, CreateWithdrawalResponse, Customer, DocumentType, type ErrorResponse, GetChargeResponse, GetTransactionResponse, ListChargesOptions, ListChargesResponse, ListCustomersOptions, ListCustomersResponse, ListProjectsOptions, ListProjectsResponse, NotificationType, type PaginatedResponse, type PaginationOptions, PaymentCompletedData, PaymentCompletedEvent, PaymentExpiredData, PaymentExpiredEvent, PaymentMethod, Pdev, PixCharge, PixKeyType, PixStatus, Project, RefundCompletedData, RefundCompletedEvent, type Response, SortBy, SortOrder, StaticQrCode, Transaction, TransactionPaymentMethod, TransactionStatus, TransactionType, WebhookEvent, WebhookEventType, WebhookHeaders, WebhookPayload, Withdrawal, WithdrawalCompletedData, WithdrawalCompletedEvent, WithdrawalFailedData, WithdrawalFailedEvent, WithdrawalStatus, parseWebhook, verifyWebhookSignature };
|
|
708
|
+
export { AccountDetail, AccountInfo, AccountStatus, BalanceAmount, BalanceBlockCreatedData, BalanceBlockCreatedEvent, BalanceDetail, Charge, ChargeStatus, CompanyDetail, CompanyStatus, CreateChargeOptions, CreateChargeResponse, CreateCustomerOptions, CreateCustomerResponse, CreatePixCustomer, CreatePixOptions, CreatePixResponse, CreateProjectOptions, CreateProjectResponse, CreateStaticQrCodeOptions, CreateStaticQrCodeResponse, CreateWithdrawalOptions, CreateWithdrawalResponse, Customer, DocumentType, type ErrorResponse, GetChargeResponse, GetTransactionResponse, ListChargesOptions, ListChargesResponse, ListCustomersOptions, ListCustomersResponse, ListProjectsOptions, ListProjectsResponse, NotificationType, type PaginatedResponse, type PaginationOptions, PaymentCompletedData, PaymentCompletedEvent, PaymentExpiredData, PaymentExpiredEvent, PaymentMethod, Pdev, PixCharge, PixKeyType, PixStatus, Project, RefundCompletedData, RefundCompletedEvent, type Response, SortBy, SortOrder, StaticQrCode, Transaction, TransactionPaymentMethod, TransactionStatus, TransactionType, WebhookEvent, WebhookEventType, WebhookHeaders, WebhookPayload, Withdrawal, WithdrawalCompletedData, WithdrawalCompletedEvent, WithdrawalFailedData, WithdrawalFailedEvent, WithdrawalReversedData, WithdrawalReversedEvent, WithdrawalStatus, parseWebhook, verifyWebhookSignature };
|
package/dist/index.mjs
CHANGED
|
@@ -226,7 +226,9 @@ function isValidWebhookEvent(event) {
|
|
|
226
226
|
"payment_expired",
|
|
227
227
|
"refund_completed",
|
|
228
228
|
"withdrawal_completed",
|
|
229
|
-
"withdrawal_failed"
|
|
229
|
+
"withdrawal_failed",
|
|
230
|
+
"withdrawal_reversed",
|
|
231
|
+
"balance_block_created"
|
|
230
232
|
].includes(obj.event);
|
|
231
233
|
}
|
|
232
234
|
/**
|