opayo-reporting-api
v1.0.5
Published
A module to allow easy usage of Opayo Reporting & Admin Api
Downloads
31
Maintainers
Readme
Opayo Reporting API
A module to allow easy usage of Opayo Reporting & Admin Api https://developer-eu.elavon.com/docs/opayo-reporting-api
Installation
npm install opayo-reporting-api
Usage
import { OpayoReportingApi } from 'opayo-reporting-api';
// or
// var OpayoReportingApi = require("opayo-reporting-api").OpayoReportingApi
var opayo = new OpayoReportingApi('vendor', 'username', 'passsword')
var validIPs = await opayo.command('getValidIPs')
console.log(validIPs.vspaccess.ipaddresses)
await opayo.command('addValidIPs', {
validips: {
ipaddress: [
{
address: "123.123.123.123",
mask: "255.255.255.255",
note: "test IP address"
}
]
}
})
validIPs = await opayo.command('getValidIPs')
console.log(validIPs.vspaccess.ipaddresses)
All commands are available to see in Opayo Reporting & Admin API Reference.
The second argument of OpayoReportingApi.command
method is the object that will be converted into XML. However, you shouldn't add there command
, vendor
, username
and signature
as those values will be added automatically by this module.
Response of that method is a JavaScript object representing XML structure of the
API response. Including the vspaccess
key.
Constructor
Constructor takes 4 arguments:
vendor: string
- Opayo vendor nameusername: string
- Opayo usernamepassword: string
- Opayo passwordoption: OpayoReportingApiOptions
- options for this module
OpayoReportingApiOptions
This is an options object allowing to change behaviour of module.
Allowed options:
baseURL: string
- allows entering custom API url. Overrides testMode value.testMode: boolean
- whether use test or live mode (does not make difference if baseURL is specified).axiosConfig: AxiosRequestConfig
- custom axios configuration. Specifying baseURL won't make any change.