# cordova-plugin-ezetap

> A Cordova plugin to integrate ezetap swiping machine

Latest version **0.0.2** (published 2019-12-16) · ISC license · 0 weekly downloads

## Install

```sh
npm install cordova-plugin-ezetap
pnpm add cordova-plugin-ezetap
yarn add cordova-plugin-ezetap
bun add cordova-plugin-ezetap
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.2 |
| Published | 2019-12-16 |
| First published | 2019-11-05 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 116 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | arun.yogesh@gmail.com |
| Maintainers | arunyogi |
| Keywords | cordova, cordova-plugin, ezetap, payment-gateway |

## Links

- npm: https://www.npmjs.com/package/cordova-plugin-ezetap
- Repository: https://github.com/ArunYogi/cordova-plugin-ezetap
- Homepage: https://github.com/ArunYogi/cordova-plugin-ezetap#readme
- Issues: https://github.com/ArunYogi/cordova-plugin-ezetap/issues
- npm.io page: https://npm.io/package/cordova-plugin-ezetap

## Recent versions

- 0.0.2 (latest) — 2019-12-16
- 1.0.0 — 2019-11-05

## README

# Cordva Plugin Ezetap

A Cordova plugin to use Ezetap POS machine for card payment.

## Installation

```bash
cordova plugin add cordova-plugin-ezetap
```

On successful installation of this plugin, the plugin would be availble as "Ezetap" (as global variable). Mention below line in top of TS of JS file you are going access this plugin

```js
declare var Ezetap :any
```

## Steps:
1) Intialize the plugin by calling method "initialize". This method invocation helps in connecting with ezetap device and preparing the device for transaction
2) After successful initialization, you can start card transaction by calling method "cardTransaction" with payment related information.

## Initialization:
Sample request

```javascript
var request = {
    "demoAppKey": "aasdas",
    "prodAppKey": "dasas",
    "merchantName": "Ezetap",
    "userName":"1293123", #User name will be provided
    "currencyCode": "INR",
    "appMode": "DEMO",
    "captureSignature": "false",
    "prepareDevice" : "false"
    }

var successcallback = (result) => { 
    console.log(result);  
    # Do your thing 
};
var errorCallback = (err) => { 
    console.error(err); 
    # Do your thing
};
Ezetap.initialize(request, successcallback, errorCallback);
```

Response:
```js
     {
        "status": "success",
        "error": "",
        "result":{
            "message":"Initialize successful"
        }
    }
```

User Name, Demo App key and Production app key will provided by Ezetap Team. (Contact Ezetap integration team for those details)

## Card Transaction:

```javascript
    var request = {
        "amount": 00.00,
        "mode": "SALE", # Other possible values are "CASHBACK, CASH@POS"
        "options": {
            "amountCashback": 0.0,
            "amountTip": 0.0,
            "references": {
                    "reference1":"<unique Id>", #This should be unique for each transaction
                    "reference2":"",
                    "reference3":"",
                    "additionalReferences":["addlRef1","addlRef2"]
            },
            "customer": {"customer information"}
        },
    };

    var successcallback = function(response){
        console.log(JSON.stringify(response));
        # Do your thing
    };

    var errorCallback = function(response){
        console.log(JSON.stringify(response));
        # Do your thing
    };

Ezetap.cardTransaction(request, successcallback, errorCallback);
```

## Void Transaction:
Call this method incase you want to cancel the transaction (happened few moments before) or refund the transaction that has happened on the same day.

```javascript
    var txnId = "txn12321423423";

    var successcallback = function(response){
        console.log(JSON.stringify(response));
        # Do your thing
    };

    var errorCallback = function(response){
        console.log(JSON.stringify(response));
        # Do your thing
    };

Ezetap.voidTransaction(txnId, successcallback, errorCallback);
```

## Get Transaction:
You can get transaction details by calling this method
```javascript
    var etxnId = "2983d2p93d23";

    var successcallback = function(response){
        console.log(JSON.stringify(response));
        # Do your thing
    };

    var errorCallback = function(response){
        console.log(JSON.stringify(response));
        # Do your thing
    };

Ezetap.getTransaction(etxnId, successcallback, errorCallback);
```

## Close:
Close the interaction with ezetap device on app closure for better longitivity.
```javascript
    var successcallback = function(response){
        console.log(JSON.stringify(response));
        # Do your thing
    };

    var errorCallback = function(response){
        console.log(JSON.stringify(response));
        # Do your thing
    };

Ezetap.close(successcallback, errorCallback);
```

#### Reference:
https://sandbox.ezetap.com/static/docs-cordova.html <br>
https://github.com/ezetap/android-payments-sdk <br>
https://github.com/ezetap/client-sdk-android/tree/master/release


### Release Notes:
0.0.1 -> Initial release of Ezetap integrated Plugin for cordova environment
0.0.2 -> Added user permission to install Ezetap Service APP, which is necessary for proper transaction or interaction with Ezetap device

---
_Source: https://npm.io/package/cordova-plugin-ezetap · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
