braintree 2.40.0 → 2.41.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. data/lib/braintree.rb +2 -2
  2. data/lib/braintree/add_on.rb +0 -1
  3. data/lib/braintree/address.rb +0 -1
  4. data/lib/braintree/apple_pay_card.rb +0 -1
  5. data/lib/braintree/configuration.rb +0 -1
  6. data/lib/braintree/credit_card.rb +0 -33
  7. data/lib/braintree/credit_card_verification.rb +0 -1
  8. data/lib/braintree/customer.rb +1 -32
  9. data/lib/braintree/discount.rb +0 -1
  10. data/lib/braintree/error_codes.rb +1 -6
  11. data/lib/braintree/error_result.rb +0 -1
  12. data/lib/braintree/errors.rb +0 -1
  13. data/lib/braintree/{sepa_bank_account.rb → europe_bank_account.rb} +2 -2
  14. data/lib/braintree/{sepa_bank_account_gateway.rb → europe_bank_account_gateway.rb} +3 -3
  15. data/lib/braintree/gateway.rb +2 -3
  16. data/lib/braintree/payment_instrument_type.rb +1 -1
  17. data/lib/braintree/payment_method_gateway.rb +4 -4
  18. data/lib/braintree/paypal_account.rb +0 -2
  19. data/lib/braintree/plan.rb +0 -2
  20. data/lib/braintree/subscription.rb +0 -6
  21. data/lib/braintree/successful_result.rb +0 -1
  22. data/lib/braintree/test/credit_card.rb +0 -2
  23. data/lib/braintree/test/transaction_amounts.rb +0 -2
  24. data/lib/braintree/transaction.rb +0 -27
  25. data/lib/braintree/transaction/credit_card_details.rb +2 -2
  26. data/lib/braintree/transaction/paypal_details.rb +2 -1
  27. data/lib/braintree/transaction_search.rb +1 -1
  28. data/lib/braintree/transparent_redirect.rb +0 -11
  29. data/lib/braintree/validation_error.rb +0 -1
  30. data/lib/braintree/validation_error_collection.rb +0 -1
  31. data/lib/braintree/version.rb +1 -1
  32. data/spec/httpsd.pid +1 -1
  33. data/spec/integration/braintree/client_api/client_token_spec.rb +1 -1
  34. data/spec/integration/braintree/client_api/spec_helper.rb +3 -4
  35. data/spec/integration/braintree/credit_card_spec.rb +1 -1
  36. data/spec/integration/braintree/payment_method_spec.rb +2 -2
  37. data/spec/integration/braintree/transaction_search_spec.rb +3 -3
  38. data/spec/integration/braintree/transaction_spec.rb +16 -0
  39. data/spec/unit/braintree/transaction/credit_card_details_spec.rb +3 -2
  40. metadata +161 -157
  41. checksums.yaml +0 -7
@@ -1,5 +1,5 @@
1
1
  module Braintree
2
- class SEPABankAccountGateway
2
+ class EuropeBankAccountGateway
3
3
  def initialize(gateway)
4
4
  @gateway = gateway
5
5
  @config = gateway.config
@@ -7,8 +7,8 @@ module Braintree
7
7
 
8
8
  def find(token)
9
9
  raise ArgumentError if token.nil? || token.to_s.strip == ""
10
- response = @config.http.get "/payment_methods/sepa_bank_account/#{token}"
11
- SEPABankAccount._new(@gateway, response[:sepa_bank_account])
10
+ response = @config.http.get "/payment_methods/europe_bank_account/#{token}"
11
+ EuropeBankAccount._new(@gateway, response[:europe_bank_account])
12
12
  rescue NotFoundError
13
13
  raise NotFoundError, "payment method with token #{token.inspect} not found"
14
14
  end
@@ -1,5 +1,4 @@
1
1
  module Braintree
2
- # See http://www.braintreepayments.com/docs/ruby
3
2
  class Gateway
4
3
  attr_reader :config
5
4
 
@@ -57,8 +56,8 @@ module Braintree
57
56
  MerchantAccountGateway.new(self)
58
57
  end
59
58
 
