braintree 4.26.0 → 4.28.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 (86) hide show
  1. checksums.yaml +4 -4
  2. data/lib/braintree/apple_pay_card.rb +4 -0
  3. data/lib/braintree/bin_data.rb +7 -2
  4. data/lib/braintree/configuration.rb +1 -1
  5. data/lib/braintree/credit_card.rb +11 -5
  6. data/lib/braintree/credit_card_gateway.rb +1 -0
  7. data/lib/braintree/credit_card_verification_gateway.rb +1 -0
  8. data/lib/braintree/customer_session_gateway.rb +11 -10
  9. data/lib/braintree/error_codes.rb +5 -104
  10. data/lib/braintree/google_pay_card.rb +4 -0
  11. data/lib/braintree/graphql/enums/recommendations.rb +2 -0
  12. data/lib/braintree/graphql/enums/recommended_payment_option.rb +2 -0
  13. data/lib/braintree/graphql/inputs/create_customer_session_input.rb +10 -1
  14. data/lib/braintree/graphql/inputs/customer_recommendations_input.rb +7 -8
  15. data/lib/braintree/graphql/inputs/customer_session_input.rb +6 -0
  16. data/lib/braintree/graphql/inputs/monetary_amount_input.rb +28 -0
  17. data/lib/braintree/graphql/inputs/paypal_payee_input.rb +28 -0
  18. data/lib/braintree/graphql/inputs/paypal_purchase_unit_input.rb +31 -0
  19. data/lib/braintree/graphql/inputs/phone_input.rb +2 -0
  20. data/lib/braintree/graphql/inputs/update_customer_session_input.rb +5 -0
  21. data/lib/braintree/graphql/types/customer_recommendations_payload.rb +112 -18
  22. data/lib/braintree/graphql/types/payment_options.rb +2 -0
  23. data/lib/braintree/graphql/types/payment_recommendations.rb +35 -0
  24. data/lib/braintree/graphql/unions/customer_recommendations.rb +38 -25
  25. data/lib/braintree/merchant_account.rb +1 -25
  26. data/lib/braintree/merchant_account_gateway.rb +0 -81
  27. data/lib/braintree/meta_checkout_card.rb +8 -4
  28. data/lib/braintree/meta_checkout_token.rb +10 -6
  29. data/lib/braintree/payment_method_gateway.rb +3 -0
  30. data/lib/braintree/test/credit_card.rb +4 -0
  31. data/lib/braintree/transaction/apple_pay_details.rb +4 -0
  32. data/lib/braintree/transaction/credit_card_details.rb +8 -0
  33. data/lib/braintree/transaction/google_pay_details.rb +4 -0
  34. data/lib/braintree/transaction/meta_checkout_card_details.rb +9 -3
  35. data/lib/braintree/transaction/meta_checkout_token_details.rb +11 -5
  36. data/lib/braintree/transaction/visa_checkout_card_details.rb +8 -3
  37. data/lib/braintree/transaction.rb +0 -26
  38. data/lib/braintree/transaction_gateway.rb +9 -20
  39. data/lib/braintree/version.rb +1 -1
  40. data/lib/braintree/visa_checkout_card.rb +9 -4
  41. data/lib/braintree/webhook_notification.rb +0 -4
  42. data/lib/braintree/webhook_testing_gateway.rb +0 -33
  43. data/lib/braintree.rb +4 -3
  44. data/spec/integration/braintree/credit_card_spec.rb +101 -0
  45. data/spec/integration/braintree/credit_card_verification_spec.rb +118 -0
  46. data/spec/integration/braintree/customer_session_spec.rb +59 -49
  47. data/spec/integration/braintree/customer_spec.rb +71 -4
  48. data/spec/integration/braintree/disbursement_spec.rb +1 -1
  49. data/spec/integration/braintree/merchant_account_spec.rb +0 -342
  50. data/spec/integration/braintree/payment_method_nonce_spec.rb +44 -0
  51. data/spec/integration/braintree/payment_method_spec.rb +50 -3
  52. data/spec/integration/braintree/transaction_payment_facilitator_spec.rb +119 -0
  53. data/spec/integration/braintree/transaction_spec.rb +60 -328
  54. data/spec/spec_helper.rb +1 -1
  55. data/spec/unit/braintree/apple_pay_card_spec.rb +4 -0
  56. data/spec/unit/braintree/configuration_spec.rb +1 -1
  57. data/spec/unit/braintree/credit_card_spec.rb +22 -2
  58. data/spec/unit/braintree/credit_card_verification_gateway_spec.rb +1 -0
  59. data/spec/unit/braintree/customer_session_gateway_spec.rb +10 -9
  60. data/spec/unit/braintree/customer_spec.rb +2 -1
  61. data/spec/unit/braintree/google_pay_card_spec.rb +20 -0
  62. data/spec/unit/braintree/graphql/create_customer_session_input_spec.rb +25 -4
  63. data/spec/unit/braintree/graphql/customer_recommendations_input_spec.rb +21 -51
  64. data/spec/unit/braintree/graphql/customer_recommendations_spec.rb +40 -0
  65. data/spec/unit/braintree/graphql/update_customer_session_input_spec.rb +21 -7
  66. data/spec/unit/braintree/meta_checkout_card_spec.rb +8 -0
  67. data/spec/unit/braintree/meta_checkout_token_spec.rb +4 -0
  68. data/spec/unit/braintree/payment_method_nonce_spec.rb +9 -2
  69. data/spec/unit/braintree/payment_method_spec.rb +12 -0
  70. data/spec/unit/braintree/transaction/apple_pay_details_spec.rb +20 -0
  71. data/spec/unit/braintree/transaction/credit_card_details_spec.rb +5 -1
  72. data/spec/unit/braintree/transaction/google_pay_details_spec.rb +20 -0
  73. data/spec/unit/braintree/transaction/meta_checkout_card_details_spec.rb +20 -0
  74. data/spec/unit/braintree/transaction/meta_checkout_token_details_spec.rb +20 -0
  75. data/spec/unit/braintree/transaction/visa_checkout_card_details_spec.rb +20 -0
  76. data/spec/unit/braintree/transaction_gateway_spec.rb +19 -0
  77. data/spec/unit/braintree/transaction_spec.rb +8 -0
  78. data/spec/unit/braintree/visa_checkout_card_spec.rb +20 -0
  79. data/spec/unit/braintree/webhook_notification_spec.rb +0 -53
  80. data/spec/unit/credit_card_details_spec.rb +20 -0
  81. metadata +8 -7
  82. data/lib/braintree/merchant_account/business_details.rb +0 -17
  83. data/lib/braintree/merchant_account/funding_details.rb +0 -18
  84. data/lib/braintree/merchant_account/individual_details.rb +0 -20
  85. data/spec/unit/braintree/disbursement_spec.rb +0 -131
  86. data/spec/unit/braintree/merchant_account_spec.rb +0 -33
