braintree 2.89.0 → 2.90.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/lib/braintree.rb +2 -0
- data/lib/braintree/authorization_adjustment.rb +2 -0
- data/lib/braintree/customer.rb +4 -1
- data/lib/braintree/dispute_search.rb +1 -7
- data/lib/braintree/payment_instrument_type.rb +1 -0
- data/lib/braintree/payment_method_gateway.rb +2 -0
- data/lib/braintree/samsung_pay_card.rb +83 -0
- data/lib/braintree/test/nonce.rb +4 -0
- data/lib/braintree/transaction.rb +2 -0
- data/lib/braintree/transaction/samsung_pay_card_details.rb +48 -0
- data/lib/braintree/version.rb +1 -1
- data/spec/integration/braintree/credit_card_spec.rb +15 -13
- data/spec/integration/braintree/payment_method_spec.rb +17 -12
- data/spec/integration/braintree/samsung_pay_card_spec.rb +144 -0
- data/spec/integration/braintree/transaction_spec.rb +30 -24
- data/spec/integration/spec_helper.rb +6 -0
- data/spec/unit/braintree/dispute_search_spec.rb +1 -1
- data/spec/unit/braintree/transaction_spec.rb +6 -2
- metadata +10 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 4ded1b6a4f547ae738fdb43c3762fcc51515f8276833bcede2828f5b51a6720a
|
4
|
+
data.tar.gz: be2edc1892560c721da8cef1b116b49229b2f790c5e0bf4b8f668625e0074ada
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8daaea6f26713cea097e60bcb39b68f912638c385f40e57fced65d548554c6ad73c78cee736a3c30f96915a10922c7425281c5a0b99f875672c40482df9672ca
|
7
|
+
data.tar.gz: c13b688529c17c8c5b5a82ff95e67bbc47058381f29e386f1b5a9da11a84d51528454d4de85a0f2f6afff419e7288e304cb71f041325339356e372fc028ac464
|
data/lib/braintree.rb
CHANGED
@@ -143,6 +143,7 @@ require "braintree/transaction/status_details"
|
|
143
143
|
require "braintree/transaction/venmo_account_details"
|
144
144
|
require "braintree/transaction/visa_checkout_card_details"
|
145
145
|
require "braintree/transaction/masterpass_card_details"
|
146
|
+
require "braintree/transaction/samsung_pay_card_details"
|
146
147
|
require "braintree/unknown_payment_method"
|
147
148
|
require "braintree/disbursement"
|
148
149
|
require "braintree/dispute_search"
|
@@ -154,6 +155,7 @@ require "braintree/venmo_account"
|
|
154
155
|
require "braintree/version"
|
155
156
|
require "braintree/visa_checkout_card"
|
156
157
|
require "braintree/masterpass_card"
|
158
|
+
require "braintree/samsung_pay_card"
|
157
159
|
require "braintree/webhook_notification"
|
158
160
|
require "braintree/webhook_notification_gateway"
|
159
161
|
require "braintree/webhook_testing"
|
data/lib/braintree/customer.rb
CHANGED
@@ -20,6 +20,7 @@ module Braintree
|
|
20
20
|
attr_reader :masterpass_cards
|
21
21
|
attr_reader :paypal_accounts
|
22
22
|
attr_reader :phone
|
23
|
+
attr_reader :samsung_pay_cards
|
23
24
|
attr_reader :updated_at
|
24
25
|
attr_reader :us_bank_accounts
|
25
26
|
attr_reader :venmo_accounts
|
@@ -117,6 +118,7 @@ module Braintree
|
|
117
118
|
@us_bank_accounts = (@us_bank_accounts || []).map { |pm| UsBankAccount._new gateway, pm }
|
118
119
|
@visa_checkout_cards = (@visa_checkout_cards|| []).map { |pm| VisaCheckoutCard._new gateway, pm }
|
119
120
|
@masterpass_cards = (@masterpass_cards|| []).map { |pm| MasterpassCard._new gateway, pm }
|
121
|
+
@samsung_pay_cards = (@samsung_pay_cards|| []).map { |pm| SamsungPayCard._new gateway, pm }
|
120
122
|
@addresses = (@addresses || []).map { |addr| Address._new gateway, addr }
|
121
123
|
@custom_fields = attributes[:custom_fields].is_a?(Hash) ? attributes[:custom_fields] : {}
|
122
124
|
end
|
@@ -156,7 +158,8 @@ module Braintree
|
|
156
158
|
@amex_express_checkout_cards +
|
157
159
|
@venmo_accounts +
|
158
160
|
@us_bank_accounts +
|
159
|
-
@visa_checkout_cards
|
161
|
+
@visa_checkout_cards +
|
162
|
+
@samsung_pay_cards
|
160
163
|
end
|
161
164
|
|
162
165
|
def inspect # :nodoc:
|
@@ -13,13 +13,7 @@ module Braintree
|
|
13
13
|
multiple_value_field :reason, :allows => Dispute::Reason::All
|
14
14
|
multiple_value_field :reason_code
|
15
15
|
multiple_value_field :status, :allows => Dispute::Status::All
|
16
|
-
|
17
|
-
multiple_value_field :transaction_source, :allows => [
|
18
|
-
Transaction::Source::Api,
|
19
|
-
Transaction::Source::ControlPanel,
|
20
|
-
Transaction::Source::Recurring,
|
21
|
-
Transaction::Source::Unrecognized,
|
22
|
-
]
|
16
|
+
multiple_value_field :transaction_source
|
23
17
|
|
24
18
|
range_fields(
|
25
19
|
:amount_disputed,
|
@@ -39,6 +39,8 @@ module Braintree
|
|
39
39
|
SuccessfulResult.new(:payment_method => VisaCheckoutCard._new(@gateway, response[:visa_checkout_card]))
|
40
40
|
elsif response[:masterpass_card]
|
41
41
|
SuccessfulResult.new(:payment_method => MasterpassCard._new(@gateway, response[:masterpass_card]))
|
42
|
+
elsif response[:samsung_pay_card]
|
43
|
+
SuccessfulResult.new(:payment_method => SamsungPayCard._new(@gateway, response[:samsung_pay_card]))
|
42
44
|
elsif response[:payment_method_nonce]
|
43
45
|
SuccessfulResult.new(:payment_method_nonce => PaymentMethodNonce._new(@gateway, response[:payment_method_nonce]))
|
44
46
|
elsif response[:success]
|
@@ -0,0 +1,83 @@
|
|
1
|
+
module Braintree
|
2
|
+
class SamsungPayCard
|
3
|
+
include BaseModule # :nodoc:
|
4
|
+
include Braintree::Util::TokenEquality
|
5
|
+
|
6
|
+
attr_reader :billing_address
|
7
|
+
attr_reader :bin
|
8
|
+
attr_reader :cardholder_name
|
9
|
+
attr_reader :card_type
|
10
|
+
attr_reader :commercial
|
11
|
+
attr_reader :country_of_issuance
|
12
|
+
attr_reader :created_at
|
13
|
+
attr_reader :customer_id
|
14
|
+
attr_reader :customer_location
|
15
|
+
attr_reader :debit
|
16
|
+
attr_reader :durbin_regulated
|
17
|
+
attr_reader :expiration_month
|
18
|
+
attr_reader :expiration_year
|
19
|
+
attr_reader :healthcare
|
20
|
+
attr_reader :image_url
|
21
|
+
attr_reader :issuing_bank
|
22
|
+
attr_reader :last_4
|
23
|
+
attr_reader :payroll
|
24
|
+
attr_reader :prepaid
|
25
|
+
attr_reader :product_id
|
26
|
+
attr_reader :source_card_last_4
|
27
|
+
attr_reader :subscriptions
|
28
|
+
attr_reader :token
|
29
|
+
attr_reader :unique_number_identifier
|
30
|
+
attr_reader :updated_at
|
31
|
+
|
32
|
+
def initialize(gateway, attributes) # :nodoc:
|
33
|
+
@gateway = gateway
|
34
|
+
set_instance_variables_from_hash(attributes)
|
35
|
+
@billing_address = attributes[:billing_address] ? Address._new(@gateway, attributes[:billing_address]) : nil
|
36
|
+
@subscriptions = (@subscriptions || []).map { |subscription_hash| Subscription._new(@gateway, subscription_hash) }
|
37
|
+
end
|
38
|
+
|
39
|
+
def default?
|
40
|
+
@default
|
41
|
+
end
|
42
|
+
|
43
|
+
# Expiration date formatted as MM/YYYY
|
44
|
+
def expiration_date
|
45
|
+
"#{expiration_month}/#{expiration_year}"
|
46
|
+
end
|
47
|
+
|
48
|
+
def expired?
|
49
|
+
@expired
|
50
|
+
end
|
51
|
+
|
52
|
+
def inspect # :nodoc:
|
53
|
+
first = [:token]
|
54
|
+
order = first + (self.class._attributes - first)
|
55
|
+
nice_attributes = order.map do |attr|
|
56
|
+
"#{attr}: #{send(attr).inspect}"
|
57
|
+
end
|
58
|
+
"#<#{self.class} #{nice_attributes.join(', ')}>"
|
59
|
+
end
|
60
|
+
|
61
|
+
def masked_number
|
62
|
+
"#{bin}******#{last_4}"
|
63
|
+
end
|
64
|
+
|
65
|
+
class << self
|
66
|
+
protected :new
|
67
|
+
end
|
68
|
+
|
69
|
+
def self._attributes # :nodoc:
|
70
|
+
[
|
71
|
+
:billing_address, :bin, :cardholder_name, :card_type, :created_at, :customer_id,
|
72
|
+
:customer_location, :expiration_month, :expiration_year,
|
73
|
+
:last_4, :source_card_last_4, :token, :updated_at, :prepaid,
|
74
|
+
:payroll, :product_id, :commercial, :debit, :durbin_regulated,
|
75
|
+
:healthcare, :country_of_issuance, :issuing_bank, :image_url
|
76
|
+
]
|
77
|
+
end
|
78
|
+
|
79
|
+
def self._new(*args) # :nodoc:
|
80
|
+
self.new *args
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
data/lib/braintree/test/nonce.rb
CHANGED
@@ -53,6 +53,10 @@ module Braintree
|
|
53
53
|
VisaCheckoutDiscover = "fake-visa-checkout-discover-nonce"
|
54
54
|
VisaCheckoutMasterCard = "fake-visa-checkout-mastercard-nonce"
|
55
55
|
VisaCheckoutVisa = "fake-visa-checkout-visa-nonce"
|
56
|
+
SamsungPayAmEx = "tokensam_fake_american_express"
|
57
|
+
SamsungPayDiscover = "tokensam_fake_discover"
|
58
|
+
SamsungPayMasterCard = "tokensam_fake_mastercard"
|
59
|
+
SamsungPayVisa = "tokensam_fake_visa"
|
56
60
|
|
57
61
|
def self.const_missing(const_name)
|
58
62
|
if const_name == :AndroidPay
|
@@ -117,6 +117,7 @@ module Braintree
|
|
117
117
|
attr_reader :refund_ids
|
118
118
|
attr_reader :refunded_transaction_id
|
119
119
|
attr_reader :risk_data
|
120
|
+
attr_reader :samsung_pay_card_details
|
120
121
|
attr_reader :service_fee_amount
|
121
122
|
attr_reader :settlement_batch_id
|
122
123
|
attr_reader :shipping_amount
|
@@ -289,6 +290,7 @@ module Braintree
|
|
289
290
|
@ideal_payment_details = IdealPaymentDetails.new(attributes[:ideal_payment]) if attributes[:ideal_payment]
|
290
291
|
@visa_checkout_card_details = VisaCheckoutCardDetails.new(attributes[:visa_checkout_card])
|
291
292
|
@masterpass_card_details = MasterpassCardDetails.new(attributes[:masterpass_card])
|
293
|
+
@samsung_pay_card_details = SamsungPayCardDetails.new(attributes[:samsung_pay_card])
|
292
294
|
authorization_adjustments.map! { |attrs| AuthorizationAdjustment._new(attrs) } if authorization_adjustments
|
293
295
|
end
|
294
296
|
|
@@ -0,0 +1,48 @@
|
|
1
|
+
module Braintree
|
2
|
+
class Transaction
|
3
|
+
class SamsungPayCardDetails # :nodoc:
|
4
|
+
include BaseModule
|
5
|
+
|
6
|
+
attr_reader :bin
|
7
|
+
attr_reader :cardholder_name
|
8
|
+
attr_reader :card_type
|
9
|
+
attr_reader :commercial
|
10
|
+
attr_reader :country_of_issuance
|
11
|
+
attr_reader :customer_location
|
12
|
+
attr_reader :debit
|
13
|
+
attr_reader :durbin_regulated
|
14
|
+
attr_reader :expiration_month
|
15
|
+
attr_reader :expiration_year
|
16
|
+
attr_reader :healthcare
|
17
|
+
attr_reader :image_url
|
18
|
+
attr_reader :issuing_bank
|
19
|
+
attr_reader :last_4
|
20
|
+
attr_reader :payroll
|
21
|
+
attr_reader :prepaid
|
22
|
+
attr_reader :product_id
|
23
|
+
attr_reader :source_card_last_4
|
24
|
+
attr_reader :token
|
25
|
+
|
26
|
+
def initialize(attributes)
|
27
|
+
set_instance_variables_from_hash attributes unless attributes.nil?
|
28
|
+
end
|
29
|
+
|
30
|
+
def expiration_date
|
31
|
+
"#{expiration_month}/#{expiration_year}"
|
32
|
+
end
|
33
|
+
|
34
|
+
def inspect
|
35
|
+
attr_order = [:token, :bin, :last_4, :card_type, :expiration_date, :source_card_last_4, :customer_location, :prepaid,
|
36
|
+
:healthcare, :durbin_regulated, :debit, :commercial, :payroll, :product_id, :country_of_issuance, :issuing_bank, :image_url]
|
37
|
+
formatted_attrs = attr_order.map do |attr|
|
38
|
+
"#{attr}: #{send(attr).inspect}"
|
39
|
+
end
|
40
|
+
"#<#{formatted_attrs.join(", ")}>"
|
41
|
+
end
|
42
|
+
|
43
|
+
def masked_number
|
44
|
+
"#{bin}******#{last_4}"
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
data/lib/braintree/version.rb
CHANGED
@@ -138,19 +138,21 @@ describe Braintree::CreditCard do
|
|
138
138
|
end
|
139
139
|
|
140
140
|
it "returns risk data on verification on credit_card create" do
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
141
|
+
with_advanced_fraud_integration_merchant do
|
142
|
+
customer = Braintree::Customer.create!
|
143
|
+
credit_card = Braintree::CreditCard.create!(
|
144
|
+
:cardholder_name => "Original Holder",
|
145
|
+
:customer_id => customer.id,
|
146
|
+
:cvv => "123",
|
147
|
+
:number => Braintree::Test::CreditCardNumbers::Visa,
|
148
|
+
:expiration_date => "05/2020",
|
149
|
+
:options => {:verify_card => true}
|
150
|
+
)
|
151
|
+
verification = credit_card.verification
|
152
|
+
verification.risk_data.should respond_to(:id)
|
153
|
+
verification.risk_data.should respond_to(:decision)
|
154
|
+
verification.risk_data.should respond_to(:device_data_captured)
|
155
|
+
end
|
154
156
|
end
|
155
157
|
|
156
158
|
it "exposes the gateway rejection reason on verification" do
|
@@ -1,6 +1,10 @@
|
|
1
1
|
require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
|
2
2
|
require File.expand_path(File.dirname(__FILE__) + "/client_api/spec_helper")
|
3
3
|
|
4
|
+
def make_token
|
5
|
+
SecureRandom.uuid
|
6
|
+
end
|
7
|
+
|
4
8
|
describe Braintree::PaymentMethod do
|
5
9
|
describe "self.create" do
|
6
10
|
it "creates a payment method from a vaulted credit card nonce" do
|
@@ -239,8 +243,8 @@ describe Braintree::PaymentMethod do
|
|
239
243
|
it "overrides the token in the nonce" do
|
240
244
|
customer = Braintree::Customer.create!
|
241
245
|
|
242
|
-
first_token =
|
243
|
-
second_token =
|
246
|
+
first_token = make_token
|
247
|
+
second_token = make_token
|
244
248
|
nonce = nonce_for_paypal_account(
|
245
249
|
:consent_code => "PAYPAL_CONSENT_CODE",
|
246
250
|
:token => first_token
|
@@ -774,7 +778,7 @@ describe Braintree::PaymentMethod do
|
|
774
778
|
context "paypal accounts" do
|
775
779
|
it "finds the payment method with the given token" do
|
776
780
|
customer = Braintree::Customer.create!
|
777
|
-
payment_method_token =
|
781
|
+
payment_method_token = make_token
|
778
782
|
nonce = nonce_for_paypal_account(
|
779
783
|
:consent_code => "consent-code",
|
780
784
|
:token => payment_method_token
|
@@ -796,7 +800,7 @@ describe Braintree::PaymentMethod do
|
|
796
800
|
context "apple pay cards" do
|
797
801
|
it "finds the payment method with the given token" do
|
798
802
|
customer = Braintree::Customer.create!
|
799
|
-
payment_method_token =
|
803
|
+
payment_method_token = make_token
|
800
804
|
result = Braintree::PaymentMethod.create(
|
801
805
|
:payment_method_nonce => Braintree::Test::Nonce::ApplePayAmEx,
|
802
806
|
:customer_id => customer.id,
|
@@ -821,7 +825,7 @@ describe Braintree::PaymentMethod do
|
|
821
825
|
context "venmo accounts" do
|
822
826
|
it "finds the payment method with the given token" do
|
823
827
|
customer = Braintree::Customer.create!
|
824
|
-
payment_method_token =
|
828
|
+
payment_method_token = make_token
|
825
829
|
result = Braintree::PaymentMethod.create(
|
826
830
|
:payment_method_nonce => Braintree::Test::Nonce::VenmoAccount,
|
827
831
|
:customer_id => customer.id,
|
@@ -845,7 +849,7 @@ describe Braintree::PaymentMethod do
|
|
845
849
|
context "android pay cards" do
|
846
850
|
it "finds the proxy card payment method with the given token" do
|
847
851
|
customer = Braintree::Customer.create!
|
848
|
-
payment_method_token =
|
852
|
+
payment_method_token = make_token
|
849
853
|
result = Braintree::PaymentMethod.create(
|
850
854
|
:payment_method_nonce => Braintree::Test::Nonce::AndroidPayDiscover,
|
851
855
|
:customer_id => customer.id,
|
@@ -872,7 +876,7 @@ describe Braintree::PaymentMethod do
|
|
872
876
|
|
873
877
|
it "finds the network token payment method with the given token" do
|
874
878
|
customer = Braintree::Customer.create!
|
875
|
-
payment_method_token =
|
879
|
+
payment_method_token = make_token
|
876
880
|
result = Braintree::PaymentMethod.create(
|
877
881
|
:payment_method_nonce => Braintree::Test::Nonce::AndroidPayMasterCard,
|
878
882
|
:customer_id => customer.id,
|
@@ -901,7 +905,7 @@ describe Braintree::PaymentMethod do
|
|
901
905
|
context "unknown payment methods" do
|
902
906
|
it "finds the payment method with the given token" do
|
903
907
|
customer = Braintree::Customer.create!
|
904
|
-
payment_method_token =
|
908
|
+
payment_method_token = make_token
|
905
909
|
result = Braintree::PaymentMethod.create(
|
906
910
|
:payment_method_nonce => Braintree::Test::Nonce::AbstractTransactable,
|
907
911
|
:customer_id => customer.id,
|
@@ -969,7 +973,8 @@ describe Braintree::PaymentMethod do
|
|
969
973
|
|
970
974
|
it "deletes a paypal account" do
|
971
975
|
customer = Braintree::Customer.create!
|
972
|
-
paypal_account_token =
|
976
|
+
paypal_account_token = make_token
|
977
|
+
|
973
978
|
nonce = nonce_for_paypal_account(
|
974
979
|
:consent_code => "PAYPAL_CONSENT_CODE",
|
975
980
|
:token => paypal_account_token
|
@@ -991,7 +996,7 @@ describe Braintree::PaymentMethod do
|
|
991
996
|
end
|
992
997
|
|
993
998
|
it "deletes a credit card" do
|
994
|
-
token =
|
999
|
+
token = make_token
|
995
1000
|
customer = Braintree::Customer.create!
|
996
1001
|
nonce = nonce_for_new_payment_method({
|
997
1002
|
:credit_card => {
|
@@ -1017,7 +1022,7 @@ describe Braintree::PaymentMethod do
|
|
1017
1022
|
end
|
1018
1023
|
|
1019
1024
|
it "raises a NotFoundError exception if payment method cannot be found" do
|
1020
|
-
token =
|
1025
|
+
token = make_token
|
1021
1026
|
customer = Braintree::Customer.create!
|
1022
1027
|
|
1023
1028
|
expect do
|
@@ -1301,7 +1306,7 @@ describe Braintree::PaymentMethod do
|
|
1301
1306
|
:customer_id => customer.id
|
1302
1307
|
)
|
1303
1308
|
|
1304
|
-
updated_token =
|
1309
|
+
updated_token = make_token
|
1305
1310
|
updated_result = Braintree::PaymentMethod.update(
|
1306
1311
|
original_token,
|
1307
1312
|
:token => updated_token
|
@@ -0,0 +1,144 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
|
2
|
+
require File.expand_path(File.dirname(__FILE__) + "/client_api/spec_helper")
|
3
|
+
|
4
|
+
describe Braintree::SamsungPayCard do
|
5
|
+
it "can create from payment method nonce" do
|
6
|
+
customer = Braintree::Customer.create!
|
7
|
+
|
8
|
+
result = Braintree::PaymentMethod.create(
|
9
|
+
:payment_method_nonce => Braintree::Test::Nonce::SamsungPayDiscover,
|
10
|
+
:customer_id => customer.id,
|
11
|
+
:cardholder_name => 'Jenny Block',
|
12
|
+
:billing_address => {
|
13
|
+
:first_name => "New First Name",
|
14
|
+
:last_name => "New Last Name",
|
15
|
+
:company => "New Company",
|
16
|
+
:street_address => "123 New St",
|
17
|
+
:extended_address => "Apt New",
|
18
|
+
:locality => "New City",
|
19
|
+
:region => "New State",
|
20
|
+
:postal_code => "56789",
|
21
|
+
:country_name => "United States of America"
|
22
|
+
}
|
23
|
+
)
|
24
|
+
result.should be_success
|
25
|
+
|
26
|
+
samsung_pay_card = result.payment_method
|
27
|
+
samsung_pay_card.should be_a(Braintree::SamsungPayCard)
|
28
|
+
samsung_pay_card.billing_address.should_not be_nil
|
29
|
+
samsung_pay_card.bin.should_not be_nil
|
30
|
+
samsung_pay_card.cardholder_name.should_not be_nil
|
31
|
+
samsung_pay_card.card_type.should_not be_nil
|
32
|
+
samsung_pay_card.commercial.should_not be_nil
|
33
|
+
samsung_pay_card.country_of_issuance.should_not be_nil
|
34
|
+
samsung_pay_card.created_at.should_not be_nil
|
35
|
+
samsung_pay_card.customer_id.should_not be_nil
|
36
|
+
samsung_pay_card.customer_location.should_not be_nil
|
37
|
+
samsung_pay_card.debit.should_not be_nil
|
38
|
+
samsung_pay_card.default?.should_not be_nil
|
39
|
+
samsung_pay_card.durbin_regulated.should_not be_nil
|
40
|
+
samsung_pay_card.expiration_date.should_not be_nil
|
41
|
+
samsung_pay_card.expiration_month.should_not be_nil
|
42
|
+
samsung_pay_card.expiration_year.should_not be_nil
|
43
|
+
samsung_pay_card.expired?.should_not be_nil
|
44
|
+
samsung_pay_card.healthcare.should_not be_nil
|
45
|
+
samsung_pay_card.image_url.should_not be_nil
|
46
|
+
samsung_pay_card.issuing_bank.should_not be_nil
|
47
|
+
samsung_pay_card.last_4.should_not be_nil
|
48
|
+
samsung_pay_card.payroll.should_not be_nil
|
49
|
+
samsung_pay_card.prepaid.should_not be_nil
|
50
|
+
samsung_pay_card.product_id.should_not be_nil
|
51
|
+
samsung_pay_card.source_card_last_4.should_not be_nil
|
52
|
+
samsung_pay_card.subscriptions.should_not be_nil
|
53
|
+
samsung_pay_card.token.should_not be_nil
|
54
|
+
samsung_pay_card.unique_number_identifier.should_not be_nil
|
55
|
+
samsung_pay_card.updated_at.should_not be_nil
|
56
|
+
|
57
|
+
customer = Braintree::Customer.find(customer.id)
|
58
|
+
customer.samsung_pay_cards.size.should == 1
|
59
|
+
customer.samsung_pay_cards.first.should == samsung_pay_card
|
60
|
+
end
|
61
|
+
|
62
|
+
it "returns cardholder_name and billing_address" do
|
63
|
+
customer = Braintree::Customer.create!
|
64
|
+
|
65
|
+
result = Braintree::PaymentMethod.create(
|
66
|
+
:payment_method_nonce => Braintree::Test::Nonce::SamsungPayDiscover,
|
67
|
+
:customer_id => customer.id,
|
68
|
+
:cardholder_name => 'Jenny Block',
|
69
|
+
:billing_address => {
|
70
|
+
:first_name => "New First Name",
|
71
|
+
:last_name => "New Last Name",
|
72
|
+
:company => "New Company",
|
73
|
+
:street_address => "123 New St",
|
74
|
+
:extended_address => "Apt New",
|
75
|
+
:locality => "New City",
|
76
|
+
:region => "New State",
|
77
|
+
:postal_code => "56789",
|
78
|
+
:country_name => "United States of America"
|
79
|
+
}
|
80
|
+
)
|
81
|
+
|
82
|
+
result.should be_success
|
83
|
+
result.payment_method.cardholder_name.should == 'Jenny Block'
|
84
|
+
|
85
|
+
address = result.payment_method.billing_address
|
86
|
+
address.first_name.should == "New First Name"
|
87
|
+
address.last_name.should == "New Last Name"
|
88
|
+
address.company.should == "New Company"
|
89
|
+
address.street_address.should == "123 New St"
|
90
|
+
address.extended_address.should == "Apt New"
|
91
|
+
address.locality.should == "New City"
|
92
|
+
address.region.should == "New State"
|
93
|
+
address.postal_code.should == "56789"
|
94
|
+
end
|
95
|
+
|
96
|
+
it "can search for transactions" do
|
97
|
+
transaction_create_result = Braintree::Transaction.sale(
|
98
|
+
:payment_method_nonce => Braintree::Test::Nonce::SamsungPayDiscover,
|
99
|
+
:amount => '47.00',
|
100
|
+
)
|
101
|
+
transaction_create_result.should be_success
|
102
|
+
transaction_id = transaction_create_result.transaction.id
|
103
|
+
|
104
|
+
search_results = Braintree::Transaction.search do |search|
|
105
|
+
search.id.is transaction_id
|
106
|
+
search.payment_instrument_type.is Braintree::PaymentInstrumentType::SamsungPayCard
|
107
|
+
end
|
108
|
+
search_results.first.id.should == transaction_id
|
109
|
+
end
|
110
|
+
|
111
|
+
it "can create transaction from nonce and vault" do
|
112
|
+
customer = Braintree::Customer.create!
|
113
|
+
|
114
|
+
result = Braintree::Transaction.sale(
|
115
|
+
:payment_method_nonce => Braintree::Test::Nonce::SamsungPayDiscover,
|
116
|
+
:customer_id => customer.id,
|
117
|
+
:amount => '47.00',
|
118
|
+
:options => { :store_in_vault => true },
|
119
|
+
)
|
120
|
+
result.should be_success
|
121
|
+
|
122
|
+
samsung_pay_card_details = result.transaction.samsung_pay_card_details
|
123
|
+
samsung_pay_card_details.bin.should_not be_nil
|
124
|
+
samsung_pay_card_details.card_type.should_not be_nil
|
125
|
+
samsung_pay_card_details.commercial.should_not be_nil
|
126
|
+
samsung_pay_card_details.country_of_issuance.should_not be_nil
|
127
|
+
samsung_pay_card_details.customer_location.should_not be_nil
|
128
|
+
samsung_pay_card_details.debit.should_not be_nil
|
129
|
+
samsung_pay_card_details.durbin_regulated.should_not be_nil
|
130
|
+
samsung_pay_card_details.expiration_date.should_not be_nil
|
131
|
+
samsung_pay_card_details.expiration_month.should_not be_nil
|
132
|
+
samsung_pay_card_details.expiration_year.should_not be_nil
|
133
|
+
samsung_pay_card_details.healthcare.should_not be_nil
|
134
|
+
samsung_pay_card_details.image_url.should_not be_nil
|
135
|
+
samsung_pay_card_details.issuing_bank.should_not be_nil
|
136
|
+
samsung_pay_card_details.last_4.should_not be_nil
|
137
|
+
samsung_pay_card_details.payroll.should_not be_nil
|
138
|
+
samsung_pay_card_details.prepaid.should_not be_nil
|
139
|
+
samsung_pay_card_details.product_id.should_not be_nil
|
140
|
+
samsung_pay_card_details.source_card_last_4.should_not be_nil
|
141
|
+
samsung_pay_card_details.source_card_last_4.should == '3333'
|
142
|
+
samsung_pay_card_details.token.should_not be_nil
|
143
|
+
end
|
144
|
+
end
|
@@ -124,18 +124,20 @@ describe Braintree::Transaction do
|
|
124
124
|
describe "self.create" do
|
125
125
|
describe "risk data" do
|
126
126
|
it "returns decision, device_data_captured and id" do
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
:
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
127
|
+
with_advanced_fraud_integration_merchant do
|
128
|
+
result = Braintree::Transaction.create(
|
129
|
+
:type => "sale",
|
130
|
+
:amount => 1_00,
|
131
|
+
:credit_card => {
|
132
|
+
:number => Braintree::Test::CreditCardNumbers::CardTypeIndicators::Prepaid,
|
133
|
+
:expiration_date => "05/2009"
|
134
|
+
}
|
135
|
+
)
|
136
|
+
result.transaction.risk_data.should be_a(Braintree::RiskData)
|
137
|
+
result.transaction.risk_data.should respond_to(:id)
|
138
|
+
result.transaction.risk_data.should respond_to(:decision)
|
139
|
+
result.transaction.risk_data.should respond_to(:device_data_captured)
|
140
|
+
end
|
139
141
|
end
|
140
142
|
end
|
141
143
|
|
@@ -4087,18 +4089,20 @@ describe Braintree::Transaction do
|
|
4087
4089
|
end
|
4088
4090
|
|
4089
4091
|
it "skips advanced fraud checking if transaction[options][skip_advanced_fraud_checking] is set to true" do
|
4090
|
-
|
4091
|
-
|
4092
|
-
|
4093
|
-
:
|
4094
|
-
|
4095
|
-
|
4096
|
-
|
4097
|
-
:
|
4098
|
-
|
4099
|
-
|
4100
|
-
|
4101
|
-
|
4092
|
+
with_advanced_fraud_integration_merchant do
|
4093
|
+
result = Braintree::Transaction.sale(
|
4094
|
+
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
4095
|
+
:credit_card => {
|
4096
|
+
:number => Braintree::Test::CreditCardNumbers::Visa,
|
4097
|
+
:expiration_date => "05/2009"
|
4098
|
+
},
|
4099
|
+
:options => {
|
4100
|
+
:skip_advanced_fraud_checking => true
|
4101
|
+
}
|
4102
|
+
)
|
4103
|
+
result.success?.should == true
|
4104
|
+
result.transaction.risk_data.should be_nil
|
4105
|
+
end
|
4102
4106
|
end
|
4103
4107
|
|
4104
4108
|
it "works with Apple Pay params" do
|
@@ -5714,6 +5718,8 @@ describe Braintree::Transaction do
|
|
5714
5718
|
authorization_adjustment.amount.should == "-20.00"
|
5715
5719
|
authorization_adjustment.success.should == true
|
5716
5720
|
authorization_adjustment.timestamp.should be_a Time
|
5721
|
+
authorization_adjustment.processor_response_code.should == "1000"
|
5722
|
+
authorization_adjustment.processor_response_text.should == "Approved"
|
5717
5723
|
end
|
5718
5724
|
end
|
5719
5725
|
|
@@ -45,6 +45,12 @@ unless defined?(INTEGRATION_SPEC_HELPER_LOADED)
|
|
45
45
|
end
|
46
46
|
end
|
47
47
|
|
48
|
+
def with_advanced_fraud_integration_merchant(&block)
|
49
|
+
with_other_merchant("advanced_fraud_integration_merchant_id", "advanced_fraud_integration_public_key", "advanced_fraud_integration_private_key") do
|
50
|
+
block.call
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
48
54
|
def with_altpay_merchant(&block)
|
49
55
|
with_other_merchant("altpay_merchant", "altpay_merchant_public_key", "altpay_merchant_private_key", &block)
|
50
56
|
end
|
@@ -29,6 +29,7 @@ describe Braintree::DisputeSearch do
|
|
29
29
|
:reference_number,
|
30
30
|
:reply_by_date,
|
31
31
|
:transaction_id,
|
32
|
+
:transaction_source,
|
32
33
|
].each do |field|
|
33
34
|
it "allows searching on #{field}" do
|
34
35
|
search = Braintree::DisputeSearch.new
|
@@ -43,7 +44,6 @@ describe Braintree::DisputeSearch do
|
|
43
44
|
:kind,
|
44
45
|
:reason,
|
45
46
|
:status,
|
46
|
-
:transaction_source,
|
47
47
|
].each do |field|
|
48
48
|
it "raises if provided an unknown #{field} value" do
|
49
49
|
search = Braintree::DisputeSearch.new
|
@@ -214,16 +214,20 @@ describe Braintree::Transaction do
|
|
214
214
|
transaction = Braintree::Transaction._new(
|
215
215
|
:gateway,
|
216
216
|
:authorization_adjustments => [
|
217
|
-
{ :timestamp => timestamp, :amount => "12.00", :success => true },
|
218
|
-
{ :timestamp => timestamp, :amount => "12.34", :success => false },
|
217
|
+
{ :timestamp => timestamp, :processor_response_code => "1000", :processor_response_text => "Approved", :amount => "12.00", :success => true },
|
218
|
+
{ :timestamp => timestamp, :processor_response_code => "3000", :processor_response_text => "Processor Network Unavailable - Try Again", :amount => "12.34", :success => false },
|
219
219
|
])
|
220
220
|
transaction.authorization_adjustments.size.should == 2
|
221
221
|
transaction.authorization_adjustments[0].amount.should == "12.00"
|
222
222
|
transaction.authorization_adjustments[0].success.should == true
|
223
223
|
transaction.authorization_adjustments[0].timestamp.should == timestamp
|
224
|
+
transaction.authorization_adjustments[0].processor_response_code.should == "1000"
|
225
|
+
transaction.authorization_adjustments[0].processor_response_text.should == "Approved"
|
224
226
|
transaction.authorization_adjustments[1].amount.should == "12.34"
|
225
227
|
transaction.authorization_adjustments[1].success.should == false
|
226
228
|
transaction.authorization_adjustments[1].timestamp.should == timestamp
|
229
|
+
transaction.authorization_adjustments[1].processor_response_code.should == "3000"
|
230
|
+
transaction.authorization_adjustments[1].processor_response_text.should == "Processor Network Unavailable - Try Again"
|
227
231
|
end
|
228
232
|
|
229
233
|
it "handles receiving custom as an empty string" do
|
metadata
CHANGED
@@ -1,27 +1,27 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: braintree
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.90.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Braintree
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-07-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: builder
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: 2.0.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 2.0.0
|
27
27
|
description: Ruby library for integrating with the Braintree Gateway
|
@@ -117,6 +117,7 @@ files:
|
|
117
117
|
- lib/braintree/plan_gateway.rb
|
118
118
|
- lib/braintree/resource_collection.rb
|
119
119
|
- lib/braintree/risk_data.rb
|
120
|
+
- lib/braintree/samsung_pay_card.rb
|
120
121
|
- lib/braintree/settlement_batch.rb
|
121
122
|
- lib/braintree/settlement_batch_summary.rb
|
122
123
|
- lib/braintree/settlement_batch_summary_gateway.rb
|
@@ -147,6 +148,7 @@ files:
|
|
147
148
|
- lib/braintree/transaction/ideal_payment_details.rb
|
148
149
|
- lib/braintree/transaction/masterpass_card_details.rb
|
149
150
|
- lib/braintree/transaction/paypal_details.rb
|
151
|
+
- lib/braintree/transaction/samsung_pay_card_details.rb
|
150
152
|
- lib/braintree/transaction/status_details.rb
|
151
153
|
- lib/braintree/transaction/subscription_details.rb
|
152
154
|
- lib/braintree/transaction/us_bank_account_details.rb
|
@@ -214,6 +216,7 @@ files:
|
|
214
216
|
- spec/integration/braintree/payment_method_us_bank_account_spec.rb
|
215
217
|
- spec/integration/braintree/paypal_account_spec.rb
|
216
218
|
- spec/integration/braintree/plan_spec.rb
|
219
|
+
- spec/integration/braintree/samsung_pay_card_spec.rb
|
217
220
|
- spec/integration/braintree/settlement_batch_summary_spec.rb
|
218
221
|
- spec/integration/braintree/subscription_spec.rb
|
219
222
|
- spec/integration/braintree/test/transaction_amounts_spec.rb
|
@@ -295,17 +298,17 @@ require_paths:
|
|
295
298
|
- lib
|
296
299
|
required_ruby_version: !ruby/object:Gem::Requirement
|
297
300
|
requirements:
|
298
|
-
- -
|
301
|
+
- - ">="
|
299
302
|
- !ruby/object:Gem::Version
|
300
303
|
version: '0'
|
301
304
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
302
305
|
requirements:
|
303
|
-
- -
|
306
|
+
- - ">="
|
304
307
|
- !ruby/object:Gem::Version
|
305
308
|
version: '0'
|
306
309
|
requirements: []
|
307
310
|
rubyforge_project: braintree
|
308
|
-
rubygems_version: 2.
|
311
|
+
rubygems_version: 2.7.7
|
309
312
|
signing_key:
|
310
313
|
specification_version: 4
|
311
314
|
summary: Braintree Gateway Ruby Client Library
|