60
- def sepa_bank_account
61
- SEPABankAccountGateway.new(self)
59
+ def europe_bank_account
60
+ EuropeBankAccountGateway.new(self)
62
61
  end
63
62
 
64
63
  def settlement_batch_summary
@@ -1,7 +1,7 @@
1
1
  module Braintree
2
2
  module PaymentInstrumentType
3
3
  PayPalAccount = 'paypal_account'
4
- SEPABankAccount = 'sepa_bank_account'
4
+ EuropeBankAccount = 'europe_bank_account'
5
5
  CreditCard = 'credit_card'
6
6
  end
7
7
  end
@@ -18,8 +18,8 @@ module Braintree
18
18
  SuccessfulResult.new(:payment_method => PayPalAccount._new(@gateway, response[:paypal_account]))
19
19
  elsif response[:coinbase_account]
20
20
  SuccessfulResult.new(:payment_method => CoinbaseAccount._new(@gateway, response[:coinbase_account]))
21
- elsif response[:sepa_bank_account]
22
- SuccessfulResult.new(:payment_method => SEPABankAccount._new(@gateway, response[:sepa_bank_account]))
21
+ elsif response[:europe_bank_account]
22
+ SuccessfulResult.new(:payment_method => EuropeBankAccount._new(@gateway, response[:europe_bank_account]))
23
23
  elsif response[:apple_pay_card]
24
24
  SuccessfulResult.new(:payment_method => ApplePayCard._new(@gateway, response[:apple_pay_card]))
25
25
  elsif response[:api_error_response]
@@ -44,8 +44,8 @@ module Braintree
44
44
  PayPalAccount._new(@gateway, response[:paypal_account])
45
45
  elsif response[:coinbase_account]
46
46
  SuccessfulResult.new(:payment_method => CoinbaseAccount._new(@gateway, response[:coinbase_account]))
47
- elsif response.has_key?(:sepa_bank_account)
48
- SEPABankAccount._new(@gateway, response[:sepa_bank_account])
47
+ elsif response.has_key?(:europe_bank_account)
48
+ EuropeBankAccount._new(@gateway, response[:europe_bank_account])
49
49
  elsif response.has_key?(:apple_pay_card)
50
50
  ApplePayCard._new(@gateway, response[:apple_pay_card])
51
51
  else
@@ -30,12 +30,10 @@ module Braintree
30
30
  Configuration.gateway.paypal_account.delete(token)
31
31
  end
32
32
 
33
- # See http://www.braintreepayments.com/docs/ruby/transactions/create_from_vault
34
33
  def self.sale(token, transaction_attributes)
35
34
  Configuration.gateway.transaction.sale(transaction_attributes.merge(:payment_method_token => token))
36
35
  end
37
36
 
38
- # See http://www.braintreepayments.com/docs/ruby/transactions/create_from_vault
39
37
  def self.sale!(token, transaction_attributes)
40
38
  return_object_or_raise(:transaction) { sale(token, transaction_attributes) }
41
39
  end
@@ -1,5 +1,4 @@
1
1
  module Braintree
2
- # See http://www.braintreepayments.com/docs/ruby
3
2
  class Plan
4
3
  include BaseModule
5
4
 
@@ -20,7 +19,6 @@ module Braintree
20
19
  attr_reader :updated_at
21
20
  attr_reader :add_ons
22
21
 
23
- # See http://www.braintreepayments.com/docs/ruby/plans/all
24
22
  def self.all
25
23
  Configuration.gateway.plan.all
26
24
  end
@@ -1,5 +1,4 @@
1
1
  module Braintree
2
- # See http://www.braintreepayments.com/docs/ruby/subscriptions/overview
3
2
  class Subscription
4
3
  include BaseModule
5
4
 
@@ -39,12 +38,10 @@ module Braintree
39
38
  attr_reader :updated_at, :created_at
40
39
  attr_reader :status_history
41
40
 
42
- # See http://www.braintreepayments.com/docs/ruby/subscriptions/cancel
43
41
  def self.cancel(subscription_id)
44
42
  Configuration.gateway.subscription.cancel(subscription_id)
45
43
  end
46
44
 
47
- # See http://www.braintreepayments.com/docs/ruby/subscriptions/create
48
45
  def self.create(attributes)