@@ -1,32 +1,126 @@
1
1
  # Represents the customer recommendations information associated with a PayPal customer session.
2
2
 
3
+ #Experimental
4
+ # This class is experimental and may change in future releases.
3
5
  module Braintree
4
- class CustomerRecommendationsPayload
5
- include BaseModule
6
+ class CustomerRecommendationsPayload
7
+ include BaseModule
6
8
 
7
- attr_reader :attrs
8
- attr_reader :is_in_paypal_network
9
- attr_reader :recommendations
9
+ attr_reader :attrs
10
+ attr_reader :is_in_paypal_network
11
+ attr_reader :recommendations
10
12
 
11
- def initialize(attributes)
12
- @attrs = [:is_in_paypal_network, :recommendations]
13
- @is_in_paypal_network = attributes[:isInPayPalNetwork] if attributes[:isInPayPalNetwork]
14
- @recommendations = CustomerRecommendations._new(attributes[:recommendations]) if attributes[:recommendations]
15
- end
13
+ def initialize(attributes)
14
+ @attrs = [:is_in_paypal_network, :recommendations]
16
15
 
17
- def inspect
18
- inspected_attributes = @attrs.map { |attr| "#{attr}:#{send(attr).inspect}" }
19
- "#<#{self.class} #{inspected_attributes.join(" ")}>"
16
+ if attributes.key?(:response)
17
+ response = attributes[:response]
18
+ # Constructor for response map
19
+ begin
20
+ @is_in_paypal_network = _get_value(response, "generateCustomerRecommendations.isInPayPalNetwork")
21
+ @recommendations = _extract_recommendations(response)
22
+ rescue => e
23
+ puts e.backtrace.join("\n")
24
+ raise
20
25
  end
