Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fixing broken tests

  • Loading branch information...
commit 0e6f3d1a20b3e144ee50ba9aedb9af7c027382da 1 parent 90f3463
@jamescarr jamescarr authored
View
2  lib/authorizenet/response-parser.js
@@ -44,7 +44,7 @@ var fieldDefinitions = {
}
-exports.parseResponse = function(response){
+exports.parseResponse = function(request, response){
var result = {}
response.split('|').forEach(function(value, index){
var key = fieldDefinitions[index]
View
1  lib/payflowpro/client.js
@@ -32,7 +32,6 @@ function Client(options, paypal){
options.__defineGetter__('pwd', function(){ return options.password})
var self = this
SUPPORTED_API_METHODS.forEach(function(name){
- console.log('adding ' + name)
self[name] = function(){
var req = {method:name}
for(var i =0; i < arguments.length; i++){
View
2  spec/unit/authorizenet/aim-response-parser.spec.js
@@ -10,7 +10,7 @@ vows.describe('Authorize.net Response Parser').addBatch({
'Mapping response to appropriate field names':{
topic:function(){
var responseFromAuthorize = '1|2|3|(TESTMODE) This transaction has been approved.|000000|P|0|INV223|Sample Transaction|19.99|CC|auth_capture|2222|John|Doe|IBM|1234 Street|Seattle|WA|98004|US|5555555555|5555555556|foo@example.com|John|Dohl|Cisco|4321 Street|St.Louis|MO|68972|US|23.11|1.11|2.33|true|po123|ACF9270B0D46F4900B01115DA202E67F|M|3|||||||||||XXXX1111|Visa||||||||||||||||'
- return response.parseResponse(responseFromAuthorize)
+ return response.parseResponse({}, responseFromAuthorize)
},
'should be parsed into the expected fields':function(result){
assert.deepEqual(result, {
View
10 spec/unit/response-parser.spec.js
@@ -10,7 +10,7 @@ var vows = require('vows'),
vows.describe('Response Parser').addBatch({
'Parsing your average response': {
- topic: response.parseResponse("CCV2=A&ACK=Success&CORRELATIONID=111")
+ topic: response.parseResponse({}, "CCV2=A&ACK=Success&CORRELATIONID=111")
,
'should lowercase each key': function(topic){
assert.deepEqual(['ccv2', 'ack', 'correlationid'], Object.keys(topic))
@@ -21,7 +21,7 @@ vows.describe('Response Parser').addBatch({
assert.equal('111', topic.correlationid)
}
}, 'Parsing error details': {
- topic: response.parseResponse('ACK=Fail&L_ERRORCODE0=12345&L_SHORTMESSAGE0=Epic Fail'),
+ topic: response.parseResponse({}, 'ACK=Fail&L_ERRORCODE0=12345&L_SHORTMESSAGE0=Epic Fail'),
'should parse in side a nested array':function(topic){
assert.isArray(topic.errors)
},
@@ -35,7 +35,7 @@ vows.describe('Response Parser').addBatch({
},
},'Parse multiple error details':{
- topic:response.parseResponse('L_ERRORCODE0=100&L_SHORTMESSAGE0=Epic Fail&L_ERRORCODE1=200&L_SHORTMESSAGE1=Whale Fail'),
+ topic:response.parseResponse({}, 'L_ERRORCODE0=100&L_SHORTMESSAGE0=Epic Fail&L_ERRORCODE1=200&L_SHORTMESSAGE1=Whale Fail'),
'should parse as individual entries in the array in order':function(topic){
var errors = topic.errors
@@ -46,7 +46,7 @@ vows.describe('Response Parser').addBatch({
assert.equal(2, topic.errors.length)
}
},'More list items than error details': {
- topic: response.parseResponse('ACK=Fail&L_ERRORCODE0=12345&L_SHORTMESSAGE0=Epic Fail&L_AMT0=22.33&L_LONGMESSAGE0=long msg&L_SEVERITYCODE0=9&L_CURRENCYCODE0=USD'),
+ topic: response.parseResponse({}, 'ACK=Fail&L_ERRORCODE0=12345&L_SHORTMESSAGE0=Epic Fail&L_AMT0=22.33&L_LONGMESSAGE0=long msg&L_SEVERITYCODE0=9&L_CURRENCYCODE0=USD'),
'should parse only relevant error fields for error':function(topic){
assert.deepEqual(['errorcode', 'shortmessage', 'longmessage', 'severitycode'], Object.keys(topic.errors[0]))
},
@@ -56,7 +56,7 @@ vows.describe('Response Parser').addBatch({
},
'create nested structure for paymentinfo':{
topic:
- response.parseResponse('paymentrequest_0_amt=22.00&paymentrequest_1_taxamt=4.67&paymentrequest_1_amt=22.91&paymentrequest_0_taxamt=2.67')
+ response.parseResponse({}, 'paymentrequest_0_amt=22.00&paymentrequest_1_taxamt=4.67&paymentrequest_1_amt=22.91&paymentrequest_0_taxamt=2.67')
,
'should create array of paymentrequest':function(topic){
assert.isArray(topic.paymentrequest)
Please sign in to comment.
Something went wrong with that request. Please try again.