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
@@ -1,50 +0,0 @@
1
- <!-- Modified cart view with PayPal button, from solidus_braintree -->
2
-
3
- <% @body_id = 'cart' %>
4
- <div data-hook="cart_container">
5
- <h1><%= t('spree.shopping_cart') %></h1>
6
-
7
- <% if @order.line_items.empty? %>
8
-
9
- <div data-hook="empty_cart">
10
- <p><%= t('spree.your_cart_is_empty') %></p>
11
- <p><%= link_to t('spree.continue_shopping'), products_path, class: 'button continue' %></p>
12
- </div>
13
-
14
- <% else %>
15
-
16
- <div data-hook="outside_cart_form">
17
- <%= form_for @order, url: update_cart_path, html: {id: 'update-cart'} do |order_form| %>
18
- <div data-hook="inside_cart_form">
19
-
20
- <div data-hook="cart_items">
21
- <%= render 'form', order_form: order_form %>
22
- </div>
23
-
24
- <div class="links columns sixteen alpha omega" data-hook="cart_buttons">
25
- <%= order_form.text_field :coupon_code, size: 10, placeholder: t('spree.coupon_code') %>
26
- <%= button_tag class: 'primary', id: 'update-button' do %>
27
- <%= t('spree.update') %>
28
- <% end %>
29
- <%= button_tag class: 'button checkout primary', id: 'checkout-link', name: 'checkout' do %>
30
- <%= t('spree.checkout') %>
31
- <% end %>
32
- </div>
33
-
34
- </div>
35
- <% end %>
36
- </div>
37
-
38
- <div id="empty-cart" data-hook>
39
- <%= form_tag empty_cart_path, method: :put do %>
40
- <p id="clear_cart_link" data-hook>
41
- <%= submit_tag t('spree.empty_cart'), class: 'button gray' %>
42
- <%= t('spree.or') %>
43
- <%= link_to t('spree.continue_shopping'), products_path, class: 'continue button gray' %>
44
- </p>
45
- <% end %>
46
- </div>
47
-
48
- <%= render "spree/shared/paypal_cart_button" %>
49
- <% end %>
50
- </div>
data/spec/spec_helper.rb DELETED
@@ -1,32 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # Configure Rails Environment
4
- ENV['RAILS_ENV'] = 'test'
5
-
6
- # Run Coverage report
7
- require 'solidus_dev_support/rspec/coverage'
8
- require 'rails-controller-testing'
9
-
10
- # Create the dummy app if it's still missing.
11
- dummy_env = "#{__dir__}/dummy/config/environment.rb"
12
- system 'bin/rake extension:test_app' unless File.exist? dummy_env
13
- require dummy_env
14
-
15
- # Requires factories and other useful helpers defined in spree_core.
16
- require 'solidus_dev_support/rspec/feature_helper'
17
-
18
- # Requires supporting ruby files with custom matchers and macros, etc,
19
- # in spec/support/ and its subdirectories.
20
- Dir["#{__dir__}/support/**/*.rb"].sort.each { |f| require f }
21
-
22
- # Requires factories defined in lib/solidus_braintree/testing_support/factories.rb
23
- SolidusDevSupport::TestingSupport::Factories.load_for(SolidusBraintree::Engine)
24
-
25
- RSpec.configure do |config|
26
- config.infer_spec_type_from_file_location!
27
- config.use_transactional_fixtures = false
28
-
29
- if Spree.solidus_gem_version < Gem::Version.new('2.11')
30
- config.extend Spree::TestingSupport::AuthorizationHelpers::Request, type: :system
31
- end
32
- end
@@ -1 +0,0 @@
1
- ApplicationController.prepend_view_path "spec/fixtures/views"
File without changes