Code Monkey home page Code Monkey logo

newebpay's Introduction

NewebPay Implementation

CircleCI

  • Referencing NewebPay API Document to perform API calling and bundle it into a module

How to install

npm install newebpay

How to use

  • Declare for the module globally
const { TradeModules } = require('newebpay');

Before version 0.0.11

  • Initialize module
const trade = new TradeModules(
 'your domain information <string>',
 'your newebpay MerchantID <string>',
 'your newebpay HashKey <string>',
 'your newebpay HashIV <string>',
 'newebpay PayGateWay <string>',
 'your newebpay ClientBackURL <string>'
);

After version 0.0.11

  • Initialize module
const trade = new TradeModules();

CallIng API

Before version 0.0.11

  • When you want to return tradeInfo then calling Newebpay Authorization
const tradeInfo = trade.getTradeInfo(
  Amt: number,
  DESC: string,
  email: string
);
  • Expecting tradeInfo output example
{
  "MerchantID": "your newebpay MerchantID <string>",
  "TradeInfo": "aes256 encryption",
  "TradeSha": "sha256 hashing",
  "Version": "1.5",
  "PayGateWay": "https://ccore.spgateway.com/MPG/mpg_gateway",
  "MerchantOrderNo": "1581686501236"
}
  • When you want Decrypt Newebpay Feedback Information
const tradeData = JSON.parse(trade.createMpgAesDecrypt(TradeInfo));

After version 0.0.11

  • Set the trade config
const trade = await tradeModules.setTrade({
  URL: 'your domain information <string>',
  MerchantID: 'your newebpay MerchantID <string>',
  HashKey: 'your newebpay HashKey <string>',
  HashIV: 'your newebpay HashIV <string>',
  PayGateWay: 'newebpay PayGateWay <string>',
  ClientBackURL: 'your newebpay ClientBackURL <string>',
});
  • When you want to return tradeInfo then calling Newebpay Authorization
const tradeInfo = trade.getTradeInfo(
  Amt: number,
  DESC: string,
  email: string
);
  • Expecting tradeInfo output example
{
  "MerchantID": "your newebpay MerchantID <string>",
  "TradeInfo": "aes256 encryption",
  "TradeSha": "sha256 hashing",
  "Version": "1.5",
  "PayGateWay": "https://ccore.spgateway.com/MPG/mpg_gateway",
  "MerchantOrderNo": "1581686501236"
}
  • When you want Decrypt Newebpay Feedback Information
const tradeData = trade.createMpgAesDecrypt(TradeInfo);
  • Expecting tradeData output example
{
  "MerchantID": "test1test1",
  "RespondType": "JSON",
  "TimeStamp": "1581755183872",
  "Version": "1.5",
  "MerchantOrderNo": "1581755183872",
  "LoginType": "0",
  "OrderComment": "OrderComment",
  "Amt": "3700",
  "ItemDesc": "1",
  "Email": "[email protected]",
  "ReturnURL": "http://localhost:3000/ReturnURL",
  "NotifyURL": "http://localhost:3000/NotifyURL",
  "ClientBackURL": "http://localhost:3000/ClientBackURL"
}

ChangeLog

ChangeLog

CopyRight

Copyright © 2020, 11. Released under the MIT License.

newebpay's People

Contributors

libterty avatar dependabot[bot] avatar

Stargazers

Tiennan Lin (Danny) avatar Donma Hsu avatar Bibby avatar John Huang avatar Ben Peng avatar Mina Huang avatar

Watchers

 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.