braintree 3.0.1 → 4.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (156) hide show
  1. checksums.yaml +4 -4
  2. data/braintree.gemspec +2 -3
  3. data/lib/braintree.rb +8 -1
  4. data/lib/braintree/account_updater_daily_report.rb +1 -1
  5. data/lib/braintree/address.rb +2 -1
  6. data/lib/braintree/apple_pay.rb +1 -1
  7. data/lib/braintree/apple_pay_card.rb +1 -1
  8. data/lib/braintree/apple_pay_options.rb +1 -1
  9. data/lib/braintree/authorization_adjustment.rb +1 -1
  10. data/lib/braintree/bin_data.rb +9 -2
  11. data/lib/braintree/client_token.rb +1 -1
  12. data/lib/braintree/configuration.rb +11 -11
  13. data/lib/braintree/connected_merchant_paypal_status_changed.rb +1 -1
  14. data/lib/braintree/connected_merchant_status_transitioned.rb +1 -1
  15. data/lib/braintree/credit_card.rb +2 -2
  16. data/lib/braintree/credit_card_gateway.rb +4 -4
  17. data/lib/braintree/credit_card_verification.rb +5 -5
  18. data/lib/braintree/credit_card_verification_search.rb +1 -1
  19. data/lib/braintree/customer.rb +6 -4
  20. data/lib/braintree/customer_gateway.rb +2 -0
  21. data/lib/braintree/customer_search.rb +1 -1
  22. data/lib/braintree/disbursement.rb +1 -1
  23. data/lib/braintree/dispute.rb +15 -1
  24. data/lib/braintree/dispute/paypal_message.rb +15 -0
  25. data/lib/braintree/dispute_gateway.rb +2 -2
  26. data/lib/braintree/dispute_search.rb +3 -2
  27. data/lib/braintree/document_upload.rb +1 -1
  28. data/lib/braintree/error_codes.rb +10 -2
  29. data/lib/braintree/google_pay_card.rb +1 -1
  30. data/lib/braintree/granted_payment_instrument_update.rb +1 -1
  31. data/lib/braintree/graphql_client.rb +7 -7
  32. data/lib/braintree/http.rb +3 -3
  33. data/lib/braintree/local_payment_completed.rb +1 -1
  34. data/lib/braintree/local_payment_reversed.rb +19 -0
  35. data/lib/braintree/merchant.rb +1 -1
  36. data/lib/braintree/merchant_account.rb +1 -1
  37. data/lib/braintree/merchant_account_gateway.rb +1 -1
  38. data/lib/braintree/merchant_gateway.rb +1 -1
  39. data/lib/braintree/modification.rb +1 -1
  40. data/lib/braintree/oauth_credentials.rb +1 -1
  41. data/lib/braintree/oauth_gateway.rb +5 -5
  42. data/lib/braintree/payment_instrument_type.rb +10 -10
  43. data/lib/braintree/payment_method_gateway.rb +4 -6
  44. data/lib/braintree/payment_method_nonce.rb +1 -1
  45. data/lib/braintree/payment_method_nonce_details.rb +37 -0
  46. data/lib/braintree/payment_method_nonce_details_payer_info.rb +32 -0
  47. data/lib/braintree/payment_method_nonce_gateway.rb +1 -1
  48. data/lib/braintree/plan.rb +1 -1
  49. data/lib/braintree/processor_response_types.rb +3 -3
  50. data/lib/braintree/resource_collection.rb +8 -3
  51. data/lib/braintree/revoked_payment_method_metadata.rb +1 -1
  52. data/lib/braintree/risk_data.rb +3 -1
  53. data/lib/braintree/samsung_pay_card.rb +1 -1
  54. data/lib/braintree/settlement_batch_summary.rb +2 -2
  55. data/lib/braintree/subscription.rb +6 -6
  56. data/lib/braintree/test/credit_card.rb +1 -0
  57. data/lib/braintree/three_d_secure_info.rb +22 -12
  58. data/lib/braintree/transaction.rb +43 -26
  59. data/lib/braintree/transaction/installment.rb +28 -0
  60. data/lib/braintree/transaction/installment/adjustment.rb +33 -0
  61. data/lib/braintree/transaction/paypal_details.rb +1 -0
  62. data/lib/braintree/transaction_gateway.rb +26 -5
  63. data/lib/braintree/transaction_line_item.rb +1 -1
  64. data/lib/braintree/transaction_search.rb +3 -1
  65. data/lib/braintree/unknown_payment_method.rb +1 -1
  66. data/lib/braintree/us_bank_account.rb +3 -3
  67. data/lib/braintree/us_bank_account_verification.rb +1 -1
  68. data/lib/braintree/us_bank_account_verification_gateway.rb +1 -1
  69. data/lib/braintree/util.rb +4 -4
  70. data/lib/braintree/venmo_account.rb +1 -1
  71. data/lib/braintree/version.rb +2 -2
  72. data/lib/braintree/visa_checkout_card.rb +2 -2
  73. data/lib/braintree/webhook_notification.rb +28 -19
  74. data/lib/braintree/webhook_notification_gateway.rb +5 -5
  75. data/lib/braintree/webhook_testing_gateway.rb +10 -0
  76. data/lib/braintree/xml/generator.rb +5 -4
  77. data/lib/braintree/xml/libxml.rb +0 -1
  78. data/lib/braintree/xml/parser.rb +22 -12
  79. data/lib/braintree/xml/rexml.rb +70 -0
  80. data/spec/integration/braintree/add_on_spec.rb +1 -1
  81. data/spec/integration/braintree/address_spec.rb +28 -24
  82. data/spec/integration/braintree/advanced_search_spec.rb +45 -45
  83. data/spec/integration/braintree/apple_pay_spec.rb +3 -3
  84. data/spec/integration/braintree/braintree_gateway_spec.rb +2 -1
  85. data/spec/integration/braintree/client_api/client_token_spec.rb +14 -14
  86. data/spec/integration/braintree/client_api/spec_helper.rb +5 -5
  87. data/spec/integration/braintree/credit_card_spec.rb +124 -122
  88. data/spec/integration/braintree/credit_card_verification_search_spec.rb +2 -2
  89. data/spec/integration/braintree/credit_card_verification_spec.rb +1 -1
  90. data/spec/integration/braintree/customer_search_spec.rb +8 -8
  91. data/spec/integration/braintree/customer_spec.rb +343 -149
  92. data/spec/integration/braintree/dispute_search_spec.rb +29 -4
  93. data/spec/integration/braintree/dispute_spec.rb +6 -6
  94. data/spec/integration/braintree/error_codes_spec.rb +1 -1
  95. data/spec/integration/braintree/http_spec.rb +2 -2
  96. data/spec/integration/braintree/merchant_account_spec.rb +25 -26
  97. data/spec/integration/braintree/merchant_spec.rb +14 -14
  98. data/spec/integration/braintree/oauth_spec.rb +11 -11
  99. data/spec/integration/braintree/payment_method_nonce_spec.rb +26 -35
  100. data/spec/integration/braintree/payment_method_spec.rb +326 -149
  101. data/spec/integration/braintree/payment_method_us_bank_account_spec.rb +17 -13
  102. data/spec/integration/braintree/paypal_account_spec.rb +28 -28
  103. data/spec/integration/braintree/samsung_pay_card_spec.rb +9 -9
  104. data/spec/integration/braintree/settlement_batch_summary_spec.rb +8 -8
  105. data/spec/integration/braintree/subscription_spec.rb +133 -133
  106. data/spec/integration/braintree/test/transaction_amounts_spec.rb +2 -2
  107. data/spec/integration/braintree/test_transaction_spec.rb +10 -10
  108. data/spec/integration/braintree/transaction_search_spec.rb +93 -67
  109. data/spec/integration/braintree/transaction_spec.rb +736 -380
  110. data/spec/integration/braintree/transaction_us_bank_account_spec.rb +32 -26
  111. data/spec/integration/braintree/us_bank_account_spec.rb +6 -6
  112. data/spec/integration/braintree/us_bank_account_verification_search_spec.rb +7 -7
  113. data/spec/integration/braintree/us_bank_account_verification_spec.rb +8 -8
  114. data/spec/integration/braintree/visa_checkout_card_spec.rb +5 -5
  115. data/spec/integration/spec_helper.rb +9 -3
  116. data/spec/oauth_test_helper.rb +1 -1
  117. data/spec/script/httpsd.rb +6 -6
  118. data/spec/spec_helper.rb +6 -3
  119. data/spec/unit/braintree/address_spec.rb +1 -1
  120. data/spec/unit/braintree/apple_pay_card_spec.rb +1 -1
  121. data/spec/unit/braintree/client_token_spec.rb +2 -2
  122. data/spec/unit/braintree/configuration_spec.rb +42 -42
  123. data/spec/unit/braintree/credit_card_spec.rb +9 -9
  124. data/spec/unit/braintree/credit_card_verification_search_spec.rb +1 -1
  125. data/spec/unit/braintree/credit_card_verification_spec.rb +8 -4
  126. data/spec/unit/braintree/customer_spec.rb +14 -4
  127. data/spec/unit/braintree/disbursement_spec.rb +7 -7
  128. data/spec/unit/braintree/dispute_search_spec.rb +1 -0
  129. data/spec/unit/braintree/dispute_spec.rb +34 -9
  130. data/spec/unit/braintree/error_result_spec.rb +5 -5
  131. data/spec/unit/braintree/errors_spec.rb +8 -8
  132. data/spec/unit/braintree/http_spec.rb +5 -5
  133. data/spec/unit/braintree/merchant_account_spec.rb +1 -1
  134. data/spec/unit/braintree/payment_method_nonce_details_payer_info_spec.rb +31 -0
  135. data/spec/unit/braintree/payment_method_nonce_details_spec.rb +43 -0
  136. data/spec/unit/braintree/payment_method_spec.rb +1 -1
  137. data/spec/unit/braintree/paypal_account_spec.rb +2 -2
  138. data/spec/unit/braintree/resource_collection_spec.rb +30 -1
  139. data/spec/unit/braintree/risk_data_spec.rb +9 -5
  140. data/spec/unit/braintree/subscription_search_spec.rb +1 -1
  141. data/spec/unit/braintree/successful_result_spec.rb +1 -1
  142. data/spec/unit/braintree/three_d_secure_info_spec.rb +32 -14
  143. data/spec/unit/braintree/transaction/credit_card_details_spec.rb +3 -3
  144. data/spec/unit/braintree/transaction/customer_details_spec.rb +1 -1
  145. data/spec/unit/braintree/transaction/deposit_details_spec.rb +2 -2
  146. data/spec/unit/braintree/transaction/installment_spec.rb +25 -0
  147. data/spec/unit/braintree/transaction/paypal_details_spec.rb +3 -1
  148. data/spec/unit/braintree/transaction_search_spec.rb +12 -12
  149. data/spec/unit/braintree/transaction_spec.rb +25 -17
  150. data/spec/unit/braintree/util_spec.rb +18 -18
  151. data/spec/unit/braintree/validation_error_collection_spec.rb +36 -36
  152. data/spec/unit/braintree/webhook_notification_spec.rb +72 -56
  153. data/spec/unit/braintree/xml/rexml_spec.rb +51 -0
  154. data/spec/unit/braintree/xml_spec.rb +31 -31
  155. metadata +15 -19
  156. data/lib/braintree/settlement_batch.rb +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 65d2cc6a7357e4cb814afc85ad926832dc746e874a08583b7905cd8b3aa8b004
