@vexpay/node 0.12.0 → 0.14.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.js CHANGED
@@ -62,7 +62,7 @@ function errorFromResponse(status, body, requestId) {
62
62
  }
63
63
 
64
64
  // src/version.ts
65
- var VERSION = "0.12.0";
65
+ var VERSION = "0.14.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" },
@@ -235,6 +236,7 @@ var ROUTES = {
235
236
  Crypto_getBalances: { method: "GET", path: "/v1/crypto/balances" },
236
237
  Crypto_getPayout: { method: "GET", path: "/v1/crypto/payouts/{id}" },
237
238
  Crypto_listNetworks: { method: "GET", path: "/v1/crypto/networks" },
239
+ Crypto_simulateDeposit: { method: "POST", path: "/v1/crypto/deposit-addresses/simulate" },
238
240
  Customers_create: { method: "POST", path: "/v1/customers" },
239
241
  Customers_list: { method: "GET", path: "/v1/customers" },
240
242
  Customers_remove: { method: "DELETE", path: "/v1/customers/{id}" },
@@ -255,10 +257,12 @@ var ROUTES = {
255
257
  Merchants_listAuditEvents: { method: "GET", path: "/v1/merchants/{id}/audit-events" },
256
258
  Merchants_listOrGetByRef: { method: "GET", path: "/v1/merchants" },
257
259
  Merchants_listPayoutMethods: { method: "GET", path: "/v1/merchants/{id}/payout-methods" },
260
+ Merchants_listTransactions: { method: "GET", path: "/v1/merchants/{id}/transactions" },
258
261
  Merchants_remove: { method: "DELETE", path: "/v1/merchants/{id}" },
259
262
  Merchants_setDefaultPayoutMethod: { method: "POST", path: "/v1/merchants/{id}/payout-methods/{methodId}/default" },
260
263
  Merchants_startVerify: { method: "POST", path: "/v1/merchants/{id}/verify/start" },
261
264
  Merchants_startVerifyMethod: { method: "POST", path: "/v1/merchants/{id}/payout-methods/{methodId}/verify/start" },
265
+ Merchants_statement: { method: "GET", path: "/v1/merchants/{id}/statement" },
262
266
  Merchants_transfer: { method: "POST", path: "/v1/merchants/{id}/transfers" },
263
267
  Merchants_update: { method: "PATCH", path: "/v1/merchants/{id}" },
264
268
  Notifications_sendTest: { method: "POST", path: "/v1/notifications/test" },
@@ -317,6 +321,11 @@ var ROUTES = {
317
321
  TenantPayoutAccount_startVerify: { method: "POST", path: "/v1/tenant/payout-account/verify/start" },
318
322
  TenantPayoutAccount_upsert: { method: "PUT", path: "/v1/tenant/payout-account" },
319
323
  TenantPayoutAccount_upsertPost: { method: "POST", path: "/v1/tenant/payout-account" },
324
+ Topups_create: { method: "POST", path: "/v1/balance/topups" },
325
+ Topups_get: { method: "GET", path: "/v1/balance/topups/{id}" },
326
+ Topups_instant: { method: "POST", path: "/v1/balance/topups/{id}/instant" },
327
+ Topups_list: { method: "GET", path: "/v1/balance/topups" },
328
+ Topups_simulate: { method: "POST", path: "/v1/balance/topups/{id}/simulate" },
320
329
  Webhooks_createWebhook: { method: "POST", path: "/v1/webhooks" },
321
330
  Webhooks_deleteWebhook: { method: "DELETE", path: "/v1/webhooks/{id}" },
322
331
  Webhooks_listWebhooks: { method: "GET", path: "/v1/webhooks" },
@@ -367,8 +376,30 @@ var BalanceTransactions = class extends APIResource {
367
376
  );
368
377
  }
369
378
  };
379
+ var BalanceTopups = class extends APIResource {
380
+ /** Start a top-up. Over the monthly limit fails with `topup_cap_exceeded` (422). */
381
+ create(params, options) {
382
+ return this.call("Topups_create", { body: params }, options);
383
+ }
384
+ /** Your latest top-ups (newest first, `limit` 1–100) plus this month's limit usage. */
385
+ list(params = {}, options) {
386
+ return this.call("Topups_list", { query: params }, options);
387
+ }
388
+ retrieve(id, options) {
389
+ return this.call("Topups_get", { path: { id } }, options);
390
+ }
391
+ /** Release the still-held part of a completed top-up now, for `instantFeeVes`. Idempotent; `not_held` (409) if nothing is held. */
392
+ instant(id, options) {
393
+ return this.call("Topups_instant", { path: { id } }, options);
394
+ }
395
+ /** Test mode only: complete the top-up as if the Pago Móvil arrived. */
396
+ simulate(id, options) {
397
+ return this.call("Topups_simulate", { path: { id } }, options);
398
+ }
399
+ };
370
400
  var Balance = class extends APIResource {
371
401
  transactions = new BalanceTransactions(this.http);
402
+ topups = new BalanceTopups(this.http);
372
403
  retrieve(options) {
373
404
  return this.call("Balance_getBalance", {}, options);
374
405
  }
@@ -656,8 +687,10 @@ var Conversions = class extends APIResource {
656
687
  // src/resources/cop.ts
657
688
  var CopPayments = class extends APIResource {
658
689
  /**
659
- * Create a payment in whole pesos. `buyer` is required for `nequi` and `daviplata`. The response
660
- * `next` says what the buyer does: `show_qr`, `approve_in_app` or `submit_otp`.
690
+ * Create a payment in whole pesos. `buyer` is required for every channel except `breb`, with
691
+ * `termsAccepted: true` when {@link Cop.channels} says `needsTermsAcceptance`; `pse` also needs
692
+ * `pse.bankCode`. The response `next` says what the buyer does: `show_qr`, `approve_in_app`,
693
+ * `submit_otp`, `redirect` (send them to `next.url`) or `redirect_pending` (retrieve again shortly).
661
694
  * Pass `idempotencyKey` in options to retry safely.
662
695
  */
663
696
  create(params, options) {
@@ -666,7 +699,7 @@ var CopPayments = class extends APIResource {
666
699
  retrieve(id, options) {
667
700
  return this.call("CopPayments_get", { path: { id } }, options);
668
701
  }
669
- /** Daviplata: submit the code the buyer received by SMS. A wrong code fails with `invalid_otp`. */
702
+ /** Daviplata with `next.type: "submit_otp"`: submit the code the buyer received by SMS. A wrong code fails with `invalid_otp`. */
670
703
  submitOtp(id, params, options) {
671
704
  return this.call("CopPayments_submitOtp", { path: { id }, body: params }, options);
672
705
  }
@@ -674,7 +707,10 @@ var CopPayments = class extends APIResource {
674
707
  cancel(id, options) {
675
708
  return this.call("CopPayments_cancel", { path: { id } }, options);
676
709
  }
677
- /** Full refund of a completed payment, within 96 hours. */
710
+ /**
711
+ * Full refund of a completed payment, within the channel's window (card 24 h, Bre-B 96 h).
712
+ * Channels that cannot be refunded through the API fail with `refund_not_supported`.
713
+ */
678
714
  refund(id, options) {
679
715
  return this.call("CopPayments_refund", { path: { id } }, options);
680
716
  }
@@ -687,6 +723,10 @@ var CopBalance = class extends APIResource {
687
723
  var Cop = class extends APIResource {
688
724
  payments = new CopPayments(this.http);
689
725
  balance = new CopBalance(this.http);
726
+ /** Channels you can use right now, with what each needs, plus the PSE banks and terms links. */
727
+ channels(options) {
728
+ return this.call("CopPayments_channels", {}, options);
729
+ }
690
730
  };
691
731
 
692
732
  // src/resources/crypto.ts
@@ -725,6 +765,14 @@ var Crypto = class extends APIResource {
725
765
  depositAddresses = new DepositAddresses(this.http);
726
766
  networks = new CryptoNetworks(this.http);
727
767
  payouts = new CryptoPayouts(this.http);
768
+ /**
769
+ * Test mode only: credit a deposit to one of your deposit addresses (`customerRef` + `currency` +
770
+ * `network`, requested before) as if it had arrived on chain. Sends `payment.completed` with
771
+ * `livemode: false`. A Live key gets 403 `test_mode_only`; an unknown address 404.
772
+ */
773
+ simulateDeposit(params, options) {
774
+ return this.call("Crypto_simulateDeposit", { body: params }, options);
775
+ }
728
776
  };
729
777
 
730
778
  // src/resources/merchants.ts
@@ -783,10 +831,34 @@ var Merchants = class extends APIResource {
783
831
  retrieveBalance(id, options) {
784
832
  return this.call("Merchants_getBalance", { path: { id } }, options);
785
833
  }
786
- /** Move VES between this merchant's balance and another. */
834
+ /**
835
+ * Credit this seller's pending balance from your platform balance. Send `amountVes`, or
836
+ * `amountUsd` to convert at the official BCV rate; `transferKey` makes it idempotent.
837
+ * The response is the seller balance plus `transfer` (amounts and rate used).
838
+ */
787
839
  transfer(id, params, options) {
788
840
  return this.call("Merchants_transfer", { path: { id }, body: params }, options);
789
841
  }
842
+ /** Seller balance movements, newest first. Await for one page, or `for await` over every movement. */
843
+ listTransactions(id, params = {}, options) {
844
+ return new PagePromise(
845
+ (cursor) => this.call("Merchants_listTransactions", { path: { id }, query: { ...params, cursor } }, options),
846
+ params.cursor
847
+ );
848
+ }
849
+ /** Monthly statement (`month: 'YYYY-MM'`, America/Caracas): opening, movements, closing. */
850
+ retrieveStatement(id, params, options) {
851
+ return this.call("Merchants_statement", { path: { id }, query: { ...params, format: "json" } }, options);
852
+ }
853
+ /** The same monthly statement as CSV (with a running balance column), returned as a string. */
854
+ async retrieveStatementCsv(id, params, options) {
855
+ const body = await this.call(
856
+ "Merchants_statement",
857
+ { path: { id }, query: { ...params, format: "csv" } },
858
+ options
859
+ );
860
+ return typeof body === "string" ? body : "";
861
+ }
790
862
  listAuditEvents(id, options) {
791
863
  return this.call("Merchants_listAuditEvents", { path: { id } }, options);
792
864
  }