diff --git a/README.md b/README.md index da9687c..a82d757 100644 --- a/README.md +++ b/README.md @@ -128,14 +128,11 @@ There is a sample Android App inside the `sample` folder of this repository. You # react-native-ezetap-sdk - +[![npm version](https://badge.fury.io/js/react-native-ezetap-sdk.svg)](https://www.npmjs.com/package/react-native-ezetap-sdk) [![Downloads](https://img.shields.io/npm/dm/react-native-ezetap-sdk)](https://www.npmjs.com/package/react-native-ezetap-sdk) [![License](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE) ## Getting started -`$ npm install react-native-ezetap-sdk --save` - -### Mostly automatic installation +`$ npm i react-native-ezetap-sdk` -`$ react-native link react-native-ezetap-sdk` ### Manual installation @@ -144,7 +141,7 @@ There is a sample Android App inside the `sample` folder of this repository. You 1. Open `node_modules` Add `react-native-ezetap-sdk@x.x.x` folder 2. Open up `android/app/src/main/java/[...]/MainApplication.java` - - Add `import com.reactlibrary.RNEzetapSdkPackage;` to the imports at the top of the file + - Add `import com.ezetapsdk.RNEzetapSdkPackage;` to the imports at the top of the file - Add `new RNEzetapSdkPackage()` to the list returned by the `getPackages()` method 3. Append the following lines to `android/settings.gradle`: ``` @@ -155,9 +152,13 @@ There is a sample Android App inside the `sample` folder of this repository. You ``` implementation project(':react-native-ezetap-sdk') ``` -5. Open up `android/app/src/main/AndroidManifest.xml` - - Add `tools:replace="android:allowBackup"` in `application` tag - ``` + +# After manual or automatic installation + + +Open up `android/app/src/main/AndroidManifest.xml` +- Add `tools:replace="android:allowBackup"` in `application` tag +```javascript +``` ## What you need 1. React Native development environment @@ -179,17 +181,208 @@ There is a sample Android App inside the `sample` folder of this repository. You import RNEzetapSdk from 'react-native-ezetap-sdk'; ``` - • Then use the methods exposed by React Native SDK - • For example: - - var response = await RNEzetapSdk.initialize(json); +### Methods + +```javascript + var json = { + "prodAppKey": "Your prod app key", + "demoAppKey": "Your demo app key", + "merchantName": "merchantName", + "userName": "userName", + "currencyCode": 'INR', + "appMode": "Your environment", + "captureSignature": 'true', + "prepareDevice": 'false', + "captureReceipt": 'false' + }; + var response = await RNEzetapSdk.initialize(JSON.stringify(json)); + console.log(response); +``` + +```javascript + var response = await RNEzetapSdk.prepareDevice(); + console.log(response); +``` + +```javascript + var sendReceiptJson = { + "customerName": "customerName", + "mobileNo": "mobileNo", + "email": "emailId", + "txnId": "transactionID" + }; + + var response = await RNEzetapSdk.sendReceipt(JSON.stringify(sendReceiptJson)); + console.log(response); +``` + + +```javascript + var json = { + "issueType": "issueType", + "issueInfo": "issueInfo", + "tags": [ + "tag1","tag2" + ] + }; + var response = await RNEzetapSdk.serviceRequest(JSON.stringify(json)); + console.log(response); +``` + + +```javascript + var json = { + "agentName": "username", + "saveLocally": false + }; + + var response = await RNEzetapSdk.searchTransaction(JSON.stringify(json)); + console.log(response); +``` + + + +```javascript + var json = { + "amount": "100", + "options": { + "amountTip": 0.0, + "references": { + "reference1": "sffr", + "additionalReferences": [ + + ] + }, + "customer": { + + }, + "serviceFee": -1.0, + "addlData": { + "addl1": "addl1", + "addl2": "addl2", + "addl3": "addl3" + }, + "appData": { + "app1": "app1", + "app2": "app2", + "app3": "app3" + } + } + }; + + var response = await RNEzetapSdk.getTransaction(JSON.stringify(json)); + console.log(response); +``` + + +```javascript + var json = {}; + var response = await RNEzetapSdk.checkForIncompleteTransaction(JSON.stringify(json)); + console.log(response); +``` + + +```javascript + //Pass the transactionId to this function + var transactionID = ""; + var response = await RNEzetapSdk.voidTransaction(transactionID); + console.log(response); +``` + + + +```javascript + var json = {"txnId": "transactionID"}; + var response = await RNEzetapSdk.attachSignature(JSON.stringify(json)); + console.log(response); +``` + + +```javascript + var json = { + "amount": "123", + "options": { + "serviceFee": 100, + "paymentBy": "CREDIT OR DEBIT OR ANY (**To be used only if the service fee is being added.)", + "paymentMode": "Card/Cash/Cheque/UPI/UPI_VOUCHER/RemotePay/BHARATQR/Brand_Offers/Brand_EMI/Normal_EMI/Wallet ", + "providerName": " eg. ZestMoney. (**providerName and emiType are to be passed only if user wants to use ZestMoney. In this scenario, set \"paymentMode”:”EMI”)", + "emiType": "NORMAL, BRAND, EMI", + "references": { + "reference1": "1234", + "additionalReferences": [ + "addRef_xx1", + "addRef_xx2" + ] + }, + "appData": { + "walletAcquirer": "freecharge/ola_money/ etc.(**walletAcquirer are to be passed only if user sets \"paymentMode”:”Wallet”)" + }, + "customer": { + "name": "xyz", + "mobileNo": "1234567890", + "email": "abc@xyz.com" + } + } + }; + + var response = await RNEzetapSdk.pay(JSON.stringify(json)); + console.log(response); +``` + + +```javascript + //Pass the transactionId to this function + var transactionID = ""; + var response = await RNEzetapSdk.printReceipt(transactionID); + console.log(response); +``` + + +```javascript + //Pass the image as base64 string to this function + var base64ImageString = ""; + var response = await RNEzetapSdk.printBitmap(base64ImageString); + console.log(response); +``` + +```javascript + var response = await RNEzetapSdk.logout(); + console.log(response); +``` + +```javascript + var json = {"txnIds":[""]}; + var response = await RNEzetapSdk.stopPayment(JSON.stringify(json)); + console.log(response); +``` + + +```javascript + var response = await RNEzetapSdk.scanBarcode(); + console.log(response); +``` + +```javascript + var json = { + "amount": "100", + "txnId": "transactionID" + }; + var response = await RNEzetapSdk.refundTransaction(JSON.stringify(json)); + console.log(response); +``` + +```javascript + var response = await RNEzetapSdk.checkForUpdates(); + console.log(response); +``` # Flutter Ezetap SDK -[![pub package](https://img.shields.io/pub/v/ezetap_sdk.svg)](https://pub.dev/packages/ezetap_sdk) -[![pub points](https://img.shields.io/pub/points/ezetap_sdk?color=2E8B57&label=pub%20points)](https://pub.dev/packages/ezetap_sdk/score) +# ezetap_sdk + +[![pub package](https://img.shields.io/pub/v/ezetap_sdk.svg)](https://pub.dev/packages/ezetap_sdk) [![pub points](https://img.shields.io/pub/points/ezetap_sdk?color=2E8B57&label=pub%20points)](https://pub.dev/packages/ezetap_sdk/score) [![License](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE) Welcome to Ezetap Payments Flutter SDK integration! You can easily collect payments from your existing android applications by integrating the SDK. @@ -212,7 +405,7 @@ implicit ```flutter pub get```) ``` dependencies: - ezetap_sdk: ^0.1.1 + ezetap_sdk: ^0.1.3 ``` ## Import it @@ -223,23 +416,25 @@ Now in your Dart code, you can use: ## Methods Available -``` +```javascript var json = { "prodAppKey": "Your prod app key", "demoAppKey": "Your demo app key", "merchantName": "merchantName", "userName": "userName", "currencyCode": 'INR', - "appMode": "SANDBOX", + "appMode": "Your environment", "captureSignature": 'true', "prepareDevice": 'false', "captureReceipt": 'false' }; EzetapSdk.initialize(json); - +``` +```javascript EzetapSdk.prepareDevice(); - +``` +```javascript var sendReceiptJson = { "customerName": "customerName", "mobileNo": "mobileNo", @@ -248,7 +443,8 @@ Now in your Dart code, you can use: }; EzetapSdk.sendReceipt(sendReceiptJson); - +``` +```javascript var json = { "issueType": "issueType", "issueInfo": "issueInfo", @@ -258,14 +454,16 @@ Now in your Dart code, you can use: }; EzetapSdk.serviceRequest(json); - +``` +```javascript var json = { "agentName": "username", "saveLocally": false }; EzetapSdk.searchTransaction(json); - +``` +```javascript var json = { "amount": "100", "options": { @@ -294,16 +492,20 @@ Now in your Dart code, you can use: }; EzetapSdk.getTransaction(json); - +``` +```javascript var json = {}; - EzetapSdk.checkForIncompleteTransaction(json); - + ``` + ```javascript + //Pass the transactionId to this function EzetapSdk.voidTransaction(String transactionID); - +``` +```javascript var json = {"txnId": "transactionID"}; EzetapSdk.attachSignature(json); - +``` +```javascript var json = { "amount": "123", "options": { @@ -329,32 +531,37 @@ var json = { } } }; - EzetapSdk.pay(json); - +``` +```javascript + //Pass the transactionId to this function EzetapSdk.printReceipt(String transactionID); - +``` +```javascript + //Pass the image as base64 string to this function EzetapSdk.printBitmap(String? base64Image); - +``` +```javascript EzetapSdk.logout(); - +``` +```javascript var json = {"txnIds":[""]}; - EzetapSdk.stopPayment(json); - +``` +```javascript EzetapSdk.scanBarcode(); - -var json = { - "amount": "100", - "txnId": "transactionID" -}; +``` +```javascript + var json = { + "amount": "100", + "txnId": "transactionID" + }; EzetapSdk.refundTransaction(json); - +``` +```javascript EzetapSdk.checkForUpdates(); - ``` - ```dart Future onPaymentClicked(json) async { String? result = await EzetapSdk.pay(json); @@ -364,7 +571,6 @@ Future onPaymentClicked(json) async { }); } ``` - ```dart Future onBarcodePressed() async { String? result = await EzetapSdk.scanBarcode(); @@ -382,10 +588,3 @@ Future onBarcodePressed() async { 3. This documentation 4. Ezetap app key or login credentials to Ezetap service 5. Ezetap device to test card payments - - - - - - - diff --git a/release/cordova-sdk-release/2.26/EzetapCordovaLibv2.26.jar b/release/cordova-sdk-release/2.26/EzetapCordovaLibv2.26.jar new file mode 100644 index 0000000..ec32c7f Binary files /dev/null and b/release/cordova-sdk-release/2.26/EzetapCordovaLibv2.26.jar differ diff --git a/release/react-native-sdk-release/react-native-ezetap-sdk@1.2.0/README.md b/release/react-native-sdk-release/react-native-ezetap-sdk@1.2.0/README.md new file mode 100644 index 0000000..f4f79bc --- /dev/null +++ b/release/react-native-sdk-release/react-native-ezetap-sdk@1.2.0/README.md @@ -0,0 +1,247 @@ +## Getting started + +`$ npm i react-native-ezetap-sdk` + + +### Manual installation + +#### Android + +1. Open `node_modules` + Add `react-native-ezetap-sdk@x.x.x` folder +2. Open up `android/app/src/main/java/[...]/MainApplication.java` + - Add `import com.ezetapsdk.RNEzetapSdkPackage;` to the imports at the top of the file + - Add `new RNEzetapSdkPackage()` to the list returned by the `getPackages()` method +3. Append the following lines to `android/settings.gradle`: + ``` + include ':react-native-ezetap-sdk' + project(':react-native-ezetap-sdk').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-ezetap-sdk/android') + ``` +4. Insert the following lines inside the dependencies block in `android/app/build.gradle`: + ``` + implementation project(':react-native-ezetap-sdk') + ``` + +# After manual or automatic installation + + +Open up `android/app/src/main/AndroidManifest.xml` +- Add `tools:replace="android:allowBackup"` in `application` tag +```javascript + +``` + +## What you need +1. React Native development environment +2. Android phone that can connect to internet +3. This documentation +4. Ezetap app key or login credentials to Ezetap service +5. Ezetap device to test card payments + +## Usage +```javascript +import RNEzetapSdk from 'react-native-ezetap-sdk'; +``` + +### Methods + +```javascript + var json = { + "prodAppKey": "Your prod app key", + "demoAppKey": "Your demo app key", + "merchantName": "merchantName", + "userName": "userName", + "currencyCode": 'INR', + "appMode": "Your environment", + "captureSignature": 'true', + "prepareDevice": 'false', + "captureReceipt": 'false' + }; + var response = await RNEzetapSdk.initialize(JSON.stringify(json)); + console.log(response); +``` + +```javascript + var response = await RNEzetapSdk.prepareDevice(); + console.log(response); +``` + +```javascript + var sendReceiptJson = { + "customerName": "customerName", + "mobileNo": "mobileNo", + "email": "emailId", + "txnId": "transactionID" + }; + + var response = await RNEzetapSdk.sendReceipt(JSON.stringify(sendReceiptJson)); + console.log(response); +``` + + +```javascript + var json = { + "issueType": "issueType", + "issueInfo": "issueInfo", + "tags": [ + "tag1","tag2" + ] + }; + + var response = await RNEzetapSdk.serviceRequest(JSON.stringify(json)); + console.log(response); +``` + + +```javascript + var json = { + "agentName": "username", + "saveLocally": false + }; + + var response = await RNEzetapSdk.searchTransaction(JSON.stringify(json)); + console.log(response); +``` + + + +```javascript + var json = { + "amount": "100", + "options": { + "amountTip": 0.0, + "references": { + "reference1": "sffr", + "additionalReferences": [ + + ] + }, + "customer": { + + }, + "serviceFee": -1.0, + "addlData": { + "addl1": "addl1", + "addl2": "addl2", + "addl3": "addl3" + }, + "appData": { + "app1": "app1", + "app2": "app2", + "app3": "app3" + } + } + }; + + var response = await RNEzetapSdk.getTransaction(JSON.stringify(json)); + console.log(response); +``` + + +```javascript + var json = {}; + var response = await RNEzetapSdk.checkForIncompleteTransaction(JSON.stringify(json)); + console.log(response); +``` + + +```javascript + //Pass the transactionId to this function + var transactionID = ""; + var response = await RNEzetapSdk.voidTransaction(transactionID); + console.log(response); +``` + + + +```javascript + var json = {"txnId": "transactionID"}; + var response = await RNEzetapSdk.attachSignature(JSON.stringify(json)); + console.log(response); +``` + + +```javascript + var json = { + "amount": "123", + "options": { + "serviceFee": 100, + "paymentBy": "CREDIT OR DEBIT OR ANY (**To be used only if the service fee is being added.)", + "paymentMode": "Card/Cash/Cheque/UPI/UPI_VOUCHER/RemotePay/BHARATQR/Brand_Offers/Brand_EMI/Normal_EMI/Wallet ", + "providerName": " eg. ZestMoney. (**providerName and emiType are to be passed only if user wants to use ZestMoney. In this scenario, set \"paymentMode”:”EMI”)", + "emiType": "NORMAL, BRAND, EMI", + "references": { + "reference1": "1234", + "additionalReferences": [ + "addRef_xx1", + "addRef_xx2" + ] + }, + "appData": { + "walletAcquirer": "freecharge/ola_money/ etc.(**walletAcquirer are to be passed only if user sets \"paymentMode”:”Wallet”)" + }, + "customer": { + "name": "xyz", + "mobileNo": "1234567890", + "email": "abc@xyz.com" + } + } + }; + + var response = await RNEzetapSdk.pay(JSON.stringify(json)); + console.log(response); +``` + + +```javascript + //Pass the transactionId to this function + var transactionID = ""; + var response = await RNEzetapSdk.printReceipt(transactionID); + console.log(response); +``` + + +```javascript + //Pass the image as base64 string to this function + var base64ImageString = ""; + var response = await RNEzetapSdk.printBitmap(base64ImageString); + console.log(response); +``` + +```javascript + var response = await RNEzetapSdk.logout(); + console.log(response); +``` + +```javascript + var json = {"txnIds":[""]}; + var response = await RNEzetapSdk.stopPayment(JSON.stringify(json)); + console.log(response); +``` + + +```javascript + var response = await RNEzetapSdk.scanBarcode(); + console.log(response); +``` + +```javascript + var json = { + "amount": "100", + "txnId": "transactionID" + }; + var response = await RNEzetapSdk.refundTransaction(JSON.stringify(json)); + console.log(response); +``` + +```javascript + var response = await RNEzetapSdk.checkForUpdates(); + console.log(response); +``` diff --git a/release/react-native-sdk-release/react-native-ezetap-sdk@1.2.0/android/build.gradle b/release/react-native-sdk-release/react-native-ezetap-sdk@1.2.0/android/build.gradle new file mode 100644 index 0000000..18b7b65 --- /dev/null +++ b/release/react-native-sdk-release/react-native-ezetap-sdk@1.2.0/android/build.gradle @@ -0,0 +1,49 @@ + +buildscript { + repositories { + google() + mavenCentral() + } + + dependencies { + classpath 'com.android.tools.build:gradle:4.1.0' + } +} +rootProject.allprojects { + repositories { + google() + mavenCentral() + flatDir { + /*when adding new update to npm + * TODO Add dirs project(':react-native-ezetap-sdk').file('libs') + * adding new changes to functions exposed + * TODO Add dirs 'libs'*/ + dirs project(':react-native-ezetap-sdk').file('libs') + } + } +} +apply plugin: 'com.android.library' + +android { + compileSdkVersion 31 + defaultConfig { + minSdkVersion 21 + targetSdkVersion 31 + versionCode 1 + versionName "1.0" + } + lintOptions { + abortOnError false + } +} + +dependencies { + //fileTree(dir:'libs', include:['*.jar', '*.aar']) + implementation 'com.facebook.react:react-native:+' + implementation 'androidx.appcompat:appcompat:1.6.1' + implementation 'androidx.recyclerview:recyclerview:1.3.0' + implementation 'com.google.android.material:material:1.8.0' + implementation (name: 'ezetapandroidsdk-2_36', ext: 'aar') + implementation (name: 'ezetapprintersdk-v1.0', ext: 'aar') +} + diff --git a/release/react-native-sdk-release/react-native-ezetap-sdk@1.2.0/android/gradle.properties b/release/react-native-sdk-release/react-native-ezetap-sdk@1.2.0/android/gradle.properties new file mode 100644 index 0000000..5465fec --- /dev/null +++ b/release/react-native-sdk-release/react-native-ezetap-sdk@1.2.0/android/gradle.properties @@ -0,0 +1,2 @@ +android.enableJetifier=true +android.useAndroidX=true \ No newline at end of file diff --git a/release/react-native-sdk-release/react-native-ezetap-sdk@1.2.0/android/gradle/wrapper/gradle-wrapper.jar b/release/react-native-sdk-release/react-native-ezetap-sdk@1.2.0/android/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..f6b961f Binary files /dev/null and b/release/react-native-sdk-release/react-native-ezetap-sdk@1.2.0/android/gradle/wrapper/gradle-wrapper.jar differ diff --git a/release/react-native-sdk-release/react-native-ezetap-sdk@1.2.0/android/gradle/wrapper/gradle-wrapper.properties b/release/react-native-sdk-release/react-native-ezetap-sdk@1.2.0/android/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..0452644 --- /dev/null +++ b/release/react-native-sdk-release/react-native-ezetap-sdk@1.2.0/android/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Mon Feb 01 11:44:02 IST 2021 +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip diff --git a/release/react-native-sdk-release/react-native-ezetap-sdk@1.2.0/android/libs/ezetapandroidsdk-2_36.aar b/release/react-native-sdk-release/react-native-ezetap-sdk@1.2.0/android/libs/ezetapandroidsdk-2_36.aar new file mode 100644 index 0000000..c81e685 Binary files /dev/null and b/release/react-native-sdk-release/react-native-ezetap-sdk@1.2.0/android/libs/ezetapandroidsdk-2_36.aar differ diff --git a/release/react-native-sdk-release/react-native-ezetap-sdk@1.2.0/android/libs/ezetapprintersdk-v1.0.aar b/release/react-native-sdk-release/react-native-ezetap-sdk@1.2.0/android/libs/ezetapprintersdk-v1.0.aar new file mode 100644 index 0000000..bb0a015 Binary files /dev/null and b/release/react-native-sdk-release/react-native-ezetap-sdk@1.2.0/android/libs/ezetapprintersdk-v1.0.aar differ diff --git a/release/react-native-sdk-release/react-native-ezetap-sdk@1.2.0/android/local.properties b/release/react-native-sdk-release/react-native-ezetap-sdk@1.2.0/android/local.properties new file mode 100644 index 0000000..9e704d4 --- /dev/null +++ b/release/react-native-sdk-release/react-native-ezetap-sdk@1.2.0/android/local.properties @@ -0,0 +1,8 @@ +## This file must *NOT* be checked into Version Control Systems, +# as it contains information specific to your local configuration. +# +# Location of the SDK. This is only used by Gradle. +# For customization when using a Version Control System, please read the +# header note. +#Thu Apr 13 13:44:18 IST 2023 +sdk.dir=/home/ezetap/Android/Sdk diff --git a/release/react-native-sdk-release/react-native-ezetap-sdk@1.2.0/android/src/main/AndroidManifest.xml b/release/react-native-sdk-release/react-native-ezetap-sdk@1.2.0/android/src/main/AndroidManifest.xml new file mode 100644 index 0000000..e858a99 --- /dev/null +++ b/release/react-native-sdk-release/react-native-ezetap-sdk@1.2.0/android/src/main/AndroidManifest.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/release/react-native-sdk-release/react-native-ezetap-sdk@1.2.0/android/src/main/java/com/ezetapsdk/EzeConstants.java b/release/react-native-sdk-release/react-native-ezetap-sdk@1.2.0/android/src/main/java/com/ezetapsdk/EzeConstants.java new file mode 100644 index 0000000..4c90fdc --- /dev/null +++ b/release/react-native-sdk-release/react-native-ezetap-sdk@1.2.0/android/src/main/java/com/ezetapsdk/EzeConstants.java @@ -0,0 +1,42 @@ +package com.ezetapsdk; + +/** + * @author TIJO THOMAS + * @since 19/04/23 + */ +public class EzeConstants { + + public static final int INITIALIZE_REQUEST_CODE = 1001; + public static final int PREPARE_DEVICE_REQUEST_CODE = 1002; + public static final int CARD_INFO_REQUEST_CODE = 1003; + public static final int SEND_RECEIPT_REQUEST_CODE = 1005; + public static final int SERVICE_REQUEST_CODE = 1008; + public static final int SEARCH_TRANSACTION_REQUEST_CODE = 1012; + public static final int GET_TRANSACTION_REQUEST_CODE = 1013; + public static final int CHECK_INCOMPLETE_TRANSACTION_REQUEST_CODE = 1014; + public static final int VOID_TRANSACTION_REQUEST_CODE = 1015; + public static final int ATTACH_SIGNATURE_REQUEST_CODE = 1016; + public static final int GENERIC_TRANSACTION_REQUEST_CODE = 1019; + public static final int BRAND_EMI_TRANSACTION_REQUEST_CODE = 1021; + public static final int NORMAL_EMI_TRANSACTION_REQUEST_CODE = 1022; + public static final int PRINT_RECEIPT_REQUEST_CODE = 1023; + public static final int PRINT_BITMAP_REQUEST_CODE = 1024; + public static final int CLOSE_SESSION_REQUEST_CODE = 1025; + public static final int PRE_AUTH_REQUEST_CODE = 1027; + public static final int CONFIRM_PRE_AUTH_REQUEST_CODE = 1028; + public static final int RELEASE_PRE_AUTH_REQUEST_CODE = 1029; + public static final int STOP_PAYMENT_REQUEST_CODE = 1030; + public static final int SCAN_BARCODE = 1031; + public static final int GET_CARD_INFO = 1032; + public static final int GET_LOYALTY_CARD_INFO = 1033; + public static final int WALLET_TRANSACTION = 1034; + public static final int CHEQUE_TRANSACTION = 1035; + public static final int CARD_TRANSACTION = 1036; + public static final int CASH_TRANSACTION = 1037; + public static final int REMOTE_TRANSACTION = 1038; + public static final int DISPLAY_TRANSACTION_HISTORY = 1039; + public static final int UPI_TRANSACTION = 1040; + public static final int QR_CODE_TRANSACTION = 1041; + public static final int REFUND_TRANSACTION = 1042; + public static final int CHECK_FOR_UPDATES = 1043; +} \ No newline at end of file diff --git a/release/react-native-sdk-release/react-native-ezetap-sdk@1.2.0/android/src/main/java/com/ezetapsdk/RNEzetapSdkModule.java b/release/react-native-sdk-release/react-native-ezetap-sdk@1.2.0/android/src/main/java/com/ezetapsdk/RNEzetapSdkModule.java new file mode 100644 index 0000000..62fb417 --- /dev/null +++ b/release/react-native-sdk-release/react-native-ezetap-sdk@1.2.0/android/src/main/java/com/ezetapsdk/RNEzetapSdkModule.java @@ -0,0 +1,636 @@ +package com.ezetapsdk; + +/** + * @author TIJO THOMAS + * @since 19/04/23 + */ + +import static com.ezetapsdk.EzeConstants.ATTACH_SIGNATURE_REQUEST_CODE; +import static com.ezetapsdk.EzeConstants.BRAND_EMI_TRANSACTION_REQUEST_CODE; +import static com.ezetapsdk.EzeConstants.CARD_INFO_REQUEST_CODE; +import static com.ezetapsdk.EzeConstants.CARD_TRANSACTION; +import static com.ezetapsdk.EzeConstants.CASH_TRANSACTION; +import static com.ezetapsdk.EzeConstants.CHECK_FOR_UPDATES; +import static com.ezetapsdk.EzeConstants.CHECK_INCOMPLETE_TRANSACTION_REQUEST_CODE; +import static com.ezetapsdk.EzeConstants.CHEQUE_TRANSACTION; +import static com.ezetapsdk.EzeConstants.CLOSE_SESSION_REQUEST_CODE; +import static com.ezetapsdk.EzeConstants.CONFIRM_PRE_AUTH_REQUEST_CODE; +import static com.ezetapsdk.EzeConstants.DISPLAY_TRANSACTION_HISTORY; +import static com.ezetapsdk.EzeConstants.GENERIC_TRANSACTION_REQUEST_CODE; +import static com.ezetapsdk.EzeConstants.GET_CARD_INFO; +import static com.ezetapsdk.EzeConstants.GET_LOYALTY_CARD_INFO; +import static com.ezetapsdk.EzeConstants.GET_TRANSACTION_REQUEST_CODE; +import static com.ezetapsdk.EzeConstants.INITIALIZE_REQUEST_CODE; +import static com.ezetapsdk.EzeConstants.NORMAL_EMI_TRANSACTION_REQUEST_CODE; +import static com.ezetapsdk.EzeConstants.PREPARE_DEVICE_REQUEST_CODE; +import static com.ezetapsdk.EzeConstants.PRE_AUTH_REQUEST_CODE; +import static com.ezetapsdk.EzeConstants.PRINT_BITMAP_REQUEST_CODE; +import static com.ezetapsdk.EzeConstants.PRINT_RECEIPT_REQUEST_CODE; +import static com.ezetapsdk.EzeConstants.QR_CODE_TRANSACTION; +import static com.ezetapsdk.EzeConstants.REFUND_TRANSACTION; +import static com.ezetapsdk.EzeConstants.RELEASE_PRE_AUTH_REQUEST_CODE; +import static com.ezetapsdk.EzeConstants.REMOTE_TRANSACTION; +import static com.ezetapsdk.EzeConstants.SCAN_BARCODE; +import static com.ezetapsdk.EzeConstants.SEARCH_TRANSACTION_REQUEST_CODE; +import static com.ezetapsdk.EzeConstants.SEND_RECEIPT_REQUEST_CODE; +import static com.ezetapsdk.EzeConstants.SERVICE_REQUEST_CODE; +import static com.ezetapsdk.EzeConstants.STOP_PAYMENT_REQUEST_CODE; +import static com.ezetapsdk.EzeConstants.UPI_TRANSACTION; +import static com.ezetapsdk.EzeConstants.VOID_TRANSACTION_REQUEST_CODE; +import static com.ezetapsdk.EzeConstants.WALLET_TRANSACTION; + +import android.app.Activity; +import android.content.Intent; +import android.graphics.Bitmap; +import android.graphics.BitmapFactory; +import android.util.Base64; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import com.eze.api.EzeAPI; +import com.eze.api.EzeAPIConstants.EzetapErrors; +import com.eze.api.EzetapUserConfig; +import com.ezetap.printer.EPrintStatus; +import com.ezetap.printer.EPrinterImplementation; +import com.facebook.react.bridge.ActivityEventListener; +import com.facebook.react.bridge.Promise; +import com.facebook.react.bridge.ReactApplicationContext; +import com.facebook.react.bridge.ReactContextBaseJavaModule; +import com.facebook.react.bridge.ReactMethod; +import org.json.JSONException; +import org.json.JSONObject; + +/** + * @author TIJO THOMAS + * @since 19/04/23 + */ +public class RNEzetapSdkModule extends ReactContextBaseJavaModule implements ActivityEventListener { + + private Promise mPromise; + + public RNEzetapSdkModule(ReactApplicationContext reactContext) { + super(reactContext); + reactContext.addActivityEventListener(this); + } + + + @NonNull + @Override + public String getName() { + return "RNEzetapSdk"; + } + + + /** + * Check For Updates method is only relevant in the Android platform. It is invoked to check for + * any updates to the Android Service app. + */ + @ReactMethod + private void checkUpdates(Promise promise) { + mPromise = promise; + EzeAPI.checkForUpdates(getCurrentActivity(), CHECK_FOR_UPDATES); + } + + /** + * Method to initialize the Ezetap transaction + * + * @param requestObject requestObject - The request object as defined in the API documentation + */ + + @ReactMethod + private void initialize(String requestObject, Promise promise) { + mPromise = promise; + try { + EzeAPI.initialize(getCurrentActivity(), INITIALIZE_REQUEST_CODE, + new JSONObject(requestObject)); + } catch (JSONException e) { + e.printStackTrace(); + promise.reject(e.getCause()); + } + } + + /** + * Method to close prepare device before any transaction + */ + + @ReactMethod + private void prepareDevice(Promise promise) { + mPromise = promise; + EzeAPI.prepareDevice(getCurrentActivity(), PREPARE_DEVICE_REQUEST_CODE); + } + + /** + * Method to scan barcode and retrieve the result + */ + @ReactMethod + private void scanBarcode(Promise promise) { + mPromise = promise; + EzeAPI.scanBarcode(getCurrentActivity(), SCAN_BARCODE, null); + } + + @ReactMethod + private void getCardInfo(Promise promise) { + mPromise = promise; + EzeAPI.getCardInfo(getCurrentActivity(), GET_CARD_INFO); + } + + @ReactMethod + private void getLoyaltyCardInfo(String requestObject, Promise promise) { + mPromise = promise; + try { + EzeAPI.getLoyaltyCardInfo(getCurrentActivity(), GET_LOYALTY_CARD_INFO, + new JSONObject(requestObject)); + } catch (JSONException e) { + e.printStackTrace(); + promise.reject(e.getCause()); + } + } + + /** + * Method to send transaction receipt to given mobile no/email id + * + * @param requestObject requestObject - The request object as defined in the API documentation + */ + + @ReactMethod + private void sendReceipt(String requestObject, Promise promise) { + mPromise = promise; + try { + EzeAPI.sendReceipt(getCurrentActivity(), SEND_RECEIPT_REQUEST_CODE, + new JSONObject(requestObject)); + } catch (JSONException e) { + e.printStackTrace(); + promise.reject(e.getCause()); + } + } + + + @ReactMethod + private void serviceRequest(String requestObject, Promise promise) { + mPromise = promise; + try { + EzeAPI.serviceRequest(getCurrentActivity(), SERVICE_REQUEST_CODE, + new JSONObject(requestObject)); + } catch (JSONException e) { + e.printStackTrace(); + promise.reject(e.getCause()); + } + } + + + /** + * Method to search transaction(s) + * + * @param requestObject requestObject - The request object as defined in the API documentation + */ + + @ReactMethod + private void searchTransaction(String requestObject, Promise promise) { + mPromise = promise; + try { + EzeAPI.searchTransaction(getCurrentActivity(), SEARCH_TRANSACTION_REQUEST_CODE, + new JSONObject(requestObject)); + } catch (JSONException e) { + e.printStackTrace(); + promise.reject(e.getCause()); + } + } + + /** + * Method to get transaction detail for a given External Reference + * + * @param externalReference externalReference - External reference number to look up + */ + + + @ReactMethod + private void getTransaction(String externalReference, Promise promise) { + mPromise = promise; + try { + EzeAPI.getTransaction(getCurrentActivity(), GET_TRANSACTION_REQUEST_CODE, + new JSONObject(externalReference)); + } catch (JSONException e) { + e.printStackTrace(); + promise.reject(e.getCause()); + } + } + + /** + * Method to if a previous card transaction is pending. A card transaction could be pending if + * no response was received after the transaction was initiated or if there was an app crash + * after the transaction was initiated. The Ezetap SDK checks for pending transactions at the + * very next Ezetap API call, it is recommended that calling applications call this API at the + * appropriate time for eg. - upon login or upon calling pay cash where the handling is not done + * by the Ezetap system. + */ + + @ReactMethod + private void checkForIncompleteTransaction(String json, Promise promise) { + mPromise = promise; + try { + EzeAPI.checkForIncompleteTransaction(getCurrentActivity(), + CHECK_INCOMPLETE_TRANSACTION_REQUEST_CODE, new JSONObject(json)); + } catch (JSONException e) { + e.printStackTrace(); + promise.reject(e.getCause()); + } + } + + /** + * Method to void transaction + * + * @param transactionID transactionID - The ID of the transaction which is to be voided + */ + + @ReactMethod + private void voidTransaction(String transactionID, Promise promise) { + mPromise = promise; + EzeAPI.voidTransaction(getCurrentActivity(), VOID_TRANSACTION_REQUEST_CODE, transactionID); + } + + /** + * Method to attach Signature for a transaction + * + * @param requestObject requestObject - The request object as defined in the API documentation + */ + + @ReactMethod + private void attachSignature(String requestObject, Promise promise) { + mPromise = promise; + try { + EzeAPI.attachSignature(getCurrentActivity(), ATTACH_SIGNATURE_REQUEST_CODE, + new JSONObject(requestObject)); + } catch (JSONException e) { + e.printStackTrace(); + promise.reject(e.getCause()); + } + } + + + /** + * Method to start a generic pay + * + * @param requestObject requestObject - The request object as defined in the API documentation + */ + + @ReactMethod + private void pay(String requestObject, Promise promise) { + mPromise = promise; + try { + EzeAPI.pay(getCurrentActivity(), GENERIC_TRANSACTION_REQUEST_CODE, + new JSONObject(requestObject)); + } catch (JSONException e) { + e.printStackTrace(); + promise.reject(e.getCause()); + } + } + + + /** + * Method to start a Brand EMI transaction + * + * @param requestObject requestObject - The request object as defined in the API documentation + */ + + @ReactMethod + private void brandEMITransaction(String requestObject, Promise promise) { + mPromise = promise; + try { + EzeAPI.brandEMITransaction(getCurrentActivity(), BRAND_EMI_TRANSACTION_REQUEST_CODE, + new JSONObject(requestObject)); + } catch (JSONException e) { + e.printStackTrace(); + promise.reject(e.getCause()); + } + } + + /** + * Method to start a Brand EMI transaction + * + * @param requestObject requestObject - The request object as defined in the API documentation + */ + + @ReactMethod + private void normalEMITransaction(String requestObject, Promise promise) { + mPromise = promise; + try { + EzeAPI.normalEMITransaction(getCurrentActivity(), NORMAL_EMI_TRANSACTION_REQUEST_CODE, + new JSONObject(requestObject)); + } catch (JSONException e) { + e.printStackTrace(); + promise.reject(e.getCause()); + } + } + + /** + * Method to print a receipt for a particular transaction + * + * @param transactionID transactionID - The ID of the Ezetap txn + */ + + @ReactMethod + private void printReceipt(String transactionID, Promise promise) { + mPromise = promise; + EzeAPI.printReceipt(getCurrentActivity(), PRINT_RECEIPT_REQUEST_CODE, transactionID); + } + + /** + * Method to print a bitmap image of the current view + */ + + @ReactMethod + private void printBitmap(String arguments, Promise promise) { + mPromise = promise; + getCurrentActivity().runOnUiThread(() -> { + String encodedImageData; + if (arguments != null) { + encodedImageData = arguments.toString(); + } else { + encodedImageData = Utils.loadBitmapBase64EncodedFromView(getCurrentActivity()); + } + if (!Utils.isDeviceX990()) { + try { + if (EzetapUserConfig.getEzeUserConfig() != null) { + EPrinterImplementation ePrinter = EPrinterImplementation.getInstance(); + byte[] imageBytes = Base64.decode(encodedImageData, Base64.DEFAULT); + Bitmap decodedImage = BitmapFactory.decodeByteArray(imageBytes, 0, + imageBytes.length); + EPrintStatus status = ePrinter.init(getCurrentActivity()); + if (status == EPrintStatus.SUCCESS) { + new Thread(() -> ePrinter.printBitmap(decodedImage, + (ePrintStatus, o) -> getCurrentActivity().runOnUiThread( + () -> mPromise.resolve(o)))).start(); + } else { + mPromise.reject("EZE_ERROR", status.getMessage()); + } + } else { + mPromise.reject(EzetapErrors.ERROR_INIT_REQUIRED.getErrorCode(), + EzetapErrors.ERROR_INIT_REQUIRED.getErrorMessage()); + } + } catch (Exception ex) { + ex.printStackTrace(); + mPromise.reject("EZE_ERROR", ex.getMessage()); + } + } else { + JSONObject jsonRequest = new JSONObject(); + JSONObject jsonImageObj = new JSONObject(); + try { + jsonImageObj.put("imageData", encodedImageData); + jsonImageObj.put("imageType", "JPEG"); + jsonImageObj.put("height", "");// optional + jsonImageObj.put("weight", "");// optional + jsonRequest.put("image", jsonImageObj); + } catch (JSONException e) { + e.printStackTrace(); + } + EzeAPI.printBitmap(getCurrentActivity(), PRINT_BITMAP_REQUEST_CODE, jsonRequest); + } + }); + + } + + /** + * Method to close Ezetap sessions + */ + + @ReactMethod + private void close(Promise promise) { + mPromise = promise; + EzeAPI.close(getCurrentActivity(), CLOSE_SESSION_REQUEST_CODE); + } + + /** + * Method to Initiate Pre Auth + * + * @param jsonObject jsonObject - All txnIds to be passed to stop the payment. + */ + @ReactMethod + private void preAuth(String jsonObject, Promise promise) { + mPromise = promise; + try { + EzeAPI.preAuth(getCurrentActivity(), PRE_AUTH_REQUEST_CODE, new JSONObject(jsonObject)); + } catch (JSONException e) { + e.printStackTrace(); + promise.reject(e.getCause()); + } + } + + /** + * Method to Confirm Pre Auth + * + * @param jsonObject jsonObject - All txnIds to be passed to stop the payment. + */ + @ReactMethod + private void confirmPreAuth(String jsonObject, Promise promise) { + mPromise = promise; + try { + EzeAPI.confirmPreAuth(getCurrentActivity(), CONFIRM_PRE_AUTH_REQUEST_CODE, + new JSONObject(jsonObject)); + } catch (JSONException e) { + e.printStackTrace(); + promise.reject(e.getCause()); + } + } + + /** + * Method to Release Pre Auth + * + * @param jsonObject jsonObject - All txnIds to be passed to stop the payment. + */ + @ReactMethod + private void releasePreAuth(String jsonObject, Promise promise) { + mPromise = promise; + try { + EzeAPI.releasePreAuth(getCurrentActivity(), RELEASE_PRE_AUTH_REQUEST_CODE, + new JSONObject(jsonObject)); + } catch (JSONException e) { + e.printStackTrace(); + promise.reject(e.getCause()); + } + } + + /** + * Method to void transaction + * + * @param jsonObject jsonObject - All txnIds to be passed to stop the payment. + */ + + @ReactMethod + private void stopPayment(String jsonObject, Promise promise) { + mPromise = promise; + try { + EzeAPI.stopPayment(getCurrentActivity(), STOP_PAYMENT_REQUEST_CODE, + new JSONObject(jsonObject)); + } catch (JSONException e) { + e.printStackTrace(); + promise.reject(e.getCause()); + } + } + + @ReactMethod + private void walletTransaction(String requestObject, Promise promise) { + mPromise = promise; + try { + EzeAPI.walletTransaction(getCurrentActivity(), WALLET_TRANSACTION, + new JSONObject(requestObject)); + } catch (JSONException e) { + e.printStackTrace(); + promise.reject(e.getCause()); + } + } + + @ReactMethod + private void upiTransaction(String requestObject, Promise promise) { + mPromise = promise; + try { + EzeAPI.upiTransaction(getCurrentActivity(), UPI_TRANSACTION, + new JSONObject(requestObject)); + } catch (JSONException e) { + e.printStackTrace(); + promise.reject(e.getCause()); + } + } + + @ReactMethod + private void qrCodeTransaction(String requestObject, Promise promise) { + mPromise = promise; + try { + EzeAPI.qrCodeTransaction(getCurrentActivity(), QR_CODE_TRANSACTION, + new JSONObject(requestObject)); + } catch (JSONException e) { + e.printStackTrace(); + promise.reject(e.getCause()); + } + } + + @ReactMethod + private void chequeTransaction(String requestObject, Promise promise) { + mPromise = promise; + try { + EzeAPI.walletTransaction(getCurrentActivity(), CHEQUE_TRANSACTION, + new JSONObject(requestObject)); + } catch (JSONException e) { + e.printStackTrace(); + promise.reject(e.getCause()); + } + } + + @ReactMethod + private void refundTransaction(String requestObject, Promise promise) { + mPromise = promise; + try { + EzeAPI.refundTransaction(getCurrentActivity(), REFUND_TRANSACTION, + new JSONObject(requestObject)); + } catch (JSONException e) { + e.printStackTrace(); + promise.reject(e.getCause()); + } + } + + @ReactMethod + private void cardTransaction(String requestObject, Promise promise) { + mPromise = promise; + try { + EzeAPI.cardTransaction(getCurrentActivity(), CARD_TRANSACTION, + new JSONObject(requestObject)); + } catch (JSONException e) { + e.printStackTrace(); + promise.reject(e.getCause()); + } + } + + @ReactMethod + private void cashTransaction(String requestObject, Promise promise) { + mPromise = promise; + try { + EzeAPI.cashTransaction(getCurrentActivity(), CASH_TRANSACTION, + new JSONObject(requestObject)); + } catch (JSONException e) { + e.printStackTrace(); + promise.reject(e.getCause()); + } + } + + @ReactMethod + private void remotePayment(String requestObject, Promise promise) { + mPromise = promise; + try { + EzeAPI.remotePayment(getCurrentActivity(), REMOTE_TRANSACTION, + new JSONObject(requestObject)); + } catch (JSONException e) { + e.printStackTrace(); + promise.reject(e.getCause()); + } + } + + @ReactMethod + private void displayTransactionHistory(String requestObject, Promise promise) { + mPromise = promise; + try { + EzeAPI.displayTransactionHistory(getCurrentActivity(), DISPLAY_TRANSACTION_HISTORY, + new JSONObject(requestObject)); + } catch (JSONException e) { + e.printStackTrace(); + promise.reject(e.getCause()); + } + } + + /** + * Do not remove this onActivityResult as it is an abstract method which calls the + * ActivityListener onActivityResult Method onActivityResult will be called + * + * @param activity context of the Activity + * @param requestCode Request code you wish to handle for the result in onActivityResult + * method. + */ + @Override + public void onActivityResult(Activity activity, int requestCode, int resultCode, + @Nullable Intent intent) { + if (mPromise != null) { + switch (requestCode) { + case INITIALIZE_REQUEST_CODE: + case PREPARE_DEVICE_REQUEST_CODE: + case CARD_INFO_REQUEST_CODE: + case SEND_RECEIPT_REQUEST_CODE: + case SERVICE_REQUEST_CODE: + case SEARCH_TRANSACTION_REQUEST_CODE: + case GET_TRANSACTION_REQUEST_CODE: + case CHECK_INCOMPLETE_TRANSACTION_REQUEST_CODE: + case VOID_TRANSACTION_REQUEST_CODE: + case ATTACH_SIGNATURE_REQUEST_CODE: + case GENERIC_TRANSACTION_REQUEST_CODE: + case BRAND_EMI_TRANSACTION_REQUEST_CODE: + case NORMAL_EMI_TRANSACTION_REQUEST_CODE: + case PRINT_RECEIPT_REQUEST_CODE: + case PRINT_BITMAP_REQUEST_CODE: + case CLOSE_SESSION_REQUEST_CODE: + case PRE_AUTH_REQUEST_CODE: + case CONFIRM_PRE_AUTH_REQUEST_CODE: + case RELEASE_PRE_AUTH_REQUEST_CODE: + case STOP_PAYMENT_REQUEST_CODE: + case CARD_TRANSACTION: + case CASH_TRANSACTION: + case CHECK_FOR_UPDATES: + case CHEQUE_TRANSACTION: + case DISPLAY_TRANSACTION_HISTORY: + case QR_CODE_TRANSACTION: + case REFUND_TRANSACTION: + case REMOTE_TRANSACTION: + case SCAN_BARCODE: + case UPI_TRANSACTION: + case WALLET_TRANSACTION: { + if (intent.getExtras() != null) { + mPromise.resolve(Utils.createJsonObject(intent)); + } else { + mPromise.reject(String.valueOf(requestCode), + new Exception("An Error has been occurred")); + } + } + } + } + } + + @Override + public void onNewIntent(Intent intent) { + + } +} \ No newline at end of file diff --git a/release/react-native-sdk-release/react-native-ezetap-sdk@1.2.0/android/src/main/java/com/ezetapsdk/RNEzetapSdkPackage.java b/release/react-native-sdk-release/react-native-ezetap-sdk@1.2.0/android/src/main/java/com/ezetapsdk/RNEzetapSdkPackage.java new file mode 100644 index 0000000..d0375c3 --- /dev/null +++ b/release/react-native-sdk-release/react-native-ezetap-sdk@1.2.0/android/src/main/java/com/ezetapsdk/RNEzetapSdkPackage.java @@ -0,0 +1,35 @@ +package com.ezetapsdk; + +import androidx.annotation.NonNull; +import com.facebook.react.ReactPackage; +import com.facebook.react.bridge.NativeModule; +import com.facebook.react.bridge.ReactApplicationContext; +import com.facebook.react.uimanager.ViewManager; +import java.util.Collections; +import java.util.List; + +/** + * @author TIJO THOMAS + * @since 19/04/23 + */ + +/** + * @author TIJO THOMAS + * @since 19/04/23 + */ +public class RNEzetapSdkPackage implements ReactPackage { + + @NonNull + @Override + public List createNativeModules( + @NonNull ReactApplicationContext reactApplicationContext) { + return Collections.singletonList(new RNEzetapSdkModule(reactApplicationContext)); + } + + @NonNull + @Override + public List createViewManagers( + @NonNull ReactApplicationContext reactApplicationContext) { + return Collections.emptyList(); + } +} \ No newline at end of file diff --git a/release/react-native-sdk-release/react-native-ezetap-sdk@1.2.0/android/src/main/java/com/ezetapsdk/Utils.java b/release/react-native-sdk-release/react-native-ezetap-sdk@1.2.0/android/src/main/java/com/ezetapsdk/Utils.java new file mode 100644 index 0000000..f8d97d4 --- /dev/null +++ b/release/react-native-sdk-release/react-native-ezetap-sdk@1.2.0/android/src/main/java/com/ezetapsdk/Utils.java @@ -0,0 +1,34 @@ +package com.ezetapsdk; + +import android.app.Activity; +import android.content.Intent; +import android.graphics.Bitmap; +import android.graphics.Canvas; +import android.os.Build; +import android.util.Base64; +import android.view.View; + +import java.io.ByteArrayOutputStream; + +public class Utils { + + public static Object createJsonObject(Intent data) { + return data.getExtras().get("response"); + } + + public static String loadBitmapBase64EncodedFromView(Activity mActivity) { + View view = mActivity.getWindow().getDecorView().findViewById(android.R.id.content); + Bitmap bitmap = Bitmap.createBitmap(view.getMeasuredWidth(), view.getMeasuredHeight(), + Bitmap.Config.ARGB_8888); + Canvas c = new Canvas(bitmap); + view.draw(c); + ByteArrayOutputStream stream = new ByteArrayOutputStream(); + bitmap.compress(Bitmap.CompressFormat.JPEG, 70, stream); + byte[] byteFormat = stream.toByteArray(); + return Base64.encodeToString(byteFormat, Base64.NO_WRAP); + } + + public static boolean isDeviceX990() { + return Build.MODEL.equalsIgnoreCase("X990"); + } +} \ No newline at end of file diff --git a/release/react-native-sdk-release/react-native-ezetap-sdk@1.2.0/index.js b/release/react-native-sdk-release/react-native-ezetap-sdk@1.2.0/index.js new file mode 100644 index 0000000..052b11b --- /dev/null +++ b/release/react-native-sdk-release/react-native-ezetap-sdk@1.2.0/index.js @@ -0,0 +1,6 @@ + +import { NativeModules } from 'react-native'; + +const { RNEzetapSdk } = NativeModules; + +export default RNEzetapSdk; diff --git a/release/react-native-sdk-release/react-native-ezetap-sdk@1.2.0/ios/RNEzetapSdk.h b/release/react-native-sdk-release/react-native-ezetap-sdk@1.2.0/ios/RNEzetapSdk.h new file mode 100644 index 0000000..7c9f19a --- /dev/null +++ b/release/react-native-sdk-release/react-native-ezetap-sdk@1.2.0/ios/RNEzetapSdk.h @@ -0,0 +1,11 @@ + +#if __has_include("RCTBridgeModule.h") +#import "RCTBridgeModule.h" +#else +#import +#endif + +@interface RNEzetapSdk : NSObject + +@end + \ No newline at end of file diff --git a/release/react-native-sdk-release/react-native-ezetap-sdk@1.2.0/ios/RNEzetapSdk.m b/release/react-native-sdk-release/react-native-ezetap-sdk@1.2.0/ios/RNEzetapSdk.m new file mode 100644 index 0000000..0d08eec --- /dev/null +++ b/release/react-native-sdk-release/react-native-ezetap-sdk@1.2.0/ios/RNEzetapSdk.m @@ -0,0 +1,13 @@ + +#import "RNEzetapSdk.h" + +@implementation RNEzetapSdk + +- (dispatch_queue_t)methodQueue +{ + return dispatch_get_main_queue(); +} +RCT_EXPORT_MODULE() + +@end + \ No newline at end of file diff --git a/release/react-native-sdk-release/react-native-ezetap-sdk@1.2.0/ios/RNEzetapSdk.podspec b/release/react-native-sdk-release/react-native-ezetap-sdk@1.2.0/ios/RNEzetapSdk.podspec new file mode 100644 index 0000000..29fd8b1 --- /dev/null +++ b/release/react-native-sdk-release/react-native-ezetap-sdk@1.2.0/ios/RNEzetapSdk.podspec @@ -0,0 +1,24 @@ + +Pod::Spec.new do |s| + s.name = "RNEzetapSdk" + s.version = "1.0.0" + s.summary = "RNEzetapSdk" + s.description = <<-DESC + RNEzetapSdk + DESC + s.homepage = "" + s.license = "MIT" + # s.license = { :type => "MIT", :file => "FILE_LICENSE" } + s.author = { "author" => "author@domain.cn" } + s.platform = :ios, "7.0" + s.source = { :git => "https://github.com/author/RNEzetapSdk.git", :tag => "master" } + s.source_files = "RNEzetapSdk/**/*.{h,m}" + s.requires_arc = true + + + s.dependency "React" + #s.dependency "others" + +end + + \ No newline at end of file diff --git a/release/react-native-sdk-release/react-native-ezetap-sdk@1.2.0/ios/RNEzetapSdk.xcodeproj/project.pbxproj b/release/react-native-sdk-release/react-native-ezetap-sdk@1.2.0/ios/RNEzetapSdk.xcodeproj/project.pbxproj new file mode 100644 index 0000000..9193736 --- /dev/null +++ b/release/react-native-sdk-release/react-native-ezetap-sdk@1.2.0/ios/RNEzetapSdk.xcodeproj/project.pbxproj @@ -0,0 +1,259 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + B3E7B58A1CC2AC0600A0062D /* RNEzetapSdk.m in Sources */ = {isa = PBXBuildFile; fileRef = B3E7B5891CC2AC0600A0062D /* RNEzetapSdk.m */; }; +/* End PBXBuildFile section */ + +/* Begin PBXCopyFilesBuildPhase section */ + 58B511D91A9E6C8500147676 /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = "include/$(PRODUCT_NAME)"; + dstSubfolderSpec = 16; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 134814201AA4EA6300B7C361 /* libRNEzetapSdk.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libRNEzetapSdk.a; sourceTree = BUILT_PRODUCTS_DIR; }; + B3E7B5881CC2AC0600A0062D /* RNEzetapSdk.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RNEzetapSdk.h; sourceTree = ""; }; + B3E7B5891CC2AC0600A0062D /* RNEzetapSdk.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNEzetapSdk.m; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 58B511D81A9E6C8500147676 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 134814211AA4EA7D00B7C361 /* Products */ = { + isa = PBXGroup; + children = ( + 134814201AA4EA6300B7C361 /* libRNEzetapSdk.a */, + ); + name = Products; + sourceTree = ""; + }; + 58B511D21A9E6C8500147676 = { + isa = PBXGroup; + children = ( + B3E7B5881CC2AC0600A0062D /* RNEzetapSdk.h */, + B3E7B5891CC2AC0600A0062D /* RNEzetapSdk.m */, + 134814211AA4EA7D00B7C361 /* Products */, + ); + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 58B511DA1A9E6C8500147676 /* RNEzetapSdk */ = { + isa = PBXNativeTarget; + buildConfigurationList = 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "RNEzetapSdk" */; + buildPhases = ( + 58B511D71A9E6C8500147676 /* Sources */, + 58B511D81A9E6C8500147676 /* Frameworks */, + 58B511D91A9E6C8500147676 /* CopyFiles */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = RNEzetapSdk; + productName = RCTDataManager; + productReference = 134814201AA4EA6300B7C361 /* libRNEzetapSdk.a */; + productType = "com.apple.product-type.library.static"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 58B511D31A9E6C8500147676 /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 0830; + ORGANIZATIONNAME = Facebook; + TargetAttributes = { + 58B511DA1A9E6C8500147676 = { + CreatedOnToolsVersion = 6.1.1; + }; + }; + }; + buildConfigurationList = 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "RNEzetapSdk" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + en, + ); + mainGroup = 58B511D21A9E6C8500147676; + productRefGroup = 58B511D21A9E6C8500147676; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 58B511DA1A9E6C8500147676 /* RNEzetapSdk */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXSourcesBuildPhase section */ + 58B511D71A9E6C8500147676 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + B3E7B58A1CC2AC0600A0062D /* RNEzetapSdk.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + 58B511ED1A9E6C8500147676 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_SYMBOLS_PRIVATE_EXTERN = NO; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + }; + name = Debug; + }; + 58B511EE1A9E6C8500147676 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = YES; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 58B511F01A9E6C8500147676 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + HEADER_SEARCH_PATHS = ( + "$(inherited)", + /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, + "$(SRCROOT)/../../../React/**", + "$(SRCROOT)/../../react-native/React/**", + ); + LIBRARY_SEARCH_PATHS = "$(inherited)"; + OTHER_LDFLAGS = "-ObjC"; + PRODUCT_NAME = RNEzetapSdk; + SKIP_INSTALL = YES; + }; + name = Debug; + }; + 58B511F11A9E6C8500147676 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + HEADER_SEARCH_PATHS = ( + "$(inherited)", + /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, + "$(SRCROOT)/../../../React/**", + "$(SRCROOT)/../../react-native/React/**", + ); + LIBRARY_SEARCH_PATHS = "$(inherited)"; + OTHER_LDFLAGS = "-ObjC"; + PRODUCT_NAME = RNEzetapSdk; + SKIP_INSTALL = YES; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "RNEzetapSdk" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 58B511ED1A9E6C8500147676 /* Debug */, + 58B511EE1A9E6C8500147676 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "RNEzetapSdk" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 58B511F01A9E6C8500147676 /* Debug */, + 58B511F11A9E6C8500147676 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 58B511D31A9E6C8500147676 /* Project object */; +} diff --git a/release/react-native-sdk-release/react-native-ezetap-sdk@1.2.0/ios/RNEzetapSdk.xcworkspace/contents.xcworkspacedata b/release/react-native-sdk-release/react-native-ezetap-sdk@1.2.0/ios/RNEzetapSdk.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..95025c5 --- /dev/null +++ b/release/react-native-sdk-release/react-native-ezetap-sdk@1.2.0/ios/RNEzetapSdk.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,9 @@ +// !$*UTF8*$! + + + + + + \ No newline at end of file diff --git a/release/react-native-sdk-release/react-native-ezetap-sdk@1.2.0/package.json b/release/react-native-sdk-release/react-native-ezetap-sdk@1.2.0/package.json new file mode 100644 index 0000000..2feaf1c --- /dev/null +++ b/release/react-native-sdk-release/react-native-ezetap-sdk@1.2.0/package.json @@ -0,0 +1,19 @@ + +{ + "name": "react-native-ezetap-sdk", + "version": "1.2.1", + "description": "", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "keywords": [ + "react-native" + ], + "author": "", + "license": "", + "peerDependencies": { + "react-native": "*" + + } +}