braintree 2.80.1 → 2.81.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.
Files changed (81) hide show
  1. checksums.yaml +7 -0
  2. data/lib/braintree.rb +4 -1
  3. data/lib/braintree/account_updater_daily_report.rb +1 -1
  4. data/lib/braintree/ach_mandate.rb +2 -1
  5. data/lib/braintree/address.rb +16 -3
  6. data/lib/braintree/amex_express_checkout_card.rb +14 -2
  7. data/lib/braintree/android_pay_card.rb +16 -3
  8. data/lib/braintree/apple_pay_card.rb +15 -3
  9. data/lib/braintree/bin_data.rb +9 -2
  10. data/lib/braintree/coinbase_account.rb +10 -1
  11. data/lib/braintree/connected_merchant_paypal_status_changed.rb +3 -1
  12. data/lib/braintree/connected_merchant_status_transitioned.rb +3 -1
  13. data/lib/braintree/credentials_parser.rb +5 -1
  14. data/lib/braintree/credit_card.rb +25 -10
  15. data/lib/braintree/credit_card_verification.rb +32 -14
  16. data/lib/braintree/customer.rb +24 -11
  17. data/lib/braintree/descriptor.rb +3 -1
  18. data/lib/braintree/disbursement.rb +9 -1
  19. data/lib/braintree/dispute.rb +1 -6
  20. data/lib/braintree/dispute/transaction_details.rb +2 -1
  21. data/lib/braintree/document_upload.rb +6 -7
  22. data/lib/braintree/error_codes.rb +30 -0
  23. data/lib/braintree/error_result.rb +8 -1
  24. data/lib/braintree/europe_bank_account.rb +3 -1
  25. data/lib/braintree/facilitated_details.rb +3 -1
  26. data/lib/braintree/facilitator_details.rb +2 -1
  27. data/lib/braintree/gateway.rb +4 -0
  28. data/lib/braintree/granted_payment_instrument_update.rb +5 -1
  29. data/lib/braintree/ideal_payment.rb +15 -2
  30. data/lib/braintree/masterpass_card.rb +26 -11
  31. data/lib/braintree/merchant.rb +8 -1
  32. data/lib/braintree/merchant_account.rb +8 -3
  33. data/lib/braintree/merchant_account/address_details.rb +4 -1
  34. data/lib/braintree/merchant_account/business_details.rb +4 -1
  35. data/lib/braintree/merchant_account/funding_details.rb +6 -1
  36. data/lib/braintree/merchant_account/individual_details.rb +7 -2
  37. data/lib/braintree/oauth_credentials.rb +4 -1
  38. data/lib/braintree/paginated_result.rb +3 -1
  39. data/lib/braintree/payment_method_nonce.rb +5 -1
  40. data/lib/braintree/paypal_account.rb +8 -1
  41. data/lib/braintree/plan.rb +4 -4
  42. data/lib/braintree/risk_data.rb +3 -1
  43. data/lib/braintree/settlement_batch_summary.rb +1 -0
  44. data/lib/braintree/subscription.rb +27 -17
  45. data/lib/braintree/subscription/status_details.rb +8 -1
  46. data/lib/braintree/successful_result.rb +19 -1
  47. data/lib/braintree/three_d_secure_info.rb +5 -1
  48. data/lib/braintree/transaction.rb +54 -48
  49. data/lib/braintree/transaction/address_details.rb +13 -4
  50. data/lib/braintree/transaction/amex_express_checkout_details.rb +9 -2
  51. data/lib/braintree/transaction/android_pay_details.rb +10 -3
  52. data/lib/braintree/transaction/apple_pay_details.rb +7 -2
  53. data/lib/braintree/transaction/coinbase_details.rb +4 -1
  54. data/lib/braintree/transaction/credit_card_details.rb +40 -6
  55. data/lib/braintree/transaction/customer_details.rb +8 -1
  56. data/lib/braintree/transaction/disbursement_details.rb +5 -1
  57. data/lib/braintree/transaction/ideal_payment_details.rb +5 -1
  58. data/lib/braintree/transaction/masterpass_card_details.rb +18 -4
  59. data/lib/braintree/transaction/paypal_details.rb +18 -4
  60. data/lib/braintree/transaction/status_details.rb +5 -1
  61. data/lib/braintree/transaction/subscription_details.rb +2 -1
  62. data/lib/braintree/transaction/us_bank_account_details.rb +8 -1
  63. data/lib/braintree/transaction/venmo_account_details.rb +5 -1
  64. data/lib/braintree/transaction/visa_checkout_card_details.rb +19 -4
  65. data/lib/braintree/transaction_gateway.rb +1 -0
  66. data/lib/braintree/transaction_line_item.rb +34 -0
  67. data/lib/braintree/transaction_line_item_gateway.rb +19 -0
  68. data/lib/braintree/unknown_payment_method.rb +2 -1
  69. data/lib/braintree/us_bank_account.rb +9 -1
  70. data/lib/braintree/util.rb +14 -0
  71. data/lib/braintree/validation_error.rb +3 -1
  72. data/lib/braintree/venmo_account.rb +10 -3
  73. data/lib/braintree/version.rb +2 -2
  74. data/lib/braintree/visa_checkout_card.rb +27 -11
  75. data/lib/braintree/webhook_notification.rb +9 -9
  76. data/spec/httpsd.pid +1 -0
  77. data/spec/integration/braintree/apple_pay_spec.rb +2 -31
  78. data/spec/integration/braintree/http_spec.rb +1 -1
  79. data/spec/integration/braintree/transaction_spec.rb +1142 -0
  80. metadata +205 -207
  81. data/README.rdoc +0 -102
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 8046a5171d6ad591681775c5d7042588ef1cf9ba
4
+ data.tar.gz: 82c32c31d3e726b76b1f2c98352bcb63b5d8a146
5
+ SHA512:
6
+ metadata.gz: 5b1dcb594b7b22c7fbe83df0981bc3ef56268a8bfd95e934dcd70c3264bd8f05e35945ee98f00ad91dad415a7e97cfe8164c645871c634ea9caa79f683dda72f
7
+ data.tar.gz: 55903ce006bde24e7b3a06e7170a20378555d1c4cab740b9d3162085ddf67a14e3f6ca3ff5b96f9350e07de1cb7e6dff783fd8d6f030235996f7cd4f4429d324
@@ -20,6 +20,8 @@ require "braintree/exceptions"
20
20
  require "braintree/base_module"
