braintree 2.91.0 → 2.92.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
2
  SHA256:
3
- metadata.gz: 703d5a600446c3eccc5d310b70091319b9d426c2db3826851bbcd55fed478ecc
4
- data.tar.gz: d98833b2c0937b365e18817b5bf5c0335695282e4aad32ecf08537fc5f36e3b8
3
+ metadata.gz: 8ee8dac5bb756fb408c50fa5acef0ad21bf4d10127ade82df57828bd7123484f
4
+ data.tar.gz: adb2042d479a2418d62e8da23b6aeaa77490e46dea06daefbff0f4c19209c59c
5
5
  SHA512:
6
- metadata.gz: 83411d93215207167d8aa5f3f52a2af58b0744f502c0ec64989dee900f87b415861563f11809e9f9f428c09ed63b7a4f47afb6a419708cfc78d5a3ae7ae3c847
7
- data.tar.gz: bd72dec425b6f7164c5ca5f2560aacc5a62e3db20ea3b01afee70683fe964f888fd4e77f35139d7034e8dbc083a5bd15f5138844d01569b21614f675b64aed77
6
+ metadata.gz: 5a1b0f3e1a7600a0a699baa9a398585704960e6fa78958be8ec9e8a95fa191d234b73c91294b15cb8f99ce699e2aaec9af2c5c9c5f28778895be039782fc96a2
7
+ data.tar.gz: 67f11e2d63c8ce0e0ca9bdd25a8b160ee0453c371495b9e9b4d83220c7c990963f496de28b08200852e8bfb76d9afad73a138136aeba0a22d303594a138008cb
@@ -95,6 +95,7 @@ require "braintree/paypal_account"
95
95
  require "braintree/paypal_account_gateway"
96
96
  require "braintree/plan"
97
97
  require "braintree/plan_gateway"
98
+ require "braintree/processor_response_types"
98
99
  require "braintree/risk_data"
99
100
  require "braintree/facilitated_details"
100
101
  require "braintree/facilitator_details"
@@ -7,6 +7,7 @@ module Braintree
7
7
  attr_reader :timestamp
8
8
  attr_reader :processor_response_code
9
9
  attr_reader :processor_response_text
10
+ attr_reader :processor_response_type
10
11
 
11
12
  class << self
12
13
  protected :new
@@ -26,6 +26,7 @@ module Braintree
26
26
  attr_reader :merchant_account_id
27
27
  attr_reader :processor_response_code
28
28
  attr_reader :processor_response_text
29
+ attr_reader :processor_response_type
29
30
  attr_reader :risk_data
30
31
  attr_reader :status
31
32
 
@@ -0,0 +1,7 @@
1
+ module Braintree
2
+ module ProcessorResponseTypes
3
+ Approved = 'approved'
4
+ SoftDeclined = 'soft_declined'
5
+ HardDeclined = 'hard_declined'
6
+ end
7
+ end
@@ -22,12 +22,14 @@ module Braintree
22
22
  attr_reader :supported_networks
23
23
  attr_reader :transaction
24
24
  attr_reader :us_bank_account_verification
25
+ attr_reader :credit_card_verification
25
26
 
26
27
  def initialize(attributes = {}) # :nodoc:
27
28
  @attrs = attributes.keys
28
29
  attributes.each do |key, value|
29
30
  instance_variable_set("@#{key}", value)
30
31
  end
32
+ @credit_card_verification = @verification
31
33
  end
32
34
 
33
35
  def inspect # :nodoc:
@@ -5,6 +5,7 @@ module Braintree
5
5
  module TransactionAmounts
6
6
  Authorize = "1000.00"
7
7
  Decline = "2000.00"
8
+ HardDecline = "2015.00"
8
9
  Fail = "3000.00"
9
10
  end
10
11
  end
@@ -83,6 +83,7 @@ module Braintree
83
83
  attr_reader :android_pay_details
84
84
  attr_reader :apple_pay_details
85
85
  attr_reader :authorization_adjustments
86
+ attr_reader :authorization_expires_at
86
87
  attr_reader :authorized_transaction_id
87
88
  attr_reader :avs_error_response_code
88
89
  attr_reader :avs_postal_code_response_code
@@ -118,6 +119,7 @@ module Braintree
118
119
  attr_reader :processor_authorization_code # Authorization code from the processor.
119
120
  attr_reader :processor_response_code # Response code from the processor.
120
121
  attr_reader :processor_response_text # Response text from the processor.
122
+ attr_reader :processor_response_type # Response type from the processor.
121
123
  attr_reader :processor_settlement_response_code # Settlement response code from the processor.
122
124
  attr_reader :processor_settlement_response_text # Settlement response text from the processor.
123
125
  attr_reader :purchase_order_number
@@ -1,7 +1,7 @@
1
1
  module Braintree
2
2
  module Version
3
3
  Major = 2
4
- Minor = 91
4
+ Minor = 92
5
5
  Tiny = 0
6
6
 
7
7
  String = "#{Major}.#{Minor}.#{Tiny}"
@@ -186,22 +186,5 @@ describe Braintree::ClientToken do
186
186
  end
