@fire-spark/payments-clisitef-pinpad-rn 0.8.0 → 0.8.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/dist/index.js +16 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -1368,10 +1368,25 @@ const clisitefPinPadPayments = (options = {}) => {
|
|
|
1368
1368
|
await writeTransaction(storage, next, key);
|
|
1369
1369
|
return next;
|
|
1370
1370
|
};
|
|
1371
|
+
const isConfigureBusy = (error) => {
|
|
1372
|
+
return error?.provider_code === "-12";
|
|
1373
|
+
};
|
|
1374
|
+
/** Drops a leftover native session so `configure` can run again. */
|
|
1375
|
+
const releaseNative = async () => {
|
|
1376
|
+
await client.abortTransaction(CLISITEF_ABORT_FLAG).catch(() => 0);
|
|
1377
|
+
await client.submitPendingMessages().catch(() => -1);
|
|
1378
|
+
await client.closePinPad().catch(() => -1);
|
|
1379
|
+
client.invalidate();
|
|
1380
|
+
};
|
|
1371
1381
|
/** Configures and resolves the open records of the device, if any. */
|
|
1372
1382
|
const prepare = async (ctx) => {
|
|
1373
1383
|
const settings = readClisitefPinPadSettings(ctx.config, ctx.deviceSettings);
|
|
1374
|
-
|
|
1384
|
+
let error = await configure(settings);
|
|
1385
|
+
if (isConfigureBusy(error)) {
|
|
1386
|
+
clisitefDebug("pinpad.adapter.release", "busy", {});
|
|
1387
|
+
await releaseNative();
|
|
1388
|
+
error = await configure(settings);
|
|
1389
|
+
}
|
|
1375
1390
|
const storage = storageOf(ctx);
|
|
1376
1391
|
const resolve = async (key) => {
|
|
1377
1392
|
const found = await readTransaction(storage, key);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fire-spark/payments-clisitef-pinpad-rn",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.1",
|
|
4
4
|
"description": "Fire Spark CliSiTef (Software Express) pinpad adapter for Brazil: debit, credit, voucher and Pix with automatic voids on Android kiosks",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -17,9 +17,9 @@
|
|
|
17
17
|
}
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@fire-spark/payments": "^0.8.
|
|
21
|
-
"@fire-spark/payments-clisitef-client": "^0.8.
|
|
22
|
-
"@fire-spark/types": "^0.8.
|
|
20
|
+
"@fire-spark/payments": "^0.8.1",
|
|
21
|
+
"@fire-spark/payments-clisitef-client": "^0.8.1",
|
|
22
|
+
"@fire-spark/types": "^0.8.1"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
25
|
"tsdown": "^0.22.14",
|