braintree 4.35.0 → 4.36.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 (56) hide show
  1. checksums.yaml +4 -4
  2. data/lib/braintree/apple_pay_card.rb +7 -0
  3. data/lib/braintree/apple_pay_gateway.rb +43 -0
  4. data/lib/braintree/base_module.rb +9 -0
  5. data/lib/braintree/credit_card_verification.rb +2 -0
  6. data/lib/braintree/customer.rb +1 -1
  7. data/lib/braintree/customer_gateway.rb +2 -0
  8. data/lib/braintree/error_codes.rb +20 -0
  9. data/lib/braintree/gateway.rb +4 -0
  10. data/lib/braintree/graphql/inputs/billing_address_input.rb +34 -0
  11. data/lib/braintree/graphql/inputs/create_local_payment_context_input.rb +44 -0
  12. data/lib/braintree/graphql/inputs/payer_info_input.rb +38 -0
  13. data/lib/braintree/graphql/inputs/shipping_address_input.rb +34 -0
  14. data/lib/braintree/local_payment_context.rb +108 -0
  15. data/lib/braintree/local_payment_context_gateway.rb +132 -0
  16. data/lib/braintree/local_payment_type.rb +6 -0
  17. data/lib/braintree/merchant_gateway.rb +16 -16
  18. data/lib/braintree/monetary_amount.rb +24 -0
  19. data/lib/braintree/successful_result.rb +1 -0
  20. data/lib/braintree/transaction.rb +2 -0
  21. data/lib/braintree/transaction_gateway.rb +11 -5
  22. data/lib/braintree/transaction_search.rb +1 -0
  23. data/lib/braintree/validation_error_collection.rb +1 -1
  24. data/lib/braintree/version.rb +1 -1
  25. data/lib/braintree.rb +20 -3
  26. data/spec/integration/braintree/customer_spec.rb +550 -0
  27. data/spec/integration/braintree/http_spec.rb +1 -1
  28. data/spec/integration/braintree/local_payment_context_spec.rb +168 -0
  29. data/spec/integration/braintree/merchant_spec.rb +5 -169
  30. data/spec/integration/braintree/payment_method_spec.rb +174 -1
  31. data/spec/integration/braintree/transaction_idempotency_spec.rb +320 -0
  32. data/spec/integration/braintree/transaction_search_spec.rb +3 -2
  33. data/spec/integration/braintree/transaction_spec.rb +75 -0
  34. data/spec/integration/braintree/transaction_us_bank_account_spec.rb +2 -1
  35. data/spec/spec_helper.rb +2 -0
  36. data/spec/unit/braintree/credit_card_verification_spec.rb +1 -1
  37. data/spec/unit/braintree/customer_spec.rb +67 -1
  38. data/spec/unit/braintree/graphql/billing_address_input_spec.rb +68 -0
  39. data/spec/unit/braintree/graphql/create_local_payment_context_input_spec.rb +63 -0
  40. data/spec/unit/braintree/graphql/monetary_amount_input_spec.rb +55 -0
  41. data/spec/unit/braintree/graphql/payer_info_input_spec.rb +92 -0
  42. data/spec/unit/braintree/local_payment_context_gateway_spec.rb +149 -0
  43. data/spec/unit/braintree/local_payment_context_spec.rb +141 -0
  44. data/spec/unit/braintree/monetary_amount_spec.rb +34 -0
  45. data/spec/unit/braintree/three_d_secure_info_spec.rb +3 -1
  46. data/spec/unit/braintree/transaction/apple_pay_details_spec.rb +7 -7
  47. data/spec/unit/braintree/transaction/google_pay_details_spec.rb +7 -7
  48. data/spec/unit/braintree/transaction/meta_checkout_card_details_spec.rb +6 -6
  49. data/spec/unit/braintree/transaction/meta_checkout_token_details_spec.rb +6 -6
  50. data/spec/unit/braintree/transaction/payment_receipt_spec.rb +4 -4
  51. data/spec/unit/braintree/transaction/visa_checkout_card_details_spec.rb +6 -6
  52. data/spec/unit/braintree/transaction_gateway_spec.rb +4 -3
  53. data/spec/unit/braintree/transaction_spec.rb +12 -0
  54. data/spec/unit/credit_card_details_spec.rb +6 -6
  55. data/spec/unit/spec_helper.rb +9 -0
  56. metadata +19 -2
@@ -172,6 +172,7 @@ module Braintree
172
172
  attr_reader :status_history
