wahdx-api 2.0.0 → 2.0.1

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 wahdalo
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # wahdx-api
2
2
 
3
- Package untuk generate QRIS dan cek payment status secara realtime dengan API OrderKuota dari [https://api.wahdx.co](https://api.wahdx.co).
3
+ Package untuk generate QRIS dan cek payment status secara realtime dengan API OrderKuota dari [https://eqris.com](https://eqris.com).
4
4
 
5
5
  > **⚠️ PENTING: Perubahan di Versi 2.0.0**
6
6
  >
@@ -34,7 +34,7 @@ ORKUT_TOKEN_AUTH=your_orkut_token_auth
34
34
  ORKUT_USERNAME=your_orkut_username
35
35
  ```
36
36
 
37
- > **Catatan:** Untuk mendapatkan tokenKey, Anda bisa membelinya di halaman [https://api.wahdx.co](https://api.wahdx.co)
37
+ > **Catatan:** Untuk mendapatkan tokenKey, Anda bisa membelinya di halaman [https://eqris.com](https://eqris.com)
38
38
 
39
39
  ### Opsi Konfigurasi
40
40
 
@@ -209,10 +209,10 @@ if (result.success && result.data.status === 'PAID') {
209
209
  ## FAQ
210
210
 
211
211
  ### Q: Bagaimana cara mendapatkan tokenKey agar bisa menggunakan module ini?
212
- A: Anda bisa membeli tokenKey di halaman utama [https://api.wahdx.co](https://api.wahdx.co)
212
+ A: Anda bisa membeli tokenKey di halaman utama [https://eqris.com](https://eqris.com)
213
213
 
214
214
  ### Q: Bagaimana cara mendapatkan kredensial API OrderKuota?
215
- A: Silahkan kunjungi dokumentasi api [https://api.wahdx.co/api-docs](https://api.wahdx.co/api-docs) untuk mendapatkan token pada akun orderkuota anda.
215
+ A: Silahkan kunjungi dokumentasi api [https://eqris.com/api-docs](https://eqris.com/api-docs) untuk mendapatkan token pada akun orderkuota anda.
216
216
 
217
217
  ### Q: Apakah module ini bisa digunakan di project CommonJS?
218
218
  A: Ya! Package ini mendukung dual module system (ESM dan CommonJS). Anda bisa menggunakan dengan dua cara:
@@ -12,15 +12,15 @@ class PaymentChecker {
12
12
  auth_token: config.auth_token
13
13
  };
14
14
  }
15
-
15
+
16
16
  async checkPaymentStatus(reference, amount) {
17
17
  try {
18
18
  if (!reference || !amount || amount <= 0) {
19
19
  throw new Error('Reference dan amount harus diisi dengan benar');
20
20
  }
21
-
21
+
22
22
  const response = await axios.post(
23
- 'https://api.wahdx.co/api/mutasi-orkut-v2',
23
+ 'https://eqris.com/api/mutasi-orkut-v2',
24
24
  {
25
25
  username_orkut: this.config.auth_username,
26
26
  token_orkut: this.config.auth_token
@@ -32,24 +32,24 @@ class PaymentChecker {
32
32
  }
33
33
  }
34
34
  );
35
-
35
+
36
36
  if (!response.data || !response.data.status || !response.data.data) {
37
37
  throw new Error('Response tidak valid dari server');
38
38
  }
39
-
39
+
40
40
  const transactions = response.data.data;
41
-
41
+
42
42
  const matchingTransactions = transactions.filter(tx => {
43
43
  const txAmount = parseInt(tx.amount);
44
44
  // Parse tanggal dengan timezone Jakarta
45
45
  const txDate = moment.tz(tx.date, 'YYYY-MM-DD HH:mm', 'Asia/Jakarta');
46
46
  const now = moment().tz("Asia/Jakarta");
47
47
  const timeDiff = now.diff(txDate, 'milliseconds');
48
-
48
+
49
49
  return txAmount === amount &&
50
- tx.qris === "static" &&
51
- tx.type === "CR" &&
52
- timeDiff <= 5 * 60 * 1000;
50
+ tx.qris === "static" &&
51
+ tx.type === "CR" &&
52
+ timeDiff <= 5 * 60 * 1000;
53
53
  });
54
54
 
55
55
  if (matchingTransactions.length > 0) {
@@ -58,7 +58,7 @@ class PaymentChecker {
58
58
  const latestDate = moment.tz(latest.date, 'YYYY-MM-DD HH:mm', 'Asia/Jakarta');
59
59
  return currentDate.isAfter(latestDate) ? current : latest;
60
60
  });
61
-
61
+
62
62
  return {
63
63
  success: true,
64
64
  data: {
@@ -71,7 +71,7 @@ class PaymentChecker {
71
71
  }
72
72
  };
73
73
  }
74
-
74
+
75
75
  return {
76
76
  success: true,
77
77
  data: {
@@ -12,15 +12,15 @@ class PaymentChecker {
12
12
  auth_token: config.auth_token
13
13
  };
14
14
  }
15
-
15
+
16
16
  async checkPaymentStatus(reference, amount) {
17
17
  try {
18
18
  if (!reference || !amount || amount <= 0) {
19
19
  throw new Error('Reference dan amount harus diisi dengan benar');
20
20
  }
21
-
21
+
22
22
  const response = await axios.post(
23
- 'https://api.wahdx.co/api/mutasi-orkut-v2',
23
+ 'https://eqris.com/api/mutasi-orkut-v2',
24
24
  {
25
25
  username_orkut: this.config.auth_username,
26
26
  token_orkut: this.config.auth_token
@@ -32,24 +32,24 @@ class PaymentChecker {
32
32
  }
33
33
  }
34
34
  );
35
-
35
+
36
36
  if (!response.data || !response.data.status || !response.data.data) {
37
37
  throw new Error('Response tidak valid dari server');
38
38
  }
39
-
39
+
40
40
  const transactions = response.data.data;
41
-
41
+
42
42
  const matchingTransactions = transactions.filter(tx => {
43
43
  const txAmount = parseInt(tx.amount);
44
44
  // Parse tanggal dengan timezone Jakarta
45
45
  const txDate = moment.tz(tx.date, 'YYYY-MM-DD HH:mm', 'Asia/Jakarta');
46
46
  const now = moment().tz("Asia/Jakarta");
47
47
  const timeDiff = now.diff(txDate, 'milliseconds');
48
-
48
+
49
49
  return txAmount === amount &&
50
- tx.qris === "static" &&
51
- tx.type === "CR" &&
52
- timeDiff <= 5 * 60 * 1000;
50
+ tx.qris === "static" &&
51
+ tx.type === "CR" &&
52
+ timeDiff <= 5 * 60 * 1000;
53
53
  });
54
54
 
55
55
  if (matchingTransactions.length > 0) {
@@ -58,7 +58,7 @@ class PaymentChecker {
58
58
  const latestDate = moment.tz(latest.date, 'YYYY-MM-DD HH:mm', 'Asia/Jakarta');
59
59
  return currentDate.isAfter(latestDate) ? current : latest;
60
60
  });
61
-
61
+
62
62
  return {
63
63
  success: true,
64
64
  data: {
@@ -71,7 +71,7 @@ class PaymentChecker {
71
71
  }
72
72
  };
73
73
  }
74
-
74
+
75
75
  return {
76
76
  success: true,
77
77
  data: {
@@ -21,7 +21,7 @@ class QRISGenerator {
21
21
  if (!qrString) {
22
22
  throw new Error('qrString tidak boleh kosong');
23
23
  }
24
-
24
+
25
25
  // Gunakan QRCode.toBuffer langsung tanpa canvas
26
26
  const qrBuffer = await QRCode.toBuffer(qrString, {
27
27
  errorCorrectionLevel: 'H',
@@ -32,7 +32,7 @@ class QRISGenerator {
32
32
  light: '#ffffff'
33
33
  }
34
34
  });
35
-
35
+
36
36
  return qrBuffer;
37
37
  } catch (error) {
38
38
  throw new Error('Gagal generate QR: ' + error.message);
@@ -69,7 +69,7 @@ class QRISGenerator {
69
69
  }
70
70
 
71
71
  const response = await axios.post(
72
- 'https://api.wahdx.co/api/qr-orkut-v2',
72
+ 'https://eqris.com/api/qr-orkut-v2',
73
73
  {
74
74
  username_orkut: this.config.auth_username,
75
75
  token_orkut: this.config.auth_token,
@@ -88,10 +88,10 @@ class QRISGenerator {
88
88
  }
89
89
 
90
90
  const qrString = response.data.qrString;
91
-
91
+
92
92
  // Generate QR image dari qrString yang didapat dari API
93
93
  const qrBuffer = await this.generateQRImage(qrString);
94
-
94
+
95
95
  return {
96
96
  qrString,
97
97
  qrBuffer
@@ -106,15 +106,15 @@ class QRISGenerator {
106
106
  if (!amount || amount <= 0) {
107
107
  throw new Error('Nominal harus lebih besar dari 0');
108
108
  }
109
-
109
+
110
110
  if (!this.config.baseQrString) {
111
111
  throw new Error('BaseQrString tidak tersedia. Gunakan readQRFromImage terlebih dahulu atau berikan baseQrString pada config.');
112
112
  }
113
-
113
+
114
114
  if (!this.config.baseQrString.includes("5802ID")) {
115
115
  throw new Error("Format QRIS tidak valid");
116
116
  }
117
-
117
+
118
118
  const finalAmount = Math.floor(amount);
119
119
  const qrisBase = this.config.baseQrString.slice(0, -4).replace("010211", "010212");
120
120
  const nominalStr = finalAmount.toString();
@@ -122,7 +122,7 @@ class QRISGenerator {
122
122
  const insertPosition = qrisBase.indexOf("5802ID");
123
123
  const qrisWithNominal = qrisBase.slice(0, insertPosition) + nominalTag + qrisBase.slice(insertPosition);
124
124
  const checksum = this.calculateCRC16(qrisWithNominal);
125
-
125
+
126
126
  return qrisWithNominal + checksum;
127
127
  } catch (error) {
128
128
  throw new Error('Gagal generate string QRIS: ' + error.message);
@@ -21,7 +21,7 @@ class QRISGenerator {
21
21
  if (!qrString) {
22
22
  throw new Error('qrString tidak boleh kosong');
23
23
  }
24
-
24
+
25
25
  // Gunakan QRCode.toBuffer langsung tanpa canvas
26
26
  const qrBuffer = await QRCode.toBuffer(qrString, {
27
27
  errorCorrectionLevel: 'H',
@@ -32,7 +32,7 @@ class QRISGenerator {
32
32
  light: '#ffffff'
33
33
  }
34
34
  });
35
-
35
+
36
36
  return qrBuffer;
37
37
  } catch (error) {
38
38
  throw new Error('Gagal generate QR: ' + error.message);
@@ -69,7 +69,7 @@ class QRISGenerator {
69
69
  }
70
70
 
71
71
  const response = await axios.post(
72
- 'https://api.wahdx.co/api/qr-orkut-v2',
72
+ 'https://eqris.com/api/qr-orkut-v2',
73
73
  {
74
74
  username_orkut: this.config.auth_username,
75
75
  token_orkut: this.config.auth_token,
@@ -88,10 +88,10 @@ class QRISGenerator {
88
88
  }
89
89
 
90
90
  const qrString = response.data.qrString;
91
-
91
+
92
92
  // Generate QR image dari qrString yang didapat dari API
93
93
  const qrBuffer = await this.generateQRImage(qrString);
94
-
94
+
95
95
  return {
96
96
  qrString,
97
97
  qrBuffer
@@ -106,15 +106,15 @@ class QRISGenerator {
106
106
  if (!amount || amount <= 0) {
107
107
  throw new Error('Nominal harus lebih besar dari 0');
108
108
  }
109
-
109
+
110
110
  if (!this.config.baseQrString) {
111
111
  throw new Error('BaseQrString tidak tersedia. Gunakan readQRFromImage terlebih dahulu atau berikan baseQrString pada config.');
112
112
  }
113
-
113
+
114
114
  if (!this.config.baseQrString.includes("5802ID")) {
115
115
  throw new Error("Format QRIS tidak valid");
116
116
  }
117
-
117
+
118
118
  const finalAmount = Math.floor(amount);
119
119
  const qrisBase = this.config.baseQrString.slice(0, -4).replace("010211", "010212");
120
120
  const nominalStr = finalAmount.toString();
@@ -122,7 +122,7 @@ class QRISGenerator {
122
122
  const insertPosition = qrisBase.indexOf("5802ID");
123
123
  const qrisWithNominal = qrisBase.slice(0, insertPosition) + nominalTag + qrisBase.slice(insertPosition);
124
124
  const checksum = this.calculateCRC16(qrisWithNominal);
125
-
125
+
126
126
  return qrisWithNominal + checksum;
127
127
  } catch (error) {
128
128
  throw new Error('Gagal generate string QRIS: ' + error.message);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "wahdx-api",
3
- "version": "2.0.0",
4
- "description": "Package untuk generate QRIS dan cek payment status secara realtime dengan API OrderKuota dari https://api.wahdx.co",
3
+ "version": "2.0.1",
4
+ "description": "Package untuk generate QRIS dan cek payment status secara realtime dengan API OrderKuota dari https://eqris.com",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.mjs",
7
7
  "exports": {
@@ -45,4 +45,4 @@
45
45
  "engines": {
46
46
  "node": ">=20.18.3"
47
47
  }
48
- }
48
+ }