solidus_paypal_braintree 1.2.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +0 -18
- data/CHANGELOG.md +9 -0
- data/README.md +9 -0
- data/lib/generators/solidus_paypal_braintree/install/install_generator.rb +2 -36
- data/lib/solidus_paypal_braintree/engine.rb +0 -56
- data/lib/solidus_paypal_braintree/version.rb +1 -1
- data/lib/solidus_paypal_braintree.rb +1 -6
- data/solidus_paypal_braintree.gemspec +7 -5
- data/spec/controllers/solidus_paypal_braintree/checkouts_controller_spec.rb +5 -5
- data/spec/controllers/solidus_paypal_braintree/client_tokens_controller_spec.rb +2 -2
- data/spec/controllers/solidus_paypal_braintree/configurations_controller_spec.rb +2 -2
- data/spec/controllers/solidus_paypal_braintree/transactions_controller_spec.rb +5 -5
- data/spec/features/backend/configuration_spec.rb +3 -3
- data/spec/features/backend/new_payment_spec.rb +1 -1
- data/spec/features/frontend/braintree_credit_card_checkout_spec.rb +3 -3
- data/spec/fixtures/views/spree/orders/edit.html.erb +1 -1
- data/spec/helpers/solidus_paypal_braintree/braintree_admin_helper_spec.rb +1 -1
- data/spec/helpers/solidus_paypal_braintree/braintree_checkout_helper_spec.rb +5 -5
- data/spec/models/solidus_paypal_braintree/address_spec.rb +1 -1
- data/spec/models/solidus_paypal_braintree/avs_result_spec.rb +1 -1
- data/spec/models/solidus_paypal_braintree/gateway_spec.rb +11 -11
- data/spec/models/solidus_paypal_braintree/response_spec.rb +1 -1
- data/spec/models/solidus_paypal_braintree/source_spec.rb +2 -2
- data/spec/models/solidus_paypal_braintree/transaction_address_spec.rb +1 -1
- data/spec/models/solidus_paypal_braintree/transaction_import_spec.rb +12 -12
- data/spec/models/solidus_paypal_braintree/transaction_spec.rb +2 -2
- data/spec/requests/spree/api/orders_controller_spec.rb +2 -2
- data/spec/spec_helper.rb +2 -2
- data/spec/support/gateway_helpers.rb +3 -3
- metadata +9 -174
- data/app/assets/config/solidus_paypal_braintree_manifest.js +0 -1
- data/app/assets/images/solidus_paypal_braintree/venmo/venmo_active_blue_button_280x48.svg +0 -19
- data/app/assets/images/solidus_paypal_braintree/venmo/venmo_active_blue_button_320x48.svg +0 -19
- data/app/assets/images/solidus_paypal_braintree/venmo/venmo_active_blue_button_375x48.svg +0 -19
- data/app/assets/images/solidus_paypal_braintree/venmo/venmo_active_white_button_280x48.svg +0 -19
- data/app/assets/images/solidus_paypal_braintree/venmo/venmo_active_white_button_320x48.svg +0 -19
- data/app/assets/images/solidus_paypal_braintree/venmo/venmo_active_white_button_375x48.svg +0 -19
- data/app/assets/images/solidus_paypal_braintree/venmo/venmo_blue_acceptance_mark.svg +0 -15
- data/app/assets/images/solidus_paypal_braintree/venmo/venmo_blue_button_280x48.svg +0 -19
- data/app/assets/images/solidus_paypal_braintree/venmo/venmo_blue_button_320x48.svg +0 -19
- data/app/assets/images/solidus_paypal_braintree/venmo/venmo_blue_button_375x48.svg +0 -19
- data/app/assets/images/solidus_paypal_braintree/venmo/venmo_blue_logo.svg +0 -18
- data/app/assets/images/solidus_paypal_braintree/venmo/venmo_white_acceptance_mark.svg +0 -20
- data/app/assets/images/solidus_paypal_braintree/venmo/venmo_white_button_280x48.svg +0 -19
- data/app/assets/images/solidus_paypal_braintree/venmo/venmo_white_button_320x48.svg +0 -19
- data/app/assets/images/solidus_paypal_braintree/venmo/venmo_white_button_375x48.svg +0 -19
- data/app/assets/images/solidus_paypal_braintree/venmo/venmo_white_logo.svg +0 -18
- data/app/assets/javascripts/solidus_paypal_braintree/apple_pay_button.js +0 -179
- data/app/assets/javascripts/solidus_paypal_braintree/checkout.js +0 -108
- data/app/assets/javascripts/solidus_paypal_braintree/client.js +0 -239
- data/app/assets/javascripts/solidus_paypal_braintree/constants.js +0 -89
- data/app/assets/javascripts/solidus_paypal_braintree/frontend.js +0 -14
- data/app/assets/javascripts/solidus_paypal_braintree/hosted_form.js +0 -46
- data/app/assets/javascripts/solidus_paypal_braintree/paypal_button.js +0 -178
- data/app/assets/javascripts/solidus_paypal_braintree/paypal_messaging.js +0 -22
- data/app/assets/javascripts/solidus_paypal_braintree/promise.js +0 -20
- data/app/assets/javascripts/solidus_paypal_braintree/venmo_button.js +0 -86
- data/app/assets/javascripts/spree/backend/solidus_paypal_braintree.js +0 -96
- data/app/assets/javascripts/spree/frontend/paypal_button.js +0 -34
- data/app/assets/javascripts/spree/frontend/solidus_paypal_braintree.js +0 -1
- data/app/assets/stylesheets/spree/backend/solidus_paypal_braintree.css +0 -4
- data/app/assets/stylesheets/spree/backend/solidus_paypal_braintree.scss +0 -28
- data/app/assets/stylesheets/spree/frontend/solidus_paypal_braintree.css +0 -51
- data/app/decorators/controllers/solidus_paypal_braintree/admin_payments_controller_decorator.rb +0 -11
- data/app/decorators/controllers/solidus_paypal_braintree/checkout_controller_decorator.rb +0 -11
- data/app/decorators/controllers/solidus_paypal_braintree/client_tokens_controller.rb +0 -41
- data/app/decorators/controllers/solidus_paypal_braintree/orders_controller_decorator.rb +0 -11
- data/app/decorators/models/solidus_paypal_braintree/spree/store_decorator.rb +0 -20
- data/app/decorators/models/solidus_paypal_braintree/spree/user_decorator.rb +0 -13
- data/app/helpers/solidus_paypal_braintree/braintree_admin_helper.rb +0 -23
- data/app/helpers/solidus_paypal_braintree/braintree_checkout_helper.rb +0 -60
- data/app/models/application_record.rb +0 -5
- data/app/models/solidus_paypal_braintree/address.rb +0 -64
- data/app/models/solidus_paypal_braintree/avs_result.rb +0 -69
- data/app/models/solidus_paypal_braintree/configuration.rb +0 -39
- data/app/models/solidus_paypal_braintree/customer.rb +0 -8
- data/app/models/solidus_paypal_braintree/gateway.rb +0 -433
- data/app/models/solidus_paypal_braintree/response.rb +0 -80
- data/app/models/solidus_paypal_braintree/source.rb +0 -135
- data/app/models/solidus_paypal_braintree/transaction.rb +0 -31
- data/app/models/solidus_paypal_braintree/transaction_address.rb +0 -88
- data/app/models/solidus_paypal_braintree/transaction_import.rb +0 -98
- data/app/overrides/spree/payments/payment/add_paypal_funding_source_to_payment.rb +0 -9
- data/app/views/spree/api/payments/source_views/_paypal_braintree.json.jbuilder +0 -3
- data/app/views/spree/checkout/existing_payment/_paypal_braintree.html.erb +0 -10
- data/app/views/spree/shared/_apple_pay_button.html.erb +0 -27
- data/app/views/spree/shared/_braintree_errors.html.erb +0 -16
- data/app/views/spree/shared/_braintree_hosted_fields.html.erb +0 -43
- data/app/views/spree/shared/_paypal_braintree_head_scripts.html.erb +0 -26
- data/app/views/spree/shared/_paypal_cart_button.html.erb +0 -38
- data/app/views/spree/shared/_paypal_messaging.html.erb +0 -13
- data/app/views/spree/shared/_venmo_button.html.erb +0 -33
- data/config/locales/en.yml +0 -96
- data/config/locales/it.yml +0 -56
- data/config/routes.rb +0 -14
- data/db/migrate/20160830061749_create_solidus_paypal_braintree_sources.rb +0 -16
- data/db/migrate/20160906201711_create_solidus_paypal_braintree_customers.rb +0 -13
- data/db/migrate/20161114231422_create_solidus_paypal_braintree_configurations.rb +0 -11
- data/db/migrate/20161125172005_add_braintree_configuration_to_stores.rb +0 -7
- data/db/migrate/20170203191030_add_credit_card_to_braintree_configuration.rb +0 -6
- data/db/migrate/20170505193712_add_null_constraint_to_sources.rb +0 -32
- data/db/migrate/20170508085402_add_not_null_constraint_to_sources_payment_type.rb +0 -11
- data/db/migrate/20190705115327_add_paypal_button_preferences_to_braintree_configurations.rb +0 -5
- data/db/migrate/20190911141712_add_3d_secure_to_braintree_configuration.rb +0 -5
- data/db/migrate/20211222170950_add_paypal_funding_source_to_solidus_paypal_braintree_sources.rb +0 -5
- data/db/migrate/20220104150301_add_venmo_to_braintree_configuration.rb +0 -5
- data/lib/controllers/backend/solidus_paypal_braintree/configurations_controller.rb +0 -48
- data/lib/controllers/frontend/solidus_paypal_braintree/checkouts_controller.rb +0 -31
- data/lib/controllers/frontend/solidus_paypal_braintree/transactions_controller.rb +0 -67
- data/lib/generators/solidus_paypal_braintree/install/templates/initializer.rb +0 -6
- data/lib/solidus_paypal_braintree/country_mapper.rb +0 -37
- data/lib/solidus_paypal_braintree/extension_configuration.rb +0 -23
- data/lib/solidus_paypal_braintree/request_protection.rb +0 -21
- data/lib/solidus_paypal_braintree/testing_support/factories.rb +0 -53
- data/lib/views/backend/solidus_paypal_braintree/configurations/list.html.erb +0 -63
- data/lib/views/backend/spree/admin/payments/source_forms/_paypal_braintree.html.erb +0 -16
- data/lib/views/backend/spree/admin/payments/source_views/_paypal_braintree.html.erb +0 -39
- data/lib/views/backend/spree/admin/shared/preference_fields/_preference_select.html.erb +0 -13
- data/lib/views/backend_v1.2/spree/admin/payments/source_forms/_paypal_braintree.html.erb +0 -16
- data/lib/views/backend_v2.4/spree/admin/shared/preference_fields/_hash.html.erb +0 -12
- data/lib/views/frontend/solidus_paypal_braintree/payments/_payment.html.erb +0 -12
- data/lib/views/frontend/spree/checkout/payment/_paypal_braintree.html.erb +0 -23
- data/lib/views/frontend/spree/shared/_paypal_checkout_button.html.erb +0 -32
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1c6085bc8f7520e1cc3af5df786810b9ff6b4f45403dff9072f51086d9afe0b6
|
4
|
+
data.tar.gz: e652de0bf5d7b517323f02c68b361d8ebf4d51c15f987dc188f6169e3ddfbecb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4323694d9f2478bd8839a6833591879a414e35639fbdd96a54a96bc5e8916e0ac39df525bc1f7aed7ac87039242651712429019c638dcffe8affc7a95215433a
|
7
|
+
data.tar.gz: e079058905f73cd30e4c8cc8dd846e1106160ccc36a1704adf7f081eb15612cd9c834bf67bcf16a351ac7f02b0cf6606e5d70e9ae1fb2bb360b1c4ea8c318701
|
data/.circleci/config.yml
CHANGED
@@ -21,27 +21,9 @@ jobs:
|
|
21
21
|
steps:
|
22
22
|
- browser-tools/install-browser-tools
|
23
23
|
- solidusio_extensions/run-tests
|
24
|
-
lint-code:
|
25
|
-
executor: solidusio_extensions/sqlite-memory
|
26
|
-
steps:
|
27
|
-
- browser-tools/install-browser-tools
|
28
|
-
- solidusio_extensions/lint-code
|
29
24
|
|
30
25
|
workflows:
|
31
26
|
"Run specs on supported Solidus versions":
|
32
27
|
jobs:
|
33
28
|
- run-specs-with-postgres
|
34
29
|
- run-specs-with-mysql
|
35
|
-
- lint-code
|
36
|
-
|
37
|
-
"Weekly run specs against master":
|
38
|
-
triggers:
|
39
|
-
- schedule:
|
40
|
-
cron: "0 0 * * 4" # every Thursday
|
41
|
-
filters:
|
42
|
-
branches:
|
43
|
-
only:
|
44
|
-
- master
|
45
|
-
jobs:
|
46
|
-
- run-specs-with-postgres
|
47
|
-
- run-specs-with-mysql
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,14 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## [v2.0.0](https://github.com/solidusio/solidus_paypal_braintree/tree/v1.2.0) (2023-03-20)
|
4
|
+
|
5
|
+
This extension is deprecated. This last version contains only a dependency to the new
|
6
|
+
recommended extension.
|
7
|
+
|
8
|
+
To upgrade, follow the instructions here:
|
9
|
+
|
10
|
+
https://github.com/solidusio/solidus_braintree/wiki/Upgrading-from-SolidusPaypalBraintree-To-SolidusBraintree
|
11
|
+
|
3
12
|
## [v1.2.0](https://github.com/solidusio/solidus_paypal_braintree/tree/v1.2.0) (2022-12-12)
|
4
13
|
|
5
14
|
[Full Changelog](https://github.com/solidusio/solidus_paypal_braintree/compare/v1.1.2...v1.2.0)
|
data/README.md
CHANGED
@@ -1,5 +1,14 @@
|
|
1
1
|
# SolidusPaypalBraintree
|
2
2
|
|
3
|
+
⛔️ This extension is archived. ⛔️
|
4
|
+
|
5
|
+
It has been renamed and moved to [solidus_braintree](https://github.com/solidusio/solidus_braintree).
|
6
|
+
|
7
|
+
If you were using this project, you can follow the [instructions to upgrade to the new extension](https://github.com/solidusio/solidus_braintree/wiki/Upgrading-from-SolidusPaypalBraintree-To-SolidusBraintree).
|
8
|
+
|
9
|
+
<hr>
|
10
|
+
<br>
|
11
|
+
|
3
12
|
[![CircleCI](https://circleci.com/gh/solidusio/solidus_paypal_braintree.svg?style=shield)](https://circleci.com/gh/solidusio/solidus_paypal_braintree)
|
4
13
|
[![codecov](https://codecov.io/gh/solidusio/solidus_paypal_braintree/branch/master/graph/badge.svg)](https://codecov.io/gh/solidusio/solidus_paypal_braintree)
|
5
14
|
|
@@ -1,42 +1,8 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
1
|
module SolidusPaypalBraintree
|
4
2
|
module Generators
|
5
3
|
class InstallGenerator < Rails::Generators::Base
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
def copy_initializer
|
10
|
-
template 'initializer.rb', 'config/initializers/solidus_paypal_braintree.rb'
|
11
|
-
end
|
12
|
-
|
13
|
-
def add_javascripts
|
14
|
-
append_file 'vendor/assets/javascripts/spree/frontend/all.js', "//= require spree/frontend/solidus_paypal_braintree\n" # rubocop:disable Layout/LineLength
|
15
|
-
append_file 'vendor/assets/javascripts/spree/backend/all.js', "//= require spree/backend/solidus_paypal_braintree\n" # rubocop:disable Layout/LineLength
|
16
|
-
end
|
17
|
-
|
18
|
-
def add_stylesheets
|
19
|
-
inject_into_file 'vendor/assets/stylesheets/spree/frontend/all.css', " *= require spree/frontend/solidus_paypal_braintree\n", before: %r{\*/}, verbose: true # rubocop:disable Layout/LineLength
|
20
|
-
inject_into_file 'vendor/assets/stylesheets/spree/backend/all.css', " *= require spree/backend/solidus_paypal_braintree\n", before: %r{\*/}, verbose: true # rubocop:disable Layout/LineLength
|
21
|
-
end
|
22
|
-
|
23
|
-
def add_migrations
|
24
|
-
run 'bin/rails railties:install:migrations FROM=solidus_paypal_braintree'
|
25
|
-
end
|
26
|
-
|
27
|
-
def mount_engine
|
28
|
-
insert_into_file File.join('config', 'routes.rb'), after: "Rails.application.routes.draw do\n" do
|
29
|
-
"mount SolidusPaypalBraintree::Engine, at: '/solidus_paypal_braintree'\n"
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
def run_migrations
|
34
|
-
run_migrations = options[:auto_run_migrations] || ['', 'y', 'Y'].include?(ask('Would you like to run the migrations now? [Y/n]')) # rubocop:disable Layout/LineLength
|
35
|
-
if run_migrations
|
36
|
-
run 'bin/rails db:migrate'
|
37
|
-
else
|
38
|
-
puts 'Skipping bin/rails db:migrate, don\'t forget to run it!' # rubocop:disable Rails/Output
|
39
|
-
end
|
4
|
+
def install_braintree
|
5
|
+
run 'bin/rails g solidus_braintree:install --auto_run_migrations=true'
|
40
6
|
end
|
41
7
|
end
|
42
8
|
end
|
@@ -9,61 +9,5 @@ module SolidusPaypalBraintree
|
|
9
9
|
|
10
10
|
isolate_namespace SolidusPaypalBraintree
|
11
11
|
engine_name 'solidus_paypal_braintree'
|
12
|
-
|
13
|
-
ActiveSupport::Inflector.inflections do |inflect|
|
14
|
-
inflect.acronym 'AVS'
|
15
|
-
end
|
16
|
-
|
17
|
-
initializer "register_solidus_paypal_braintree_gateway", after: "spree.register.payment_methods" do |app|
|
18
|
-
config.to_prepare do
|
19
|
-
app.config.spree.payment_methods << SolidusPaypalBraintree::Gateway
|
20
|
-
SolidusPaypalBraintree::Gateway.allowed_admin_form_preference_types.push(:preference_select).uniq!
|
21
|
-
::Spree::PermittedAttributes.source_attributes.concat([:nonce, :payment_type, :paypal_funding_source]).uniq!
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
if SolidusSupport.frontend_available?
|
26
|
-
config.assets.precompile += [
|
27
|
-
'solidus_paypal_braintree/checkout.js',
|
28
|
-
'solidus_paypal_braintree/frontend.js',
|
29
|
-
'spree/frontend/apple_pay_button.js',
|
30
|
-
'solidus_paypal_braintree_manifest.js'
|
31
|
-
]
|
32
|
-
paths["app/controllers"] << "lib/controllers/frontend"
|
33
|
-
paths["app/views"] << "lib/views/frontend"
|
34
|
-
end
|
35
|
-
|
36
|
-
if SolidusSupport.backend_available?
|
37
|
-
config.assets.precompile += ["spree/backend/solidus_paypal_braintree.js"]
|
38
|
-
paths["app/controllers"] << "lib/controllers/backend"
|
39
|
-
|
40
|
-
# We support Solidus v1.2, which requires some different markup in the
|
41
|
-
# source form partial. This will take precedence over lib/views/backend.
|
42
|
-
paths["app/views"] << "lib/views/backend_v1.2" if Spree.solidus_gem_version < Gem::Version.new('1.3')
|
43
|
-
|
44
|
-
# Solidus v2.4 introduced preference field partials but does not ship a hash field type.
|
45
|
-
# This is solved in Solidus v2.5.
|
46
|
-
if Spree.solidus_gem_version <= Gem::Version.new('2.5.0')
|
47
|
-
paths["app/views"] << "lib/views/backend_v2.4"
|
48
|
-
end
|
49
|
-
|
50
|
-
paths["app/views"] << "lib/views/backend"
|
51
|
-
|
52
|
-
initializer "solidus_paypal_braintree_admin_menu_item", after: "register_solidus_paypal_braintree_gateway" do
|
53
|
-
Spree::Backend::Config.configure do |config|
|
54
|
-
config.menu_items << config.class::MenuItem.new(
|
55
|
-
[:braintree],
|
56
|
-
'cc-paypal',
|
57
|
-
url: '/solidus_paypal_braintree/configurations/list',
|
58
|
-
condition: -> { can?(:list, SolidusPaypalBraintree::Configuration) }
|
59
|
-
)
|
60
|
-
end
|
61
|
-
end
|
62
|
-
end
|
63
|
-
|
64
|
-
# use rspec for tests
|
65
|
-
config.generators do |g|
|
66
|
-
g.test_framework :rspec
|
67
|
-
end
|
68
12
|
end
|
69
13
|
end
|
@@ -1,11 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require '
|
4
|
-
require 'solidus_support'
|
5
|
-
|
6
|
-
require 'solidus_paypal_braintree/country_mapper'
|
7
|
-
require 'solidus_paypal_braintree/request_protection'
|
8
|
-
require 'solidus_paypal_braintree/extension_configuration'
|
3
|
+
require 'solidus_braintree'
|
9
4
|
require 'solidus_paypal_braintree/version'
|
10
5
|
require 'solidus_paypal_braintree/engine'
|
11
6
|
|
@@ -29,11 +29,13 @@ Gem::Specification.new do |spec|
|
|
29
29
|
spec.executables = files.grep(%r{^exe/}) { |f| File.basename(f) }
|
30
30
|
spec.require_paths = ["lib"]
|
31
31
|
|
32
|
-
spec.add_dependency '
|
33
|
-
spec.
|
34
|
-
|
35
|
-
|
36
|
-
|
32
|
+
spec.add_dependency 'solidus_braintree', '~> 2.0'
|
33
|
+
spec.post_install_message = %q{
|
34
|
+
ACTION REQUIRED: This extension has been renamed to solidus_braintree.
|
35
|
+
|
36
|
+
To upgrade to the new name, follow the instructions here:
|
37
|
+
https://github.com/solidusio/solidus_braintree/wiki/Upgrading-from-SolidusPaypalBraintree-To-SolidusBraintree
|
38
|
+
}
|
37
39
|
|
38
40
|
spec.add_development_dependency 'rails-controller-testing'
|
39
41
|
spec.add_development_dependency 'solidus_dev_support', '~> 2.5'
|
@@ -1,8 +1,8 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
require 'support/order_ready_for_payment'
|
3
3
|
|
4
|
-
RSpec.describe
|
5
|
-
routes {
|
4
|
+
RSpec.describe SolidusBraintree::CheckoutsController, type: :controller do
|
5
|
+
routes { SolidusBraintree::Engine.routes }
|
6
6
|
|
7
7
|
include_context 'when order is ready for payment'
|
8
8
|
|
@@ -18,7 +18,7 @@ RSpec.describe SolidusPaypalBraintree::CheckoutsController, type: :controller do
|
|
18
18
|
"payment_method_id" => payment_method.id,
|
19
19
|
"source_attributes" => {
|
20
20
|
"nonce" => "fake-paypal-billing-agreement-nonce",
|
21
|
-
"payment_type" =>
|
21
|
+
"payment_type" => SolidusBraintree::Source::PAYPAL
|
22
22
|
}
|
23
23
|
}
|
24
24
|
],
|
@@ -54,7 +54,7 @@ RSpec.describe SolidusPaypalBraintree::CheckoutsController, type: :controller do
|
|
54
54
|
|
55
55
|
it 'creates a payment source' do
|
56
56
|
expect { patch_update }.
|
57
|
-
to change(
|
57
|
+
to change(SolidusBraintree::Source, :count).
|
58
58
|
from(0).
|
59
59
|
to(1)
|
60
60
|
end
|
@@ -92,7 +92,7 @@ RSpec.describe SolidusPaypalBraintree::CheckoutsController, type: :controller do
|
|
92
92
|
end
|
93
93
|
|
94
94
|
it "does not change the number of sources in the system" do
|
95
|
-
expect{ patch_update }.not_to(change(
|
95
|
+
expect{ patch_update }.not_to(change(SolidusBraintree::Source, :count))
|
96
96
|
end
|
97
97
|
end
|
98
98
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe
|
4
|
-
routes {
|
3
|
+
describe SolidusBraintree::ClientTokensController do
|
4
|
+
routes { SolidusBraintree::Engine.routes }
|
5
5
|
|
6
6
|
cassette_options = { cassette_name: "braintree/token" }
|
7
7
|
describe "POST create", vcr: cassette_options do
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe
|
4
|
-
routes {
|
3
|
+
describe SolidusBraintree::ConfigurationsController, type: :controller do
|
4
|
+
routes { SolidusBraintree::Engine.routes }
|
5
5
|
|
6
6
|
let!(:store_1) { create :store }
|
7
7
|
let!(:store_2) { create :store }
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
RSpec.describe
|
4
|
-
routes {
|
3
|
+
RSpec.describe SolidusBraintree::TransactionsController, type: :controller do
|
4
|
+
routes { SolidusBraintree::Engine.routes }
|
5
5
|
|
6
6
|
let!(:country) { create :country }
|
7
7
|
let(:line_item) { create :line_item, price: 50 }
|
@@ -37,7 +37,7 @@ RSpec.describe SolidusPaypalBraintree::TransactionsController, type: :controller
|
|
37
37
|
{
|
38
38
|
transaction: {
|
39
39
|
nonce: "fake-valid-nonce",
|
40
|
-
payment_type:
|
40
|
+
payment_type: SolidusBraintree::Source::PAYPAL,
|
41
41
|
phone: "1112223333",
|
42
42
|
email: "batman@example.com",
|
43
43
|
address_attributes: {
|
@@ -62,7 +62,7 @@ RSpec.describe SolidusPaypalBraintree::TransactionsController, type: :controller
|
|
62
62
|
|
63
63
|
it "raises a validation error" do
|
64
64
|
expect { post_create }.to raise_error(
|
65
|
-
|
65
|
+
SolidusBraintree::TransactionsController::InvalidImportError,
|
66
66
|
"Import invalid: " \
|
67
67
|
"Address is invalid, " \
|
68
68
|
"Address City can't be blank"
|
@@ -159,7 +159,7 @@ RSpec.describe SolidusPaypalBraintree::TransactionsController, type: :controller
|
|
159
159
|
context "when format is HTML" do
|
160
160
|
it "raises an error including the validation messages" do
|
161
161
|
expect { post_create }.to raise_error(
|
162
|
-
|
162
|
+
SolidusBraintree::TransactionsController::InvalidImportError,
|
163
163
|
"Import invalid: Email can't be blank"
|
164
164
|
)
|
165
165
|
end
|
@@ -5,15 +5,15 @@ RSpec.describe "viewing the configuration interface" do
|
|
5
5
|
|
6
6
|
# Regression to ensure this page still renders on old versions of solidus
|
7
7
|
it "doesn't raise any errors due to unavailable route helpers" do
|
8
|
-
visit "/
|
8
|
+
visit "/solidus_braintree/configurations/list"
|
9
9
|
expect(page).to have_content("Braintree Configurations")
|
10
10
|
end
|
11
11
|
|
12
12
|
# Regression to ensure this page renders on Solidus 2.4
|
13
13
|
it "doesn't raise any errors due to unavailable preference field partial" do
|
14
|
-
Rails.application.config.spree.payment_methods <<
|
14
|
+
Rails.application.config.spree.payment_methods << SolidusBraintree::Gateway
|
15
15
|
Spree::PaymentMethod.create!(
|
16
|
-
type: '
|
16
|
+
type: 'SolidusBraintree::Gateway',
|
17
17
|
name: 'Braintree Payments'
|
18
18
|
)
|
19
19
|
visit '/admin/payment_methods'
|
@@ -14,7 +14,7 @@ shared_context "with backend checkout setup" do
|
|
14
14
|
store.braintree_configuration.update!(credit_card: true)
|
15
15
|
end
|
16
16
|
|
17
|
-
allow_any_instance_of(
|
17
|
+
allow_any_instance_of(SolidusBraintree::Source).to receive(:nonce).and_return("fake-valid-nonce")
|
18
18
|
|
19
19
|
# Order and payment numbers must be identical between runs to re-use the VCR
|
20
20
|
# cassette
|
@@ -40,7 +40,7 @@ shared_context "with frontend checkout setup" do
|
|
40
40
|
allow_any_instance_of(Spree::CheckoutController).to receive_messages(try_spree_current_user: user)
|
41
41
|
allow_any_instance_of(Spree::CheckoutController).to receive_messages(spree_current_user: user)
|
42
42
|
allow_any_instance_of(Spree::Payment).to receive(:number).and_return("123ABC")
|
43
|
-
allow_any_instance_of(
|
43
|
+
allow_any_instance_of(SolidusBraintree::Source).to receive(:nonce).and_return("fake-valid-nonce")
|
44
44
|
|
45
45
|
visit spree.checkout_state_path(:delivery)
|
46
46
|
click_button "Save and Continue"
|
@@ -141,7 +141,7 @@ describe 'entering credit card details', type: :feature, js: true do
|
|
141
141
|
end
|
142
142
|
|
143
143
|
it "displays an alert with a meaningful error message" do
|
144
|
-
expect(page).to have_text I18n.t("
|
144
|
+
expect(page).to have_text I18n.t("solidus_braintree.errors.empty_fields")
|
145
145
|
expect(page).to have_selector("input[type='submit']:enabled")
|
146
146
|
end
|
147
147
|
|
@@ -151,7 +151,7 @@ describe 'entering credit card details', type: :feature, js: true do
|
|
151
151
|
expect(page).to have_selector("input[type='submit']:enabled")
|
152
152
|
|
153
153
|
click_button "Save and Continue"
|
154
|
-
expect(page).to have_text I18n.t("
|
154
|
+
expect(page).to have_text I18n.t("solidus_braintree.errors.empty_fields")
|
155
155
|
end
|
156
156
|
end
|
157
157
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
RSpec.describe
|
3
|
+
RSpec.describe SolidusBraintree::BraintreeCheckoutHelper do
|
4
4
|
let!(:store) { create :store }
|
5
5
|
let(:braintree_configuration) { {} }
|
6
6
|
|
@@ -36,7 +36,7 @@ RSpec.describe SolidusPaypalBraintree::BraintreeCheckoutHelper do
|
|
36
36
|
let(:active) { false }
|
37
37
|
|
38
38
|
it 'returns the correct url' do
|
39
|
-
expect(subject).to match(%r[\A/assets/
|
39
|
+
expect(subject).to match(%r[\A/assets/solidus_braintree/venmo/venmo_white_button_280x48-.+\.svg])
|
40
40
|
end
|
41
41
|
end
|
42
42
|
|
@@ -45,7 +45,7 @@ RSpec.describe SolidusPaypalBraintree::BraintreeCheckoutHelper do
|
|
45
45
|
let(:active) { true }
|
46
46
|
|
47
47
|
it 'returns the correct url' do
|
48
|
-
expect(subject).to match(%r[\A/assets/
|
48
|
+
expect(subject).to match(%r[\A/assets/solidus_braintree/venmo/venmo_active_white_button_280x48-.+\.svg])
|
49
49
|
end
|
50
50
|
end
|
51
51
|
|
@@ -54,7 +54,7 @@ RSpec.describe SolidusPaypalBraintree::BraintreeCheckoutHelper do
|
|
54
54
|
let(:active) { false }
|
55
55
|
|
56
56
|
it 'returns the correct url' do
|
57
|
-
expect(subject).to match(%r[\A/assets/
|
57
|
+
expect(subject).to match(%r[\A/assets/solidus_braintree/venmo/venmo_blue_button_320x48-.+\.svg])
|
58
58
|
end
|
59
59
|
end
|
60
60
|
|
@@ -63,7 +63,7 @@ RSpec.describe SolidusPaypalBraintree::BraintreeCheckoutHelper do
|
|
63
63
|
let(:active) { true }
|
64
64
|
|
65
65
|
it 'returns the correct url' do
|
66
|
-
expect(subject).to match(%r[\A/assets/
|
66
|
+
expect(subject).to match(%r[\A/assets/solidus_braintree/venmo/venmo_active_blue_button_320x48-.+\.svg])
|
67
67
|
end
|
68
68
|
end
|
69
69
|
end
|
@@ -2,7 +2,7 @@ require 'spec_helper'
|
|
2
2
|
require 'webmock'
|
3
3
|
require 'support/order_ready_for_payment'
|
4
4
|
|
5
|
-
RSpec.describe
|
5
|
+
RSpec.describe SolidusBraintree::Gateway do
|
6
6
|
let(:gateway) do
|
7
7
|
new_gateway.tap(&:save)
|
8
8
|
end
|
@@ -12,7 +12,7 @@ RSpec.describe SolidusPaypalBraintree::Gateway do
|
|
12
12
|
let(:user) { create :user }
|
13
13
|
|
14
14
|
let(:source) do
|
15
|
-
|
15
|
+
SolidusBraintree::Source.create!(
|
16
16
|
nonce: 'fake-valid-nonce',
|
17
17
|
user: user,
|
18
18
|
payment_type: payment_type,
|
@@ -20,7 +20,7 @@ RSpec.describe SolidusPaypalBraintree::Gateway do
|
|
20
20
|
)
|
21
21
|
end
|
22
22
|
|
23
|
-
let(:payment_type) {
|
23
|
+
let(:payment_type) { SolidusBraintree::Source::PAYPAL }
|
24
24
|
|
25
25
|
describe "saving preference hashes as strings" do
|
26
26
|
subject { gateway.update(update_params) }
|
@@ -159,7 +159,7 @@ RSpec.describe SolidusPaypalBraintree::Gateway do
|
|
159
159
|
describe "#method_type" do
|
160
160
|
subject { gateway.method_type }
|
161
161
|
|
162
|
-
it { is_expected.to eq "
|
162
|
+
it { is_expected.to eq "braintree" }
|
163
163
|
end
|
164
164
|
|
165
165
|
describe '#gateway_options' do
|
@@ -281,7 +281,7 @@ RSpec.describe SolidusPaypalBraintree::Gateway do
|
|
281
281
|
cassette_name: 'gateway/authorize/credit_card/address',
|
282
282
|
match_requests_on: [:braintree_uri]
|
283
283
|
} do
|
284
|
-
let(:payment_type) {
|
284
|
+
let(:payment_type) { SolidusBraintree::Source::CREDIT_CARD }
|
285
285
|
|
286
286
|
it 'includes the billing address in the request' do
|
287
287
|
expect_any_instance_of(Braintree::TransactionGateway).to receive(:sale).
|
@@ -509,7 +509,7 @@ RSpec.describe SolidusPaypalBraintree::Gateway do
|
|
509
509
|
}
|
510
510
|
context "with no existing customer profile", vcr: cassette_options do
|
511
511
|
it 'creates and returns a new customer profile', aggregate_failures: true do
|
512
|
-
expect(profile).to be_a
|
512
|
+
expect(profile).to be_a SolidusBraintree::Customer
|
513
513
|
expect(profile.sources).to eq [source]
|
514
514
|
expect(profile.braintree_customer_id).to be_present
|
515
515
|
end
|
@@ -601,7 +601,7 @@ RSpec.describe SolidusPaypalBraintree::Gateway do
|
|
601
601
|
let(:other_payment_method) { FactoryBot.create(:payment_method) }
|
602
602
|
|
603
603
|
let(:source_without_profile) do
|
604
|
-
|
604
|
+
SolidusBraintree::Source.create!(
|
605
605
|
payment_method_id: gateway.id,
|
606
606
|
payment_type: payment_type,
|
607
607
|
user_id: user.id
|
@@ -609,7 +609,7 @@ RSpec.describe SolidusPaypalBraintree::Gateway do
|
|
609
609
|
end
|
610
610
|
|
611
611
|
let(:source_with_profile) do
|
612
|
-
|
612
|
+
SolidusBraintree::Source.create!(
|
613
613
|
payment_method_id: gateway.id,
|
614
614
|
payment_type: payment_type,
|
615
615
|
user_id: user.id
|
@@ -677,7 +677,7 @@ RSpec.describe SolidusPaypalBraintree::Gateway do
|
|
677
677
|
let(:user) { FactoryBot.create(:user) }
|
678
678
|
|
679
679
|
let!(:source_without_profile) do
|
680
|
-
|
680
|
+
SolidusBraintree::Source.create!(
|
681
681
|
payment_method_id: gateway.id,
|
682
682
|
payment_type: payment_type,
|
683
683
|
user_id: user.id
|
@@ -685,7 +685,7 @@ RSpec.describe SolidusPaypalBraintree::Gateway do
|
|
685
685
|
end
|
686
686
|
|
687
687
|
let!(:source_with_profile) do
|
688
|
-
|
688
|
+
SolidusBraintree::Source.create!(
|
689
689
|
payment_method_id: gateway.id,
|
690
690
|
payment_type: payment_type,
|
691
691
|
user_id: user.id
|
@@ -736,7 +736,7 @@ RSpec.describe SolidusPaypalBraintree::Gateway do
|
|
736
736
|
gateway
|
737
737
|
end
|
738
738
|
|
739
|
-
it { expect { subject }.to raise_error
|
739
|
+
it { expect { subject }.to raise_error SolidusBraintree::Gateway::TokenGenerationDisabledError }
|
740
740
|
end
|
741
741
|
end
|
742
742
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
RSpec.describe
|
3
|
+
RSpec.describe SolidusBraintree::Source, type: :model do
|
4
4
|
include_context 'when order is ready for payment'
|
5
5
|
|
6
6
|
it 'is invalid without a payment_type set' do
|
@@ -13,7 +13,7 @@ RSpec.describe SolidusPaypalBraintree::Source, type: :model do
|
|
13
13
|
|
14
14
|
describe 'attributes' do
|
15
15
|
context 'with paypal_funding_source' do
|
16
|
-
subject { build(:
|
16
|
+
subject { build(:solidus_braintree_source, :paypal) }
|
17
17
|
|
18
18
|
it 'can be nil' do
|
19
19
|
subject.paypal_funding_source = nil
|