braintree 4.23.0 → 4.25.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. checksums.yaml +4 -4
  2. data/lib/braintree/customer_session_gateway.rb +194 -0
  3. data/lib/braintree/error_result.rb +1 -1
  4. data/lib/braintree/errors.rb +2 -1
  5. data/lib/braintree/gateway.rb +4 -0
  6. data/lib/braintree/graphql/enums/recommendations.rb +7 -0
  7. data/lib/braintree/graphql/enums/recommended_payment_option.rb +8 -0
  8. data/lib/braintree/graphql/inputs/create_customer_session_input.rb +35 -0
  9. data/lib/braintree/graphql/inputs/customer_recommendations_input.rb +41 -0
  10. data/lib/braintree/graphql/inputs/customer_session_input.rb +39 -0
  11. data/lib/braintree/graphql/inputs/phone_input.rb +32 -0
  12. data/lib/braintree/graphql/inputs/update_customer_session_input.rb +37 -0
  13. data/lib/braintree/graphql/types/customer_recommendations_payload.rb +32 -0
  14. data/lib/braintree/graphql/types/payment_options.rb +33 -0
  15. data/lib/braintree/graphql/unions/customer_recommendations.rb +34 -0
  16. data/lib/braintree/graphql_client.rb +16 -0
  17. data/lib/braintree/successful_result.rb +2 -0
  18. data/lib/braintree/transaction/paypal_details.rb +2 -0
  19. data/lib/braintree/transaction_gateway.rb +10 -10
  20. data/lib/braintree/version.rb +1 -1
  21. data/lib/braintree.rb +11 -0
  22. data/spec/integration/braintree/advanced_search_spec.rb +7 -4
  23. data/spec/integration/braintree/credit_card_spec.rb +2 -1
  24. data/spec/integration/braintree/customer_session_spec.rb +143 -0
  25. data/spec/integration/braintree/customer_spec.rb +2 -1
  26. data/spec/integration/braintree/transaction_search_spec.rb +9 -6
  27. data/spec/integration/braintree/transaction_spec.rb +38 -0
  28. data/spec/unit/braintree/customer_session_gateway_spec.rb +120 -0
  29. data/spec/unit/braintree/graphql/create_customer_session_input_spec.rb +81 -0
  30. data/spec/unit/braintree/graphql/customer_recommendations_input_spec.rb +110 -0
  31. data/spec/unit/braintree/graphql/customer_session_input_spec.rb +81 -0
  32. data/spec/unit/braintree/graphql/phone_input_spec.rb +51 -0
  33. data/spec/unit/braintree/graphql/update_customer_session_input_spec.rb +93 -0
  34. data/spec/unit/braintree/graphql_client_spec.rb +37 -0
  35. data/spec/unit/braintree/transaction/paypal_details_spec.rb +5 -0
  36. data/spec/unit/braintree/transaction_gateway_spec.rb +10 -10
  37. metadata +21 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 80f9d00b4dec8e85066f61cecaf04c5863399c8c6552d5158d0fe69f8b81a64f
4
- data.tar.gz: 4664e8431f59bf1293d6cafbaf3623b6fe2069aa81af17520384b5e85c34a0a5
3
+ metadata.gz: a53b0f33066dc60083b87ba8eb176eecef8e765c87d4b0073f09d74ce584aeaf
4
+ data.tar.gz: '09b4b509edaa9c5a8d20a52ee735eca5067a28c05fd01401a1a08034b84d6d49'
5
5
  SHA512:
6
- metadata.gz: 73131e462a1c99744d967f82cecdda88dc2780e04c3bb69f51cd7149fc8e747d7e487e31cc5e5e3fe7f4440d6da3ef42a90ee7e027c7fa0f567ad2b84a6119dd
7
- data.tar.gz: a17216eb8f219f33af17d79accae60eccc23e059753ac159aed34063ec7f8abb0566c6268097647bb1a657fabf507d4f9d1d90c39e3c73b0e66f9d4c1a29c8bc
6
+ metadata.gz: ae0bc77b138805d06321f200d61376328173630dc730f0fecd91483b70fd35f7817632323923a8bcf95c76c99b095825f472101f2bc3a657ad7d6c8d278ec5a2
7
+ data.tar.gz: 8d28568a72404894d70b00546f2dd391520253cbe1729d852bbea67ebfbf8d65857389a42783b8f9923dee8add8677e38879421c5a9262f5d7a50076f04e2887
@@ -0,0 +1,194 @@
1
+ # Creates and manages PayPal customer sessions.
2
+
3
+ module Braintree
4
+ class CustomerSessionGateway
5
+ CREATE_CUSTOMER_SESSION = <<~GRAPHQL
6
+ mutation CreateCustomerSession($input: CreateCustomerSessionInput!) {
7
+ createCustomerSession(input: $input) {
8
+ sessionId
9
+ }
10
+ }
11
+ GRAPHQL
12
+
13
+ UPDATE_CUSTOMER_SESSION = <<~GRAPHQL
14
+ mutation UpdateCustomerSession($input: UpdateCustomerSessionInput!) {
15
+ updateCustomerSession(input: $input) {
16
+ sessionId
17
+ }
18
+ }
19
+ GRAPHQL
20
+
21
+ GET_CUSTOMER_RECOMMENDATIONS = <<~GRAPHQL
22
+ query CustomerRecommendations($input: CustomerRecommendationsInput!) {
23
+ customerRecommendations(input: $input) {
24
+ isInPayPalNetwork
25
+ recommendations {
26
+ ... on PaymentRecommendations {
27
+ paymentOptions {
28
+ paymentOption
29
+ recommendedPriority
30
+ }
31
+ }
32
+ }
33
+ }
34
+ }
35
+ GRAPHQL
36
+
37
+ def initialize(gateway, graphql_client)
38
+ @gateway = gateway
39
+ @graphql_client = graphql_client
40
+ end
41
+
42
+ # Creates a new customer session.
43
+ #
44
+ # Example:
45
+ # customer = {
46
+ # email: "test@example.com",
47
+ # device_fingerprint_id: "1234",
48
+ # phone: {country_phone_code: "1", phone_number: "5555555555"},
49
+ # paypal_app_installed: true,
50
+ # venmo_app_installed: true,
51
+ # }
52
+ # input = Braintree::CreateCustomerSessionInput.new(
53
+ # customer: customer,
54
+ # )
55
+ # result = gateway.customer_session.create_customer_session(input)
56
+ # if result.success?
57
+ # puts "Created session #{result.session_id}"
58
+ # else
59
+ # puts "Validations failed"
60
+ # puts result.errors.first.message
61
+ # end
62
+ #
63
+ # @param input [CreateCustomerSessionInput] The input parameters for creating a customer session.
64
+ #
65
+ # @return [(Successful|Error)Result] A result object with session ID if successful, or errors otherwise.
66
+ #
67
+ # @raise [UnexpectedError] If there is an unexpected error during the process.
68
+ def create_customer_session(input)
69
+ execute_mutation(CREATE_CUSTOMER_SESSION, input, :createCustomerSession)
70
+ end
71
+
72
+
73
+ # Updates an existing customer session.
74
+ #
75
+ # Example:
76
+ # customer = {
77
+ # email: "test@example.com",
78
+ # device_fingerprint_id: "1234",
79
+ # phone: {country_phone_code: "1", phone_number: "5555555555"},
80
+ # paypal_app_installed: true,
81
+ # venmo_app_installed: true,
82
+ # }
83
+ # input = Braintree::UpdateCustomerSessionInput.new(
84
+ # session_id: "11EF-34BC-2702904B-9026-555555555555",
85
+ # customer: customer,
86
+ # )
87
+ # result = gateway.customer_session.updated_customer_session(input)
88
+ # if result.success?
89
+ # puts "Updated session #{result.session_id}"
90
+ # else
91
+ # puts "Validations failed"
92
+ # puts result.errors.first.message
93
+ # end
94
+ #
95
+ # @param input [UpdateCustomerSessionInput] The input parameters for updating a customer session.
96
+ #
97
+ # @return [(Successful|Error)Result] A result object with session ID if successful, or errors otherwise.
98
+ #
99
+ # @raise [UnexpectedError] If there is an unexpected error during the process.
100
+ def update_customer_session(input)
101
+ execute_mutation(UPDATE_CUSTOMER_SESSION, input, :updateCustomerSession)
102
+ end
103
+
104
+ # Retrieves customer recommendations associated with a customer session.
105
+ #
106
+ # Example:
107
+ # customer = {
108
+ # email: "test@example.com",
109
+ # device_fingerprint_id: "1234",
110
+ # phone: {country_phone_code: "1", phone_number: "5555555555"},
111
+ # paypal_app_installed: true,
112
+ # venmo_app_installed: true,
113
+ # }
114
+ # input = Braintree::CustomerRecommendationsInput.new(
115
+ # session_id: "11EF-34BC-2702904B-9026-555555555555",
116
+ # customer: customer,
117
+ # recommendations: [Braintree::Recommendations::PAYMENT_RECOMMENDATIONS]
118
+ # )
119
+ # result = gateway.customer_session.get_customer_recommendations(input)
120
+ # if result.success?
121
+ # puts "Fetched customer recommendations"
122
+ # payload = result.customer_recommendations
123
+ # puts payload
124
+ # else
125
+ # puts "Validations failed"
126
+ # puts result.errors.first.message
127
+ # end
128
+ #
129
+ # @param input [CustomerRecommendationsInput] The input parameters for retrieving customer recommendations.
130
+ #
131
+ # @return [Result\Error|Result\Successful] A result object containing the customer recommendations if successful, or errors otherwise.
132
+ #
133
+ # @raise [UnexpectedError] If there is an unexpected error during the process.
134
+ def get_customer_recommendations(customer_recommendations_input)
135
+ variables = {"input" => customer_recommendations_input.to_graphql_variables}
136
+
137
+ begin
138
+ response = @graphql_client.query(GET_CUSTOMER_RECOMMENDATIONS, variables)
139
+ errors = GraphQLClient.get_validation_errors(response)
140
+ if errors
141
+ ErrorResult.new(@gateway, {errors:errors})
142
+ else
143
+ SuccessfulResult.new(:customer_recommendations => extract_customer_recommendations_payload(response))
144
+ end
145
+ rescue StandardError => e
146
+ raise UnexpectedError, e.message
147
+ end
148
+ end
149
+
150
+ private
151
+
152
+ def execute_mutation(query, input, operation_name)
153
+ variables = {"input" => input.to_graphql_variables}
154
+ begin
155
+ response = @graphql_client.query(query, variables)
156
+ errors = GraphQLClient.get_validation_errors(response)
157
+ if errors
158
+ ErrorResult.new(@gateway, {errors:errors})
159
+ else
160
+ session_id = get_value(response, "data.#{operation_name}.sessionId")
161
+ SuccessfulResult.new(:session_id => session_id)
162
+ end
163
+ rescue StandardError => e
164
+ raise UnexpectedError, e.message
165
+ end
166
+ end
167
+
168
+ def get_value(response, key)
169
+ map = response
170
+ key_parts = key.split(".")
171
+
172
+ key_parts[0..-2].each do |sub_key|
173
+ map = pop_value(map, sub_key)
174
+ raise UnexpectedError, "Couldn't parse response" unless map.is_a?(Hash)
175
+ end
176
+
177
+ pop_value(map, key_parts.last)
178
+ end
179
+
180
+ def pop_value(map, key)
181
+ key = key.to_sym
182
+ if map.key?(key)
183
+ map[key]
184
+ else
185
+ raise UnexpectedError, "Couldn't parse response"
186
+ end
187
+ end
188
+
189
+ def extract_customer_recommendations_payload(data)
190
+ customer_recommendations_hash = get_value(data, "data.customerRecommendations")
191
+ Braintree::CustomerRecommendationsPayload._new(customer_recommendations_hash)
192
+ end
193
+ end
194
+ end
@@ -12,7 +12,7 @@ module Braintree
12
12
 