21
21
  require "braintree/modification"
22
22
 
23
+ require "braintree/util"
24
+
23
25
  require "braintree/account_updater_daily_report"
24
26
  require "braintree/ach_mandate"
25
27
  require "braintree/add_on"
@@ -119,6 +121,7 @@ require "braintree/test/nonce"
119
121
  require "braintree/test/transaction_amounts"
120
122
  require "braintree/testing_gateway"
121
123
  require "braintree/transaction"
124
+ require "braintree/transaction_line_item"
122
125
  require "braintree/test_transaction"
123
126
  require "braintree/transaction/address_details"
124
127
  require "braintree/transaction/apple_pay_details"
@@ -131,6 +134,7 @@ require "braintree/transaction/disbursement_details"
131
134
  require "braintree/transaction/paypal_details"
132
135
  require "braintree/transaction/subscription_details"
133
136
  require "braintree/transaction_gateway"
137
+ require "braintree/transaction_line_item_gateway"
134
138
  require "braintree/transaction_search"
135
139
  require "braintree/transaction/status_details"
136
140
  require "braintree/transaction/venmo_account_details"
@@ -141,7 +145,6 @@ require "braintree/disbursement"
141
145
  require "braintree/dispute_search"
142
146
  require "braintree/transparent_redirect"
143
147
  require "braintree/transparent_redirect_gateway"
144
- require "braintree/util"
145
148
  require "braintree/validation_error"
146
149
  require "braintree/validation_error_collection"
147
150
  require "braintree/venmo_account"
@@ -2,8 +2,8 @@ module Braintree
2
2
  class AccountUpdaterDailyReport # :nodoc:
3
3
  include BaseModule
4
4
 
5
- attr_reader :report_url
6
5
  attr_reader :report_date
6
+ attr_reader :report_url
7
7
 
8
8
  class << self
9
9
  protected :new
@@ -2,7 +2,8 @@ module Braintree
2
2
  class AchMandate
3
3
  include BaseModule # :nodoc:
4
4
 
5
- attr_reader :text, :accepted_at
5
+ attr_reader :accepted_at
6
+ attr_reader :text
6
7
 
7
8
  def initialize(attributes)
8
9
  set_instance_variables_from_hash(attributes)
@@ -2,9 +2,22 @@ module Braintree
2
2
  class Address
3
3
  include BaseModule # :nodoc:
4
4
 
5
- attr_reader :company, :country_name, :created_at, :customer_id, :extended_address, :first_name, :id,
6
- :last_name, :locality, :postal_code, :region, :street_address, :updated_at,
7
- :country_code_alpha2, :country_code_alpha3, :country_code_numeric
5
+ attr_reader :company
6
+ attr_reader :country_code_alpha2
7
+ attr_reader :country_code_alpha3
8
+ attr_reader :country_code_numeric
9
+ attr_reader :country_name
10
+ attr_reader :created_at
11
+ attr_reader :customer_id
12
+ attr_reader :extended_address
13
+ attr_reader :first_name
14
+ attr_reader :id
15
+ attr_reader :last_name
16
+ attr_reader :locality
17
+ attr_reader :postal_code
18
+ attr_reader :region
19
+ attr_reader :street_address
20
+ attr_reader :updated_at
8
21
 
9
22
  def self.create(attributes)
10
23
  Configuration.gateway.address.create(attributes)
@@ -2,8 +2,20 @@ module Braintree
2
2
  class AmexExpressCheckoutCard
3
3
  include BaseModule # :nodoc:
4
4
 
5
- attr_reader :bin, :card_member_expiry_date, :card_member_number, :card_type, :created_at, :customer_id, :default,
6
- :expiration_month, :expiration_year, :image_url, :source_description, :subscriptions, :token, :updated_at
5
+ attr_reader :bin
6
+ attr_reader :card_member_expiry_date
7
+ attr_reader :card_member_number
8
+ attr_reader :card_type
9
+ attr_reader :created_at
10
+ attr_reader :customer_id
11
+ attr_reader :default
12
+ attr_reader :expiration_month
13
+ attr_reader :expiration_year
14
+ attr_reader :image_url
15
+ attr_reader :source_description
16
+ attr_reader :subscriptions
17
+ attr_reader :token
18
+ attr_reader :updated_at
7
19
 
8
20
  def initialize(gateway, attributes) # :nodoc:
9
21
  @gateway = gateway
@@ -2,9 +2,22 @@ module Braintree
2
2
  class AndroidPayCard
3
3
  include BaseModule # :nodoc:
4
4
 
5
- attr_reader :token, :virtual_card_type, :virtual_card_last_4, :source_card_type, :source_card_last_4,
6
- :expiration_month, :expiration_year, :created_at, :updated_at, :image_url, :subscriptions, :bin,
7
- :google_transaction_id, :default, :source_description, :customer_id
5
+ attr_reader :bin
6
+ attr_reader :created_at
7
+ attr_reader :customer_id
8
+ attr_reader :default
9
+ attr_reader :expiration_month
10
+ attr_reader :expiration_year
11
+ attr_reader :google_transaction_id
12
+ attr_reader :image_url
13
+ attr_reader :source_card_last_4
14
+ attr_reader :source_card_type
15
+ attr_reader :source_description
16
+ attr_reader :subscriptions
17
+ attr_reader :token
18
+ attr_reader :updated_at
19
+ attr_reader :virtual_card_last_4
20
+ attr_reader :virtual_card_type
8
21
 
9
22
  def initialize(gateway, attributes) # :nodoc:
10
23
  @gateway = gateway
@@ -10,9 +10,21 @@ module Braintree
10
10
  All = constants.map { |c| const_get(c) }
11
11
  end
12
12
 
13
- attr_reader :bin, :card_type, :created_at, :customer_id, :default, :expiration_month,
14
- :expiration_year, :expired, :image_url, :last_4, :payment_instrument_name,
15
- :source_description, :subscriptions, :token, :updated_at
13
+ attr_reader :bin
14
+ attr_reader :card_type
15
+ attr_reader :created_at
16
+ attr_reader :customer_id
17
+ attr_reader :default
18
+ attr_reader :expiration_month
19
+ attr_reader :expiration_year
20
+ attr_reader :expired
21
+ attr_reader :image_url
22
+ attr_reader :last_4
23
+ attr_reader :payment_instrument_name
24
+ attr_reader :source_description
25
+ attr_reader :subscriptions
26
+ attr_reader :token
27
+ attr_reader :updated_at
16
28
 