4
- data.tar.gz: 6c43487912cceb31dbeb1b0b9d73050f6b6179e2a99c062a632b04f8c7c9c866
3
+ metadata.gz: a48854f74d17f7c0f06f437ab9cf144f6787cdb634cb4585b96cbf0e8b3eb316
4
+ data.tar.gz: e278599e9a4fe1ec55ed4c25a0c2941c256815adff6240f24d7326dda3c7979b
5
5
  SHA512:
6
- metadata.gz: bb38ff65933619995157992aba73994dac75a28f190e098c16cd3864215305710ffa8db7ada6ff3b88f5f78a6f65a1db0d9158672f1e277fa44dfe052e5be9da
7
- data.tar.gz: 70c01aac5d220f2b2d82b2dc7180071d4f8db67e8bd3622e512ccbd849fc19eecde5db6c6232f244b3495c2b2bdb0e3aff92121141d801e4722c1c004b1201f8
6
+ metadata.gz: dbe42e3ee49bffddde129c228d9dc9ea9a8e7615140d184211378d58add503f13a666f2aaf8c393fafbb330db77685a5953b10344c712da5719c630f1ab64e5a
7
+ data.tar.gz: ae8af00364f7853fb0e6eb82f585ebc30015f0b6ac7014f41eccdfe732348f3b3f715b474afc516b17b913550f9ae339b587a53296cc823bb30c5954ecbda146
data/braintree.gemspec CHANGED
@@ -1,5 +1,5 @@
1
1
  $:.push File.expand_path("../lib", __FILE__)