13
13
  def initialize(gateway, data)
14
14
  @gateway = gateway
15
- @params = data[:params]
15
+ @params = data[:params] if data[:params]
16
16
  @credit_card_verification = CreditCardVerification._new(data[:verification]) if data[:verification]
17
17
  @merchant_account = MerchantAccount._new(gateway, data[:merchant_account]) if data[:merchant_account]
18
18
  @message = data[:message]
@@ -3,7 +3,8 @@ module Braintree
3
3
  include Enumerable
4
4
 
5
5
  def initialize(data = {})
6
- @errors = ValidationErrorCollection.new(data.merge(:errors => []))
6
+ data = data.merge(:errors => []) unless data
7
+ @errors = ValidationErrorCollection.new(data)
7
8
  end
8
9
 
9
10
  def each(&block)
@@ -38,6 +38,10 @@ module Braintree
38
38
  CustomerGateway.new(self)
39
39
  end
40
40
 
41
+ def customer_session
42
+ CustomerSessionGateway.new(self, graphql_client)
43
+ end
44
+
41
45
  def discount
42
46
  DiscountGateway.new(self)
43
47
  end
@@ -0,0 +1,7 @@
1
+ # Represents available types of customer recommendations that can be retrieved using a PayPal customer session.
2
+
3
+ module Braintree
4
+ module Recommendations
5
+ PAYMENT_RECOMMENDATIONS = "PAYMENT_RECOMMENDATIONS"
6
+ end
7
+ end
@@ -0,0 +1,8 @@
1
+ # Represents available payment options related to PayPal customer session recommendations.
2
+
3
+ module Braintree
4
+ module RecommendedPaymentOption
5
+ PAYPAL = "PAYPAL"
6
+ VENMO = "VENMO"
7
+ end
8
+ end
@@ -0,0 +1,35 @@
1
+ # Represents the input to request the creation of a PayPal customer session.
2
+
3
+ module Braintree
4
+ class CreateCustomerSessionInput
5
+ include BaseModule
6
+
7
+ attr_reader :attrs
8
+ attr_reader :merchant_account_id
9
+ attr_reader :session_id
10
+ attr_reader :customer
11
+ attr_reader :domain
12
+
13
+ def initialize(attributes)
14
+ @attrs = attributes.keys
15
+ set_instance_variables_from_hash(attributes)
16
+ @customer = attributes[:customer] ? CustomerSessionInput.new(attributes[:customer]) : nil
17
+ end
18
+
19
+ def inspect
20
+ inspected_attributes = @attrs.map { |attr| "#{attr}:#{send(attr).inspect}" }
21
+ "#<#{self.class} #{inspected_attributes.join(" ")}>"
22
+ end
23
+
24
+ def to_graphql_variables
25
+ variables = {}
26
+ variables["merchantAccountId"] = merchant_account_id if merchant_account_id
27
+ variables["sessionId"] = session_id if session_id
28
+ variables["domain"] = domain if domain
29
+ variables["customer"] = customer.to_graphql_variables if customer
30
+ variables
31
+ end
32
+ end
33
+ end
34
+
35
+
@@ -0,0 +1,41 @@
1
+ # Represents the input to request PayPal customer session recommendations.
2
+
3
+ module Braintree
4
+ class CustomerRecommendationsInput
5
+ include BaseModule
6
+
7
+ attr_reader :attrs
8
+ attr_reader :merchant_account_id
9
+ attr_reader :session_id
10
+ attr_reader :recommendations
11
+ attr_reader :customer
12
+
13
+ def initialize(attributes)
14
+ unless attributes[:session_id]
15
+ raise ArgumentError, "Expected hash to contain a :session_id"
16
+ end
17
+ unless attributes[:recommendations]
18
+ raise ArgumentError, "Expected hash to contain a :recommendations"
19
+ end
20
+ @attrs = attributes.keys
21
+ set_instance_variables_from_hash(attributes)
22
+ @customer = attributes[:customer] ? CustomerSessionInput.new(attributes[:customer]) : nil
23
+ end
24
+
25
+ def inspect
26
+ inspected_attributes = @attrs.map { |attr| "#{attr}:#{send(attr).inspect}" }
27
+ "#<#{self.class} #{inspected_attributes.join(" ")}>"
28
+ end
29
+
30
+ def to_graphql_variables
31
+ variables = {}
32
+ variables["merchantAccountId"] = merchant_account_id if merchant_account_id
33
+ variables["sessionId"] = session_id if session_id
34
+ variables["recommendations"] = recommendations if recommendations
35
+ variables["customer"] = customer.to_graphql_variables if customer
36
+ variables
37
+ end
38
+ end
39
+ end
40
+
41
+
@@ -0,0 +1,39 @@
1
+ # Customer identifying information for a PayPal customer session.
2
+
3
+ module Braintree
4
+ class CustomerSessionInput
5
+ include BaseModule
6
+
7
+ attr_reader :attrs
8
+ attr_reader :email
9
+ attr_reader :phone
10
+ attr_reader :device_fingerprint_id
11
+ attr_reader :paypal_app_installed
12
+ attr_reader :venmo_app_installed
13
+ attr_reader :user_agent
14
+
15
+ def initialize(attributes)
16
+ @attrs = attributes.keys
17
+ set_instance_variables_from_hash(attributes)
18
+ @phone = attributes[:phone] ? PhoneInput.new(attributes[:phone]) : nil
19
+ end
20
+
21
+ def inspect
22
+ inspected_attributes = @attrs.map { |attr| "#{attr}:#{send(attr).inspect}" }
23
+ "#<#{self.class} #{inspected_attributes.join(" ")}>"
24
+ end
25
+
26
+ def to_graphql_variables
27
+ variables = {}
28
+ variables["email"] = email if email
29
+ variables["phone"] = phone.to_graphql_variables if phone
30
+ variables["deviceFingerprintId"] = device_fingerprint_id if device_fingerprint_id
31
+ variables["paypalAppInstalled"] = paypal_app_installed if paypal_app_installed
32
+ variables["venmoAppInstalled"] = venmo_app_installed if venmo_app_installed
33
+ variables["userAgent"] = user_agent if user_agent
34
+ variables
35
+ end
36
+ end
37
+ end
38
+
39
+
@@ -0,0 +1,32 @@
1
+ # Phone number input for PayPal customer session.
2
+
3
+ module Braintree
4
+ class PhoneInput
5
+ include BaseModule
6
+
7
+ attr_reader :attrs
8
+ attr_reader :country_phone_code
9
+ attr_reader :phone_number
10
+ attr_reader :extension_number
11
+
12
+ def initialize(attributes)
13
+ @attrs = attributes.keys
14
+ set_instance_variables_from_hash(attributes)
15
+ end
16
+
17
+ def inspect
18
+ inspected_attributes = @attrs.map { |attr| "#{attr}:#{send(attr).inspect}" }
19
+ "#<#{self.class} #{inspected_attributes.join(" ")}>"
20
+ end
21
+
22
+ def to_graphql_variables
23
+ variables = {}
24
+ variables["countryPhoneCode"] = country_phone_code if country_phone_code
25
+ variables["phoneNumber"] = phone_number if phone_number
26
+ variables["extensionNumber"] = extension_number if extension_number
27
+ variables
28
+ end
29
+ end
30
+ end
31
+
32
+
@@ -0,0 +1,37 @@
1
+ # Represents the input to request an update to a PayPal customer session.
2
+
3
+ module Braintree
4
+ class UpdateCustomerSessionInput
5
+ include BaseModule
6
+
7
+ attr_reader :attrs
8
+ attr_reader :merchant_account_id
9
+ attr_reader :session_id
10
+ attr_reader :customer
11
+
12
+ def initialize(attributes)
13
+ unless attributes[:session_id]
14
+ raise ArgumentError, "Expected hash to contain a :session_id"
15
+ end
16
+ @attrs = attributes.keys
17
+ set_instance_variables_from_hash(attributes)
18
+ @customer = attributes[:customer] ? CustomerSessionInput.new(attributes[:customer]) : nil
19
+ end
20
+
21
+ def inspect
22
+ inspected_attributes = @attrs.map { |attr| "#{attr}:#{send(attr).inspect}" }
23
+ "#<#{self.class} #{inspected_attributes.join(" ")}>"
24
+ end
25
+
26
+ def to_graphql_variables
27
+ variables = {}
28
+ variables["merchantAccountId"] = merchant_account_id if merchant_account_id
29
+ variables["sessionId"] = session_id if session_id
30
+ variables["customer"] = customer.to_graphql_variables if customer
31
+ variables
32
+ end
33
+
34
+ end
35
+ end
36
+
37
+
@@ -0,0 +1,32 @@
1
+ # Represents the customer recommendations information associated with a PayPal customer session.
2
+
3
+ module Braintree
4
+ class CustomerRecommendationsPayload
5
+ include BaseModule
6
+
7
+ attr_reader :attrs
8
+ attr_reader :is_in_paypal_network
9
+ attr_reader :recommendations
10
+
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
16
+
17
+ def inspect
18
+ inspected_attributes = @attrs.map { |attr| "#{attr}:#{send(attr).inspect}" }
19
+ "#<#{self.class} #{inspected_attributes.join(" ")}>"
20
+ end
21
+
22
+ class << self
23
+ protected :new
24
+ end
25
+
26
+ def self._new(*args)
27
+ self.new(*args)
28
+ end
29
+ end
30
+ end
31
+
32
+
@@ -0,0 +1,33 @@
1
+ # Represents the payment method and priority associated with a PayPal customer session.
2
+
3
+ module Braintree
4
+ class PaymentOptions
5
+ include BaseModule
6
+
7
+ attr_reader :attrs
8
+ attr_reader :payment_option
9
+ attr_reader :recommended_priority
10
+
11
+ def initialize(attributes)
12
+ @attrs = [:payment_option, :recommended_priority]
13
+ @payment_option = attributes[:paymentOption] if attributes[:paymentOption]
14
+ @recommended_priority = attributes[:recommendedPriority] if attributes[:recommendedPriority]
15
+
16
+ end
17
+
18
+ def inspect
19
+ inspected_attributes = @attrs.map { |attr| "#{attr}:#{send(attr).inspect}" }
20
+ "#<#{self.class} #{inspected_attributes.join(" ")}>"
21
+ end
22
+
23
+ class << self
24
+ protected :new
25
+ end
26
+
27
+ def self._new(*args)
28
+ self.new(*args)
29
+ end
30
+ end
31
+ end
32
+
33
+
@@ -0,0 +1,34 @@
1
+ # A union of all possible customer recommendations associated with a PayPal customer session.
2
+
3
+ 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
18
+
19
+ def inspect
20
+ inspected_attributes = @attrs.map { |attr| "#{attr}:#{send(attr).inspect}" }
21
+ "#<#{self.class} #{inspected_attributes.join(" ")}>"
22
+ end
23
+
24
+ class << self
25
+ protected :new
26
+ end
27
+
28
+ def self._new(*args)
29
+ self.new(*args)
30
+ end
31
+ end
32
+ end
33
+
34
+
@@ -30,5 +30,21 @@ module Braintree
30
30
  body = Zlib::GzipReader.new(StringIO.new(body)).read if response.header["Content-Encoding"] == "gzip"
