Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

1.6.0

  • Loading branch information...
commit 578eba2b8a6379248764454b84ea95e09c871e49 1 parent f4cfc6f
@braintreeps braintreeps authored
View
4 CHANGELOG.md
@@ -1,3 +1,7 @@
+## 1.6.0
+
+* Adds channel field to transactions.
+
## 1.5.0
* Adds country of issuance and issuing bank
View
2  lib/braintree.coffee
@@ -7,6 +7,6 @@ connect = (config) ->
new BraintreeGateway(new Config(config))
exports.connect = connect
-exports.version = '1.5.1'
+exports.version = '1.6.0'
exports.Environment = Environment
exports.errorTypes = errorTypes
View
2  package.json
@@ -1,6 +1,6 @@
{
"name" : "braintree",
- "version" : "1.5.1",
+ "version" : "1.6.0",
"description" : "A library for integrating with Braintree.",
"keywords" : ["payments"],
"homepage" : "http://github.com/braintree/braintree_node",
View
36 spec/integration/braintree/credit_card_verification_gateway_spec.coffee
@@ -1,4 +1,6 @@
require('../../spec_helper')
+{CreditCardNumbers} = require('../../../lib/braintree/test/credit_card_numbers')
+{CreditCard} = require('../../../lib/braintree/credit_card')
braintree = specHelper.braintree
@@ -38,4 +40,38 @@ vows
'returns a not found error': (err, response) ->
assert.equal(err.type, braintree.errorTypes.notFoundError)
+ 'when using a card with card type indicators':
+ topic: ->
+ callback = @callback
+ name = specHelper.randomId() + ' Smith'
+ specHelper.defaultGateway.customer.create({
+ creditCard:
+ cardholderName: name,
+ number: CreditCardNumbers.CardTypeIndicators.Unknown,
+ expirationDate: '05/12',
+ options:
+ verifyCard: true
+ }, (err, response) ->
+ specHelper.defaultGateway.creditCardVerification.search((search) ->
+ search.creditCardCardholderName().is(name)
+ , (err, response) ->
+ response.first((err, result) ->
+ callback(err,
+ verification: result
+ name: name
+ )
+ )
+ )
+ )
+ undefined
+ 'card details card type indicator should be prepaid': (err, result) ->
+ assert.isNull(err)
+ assert.equal(result.verification.creditCard.cardholderName, result.name)
+ assert.equal(result.verification.creditCard.prepaid, CreditCard.Prepaid.Unknown)
+ assert.equal(result.verification.creditCard.durbinRegulated, CreditCard.DurbinRegulated.Unknown)
+ assert.equal(result.verification.creditCard.commercial, CreditCard.Commercial.Unknown)
+ assert.equal(result.verification.creditCard.healthcare, CreditCard.Healthcare.Unknown)
+ assert.equal(result.verification.creditCard.debit, CreditCard.Debit.Unknown)
+ assert.equal(result.verification.creditCard.payroll, CreditCard.Payroll.Unknown)
+
.export(module)
View
24 spec/integration/braintree/transaction_gateway_spec.coffee
@@ -2,6 +2,8 @@ require('../../spec_helper')
{_} = require('underscore')
braintree = specHelper.braintree
+{CreditCardNumbers} = require('../../../lib/braintree/test/credit_card_numbers')
+{CreditCard} = require('../../../lib/braintree/credit_card')
createTransactionToRefund = (callback) ->
specHelper.defaultGateway.transaction.sale(
@@ -230,6 +232,24 @@ vows
'sets recurring to true': (err, response) ->
assert.equal(response.transaction.recurring, true)
+ 'when using a card with card type indicators':
+ topic: ->
+ specHelper.defaultGateway.transaction.sale(
+ amount: '5.00'
+ creditCard:
+ number: CreditCardNumbers.CardTypeIndicators.Unknown
+ expirationDate: '05/12'
+ , @callback)
+ undefined
+ 'has cardtype indicator fields in result': (err, response) ->
+ assert.equal(response.transaction.creditCard.prepaid, CreditCard.Prepaid.Unknown)
+ assert.equal(response.transaction.creditCard.durbinRegulated, CreditCard.DurbinRegulated.Unknown)
+ assert.equal(response.transaction.creditCard.commercial, CreditCard.Commercial.Unknown)
+ assert.equal(response.transaction.creditCard.healthcare, CreditCard.Healthcare.Unknown)
+ assert.equal(response.transaction.creditCard.debit, CreditCard.Debit.Unknown)
+ assert.equal(response.transaction.creditCard.payroll, CreditCard.Payroll.Unknown)
+
+
'when processor declined':
topic: ->
specHelper.defaultGateway.transaction.sale(
@@ -476,6 +496,7 @@ vows
, (err, result) ->
specHelper.defaultGateway.transaction.cloneTransaction(result.transaction.id,
amount: '123.45'
+ channel: 'MyShoppingCartProvider'
options:
submitForSettlement: 'false'
, callback)
@@ -483,9 +504,10 @@ vows
undefined
'is successful': (err, response) ->
assert.isTrue(response.success)
- 'it copies fields': (err, response) ->
+ 'it copies and updates fields': (err, response) ->
transaction = response.transaction
assert.equal(transaction.amount, '123.45')
+ assert.equal(transaction.channel, 'MyShoppingCartProvider')
assert.equal(transaction.creditCard.maskedNumber, '510510******5100')
assert.equal(transaction.creditCard.expirationDate, '05/2012')
Please sign in to comment.
Something went wrong with that request. Please try again.