49
46
  Configuration.gateway.subscription.create(attributes)
50
47
  end
@@ -53,7 +50,6 @@ module Braintree
53
50
  return_object_or_raise(:subscription) { create(attributes) }
54
51
  end
55
52
 
56
- # See http://www.braintreepayments.com/docs/ruby/subscriptions/search
57
53
  def self.find(id)
58
54
  Configuration.gateway.subscription.find(id)
59
55
  end
@@ -62,12 +58,10 @@ module Braintree
62
58
  Configuration.gateway.transaction.retry_subscription_charge(subscription_id, amount)
63
59
  end
64
60
 
65
- # See http://www.braintreepayments.com/docs/ruby/subscriptions/search
66
61
  def self.search(&block)
67
62
  Configuration.gateway.subscription.search(&block)
68
63
  end
69
64
 
70
- # See http://www.braintreepayments.com/docs/ruby/subscriptions/update
71
65
  def self.update(subscription_id, attributes)
72
66
  Configuration.gateway.subscription.update(subscription_id, attributes)
73
67
  end
@@ -1,5 +1,4 @@
1
1
  module Braintree
2
- # See http://www.braintreepayments.com/docs/ruby/general/result_objects
3
2
  class SuccessfulResult
4
3
  include BaseModule
5
4
 
@@ -3,8 +3,6 @@ module Braintree
3
3
  # The constants contained in the Braintree::Test::CreditCardNumbers module provide
4
4
  # credit card numbers that should be used when working in the sandbox environment. The sandbox
5
5
  # will not accept any credit card numbers other than the ones listed below.
6
- #
7
- # See http://www.braintreepayments.com/docs/ruby/reference/sandbox
8
6
  module CreditCardNumbers
9
7
  module CardTypeIndicators
10
8
  Prepaid = "4111111111111210"
@@ -2,8 +2,6 @@ module Braintree
2
2
  module Test # :nodoc:
3
3
  # The constants in this module can be used to create transactions with
4
4
  # the desired status in the sandbox environment.
5
- #
6
- # See http://www.braintreepayments.com/docs/ruby/reference/sandbox
7
5
  module TransactionAmounts
8
6
  Authorize = "1000.00"
9
7
  Decline = "2000.00"
@@ -1,5 +1,4 @@
1
1
  module Braintree
2
- # See http://www.braintreepayments.com/docs/ruby/transactions/overview
3
2
  class Transaction
4
3
  include BaseModule
5
4
 
@@ -116,12 +115,10 @@ module Braintree
116
115
  attr_reader :payment_instrument_type
117
116
  attr_reader :risk_data
118
117
 
119
- # See http://www.braintreepayments.com/docs/ruby/transactions/create
120
118
  def self.create(attributes)
121
119
  Configuration.gateway.transaction.create(attributes)
122
120
  end
123
121
 
124
- # See http://www.braintreepayments.com/docs/ruby/transactions/create
125
122
  def self.create!(attributes)
126
123
  return_object_or_raise(:transaction) { create(attributes) }
127
124
  end
@@ -143,16 +140,12 @@ module Braintree
143
140
  end
144
141
 
145
142
  # Deprecated. Use Braintree::TransparentRedirect.confirm
146
- #
147
- # See http://www.braintreepayments.com/docs/ruby/transactions/create_tr
148
143
  def self.create_from_transparent_redirect(query_string)
149
144
  warn "[DEPRECATED] Transaction.create_from_transparent_redirect is deprecated. Please use TransparentRedirect.confirm"
150
145
  Configuration.gateway.transaction.create_from_transparent_redirect(query_string)
151
146
  end
152
147
 
153
148
  # Deprecated. Use Braintree::TransparentRedirect.url
154
- #
155
- # See http://www.braintreepayments.com/docs/ruby/transactions/create_tr
156
149
  def self.create_transaction_url
157
150
  warn "[DEPRECATED] Transaction.create_transaction_url is deprecated. Please use TransparentRedirect.url"
158
151
  Configuration.gateway.transaction.create_transaction_url
@@ -166,7 +159,6 @@ module Braintree
166
159
  return_object_or_raise(:transaction) { credit(attributes) }
