cordova-plugin-netcontroll-integration 1.0.94 → 1.0.99

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.94
1
+ Versao 1.0.99
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.94",
3
+ "version": "1.0.99",
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.94"
2
+ <plugin id="cordova-plugin-netcontroll-integration" version="1.0.99"
3
3
  xmlns="http://apache.org/cordova/ns/plugins/1.0"
4
4
  xmlns:android="http://schemas.android.com/apk/res/android">
5
5
 
@@ -14,7 +14,6 @@
14
14
  </js-module>
15
15
 
16
16
 
17
-
18
17
  <js-module name="ElginM10Terminal" src="www/Elgin/M10Terminal.js">
19
18
  <clobbers target="cordova.plugins.NetControllCordovaPluginsIntegration.ElginM10Terminal" />
20
19
  </js-module>
@@ -22,12 +21,6 @@
22
21
  <clobbers target="cordova.plugins.NetControllCordovaPluginsIntegration.ElginSmartPay" />
23
22
  </js-module>
24
23
 
25
-
26
-
27
- <js-module name="StoneSumni" src="www/Stone/Sumni.js">
28
- <clobbers target="cordova.plugins.NetControllCordovaPluginsIntegration.StoneSumni" />
29
- </js-module>
30
-
31
24
  <js-module name="RedeGPos700" src="www/Rede/RedeGpos700.js">
32
25
  <clobbers target="cordova.plugins.NetControllCordovaPluginsIntegration.RedeGPos700" />
33
26
  </js-module>
@@ -36,22 +29,6 @@
36
29
  <clobbers target="cordova.plugins.NetControllCordovaPluginsIntegration.SafraPayIngenico" />
37
30
  </js-module>
38
31
 
39
- <js-module name="PagSeguroPax" src="www/PagSeguro/PagSeguroPax.js">
40
- <clobbers target="cordova.plugins.NetControllCordovaPluginsIntegration.PagSeguroPax" />
41
- </js-module>
42
-
43
-
44
-
45
- <js-module src="www/alice.js" name="alice">
46
- <clobbers target="cordova.plugins.NetControllCordovaPluginsIntegration.alice" />
47
- <!-- <runs/> -->
48
- </js-module>
49
- <js-module src="www/bob.js" name="bob">
50
- <clobbers target="cordova.plugins.NetControllCordovaPluginsIntegration.bob" />
51
- <!-- <runs/> -->
52
- </js-module>
53
-
54
-
55
32
  <dependency id="cordova-plugin-androidx-adapter" version="1.1.3" />
56
33
  <platform name="android">
57
34
  <config-file parent="/*" target="res/xml/config.xml">
@@ -64,6 +41,9 @@
64
41
  </config-file>
65
42
 
66
43
  <config-file parent="/*" target="AndroidManifest.xml">
44
+ <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
45
+ <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
46
+ <uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" />
67
47
  </config-file>
68
48
 
69
49
  <!-- executable source code > -->
@@ -89,9 +69,6 @@
89
69
  <resource-file src="src/libs/InterfaceAutomacao-v2.0.0.9.aar" target="libs/InterfaceAutomacao-v2.0.0.9.aar" />
90
70
 
91
71
 
92
- <!--______________________________Stone______________________________-->
93
- <source-file src="src/android/Stone/StoneSumni.java" target-dir="src/cordova-plugin-netcontroll-integration/Stone" />
94
-
95
72
  <!--_____________________________UseRede_____________________________-->
96
73
  <source-file src="src/android/Rede/RedeGPos700.java" target-dir="src/cordova-plugin-netcontroll-integration/UseRede" />
97
74
 
@@ -110,10 +87,6 @@
110
87
 
111
88
  <resource-file src="src/libs/IntegracaoSafra-v2.0.aar" target="libs/IntegracaoSafra-v2.0.aar" />
112
89
 
113
- <!--______________________________PagSeguro___________________________-->
114
- <source-file src="src/android/PagSeguro/PagSeguroPax.java" target-dir="src/cordova-plugin-netcontroll-integration/PagSeguro" />
115
-
116
-
117
90
  <!--______________________________Other______________________________-->
118
91
 
119
92
  <!-- BarcodeScanner -->
@@ -845,28 +845,6 @@ public class CieloLioLocal {
845
845
  0,
846
846
  callbackContext);
847
847
  callbackContext.success("ImpressoOk");