2
- require 'braintree/version'
2
+ require "braintree/version"
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "braintree"
@@ -12,8 +12,7 @@ Gem::Specification.new do |s|
12
12
  s.homepage = "https://www.braintreepayments.com/"
13
13
  s.files = Dir.glob ["README.rdoc", "LICENSE", "lib/**/*.{rb,crt}", "spec/**/*", "*.gemspec"]
14
14
  s.add_dependency "builder", ">= 3.2.4"
15
- s.add_dependency "libxml-ruby", ">= 3.2.0"
16
- s.required_ruby_version = ">=2.5.0"
15
+ s.required_ruby_version = ">=2.6.0"
17
16
  s.metadata = {
18
17
  "bug_tracker_uri" => "https://github.com/braintree/braintree_ruby/issues",
19
18
  "changelog_uri" => "https://github.com/braintree/braintree_ruby/blob/master/CHANGELOG.md",
data/lib/braintree.rb CHANGED
@@ -1,4 +1,4 @@
1
- require 'base64'
1
+ require "base64"
2
2
  require "bigdecimal"
3
3
  require "cgi"
4
4
  require "date"
@@ -59,6 +59,7 @@ require "braintree/discount_gateway"
59
59
  require "braintree/dispute"
60
60
  require "braintree/dispute_gateway"
61
61
  require "braintree/dispute/evidence"
62
+ require "braintree/dispute/paypal_message"
62
63
  require "braintree/dispute/status_history"
63
64
  require "braintree/dispute/transaction"
64
65
  require "braintree/dispute/transaction_details"
@@ -71,6 +72,7 @@ require "braintree/gateway"
71
72
  require "braintree/graphql_client"
72
73
  require "braintree/google_pay_card"
73
74
  require "braintree/local_payment_completed"
75
+ require "braintree/local_payment_reversed"
74
76
  require "braintree/transaction/local_payment_details"
75
77
  require "braintree/merchant"
76
78
  require "braintree/merchant_gateway"
@@ -86,6 +88,8 @@ require "braintree/payment_instrument_type"
86
88
  require "braintree/payment_method"
87
89
  require "braintree/payment_method_gateway"
88
90
  require "braintree/payment_method_nonce"
91
+ require "braintree/payment_method_nonce_details"
92
+ require "braintree/payment_method_nonce_details_payer_info"
89
93
  require "braintree/payment_method_nonce_gateway"
90
94
  require "braintree/payment_method_parser"
91
95
  require "braintree/paypal_account"
@@ -141,6 +145,8 @@ require "braintree/transaction/status_details"
141
145
  require "braintree/transaction/venmo_account_details"
142
146
  require "braintree/transaction/visa_checkout_card_details"
143
147
  require "braintree/transaction/samsung_pay_card_details"
148
+ require "braintree/transaction/installment"
149
+ require "braintree/transaction/installment/adjustment"
144
150
  require "braintree/unknown_payment_method"
145
151
  require "braintree/disbursement"
146
152
  require "braintree/dispute_search"
@@ -157,4 +163,5 @@ require "braintree/webhook_testing_gateway"
157
163
  require "braintree/xml"
158
164
  require "braintree/xml/generator"
159
165
  require "braintree/xml/libxml"
166
+ require "braintree/xml/rexml"
160
167
  require "braintree/xml/parser"
@@ -8,7 +8,7 @@ module Braintree
8
8
  class << self
9
9
  protected :new
10
10
  def _new(*args) # :nodoc:
11
- self.new *args
11
+ self.new(*args)
12
12
  end
13
13
  end
14
14
 
@@ -14,6 +14,7 @@ module Braintree
14
14
  attr_reader :id
15
15
  attr_reader :last_name
16
16
  attr_reader :locality
17
+ attr_reader :phone_number
17
18
  attr_reader :postal_code
18
19
  attr_reader :region
19
20
  attr_reader :street_address
@@ -58,7 +59,7 @@ module Braintree
58
59
  end
59
60
 
60
61
  def self._new(*args) # :nodoc:
61
- self.new *args
62
+ self.new(*args)
62
63
  end
63
64
  end
64
65
  end
@@ -11,7 +11,7 @@ module Braintree
11
11
  end
12
12
 
13
13
  def self._new(*args) # :nodoc:
14
- self.new *args
14
+ self.new(*args)
15
15
  end
16
16
 
17
17
  def self.register_domain(domain)
@@ -45,7 +45,7 @@ module Braintree
45
45
  end
46
46
 
47
47
  def self._new(*args) # :nodoc:
48
- self.new *args
48
+ self.new(*args)
49
49
  end
50
50
  end
51
51
  end
@@ -13,7 +13,7 @@ module Braintree
13
13
  end
14
14
 
15
15
  def self._new(*args) # :nodoc:
16
- self.new *args
16
+ self.new(*args)
17
17
  end
18
18
  end
19
19
  end
@@ -12,7 +12,7 @@ module Braintree
12
12
  class << self
13
13
  protected :new
14
14
  def _new(*args) # :nodoc:
15
- self.new *args
15
+ self.new(*args)
16
16
  end
17
17
  end
18
18
 
@@ -17,10 +17,17 @@ module Braintree
17
17
  end
18
18
 
19
19
  def inspect
20
- formatted_attrs = self.class._attributes.map do |attr|
20
+ formatted_attributes = self.class._attributes.map do |attr|
21
21
  "#{attr}: #{send(attr).inspect}"
22
22
  end
23
- "#<BinData #{formatted_attrs.join(", ")}>"
23
+ "#<#{self.class} #{formatted_attributes.join(", ")}>"
24
+ end
25
+
26
+ def self._attributes # :nodoc:
27
+ [
28
+ :commercial, :country_of_issuance, :debit, :durbin_regulated, :healthcare,
29
+ :issuing_bank, :payroll, :prepaid, :product_id
30
+ ]
24
31
  end
25
32
  end
26
33
  end
@@ -1,4 +1,4 @@
1
- require 'json'
1
+ require "json"
2
2
 
3
3
  module Braintree
4
4
  module ClientToken
@@ -40,12 +40,12 @@ module Braintree
40
40
  ]