17
29
  def initialize(gateway, attributes) # :nodoc:
18
30
  @gateway = gateway
@@ -2,8 +2,15 @@ module Braintree
2
2
  class BinData # :nodoc:
3
3
  include BaseModule
4
4
 
5
- attr_reader :commercial, :country_of_issuance, :debit, :durbin_regulated, :healthcare,
6
- :issuing_bank, :payroll, :prepaid, :product_id
5
+ attr_reader :commercial
6
+ attr_reader :country_of_issuance
7
+ attr_reader :debit
8
+ attr_reader :durbin_regulated
9
+ attr_reader :healthcare
10
+ attr_reader :issuing_bank
11
+ attr_reader :payroll
12
+ attr_reader :prepaid
13
+ attr_reader :product_id
7
14
 
8
15
  def initialize(attributes)
9
16
  set_instance_variables_from_hash attributes unless attributes.nil?
@@ -2,7 +2,16 @@ module Braintree
2
2
  class CoinbaseAccount
3
3
  include BaseModule # :nodoc:
4
4
 
5
- attr_reader :token, :user_id, :user_email, :user_name, :subscriptions, :created_at, :updated_at, :default, :customer_id
5
+ attr_reader :created_at
6
+ attr_reader :customer_id
7
+ attr_reader :default
8
+ attr_reader :subscriptions
9
+ attr_reader :token
10
+ attr_reader :updated_at
11
+ attr_reader :user_email
12
+ attr_reader :user_id
13
+ attr_reader :user_name
14
+
6
15
  def initialize(gateway, attributes) # :nodoc:
7
16
  @gateway = gateway
8
17
  set_instance_variables_from_hash(attributes)
@@ -2,7 +2,9 @@ module Braintree
2
2
  class ConnectedMerchantPayPalStatusChanged
3
3
  include BaseModule
4
4
 
5
- attr_reader :merchant_public_id, :action, :oauth_application_client_id
5
+ attr_reader :action
6
+ attr_reader :merchant_public_id
7
+ attr_reader :oauth_application_client_id
6
8
 
7
9
  def initialize(attributes)
8
10
  set_instance_variables_from_hash(attributes)
@@ -2,7 +2,9 @@ module Braintree
2
2
  class ConnectedMerchantStatusTransitioned
3
3
  include BaseModule
4
4
 
5
- attr_reader :merchant_public_id, :status, :oauth_application_client_id
5
+ attr_reader :merchant_public_id
6
+ attr_reader :oauth_application_client_id
7
+ attr_reader :status
6
8
 
7
9
  def initialize(attributes)
8
10
  set_instance_variables_from_hash(attributes)
@@ -1,6 +1,10 @@
1
1
  module Braintree
2
2
  class CredentialsParser
3
- attr_reader :client_id, :client_secret, :access_token, :environment, :merchant_id
3
+ attr_reader :access_token
4
+ attr_reader :client_id
5
+ attr_reader :client_secret
6
+ attr_reader :environment
7
+ attr_reader :merchant_id
4
8
 
5
9
  def parse_client_credentials(client_id, client_secret)
6
10
  raise ConfigurationError.new("Missing client_id when constructing Braintree::Gateway") if client_id.nil?
@@ -1,6 +1,7 @@
1
1
  module Braintree
2
2
  class CreditCard
3
3
  include BaseModule # :nodoc:
4
+ include Braintree::Util::TokenEquality
4
5
 
5
6
  module CardType
6
7
  AmEx = "American Express"
@@ -35,10 +36,30 @@ module Braintree
35
36
  Commercial = Debit = DurbinRegulated = Healthcare = Payroll = Prepaid = ProductId =
36
37
  IssuingBank = CountryOfIssuance = CardTypeIndicator
37
38
 
