From 9e411527a97ca18ef275683fb352f0ff54b6c201 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ezequiel=20Cu=C3=B1ado?= Date: Fri, 2 Jun 2023 13:23:47 +0200 Subject: [PATCH] chore: adding logs EFTCLIENT-4791 (#148) * chore: adding logs * chore: 4.1.7-RC.0 * chore: keep the import statements --- package.json | 2 +- .../handpoint/cordova/HandpointHelper.java | 21 ++++++++++++------- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index 7d1558a..e58a633 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cordova-plugin-handpoint", - "version": "4.1.6-RC.0", + "version": "4.1.7-RC.0", "description": "Cordova Handpoint SDK Plugin", "cordova": { "id": "cordova-plugin-handpoint", diff --git a/src/android/com/handpoint/cordova/HandpointHelper.java b/src/android/com/handpoint/cordova/HandpointHelper.java index 0a47e73..88f2f14 100644 --- a/src/android/com/handpoint/cordova/HandpointHelper.java +++ b/src/android/com/handpoint/cordova/HandpointHelper.java @@ -495,12 +495,18 @@ public void setLocale(CallbackContext callbackContext, JSONObject params) throws @Override public void endOfTransaction(TransactionResult transactionResult, Device device) { SDKEvent event = new SDKEvent("endOfTransaction"); - event.put("transactionResult", transactionResult); - event.put("device", device); - PluginResult result = new PluginResult(PluginResult.Status.OK, event.toJSONObject()); - result.setKeepCallback(true); - if (this.callbackContext != null) { - this.callbackContext.sendPluginResult(result); + // print transaction result before serializing it + if (transactionResult != null) { + Logger.getLogger("App-Detailed-Logger").warning("***[APP] -> endOfTransaction received: " + transactionResult.toJSON()); + event.put("transactionResult", transactionResult); + event.put("device", device); + PluginResult result = new PluginResult(PluginResult.Status.OK, event.toJSONObject()); + result.setKeepCallback(true); + if (this.callbackContext != null) { + this.callbackContext.sendPluginResult(result); + } + } else { + Logger.getLogger("App-Detailed-Logger").warning("***[APP] -> endOfTransaction received: null"); } } @@ -887,6 +893,7 @@ public void getPaxModel(CallbackContext callbackContext, JSONObject params) thro } } + @Override protected void finalize() { this.api.unregisterEventsDelegate(this); } @@ -896,4 +903,4 @@ private void setEventsHandler() { this.api.registerEventsDelegate(this); } -} \ No newline at end of file +}