41
41
 
42
42
  class << self
43
- attr_writer *WRITABLE_ATTRIBUTES
44
- attr_reader *NON_REQUIRED_READABLE_ATTRIBUTES
43
+ attr_writer(*WRITABLE_ATTRIBUTES)
44
+ attr_reader(*NON_REQUIRED_READABLE_ATTRIBUTES)
45
45
  end
46
- attr_reader *READABLE_ATTRIBUTES
47
- attr_reader *NON_REQUIRED_READABLE_ATTRIBUTES
48
- attr_writer *WRITABLE_ATTRIBUTES
46
+ attr_reader(*READABLE_ATTRIBUTES)
47
+ attr_reader(*NON_REQUIRED_READABLE_ATTRIBUTES)
48
+ attr_writer(*WRITABLE_ATTRIBUTES)
49
49
 
50
50
  def self.expectant_reader(*attributes) # :nodoc:
51
51
  attributes.each do |attribute|
@@ -56,7 +56,7 @@ module Braintree
56
56
  end
57
57
  end
58
58
  end
59
- expectant_reader *READABLE_ATTRIBUTES
59
+ expectant_reader(*READABLE_ATTRIBUTES)
60
60
 
61
61
  # Sets the Braintree environment to use. Valid values are <tt>:sandbox</tt> and <tt>:production</tt>