38
- attr_reader :billing_address, :bin, :card_type, :cardholder_name, :commercial, :country_of_issuance,
39
- :created_at, :customer_id, :debit, :durbin_regulated, :expiration_month, :expiration_year, :healthcare,
40
- :issuing_bank, :last_4, :payroll, :prepaid, :product_id, :subscriptions, :token, :unique_number_identifier, :updated_at,
41
- :image_url, :verification
39
+ attr_reader :billing_address
40
+ attr_reader :bin
41
+ attr_reader :card_type
42
+ attr_reader :cardholder_name
43
+ attr_reader :commercial
44
+ attr_reader :country_of_issuance
45
+ attr_reader :created_at
46
+ attr_reader :customer_id
47
+ attr_reader :debit
48
+ attr_reader :durbin_regulated
49
+ attr_reader :expiration_month
50
+ attr_reader :expiration_year
51
+ attr_reader :healthcare
52
+ attr_reader :image_url
53
+ attr_reader :issuing_bank
54
+ attr_reader :last_4
55
+ attr_reader :payroll
56
+ attr_reader :prepaid
57
+ attr_reader :product_id
58
+ attr_reader :subscriptions
59
+ attr_reader :token
60
+ attr_reader :unique_number_identifier
61
+ attr_reader :updated_at
62
+ attr_reader :verification
42
63
 
43
64
  def self.create(attributes)
44
65
  Configuration.gateway.credit_card.create(attributes)
@@ -217,12 +238,6 @@ module Braintree
217
238
  @venmo_sdk
218
239
  end
219
240
 
220
- # Returns true if +other+ is a +CreditCard+ with the same token.
221
- def ==(other)
222
- return false unless other.is_a?(CreditCard)
223
- token == other.token
224
- end
225
-
226
241
  class << self
227
242
  protected :new
228
243
  end
@@ -1,6 +1,7 @@
1
1
  module Braintree
2
2
  class CreditCardVerification
3
3
  include BaseModule
4
+ include Braintree::Util::IdEquality
4
5
 
5
6
  module Status
6
7
  Failed = 'failed'
@@ -11,10 +12,22 @@ module Braintree
11
12
  All = [Failed, GatewayRejected, ProcessorDeclined, Verified]
12
13
  end
13
14
 
14
- attr_reader :avs_error_response_code, :avs_postal_code_response_code, :avs_street_address_response_code,
15
- :cvv_response_code, :merchant_account_id, :processor_response_code, :processor_response_text, :status,
16
- :amount, :currency_iso_code, :id, :gateway_rejection_reason, :credit_card, :billing, :created_at,
17
- :risk_data
15
+ attr_reader :amount
16
+ attr_reader :avs_error_response_code
17
+ attr_reader :avs_postal_code_response_code
18
+ attr_reader :avs_street_address_response_code
19
+ attr_reader :billing
20
+ attr_reader :created_at
21
+ attr_reader :credit_card
22
+ attr_reader :currency_iso_code
23
+ attr_reader :cvv_response_code
24
+ attr_reader :gateway_rejection_reason
25
+ attr_reader :id
26
+ attr_reader :merchant_account_id
27
+ attr_reader :processor_response_code
28
+ attr_reader :processor_response_text
29
+ attr_reader :risk_data
30
+ attr_reader :status
18
31
 
19
32
  def initialize(attributes) # :nodoc:
20
33
  set_instance_variables_from_hash(attributes)
@@ -26,11 +39,21 @@ module Braintree
26
39
 
27
40
  def inspect # :nodoc:
28
41
  attr_order = [
29
- :status, :processor_response_code, :processor_response_text,
30
- :amount, :currency_iso_code,
31
- :cvv_response_code, :avs_error_response_code,
32
- :avs_postal_code_response_code, :avs_street_address_response_code,
33
- :merchant_account_id, :gateway_rejection_reason, :id, :credit_card, :billing, :created_at
42
+ :status,
43
+ :processor_response_code,
44
+ :processor_response_text,
45
+ :amount,
46
+ :currency_iso_code,
47
+ :cvv_response_code,
48
+ :avs_error_response_code,
49
+ :avs_postal_code_response_code,
50
+ :avs_street_address_response_code,
51
+ :merchant_account_id,
52
+ :gateway_rejection_reason,
53
+ :id,
54
+ :credit_card,
55
+ :billing,
56
+ :created_at
34
57
  ]