187
187
  end
188
188
  end
189
-
190
- context "SEPA" do
191
- it "raises error for passing in sepa related params" do
192
- with_altpay_merchant do
193
- result = Braintree::Customer.create
194
- customer_id = result.customer.id
195
-
196
- expect do
197
- Braintree::ClientToken.generate(
198
- :customer_id => customer_id,
199
- :sepa_mandate_acceptance_location => "Hamburg, Germany",
200
- :sepa_mandate_type => Braintree::EuropeBankAccount::MandateType::Business
201
- )
202
- end.to raise_error(ArgumentError, "invalid keys: sepa_mandate_acceptance_location, sepa_mandate_type")
203
- end
204
- end
205
- end
206
189
  end
207
190
  end
@@ -17,6 +17,11 @@ describe Braintree::CreditCardVerification, "search" do
17
17
  result = Braintree::CreditCardVerification.create(verification_params)
18
18
 
19
19
  result.should be_success
20
+ result.credit_card_verification.id.should =~ /^\w{6,}$/
21
+ result.credit_card_verification.status.should == Braintree::CreditCardVerification::Status::Verified
22
+ result.credit_card_verification.processor_response_code.should == "1000"
23
+ result.credit_card_verification.processor_response_text.should == "Approved"
24
+ result.credit_card_verification.processor_response_type.should == Braintree::ProcessorResponseTypes::Approved
20
25
  end
21
26
 
22
27
  it "returns processor response code and text as well as the additional processor response if declined" do
@@ -33,10 +38,11 @@ describe Braintree::CreditCardVerification, "search" do
33
38
  result = Braintree::CreditCardVerification.create(verification_params)
34
39
 
35
40
  result.success?.should == false
36
- result.verification.id.should =~ /^\w{6,}$/
37
- result.verification.status.should == Braintree::CreditCardVerification::Status::ProcessorDeclined
38
- result.verification.processor_response_code.should == "2000"
39
- result.verification.processor_response_text.should == "Do Not Honor"
41
+ result.credit_card_verification.id.should =~ /^\w{6,}$/
42
+ result.credit_card_verification.status.should == Braintree::CreditCardVerification::Status::ProcessorDeclined
43
+ result.credit_card_verification.processor_response_code.should == "2000"
44
+ result.credit_card_verification.processor_response_text.should == "Do Not Honor"
45
+ result.credit_card_verification.processor_response_type.should == Braintree::ProcessorResponseTypes::SoftDeclined
40
46
  end
41
47
 
42
48
  it "returns validation errors" do
@@ -204,18 +204,6 @@ describe Braintree::PaymentMethod do
204
204
  venmo_account.customer_id.should == customer.id
205
205
  end
206
206
 
207
- it "raise server error when we attempt to create europe bank account payment method" do
208
- customer = Braintree::Customer.create.customer
209
- token = SecureRandom.hex(16)
210
- expect do
211
- Braintree::PaymentMethod.create(
212
- :payment_method_nonce => Braintree::Test::Nonce::Europe,
213
- :customer_id => customer.id,
214
- :token => token
215
- )
216
- end.to raise_error(Braintree::ServerError)
217
- end
218
-
219
207
  it "allows passing the make_default option alongside the nonce" do
220
208
  customer = Braintree::Customer.create!