167
160
  end
168
161
 
169
- # See http://www.braintreepayments.com/docs/ruby/transactions/search
170
162
  def self.find(id)
171
163
  Configuration.gateway.transaction.find(id)
172
164
  end
@@ -179,27 +171,22 @@ module Braintree
179
171
  return_object_or_raise(:transaction) { hold_in_escrow(id) }
180
172
  end
181
173
 
182
- # See http://www.braintreepayments.com/docs/ruby/transactions/refund
183
174
  def self.refund(id, amount = nil)
184
175
  Configuration.gateway.transaction.refund(id, amount)
185
176
  end
186
177
 
187
- # See http://www.braintreepayments.com/docs/ruby/transactions/refund
188
178
  def self.refund!(id, amount = nil)
189
179
  return_object_or_raise(:transaction) { refund(id, amount) }
190
180
  end
191
181
 
192
- # See http://www.braintreepayments.com/docs/ruby/transactions/create
193
182
  def self.sale(attributes)
194
183
  Configuration.gateway.transaction.sale(attributes)
195
184
  end
196
185
 
197
- # See http://www.braintreepayments.com/docs/ruby/transactions/create
198
186
  def self.sale!(attributes)
199
187
  return_object_or_raise(:transaction) { sale(attributes) }
200
188
  end
201
189
 
202
- # See http://www.braintreepayments.com/docs/ruby/transactions/search
203
190
  def self.search(&block)
204
191
  Configuration.gateway.transaction.search(&block)
205
192
  end
@@ -212,22 +199,18 @@ module Braintree
212
199
  return_object_or_raise(:transaction) { release_from_escrow(transaction_id) }
213
200
  end
214
201
 
215
- # See http://www.braintreepayments.com/docs/ruby/transactions/submit_for_settlement
216
202
  def self.submit_for_settlement(transaction_id, amount = nil)
217
203
  Configuration.gateway.transaction.submit_for_settlement(transaction_id, amount)
218
204
  end
219
205
 
220
- # See http://www.braintreepayments.com/docs/ruby/transactions/submit_for_settlement
221
206
  def self.submit_for_settlement!(transaction_id, amount = nil)
222
207
  return_object_or_raise(:transaction) { submit_for_settlement(transaction_id, amount) }
223
208
  end
224
209
 
225
- # See http://www.braintreepayments.com/docs/ruby/transactions/void
226
210
  def self.void(transaction_id)
227
211
  Configuration.gateway.transaction.void(transaction_id)
228
212
  end
229
213
 
230
- # See http://www.braintreepayments.com/docs/ruby/transactions/void
231
214
  def self.void!(transaction_id)
232
215
  return_object_or_raise(:transaction) { void(transaction_id) }
233
216
  end
@@ -277,8 +260,6 @@ module Braintree
277
260
  end
278
261
 
279
262
  # Deprecated. Use Braintree::Transaction.refund
280
- #
281
- # See http://www.braintreepayments.com/docs/ruby/transactions/refund
282
263
  def refund(amount = nil)
283
264
  warn "[DEPRECATED] refund as an instance method is deprecated. Please use Transaction.refund"
284
265
  result = @gateway.transaction.refund(id, amount)
@@ -306,8 +287,6 @@ module Braintree
306
287
  end
307
288
 
308
289
  # Deprecated. Use Braintree::Transaction.submit_for_settlement
309
- #
310
- # See http://www.braintreepayments.com/docs/ruby/transactions/submit_for_settlement
311
290
  def submit_for_settlement(amount = nil)
312
291
  warn "[DEPRECATED] submit_for_settlement as an instance method is deprecated. Please use Transaction.submit_for_settlement"
313
292
  result = @gateway.transaction.submit_for_settlement(id, amount)
@@ -318,8 +297,6 @@ module Braintree
318
297
  end
319
298
 
320
299
  # Deprecated. Use Braintree::Transaction.submit_for_settlement!
321
- #
322
- # See http://www.braintreepayments.com/docs/ruby/transactions/submit_for_settlement
323
300
  def submit_for_settlement!(amount = nil)
324
301
  warn "[DEPRECATED] submit_for_settlement! as an instance method is deprecated. Please use Transaction.submit_for_settlement!"
