WARNING |
---|
This repository is no longer maintained. |
Provides a wrapper for making requests to SagePay that deals with its custom authentication and request signing, and reducing the results to their simplest form.
Knowledge of the Customised reporting and admin API is essential.
The API uses a tiny subset of XML syntax, so transformation of both requests and responses into simpler Javascript objects is performed. String properties of an object map to text elements of the same name, and visa-versa. Non-string properties, which must be arrays, are mapped to nested elements of the same name as the property, and visa-versa.
const SagepayAdminApiClient = require("sagepay-admin-api");
var client = new SagepayAdminApiClient({
user: "me",
password: "you",
vendor: "acme"
});
client.request({
command: "version"
})
.then(console.log);
node node_modules/sagepay-admin-api/cmd --user me --password you --vendor acme
> request({command:"version"});
A class that provides access to the SagePay Administration and Reporting API.
var foo = new SagepayAdminApiClient(options);
Creates a new instance.
options
Required, connection options.options.endpoint
Optional, defaults to the test system.options.user
Required, passed as theuser
to the API.options.password
Required, used to sign the requests.options.vendor
Required, passed as thevendor
to the API.
var foo = client.request(options);
Makes a request and returns a promise that resolves to the response.
options
Required, values to pass with the request.options.command
Required, the SagePay API requires this at a minimum.
MIT