26
+ else
27
+ @is_in_paypal_network = attributes[:is_in_paypal_network]
28
+ @recommendations = attributes[:recommendations]
29
+ end
30
+ end
21
31
 
22
- class << self
23
- protected :new
24
- end
32
+ def _extract_recommendations(response)
33
+ begin
34
+ payment_recommendations = _get_value(response, "generateCustomerRecommendations.paymentRecommendations")
35
+
36
+ payment_options_list = []
37
+ payment_recommendations_list = []
38
+
39
+ payment_recommendations.each_with_index do |recommendation, _i|
40
+ recommended_priority = _get_value(recommendation, "recommendedPriority")
41
+ payment_option_string = _get_value(recommendation, "paymentOption")
42
+
43
+ begin
44
+ payment_option = payment_option_string
45
+
46
+ payment_option_obj = Braintree::PaymentOptions._new({
47
+ paymentOption: payment_option,
48
+ recommendedPriority: recommended_priority
49
+ })
25
50
 
26
- def self._new(*args)
27
- self.new(*args)
51
+ payment_recommendation_obj = Braintree::PaymentRecommendations._new({
52
+ paymentOption: payment_option,
53
+ recommendedPriority: recommended_priority
54
+ })
55
+
56
+ payment_options_list << payment_option_obj
57
+ payment_recommendations_list << payment_recommendation_obj
58
+ rescue => e
59
+ puts e.backtrace.join("\n")
60
+ raise
61
+ end
28
62
  end
63
+
64
+ customer_recommendations = CustomerRecommendations._new({
65
+ payment_recommendations: payment_recommendations_list
66
+ })
67
+
68
+ return customer_recommendations
69
+ rescue => e
70
+ puts e.backtrace.join("\n")
71
+ raise ServerError.new("Error extracting recommendations: #{e.message}")
72
+ end
73
+ end
74
+
75
+ def _get_value(response, key)
76
+ current_map = response
77
+ key_parts = key.split(".")
78
+
79
+ # Navigate through nested dictionaries for all but last key
80
+ (0...key_parts.length - 1).each do |i|
81
+ sub_key = key_parts[i]
82
+ current_map = _pop_value(current_map, sub_key)
83
+ end
84
+
85
+ # Get the final value
86
+ last_key = key_parts[-1]
87
+ value = _pop_value(current_map, last_key)
88
+ return value
89
+ end
90
+
91
+ def _pop_value(response, key)
92
+
93
+ # Try as string first
94
+ if response.key?(key)
95
+ return response[key]
96
+ end
97
+
98
+ # Then try as symbol
99
+ symkey = key.to_sym
100
+ if response.key?(symkey)
101
+ return response[symkey]
102
+ end
103
+
104
+ # Finally try as string with string keys
105
+ if response.key?(key.to_s)
106
+ return response[key.to_s]
107
+ end
108
+
109
+ raise ServerError.new("Couldn't parse response")
110
+ end
111
+ def inspect
112
+ inspected_attributes = @attrs.map { |attr| "#{attr}:#{send(attr).inspect}" }
113
+ "#<#{self.class} #{inspected_attributes.join(" ")}>"
114
+ end
115
+
116
+ class << self
117
+ protected :new
118
+ end
119
+
120
+ def self._new(*args)
121
+ self.new(*args)
29
122
  end
123
+ end
30
124
  end
31
125
 
32
126
 
@@ -1,5 +1,7 @@
1
1
  # Represents the payment method and priority associated with a PayPal customer session.
2
2
 
3
+ #Experimental
4
+ # This class is experimental and may change in future releases.
3
5
  module Braintree
4
6
  class PaymentOptions
5
7
  include BaseModule
