1.0.2 • Published 2 years ago

@fivestarprogramming/fsp-cash-service-js v1.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

Fsp Cash Machine Service

Fsp Cash Machine Service library for Angular, Vue, React, JS.

Getting started

Step 1: Install @fivestarprogramming/fsp-cash-service-js:

NPM

npm i @fivestarprogramming/fsp-cash-service-js

Implementation Guide for Vue (2):

<template>
  <div>
    <button @click="sendAmount(100, { customField: 'value' })">Send Amount</button>
    <button @click="cancelTransaction">Cancel Transaction</button>
  </div>
</template>

<script>
import FspCashService from '@fivestarprogramming/fsp-cash-service-js';

export default {
  mounted() {
    const fspCashService = new FspCashService('your-tenant-id');
    fspCashService.connect();

    fspCashService.on('logs', (message) => {
      console.log('Received logs:', message);
    });

    fspCashService.on('completed', (message) => {
      console.log('Transaction completed:', message);
    });

    fspCashService.on('cancelled', (message) => {
      console.log('Transaction cancelled:', message);
    });

    this.fspCashService = fspCashService;
  },
  methods: {
    sendAmount(amount, customFields) {
      this.fspCashService.sendAmount(amount, customFields);
    },
    cancelTransaction() {
      this.fspCashService.cancelTransaction();
    }
  }
};
</script>