braintree 4.8.0 → 4.9.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: 67348684ea4b3f86ef0063df5559298bf7563901010c0d68ee5fce5a64710c4c
4
- data.tar.gz: 3b32cd4ccfe99e604a42a871003e38fa1679afd62bd8a44ffca6e7524dc30e85
3
+ metadata.gz: a83d6966dbe837625c68efa0fdee683820705fba7c4c1f65118892d61ea2261b
4
+ data.tar.gz: f947bda53f860763dc3c57080ded11b1823e9c48e71efb05a89bb0490e7dad79
5
5
  SHA512:
6
- metadata.gz: 8f7f99a0d53c1e98faf5e0ef34fd47bee88be1a366412d267ada59d309b93d9119fcef2f2c0c535305a7de9340a044ddaf73550f72b69e0ab1e5ff403debf20e
7
- data.tar.gz: ede1ae81a11c86079c8a7cd2f62673c4bbfefe5ef273bfb899d81583a302e39cb289fd9c1fdd5dfe83e573c55db6ff1ebf041a460f9a0089850b59468979b75a
6
+ metadata.gz: f9a82a773ef66320358e028dbb9a403f6bcc97d7c32d727bff0b00a2936ab54ae8bbfba201024a7e8d5956ef17be0247b61f0e8e3cc23aecb819a5e77d833a9a
7
+ data.tar.gz: 21a069ff7615e48429c6882ed354334f37fd7e0600e6696b97b000178a03531955d6156dcd77b3927bc2d35a144ecafa07d65d2b6d9566d5202630bfac62cb37
@@ -12,6 +12,7 @@ module Braintree
12
12
 
13
13
  attr_reader :bin
14
14
  attr_reader :card_type
15
+ attr_reader :cardholder_name
15
16
  attr_reader :commercial
16
17
  attr_reader :country_of_issuance
17
18
  attr_reader :created_at
@@ -7,7 +7,9 @@ module Braintree
7
7
  attr_reader :amount_disputed
8
8
  attr_reader :amount_won
9
9
  attr_reader :case_number
10
- attr_reader :chargeback_protection_level
10
+ # NEXT_MAJOR_VERSION Remove this attribute
11
+ # DEPRECATED The chargeback_protection_level attribute is deprecated in favor of protection_level
12
+ attr_reader :chargeback_protection_level #Deprecated
11
13
  attr_reader :created_at
12
14
  attr_reader :currency_iso_code
13
15
  attr_reader :date_opened
@@ -20,6 +22,7 @@ module Braintree
20
22
  attr_reader :original_dispute_id
21
23
  attr_reader :paypal_messages
22
24
  attr_reader :processor_comments
25
+ attr_reader :protection_level
23
26
  attr_reader :reason
24
27
  attr_reader :reason_code
25
28
  attr_reader :reason_description
@@ -75,6 +78,14 @@ module Braintree
75
78
  All = constants.map { |c| const_get(c) }
76
79
  end
77
80
 
81
+ module ProtectionLevel
82
+ EffortlessCBP = "Effortless Chargeback Protection tool"
83
+ StandardCBP = "Chargeback Protection tool"
84
+ NoProtection = "No Protection"
85
+
86
+ All = constants.map { |c| const_get(c) }
87
+ end
88
+
78
89
  class << self
79
90
  protected :new
80
91
  def _new(*args) # :nodoc:
@@ -119,6 +130,11 @@ module Braintree
119
130
  @amount = Util.to_big_decimal(amount)
120
131
  @amount_disputed = Util.to_big_decimal(amount_disputed)
121
132
  @amount_won = Util.to_big_decimal(amount_won)
133
+ if (ChargebackProtectionLevel::All - [ChargebackProtectionLevel::NotProtected]).include?(chargeback_protection_level)
134
+ @protection_level = Dispute.const_get("ProtectionLevel::#{chargeback_protection_level.capitalize}CBP")
135
+ else
136
+ @protection_level = ProtectionLevel::NoProtection
137
+ end
122
138
 
123
139
  @evidence = evidence.map do |record|
124
140
  Braintree::Dispute::Evidence.new(record)
@@ -7,8 +7,10 @@ module Braintree
7
7
  :reference_number,
8
8
  :transaction_id,
9
9
  )
10
-
10
+ # NEXT_MAJOR_VERSION Remove this attribute
11
+ # DEPRECATED The chargeback_protection_level attribute is deprecated in favor of protection_level
11
12
  multiple_value_field :chargeback_protection_level, :allows => Dispute::ChargebackProtectionLevel::All
13
+ multiple_value_field :protection_level, :allows => Dispute::ProtectionLevel::All
12
14
  multiple_value_field :kind, :allows => Dispute::Kind::All
13
15
  multiple_value_field :merchant_account_id
14
16
  multiple_value_field :reason, :allows => Dispute::Reason::All
@@ -1,7 +1,7 @@
1
1
  module Braintree
2
2
  module Version
3
3
  Major = 4
4
- Minor = 8
4
+ Minor = 9
5
5
  Tiny = 0
6
6
 
7
7
  String = "#{Major}.#{Minor}.#{Tiny}"
@@ -86,7 +86,9 @@ describe Braintree::Dispute, "search" do
86
86
  expect(collection.disputes.count).to eq(1)
87
87
  dispute = collection.disputes.first
88
88
 
89
+ # NEXT_MAJOR_VERSION Remove this assertion when chargeback_protection_level is removed from the SDK
89
90
  expect(dispute.chargeback_protection_level).to eq(Braintree::Dispute::ChargebackProtectionLevel::Effortless)
