auth-net-types
Advanced tools
Comparing version 1.2.0 to 1.2.1
@@ -142,4 +142,9 @@ var xml = require('xml'); | ||
this.customerProfileId = options.customerProfileId || ''; | ||
this.shipToList = new AuthorizeShippingAddress(options.shipToList); | ||
this.paymentProfiles = new AuthorizePaymentProfiles(options.paymentProfiles); | ||
if (options.shipToList) { | ||
this.shipToList = new AuthorizeShippingAddress(options.shipToList); | ||
} | ||
if (options.paymentProfiles) { | ||
this.paymentProfiles = new AuthorizePaymentProfiles(options.paymentProfiles); | ||
} | ||
}; | ||
@@ -155,4 +160,7 @@ | ||
addXmlObjToList(xmlObj.profile, 'email', this.email); | ||
xmlObj.profile = xmlObj.profile.concat(this.paymentProfiles.toXmlObjList()); | ||
if (this.shipToList.length > 0) { | ||
if (this.paymentProfiles && this.paymentProfiles.length) { | ||
xmlObj.profile = xmlObj.profile.concat(this.paymentProfiles.toXmlObjList()); | ||
} | ||
if (this.shipToList && this.shipToList.length) { | ||
xmlObj.profile.push({ shipToList: this.shipToList.toXmlObjList() }); | ||
@@ -159,0 +167,0 @@ } |
{ | ||
"name": "auth-net-types", | ||
"version": "1.2.0", | ||
"version": "1.2.1", | ||
"description": "A collection of Authorize.net's types/data types/xml objects.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -19,2 +19,4 @@ var Types = require(__dirname + '/../index') | ||
expect(Customer.customerProfileId).to.equal(1234); | ||
expect(Customer.shipToList).to.not.exist; | ||
expect(Customer.paymentProfiles).to.not.exist; | ||
expect(Customer.toXml()).to.equal('<profile><merchantCustomerId>123</merchantCustomerId><description>A customer with a lot of cash & stuff.</description><email>completelyfake@dontemail.com</email></profile>'); | ||
@@ -21,0 +23,0 @@ |
127516
2417