325
302
  return_object_or_raise(:transaction) { submit_for_settlement(amount) }
@@ -362,8 +339,6 @@ module Braintree
362
339
  end
363
340
 
364
341
  # Deprecated. Use Braintree::Transaction.void
365
- #
366
- # See http://www.braintreepayments.com/docs/ruby/transactions/void
367
342
  def void
368
343
  warn "[DEPRECATED] void as an instance method is deprecated. Please use Transaction.void"
369
344
  result = @gateway.transaction.void(id)
@@ -374,8 +349,6 @@ module Braintree
374
349
  end
375
350
 
376
351
  # Deprecated. Use Braintree::Transaction.void!
377
- #
378
- # See http://www.braintreepayments.com/docs/ruby/transactions/void
379
352
  def void!
380
353
  warn "[DEPRECATED] void! as an instance method is deprecated. Please use Transaction.void!"
381
354
  return_object_or_raise(:transaction) { void }
@@ -5,7 +5,7 @@ module Braintree
5
5
 
6
6
  attr_reader :bin, :card_type, :cardholder_name, :customer_location, :expiration_month,
7
7
  :expiration_year, :last_4, :token, :prepaid, :healthcare, :durbin_regulated, :debit,
8
- :commercial, :payroll, :country_of_issuance, :issuing_bank
8
+ :commercial, :payroll, :country_of_issuance, :issuing_bank, :image_url
9
9
 
10
10
  def initialize(attributes)
11
11
  set_instance_variables_from_hash attributes unless attributes.nil?
@@ -17,7 +17,7 @@ module Braintree
17
17
 
18
18
  def inspect
19
19
  attr_order = [:token, :bin, :last_4, :card_type, :expiration_date, :cardholder_name, :customer_location, :prepaid,
20
- :healthcare, :durbin_regulated, :debit, :commercial, :payroll, :country_of_issuance, :issuing_bank]
20
+ :healthcare, :durbin_regulated, :debit, :commercial, :payroll, :country_of_issuance, :issuing_bank, :image_url]
21
21
  formatted_attrs = attr_order.map do |attr|
22
22
  "#{attr}: #{send(attr).inspect}"
23
23
  end
@@ -4,7 +4,8 @@ module Braintree
4
4
  include BaseModule
5
5
 
6
6
  attr_reader :custom_field, :payer_email, :payment_id, :authorization_id, :token,
7
- :image_url, :debug_id, :payee_email
7
+ :image_url, :debug_id, :payee_email, :payer_id, :payer_first_name, :payer_last_name,
8
+ :seller_protection_status, :capture_id, :refund_id
8
9
 
9
10
  def initialize(attributes)
10
11
  set_instance_variables_from_hash attributes unless attributes.nil?
@@ -27,7 +27,7 @@ module Braintree
27
27
  :paypal_authorization_id,
28
28
  :paypal_payer_email,
29
29
  :processor_authorization_code,
30
- :sepa_bank_account_iban,
30
+ :europe_bank_account_iban,
31
31
  :settlement_batch_id,
32
32
  :shipping_company,
33
33
  :shipping_country_name,
@@ -1,10 +1,4 @@
1
1
  module Braintree
2
- # See:
3
- # * http://www.braintreepayments.com/docs/ruby/transactions/create_tr
4
- # * http://www.braintreepayments.com/docs/ruby/customers/create_tr
5
- # * http://www.braintreepayments.com/docs/ruby/customers/update_tr
6
- # * http://www.braintreepayments.com/docs/ruby/credit_cards/create_tr
7
- # * http://www.braintreepayments.com/docs/ruby/credit_cards/update_tr
8
2
  module TransparentRedirect
9
3
  module Kind # :nodoc:
10
4
  CreateCustomer = "create_customer"
@@ -18,27 +12,22 @@ module Braintree
18
12
  Configuration.gateway.transparent_redirect.confirm(query_string)
19
13
  end
20
14
 
21
- # See http://www.braintreepayments.com/docs/ruby/credit_cards/create_tr
22
15
  def self.create_credit_card_data(params)
23
16
  Configuration.gateway.transparent_redirect.create_credit_card_data(params)