@@ -0,0 +1,35 @@
1
+ # Represents the payment method and priority associated with a PayPal customer session.
2
+
3
+ #Experimental
4
+ # This class is experimental and may change in future releases.
5
+ module Braintree
6
+ class PaymentRecommendations
7
+ include BaseModule
8
+
9
+ attr_reader :attrs
10
+ attr_reader :payment_option
11
+ attr_reader :recommended_priority
12
+
13
+ def initialize(attributes)
14
+ @attrs = [:payment_option, :recommended_priority]
15
+ @payment_option = attributes[:paymentOption] if attributes[:paymentOption]
16
+ @recommended_priority = attributes[:recommendedPriority] if attributes[:recommendedPriority]
17
+
18
+ end
19
+
20
+ def inspect
21
+ inspected_attributes = @attrs.map { |attr| "#{attr}:#{send(attr).inspect}" }
22
+ "#<#{self.class} #{inspected_attributes.join(" ")}>"
23
+ end
24
+
25
+ class << self
26
+ protected :new
27
+ end
28
+
29
+ def self._new(*args)
30
+ self.new(*args)
31
+ end
32
+ end
33
+ end
34
+
35
+
@@ -1,34 +1,47 @@
1
1
  # A union of all possible customer recommendations associated with a PayPal customer session.
2
2
 
3
+ #Experimental
4
+ # This class is experimental and may change in future releases.
3
5
  module Braintree
4
- class CustomerRecommendations
5
- include BaseModule
6
-
7
- attr_reader :attrs
8
- attr_reader :payment_options
9
-
10
- def initialize(attributes)
11
- @attrs = [:payment_options]
12
- if attributes.nil?
13
- @payment_options = []
14
- else
15
- @payment_options = (attributes[:paymentOptions] || []).map { |payment_options_hash| PaymentOptions._new(payment_options_hash) }
16
- end
17
- end
6
+ class CustomerRecommendations
7
+ include BaseModule
18
8
 
19
- def inspect
20
- inspected_attributes = @attrs.map { |attr| "#{attr}:#{send(attr).inspect}" }
21
- "#<#{self.class} #{inspected_attributes.join(" ")}>"
22
- end
9
+ attr_reader :payment_options, :payment_recommendations
23
10
 
24
- class << self
25
- protected :new
26
- end
11
+ def initialize(attributes = {})
12
+ @payment_recommendations = initialize_payment_recommendations(attributes[:payment_recommendations])
27
13
 
28
- def self._new(*args)
29
- self.new(*args)
30
- end
14
+ # Always derive payment_options from payment_recommendations
15
+ @payment_options = @payment_recommendations.map do |recommendation|
16
+ PaymentOptions._new(
17
+ paymentOption: recommendation.payment_option,
18
+ recommendedPriority: recommendation.recommended_priority,
19
+ )
20
+ end
21
+ end
22
+
23
+ def inspect
24
+ "#<#{self.class} payment_options: #{payment_options.inspect}, payment_recommendations: #{payment_recommendations.inspect}>"
31
25
  end
32
- end
33
26
 
27
+ private
34
28
 
29
+ def initialize_payment_recommendations(payment_recommendations)
30
+ return [] if payment_recommendations.nil?
31
+
32
+ payment_recommendations.map do |recommendation_hash|
33
+ if recommendation_hash.is_a?(PaymentRecommendations)
34
+ recommendation_hash
35
+ else
36
+ PaymentRecommendations._new(recommendation_hash)
37
+ end
38
+ end
39
+ end
40
+
41
+ class << self
42
+ def _new(attributes = {})
43
+ new(attributes)
44
+ end
45
+ end
46
+ end
47
+ end
@@ -18,44 +18,20 @@ module Braintree
18
18
  include Braintree::MerchantAccount::FundingDestination
19
19
  end
20
20
 
21
- attr_reader :business_details
22
21
  attr_reader :currency_iso_code
23
22
  attr_reader :default
24
- attr_reader :funding_details
25
23
  attr_reader :id
26
- attr_reader :individual_details
27
- attr_reader :master_merchant_account
28
24
  attr_reader :status