62
62
  def self.environment=(env)
@@ -86,7 +86,7 @@ module Braintree
86
86
  :proxy_port => proxy_port,
87
87
  :proxy_user => proxy_user,
88
88
  :proxy_pass => proxy_pass,
89
- :ssl_version => ssl_version
89
+ :ssl_version => ssl_version,
90
90
  )
91
91
  end
92
92
 
@@ -205,7 +205,7 @@ module Braintree
205
205
  def port # :nodoc:
206
206
  case @environment
207
207
  when :development, :integration
208
- ENV['GATEWAY_PORT'] || 3000
208
+ ENV["GATEWAY_PORT"] || 3000
209
209
  when :production, :qa, :sandbox
210
210
  443
211
211
  end
@@ -214,7 +214,7 @@ module Braintree
214
214
  def graphql_port # :nodoc:
215
215
  case @environment
216
216
  when :development, :integration
217
- ENV['GRAPHQL_PORT'] || 8080
217
+ ENV["GRAPHQL_PORT"] || 8080
218
218
  when :production, :qa, :sandbox
219
219
  443
220
220
  end
@@ -235,7 +235,7 @@ module Braintree
235
235
  def server # :nodoc:
236
236
  case @environment
237
237
  when :development, :integration
238
- ENV['GATEWAY_HOST'] || "localhost"
238
+ ENV["GATEWAY_HOST"] || "localhost"
239
239
  when :production
