Permalink
Browse files

1.2.0

  • Loading branch information...
1 parent 1b84b0c commit 83844dbd0d46a806267eb68b3067a7213d001377 @braintreeps braintreeps committed Sep 13, 2012
Showing with 69 additions and 1 deletion.
  1. +4 −0 CHANGELOG.md
  2. +5 −0 lib/braintree/credit_card.coffee
  3. +1 −1 package.json
  4. +59 −0 spec/integration/braintree/credit_card_gateway_spec.coffee
View
@@ -1,3 +1,7 @@
+## 1.2.0
+
+* Add prepaid field to credit card (possible values include Yes, No, Unknown)
+
## 1.1.2
* Compatibility with Node 0.8.x
@@ -24,6 +24,11 @@ class CreditCard extends AttributeSetter
International : 'international'
US : 'us'
+ @Prepaid =
+ Yes : "Yes"
+ No : "No"
+ Unknown : "Unknown"
+
constructor: (attributes) ->
super attributes
@maskedNumber = "#{@bin}******#{@last4}"
View
@@ -1,6 +1,6 @@
{
"name" : "braintree",
- "version" : "1.1.2",
+ "version" : "1.2.0",
"description" : "A library for integrating with Braintree.",
"keywords" : ["payments"],
"homepage" : "http://github.com/braintree/braintree_node",
@@ -2,6 +2,7 @@ require('../../spec_helper')
_ = require('underscore')._
braintree = specHelper.braintree
util = require('util')
+{CreditCard} = require('../../../lib/braintree/credit_card')
vows
.describe('CreditCardGateway')
@@ -204,6 +205,64 @@ vows
'returns a not found error': (err, address) ->
assert.equal(err.type, braintree.errorTypes.notFoundError)
+ 'prepaid':
+ 'with a prepaid card':
+ topic: () ->
+ callback = @callback
+ specHelper.defaultGateway.customer.create(
+ firstName: 'John',
+ lastName: 'Smith'
+ , (err, response) ->
+ specHelper.defaultGateway.creditCard.create(
+ customerId: response.customer.id,
+ number: '4500600000000061',
+ expirationDate: '05/2012',
+ options: {
+ verifyCard: true
+ }
+ , callback))
+ undefined
+ 'sets the prepaid field to Yes': (err, response) ->
+ assert.equal(response.creditCard.prepaid, CreditCard.Prepaid.Yes)
+
+ 'with a non-prepaid card':
+ topic: () ->
+ callback = @callback
+ specHelper.defaultGateway.customer.create(
+ firstName: 'John',
+ lastName: 'Smith'
+ , (err, response) ->
+ specHelper.defaultGateway.creditCard.create(
+ customerId: response.customer.id,
+ number: '4111111111111111',
+ expirationDate: '05/2012',
+ options: {
+ verifyCard: true
+ }
+ , callback))
+ undefined
+ 'sets the prepaid field to No': (err, response) ->
+ assert.equal(response.creditCard.prepaid, CreditCard.Prepaid.No)
+
+ 'with an un-identified card':
+ topic: () ->
+ callback = @callback
+ specHelper.defaultGateway.customer.create(
+ firstName: 'John',
+ lastName: 'Smith'
+ , (err, response) ->
+ specHelper.defaultGateway.creditCard.create(
+ customerId: response.customer.id,
+ number: '5555555555554444',
+ expirationDate: '05/2012',
+ options: {
+ verifyCard: true
+ }
+ , callback))
+ undefined
+ 'sets the prepaid field to Unknown': (err, response) ->
+ assert.equal(response.creditCard.prepaid, CreditCard.Prepaid.Unknown)
+
'update':
'for a minimal case':
topic: () ->

0 comments on commit 83844db

Please sign in to comment.