@vexpay/node 0.12.0 → 0.13.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 +78 -7
- package/dist/index.cjs +69 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1233 -185
- package/dist/index.d.ts +1233 -185
- package/dist/index.js +69 -6
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -62,7 +62,7 @@ function errorFromResponse(status, body, requestId) {
|
|
|
62
62
|
}
|
|
63
63
|
|
|
64
64
|
// src/version.ts
|
|
65
|
-
var VERSION = "0.
|
|
65
|
+
var VERSION = "0.13.0";
|
|
66
66
|
|
|
67
67
|
// src/core.ts
|
|
68
68
|
var INITIAL_RETRY_DELAY_MS = 500;
|
|
@@ -225,6 +225,7 @@ var ROUTES = {
|
|
|
225
225
|
ConversionSettings_update: { method: "PATCH", path: "/v1/conversions/settings" },
|
|
226
226
|
CopPayments_balance: { method: "GET", path: "/v1/cop/balance" },
|
|
227
227
|
CopPayments_cancel: { method: "POST", path: "/v1/cop/payments/{id}/cancel" },
|
|
228
|
+
CopPayments_channels: { method: "GET", path: "/v1/cop/channels" },
|
|
228
229
|
CopPayments_create: { method: "POST", path: "/v1/cop/payments" },
|
|
229
230
|
CopPayments_get: { method: "GET", path: "/v1/cop/payments/{id}" },
|
|
230
231
|
CopPayments_refund: { method: "POST", path: "/v1/cop/payments/{id}/refund" },
|
|
@@ -255,10 +256,12 @@ var ROUTES = {
|
|
|
255
256
|
Merchants_listAuditEvents: { method: "GET", path: "/v1/merchants/{id}/audit-events" },
|
|
256
257
|
Merchants_listOrGetByRef: { method: "GET", path: "/v1/merchants" },
|
|
257
258
|
Merchants_listPayoutMethods: { method: "GET", path: "/v1/merchants/{id}/payout-methods" },
|
|
259
|
+
Merchants_listTransactions: { method: "GET", path: "/v1/merchants/{id}/transactions" },
|
|
258
260
|
Merchants_remove: { method: "DELETE", path: "/v1/merchants/{id}" },
|
|
259
261
|
Merchants_setDefaultPayoutMethod: { method: "POST", path: "/v1/merchants/{id}/payout-methods/{methodId}/default" },
|
|
260
262
|
Merchants_startVerify: { method: "POST", path: "/v1/merchants/{id}/verify/start" },
|
|
261
263
|
Merchants_startVerifyMethod: { method: "POST", path: "/v1/merchants/{id}/payout-methods/{methodId}/verify/start" },
|
|
264
|
+
Merchants_statement: { method: "GET", path: "/v1/merchants/{id}/statement" },
|
|
262
265
|
Merchants_transfer: { method: "POST", path: "/v1/merchants/{id}/transfers" },
|
|
263
266
|
Merchants_update: { method: "PATCH", path: "/v1/merchants/{id}" },
|
|
264
267
|
Notifications_sendTest: { method: "POST", path: "/v1/notifications/test" },
|
|
@@ -317,6 +320,11 @@ var ROUTES = {
|
|
|
317
320
|
TenantPayoutAccount_startVerify: { method: "POST", path: "/v1/tenant/payout-account/verify/start" },
|
|
318
321
|
TenantPayoutAccount_upsert: { method: "PUT", path: "/v1/tenant/payout-account" },
|
|
319
322
|
TenantPayoutAccount_upsertPost: { method: "POST", path: "/v1/tenant/payout-account" },
|
|
323
|
+
Topups_create: { method: "POST", path: "/v1/balance/topups" },
|
|
324
|
+
Topups_get: { method: "GET", path: "/v1/balance/topups/{id}" },
|
|
325
|
+
Topups_instant: { method: "POST", path: "/v1/balance/topups/{id}/instant" },
|
|
326
|
+
Topups_list: { method: "GET", path: "/v1/balance/topups" },
|
|
327
|
+
Topups_simulate: { method: "POST", path: "/v1/balance/topups/{id}/simulate" },
|
|
320
328
|
Webhooks_createWebhook: { method: "POST", path: "/v1/webhooks" },
|
|
321
329
|
Webhooks_deleteWebhook: { method: "DELETE", path: "/v1/webhooks/{id}" },
|
|
322
330
|
Webhooks_listWebhooks: { method: "GET", path: "/v1/webhooks" },
|
|
@@ -367,8 +375,30 @@ var BalanceTransactions = class extends APIResource {
|
|
|
367
375
|
);
|
|
368
376
|
}
|
|
369
377
|
};
|
|
378
|
+
var BalanceTopups = class extends APIResource {
|
|
379
|
+
/** Start a top-up. Over the monthly limit fails with `topup_cap_exceeded` (422). */
|
|
380
|
+
create(params, options) {
|
|
381
|
+
return this.call("Topups_create", { body: params }, options);
|
|
382
|
+
}
|
|
383
|
+
/** Your latest top-ups (newest first, `limit` 1–100) plus this month's limit usage. */
|
|
384
|
+
list(params = {}, options) {
|
|
385
|
+
return this.call("Topups_list", { query: params }, options);
|
|
386
|
+
}
|
|
387
|
+
retrieve(id, options) {
|
|
388
|
+
return this.call("Topups_get", { path: { id } }, options);
|
|
389
|
+
}
|
|
390
|
+
/** Release the still-held part of a completed top-up now, for `instantFeeVes`. Idempotent; `not_held` (409) if nothing is held. */
|
|
391
|
+
instant(id, options) {
|
|
392
|
+
return this.call("Topups_instant", { path: { id } }, options);
|
|
393
|
+
}
|
|
394
|
+
/** Test mode only: complete the top-up as if the Pago Móvil arrived. */
|
|
395
|
+
simulate(id, options) {
|
|
396
|
+
return this.call("Topups_simulate", { path: { id } }, options);
|
|
397
|
+
}
|
|
398
|
+
};
|
|
370
399
|
var Balance = class extends APIResource {
|
|
371
400
|
transactions = new BalanceTransactions(this.http);
|
|
401
|
+
topups = new BalanceTopups(this.http);
|
|
372
402
|
retrieve(options) {
|
|
373
403
|
return this.call("Balance_getBalance", {}, options);
|
|
374
404
|
}
|
|
@@ -656,8 +686,10 @@ var Conversions = class extends APIResource {
|
|
|
656
686
|
// src/resources/cop.ts
|
|
657
687
|
var CopPayments = class extends APIResource {
|
|
658
688
|
/**
|
|
659
|
-
* Create a payment in whole pesos. `buyer` is required for
|
|
660
|
-
* `
|
|
689
|
+
* Create a payment in whole pesos. `buyer` is required for every channel except `breb`, with
|
|
690
|
+
* `termsAccepted: true` when {@link Cop.channels} says `needsTermsAcceptance`; `pse` also needs
|
|
691
|
+
* `pse.bankCode`. The response `next` says what the buyer does: `show_qr`, `approve_in_app`,
|
|
692
|
+
* `submit_otp`, `redirect` (send them to `next.url`) or `redirect_pending` (retrieve again shortly).
|
|
661
693
|
* Pass `idempotencyKey` in options to retry safely.
|
|
662
694
|
*/
|
|
663
695
|
create(params, options) {
|
|
@@ -666,7 +698,7 @@ var CopPayments = class extends APIResource {
|
|
|
666
698
|
retrieve(id, options) {
|
|
667
699
|
return this.call("CopPayments_get", { path: { id } }, options);
|
|
668
700
|
}
|
|
669
|
-
/** Daviplata: submit the code the buyer received by SMS. A wrong code fails with `invalid_otp`. */
|
|
701
|
+
/** Daviplata with `next.type: "submit_otp"`: submit the code the buyer received by SMS. A wrong code fails with `invalid_otp`. */
|
|
670
702
|
submitOtp(id, params, options) {
|
|
671
703
|
return this.call("CopPayments_submitOtp", { path: { id }, body: params }, options);
|
|
672
704
|
}
|
|
@@ -674,7 +706,10 @@ var CopPayments = class extends APIResource {
|
|
|
674
706
|
cancel(id, options) {
|
|
675
707
|
return this.call("CopPayments_cancel", { path: { id } }, options);
|
|
676
708
|
}
|
|
677
|
-
/**
|
|
709
|
+
/**
|
|
710
|
+
* Full refund of a completed payment, within the channel's window (card 24 h, Bre-B 96 h).
|
|
711
|
+
* Channels that cannot be refunded through the API fail with `refund_not_supported`.
|
|
712
|
+
*/
|
|
678
713
|
refund(id, options) {
|
|
679
714
|
return this.call("CopPayments_refund", { path: { id } }, options);
|
|
680
715
|
}
|
|
@@ -687,6 +722,10 @@ var CopBalance = class extends APIResource {
|
|
|
687
722
|
var Cop = class extends APIResource {
|
|
688
723
|
payments = new CopPayments(this.http);
|
|
689
724
|
balance = new CopBalance(this.http);
|
|
725
|
+
/** Channels you can use right now, with what each needs, plus the PSE banks and terms links. */
|
|
726
|
+
channels(options) {
|
|
727
|
+
return this.call("CopPayments_channels", {}, options);
|
|
728
|
+
}
|
|
690
729
|
};
|
|
691
730
|
|
|
692
731
|
// src/resources/crypto.ts
|
|
@@ -783,10 +822,34 @@ var Merchants = class extends APIResource {
|
|
|
783
822
|
retrieveBalance(id, options) {
|
|
784
823
|
return this.call("Merchants_getBalance", { path: { id } }, options);
|
|
785
824
|
}
|
|
786
|
-
/**
|
|
825
|
+
/**
|
|
826
|
+
* Credit this seller's pending balance from your platform balance. Send `amountVes`, or
|
|
827
|
+
* `amountUsd` to convert at the official BCV rate; `transferKey` makes it idempotent.
|
|
828
|
+
* The response is the seller balance plus `transfer` (amounts and rate used).
|
|
829
|
+
*/
|
|
787
830
|
transfer(id, params, options) {
|
|
788
831
|
return this.call("Merchants_transfer", { path: { id }, body: params }, options);
|
|
789
832
|
}
|
|
833
|
+
/** Seller balance movements, newest first. Await for one page, or `for await` over every movement. */
|
|
834
|
+
listTransactions(id, params = {}, options) {
|
|
835
|
+
return new PagePromise(
|
|
836
|
+
(cursor) => this.call("Merchants_listTransactions", { path: { id }, query: { ...params, cursor } }, options),
|
|
837
|
+
params.cursor
|
|
838
|
+
);
|
|
839
|
+
}
|
|
840
|
+
/** Monthly statement (`month: 'YYYY-MM'`, America/Caracas): opening, movements, closing. */
|
|
841
|
+
retrieveStatement(id, params, options) {
|
|
842
|
+
return this.call("Merchants_statement", { path: { id }, query: { ...params, format: "json" } }, options);
|
|
843
|
+
}
|
|
844
|
+
/** The same monthly statement as CSV (with a running balance column), returned as a string. */
|
|
845
|
+
async retrieveStatementCsv(id, params, options) {
|
|
846
|
+
const body = await this.call(
|
|
847
|
+
"Merchants_statement",
|
|
848
|
+
{ path: { id }, query: { ...params, format: "csv" } },
|
|
849
|
+
options
|
|
850
|
+
);
|
|
851
|
+
return typeof body === "string" ? body : "";
|
|
852
|
+
}
|
|
790
853
|
listAuditEvents(id, options) {
|
|
791
854
|
return this.call("Merchants_listAuditEvents", { path: { id } }, options);
|
|
792
855
|
}
|