cordova-plugin-netcontroll-integration 1.0.64 → 1.0.67

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.67
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.64",
3
+ "version": "1.0.67",
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.64"
2
+ <plugin id="cordova-plugin-netcontroll-integration" version="1.0.67"
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;
@@ -188,7 +190,6 @@ public class StoneSumni {
188
190
  String tipoTransacao = params.getString("tipoTransacao");
189
191
  boolean capturar = params.getBoolean("capturar");
190
192
  String valor = params.getString("valor");
191
- valor = "159";
192
193
  String statusChangeCallBack = params.getString("statusChangeCallBack");
193
194
 
194
195
  final TransactionObject transactionObject = new TransactionObject();
@@ -202,7 +203,7 @@ public class StoneSumni {
202
203
  transactionObject.setCapture(capturar);
203
204
  transactionObject.setAmount(valor);
204
205
 
205
- final PosTransactionProvider transactionProvider = new PosTransactionProvider(this.mContext, transactionObject, GetSelectedUserModel(0));
206
+ transactionProvider = new PosTransactionProvider(this.mContext, transactionObject, GetSelectedUserModel(0));
206
207
  transactionProvider.useDefaultUI(true);
207
208
  transactionProvider.setDialogTitle("Aguarde"); // Título do Dialog
208
209
  transactionProvider.setDialogMessage("Enviando..."); // Mensagem do Dialog
@@ -219,16 +220,20 @@ public class StoneSumni {
219
220
  if (transactionObject.getTransactionStatus() == TransactionStatusEnum.APPROVED) {
220
221
  callbackContext.success(parseObjToJsonSrtring(transactionObject));
221
222
  } else {
222
- String teste01 = "asdasd";
223
- callbackContext.error(parseObjToJsonSrtring(transactionObject));
223
+ String msg = "Erro na transação";
224
+ if (transactionProvider.getMessageFromAuthorize() != null) {
225
+ msg += ":" + transactionProvider.getMessageFromAuthorize();
226
+ } else {
227
+ msg += "!";
228
+ }
229
+ callbackContext.error(msg);
224
230
  }
225
231
  }
226
232
 
227
233
  @Override
228
234
  public void onError() {
229
- Object teste2 = transactionObject;
230
- callbackContext.error("Erro na transação");
231
235
  // Erro na transação
236
+ callbackContext.error(transactionProvider.getListOfErrors().toString());
232
237
  }
233
238
 
234
239
  @Override
@@ -242,7 +247,9 @@ public class StoneSumni {
242
247
  });
243
248
  }
244
249
  });
245
- transactionProvider.execute();
250
+ new Thread(() -> {
251
+ transactionProvider.execute();
252
+ }).start();
246
253
  return true;
