1.0.1-0.1 • Published 2 years ago

@digipharm/moneryze v1.0.1-0.1

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

moneryze

Currently only supports vault transactions, more will be added soon

NPM version  Build Status  Coverage Status  License: MIT

A wrapper to access the Moneris API, forked from AlejandroEsquivel's great work (AlejandroEsquivel/moneris-js), forked from shaynair's great work (shaynair/moneris-js)

The hope for this module is to create clean, robust, promise wrapped queries that extend just beyond payments. Shaynair's work supported generalized queries to Moneris, Alejandro's work handled the imperfect formatting. My hope is to extend and complete the wrapper, transforming the project into something easy to implement by any developer.

Installation | Usage | Example | License

Installation

With npm:

npm install moneryze --save

Note: You need an engine that supports ES6 (e.g. Babel or Node 4.0+).

General Usage

const moneris = require('moneryze');

Queries the Moneris API with the information provided.

  • config: Required. An object with the following fields.
    • app_name: Optional. If given, will add app_name as a prefix to receipt names.
    • api_token: Required. Your API token.
    • store_id: Required. Your store ID.
    • crypt_type: Optional. If given, will set the default crypt_type for all transactions. 7 by default.
    • test: Optional. If true, uses Moneris Test endpoints. You can get a api_token and store_id for this endpoint from Moneris's Documentation. false by default.

.init() must be called before any other operation, otherwise an error will be thrown

Examples

.init()

moneris.init({
  app_name: 'Test',
  store_id: 'store5',
  api_token: 'yesguy',
  crypt_type: '7',
  test: true,
});

.resAddCC()

  • pan: Required. Card number.
  • expdate: Required. Expiry date of the card.
moneris.resAddCC({
  pan: '4242424242424242',
  expdate: '2011',
});

.resPurchaseCC()

  • token: Required. Customer's moneris token.
  • amount: Required. Amount to charge.
  • description: Optional. A short message attached to the purchase.
moneris.resPurchaseCC({
  token: 'D8WyyItuNb6mHn4biiPqAwM42',
  amount: 11.98,
  description: 'bubble tea',
});

.purchase()

  • pan: Required. Card number.
  • expdate: Required. Expiry date of the card.
  • amount: Required. Amount to charge.
  • description: Optional. A short message attached to the purchase.
moneris.resPurchaseCC({
  pan: '4242424242424242',
  expdate: '2011',
  amount: 11.98,
  description: 'bubble tea',
});

.refund()

  • order_id: Required. The ID of the order from the transaction.
  • txn_number: Required.. The number from the transaction.
  • amount: Required. Amount to refund.
moneris.refund({
  order_id: 'mvt2713618548',
  txn_number: '911464-0_10',
  amount: 11.98,
});

.preauth()

  • order_id: Required. The ID of the order for the preauthorization.
  • amount: Required. Amount to preauthorize.
  • pan: Required. Card number.
  • expdate: Required. Expiry date of the card.
moneris.refund({
  order_id: 'mvt2713618548',
  amount: 11.98,
  pan: '4242424242424242',
  expdate: '2011'
});

.completion()

  • order_id: Required. The ID of the order for the preauthorization.
  • amount: Required. Completion amount.
  • txn_number: Required.. The number from the transaction.
moneris.completion({
  order_id: 'mvt2713618548',
  amount: 11.98,
  txn_number: '911464-0_10',
});

License

MIT

Notes

With love and passion,

wuon