Skip to content
This repository was archived by the owner on Sep 28, 2021. It is now read-only.

Commit 3749f83

Browse files
committed
1.16.0
1 parent df42350 commit 3749f83

21 files changed

+1177
-72
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
## 1.16.0
2+
* Allow credit card verification options to be passed outside of the nonce for PaymentMethod.create
3+
* Allow billing_address parameters and billing_address_id to be passed outside of the nonce for PaymentMethod.create
4+
* Add Subscriptions to paypal accounts
5+
* Add PaymentMethod.update
6+
* Add fail_on_duplicate_payment_method option to PaymentMethod.create
7+
* Add supoort for dispute webhooks
8+
19
## 1.15.0
210
* Support for v.zero SDKs.
311

Rakefile

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,18 @@ namespace :spec do
88

99
desc "Run integration"
1010
task :integration => [:npm_install, :compile_coffee] do
11-
sh "#{local_mocha} spec_compiled/integration --recursive"
11+
sh "#{local_mocha} --slow 2000 spec_compiled/integration --recursive"
1212
end
1313

1414
desc "Run tests in a specific file, e.g. rake spec:focused[spec/integration/braintree/credit_card_gateway_spec]"
1515
task :focused, [:filename] => [:npm_install, :compile_coffee] do |t, args|
1616
compiled_filename = args[:filename].sub(/\Aspec/, "spec_compiled").sub(/\.coffee\z/, ".js")
1717

18-
sh "#{local_mocha} #{compiled_filename}"
18+
command = local_mocha
19+
if args[:filename].include? "integration"
20+
command += " --slow 2000"
21+
end
22+
sh "#{command} #{compiled_filename}"
1923
end
2024
end
2125

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name" : "braintree",
3-
"version" : "1.15.0",
3+
"version" : "1.16.0",
44
"description" : "A library for integrating with Braintree.",
55
"keywords" : ["payments"],
66
"homepage" : "http://github.com/braintree/braintree_node",

spec/integration/braintree/client_token_gateway_spec.coffee

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ describe "ClientTokenGateway", ->
1717
sharedCustomerIdentifierType: "testing"
1818
}
1919

20-
myHttp.get("/client_api/nonces.json", params, (statusCode) ->
20+
myHttp.get("/client_api/v1/payment_methods.json", params, (statusCode) ->
2121
assert.equal(statusCode, 200)
2222
done()
2323
)
@@ -41,7 +41,7 @@ describe "ClientTokenGateway", ->
4141
decoded_client_token = new Buffer(encoded_client_token, "base64").toString("utf8")
4242
unescaped_client_token = decoded_client_token.replace("\\u0026", "&")
4343
clientToken = JSON.parse(decoded_client_token)
44-
assert.equal(clientToken.version, "2")
44+
assert.equal(clientToken.version, 2)
4545
done()
4646
)
4747

@@ -71,7 +71,7 @@ describe "ClientTokenGateway", ->
7171
}
7272
}
7373

74-
myHttp.post("/client_api/nonces.json", params, (statusCode) ->
74+
myHttp.post("/client_api/v1/payment_methods/credit_cards.json", params, (statusCode) ->
7575
assert.equal(statusCode, 422)
7676
done()
7777
)
@@ -109,7 +109,7 @@ describe "ClientTokenGateway", ->
109109
}
110110
}
111111