29
25
 
30
26
  alias_method :default?, :default
31
27
 
32
- def self.create(*args)
33
- Configuration.gateway.merchant_account.create(*args)
34
- end
35
-
36
- def self.create!(*args)
37
- Configuration.gateway.merchant_account.create!(*args)
38
- end
39
-
40
28
  def self.find(*args)
41
29
  Configuration.gateway.merchant_account.find(*args)
42
30
  end
43
31
 
44
- def self.update(*args)
45
- Configuration.gateway.merchant_account.update(*args)
46
- end
47
-
48
- def self.update!(*args)
49
- Configuration.gateway.merchant_account.update!(*args)
50
- end
51
-
52
32
  def initialize(gateway, attributes)
53
33
  @gateway = gateway
54
34
  set_instance_variables_from_hash(attributes)
55
- @individual_details = IndividualDetails.new(@individual)
56
- @business_details = BusinessDetails.new(@business)
57
- @funding_details = FundingDetails.new(@funding)
58
- @master_merchant_account = MerchantAccount._new(@gateway, attributes.delete(:master_merchant_account)) if attributes[:master_merchant_account]
59
35
  end
60
36
 
61
37
  class << self
@@ -66,7 +42,7 @@ module Braintree
66
42
  end
67
43
 
68
44
  def inspect
69
- order = [:id, :status, :master_merchant_account]
45
+ order = [:id, :status]
70
46
  nice_attributes = order.map do |attr|
71
47
  "#{attr}: #{send(attr).inspect}"
72
48
  end
@@ -20,16 +20,6 @@ module Braintree
20
20
  PaginatedResult.new(body[:total_items], body[:page_size], merchant_accounts)
21
21
  end
22
22
 
23
- def create(attributes)
24
- signature = MerchantAccountGateway._detect_signature(attributes)
25
- Util.verify_keys(signature, attributes)
26
- _do_create "/merchant_accounts/create_via_api", :merchant_account => attributes
27
- end
28
-
29
- def create!(*args)
30
- return_object_or_raise(:merchant_account) { create(*args) }
31
- end
32
-
33
23
  def find(merchant_account_id)
34
24
  raise ArgumentError if merchant_account_id.nil? || merchant_account_id.to_s.strip == ""
35
25
  response = @config.http.get("#{@config.base_merchant_path}/merchant_accounts/#{merchant_account_id}")
@@ -38,37 +28,10 @@ module Braintree
38
28
  raise NotFoundError, "Merchant account with id #{merchant_account_id} not found"
39
29
  end
40
30
 
41
- def update(merchant_account_id, attributes)
42
- Util.verify_keys(MerchantAccountGateway._update_signature, attributes)
43
- _do_update "/merchant_accounts/#{merchant_account_id}/update_via_api", :merchant_account => attributes
44
- end
45
-
46
- def update!(*args)
47
- return_object_or_raise(:merchant_account) { update(*args) }
48
- end
49
-
50
31
  def create_for_currency(params)
51
32
  _create_for_currency(params)
52
33
  end
53
34
 
54
- def _do_create(path, params=nil)
55
- response = @config.http.post("#{@config.base_merchant_path}#{path}", params)
56
- if response[:api_error_response]
57
- ErrorResult.new(@gateway, response[:api_error_response])
58
- else
59
- SuccessfulResult.new(:merchant_account => MerchantAccount._new(@gateway, response[:merchant_account]))
60
- end
61
- end
62
-
63
- def _do_update(path, params=nil)
64
- response = @config.http.put("#{@config.base_merchant_path}#{path}", params)
65
- if response[:api_error_response]
66
- ErrorResult.new(@gateway, response[:api_error_response])
67
- else
68
- SuccessfulResult.new(:merchant_account => MerchantAccount._new(@gateway, response[:merchant_account]))
69
- end
70
- end
71
-
72
35
  def _create_for_currency(params)
73
36
  response = @config.http.post("#{@config.base_merchant_path}/merchant_accounts/create_for_currency", :merchant_account => params)
74
37
 
@@ -82,49 +45,5 @@ module Braintree
82
45
  raise UnexpectedError, "expected :merchant or :api_error_response"
