braintree 2.89.0 → 2.90.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 1dbdc2a3360539354ac8dee567e437609b10047e
4
- data.tar.gz: b79dfe5dc9dc997325c094d76e35fe8e952cfe54
2
+ SHA256:
3
+ metadata.gz: 4ded1b6a4f547ae738fdb43c3762fcc51515f8276833bcede2828f5b51a6720a
4
+ data.tar.gz: be2edc1892560c721da8cef1b116b49229b2f790c5e0bf4b8f668625e0074ada
5
5
  SHA512:
6
- metadata.gz: 2997abeff62b6067f00979a8fb13d215f7716dcdd994f3451e77c09d0ecf2649dc267e3dfaadc165e6e36c54a915be58fe1b6ad1930ec641dffe8b3f72232e32
7
- data.tar.gz: 6f0d883162764a99a777d84c33c9ff04a41c175a1acde9ec10738e10fde37ee9e46a66dd99882b5219cbd2153125362eb0aef641231d4766131aaac9f777142d
6
+ metadata.gz: 8daaea6f26713cea097e60bcb39b68f912638c385f40e57fced65d548554c6ad73c78cee736a3c30f96915a10922c7425281c5a0b99f875672c40482df9672ca
7
+ data.tar.gz: c13b688529c17c8c5b5a82ff95e67bbc47058381f29e386f1b5a9da11a84d51528454d4de85a0f2f6afff419e7288e304cb71f041325339356e372fc028ac464
@@ -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"
@@ -5,6 +5,8 @@ module Braintree
5
5
  attr_reader :amount
6
6
  attr_reader :success
7
7
  attr_reader :timestamp
8
+ attr_reader :processor_response_code
9
+ attr_reader :processor_response_text
8
10
 
9
11
  class << self
10
12
  protected :new
@@ -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,
@@ -11,5 +11,6 @@ module Braintree
11
11
  IdealPayment = 'ideal_payment'
12
12
  VisaCheckoutCard = 'visa_checkout_card'
13
13
  MasterpassCard = 'masterpass_card'
14
+ SamsungPayCard = 'samsung_pay_card'
14
15
  end
15
16
  end
@@ -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
@@ -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
@@ -1,7 +1,7 @@
1
1
  module Braintree
2
2
  module Version
3
3
  Major = 2
4
- Minor = 89
4
+ Minor = 90
5
5
  Tiny = 0
6
6
 
7
7
  String = "#{Major}.#{Minor}.#{Tiny}"
@@ -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
- customer = Braintree::Customer.create!
142
- credit_card = Braintree::CreditCard.create!(
143
- :cardholder_name => "Original Holder",
144
- :customer_id => customer.id,
145
- :cvv => "123",
146
- :number => Braintree::Test::CreditCardNumbers::Visa,
147
- :expiration_date => "05/2020",
148
- :options => {:verify_card => true}
149
- )
150
- verification = credit_card.verification
151
- verification.risk_data.should respond_to(:id)
152
- verification.risk_data.should respond_to(:decision)
153
- verification.risk_data.should respond_to(:device_data_captured)
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 = "FIRST_TOKEN_#{rand(36**3).to_s(36)}"
243
- second_token = "SECOND_TOKEN_#{rand(36**3).to_s(36)}"
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 = "PAYMENT_METHOD_TOKEN_#{rand(36**3).to_s(36)}"
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 = "PAYMENT_METHOD_TOKEN_#{rand(36**3).to_s(36)}"
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 = "PAYMENT_METHOD_TOKEN_#{rand(36**3).to_s(36)}"
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 = "PAYMENT_METHOD_TOKEN_#{rand(36**3).to_s(36)}"
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 = "PAYMENT_METHOD_TOKEN_#{rand(36**3).to_s(36)}"
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 = "FUTURE_PAYMENT_#{rand(36**3).to_s(36)}"
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 = "PAYPAL_ACCOUNT_TOKEN_#{rand(36**3).to_s(36)}"
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 = "CREDIT_CARD_#{rand(36**3).to_s(36)}"
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 = "CREDIT_CARD_#{rand(36**3).to_s(36)}"
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 = "UPDATED_TOKEN-" + rand(36**3).to_s(36)
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
- result = Braintree::Transaction.create(
128
- :type => "sale",
129
- :amount => 1_00,
130
- :credit_card => {
131
- :number => Braintree::Test::CreditCardNumbers::CardTypeIndicators::Prepaid,
132
- :expiration_date => "05/2009"
133
- }
134
- )
135
- result.transaction.risk_data.should be_a(Braintree::RiskData)
136
- result.transaction.risk_data.should respond_to(:id)
137
- result.transaction.risk_data.should respond_to(:decision)
138
- result.transaction.risk_data.should respond_to(:device_data_captured)
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
- result = Braintree::Transaction.sale(
4091
- :amount => Braintree::Test::TransactionAmounts::Authorize,
4092
- :credit_card => {
4093
- :number => Braintree::Test::CreditCardNumbers::Visa,
4094
- :expiration_date => "05/2009"
4095
- },
4096
- :options => {
4097
- :skip_advanced_fraud_checking => true
4098
- }
4099
- )
4100
- result.success?.should == true
4101
- result.transaction.risk_data.id.should be_nil
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.89.0
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-05-21 00:00:00.000000000 Z
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.2.0
311
+ rubygems_version: 2.7.7
309
312
  signing_key:
310
313
  specification_version: 4
311
314
  summary: Braintree Gateway Ruby Client Library