aba-pos-sdk-node 1.0.3 → 1.0.4

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  # ABA POS SDK for Node.js
2
2
 
3
- An official Node.js Addons for ABA POS SDK developed by ABA Bank (Advanced Bank of Asia Ltd.). This package allows you to connect with the ABA POS terminal from these supported platforms: Windows (x64), macOS (x64, arm64), and Linux (x64).
3
+ An official Node.js Addons for ABA POS SDK developed by ABA Bank (Advanced Bank of Asia Ltd.). This package allows you to connect with the ABA POS terminal from these supported platforms: Windows (x64, arm64), macOS (x64, arm64), and Linux (x64, arm64).
4
4
 
5
5
  ## Driver Installation
6
6
  The driver might already come with Windows Update if you use Windows 10 or 11. To verify if you have
@@ -11,16 +11,21 @@ the driver installed, you need to:
11
11
  * Prolific USB-to-Serial Comm Port
12
12
  * Prolific PL2303GT USB Serial COM Port
13
13
  * Prolific PL2303GC USB Serial COM Port
14
+ * USB Serial Device (COMXX)
14
15
  * Or something similar.
15
16
  If you cannot find the USB device after you plug in the ABA POS USB cable, you can get the latest official
16
- USB driver from the Prolific website here.
17
- https://www.prolific.com.tw/US/ShowProduct.aspx?p_id=223&pcid=126
17
+ USB driver from:
18
+ * WizarPOS Q2, Q2P: https://www.prolific.com.tw/en/portfolio-item/pl2303gs/
19
+ * WizarPOS Q2Pro: https://smartpossdk.gitbook.io/cloudpossdk/faq/usb-serial-port/install-terminal-usb-drivers
18
20
 
19
21
  * On macOS, you need to install the official driver from AppStore here:
20
22
  https://apps.apple.com/us/app/pl2303-serial/id1624835354
21
23
 
22
24
  * On Linux, please contact our ABA Terminal Integration Team via any channel (Telegram, Email, etc)
23
25
 
26
+ ## Additional Software Installation
27
+ On Windows, you'll need to install Microsoft Visual C++ Redistributable (VC_redist.x64.exe or VC_redist.arm64.exe) if you could not load the aba-pos-sdk-node. Link: https://learn.microsoft.com/en-us/cpp/windows/latest-supported-vc-redist
28
+
24
29
  ## Import Module
25
30
  You need to import AbaPosSdk and AbaPosSdkError from this module: 'aba-pos-sdk-node'.
26
31
 
