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
@@ -1,28 +1,28 @@
1
- require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
1
+ require File.expand_path(File.dirname(__FILE__) + "/../../spec_helper")
2
2
 
3
3
  describe Braintree::VisaCheckoutCardDetails do
4
4
  it "initializes prepaid reloadable correctly" do
5
- card = Braintree::VisaCheckoutCardDetails._new(:gateway, {:prepaid_reloadable => "No"})
5
+ card = Braintree::VisaCheckoutCardDetails.new({:prepaid_reloadable => "No"})
6
6
  expect(card.prepaid_reloadable).to eq("No")
7
7
  end
8
8
 
9
9
  it "initializes business correctly" do
10
- card = Braintree::VisaCheckoutCardDetails._new(:gateway, {:business => "No"})
10
+ card = Braintree::VisaCheckoutCardDetails.new({:business => "No"})
11
11
  expect(card.business).to eq("No")
12
12
  end
13
13
 
14
14
  it "initializes consumer correctly" do
15
- card = Braintree::VisaCheckoutCardDetails._new(:gateway, {:consumer => "No"})
15
+ card = Braintree::VisaCheckoutCardDetails.new({:consumer => "No"})
16
16
  expect(card.consumer).to eq("No")
17
17
  end
18
18
 
19
19
  it "initializes corporate correctly" do
20
- card = Braintree::VisaCheckoutCardDetails._new(:gateway, {:corporate => "No"})
20
+ card = Braintree::VisaCheckoutCardDetails.new({:corporate => "No"})
21
21
  expect(card.corporate).to eq("No")
22
22
  end
23
23
 
24
24
  it "initializes purchase correctly" do
25
- card = Braintree::VisaCheckoutCardDetails._new(:gateway, {:purchase => "No"})
25
+ card = Braintree::VisaCheckoutCardDetails.new({:purchase => "No"})
26
26
  expect(card.purchase).to eq("No")
27
27
  end
28
28
  end
@@ -33,13 +33,13 @@ describe Braintree::TransactionGateway do
33
33
  # three_d_secure_token has been deprecated in favor of three_d_secure_authentication_id
34
34
  it "creates a transaction gateway signature" do
35
35
  expect(Braintree::TransactionGateway._create_signature).to match([
36
- :accept_partial_authorization, :amount, :billing_address_id, :channel, :currency_iso_code, :customer_id, :device_data,
36
+ :accept_partial_authorization, :amount, :api_request_key, :billing_address_id, :channel, :currency_iso_code, :customer_id, :device_data,
37
37
  :discount_amount, :exchange_rate_quote_id, :foreign_retailer,
38
38
  :merchant_account_id, :order_id, :payment_method_nonce, :payment_method_token, :processing_merchant_category_code,
39
39
  :product_sku, :purchase_order_number, :service_fee_amount, :shared_billing_address_id,
40
40
  :shared_customer_id, :shared_payment_method_nonce, :shared_payment_method_token,
41
41
  :shared_shipping_address_id, :shipping_address_id, :shipping_amount, :shipping_tax_amount,
42
- :ships_from_postal_code, :tax_amount, :tax_exempt, :three_d_secure_authentication_id,:three_d_secure_token, #Deprecated
42
+ :ships_from_postal_code, :surcharge_amount, :tax_amount, :tax_exempt, :three_d_secure_authentication_id,:three_d_secure_token, #Deprecated
43
43
  :transaction_source, :type, :venmo_sdk_payment_method_code, # Deprecated
44
44
  :sca_exemption,
45
45
  {:apple_pay_card => [:number, :cardholder_name, :cryptogram, :expiration_month, :expiration_year, :eci_indicator]},
@@ -47,7 +47,7 @@ describe Braintree::TransactionGateway do
47
47
  :billing => Braintree::AddressGateway._shared_signature
48
48
  },
49
49
  {: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]}]},
50
- {:customer => [:id, :company, :email, :fax, :first_name, :last_name, :phone, :website]},
50
+ {:customer => [:id, :company, :email, :fax, :first_name, {:international_phone => [:country_code, :national_number]}, :last_name, :phone, :website]},
51
51
  {:custom_fields => :_any_key_},
52
52
  {:descriptor => [:name, :phone, :url]},
