cordova-plugin-netcontroll-integration 1.0.65 → 1.0.68

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,4 +1,4 @@
1
- Versao 1.0.64
1
+ Versao 1.0.68
2
2
 
3
3
  Funções internas de integração XMenu / NetControll
4
4
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cordova-plugin-netcontroll-integration",
3
- "version": "1.0.65",
3
+ "version": "1.0.68",
4
4
  "description": "Plugin cordova de integracao para uso interno (NetControll/ XMenu)",
5
5
  "cordova": {
6
6
  "id": "cordova-plugin-netcontroll-integration",
package/plugin.xml CHANGED
@@ -1,5 +1,5 @@
1
1
  <?xml version='1.0' encoding='utf-8'?>
2
- <plugin id="cordova-plugin-netcontroll-integration" version="1.0.65"
2
+ <plugin id="cordova-plugin-netcontroll-integration" version="1.0.68"
3
3
  xmlns="http://apache.org/cordova/ns/plugins/1.0"
4
4
  xmlns:android="http://schemas.android.com/apk/res/android">
5
5
 
@@ -60,8 +60,8 @@
60
60
  <source-file src="src/android/Elgin/ElginM10Terminal.java" target-dir="src/cordova-plugin-m8/cordova-plugin-m8" />
61
61
  <source-file src="src/android/Elgin/ElginSmartPay.java" target-dir="src/cordova-plugin-m8/cordova-plugin-m8" />
62
62
  <source-file src="src/android/Cielo/CieloLioLocal.java" target-dir="src/cordova-plugin-m8/cordova-plugin-m8" />
63
- <source-file src="src/android/Stone/StoneSumni.java" target-dir="src/cordova-plugin-m8/cordova-plugin-m8" />
64
- <source-file src="src/android/Rede/RedeGPos700.java" target-dir="src/cordova-plugin-m8/cordova-plugin-m8" />
63
+ <source-file src="src/android/Stone/StoneSumni.java" target-dir="src/cordova-plugin-m8/cordova-plugin-m8" />
64
+ <source-file src="src/android/Rede/RedeGPos700.java" target-dir="src/cordova-plugin-m8/cordova-plugin-m8" />
65
65
  <!-- <source-file src="src/android/NetControllCordovaPluginsIntegration.java" target-dir="src/cordova/plugin/netcontroll/integration/NetControllCordovaPluginsIntegration" />
66
66
  <source-file src="src/android/Elgin/ElginM10Terminal.java" target-dir="src/cordova-plugin-m8/cordova-plugin-m8" /> -->
67
67
 
@@ -75,6 +75,9 @@
75
75
  <resource-file src="src/libs/cloudpossdk-s-1.0.2.aar" target="libs/cloudpossdk-s-1.0.2.aar" />
76
76
  <resource-file src="src/libs/InterfaceAutomacao-v2.0.0.9.aar" target="libs/InterfaceAutomacao-v2.0.0.9.aar" />
77
77
 
78
+ <!-- BarcodeScanner -->
79
+ <!-- <resource-file src="src/libs/barcodescanner-release-2.1.5.aar" target="libs/barcodescanner-release-2.1.5.aar" /> -->
80
+
78
81
  <!-- UseRede -->
79
82
  <resource-file src="src/libs/sdk_3.0_release.aar" target="libs/sdk_3.0_release.aar" />
80
83
  <resource-file src="src/libs/payment-1.14.10.181016.aar" target="libs/payment-1.14.10.181016.aar" />
@@ -56,6 +56,8 @@ import android.graphics.Matrix;
56
56
 
57
57
  import android.util.Base64;
58
58
  import java.io.ByteArrayOutputStream;
59
+ import java.util.Objects;
60
+ import java.util.stream.Collectors;
59
61
 
60
62
  //Stone
61
63
 
@@ -64,6 +66,7 @@ import stone.providers.ActiveApplicationProvider;
64
66
  import stone.providers.BaseTransactionProvider;
65
67
  import stone.providers.TransactionProvider;
66
68
  import stone.providers.CancellationProvider;
69
+ import stone.providers.ReversalProvider;
67
70
 
68
71
  import stone.application.StoneStart;
69
72
 
@@ -88,7 +91,6 @@ import com.google.zxing.BarcodeFormat;
88
91
  import com.google.zxing.WriterException;
89
92
  import com.google.zxing.qrcode.QRCodeWriter;
90
93
  import com.google.zxing.common.BitMatrix;
91
- //import com.google.zxing.client.j2se.MatrixToImageWriter;
92
94
 
93
95
 
94
96
  import stone.user.UserModel;
@@ -97,7 +99,7 @@ import stone.utils.Stone;
97
99
 
98
100
  public class StoneSumni {
99
101
  private BaseTransactionProvider transactionProvider;
100
-
102
+
101
103
  //Cordova/Java Params
102
104
  private Activity mActivity;
103
105
  private Context mContext;
@@ -201,7 +203,7 @@ public class StoneSumni {
201
203
  transactionObject.setCapture(capturar);
202
204
  transactionObject.setAmount(valor);
203
205
 
204
- final PosTransactionProvider transactionProvider = new PosTransactionProvider(this.mContext, transactionObject, GetSelectedUserModel(0));
206
+ transactionProvider = new PosTransactionProvider(this.mContext, transactionObject, GetSelectedUserModel(0));
205
207
  transactionProvider.useDefaultUI(true);
206
208
  transactionProvider.setDialogTitle("Aguarde"); // Título do Dialog
207
209
  transactionProvider.setDialogMessage("Enviando..."); // Mensagem do Dialog
@@ -215,19 +217,24 @@ public class StoneSumni {
215
217
  executeGlobalJavascript(statusChangeCallBack + "('" + transactionStatus + "')");
216
218
  }
217
219
  });
218
- if (transactionObject.getTransactionStatus() == TransactionStatusEnum.APPROVED) {
219
- callbackContext.success(parseObjToJsonSrtring(transactionObject));
220
- } else {
221
- String teste01 = "asdasd";
222
- callbackContext.error(parseObjToJsonSrtring(transactionObject));
223
- }
220
+ callbackContext.success(parseObjToJsonSrtring(transactionObject));
221
+ // if (transactionObject.getTransactionStatus() == TransactionStatusEnum.APPROVED) {
222
+ // callbackContext.success(parseObjToJsonSrtring(transactionObject));
223
+ // } else {
224
+ // String msg = "Erro na transação";
225
+ // if (transactionProvider.getMessageFromAuthorize() != null) {
226
+ // msg += ":" + transactionProvider.getMessageFromAuthorize();
227
+ // } else {
228
+ // msg += "!";
229
+ // }
230
+ // callbackContext.error(msg);
231
+ // }
224
232
  }