112-
myHttp.post("/client_api/nonces.json", params, (statusCode) ->
112+
myHttp.post("/client_api/v1/payment_methods/credit_cards.json", params, (statusCode) ->
113113
assert.equal(statusCode, 201)
114114
specHelper.defaultGateway.customer.find(customerId, (err, customer) ->
115115
assert.equal(2, customer.creditCards.length)
@@ -145,7 +145,7 @@ describe "ClientTokenGateway", ->
145145
}
146146
}
147147

148-
myHttp.post("/client_api/nonces.json", params, (statusCode) ->
148+
myHttp.post("/client_api/v1/payment_methods/credit_cards.json", params, (statusCode) ->
149149
assert.equal(statusCode, 201)
150150
specHelper.defaultGateway.clientToken.generate({
151151
customerId: customer.id,
@@ -157,7 +157,7 @@ describe "ClientTokenGateway", ->
157157
authorizationFingerprint = clientToken.authorizationFingerprint
158158
params.authorizationFingerprint = authorizationFingerprint
159159

160-
myHttp.post("/client_api/nonces.json", params, (statusCode) ->
160+
myHttp.post("/client_api/v1/payment_methods/credit_cards.json", params, (statusCode) ->
161161
assert.equal(statusCode, 422)
162162
done()
163163
)

spec/integration/braintree/credit_card_gateway_spec.coffee

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,8 @@ describe "CreditCardGateway", ->
160160
}
161161
}
162162

163-
myHttp.post("/client_api/nonces.json", params, (statusCode, body) ->
164-
nonce = JSON.parse(body).nonce
163+
myHttp.post("/client_api/v1/payment_methods/credit_cards.json", params, (statusCode, body) ->
164+
nonce = JSON.parse(body).creditCards[0].nonce
165165
creditCardParams =
166166
customerId: customerId
167167
paymentMethodNonce: nonce
@@ -472,8 +472,8 @@ describe "CreditCardGateway", ->
472472
}
473473
}
474474

475-
myHttp.post "/client_api/nonces.json", params, (statusCode, body) ->
476-
nonce = JSON.parse(body).nonce
475+
myHttp.post "/client_api/v1/payment_methods/credit_cards.json", params, (statusCode, body) ->
476+
nonce = JSON.parse(body).creditCards[0].nonce
477477

478478
specHelper.defaultGateway.creditCard.fromNonce nonce, (err, creditCard) ->
479479
assert.isNull(err)
@@ -500,8 +500,8 @@ describe "CreditCardGateway", ->
500500
}
501501
}
502502

503-
myHttp.post "/client_api/nonces.json", params, (statusCode, body) ->
504-
nonce = JSON.parse(body).nonce
503+
myHttp.post "/client_api/v1/payment_methods/credit_cards.json", params, (statusCode, body) ->
504+
nonce = JSON.parse(body).creditCards[0].nonce
505505

506506
specHelper.defaultGateway.creditCard.fromNonce nonce, (err, creditCard) ->
507507
assert.isNull(creditCard)
@@ -528,15 +528,15 @@ describe "CreditCardGateway", ->
528528
}
529529
}
530530

531-
myHttp.post "/client_api/nonces.json", params, (statusCode, body) ->
531+
myHttp.post "/client_api/v1/payment_methods/credit_cards.json", params, (statusCode, body) ->
532532
params = {
533533
authorizationFingerprint: authorizationFingerprint,
534534
sharedCustomerIdentifierType: "testing",
535535
sharedCustomerIdentifier: "testing-identifier"
536536
}
537537

538-
myHttp.get "/client_api/nonces.json", params, (statusCode, body) ->
539-
nonce = JSON.parse(body).creditCards[0].nonce
538+
myHttp.get "/client_api/v1/payment_methods.json", params, (statusCode, body) ->
539+
nonce = JSON.parse(body).paymentMethods[0].nonce
540540

541541
specHelper.defaultGateway.creditCard.fromNonce nonce, (err, creditCard) ->
542542
assert.isNull(creditCard)
@@ -562,8 +562,8 @@ describe "CreditCardGateway", ->
562562
}
563563
}
564564

565-
myHttp.post "/client_api/nonces.json", params, (statusCode, body) ->
566-
nonce = JSON.parse(body).nonce
565+
myHttp.post "/client_api/v1/payment_methods/credit_cards.json", params, (statusCode, body) ->
566+
nonce = JSON.parse(body).creditCards[0].nonce
567567

568568
specHelper.defaultGateway.creditCard.fromNonce nonce, (err, creditCard) ->
569569
assert.isNull(err)

spec/integration/braintree/customer_gateway_spec.coffee

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,8 @@ describe "CustomerGateway", ->
8484
}
8585
}
8686

87-
myHttp.post("/client_api/nonces.json", params, (statusCode, body) ->
88-
nonce = JSON.parse(body).nonce
87+
myHttp.post("/client_api/v1/payment_methods/credit_cards.json", params, (statusCode, body) ->
88+
nonce = JSON.parse(body).creditCards[0].nonce
8989
customerParams =
9090
creditCard:
9191
paymentMethodNonce: nonce
@@ -288,6 +288,26 @@ describe "CustomerGateway", ->
288288

289289
done()
290290

291+
it "creates a customer with a params nonce", (done) ->
292+
paymentMethodParams =
293+
creditCard:
294+
number: "4111111111111111"
295+
expirationMonth: "12"
296+
expirationYear: "2099"
297+
specHelper.generateNonceForNewPaymentMethod(paymentMethodParams, null, (nonce) ->
298+
customerParams =
299+
firstName: "Bob"
300+
lastName: "Fisher"
301+
paymentMethodNonce: nonce
302+
303+
specHelper.defaultGateway.customer.create customerParams, (err, response) ->
304+
assert.isNull(err)
305+
assert.isTrue(response.success)
306+
assert.equal(response.customer.creditCards[0].bin, "411111")
307+
308+
done()
309+
)
310+
291311
describe "find", ->
292312
it "finds a custoemr", (done) ->
293313
customerParams =

0 commit comments

Comments
 (0)