Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

magento-api-xmlrpc-icw

latheesan-k50MIT1.0.2

Magento XMLRPC wrapper for Node.js. This is the most reliable and up to date wrapper, including bug fixes and extended feature support for Ebizmart SagePay api end-points.

magento, api, xml, xml-rpc, latheesan, kanesamoorthy

readme

Magento XMLRPC API Wrapper

Forked from https://www.npmjs.com/package/magento-api-xmlrpc, Updated by Latheesan Kanesamoorthy - specifically for Infinite Codeworks.

This wrapper lets you talk to Magento v1.x via XMLRPC. This is the most reliable and up to date magento wrapper, with lots of bug fixes and extended support for Ebizmart SagePay api end-points.

Original wrapper: bitbucket.org/icecom/magentoapi , developed by https://www.npmjs.com/~icecom and https://www.npmjs.com/~2ps.

Installation

npm i -S magento-api-xmlrpc-icw

Usage

const MagentoAPI = require('magento-api-xmlrpc-icw');

const magentoAPI = new MagentoAPI({
    host: 'shop-domain.com',
    port: 80,
    path: '/api/xmlrpc/',
    login: 'api_username',
    pass: 'api_password'
});

magentoAPI.login((error, sessionId) =>
{
    // Error
    if (error) {
        console.log('error', error);
        return;
    }

    // Test
    console.log('sessionId', sessionId);

    // Rest of your code...
});

If need be, you can manually change the session id.

magentoAPI.changeSession(newSessionId);

(Ebizmart) Sage Pay API Usage

List transactions

magentoAPI.sagePayTransaction.list((error, transactionList) => {
    if (error) {
        console.log('error', error);
        return;
    }
    console.log(transactionList);
});

Transaction Info

let request = { 
    'vpstxcode': 'EA049E74-A774-4322-80E6-1B317A90C2EB' 
};
magentoAPI.sagePayTransaction.info(request, (error, transactionInfo) => {
    if (error) {
        console.log('error', error);
        return;
    }
    console.log(transactionInfo);
});

All of the API methods take an object of params as the first argument, and a callback as the second.

Or, if no params are sent, just a callback as the first argument.

Methods