@vexpay/node 0.14.0 → 0.15.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 +4 -4
- package/dist/index.cjs +39 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +573 -34
- package/dist/index.d.ts +573 -34
- package/dist/index.js +39 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# VEXPay Node.js SDK
|
|
2
2
|
|
|
3
|
-
The official Node.js / TypeScript library for the [VEXPay](https://
|
|
3
|
+
The official Node.js / TypeScript library for the [VEXPay](https://vexpay.app) API: accept Venezuelan payments (Pago Móvil C2P, cards, débito inmediato), pay out to merchants, create checkout sessions, and verify signed webhooks.
|
|
4
4
|
|
|
5
5
|
- Fully typed from the VEXPay OpenAPI contract
|
|
6
6
|
- Safe retries: every `POST` carries an `Idempotency-Key`, so a retried charge never charges twice
|
|
@@ -278,7 +278,7 @@ await vexpay.subscriptions.update(subscription.id, { cancelAtPeriodEnd: true });
|
|
|
278
278
|
|
|
279
279
|
## Testing card payments
|
|
280
280
|
|
|
281
|
-
With a test API key, VPOS test cards return a fixed outcome without reaching the bank: `4242424242424242` succeeds, `4000000000009995` is declined with `G51` (insufficient funds), `4000000000000259` completes and is then charged back, and more. A decline fails exactly like a live one (422, the bank code in `code` and `failureCode`, a `payment.failed` webhook). With a live key these numbers are refused with 400 `test_card_in_live_mode`. Full list: [test cards](https://docs.
|
|
281
|
+
With a test API key, VPOS test cards return a fixed outcome without reaching the bank: `4242424242424242` succeeds, `4000000000009995` is declined with `G51` (insufficient funds), `4000000000000259` completes and is then charged back, and more. A decline fails exactly like a live one (422, the bank code in `code` and `failureCode`, a `payment.failed` webhook). With a live key these numbers are refused with 400 `test_card_in_live_mode`. Full list: [test cards](https://docs.vexpay.app/vpos#test-card).
|
|
282
282
|
|
|
283
283
|
## Webhooks
|
|
284
284
|
|
|
@@ -475,7 +475,7 @@ console.log(recentPayouts.length);
|
|
|
475
475
|
import VexPay from '@vexpay/node';
|
|
476
476
|
|
|
477
477
|
const vexpay = new VexPay(process.env.VEXPAY_API_KEY!, {
|
|
478
|
-
baseUrl: 'http://localhost:3010', // default: https://api.
|
|
478
|
+
baseUrl: 'http://localhost:3010', // default: https://api.vexpay.app
|
|
479
479
|
timeoutMs: 30_000,
|
|
480
480
|
maxNetworkRetries: 2,
|
|
481
481
|
});
|
|
@@ -541,7 +541,7 @@ console.log(describe, {} as NewPayout, {} as Session);
|
|
|
541
541
|
| `paymentMethods` | `retrieve`, `detach` |
|
|
542
542
|
| `webhooks` | `constructEvent`, `generateTestHeader` (offline) |
|
|
543
543
|
|
|
544
|
-
Full API reference: [docs](https://
|
|
544
|
+
Full API reference: [docs](https://docs.vexpay.app) · OpenAPI: `/openapi.json`.
|
|
545
545
|
|
|
546
546
|
## License
|
|
547
547
|
|
package/dist/index.cjs
CHANGED
|
@@ -107,7 +107,7 @@ function errorFromResponse(status, body, requestId) {
|
|
|
107
107
|
}
|
|
108
108
|
|
|
109
109
|
// src/version.ts
|
|
110
|
-
var VERSION = "0.
|
|
110
|
+
var VERSION = "0.15.0";
|
|
111
111
|
|
|
112
112
|
// src/core.ts
|
|
113
113
|
var INITIAL_RETRY_DELAY_MS = 500;
|
|
@@ -366,6 +366,11 @@ var ROUTES = {
|
|
|
366
366
|
TenantPayoutAccount_startVerify: { method: "POST", path: "/v1/tenant/payout-account/verify/start" },
|
|
367
367
|
TenantPayoutAccount_upsert: { method: "PUT", path: "/v1/tenant/payout-account" },
|
|
368
368
|
TenantPayoutAccount_upsertPost: { method: "POST", path: "/v1/tenant/payout-account" },
|
|
369
|
+
TestClocks_advance: { method: "POST", path: "/v1/test-clocks/{id}/advance" },
|
|
370
|
+
TestClocks_create: { method: "POST", path: "/v1/test-clocks" },
|
|
371
|
+
TestClocks_list: { method: "GET", path: "/v1/test-clocks" },
|
|
372
|
+
TestClocks_remove: { method: "DELETE", path: "/v1/test-clocks/{id}" },
|
|
373
|
+
TestClocks_retrieve: { method: "GET", path: "/v1/test-clocks/{id}" },
|
|
369
374
|
Topups_create: { method: "POST", path: "/v1/balance/topups" },
|
|
370
375
|
Topups_get: { method: "GET", path: "/v1/balance/topups/{id}" },
|
|
371
376
|
Topups_instant: { method: "POST", path: "/v1/balance/topups/{id}/instant" },
|
|
@@ -633,6 +638,33 @@ var PaymentMethods = class extends APIResource {
|
|
|
633
638
|
return this.call("PaymentMethods_detach", { path: { id } }, options);
|
|
634
639
|
}
|
|
635
640
|
};
|
|
641
|
+
var TestClocks = class extends APIResource {
|
|
642
|
+
/** `frozenTime` is an ISO 8601 time. */
|
|
643
|
+
create(params, options) {
|
|
644
|
+
return this.call("TestClocks_create", { body: params }, options);
|
|
645
|
+
}
|
|
646
|
+
/** Await for one page, or `for await` over every clock (newest first). */
|
|
647
|
+
list(params = {}, options) {
|
|
648
|
+
return new PagePromise(
|
|
649
|
+
(cursor) => this.call("TestClocks_list", { query: { ...params, cursor } }, options),
|
|
650
|
+
params.cursor
|
|
651
|
+
);
|
|
652
|
+
}
|
|
653
|
+
retrieve(id, options) {
|
|
654
|
+
return this.call("TestClocks_retrieve", { path: { id } }, options);
|
|
655
|
+
}
|
|
656
|
+
/** Deletes the clock with its customers, subscriptions, invoices and payment methods. */
|
|
657
|
+
delete(id, options) {
|
|
658
|
+
return this.call("TestClocks_remove", { path: { id } }, options);
|
|
659
|
+
}
|
|
660
|
+
/**
|
|
661
|
+
* Move the clock forward (at most two intervals of its shortest subscription). It returns at
|
|
662
|
+
* once with `status: "advancing"`; poll `retrieve` or wait for `test_clock.ready`.
|
|
663
|
+
*/
|
|
664
|
+
advance(id, params, options) {
|
|
665
|
+
return this.call("TestClocks_advance", { path: { id }, body: params }, options);
|
|
666
|
+
}
|
|
667
|
+
};
|
|
636
668
|
|
|
637
669
|
// src/resources/commerce.ts
|
|
638
670
|
var CheckoutSessions = class extends APIResource {
|
|
@@ -1063,6 +1095,8 @@ var WEBHOOK_EVENT_NAMES = [
|
|
|
1063
1095
|
"payment_method.attached",
|
|
1064
1096
|
"payment_method.updated",
|
|
1065
1097
|
"payment_method.detached",
|
|
1098
|
+
"test_clock.advancing",
|
|
1099
|
+
"test_clock.ready",
|
|
1066
1100
|
"notification.test"
|
|
1067
1101
|
];
|
|
1068
1102
|
var SIGNATURE_HEADER = "VexPay-Signature";
|
|
@@ -1143,7 +1177,7 @@ var Webhooks = class {
|
|
|
1143
1177
|
};
|
|
1144
1178
|
|
|
1145
1179
|
// src/client.ts
|
|
1146
|
-
var DEFAULT_BASE_URL = "https://api.
|
|
1180
|
+
var DEFAULT_BASE_URL = "https://api.vexpay.app";
|
|
1147
1181
|
var VexPay = class {
|
|
1148
1182
|
/** @internal */
|
|
1149
1183
|
http;
|
|
@@ -1175,6 +1209,8 @@ var VexPay = class {
|
|
|
1175
1209
|
setupSessions;
|
|
1176
1210
|
/** Billing: domiciliación payment methods (bolívar methods your account takes: `payments.methods()`). */
|
|
1177
1211
|
paymentMethods;
|
|
1212
|
+
/** Billing, test mode only: simulated time for trials, renewals and dunning. */
|
|
1213
|
+
testClocks;
|
|
1178
1214
|
/** Offline helpers: `constructEvent` verifies deliveries; no API calls. */
|
|
1179
1215
|
webhooks = new Webhooks();
|
|
1180
1216
|
constructor(apiKey, options = {}) {
|
|
@@ -1215,6 +1251,7 @@ var VexPay = class {
|
|
|
1215
1251
|
this.invoices = new Invoices(this.http);
|
|
1216
1252
|
this.setupSessions = new SetupSessions(this.http);
|
|
1217
1253
|
this.paymentMethods = new PaymentMethods(this.http);
|
|
1254
|
+
this.testClocks = new TestClocks(this.http);
|
|
1218
1255
|
}
|
|
1219
1256
|
};
|
|
1220
1257
|
// Annotate the CommonJS export names for ESM import in node:
|