@pague-dev/sdk-node 0.2.3 → 0.3.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/README.md +5 -0
- package/dist/index.cjs +8 -0
- package/dist/index.d.cts +39 -1
- package/dist/index.d.mts +39 -1
- package/dist/index.mjs +8 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -35,6 +35,10 @@ await pdev.customers.list({ page, limit, search });
|
|
|
35
35
|
await pdev.projects.create({ name, color });
|
|
36
36
|
await pdev.projects.list({ page, limit });
|
|
37
37
|
|
|
38
|
+
// Withdrawals (Saques PIX)
|
|
39
|
+
await pdev.withdrawals.create({ amount, pixKey, pixKeyType, holderName, holderDocument });
|
|
40
|
+
await pdev.withdrawals.create({ amount, bankAccountId });
|
|
41
|
+
|
|
38
42
|
// Transactions
|
|
39
43
|
await pdev.transactions.get(id);
|
|
40
44
|
|
|
@@ -49,6 +53,7 @@ const event = parseWebhook(req.body);
|
|
|
49
53
|
- **Charges** - Links de pagamento
|
|
50
54
|
- **Customers** - Gestão de clientes
|
|
51
55
|
- **Projects** - Organização por projetos
|
|
56
|
+
- **Withdrawals** - Saques via PIX (avulso ou conta salva)
|
|
52
57
|
- **Transactions** - Consulta de transações
|
|
53
58
|
- **Webhooks** - Notificações em tempo real
|
|
54
59
|
|
package/dist/index.cjs
CHANGED
|
@@ -94,6 +94,12 @@ var Transactions = class extends GetOnlyResource {
|
|
|
94
94
|
endpoint = "/transactions";
|
|
95
95
|
};
|
|
96
96
|
|
|
97
|
+
//#endregion
|
|
98
|
+
//#region src/withdrawals/withdrawals.ts
|
|
99
|
+
var Withdrawals = class extends CreateOnlyResource {
|
|
100
|
+
endpoint = "/withdrawals";
|
|
101
|
+
};
|
|
102
|
+
|
|
97
103
|
//#endregion
|
|
98
104
|
//#region src/pdev.ts
|
|
99
105
|
var Pdev = class {
|
|
@@ -105,6 +111,7 @@ var Pdev = class {
|
|
|
105
111
|
projects;
|
|
106
112
|
charges;
|
|
107
113
|
transactions;
|
|
114
|
+
withdrawals;
|
|
108
115
|
constructor(key) {
|
|
109
116
|
if (!key) {
|
|
110
117
|
if (typeof process !== "undefined" && process.env) this.key = process.env.PDEV_API_KEY || "";
|
|
@@ -121,6 +128,7 @@ var Pdev = class {
|
|
|
121
128
|
this.projects = new Projects(this);
|
|
122
129
|
this.charges = new Charges(this);
|
|
123
130
|
this.transactions = new Transactions(this);
|
|
131
|
+
this.withdrawals = new Withdrawals(this);
|
|
124
132
|
}
|
|
125
133
|
async post(path, body, options = {}) {
|
|
126
134
|
const url = this.buildUrl(path, options.query);
|
package/dist/index.d.cts
CHANGED
|
@@ -261,6 +261,43 @@ declare class Transactions extends GetOnlyResource<Transaction> {
|
|
|
261
261
|
protected readonly endpoint = "/transactions";
|
|
262
262
|
}
|
|
263
263
|
//#endregion
|
|
264
|
+
//#region src/withdrawals/interfaces/withdrawal.interface.d.ts
|
|
265
|
+
type WithdrawalStatus = 'pending' | 'processing' | 'completed' | 'failed';
|
|
266
|
+
type PixKeyType = 'cpf' | 'cnpj' | 'email' | 'phone' | 'random';
|
|
267
|
+
interface Withdrawal {
|
|
268
|
+
id: string;
|
|
269
|
+
bankAccountId: string | null;
|
|
270
|
+
amount: number;
|
|
271
|
+
feeAmount: number;
|
|
272
|
+
netAmount: number;
|
|
273
|
+
status: WithdrawalStatus;
|
|
274
|
+
snapshotPixKey: string | null;
|
|
275
|
+
snapshotPixKeyType: PixKeyType | null;
|
|
276
|
+
snapshotHolderName: string;
|
|
277
|
+
snapshotHolderDocument: string;
|
|
278
|
+
failureReason: string | null;
|
|
279
|
+
pspReference: string | null;
|
|
280
|
+
createdAt: string;
|
|
281
|
+
processedAt: string | null;
|
|
282
|
+
}
|
|
283
|
+
//#endregion
|
|
284
|
+
//#region src/withdrawals/interfaces/create-withdrawal.interface.d.ts
|
|
285
|
+
interface CreateWithdrawalOptions {
|
|
286
|
+
amount: number;
|
|
287
|
+
bankAccountId?: string;
|
|
288
|
+
pixKey?: string;
|
|
289
|
+
pixKeyType?: PixKeyType;
|
|
290
|
+
holderName?: string;
|
|
291
|
+
holderDocument?: string;
|
|
292
|
+
holderDocumentType?: 'cpf' | 'cnpj';
|
|
293
|
+
}
|
|
294
|
+
type CreateWithdrawalResponse = Response<Withdrawal>;
|
|
295
|
+
//#endregion
|
|
296
|
+
//#region src/withdrawals/withdrawals.d.ts
|
|
297
|
+
declare class Withdrawals extends CreateOnlyResource<Withdrawal, CreateWithdrawalOptions> {
|
|
298
|
+
protected readonly endpoint = "/withdrawals";
|
|
299
|
+
}
|
|
300
|
+
//#endregion
|
|
264
301
|
//#region src/pdev.d.ts
|
|
265
302
|
declare class Pdev {
|
|
266
303
|
readonly key: string;
|
|
@@ -271,6 +308,7 @@ declare class Pdev {
|
|
|
271
308
|
readonly projects: Projects;
|
|
272
309
|
readonly charges: Charges;
|
|
273
310
|
readonly transactions: Transactions;
|
|
311
|
+
readonly withdrawals: Withdrawals;
|
|
274
312
|
constructor(key?: string);
|
|
275
313
|
post<T>(path: string, body?: unknown, options?: PostOptions): Promise<Response<T>>;
|
|
276
314
|
get<T>(path: string, options?: GetOptions): Promise<Response<T>>;
|
|
@@ -479,4 +517,4 @@ interface WebhookHeaders {
|
|
|
479
517
|
*/
|
|
480
518
|
declare function parseWebhook(payload: string): WebhookEvent | null;
|
|
481
519
|
//#endregion
|
|
482
|
-
export { Charge, ChargeStatus, CreateChargeOptions, CreateChargeResponse, CreateCustomerOptions, CreateCustomerResponse, CreatePixCustomer, CreatePixOptions, CreatePixResponse, CreateProjectOptions, CreateProjectResponse, Customer, DocumentType, type ErrorResponse, GetChargeResponse, GetTransactionResponse, ListChargesOptions, ListChargesResponse, ListCustomersOptions, ListCustomersResponse, ListProjectsOptions, ListProjectsResponse, NotificationType, type PaginatedResponse, type PaginationOptions, PaymentCompletedData, PaymentCompletedEvent, PaymentMethod, Pdev, PixCharge, PixStatus, Project, RefundCompletedData, RefundCompletedEvent, type Response, SortBy, SortOrder, Transaction, TransactionPaymentMethod, TransactionStatus, TransactionType, WebhookEvent, WebhookEventType, WebhookHeaders, WebhookPayload, WithdrawalCompletedData, WithdrawalCompletedEvent, WithdrawalFailedData, WithdrawalFailedEvent, parseWebhook };
|
|
520
|
+
export { Charge, ChargeStatus, CreateChargeOptions, CreateChargeResponse, CreateCustomerOptions, CreateCustomerResponse, CreatePixCustomer, CreatePixOptions, CreatePixResponse, CreateProjectOptions, CreateProjectResponse, CreateWithdrawalOptions, CreateWithdrawalResponse, Customer, DocumentType, type ErrorResponse, GetChargeResponse, GetTransactionResponse, ListChargesOptions, ListChargesResponse, ListCustomersOptions, ListCustomersResponse, ListProjectsOptions, ListProjectsResponse, NotificationType, type PaginatedResponse, type PaginationOptions, PaymentCompletedData, PaymentCompletedEvent, PaymentMethod, Pdev, PixCharge, PixKeyType, PixStatus, Project, RefundCompletedData, RefundCompletedEvent, type Response, SortBy, SortOrder, Transaction, TransactionPaymentMethod, TransactionStatus, TransactionType, WebhookEvent, WebhookEventType, WebhookHeaders, WebhookPayload, Withdrawal, WithdrawalCompletedData, WithdrawalCompletedEvent, WithdrawalFailedData, WithdrawalFailedEvent, WithdrawalStatus, parseWebhook };
|
package/dist/index.d.mts
CHANGED
|
@@ -261,6 +261,43 @@ declare class Transactions extends GetOnlyResource<Transaction> {
|
|
|
261
261
|
protected readonly endpoint = "/transactions";
|
|
262
262
|
}
|
|
263
263
|
//#endregion
|
|
264
|
+
//#region src/withdrawals/interfaces/withdrawal.interface.d.ts
|
|
265
|
+
type WithdrawalStatus = 'pending' | 'processing' | 'completed' | 'failed';
|
|
266
|
+
type PixKeyType = 'cpf' | 'cnpj' | 'email' | 'phone' | 'random';
|
|
267
|
+
interface Withdrawal {
|
|
268
|
+
id: string;
|
|
269
|
+
bankAccountId: string | null;
|
|
270
|
+
amount: number;
|
|
271
|
+
feeAmount: number;
|
|
272
|
+
netAmount: number;
|
|
273
|
+
status: WithdrawalStatus;
|
|
274
|
+
snapshotPixKey: string | null;
|
|
275
|
+
snapshotPixKeyType: PixKeyType | null;
|
|
276
|
+
snapshotHolderName: string;
|
|
277
|
+
snapshotHolderDocument: string;
|
|
278
|
+
failureReason: string | null;
|
|
279
|
+
pspReference: string | null;
|
|
280
|
+
createdAt: string;
|
|
281
|
+
processedAt: string | null;
|
|
282
|
+
}
|
|
283
|
+
//#endregion
|
|
284
|
+
//#region src/withdrawals/interfaces/create-withdrawal.interface.d.ts
|
|
285
|
+
interface CreateWithdrawalOptions {
|
|
286
|
+
amount: number;
|
|
287
|
+
bankAccountId?: string;
|
|
288
|
+
pixKey?: string;
|
|
289
|
+
pixKeyType?: PixKeyType;
|
|
290
|
+
holderName?: string;
|
|
291
|
+
holderDocument?: string;
|
|
292
|
+
holderDocumentType?: 'cpf' | 'cnpj';
|
|
293
|
+
}
|
|
294
|
+
type CreateWithdrawalResponse = Response<Withdrawal>;
|
|
295
|
+
//#endregion
|
|
296
|
+
//#region src/withdrawals/withdrawals.d.ts
|
|
297
|
+
declare class Withdrawals extends CreateOnlyResource<Withdrawal, CreateWithdrawalOptions> {
|
|
298
|
+
protected readonly endpoint = "/withdrawals";
|
|
299
|
+
}
|
|
300
|
+
//#endregion
|
|
264
301
|
//#region src/pdev.d.ts
|
|
265
302
|
declare class Pdev {
|
|
266
303
|
readonly key: string;
|
|
@@ -271,6 +308,7 @@ declare class Pdev {
|
|
|
271
308
|
readonly projects: Projects;
|
|
272
309
|
readonly charges: Charges;
|
|
273
310
|
readonly transactions: Transactions;
|
|
311
|
+
readonly withdrawals: Withdrawals;
|
|
274
312
|
constructor(key?: string);
|
|
275
313
|
post<T>(path: string, body?: unknown, options?: PostOptions): Promise<Response<T>>;
|
|
276
314
|
get<T>(path: string, options?: GetOptions): Promise<Response<T>>;
|
|
@@ -479,4 +517,4 @@ interface WebhookHeaders {
|
|
|
479
517
|
*/
|
|
480
518
|
declare function parseWebhook(payload: string): WebhookEvent | null;
|
|
481
519
|
//#endregion
|
|
482
|
-
export { Charge, ChargeStatus, CreateChargeOptions, CreateChargeResponse, CreateCustomerOptions, CreateCustomerResponse, CreatePixCustomer, CreatePixOptions, CreatePixResponse, CreateProjectOptions, CreateProjectResponse, Customer, DocumentType, type ErrorResponse, GetChargeResponse, GetTransactionResponse, ListChargesOptions, ListChargesResponse, ListCustomersOptions, ListCustomersResponse, ListProjectsOptions, ListProjectsResponse, NotificationType, type PaginatedResponse, type PaginationOptions, PaymentCompletedData, PaymentCompletedEvent, PaymentMethod, Pdev, PixCharge, PixStatus, Project, RefundCompletedData, RefundCompletedEvent, type Response, SortBy, SortOrder, Transaction, TransactionPaymentMethod, TransactionStatus, TransactionType, WebhookEvent, WebhookEventType, WebhookHeaders, WebhookPayload, WithdrawalCompletedData, WithdrawalCompletedEvent, WithdrawalFailedData, WithdrawalFailedEvent, parseWebhook };
|
|
520
|
+
export { Charge, ChargeStatus, CreateChargeOptions, CreateChargeResponse, CreateCustomerOptions, CreateCustomerResponse, CreatePixCustomer, CreatePixOptions, CreatePixResponse, CreateProjectOptions, CreateProjectResponse, CreateWithdrawalOptions, CreateWithdrawalResponse, Customer, DocumentType, type ErrorResponse, GetChargeResponse, GetTransactionResponse, ListChargesOptions, ListChargesResponse, ListCustomersOptions, ListCustomersResponse, ListProjectsOptions, ListProjectsResponse, NotificationType, type PaginatedResponse, type PaginationOptions, PaymentCompletedData, PaymentCompletedEvent, PaymentMethod, Pdev, PixCharge, PixKeyType, PixStatus, Project, RefundCompletedData, RefundCompletedEvent, type Response, SortBy, SortOrder, Transaction, TransactionPaymentMethod, TransactionStatus, TransactionType, WebhookEvent, WebhookEventType, WebhookHeaders, WebhookPayload, Withdrawal, WithdrawalCompletedData, WithdrawalCompletedEvent, WithdrawalFailedData, WithdrawalFailedEvent, WithdrawalStatus, parseWebhook };
|
package/dist/index.mjs
CHANGED
|
@@ -93,6 +93,12 @@ var Transactions = class extends GetOnlyResource {
|
|
|
93
93
|
endpoint = "/transactions";
|
|
94
94
|
};
|
|
95
95
|
|
|
96
|
+
//#endregion
|
|
97
|
+
//#region src/withdrawals/withdrawals.ts
|
|
98
|
+
var Withdrawals = class extends CreateOnlyResource {
|
|
99
|
+
endpoint = "/withdrawals";
|
|
100
|
+
};
|
|
101
|
+
|
|
96
102
|
//#endregion
|
|
97
103
|
//#region src/pdev.ts
|
|
98
104
|
var Pdev = class {
|
|
@@ -104,6 +110,7 @@ var Pdev = class {
|
|
|
104
110
|
projects;
|
|
105
111
|
charges;
|
|
106
112
|
transactions;
|
|
113
|
+
withdrawals;
|
|
107
114
|
constructor(key) {
|
|
108
115
|
if (!key) {
|
|
109
116
|
if (typeof process !== "undefined" && process.env) this.key = process.env.PDEV_API_KEY || "";
|
|
@@ -120,6 +127,7 @@ var Pdev = class {
|
|
|
120
127
|
this.projects = new Projects(this);
|
|
121
128
|
this.charges = new Charges(this);
|
|
122
129
|
this.transactions = new Transactions(this);
|
|
130
|
+
this.withdrawals = new Withdrawals(this);
|
|
123
131
|
}
|
|
124
132
|
async post(path, body, options = {}) {
|
|
125
133
|
const url = this.buildUrl(path, options.query);
|