31
31
  JSON.parse(body, :symbolize_names => true)
32
32
  end
33
+
34
+ def self.get_validation_errors(response)
35
+ return nil unless response.key?(:errors) && response[:errors].is_a?(Array)
36
+ validation_errors = response[:errors].map do |error|
37
+ {
38
+ :attribute => "",
39
+ :code => get_validation_error_code(error),
40
+ :message => error[:message]
41
+ }
42
+ end
43
+ {errors: validation_errors}
44
+ end
45
+
46
+ def self.get_validation_error_code(error)
47
+ error[:extensions] && error[:extensions][:legacyCode] rescue nil
48
+ end
33
49
  end
34
50
  end
@@ -24,6 +24,8 @@ module Braintree
24
24
  attr_reader :supported_networks
25
25
  attr_reader :transaction
26
26
  attr_reader :us_bank_account_verification
27
+ attr_reader :session_id
28
+ attr_reader :customer_recommendations
27
29
 
28
30
  def initialize(attributes = {})
29
31
  @attrs = attributes.keys
@@ -20,6 +20,8 @@ module Braintree
20
20
  attr_reader :payer_last_name
21
21
  attr_reader :payer_status
22
22
  attr_reader :payment_id
23
+ attr_reader :recipient_email
24
+ attr_reader :recipient_phone
23
25
  attr_reader :refund_from_transaction_fee_amount