240
240
  "#{endpoint}.braintreegateway.com"
241
241
  when :qa
@@ -248,7 +248,7 @@ module Braintree
248
248
  def graphql_server # :nodoc:
249
249
  case @environment
250
250
  when :development, :integration
251
- ENV['GRAPHQL_HOST'] || "graphql.bt.local"
251
+ ENV["GRAPHQL_HOST"] || "graphql.bt.local"
252
252
  when :production
253
253
  "payments.braintree-api.com"
254
254
  when :qa
@@ -15,7 +15,7 @@ module Braintree
15
15
  class << self
16
16
  protected :new
17
17
  def _new(*args) # :nodoc:
18
- self.new *args
18
+ self.new(*args)
19
19
  end
20
20
  end
21
21
  end
@@ -15,7 +15,7 @@ module Braintree
15
15
  class << self
16
16
  protected :new
17
17
  def _new(*args) # :nodoc:
18
- self.new *args
18
+ self.new(*args)
19
19
  end
20
20
  end
21
21
  end
@@ -123,7 +123,7 @@ module Braintree
123
123
  end
124
124
 
125
125
  def _most_recent_verification(attributes)
126
- verification = (attributes[:verifications] || []).sort_by{ |verification| verification[:created_at] }.reverse.first
126
+ verification = (attributes[:verifications] || []).sort_by { |verification| verification[:created_at] }.reverse.first
127
127
  CreditCardVerification._new(verification) if verification
128
128
  end
129
129
 
@@ -181,7 +181,7 @@ module Braintree
181
181
  end
182
182
 
183
183
  def self._new(*args) # :nodoc:
184
- self.new *args
184
+ self.new(*args)
185
185
  end
186
186
  end
187
187
  end
@@ -38,8 +38,8 @@ module Braintree
38
38
  end
39
39
 
40
40
  def expiring_between(start_date, end_date, options = {})
41
- formatted_start_date = start_date.strftime('%m%Y')
42
- formatted_end_date = end_date.strftime('%m%Y')
41
+ formatted_start_date = start_date.strftime("%m%Y")
42
+ formatted_end_date = end_date.strftime("%m%Y")
43
43
  response = @config.http.post("#{@config.base_merchant_path}/payment_methods/all/expiring_ids?start=#{formatted_start_date}&end=#{formatted_end_date}")
44
44
  ResourceCollection.new(response) { |ids| _fetch_expiring_between(formatted_start_date, formatted_end_date, ids) }
