braintree 4.1.0 → 4.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d934c307cf9a97cf867edc42477230eba5680d7183c73ce691aef287abbb01d6
4
- data.tar.gz: b817ec7febb2c2e050c2ed3a19820e67b93890a34211fc5364ba4fc0f1487778
3
+ metadata.gz: 6b9382c924f47002feeb68618490bcaa17da29666dff9917252a54141b30a6f7
4
+ data.tar.gz: 2744c9e6e6835a1213a89e35ce170efd74cf8bdab1b6b8d7f3c1a61bcc359b35
5
5
  SHA512:
6
- metadata.gz: d527fd7a32ac2240f108531ad040d6525ecc7a87fd23e18b5de3e4674ebc1daf7197ccb260ecad6e58bd6ed77132aac25249ed90f1d3e630054c3995eb28171e
7
- data.tar.gz: 2e8ff42991a0120a0aef55705780b0659576b550cb62c6f499f44011c5b7bab441d64f3d6ad3ee27dd6f16b2787e24f849d01d8429c7bcf415d356e621cee81f
6
+ metadata.gz: d478c728fccb782500075966a9967918b2728b60925cf9e294da7447991c91a5898dfb1bdd46040f91f7a0c51f17fe8a795205adbbc1de97e6741c2cb18727e7
7
+ data.tar.gz: fa5d2f84f33dd66a5049b99f4ea201cfb9787ce3686e6ef56921e9b3d3b25f080eac81b34ad042daa2445bc6090a33b3714d171a221d811a5858a8cd89bbf8d6
@@ -385,6 +385,7 @@ module Braintree
385
385
  SubscriptionStatusMustBePastDue = "91531"
386
386
  TaxAmountCannotBeNegative = "81534"
387
387
  TaxAmountFormatIsInvalid = "81535"
388
+ TaxAmountIsRequiredForAibSwedish = "815224"
388
389
  TaxAmountIsTooLarge = "81536"
389
390
  ThreeDSecureAuthenticationFailed = "81571"
390
391
  ThreeDSecureAuthenticationIdDoesntMatchNonceThreeDSecureAuthentication = "915198"
@@ -15,6 +15,7 @@ module Braintree
15
15
  end
16
16
 
17
17
  attr_reader :bin_data
18
+ attr_reader :default
18
19
  attr_reader :details
19
20
  attr_reader :nonce
20
21
  attr_reader :three_d_secure_info
@@ -23,14 +24,16 @@ module Braintree
23
24
 
24
25
  def initialize(gateway, attributes) # :nodoc:
25
26
  @gateway = gateway
26
- @nonce = attributes.fetch(:nonce)
27
- @type = attributes.fetch(:type)
27
+ set_instance_variables_from_hash(attributes)
28
28
  @details = PaymentMethodNonceDetails.new(attributes[:details]) if attributes[:details]
29
- @authentication_insight = attributes.fetch(:authentication_insight, nil)
30
29
  @three_d_secure_info = ThreeDSecureInfo.new(attributes[:three_d_secure_info]) if attributes[:three_d_secure_info]
31
30
  @bin_data = BinData.new(attributes[:bin_data]) if attributes[:bin_data]
32
31
  end
33
32
 
33
+ def default?
34
+ @default
35
+ end
36
+
34
37
  def to_s # :nodoc:
35
38
  nonce
36
39
  end
@@ -1,7 +1,7 @@
1
1
  module Braintree
2
2
  module Version
3
3
  Major = 4
4
- Minor = 1
4
+ Minor = 2
5
5
  Tiny = 0
6
6
 
7
7
  String = "#{Major}.#{Minor}.#{Tiny}"
@@ -32,6 +32,7 @@ describe Braintree::PaymentMethodNonce do
32
32
  result.payment_method_nonce.should_not be_nil
33
33
  result.payment_method_nonce.nonce.should_not be_nil
34
34
  result.payment_method_nonce.details.should_not be_nil
35
+ result.payment_method_nonce.default?.should be_truthy
35
36
  end
36
37
 
37
38
  it "correctly raises and exception for a non existent token" do
@@ -67,6 +68,7 @@ describe Braintree::PaymentMethodNonce do
67
68
  payment_method_nonce.should_not be_nil
68
69
  payment_method_nonce.nonce.should_not be_nil
69
70
  payment_method_nonce.details.should_not be_nil
71
+ payment_method_nonce.default?.should be_truthy
70
72
  end
71
73
  end
72
74
 
