pxpay2
Version:
A node module for using the Payment Express PXPay 2.0 service for payment processing including response parsing
26 lines (25 loc) • 973 B
JavaScript
var assert = require('assert');
var pxpay = require('./index.js');
var qconf = require('qconf'),
config = qconf(),
xpath = require('xpath'),
dom = require('xmldom').DOMParser;
var options ={
user: config.get('user'),
password: config.get('password'),
amount: '1.00',
reference: 'Test',
line1: '1 Street Rd',
line2: 'Some Suburb',
line3: 'Testville',
email: 'test@example.com',
TxnId: 'test-'+Date.now(),
addCard: 1,
successURL: 'http://example.com/success',
failURL: 'http://example.com/fail'
};
var rq = pxpay.generateRequest(options);
console.log(rq);
var doc = new dom().parseFromString(rq);
var addBill = xpath.select("/GenerateRequest/EnableAddBillCard/text()", doc).toString();
assert.equal(addBill, 1, "The Node value should be 1");