Skip to content

Commit

Permalink
1.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
braintreeps committed Jun 14, 2012
1 parent f4ed7ba commit 0e54c37
Show file tree
Hide file tree
Showing 8 changed files with 65 additions and 5 deletions.
4 changes: 4 additions & 0 deletions 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
Expand Down
2 changes: 1 addition & 1 deletion lib/braintree.coffee
Expand Up @@ -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
5 changes: 4 additions & 1 deletion lib/braintree/credit_card_gateway.coffee
Expand Up @@ -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
7 changes: 6 additions & 1 deletion lib/braintree/transparent_redirect_gateway.coffee
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion 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",
Expand Down
2 changes: 1 addition & 1 deletion spec/integration/braintree/credit_card_gateway_spec.coffee
Expand Up @@ -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) ->
Expand Down
12 changes: 12 additions & 0 deletions 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)
36 changes: 36 additions & 0 deletions 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)

0 comments on commit 0e54c37

Please sign in to comment.