35
58
  formatted_attrs = attr_order.map do |attr|
36
59
  if attr == :amount
@@ -62,10 +85,5 @@ module Braintree
62
85
  Util.verify_keys(CreditCardVerificationGateway._create_signature, attributes)
63
86
  Configuration.gateway.verification.create(attributes)
64
87
  end
65
-
66
- def ==(other)
67
- return false unless other.is_a?(CreditCardVerification)
68
- id == other.id
69
- end
70
88
  end
71
89
  end
@@ -1,11 +1,30 @@
1
1
  module Braintree
2
2
  class Customer
3
3
  include BaseModule
4
-
5
- attr_reader :addresses, :company, :created_at, :credit_cards, :email, :fax, :first_name, :id, :last_name,
6
- :phone, :updated_at, :website, :custom_fields, :paypal_accounts, :apple_pay_cards, :coinbase_accounts,
7
- :android_pay_cards, :amex_express_checkout_cards, :venmo_accounts, :us_bank_accounts, :visa_checkout_cards,
8
- :masterpass_cards
4
+ include Braintree::Util::IdEquality
5
+
6
+ attr_reader :addresses
7
+ attr_reader :amex_express_checkout_cards
8
+ attr_reader :android_pay_cards
9
+ attr_reader :apple_pay_cards
10
+ attr_reader :coinbase_accounts
11
+ attr_reader :company
12
+ attr_reader :created_at
13
+ attr_reader :credit_cards
14
+ attr_reader :custom_fields
15
+ attr_reader :email
16
+ attr_reader :fax
17
+ attr_reader :first_name
18
+ attr_reader :id
19
+ attr_reader :last_name
20
+ attr_reader :masterpass_cards
21
+ attr_reader :paypal_accounts
22
+ attr_reader :phone
23
+ attr_reader :updated_at
24
+ attr_reader :us_bank_accounts
25
+ attr_reader :venmo_accounts
26
+ attr_reader :visa_checkout_cards
27
+ attr_reader :website
9
28
 
10
29
  def self.all
11
30
  Configuration.gateway.customer.all
@@ -183,12 +202,6 @@ module Braintree
183
202
  return_object_or_raise(:customer) { update(attributes) }
184
203
  end
185
204
 
186
- # Returns true if +other+ is a Customer with the same id
187
- def ==(other)
188
- return false unless other.is_a?(Customer)
189
- id == other.id
190
- end
191
-
192
205
  class << self
193
206
  protected :new
194
207
  end
@@ -2,7 +2,9 @@ module Braintree
2
2
  class Descriptor # :nodoc:
3
3
  include BaseModule
4
4
 
5
- attr_reader :name, :phone, :url
5
+ attr_reader :name
6
+ attr_reader :phone
7
+ attr_reader :url
6
8
 
7
9
  def initialize(attributes)
8
10
  set_instance_variables_from_hash attributes unless attributes.nil?
@@ -2,7 +2,15 @@ module Braintree
2
2
  class Disbursement
3
3
  include BaseModule
4
4
 
5
- attr_reader :id, :amount, :exception_message, :disbursement_date, :follow_up_action, :merchant_account, :transaction_ids, :retry, :success
5
+ attr_reader :amount
6
+ attr_reader :disbursement_date
7
+ attr_reader :exception_message
8
+ attr_reader :follow_up_action
9
+ attr_reader :id
10
+ attr_reader :merchant_account
11
+ attr_reader :retry
12
+ attr_reader :success
13
+ attr_reader :transaction_ids
6
14
 
7
15
  alias_method :success?, :success
8
16
 
@@ -1,6 +1,7 @@
1
1
  module Braintree
2
2
  class Dispute # :nodoc:
3
3
  include BaseModule
4
+ include Braintree::Util::IdEquality
4
5
 
5
6
  attr_reader :amount
6
7
  attr_reader :amount_disputed
@@ -119,11 +120,5 @@ module Braintree
119
120
  Braintree::Dispute::HistoryEvent.new(event)
120
121
  end unless status_history.nil?
121
122
  end
122
-
123
- # Returns true if +other+ is a Dispute with the same id
124
- def ==(other)
125
- return false unless other.is_a?(Dispute)
126
- id == other.id
127
- end
128
123
  end
129
124
  end