83
46
  end
84
47
  end
85
-
86
- # NEXT_MAJOR_VERSION this is part of Marketplace and shouldn't be removed unless we're removing all Marketplace code
87
- def self._detect_signature(attributes)
88
- if attributes.has_key?(:applicant_details)
89
- warn "[DEPRECATED] Passing :applicant_details to create is deprecated. Please use :individual, :business, and :funding."
90
- MerchantAccountGateway._deprecated_create_signature
91
- else
92
- MerchantAccountGateway._create_signature
93
- end
94
- end
95
-
96
- # NEXT_MAJOR_VERSION this is part of Marketplace and shouldn't be removed unless we're removing all Marketplace code
97
- def self._deprecated_create_signature
98
- [
99
- {:applicant_details => [
100
- :first_name, :last_name, :email, :date_of_birth, :ssn, :routing_number,
101
- :account_number, :tax_id, :company_name, :phone,
102
- {:address => [:street_address, :postal_code, :locality, :region]}]
103
- },
104
- :tos_accepted, :master_merchant_account_id, :id
105
- ]
106
- end
107
-
108
- def self._signature
109
- [
110
- {:individual => [
111
- :first_name, :last_name, :email, :date_of_birth, :ssn, :phone,
112
- {:address => [:street_address, :locality, :region, :postal_code]}]
113
- },
114
- {:business => [
115
- :dba_name, :legal_name, :tax_id,
116
- {:address => [:street_address, :locality, :region, :postal_code]}]
117
- },
118
- {:funding => [:destination, :email, :mobile_phone, :routing_number, :account_number, :descriptor]}
119
- ]
120
- end
121
-
122
- def self._create_signature
123
- _signature + [:tos_accepted, :master_merchant_account_id, :id]
124
- end
125
-
126
- def self._update_signature
127
- _signature
128
- end
129
48
  end
130
49
  end
@@ -4,10 +4,13 @@ module Braintree
4
4
  include Braintree::Util::TokenEquality
5
5
 
6
6
  attr_reader :bin
7
- attr_reader :container_id
7
+ attr_reader :business
8
8
  attr_reader :card_type
9
9
  attr_reader :cardholder_name
10
10
  attr_reader :commercial
11
+ attr_reader :consumer
12
+ attr_reader :container_id
13
+ attr_reader :corporate
11
14
  attr_reader :country_of_issuance
12
15
  attr_reader :created_at
13
16
  attr_reader :customer_id
@@ -24,6 +27,7 @@ module Braintree
24
27
  attr_reader :prepaid
25
28
  attr_reader :prepaid_reloadable
26
29
  attr_reader :product_id
30
+ attr_reader :purchase
27
31
  attr_reader :subscriptions
28
32
  attr_reader :token
29
33
  attr_reader :unique_number_identifier
@@ -75,11 +79,11 @@ module Braintree
75
79
 
76
80
  def self._attributes # :nodoc:
77
81
  [
78
- :bin, :card_type, :cardholder_name, :commercial,
79
- :container_id, :country_of_issuance, :created_at, :customer_id,
82
+ :bin, :business, :card_type, :cardholder_name, :commercial,
83
+ :consumer, :container_id, :corporate, :country_of_issuance, :created_at, :customer_id,
80
84
  :customer_location, :debit, :durbin_regulated, :expiration_month,
81
85
  :expiration_year, :healthcare, :image_url, :issuing_bank, :last_4, :payroll, :prepaid,
82
- :prepaid_reloadable, :product_id, :token, :updated_at
86
+ :prepaid_reloadable, :product_id, :purchase, :token, :updated_at
83
87
  ]
84
88
  end
85
89
 
@@ -4,10 +4,13 @@ module Braintree
4
4
  include Braintree::Util::TokenEquality
5
5
 
6
6
  attr_reader :bin
7
- attr_reader :container_id
7
+ attr_reader :business
8
8
  attr_reader :card_type
9
9
  attr_reader :cardholder_name
10
10
  attr_reader :commercial
11
+ attr_reader :consumer
12
+ attr_reader :container_id
13
+ attr_reader :corporate
11
14
  attr_reader :country_of_issuance