53
53
  {:external_vault => [
@@ -163,6 +163,7 @@ describe Braintree::TransactionGateway do
163
163
 
164
164
  it "creates a transaction gateway submit for settlement signature" do
165
165
  expect(Braintree::TransactionGateway._submit_for_settlement_signature).to match([
166
+ :api_request_key,
166
167
  :order_id,
167
168
  {:descriptor => [:name, :phone, :url]},
168
169
  {:industry => [
@@ -576,4 +576,16 @@ describe Braintree::Transaction do
576
576
  expect(transaction.gateway_rejection_reason).to eq(Braintree::Transaction::GatewayRejectionReason::ExcessiveRetry)
577
577
  end
578
578
  end
579
+
580
+ describe "request includes surcharge amount" do
581
+ it "if the surcharge_amount is present" do
582
+ transaction = Braintree::Transaction._new(:gateway, :surcharge_amount => "1.00")
583
+ expect(transaction.surcharge_amount).to eq(BigDecimal("1.00"))
584
+ end
585
+
586
+ it "is set to nil if the surcharge_amount is not present" do
587
+ transaction = Braintree::Transaction._new(:gateway, {})
588
+ expect(transaction.surcharge_amount).to be_nil
589
+ end
590
+ end
579
591
  end
@@ -1,28 +1,28 @@
1
- require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
1
+ require File.expand_path(File.dirname(__FILE__) + "/spec_helper")
2
2
 
3
3
  describe Braintree::CreditCardDetails do
4
4
  it "initializes prepaid reloadable correctly" do
5
- card = Braintree::CreditCardDetails._new(:gateway, {:prepaid_reloadable => "No"})
5
+ card = Braintree::CreditCardDetails.new({:prepaid_reloadable => "No"})
6
6
  expect(card.prepaid_reloadable).to eq("No")
7
7
  end
8
8
 
9
9
  it "initializes business correctly" do
10
- card = Braintree::CreditCardDetails._new(:gateway, {:business => "No"})
10
+ card = Braintree::CreditCardDetails.new({:business => "No"})
11
11
  expect(card.business).to eq("No")
12
12
  end
13
13
 
14
14
  it "initializes consumer correctly" do
15
- card = Braintree::CreditCardDetails._new(:gateway, {:consumer => "No"})
15
+ card = Braintree::CreditCardDetails.new({:consumer => "No"})
16
16
  expect(card.consumer).to eq("No")
17
17
  end
18
18
 
19
19
  it "initializes corporate correctly" do
20
- card = Braintree::CreditCardDetails._new(:gateway, {:corporate => "No"})
20
+ card = Braintree::CreditCardDetails.new({:corporate => "No"})
21
21
  expect(card.corporate).to eq("No")
22
22
  end
23
23
 
24
24
  it "initializes purchase correctly" do
25
- card = Braintree::CreditCardDetails._new(:gateway, {:purchase => "No"})
25
+ card = Braintree::CreditCardDetails.new({:purchase => "No"})
26
26
  expect(card.purchase).to eq("No")
27
27
  end
28
28
  end
@@ -1 +1,10 @@
1
+ if ENV["COVERAGE"]
2
+ require "simplecov"
3
+ require "simplecov_json_formatter"
4
+ SimpleCov.start do
5
+ add_filter "/spec/"
6
+ formatter SimpleCov::Formatter::JSONFormatter
7
+ end
8
+ end
9
+
1
10
  require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: braintree
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.35.0
4
+ version: 4.36.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Braintree
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-02-02 00:00:00.000000000 Z
11
+ date: 2026-05-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: builder
@@ -114,13 +114,17 @@ files:
114
114
  - lib/braintree/granted_payment_instrument_update.rb
115
115
  - lib/braintree/graphql/enums/recommendations.rb
116
116
  - lib/braintree/graphql/enums/recommended_payment_option.rb
117
+ - lib/braintree/graphql/inputs/billing_address_input.rb
117
118
  - lib/braintree/graphql/inputs/create_customer_session_input.rb
119
+ - lib/braintree/graphql/inputs/create_local_payment_context_input.rb
118
120
  - lib/braintree/graphql/inputs/customer_recommendations_input.rb
119
121
  - lib/braintree/graphql/inputs/customer_session_input.rb
120
122
  - lib/braintree/graphql/inputs/monetary_amount_input.rb
123
+ - lib/braintree/graphql/inputs/payer_info_input.rb
121
124
  - lib/braintree/graphql/inputs/paypal_payee_input.rb
122
125
  - lib/braintree/graphql/inputs/paypal_purchase_unit_input.rb
123
126
  - lib/braintree/graphql/inputs/phone_input.rb
127
+ - lib/braintree/graphql/inputs/shipping_address_input.rb
124
128
  - lib/braintree/graphql/inputs/update_customer_session_input.rb
125
129
  - lib/braintree/graphql/types/customer_recommendations_payload.rb
126
130
  - lib/braintree/graphql/types/payment_options.rb
@@ -130,9 +134,12 @@ files:
130
134
  - lib/braintree/http.rb
131
135
  - lib/braintree/local_payment_completed.rb
132
136
  - lib/braintree/local_payment_completed/blik_alias.rb
137
+ - lib/braintree/local_payment_context.rb
138
+ - lib/braintree/local_payment_context_gateway.rb
133
139
  - lib/braintree/local_payment_expired.rb
134
140
  - lib/braintree/local_payment_funded.rb
135
141
  - lib/braintree/local_payment_reversed.rb
142
+ - lib/braintree/local_payment_type.rb
136
143
  - lib/braintree/merchant.rb
137
144
  - lib/braintree/merchant_account.rb
138
145
  - lib/braintree/merchant_account/address_details.rb
@@ -141,6 +148,7 @@ files:
141
148
  - lib/braintree/meta_checkout_card.rb
142
149
  - lib/braintree/meta_checkout_token.rb
143
150
  - lib/braintree/modification.rb
151
+ - lib/braintree/monetary_amount.rb
144
152
  - lib/braintree/oauth_credentials.rb
145
153
  - lib/braintree/oauth_gateway.rb
146
154
  - lib/braintree/paginated_collection.rb
@@ -267,6 +275,7 @@ files:
267
275
  - spec/integration/braintree/exchange_rate_quote_spec.rb
268
276
  - spec/integration/braintree/graphql_client_spec.rb
269
277
  - spec/integration/braintree/http_spec.rb
278
+ - spec/integration/braintree/local_payment_context_spec.rb
270
279
  - spec/integration/braintree/merchant_account_spec.rb
271
280
  - spec/integration/braintree/merchant_spec.rb
272
281
  - spec/integration/braintree/oauth_spec.rb
@@ -283,6 +292,7 @@ files:
283
292
  - spec/integration/braintree/subscription_spec.rb
284
293
  - spec/integration/braintree/test/transaction_amounts_spec.rb
285
294
  - spec/integration/braintree/test_transaction_spec.rb
295
+ - spec/integration/braintree/transaction_idempotency_spec.rb
286
296
  - spec/integration/braintree/transaction_line_item_spec.rb
287
297
  - spec/integration/braintree/transaction_payment_facilitator_spec.rb
288
298
  - spec/integration/braintree/transaction_search_spec.rb
@@ -328,15 +338,21 @@ files:
328
338
  - spec/unit/braintree/exchange_rate_quote_spec.rb
329
339
  - spec/unit/braintree/exchange_rate_spec.rb
330
340
  - spec/unit/braintree/google_pay_card_spec.rb
341
+ - spec/unit/braintree/graphql/billing_address_input_spec.rb
331
342
  - spec/unit/braintree/graphql/create_customer_session_input_spec.rb
343
+ - spec/unit/braintree/graphql/create_local_payment_context_input_spec.rb
332
344
  - spec/unit/braintree/graphql/customer_recommendations_input_spec.rb
333
345
  - spec/unit/braintree/graphql/customer_recommendations_spec.rb
334
346
  - spec/unit/braintree/graphql/customer_session_input_spec.rb
347
+ - spec/unit/braintree/graphql/monetary_amount_input_spec.rb
348
+ - spec/unit/braintree/graphql/payer_info_input_spec.rb
335
349
  - spec/unit/braintree/graphql/phone_input_spec.rb
336
350
  - spec/unit/braintree/graphql/update_customer_session_input_spec.rb
337
351
  - spec/unit/braintree/graphql_client_spec.rb
338
352
  - spec/unit/braintree/http_spec.rb
339
353
  - spec/unit/braintree/local_payment_completed_spec.rb
354
+ - spec/unit/braintree/local_payment_context_gateway_spec.rb
355
+ - spec/unit/braintree/local_payment_context_spec.rb
340
356
  - spec/unit/braintree/local_payment_expired_spec.rb
341
357
  - spec/unit/braintree/local_payment_funded_spec.rb
342
358
  - spec/unit/braintree/meta_checkout_card_details_spec.rb
@@ -344,6 +360,7 @@ files:
344
360
  - spec/unit/braintree/meta_checkout_token_details_spec.rb
345
361
  - spec/unit/braintree/meta_checkout_token_spec.rb
346
362
  - spec/unit/braintree/modification_spec.rb
363
+ - spec/unit/braintree/monetary_amount_spec.rb
347
364
  - spec/unit/braintree/package_tracking_spec.rb
348
365
  - spec/unit/braintree/payment_method_customer_data_updated_metadata_spec.rb
349
366
  - spec/unit/braintree/payment_method_nonce_details_payer_info_spec.rb