Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

1.1.1

  • Loading branch information...
commit 0e54c37bb89eb3c82ae2374776e265338ba912af 1 parent f4ed7ba
@braintreeps braintreeps authored
View
4 CHANGELOG.md
@@ -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
2  lib/braintree.coffee
@@ -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
View
5 lib/braintree/credit_card_gateway.coffee
@@ -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
View
7 lib/braintree/transparent_redirect_gateway.coffee
@@ -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
2  package.json
@@ -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",
View
2  spec/integration/braintree/credit_card_gateway_spec.coffee
@@ -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) ->
View
12 spec/unit/braintree/credit_card_gateway_spec.coffee
@@ -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)
View
36 spec/unit/braintree/transparent_redirect_gateway_spec.coffee
@@ -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)
Please sign in to comment.
Something went wrong with that request. Please try again.