24
17
  end
25
18
 
26
- # See http://www.braintreepayments.com/docs/ruby/customers/create_tr
27
19
  def self.create_customer_data(params)
28
20
  Configuration.gateway.transparent_redirect.create_customer_data(params)
29
21
  end
30
22
 
31
- # See http://www.braintreepayments.com/docs/ruby/transactions/create_tr
32
23
  def self.transaction_data(params)
33
24
  Configuration.gateway.transparent_redirect.transaction_data(params)
34
25
  end
35
26
 
36
- # See http://www.braintreepayments.com/docs/ruby/credit_cards/update_tr
37
27
  def self.update_credit_card_data(params)
38
28
  Configuration.gateway.transparent_redirect.update_credit_card_data(params)
39
29
  end
40
30
 
41
- # See http://www.braintreepayments.com/docs/ruby/customers/update_tr
42
31
  def self.update_customer_data(params)
43
32
  Configuration.gateway.transparent_redirect.update_customer_data(params)
44
33
  end
@@ -1,5 +1,4 @@
1
1
  module Braintree
2
- # See http://www.braintreepayments.com/docs/ruby/general/validation_errors
3
2
  class ValidationError
4
3
  include BaseModule
5
4
 
@@ -1,5 +1,4 @@
1
1
  module Braintree
2
- # See http://www.braintreepayments.com/docs/ruby/general/validation_errors
3
2
  class ValidationErrorCollection
4
3
  include Enumerable
5
4
 
@@ -1,7 +1,7 @@
1
1
  module Braintree
2
2
  module Version
3
3
  Major = 2
4
- Minor = 40
4
+ Minor = 41
5
5
  Tiny = 0
6
6
 
7
7
  String = "#{Major}.#{Minor}.#{Tiny}"
data/spec/httpsd.pid CHANGED
@@ -1 +1 @@
1
- 17610
1
+ 20677
@@ -194,7 +194,7 @@ describe Braintree::ClientToken do
194
194
  raw_client_token = Braintree::ClientToken.generate(
195
195
  :customer_id => customer_id,
196
196
  :sepa_mandate_acceptance_location => "Hamburg, Germany",
197
- :sepa_mandate_type => Braintree::SEPABankAccount::MandateType::Business
197
+ :sepa_mandate_type => Braintree::EuropeBankAccount::MandateType::Business
198
198
  )
199
199
  client_token = decode_client_token(raw_client_token)
200
200
 
@@ -145,7 +145,7 @@ class ClientApiHttp
145
145
  post("/merchants/#{config.merchant_id}/client_api/v1/payment_methods/paypal_accounts", params)
146
146
  end
147
147
 
148
- def create_sepa_bank_account_nonce(params)
148
+ def create_europe_bank_account_nonce(params)
149
149
  foo = {
150
150
  :authorization_fingerprint => @options[:authorization_fingerprint],
151
151
  :shared_customer_identifier => "fake_identifier",
@@ -156,8 +156,7 @@ class ClientApiHttp
156
156
 
157
157
  response = post("/merchants/#{config.merchant_id}/client_api/v1/sepa_mandates", foo)
158
158
 
159
- mrn = JSON.parse(response.body)['sepaMandates'][0]['mandateReferenceNumber']
160
- accept_response = put("/merchants/#{config.merchant_id}/client_api/v1/sepa_mandates/#{mrn}/accept.json",foo)
161
- JSON.parse(accept_response.body)['sepaBankAccounts'][0]['nonce']
159
+ mrn = JSON.parse(response.body)['europeBankAccounts'][0]['sepaMandates'][0]['mandateReferenceNumber']
160
+ JSON.parse(response.body)['europeBankAccounts'][0]['nonce']
162
161
  end
163
162
  end
@@ -1091,7 +1091,7 @@ describe Braintree::CreditCard do
1091
1091
  Braintree::CreditCard.create!(
1092
1092
  :customer_id => customer.id,
1093
1093
  :number => Braintree::Test::CreditCardNumbers::Visa,
1094
- :expiration_date => "01/2010"
1094
+ :expiration_date => "01/2015"
1095
1095
  )
1096
1096
  end
1097
1097