vxgate 1.0.1 → 2.0.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 +9 -0
- package/package.json +1 -1
- package/src/index.js +11 -11
- package/src/index.mjs +2 -2
package/README.md
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
Violetics Payment Gateway SDK — terima pembayaran QRIS via Orderkuota dengan 3 baris kode.
|
|
4
4
|
|
|
5
|
+
## Get API Key
|
|
6
|
+
|
|
7
|
+
1. Daftar di **[pg.vltcx.eu.cc/register](https://pg.vltcx.eu.cc/register)**
|
|
8
|
+
2. Verifikasi akun kamu
|
|
9
|
+
3. Buka **Dashboard → API Keys** → Generate key baru
|
|
10
|
+
4. Copy key dengan format `vlt_xxx` — siap dipakai
|
|
11
|
+
|
|
5
12
|
## Install
|
|
6
13
|
|
|
7
14
|
```bash
|
|
@@ -193,5 +200,7 @@ const { VioleticsPayment } = require('vxgate');
|
|
|
193
200
|
|
|
194
201
|
## Links
|
|
195
202
|
|
|
203
|
+
- [Register](https://pg.vltcx.eu.cc/register) — daftar & dapatkan API key
|
|
196
204
|
- [Documentation](https://pg.vltcx.eu.cc/docs)
|
|
197
205
|
- [Dashboard](https://pg.vltcx.eu.cc/dashboard)
|
|
206
|
+
- [GitHub](https://github.com/cv3inx/VXGate)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vxgate",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "Violetics Payment Gateway SDK — QRIS payment via Orderkuota API",
|
|
5
5
|
"keywords": ["qris", "payment", "orderkuota", "violetics", "indonesia", "payment-gateway"],
|
|
6
6
|
"author": "Violetics",
|
package/src/index.js
CHANGED
|
@@ -42,7 +42,7 @@ const DEFAULT_BASE_URL = 'https://pg.vltcx.eu.cc/api';
|
|
|
42
42
|
* @property {function} [onPoll] (attempt: number, status: string) => void
|
|
43
43
|
*/
|
|
44
44
|
|
|
45
|
-
class
|
|
45
|
+
class VXGatePayment {
|
|
46
46
|
/**
|
|
47
47
|
* @param {string} apiKey - Violetics API Key (format: vlt_xxx)
|
|
48
48
|
* @param {string} [baseUrl]
|
|
@@ -60,7 +60,7 @@ class VioleticsPayment {
|
|
|
60
60
|
const res = await fetch(`${this._baseUrl}?${qs}`);
|
|
61
61
|
const data = await res.json();
|
|
62
62
|
if (!data.status && !data.success)
|
|
63
|
-
throw new
|
|
63
|
+
throw new VXGateError(data.message ?? `HTTP ${res.status}`, res.status, data);
|
|
64
64
|
return data;
|
|
65
65
|
}
|
|
66
66
|
|
|
@@ -72,7 +72,7 @@ class VioleticsPayment {
|
|
|
72
72
|
});
|
|
73
73
|
const data = await res.json();
|
|
74
74
|
if (!data.status && !data.success)
|
|
75
|
-
throw new
|
|
75
|
+
throw new VXGateError(data.message ?? `HTTP ${res.status}`, res.status, data);
|
|
76
76
|
return data;
|
|
77
77
|
}
|
|
78
78
|
|
|
@@ -148,7 +148,7 @@ class VioleticsPayment {
|
|
|
148
148
|
await new Promise(r => setTimeout(r, wait));
|
|
149
149
|
}
|
|
150
150
|
|
|
151
|
-
throw new
|
|
151
|
+
throw new VXGateTimeoutError(
|
|
152
152
|
`Polling timeout setelah ${timeoutMs / 1000}s`,
|
|
153
153
|
referenceId,
|
|
154
154
|
timeoutMs,
|
|
@@ -228,7 +228,7 @@ class VioleticsPayment {
|
|
|
228
228
|
}
|
|
229
229
|
}
|
|
230
230
|
// Browser (Web Crypto — async, use verifyWebhookAsync instead)
|
|
231
|
-
throw new Error('Use
|
|
231
|
+
throw new Error('Use VXGatePayment.verifyWebhookAsync() in browser environments');
|
|
232
232
|
}
|
|
233
233
|
|
|
234
234
|
/**
|
|
@@ -250,23 +250,23 @@ class VioleticsPayment {
|
|
|
250
250
|
|
|
251
251
|
// ── Custom errors ─────────────────────────────────────────────────────────
|
|
252
252
|
|
|
253
|
-
class
|
|
253
|
+
class VXGateError extends Error {
|
|
254
254
|
constructor(message, statusCode, response) {
|
|
255
255
|
super(message);
|
|
256
|
-
this.name = '
|
|
256
|
+
this.name = 'VXGateError';
|
|
257
257
|
this.statusCode = statusCode;
|
|
258
258
|
this.response = response;
|
|
259
259
|
}
|
|
260
260
|
}
|
|
261
261
|
|
|
262
|
-
class
|
|
262
|
+
class VXGateTimeoutError extends Error {
|
|
263
263
|
constructor(message, referenceId, timeoutMs) {
|
|
264
264
|
super(message);
|
|
265
|
-
this.name = '
|
|
265
|
+
this.name = 'VXGateTimeoutError';
|
|
266
266
|
this.referenceId = referenceId;
|
|
267
267
|
this.timeoutMs = timeoutMs;
|
|
268
268
|
}
|
|
269
269
|
}
|
|
270
270
|
|
|
271
|
-
module.exports = {
|
|
272
|
-
module.exports.default =
|
|
271
|
+
module.exports = { VXGatePayment, VXGateError, VXGateTimeoutError };
|
|
272
|
+
module.exports.default = VXGatePayment;
|
package/src/index.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// ESM re-export wrapper
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
2
|
+
export { VXGatePayment, VXGateError, VXGateTimeoutError } from './index.js';
|
|
3
|
+
export { VXGatePayment as default } from './index.js';
|