Giter VIP home page Giter VIP logo

hipay's Introduction

HiPay SDK

Library that enables you to interact with the Gateway and the Tokenization HiPay APIs.

Notes:

  • This package respects the semver and the keep a changelog specifications.
  • Every asynchronous methods can be used with async/await ES7 features, generators, or promises.
  • Every methods listed but not specified here fit the HiPay specifications, so please refer to their documentation to know exactly how to provide them.

Install

npm i hipay

Available Methods

Hipay#init(credentials)

const credentials = {
  username: String, // (required)
  password: String, // (required)
  passphrase: String,
  mod: String // production || test (default: test)
};

Hipay#order(order)

Hipay#capture(transaction)

Hipay#refund(transaction)

Hipay#cancel(transaction)

Hipay#getFormUrl(order)

Hipay#getTransactionDetails(source)

const source = {
  transactionId: String
};

Or

const source = {
  orderId: String
};

Hipay#getTokenDetails(data)

Hipay#createToken(card)

Hipay#updateToken(data)

Hipay#isCallbackSignatureValid(query)

Hipay#isNotifySignatureValid(rawBody, receivedHash)

Example

const bodyParser = require('body-parser');
const hipay = require('hipay');
const server = require('express')();

hipay.init({
  username: 'john',
  password: 'shhhh',
  passphrase: 'secret',
  mod: 'test'
});

server.use(bodyParser.json());

server.post('/order', async (req, res) => {
  try {
    const hipayResponse = await hipay.order(req.body);

    res.send(hipayResponse);
  } catch(e) {
    res.status(500).send(e);
  }
});

server.listen(3000);

hipay's People

Contributors

ludoblues avatar flasomm avatar

Stargazers

Ron avatar Raphael Simon avatar Benjamin Canac avatar

Watchers

James Cloos avatar  avatar Johan PROTIN avatar

Forkers

roncodes

hipay's Issues

Class instance is mutable

It can not be used in a middleware in case of multi credentials because its properties changes over time :


var hipay = require("hipay")

hipay.init({
    username: 'initial',
    password:'initial'
});
let test = { value: hipay };

console.log(test.value.username); // 'initial'

hipay.init({
    username: 'changed',
    password: 'changed'
});

console.log(test.value.username); // 'changed'

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.