@@ -5058,6 +5058,22 @@ describe Braintree::Transaction do
5058
5058
  result.errors.for(:transaction).on(:currency_iso_code)[0].code.should == Braintree::ErrorCodes::Transaction::CurrencyCodeNotSupportedByMerchantAccount
5059
5059
  end
5060
5060
 
5061
+ it "validates tax_amount for Aib domestic sweden transaction and returns error" do
5062
+ params = {
5063
+ :transaction => {
5064
+ :amount => Braintree::Test::TransactionAmounts::Authorize,
5065
+ :merchant_account_id => SpecHelper::AibSwedenMaMerchantAccountId,
5066
+ :credit_card => {
5067
+ :number => Braintree::Test::CreditCardNumbers::Visa,
5068
+ :expiration_date => "05/2030"
5069
+ }
5070
+ }
5071
+ }
5072
+ result = Braintree::Transaction.sale(params[:transaction])
5073
+ result.success?.should == false
5074
+ result.errors.for(:transaction).on(:tax_amount)[0].code.should == Braintree::ErrorCodes::Transaction::TaxAmountIsRequiredForAibSwedish
5075
+ end
5076
+
5061
5077
  it "skips advanced fraud checking if transaction[options][skip_advanced_fraud_checking] is set to true" do
5062
5078
  with_advanced_fraud_kount_integration_merchant do
5063
5079
  result = Braintree::Transaction.sale(
data/spec/spec_helper.rb CHANGED
@@ -42,6 +42,7 @@ unless defined?(SPEC_HELPER_LOADED)
42
42
  HiperBRLMerchantAccountId = "hiper_brl"
43
43
  CardProcessorBRLMerchantAccountId = "card_processor_brl"
44
44
  FakeFirstDataMerchantAccountId = "fake_first_data_merchant_account"
45
+ AibSwedenMaMerchantAccountId = "aib_swe_ma"
45
46
 
46
47
  TrialPlan = {
47
48
  :description => "Plan for integration tests -- with trial",
@@ -0,0 +1,40 @@
1
+ require File.expand_path(File.dirname(__FILE__) + "/../../spec_helper")
2
+
3
+ describe Braintree::PaymentMethodNonce do
4
+ let(:payment_method_nonce) {
5
+ Braintree::PaymentMethodNonce._new(
6
+ :gateway,
7
+ :nonce => "some-nonce",
8
+ :type => "CreditCard",
9
+ :default => true,
10
+ :details => {
11
+ :bin => "some-bin"
12
+ },
13
+ :three_d_secure_info => {
14
+ :liability_shift_possible => false,
15
+ :liability_shifted => false
16
+ },
17
+ :bin_data => {
18
+ :country_of_issuance => "USA"
19
+ },
20
+ )
21
+ }
22
+
23
+ describe "#initialize" do
24
+ it "sets attributes" do
25
+ expect(payment_method_nonce.nonce).to eq("some-nonce")
26
+ expect(payment_method_nonce.type).to eq("CreditCard")
27
+ expect(payment_method_nonce.default).to be true
28
+ expect(payment_method_nonce.details.bin).to eq("some-bin")
29
+ expect(payment_method_nonce.three_d_secure_info.liability_shift_possible).to be false
30
+ expect(payment_method_nonce.three_d_secure_info.liability_shifted).to be false
31
+ expect(payment_method_nonce.bin_data.country_of_issuance).to eq("USA")
32
+ end
33
+ end
34
+
35
+ describe "default" do
36
+ it "is aliased to default?" do
37
+ expect(payment_method_nonce.default?).to be true
38
+ end
39
+ end
40
+ end
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.1.0
4
+ version: 4.2.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-05-25 00:00:00.000000000 Z
11
+ date: 2021-06-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: builder
@@ -274,6 +274,7 @@ files:
274
274
  - spec/unit/braintree/modification_spec.rb
275
275
  - spec/unit/braintree/payment_method_nonce_details_payer_info_spec.rb
276
276
  - spec/unit/braintree/payment_method_nonce_details_spec.rb
277
+ - spec/unit/braintree/payment_method_nonce_spec.rb
277
278
  - spec/unit/braintree/payment_method_spec.rb
278
279
  - spec/unit/braintree/paypal_account_spec.rb
279
280
  - spec/unit/braintree/resource_collection_spec.rb
@@ -328,7 +329,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
328
329
  - !ruby/object:Gem::Version
329
330
  version: '0'
330
331
  requirements: []
331
- rubygems_version: 3.2.18
332
+ rubygems_version: 3.2.20
332
333
  signing_key:
333
334
  specification_version: 4
334
335
  summary: Braintree Ruby Server SDK