12
15
  attr_reader :created_at
13
16
  attr_reader :cryptogram
@@ -26,6 +29,7 @@ module Braintree
26
29
  attr_reader :prepaid
27
30
  attr_reader :prepaid_reloadable
28
31
  attr_reader :product_id
32
+ attr_reader :purchase
29
33
  attr_reader :token
30
34
  attr_reader :unique_number_identifier
31
35
  attr_reader :updated_at
@@ -74,11 +78,11 @@ module Braintree
74
78
 
75
79
  def self._attributes # :nodoc:
76
80
  [
77
- :bin, :card_type, :cardholder_name, :commercial, :container_id, :country_of_issuance,
78
- :created_at, :cryptogram, :customer_id, :customer_location, :debit, :durbin_regulated,
79
- :ecommerce_indicator, :expiration_month, :expiration_year, :healthcare, :image_url,
80
- :issuing_bank, :last_4, :payroll, :prepaid, :prepaid_reloadable, :product_id, :token,
81
- :updated_at
81
+ :bin, :business, :card_type, :cardholder_name, :commercial, :consumer, :container_id,
82
+ :corporate, :country_of_issuance, :created_at, :cryptogram, :customer_id, :customer_location,
83
+ :debit, :durbin_regulated, :ecommerce_indicator, :expiration_month, :expiration_year,
84
+ :healthcare, :image_url, :issuing_bank, :last_4, :payroll, :prepaid, :prepaid_reloadable,
85
+ :product_id, :purchase, :token, :updated_at
82
86
  ]
83
87
  end
84
88
 
@@ -160,6 +160,7 @@ module Braintree
160
160
  # NEXT_MAJOR_VERSION Remove venmo_sdk_session
161
161
  # The old venmo SDK class has been deprecated