@@ -64,11 +69,9 @@ try {
64
69
  // The timeout in milliseconds. You can increase the timeout if it's too fast.
65
70
  const timeoutMs = 60000;
66
71
 
67
- console.log("Sending data to ABA POS...");
68
- await AbaPosSdk.sendDataByUsb(data, timeoutMs);
69
-
70
- console.log("Waiting for response from ABA POS...");
71
- const response = await AbaPosSdk.waitForResponse();
72
+ console.log("Send data to ABA POS. Waiting for response...");
73
+ const response = await AbaPosSdk.sendDataByUsb(data, timeoutMs);
74
+
72
75
  if (response) {
73
76
  console.log('Response received:', response);
74
77
  } else {
@@ -111,11 +114,9 @@ try {
111
114
  // The timeout in milliseconds. You can increase the timeout if it's too fast.
112
115
  const timeoutMs = 60000;
113
116
 
114
- console.log("Sending data to ABA POS...");
115
- await AbaPosSdk.sendDataByIp(data, timeoutMs);
116
-
117
- console.log("Waiting for response from ABA POS...");
118
- const response = await AbaPosSdk.waitForResponse();
117
+ console.log("Send data to ABA POS. Waiting for response...");
118
+ const response = await AbaPosSdk.sendDataByIp(data, timeoutMs);
119
+
119
120
  if (response) {
120
121
  console.log('Response received:', response);
121
122
  } else {
@@ -6,7 +6,7 @@
6
6
  * asynchronous utility methods to interact with the POS terminal via USB or IP connection.
7
7
  *
8
8
  * @copyright
9
- * Copyright (C) 2025 ABA Bank (Advanced Bank of Asia Ltd).
9
+ * Copyright (C) 2026 ABA Bank (Advanced Bank of Asia Ltd).
10
10
  * All copyrights of the code are owned or licensed by ABA Bank.
11
11
  */
12
- const r=require("path"),t=process.platform,a=process.arch;if("darwin"!==t&&"win32"!==t&&"linux"!==t)throw new AbaPosSdkError(e,`Unsupported platform: ${t}`);const s=r.resolve(__dirname,"addons",t,a,"aba_pos_sdk_node_addon"),o=require(s),e=-101;class AbaPosSdk{constructor(){throw new AbaPosSdkError(e,"AbaPosSdk is a static class and cannot be instantiated.")}static async initUsbConnection(r){if("string"!=typeof r)throw new AbaPosSdkError(e,"initUsbConnection() error. 'key' must be a string.");0!==await o.initUsbConnection(r)&&await AbaPosSdk.t()}static async sendDataByUsb(r,t){if("string"!=typeof r)throw new AbaPosSdkError(e,"sendDataByUsb() error. 'data' must be a string.");if(!Number.isInteger(t))throw new AbaPosSdkError(e,"sendDataByUsb() error. 'timeout' must be an integer.");0!==await o.sendDataByUsb(r,t)&&await AbaPosSdk.t()}static async releaseUsbConnection(){await o.releaseUsbConnection()}static async initIpConnection(r,t){if("string"!=typeof r)throw new AbaPosSdkError(e,"initIpConnection() error. 'ipAddress' must be a string.");if("string"!=typeof t)throw new AbaPosSdkError(e,"initIpConnection() error. 'key' must be a string.");0!==await o.initIpConnection(r,t)&&await AbaPosSdk.t()}static async updateIpAddress(r){if("string"!=typeof r)throw new AbaPosSdkError(e,"updateIpAddress() error. 'newIpAddress' must be a string.");0!==await o.updateIpAddress(r)&&await AbaPosSdk.t()}static async sendDataByIp(r,t){if("string"!=typeof r)throw new AbaPosSdkError(e,"sendDataByIp() error. 'data' must be a string.");if(!Number.isInteger(t))throw new AbaPosSdkError(e,"sendDataByIp() error. 'timeout' must be an integer.");0!==await o.sendDataByIp(r,t)&&await AbaPosSdk.t()}static async releaseIpConnection(){await o.releaseIpConnection()}static async cancelWaitingPosTerminal(){0!==await o.cancelWaitingPosTerminal()&&await AbaPosSdk.t()}static waitForResponse(){return new Promise((r,t)=>{o.waitForResponseAsync(async(a,s)=>{a?t(a):0==await AbaPosSdk.getErrorCode()?r(s):t(await AbaPosSdk.o())})})}static async getErrorMessage(){return await o.getErrorMessage()}static async getErrorCode(){return await o.getErrorCode()}static async setLogDirectoryPath(r){if("string"!=typeof r)throw new AbaPosSdkError(e,"setLogDirectoryPath() error. 'absolutePath' must be a string.");0!==await o.setLogDirectoryPath(r)&&await AbaPosSdk.t()}static async removeLogDirectoryPath(){0!==await o.removeLogDirectoryPath()&&await AbaPosSdk.t()}static async updateKey(r){if("string"!=typeof r)throw new AbaPosSdkError(e,"updateKey() error. 'newKey' must be a string.");0!==await o.updateKey(r)&&await AbaPosSdk.t()}static generateTimestamp(){const r=new Date;return`${r.getFullYear()}-${String(r.getMonth()+1).padStart(2,"0")}-${String(r.getDate()).padStart(2,"0")} ${String(r.getHours()).padStart(2,"0")}:${String(r.getMinutes()).padStart(2,"0")}:${String(r.getSeconds()).padStart(2,"0")}`}static async t(){throw new AbaPosSdkError(await AbaPosSdk.getErrorCode(),await AbaPosSdk.getErrorMessage())}static async o(){return new AbaPosSdkError(await AbaPosSdk.getErrorCode(),await AbaPosSdk.getErrorMessage())}}class AbaPosSdkError extends Error{constructor(r,t){if(super(t),!Number.isInteger(r))throw new AbaPosSdkError(e,"'errorCode' must be an integer.");if("string"!=typeof t)throw new AbaPosSdkError(e,"'errorMessage' must be a string.");this.name="AbaPosSdkError",this.errorCode=r,this.errorMessage=t,Error.captureStackTrace&&Error.captureStackTrace(this,AbaPosSdkError)}toString(){return`AbaPosSdkError: ${this.errorMessage} (Error Code: ${this.errorCode})`}}module.exports={AbaPosSdk:AbaPosSdk,AbaPosSdkError:AbaPosSdkError};
12
+ const r=require("path"),t=process.platform,a=process.arch;if("darwin"!==t&&"win32"!==t&&"linux"!==t)throw new AbaPosSdkError(e,`Unsupported platform: ${t}`);const s=r.resolve(__dirname,"addons",t,a,"aba_pos_sdk_node_addon"),o=require(s),e=-101;class AbaPosSdk{constructor(){throw new AbaPosSdkError(e,"AbaPosSdk is a static class and cannot be instantiated.")}static async initUsbConnection(r){if("string"!=typeof r)throw new AbaPosSdkError(e,"initUsbConnection() error. 'key' must be a string.");0!==await o.initUsbConnection(r)&&await AbaPosSdk.t()}static async sendDataByUsb(r,t){if("string"!=typeof r)throw new AbaPosSdkError(e,"sendDataByUsb() error. 'data' must be a string.");if(!Number.isInteger(t))throw new AbaPosSdkError(e,"sendDataByUsb() error. 'timeout' must be an integer.");return 0!==await o.sendDataByUsb(r,t)&&await AbaPosSdk.t(),AbaPosSdk.o()}static async releaseUsbConnection(){await o.releaseUsbConnection()}static async initIpConnection(r,t){if("string"!=typeof r)throw new AbaPosSdkError(e,"initIpConnection() error. 'ipAddress' must be a string.");if("string"!=typeof t)throw new AbaPosSdkError(e,"initIpConnection() error. 'key' must be a string.");0!==await o.initIpConnection(r,t)&&await AbaPosSdk.t()}static async updateIpAddress(r){if("string"!=typeof r)throw new AbaPosSdkError(e,"updateIpAddress() error. 'newIpAddress' must be a string.");0!==await o.updateIpAddress(r)&&await AbaPosSdk.t()}static async sendDataByIp(r,t){if("string"!=typeof r)throw new AbaPosSdkError(e,"sendDataByIp() error. 'data' must be a string.");if(!Number.isInteger(t))throw new AbaPosSdkError(e,"sendDataByIp() error. 'timeout' must be an integer.");return 0!==await o.sendDataByIp(r,t)&&await AbaPosSdk.t(),AbaPosSdk.o()}static async releaseIpConnection(){await o.releaseIpConnection()}static async cancelWaitingPosTerminal(){0!==await o.cancelWaitingPosTerminal()&&await AbaPosSdk.t()}static o(){return new Promise((r,t)=>{o.waitForResponseAsync(async(a,s)=>{a?t(a):0==await AbaPosSdk.getErrorCode()?r(s):t(await AbaPosSdk.i())})})}static async getErrorMessage(){return await o.getErrorMessage()}static async getErrorCode(){return await o.getErrorCode()}static async setLogDirectoryPath(r){if("string"!=typeof r)throw new AbaPosSdkError(e,"setLogDirectoryPath() error. 'absolutePath' must be a string.");0!==await o.setLogDirectoryPath(r)&&await AbaPosSdk.t()}static async removeLogDirectoryPath(){0!==await o.removeLogDirectoryPath()&&await AbaPosSdk.t()}static async updateKey(r){if("string"!=typeof r)throw new AbaPosSdkError(e,"updateKey() error. 'newKey' must be a string.");0!==await o.updateKey(r)&&await AbaPosSdk.t()}static generateTimestamp(){const r=new Date;return`${r.getFullYear()}-${String(r.getMonth()+1).padStart(2,"0")}-${String(r.getDate()).padStart(2,"0")} ${String(r.getHours()).padStart(2,"0")}:${String(r.getMinutes()).padStart(2,"0")}:${String(r.getSeconds()).padStart(2,"0")}`}static async t(){throw new AbaPosSdkError(await AbaPosSdk.getErrorCode(),await AbaPosSdk.getErrorMessage())}static async i(){return new AbaPosSdkError(await AbaPosSdk.getErrorCode(),await AbaPosSdk.getErrorMessage())}}class AbaPosSdkError extends Error{constructor(r,t){if(super(t),!Number.isInteger(r))throw new AbaPosSdkError(e,"'errorCode' must be an integer.");if("string"!=typeof t)throw new AbaPosSdkError(e,"'errorMessage' must be a string.");this.name="AbaPosSdkError",this.errorCode=r,this.errorMessage=t,Error.captureStackTrace&&Error.captureStackTrace(this,AbaPosSdkError)}toString(){return`AbaPosSdkError: ${this.errorMessage} (Error Code: ${this.errorCode})`}}module.exports={AbaPosSdk:AbaPosSdk,AbaPosSdkError:AbaPosSdkError};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aba-pos-sdk-node",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "description": "Node.js Addons for ABA POS SDK developed by ABA Bank. This package allows you to connect with the ABA POS terminal.",
5
5
  "main": "aba_pos_sdk.min.js",
6
6
  "type": "commonjs",