221
209
  result = Braintree::CreditCard.create(
@@ -287,6 +287,9 @@ describe Braintree::Transaction do
287
287
  result.transaction.type.should == "sale"
288
288
  result.transaction.amount.should == BigDecimal.new(Braintree::Test::TransactionAmounts::Authorize)
289
289
  result.transaction.processor_authorization_code.should_not be_nil
290
+ result.transaction.processor_response_code.should == "1000"
291
+ result.transaction.processor_response_text.should == "Approved"
292
+ result.transaction.processor_response_type.should == Braintree::ProcessorResponseTypes::Approved
290
293
  result.transaction.voice_referral_number.should be_nil
291
294
  result.transaction.credit_card_details.bin.should == Braintree::Test::CreditCardNumbers::Visa[0, 6]
292
295
  result.transaction.credit_card_details.last_4.should == Braintree::Test::CreditCardNumbers::Visa[-4..-1]
@@ -384,7 +387,7 @@ describe Braintree::Transaction do
384
387
  result.success?.should == true
385
388
  end
386
389
 
387
- it "returns processor response code and text as well as the additional processor response if declined" do
390
+ it "returns processor response code and text as well as the additional processor response if soft declined" do
388
391
  result = Braintree::Transaction.create(
389
392
  :type => "sale",
390
393
  :amount => Braintree::Test::TransactionAmounts::Decline,
@@ -399,9 +402,29 @@ describe Braintree::Transaction do
399
402
  result.transaction.status.should == Braintree::Transaction::Status::ProcessorDeclined
400
403
  result.transaction.processor_response_code.should == "2000"
401
404
  result.transaction.processor_response_text.should == "Do Not Honor"
405
+ result.transaction.processor_response_type.should == Braintree::ProcessorResponseTypes::SoftDeclined
402
406
  result.transaction.additional_processor_response.should == "2000 : Do Not Honor"
403
407
  end
404
408
 
409
+ it "returns processor response code and text as well as the additional processor response if hard declined" do
410
+ result = Braintree::Transaction.create(
411
+ :type => "sale",
412
+ :amount => Braintree::Test::TransactionAmounts::HardDecline,
413
+ :credit_card => {
414
+ :number => Braintree::Test::CreditCardNumbers::Visa,
415
+ :expiration_date => "05/2009"
416
+ }
417
+ )
418
+ result.success?.should == false
419
+ result.transaction.id.should =~ /^\w{6,}$/
420
+ result.transaction.type.should == "sale"
421
+ result.transaction.status.should == Braintree::Transaction::Status::ProcessorDeclined
422
+ result.transaction.processor_response_code.should == "2015"
423
+ result.transaction.processor_response_text.should == "Transaction Not Allowed"
424
+ result.transaction.processor_response_type.should == Braintree::ProcessorResponseTypes::HardDeclined
425
+ result.transaction.additional_processor_response.should == "2015 : Transaction Not Allowed"
426
+ end
427
+
405
428
  it "accepts all four country codes" do
406
429
  result = Braintree::Transaction.sale(
407
430
  :amount => "100",
@@ -4011,6 +4034,7 @@ describe Braintree::Transaction do
4011
4034
  transaction.order_id.should == "123"
4012
4035
  transaction.channel.should == "MyShoppingCartProvider"
4013
4036
  transaction.processor_response_code.should == "1000"
4037
+ transaction.authorization_expires_at.between?(Time.now, Time.now + (60 * 60 * 24 * 60)).should == true
4014
4038
  transaction.created_at.between?(Time.now - 60, Time.now).should == true
4015
4039
  transaction.updated_at.between?(Time.now - 60, Time.now).should == true
4016
4040
  transaction.credit_card_details.bin.should == "510510"
@@ -5400,6 +5424,7 @@ describe Braintree::Transaction do
5400
5424
  transaction.order_id.should == "123"
5401
5425
  transaction.channel.should == "MyShoppingCartProvider"
5402
5426
  transaction.processor_response_code.should == "1000"
5427
+ transaction.authorization_expires_at.between?(Time.now, Time.now + (60 * 60 * 24 * 60)).should == true
5403
5428
  transaction.created_at.between?(Time.now - 60, Time.now).should == true
5404
5429
  transaction.updated_at.between?(Time.now - 60, Time.now).should == true
5405
5430
  transaction.credit_card_details.bin.should == "510510"
@@ -5922,6 +5947,34 @@ describe Braintree::Transaction do
5922
5947
  authorization_adjustment.processor_response_code.should == "1000"
5923
5948
  authorization_adjustment.processor_response_text.should == "Approved"
5924
5949
  end
5950
+
5951
+ it "includes authorization adjustments soft declined on found transactions" do
5952
+ found_transaction = Braintree::Transaction.find("authadjustmenttransactionsoftdeclined")
5953
+
5954
+ found_transaction.authorization_adjustments.count.should == 1
5955
+
5956
+ authorization_adjustment = found_transaction.authorization_adjustments.first
5957
+ authorization_adjustment.amount.should == "-20.00"
5958
+ authorization_adjustment.success.should == false
5959
+ authorization_adjustment.timestamp.should be_a Time
5960
+ authorization_adjustment.processor_response_code.should == "3000"
5961
+ authorization_adjustment.processor_response_text.should == "Processor Network Unavailable - Try Again"
5962
+ authorization_adjustment.processor_response_type.should == Braintree::ProcessorResponseTypes::SoftDeclined
5963
+ end
5964
+
5965
+ it "includes authorization adjustments hard declined on found transactions" do
5966
+ found_transaction = Braintree::Transaction.find("authadjustmenttransactionharddeclined")
5967
+
5968
+ found_transaction.authorization_adjustments.count.should == 1
5969
+
5970
+ authorization_adjustment = found_transaction.authorization_adjustments.first
5971
+ authorization_adjustment.amount.should == "-20.00"
5972
+ authorization_adjustment.success.should == false
5973
+ authorization_adjustment.timestamp.should be_a Time
5974
+ authorization_adjustment.processor_response_code.should == "2015"
5975
+ authorization_adjustment.processor_response_text.should == "Transaction Not Allowed"
5976
+ authorization_adjustment.processor_response_type.should == Braintree::ProcessorResponseTypes::HardDeclined
5977
+ end
5925
5978
  end
5926
5979
 
5927
5980
  describe "vault_credit_card" do
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: 2.91.0
4
+ version: 2.92.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-10-10 00:00:00.000000000 Z
11
+ date: 2018-11-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: builder
@@ -117,6 +117,7 @@ files:
117
117
  - lib/braintree/paypal_account_gateway.rb
118
118
  - lib/braintree/plan.rb
119
119
  - lib/braintree/plan_gateway.rb
120
+ - lib/braintree/processor_response_types.rb
120
121
  - lib/braintree/resource_collection.rb
121
122
  - lib/braintree/risk_data.rb
122
123
  - lib/braintree/samsung_pay_card.rb