Permalink
Browse files

1.1.1

  • Loading branch information...
braintreeps committed Jun 14, 2012
1 parent f4ed7ba commit 0e54c37bb89eb3c82ae2374776e265338ba912af
View
@@ -1,3 +1,7 @@
+## 1.1.1
+* Fix dateFormat bug with months after October in CreditCardGateway
+* Fix TransparentRedirecteGateway url method to return full url (thanks to [sberryman](https://github.com/sberryman))
+
## 1.1.0
* Add webhook gateways for parsing, verifying, and testing incoming notifications
View
@@ -7,6 +7,6 @@ connect = (config) ->
new BraintreeGateway(new Config(config))
exports.connect = connect
-exports.version = '1.1.0'
+exports.version = '1.1.1'
exports.Environment = Environment
exports.errorTypes = errorTypes
@@ -36,7 +36,10 @@ class CreditCardGateway extends Gateway
dateFormat: (date) ->
month = date.getMonth() + 1
- month = "0#{month}" if month < 10
+ if month < 10
+ month = "0#{month}"
+ else
+ month = "#{month}"
return month + date.getFullYear()
exports.CreditCardGateway = CreditCardGateway
@@ -16,7 +16,12 @@ class TransparentRedirectGateway
CREATE_TRANSACTION: 'create_transaction'
constructor: (@gateway) ->
- @url = "#{@gateway.config.baseMerchantPath}/transparent_redirect_requests"
+ uriScheme = if @gateway.config.environment.ssl then 'https://' else 'http://'
+ fullHost = if @gateway.config.environment is braintree.Environment.Development
+ "#{@gateway.config.environment.server}:#{@gateway.config.environment.port}"
+ else
+ @gateway.config.environment.server
+ @url = "#{uriScheme}#{fullHost}#{@gateway.config.baseMerchantPath}/transparent_redirect_requests"
generateTrData: (inputData) ->
data = Util.convertObjectKeysToUnderscores(inputData)
View
@@ -1,6 +1,6 @@
{
"name" : "braintree",
- "version" : "1.1.0",
+ "version" : "1.1.1",
"description" : "A library for integrating with Braintree.",
"keywords" : ["payments"],
"homepage" : "http://github.com/braintree/braintree_node",
@@ -165,7 +165,7 @@ vows
after = new Date("2016-10-01")
specHelper.defaultGateway.creditCard.expiringBetween(before, after, (err, searchResult) ->
- callback(null, {testCard: testCard, searchResult: searchResult})))
+ callback(err, {testCard: testCard, searchResult: searchResult})))
undefined
'has no errors': (err, result) ->
@@ -0,0 +1,12 @@
+require('../../spec_helper')
+{CreditCardGateway} = require('../../../lib/braintree/credit_card_gateway')
+
+vows
+ .describe('CreditCardGateway')
+ .addBatch
+ 'dateFormat':
+ 'month boundary':
+ topic: (new CreditCardGateway(specHelper.gateway)).dateFormat(new Date('2016-10-1'))
+ 'returns the expected date format': (result) ->
+ assert.equal(result, '102016')
+ .export(module)
@@ -0,0 +1,36 @@
+require('../../spec_helper')
+
+{TransparentRedirectGateway} = require('../../../lib/braintree/transparent_redirect_gateway')
+
+vows
+ .describe('TransparentRedirectGateway')
+ .addBatch
+ 'url':
+ 'sandbox environment':
+ topic: ->
+ sandboxConfig = {
+ environment: braintree.Environment.Sandbox
+ merchantId: 'integration_merchant_id'
+ }
+ new TransparentRedirectGateway(braintree.connect(sandboxConfig))
+ 'gives full dev url': (result) ->
+ assert.equal(result.url, 'https://sandbox.braintreegateway.com/merchants/integration_merchant_id/transparent_redirect_requests')
+ 'production environment':
+ topic: ->
+ sandboxConfig = {
+ environment: braintree.Environment.Production
+ merchantId: 'integration_merchant_id'
+ }
+ new TransparentRedirectGateway(braintree.connect(sandboxConfig))
+ 'gives full dev url': (result) ->
+ assert.equal(result.url, 'https://www.braintreegateway.com/merchants/integration_merchant_id/transparent_redirect_requests')
+ 'development environment':
+ topic: ->
+ sandboxConfig = {
+ environment: braintree.Environment.Development
+ merchantId: 'integration_merchant_id'
+ }
+ new TransparentRedirectGateway(braintree.connect(sandboxConfig))
+ 'gives full dev url': (result) ->
+ assert.equal(result.url, "http://localhost:#{result.gateway.config.environment.port}/merchants/integration_merchant_id/transparent_redirect_requests")
+ .export(module)

0 comments on commit 0e54c37

Please sign in to comment.