24
26
  attr_reader :refund_from_transaction_fee_currency_iso_code
25
27
  attr_reader :refund_id
@@ -254,24 +254,24 @@ module Braintree
254
254
  {:installments => [:count]},
255
255
  {:line_items => [:commodity_code, :description, :discount_amount, :image_url, :kind, :name, :product_code, :quantity, :tax_amount, :total_amount, :unit_amount, :unit_of_measure, :unit_tax_amount, :upc_code, :upc_type, :url]},
256
256
  {:options => [
257
- :hold_in_escrow,
258
- :store_in_vault,
259
- :store_in_vault_on_success,
260
- :submit_for_settlement,
261
257
  :add_billing_address_to_payment_method,
262
- :store_shipping_address_in_vault,
263
- :venmo_sdk_session, # Deprecated
258
+ {:amex_rewards => [:request_id, :points, :currency_amount, :currency_iso_code]},
259
+ {:credit_card => [:account_type, :process_debit_as_credit]},
260
+ :hold_in_escrow,
264
261
  :payee_id,
265
262
  :payee_email,
263
+ {:paypal => [:custom_field, :description, :payee_id, :payee_email, :recipient_email, {:recipient_phone => [:country_code, :national_number]}, {:supplementary_data => :_any_key_}]},
264
+ {:processing_overrides => [:customer_email, :customer_first_name, :customer_last_name, :customer_tax_identifier]},
266
265
  :skip_advanced_fraud_checking,
267
266
  :skip_avs,
268
267
  :skip_cvv,
269
- {:paypal => [:custom_field, :payee_id, :payee_email, :description, {:supplementary_data => :_any_key_}]},
270
- {:processing_overrides => [:customer_email, :customer_first_name, :customer_last_name, :customer_tax_identifier]},
268
+ :store_in_vault,
269
+ :store_in_vault_on_success,
270
+ :store_shipping_address_in_vault,
271
+ :submit_for_settlement,
271
272
  {:three_d_secure => [:required]},
272
- {:amex_rewards => [:request_id, :points, :currency_amount, :currency_iso_code]},
273
273
  {:venmo => [:profile_id]},
274
- {:credit_card => [:account_type, :process_debit_as_credit]},
274
+ :venmo_sdk_session, # Deprecated
275
275
  ]
276
276
  },