247
254
  } catch (Exception error1) {
248
255
  callbackContext.error("Result - Stone - Sumni - IniciarTransacao: " + "Error Detail: " + error1);
@@ -250,6 +257,50 @@ public class StoneSumni {
250
257
  return false;
251
258
  }
252
259
 
260
+ else if (action.equals("AbortarTransacao")) {
261
+ try {
262
+ new Thread(() -> {
263
+ try {
264
+ transactionProvider.abortPayment();
265
+ callbackContext.success("Stone - Sumni - AbortarTransacao - onSuccess");
266
+ } catch (Exception e) {
267
+ callbackContext.error("Result - Stone - Sumni - AbortarTransacao: " + "Error Detail: " + e.toString());
268
+ }
269
+ }).start();
270
+ return true;
271
+ } catch (Exception error1) {
272
+ callbackContext.error("Result - Stone - Sumni - AbortarTransacao: " + "Error Detail: " + error1);
273
+ }
274
+ return false;
275
+ }
276
+
277
+ else if (action.equals("ReverterTransacaoComErro")) {
278
+ try {
279
+
280
+ ReversalProvider reversalProvider = new ReversalProvider(this.mContext);
281
+ reversalProvider.setDialogMessage("Cancelando transação com erro");
282
+ reversalProvider.isDefaultUI();
283
+ reversalProvider.setConnectionCallback(new StoneCallbackInterface() {
284
+ @Override
285
+ public void onSuccess() {
286
+ callbackContext.success("Result - Stone - Sumni - ReverterTransacaoComErro: OK");
287
+ }
288
+
289
+ @Override
290
+ public void onError() {
291
+ callbackContext.success("Result - Stone - Sumni - ReverterTransacaoComErro: Error");
292
+ }
293
+ });
294
+ new Thread(() -> {
295
+ reversalProvider.execute();
296
+ }).start();
297
+ return true;
298
+ } catch (Exception error1) {
299
+ callbackContext.error("Result - Stone - Sumni - ReverterTransacaoComErro: " + "Error Detail: " + error1);
300
+ }
301
+ return false;
302
+ }
303
+
253
304
  else if (action.equals("ImprimirComprovanteTransacao")) {
254
305
  JSONObject params = args.getJSONObject(0);
255
306
  try {
@@ -407,12 +458,25 @@ public class StoneSumni {
407
458
  cancellationProvider.setDialogMessage("Cancelando...");
408
459
  cancellationProvider.setConnectionCallback(new StoneCallbackInterface() { // chamada de retorno.
409
460
  public void onSuccess() {
410
- callbackContext.success(cancellationProvider.getMessageFromAuthorize());
461
+ switch (cancellationProvider.getResponseCodeEnum()) {
462
+ case Approved: case PartialApproved:
463
+ callbackContext.success(cancellationProvider.getMessageFromAuthorize());
464
+ break;
465
+ case Declined:
466
+ callbackContext.error(cancellationProvider.getMessageFromAuthorize());
467
+ break;
468
+ case TechnicalError:
469
+ callbackContext.error(cancellationProvider.getMessageFromAuthorize());
470
+ break;
471
+ case Default:
472
+ callbackContext.error(cancellationProvider.getMessageFromAuthorize());
473
+ break;
474
+ }
475
+
411
476
  }
412
477
 
413
478
  public void onError() {
414
- String teste2 = "";
415
- callbackContext.error(cancellationProvider.getMessageFromAuthorize());
479
+ callbackContext.error(cancellationProvider.getListOfErrors().toString());
416
480
  }
417
481
  });
418
482
  cancellationProvider.execute();
@@ -422,6 +486,57 @@ public class StoneSumni {
422
486
  }
423
487
  return false;
424
488
  }
489
+
490
+ else if (action.equals("CancelarTransacaoCompleto")) {
491
+ JSONObject params = args.getJSONObject(0);
492
+ try {
493
+ String transactionObjectStr = params.getString("transactionObject");
494
+ TransactionObject transactionObject = parseJsonStringToObj(transactionObjectStr,TransactionObject.class);
495
+
496
+ final CancellationProvider cancellationProvider = new CancellationProvider(this.mContext, transactionObject);
497
+ cancellationProvider.useDefaultUI(false); // para dar feedback ao usuario ou nao.
498
+ cancellationProvider.setDialogMessage("Cancelando...");
499
+ cancellationProvider.setConnectionCallback(new StoneCallbackInterface() { // chamada de retorno.
500
+ public void onSuccess() {
501
+
502
+ TransactionDAO transactionDAO = new TransactionDAO(mContext);
503
+ List<TransactionObject> transactionObjects = transactionDAO.getAllTransactionsOrderByIdDesc();
504
+
505
+
506
+
507
+ switch (cancellationProvider.getResponseCodeEnum()) {
508
+ case Approved: case PartialApproved:
509
+ for (TransactionObject item : transactionObjects) {
510
+ if (transactionObject.getTransactionReference().equals((item.getTransactionReference()))) {
511
+ callbackContext.success(parseObjToJsonSrtring(item));
512
+ return;
513
+ }
514
+ }
515
+ break;
516
+
517
+ case Declined:
518
+ callbackContext.error(cancellationProvider.getMessageFromAuthorize());
519
+ break;
520
+ case TechnicalError:
521
+ callbackContext.error(cancellationProvider.getMessageFromAuthorize());
522
+ break;
523
+ case Default:
524
+ callbackContext.error(cancellationProvider.getMessageFromAuthorize());
525
+ break;
526
+ }
527
+ }
528
+
529
+ public void onError() {
530
+ callbackContext.error(cancellationProvider.getListOfErrors().toString());
531
+ }
532
+ });
533
+ cancellationProvider.execute();
534
+ return true;
535
+ } catch (Exception error1) {
536
+ callbackContext.error("Result - Stone - Sumni - CancelarTransacao: " + "Error Detail: " + error1);
537
+ }
538
+ return false;
539
+ }
425
540
  return false;
426
541
  }
427
542
 
@@ -572,22 +687,9 @@ public class StoneSumni {
572
687
  AsyncTask<Void, Void, Bitmap> taskBitMap = new AsyncTask<Void, Void, Bitmap>() {
573
688
  @Override
574
689
  protected Bitmap doInBackground(Void... voids) {
575
- // Html2BitmapConfigurator html2BitmapConfigurator = new Html2BitmapConfigurator() {
576
- //
577
- // @Override
578
- // public void configureWebView(WebView webview) {
579
- // webview.setBackgroundColor(Color.MAGENTA);
580
- // webview.getSettings().setTextZoom(150);
581
- // }
582
- // };
583
- //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();
584
- Html2Bitmap build = new Html2Bitmap.Builder().setContext(mContext).setContent(WebViewContent.html(htmlString)).setBitmapWidth(380).setMeasureDelay(300).setScreenshotDelay(300).setStrictMode(true).setTimeout(15).setTextZoom(100).build();
690
+ Html2Bitmap build = new Html2Bitmap.Builder().setContext(mContext).setContent(WebViewContent.html(htmlString)).setBitmapWidth(380).setMeasureDelay(300).setScreenshotDelay(300).setStrictMode(true).setTimeout(15).setTextZoom(96).build();
585
691
  Bitmap bitmapResult = build.getBitmap();
586
692
  return bitmapResult;
587
-
588
-
589
- // Bitmap bitmapResult = new Html2Bitmap.Builder().setContext(mContext).setContent(WebViewContent.html(htmlString)).build().getBitmap();
590
- // return bitmapResult;
591
693
  }
592
694
 
593
695
  @Override
@@ -673,10 +775,10 @@ public class StoneSumni {
673
775
  "\n" +
674
776
  "\n" +
675
777
  " .printer-ticket {\n" +
778
+ " /*border: solid 1px black;*/\n" +
676
779
  " /* background-color: #ffffcc; */\n" +
677
780
  " background-color: white;\n" +
678
781
  " font-size: 16px;\n" +
679
-
680
782
  " /* padding: 10px; */\n" +
681
783
  " max-width: 380px;\n" +
682
784
  " /* border: solid 1px black; */\n" +
@@ -698,6 +800,8 @@ public class StoneSumni {
698
800
  " }\n" +
699
801
  "\n" +
700
802
  " .printer-ticket * {\n" +
803
+ " /*border-left: 1px solid black;*/\n" +
804
+ " /*border-right: 1px solid black;*/\n" +
701
805
  " font-family: monospace;\n" +
702
806
  " /* font-family: Consolas, Regular;*/\n" +
703
807
  " /* font-size: 100%; */\n" +
@@ -794,7 +898,7 @@ public class StoneSumni {
794
898
  " body {\n" +
795
899
  " margin: 0px;\n" +
796
900
  " width: 380px;\n" +
797
- " border: 1px solid black;\n" +
901
+ " /*border: 1px solid black;*/\n" +
798
902
  " }\n" +
799
903
  "\n" +
800
904
  "\n" +
@@ -822,7 +926,7 @@ public class StoneSumni {
822
926
  "\n" +
823
927
  " }\n" +
824
928
  "\n" +
825
- " .printer-ticket * {\n" +
929
+ " .printer-ticket * {\n" +
826
930
  " font-family: monospace;\n" +
827
931
  " /* font-size: 100%; */\n" +
828
932
  " 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