Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
301 changes: 250 additions & 51 deletions README.md

Large diffs are not rendered by default.

Binary file not shown.
Original file line number Diff line number Diff line change
@@ -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
<application
android:name=".MainApplication"
android:allowBackup="false"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:theme="@style/AppTheme"
tools:replace="android:allowBackup">
```

## 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": "<NBFC> 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);
```
Original file line number Diff line number Diff line change
@@ -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')
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
android.enableJetifier=true
android.useAndroidX=true
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -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
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.ezetapsdk">
<uses-permission android:name="com.pax.permission.PRINTER" />
</manifest>

Original file line number Diff line number Diff line change
@@ -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;
}
Loading