277
277
  {:paypal_account => [:email, :token, :paypal_data, :payee_id, :payee_email, :payer_id, :payment_id]},
@@ -1,7 +1,7 @@
1
1
  module Braintree
2
2
  module Version
3
3
  Major = 4
4
- Minor = 23
4
+ Minor = 25
5
5
  Tiny = 0
6
6
 
7
7
  String = "#{Major}.#{Minor}.#{Tiny}"
data/lib/braintree.rb CHANGED
@@ -51,6 +51,7 @@ require "braintree/customer"
51
51
  require "braintree/customer_gateway"
52
52
  require "braintree/granted_payment_instrument_update"
53
53
  require "braintree/customer_search"
54
+ require "braintree/customer_session_gateway"
54
55
  require "braintree/descriptor"
55
56
  require "braintree/digest"
56
57
  require "braintree/discount"
@@ -75,6 +76,16 @@ require "braintree/exchange_rate_quote_input"
75
76
  require "braintree/exchange_rate_quote_response"
76
77
  require "braintree/exchange_rate_quote_request"
77
78
  require "braintree/gateway"
79
+ require "braintree/graphql/enums/recommendations"
80
+ require "braintree/graphql/enums/recommended_payment_option"
81
+ require "braintree/graphql/inputs/create_customer_session_input"
82
+ require "braintree/graphql/inputs/customer_recommendations_input"
83
+ require "braintree/graphql/inputs/customer_session_input"
84
+ require "braintree/graphql/inputs/phone_input"
85
+ require "braintree/graphql/inputs/update_customer_session_input"
86
+ require "braintree/graphql/types/customer_recommendations_payload"
87
+ require "braintree/graphql/types/payment_options"
88
+ require "braintree/graphql/unions/customer_recommendations"
78
89
  require "braintree/graphql_client"
79
90
  require "braintree/google_pay_card"
80
91
  require "braintree/local_payment_completed"