SDK to communicate with the Online Payments platform using the Online Payments Server API
npm install onlinepayments-sdk-nodejsThe Node.js SDK helps you to communicate with the payment platform server API. Its primary features are:
* convenient JavaScript wrapper around the API calls,
* authentication of all calls
* logging support by proxying log calls to a custom user defined logger instance
* validation of input and
* a logfile obfuscater
See the Online Payments Developer Hub
for more information on how to use the API.
This repository consists out of three main components:
1. The source code of the SDK itself: /src
2. The JSON schemas used to validate requests: /schemas
3. Unit and integration tests: /__tests__
Node.js 18 or higher is required.
From the folder where your package.json is located, run the following command to install the SDK:
npm i onlinepayments-sdk-nodejs
From the root of the project install all dependencies, then compile the code:
npm install
npm run build
There are two types of tests:
1. Unit tests. These will work out-of-the-box.
Run these tests as follows:
```
npm run test:unit
__tests__/config.json.dist
2. Integration tests. Before you can run these, you first need to copy file to__tests__/config.json
and replace all values as needed. If needed, a proxy property can be added with nestedhost
properties , scheme (defaults to http), port (defaults to 3128) and credentials (optional, in the
format ).
Run these tests as follows:
```
npm run test:integration
You can also run both types of tests together as follows:
npm run test