durango / authorize-net-cim

Authorize.net CIM bindings for Node.JS
14 stars 5 forks source link

transactionTypes issues #8

Closed sean-hill closed 9 years ago

sean-hill commented 9 years ago

This library defines transaction types as

this.transactionTypes = [
    'AuthOnly', 'AuthCapture',
    'CaptureOnly', 'PriorAuthCapture',
    'Refund', 'Void'
];

But in the createCustomerProfileTransaction this line of code prevents Refund or Void requests.

if (transactionType !== "AuthCapture" && transactionType !== "AuthOnly" && transactionType !== "CaptureOnly" && transactionType !== "PriorAuthCapture") {
    throw new Error('Invalid transactionType. Must be: AuthCapture, AuthOnly, CaptureOnly, or PriorAuthCapture');
}

This could be fixed by this code

if (this.transactionTypes.indexOf(transactionType) === -1) {
    throw new Error('Invalid transactionType. Must be: ' + this.transactionTypes.join(', '));
}

@durango if this could be fixed that'd be great!

durango commented 9 years ago

Sorry for the delay! Things got in the way, thanks for the PR on this though. Really appreciate it.