solidus_braintree 2.0.0 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (109) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +39 -8
  3. data/.gitignore +1 -0
  4. data/.rubocop.yml +8 -1
  5. data/CHANGELOG.md +37 -29
  6. data/Rakefile +6 -1
  7. data/app/assets/config/solidus_braintree_manifest.js +0 -1
  8. data/app/assets/javascripts/spree/backend/solidus_braintree.js +4 -4
  9. data/app/models/solidus_braintree/gateway.rb +4 -0
  10. data/app/models/solidus_braintree/response.rb +1 -1
  11. data/app/models/solidus_braintree/source.rb +5 -0
  12. data/bin/dummy-app +37 -0
  13. data/bin/rails-dummy-app +17 -0
  14. data/bin/rspec +11 -0
  15. data/bin/sandbox +20 -62
  16. data/db/migrate/20230210104310_add_device_data_to_braintree_sources.rb +5 -0
  17. data/lib/generators/solidus_braintree/install/install_generator.rb +134 -34
  18. data/{app → lib/generators/solidus_braintree/install/templates/app}/assets/javascripts/spree/frontend/paypal_button.js +1 -1
  19. data/lib/generators/solidus_braintree/install/templates/app/assets/javascripts/spree/frontend/solidus_braintree/ajax.js +13 -0
  20. data/{app/assets/javascripts → lib/generators/solidus_braintree/install/templates/app/assets/javascripts/spree/frontend}/solidus_braintree/apple_pay_button.js +2 -2
  21. data/{app/assets/javascripts → lib/generators/solidus_braintree/install/templates/app/assets/javascripts/spree/frontend}/solidus_braintree/checkout.js +10 -5
  22. data/lib/generators/solidus_braintree/install/templates/app/assets/javascripts/spree/frontend/solidus_braintree/client.js +239 -0
  23. data/lib/generators/solidus_braintree/install/templates/app/assets/javascripts/spree/frontend/solidus_braintree/constants.js +89 -0
  24. data/lib/generators/solidus_braintree/install/templates/app/assets/javascripts/spree/frontend/solidus_braintree/frontend.js +15 -0
  25. data/lib/generators/solidus_braintree/install/templates/app/assets/javascripts/spree/frontend/solidus_braintree/hosted_form.js +48 -0
  26. data/{app/assets/javascripts → lib/generators/solidus_braintree/install/templates/app/assets/javascripts/spree/frontend}/solidus_braintree/paypal_button.js +2 -2
  27. data/{app/assets/javascripts → lib/generators/solidus_braintree/install/templates/app/assets/javascripts/spree/frontend}/solidus_braintree/paypal_messaging.js +1 -1
  28. data/lib/generators/solidus_braintree/install/templates/app/assets/javascripts/spree/frontend/solidus_braintree/promise.js +20 -0
  29. data/{app/assets/javascripts → lib/generators/solidus_braintree/install/templates/app/assets/javascripts/spree/frontend}/solidus_braintree/venmo_button.js +1 -1
  30. data/lib/generators/solidus_braintree/install/templates/app/assets/javascripts/spree/frontend/solidus_braintree.js +1 -0
  31. data/{app → lib/generators/solidus_braintree/install/templates/app}/assets/stylesheets/spree/frontend/solidus_braintree.scss +11 -0
  32. data/lib/{controllers/frontend → generators/solidus_braintree/install/templates/app/controllers}/solidus_braintree/checkouts_controller.rb +1 -1
  33. data/lib/{controllers/frontend → generators/solidus_braintree/install/templates/app/controllers}/solidus_braintree/transactions_controller.rb +3 -3
  34. data/lib/generators/solidus_braintree/install/templates/app/views/checkouts/existing_payment/_braintree.html.erb +2 -0
  35. data/lib/{views/frontend/spree/checkout → generators/solidus_braintree/install/templates/app/views/checkouts}/payment/_braintree.html.erb +1 -1
  36. data/lib/{views/frontend/solidus_braintree/payments/_payment.html.erb → generators/solidus_braintree/install/templates/app/views/payments/_braintree_payment_details.html.erb} +0 -3
  37. data/{app → lib/generators/solidus_braintree/install/templates/app}/views/spree/shared/_apple_pay_button.html.erb +1 -1
  38. data/{app → lib/generators/solidus_braintree/install/templates/app}/views/spree/shared/_braintree_head_scripts.html.erb +1 -1
  39. data/{app → lib/generators/solidus_braintree/install/templates/app}/views/spree/shared/_braintree_hosted_fields.html.erb +1 -4
  40. data/lib/solidus_braintree/engine.rb +15 -10
  41. data/lib/solidus_braintree/version.rb +1 -1
  42. data/solidus_braintree.gemspec +3 -5
  43. data/spec/controllers/solidus_braintree/checkouts_controller_spec.rb +2 -2
  44. data/spec/controllers/solidus_braintree/client_tokens_controller_spec.rb +2 -2
  45. data/spec/controllers/solidus_braintree/configurations_controller_spec.rb +2 -2
  46. data/spec/controllers/solidus_braintree/transactions_controller_spec.rb +3 -3
  47. data/spec/fixtures/views/carts/_cart_footer.html.erb +18 -0
  48. data/spec/helpers/solidus_braintree/braintree_admin_helper_spec.rb +1 -1
  49. data/spec/helpers/solidus_braintree/braintree_checkout_helper_spec.rb +1 -1
  50. data/spec/models/solidus_braintree/address_spec.rb +1 -1
  51. data/spec/models/solidus_braintree/avs_result_spec.rb +1 -1
  52. data/spec/models/solidus_braintree/gateway_spec.rb +35 -3
  53. data/spec/models/solidus_braintree/response_spec.rb +1 -1
  54. data/spec/models/solidus_braintree/source_spec.rb +17 -1
  55. data/spec/models/solidus_braintree/transaction_address_spec.rb +2 -2
  56. data/spec/models/solidus_braintree/transaction_import_spec.rb +2 -2
  57. data/spec/models/solidus_braintree/transaction_spec.rb +2 -2
  58. data/spec/models/spree/store_spec.rb +2 -2
  59. data/spec/requests/spree/api/orders_controller_spec.rb +2 -2
  60. data/spec/solidus_braintree_helper.rb +7 -0
  61. data/{lib/solidus_braintree/testing_support → spec/support/solidus_braintree}/factories.rb +17 -15
  62. data/spec/support/{order_ready_for_payment.rb → solidus_braintree/order_ready_for_payment.rb} +9 -2
  63. data/spec/support/solidus_braintree/order_walkthrough.rb +87 -0
  64. data/spec/support/solidus_braintree/with_prepended_view_fixtures.rb +19 -0
  65. data/spec/{features → system}/backend/configuration_spec.rb +2 -2
  66. data/spec/{features → system}/backend/new_payment_spec.rb +3 -4
  67. data/spec/{features → system}/frontend/braintree_credit_card_checkout_spec.rb +23 -15
  68. data/spec/{features → system}/frontend/paypal_checkout_spec.rb +6 -3
  69. data/spec/{features → system}/frontend/venmo_checkout_spec.rb +8 -9
  70. metadata +88 -107
  71. data/app/assets/javascripts/solidus_braintree/frontend.js +0 -14
  72. data/app/assets/javascripts/spree/frontend/solidus_braintree.js +0 -1
  73. data/app/decorators/controllers/solidus_braintree/checkout_controller_decorator.rb +0 -11
  74. data/app/decorators/controllers/solidus_braintree/orders_controller_decorator.rb +0 -11
  75. data/app/overrides/spree/payments/payment/add_paypal_funding_source_to_payment.rb +0 -9
  76. data/app/views/spree/checkout/existing_payment/_braintree.html.erb +0 -10
  77. data/spec/fixtures/views/spree/orders/edit.html.erb +0 -50
  78. data/spec/spec_helper.rb +0 -32
  79. data/spec/support/views.rb +0 -1
  80. /data/app/assets/javascripts/{solidus_braintree → spree/backend/solidus_braintree}/client.js +0 -0
  81. /data/app/assets/javascripts/{solidus_braintree → spree/backend/solidus_braintree}/constants.js +0 -0
  82. /data/app/assets/javascripts/{solidus_braintree → spree/backend/solidus_braintree}/hosted_form.js +0 -0
  83. /data/app/assets/javascripts/{solidus_braintree → spree/backend/solidus_braintree}/promise.js +0 -0
  84. /data/{app → lib/generators/solidus_braintree/install/templates/app}/assets/images/solidus_braintree/venmo/venmo_active_blue_button_280x48.svg +0 -0
  85. /data/{app → lib/generators/solidus_braintree/install/templates/app}/assets/images/solidus_braintree/venmo/venmo_active_blue_button_320x48.svg +0 -0
  86. /data/{app → lib/generators/solidus_braintree/install/templates/app}/assets/images/solidus_braintree/venmo/venmo_active_blue_button_375x48.svg +0 -0
  87. /data/{app → lib/generators/solidus_braintree/install/templates/app}/assets/images/solidus_braintree/venmo/venmo_active_white_button_280x48.svg +0 -0
  88. /data/{app → lib/generators/solidus_braintree/install/templates/app}/assets/images/solidus_braintree/venmo/venmo_active_white_button_320x48.svg +0 -0
  89. /data/{app → lib/generators/solidus_braintree/install/templates/app}/assets/images/solidus_braintree/venmo/venmo_active_white_button_375x48.svg +0 -0
  90. /data/{app → lib/generators/solidus_braintree/install/templates/app}/assets/images/solidus_braintree/venmo/venmo_blue_acceptance_mark.svg +0 -0
  91. /data/{app → lib/generators/solidus_braintree/install/templates/app}/assets/images/solidus_braintree/venmo/venmo_blue_button_280x48.svg +0 -0
  92. /data/{app → lib/generators/solidus_braintree/install/templates/app}/assets/images/solidus_braintree/venmo/venmo_blue_button_320x48.svg +0 -0
  93. /data/{app → lib/generators/solidus_braintree/install/templates/app}/assets/images/solidus_braintree/venmo/venmo_blue_button_375x48.svg +0 -0
  94. /data/{app → lib/generators/solidus_braintree/install/templates/app}/assets/images/solidus_braintree/venmo/venmo_blue_logo.svg +0 -0
  95. /data/{app → lib/generators/solidus_braintree/install/templates/app}/assets/images/solidus_braintree/venmo/venmo_white_acceptance_mark.svg +0 -0
  96. /data/{app → lib/generators/solidus_braintree/install/templates/app}/assets/images/solidus_braintree/venmo/venmo_white_button_280x48.svg +0 -0
  97. /data/{app → lib/generators/solidus_braintree/install/templates/app}/assets/images/solidus_braintree/venmo/venmo_white_button_320x48.svg +0 -0
  98. /data/{app → lib/generators/solidus_braintree/install/templates/app}/assets/images/solidus_braintree/venmo/venmo_white_button_375x48.svg +0 -0
  99. /data/{app → lib/generators/solidus_braintree/install/templates/app}/assets/images/solidus_braintree/venmo/venmo_white_logo.svg +0 -0
  100. /data/{app → lib/generators/solidus_braintree/install/templates/app}/helpers/solidus_braintree/braintree_checkout_helper.rb +0 -0
  101. /data/{app → lib/generators/solidus_braintree/install/templates/app}/views/spree/shared/_braintree_errors.html.erb +0 -0
  102. /data/{app → lib/generators/solidus_braintree/install/templates/app}/views/spree/shared/_paypal_cart_button.html.erb +0 -0
  103. /data/lib/{views/frontend → generators/solidus_braintree/install/templates/app/views}/spree/shared/_paypal_checkout_button.html.erb +0 -0
  104. /data/{app → lib/generators/solidus_braintree/install/templates/app}/views/spree/shared/_paypal_messaging.html.erb +0 -0
  105. /data/{app → lib/generators/solidus_braintree/install/templates/app}/views/spree/shared/_venmo_button.html.erb +0 -0
  106. /data/lib/generators/solidus_braintree/install/templates/{initializer.rb → config/initializers/solidus_braintree.rb} +0 -0
  107. /data/spec/support/{capybara.rb → solidus_braintree/capybara.rb} +0 -0
  108. /data/spec/support/{gateway_helpers.rb → solidus_braintree/gateway_helpers.rb} +0 -0
  109. /data/spec/support/{vcr.rb → solidus_braintree/vcr.rb} +0 -0
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ RSpec.shared_context 'with prepended view fixtures' do
4
+ let(:view_fixtures_path) { 'spec/fixtures/views' }
5
+
6
+ before do
7
+ ApplicationController.prepend_view_path view_fixtures_path
8
+ end
9
+
10
+ after do
11
+ view_paths = ApplicationController.view_paths.to_a
12
+
13
+ view_paths.delete_if do |view_path|
14
+ view_path.to_path.match?(/#{view_fixtures_path}$/)
15
+ end
16
+
17
+ ApplicationController.view_paths = view_paths
18
+ end
19
+ end
@@ -1,6 +1,6 @@
1
- require 'spec_helper'
1
+ require 'solidus_braintree_helper'
2
2
 
3
- RSpec.describe "viewing the configuration interface" do
3
+ RSpec.describe "viewing the configuration interface", type: :feature do
4
4
  stub_authorization!
5
5
 
6
6
  # Regression to ensure this page still renders on old versions of solidus
@@ -1,7 +1,6 @@
1
- require 'spec_helper'
2
- require 'spree/testing_support/order_walkthrough'
1
+ require 'solidus_braintree_helper'
3
2
 
4
- shared_context "with backend checkout setup" do
3
+ RSpec.shared_context "with backend checkout setup" do
5
4
  let(:braintree) { new_gateway(active: true) }
6
5
  let!(:gateway) { create :payment_method }
7
6
  let(:order) { create(:completed_order_with_totals, number: 'R9999999') }
@@ -26,7 +25,7 @@ shared_context "with backend checkout setup" do
26
25
  end
27
26
  end
28
27
 
29
- describe 'creating a new payment', type: :feature, js: true do
28
+ RSpec.describe 'creating a new payment', type: :feature, js: true do
30
29
  stub_authorization!
31
30
 
32
31
  context "with valid credit card data", vcr: {
@@ -1,7 +1,6 @@
1
- require 'spec_helper'
2
- require 'spree/testing_support/order_walkthrough'
1
+ require 'solidus_braintree_helper'
3
2
 
4
- shared_context "with frontend checkout setup" do
3
+ RSpec.shared_context "with frontend checkout setup" do
5
4
  let(:braintree) { new_gateway(active: true) }
6
5
  let!(:gateway) { create :payment_method }
7
6
  let(:three_d_secure_enabled) { false }
@@ -26,7 +25,7 @@ shared_context "with frontend checkout setup" do
26
25
  end
27
26
 
28
27
  order = if Spree.solidus_gem_version >= Gem::Version.new('2.6.0')
29
- Spree::TestingSupport::OrderWalkthrough.up_to(:delivery)
28
+ SolidusBraintree::OrderWalkthrough.up_to(:delivery)
30
29
  else
31
30
  OrderWalkthrough.up_to(:delivery)
32
31
  end
@@ -36,13 +35,13 @@ shared_context "with frontend checkout setup" do
36
35
  order.number = "R9999999"
37
36
  order.recalculate
38
37
 
39
- allow_any_instance_of(Spree::CheckoutController).to receive_messages(current_order: order)
40
- allow_any_instance_of(Spree::CheckoutController).to receive_messages(try_spree_current_user: user)
41
- allow_any_instance_of(Spree::CheckoutController).to receive_messages(spree_current_user: user)
38
+ allow_any_instance_of(CheckoutsController).to receive_messages(current_order: order)
39
+ allow_any_instance_of(CheckoutsController).to receive_messages(try_spree_current_user: user)
40
+ allow_any_instance_of(CheckoutsController).to receive_messages(spree_current_user: user)
42
41
  allow_any_instance_of(Spree::Payment).to receive(:number).and_return("123ABC")
43
42
  allow_any_instance_of(SolidusBraintree::Source).to receive(:nonce).and_return("fake-valid-nonce")
44
43
 
45
- visit spree.checkout_state_path(:delivery)
44
+ visit checkout_state_path(:delivery)
46
45
  click_button "Save and Continue"
47
46
  choose("Braintree")
48
47
  end
@@ -52,12 +51,12 @@ shared_context "with frontend checkout setup" do
52
51
  end
53
52
  end
54
53
 
55
- describe 'entering credit card details', type: :feature, js: true do
54
+ RSpec.describe 'entering credit card details', type: :feature, js: true do
56
55
  context 'when page loads' do
57
56
  include_context "with frontend checkout setup"
58
57
 
59
58
  it "selectors display correctly" do
60
- expect(page).to have_selector("#payment_method_#{braintree.id}", visible: :visible)
59
+ expect(page).to have_selector("fieldset[name='payment-method-#{braintree.id}']", visible: :visible)
61
60
  expect(page).to have_selector("iframe#braintree-hosted-field-number")
62
61
  expect(page).to have_selector("iframe[type='number']")
63
62
  end
@@ -98,9 +97,12 @@ describe 'entering credit card details', type: :feature, js: true do
98
97
  end
99
98
 
100
99
  it "checks out successfully" do
101
- within("#order_details") do
100
+ within(".confirm-step") do
102
101
  expect(page).to have_content("CONFIRM")
103
102
  end
103
+
104
+ check('accept_terms_and_conditions')
105
+
104
106
  click_button("Place Order")
105
107
  expect(page).to have_content("Your order has been processed successfully")
106
108
  end
@@ -111,10 +113,12 @@ describe 'entering credit card details', type: :feature, js: true do
111
113
  it 'checks out successfully' do
112
114
  authenticate_3ds
113
115
 
114
- within("#order_details") do
116
+ within(".confirm-step") do
115
117
  expect(page).to have_content("CONFIRM")
116
118
  end
117
119
 
120
+ check('accept_terms_and_conditions')
121
+
118
122
  click_button("Place Order")
119
123
  expect(page).to have_content("Your order has been processed successfully")
120
124
  end
@@ -142,13 +146,13 @@ describe 'entering credit card details', type: :feature, js: true do
142
146
 
143
147
  it "displays an alert with a meaningful error message" do
144
148
  expect(page).to have_text I18n.t("solidus_braintree.errors.empty_fields")
145
- expect(page).to have_selector("input[type='submit']:enabled")
149
+ expect(page).to have_selector("[type='submit']:enabled")
146
150
  end
147
151
 
148
152
  # Same error should be produced when submitting an empty form again
149
153
  context "when user tries to resubmit an empty form", vcr: { cassette_name: "checkout/invalid_credit_card" } do
150
154
  it "displays an alert with a meaningful error message" do
151
- expect(page).to have_selector("input[type='submit']:enabled")
155
+ expect(page).to have_selector("[type='submit']:enabled")
152
156
 
153
157
  click_button "Save and Continue"
154
158
  expect(page).to have_text I18n.t("solidus_braintree.errors.empty_fields")
@@ -171,9 +175,13 @@ describe 'entering credit card details', type: :feature, js: true do
171
175
  fill_in("cvv", with: "123")
172
176
  end
173
177
  click_button("Save and Continue")
174
- within("#order_details") do
178
+
179
+ within(".confirm-step") do
175
180
  expect(page).to have_content("CONFIRM")
176
181
  end
182
+
183
+ check('accept_terms_and_conditions')
184
+
177
185
  click_button("Place Order")
178
186
  expect(page).to have_content("Your order has been processed successfully")
179
187
  end
@@ -1,6 +1,9 @@
1
- require 'spec_helper'
1
+ require 'solidus_braintree_helper'
2
+ require 'support/solidus_braintree/with_prepended_view_fixtures'
3
+
4
+ RSpec.describe "Checkout", type: :feature, js: true do
5
+ include_context 'with prepended view fixtures'
2
6
 
3
- describe "Checkout", type: :feature, js: true do
4
7
  Capybara.default_max_wait_time = 60
5
8
 
6
9
  # let!(:store) do
@@ -149,7 +152,7 @@ describe "Checkout", type: :feature, js: true do
149
152
  end
150
153
 
151
154
  def add_mug_to_cart
152
- visit spree.root_path
155
+ visit root_path
153
156
  click_link mug.name
154
157
  click_button "add-to-cart-button"
155
158
  end
@@ -1,9 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'spec_helper'
4
- require 'spree/testing_support/order_walkthrough'
3
+ require 'solidus_braintree_helper'
5
4
 
6
- describe "Checkout", type: :feature, js: true do
5
+ RSpec.describe "Checkout", type: :feature, js: true do
7
6
  let(:braintree_preferences) { { venmo: true }.merge(preferences) }
8
7
  let(:preferences) { {} }
9
8
  let(:user) { create(:user) }
@@ -134,22 +133,22 @@ describe "Checkout", type: :feature, js: true do
134
133
 
135
134
  def go_to_payment_checkout_page(order_number: 'R300000001' )
136
135
  order = if Spree.solidus_gem_version >= Gem::Version.new('2.6.0')
137
- Spree::TestingSupport::OrderWalkthrough.up_to(:address)
136
+ SolidusBraintree::OrderWalkthrough.up_to(:address)
138
137
  else
139
138
  OrderWalkthrough.up_to(:address)
140
139
  end
141
140
 
142
141
  order.update!(user: user, number: order_number) # constant order number for VCRs
143
142
 
144
- allow_any_instance_of(Spree::CheckoutController).to receive_messages(current_order: order)
143
+ allow_any_instance_of(CheckoutsController).to receive_messages(current_order: order)
145
144
 
146
145
  first_user = Spree::User.first
147
- allow_any_instance_of(Spree::CheckoutController).to receive_messages(try_spree_current_user: first_user)
148
- allow_any_instance_of(Spree::CheckoutController).to receive_messages(spree_current_user: first_user)
146
+ allow_any_instance_of(CheckoutsController).to receive_messages(try_spree_current_user: first_user)
147
+ allow_any_instance_of(CheckoutsController).to receive_messages(spree_current_user: first_user)
149
148
 
150
149
  allow_any_instance_of(Spree::Payment).to receive(:gateway_order_id).and_return(order_number)
151
150
 
152
- visit spree.checkout_state_path(order.state)
151
+ visit checkout_state_path(order.state)
153
152
  next_checkout_step
154
153
  end
155
154
 
@@ -188,7 +187,7 @@ describe "Checkout", type: :feature, js: true do
188
187
 
189
188
  def disable_hosted_fields_form_listener
190
189
  # Once the submit button is enabled, the submit listener has been added
191
- find("#checkout_form_payment input[type='submit']:not(:disabled)")
190
+ find("#checkout_form_payment [type='submit']:not(:disabled)")
192
191
  page.execute_script("$('#checkout_form_payment').off('submit');")
193
192
  end
194
193
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: solidus_braintree
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 3.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stembolt
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-03-17 00:00:00.000000000 Z
11
+ date: 2023-03-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemerchant
@@ -44,7 +44,7 @@ dependencies:
44
44
  requirements:
45
45
  - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: 2.4.0
47
+ version: 3.4.0.dev
48
48
  - - "<"
49
49
  - !ruby/object:Gem::Version
50
50
  version: '4'
@@ -54,7 +54,7 @@ dependencies:
54
54
  requirements:
55
55
  - - ">="
56
56
  - !ruby/object:Gem::Version
57
- version: 2.4.0
57
+ version: 3.4.0.dev
58
58
  - - "<"
59
59
  - !ruby/object:Gem::Version
60
60
  version: '4'
@@ -64,7 +64,7 @@ dependencies:
64
64
  requirements:
65
65
  - - ">="
66
66
  - !ruby/object:Gem::Version
67
- version: 2.4.0
67
+ version: 3.4.0.dev
68
68
  - - "<"
69
69
  - !ruby/object:Gem::Version
70
70
  version: '4'
@@ -74,7 +74,7 @@ dependencies:
74
74
  requirements:
75
75
  - - ">="
76
76
  - !ruby/object:Gem::Version
77
- version: 2.4.0
77
+ version: 3.4.0.dev
78
78
  - - "<"
79
79
  - !ruby/object:Gem::Version
80
80
  version: '4'
@@ -126,34 +126,6 @@ dependencies:
126
126
  - - "~>"
127
127
  - !ruby/object:Gem::Version
128
128
  version: '2.5'
129
- - !ruby/object:Gem::Dependency
130
- name: vcr
131
- requirement: !ruby/object:Gem::Requirement
132
- requirements:
133
- - - ">="
134
- - !ruby/object:Gem::Version
135
- version: '0'
136
- type: :development
137
- prerelease: false
138
- version_requirements: !ruby/object:Gem::Requirement
139
- requirements:
140
- - - ">="
141
- - !ruby/object:Gem::Version
142
- version: '0'
143
- - !ruby/object:Gem::Dependency
144
- name: webmock
145
- requirement: !ruby/object:Gem::Requirement
146
- requirements:
147
- - - ">="
148
- - !ruby/object:Gem::Version
149
- version: '0'
150
- type: :development
151
- prerelease: false
152
- version_requirements: !ruby/object:Gem::Requirement
153
- requirements:
154
- - - ">="
155
- - !ruby/object:Gem::Version
156
- version: '0'
157
129
  description: Uses the javascript API for seamless braintree payments
158
130
  email: braintree+gemfile@stembolt.com
159
131
  executables: []
@@ -173,45 +145,17 @@ files:
173
145
  - README.md
174
146
  - Rakefile
175
147
  - app/assets/config/solidus_braintree_manifest.js
176
- - app/assets/images/solidus_braintree/venmo/venmo_active_blue_button_280x48.svg
177
- - app/assets/images/solidus_braintree/venmo/venmo_active_blue_button_320x48.svg
178
- - app/assets/images/solidus_braintree/venmo/venmo_active_blue_button_375x48.svg
179
- - app/assets/images/solidus_braintree/venmo/venmo_active_white_button_280x48.svg
180
- - app/assets/images/solidus_braintree/venmo/venmo_active_white_button_320x48.svg
181
- - app/assets/images/solidus_braintree/venmo/venmo_active_white_button_375x48.svg
182
- - app/assets/images/solidus_braintree/venmo/venmo_blue_acceptance_mark.svg
183
- - app/assets/images/solidus_braintree/venmo/venmo_blue_button_280x48.svg
184
- - app/assets/images/solidus_braintree/venmo/venmo_blue_button_320x48.svg
185
- - app/assets/images/solidus_braintree/venmo/venmo_blue_button_375x48.svg
186
- - app/assets/images/solidus_braintree/venmo/venmo_blue_logo.svg
187
- - app/assets/images/solidus_braintree/venmo/venmo_white_acceptance_mark.svg
188
- - app/assets/images/solidus_braintree/venmo/venmo_white_button_280x48.svg
189
- - app/assets/images/solidus_braintree/venmo/venmo_white_button_320x48.svg
190
- - app/assets/images/solidus_braintree/venmo/venmo_white_button_375x48.svg
191
- - app/assets/images/solidus_braintree/venmo/venmo_white_logo.svg
192
- - app/assets/javascripts/solidus_braintree/apple_pay_button.js
193
- - app/assets/javascripts/solidus_braintree/checkout.js
194
- - app/assets/javascripts/solidus_braintree/client.js
195
- - app/assets/javascripts/solidus_braintree/constants.js
196
- - app/assets/javascripts/solidus_braintree/frontend.js
197
- - app/assets/javascripts/solidus_braintree/hosted_form.js
198
- - app/assets/javascripts/solidus_braintree/paypal_button.js
199
- - app/assets/javascripts/solidus_braintree/paypal_messaging.js
200
- - app/assets/javascripts/solidus_braintree/promise.js
201
- - app/assets/javascripts/solidus_braintree/venmo_button.js
202
148
  - app/assets/javascripts/spree/backend/solidus_braintree.js
203
- - app/assets/javascripts/spree/frontend/paypal_button.js
204
- - app/assets/javascripts/spree/frontend/solidus_braintree.js
149
+ - app/assets/javascripts/spree/backend/solidus_braintree/client.js
150
+ - app/assets/javascripts/spree/backend/solidus_braintree/constants.js
151
+ - app/assets/javascripts/spree/backend/solidus_braintree/hosted_form.js
152
+ - app/assets/javascripts/spree/backend/solidus_braintree/promise.js
205
153
  - app/assets/stylesheets/spree/backend/solidus_braintree.scss
206
- - app/assets/stylesheets/spree/frontend/solidus_braintree.scss
207
154
  - app/decorators/controllers/solidus_braintree/admin_payments_controller_decorator.rb
208
- - app/decorators/controllers/solidus_braintree/checkout_controller_decorator.rb
209
155
  - app/decorators/controllers/solidus_braintree/client_tokens_controller.rb
210
- - app/decorators/controllers/solidus_braintree/orders_controller_decorator.rb
211
156
  - app/decorators/models/solidus_braintree/spree/store_decorator.rb
212
157
  - app/decorators/models/solidus_braintree/spree/user_decorator.rb
213
158
  - app/helpers/solidus_braintree/braintree_admin_helper.rb
214
- - app/helpers/solidus_braintree/braintree_checkout_helper.rb
215
159
  - app/models/application_record.rb
216
160
  - app/models/solidus_braintree/address.rb
217
161
  - app/models/solidus_braintree/avs_result.rb
@@ -223,21 +167,15 @@ files:
223
167
  - app/models/solidus_braintree/transaction.rb
224
168
  - app/models/solidus_braintree/transaction_address.rb
225
169
  - app/models/solidus_braintree/transaction_import.rb
226
- - app/overrides/spree/payments/payment/add_paypal_funding_source_to_payment.rb
227
170
  - app/views/spree/api/payments/source_views/_braintree.json.jbuilder
228
- - app/views/spree/checkout/existing_payment/_braintree.html.erb
229
- - app/views/spree/shared/_apple_pay_button.html.erb
230
- - app/views/spree/shared/_braintree_errors.html.erb
231
- - app/views/spree/shared/_braintree_head_scripts.html.erb
232
- - app/views/spree/shared/_braintree_hosted_fields.html.erb
233
- - app/views/spree/shared/_paypal_cart_button.html.erb
234
- - app/views/spree/shared/_paypal_messaging.html.erb
235
- - app/views/spree/shared/_venmo_button.html.erb
236
171
  - bin/console
172
+ - bin/dummy-app
237
173
  - bin/rails
174
+ - bin/rails-dummy-app
238
175
  - bin/rails-engine
239
176
  - bin/rails-sandbox
240
177
  - bin/rake
178
+ - bin/rspec
241
179
  - bin/sandbox
242
180
  - bin/setup
243
181
  - config/locales/en.yml
@@ -255,17 +193,59 @@ files:
255
193
  - db/migrate/20211222170950_add_paypal_funding_source_to_solidus_paypal_braintree_sources.rb
256
194
  - db/migrate/20220104150301_add_venmo_to_braintree_configuration.rb
257
195
  - db/migrate/20230109080950_rename_solidus_paypal_braintree_source_type.rb
196
+ - db/migrate/20230210104310_add_device_data_to_braintree_sources.rb
258
197
  - lib/controllers/backend/solidus_braintree/configurations_controller.rb
259
- - lib/controllers/frontend/solidus_braintree/checkouts_controller.rb
260
- - lib/controllers/frontend/solidus_braintree/transactions_controller.rb
261
198
  - lib/generators/solidus_braintree/install/install_generator.rb
262
- - lib/generators/solidus_braintree/install/templates/initializer.rb
199
+ - lib/generators/solidus_braintree/install/templates/app/assets/images/solidus_braintree/venmo/venmo_active_blue_button_280x48.svg
200
+ - lib/generators/solidus_braintree/install/templates/app/assets/images/solidus_braintree/venmo/venmo_active_blue_button_320x48.svg
201
+ - lib/generators/solidus_braintree/install/templates/app/assets/images/solidus_braintree/venmo/venmo_active_blue_button_375x48.svg
202
+ - lib/generators/solidus_braintree/install/templates/app/assets/images/solidus_braintree/venmo/venmo_active_white_button_280x48.svg
203
+ - lib/generators/solidus_braintree/install/templates/app/assets/images/solidus_braintree/venmo/venmo_active_white_button_320x48.svg
204
+ - lib/generators/solidus_braintree/install/templates/app/assets/images/solidus_braintree/venmo/venmo_active_white_button_375x48.svg
205
+ - lib/generators/solidus_braintree/install/templates/app/assets/images/solidus_braintree/venmo/venmo_blue_acceptance_mark.svg
206
+ - lib/generators/solidus_braintree/install/templates/app/assets/images/solidus_braintree/venmo/venmo_blue_button_280x48.svg
207
+ - lib/generators/solidus_braintree/install/templates/app/assets/images/solidus_braintree/venmo/venmo_blue_button_320x48.svg
208
+ - lib/generators/solidus_braintree/install/templates/app/assets/images/solidus_braintree/venmo/venmo_blue_button_375x48.svg
209
+ - lib/generators/solidus_braintree/install/templates/app/assets/images/solidus_braintree/venmo/venmo_blue_logo.svg
210
+ - lib/generators/solidus_braintree/install/templates/app/assets/images/solidus_braintree/venmo/venmo_white_acceptance_mark.svg
211
+ - lib/generators/solidus_braintree/install/templates/app/assets/images/solidus_braintree/venmo/venmo_white_button_280x48.svg
212
+ - lib/generators/solidus_braintree/install/templates/app/assets/images/solidus_braintree/venmo/venmo_white_button_320x48.svg
213
+ - lib/generators/solidus_braintree/install/templates/app/assets/images/solidus_braintree/venmo/venmo_white_button_375x48.svg
214
+ - lib/generators/solidus_braintree/install/templates/app/assets/images/solidus_braintree/venmo/venmo_white_logo.svg
215
+ - lib/generators/solidus_braintree/install/templates/app/assets/javascripts/spree/frontend/paypal_button.js
216
+ - lib/generators/solidus_braintree/install/templates/app/assets/javascripts/spree/frontend/solidus_braintree.js
217
+ - lib/generators/solidus_braintree/install/templates/app/assets/javascripts/spree/frontend/solidus_braintree/ajax.js
218
+ - lib/generators/solidus_braintree/install/templates/app/assets/javascripts/spree/frontend/solidus_braintree/apple_pay_button.js
219
+ - lib/generators/solidus_braintree/install/templates/app/assets/javascripts/spree/frontend/solidus_braintree/checkout.js
220
+ - lib/generators/solidus_braintree/install/templates/app/assets/javascripts/spree/frontend/solidus_braintree/client.js
221
+ - lib/generators/solidus_braintree/install/templates/app/assets/javascripts/spree/frontend/solidus_braintree/constants.js
222
+ - lib/generators/solidus_braintree/install/templates/app/assets/javascripts/spree/frontend/solidus_braintree/frontend.js
223
+ - lib/generators/solidus_braintree/install/templates/app/assets/javascripts/spree/frontend/solidus_braintree/hosted_form.js
224
+ - lib/generators/solidus_braintree/install/templates/app/assets/javascripts/spree/frontend/solidus_braintree/paypal_button.js
225
+ - lib/generators/solidus_braintree/install/templates/app/assets/javascripts/spree/frontend/solidus_braintree/paypal_messaging.js
226
+ - lib/generators/solidus_braintree/install/templates/app/assets/javascripts/spree/frontend/solidus_braintree/promise.js
227
+ - lib/generators/solidus_braintree/install/templates/app/assets/javascripts/spree/frontend/solidus_braintree/venmo_button.js
228
+ - lib/generators/solidus_braintree/install/templates/app/assets/stylesheets/spree/frontend/solidus_braintree.scss
229
+ - lib/generators/solidus_braintree/install/templates/app/controllers/solidus_braintree/checkouts_controller.rb
230
+ - lib/generators/solidus_braintree/install/templates/app/controllers/solidus_braintree/transactions_controller.rb
231
+ - lib/generators/solidus_braintree/install/templates/app/helpers/solidus_braintree/braintree_checkout_helper.rb
232
+ - lib/generators/solidus_braintree/install/templates/app/views/checkouts/existing_payment/_braintree.html.erb
233
+ - lib/generators/solidus_braintree/install/templates/app/views/checkouts/payment/_braintree.html.erb
234
+ - lib/generators/solidus_braintree/install/templates/app/views/payments/_braintree_payment_details.html.erb
235
+ - lib/generators/solidus_braintree/install/templates/app/views/spree/shared/_apple_pay_button.html.erb
236
+ - lib/generators/solidus_braintree/install/templates/app/views/spree/shared/_braintree_errors.html.erb
237
+ - lib/generators/solidus_braintree/install/templates/app/views/spree/shared/_braintree_head_scripts.html.erb
238
+ - lib/generators/solidus_braintree/install/templates/app/views/spree/shared/_braintree_hosted_fields.html.erb
239
+ - lib/generators/solidus_braintree/install/templates/app/views/spree/shared/_paypal_cart_button.html.erb
240
+ - lib/generators/solidus_braintree/install/templates/app/views/spree/shared/_paypal_checkout_button.html.erb
241
+ - lib/generators/solidus_braintree/install/templates/app/views/spree/shared/_paypal_messaging.html.erb
242
+ - lib/generators/solidus_braintree/install/templates/app/views/spree/shared/_venmo_button.html.erb
243
+ - lib/generators/solidus_braintree/install/templates/config/initializers/solidus_braintree.rb
263
244
  - lib/solidus_braintree.rb
264
245
  - lib/solidus_braintree/country_mapper.rb
265
246
  - lib/solidus_braintree/engine.rb
266
247
  - lib/solidus_braintree/extension_configuration.rb
267
248
  - lib/solidus_braintree/request_protection.rb
268
- - lib/solidus_braintree/testing_support/factories.rb
269
249
  - lib/solidus_braintree/version.rb
270
250
  - lib/solidus_paypal_braintree.rb
271
251
  - lib/views/backend/solidus_braintree/configurations/list.html.erb
@@ -274,19 +254,11 @@ files:
274
254
  - lib/views/backend/spree/admin/shared/preference_fields/_preference_select.html.erb
275
255
  - lib/views/backend_v1.2/spree/admin/payments/source_forms/_braintree.html.erb
276
256
  - lib/views/backend_v2.4/spree/admin/shared/preference_fields/_hash.html.erb
277
- - lib/views/frontend/solidus_braintree/payments/_payment.html.erb
278
- - lib/views/frontend/spree/checkout/payment/_braintree.html.erb
279
- - lib/views/frontend/spree/shared/_paypal_checkout_button.html.erb
280
257
  - solidus_braintree.gemspec
281
258
  - spec/controllers/solidus_braintree/checkouts_controller_spec.rb
282
259
  - spec/controllers/solidus_braintree/client_tokens_controller_spec.rb
283
260
  - spec/controllers/solidus_braintree/configurations_controller_spec.rb
284
261
  - spec/controllers/solidus_braintree/transactions_controller_spec.rb
285
- - spec/features/backend/configuration_spec.rb
286
- - spec/features/backend/new_payment_spec.rb
287
- - spec/features/frontend/braintree_credit_card_checkout_spec.rb
288
- - spec/features/frontend/paypal_checkout_spec.rb
289
- - spec/features/frontend/venmo_checkout_spec.rb
290
262
  - spec/fixtures/cassettes/admin/invalid_credit_card.yml
291
263
  - spec/fixtures/cassettes/admin/resubmit_credit_card.yml
292
264
  - spec/fixtures/cassettes/admin/valid_credit_card.yml
@@ -319,7 +291,7 @@ files:
319
291
  - spec/fixtures/cassettes/source/last4.yml
320
292
  - spec/fixtures/cassettes/transaction/import/valid.yml
321
293
  - spec/fixtures/cassettes/transaction/import/valid/capture.yml
322
- - spec/fixtures/views/spree/orders/edit.html.erb
294
+ - spec/fixtures/views/carts/_cart_footer.html.erb
323
295
  - spec/helpers/solidus_braintree/braintree_admin_helper_spec.rb
324
296
  - spec/helpers/solidus_braintree/braintree_checkout_helper_spec.rb
325
297
  - spec/models/solidus_braintree/address_spec.rb
@@ -332,12 +304,19 @@ files:
332
304
  - spec/models/solidus_braintree/transaction_spec.rb
333
305
  - spec/models/spree/store_spec.rb
334
306
  - spec/requests/spree/api/orders_controller_spec.rb
335
- - spec/spec_helper.rb
336
- - spec/support/capybara.rb
337
- - spec/support/gateway_helpers.rb
338
- - spec/support/order_ready_for_payment.rb
339
- - spec/support/vcr.rb
340
- - spec/support/views.rb
307
+ - spec/solidus_braintree_helper.rb
308
+ - spec/support/solidus_braintree/capybara.rb
309
+ - spec/support/solidus_braintree/factories.rb
310
+ - spec/support/solidus_braintree/gateway_helpers.rb
311
+ - spec/support/solidus_braintree/order_ready_for_payment.rb
312
+ - spec/support/solidus_braintree/order_walkthrough.rb
313
+ - spec/support/solidus_braintree/vcr.rb
314
+ - spec/support/solidus_braintree/with_prepended_view_fixtures.rb
315
+ - spec/system/backend/configuration_spec.rb
316
+ - spec/system/backend/new_payment_spec.rb
317
+ - spec/system/frontend/braintree_credit_card_checkout_spec.rb
318
+ - spec/system/frontend/paypal_checkout_spec.rb
319
+ - spec/system/frontend/venmo_checkout_spec.rb
341
320
  homepage: https://github.com/solidusio/solidus_braintree
342
321
  licenses:
343
322
  - BSD-3-Clause
@@ -354,7 +333,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
354
333
  requirements:
355
334
  - - ">="
356
335
  - !ruby/object:Gem::Version
357
- version: '2.5'
336
+ version: '2.7'
358
337
  - - "<"
359
338
  - !ruby/object:Gem::Version
360
339
  version: '4'
@@ -373,11 +352,6 @@ test_files:
373
352
  - spec/controllers/solidus_braintree/client_tokens_controller_spec.rb
374
353
  - spec/controllers/solidus_braintree/configurations_controller_spec.rb
375
354
  - spec/controllers/solidus_braintree/transactions_controller_spec.rb
376
- - spec/features/backend/configuration_spec.rb
377
- - spec/features/backend/new_payment_spec.rb
378
- - spec/features/frontend/braintree_credit_card_checkout_spec.rb
379
- - spec/features/frontend/paypal_checkout_spec.rb
380
- - spec/features/frontend/venmo_checkout_spec.rb
381
355
  - spec/fixtures/cassettes/admin/invalid_credit_card.yml
382
356
  - spec/fixtures/cassettes/admin/resubmit_credit_card.yml
383
357
  - spec/fixtures/cassettes/admin/valid_credit_card.yml
@@ -410,7 +384,7 @@ test_files:
410
384
  - spec/fixtures/cassettes/source/last4.yml
411
385
  - spec/fixtures/cassettes/transaction/import/valid.yml
412
386
  - spec/fixtures/cassettes/transaction/import/valid/capture.yml
413
- - spec/fixtures/views/spree/orders/edit.html.erb
387
+ - spec/fixtures/views/carts/_cart_footer.html.erb
414
388
  - spec/helpers/solidus_braintree/braintree_admin_helper_spec.rb
415
389
  - spec/helpers/solidus_braintree/braintree_checkout_helper_spec.rb
416
390
  - spec/models/solidus_braintree/address_spec.rb
@@ -423,9 +397,16 @@ test_files:
423
397
  - spec/models/solidus_braintree/transaction_spec.rb
424
398
  - spec/models/spree/store_spec.rb
425
399
  - spec/requests/spree/api/orders_controller_spec.rb
426
- - spec/spec_helper.rb
427
- - spec/support/capybara.rb
428
- - spec/support/gateway_helpers.rb
429
- - spec/support/order_ready_for_payment.rb
430
- - spec/support/vcr.rb
431
- - spec/support/views.rb
400
+ - spec/solidus_braintree_helper.rb
401
+ - spec/support/solidus_braintree/capybara.rb
402
+ - spec/support/solidus_braintree/factories.rb
403
+ - spec/support/solidus_braintree/gateway_helpers.rb
404
+ - spec/support/solidus_braintree/order_ready_for_payment.rb
405
+ - spec/support/solidus_braintree/order_walkthrough.rb
406
+ - spec/support/solidus_braintree/vcr.rb
407
+ - spec/support/solidus_braintree/with_prepended_view_fixtures.rb
408
+ - spec/system/backend/configuration_spec.rb
409
+ - spec/system/backend/new_payment_spec.rb
410
+ - spec/system/frontend/braintree_credit_card_checkout_spec.rb
411
+ - spec/system/frontend/paypal_checkout_spec.rb
412
+ - spec/system/frontend/venmo_checkout_spec.rb
@@ -1,14 +0,0 @@
1
- // This is a manifest file that'll be compiled into including all the files listed below.
2
- // Add new JavaScript/Coffee code in separate files in this directory and they'll automatically
3
- // be included in the compiled file accessible from http://example.com/assets/application.js
4
- // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
5
- // the compiled file.
6
- //
7
- //= require solidus_braintree/constants
8
- //= require solidus_braintree/promise
9
- //= require solidus_braintree/client
10
- //= require solidus_braintree/hosted_form
11
- //= require solidus_braintree/paypal_button
12
- //= require solidus_braintree/paypal_messaging
13
- //= require solidus_braintree/apple_pay_button
14
- //= require solidus_braintree/venmo_button
@@ -1 +0,0 @@
1
- //= require solidus_braintree/frontend
@@ -1,11 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module SolidusBraintree
4
- module CheckoutControllerDecorator
5
- def self.prepended(base)
6
- base.helper ::SolidusBraintree::BraintreeCheckoutHelper
7
- end
8
-
9
- ::Spree::CheckoutController.prepend(self) if SolidusSupport.frontend_available?
10
- end
11
- end
@@ -1,11 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module SolidusBraintree
4
- module OrdersControllerDecorator
5
- def self.prepended(base)
6
- base.helper ::SolidusBraintree::BraintreeCheckoutHelper
7
- end
8
-
9
- ::Spree::OrdersController.prepend(self) if SolidusSupport.frontend_available?
10
- end
11
- end
@@ -1,9 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- Deface::Override.new(
4
- name: "payments/payment/add_paypal_funding_source_to_payment",
5
- virtual_path: "spree/payments/_payment",
6
- original: "0b5b5ae53626059cb3a202ef95d10827dd399925",
7
- insert_after: "erb[loud]:contains('content_tag(:span, payment.payment_method.name)')",
8
- partial: "solidus_braintree/payments/payment"
9
- )
@@ -1,10 +0,0 @@
1
- <tr id="<%= dom_id(wallet_payment_source, 'spree')%>" class="<%= cycle('even', 'odd') %>">
2
- <td>
3
- <%= radio_button_tag "order[wallet_payment_source_id]",
4
- wallet_payment_source.id,
5
- default,
6
- class: "existing-cc-radio" %>
7
- </td>
8
- <td><%= wallet_payment_source.payment_source.friendly_payment_type %></td>
9
- <td><%= wallet_payment_source.payment_source.display_number %></td>
10
- </tr>