0.1.2 • Published 7 years ago

liha-swish-module v0.1.2

Weekly downloads
-
License
Unlicense
Repository
-
Last release
7 years ago

Swish Module

This is a minimal node interface to the Swish API

Usage

Require package

this package is a private and its main repo is located at gitlab. in your package.json, add the following:

”liha-swish-module”: "git+ssh://git@gitlab.com:liha/liha-swish-module.git#master"

Example package.json file

{
  "name": "test",
  "version": "1.0.0",
  "description": "test project",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC",
  "dependencies" : {
    "liha-swish-module": "git+ssh://git@gitlab.com:liha/liha-swish-module.git#master"
  }
}

Instantiate module

The module provides a constructor function which requires a options object. See example below:

var initConfig = {
    swishPath: 'https://mss.swicpc.bankgirot.se/swish-cpcapi/api/v1/', // <-- leave out refunds/ or paymentrequests/
    certPath: 'String',
    caPath: 'String',
    keyPath: 'String'
    callbackUrlPayments: 'https://eab-quiz.herokuapp.com/api/payments/',
    callbackUrlRefunds: 'https://eab-quiz.herokuapp.com/api/refunds/',
    merchantId: '1231181189',
    passphrase: 'your passphrase to key',
    demoMode: false // <-- if demoMode is set to true no certpaths or passphrase is needed
    rejectUnauthorized: false // <-- optional
};

var Swish = require('swish');

var swish = new Swish(initConfig);

Methods

createPayment(customerId, payeeReference, amount, message)

Returns: Promise

readPayment(swishPaymentId)

Returns: Promise

createRefund(swishPaymentReference, amount, message)

Returns: Promise

readRefund(swishRefundId)

Returns: Promise

0.1.2

7 years ago