Giter Site home page Giter Site logo

truewallet's Introduction

DEPRECATED! TRUEMONEY API V1 IS DEPRECATED, THERE WILL BE NO ANY FURTHER UPDATE FROM NOW ON

truewallet

Build Status Codacy Badge npm Javascript Style Guide License: MIT

Promise-based True Wallet API for JS

Install

yarn add truewallet

Examples

Login and Logout

const truewallet = require('truewallet');

;(async () => {
  // Get token with email and password
  var token = await truewallet.get.token('[email protected]', 'p4ssw0rd')

  // Logout
  await truewallet.logout(token)
})()

Check balance

const truewallet = require('truewallet');

;(async () => {
  // Get token with email and password
  var token = await truewallet.get.token('[email protected]', 'p4ssw0rd')

  // Check scuccessfully login
  if(token !== null) {
    var profile = await truewallet.get.balance(token)
    console.log(profile)

    // Logout
    await truewallet.logout(token)
  }
})()

Topup TrueMoney Cashcard

const truewallet = require('truewallet');

;(async () => {
  // Get token with email and password
  var token = await truewallet.get.token('[email protected]', 'p4ssw0rd')

  // Check scuccessfully login
  if(token !== null) {
    var topup = await truewallet.cashcard.topup(token, '00000000000000')

    // Logout
    await truewallet.logout(token)
  }
})()

Fetch Tx

const moment = require('moment');
const truewallet = require('truewallet');

;(async () => {
  // Get token with email and password
  var token = await truewallet.get.token('[email protected]', 'p4ssw0rd')

  // Check scuccessfully login
  if(token !== null) {
    var startDate= moment().subtract(1, 'days').format('YYYY-MM-DD')
    var endDate= moment().add(1, 'days').format('YYYY-MM-DD')

    var activities = await truewallet.fetch.activity(token, startDate, endDate)
    console.log(activities)

    // Logout
    await truewallet.logout(token)
  }
})()

Get Tx details by ID

const moment = require('moment');
const truewallet = require('truewallet');

(async () => {
  // Get token with email and password
  var token = await truewallet.get.token('[email protected]', 'p4ssw0rd')

  // Check scuccessfully login
  if(token !== null) {
    var startDate= moment().subtract(1, 'days').format('YYYY-MM-DD')
    var endDate= moment().add(1, 'days').format('YYYY-MM-DD')

    var activities = await truewallet.fetch.activity(token, startDate, endDate)

    activities.forEach(function(activity) {
      if(activity.original_action === 'creditor') {
        var data = await truewallet.fetch.txDetail(token, data.report_id)

        // Tx ID
        var txId = data.section4.column2.cell1.value

        // Value
        var txValue = data.section3.column1.cell1.value.replace(',', '')

        console.log(txId)
        console.log(txValue)
      }
    })

    // Logout
    await truewallet.logout(token)
  }
})()

Contributing

We welcome all contributions by sending PR to this repository.

Need Help

If you need help with anything, here're following methods:

Create an Issue

If you have something you want to discuss in detail, or have hit an issue which you believe others will also have in deployment or development of the system, opening an issue is the best way to get help. It creates a permanent resource for others wishing to contribute to conversation.

Donation

You can feed me by donating money via Bank Account or PromptPay

truewallet's People

Contributors

rayriffy avatar dependabot[bot] avatar sctnightcore avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.