848
- // // PosPrintProvider customPosPrintProvider = new PosPrintProvider(mContext);
849
- // // // PosPrintProvider posPrintReceiptProvider = new PosPrintProvider(mContext, transactionObject, receiptType);
850
- // // customPosPrintProvider.addBitmap(bitmap);
851
- // ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
852
- // bitmap.compress(Bitmap.CompressFormat.PNG, 100, byteArrayOutputStream);
853
- // byte[] byteArray = byteArrayOutputStream.toByteArray();
854
- // String encoded = Base64.encodeToString(byteArray, Base64.DEFAULT);
855
-
856
-
857
-
858
- // customPosPrintProvider.setConnectionCallback(new StoneCallbackInterface() {
859
- // @Override
860
- // public void onSuccess() {
861
- // callbackContext.success("ImpressoOk");
862
- // }
863
-
864
- // @Override
865
- // public void onError() {
866
- // callbackContext.error("Erro ao imprimir: " + customPosPrintProvider.getListOfErrors());
867
- // }
868
- // });
869
- // customPosPrintProvider.execute();
870
848
  } catch (Exception errorPost) {
871
849
  callbackContext.error("Result - ConverterHtmlToBitmap: " + "Error Detail: " + errorPost);
872
850
  }
@@ -19,18 +19,12 @@ public class NetControllCordovaPluginsIntegration extends CordovaPlugin {
19
19
  //Cielo
20
20
  public CieloLioLocal cieloLioLocal;
21
21
 
22
- //Stone
23
- public StoneSumni stoneSumni;
24
-
25
22
  //Rede
26
23
  public RedeGPos700 redeGPos700;
27
24
 
28
25
  //SafraPay
29
26
  public SafraPayIngenico safraPayIngenico;
30
27
 
31
- //PagSeguro
32
- public PagSeguroPax pagSeguroPax;
33
-
34
28
  //Cordova/Java Params
35
29
  private Activity mActivity;
36
30
  private Context mContext;
@@ -68,13 +62,6 @@ public class NetControllCordovaPluginsIntegration extends CordovaPlugin {
68
62
  }
69
63
  }
70
64
 
