pankkiyhteys
v1.2.0
Published
[![Build Status](https://travis-ci.org/hyrsky/pankkiyhteys.svg?branch=master)](https://travis-ci.org/hyrsky/pankkiyhteys)
Downloads
16
Readme
Pankkiyhteys
This library is an implementation of Web Services API, a standardised solution used for automated communications between banks and corporate customers.
Currently only Osuuspankki is supported.
For in depth technical documentation about Web Services click here.
Install
Install with npm:
npm install pankkiyhteys
Usage
Autogenerated docs at: https://hyrsky.github.io/pankkiyhteys
Renewing certificate
function isAboutToExpire(key) {
const dateToCheck = new Date()
dateToCheck.setMonth(dateToCheck.getMonth() + 2)
return key.expires() < dateToCheck
}
const key = new Key(oldPrivateKey, oldCert)
const client = new Osuuspankki('1234567890', key, 'FI')
if (key.isAboutToExpire()) {
/**
* You have to:
* * generate new key.
* * save key to persistent storage before renewal.
*/
const keys = await Key.generateKey()
await writeFile('./newkey.pem', keys.privateKey)
const certificate = await client.getCertificate(keys.privateKey)
await writeFile('./newcert.pem', certificate)
}