braintree 4.2.0 → 4.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/braintree/apple_pay_card.rb +9 -0
- data/lib/braintree/error_codes.rb +1 -0
- data/lib/braintree/google_pay_card.rb +9 -0
- data/lib/braintree/transaction/paypal_details.rb +2 -0
- data/lib/braintree/transaction_gateway.rb +2 -2
- data/lib/braintree/version.rb +1 -1
- data/spec/integration/braintree/customer_spec.rb +27 -0
- data/spec/integration/braintree/merchant_account_spec.rb +3 -3
- data/spec/integration/braintree/payment_method_spec.rb +27 -0
- data/spec/integration/braintree/transaction_spec.rb +28 -0
- data/spec/unit/braintree/transaction/paypal_details_spec.rb +4 -0
- data/spec/unit/braintree/transaction_spec.rb +3 -3
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 47a154939f137c75bb981bb87bc53531502190ebd6dc8541e6df267c4692f520
|
4
|
+
data.tar.gz: 8acb4e0255f8b0ae61bcf7749f05b93bb4f09aa451fb5f1951d7605ce2b1f6b5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a00d9aa6efeaf3e218f01470941c218fbcd3f3551f8259af0b2e4acdb55349c9c17ac36fd4e4163216e3569e2fbf6b3e247ba49ecdfea853dc63b9387b921ff9
|
7
|
+
data.tar.gz: 85d512a9b6b445d7a0e17c48b020a9ccbf1491f067ab7d845f7bc554bb9597aea1cd62d965396b86b9f45f06fd2c5707acbb17a848b699ca7500772bcff97656
|
@@ -12,15 +12,24 @@ module Braintree
|
|
12
12
|
|
13
13
|
attr_reader :bin
|
14
14
|
attr_reader :card_type
|
15
|
+
attr_reader :commercial
|
16
|
+
attr_reader :country_of_issuance
|
15
17
|
attr_reader :created_at
|
16
18
|
attr_reader :customer_id
|
19
|
+
attr_reader :debit
|
17
20
|
attr_reader :default
|
21
|
+
attr_reader :durbin_regulated
|
18
22
|
attr_reader :expiration_month
|
19
23
|
attr_reader :expiration_year
|
20
24
|
attr_reader :expired
|
25
|
+
attr_reader :healthcare
|
21
26
|
attr_reader :image_url
|
27
|
+
attr_reader :issuing_bank
|
22
28
|
attr_reader :last_4
|
23
29
|
attr_reader :payment_instrument_name
|
30
|
+
attr_reader :payroll
|
31
|
+
attr_reader :prepaid
|
32
|
+
attr_reader :product_id
|
24
33
|
attr_reader :source_description
|
25
34
|
attr_reader :subscriptions
|
26
35
|
attr_reader :token
|
@@ -312,6 +312,7 @@ module Braintree
|
|
312
312
|
DiscountAmountCannotBeNegative = "915160"
|
313
313
|
DiscountAmountFormatIsInvalid = "915159"
|
314
314
|
DiscountAmountIsTooLarge = "915161"
|
315
|
+
ExchangeRateQuoteIdTooLong = "915229"
|
315
316
|
FailedAuthAdjustmentAllowRetry = "95603"
|
316
317
|
FailedAuthAdjustmentHardDecline = "95602"
|
317
318
|
FinalAuthSubmitForSettlementForDifferentAmount = "95601"
|
@@ -3,13 +3,22 @@ module Braintree
|
|
3
3
|
include BaseModule # :nodoc:
|
4
4
|
|
5
5
|
attr_reader :bin
|
6
|
+
attr_reader :commercial
|
7
|
+
attr_reader :country_of_issuance
|
6
8
|
attr_reader :created_at
|
7
9
|
attr_reader :customer_id
|
10
|
+
attr_reader :debit
|
8
11
|
attr_reader :default
|
12
|
+
attr_reader :durbin_regulated
|
9
13
|
attr_reader :expiration_month
|
10
14
|
attr_reader :expiration_year
|
11
15
|
attr_reader :google_transaction_id
|
16
|
+
attr_reader :healthcare
|
12
17
|
attr_reader :image_url
|
18
|
+
attr_reader :issuing_bank
|
19
|
+
attr_reader :payroll
|
20
|
+
attr_reader :prepaid
|
21
|
+
attr_reader :product_id
|
13
22
|
attr_reader :source_card_last_4
|
14
23
|
attr_reader :source_card_type
|
15
24
|
attr_reader :source_description
|
@@ -24,6 +24,8 @@ module Braintree
|
|
24
24
|
attr_reader :refund_from_transaction_fee_currency_iso_code
|
25
25
|
attr_reader :refund_id
|
26
26
|
attr_reader :seller_protection_status
|
27
|
+
attr_reader :tax_id
|
28
|
+
attr_reader :tax_id_type
|
27
29
|
attr_reader :token
|
28
30
|
attr_reader :transaction_fee_amount
|
29
31
|
attr_reader :transaction_fee_currency_iso_code
|
@@ -61,7 +61,7 @@ module Braintree
|
|
61
61
|
end
|
62
62
|
|
63
63
|
def find(id)
|
64
|
-
raise ArgumentError if id.nil? || id.strip.to_s == ""
|
64
|
+
raise ArgumentError, "id can not be empty" if id.nil? || id.strip.to_s == ""
|
65
65
|
response = @config.http.get("#{@config.base_merchant_path}/transactions/#{id}")
|
66
66
|
Transaction._new(@gateway, response[:transaction])
|
67
67
|
rescue NotFoundError
|
@@ -192,7 +192,7 @@ module Braintree
|
|
192
192
|
:shared_shipping_address_id, :shipping_address_id, :shipping_amount,
|
193
193
|
:ships_from_postal_code, :tax_amount, :tax_exempt, :three_d_secure_authentication_id,
|
194
194
|
:three_d_secure_token, :transaction_source, :type, :venmo_sdk_payment_method_code,
|
195
|
-
:sca_exemption, :currency_iso_code,
|
195
|
+
:sca_exemption, :currency_iso_code, :exchange_rate_quote_id,
|
196
196
|
{:line_items => [:quantity, :name, :description, :kind, :unit_amount, :unit_tax_amount, :total_amount, :discount_amount, :tax_amount, :unit_of_measure, :product_code, :commodity_code, :url]},
|
197
197
|
{:risk_data => [:customer_browser, :customer_device_id, :customer_ip, :customer_location_zip, :customer_tenure]},
|
198
198
|
{:credit_card => [:token, :cardholder_name, :cvv, :expiration_date, :expiration_month, :expiration_year, :number, {:payment_reader_card_details => [:encrypted_card_data, :key_serial_number]}]},
|
data/lib/braintree/version.rb
CHANGED
@@ -1021,6 +1021,15 @@ describe Braintree::Customer do
|
|
1021
1021
|
apple_pay_card.token.should_not be_nil
|
1022
1022
|
apple_pay_card.expiration_year.should_not be_nil
|
1023
1023
|
apple_pay_card.payment_instrument_name.should == "AmEx 41002"
|
1024
|
+
apple_pay_card.commercial.should_not be_nil
|
1025
|
+
apple_pay_card.country_of_issuance.should_not be_nil
|
1026
|
+
apple_pay_card.debit.should_not be_nil
|
1027
|
+
apple_pay_card.durbin_regulated.should_not be_nil
|
1028
|
+
apple_pay_card.healthcare.should_not be_nil
|
1029
|
+
apple_pay_card.issuing_bank.should_not be_nil
|
1030
|
+
apple_pay_card.payroll.should_not be_nil
|
1031
|
+
apple_pay_card.prepaid.should_not be_nil
|
1032
|
+
apple_pay_card.product_id.should_not be_nil
|
1024
1033
|
end
|
1025
1034
|
|
1026
1035
|
it "returns associated google pay proxy cards" do
|
@@ -1037,6 +1046,15 @@ describe Braintree::Customer do
|
|
1037
1046
|
google_pay_card.token.should_not be_nil
|
1038
1047
|
google_pay_card.expiration_year.should_not be_nil
|
1039
1048
|
google_pay_card.is_network_tokenized?.should == false
|
1049
|
+
google_pay_card.commercial.should_not be_nil
|
1050
|
+
google_pay_card.country_of_issuance.should_not be_nil
|
1051
|
+
google_pay_card.debit.should_not be_nil
|
1052
|
+
google_pay_card.durbin_regulated.should_not be_nil
|
1053
|
+
google_pay_card.healthcare.should_not be_nil
|
1054
|
+
google_pay_card.issuing_bank.should_not be_nil
|
1055
|
+
google_pay_card.payroll.should_not be_nil
|
1056
|
+
google_pay_card.prepaid.should_not be_nil
|
1057
|
+
google_pay_card.product_id.should_not be_nil
|
1040
1058
|
end
|
1041
1059
|
|
1042
1060
|
it "returns associated google pay network tokens" do
|
@@ -1053,6 +1071,15 @@ describe Braintree::Customer do
|
|
1053
1071
|
google_pay_card.token.should_not be_nil
|
1054
1072
|
google_pay_card.expiration_year.should_not be_nil
|
1055
1073
|
google_pay_card.is_network_tokenized?.should == true
|
1074
|
+
google_pay_card.commercial.should_not be_nil
|
1075
|
+
google_pay_card.country_of_issuance.should_not be_nil
|
1076
|
+
google_pay_card.debit.should_not be_nil
|
1077
|
+
google_pay_card.durbin_regulated.should_not be_nil
|
1078
|
+
google_pay_card.healthcare.should_not be_nil
|
1079
|
+
google_pay_card.issuing_bank.should_not be_nil
|
1080
|
+
google_pay_card.payroll.should_not be_nil
|
1081
|
+
google_pay_card.prepaid.should_not be_nil
|
1082
|
+
google_pay_card.product_id.should_not be_nil
|
1056
1083
|
end
|
1057
1084
|
|
1058
1085
|
it "returns associated venmo accounts" do
|
@@ -41,7 +41,7 @@ VALID_APPLICATION_PARAMS = {
|
|
41
41
|
:business => {
|
42
42
|
:legal_name => "Joe's Bloggs",
|
43
43
|
:dba_name => "Joe's Junkyard",
|
44
|
-
:tax_id => "
|
44
|
+
:tax_id => "423456789",
|
45
45
|
:address => {
|
46
46
|
:street_address => "456 Fake St",
|
47
47
|
:postal_code => "48104",
|
@@ -371,7 +371,7 @@ describe Braintree::MerchantAccount do
|
|
371
371
|
params[:individual][:address][:postal_code] = "60622"
|
372
372
|
params[:business][:dba_name] = "James's Bloggs"
|
373
373
|
params[:business][:legal_name] = "James's Bloggs Inc"
|
374
|
-
params[:business][:tax_id] = "
|
374
|
+
params[:business][:tax_id] = "423456789"
|
375
375
|
params[:business][:address][:street_address] = "999 Fake St"
|
376
376
|
params[:business][:address][:locality] = "Miami"
|
377
377
|
params[:business][:address][:region] = "FL"
|
@@ -397,7 +397,7 @@ describe Braintree::MerchantAccount do
|
|
397
397
|
result.merchant_account.individual_details.address_details.postal_code.should == "60622"
|
398
398
|
result.merchant_account.business_details.dba_name.should == "James's Bloggs"
|
399
399
|
result.merchant_account.business_details.legal_name.should == "James's Bloggs Inc"
|
400
|
-
result.merchant_account.business_details.tax_id.should == "
|
400
|
+
result.merchant_account.business_details.tax_id.should == "423456789"
|
401
401
|
result.merchant_account.business_details.address_details.street_address.should == "999 Fake St"
|
402
402
|
result.merchant_account.business_details.address_details.locality.should == "Miami"
|
403
403
|
result.merchant_account.business_details.address_details.region.should == "FL"
|
@@ -99,6 +99,15 @@ describe Braintree::PaymentMethod do
|
|
99
99
|
apple_pay_card.expiration_month.to_i.should > 0
|
100
100
|
apple_pay_card.expiration_year.to_i.should > 0
|
101
101
|
apple_pay_card.customer_id.should == customer.id
|
102
|
+
apple_pay_card.commercial.should_not be_nil
|
103
|
+
apple_pay_card.country_of_issuance.should_not be_nil
|
104
|
+
apple_pay_card.debit.should_not be_nil
|
105
|
+
apple_pay_card.durbin_regulated.should_not be_nil
|
106
|
+
apple_pay_card.healthcare.should_not be_nil
|
107
|
+
apple_pay_card.issuing_bank.should_not be_nil
|
108
|
+
apple_pay_card.payroll.should_not be_nil
|
109
|
+
apple_pay_card.prepaid.should_not be_nil
|
110
|
+
apple_pay_card.product_id.should_not be_nil
|
102
111
|
end
|
103
112
|
|
104
113
|
it "creates a payment method from a fake google pay proxy card nonce" do
|
@@ -127,6 +136,15 @@ describe Braintree::PaymentMethod do
|
|
127
136
|
google_pay_card.google_transaction_id.should == "google_transaction_id"
|
128
137
|
google_pay_card.source_description.should == "Discover 1111"
|
129
138
|
google_pay_card.customer_id.should == customer.id
|
139
|
+
google_pay_card.commercial.should_not be_nil
|
140
|
+
google_pay_card.country_of_issuance.should_not be_nil
|
141
|
+
google_pay_card.debit.should_not be_nil
|
142
|
+
google_pay_card.durbin_regulated.should_not be_nil
|
143
|
+
google_pay_card.healthcare.should_not be_nil
|
144
|
+
google_pay_card.issuing_bank.should_not be_nil
|
145
|
+
google_pay_card.payroll.should_not be_nil
|
146
|
+
google_pay_card.prepaid.should_not be_nil
|
147
|
+
google_pay_card.product_id.should_not be_nil
|
130
148
|
end
|
131
149
|
|
132
150
|
it "creates a payment method from a google pay network token nonce" do
|
@@ -155,6 +173,15 @@ describe Braintree::PaymentMethod do
|
|
155
173
|
google_pay_card.google_transaction_id.should == "google_transaction_id"
|
156
174
|
google_pay_card.source_description.should == "MasterCard 4444"
|
157
175
|
google_pay_card.customer_id.should == customer.id
|
176
|
+
google_pay_card.commercial.should_not be_nil
|
177
|
+
google_pay_card.country_of_issuance.should_not be_nil
|
178
|
+
google_pay_card.debit.should_not be_nil
|
179
|
+
google_pay_card.durbin_regulated.should_not be_nil
|
180
|
+
google_pay_card.healthcare.should_not be_nil
|
181
|
+
google_pay_card.issuing_bank.should_not be_nil
|
182
|
+
google_pay_card.payroll.should_not be_nil
|
183
|
+
google_pay_card.prepaid.should_not be_nil
|
184
|
+
google_pay_card.product_id.should_not be_nil
|
158
185
|
end
|
159
186
|
|
160
187
|
it "creates a payment method from venmo account nonce" do
|
@@ -999,6 +999,34 @@ describe Braintree::Transaction do
|
|
999
999
|
result.transaction.credit_card_details.expiration_date.should == "05/2011"
|
1000
1000
|
end
|
1001
1001
|
|
1002
|
+
it "accepts exchange_rate_quote_id" do
|
1003
|
+
result = Braintree::Transaction.create(
|
1004
|
+
:type => "sale",
|
1005
|
+
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
1006
|
+
:credit_card => {
|
1007
|
+
:number => Braintree::Test::CreditCardNumbers::Visa,
|
1008
|
+
:expiration_date => "05/2009"
|
1009
|
+
},
|
1010
|
+
:exchange_rate_quote_id => "dummyExchangeRateQuoteId-Brainree-Ruby",
|
1011
|
+
)
|
1012
|
+
result.success?.should == true
|
1013
|
+
result.transaction.credit_card_details.expiration_date.should == "05/2009"
|
1014
|
+
end
|
1015
|
+
|
1016
|
+
it "returns an error if provided invalid exchange_rate_quote_id" do
|
1017
|
+
result = Braintree::Transaction.create(
|
1018
|
+
:type => "sale",
|
1019
|
+
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
1020
|
+
:credit_card => {
|
1021
|
+
:number => Braintree::Test::CreditCardNumbers::Visa,
|
1022
|
+
:expiration_date => "05/2009"
|
1023
|
+
},
|
1024
|
+
:exchange_rate_quote_id => "a" * 4010,
|
1025
|
+
)
|
1026
|
+
result.success?.should == false
|
1027
|
+
result.errors.for(:transaction).on(:exchange_rate_quote_id)[0].code.should == Braintree::ErrorCodes::Transaction::ExchangeRateQuoteIdTooLong
|
1028
|
+
end
|
1029
|
+
|
1002
1030
|
it "returns some error if customer_id is invalid" do
|
1003
1031
|
result = Braintree::Transaction.create(
|
1004
1032
|
:type => "sale",
|
@@ -25,6 +25,8 @@ describe Braintree::Transaction::PayPalDetails do
|
|
25
25
|
:refund_from_transaction_fee_currency_iso_code => "123",
|
26
26
|
:refund_id => "refund-id",
|
27
27
|
:seller_protection_status => "seller-protection-status",
|
28
|
+
:tax_id => "tax-id",
|
29
|
+
:tax_id_type => "tax-id-type",
|
28
30
|
:token => "token",
|
29
31
|
:transaction_fee_amount => "2.00",
|
30
32
|
:transaction_fee_currency_iso_code => "123",
|
@@ -51,6 +53,8 @@ describe Braintree::Transaction::PayPalDetails do
|
|
51
53
|
expect(details.refund_from_transaction_fee_currency_iso_code).to eq("123")
|
52
54
|
expect(details.refund_id).to eq("refund-id")
|
53
55
|
expect(details.seller_protection_status).to eq("seller-protection-status")
|
56
|
+
expect(details.tax_id).to eq("tax-id")
|
57
|
+
expect(details.tax_id_type).to eq("tax-id-type")
|
54
58
|
expect(details.token).to eq("token")
|
55
59
|
expect(details.transaction_fee_amount).to eq("2.00")
|
56
60
|
expect(details.transaction_fee_currency_iso_code).to eq("123")
|
@@ -21,19 +21,19 @@ describe Braintree::Transaction do
|
|
21
21
|
it "raises error if passed empty string" do
|
22
22
|
expect do
|
23
23
|
Braintree::Transaction.find("")
|
24
|
-
end.to raise_error(ArgumentError)
|
24
|
+
end.to raise_error(ArgumentError, "id can not be empty")
|
25
25
|
end
|
26
26
|
|
27
27
|
it "raises error if passed empty string wth space" do
|
28
28
|
expect do
|
29
29
|
Braintree::Transaction.find(" ")
|
30
|
-
end.to raise_error(ArgumentError)
|
30
|
+
end.to raise_error(ArgumentError, "id can not be empty")
|
31
31
|
end
|
32
32
|
|
33
33
|
it "raises error if passed nil" do
|
34
34
|
expect do
|
35
35
|
Braintree::Transaction.find(nil)
|
36
|
-
end.to raise_error(ArgumentError)
|
36
|
+
end.to raise_error(ArgumentError, "id can not be empty")
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: braintree
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Braintree
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-07-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: builder
|
@@ -329,7 +329,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
329
329
|
- !ruby/object:Gem::Version
|
330
330
|
version: '0'
|
331
331
|
requirements: []
|
332
|
-
rubygems_version: 3.2.
|
332
|
+
rubygems_version: 3.2.24
|
333
333
|
signing_key:
|
334
334
|
specification_version: 4
|
335
335
|
summary: Braintree Ruby Server SDK
|