Compare commits

...

40 Commits

Author SHA1 Message Date
Andy Brett
5d39155519 Merge pull request #7739 from openfoodfoundation/dependabot/bundler/rails-6.0.3.7
Bump rails from 6.0.3.6 to 6.0.3.7
2021-06-04 07:18:59 -07:00
dependabot[bot]
b6c9d4d6a9 Bump rails from 6.0.3.6 to 6.0.3.7
Bumps [rails](https://github.com/rails/rails) from 6.0.3.6 to 6.0.3.7.
- [Release notes](https://github.com/rails/rails/releases)
- [Commits](https://github.com/rails/rails/compare/v6.0.3.6...v6.0.3.7)

---
updated-dependencies:
- dependency-name: rails
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-06-04 05:30:32 +00:00
Maikel
0c92a594f4 Merge pull request #7717 from coopdevs/fix-docker-jemalloc-sidekiq
Fix docker Jemalloc + Sidekiq setup
2021-06-04 13:16:53 +10:00
Maikel
4dacdb180f Merge pull request #7617 from luisramos0/layout61
[Rails 6.1] Make admin layout path relative
2021-06-04 12:26:40 +10:00
Andy Brett
c1ad4243bb Update all locales with the latest Transifex translations 2021-06-03 18:21:21 -07:00
Andy Brett
9f3ddfc88b Merge pull request #7735 from Matt-Yorkley/bootsnap-reloaded
Add bootsnap gem (again)
2021-06-03 12:54:22 -07:00
Matt-Yorkley
67d7d225cc Add bootsnap gem 2021-06-03 19:03:18 +01:00
Andy Brett
24edad15ae Merge pull request #7727 from openfoodfoundation/dependabot/bundler/view_component-2.33.0
Bump view_component from 2.32.0 to 2.33.0
2021-06-03 09:57:36 -07:00
Andy Brett
6d56a0791f Merge pull request #7728 from Matt-Yorkley/papertrail-deprecation
Remove papertrail initializer
2021-06-03 09:52:56 -07:00
dependabot[bot]
cd1d77c572 Bump view_component from 2.32.0 to 2.33.0
Bumps [view_component](https://github.com/github/view_component) from 2.32.0 to 2.33.0.
- [Release notes](https://github.com/github/view_component/releases)
- [Changelog](https://github.com/github/view_component/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/view_component/compare/v2.32.0...v2.33.0)

---
updated-dependencies:
- dependency-name: view_component
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-06-03 16:43:45 +00:00
Andy Brett
2dddd625a1 Merge pull request #7554 from luisramos0/rails6
[Rails 6.0] Upgrade to rails 6.0
2021-06-03 09:42:33 -07:00
Matt-Yorkley
5b676e8f93 Remove papertrail initializer
This setting is now deprecated and triggers this message:

Association Tracking for PaperTrail has been extracted to a separate gem. To use it, please add `paper_trail-association_tracking` to your Gemfile. If you don't use it (most people don't, that's the default) and you set `track_associations = false` somewhere (probably a rails initializer) you can remove that line now.
2021-06-03 11:33:33 +01:00
Pau Perez
5d91f5f398 Document Redis as a requirement 2021-06-03 10:11:05 +02:00
Pau Pérez Fabregat
62959cc883 Merge pull request #7724 from openfoodfoundation/transifex
Transifex
2021-06-03 09:34:51 +02:00
Andy Brett
bab4b404f4 Merge pull request #7722 from openfoodfoundation/dependabot/npm_and_yarn/karma-6.3.3
Bump karma from 6.3.2 to 6.3.3
2021-06-02 15:01:46 -07:00
Andy Brett
5ecd24d66a Merge pull request #7721 from openfoodfoundation/dependabot/bundler/rubocop-1.16.0
Bump rubocop from 1.15.0 to 1.16.0
2021-06-02 15:00:55 -07:00
Transifex-Openfoodnetwork
db373a826b Updating translations for config/locales/en_IE.yml 2021-06-03 02:38:20 +10:00
dependabot[bot]
1ddfd2a4f7 Bump karma from 6.3.2 to 6.3.3
Bumps [karma](https://github.com/karma-runner/karma) from 6.3.2 to 6.3.3.
- [Release notes](https://github.com/karma-runner/karma/releases)
- [Changelog](https://github.com/karma-runner/karma/blob/master/CHANGELOG.md)
- [Commits](https://github.com/karma-runner/karma/compare/v6.3.2...v6.3.3)

---
updated-dependencies:
- dependency-name: karma
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-06-02 05:32:51 +00:00
dependabot[bot]
d972f6e041 Bump rubocop from 1.15.0 to 1.16.0
Bumps [rubocop](https://github.com/rubocop/rubocop) from 1.15.0 to 1.16.0.
- [Release notes](https://github.com/rubocop/rubocop/releases)
- [Changelog](https://github.com/rubocop/rubocop/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rubocop/rubocop/compare/v1.15.0...v1.16.0)

---
updated-dependencies:
- dependency-name: rubocop
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-06-02 05:12:04 +00:00
Luis Ramos
cf756c5774 Added action cable to gemfile by running bundle install
After rebase Action cable was missing from Gemfile.lock
2021-06-01 22:34:04 +01:00
Luis Ramos
4252bd0bb1 For some reason report helper is not available on this view now, so we call Spree::Money directly 2021-06-01 22:34:04 +01:00
Luis Ramos
cb6e626193 Remove require rails/all, this is already done in application.rb where we are loading only the rails modules we need 2021-06-01 22:34:04 +01:00
Andy Brett
77c384633b specify payment intent ID in stripe stub 2021-06-01 22:34:04 +01:00
Luis Ramos
64de303b59 Move compass-rails back to 4.0
This must have been a mistake when managing initial conflicts in rails6 branch
2021-06-01 22:34:04 +01:00
Matt-Yorkley
88cae21ab4 Disable currently unused modules and add notes
We should migrate to ActiveStorage soon, but we're not using it yet. ActionText is cool but we also don't currently use it. ActionMailbox is not something we need at all.
2021-06-01 22:34:04 +01:00
Matt-Yorkley
66e4986944 Bring modules list from rails/all to application.rb
This is the default list in Rails 6.0
2021-06-01 22:34:04 +01:00
Andy Brett
b3e08b47b9 set Stripe api key directly instead of using allow 2021-06-01 22:33:12 +01:00
Luis Ramos
85508f45b4 Replace be_success on test_reponse with status 200
In rails 6 response.success? is not supported.
2021-06-01 22:33:12 +01:00
Luis Ramos
f07cc32be0 Remove authorization token from stripe stubs 2021-06-01 22:33:12 +01:00
Luis Ramos
2c43522bf9 change devise config to use secret_key_Base instead of secret_token as pepper 2021-06-01 22:33:12 +01:00
Luis Ramos
adf35f8e18 Fix sass-rails compass-rails compatibility problem 2021-06-01 22:33:12 +01:00
Luis Ramos
04ff4fa47c Update to rails 6.0 and resolve Gemfile conflicts 2021-06-01 22:33:12 +01:00
Matt-Yorkley
0d30e3359f Merge pull request #7081 from openfoodfoundation/dependabot/bundler/database_cleaner-2.0.1
Bump database_cleaner from 1.99.0 to 2.0.1
2021-06-01 21:59:27 +02:00
Matt-Yorkley
30e2be13f0 Update spec/lib/open_food_network/i18n_config_spec.rb 2021-06-01 18:50:04 +01:00
Luis Ramos
dc1cdf4254 Add required DB cleaner setup code 2021-06-01 18:50:04 +01:00
dependabot[bot]
c4bd9208ce Bump database_cleaner from 1.99.0 to 2.0.1
Bumps [database_cleaner](https://github.com/DatabaseCleaner/database_cleaner) from 1.99.0 to 2.0.1.
- [Release notes](https://github.com/DatabaseCleaner/database_cleaner/releases)
- [Changelog](https://github.com/DatabaseCleaner/database_cleaner/blob/main/History.rdoc)
- [Commits](https://github.com/DatabaseCleaner/database_cleaner/compare/v1.99.0...v2.0.1)

Signed-off-by: dependabot[bot] <support@github.com>
2021-06-01 18:50:04 +01:00
Pau Perez
07fd5cb29c Configure Sidekiq in development also 2021-05-31 17:04:14 +02:00
Pau Perez
ee7da14019 Provide Redis docker container 2021-05-31 17:04:14 +02:00
Pau Perez
e5adbf1f08 Fix jemalloc installation 2021-05-31 16:54:35 +02:00
Luis Ramos
b265fbf9a0 Remove initial slash from admin layout, this fixes a problem with layouts cant be loaded from absolute paths 2021-05-11 22:34:15 +01:00
38 changed files with 271 additions and 138 deletions

View File

@@ -30,6 +30,7 @@ ENV PATH /usr/local/src/rbenv/shims:/usr/local/src/rbenv/bin:$PATH
ENV RBENV_ROOT /usr/local/src/rbenv
ENV CONFIGURE_OPTS --disable-install-doc
ENV BUNDLE_PATH /bundles
ENV LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libjemalloc.so
WORKDIR /usr/src/app
COPY .ruby-version .

View File

@@ -8,6 +8,7 @@ The fastest way to make it work locally is to use Docker, you only need to setup
Otherwise, for a local setup you will need:
* Ruby and bundler (check current Ruby version in [.ruby-version](https://github.com/openfoodfoundation/openfoodnetwork/blob/master/.ruby-version) file)
* PostgreSQL database
* Redis (for background jobs)
* Chrome (for testing)
The following guides will provide OS-specific step-by-step instructions to get these requirements installed:

16
Gemfile
View File

@@ -4,15 +4,15 @@ source 'https://rubygems.org'
ruby "2.5.9"
git_source(:github) { |repo_name| "https://github.com/#{repo_name}.git" }
gem 'rails', '~> 5.2'
gem 'rails', '~> 6.0.3.7'
gem 'activemerchant', '>= 1.78.0'
gem 'angular-rails-templates', '>= 0.3.0'
gem 'awesome_nested_set'
gem 'ransack', '2.4.1'
gem 'responders'
gem 'sass', '<= 4.7.1'
gem 'sass-rails', '< 6.0.0'
gem 'sass', '~> 3.4.0' # this restriction originates from foundation-rails's version
gem 'sass-rails', '< 5.1.0' # this restriction originates from the compass-rails's version
gem 'i18n'
gem 'i18n-js', '~> 3.8.3'
@@ -20,8 +20,8 @@ gem 'rails-i18n'
gem 'rails_safe_tasks', '~> 1.0'
gem "activerecord-import"
gem "db2fog", github: "openfoodfoundation/db2fog", branch: "rails-5"
gem "fog-aws", ">= 0.6.0"
gem "db2fog", github: "openfoodfoundation/db2fog", branch: "rails-6"
gem "fog-aws", "~> 2.0" # db2fog does not support v3
gem "catalog", path: "./engines/catalog"
gem 'dfc_provider', path: './engines/dfc_provider'
@@ -69,6 +69,7 @@ gem "active_model_serializers", "0.8.4"
gem 'activerecord-session_store'
gem 'acts-as-taggable-on', '~> 7.0'
gem 'angularjs-file-upload-rails', '~> 2.4.1'
gem 'bootsnap', require: false
gem 'custom_error_message', github: 'jeremydurham/custom-err-msg'
gem 'dalli'
gem 'figaro'
@@ -79,7 +80,7 @@ gem 'paper_trail', '~> 10.3.1'
gem 'paperclip', '~> 3.4.1'
gem 'rack-rewrite'
gem 'rack-ssl', require: 'rack/ssl'
gem 'roadie-rails', '~> 2.2.0'
gem 'roadie-rails'
gem 'redis', '>= 4.0', require: ['redis', 'redis/connection/hiredis']
gem 'hiredis'
@@ -113,6 +114,9 @@ gem 'jquery-migrate-rails'
gem 'jquery-rails', '4.4.0'
gem 'jquery-ui-rails', '~> 4.2'
gem 'select2-rails', '~> 3.4.7'
# Thor v0.20 works with both select2-rails 3.4.7 and railties 6.0.3.6
# To upgrade to thor v1 we need to upgrade select2-rails to v3.5 which requires some work
gem 'thor', '~> 0.20'
gem 'ofn-qz', github: 'openfoodfoundation/ofn-qz', branch: 'ofn-rails-4'

View File

@@ -6,13 +6,13 @@ GIT
GIT
remote: https://github.com/openfoodfoundation/db2fog.git
revision: 8ceef362c64e6573d62d26db5ebb0c0f33cd3d61
branch: rails-5
revision: 5b63343847452f52aa42f7fc169d6ab3af57cda3
branch: rails-6
specs:
db2fog (0.9.1)
activerecord (>= 3.2.0, < 6.0)
db2fog (0.9.2)
activerecord (>= 3.2.0, < 7.0)
fog-core (~> 1.0)
rails (>= 3.2.0, < 6.0)
rails (>= 3.2.0, < 7.0)
GIT
remote: https://github.com/openfoodfoundation/ofn-qz.git
@@ -48,47 +48,61 @@ GEM
remote: https://rubygems.org/
specs:
Ascii85 (1.1.0)
actioncable (5.2.6)
actionpack (= 5.2.6)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
actionmailer (5.2.6)
actionpack (= 5.2.6)
actionview (= 5.2.6)
activejob (= 5.2.6)
actioncable (6.0.3.7)
actionpack (= 6.0.3.7)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
actionmailbox (6.0.3.7)
actionpack (= 6.0.3.7)
activejob (= 6.0.3.7)
activerecord (= 6.0.3.7)
activestorage (= 6.0.3.7)
activesupport (= 6.0.3.7)
mail (>= 2.7.1)
actionmailer (6.0.3.7)
actionpack (= 6.0.3.7)
actionview (= 6.0.3.7)
activejob (= 6.0.3.7)
mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 2.0)
actionpack (5.2.6)
actionview (= 5.2.6)
activesupport (= 5.2.6)
actionpack (6.0.3.7)
actionview (= 6.0.3.7)
activesupport (= 6.0.3.7)
rack (~> 2.0, >= 2.0.8)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.2)
rails-html-sanitizer (~> 1.0, >= 1.2.0)
actionpack-action_caching (1.2.2)
actionpack (>= 4.0.0)
actionview (5.2.6)
activesupport (= 5.2.6)
actiontext (6.0.3.7)
actionpack (= 6.0.3.7)
activerecord (= 6.0.3.7)
activestorage (= 6.0.3.7)
activesupport (= 6.0.3.7)
nokogiri (>= 1.8.5)
actionview (6.0.3.7)
activesupport (= 6.0.3.7)
builder (~> 3.1)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.3)
rails-html-sanitizer (~> 1.1, >= 1.2.0)
active_model_serializers (0.8.4)
activemodel (>= 3.0)
activejob (5.2.6)
activesupport (= 5.2.6)
activejob (6.0.3.7)
activesupport (= 6.0.3.7)
globalid (>= 0.3.6)
activemerchant (1.119.0)
activesupport (>= 4.2)
builder (>= 2.1.2, < 4.0.0)
i18n (>= 0.6.9)
nokogiri (~> 1.4)
activemodel (5.2.6)
activesupport (= 5.2.6)
activerecord (5.2.6)
activemodel (= 5.2.6)
activesupport (= 5.2.6)
arel (>= 9.0)
activemodel (6.0.3.7)
activesupport (= 6.0.3.7)
activerecord (6.0.3.7)
activemodel (= 6.0.3.7)
activesupport (= 6.0.3.7)
activerecord-import (1.1.0)
activerecord (>= 3.2)
activerecord-postgresql-adapter (0.0.1)
@@ -99,15 +113,17 @@ GEM
multi_json (~> 1.11, >= 1.11.2)
rack (>= 2.0.8, < 3)
railties (>= 5.2.4.1)
activestorage (5.2.6)
actionpack (= 5.2.6)
activerecord (= 5.2.6)
activestorage (6.0.3.7)
actionpack (= 6.0.3.7)
activejob (= 6.0.3.7)
activerecord (= 6.0.3.7)
marcel (~> 1.0.0)
activesupport (5.2.6)
activesupport (6.0.3.7)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 0.7, < 2)
minitest (~> 5.1)
tzinfo (~> 1.1)
zeitwerk (~> 2.2, >= 2.2.2)
acts-as-taggable-on (7.0.0)
activerecord (>= 5.0, < 6.2)
acts_as_list (1.0.4)
@@ -124,7 +140,6 @@ GEM
railties (>= 3, < 7)
angularjs-file-upload-rails (2.4.1)
angularjs-rails (1.5.5)
arel (9.0.0)
ast (2.4.2)
awesome_nested_set (3.4.0)
activerecord (>= 4.0.0, < 7.0)
@@ -135,6 +150,8 @@ GEM
json (~> 1.4)
nokogiri (~> 1)
bcrypt (3.1.16)
bootsnap (1.7.5)
msgpack (~> 1.0)
bugsnag (6.20.0)
concurrent-ruby (~> 1.0)
builder (3.2.4)
@@ -194,7 +211,12 @@ GEM
addressable
daemons (1.4.0)
dalli (2.7.11)
database_cleaner (1.99.0)
database_cleaner (2.0.1)
database_cleaner-active_record (~> 2.0.0)
database_cleaner-active_record (2.0.0)
activerecord (>= 5.a)
database_cleaner-core (~> 2.0.0)
database_cleaner-core (2.0.1)
ddtrace (0.49.0)
ffi (~> 1.0)
msgpack
@@ -220,18 +242,22 @@ GEM
erubi (1.10.0)
et-orbi (1.2.4)
tzinfo
excon (0.79.0)
excon (0.81.0)
execjs (2.7.0)
factory_bot (6.2.0)
activesupport (>= 5.0.0)
factory_bot_rails (6.2.0)
factory_bot (~> 6.2.0)
railties (>= 5.0.0)
faraday (1.3.0)
faraday (1.4.1)
faraday-excon (~> 1.1)
faraday-net_http (~> 1.0)
faraday-net_http_persistent (~> 1.1)
multipart-post (>= 1.2, < 3)
ruby2_keywords
ruby2_keywords (>= 0.0.4)
faraday-excon (1.1.0)
faraday-net_http (1.0.1)
faraday-net_http_persistent (1.1.0)
ffaker (2.18.0)
ffi (1.15.0)
figaro (1.2.0)
@@ -325,11 +351,11 @@ GEM
kgio (2.11.3)
knapsack (1.22.0)
rake
launchy (2.4.3)
addressable (~> 2.3)
launchy (2.5.0)
addressable (~> 2.7)
letter_opener (1.7.0)
launchy (~> 2.2)
libv8-node (15.14.0.0)
libv8-node (15.14.0.1)
loofah (2.9.1)
crass (~> 1.0.2)
nokogiri (>= 1.5.9)
@@ -339,12 +365,12 @@ GEM
method_source (1.0.0)
mime-types (3.3.1)
mime-types-data (~> 3.2015)
mime-types-data (3.2020.1104)
mime-types-data (3.2021.0225)
mimemagic (0.4.3)
nokogiri (~> 1)
rake
mini_mime (1.1.0)
mini_portile2 (2.5.1)
mini_portile2 (2.5.3)
mini_racer (0.4.0)
libv8-node (~> 15.14.0.0)
minitest (5.14.4)
@@ -357,7 +383,7 @@ GEM
multi_xml (0.6.0)
multipart-post (2.1.1)
nio4r (2.5.7)
nokogiri (1.11.4)
nokogiri (1.11.7)
mini_portile2 (~> 2.5.0)
racc (~> 1.4)
oauth2 (1.4.7)
@@ -394,12 +420,12 @@ GEM
ttfunk
pg (1.2.3)
power_assert (2.0.0)
pry (0.13.1)
pry (0.14.1)
coderay (~> 1.1)
method_source (~> 1.0)
pry-byebug (3.9.0)
pry-byebug (3.8.0)
byebug (~> 11.0)
pry (~> 0.13.0)
pry (~> 0.10)
public_suffix (4.0.6)
raabro (1.4.0)
racc (1.5.2)
@@ -413,18 +439,20 @@ GEM
rack
rack-test (1.1.0)
rack (>= 1.0, < 3)
rails (5.2.6)
actioncable (= 5.2.6)
actionmailer (= 5.2.6)
actionpack (= 5.2.6)
actionview (= 5.2.6)
activejob (= 5.2.6)
activemodel (= 5.2.6)
activerecord (= 5.2.6)
activestorage (= 5.2.6)
activesupport (= 5.2.6)
rails (6.0.3.7)
actioncable (= 6.0.3.7)
actionmailbox (= 6.0.3.7)
actionmailer (= 6.0.3.7)
actionpack (= 6.0.3.7)
actiontext (= 6.0.3.7)
actionview (= 6.0.3.7)
activejob (= 6.0.3.7)
activemodel (= 6.0.3.7)
activerecord (= 6.0.3.7)
activestorage (= 6.0.3.7)
activesupport (= 6.0.3.7)
bundler (>= 1.3.0)
railties (= 5.2.6)
railties (= 6.0.3.7)
sprockets-rails (>= 2.0.0)
rails-controller-testing (1.0.5)
actionpack (>= 5.0.1.rc1)
@@ -435,16 +463,16 @@ GEM
nokogiri (>= 1.6)
rails-html-sanitizer (1.3.0)
loofah (~> 2.3)
rails-i18n (5.1.3)
rails-i18n (6.0.0)
i18n (>= 0.7, < 2)
railties (>= 5.0, < 6)
railties (>= 6.0.0, < 7)
rails_safe_tasks (1.0.0)
railties (5.2.6)
actionpack (= 5.2.6)
activesupport (= 5.2.6)
railties (6.0.3.7)
actionpack (= 6.0.3.7)
activesupport (= 6.0.3.7)
method_source
rake (>= 0.8.7)
thor (>= 0.19.0, < 2.0)
thor (>= 0.20.3, < 2.0)
rainbow (3.0.0)
raindrops (0.19.1)
rake (13.0.3)
@@ -452,7 +480,7 @@ GEM
activerecord (>= 5.2.4)
activesupport (>= 5.2.4)
i18n
rb-fsevent (0.10.4)
rb-fsevent (0.11.0)
rb-inotify (0.10.1)
ffi (~> 1.0)
redcarpet (3.5.1)
@@ -509,16 +537,16 @@ GEM
rswag-ui (2.4.0)
actionpack (>= 3.1, < 7.0)
railties (>= 3.1, < 7.0)
rubocop (1.15.0)
rubocop (1.16.0)
parallel (~> 1.10)
parser (>= 3.0.0.0)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
rexml
rubocop-ast (>= 1.5.0, < 2.0)
rubocop-ast (>= 1.7.0, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 3.0)
rubocop-ast (1.5.0)
rubocop-ast (1.7.0)
parser (>= 3.0.1.1)
rubocop-rails (2.10.1)
activesupport (>= 4.2.0)
@@ -526,13 +554,13 @@ GEM
rubocop (>= 1.7.0, < 2.0)
ruby-progressbar (1.11.0)
ruby-rc4 (0.1.5)
ruby2_keywords (0.0.2)
ruby2_keywords (0.0.4)
rubyzip (2.3.0)
rufus-scheduler (3.7.0)
fugit (~> 1.1, >= 1.1.6)
sass (3.4.25)
sass-rails (5.0.7)
railties (>= 4.0.0, < 6)
sass-rails (5.0.8)
railties (>= 5.2.0)
sass (~> 3.1)
sprockets (>= 2.8, < 4.0)
sprockets-rails (>= 2.0, < 4.0)
@@ -561,7 +589,7 @@ GEM
simplecov-html (~> 0.11)
simplecov_json_formatter (~> 0.1)
simplecov-html (0.12.3)
simplecov_json_formatter (0.1.2)
simplecov_json_formatter (0.1.3)
spring (2.1.1)
spring-commands-rspec (1.0.4)
spring (>= 0.9.1)
@@ -580,7 +608,7 @@ GEM
activerecord (>= 5.1)
state_machines-activemodel (>= 0.8.0)
stringex (2.8.5)
stripe (5.30.0)
stripe (5.32.1)
temple (0.8.2)
test-prof (1.0.5)
test-unit (3.4.2)
@@ -606,8 +634,8 @@ GEM
unicorn-worker-killer (0.4.5)
get_process_mem (~> 0)
unicorn (>= 4, < 7)
uniform_notifier (1.14.1)
view_component (2.32.0)
uniform_notifier (1.14.2)
view_component (2.33.0)
activesupport (>= 5.0.0, < 7.0)
view_component_storybook (0.8.0)
view_component (>= 2.2)
@@ -621,7 +649,7 @@ GEM
addressable (>= 2.3.6)
crack (>= 0.3.2)
hashdiff (>= 0.4.0, < 2.0.0)
websocket-driver (0.7.3)
websocket-driver (0.7.4)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.5)
whenever (1.0.0)
@@ -632,6 +660,7 @@ GEM
xml-simple (1.1.8)
xpath (3.2.0)
nokogiri (~> 1.8)
zeitwerk (2.4.2)
PLATFORMS
ruby
@@ -653,6 +682,7 @@ DEPENDENCIES
awesome_nested_set
awesome_print
aws-sdk (= 1.67.0)
bootsnap
bugsnag
bullet
byebug
@@ -681,7 +711,7 @@ DEPENDENCIES
flipper
flipper-active_record
flipper-ui
fog-aws (>= 0.6.0)
fog-aws (~> 2.0)
foundation-icons-sass-rails
foundation-rails (= 5.5.2.1)
fuubar (~> 2.5.1)
@@ -720,7 +750,7 @@ DEPENDENCIES
rack-mini-profiler (< 3.0.0)
rack-rewrite
rack-ssl
rails (~> 5.2)
rails (~> 6.0.3.7)
rails-controller-testing
rails-i18n
rails_safe_tasks (~> 1.0)
@@ -728,15 +758,15 @@ DEPENDENCIES
redcarpet
redis (>= 4.0)
responders
roadie-rails (~> 2.2.0)
roadie-rails
roo (~> 2.8.3)
rspec-rails (>= 3.5.2)
rspec-retry
rswag
rubocop
rubocop-rails
sass (<= 4.7.1)
sass-rails (< 6.0.0)
sass (~> 3.4.0)
sass-rails (< 5.1.0)
select2-rails (~> 3.4.7)
selenium-webdriver
shoulda-matchers
@@ -750,6 +780,7 @@ DEPENDENCIES
stripe
test-prof
test-unit (~> 3.4)
thor (~> 0.20)
timecop
uglifier (>= 1.0.3)
unicorn-rails

View File

@@ -12,7 +12,7 @@ module Spree
helper 'enterprise_fees'
helper 'angular_form'
layout '/spree/layouts/admin'
layout 'spree/layouts/admin'
include I18nHelper

View File

@@ -152,7 +152,7 @@
%th.final_weight_volume{ 'ng-show' => 'columns.final_weight_volume.visible' }
= t("admin.orders.bulk_management.weight_volume")
%th.price{ 'ng-show' => 'columns.price.visible' }
= "#{t('admin.price')} (#{currency_symbol})"
= "#{t('admin.price')} (#{Spree::Money.currency_symbol})"
%th.actions
%th.actions
= t("admin.orders.bulk_management.ask")

View File

@@ -1,6 +1,25 @@
require_relative 'boot'
require 'rails/all'
require "rails"
[
"active_record/railtie",
#"active_storage/engine",
"action_controller/railtie",
"action_view/railtie",
"action_mailer/railtie",
"active_job/railtie",
#"action_cable/engine", # Enable this when installing StimulusReflex
#"action_mailbox/engine",
#"action_text/engine",
"rails/test_unit/railtie",
"sprockets/railtie" # Disable this after migrating to Webpacker
].each do |railtie|
begin
require railtie
rescue LoadError
end
end
require_relative "../lib/open_food_network/i18n_config"
require_relative '../lib/spree/core/environment'

View File

@@ -4,3 +4,4 @@ require 'rubygems'
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
require 'bootsnap/setup'

View File

@@ -40,7 +40,7 @@ Devise.setup do |config|
config.stretches = Rails.env.test? ? 1 : 20
# Setup a pepper to generate the encrypted password.
config.pepper = Rails.configuration.secret_token
config.pepper = Rails.configuration.secret_key_base
# ==> Configuration for :confirmable
# The time you want to give your user to confirm his account. During this time

View File

@@ -1 +0,0 @@
PaperTrail.config.track_associations = false

View File

@@ -1,11 +1,9 @@
if Rails.env.production? || Rails.env.staging?
redis_jobs_url = ENV.fetch("OFN_REDIS_JOBS_URL", "redis://localhost:6381/0")
redis_jobs_url = ENV.fetch("OFN_REDIS_JOBS_URL", "redis://localhost:6381/0")
Sidekiq.configure_server do |config|
config.redis = { url: redis_jobs_url, network_timeout: 5 }
end
Sidekiq.configure_client do |config|
config.redis = { url: redis_jobs_url, network_timeout: 5 }
end
Sidekiq.configure_server do |config|
config.redis = { url: redis_jobs_url, network_timeout: 5 }
end
Sidekiq.configure_client do |config|
config.redis = { url: redis_jobs_url, network_timeout: 5 }
end

View File

@@ -317,6 +317,8 @@ en_IE:
height: "Height"
width: "Width"
depth: "Depth"
payment_could_not_process: "The payment could not be processed"
payment_could_not_complete: "The payment could not be completed"
actions:
create_and_add_another: "Create and Add Another"
create: "Create"
@@ -1566,6 +1568,7 @@ en_IE:
email_order_summary_includes_tax: "(includes tax):"
email_payment_paid: PAID
email_payment_not_paid: NOT PAID
email_payment_description: Payment Description at Checkout
email_payment_summary: Payment summary
email_payment_method: "Paying via:"
email_so_placement_intro_html: "You have a new order with <strong>%{distributor}</strong>"

View File

@@ -119,6 +119,7 @@ es_US:
updated_not_active: "Su contraseña ha sido restablecida, pero su correo electrónico aún no ha sido confirmado."
updated: "Su contraseña ha sido cambiada con éxito. Ya tienes la sesión iniciada."
send_instructions: "Recibirás un correo electrónico con instrucciones sobre cómo confirmar su cuenta en unos minutos."
item_description: "Descripción del artículo"
models:
order_cycle:
cloned_order_cycle_name: "COPIA DE %{order_cycle}"
@@ -127,6 +128,9 @@ es_US:
open_street_map_enabled: "Open Street Map activado"
open_street_map_default_latitude: "latitud por defecto en Open Street Map"
open_street_map_default_longitude: "longitud por defecto en Open Street Map"
open_street_map_provider_name: "nombre del proveedor de Open Street Map"
open_street_map_provider_options: "opciones de proveedor de Open Street Map"
resume_order: "Reanudar pedido"
sku: "SKU"
subtotal: "Subtotal"
tax_rate: "% Impuestos"
@@ -155,6 +159,7 @@ es_US:
producer_mailer:
order_cycle:
subject: "Informe Ciclo de Pedido para %{producer}"
provider_settings: "Configuración de proveedor"
shipment_mailer:
shipped_email:
dear_customer: "Estimada consumidora,"
@@ -1082,6 +1087,7 @@ es_US:
index:
title: "Suscripciones"
new: "Nueva suscripción"
issue: "Asunto"
new:
title: "Nueva suscripción"
edit:
@@ -1195,8 +1201,11 @@ es_US:
terms_and_conditions:
message_html: "Acepto el %{terms_and_conditions_link} del vendedor."
link_text: "Términos y Condiciones"
platform_terms_of_service:
terms_of_service: "La latitud y longitud son necesarias para mostrar su empresa en el mapa."
all_terms_and_conditions:
terms_and_conditions: "Términos y Condiciones"
terms_of_service: "La latitud y longitud son necesarios para mostrar su empresa en el mapa."
failed: "La finalización de compra falló, por favor comunicate con nosotros para procesar la orden."
shops:
hubs:
@@ -1861,6 +1870,7 @@ es_US:
details:
title: "Detalles"
headline: "Empecemos"
enterprise: "Bueno! Primero necesitamos saber un poco más acerca de tu empresa"
producer: "Primero necesitamos saber un poco sobre tu productora:"
enterprise_name_field: "Nombre de la organización:"
producer_name_field: "Nombre de la productora:"
@@ -2436,6 +2446,7 @@ es_US:
Ha habido un problema al añadir este producto en el carrito. Puede que haya
dejado de estar disponible o que la tinda haya cerrado.
admin:
unit_price_tooltip: "El precio unitario aumenta la transparencia al permitir a sus clientes comparar fácilmente los precios entre diferentes productos y tamaños de empaque. Tenga en cuenta que el precio unitario final que se muestra en la tienda puede diferir, ya que incluye impuestos y comisiones."
enterprise_limit_reached: "Has alcanzado el límite estándar de organizaciones por cuenta. Escriba a %{contact_email} si necesita aumentarlo."
modals:
got_it: "Lo entiendo"
@@ -2914,18 +2925,48 @@ es_US:
previous: "Anterior"
last: "Último"
spree:
add_country: "Agregar país"
add_state: "Agregar estado"
all: "Todos"
back_to_adjustments_list: "Regresar a ajustes"
back_to_users_list: "Regresar a usuarios"
back_to_zones_list: "Regresar a zonas"
card_code: "Código de la tarjeta"
card_number: "Número de tarjeta"
category: "Categoría"
created_successfully: "Creado con éxito"
credit: "Crédito"
editing_tax_category: "Editar categoría de impuestos"
editing_tax_rate: "Editar tasa de impuestos"
editing_zone: "Editar zona"
expiration: "Vencimiento"
invalid_payment_provider: "Proveedor de pago no válido"
items_cannot_be_shipped: "Estos artículos no pueden ser enviados"
gateway_config_unavailable: "Configuración de puerta de enlace no disponible"
gateway_error: "Pago fallido"
more: "Más"
new_adjustment: "Nuevo ajuste"
new_order_completed: "Nuevo pedido completado"
new_tax_category: "Nueva categoría de impuestos"
new_user: "Nuevo usuario"
no_pending_payments: "No tiene pagos pendientes"
none: "Ninguno"
not_found: "no encontrado"
notice_messages:
variant_deleted: "Variante eliminada"
or: "O"
order_processed_successfully: "Pedido procesado con éxito"
payment_method_not_supported: "Método de pago no admitido"
resend_authorization_email: "Reenviar email de autorización"
server_error: "Error del Servidor"
tree: "Árbol"
updating: "Actualizando"
your_order_is_empty_add_product: "Su pedido está vacío, busque y añada un producto arriba"
add_product: "Añadir Producto"
name_or_sku: "Nombre o código SKU (ingrese al menos los primeros 4 caracteres del nombre del producto)"
resend: "Reenviar"
back_to_orders_list: "Volver a la lista de pedidos"
back_to_payments_list: "Regresar a la lista de pagos"
return_authorizations: "Autorizaciones de devolución"
cannot_create_returns: "No se pueden crear devoluciones ya que este pedido no tiene unidades enviadas."
select_stock: "Seleccionar stock"
@@ -2947,6 +2988,7 @@ es_US:
tracking_number: "Número de seguimiento"
order_total: "Total del pedido"
customer_details: "Detalles de la consumidora"
customer_details_updated: "Detalles del consumir actualizados"
customer_search: "Búsqueda de consumidores"
choose_a_customer: "Elige una consumidora "
account: "Cuenta"
@@ -3098,6 +3140,7 @@ es_US:
payment_processing_failed: "No se pudo procesar el pago, por favor verifique los detalles que introdujo"
not_available: "No disponible"
sku: "SKU"
there_are_no_items_for_this_order: "No hay artículos para este pedido."
order_populator:
out_of_stock: '%{item} está agotado.'
actions:
@@ -3125,7 +3168,15 @@ es_US:
login_nav:
header:
store: Tienda
validation:
must_be_int: "debe ser un entero"
admin:
mail_methods:
send_testmail: "Enviar email de prueba"
testmail:
delivery_success: "email de prueba enviado"
error: "Ha ocurrido un error para el envío del email de prueba."
unit_price_tooltip: "El precio unitario aumenta la transparencia al permitir a sus clientes comparar fácilmente los precios entre diferentes productos y tamaños de empaque. Tenga en cuenta que el precio unitario final que se muestra en la tienda puede diferir, ya que incluye impuestos y comisiones."
subscriptions:
number: "Número"
tab:
@@ -3196,6 +3247,8 @@ es_US:
received: "recibido"
canceled: "cancelado"
orders:
add_product:
cannot_add_item_to_canceled_order: "No se puede agregar un artículo a un pedido cancelado"
index:
listing_orders: "Pedidos de listado"
new_order: "Nuevo pedido"
@@ -3238,6 +3291,9 @@ es_US:
overview:
enterprises_header:
ofn_with_tip: Las Organizaciones son Productoras y/o Grupos y son la unidad básica de organización dentro de la Open Food Network.
enterprise_row:
has_no_payment_methods: "no tiene métodos de pago"
has_no_shipping_methods: "No tiene métodos de envío"
products:
active_products:
zero: "No tienes ningún producto activo"
@@ -3358,6 +3414,7 @@ es_US:
unit_name: "Nombre de la unidad"
price: "Precio"
unit_price: "Precio por unidad"
unit_price_legend: "Calculado a partir del precio del artículo"
on_hand: "Disponibles"
on_demand: "Bajo demanda"
product_description: "Descripción del producto"
@@ -3463,6 +3520,7 @@ es_US:
cookies_consent_banner_toggle: "Mostrar el banner de consentimiento de cookies"
privacy_policy_url: "Vínculo con la Política de privacidad"
enterprises_require_tos: "Las organizaciones deben aceptar los Términos del Servicio"
shoppers_require_tos: "Los compradores tienen que aceptar los Términos y Condiciones de Servicio"
cookies_policy_matomo_section: "Mostrar la sección de Matomo en la página de política de cookies"
footer_tos_url: "URL de términos y servicios"
checkout:
@@ -3500,6 +3558,7 @@ es_US:
pending: pendiente
ready: Listo
shipped: enviado
canceled: cancelado
payment_states:
balance_due: saldo debido
completed: completado
@@ -3621,6 +3680,8 @@ es_US:
past_orders: Pedidos anteriores
transactions:
transaction_history: Historial de transacciones
authorisation_required: Autorización requerida
authorise: Autorizar
open_orders:
order: Pedido
shop: Tienda
@@ -3672,3 +3733,6 @@ es_US:
spree/payment:
one: Pago
other: Pagos
datetime:
distance_in_words:
half_a_minute: medio minuto

View File

@@ -12,6 +12,8 @@ services:
- 5432:5432
volumes:
- 'postgres:/var/lib/postgresql/data'
redis:
image: redis
web:
tty: true
stdin_open: true
@@ -25,8 +27,11 @@ services:
- ./config/application.yml.example:/usr/src/app/config/application.yml
depends_on:
- db
- redis
environment:
OFN_DB_HOST: db
OFN_REDIS_URL: redis://redis/
OFN_REDIS_JOBS_URL: redis://redis
command: >
bash -c "wait-for-it -t 30 db:5432 &&
rm -f tmp/pids/server.pid &&
@@ -44,8 +49,11 @@ services:
- ./config/application.yml.example:/usr/src/app/config/application.yml
depends_on:
- db
- redis
environment:
OFN_DB_HOST: db
OFN_REDIS_URL: redis://redis
OFN_REDIS_JOBS_URL: redis://redis
command: >
bash -c "wait-for-it -t 30 db:5432 &&
(bundle check || bundle install)

View File

@@ -1,6 +1,5 @@
# frozen_string_literal: true
require 'rails/all'
require 'active_merchant'
require 'acts_as_list'
require 'awesome_nested_set'

View File

@@ -13,7 +13,7 @@
"@storybook/addon-docs": "^6.2.9",
"@storybook/server": "^6.2.9",
"jasmine-core": "~2.4.1",
"karma": "~6.3.2",
"karma": "~6.3.3",
"karma-chrome-launcher": "~3.1.0",
"karma-coffee-preprocessor": "~1.0.1",
"karma-jasmine": "~0.3.8"

View File

@@ -6,7 +6,7 @@ describe Admin::StripeAccountsController, type: :controller do
let(:enterprise) { create(:distributor_enterprise) }
before do
allow(Stripe).to receive(:client_id) { "some_id" }
Stripe.client_id = "some_id"
end
describe "#connect" do
@@ -86,7 +86,7 @@ describe Admin::StripeAccountsController, type: :controller do
end
before do
allow(Stripe).to receive(:api_key) { "sk_test_12345" }
Stripe.api_key = "sk_test_12345"
Spree::Config.set(stripe_connect_enabled: false)
end

View File

@@ -30,7 +30,7 @@ describe Admin::StripeConnectSettingsController, type: :controller do
context "when a Stripe API key is not set" do
before do
allow(Stripe).to receive(:api_key) { nil }
Stripe.api_key = nil
end
it "sets the account status to :empty_api_key_error_html" do
@@ -42,7 +42,7 @@ describe Admin::StripeConnectSettingsController, type: :controller do
context "when a Stripe API key is set" do
before do
allow(Stripe).to receive(:api_key) { "sk_test_xxxx" }
Stripe.api_key = "sk_test_xxxx"
end
context "and the request to retrieve Stripe account info fails" do

View File

@@ -153,7 +153,7 @@ describe CheckoutController, type: :controller do
}
before do
allow(Stripe).to receive(:api_key) { "sk_test_12345" }
Stripe.api_key = "sk_test_12345"
stub_payment_intent_get_request
stub_successful_capture_request(order: order)

View File

@@ -31,7 +31,7 @@ describe Spree::Admin::PaymentsController, type: :controller do
end
before do
allow(Stripe).to receive(:api_key) { "sk_test_12345" }
Stripe.api_key = "sk_test_12345"
end
context "where the request succeeds" do
@@ -90,7 +90,7 @@ describe Spree::Admin::PaymentsController, type: :controller do
end
before do
allow(Stripe).to receive(:api_key) { "sk_test_12345" }
Stripe.api_key = "sk_test_12345"
end
context "where the request succeeds" do
@@ -152,7 +152,7 @@ describe Spree::Admin::PaymentsController, type: :controller do
let(:stripe_account) { create(:stripe_account, enterprise: shop) }
before do
allow(Stripe).to receive(:api_key) { "sk_test_12345" }
Stripe.api_key = "sk_test_12345"
allow(StripeAccount).to receive(:find_by) { stripe_account }
end
@@ -236,7 +236,7 @@ describe Spree::Admin::PaymentsController, type: :controller do
end
before do
allow(Stripe).to receive(:api_key) { "sk_test_12345" }
Stripe.api_key = "sk_test_12345"
stub_payment_intent_get_request stripe_account_header: false
end

View File

@@ -7,7 +7,7 @@ describe Spree::CreditCardsController, type: :controller do
let(:token) { "tok_234bd2c22" }
before do
allow(Stripe).to receive(:api_key) { "sk_test_12345" }
Stripe.api_key = "sk_test_12345"
allow(controller).to receive(:spree_current_user) { user }
end

View File

@@ -5,6 +5,7 @@ require 'spec_helper'
describe Spree::OrdersController, type: :controller do
include OpenFoodNetwork::EmailHelper
include CheckoutHelper
include StripeStubs
let(:distributor) { double(:distributor) }
let(:order) { create(:order) }
@@ -163,7 +164,7 @@ describe Spree::OrdersController, type: :controller do
it "does not complete the payment" do
get :show, params: { id: order.number, payment_intent: payment_intent }
expect(response).to be_success
expect(response.status).to eq 200
expect(flash[:error]).to eq("#{I18n.t("payment_could_not_process")}. error message")
payment.reload
expect(payment.cvv_response_message).to eq("https://stripe.com/redirect")
@@ -178,11 +179,11 @@ describe Spree::OrdersController, type: :controller do
before do
allow(payment).to receive(:response_code).and_return("invalid")
allow(OrderPaymentFinder).to receive(:new).with(order).and_return(finder)
allow_any_instance_of(Stripe::PaymentIntentValidator)
.to receive(:call)
.with(payment_intent, kind_of(String))
.and_return(payment_intent)
stub_payment_intent_get_request(payment_intent_id: "valid")
end
it "does not complete the payment" do

View File

@@ -47,7 +47,7 @@ feature '
before do
Spree::Config.set(stripe_connect_enabled: true)
allow(Stripe).to receive(:api_key) { "sk_test_12345" }
Stripe.api_key = "sk_test_12345"
stub_request(:get, "https://api.stripe.com/v1/accounts/acc_connected123").to_return(body: JSON.generate(stripe_account_mock))
stub_request(:get, "https://api.stripe.com/v1/accounts/acc_revoked123").to_return(status: 404)
end

View File

@@ -22,8 +22,8 @@ feature "Credit Cards", js: true do
before do
login_as user
allow(Stripe).to receive(:api_key) { "sk_test_12345" }
allow(Stripe).to receive(:publishable_key) { "some_token" }
Stripe.api_key = "sk_test_12345"
Stripe.publishable_key = "some_token"
Spree::Config.set(stripe_connect_enabled: true)
stub_request(:get, "https://api.stripe.com/v1/customers/cus_AZNMJ").

View File

@@ -266,7 +266,7 @@ describe EnterprisesHelper, type: :helper do
before do
Spree::Config.set(stripe_connect_enabled: true)
allow(Stripe).to receive(:publishable_key) { "some_key" }
Stripe.publishable_key = "some_key"
end
it "includes Stripe payment methods with a valid stripe accounts" do

View File

@@ -5,6 +5,11 @@ require 'open_food_network/i18n_config'
module OpenFoodNetwork
describe I18nConfig do
before do
# Allow non-stubbed calls to ENV to proceed
allow(ENV).to receive(:[]).and_call_original
end
context "in default test configuration" do
before do
allow(ENV).to receive(:[]).with("LOCALE").and_return("en")

View File

@@ -15,7 +15,7 @@ module Stripe
let(:connector) { AccountConnector.new(user, params) }
before do
allow(Stripe).to receive(:api_key) { "sk_test_12345" }
Stripe.api_key = "sk_test_12345"
end
context "when the connection was cancelled by the user" do

View File

@@ -24,7 +24,7 @@ module Stripe
}
before do
allow(Stripe).to receive(:api_key) { "sk_test_12345" }
Stripe.api_key = "sk_test_12345"
stub_customers_post_request email: credit_card.user.email,
response: { customer_id: new_customer_id },

View File

@@ -12,7 +12,7 @@ module Stripe
let(:payment_intent_response_mock) { { status: 200, body: payment_intent_response_body } }
before do
allow(Stripe).to receive(:api_key) { "sk_test_12345" }
Stripe.api_key = "sk_test_12345"
stub_request(:get, "https://api.stripe.com/v1/payment_intents/#{payment_intent_id}")
.with(headers: { 'Stripe-Account' => stripe_account_id })

View File

@@ -14,7 +14,7 @@ module Stripe
let(:customer_response_mock) { { status: 200, body: customer_response_body } }
before do
allow(Stripe).to receive(:api_key) { "sk_test_12345" }
Stripe.api_key = "sk_test_12345"
stub_request(:post, "https://api.stripe.com/v1/customers")
.with(basic_auth: ["sk_test_12345", ""], body: { email: payment.order.email })

View File

@@ -15,7 +15,7 @@ describe Spree::Gateway::StripeConnect, type: :model do
let(:stripe_account_id) { "acct_123" }
before do
allow(Stripe).to receive(:api_key) { "sk_test_123456" }
Stripe.api_key = "sk_test_123456"
allow(subject).to receive(:stripe_account_id) { stripe_account_id }
allow(subject).to receive(:options_for_purchase_or_auth).and_return(['money', 'cc', 'opts'])
allow(subject).to receive(:provider).and_return provider

View File

@@ -3,7 +3,7 @@
require 'spec_helper'
describe Spree::Gateway::StripeSCA, type: :model do
before { allow(Stripe).to receive(:api_key) { "sk_test_12345" } }
before { Stripe.api_key = "sk_test_12345" }
describe "#purchase" do
let(:order) { create(:order_with_totals_and_distribution) }

View File

@@ -12,8 +12,8 @@ describe StripeAccount do
let!(:stripe_account) { create(:stripe_account, enterprise: enterprise, stripe_user_id: stripe_user_id) }
before do
allow(Stripe).to receive(:api_key) { "sk_test_12345" }
allow(Stripe).to receive(:client_id) { client_id }
Stripe.api_key = "sk_test_12345"
Stripe.client_id = client_id
end
context "when the Stripe API disconnect fails" do

View File

@@ -68,7 +68,7 @@ describe "checking out an order with a Stripe Connect payment method", type: :re
allow(OrderCycleDistributedVariants).to receive(:new) { order_cycle_distributed_variants }
allow(order_cycle_distributed_variants).to receive(:distributes_order_variants?) { true }
allow(Stripe).to receive(:api_key) { "sk_test_12345" }
Stripe.api_key = "sk_test_12345"
order.update(distributor_id: enterprise.id, order_cycle_id: order_cycle.id)
order.reload.update_totals
set_order order

View File

@@ -87,7 +87,7 @@ describe "checking out an order with a Stripe SCA payment method", type: :reques
allow(OrderCycleDistributedVariants).to receive(:new) { order_cycle_distributed_variants }
allow(order_cycle_distributed_variants).to receive(:distributes_order_variants?) { true }
allow(Stripe).to receive(:api_key) { "sk_test_12345" }
Stripe.api_key = "sk_test_12345"
order.update(distributor_id: enterprise.id, order_cycle_id: order_cycle.id)
order.reload.update_totals
set_order order

View File

@@ -30,8 +30,8 @@ module StripeHelper
end
def setup_stripe
allow(Stripe).to receive(:api_key) { "sk_test_12345" }
allow(Stripe).to receive(:publishable_key) { "pk_test_12345" }
Stripe.api_key = "sk_test_12345"
Stripe.publishable_key = "pk_test_12345"
Spree::Config.set(stripe_connect_enabled: true)
end
end

View File

@@ -14,8 +14,8 @@ module StripeStubs
.to_return(payment_intent_redirect_response_mock(redirect_url))
end
def stub_payment_intent_get_request(response: {}, stripe_account_header: true)
stub = stub_request(:get, "https://api.stripe.com/v1/payment_intents/pi_123")
def stub_payment_intent_get_request(response: {}, stripe_account_header: true, payment_intent_id: "pi_123")
stub = stub_request(:get, "https://api.stripe.com/v1/payment_intents/#{payment_intent_id}")
stub = stub.with(headers: { 'Stripe-Account' => 'abc123' }) if stripe_account_header
stub.to_return(payment_intent_authorize_response_mock(response))
end
@@ -37,7 +37,6 @@ module StripeStubs
def stub_retrieve_payment_method_request(payment_method_id = "pm_1234")
stub_request(:get, "https://api.stripe.com/v1/payment_methods/#{payment_method_id}")
.with(headers: { 'Authorization' => 'Bearer sk_test_12345' })
.to_return(retrieve_payment_method_response_mock({}))
end
@@ -52,7 +51,7 @@ module StripeStubs
def stub_list_customers_request(email:, response: {})
stub = stub_request(:get, "https://api.stripe.com/v1/customers?email=#{email}&limit=100")
stub = stub.with(
headers: { 'Authorization' => 'Bearer sk_test_12345', 'Stripe-Account' => 'abc123' }
headers: { 'Stripe-Account' => 'abc123' }
)
stub.to_return(list_customers_response_mock(response))
end
@@ -62,7 +61,7 @@ module StripeStubs
:get, "https://api.stripe.com/v1/payment_methods?customer=#{customer}&limit=100&type=card"
)
stub = stub.with(
headers: { 'Authorization' => 'Bearer sk_test_12345', 'Stripe-Account' => 'abc123' }
headers: { 'Stripe-Account' => 'abc123' }
)
stub.to_return(get_customer_payment_methods_response_mock(response))
end
@@ -71,7 +70,7 @@ module StripeStubs
stub = stub_request(:post, "https://api.stripe.com/v1/payment_methods/#{payment_method}")
stub = stub.with(body: { metadata: { "ofn-clone": true } })
stub = stub.with(
headers: { 'Authorization' => 'Bearer sk_test_12345', 'Stripe-Account' => 'abc123' }
headers: { 'Stripe-Account' => 'abc123' }
)
stub.to_return(add_metadata_response_mock(response))
end

View File

@@ -5838,10 +5838,10 @@ karma-jasmine@~0.3.8:
resolved "https://registry.yarnpkg.com/karma-jasmine/-/karma-jasmine-0.3.8.tgz#5b6457791ad9b89aa173f079e3ebe1b8c805236c"
integrity sha1-W2RXeRrZuJqhc/B54+vhuMgFI2w=
karma@~6.3.2:
version "6.3.2"
resolved "https://registry.yarnpkg.com/karma/-/karma-6.3.2.tgz#24b62fbae3e8b5218cc32a0dac49ad08a541e76d"
integrity sha512-fo4Wt0S99/8vylZMxNj4cBFyOBBnC1bewZ0QOlePij/2SZVWxqbyLeIddY13q6URa2EpLRW8ixvFRUMjkmo1bw==
karma@~6.3.3:
version "6.3.3"
resolved "https://registry.yarnpkg.com/karma/-/karma-6.3.3.tgz#bd04c7c533f8de99b3c3e85e191d0a6ae2621ad1"
integrity sha512-JRAujkKWaOtO2LmyPH7K2XXRhrxuFAn9loIL9+iiah6vjz+ZLkqdKsySV9clRITGhj10t9baIfbCl6CJ5hu9gQ==
dependencies:
body-parser "^1.19.0"
braces "^3.0.2"