@pague-dev/sdk-node 0.2.3 → 0.4.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 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
@@ -167,6 +167,7 @@ interface PixCharge {
167
167
  amount: number;
168
168
  currency: string;
169
169
  pixCopyPaste: string;
170
+ qrCodeBase64?: string;
170
171
  expiresAt: string;
171
172
  externalReference?: string;
172
173
  customerId?: string;
@@ -247,6 +248,7 @@ interface Transaction {
247
248
  projectId?: string;
248
249
  metadata?: Record<string, unknown>;
249
250
  pixCopyPaste?: string;
251
+ qrCodeBase64?: string;
250
252
  expiresAt?: string;
251
253
  paidAt?: string;
252
254
  createdAt: string;
@@ -261,6 +263,43 @@ declare class Transactions extends GetOnlyResource<Transaction> {
261
263
  protected readonly endpoint = "/transactions";
262
264
  }
263
265
  //#endregion
266
+ //#region src/withdrawals/interfaces/withdrawal.interface.d.ts
267
+ type WithdrawalStatus = 'pending' | 'processing' | 'completed' | 'failed';
268
+ type PixKeyType = 'cpf' | 'cnpj' | 'email' | 'phone' | 'random';
269
+ interface Withdrawal {
270
+ id: string;
271
+ bankAccountId: string | null;
272
+ amount: number;
273
+ feeAmount: number;
274
+ netAmount: number;
275
+ status: WithdrawalStatus;
276
+ snapshotPixKey: string | null;
277
+ snapshotPixKeyType: PixKeyType | null;
278
+ snapshotHolderName: string;
279
+ snapshotHolderDocument: string;
280
+ failureReason: string | null;
281
+ pspReference: string | null;
282
+ createdAt: string;
283
+ processedAt: string | null;
284
+ }
285
+ //#endregion
286
+ //#region src/withdrawals/interfaces/create-withdrawal.interface.d.ts
287
+ interface CreateWithdrawalOptions {
288
+ amount: number;
289
+ bankAccountId?: string;
290
+ pixKey?: string;
291
+ pixKeyType?: PixKeyType;
292
+ holderName?: string;
293
+ holderDocument?: string;
294
+ holderDocumentType?: 'cpf' | 'cnpj';
295
+ }
296
+ type CreateWithdrawalResponse = Response<Withdrawal>;
297
+ //#endregion
298
+ //#region src/withdrawals/withdrawals.d.ts
299
+ declare class Withdrawals extends CreateOnlyResource<Withdrawal, CreateWithdrawalOptions> {
300
+ protected readonly endpoint = "/withdrawals";
301
+ }
302
+ //#endregion
264
303
  //#region src/pdev.d.ts
265
304
  declare class Pdev {
266
305
  readonly key: string;
@@ -271,6 +310,7 @@ declare class Pdev {
271
310
  readonly projects: Projects;
272
311
  readonly charges: Charges;
273
312
  readonly transactions: Transactions;
313
+ readonly withdrawals: Withdrawals;
274
314
  constructor(key?: string);
275
315
  post<T>(path: string, body?: unknown, options?: PostOptions): Promise<Response<T>>;
276
316
  get<T>(path: string, options?: GetOptions): Promise<Response<T>>;
@@ -479,4 +519,4 @@ interface WebhookHeaders {
479
519
  */
480
520
  declare function parseWebhook(payload: string): WebhookEvent | null;
481
521
  //#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 };
522
+ 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
@@ -167,6 +167,7 @@ interface PixCharge {
167
167
  amount: number;
168
168
  currency: string;
169
169
  pixCopyPaste: string;
170
+ qrCodeBase64?: string;
170
171
  expiresAt: string;
171
172
  externalReference?: string;
172
173
  customerId?: string;
@@ -247,6 +248,7 @@ interface Transaction {
247
248
  projectId?: string;
248
249
  metadata?: Record<string, unknown>;
249
250
  pixCopyPaste?: string;
251
+ qrCodeBase64?: string;
250
252
  expiresAt?: string;
251
253
  paidAt?: string;
252
254
  createdAt: string;
@@ -261,6 +263,43 @@ declare class Transactions extends GetOnlyResource<Transaction> {
261
263
  protected readonly endpoint = "/transactions";
262
264
  }
263
265
  //#endregion
266
+ //#region src/withdrawals/interfaces/withdrawal.interface.d.ts
267
+ type WithdrawalStatus = 'pending' | 'processing' | 'completed' | 'failed';
268
+ type PixKeyType = 'cpf' | 'cnpj' | 'email' | 'phone' | 'random';
269
+ interface Withdrawal {
270
+ id: string;
271
+ bankAccountId: string | null;
272
+ amount: number;
273
+ feeAmount: number;
274
+ netAmount: number;
275
+ status: WithdrawalStatus;
276
+ snapshotPixKey: string | null;
277
+ snapshotPixKeyType: PixKeyType | null;
278
+ snapshotHolderName: string;
279
+ snapshotHolderDocument: string;
280
+ failureReason: string | null;
281
+ pspReference: string | null;
282
+ createdAt: string;
283
+ processedAt: string | null;
284
+ }
285
+ //#endregion
286
+ //#region src/withdrawals/interfaces/create-withdrawal.interface.d.ts
287
+ interface CreateWithdrawalOptions {
288
+ amount: number;
289
+ bankAccountId?: string;
290
+ pixKey?: string;
291
+ pixKeyType?: PixKeyType;
292
+ holderName?: string;
293
+ holderDocument?: string;
294
+ holderDocumentType?: 'cpf' | 'cnpj';
295
+ }
296
+ type CreateWithdrawalResponse = Response<Withdrawal>;
297
+ //#endregion
298
+ //#region src/withdrawals/withdrawals.d.ts
299
+ declare class Withdrawals extends CreateOnlyResource<Withdrawal, CreateWithdrawalOptions> {
300
+ protected readonly endpoint = "/withdrawals";
301
+ }
302
+ //#endregion
264
303
  //#region src/pdev.d.ts
265
304
  declare class Pdev {
266
305
  readonly key: string;
@@ -271,6 +310,7 @@ declare class Pdev {
271
310
  readonly projects: Projects;
272
311
  readonly charges: Charges;
273
312
  readonly transactions: Transactions;
313
+ readonly withdrawals: Withdrawals;
274
314
  constructor(key?: string);
275
315
  post<T>(path: string, body?: unknown, options?: PostOptions): Promise<Response<T>>;
276
316
  get<T>(path: string, options?: GetOptions): Promise<Response<T>>;
@@ -479,4 +519,4 @@ interface WebhookHeaders {
479
519
  */
480
520
  declare function parseWebhook(payload: string): WebhookEvent | null;
481
521
  //#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 };
522
+ 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);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pague-dev/sdk-node",
3
- "version": "0.2.3",
3
+ "version": "0.4.0",
4
4
  "description": "Node.js SDK for the pague.dev API",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.mjs",