91
+ expect(dispute.protection_level).to eq(Braintree::Dispute::ProtectionLevel::EffortlessCBP)
90
92
  expect(dispute.reason).to eq(Braintree::Dispute::Reason::Fraud)
91
93
  end
92
94
 
@@ -99,7 +101,9 @@ describe Braintree::Dispute, "search" do
99
101
  expect(collection.disputes.count).to eq(1)
100
102
  dispute = collection.disputes.first
101
103
 
104
+ # NEXT_MAJOR_VERSION Remove this assertion when chargeback_protection_level is removed from the SDK
102
105
  expect(dispute.chargeback_protection_level).to eq(Braintree::Dispute::ChargebackProtectionLevel::Effortless)
106
+ expect(dispute.protection_level).to eq(Braintree::Dispute::ProtectionLevel::EffortlessCBP)
103
107
  expect(dispute.reason).to eq(Braintree::Dispute::Reason::Fraud)
104
108
  end
105
109
 
@@ -7,6 +7,12 @@ describe Braintree::ApplePayCard do
7
7
  end
8
8
  end
9
9
 
10
+ describe "cardholder_name" do
11
+ it "returns Apple pay card cardholder name" do
12
+ Braintree::ApplePayCard._new(:gateway, cardholder_name: "John Miller").cardholder_name.should == "John Miller"
13
+ end
14
+ end
15
+
10
16
  describe "default?" do
11
17
  it "is true if the Apple pay card is the default payment method for the customer" do
12
18
  Braintree::ApplePayCard._new(:gateway, :default => true).default?.should == true
@@ -41,7 +41,9 @@ describe Braintree::DisputeSearch do
41
41
  end
42
42
 
43
43
  [
44
+ # NEXT_MAJOR_VERSION Remove this assertion when chargeback_protection_level is removed from the SDK
44
45
  :chargeback_protection_level,
46
+ :protection_level,
45
47
  :kind,
46
48
  :reason,
47
49
  :status,
@@ -7,6 +7,7 @@ describe Braintree::Dispute do
7
7
  :amount => "31.00",
8
8
  :amount_disputed => "500.00",
9
9
  :amount_won => "0.00",
10
+ :chargeback_protection_level => nil,
10
11
  :created_at => Time.utc(2009, 3, 9, 10, 50, 39),
11
12
  :processor_comments => "forwarded comments",
12
13
  :date_opened => "2009-03-09",
@@ -283,6 +284,45 @@ describe Braintree::Dispute do
283
284
  dispute.amount_won.should == 0.0
284
285
  end
285
286
 
287
+ it "returns 'Effortless Chargeback Protection tool' when initial chargeback_protection_level is effortless" do
288
+ attributes.merge!(:chargeback_protection_level => Braintree::Dispute::ChargebackProtectionLevel::Effortless)
289
+ dispute = Braintree::Dispute._new(attributes)
290
+
291
+ expect(dispute.chargeback_protection_level).to eq(Braintree::Dispute::ChargebackProtectionLevel::Effortless)
292
+ expect(dispute.protection_level).to eq(Braintree::Dispute::ProtectionLevel::EffortlessCBP)
293
+ end
294
+
295
+ it "returns 'Chargeback Protection tool' when initial chargeback_protection_level is standard" do
296
+ attributes.merge!(:chargeback_protection_level => Braintree::Dispute::ChargebackProtectionLevel::Standard)
297
+ dispute = Braintree::Dispute._new(attributes)
298
+
299
+ expect(dispute.chargeback_protection_level).to eq(Braintree::Dispute::ChargebackProtectionLevel::Standard)
300
+ expect(dispute.protection_level).to eq(Braintree::Dispute::ProtectionLevel::StandardCBP)
301
+ end
302
+
303
+ it "returns 'No Protection' when initial chargeback_protection_level is nil" do
304
+ dispute = Braintree::Dispute._new(attributes)
305
+
306
+ expect(dispute.chargeback_protection_level).to eq(nil)
307
+ expect(dispute.protection_level).to eq(Braintree::Dispute::ProtectionLevel::NoProtection)
308
+ end
309
+
310
+ it "returns 'No Protection' when initial chargeback_protection_level is empty" do
311
+ attributes.merge!(:chargeback_protection_level => "")
312
+ dispute = Braintree::Dispute._new(attributes)
313
+
314
+ expect(dispute.chargeback_protection_level).to eq("")
315
+ expect(dispute.protection_level).to eq(Braintree::Dispute::ProtectionLevel::NoProtection)
316
+ end
317
+
318
+ it "returns 'No Protection' when initial chargeback_protection_level is not_protected" do
319
+ attributes.merge!(:chargeback_protection_level => Braintree::Dispute::ChargebackProtectionLevel::NotProtected)
320
+ dispute = Braintree::Dispute._new(attributes)
321
+
322
+ expect(dispute.chargeback_protection_level).to eq(Braintree::Dispute::ChargebackProtectionLevel::NotProtected)
323
+ expect(dispute.protection_level).to eq(Braintree::Dispute::ProtectionLevel::NoProtection)
324
+ end
325
+
286
326
  [
287
327
  :reply_by_date,
288
328
  :amount,
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.8.0
4
+ version: 4.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Braintree
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-07-25 00:00:00.000000000 Z
11
+ date: 2022-10-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: builder
@@ -354,7 +354,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
354
354
  - !ruby/object:Gem::Version
355
355
  version: '0'
356
356
  requirements: []
357
- rubygems_version: 3.3.18
357
+ rubygems_version: 3.3.22
358
358
  signing_key:
359
359
  specification_version: 4
360
360
  summary: Braintree Ruby Server SDK