162
162
  options = [
163
+ :account_information_inquiry,
163
164
  :make_default,
164
165
  :skip_advanced_fraud_checking,
165
166
  :us_bank_account_verification_method,
@@ -205,11 +206,13 @@ module Braintree
205
206
  when :create
206
207
  options << :fail_on_duplicate_payment_method
207
208
  options << :fail_on_duplicate_payment_method_for_customer
209
+ options << :accountInformationInquiry
208
210
  signature << :customer_id
209
211
  signature << :paypal_refresh_token
210
212
  when :update
211
213
  options << :fail_on_duplicate_payment_method
212
214
  options << :fail_on_duplicate_payment_method_for_customer
215
+ options << :accountInformationInquiry
213
216
  billing_address_params << {:options => [:update_existing]}
214
217
  else
215
218
  raise ArgumentError
@@ -4,8 +4,12 @@ module Braintree
4
4
  module CardTypeIndicators
5
5
  Prepaid = "4111111111111210"
6
6
  PrepaidReloadable = "4229989900000002"
7
+ Business = "4229989800000003"
7
8
  Commercial = "4111111111131010"
9
+ Consumer = "4229989700000004"
10
+ Corporate = "4229989100000000"
8
11
  Payroll = "4111111114101010"
12
+ Purchase = "4229989500000006"
9
13
  Healthcare = "4111111510101010"
10
14
  DurbinRegulated = "4111161010101010"
11
15
  Debit = "4117101010101010"
@@ -4,9 +4,12 @@ module Braintree
4
4
  include BaseModule
5
5
 
6
6
  attr_reader :bin
7
+ attr_reader :business
7
8
  attr_reader :card_type
8
9
  attr_reader :cardholder_name
9
10
  attr_reader :commercial
11
+ attr_reader :consumer
12
+ attr_reader :corporate
10
13
  attr_reader :country_of_issuance
11
14
  attr_reader :debit
12
15
  attr_reader :durbin_regulated
@@ -23,6 +26,7 @@ module Braintree
23
26
  attr_reader :prepaid
24
27
  attr_reader :prepaid_reloadable
25
28
  attr_reader :product_id
29
+ attr_reader :purchase
26
30
  attr_reader :source_card_last4
27
31
  attr_reader :source_description
28
32
  attr_reader :token
@@ -5,9 +5,12 @@ module Braintree
5
5
 
6
6
  attr_reader :account_type
7
7
  attr_reader :bin
8
+ attr_reader :business
8
9
  attr_reader :card_type
9
10
  attr_reader :cardholder_name
10
11
  attr_reader :commercial
12
+ attr_reader :consumer
13
+ attr_reader :corporate
11
14
  attr_reader :country_of_issuance
12
15
  attr_reader :customer_location
13
16
  attr_reader :debit
@@ -22,6 +25,7 @@ module Braintree
22
25
  attr_reader :prepaid
23
26
  attr_reader :prepaid_reloadable
24
27
  attr_reader :product_id
28
+ attr_reader :purchase
25
29
  attr_reader :token
26
30
  attr_reader :unique_number_identifier
27
31
 
@@ -36,9 +40,12 @@ module Braintree
36
40
  def inspect
37
41
  attr_order = [
38
42
  :bin,
43
+ :business,
39
44
  :card_type,
40
45
  :cardholder_name,
41
46
  :commercial,
47
+ :consumer,
48
+ :corporate,
42
49
  :country_of_issuance,
43
50
  :customer_location,
44
51
  :debit,
@@ -52,6 +59,7 @@ module Braintree
52
59
  :prepaid,
53
60
  :prepaid_reloadable,
54
61
  :product_id,
62
+ :purchase,
55
63
  :token,
56
64
  :unique_number_identifier,
57
65
  ]
@@ -4,8 +4,11 @@ module Braintree
4
4
  include BaseModule
5
5
 
6
6
  attr_reader :bin
7
+ attr_reader :business
7
8
  attr_reader :card_type
8
9
  attr_reader :commercial
10
+ attr_reader :consumer
11
+ attr_reader :corporate
9
12
  attr_reader :country_of_issuance
10
13
  attr_reader :debit
11
14
  attr_reader :durbin_regulated
@@ -21,6 +24,7 @@ module Braintree
21
24
  attr_reader :prepaid
22
25
  attr_reader :prepaid_reloadable
23
26
  attr_reader :product_id
27
+ attr_reader :purchase
24
28
  attr_reader :source_card_last_4
25
29
  attr_reader :source_card_type
26
30
  attr_reader :source_description
@@ -4,10 +4,13 @@ module Braintree
4
4
  include BaseModule
5
5
 
6
6
  attr_reader :bin
7
+ attr_reader :business
7
8
  attr_reader :card_type
8
9
  attr_reader :cardholder_name
9
10
  attr_reader :commercial
11
+ attr_reader :consumer
10
12
  attr_reader :container_id
13
+ attr_reader :corporate
11
14
  attr_reader :country_of_issuance
12
15
  attr_reader :created_at
13
16
  attr_reader :customer_location
@@ -24,6 +27,7 @@ module Braintree
24
27
  attr_reader :prepaid
25
28
  attr_reader :prepaid_reloadable
26
29
  attr_reader :product_id
30
+ attr_reader :purchase
27
31
  attr_reader :token
28
32
  attr_reader :unique_number_identifier
29
33
  attr_reader :updated_at
@@ -38,9 +42,11 @@ module Braintree
38
42
 
39
43
  def inspect
40
44
  attr_order = [
41
- :bin, :card_type, :cardholder_name, :commercial, :container_id, :country_of_issuance,
42
- :customer_location, :debit, :durbin_regulated, :expiration_date, :healthcare, :image_url,
43
- :issuing_bank, :last_4, :payroll, :prepaid, :prepaid_reloadable, :product_id, :token]
45
+ :bin, :business, :card_type, :cardholder_name, :commercial, :consumer, :container_id,
46
+ :corporate, :country_of_issuance, :customer_location, :debit, :durbin_regulated,
47
+ :expiration_date, :healthcare, :image_url, :issuing_bank, :last_4, :payroll,
48
+ :prepaid, :prepaid_reloadable, :product_id, :purchase, :token
49
+ ]
44
50
  formatted_attrs = attr_order.map do |attr|
45
51
  "#{attr}: #{send(attr).inspect}"
46
52
  end