173
173
  attr_reader :subscription_details
174
174
  attr_reader :subscription_id
175
+ attr_reader :surcharge_amount
175
176
  attr_reader :tax_amount
176
177
  attr_reader :tax_exempt
177
178
  attr_reader :three_d_secure_info
@@ -321,6 +322,7 @@ module Braintree
321
322
  @shipping_details = AddressDetails.new(@shipping)
322
323
  @status_history = attributes[:status_history] ? attributes[:status_history].map { |s| StatusDetails.new(s) } : []
323
324
  @subscription_details = SubscriptionDetails.new(@subscription)
325
+ @surcharge_amount = Util.to_big_decimal(surcharge_amount)
324
326
  @partially_authorized = %w[1004].include?(processor_response_code)
325
327
  @tax_amount = Util.to_big_decimal(tax_amount)
326
328
  @venmo_account_details = VenmoAccountDetails.new(@venmo_account)
@@ -168,8 +168,12 @@ module Braintree
168
168
  return_object_or_raise(:transaction) { submit_for_partial_settlement(*args) }
169
169
  end
170
170
 
171
- def void(transaction_id)
172
- response = @config.http.put("#{@config.base_merchant_path}/transactions/#{transaction_id}/void")
171
+ def void(transaction_id, options = {})
172
+ transaction_params = options.empty? ? nil : options
173
+ response = @config.http.put(
174
+ "#{@config.base_merchant_path}/transactions/#{transaction_id}/void",
175
+ transaction_params ? {:transaction => transaction_params} : nil,
176
+ )
173
177
  _handle_transaction_response(response)
174
178
  end
175
179
 
@@ -194,13 +198,13 @@ module Braintree
194
198
  # three_d_secure_token has been deprecated in favor of three_d_secure_authentication_id
195
199
  def self._create_signature
196
200
  [
197
- :accept_partial_authorization, :amount, :billing_address_id, :channel, :currency_iso_code, :customer_id, :device_data,
201
+ :accept_partial_authorization, :amount, :api_request_key, :billing_address_id, :channel, :currency_iso_code, :customer_id, :device_data,
198
202
  :discount_amount, :exchange_rate_quote_id, :foreign_retailer,
199
203
  :merchant_account_id, :order_id, :payment_method_nonce, :payment_method_token, :processing_merchant_category_code,
200
204
  :product_sku, :purchase_order_number, :service_fee_amount, :shared_billing_address_id,
201
205
  :shared_customer_id, :shared_payment_method_nonce, :shared_payment_method_token,
202
206
  :shared_shipping_address_id, :shipping_address_id, :shipping_amount, :shipping_tax_amount,
203
- :ships_from_postal_code, :tax_amount, :tax_exempt, :three_d_secure_authentication_id,:three_d_secure_token, #Deprecated
207
+ :ships_from_postal_code,:surcharge_amount, :tax_amount, :tax_exempt, :three_d_secure_authentication_id,:three_d_secure_token, #Deprecated
204
208
  :transaction_source, :type, :venmo_sdk_payment_method_code, # Deprecated
205
209
  :sca_exemption,
206
210
  {:apple_pay_card => [:number, :cardholder_name, :cryptogram, :expiration_month, :expiration_year, :eci_indicator]},
@@ -208,7 +212,7 @@ module Braintree
208
212
  :billing => AddressGateway._shared_signature
209
213
  },
210
214
  {:credit_card => [:token, :cardholder_name, :cvv, :expiration_date, :expiration_month, :expiration_year, :number, {:payment_reader_card_details => [:encrypted_card_data, :key_serial_number]}, {:network_tokenization_attributes => [:cryptogram, :ecommerce_indicator, :token_requestor_id]}]},
211
- {:customer => [:id, :company, :email, :fax, :first_name, :last_name, :phone, :website]},
215
+ {:customer => [:id, :company, :email, :fax, :first_name, {:international_phone => [:country_code, :national_number]}, :last_name, :phone, :website]},
212
216
  {:custom_fields => :_any_key_},
213
217
  {:descriptor => [:name, :phone, :url]},