45
45
  end
@@ -79,7 +79,7 @@ module Braintree
79
79
 
80
80
  def self._signature(type) # :nodoc:
81
81
  billing_address_params = AddressGateway._shared_signature
82
- options = [:make_default, :verification_merchant_account_id, :verify_card, :verification_amount, :venmo_sdk_session, :fail_on_duplicate_payment_method, :verification_account_type]
82
+ options = [:make_default, :verification_merchant_account_id, :verify_card, :verification_amount, :venmo_sdk_session, :fail_on_duplicate_payment_method, :verification_account_type,:verification_currency_iso_code]
83
83
  signature = [
84
84
  :billing_address_id, :cardholder_name, :cvv, :expiration_date, :expiration_month,
85
85
  :expiration_year, :number, :token, :venmo_sdk_payment_method_code, :device_data,
@@ -145,7 +145,7 @@ module Braintree
145
145
  def _fetch_expiring_between(formatted_start_date, formatted_end_date, ids) # :nodoc:
146
146
  response = @config.http.post(
147
147
  "#{@config.base_merchant_path}/payment_methods/all/expiring?start=#{formatted_start_date}&end=#{formatted_end_date}",
148
- :search => {:ids => ids}
148
+ :search => {:ids => ids},
149
149
  )
150
150
  attributes = response[:payment_methods]
151
151
  Util.extract_attribute_as_array(attributes, :credit_card).map { |attrs| CreditCard._new(@gateway, attrs) }
@@ -17,10 +17,10 @@ module Braintree
17
17
  end
18
18
 
19
19
  module Status
20
- Failed = 'failed'
21
- GatewayRejected = 'gateway_rejected'
22
- ProcessorDeclined = 'processor_declined'
23
- Verified = 'verified'
20
+ Failed = "failed"
21
+ GatewayRejected = "gateway_rejected"
22
+ ProcessorDeclined = "processor_declined"
23
+ Verified = "verified"
24
24
 
25
25
  All = [Failed, GatewayRejected, ProcessorDeclined, Verified]
26
26
  end
@@ -92,7 +92,7 @@ module Braintree
92
92
  end
93
93
 
94
94
  def self._new(*args) # :nodoc:
95
- self.new *args
95
+ self.new(*args)
96
96
  end
97
97
 
98
98
  def self.find(*args)
@@ -6,7 +6,7 @@ module Braintree
6
6
  :customer_email,
7
7
  :customer_id,
8
8
  :id,
9
- :payment_method_token
9
+ :payment_method_token,
10
10
  )
11
11
 
12
12
  equality_fields :credit_card_expiration_date
@@ -19,6 +19,7 @@ module Braintree
19
19
  attr_reader :paypal_accounts
20
20
  attr_reader :phone
21
21
  attr_reader :samsung_pay_cards
22
+ attr_reader :tax_identifiers
22
23
  attr_reader :updated_at
23
24
  attr_reader :us_bank_accounts
24
25
  attr_reader :venmo_accounts
@@ -42,7 +43,7 @@ module Braintree
42
43
  end
43
44
 
44
45
  def self.credit!(customer_id, transaction_attributes)
45
- return_object_or_raise(:transaction){ credit(customer_id, transaction_attributes) }
46
+ return_object_or_raise(:transaction) { credit(customer_id, transaction_attributes) }
46
47
  end
47
48
 
48
49
  def self.delete(*args)
@@ -90,6 +91,7 @@ module Braintree
90
91
  @visa_checkout_cards = (@visa_checkout_cards|| []).map { |pm| VisaCheckoutCard._new gateway, pm }
91
92
  @samsung_pay_cards = (@samsung_pay_cards|| []).map { |pm| SamsungPayCard._new gateway, pm }
92
93
  @addresses = (@addresses || []).map { |addr| Address._new gateway, addr }
94
+ @tax_identifiers = (@tax_identifiers || []).map { |addr| TaxIdentifier._new gateway, addr }
93
95
  @custom_fields = attributes[:custom_fields].is_a?(Hash) ? attributes[:custom_fields] : {}