71
- private void initializeStoneSumni() {
72
- if (this.stoneSumni == null) {
73
- this.stoneSumni = new StoneSumni();
74
- this.stoneSumni.initialize(this.cordova, this.webView);
75
- }
76
- }
77
-
78
65
  private void initializeRedeGpos700() {
79
66
  if (this.redeGPos700 == null) {
80
67
  this.redeGPos700 = new RedeGPos700();
@@ -89,13 +76,6 @@ public class NetControllCordovaPluginsIntegration extends CordovaPlugin {
89
76
  }
90
77
  }
91
78
 
92
- private void initializePagSeguroPax() {
93
- if (this.pagSeguroPax == null) {
94
- this.pagSeguroPax = new PagSeguroPax();
95
- this.pagSeguroPax.initialize(this.cordova, this.webView);
96
- }
97
- }
98
-
99
79
  @Override
100
80
  public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException {
101
81
  try {
@@ -103,19 +83,6 @@ public class NetControllCordovaPluginsIntegration extends CordovaPlugin {
103
83
  String[] actionProviderList = action.split("\\.");
104
84
  String provider = actionProviderList[0];
105
85
 
106
- // if (action.equals("GerarImagemImpresso")) {
107
- // JSONObject params = args.getJSONObject(0);
108
- // String htmlString = params.getString("dados");
109
-
110
-
111
- // //String html = "<html><body><p>Hello world!</p><br/>Html bitmap</body><html>";
112
-
113
-
114
- // //callbackContext.success("Result GerarImagemImpresso");
115
- // return true;
116
- // }
117
-
118
-
119
86
  switch (provider.toLowerCase()) {
120
87
  case "elgin":
121
88
  String elginProduct = actionProviderList[1];
@@ -144,17 +111,6 @@ public class NetControllCordovaPluginsIntegration extends CordovaPlugin {
144
111
  default:
145
112
  break;
146
113
  }
147
- case "stone":
148
- String stoneProduct = actionProviderList[1];
149
- switch (stoneProduct.toLowerCase()) {
150
- case "sumni":
151
- this.initializeStoneSumni();
152
- String stoneSuminAction = actionProviderList[2];
153
- boolean resultStoneSuminExecute = this.stoneSumni.execute(stoneSuminAction, args, callbackContext);
154
- return resultStoneSuminExecute;
155
- default:
156
- break;
157
- }
158
114
  case "rede":
159
115
  String redeProduct = actionProviderList[1];
160
116
  switch (redeProduct.toLowerCase()) {
@@ -177,17 +133,6 @@ public class NetControllCordovaPluginsIntegration extends CordovaPlugin {
177
133
  default:
178
134
  break;
179
135
  }
180
- case "pagseguro":
181
- String pagSeguroProduct = actionProviderList[1];
182
- switch (pagSeguroProduct.toLowerCase()) {
183
- case "pagseguropax":
184
- this.initializePagSeguroPax();
185
- String pagSeguroAction = actionProviderList[2];
186
- boolean resultPagSeguroExecute = this.pagSeguroPax.execute(pagSeguroAction, args, callbackContext);
187
- return resultPagSeguroExecute;
188
- default:
189
- break;
190
- }
191
136
  default:
192
137
  break;
193
138
  }
@@ -53,8 +53,6 @@ import br.com.setis.safra.integracaosafra.util.ReturnCodes;
53
53
 
54
54
 
55
55
  //Json Serialize
56
- import stone.application.enums.ReceiptType;
57
-
58
56
  import com.google.gson.Gson;
59
57
  import com.google.gson.GsonBuilder;
60
58
  import com.google.gson.annotations.SerializedName;
@@ -8,11 +8,6 @@ import android.content.Context;
8
8
  import android.os.Environment;
9
9
  import android.util.Base64;
10
10
 
11
- import br.com.uol.pagseguro.plugpagservice.wrapper.PlugPagPrintResult;
12
- import br.com.uol.pagseguro.plugpagservice.wrapper.PlugPagPrinterData;
13
- import br.com.uol.pagseguro.plugpagservice.wrapper.PlugPagPrinterListener;
14
- import stone.application.enums.ReceiptType;
15
-
16
11
  import com.google.gson.Gson;
17
12
  import com.google.gson.GsonBuilder;
18
13
  import com.google.gson.annotations.SerializedName;
@@ -5,23 +5,23 @@ android {
5
5
  exclude 'META-INF/client_release.kotlin_module'
6
6
  }
7
7
 
8
- // signingConfigs {
9
- // gertec {
10
- // storeFile file('..\\app\\src\\main\\libs\\development_gertecdeveloper_customer_app_29_19.jks')
11
- // storePassword 'Development@GertecDeveloper2018'
12
- // keyAlias 'developmentgertecdeveloper_customerapp'
13
- // keyPassword 'Development@GertecDeveloper2018'
14
- // }
15
- // }
16
-
17
8
  signingConfigs {
18
9
  gertec {
19
- storeFile file('..\\app\\src\\main\\libs\\Development_GertecDeveloper_EnhancedAPP.jks')
10
+ storeFile file('..\\app\\src\\main\\libs\\development_gertecdeveloper_customer_app_29_19.jks')
20
11
  storePassword 'Development@GertecDeveloper2018'
21
- keyAlias 'developmentgertecdeveloper_enhancedapp'
12
+ keyAlias 'developmentgertecdeveloper_customerapp'
22
13
  keyPassword 'Development@GertecDeveloper2018'
23
14
  }
24
- }
15
+ }
16
+
17
+ // signingConfigs {
18
+ // gertec {
19
+ // storeFile file('..\\app\\src\\main\\libs\\Development_GertecDeveloper_EnhancedAPP.jks')
20
+ // storePassword 'Development@GertecDeveloper2018'
21
+ // keyAlias 'developmentgertecdeveloper_enhancedapp'
22
+ // keyPassword 'Development@GertecDeveloper2018'
23
+ // }
24
+ // }
25
25
 
26
26
  buildTypes {
27
27
  release {
package/src/build.gradle CHANGED
@@ -5,10 +5,6 @@ repositories {
5
5
  dirs 'src/main/libs'
6
6
  }
7
7
  mavenCentral()
8
- maven { url "https://packagecloud.io/priv/a753b90c3483978bb2514e3618ee3f72eb37ec2c9aa0b31d/stone/pos-android/maven2" }
9
- maven { url "https://packagecloud.io/priv/a753b90c3483978bb2514e3618ee3f72eb37ec2c9aa0b31d/stone/pos-android-internal/maven2" }
10
- maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
11
- maven { url 'https://github.com/pagseguro/PlugPagServiceWrapper/raw/master' }
12
8
  }
13
9
  dependencies {
14
10
  implementation fileTree(dir: 'libs', include: ['*.jar'])
@@ -44,14 +40,6 @@ dependencies {
44
40
  // }
45
41
 
46
42
 
47
- //______________________________ Stone ______________________________
48
- implementation "br.com.stone:stone-sdk:4.0.6"
49
- implementation "br.com.stone:stone-sdk-posandroid:4.0.6"
50
- // // implementation "br.com.stone:stone-sdk-posandroid-ingenico:4.0.6"
51
- // // implementation "br.com.stone:stone-sdk-posandroid-gertec:4.0.6"
52
- implementation "br.com.stone:stone-sdk-posandroid-sunmi:4.0.6"
53
-
54
-
55
43
  //______________________________ UseRede ______________________________
56
44
  implementation(name: 'sdk_3.0_release', ext: 'aar')
57
45
  implementation(name: 'payment-1.14.10.181016', ext: 'aar')
@@ -61,10 +49,6 @@ dependencies {
61
49
 
62
50
  implementation(name:'IntegracaoSafra-v2.0', ext:'aar')
63
51
 
64
- //______________________________ PagSeguro ______________________________
65
- implementation 'br.com.uol.pagseguro.plugpagservice.wrapper:wrapper:1.7.6'
66
-
67
-
68
52
  //Biblioteca de suporte dos códigos de barras utilizada para impressão dos mesmos
69
53
  implementation 'com.google.zxing:core:3.3.2'
70
54
  //implementation 'com.google.zxing:javase:3.3.2'
@@ -8,44 +8,44 @@ exports.Testar = function (params, success, error) {
8
8
 
9
9
  exports.InicializaImpressao = function (params, success, error) {
10
10
  debugger;
11
- exec(success, error, 'NetControllCordovaPluginsIntegration', 'Elgin.Gpos700.InicializaImpressao', [params]);
11
+ exec(success, error, 'NetControllCordovaPluginsIntegration', 'Rede.Gpos700.InicializaImpressao', [params]);
12
12
  }
13
13
 
14
14
  exports.AvancaPapel = function (params, success, error) {
15
- exec(success, error, 'NetControllCordovaPluginsIntegration', 'Elgin.Gpos700.AvancaPapel', [params]);
15
+ exec(success, error, 'NetControllCordovaPluginsIntegration', 'Rede.Gpos700.AvancaPapel', [params]);
16
16
  }
17
17
 
18
18
  exports.ImpressaoTexto = function (params, success, error) {
19
- exec(success, error, 'NetControllCordovaPluginsIntegration', 'Elgin.Gpos700.ImpressaoTexto', [params]);
19
+ exec(success, error, 'NetControllCordovaPluginsIntegration', 'Rede.Gpos700.ImpressaoTexto', [params]);
20
20
  }
21
21
 
22
22
  exports.ImpressaoCodigoBarras = function (params, success, error) {
23
- exec(success, error, 'NetControllCordovaPluginsIntegration', 'Elgin.Gpos700.ImpressaoCodigoBarras', [params]);
23
+ exec(success, error, 'NetControllCordovaPluginsIntegration', 'Rede.Gpos700.ImpressaoCodigoBarras', [params]);
24
24
  }
25
25
 
26
26
  exports.ImpressaoQRCode = function (params, success, error) {
27
- exec(success, error, 'NetControllCordovaPluginsIntegration', 'Elgin.Gpos700.ImpressaoQRCode', [params]);
27
+ exec(success, error, 'NetControllCordovaPluginsIntegration', 'Rede.Gpos700.ImpressaoQRCode', [params]);
28
28
  }
29
29
 
30
30
  exports.StatusImpressora = function (params, success, error) {
31
- exec(success, error, 'NetControllCordovaPluginsIntegration', 'Elgin.Gpos700.StatusImpressora', [params]);
31
+ exec(success, error, 'NetControllCordovaPluginsIntegration', 'Rede.Gpos700.StatusImpressora', [params]);
32
32
  }
33
33
 
34
34
  exports.ImprimeImagemBase64 = function (params, success, error) {
35
- exec(success, error, 'NetControllCordovaPluginsIntegration', 'Elgin.Gpos700.ImprimeImagemBase64', [params]);
35
+ exec(success, error, 'NetControllCordovaPluginsIntegration', 'Rede.Gpos700.ImprimeImagemBase64', [params]);
36
36
  }
37
37
 
38
38
 
39
39
  exports.IniciarPagamento = function (params, success, error) {
40
- exec(success, error, 'NetControllCordovaPluginsIntegration', 'Elgin.Gpos700.IniciarPagamento', [params]);
40
+ exec(success, error, 'NetControllCordovaPluginsIntegration', 'Rede.Gpos700.IniciarPagamento', [params]);
41
41
  }
42
42
 
43
43
  exports.EstornarPagamento = function (params, success, error) {
44
- exec(success, error, 'NetControllCordovaPluginsIntegration', 'Elgin.Gpos700.EstornarPagamento', [params]);
44
+ exec(success, error, 'NetControllCordovaPluginsIntegration', 'Rede.Gpos700.EstornarPagamento', [params]);
45
45
  }
46
46
 
47
47
  exports.ReimprimirPagamento = function (params, success, error) {
48
- exec(success, error, 'NetControllCordovaPluginsIntegration', 'Elgin.Gpos700.ReimprimirPagamento', [params]);
48
+ exec(success, error, 'NetControllCordovaPluginsIntegration', 'Rede.Gpos700.ReimprimirPagamento', [params]);
49
49
  }
50
50
 
51
51
 
@@ -58,12 +58,12 @@ exports.ReimprimirPagamento = function (params, success, error) {
58
58
 
59
59
  exports.ImprimirTodasFuncoes = function (params, success, error) {
60
60
  debugger;
61
- exec(success, error, 'NetControllCordovaPluginsIntegration', 'Elgin.Gpos700.ImprimirTodasFuncoes', [params]);
61
+ exec(success, error, 'NetControllCordovaPluginsIntegration', 'Rede.Gpos700.ImprimirTodasFuncoes', [params]);
62
62
  }
63
63
 
64
64
 
65
65
  exports.ImpressaoTextoNetPrintImg = function (params, success, error) {
66
- exec(success, error, 'NetControllCordovaPluginsIntegration', 'Stone.Gpos700.ImpressaoTextoNetPrintImg', [params]);
66
+ exec(success, error, 'NetControllCordovaPluginsIntegration', 'Rede.Gpos700.ImpressaoTextoNetPrintImg', [params]);
67
67
  }
68
68
 
69
69
 
@@ -1,366 +0,0 @@
1
- package cordova.plugin.netcontroll.integration;
2
-
3
- import br.com.uol.pagseguro.plugpagservice.wrapper.PlugPagCustomPrinterLayout;
4
- import br.com.uol.pagseguro.plugpagservice.wrapper.PlugPagEventData;
5
- import br.com.uol.pagseguro.plugpagservice.wrapper.PlugPagVoidData;
6
- import br.com.uol.pagseguro.plugpagservice.wrapper.exception.PlugPagException;
7
- import br.com.uol.pagseguro.plugpagservice.wrapper.listeners.PlugPagPaymentListener;
8
- import io.reactivex.Observable;
9
- import io.reactivex.ObservableEmitter;
10
-
11
- import br.com.uol.pagseguro.plugpagservice.wrapper.PlugPagActivationData;
12
- import br.com.uol.pagseguro.plugpagservice.wrapper.PlugPagPaymentData;
13
- import br.com.uol.pagseguro.plugpagservice.wrapper.PlugPagTransactionResult;
14
- import cordova.plugin.netcontroll.integration.NetControllHelpers;
15
- import cordova.plugin.netcontroll.integration.NetControllPrinter;
16
-
17
- import org.apache.cordova.CordovaPlugin;
18
- import org.apache.cordova.PluginResult;
19
- import org.apache.cordova.CallbackContext;
20
- import org.apache.cordova.CordovaInterface;
21
- import org.apache.cordova.CordovaWebView;
22
-
23
-
24
- import org.jetbrains.annotations.NotNull;
25
- import org.json.JSONArray;
26
- import org.json.JSONException;
27
- import org.json.JSONObject;
28
-
29
- import android.annotation.SuppressLint;
30
- import android.app.Activity;
31
- import android.content.ContentResolver;
32
- import android.content.ContentValues;
33
- import android.content.pm.PackageInfo;
34
- import android.content.pm.PackageManager;
35
- import android.graphics.Bitmap;
36
- import android.content.Context;
37
- import android.os.Build;
38
- import android.os.Environment;
39
- import android.os.Handler;
40
- import android.os.Looper;
41
- import android.os.Message;
42
- import android.util.Log;
43
- import android.widget.Toast;
44
- import android.net.Uri;
45
- import android.content.Intent;
46
- import android.provider.MediaStore;
47
-
48
- import android.graphics.Bitmap;
49
- import android.graphics.BitmapFactory;
50
- import android.graphics.Matrix;
51
-
52
- import android.util.Base64;
53
-
54
-
55
- import br.com.uol.pagseguro.plugpagservice.wrapper.PlugPag;
56
- import br.com.uol.pagseguro.plugpagservice.wrapper.PlugPagAppIdentification;
57
- import br.com.uol.pagseguro.plugpagservice.wrapper.PlugPagActivationData;
58
- import br.com.uol.pagseguro.plugpagservice.wrapper.PlugPagInitializationResult;
59
- import br.com.uol.pagseguro.plugpagservice.wrapper.PlugPagPrintResult;
60
- import br.com.uol.pagseguro.plugpagservice.wrapper.PlugPagPrinterData;
61
- import br.com.uol.pagseguro.plugpagservice.wrapper.PlugPagPrinterListener;
62
-
63
- //Json Serialize
64
-
65
- import stone.application.enums.ReceiptType;
66
-
67
- import com.google.gson.Gson;
68
- import com.google.gson.GsonBuilder;
69
- import com.google.gson.annotations.SerializedName;
70
- import com.google.zxing.WriterException;
71
- import com.google.zxing.MultiFormatWriter;
72
- import com.google.zxing.common.BitMatrix;
73
- import com.google.zxing.BarcodeFormat;
74
-
75
- import java.io.File;
76
- import java.io.FileOutputStream;
77
- import java.io.IOException;
78
- import java.io.OutputStream;
79
- import java.text.SimpleDateFormat;
80
- import java.util.Date;
81
- import java.util.List;
82
- import java.util.HashMap;
83
- import java.util.Map;
84
-
85
- import com.google.zxing.EncodeHintType;
86
-
87
- import android.os.AsyncTask;
88
-
89
- import androidx.annotation.NonNull;
90
- import androidx.core.app.ActivityCompat;
91
- import androidx.core.content.ContextCompat;
92
-
93
- import java.lang.reflect.Type;
94
- import java.util.ArrayList;
95
-
96
- import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel;
97
-
98
- import java.util.EnumMap;
99
-
100
- import com.izettle.html2bitmap.Html2Bitmap;
101
- import com.izettle.html2bitmap.content.WebViewContent;
102
-
103
- import java.io.ByteArrayOutputStream;
104
-
105
- import android.content.pm.PackageInfo;
106
- import android.content.pm.PackageManager;
107
-
108
- public class PagSeguroPax {
109
- private PlugPag plugpag;
110
-
111
- private static final int PERMISSIONS_REQUEST_CODE = 0x1234;
112
- private Activity mActivity;
113
- private Context mContext;
114
- private CordovaInterface mCordova;
115
- private CordovaWebView webView;
116
-
117
- //@Override
118
- public void initialize(CordovaInterface cordova, CordovaWebView webView) {
119
- this.webView = webView;
120
- mActivity = cordova.getActivity();
121
- mContext = cordova.getActivity().getApplicationContext();
122
- mCordova = cordova;
123
- }
124
-
125
- public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException {
126
- if (action.equals("InitializeSdk")) {
127
- JSONObject params = args.getJSONObject(0);
128
- try {
129
- NetControllPrinter.RequestPermissions(this.mActivity, this.mContext);
130
-
131
- String appName = params.getString("appName");
132
- String appVersion = params.getString("appVersion");
133
- // String activationCode = params.getString("activationCode");
134
- String activationCode = "403938";
135
-
136
-
137
- PlugPagAppIdentification appIdentification = new PlugPagAppIdentification(appName, appVersion);
138
- plugpag = new PlugPag(mContext, appIdentification);
139
-
140
- this.mCordova.getThreadPool().execute(new Runnable() {
141
- public void run() {
142
- // plugpag = new PlugPag(mActivity, appIdentification);
143
- plugpag.initializeAndActivatePinpad(new PlugPagActivationData(activationCode));
144
- callbackContext.success("InitializeSdk OK"); // Thread-safe.
145
- }
146
- });
147
- return true;
148
- } catch (Exception error1) {
149
- callbackContext.error("Result - PagSeguro - Pax - InitializeSdk: " + "Error Detail: " + error1);
150
- }
151
- return false;
152
- } else if (action.equals("IniciarTransacao")) {
153
- try {
154
- JSONObject params = args.getJSONObject(0);
155
-
156
- int tipoTransacao = params.getInt("tipoTransacao");
157
- int valor = params.getInt("valor");
158
-
159
-
160
- int tipoParcelamento = params.getInt("tipoParcelamento");
161
- int numeroParcelas = params.getInt("numeroParcelas");
162
-
163
- String identificadorAutomacao = params.getString("identificadorAutomacao");
164
- String statusChangeCallBack = params.getString("statusChangeCallBack");
165
-
166
- PlugPagPaymentData paymentData =
167
- new PlugPagPaymentData(
168
- tipoTransacao,
169
- valor,
170
- tipoParcelamento,
171
- numeroParcelas,
172
- identificadorAutomacao,
173
- true);
174
-
175
- this.plugpag.doAsyncPayment(paymentData, new PlugPagPaymentListener() {
176
- @Override
177
- public void onSuccess(@NotNull PlugPagTransactionResult plugPagTransactionResult) {
178
- mActivity.runOnUiThread(new Runnable() {
179
- @Override
180
- public void run() {
181
- String transactionStatus = plugPagTransactionResult.getMessage();
182
- executeGlobalJavascript(statusChangeCallBack + "('" + transactionStatus + "')");
183
- }
184
- });
185
- callbackContext.success(NetControllHelpers.parseObjToJsonSrtring(plugPagTransactionResult));
186
- }
187
-
188
- @Override
189
- public void onError(@NotNull PlugPagTransactionResult plugPagTransactionResult) {
190
- //seu código aqui
191
- callbackContext.error(plugPagTransactionResult.getErrorCode() + " - " + plugPagTransactionResult.getMessage());
192
- }
193
-
194
- @Override
195
- public void onPaymentProgress(@NotNull PlugPagEventData plugPagEventData) {
196
- executeGlobalJavascript(statusChangeCallBack + "('" + plugPagEventData.getCustomMessage() + "')");
197
- }
198
-
199
- @Override
200
- public void onPrinterSuccess(@NotNull PlugPagPrintResult plugPagPrintResult) {
201
- String printerSuccess = "";
202
- }
203
-
204
- @Override
205
- public void onPrinterError(@NotNull PlugPagPrintResult plugPagPrintResult) {
206
- String printerError = "";
207
- }
208
- });
209
- return true;
210
- } catch (Exception ex) {
211
- String exStr = ex.toString();
212
- throw ex;
213
- }
214
-
215
- } else if (action.equals("AbortarTransacao")) {
216
- try {
217
-
218
- try {
219
- this.plugpag.abort();
220
- callbackContext.success("PagSeguro - Pax - AbortarTransacao - onSuccess");
221
- } catch (Exception e) {
222
- callbackContext.error("Result - PagSeguro - Pax - AbortarTransacao: " + "Error Detail: " + e.toString());
223
- }
224
- return true;
225
- } catch (Exception error1) {
226
- callbackContext.error("Result - PagSeguro - Pax - AbortarTransacao: " + "Error Detail: " + error1);
227
- }
228
- return false;
229
- } else if (action.equals("CancelarTransacao")) {
230
- try {
231
- JSONObject params = args.getJSONObject(0);
232
-
233
- String codigoTransacao = params.getString("codigoTransacao");
234
- String idTransacao = params.getString("idTransacao");
235
- boolean imprimirRecibo = params.getBoolean("imprimirRecibo");
236
- String statusChangeCallBack = params.getString("statusChangeCallBack");
237
-
238
- PlugPagVoidData plugPagVoidData = new PlugPagVoidData(codigoTransacao, idTransacao, imprimirRecibo);
239
-
240
- this.plugpag.doAsyncVoidPayment(plugPagVoidData, new PlugPagPaymentListener() {
241
- @Override
242
- public void onSuccess(@NotNull PlugPagTransactionResult plugPagTransactionResult) {
243
- String testeSucess = "onSuccess";
244
- }
245
-
246
- @Override
247
- public void onError(@NotNull PlugPagTransactionResult plugPagTransactionResult) {
248
- //seu código aqui
249
- callbackContext.error(plugPagTransactionResult.getErrorCode() + " - " + plugPagTransactionResult.getMessage());
250
- }
251
-
252
- @Override
253
- public void onPaymentProgress(@NotNull PlugPagEventData plugPagEventData) {
254
- executeGlobalJavascript(statusChangeCallBack + "('" + plugPagEventData.getCustomMessage() + "')");
255
- }
256
-
257
- @Override
258
- public void onPrinterSuccess(@NotNull PlugPagPrintResult plugPagPrintResult) {
259
- String printerSuccess = "";
260
- }
261
-
262
- @Override
263
- public void onPrinterError(@NotNull PlugPagPrintResult plugPagPrintResult) {
264
- String printerError = "";
265
- }
266
- });
267
- return true;
268
- } catch (Exception ex) {
269
- String exStr = ex.toString();
270
- throw ex;
271
- }
272
- } else if (action.equals("ImpressaoTextoNetPrintImg")) {
273
- JSONObject params = args.getJSONObject(0);
274
- try {
275
- if (plugpag == null) {
276
- callbackContext.error("ImpressaoTextoNetPrintImg error: Sdk não inicializado");
277
- return false;
278
- }
279
-
280
- String dados = params.getString("dados");
281
- String html = NetControllPrinter.ConverterTextoImpressoToHtml(dados);
282
- NetControllPrinter.ConverterHtmlToBitmap(html, mContext, bitmapResult -> {
283
- Bitmap dadosImg = bitmapResult;
284
- String directoryFileName = Environment.getExternalStorageDirectory().getAbsolutePath() + "/Download/NetControllPrint.bmp";
285
- try {
286
- String fileName = NetControllPrinter.SaveImage(dadosImg, directoryFileName);
287
- if (!fileName.isEmpty()) {
288
- this.ImprimirArquivo(fileName, callbackContext);
289
- }
290
- } catch (IOException e) {
291
- e.printStackTrace();
292
- }
293
- });
294
- } catch (Exception e) {
295
- callbackContext.error("ImpressaoTextoNetPrintImg error: " + e.toString());
296
- }
297
- return true;
298
- }
299
- return false;
300
- }
301
-
302
- private boolean ImprimirArquivo(String caminhoArquivo, CallbackContext callbackContext) {
303
- try {
304
- if (caminhoArquivo != "") {
305
- try {
306
- AsyncTask<Void, Void, Boolean> taskPrinter = new AsyncTask<Void, Void, Boolean>() {
307
- @Override
308
- protected Boolean doInBackground(Void... voids) {
309
- PlugPagPrinterData plugPagPrinterData = new PlugPagPrinterData(
310
- caminhoArquivo,
311
- 10,
312
- 10 * 12);
313
-
314
- PlugPagPrinterListener listener = new PlugPagPrinterListener() {
315
- @Override
316
- public void onSuccess(@NonNull PlugPagPrintResult plugPagPrintResult) {
317
- callbackContext.success("Arquivo impresso com sucesso");
318
- }
319
-
320
- @Override
321
- public void onError(@NotNull PlugPagPrintResult plugPagPrintResult) {
322
- callbackContext.error("Erro ao imprimir: " + plugPagPrintResult.getErrorCode() + " - " + plugPagPrintResult.getMessage());
323
- }
324
- };
325
-
326
- //Seta listener de impressão
327
- plugpag.setPrinterListener(listener);
328
-
329
- // Imprime arquivo
330
- PlugPagPrintResult result = plugpag.printFromFile(plugPagPrinterData);
331
-
332
- if (result.getResult() == PlugPag.RET_OK) {
333
- callbackContext.success("Arquivo impresso com sucesso");
334
- }
335
- return true;
336
- }
337
-
338
- @Override
339
- protected void onPostExecute(Boolean bitmap) {
340
-
341
- }
342
- };
343
- taskPrinter.execute();
344
- return true;
345
- } catch (Exception ex) {
346
- String exStr = ex.toString();
347
- throw ex;
348
- }
349
- }
350
- } catch (Exception errorPost) {
351
- callbackContext.error("Result - ImprimirArquivo: " + "Error Detail: " + errorPost);
352
- return false;
353
- }
354
- return false;
355
- }
356
-
357
- private void executeGlobalJavascript(final String jsString) {
358
- mActivity.runOnUiThread(new Runnable() {
359
- @Override
360
- public void run() {
361
- webView.loadUrl("javascript:" + jsString);
362
- }
363
- });
364
- }
365
- }
366
-
@@ -1,21 +0,0 @@
1
- var exec = require('cordova/exec');
2
-
3
- exports.InitializeSdk = function (params, success, error) {
4
- exec(success, error, 'NetControllCordovaPluginsIntegration', 'PagSeguro.PagSeguroPax.InitializeSdk', [params]);
5
- }
6
-
7
- exports.IniciarTransacao = function (params, success, error) {
8
- exec(success, error, 'NetControllCordovaPluginsIntegration', 'PagSeguro.PagSeguroPax.IniciarTransacao', [params]);
9
- }
10
-
11
- exports.AbortarTransacao = function (params, success, error) {
12
- exec(success, error, 'NetControllCordovaPluginsIntegration', 'Stone.PagSeguroPax.AbortarTransacao', [params]);
13
- }
14
-
15
- exports.CancelarTransacao = function (params, success, error) {
16
- exec(success, error, 'NetControllCordovaPluginsIntegration', 'PagSeguro.PagSeguroPax.CancelarTransacao', [params]);
17
- }
18
-
19
- exports.ImpressaoTextoNetPrintImg = function (params, success, error) {
20
- exec(success, error, 'NetControllCordovaPluginsIntegration', 'PagSeguro.PagSeguroPax.ImpressaoTextoNetPrintImg', [params]);
21
- }
package/www/alice.js DELETED
@@ -1,4 +0,0 @@
1
- function alice() {
2
- console.log("Hello World From Alice!");
3
- }
4
- module.exports = alice;
package/www/bob.js DELETED
@@ -1,10 +0,0 @@
1
- var alice = require('cordova-plugin-netcontroll-integration.alice');
2
-
3
- function bob(){
4
- console.log("Hello World From Bob! Are you there Alice?");
5
- alice();
6
- }
7
-
8
- // bob();
9
-
10
- module.exports = bob;