214
218
  {:external_vault => [
@@ -318,6 +322,7 @@ module Braintree
318
322
 
319
323
  def self._submit_for_settlement_signature
320
324
  [
325
+ :api_request_key,
321
326
  :order_id,
322
327
  {:descriptor => [:name, :phone, :url]},
323
328
  {:industry => [
@@ -369,6 +374,7 @@ module Braintree
369
374
  def self._refund_signature
370
375
  [
371
376
  :amount,
377
+ :api_request_key,
372
378
  :merchant_account_id,
373
379
  :order_id,
374
380
  ]
@@ -1,6 +1,7 @@
1
1
  module Braintree
2
2
  class TransactionSearch < AdvancedSearch
3
3
  text_fields(
4
+ :acquirer_reference_number,
4
5
  :billing_company,
5
6
  :billing_country_name,
6
7
  :billing_extended_address,
@@ -39,7 +39,7 @@ module Braintree
39
39
  end
40
40
 
41
41
  def for_index(index)
42
- self.for("index_#{index}".to_sym)
42
+ self.for(:"index_#{index}")
43
43
  end
44
44
 
45
45
  def inspect
@@ -1,7 +1,7 @@
1
1
  module Braintree
2
2
  module Version
3
3
  Major = 4
4
- Minor = 35
4
+ Minor = 36
5
5
  Tiny = 0
6
6
 
7
7
  String = "#{Major}.#{Minor}.#{Tiny}"
data/lib/braintree.rb CHANGED
@@ -89,6 +89,10 @@ require "braintree/graphql/inputs/update_customer_session_input"
89
89
  require "braintree/graphql/inputs/paypal_purchase_unit_input"
90
90
  require "braintree/graphql/inputs/paypal_payee_input"
91
91
  require "braintree/graphql/inputs/monetary_amount_input"
92
+ require "braintree/graphql/inputs/create_local_payment_context_input"
93
+ require "braintree/graphql/inputs/payer_info_input"
94
+ require "braintree/graphql/inputs/billing_address_input"
95
+ require "braintree/graphql/inputs/shipping_address_input"
92
96
  require "braintree/graphql/types/customer_recommendations_payload"
93
97
  require "braintree/graphql/types/payment_options"
94
98
  require "braintree/graphql/types/payment_recommendations"
@@ -97,17 +101,20 @@ require "braintree/graphql_client"
97
101
  require "braintree/google_pay_card"
98
102
  require "braintree/local_payment_completed"
99
103
  require "braintree/local_payment_completed/blik_alias"
100
- require "braintree/local_payment_reversed"
104
+ require "braintree/local_payment_context"
105
+ require "braintree/local_payment_context_gateway"
101
106
  require "braintree/local_payment_expired"
102
107
  require "braintree/local_payment_funded"
103
- require "braintree/transaction/local_payment_details"
108
+ require "braintree/local_payment_reversed"
109
+ require "braintree/local_payment_type"
104
110
  require "braintree/merchant"
105
- require "braintree/merchant_gateway"
106
111
  require "braintree/merchant_account"
112
+ require "braintree/merchant_gateway"
107
113
  require "braintree/merchant_account_gateway"
108
114
  require "braintree/merchant_account/address_details"
109
115
  require "braintree/meta_checkout_card"
110
116
  require "braintree/meta_checkout_token"
117
+ require "braintree/monetary_amount"
111
118
  require "braintree/oauth_gateway"
112
119
  require "braintree/oauth_credentials"
113
120
  require "braintree/payment_instrument_type"
@@ -172,6 +179,7 @@ require "braintree/transaction/installment/adjustment"
172
179
  require "braintree/transaction/payment_receipt"
173
180
  require "braintree/transaction/payment_receipt/card_present_data.rb"
174
181
  require "braintree/transaction/payment_receipt/merchant_address.rb"
182
+ require "braintree/transaction/local_payment_details"
175
183
  require "braintree/transaction/meta_checkout_card_details"
176
184
  require "braintree/transaction/meta_checkout_token_details"
177
185
  require "braintree/transaction/package_details"
@@ -206,3 +214,12 @@ require "braintree/xml/generator"
206
214
  require "braintree/xml/nokogiri"
207
215
  require "braintree/xml/rexml"
208
216
  require "braintree/xml/parser"
217
+
218
+ module Braintree
219
+ ApplePayDetails = Transaction::ApplePayDetails
220
+ CreditCardDetails = Transaction::CreditCardDetails
221
+ GooglePayDetails = Transaction::GooglePayDetails
222
+ MetaCheckoutCardDetails = Transaction::MetaCheckoutCardDetails
223
+ MetaCheckoutTokenDetails = Transaction::MetaCheckoutTokenDetails
224
+ VisaCheckoutCardDetails = Transaction::VisaCheckoutCardDetails
225
+ end