94
96
  end
95
97
 
@@ -124,7 +126,7 @@ module Braintree
124
126
 
125
127
  def inspect # :nodoc:
126
128
  first = [:id]
127
- last = [:addresses, :credit_cards, :paypal_accounts]
129
+ last = [:addresses, :credit_cards, :paypal_accounts, :tax_identifiers]
128
130
  order = first + (self.class._attributes - first - last) + last
129
131
  nice_attributes = order.map do |attr|
130
132
  "#{attr}: #{send(attr).inspect}"
@@ -142,13 +144,13 @@ module Braintree
142
144
  end
143
145
 
144
146
  def self._new(*args) # :nodoc:
145
- self.new *args
147
+ self.new(*args)
146
148
  end
147
149
 
148
150
  def self._attributes # :nodoc:
149
151
  [
150
152
  :addresses, :company, :credit_cards, :email, :fax, :first_name, :id, :last_name, :phone, :website,
151
- :created_at, :updated_at
153
+ :created_at, :updated_at, :tax_identifiers
152
154
  ]
153
155
  end
154
156
 
@@ -80,6 +80,7 @@ module Braintree
80
80
  {:risk_data => [:customer_browser, :customer_ip]},
81
81
  {:credit_card => credit_card_signature},
82
82
  {:paypal_account => paypal_account_signature},
83
+ {:tax_identifiers => [:country_code, :identifier]},
83
84
  {:options => options},
84
85
  {:custom_fields => :_any_key_}
85
86
  ]
@@ -141,6 +142,7 @@ module Braintree
141
142
  :company, :email, :fax, :first_name, :id, :last_name, :phone, :website,
142
143
  :device_data, :payment_method_nonce, :default_payment_method_token,
143
144
  {:credit_card => credit_card_signature},
145
+ {:tax_identifiers => [:country_code, :identifier]},
144
146
  {:options => options},
145
147
  {:custom_fields => :_any_key_}
146
148
  ]
@@ -19,7 +19,7 @@ module Braintree
19
19
  :payment_method_token,
20
20
  :paypal_account_email,
21
21
  :phone,
22
- :website
22
+ :website,
23
23
  )
24
24
 
25
25
  is_fields :payment_method_token_with_duplicates
@@ -52,7 +52,7 @@ module Braintree
52
52
  class << self
53
53
  protected :new
54
54
  def _new(*args) # :nodoc:
55
- self.new *args
55
+ self.new(*args)
56
56
  end
57
57
  end
58
58
 
@@ -7,6 +7,7 @@ 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
11
  attr_reader :created_at
11
12
  attr_reader :currency_iso_code
12
13
  attr_reader :date_opened
@@ -17,6 +18,7 @@ module Braintree
17
18
  attr_reader :kind
18
19
  attr_reader :merchant_account_id
19
20
  attr_reader :original_dispute_id
21
+ attr_reader :paypal_messages
20
22
  attr_reader :processor_comments
21
23
  attr_reader :reason
22
24
  attr_reader :reason_code
@@ -65,10 +67,18 @@ module Braintree
65
67
  All = constants.map { |c| const_get(c) }
66
68
  end
67
69
 
70
+ module ChargebackProtectionLevel
71
+ Effortless = "effortless"
72
+ Standard = "standard"
73
+ NotProtected = "not_protected"
74
+
75
+ All = constants.map { |c| const_get(c) }
76
+ end
77
+
68
78
  class << self
69
79
  protected :new
70
80
  def _new(*args) # :nodoc:
71
- self.new *args
81
+ self.new(*args)
72
82
  end
73
83
  end
74
84
 
@@ -114,6 +124,10 @@ module Braintree
114
124
  Braintree::Dispute::Evidence.new(record)
115
125
  end unless evidence.nil?
116
126
 
127
+ @paypal_messages = paypal_messages.map do |record|
128
+ Braintree::Dispute::PayPalMessage.new(record)
129
+ end unless paypal_messages.nil?
130
+
117
131
  @transaction_details = TransactionDetails.new(transaction)
118
132
  @transaction = Transaction.new(transaction)
119
133