225
233
 
226
234
  @Override
227
235
  public void onError() {
228
- Object teste2 = transactionObject;
229
- callbackContext.error("Erro na transação");
230
236
  // Erro na transação
237
+ callbackContext.error(transactionProvider.getListOfErrors().toString());
231
238
  }
232
239
 
233
240
  @Override
@@ -241,7 +248,9 @@ public class StoneSumni {
241
248
  });
242
249
  }
243
250
  });
244
- transactionProvider.execute();
251
+ new Thread(() -> {
252
+ transactionProvider.execute();
253
+ }).start();
245
254
  return true;
246
255
  } catch (Exception error1) {
247
256
  callbackContext.error("Result - Stone - Sumni - IniciarTransacao: " + "Error Detail: " + error1);
@@ -249,6 +258,50 @@ public class StoneSumni {
249
258
  return false;
250
259
  }
251
260
 
261
+ else if (action.equals("AbortarTransacao")) {
262
+ try {
263
+ new Thread(() -> {
264
+ try {
265
+ transactionProvider.abortPayment();
266
+ callbackContext.success("Stone - Sumni - AbortarTransacao - onSuccess");
267
+ } catch (Exception e) {
268
+ callbackContext.error("Result - Stone - Sumni - AbortarTransacao: " + "Error Detail: " + e.toString());
269
+ }
270
+ }).start();
271
+ return true;
272
+ } catch (Exception error1) {
273
+ callbackContext.error("Result - Stone - Sumni - AbortarTransacao: " + "Error Detail: " + error1);
274
+ }
275
+ return false;
276
+ }
277
+
278
+ else if (action.equals("ReverterTransacaoComErro")) {
279
+ try {
280
+
281
+ ReversalProvider reversalProvider = new ReversalProvider(this.mContext);
282
+ reversalProvider.setDialogMessage("Cancelando transação com erro");
283
+ reversalProvider.isDefaultUI();
284
+ reversalProvider.setConnectionCallback(new StoneCallbackInterface() {
285
+ @Override
286
+ public void onSuccess() {
287
+ callbackContext.success("Result - Stone - Sumni - ReverterTransacaoComErro: OK");
288
+ }
289
+
290
+ @Override
291
+ public void onError() {
292
+ callbackContext.success("Result - Stone - Sumni - ReverterTransacaoComErro: Error");
293
+ }
294
+ });
295
+ new Thread(() -> {
296
+ reversalProvider.execute();
297
+ }).start();
298
+ return true;
299
+ } catch (Exception error1) {
300
+ callbackContext.error("Result - Stone - Sumni - ReverterTransacaoComErro: " + "Error Detail: " + error1);
301
+ }
302
+ return false;
303
+ }
304
+
252
305
  else if (action.equals("ImprimirComprovanteTransacao")) {
253
306
  JSONObject params = args.getJSONObject(0);
254
307
  try {
@@ -406,12 +459,25 @@ public class StoneSumni {
406
459
  cancellationProvider.setDialogMessage("Cancelando...");
407
460
  cancellationProvider.setConnectionCallback(new StoneCallbackInterface() { // chamada de retorno.
408
461
  public void onSuccess() {
409
- callbackContext.success(cancellationProvider.getMessageFromAuthorize());
462
+ switch (cancellationProvider.getResponseCodeEnum()) {
463
+ case Approved: case PartialApproved:
464
+ callbackContext.success(cancellationProvider.getMessageFromAuthorize());
465
+ break;
466
+ case Declined:
467
+ callbackContext.error(cancellationProvider.getMessageFromAuthorize());
468
+ break;
469
+ case TechnicalError:
470
+ callbackContext.error(cancellationProvider.getMessageFromAuthorize());
471
+ break;
472
+ case Default:
473
+ callbackContext.error(cancellationProvider.getMessageFromAuthorize());
474
+ break;
475
+ }
476
+
410
477
  }
411
478
 
412
479
  public void onError() {
413
- String teste2 = "";
414
- callbackContext.error(cancellationProvider.getMessageFromAuthorize());
480
+ callbackContext.error(cancellationProvider.getListOfErrors().toString());
415
481
  }
416
482
  });
417
483
  cancellationProvider.execute();
@@ -421,6 +487,57 @@ public class StoneSumni {
421
487
  }
422
488
  return false;
423
489
  }
490
+
491
+ else if (action.equals("CancelarTransacaoCompleto")) {
492
+ JSONObject params = args.getJSONObject(0);
493
+ try {
494
+ String transactionObjectStr = params.getString("transactionObject");
495
+ TransactionObject transactionObject = parseJsonStringToObj(transactionObjectStr,TransactionObject.class);
496
+
497
+ final CancellationProvider cancellationProvider = new CancellationProvider(this.mContext, transactionObject);
498
+ cancellationProvider.useDefaultUI(false); // para dar feedback ao usuario ou nao.
499
+ cancellationProvider.setDialogMessage("Cancelando...");
500
+ cancellationProvider.setConnectionCallback(new StoneCallbackInterface() { // chamada de retorno.
501
+ public void onSuccess() {
502
+
503
+ TransactionDAO transactionDAO = new TransactionDAO(mContext);
504
+ List<TransactionObject> transactionObjects = transactionDAO.getAllTransactionsOrderByIdDesc();
505
+
506
+
507
+
508
+ switch (cancellationProvider.getResponseCodeEnum()) {
509
+ case Approved: case PartialApproved:
510
+ for (TransactionObject item : transactionObjects) {
511
+ if (transactionObject.getTransactionReference().equals((item.getTransactionReference()))) {
512
+ callbackContext.success(parseObjToJsonSrtring(item));
513
+ return;
514
+ }
515
+ }
516
+ break;
517
+
518
+ case Declined:
519
+ callbackContext.error(cancellationProvider.getMessageFromAuthorize());
520
+ break;
521
+ case TechnicalError:
522
+ callbackContext.error(cancellationProvider.getMessageFromAuthorize());
523
+ break;
524
+ case Default:
525
+ callbackContext.error(cancellationProvider.getMessageFromAuthorize());
526
+ break;
527
+ }
528
+ }
529
+
530
+ public void onError() {
531
+ callbackContext.error(cancellationProvider.getListOfErrors().toString());
532
+ }
533
+ });
534
+ cancellationProvider.execute();
535
+ return true;
536
+ } catch (Exception error1) {
537
+ callbackContext.error("Result - Stone - Sumni - CancelarTransacao: " + "Error Detail: " + error1);
538
+ }
539
+ return false;
540
+ }
424
541
  return false;
425
542
  }
426
543
 
@@ -571,22 +688,9 @@ public class StoneSumni {
571
688
  AsyncTask<Void, Void, Bitmap> taskBitMap = new AsyncTask<Void, Void, Bitmap>() {
572
689
  @Override
573
690
  protected Bitmap doInBackground(Void... voids) {
574
- // Html2BitmapConfigurator html2BitmapConfigurator = new Html2BitmapConfigurator() {
575
- //
576
- // @Override
577
- // public void configureWebView(WebView webview) {
578
- // webview.setBackgroundColor(Color.MAGENTA);
579
- // webview.getSettings().setTextZoom(150);
580
- // }
581
- // };
582
- //Html2Bitmap build = new Html2Bitmap.Builder().setContext(mContext).setContent(WebViewContent.html(htmlString)).setBitmapWidth(380).setMeasureDelay(10).setScreenshotDelay(10).setStrictMode(true).setTimeout(5).setTextZoom(150).setConfigurator(html2BitmapConfigurator).build();
583
- Html2Bitmap build = new Html2Bitmap.Builder().setContext(mContext).setContent(WebViewContent.html(htmlString)).setBitmapWidth(380).setMeasureDelay(300).setScreenshotDelay(300).setStrictMode(true).setTimeout(15).setTextZoom(100).build();
691
+ Html2Bitmap build = new Html2Bitmap.Builder().setContext(mContext).setContent(WebViewContent.html(htmlString)).setBitmapWidth(380).setMeasureDelay(300).setScreenshotDelay(300).setStrictMode(true).setTimeout(15).setTextZoom(96).build();
584
692
  Bitmap bitmapResult = build.getBitmap();
585
693
  return bitmapResult;
586
-
587
-
588
- // Bitmap bitmapResult = new Html2Bitmap.Builder().setContext(mContext).setContent(WebViewContent.html(htmlString)).build().getBitmap();
589
- // return bitmapResult;
590
694
  }
591
695
 
592
696
  @Override
@@ -672,10 +776,10 @@ public class StoneSumni {
672
776
  "\n" +
673
777
  "\n" +
674
778
  " .printer-ticket {\n" +
779
+ " /*border: solid 1px black;*/\n" +
675
780
  " /* background-color: #ffffcc; */\n" +
676
781
  " background-color: white;\n" +
677
782
  " font-size: 16px;\n" +
678
-
679
783
  " /* padding: 10px; */\n" +
680
784
  " max-width: 380px;\n" +
681
785
  " /* border: solid 1px black; */\n" +
@@ -697,6 +801,8 @@ public class StoneSumni {
697
801
  " }\n" +
698
802
  "\n" +
699
803
  " .printer-ticket * {\n" +
804
+ " /*border-left: 1px solid black;*/\n" +
805
+ " /*border-right: 1px solid black;*/\n" +
700
806
  " font-family: monospace;\n" +
701
807
  " /* font-family: Consolas, Regular;*/\n" +
702
808
  " /* font-size: 100%; */\n" +
@@ -793,7 +899,7 @@ public class StoneSumni {
793
899
  " body {\n" +
794
900
  " margin: 0px;\n" +
795
901
  " width: 380px;\n" +
796
- " border: 1px solid black;\n" +
902
+ " /*border: 1px solid black;*/\n" +
797
903
  " }\n" +
798
904
  "\n" +
799
905
  "\n" +
@@ -821,7 +927,7 @@ public class StoneSumni {
821
927
  "\n" +
822
928
  " }\n" +
823
929
  "\n" +
824
- " .printer-ticket * {\n" +
930
+ " .printer-ticket * {\n" +
825
931
  " font-family: monospace;\n" +
826
932
  " /* font-size: 100%; */\n" +
827
933
  " color: black;\n" +
package/src/build.gradle CHANGED
@@ -22,6 +22,10 @@ dependencies {
22
22
  implementation(name: 'InterfaceAutomacao-v2.0.0.9', ext: 'aar')
23
23
  implementation(name: 'cloudpossdk-s-1.0.2', ext: 'aar')
24
24
  implementation(name: 'minipdvm8', ext: 'aar')
25
+ // implementation(name: 'barcodescanner-release-2.1.5', ext: 'aar') {
26
+ // exclude group: 'com.google.zxing', module: 'android-core'
27
+ // transitive = false
28
+ // }
25
29
 
26
30
 
27
31
  //UseRede
@@ -55,4 +59,7 @@ dependencies {
55
59
  implementation "br.com.stone:stone-sdk-posandroid-sunmi:4.0.6"
56
60
 
57
61
  implementation 'com.izettle:html2bitmap:1.9'
62
+
63
+
64
+ // implementation 'cordova-plugin-screen-orientation:3.0.2'
58
65
  }
@@ -18,6 +18,14 @@ exports.IniciarTransacao = function (params, success, error) {
18
18
  exec(success, error, 'NetControllCordovaPluginsIntegration', 'Stone.Sumni.IniciarTransacao', [params]);
19
19
  }
20
20
 
21
+ exports.AbortarTransacao = function (params, success, error) {
22
+ exec(success, error, 'NetControllCordovaPluginsIntegration', 'Stone.Sumni.AbortarTransacao', [params]);
23
+ }
24
+
25
+ exports.ReverterTransacaoComErro = function (success, error) {
26
+ exec(success, error, 'NetControllCordovaPluginsIntegration', 'Stone.Sumni.ReverterTransacaoComErro');
27
+ }
28
+
21
29
  exports.ImprimirComprovanteTransacao = function (params, success, error) {
22
30
  exec(success, error, 'NetControllCordovaPluginsIntegration', 'Stone.Sumni.ImprimirComprovanteTransacao', [params]);
23
31
  }
@@ -30,6 +38,10 @@ exports.CancelarTransacao = function (params, success, error) {
30
38
  exec(success, error, 'NetControllCordovaPluginsIntegration', 'Stone.Sumni.CancelarTransacao', [params]);
31
39
  }
32
40
 
41
+ exports.CancelarTransacaoCompleto = function (params, success, error) {
42
+ exec(success, error, 'NetControllCordovaPluginsIntegration', 'Stone.Sumni.CancelarTransacaoCompleto', [params]);
43
+ }
44
+
33
45
 
34
46
 
35
47