Compare commits

...

568 Commits

Author SHA1 Message Date
Andy Brett
3e860f6d54 Merge pull request #7781 from andrewpbrett/decouple-payments
Decouple payments
2021-07-01 18:07:01 -07:00
Matt-Yorkley
97a087707d Merge pull request #7873 from openfoodfoundation/transifex
Transifex
2021-07-01 18:57:56 +02:00
Transifex-Openfoodnetwork
f065df669a Updating translations for config/locales/de_DE.yml 2021-07-02 02:28:44 +10:00
Transifex-Openfoodnetwork
a2196b08a3 Updating translations for config/locales/en_IE.yml 2021-07-02 02:28:42 +10:00
Transifex-Openfoodnetwork
aa7d08dff7 Updating translations for config/locales/en_FR.yml 2021-07-02 02:25:41 +10:00
Transifex-Openfoodnetwork
fab3486669 Updating translations for config/locales/en_GB.yml 2021-07-02 02:25:38 +10:00
Transifex-Openfoodnetwork
71e97b3eba Updating translations for config/locales/es.yml 2021-07-02 02:25:35 +10:00
Pau Pérez Fabregat
021f33645d Merge pull request #7629 from viktorsmari/remove-bin-from-gitignore
Stop gitignoring the bin/ folder
2021-07-01 18:04:01 +02:00
Andy Brett
058ba2bb8c Merge pull request #7862 from openfoodfoundation/dependabot/bundler/stripe-5.35.0
Bump stripe from 5.34.0 to 5.35.0
2021-07-01 08:50:29 -07:00
Andy Brett
a5ead1da86 Merge pull request #7870 from andrewpbrett/revert-webpack-again
Revert "Bump webpack from 5.41.0 to 5.41.1"
2021-07-01 08:46:41 -07:00
Andy Brett
0af845a02d Revert "Bump webpack from 5.41.0 to 5.41.1"
This reverts commit 1a8a0f33d0.
2021-07-01 08:45:34 -07:00
Andy Brett
79eef161f5 Merge pull request #7866 from openfoodfoundation/dependabot/npm_and_yarn/storybook/addon-docs-6.3.2
Bump @storybook/addon-docs from 6.3.1 to 6.3.2
2021-07-01 08:03:03 -07:00
Matt-Yorkley
0005a77115 Update all locales with the latest Transifex translations 2021-07-01 16:01:24 +01:00
Matt-Yorkley
a0b9eff2c1 Merge pull request #7699 from guidoDutra/1971-inventory-page-field-validation
Add validation to inventory page fields
2021-07-01 16:59:20 +02:00
dependabot[bot]
c571767cfb Bump @storybook/addon-docs from 6.3.1 to 6.3.2
Bumps [@storybook/addon-docs](https://github.com/storybookjs/storybook/tree/HEAD/addons/docs) from 6.3.1 to 6.3.2.
- [Release notes](https://github.com/storybookjs/storybook/releases)
- [Changelog](https://github.com/storybookjs/storybook/blob/next/CHANGELOG.md)
- [Commits](https://github.com/storybookjs/storybook/commits/v6.3.2/addons/docs)

---
updated-dependencies:
- dependency-name: "@storybook/addon-docs"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-07-01 14:58:58 +00:00
Andy Brett
b9bb43054a Merge pull request #7863 from openfoodfoundation/dependabot/bundler/good_migrations-0.1.0
Bump good_migrations from 0.0.2 to 0.1.0
2021-07-01 07:51:27 -07:00
Andy Brett
8fb51165bc Merge pull request #7865 from openfoodfoundation/dependabot/npm_and_yarn/storybook/addon-controls-6.3.2
Bump @storybook/addon-controls from 6.3.1 to 6.3.2
2021-07-01 07:49:47 -07:00
Pau Pérez Fabregat
f6e0b9af0e Merge pull request #7646 from apricot12/advanced_settings_button_OC_edits
Add advanced settings button to incoming and outgoing pages in OC cyc…
2021-07-01 15:37:16 +02:00
Matt-Yorkley
d2ebda8844 Merge pull request #7856 from andrewpbrett/raise-on-missing-translations
Update config to address deprecation warning for missing translations
2021-07-01 14:22:23 +02:00
Pau Pérez Fabregat
8883aa13ad Merge pull request #7814 from openfoodfoundation/dependabot/bundler/acts-as-taggable-on-8.1.0
Bump acts-as-taggable-on from 8.0.0 to 8.1.0
2021-07-01 14:00:17 +02:00
dependabot[bot]
7b2f2ef690 Bump @storybook/addon-controls from 6.3.1 to 6.3.2
Bumps [@storybook/addon-controls](https://github.com/storybookjs/storybook/tree/HEAD/addons/controls) from 6.3.1 to 6.3.2.
- [Release notes](https://github.com/storybookjs/storybook/releases)
- [Changelog](https://github.com/storybookjs/storybook/blob/next/CHANGELOG.md)
- [Commits](https://github.com/storybookjs/storybook/commits/v6.3.2/addons/controls)

---
updated-dependencies:
- dependency-name: "@storybook/addon-controls"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-07-01 11:58:26 +00:00
Pau Pérez Fabregat
13dfbb9a0c Merge pull request #7859 from openfoodfoundation/dependabot/npm_and_yarn/webpack-5.41.1
Bump webpack from 5.41.0 to 5.41.1
2021-07-01 13:55:47 +02:00
Pau Pérez Fabregat
8b12fd4af1 Merge pull request #7864 from openfoodfoundation/dependabot/npm_and_yarn/storybook/server-6.3.2
Bump @storybook/server from 6.3.1 to 6.3.2
2021-07-01 13:55:24 +02:00
Pau Pérez Fabregat
f071ab2038 Merge pull request #7807 from mkllnk/rbenv-install
Add convenience script to install Ruby
2021-07-01 13:53:54 +02:00
dependabot[bot]
16d0235a6e Bump @storybook/server from 6.3.1 to 6.3.2
Bumps [@storybook/server](https://github.com/storybookjs/storybook/tree/HEAD/app/server) from 6.3.1 to 6.3.2.
- [Release notes](https://github.com/storybookjs/storybook/releases)
- [Changelog](https://github.com/storybookjs/storybook/blob/next/CHANGELOG.md)
- [Commits](https://github.com/storybookjs/storybook/commits/v6.3.2/app/server)

---
updated-dependencies:
- dependency-name: "@storybook/server"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-07-01 09:05:40 +00:00
dependabot[bot]
ea8cb9ce7d Bump good_migrations from 0.0.2 to 0.1.0
Bumps [good_migrations](https://github.com/testdouble/good-migrations) from 0.0.2 to 0.1.0.
- [Release notes](https://github.com/testdouble/good-migrations/releases)
- [Changelog](https://github.com/testdouble/good-migrations/blob/main/CHANGELOG.md)
- [Commits](https://github.com/testdouble/good-migrations/compare/v0.0.2...v0.1.0)

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

Signed-off-by: dependabot[bot] <support@github.com>
2021-07-01 09:04:42 +00:00
dependabot[bot]
00b6b58b4d Bump stripe from 5.34.0 to 5.35.0
Bumps [stripe](https://github.com/stripe/stripe-ruby) from 5.34.0 to 5.35.0.
- [Release notes](https://github.com/stripe/stripe-ruby/releases)
- [Changelog](https://github.com/stripe/stripe-ruby/blob/master/CHANGELOG.md)
- [Commits](https://github.com/stripe/stripe-ruby/compare/v5.34.0...v5.35.0)

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

Signed-off-by: dependabot[bot] <support@github.com>
2021-07-01 09:04:14 +00:00
Andy Brett
e9a00eb0d4 Merge pull request #7310 from cillian/resumed-order-actions-menu
Make sure the Resend Confirmation and Send/Print Invoice links display for resumed orders
2021-06-30 10:43:07 -07:00
Andy Brett
7451f06fe1 Merge pull request #7307 from cillian/hide-notifications-setting-for-profiles
Don't show the Notifications setting for profile only enterprises in the Users section
2021-06-30 10:14:14 -07:00
Nihal Mohammed
f7795ca21a Fix failing specs 2021-06-30 09:50:38 -07:00
Nihal Mohammed
cd0b97bf0a Update i18n configs 2021-06-30 09:50:38 -07:00
Nihal Mohammed
18282a6f73 Add advanced settings button to incoming and outgoing pages in OC cycle edit 2021-06-30 09:50:38 -07:00
Nihal Mohammed
c335ec3b29 # This is a combination of 5 commits.tree d6d4f31283e42c44c9c4d116567ce7b1a99a13ab
parent b680697af6
author Nihal Mohammed <mnihal64@outlook.com> 1621004464 +0530
committer Nihal Mohammed <mnihal64@outlook.com> 1621022463 +0530

# This is a combination of 4 commits.
# This is the 1st commit message:

Add advanced settings button to incoming and outgoing pages in OC cycle edit

# This is the commit message #2:

Remove extra header text

# This is the commit message #3:

Moved repeating code blocks to partial

# This is the commit message #4:

Refactored code

# This is the commit message #5:

Delete _advanced_settings_hidden.html.haml
2021-06-30 09:50:38 -07:00
Cillian O'Ruanaidh
2bb406fe6a Don't show the Notifications setting for profile only enterprises in the Users settings section
If a enterprise has only set up a profile they won't be getting any order notification emails so showing this setting could be confusing.

#1797
2021-06-30 09:48:08 -07:00
dependabot[bot]
1a8a0f33d0 Bump webpack from 5.41.0 to 5.41.1
Bumps [webpack](https://github.com/webpack/webpack) from 5.41.0 to 5.41.1.
- [Release notes](https://github.com/webpack/webpack/releases)
- [Commits](https://github.com/webpack/webpack/compare/v5.41.0...v5.41.1)

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

Signed-off-by: dependabot[bot] <support@github.com>
2021-06-30 16:47:01 +00:00
Andy Brett
7eac465b18 Merge pull request #7861 from andrewpbrett/revert-webpack
Revert "Bump webpack from 4.46.0 to 5.41.0"
2021-06-30 09:41:45 -07:00
Andy Brett
404a2d3a2d Revert "Bump webpack from 4.46.0 to 5.41.0"
This reverts commit e753f47291.
2021-06-30 09:26:15 -07:00
Andy Brett
47e954afcb Merge pull request #7858 from openfoodfoundation/dependabot/bundler/rubocop-1.18.1
Bump rubocop from 1.18.0 to 1.18.1
2021-06-30 08:04:56 -07:00
Viktor Smari
c95c2f5772 Add files generated by spring binstub --all 2021-06-30 13:35:09 +02:00
Viktor Smari
14a1992d52 Stop ignoring the /bin folder
New rails apps do not ignore the bin folder.
When running rails app:update, the bin folder also gets update.
This also allows us to use bin/rails to run rails, or bin/yarn etc.
Tip: create an alias r=./bin/rails
2021-06-30 13:33:11 +02:00
dependabot[bot]
e98ad9096d Bump rubocop from 1.18.0 to 1.18.1
Bumps [rubocop](https://github.com/rubocop/rubocop) from 1.18.0 to 1.18.1.
- [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.18.0...v1.18.1)

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

Signed-off-by: dependabot[bot] <support@github.com>
2021-06-30 09:04:54 +00:00
Matt-Yorkley
7489fd98bf Merge pull request #7837 from openfoodfoundation/dependabot/bundler/rails-6.1.4
Bump rails from 6.1.3.2 to 6.1.4
2021-06-29 21:32:07 +02:00
Matt-Yorkley
189d007304 Merge pull request #7850 from openfoodfoundation/dependabot/npm_and_yarn/webpack-5.41.0
Bump webpack from 4.46.0 to 5.41.0
2021-06-29 21:28:04 +02:00
Andy Brett
a97b5b7c90 rename payment state machine events to be verbs 2021-06-29 11:54:51 -07:00
Andy Brett
9b1da14380 mark payment failed after failed authorization 2021-06-29 11:54:51 -07:00
Andy Brett
f61fbee52a refactor to advance_to_state method
this leaves `advance_order!` as is since it's not directly touched by this PR and the metaprogramming looks like it would decrease readability
2021-06-29 11:54:51 -07:00
Andy Brett
aa8067f96b process payments separately from completing the order 2021-06-29 11:54:48 -07:00
Andy Brett
d2701226b6 complete order immediately before adding payment 2021-06-29 11:45:33 -07:00
dependabot[bot]
4bbdcc109d Bump rails from 6.0.3.7 to 6.1.4
Bumps [rails](https://github.com/rails/rails) from 6.0.3.7 to 6.1.4.
- [Release notes](https://github.com/rails/rails/releases)
- [Commits](https://github.com/rails/rails/compare/v6.0.3.7...v6.1.4)

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

Signed-off-by: dependabot[bot] <support@github.com>
2021-06-29 17:33:32 +00:00
dependabot[bot]
09254215a5 Bump acts-as-taggable-on from 8.0.0 to 8.1.0
Bumps [acts-as-taggable-on](https://github.com/mbleigh/acts-as-taggable-on) from 8.0.0 to 8.1.0.
- [Release notes](https://github.com/mbleigh/acts-as-taggable-on/releases)
- [Changelog](https://github.com/mbleigh/acts-as-taggable-on/blob/master/CHANGELOG.md)
- [Commits](https://github.com/mbleigh/acts-as-taggable-on/compare/v8.0.0...v8.1.0)

---
updated-dependencies:
- dependency-name: acts-as-taggable-on
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-06-29 17:22:37 +00:00
Andy Brett
63fcb40f6c update config to address deprecation warning for missing translations config 2021-06-29 10:22:25 -07:00
Andy Brett
1a6257257a Merge pull request #7608 from luisramos0/rails61
[Rails 6.1] Upgrade to rails 6.1
2021-06-29 10:21:15 -07:00
Andy Brett
e24d2e5077 address deprecation warning 2021-06-29 09:17:31 -07:00
Andy Brett
eb724bbe10 Merge pull request #7849 from openfoodfoundation/dependabot/bundler/rubocop-1.18.0
Bump rubocop from 1.17.0 to 1.18.0
2021-06-29 06:48:44 -07:00
dependabot[bot]
e753f47291 Bump webpack from 4.46.0 to 5.41.0
Bumps [webpack](https://github.com/webpack/webpack) from 4.46.0 to 5.41.0.
- [Release notes](https://github.com/webpack/webpack/releases)
- [Commits](https://github.com/webpack/webpack/compare/v4.46.0...v5.41.0)

---
updated-dependencies:
- dependency-name: webpack
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-06-29 09:08:03 +00:00
dependabot[bot]
df353aa006 Bump rubocop from 1.17.0 to 1.18.0
Bumps [rubocop](https://github.com/rubocop/rubocop) from 1.17.0 to 1.18.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.17.0...v1.18.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-29 09:05:09 +00:00
Andy Brett
7b87476986 Merge pull request #7804 from Matt-Yorkley/default-taxrate-check
Ignore potential error in dev where default tax rate is nil
2021-06-28 10:35:09 -07:00
Andy Brett
837c9bd7d8 Merge pull request #7826 from openfoodfoundation/dependabot/bundler/knapsack-3.1.0
Bump knapsack from 1.22.0 to 3.1.0
2021-06-28 10:34:01 -07:00
Andy Brett
394043dcc2 Merge pull request #7817 from openfoodfoundation/dependabot/bundler/webpacker-5.4.0
Bump webpacker from 5.3.0 to 5.4.0
2021-06-28 10:32:54 -07:00
Andy Brett
bc8ba48100 Merge pull request #7846 from openfoodfoundation/dependabot/npm_and_yarn/storybook/addon-docs-6.3.1
Bump @storybook/addon-docs from 6.3.0 to 6.3.1
2021-06-28 08:51:33 -07:00
dependabot[bot]
1b93d7a45f Bump @storybook/addon-docs from 6.3.0 to 6.3.1
Bumps [@storybook/addon-docs](https://github.com/storybookjs/storybook/tree/HEAD/addons/docs) from 6.3.0 to 6.3.1.
- [Release notes](https://github.com/storybookjs/storybook/releases)
- [Changelog](https://github.com/storybookjs/storybook/blob/next/CHANGELOG.md)
- [Commits](https://github.com/storybookjs/storybook/commits/v6.3.1/addons/docs)

---
updated-dependencies:
- dependency-name: "@storybook/addon-docs"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-06-28 15:50:42 +00:00
Andy Brett
1137341591 Merge pull request #7845 from openfoodfoundation/dependabot/npm_and_yarn/storybook/server-6.3.1
Bump @storybook/server from 6.3.0 to 6.3.1
2021-06-28 08:46:30 -07:00
Pau Pérez Fabregat
4db0075de3 Merge pull request #7821 from openfoodfoundation/dependabot/npm_and_yarn/webpack-cli-4.7.2
Bump webpack-cli from 3.3.12 to 4.7.2
2021-06-28 17:23:04 +02:00
dependabot[bot]
2a6a3fd64a Bump @storybook/server from 6.3.0 to 6.3.1
Bumps [@storybook/server](https://github.com/storybookjs/storybook/tree/HEAD/app/server) from 6.3.0 to 6.3.1.
- [Release notes](https://github.com/storybookjs/storybook/releases)
- [Changelog](https://github.com/storybookjs/storybook/blob/next/CHANGELOG.md)
- [Commits](https://github.com/storybookjs/storybook/commits/v6.3.1/app/server)

---
updated-dependencies:
- dependency-name: "@storybook/server"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-06-28 15:15:44 +00:00
Pau Pérez Fabregat
9055e186b6 Merge pull request #7847 from openfoodfoundation/dependabot/npm_and_yarn/storybook/addon-controls-6.3.1
Bump @storybook/addon-controls from 6.3.0 to 6.3.1
2021-06-28 17:11:20 +02:00
dependabot[bot]
965ee4a88f Bump @storybook/addon-controls from 6.3.0 to 6.3.1
Bumps [@storybook/addon-controls](https://github.com/storybookjs/storybook/tree/HEAD/addons/controls) from 6.3.0 to 6.3.1.
- [Release notes](https://github.com/storybookjs/storybook/releases)
- [Changelog](https://github.com/storybookjs/storybook/blob/next/CHANGELOG.md)
- [Commits](https://github.com/storybookjs/storybook/commits/v6.3.1/addons/controls)

---
updated-dependencies:
- dependency-name: "@storybook/addon-controls"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-06-28 09:09:34 +00:00
Andy Brett
cbc0cb707d Merge pull request #7816 from mkllnk/customer-import
Add example script for importing customers
2021-06-25 10:16:54 -07:00
Andy Brett
0e0e9402dd Merge pull request #7836 from openfoodfoundation/dependabot/bundler/rubocop-rails-2.11.1
Bump rubocop-rails from 2.11.0 to 2.11.1
2021-06-25 09:32:20 -07:00
Transifex-Openfoodnetwork
71609a6489 Updating translations for config/locales/en_IE.yml 2021-06-25 22:28:54 +10:00
dependabot[bot]
5b2a7bf7e7 Bump rubocop-rails from 2.11.0 to 2.11.1
Bumps [rubocop-rails](https://github.com/rubocop/rubocop-rails) from 2.11.0 to 2.11.1.
- [Release notes](https://github.com/rubocop/rubocop-rails/releases)
- [Changelog](https://github.com/rubocop/rubocop-rails/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rubocop/rubocop-rails/compare/v2.11.0...v2.11.1)

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

Signed-off-by: dependabot[bot] <support@github.com>
2021-06-25 09:02:06 +00:00
Andy Brett
8ec6b8682f Merge pull request #7831 from openfoodfoundation/dependabot/npm_and_yarn/storybook/server-6.3.0
Bump @storybook/server from 6.2.9 to 6.3.0
2021-06-24 12:24:40 -07:00
Andy Brett
a1efa685f9 Merge pull request #7830 from openfoodfoundation/dependabot/npm_and_yarn/storybook/addon-controls-6.3.0
Bump @storybook/addon-controls from 6.2.9 to 6.3.0
2021-06-24 12:24:13 -07:00
dependabot[bot]
03b43e3302 Bump @storybook/addon-controls from 6.2.9 to 6.3.0
Bumps [@storybook/addon-controls](https://github.com/storybookjs/storybook/tree/HEAD/addons/controls) from 6.2.9 to 6.3.0.
- [Release notes](https://github.com/storybookjs/storybook/releases)
- [Changelog](https://github.com/storybookjs/storybook/blob/next/CHANGELOG.md)
- [Commits](https://github.com/storybookjs/storybook/commits/v6.3.0/addons/controls)

---
updated-dependencies:
- dependency-name: "@storybook/addon-controls"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-06-24 19:22:02 +00:00
dependabot[bot]
75d0be410f Bump @storybook/server from 6.2.9 to 6.3.0
Bumps [@storybook/server](https://github.com/storybookjs/storybook/tree/HEAD/app/server) from 6.2.9 to 6.3.0.
- [Release notes](https://github.com/storybookjs/storybook/releases)
- [Changelog](https://github.com/storybookjs/storybook/blob/next/CHANGELOG.md)
- [Commits](https://github.com/storybookjs/storybook/commits/v6.3.0/app/server)

---
updated-dependencies:
- dependency-name: "@storybook/server"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-06-24 19:21:19 +00:00
Andy Brett
afe92dfcad Merge pull request #7827 from openfoodfoundation/dependabot/bundler/bugsnag-6.21.0
Bump bugsnag from 6.20.0 to 6.21.0
2021-06-24 12:20:57 -07:00
Andy Brett
5dea7d218a Merge pull request #7828 from openfoodfoundation/dependabot/bundler/test-prof-1.0.6
Bump test-prof from 1.0.5 to 1.0.6
2021-06-24 12:19:40 -07:00
Andy Brett
28c2601a24 Merge pull request #7829 from openfoodfoundation/dependabot/npm_and_yarn/storybook/addon-docs-6.3.0
Bump @storybook/addon-docs from 6.2.9 to 6.3.0
2021-06-24 12:17:40 -07:00
Andy Brett
07a2a584c3 remove calls to ssl_allowed as well 2021-06-24 12:06:34 -07:00
Andy Brett
334b9b520a removed deprecated calls to force_ssl; rely on config.force_ssl 2021-06-24 11:58:33 -07:00
Andy Brett
0c03ca26af Merge pull request #7832 from openfoodfoundation/RachL-patch-1
Update links to welcoming new people boards
2021-06-24 09:14:43 -07:00
Andy Brett
9a9dd6a308 Merge pull request #7768 from apricot12/delete_shipped_orders_from_BOM
Hide shipped orders from BOM
2021-06-24 09:09:54 -07:00
Andy Brett
df0c98d013 Merge branch 'master' into rails61 2021-06-24 08:02:58 -07:00
Nihal Mohammed
5a94e3b644 Remove duplicate shipment_state conditions from BOM spec 2021-06-24 20:01:19 +05:30
Transifex-Openfoodnetwork
f707284c6c Updating translations for config/locales/ru.yml 2021-06-24 23:38:03 +10:00
Nihal Mohammed
edca260af4 Hide shipped orders from BOM and update specs 2021-06-24 18:26:39 +05:30
Rachel Arnould
636d449de1 Update links to welcoming new people boards
Updating links
2021-06-24 12:22:06 +02:00
dependabot[bot]
2f58f932a7 Bump @storybook/addon-docs from 6.2.9 to 6.3.0
Bumps [@storybook/addon-docs](https://github.com/storybookjs/storybook/tree/HEAD/addons/docs) from 6.2.9 to 6.3.0.
- [Release notes](https://github.com/storybookjs/storybook/releases)
- [Changelog](https://github.com/storybookjs/storybook/blob/next/CHANGELOG.md)
- [Commits](https://github.com/storybookjs/storybook/commits/v6.3.0/addons/docs)

---
updated-dependencies:
- dependency-name: "@storybook/addon-docs"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-06-24 09:05:34 +00:00
dependabot[bot]
68aa42860e Bump test-prof from 1.0.5 to 1.0.6
Bumps [test-prof](https://github.com/test-prof/test-prof) from 1.0.5 to 1.0.6.
- [Release notes](https://github.com/test-prof/test-prof/releases)
- [Changelog](https://github.com/test-prof/test-prof/blob/master/CHANGELOG.md)
- [Commits](https://github.com/test-prof/test-prof/compare/v1.0.5...v1.0.6)

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

Signed-off-by: dependabot[bot] <support@github.com>
2021-06-24 09:05:28 +00:00
dependabot[bot]
c4fbb2e715 Bump bugsnag from 6.20.0 to 6.21.0
Bumps [bugsnag](https://github.com/bugsnag/bugsnag-ruby) from 6.20.0 to 6.21.0.
- [Release notes](https://github.com/bugsnag/bugsnag-ruby/releases)
- [Changelog](https://github.com/bugsnag/bugsnag-ruby/blob/master/CHANGELOG.md)
- [Commits](https://github.com/bugsnag/bugsnag-ruby/compare/v6.20.0...v6.21.0)

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

Signed-off-by: dependabot[bot] <support@github.com>
2021-06-24 09:05:02 +00:00
dependabot[bot]
dca51ec298 Bump knapsack from 1.22.0 to 3.1.0
Bumps [knapsack](https://github.com/KnapsackPro/knapsack) from 1.22.0 to 3.1.0.
- [Release notes](https://github.com/KnapsackPro/knapsack/releases)
- [Changelog](https://github.com/KnapsackPro/knapsack/blob/master/CHANGELOG.md)
- [Commits](https://github.com/KnapsackPro/knapsack/compare/v1.22.0...v3.1.0)

---
updated-dependencies:
- dependency-name: knapsack
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-06-24 09:04:04 +00:00
Andy Brett
e37a065f10 Merge pull request #7281 from coopdevs/refactor-subs-placement-job
Refactor subs placement job
2021-06-23 11:47:50 -07:00
Andy Brett
92216cc1c7 Merge pull request #7761 from apricot12/show_variant_SKU_in_xero
Show product variant SKU in Xero report
2021-06-23 08:59:15 -07:00
Andy Brett
ca7b1f047b Merge pull request #7780 from apricot12/new_payment_method_html_bug
Fix HTML bug on new payment method page
2021-06-23 08:58:45 -07:00
Pau Perez
1125ac635b Make test not too dangerously play with time
We could get hurt and introduce flakiness in the build.
2021-06-23 13:47:42 +02:00
Pau Perez
1f3560e964 Pass in the order when it's already initialized
At `CapQuantity`'s instantiation time the proxy's order is not yet
initialized, and so `CapQuantity` was checking against nil all the time.

This went unnoticed because the job's specs were not integration-level
tests and were stubbing way too many things.
2021-06-23 13:47:42 +02:00
Pau Perez
648023750b Move tests exercising the service to its spec file
These are bypassing the job to only test the service, so there's no
point on doing that. They can test the service alone.
2021-06-23 13:45:43 +02:00
Andy Brett
49dbca71b8 Merge pull request #7748 from openfoodfoundation/dependabot/bundler/stripe-5.34.0
Bump stripe from 5.33.0 to 5.34.0
2021-06-22 11:18:20 -07:00
Andy Brett
ec8a892e13 Merge pull request #7820 from openfoodfoundation/dependabot/npm_and_yarn/rails/webpacker-5.4.0
Bump @rails/webpacker from 5.3.0 to 5.4.0
2021-06-22 10:41:41 -07:00
Andy Brett
a69d89130f Merge pull request #7819 from openfoodfoundation/dependabot/bundler/rubocop-rails-2.11.0
Bump rubocop-rails from 2.10.1 to 2.11.0
2021-06-22 10:31:13 -07:00
dependabot[bot]
3ddc142ee9 Bump webpack-cli from 3.3.12 to 4.7.2
Bumps [webpack-cli](https://github.com/webpack/webpack-cli) from 3.3.12 to 4.7.2.
- [Release notes](https://github.com/webpack/webpack-cli/releases)
- [Changelog](https://github.com/webpack/webpack-cli/blob/master/CHANGELOG.md)
- [Commits](https://github.com/webpack/webpack-cli/compare/v3.3.12...webpack-cli@4.7.2)

---
updated-dependencies:
- dependency-name: webpack-cli
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-06-22 09:06:57 +00:00
dependabot[bot]
d75bc2fd14 Bump @rails/webpacker from 5.3.0 to 5.4.0
Bumps [@rails/webpacker](https://github.com/rails/webpacker) from 5.3.0 to 5.4.0.
- [Release notes](https://github.com/rails/webpacker/releases)
- [Changelog](https://github.com/rails/webpacker/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rails/webpacker/compare/v5.3.0...v5.4.0)

---
updated-dependencies:
- dependency-name: "@rails/webpacker"
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-06-22 09:06:37 +00:00
dependabot[bot]
6e88090b89 Bump rubocop-rails from 2.10.1 to 2.11.0
Bumps [rubocop-rails](https://github.com/rubocop/rubocop-rails) from 2.10.1 to 2.11.0.
- [Release notes](https://github.com/rubocop/rubocop-rails/releases)
- [Changelog](https://github.com/rubocop/rubocop-rails/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rubocop/rubocop-rails/compare/v2.10.1...v2.11.0)

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

Signed-off-by: dependabot[bot] <support@github.com>
2021-06-22 09:03:42 +00:00
dependabot[bot]
cfb81d7f94 Bump webpacker from 5.3.0 to 5.4.0
Bumps [webpacker](https://github.com/rails/webpacker) from 5.3.0 to 5.4.0.
- [Release notes](https://github.com/rails/webpacker/releases)
- [Changelog](https://github.com/rails/webpacker/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rails/webpacker/compare/v5.3.0...v5.4.0)

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

Signed-off-by: dependabot[bot] <support@github.com>
2021-06-22 09:02:36 +00:00
Maikel Linke
a6753b832c Add example script for importing customers 2021-06-22 13:46:34 +10:00
Transifex-Openfoodnetwork
2eb67cf61b Updating translations for config/locales/de_DE.yml 2021-06-22 07:46:31 +10:00
Andy Brett
fea5c27437 Merge pull request #7775 from Matt-Yorkley/webpacker
Add Webpacker
2021-06-21 11:15:28 -07:00
Andy Brett
9db14a5e8c Merge pull request #7815 from Matt-Yorkley/dev-retries
Move Rspec retries count to CI config and remove in local environment
2021-06-21 09:09:44 -07:00
Matt-Yorkley
99035a250b Move Rspec retries count to CI config and remove in local environment
When running tests locally we want them to fail immediately

Reference: https://github.com/NoRedInk/rspec-retry#environment-variables
2021-06-21 11:21:11 +01:00
Transifex-Openfoodnetwork
27c6a842bd Updating translations for config/locales/es.yml 2021-06-21 18:41:34 +10:00
Transifex-Openfoodnetwork
3cb6f77cbb Updating translations for config/locales/ca.yml 2021-06-21 18:41:21 +10:00
Pau Perez
475474b179 Replace order reloads with association set up 2021-06-21 10:30:12 +02:00
Pau Perez
073c4bc1ae Reload order so line items are visible in spec 2021-06-21 10:30:12 +02:00
Pau Perez
e052f36cc6 Rubocop -a 2021-06-21 10:30:12 +02:00
Pau Perez
827faef690 Fix call to #record_and_log_error 2021-06-21 10:30:12 +02:00
Pau Perez
b69aeae892 Rename PlaceOrder to PlaceProxyOrder
As discussed in
https://github.com/openfoodfoundation/openfoodnetwork/pull/7281#discussion_r650183813.
2021-06-21 10:30:12 +02:00
Pau Perez
f92ca964db Improve service name
As discussed in
https://github.com/openfoodfoundation/openfoodnetwork/pull/7281#discussion_r650069982.
2021-06-21 10:30:12 +02:00
Transifex-Openfoodnetwork
030ad350b6 Updating translations for config/locales/en_GB.yml 2021-06-21 18:17:46 +10:00
Pau Perez
8bcb19f293 Split method into higher-level smaller methods 2021-06-21 09:49:07 +02:00
Pau Perez
f61cdb6608 Extract CapQuantityAndStoreChanges service
This is a responsiblity of its own that makes the job's tests really
complex.
2021-06-21 09:49:07 +02:00
Pau Perez
431f30bb52 Fix proxy_order.placed_at test and deal with time
Relying on Rails' `freeze_time` is much more reliable than this brittle
magic number. It turns out Timecop is not needed for this case anymore.
See
https://frontdeveloper.pl/2020/03/how-we-migrated-from-timecop-to-built-in-rails-5-2-time-helpers/.
2021-06-21 09:47:49 +02:00
Pau Perez
f785851236 Use time with zone 2021-06-21 09:47:49 +02:00
Pau Perez
fcb013eb2a Extract subs placement job logic into new service
While doing that we pass stock changes to the service but we
lazy-evaluate them. This way we don't fetch all this data from DB when
it might not be used due to an early return.

Also, this makes it possible to save the stock-related logic for later.

Finally, when changing things to rely on `#initialize_order`'s boolean
return value I noticed though, that we were evaluating
`proxy_order.order` too early.  When instantiating the service object it
won't exist yet.
2021-06-21 09:47:49 +02:00
Transifex-Openfoodnetwork
5ff13b6e3e Updating translations for config/locales/en_FR.yml 2021-06-21 17:28:50 +10:00
Transifex-Openfoodnetwork
3e0ff968bd Updating translations for config/locales/fr.yml 2021-06-21 17:26:28 +10:00
Matt-Yorkley
6c3c46b0f5 Add foreman and Procfile 2021-06-19 17:51:18 +01:00
Matt-Yorkley
0acd4fc9a1 Change Webpacker default path name
In the current version of Webpacker all assets are kept under a new path called `app/javascript`. This is a really stupid name, as it can contain all kinds of assets that are *not* javascript at all, like SCSS. It's common practise to rename this to something sensible like `app/webpacker` or `app/frontend`...
2021-06-19 17:51:18 +01:00
Matt-Yorkley
a074f627b2 Add Webpacker
Most of this is automatically generated by the rake task: `bundle exec rake webpacker:install`

Docs: https://github.com/rails/webpacker/tree/5-x-stable
2021-06-19 17:51:18 +01:00
Andy Brett
3d65929a74 Merge pull request #7808 from mkllnk/sass-gem
Remove explicit dependency on sass gem
2021-06-19 09:05:21 -07:00
Transifex-Openfoodnetwork
d89a0e2cd9 Updating translations for config/locales/en_CA.yml 2021-06-19 02:05:04 +10:00
Pau Perez
198d4be18f Update all locales with the latest Transifex translations 2021-06-18 18:05:03 +02:00
Transifex-Openfoodnetwork
ecad6c1982 Updating translations for config/locales/ru.yml 2021-06-19 01:41:57 +10:00
Pau Pérez Fabregat
42e26f3328 Merge pull request #7708 from andrewpbrett/payment-states
Add `requires_authorization` Payment state
2021-06-18 17:04:03 +02:00
Pau Perez
cb23cda9e9 Update all locales with the latest Transifex translations 2021-06-18 15:05:26 +02:00
Transifex-Openfoodnetwork
4255dd9141 Updating translations for config/locales/es.yml 2021-06-18 22:57:08 +10:00
Transifex-Openfoodnetwork
654bde6207 Updating translations for config/locales/ca.yml 2021-06-18 22:56:45 +10:00
Pau Pérez Fabregat
4ecbf51b33 Merge pull request #7802 from Matt-Yorkley/confirmation-mails
Add a delay on sending order confirmation emails
2021-06-18 12:27:24 +02:00
Pau Pérez Fabregat
837e65d72a Merge pull request #7792 from openfoodfoundation/dependabot/npm_and_yarn/postcss-7.0.36
Bump postcss from 7.0.35 to 7.0.36
2021-06-18 12:24:33 +02:00
Pau Pérez Fabregat
aa9a85159e Merge pull request #7806 from mkllnk/feature-toggles
Remove custom feature toggles
2021-06-18 12:23:21 +02:00
Pau Pérez Fabregat
db993652c4 Merge branch 'master' into payment-states 2021-06-18 12:20:26 +02:00
Pau Pérez Fabregat
b500486f6b Merge pull request #7211 from jibees/4207-add-query-params-in-url
Orders list : save filters params
2021-06-18 11:19:26 +02:00
Pau Pérez Fabregat
11a7316b9d Merge pull request #7759 from apricot12/fix_duplicate_refund
Disable credit button on click
2021-06-18 09:27:45 +02:00
Pau Pérez Fabregat
75ed148490 Merge pull request #7803 from openfoodfoundation/transifex
Transifex
2021-06-18 09:26:47 +02:00
Transifex-Openfoodnetwork
2f82afcb07 Updating translations for config/locales/en_FR.yml 2021-06-18 16:58:14 +10:00
Transifex-Openfoodnetwork
fcf6f1929b Updating translations for config/locales/fr.yml 2021-06-18 16:58:00 +10:00
Pau Pérez Fabregat
6f90a7b07f Merge pull request #7720 from luisramos0/rubocop_auto_correct
Executed rubocop autocorrect (-a for safe corrections plus adding frozen_string_literal comment to all files)
2021-06-18 08:48:03 +02:00
Transifex-Openfoodnetwork
36fa34a39e Updating translations for config/locales/es.yml 2021-06-18 16:44:01 +10:00
Transifex-Openfoodnetwork
d516b1d885 Updating translations for config/locales/ca.yml 2021-06-18 16:43:55 +10:00
Maikel Linke
2027590a8a Remove explicit dependency on sass gem
We still depend on it via compass and foundation-rails but it's not
explicit any more.

The sass gem has been deprecated in favour of the faster sassc gem.
But sassc has been deprecated in favour of dart-sass which is an npm
package.

https://github.com/sass/ruby-sass#ruby-sass-has-reached-end-of-life
https://github.com/sass/sassc#sassc

This is confusing but we don't have to worry about it because it's not
a direct dependency and other gems can solve the dependency selection
for us, I think. 😄
2021-06-18 15:49:43 +10:00
Maikel Linke
2c8bead8a0 Add convenience script to update Ruby 2021-06-18 15:13:00 +10:00
Andy Brett
d9aa1b054a update payments to be in requires_authorization state in specs 2021-06-17 18:10:41 -07:00
Maikel Linke
a8eecf963d Remove unused custom FeatureToggle implementation
Flipper is now our only source of truth regarding feature toggles.
2021-06-18 10:46:51 +10:00
Maikel Linke
bba85e5e79 Remove feature toggling via ENV vars
We don't use ENV vars for feature toggles any more. Flipper is much
easier to manage.
2021-06-18 10:46:51 +10:00
Maikel Linke
a712f254e0 Remove Australian custom homepage content
This was activated with a feature toggle. But when we re-implemented the
feature toggles, we accidentally broke this one and it hasn't been
active for two months. Nobody complained and it doesn't seem to be
needed while developers are keen to remove instance-specific
customisations anyway.
2021-06-18 10:46:50 +10:00
Luis Ramos
5a05a21dad Revert to false so strings can be mutated in this class 2021-06-17 23:07:54 +01:00
Luis Ramos
f95b0e3c54 Revert frozen string literal comment in codecov config 2021-06-17 23:07:41 +01:00
Luis Ramos
755222a35d Revert to false so strings can be mutated in this class 2021-06-17 23:07:35 +01:00
Luis Ramos
e52937c113 Use rubocop auto correct to add frozen string literal to all files
This is an unsafe auto corection, we will need to trust our build here
2021-06-17 23:07:26 +01:00
Luis Ramos
4fe9a936f0 Regenerate rubocop_todo 2021-06-17 22:32:59 +01:00
Luis Ramos
a253228b96 Add some rubocop disable commands in the code to avoid future wrong rubocop auto corrections 2021-06-17 22:26:54 +01:00
Andy Brett
b41302d5d8 update state transitions for new requires_authorization state 2021-06-17 14:23:59 -07:00
Andy Brett
dd0375aed4 clear authorization url after failing the payment 2021-06-17 14:23:59 -07:00
Andy Brett
d3cca04703 update spec 2021-06-17 14:23:59 -07:00
Andy Brett
3e32abe64f add colors and translations for requires_authorization state 2021-06-17 14:23:59 -07:00
Andy Brett
dc1a24339c update can_resend_auth_email 2021-06-17 14:23:59 -07:00
Andy Brett
95f123d137 update success response in payment spec 2021-06-17 14:23:59 -07:00
Andy Brett
b016337d4f add requires_authorization as a possible payment_state on Orders 2021-06-17 14:23:59 -07:00
Andy Brett
24a60cd108 add translation key 2021-06-17 14:23:59 -07:00
Andy Brett
2699e17b63 update specs to create payment in requires_authorization state 2021-06-17 14:23:59 -07:00
Andy Brett
527f4e2cb3 move payment to requires_authorization if cvv_result is present 2021-06-17 14:23:59 -07:00
Andy Brett
a6cec20056 update success_response in payment_spec 2021-06-17 14:23:59 -07:00
Andy Brett
31738ceb49 rename and consolidate authorization? methods 2021-06-17 14:23:59 -07:00
Andy Brett
674ca3026b change states after failure/requiring auth 2021-06-17 14:23:58 -07:00
Andy Brett
a3d9f1f3cc create requires_authorization payment state and migration 2021-06-17 14:23:58 -07:00
Andy Brett
4d2235c9cc Merge pull request #7794 from openfoodfoundation/dependabot/bundler/bigdecimal-3.0.2
Bump bigdecimal from 1.4.2 to 3.0.2
2021-06-17 14:21:55 -07:00
Luis Ramos
de76a1d41e Manually fix rubocop issue (unsafe auto correct would be wrong) 2021-06-17 22:20:28 +01:00
Luis Ramos
23627c5453 Run rubocop -a (safe corrections) removing all exceptions so all possible fixes are applied
9290 issues fixed
2021-06-17 22:19:26 +01:00
Andy Brett
5a25de1c82 Merge pull request #7760 from apricot12/remove_unused_partial_paypal
Remove unused partial paypal
2021-06-17 13:21:33 -07:00
Andy Brett
355b5ab56f Merge pull request #7788 from jibees/5735-flaky-spec-on-variant-override
Uncomment flaky (?) spec
2021-06-17 12:55:16 -07:00
Andy Brett
bcd0173ed0 Merge pull request #7305 from cillian/add-distributor-to-shipment-email
Add enterprise name to subject and body of shipment shipped email
2021-06-17 12:53:09 -07:00
Andy Brett
7c694e3cf3 Merge pull request #7771 from openfoodfoundation/dependabot/bundler/activemerchant-1.121.0
Bump activemerchant from 1.120.0 to 1.121.0
2021-06-17 12:52:21 -07:00
Jean-Baptiste Bellet
89ea9913e6 Checkbox is correctly handled with null value (and not false)
- It's better to read the comment juste below the line... 😠 (https://github.com/openfoodfoundation/openfoodnetwork/pull/3076#issuecomment-440010498)
 - Add appropriate spec so it is now correctly tested!
2021-06-17 21:40:25 +02:00
Matt-Yorkley
c821380ff1 Merge pull request #7749 from apricot12/remove_paypal_refund_button
Remove refund button from paypal completed order tab
2021-06-17 21:37:51 +02:00
Matt-Yorkley
e4e84b0a86 Remove old warning on BigDecimal gem 2021-06-17 16:05:12 +01:00
Matt-Yorkley
a7d873356d Fix shady use of BigDecimal 2021-06-17 15:51:06 +01:00
Matt-Yorkley
148349f0f3 Ignore potential error where default tax rate is nil
If the current tax rates are badly *misconfigured*, and an included-tax rate is being applied but a *default* rate does not exist (there are validations to stop this case from occurring, see DefaultTaxZoneValidator), this line can throw an error. This situation will not actually arise in production, but can happen fairly easily in dev or with staging data when switching datasets, and when it does it's kind of annoying.

Note: the logic in the check here is still good; if there's no default tax rate we check if the order's tax zone matches the zone for the current tax rate, which is correct.
2021-06-17 12:47:41 +01:00
Transifex-Openfoodnetwork
ba7b53051a Updating translations for config/locales/es.yml 2021-06-17 20:30:36 +10:00
Transifex-Openfoodnetwork
5803c0fe50 Updating translations for config/locales/fr.yml 2021-06-17 20:27:31 +10:00
Transifex-Openfoodnetwork
2e701656d2 Updating translations for config/locales/en_US.yml 2021-06-17 20:27:29 +10:00
Pau Pérez Fabregat
a8efbffca6 Merge pull request #7429 from Matt-Yorkley/adjustments-taxrate
[Adjustments] TaxRate changes
2021-06-17 11:51:01 +02:00
Pau Pérez Fabregat
ef724d2de8 Merge pull request #7758 from jibees/7710-manage-comma-as-decimal-separator-in-unit-value-field
[UnitPrice] Manage comma as decimal separator in unit value field
2021-06-17 11:46:22 +02:00
Matt-Yorkley
bb848811e6 Add a delay on sending order confirmation emails
There's a race condition here that means the order's address is not always present when the email is first sent, but it *is* present shortly after. The fix in this commit is a temporary solution.
2021-06-17 09:35:25 +01:00
Matt-Yorkley
6ebc6bcd6f Merge pull request #7797 from luisramos0/bundler
Upgrade to bundler 2
2021-06-17 09:18:13 +02:00
dependabot[bot]
9653b0a965 Bump activemerchant from 1.120.0 to 1.121.0
Bumps [activemerchant](https://github.com/activemerchant/active_merchant) from 1.120.0 to 1.121.0.
- [Release notes](https://github.com/activemerchant/active_merchant/releases)
- [Changelog](https://github.com/activemerchant/active_merchant/blob/master/CHANGELOG)
- [Commits](https://github.com/activemerchant/active_merchant/compare/v1.120.0...v1.121.0)

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

Signed-off-by: dependabot[bot] <support@github.com>
2021-06-17 00:26:49 +00:00
Andy Brett
aca3a76854 Merge pull request #7793 from openfoodfoundation/dependabot/bundler/ransack-2.4.2
Bump ransack from 2.4.1 to 2.4.2
2021-06-16 17:12:17 -07:00
Andy Brett
d38cf1da1f Merge pull request #7795 from openfoodfoundation/dependabot/bundler/rubocop-1.17.0
Bump rubocop from 1.16.1 to 1.17.0
2021-06-16 17:10:48 -07:00
Luis Ramos
a226aedaec Upgrade to bundler 2 2021-06-16 21:50:01 +01:00
dependabot[bot]
b39ed424f6 Bump rubocop from 1.16.1 to 1.17.0
Bumps [rubocop](https://github.com/rubocop/rubocop) from 1.16.1 to 1.17.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.16.1...v1.17.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-16 05:20:57 +00:00
dependabot[bot]
e4cf6421bd Bump bigdecimal from 1.4.2 to 3.0.2
Bumps [bigdecimal](https://github.com/ruby/bigdecimal) from 1.4.2 to 3.0.2.
- [Release notes](https://github.com/ruby/bigdecimal/releases)
- [Changelog](https://github.com/ruby/bigdecimal/blob/v3.0.2/CHANGES.md)
- [Commits](https://github.com/ruby/bigdecimal/compare/v1.4.2...v3.0.2)

---
updated-dependencies:
- dependency-name: bigdecimal
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-06-16 05:18:50 +00:00
dependabot[bot]
0776fcf5cc Bump ransack from 2.4.1 to 2.4.2
Bumps [ransack](https://github.com/activerecord-hackery/ransack) from 2.4.1 to 2.4.2.
- [Release notes](https://github.com/activerecord-hackery/ransack/releases)
- [Changelog](https://github.com/activerecord-hackery/ransack/blob/master/CHANGELOG.md)
- [Commits](https://github.com/activerecord-hackery/ransack/compare/2.4.1...v2.4.2)

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

Signed-off-by: dependabot[bot] <support@github.com>
2021-06-16 05:17:11 +00:00
Andy Brett
59358443b4 Merge pull request #7786 from andrewpbrett/add-web-console
Add web-console gem for debugging in development
2021-06-15 13:10:25 -07:00
Andy Brett
c4911b1947 add web console for debugging in development 2021-06-15 13:00:22 -07:00
dependabot[bot]
6c24d4bc1a Bump postcss from 7.0.35 to 7.0.36
Bumps [postcss](https://github.com/postcss/postcss) from 7.0.35 to 7.0.36.
- [Release notes](https://github.com/postcss/postcss/releases)
- [Changelog](https://github.com/postcss/postcss/blob/main/CHANGELOG.md)
- [Commits](https://github.com/postcss/postcss/compare/7.0.35...7.0.36)

---
updated-dependencies:
- dependency-name: postcss
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-06-15 19:08:24 +00:00
Matt-Yorkley
8753076dcd Merge pull request #7737 from luisramos0/ruby273
Upgrade to ruby 2.7.3
2021-06-15 21:07:38 +02:00
Jean-Baptiste Bellet
7f5e58bcc3 Uncomment flaky (?) spec 2021-06-15 13:51:40 +02:00
Maikel
d839313cf5 Merge pull request #7782 from openfoodfoundation/dependabot/bundler/redis-4.3.1
Bump redis from 4.2.5 to 4.3.1
2021-06-15 17:17:59 +10:00
Pau Pérez Fabregat
f51f304818 Merge pull request #7778 from openfoodfoundation/transifex
Transifex
2021-06-15 09:12:11 +02:00
Transifex-Openfoodnetwork
7f09fd4c19 Updating translations for config/locales/en_US.yml 2021-06-15 10:23:53 +10:00
Andy Brett
87692b06e6 remove deprecated update_attributes method call 2021-06-14 15:13:51 -07:00
Andy Brett
b8617e0a5a Merge pull request #7783 from openfoodfoundation/dependabot/npm_and_yarn/karma-6.3.4
Bump karma from 6.3.3 to 6.3.4
2021-06-14 09:18:55 -07:00
Transifex-Openfoodnetwork
6701afcdce Updating translations for config/locales/en_GB.yml 2021-06-14 18:10:03 +10:00
dependabot[bot]
fbf0e48a07 Bump karma from 6.3.3 to 6.3.4
Bumps [karma](https://github.com/karma-runner/karma) from 6.3.3 to 6.3.4.
- [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.3...v6.3.4)

---
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-14 06:57:07 +00:00
dependabot[bot]
e4087e9c65 Bump redis from 4.2.5 to 4.3.1
Bumps [redis](https://github.com/redis/redis-rb) from 4.2.5 to 4.3.1.
- [Release notes](https://github.com/redis/redis-rb/releases)
- [Changelog](https://github.com/redis/redis-rb/blob/master/CHANGELOG.md)
- [Commits](https://github.com/redis/redis-rb/compare/v4.2.5...v4.3.1)

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

Signed-off-by: dependabot[bot] <support@github.com>
2021-06-14 06:05:07 +00:00
Andy Brett
c790373804 resolve gemfile conflict 2021-06-13 18:29:57 -07:00
Luis Ramos
43401e4b5e Fix double spree scope in i18n
Fix taken from spree: efba9f1a02
2021-06-13 18:19:29 -07:00
Luis Ramos
5948c20326 Fix spec by adding mocked response 2021-06-13 18:19:29 -07:00
Luis Ramos
74aabbbb5f Upgrade to rails 6.1 2021-06-13 18:19:26 -07:00
Nihal Mohammed
522a7384e7 Fix HTML bug on new payment method page and update providers_controller spec 2021-06-12 01:47:08 +05:30
Andy Brett
0eea932778 Merge pull request #7757 from openfoodfoundation/dependabot/bundler/acts-as-taggable-on-8.0.0
Bump acts-as-taggable-on from 7.0.0 to 8.0.0
2021-06-11 07:39:57 -07:00
Jean-Baptiste Bellet
db8f8a2675 Create internal methods with regexp test
- Make it more easily readable and add unit tests
2021-06-11 10:40:02 +02:00
Transifex-Openfoodnetwork
3ef5953db2 Updating translations for config/locales/en_FR.yml 2021-06-11 18:38:36 +10:00
Transifex-Openfoodnetwork
586c97b22c Updating translations for config/locales/fr.yml 2021-06-11 18:37:04 +10:00
Transifex-Openfoodnetwork
d54cb9182f Updating translations for config/locales/ca.yml 2021-06-11 18:19:44 +10:00
Transifex-Openfoodnetwork
3257f16667 Updating translations for config/locales/es.yml 2021-06-11 18:17:41 +10:00
Jean-Baptiste Bellet
178c0a441b Move unlocalize_currency filter to a PriceParser service
- It's no longer a filter but more a service: it's therefore more logic.
2021-06-11 10:01:19 +02:00
Maikel Linke
4faf76794d Update translations from Transifex 2021-06-11 09:44:47 +10:00
Maikel
56570ec604 Merge pull request #7755 from openfoodfoundation/transifex
Transifex
2021-06-11 09:41:22 +10:00
Andy Brett
4047f135f7 Merge pull request #7747 from openfoodfoundation/dependabot/bundler/pdf-reader-2.5.0
Bump pdf-reader from 2.4.2 to 2.5.0
2021-06-10 14:49:35 -07:00
Matt-Yorkley
690cbe3ad3 Merge pull request #7468 from mkllnk/6328-tos-tracking
6328 tos tracking
2021-06-10 19:48:13 +02:00
Matt-Yorkley
04e76ed506 Merge pull request #7776 from openfoodfoundation/dependabot/npm_and_yarn/ssri-6.0.2
Bump ssri from 6.0.1 to 6.0.2
2021-06-10 19:45:00 +02:00
Andy Brett
d22f807084 Merge pull request #7773 from Matt-Yorkley/rspec-retries
Set Capybara retry count to 3 and remove conditional
2021-06-10 09:52:50 -07:00
Andy Brett
75440856af Merge pull request #7770 from openfoodfoundation/dependabot/bundler/rubocop-1.16.1
Bump rubocop from 1.16.0 to 1.16.1
2021-06-10 09:51:35 -07:00
dependabot[bot]
c614b92c5f Bump ssri from 6.0.1 to 6.0.2
Bumps [ssri](https://github.com/npm/ssri) from 6.0.1 to 6.0.2.
- [Release notes](https://github.com/npm/ssri/releases)
- [Changelog](https://github.com/npm/ssri/blob/v6.0.2/CHANGELOG.md)
- [Commits](https://github.com/npm/ssri/compare/v6.0.1...v6.0.2)

---
updated-dependencies:
- dependency-name: ssri
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-06-10 16:51:16 +00:00
Andy Brett
84e3db30f1 Merge pull request #7772 from openfoodfoundation/dependabot/bundler/view_component-2.34.0
Bump view_component from 2.33.0 to 2.34.0
2021-06-10 09:50:42 -07:00
Matt-Yorkley
937cede9b8 Fix tax adjustment label
:amount is actually a property on the TaxRate object itself that refers to the rate (eg 10% expressed as 0.10), and is not the same as the adjustment amount being passed in to this method (eg: $4.28)
2021-06-10 17:16:45 +01:00
Matt-Yorkley
50b5fc7545 Set Capybara retry count to 3 and remove conditional
This is a slippery slope and there's perfectly reasonable arguments against doing this, but on a practical level I think retrying the occasional flaky spec (and adding an extra 10 seconds or so on to the build time) is categorically better than failing the build and having to restart the whole thing (potentially multiple times).
2021-06-10 11:39:05 +01:00
Matt-Yorkley
f36c01abf6 Merge pull request #7765 from mkllnk/7764-heartbeat-job
Avoid false alarms due to delayed HeartbeatJob
2021-06-10 11:15:42 +02:00
dependabot[bot]
d259771ce9 Bump view_component from 2.33.0 to 2.34.0
Bumps [view_component](https://github.com/github/view_component) from 2.33.0 to 2.34.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.33.0...v2.34.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-10 05:11:51 +00:00
dependabot[bot]
9fd0b096bd Bump rubocop from 1.16.0 to 1.16.1
Bumps [rubocop](https://github.com/rubocop/rubocop) from 1.16.0 to 1.16.1.
- [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.16.0...v1.16.1)

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

Signed-off-by: dependabot[bot] <support@github.com>
2021-06-10 05:07:28 +00:00
Transifex-Openfoodnetwork
1bbc765028 Updating translations for config/locales/ru.yml 2021-06-10 05:21:49 +10:00
Transifex-Openfoodnetwork
a232722f64 Updating translations for config/locales/ru.yml 2021-06-10 05:18:45 +10:00
Andy Brett
2c1ffa929c Merge pull request #7766 from mkllnk/schema
Update schema file description
2021-06-09 08:45:06 -07:00
Andy Brett
2b66d270c0 Merge pull request #7704 from coopdevs/drop-master-variant-leftovers
Drop product.price from /api/order_cycles/:id/products
2021-06-09 08:20:44 -07:00
Transifex-Openfoodnetwork
0e19232f45 Updating translations for config/locales/ca.yml 2021-06-09 17:22:50 +10:00
Transifex-Openfoodnetwork
f4d9e8e520 Updating translations for config/locales/es.yml 2021-06-09 17:22:39 +10:00
Transifex-Openfoodnetwork
d0041334fa Updating translations for config/locales/en_FR.yml 2021-06-09 16:42:33 +10:00
Transifex-Openfoodnetwork
3b68d8a94e Updating translations for config/locales/fr.yml 2021-06-09 16:41:46 +10:00
Maikel Linke
fc8e22b82e Update schema file description
I ran `rake db:migrate` and Rails updated this section. Let's use or we
have to constantly checkout the schema after migrations or we'll have
unrelated changes in future pull requests.
2021-06-09 16:02:05 +10:00
Maikel
6caae9e886 Merge pull request #7694 from coopdevs/split-confirm-order-job
Split ConfirmOrderJob to avoid blocking DJ worker
2021-06-09 14:11:10 +10:00
Andy Brett
d145d3a8ec add create/delete specs for admin and non-admin users 2021-06-09 14:06:55 +10:00
Andy Brett
d4e9c0afdc spec TOS service object 2021-06-09 14:06:55 +10:00
Andy Brett
e0cdf4ff49 refactor to TOS service 2021-06-09 14:06:54 +10:00
Andy Brett
a4bb697787 add spec for trying to create TOS with no file 2021-06-09 14:06:54 +10:00
Maikel Linke
3e2f81d640 Add helper to view spec needing it 2021-06-09 14:06:54 +10:00
Andy Brett
768c56400c add TOS helper to application_controller.rb 2021-06-09 14:06:54 +10:00
Maikel Linke
af314cbbdf Allow fast checkout without re-accepting old terms
We did that for the shop's terms already and now do it for the platform
terms as well.
2021-06-09 14:06:54 +10:00
Maikel Linke
17a3d23d68 Handle user clicking upload button early 2021-06-09 14:06:54 +10:00
Maikel Linke
e3be519b25 Style TOS page to be usable
It's not pretty but only used by instance managers, very rarely.
2021-06-09 14:06:54 +10:00
Maikel Linke
51ad8f8065 Remove old UI to edit Terms of service
It's now completely replaced by file uploads on a separate page.
2021-06-09 14:06:54 +10:00
Maikel Linke
960b829ece Link to last uploaded Terms of service 2021-06-09 14:06:54 +10:00
Maikel Linke
23999c96bf Unify all links to platform Terms of service
DRY code and have more consistency. We always use "Terms of service" now
and not "Terms of Service" or "Terms and conditions". The latter is used
for the shop's terms, not the platform terms.
2021-06-09 14:06:54 +10:00
Maikel Linke
3b3ba70670 Safeguard deletion of ToS with alert 2021-06-09 14:06:54 +10:00
Maikel Linke
690118c2bd Add delete method to terms of service files 2021-06-09 14:06:54 +10:00
Maikel Linke
3bee9cb951 Add Rails action #new to ToS 2021-06-09 14:06:54 +10:00
Maikel Linke
abe76ccf0f Add upload of Terms of Service files
Admins can upload files and view the most recent (current) one.
2021-06-09 14:06:54 +10:00
Maikel Linke
ed4f61acd7 Add title to TOS config page 2021-06-09 14:06:53 +10:00
Maikel Linke
007b8cd888 Add new admin page for TOS files
Just the basic Rails setup without any functionality yet.
2021-06-09 14:06:53 +10:00
Maikel Linke
1f63bb15eb Remove executable bit from spec 2021-06-09 14:06:53 +10:00
Maikel Linke
9027f8b604 Add attachment to TOS record 2021-06-09 14:06:53 +10:00
Maikel Linke
c4317c5707 Add model TermsOfServiceFile
We want to enable instance managers to upload TOS files.

I also added the rails_helper which is a new convention. It can contain
more Rails specific configuration we currently have in the spec_helper.
2021-06-09 14:06:09 +10:00
Maikel Linke
a0835eae54 Avoid false alarms due to delayed HeartbeatJob
When Sidekiq was restarted, the scheduler's time was reset and jobs were
executed later. Now we trigger the HeartbeatJob straight after a Sidekiq
boot and we shouldn't see any false alarms in our monitoring.
2021-06-09 12:05:18 +10:00
Maikel
2556921110 Merge pull request #7718 from openfoodfoundation/dependabot/bundler/sidekiq-scheduler-3.1.0
Bump sidekiq-scheduler from 3.0.1 to 3.1.0
2021-06-09 12:03:31 +10:00
Andy Brett
fcbe42f080 Merge pull request #7756 from openfoodfoundation/dependabot/bundler/ddtrace-0.50.0
Bump ddtrace from 0.49.0 to 0.50.0
2021-06-08 14:59:22 -07:00
Andy Brett
b6f6407c31 Merge pull request #7660 from jibees/7499-remove-feature-toggle-for-unit-price
Remove feature toggle around unit_price
2021-06-08 10:39:32 -07:00
Andy Brett
82ec04552c Merge pull request #7693 from andrewpbrett/add-password-translation
Add translation keys for password messages
2021-06-08 10:35:41 -07:00
Andy Brett
fe62a0a2a7 Merge pull request #7697 from jibees/7689-trigger-a-change-when-hour/minute-inputs-are-modified
Datetimepicker for order cycles: add keyup event listener on hour/minute inputs
2021-06-08 10:32:07 -07:00
Andy Brett
ba6ebdee15 Merge pull request #7686 from shen-sat/7470-add-delete-action-test-to-shipping-categories-controller-spec
[7470] Add delete action test to ShippingCategoriesController spec
2021-06-08 10:31:26 -07:00
Andy Brett
ede966f2d1 Merge pull request #7640 from apricot12/closed_OC_bheaviour
Checkout made to redirect to shop front when OC closed
2021-06-08 10:30:13 -07:00
Andy Brett
74d93e324c Merge pull request #7661 from romale/products_import_date_translation
Missed import_date translation key
2021-06-08 10:26:13 -07:00
dependabot[bot]
3ff60ede2a Bump stripe from 5.33.0 to 5.34.0
Bumps [stripe](https://github.com/stripe/stripe-ruby) from 5.33.0 to 5.34.0.
- [Release notes](https://github.com/stripe/stripe-ruby/releases)
- [Changelog](https://github.com/stripe/stripe-ruby/blob/master/CHANGELOG.md)
- [Commits](https://github.com/stripe/stripe-ruby/compare/v5.33.0...v5.34.0)

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

Signed-off-by: dependabot[bot] <support@github.com>
2021-06-08 17:06:20 +00:00
Andy Brett
37b3f7aa3f Merge pull request #7743 from openfoodfoundation/dependabot/bundler/test-unit-3.4.4
Bump test-unit from 3.4.2 to 3.4.4
2021-06-08 10:05:01 -07:00
Nihal Mohammed
3b73f72ac2 Show product variant SKU in Xero report 2021-06-08 19:53:55 +05:30
Nihal Mohammed
3b4baab01a Remove unused _paypal_complete partial 2021-06-08 16:31:26 +05:30
Matt-Yorkley
9921e9c72b Merge pull request #7754 from Matt-Yorkley/stripe-issues
Stripe 3DS issues
2021-06-08 11:33:54 +02:00
Nihal Mohammed
4476d7f69e Disable credit button on click 2021-06-08 14:41:25 +05:30
Jean-Baptiste Bellet
6cf0c73453 Use our unlocalizeCurrencyFilter to parse unit value field
- More tolerant (can handle `,` or `.` as decimal separator, remove thousands separator) to return a `number`
2021-06-08 10:55:43 +02:00
Jean-Baptiste Bellet
d3c2158121 Handle comma as decimal separator in the unit value field
- Add comma as a decimal separator in the regexp
 - Do not use parseFloat but our `unlocalizeCurrencyFilter` which is more tolerant
2021-06-08 09:51:30 +02:00
Jean-Baptiste Bellet
0cb2739139 Handle case when price is not a number
And return a `null` if so.
2021-06-08 09:46:24 +02:00
dependabot[bot]
0cca01345c Bump acts-as-taggable-on from 7.0.0 to 8.0.0
Bumps [acts-as-taggable-on](https://github.com/mbleigh/acts-as-taggable-on) from 7.0.0 to 8.0.0.
- [Release notes](https://github.com/mbleigh/acts-as-taggable-on/releases)
- [Changelog](https://github.com/mbleigh/acts-as-taggable-on/blob/master/CHANGELOG.md)
- [Commits](https://github.com/mbleigh/acts-as-taggable-on/compare/v7.0.0...v8.0.0)

---
updated-dependencies:
- dependency-name: acts-as-taggable-on
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-06-08 05:12:23 +00:00
dependabot[bot]
6edb80ea29 Bump ddtrace from 0.49.0 to 0.50.0
Bumps [ddtrace](https://github.com/DataDog/dd-trace-rb) from 0.49.0 to 0.50.0.
- [Release notes](https://github.com/DataDog/dd-trace-rb/releases)
- [Changelog](https://github.com/DataDog/dd-trace-rb/blob/master/CHANGELOG.md)
- [Commits](https://github.com/DataDog/dd-trace-rb/compare/v0.49.0...v0.50.0)

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

Signed-off-by: dependabot[bot] <support@github.com>
2021-06-08 05:10:49 +00:00
Matt-Yorkley
15b386bce3 Set :execute_threed option to explicitly handle 3DS responses 2021-06-07 22:48:54 +01:00
Transifex-Openfoodnetwork
225edbf745 Updating translations for config/locales/fr_CA.yml 2021-06-08 07:13:36 +10:00
Transifex-Openfoodnetwork
e8fb5d39a1 Updating translations for config/locales/en_CA.yml 2021-06-08 06:39:23 +10:00
Matt-Yorkley
3544b7de7a Remove Stripe Decorator
The method being overridden here is the same in the upstream
2021-06-07 20:44:58 +01:00
Jean-Baptiste Bellet
e3f56556cf Remove feature toggle around unit_price and enable it 2021-06-07 20:53:45 +02:00
Matt-Yorkley
8e0a84a502 Merge pull request #7729 from Matt-Yorkley/delayed-cleanup
Delayed::Cleanup
2021-06-07 19:11:37 +02:00
Jean-Baptiste Bellet
3ebba9502a Handle more cases with decimal/thousands separator
- ',' or '.' can be used as decimal separator (defined in the application configuration)
 - Remove thousands separator if it's detected as so (use regexp to match)
2021-06-07 16:53:20 +02:00
Nihal Mohammed
a5190ec5d7 Remove refund button from paypal completed order tab 2021-06-07 16:07:31 +05:30
dependabot[bot]
90f1e3a80d Bump pdf-reader from 2.4.2 to 2.5.0
Bumps [pdf-reader](https://github.com/yob/pdf-reader) from 2.4.2 to 2.5.0.
- [Release notes](https://github.com/yob/pdf-reader/releases)
- [Changelog](https://github.com/yob/pdf-reader/blob/main/CHANGELOG)
- [Commits](https://github.com/yob/pdf-reader/compare/v2.4.2...v2.5.0)

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

Signed-off-by: dependabot[bot] <support@github.com>
2021-06-07 05:42:29 +00:00
Matt-Yorkley
5bfe079262 Update Xero Invoices test setup
Uses the new format of enterprise fee taxes
2021-06-06 20:20:41 +01:00
Matt-Yorkley
7b641ace23 Update Xero Invoices scopes for taxable fees
Taxable enterprise fee adjustments now have a tax_category
2021-06-06 20:20:41 +01:00
Matt-Yorkley
7bcb0bcaa8 Eager-load the adjustment's adjustable
Reduces the total migration time by ~15%. Requires including some more models, as order objects are now being eager-loaded as part of the polymorphic associations.
2021-06-06 20:20:41 +01:00
Matt-Yorkley
7ecd67a3fe Skip orphaned adjustments
There are a handful of enterprise fee adjustments on line items in production data where the line item has actually been deleted and no longer exists, but the fee adjustment is still in the database.
2021-06-06 20:20:41 +01:00
Matt-Yorkley
d9f459d94a Update db/migrate/20210406161242_migrate_enterprise_fee_tax_amounts.rb
Co-authored-by: Maikel <maikel@email.org.au>
2021-06-06 20:20:41 +01:00
Matt-Yorkley
76756923ba Use non-legacy-tax example in paypal items spec 2021-06-06 20:20:41 +01:00
Matt-Yorkley
401dd99225 Update stubbing of default country id in TaxRate tests 2021-06-06 20:20:41 +01:00
Matt-Yorkley
e21ef3f182 Add test coverage to #create_tax_charge! with legacy taxes 2021-06-06 20:20:41 +01:00
Matt-Yorkley
9e1d8ab369 Introduce legacy tax handing in Order::Updater whenever order totals change
This will remove legacy tax adjustments, recalculate any relevant taxes for items in the order and re-apply them in non-legacy tax adjustments
2021-06-06 20:20:41 +01:00
Matt-Yorkley
00988dc1e7 Use :order_with_totals factory in payments controller spec
This factory makes an order that actually has a line item 👍
2021-06-06 20:20:41 +01:00
Matt-Yorkley
7007de752d Update BulkLineItemsController spec now that taxes on enterprise fees are updated correctly
Tax on fees previously stayed the same unless the fees were deleted recreated from scratch, instead of updating when the fee amounts changed
2021-06-06 20:20:41 +01:00
Matt-Yorkley
832fbb7d5d Update data migration model definitions
The good_migrations gem was not working with polymorphic associations.
2021-06-06 20:18:05 +01:00
Matt-Yorkley
dc7c674a0e Switch to ApplicationRecord in migation spec
Fixes:

An error occurred while loading ./spec/migrations/migrate_enterprise_fee_tax_amounts_spec.rb.
Failure/Error: require_relative '../../db/migrate/20210406161242_migrate_enterprise_fee_tax_amounts'

TypeError:
  superclass mismatch for class Adjustment
# ./db/migrate/20210406161242_migrate_enterprise_fee_tax_amounts.rb:2:in `<class:MigrateEnterpriseFeeTaxAmounts>'
# ./db/migrate/20210406161242_migrate_enterprise_fee_tax_amounts.rb:1:in `<top (required)>'
# ./spec/migrations/migrate_enterprise_fee_tax_amounts_spec.rb:4:in `require_relative'
# ./spec/migrations/migrate_enterprise_fee_tax_amounts_spec.rb:4:in `<top (required)>'
# -e:1:in `<main>'
2021-06-06 20:18:05 +01:00
Matt-Yorkley
bfea47802e Move fee tax call outside of lock and simplify order updating 2021-06-06 20:18:05 +01:00
Matt-Yorkley
28ebb303af Simplify order interface 2021-06-06 20:17:03 +01:00
Matt-Yorkley
f20cf509d3 Add missing Spree translation 2021-06-06 20:17:03 +01:00
Matt-Yorkley
3f9a3b41da Refactor and improve EnterpriseFeeApplicator spec 2021-06-06 20:17:03 +01:00
Matt-Yorkley
38811b5a28 Add Bugsnag message if legacy taxes are used 2021-06-06 20:17:03 +01:00
Matt-Yorkley
f791f6fa20 Add test coverage to recalculating fees and taxes on completed orders 2021-06-06 20:17:03 +01:00
Matt-Yorkley
c84f9e56fb Tax enterprise fee adjustments when calling #recreate_all_fees! 2021-06-06 20:17:03 +01:00
Matt-Yorkley
355837547e Add test coverage for legacy additional taxes in OrderTaxAdjustmentsFetcher
OrderTaxAdjustmentsFetcher is used in various places to display the taxes on an order. This test validates that legacy taxes are still returned and displayed as normal.
2021-06-06 20:16:03 +01:00
Matt-Yorkley
0f5c39317a Re-apply taxes in Admin::OrdersController#update
Ensures taxes are updated properly when hitting the "Update and Recalculate Fees" button on the order edit page.
2021-06-06 20:16:03 +01:00
Matt-Yorkley
43877f4e34 Add unit tests for data migration 2021-06-06 20:16:03 +01:00
Matt-Yorkley
b427fd6876 Add data migration for enterprise fee tax amounts 2021-06-06 20:16:03 +01:00
Matt-Yorkley
a31487a86d Clear any legacy taxes when applying tax to an order
#create_tax_charge! adds tax (adjustments) to all taxable items on an order. If an order order has legacy taxes (lump-sum tax adjustments on the order object), we remove them here before re-applying taxes (using the new setup).
2021-06-06 20:16:03 +01:00
Matt-Yorkley
84a40e6ae0 Improve Order#enterpise_fee_tax 2021-06-06 20:16:03 +01:00
Matt-Yorkley
19f32b7825 Update checkout tax display test setup 2021-06-06 20:16:03 +01:00
Matt-Yorkley
93e422ec59 Update order fee tax test setup 2021-06-06 20:16:03 +01:00
Matt-Yorkley
6e9ae0b0db Update tax totals calculation in Order::Updater
Line items, shipments, and fees now all have taxes recorded in a uniform way, so we can drop more complexity here (and the number of queries).
2021-06-06 20:16:03 +01:00
Matt-Yorkley
a1438bdb3d Update enterprise fee tax adjustment specs 2021-06-06 20:16:03 +01:00
Matt-Yorkley
510f74f654 Update OrderTaxAdjustmentsFetcher
Taxes on Enterprise Fees are now recorded in proper tax adjustments, so they don't need special treatment.
2021-06-06 20:16:03 +01:00
Matt-Yorkley
52452f7939 Update default tax calculator
Line items, shipments and fees can now all be calculated in the same way when applying tax.
2021-06-06 20:16:03 +01:00
Matt-Yorkley
b3240f859a Add tax category id to adjustments 2021-06-06 20:16:03 +01:00
Matt-Yorkley
2de442f44d Move taxing of enterprise fees to TaxRate 2021-06-06 20:16:03 +01:00
Matt-Yorkley
c2211c501d Improve test setup in Xero Invoices spec 2021-06-06 20:16:03 +01:00
Matt-Yorkley
6c340f8ed4 Update SalesTax test setup 2021-06-06 20:16:03 +01:00
Matt-Yorkley
a22cc96ea5 Simplify DefaultTax calculator
This logic is handled in TaxRate and doesn't need to be duplicated here.
2021-06-06 20:16:03 +01:00
Matt-Yorkley
8c9733d8da Remove included tax check from CalculatedAdjustments
This is handled in TaxRate now.
2021-06-06 20:16:03 +01:00
Matt-Yorkley
ff9ad96b74 Update TaxRate specs 2021-06-06 20:16:03 +01:00
Matt-Yorkley
8479d4ff7c Update outdated calls to TaxRate#adjust in specs 2021-06-06 20:16:03 +01:00
Matt-Yorkley
d450aff607 Update Order#create_tax_charge!
TaxRate#adjust now handles individual items instead of the whole order 🎉 We can use this elsewhere too, for example to re-apply taxes on a single line item, we can do: Spree::TaxRate.adjust(order, [line_item])
2021-06-06 20:16:03 +01:00
Matt-Yorkley
1c28b9783f Bring in Spree::TaxRate test coverage 2021-06-06 20:16:03 +01:00
Matt-Yorkley
f92c082df8 Refactor tax adjustment create_label method 2021-06-06 20:16:03 +01:00
Matt-Yorkley
d69f714032 Bring in changes to TaxRate#adjust 2021-06-06 20:16:03 +01:00
Matt-Yorkley
50d0952dd5 Bring in TaxRate#potentially_applicable method and add eager-loading 2021-06-06 20:16:03 +01:00
Matt-Yorkley
82e38b0156 Merge pull request #7623 from Matt-Yorkley/order-contents
Use OrderContents to update line items
2021-06-05 17:11:45 +02:00
Luis Ramos
5453a1c0fa Adapt importer error to new ruby version 2.7 2021-06-04 22:42:27 +01:00
Luis Ramos
18231cd950 Adding bigdecimal to avoid errors with BigDecimal
v1.4.2 is the version that works for us, see here for more details: https://github.com/ruby/bigdecimal/issues/127
2021-06-04 22:42:27 +01:00
Luis Ramos
5629dfbe09 Fix warning: deprecated Object#=~ is called 2021-06-04 22:42:27 +01:00
Luis Ramos
21b80db0ee Fix json v1.8.6 common.rb warning
Using this patch https://github.com/flori/json/issues/399#issuecomment-734863279

We can upgrade to json v2 but to do that we need to switch from aws-sdk-v1 to aws-sdk-s3 first
2021-06-04 22:42:27 +01:00
Luis Ramos
c22799bda1 Replace gsub! with gsub so that strings are not modified 2021-06-04 22:42:22 +01:00
Luis Ramos
2b187c0547 Upgrade to ruby 2.7.3 2021-06-04 22:29:49 +01:00
Andy Brett
640aa11f3b Merge pull request #7744 from luisramos0/byebug
Move byebug to test gem group so we can use it in specs
2021-06-04 13:17:43 -07:00
Luis Ramos
b939a292df Move byebug to test gem group so we can use it in specs 2021-06-04 20:59:50 +01:00
Matt-Yorkley
099ef5d358 Add more explicit tests on updating shipping fees in Api::ShipmentsController 2021-06-04 18:19:27 +01:00
Guido Oliveira
65b760b119 Add validations to variant_override model 2021-06-04 14:11:22 -03:00
dependabot[bot]
6de0682439 Bump test-unit from 3.4.2 to 3.4.4
Bumps [test-unit](https://github.com/test-unit/test-unit) from 3.4.2 to 3.4.4.
- [Release notes](https://github.com/test-unit/test-unit/releases)
- [Commits](https://github.com/test-unit/test-unit/compare/3.4.2...3.4.4)

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

Signed-off-by: dependabot[bot] <support@github.com>
2021-06-04 16:57:41 +00:00
Matt-Yorkley
efcf71fd2b Use OrderContents in cart spec test setups 2021-06-04 17:26:49 +01:00
Matt-Yorkley
acf7c0c4d8 Use :order_with_totals factory in CustomersController spec 2021-06-04 17:10:50 +01:00
Matt-Yorkley
443b180f32 Update order totals in :order_with_totals factory 2021-06-04 17:10:50 +01:00
Matt-Yorkley
3222d4980d Improve comment on #ensure_updated_shipments 2021-06-04 17:10:50 +01:00
Matt-Yorkley
e246eed99d Move #restart_chceckout_flow out of Order class 2021-06-04 17:10:50 +01:00
Matt-Yorkley
b69d61dd77 Remove #order_update! call from method used in order after_save callbacks
This method gets called twice every time we save a completed order, calling order_update! twice...
2021-06-04 17:10:50 +01:00
Matt-Yorkley
2d76c2730a Update shipment updating 2021-06-04 17:10:50 +01:00
Matt-Yorkley
6b364dc420 Update specs on shipping fee changes and mark as pending
The shipping fee and it's tax actually don't get updated correctly here (in master).
2021-06-04 17:10:50 +01:00
Matt-Yorkley
d5b20d5446 Add specs for Order#ensure_updated_shipments 2021-06-04 17:10:50 +01:00
Matt-Yorkley
05c001807e Add variant override specs for Stock::AvailabilityValidator 2021-06-04 17:10:50 +01:00
Matt-Yorkley
011da05712 Add more test coverage to OrderContents 2021-06-04 17:10:50 +01:00
Matt-Yorkley
2e96982e60 Refactor conditional
CartService#populate already returns the value of the #valid? method by default.
2021-06-04 17:10:50 +01:00
Matt-Yorkley
6abe0b375c Refactor stock levels check in CartController 2021-06-04 17:10:50 +01:00
Matt-Yorkley
dc6be6f06b Don't resubmit the whole cart contents for no reason.
There's a couple of places where this was causing a cart update submission where it wasn't needed, eg the items had not actually changed. The conditional here was designed to stop that from happening, but it was actually passing every time (the conditional logic was not actually catching the case it was supposed to).

This is really expensive!
2021-06-04 17:10:50 +01:00
Matt-Yorkley
47e2976fd1 Update CartService specs 2021-06-04 17:10:50 +01:00
Matt-Yorkley
38ce9eb0c4 Update line item removal in CartService when the line item doesn't exist 2021-06-04 17:10:50 +01:00
Matt-Yorkley
3b52b173e8 Delete more dead code in CartService 2021-06-04 17:10:50 +01:00
Matt-Yorkley
b8ccee5f30 Simplify use of #to_i in variant data hash 2021-06-04 17:10:50 +01:00
Matt-Yorkley
0cfe7fdc45 Move required logic into OrderContents and improve spec 2021-06-04 17:10:50 +01:00
Matt-Yorkley
42ff2307fa Update specs that use removed #add_variant and #remove_variant methods in test setup 2021-06-04 17:10:50 +01:00
Matt-Yorkley
b25e7fcb89 Delete tests for removed Order #add_variant and #remove_variant methods 2021-06-04 17:10:50 +01:00
Matt-Yorkley
79aebed40e Bring OrderContents#update_cart tests from upstream and tidy up 2021-06-04 17:10:50 +01:00
Matt-Yorkley
f5c08baabb Use OrderContents in LineItemsController and move enterprise fee updating logic 2021-06-04 17:10:50 +01:00
Matt-Yorkley
a883b2cf63 Remove dead code CartService#cart_remove 2021-06-04 17:10:50 +01:00
Matt-Yorkley
398d4b2612 Tidy up public interface of CartService
We don't need this extra hash to be passed around
2021-06-04 17:10:50 +01:00
Matt-Yorkley
4a7c0e8297 Remove variant early if we're deleting them and they're already loaded 2021-06-04 17:10:50 +01:00
Matt-Yorkley
67df6728f6 Fix Order line items association definition
Populating the cart was throwing an "Association Mismatch" error D:
2021-06-04 17:10:50 +01:00
Matt-Yorkley
0178cd7530 Adapt OrderContents to allow use with frontend cart service and updating :max_quantity
The cart service and it's surrounding logic is a bit messy, as it jumps through hoops to add extra logic for the :max_quantity attribute used with the "group buy" feature.

This is the last bit of code where an order's line items could be changed where we were not using OrderContents.
2021-06-04 17:10:50 +01:00
Matt-Yorkley
cb92231835 Clarify behavior via variable names
This is a small semantic thing to clarify that we're not adding to / incrementing the quantity here, we're setting it to the given value. In other places where we change line items on an order we are actually adding the given value to the existing quantity.
2021-06-04 17:10:50 +01:00
Matt-Yorkley
6e8fd3c3f8 Simplify CartService interface
There's only one place this method is called, and the "overwrite" argument is always explicitly true. It doesn't need to be there if it's mandatory.
2021-06-04 17:10:50 +01:00
Matt-Yorkley
6451ef173c Use OrderContents when removing line items with soft-deleted variants in CartService 2021-06-04 17:10:50 +01:00
Matt-Yorkley
7af5e8931f Adapt OrderContents for use with BulkLineItemsController#update 2021-06-04 17:10:50 +01:00
Matt-Yorkley
9045cc7d65 Use OrderContents in CartService for removing line items from cart 2021-06-04 17:10:50 +01:00
Matt-Yorkley
5ff8436c1a Adapt OrderContents#remove to allow deleting line item without passing a quantity 2021-06-04 17:10:50 +01:00
Matt-Yorkley
a5ccaf9595 Remove unnecessary code in BulkLineItemsController
This method isn't called from anywhere else
2021-06-04 17:10:50 +01:00
Matt-Yorkley
423c140670 Remove pointless currency code in Order and CartService
The currency will always be the currency of the variant, there's no need to pass this value around.
2021-06-04 17:10:50 +01:00
Matt-Yorkley
e8ef183623 Delete dead code Order#set_variant_attributes 2021-06-04 17:10:50 +01:00
Matt-Yorkley
000e2c07f8 Use OrderContents in OrdersController 2021-06-04 17:10:50 +01:00
Matt-Yorkley
c1c69b00b4 Update order explicitly in OrderSyncer 2021-06-04 17:10:50 +01:00
Matt-Yorkley
d5edf03042 Update reports_spec test setup 2021-06-04 17:10:50 +01:00
Matt-Yorkley
305ac037fe Use OrderContents in customers controller spec 2021-06-04 17:10:50 +01:00
Matt-Yorkley
23910dbab4 Use OrderContents in BulkLineItemsController
We should move towards *all* operations on an order's line items being done exclusively through this service.
2021-06-04 17:10:50 +01:00
Matt-Yorkley
632f4228f0 Bring in line item fetching refactor 2021-06-04 17:10:50 +01:00
Matt-Yorkley
1268cb565c Extract method 2021-06-04 17:10:50 +01:00
Matt-Yorkley
c55e47f6af Remove superfluous updates in OrderFeesHandler 2021-06-04 17:10:50 +01:00
Matt-Yorkley
03fc63ad14 Remove #order_update! from line item after_save callback 2021-06-04 17:10:50 +01:00
Matt-Yorkley
a124141537 Move Shipment#line_items to private 2021-06-04 17:10:50 +01:00
Matt-Yorkley
0fabb5bc2f Don't pluck variant_ids multiple times (once for each line item) 2021-06-04 17:10:50 +01:00
Matt-Yorkley
1fff81c214 Remove call to OrderInventory#verify
This already gets called in after_save and after_destroy in Spree::LineItem.
2021-06-04 17:10:50 +01:00
Matt-Yorkley
67264c047f Delete dead code #editable_by?
This is junk Spree code from 2010. 11 years old! The method that previous called this was removed long ago...
2021-06-04 17:10:50 +01:00
Matt-Yorkley
34eaf6f0f2 DRY shipment updating 2021-06-04 17:10:50 +01:00
Matt-Yorkley
8405a7672d Bring in shipment updating 2021-06-04 17:10:50 +01:00
Matt-Yorkley
66a3246a23 Move order updating 2021-06-04 17:10:50 +01:00
Matt-Yorkley
34482f6710 Bring OrderContents#update_cart from Spree 2.2 2021-06-04 17:10:50 +01:00
Matt-Yorkley
f550d1e9f3 Bring Order#ensure_updated_shipments from Spree 2.2 2021-06-04 17:10:50 +01:00
Matt-Yorkley
d99e598e7a Delete dead code in CartController
The two conditionals in #populate_variant_attributes here are never actually true, so the subsequent code paths are never reached.
2021-06-04 17:10:50 +01:00
Matt-Yorkley
eb59b691d8 Move hash parsing outside of order lock 2021-06-04 17:10:50 +01:00
Matt-Yorkley
d5d76d9b9a Move private controller methods to private 2021-06-04 17:10:50 +01:00
Andy Brett
3c933befbb Merge pull request #7607 from luisramos0/rails6_select2_upgrade
[Rails 6.1] Upgrade thor
2021-06-04 07:45:47 -07:00
Andy Brett
fc4a40ec8b Merge pull request #7668 from openfoodfoundation/dependabot/bundler/stripe-5.33.0
Bump stripe from 5.32.1 to 5.33.0
2021-06-04 07:45:02 -07:00
Andy Brett
d197b81351 Merge pull request #7606 from luisramos0/deprecation
[Rails 6.1] Fix deprecation warning in rails 6.0
2021-06-04 07:42:50 -07:00
Andy Brett
b1f619a90a Merge pull request #7715 from openfoodfoundation/dependabot/bundler/activemerchant-1.120.0
Bump activemerchant from 1.119.0 to 1.120.0
2021-06-04 07:40:24 -07:00
Andy Brett
f70c1f0644 Merge pull request #7611 from luisramos0/rails61_arel
[Rails 6.1] Adapt code to circunvent security constraint on rails 6.1
2021-06-04 07:36:23 -07:00
Andy Brett
b23530be4c Merge pull request #7736 from Matt-Yorkley/ssl-in-dev
Remove Spree::Config[:allow_ssl_in_development_and_test]
2021-06-04 07:21:05 -07:00
dependabot[bot]
1fe74c9690 Bump activemerchant from 1.119.0 to 1.120.0
Bumps [activemerchant](https://github.com/activemerchant/active_merchant) from 1.119.0 to 1.120.0.
- [Release notes](https://github.com/activemerchant/active_merchant/releases)
- [Changelog](https://github.com/activemerchant/active_merchant/blob/master/CHANGELOG)
- [Commits](https://github.com/activemerchant/active_merchant/compare/v1.119.0...v1.120.0)

Signed-off-by: dependabot[bot] <support@github.com>
2021-06-04 14:20:09 +00:00
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
Pau Perez
dfe83e5c51 Do not return master variant in api/ocs/products
`product.master` seems to always be `null` on
/api/v0/order_cycles/:id/products JSON response. That's because the
first of the underlying AR relation,
`order_cycle.variants_distributed_by(distributor)`, does not include
master variants. They are not in OC exchanges.
2021-06-04 12:10:52 +02:00
Pau Perez
e7166ba5d4 Drop product.price from /api/ocs/:id/products
Its serializer it's only used by this endpoint and
app/assets/javascripts/templates/shop_variant.html.haml doesn't rely on
the response's product.price but the variant's price.

Because our DB schema allows NULL on spree_prices.amount, a master
variant without a price can cause the shopfront not to load products.
This was the case in
https://app.bugsnag.com/yaycode/openfoodnetwork-uk/errors/60adfcc31cf9740007f82fc9.
2021-06-04 12:10:52 +02: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
Luis Ramos
66934af579 Upgrade to thor v1 2021-06-03 20:54:55 +01: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
Luis Ramos
466f7030c6 Depend on select2-rails without the thor v0.14 requirement 2021-06-03 20:54:07 +01:00
Matt-Yorkley
7d38bec26d Remove Spree::Config[:allow_ssl_in_development_and_test]
Unconditionally disables forced https-redirects in dev and test
2021-06-03 20:52:09 +01: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
dependabot[bot]
69690f1e37 Bump stripe from 5.30.0 to 5.33.0
Bumps [stripe](https://github.com/stripe/stripe-ruby) from 5.30.0 to 5.33.0.
- [Release notes](https://github.com/stripe/stripe-ruby/releases)
- [Changelog](https://github.com/stripe/stripe-ruby/blob/master/CHANGELOG.md)
- [Commits](https://github.com/stripe/stripe-ruby/compare/v5.30.0...v5.33.0)

Signed-off-by: dependabot[bot] <support@github.com>
2021-06-03 16:43:38 +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
d66b6f7192 Fix InvoicesController spec and change from pending to active 2021-06-03 12:51:15 +01:00
Matt-Yorkley
ba592c1ca3 Switch JobLogger to using the default Rails logger
Logging in background jobs with Sidekiq all ultimately get sent to STDOUT now anyway, which is redirected to `/log/sidekiq.log` via the Sidekiq systemd service.
2021-06-03 12:48:18 +01:00
Matt-Yorkley
0ede0acc6a Remove DelayedJob references 2021-06-03 12:45:23 +01: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
Shen
80ae211b72 Use correct syntax for change matcher in spec/controllers/spree/admin/shipping_categories_controller_spec.rb
Co-authored-by: Maikel <maikel@email.org.au>
2021-06-02 13:17:49 +01:00
Shen Sat
99a4be134b Add delete action test to ShippingCategoriesController spec 2021-06-02 13:17:49 +01: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
b1bfac5144 Update all locales with the latest Transifex translations 2021-06-01 19:10:58 +01: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 Pérez Fabregat
01f8aff3e0 Merge pull request #7716 from coopdevs/pick-up-site-name-from-env
Allow :site_name to be picked up from ENV vars
2021-06-01 13:50:36 +02:00
Jean-Baptiste Bellet
60f3ebca62 Check whether the changes made by the keyboard are taken into account in datetimepicker
- User can change minute directly with keyboard, and without closing the datetimepicker, the modification should be catch and then a label "You have unsaved changes" with the "Save changes" button should appear
2021-06-01 12:05:03 +02:00
Jean-Baptiste Bellet
0db7df6c14 Add keyup event listener on hour/minute inputs
- To set the date (and trigger the onChange event) when the user is typing through its keyboard
2021-06-01 12:04:55 +02:00
Pau Perez
74a8b3038a Split ConfirmOrderJob to avoid blocking a worker
This unties this two email notifications so that they are picked up by
a DJ worker independently. This should avoid the blocking the worker experiences (remember we
still have a single one in all instances) when waiting between the two
deliveries. See the flamegraph:
https://app.datadoghq.com/apm/traces?end=1622015605459&paused=true&query=env%3Aproduction%20service%3Adelayed_job%20operation_name%3Adelayed_job%20resource_name%3AConfirmOrderJob%20%40duration%3A%3E%3D5s&start=1622009898303&streamTraces=true&trace=AQAAAXmngbg_woqc_QAAAABBWG1uZ2IwVkFBRHVDbWJkN25QTUVuY28&traceID=2916038355421570548&spanID=2005781139590273685.

Overall, both operations may take longer but other jobs can be processed
in between. Also, if any of the two fails, the other won't be affected.
2021-06-01 11:43:00 +02:00
Jean-Baptiste Bellet
f73e5c74fb Handle null/undefined cases for price 2021-06-01 11:40:02 +02:00
dependabot[bot]
de1d4fa4eb Bump sidekiq-scheduler from 3.0.1 to 3.1.0
Bumps [sidekiq-scheduler](https://github.com/moove-it/sidekiq-scheduler) from 3.0.1 to 3.1.0.
- [Release notes](https://github.com/moove-it/sidekiq-scheduler/releases)
- [Commits](https://github.com/moove-it/sidekiq-scheduler/compare/v3.0.1...v3.1.0)

Signed-off-by: dependabot[bot] <support@github.com>
2021-06-01 05:31:12 +00: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
Matt-Yorkley
7f9179193e Merge pull request #7713 from openfoodfoundation/dependabot/npm_and_yarn/ws-7.4.6
Bump ws from 7.4.4 to 7.4.6
2021-05-31 16:07:05 +02:00
Pau Perez
3be0e1c13a Allow :site_name to be picked up from ENV vars
This mimics what we did in 6377736f4. This way provisioning an instance
from scratch doesn't require configuring things from the backoffice,
which will simplify the roll out of
https://github.com/openfoodfoundation/ofn-install/pull/734.
2021-05-31 15:50:54 +02:00
Pau Pérez Fabregat
18c020535a Merge pull request #7711 from Matt-Yorkley/sidekiq
Sidekiq!
2021-05-31 15:11:45 +02:00
Matt-Yorkley
8d1fcc06fd Remove logfile config
This setting was removed in Sidekiq 6.0, logs are handled a bit differently now. The logging works though 👍
2021-05-31 10:46:43 +01:00
Matt-Yorkley
2b6a72ffb4 Remove DelayedJob web UI 2021-05-31 10:10:36 +01:00
Pau Pérez Fabregat
157d86c94f Merge pull request #7714 from openfoodfoundation/dependabot/bundler/test-unit-3.4.2
Bump test-unit from 3.4.1 to 3.4.2
2021-05-31 11:04:42 +02:00
Pau Pérez Fabregat
d41de06809 Merge pull request #7707 from openfoodfoundation/transifex
Transifex
2021-05-31 10:59:04 +02:00
Jean-Baptiste Bellet
7008b5ec7b Make a more generic solution: KeyValueMapStore
- As QueryPersistence, stored in the localStorage too but it is now more generic and has nothing to do with Query
 - Add some js unit testing
2021-05-31 10:44:21 +02:00
Jean-Baptiste Bellet
f167b09397 Add distributor and order cycle selectors in the test 2021-05-31 10:44:21 +02:00
Jean-Baptiste Bellet
54c645e33a Add tests for clearing all filters feature
- and check each filter is well reinitialized
2021-05-31 10:44:21 +02:00
Jean-Baptiste Bellet
385446807d Add a clear filters button
- This button clear all stored filters and then update results
2021-05-31 10:44:21 +02:00
Jean-Baptiste Bellet
ea2cb4e6c0 Update flatpickr input value if ng-model change 2021-05-31 10:44:21 +02:00
Jean-Baptiste Bellet
303bf5420e Add select2WatchNgModel directive
- Select2 components cannot handle ng-model correctly: they do not update if the ng-model change. Add a directive to watch the ng-model and update the component value
2021-05-31 10:44:21 +02:00
Jean-Baptiste Bellet
58a96c6500 Add missing ] char to be consistant 2021-05-31 10:44:12 +02:00
Jean-Baptiste Bellet
4f50afc188 Change shipping_method_id storage: in the query 2021-05-31 10:44:12 +02:00
Jean-Baptiste Bellet
e388238a25 Add tests for saving filter params in Orders list 2021-05-31 10:44:12 +02:00
Jean-Baptiste Bellet
1674c6a252 Improve HTML to improve tests readability
- Specify `for` attribute to `<label />` element
- Initialize component with its default value

So, it's linked to its `<input />`
2021-05-31 10:44:12 +02:00
Matt-Yorkley
93ebfb6a4f Improve checking for presence of saved filters 2021-05-31 10:44:12 +02:00
Matt-Yorkley
47404b1dc8 Improve handling of nils 2021-05-31 10:44:12 +02:00
Matt-Yorkley
c24ceac063 Extract default-setting to comment method 2021-05-31 10:44:12 +02:00
Jean-Baptiste Bellet
c5a2d183d8 Save filter params to sessionStorage for orders list
- Use sessionStorage to save the filters params each time a filter is modified
2021-05-31 10:44:12 +02:00
Transifex-Openfoodnetwork
d730f21dc7 Updating translations for config/locales/en_GB.yml 2021-05-31 17:54:39 +10:00
dependabot[bot]
49dfaa20ab Bump test-unit from 3.4.1 to 3.4.2
Bumps [test-unit](https://github.com/test-unit/test-unit) from 3.4.1 to 3.4.2.
- [Release notes](https://github.com/test-unit/test-unit/releases)
- [Commits](https://github.com/test-unit/test-unit/compare/3.4.1...3.4.2)

Signed-off-by: dependabot[bot] <support@github.com>
2021-05-31 05:38:26 +00:00
dependabot[bot]
bfeb892cab Bump ws from 7.4.4 to 7.4.6
Bumps [ws](https://github.com/websockets/ws) from 7.4.4 to 7.4.6.
- [Release notes](https://github.com/websockets/ws/releases)
- [Commits](https://github.com/websockets/ws/compare/7.4.4...7.4.6)

Signed-off-by: dependabot[bot] <support@github.com>
2021-05-30 21:28:21 +00:00
Matt-Yorkley
4b56422abd Add network timeouts
In rare cases where Redis is being updated/restarted while a job is running, this should add some flexibility.
2021-05-29 21:07:36 +01:00
Matt-Yorkley
53e3e2b66d Remove outdated Job test helpers
This logic around testing jobs is already handled by integrations with ActiveJob since Rails 4.2
2021-05-29 16:37:06 +01:00
Matt-Yorkley
834140f0a2 Don't dump massive binary PDF data into the job queue
Here we were rendering an entire PDF, then passing that PDF into the job queue as an *argument* containing the entire binary of the PDF in a massive string. This means the job object itself would contain that entire PDF. That's bad queueing!

We now create the PDF *during* the job (not before it), and pass simple arguments.
2021-05-29 16:06:29 +01:00
Matt-Yorkley
0d95d83ef9 Add sidekiq-scheduler to web UI 2021-05-29 13:12:33 +01:00
Matt-Yorkley
54d373c963 Enqueue scheduled jobs with sidekick-scheduler 2021-05-29 13:12:33 +01:00
Matt-Yorkley
1dfd68c691 Add sidekiq-scheduler 2021-05-29 13:12:33 +01:00
Matt-Yorkley
df9213e812 Bump port for new caching instance 2021-05-29 13:12:33 +01:00
Matt-Yorkley
03a078a3a0 Remove namespacing in cache config 2021-05-29 13:11:59 +01:00
Matt-Yorkley
11da025247 Add Sidekiq web interface 2021-05-29 13:11:59 +01:00
Matt-Yorkley
07a9da901f Switch queue adapter to Sidekiq 2021-05-29 13:11:59 +01:00
Matt-Yorkley
4ac3853be9 Configure Sidekiq 2021-05-29 13:11:59 +01:00
Transifex-Openfoodnetwork
eae7a9978c Updating translations for config/locales/de_DE.yml 2021-05-29 18:47:49 +10:00
Transifex-Openfoodnetwork
bdd8572fbf Updating translations for config/locales/en_US.yml 2021-05-29 02:59:45 +10:00
Matt-Yorkley
07422dac29 Add sidekiq gem 2021-05-28 16:58:26 +01:00
jibees
088ae496cc Merge pull request #7664 from shen-sat/7626-fix-unknown-currency-error
7626 fix unknown currency error
2021-05-28 16:18:04 +02:00
Pau Pérez Fabregat
c83a619082 Merge pull request #7705 from openfoodfoundation/transifex
Transifex
2021-05-28 15:45:58 +02:00
Transifex-Openfoodnetwork
ca7d1b111a Updating translations for config/locales/ru.yml 2021-05-28 21:35:53 +10:00
Pau Pérez Fabregat
3c507c1727 Merge pull request #7696 from openfoodfoundation/transifex
Transifex
2021-05-28 13:28:39 +02:00
Jean-Baptiste Bellet
b111d24488 Update all locales with the latest Transifex translations 2021-05-28 09:12:42 +02:00
Andy Brett
4dc8b44e81 Merge pull request #7695 from coopdevs/fix-ruby-installation-dockerfile
Fix Rbenv and ruby-build installation to get Ruby 2.5.9
2021-05-27 11:30:31 -07:00
Andy Brett
27a9ad7bcb Merge pull request #7698 from Matt-Yorkley/remove-eventmachine
Remove eventmachine gem
2021-05-27 11:30:14 -07:00
Pau Perez
fbd4d512d5 Add libssl as required by Ruby 2.5.9
This is a more recent libssl version in Ubuntu 20. Not related to the
libssl1.0 hack required by older Ruby versions.
2021-05-27 17:50:22 +02:00
Pau Perez
0f85db6d36 Fix Rbenv and ruby-build installation to get 2.5.9
This newer Ruby version can't be found on that ruby-build's branch that
we were installing. The `docker-compose build` command works again.
2021-05-27 17:50:22 +02:00
Pau Pérez Fabregat
0f78b5b315 Merge pull request #7616 from jibees/7602-unit-price-not-displaying-when-comma-is-the-decimal-separator
Backoffice: Unit price not displaying when comma is the decimal separator
2021-05-27 17:45:19 +02:00
Matt-Yorkley
78e3bb1acd Remove eventmachine gem
This was a dependency of a dependency a long time ago...
2021-05-27 15:57:17 +01:00
Transifex-Openfoodnetwork
c5e1c057ae Updating translations for config/locales/es.yml 2021-05-28 00:17:47 +10:00
Transifex-Openfoodnetwork
f34a3c3c02 Updating translations for config/locales/ca.yml 2021-05-28 00:17:29 +10:00
Transifex-Openfoodnetwork
546a32e97a Updating translations for config/locales/en_FR.yml 2021-05-27 22:47:27 +10:00
Transifex-Openfoodnetwork
abd269949d Updating translations for config/locales/fr.yml 2021-05-27 22:47:09 +10:00
Pau Pérez Fabregat
0d5f76b19e Merge pull request #7621 from jibees/7534-upload-logo-and-promo-image-for-enterprise
Upload enterprise image (logo and promo): force content type to "text/plain"
2021-05-27 11:33:56 +02:00
Pau Pérez Fabregat
bfa77baae1 Merge pull request #7542 from jibees/6359-add-payment-method-description-to-invoice
Add payment method description to invoice
2021-05-27 11:01:07 +02:00
Pau Pérez Fabregat
a2a1aac384 Merge pull request #7604 from coopdevs/compile-with-jemalloc
Compile Ruby with jemalloc
2021-05-27 08:30:51 +02:00
Pau Perez
43ede7ba26 Remove libssl1.0 from Dockerfile
We recently removed it from production in
bd9e382fba.
2021-05-27 08:09:51 +02:00
kgericke
bb8535cb3a add translation keys for password messages 2021-05-26 08:50:16 -07:00
Andy Brett
883e9fdf62 Merge pull request #7690 from Matt-Yorkley/ruby-259
Bump Ruby to 2.5.9
2021-05-26 08:41:15 -07:00
Matt-Yorkley
c625766af1 Bump Ruby to 2.5.9 2021-05-26 09:36:28 +01:00
Andy Brett
23730ab28f Merge pull request #7683 from openfoodfoundation/dependabot/bundler/view_component-2.32.0
Bump view_component from 2.31.1 to 2.32.0
2021-05-25 07:36:25 -07:00
Jean-Baptiste Bellet
0c8bfea2f7 Add feature tests for upload images on enterprise registration
For both logo and promo images
2021-05-25 15:30:35 +02:00
Jean-Baptiste Bellet
0306732a3d Add test for enterprise logo and promo image uploading
- Add a fixture image to do the upload thanks to `fixture_file_upload`
 - Check the response status, the content type and the response body for both logo image and promo image
2021-05-25 15:30:29 +02:00
Jean-Baptiste Bellet
6842cbfda4 Force content type to "text/html"
- Force the content type to be `text/html` (instead of `application/json`)
2021-05-25 15:30:21 +02:00
Matt-Yorkley
ecb4cb31ad Merge pull request #7599 from Matt-Yorkley/cart-rendering
Move line item rendering to a collection in cart page
2021-05-25 13:37:50 +02:00
Jean-Baptiste Bellet
dd47430f19 Improve unlocalizeCurrency filter to handle many cases
- Complete the unit test to handle all these cases.
2021-05-25 13:14:53 +02:00
Jean-Baptiste Bellet
afe97bcc96 Add tests for creating/editing product/variant cases with decimal price 2021-05-24 10:55:05 +02:00
Jean-Baptiste Bellet
8af6fedf8a Factorize js:true as a common configuration around all tests 2021-05-24 10:55:05 +02:00
Jean-Baptiste Bellet
d8042b25e4 Add test for unlocalize currency filter
- Test that comma is well handle in both cases where comma is the default decimal separator or not.
2021-05-24 10:55:05 +02:00
Jean-Baptiste Bellet
f97e71d054 Add test for decimal price separated by point or comma 2021-05-24 10:55:05 +02:00
Jean-Baptiste Bellet
d066f0b94d Enable displayable unit price for price with comma as decimal separator
Retrieve the current decimal separator used to display price (`I18n.toCurrency()`), and check if number is formatted with only if this is `,`. If so, remplace comma by point, to pass the check `!isNaN`, and format unit price
2021-05-24 10:55:05 +02:00
dependabot[bot]
e9d389e4f1 Bump view_component from 2.31.1 to 2.32.0
Bumps [view_component](https://github.com/github/view_component) from 2.31.1 to 2.32.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.31.1...v2.32.0)

Signed-off-by: dependabot[bot] <support@github.com>
2021-05-24 05:51:25 +00:00
Jean-Baptiste Bellet
325b97b683 Add tests around invoice printing in PDF
- use PDF Reader to read pdf and get its content
 - check with we print the payment description information section with the right value
2021-05-19 11:55:46 +02:00
Jean-Baptiste Bellet
7ab065e8cd Add section at the bottom of invoice: Payment Description at Checkout
- If there is any payments, we use the last one to retrieve the payment method description
Use the first completed payment to display payment description
Completed is state = "checkout" or state = "completed"
Squash w/ "Add section at the bottom of invoice: Payment Description at Checkout"

Squash w "Add section at the bottom of invoice: Payment Description a"
2021-05-19 11:55:38 +02:00
Jean-Baptiste Bellet
aea0670268 Add method payment_method to get the payment method from a payment
- Method `payment_method_name` now use `payment_method`
2021-05-19 11:55:38 +02:00
Shen Sat
cb914e4729 Change wording in create_admin_user to be more descriptive 2021-05-19 08:45:40 +01:00
Shen Sat
ab027d6af6 Change money initializer to use ENV vars instead of Spree::Config 2021-05-19 08:44:55 +01:00
Shen Sat
6a8ee544e8 Change readme to strong encourage running setup script 2021-05-19 08:44:10 +01:00
alex
4a5cb7f628 Missed import_date translation 2021-05-18 18:30:59 +03:00
Luis Ramos
3f020ec855 Circunvent security contraint on rails 61 2021-05-14 00:13:38 +01:00
Luis Ramos
3d2155b60e Use Arel.sql to curcunvent security restriction on rails 6.1 2021-05-13 23:55:08 +01:00
Nihal Mohammed
0b12b398ba Update spec test for the changed redirect path 2021-05-14 03:32:14 +05:30
Nihal Mohammed
122577b11b Checkout made to redirect to shop front when OC closed 2021-05-14 02:58:41 +05:30
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
Luis Ramos
f29f525d90 Adapt code to circunvent security constraint on rails 6.1 2021-05-10 23:39:17 +01:00
Luis Ramos
d308e20871 Fix deprecation warning in rails 6.0
Warning: Class level methods will no longer inherit scoping from create in Rails 6.1
2021-05-10 21:03:24 +01:00
Pau Perez
ed6b7f1ab4 Split apt packages list into a name per line
This super long line was hard to read.
2021-05-10 19:57:24 +02:00
Pau Perez
4453123944 Compile Ruby with jemalloc 2021-05-10 19:31:04 +02:00
Matt-Yorkley
122ba385f7 Move line item rendering to collection in cart page
Improvement from upstream Spree commit. Brings a big performance boost to rendering, especially with larger numbers of items in the cart. 50%+ reduction in rendering times reported.
2021-05-10 11:50:31 +01:00
Cillian O'Ruanaidh
7e2d9ff381 The Resend Confirmation and Send/Print Invoice links should display for resumed orders too
These are links inside the Actions drop down menu on the edit order view. Before they were missing if an order was in a resumed state.

Fixes #5946
2021-04-02 15:41:59 +01:00
Cillian O'Ruanaidh
413896af5d Add enterprise name to subject and body of shipment shipped email
Fixes #7052
2021-04-02 11:44:40 +01:00
839 changed files with 14176 additions and 6147 deletions

1
.browserslistrc Normal file
View File

@@ -0,0 +1 @@
defaults

View File

@@ -9,6 +9,7 @@ env:
DISABLE_KNAPSACK: true
TIMEZONE: UTC
COVERAGE: true
RSPEC_RETRY_RETRY_COUNT: 3
jobs:
test-controllers-and-serializers:

7
.gitignore vendored
View File

@@ -46,5 +46,10 @@ vendor/bundle/
coverage
/reports/
!/reports/README.md
bin/
/spec/components/stories/**/*.stories.json
/public/packs
/public/packs-test
/yarn-error.log
yarn-debug.log*
.yarn-integrity

View File

@@ -334,7 +334,6 @@ Layout/LineLength:
- spec/services/variant_units/option_value_namer_spec.rb
- spec/spec_helper.rb
- spec/support/cancan_helper.rb
- spec/support/delayed_job_helper.rb
- spec/support/matchers/delegate_matchers.rb
- spec/support/matchers/select2_matchers.rb
- spec/support/matchers/table_matchers.rb
@@ -485,7 +484,6 @@ Metrics/AbcSize:
- lib/spree/core/calculated_adjustments.rb
- lib/spree/core/controller_helpers/order.rb
- lib/spree/core/controller_helpers/respond_with.rb
- lib/spree/core/controller_helpers/ssl.rb
- lib/spree/core/delegate_belongs_to.rb
- lib/spree/core/permalinks.rb
- lib/spree/core/s3_support.rb
@@ -529,7 +527,6 @@ Metrics/BlockLength:
- app/models/spree/payment/processing.rb
- app/models/spree/shipment.rb
- lib/spree/core/controller_helpers/common.rb
- lib/spree/core/controller_helpers/ssl.rb
- lib/tasks/data.rake
- spec/controllers/spree/admin/invoices_controller_spec.rb
- spec/factories/address_factory.rb
@@ -549,7 +546,6 @@ Metrics/BlockLength:
- spec/models/tag_rule/discount_order_spec.rb
- spec/requests/api/orders_spec.rb
- spec/spec_helper.rb
- spec/support/delayed_job_helper.rb
- spec/support/matchers/select2_matchers.rb
- spec/support/matchers/table_matchers.rb
- spec/swagger_helper.rb
@@ -609,7 +605,6 @@ Metrics/CyclomaticComplexity:
- lib/spree/core/calculated_adjustments.rb
- lib/spree/core/controller_helpers/order.rb
- lib/spree/core/controller_helpers/respond_with.rb
- lib/spree/core/controller_helpers/ssl.rb
- lib/spree/localized_number.rb
- spec/models/product_importer_spec.rb
@@ -653,7 +648,6 @@ Metrics/PerceivedComplexity:
- lib/spree/core/calculated_adjustments.rb
- lib/spree/core/controller_helpers/order.rb
- lib/spree/core/controller_helpers/respond_with.rb
- lib/spree/core/controller_helpers/ssl.rb
- lib/spree/localized_number.rb
- spec/models/product_importer_spec.rb

File diff suppressed because it is too large Load Diff

View File

@@ -1 +1 @@
2.5.8
2.7.3

0
.simplecov Normal file → Executable file
View File

View File

@@ -7,23 +7,39 @@ RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN echo "deb http://security.ubuntu.com/ubuntu bionic-security main" >> /etc/apt/sources.list
# Install all the requirements
RUN apt-get update && apt-get install -y curl git build-essential software-properties-common wget zlib1g-dev libssl1.0-dev libreadline-dev libyaml-dev libffi-dev libxml2-dev libxslt1-dev wait-for-it imagemagick unzip
RUN apt-get update && apt-get install -y \
curl \
git \
build-essential \
software-properties-common \
wget \
zlib1g-dev \
libreadline-dev \
libyaml-dev \
libffi-dev \
libxml2-dev \
libxslt1-dev \
wait-for-it \
imagemagick \
unzip \
libjemalloc-dev \
libssl-dev
# Setup ENV variables
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 .
# Install Rbenv & Ruby
RUN git clone --depth 1 --branch v1.1.2 https://github.com/rbenv/rbenv.git ${RBENV_ROOT} && \
git clone --depth 1 --branch v20200520 https://github.com/rbenv/ruby-build.git ${RBENV_ROOT}/plugins/ruby-build && \
${RBENV_ROOT}/plugins/ruby-build/install.sh && \
RUN git clone --depth 1 https://github.com/rbenv/rbenv.git ${RBENV_ROOT} && \
git clone --depth 1 https://github.com/rbenv/ruby-build.git ${RBENV_ROOT}/plugins/ruby-build && \
echo 'eval "$(rbenv init -)"' >> /etc/profile.d/rbenv.sh && \
rbenv install $(cat .ruby-version) && \
RUBY_CONFIGURE_OPTS=--with-jemalloc rbenv install $(cat .ruby-version) && \
rbenv global $(cat .ruby-version) && \
gem install bundler --version=1.17.3

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:
@@ -47,7 +48,11 @@ $ sudo -u postgres psql -c "CREATE USER ofn WITH SUPERUSER CREATEDB PASSWORD 'f0
This will create the "ofn" user as superuser and allowing it to create databases. If this command fails, check the [troubleshooting section](#creating-the-database) for an alternative.
Once done, run `script/setup`. If the script succeeds you're ready to start developing. If not, take a look at the output as it should be informative enough to help you troubleshoot.
Next, it is _strongly recommended_ to run the setup script.
```sh
$ script/setup
```
If the script succeeds you're ready to start developing. If not, take a look at the output as it should be informative enough to help you troubleshoot.
Now, your dreams of spinning up a development server can be realised:

44
Gemfile
View File

@@ -1,18 +1,18 @@
# frozen_string_literal: true
source 'https://rubygems.org'
ruby "2.5.8"
ruby "2.7.3"
git_source(:github) { |repo_name| "https://github.com/#{repo_name}.git" }
gem 'rails', '~> 5.2'
gem 'rails', '~> 6.1.4'
gem 'activemerchant', '>= 1.78.0'
gem 'angular-rails-templates', '>= 0.3.0'
gem 'awesome_nested_set'
gem 'ransack', '2.4.1'
gem 'ransack', '2.4.2'
gem 'responders'
gem 'sass', '<= 4.7.1'
gem 'sass-rails', '< 6.0.0'
gem 'sass-rails', '< 5.1.0' # this restriction originates from the compass-rails's version
gem 'webpacker', '~> 5'
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'
@@ -50,10 +50,6 @@ gem 'devise-token_authenticatable'
gem 'jwt', '~> 2.2'
gem 'oauth2', '~> 1.4.7' # Used for Stripe Connect
gem 'daemons'
gem 'delayed_job_active_record'
gem 'delayed_job_web'
gem 'kaminari', '~> 1.2.1'
gem 'andand'
@@ -68,22 +64,26 @@ gem 'actionpack-action_caching'
# AMS is deprecated, we will introduce an alternative at some point
gem "active_model_serializers", "0.8.4"
gem 'activerecord-session_store'
gem 'acts-as-taggable-on', '~> 7.0'
gem 'acts-as-taggable-on', '~> 8.1'
gem 'angularjs-file-upload-rails', '~> 2.4.1'
gem 'bigdecimal', '3.0.2'
gem 'bootsnap', require: false
gem 'custom_error_message', github: 'jeremydurham/custom-err-msg'
gem 'dalli'
gem 'figaro'
gem 'geocoder'
gem 'gmaps4rails'
gem 'mimemagic', '> 0.3.5'
gem 'paper_trail', '~> 10.3.1'
gem 'paperclip', '~> 3.4.1'
gem 'paper_trail', '~> 10.3.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'
gem 'redis', '>= 4.0', require: ['redis', 'redis/connection/hiredis']
gem 'sidekiq'
gem 'sidekiq-scheduler'
gem 'combine_pdf'
gem 'wicked_pdf'
@@ -111,7 +111,7 @@ gem 'foundation-rails', '= 5.5.2.1'
gem 'jquery-migrate-rails'
gem 'jquery-rails', '4.4.0'
gem 'jquery-ui-rails', '~> 4.2'
gem 'select2-rails', '~> 3.4.7'
gem "select2-rails", github: "openfoodfoundation/select2-rails", branch: "v349_with_thor_v1"
gem 'ofn-qz', github: 'openfoodfoundation/ofn-qz', branch: 'ofn-rails-4'
@@ -150,31 +150,29 @@ group :test, :development do
end
group :test do
gem 'byebug'
gem 'codecov', require: false
gem 'pdf-reader'
gem 'rails-controller-testing'
gem 'simplecov', require: false
gem 'test-prof'
gem 'webmock'
gem 'rails-controller-testing'
# See spec/spec_helper.rb for instructions
# gem 'perftools.rb'
end
group :development do
gem 'byebug'
gem 'debugger-linecache'
gem 'foreman'
gem 'pry'
gem 'pry-byebug'
gem 'rubocop'
gem 'rubocop-rails'
gem 'spring'
gem 'spring-commands-rspec'
gem 'web-console'
gem "view_component_storybook", require: "view_component/storybook/engine"
# 1.0.9 fixed openssl issues on macOS https://github.com/eventmachine/eventmachine/issues/602
# While we don't require this gem directly, no dependents forced the upgrade to a version
# greater than 1.0.9, so we just required the latest available version here.
gem 'eventmachine', '>= 1.2.3'
gem 'rack-mini-profiler', '< 3.0.0'
end

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
@@ -21,6 +21,15 @@ GIT
specs:
ofn-qz (0.1.0)
GIT
remote: https://github.com/openfoodfoundation/select2-rails.git
revision: fc240e85fbdf1878ff3c39d972c0cd9a312f5ed4
branch: v349_with_thor_v1
specs:
select2-rails (3.4.9)
sass-rails
thor (>= 0.14)
PATH
remote: engines/catalog
specs:
@@ -47,47 +56,62 @@ PATH
GEM
remote: https://rubygems.org/
specs:
actioncable (5.2.6)
actionpack (= 5.2.6)
Ascii85 (1.1.0)
actioncable (6.1.4)
actionpack (= 6.1.4)
activesupport (= 6.1.4)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
actionmailer (5.2.6)
actionpack (= 5.2.6)
actionview (= 5.2.6)
activejob (= 5.2.6)
actionmailbox (6.1.4)
actionpack (= 6.1.4)
activejob (= 6.1.4)
activerecord (= 6.1.4)
activestorage (= 6.1.4)
activesupport (= 6.1.4)
mail (>= 2.7.1)
actionmailer (6.1.4)
actionpack (= 6.1.4)
actionview (= 6.1.4)
activejob (= 6.1.4)
activesupport (= 6.1.4)
mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 2.0)
actionpack (5.2.6)
actionview (= 5.2.6)
activesupport (= 5.2.6)
rack (~> 2.0, >= 2.0.8)
actionpack (6.1.4)
actionview (= 6.1.4)
activesupport (= 6.1.4)
rack (~> 2.0, >= 2.0.9)
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.1.4)
actionpack (= 6.1.4)
activerecord (= 6.1.4)
activestorage (= 6.1.4)
activesupport (= 6.1.4)
nokogiri (>= 1.8.5)
actionview (6.1.4)
activesupport (= 6.1.4)
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.1.4)
activesupport (= 6.1.4)
globalid (>= 0.3.6)
activemerchant (1.119.0)
activemerchant (1.121.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.1.4)
activesupport (= 6.1.4)
activerecord (6.1.4)
activemodel (= 6.1.4)
activesupport (= 6.1.4)
activerecord-import (1.1.0)
activerecord (>= 3.2)
activerecord-postgresql-adapter (0.0.1)
@@ -98,21 +122,26 @@ 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.1.4)
actionpack (= 6.1.4)
activejob (= 6.1.4)
activerecord (= 6.1.4)
activesupport (= 6.1.4)
marcel (~> 1.0.0)
activesupport (5.2.6)
mini_mime (>= 1.1.0)
activesupport (6.1.4)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 0.7, < 2)
minitest (~> 5.1)
tzinfo (~> 1.1)
acts-as-taggable-on (7.0.0)
i18n (>= 1.6, < 2)
minitest (>= 5.1)
tzinfo (~> 2.0)
zeitwerk (~> 2.3)
acts-as-taggable-on (8.1.0)
activerecord (>= 5.0, < 6.2)
acts_as_list (1.0.4)
activerecord (>= 4.2)
addressable (2.7.0)
public_suffix (>= 2.0.2, < 5.0)
afm (0.2.2)
andand (1.3.3)
angular-rails-templates (1.1.0)
railties (>= 4.2, < 7)
@@ -122,7 +151,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)
@@ -133,7 +161,11 @@ GEM
json (~> 1.4)
nokogiri (~> 1)
bcrypt (3.1.16)
bugsnag (6.20.0)
bigdecimal (3.0.2)
bindex (0.8.1)
bootsnap (1.7.5)
msgpack (~> 1.0)
bugsnag (6.21.0)
concurrent-ruby (~> 1.0)
builder (3.2.4)
bullet (6.1.4)
@@ -183,29 +215,24 @@ GEM
compass (~> 1.0.0)
sass-rails (< 5.1)
sprockets (< 4.0)
concurrent-ruby (1.1.8)
concurrent-ruby (1.1.9)
connection_pool (2.2.5)
crack (0.4.5)
rexml
crass (1.0.6)
css_parser (1.9.0)
addressable
daemons (1.4.0)
dalli (2.7.11)
database_cleaner (1.99.0)
ddtrace (0.49.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.50.0)
ffi (~> 1.0)
msgpack
debugger-linecache (1.2.0)
delayed_job (4.1.9)
activesupport (>= 3.0, < 6.2)
delayed_job_active_record (4.1.6)
activerecord (>= 3.0, < 6.2)
delayed_job (>= 3.0, < 5)
delayed_job_web (1.4.4)
activerecord (> 3.0.0)
delayed_job (> 2.0.3)
rack-protection (>= 1.5.5)
sinatra (>= 1.4.4)
devise (4.8.0)
bcrypt (~> 3.0)
orm_adapter (~> 0.1)
@@ -218,22 +245,28 @@ GEM
devise (>= 4.0.0, < 5.0.0)
diff-lcs (1.4.4)
docile (1.3.5)
e2mmap (0.1.0)
erubi (1.10.0)
eventmachine (1.2.7)
excon (0.79.0)
et-orbi (1.2.4)
tzinfo
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)
ffi (1.15.1)
figaro (1.2.0)
thor (>= 0.14.0, < 2)
flipper (0.20.4)
@@ -260,6 +293,7 @@ GEM
fog-xml (0.1.3)
fog-core
nokogiri (>= 1.5.11, < 2.0.0)
foreman (0.87.2)
formatador (0.2.5)
foundation-icons-sass-rails (3.0.0)
railties (>= 3.1.1)
@@ -267,6 +301,9 @@ GEM
foundation-rails (5.5.2.1)
railties (>= 3.1.0)
sass (>= 3.3.0, < 3.5)
fugit (1.4.5)
et-orbi (~> 1.1, >= 1.1.8)
raabro (~> 1.4)
fuubar (2.5.1)
rspec-core (~> 3.0)
ruby-progressbar (~> 1.4)
@@ -276,13 +313,14 @@ GEM
globalid (0.4.2)
activesupport (>= 4.2.0)
gmaps4rails (2.1.2)
good_migrations (0.0.2)
good_migrations (0.1.0)
activerecord (>= 3.1)
railties (>= 3.1)
haml (5.2.1)
temple (>= 0.8.0)
tilt
hashdiff (1.0.1)
hashery (2.1.2)
highline (2.0.3)
hiredis (0.6.3)
i18n (1.8.10)
@@ -319,14 +357,14 @@ GEM
kaminari-core (= 1.2.1)
kaminari-core (1.2.1)
kgio (2.11.3)
knapsack (1.22.0)
knapsack (3.1.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)
loofah (2.9.1)
libv8-node (15.14.0.1)
loofah (2.10.0)
crass (~> 1.0.2)
nokogiri (>= 1.5.9)
mail (2.7.1)
@@ -335,12 +373,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)
@@ -352,10 +390,8 @@ GEM
multi_json (1.15.0)
multi_xml (0.6.0)
multipart-post (2.1.1)
mustermann (1.1.1)
ruby2_keywords (~> 0.0.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)
@@ -384,38 +420,49 @@ GEM
xml-simple
paypal-sdk-merchant (1.117.2)
paypal-sdk-core (~> 0.3.0)
pdf-reader (2.5.0)
Ascii85 (~> 1.0)
afm (~> 0.2.1)
hashery (~> 2.0)
ruby-rc4
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)
rack (2.2.3)
rack-mini-profiler (2.3.2)
rack (>= 1.2.0)
rack-protection (2.1.0)
rack
rack-proxy (0.7.0)
rack
rack-rewrite (1.5.1)
rack-ssl (1.4.1)
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)
bundler (>= 1.3.0)
railties (= 5.2.6)
rails (6.1.4)
actioncable (= 6.1.4)
actionmailbox (= 6.1.4)
actionmailer (= 6.1.4)
actionpack (= 6.1.4)
actiontext (= 6.1.4)
actionview (= 6.1.4)
activejob (= 6.1.4)
activemodel (= 6.1.4)
activerecord (= 6.1.4)
activestorage (= 6.1.4)
activesupport (= 6.1.4)
bundler (>= 1.15.0)
railties (= 6.1.4)
sprockets-rails (>= 2.0.0)
rails-controller-testing (1.0.5)
actionpack (>= 5.0.1.rc1)
@@ -426,28 +473,28 @@ 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.1.4)
actionpack (= 6.1.4)
activesupport (= 6.1.4)
method_source
rake (>= 0.8.7)
thor (>= 0.19.0, < 2.0)
rake (>= 0.13)
thor (~> 1.0)
rainbow (3.0.0)
raindrops (0.19.1)
rake (13.0.3)
ransack (2.4.1)
ransack (2.4.2)
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)
redis (4.2.5)
redis (4.3.1)
regexp_parser (2.1.1)
request_store (1.5.0)
rack (>= 1.4)
@@ -500,51 +547,57 @@ GEM
rswag-ui (2.4.0)
actionpack (>= 3.1, < 7.0)
railties (>= 3.1, < 7.0)
rubocop (1.15.0)
rubocop (1.18.1)
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)
rubocop-rails (2.11.1)
activesupport (>= 4.2.0)
rack (>= 1.1)
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)
tilt (>= 1.1, < 3)
select2-rails (3.4.9)
sass-rails
thor (~> 0.14)
selenium-webdriver (3.142.7)
childprocess (>= 0.5, < 4.0)
rubyzip (>= 1.2.2)
semantic_range (3.0.0)
shoulda-matchers (4.5.1)
activesupport (>= 4.2.0)
sidekiq (6.2.1)
connection_pool (>= 2.2.2)
rack (~> 2.0)
redis (>= 4.2.0)
sidekiq-scheduler (3.1.0)
e2mmap
redis (>= 3, < 5)
rufus-scheduler (~> 3.2)
sidekiq (>= 3)
thwait
tilt (>= 1.4.0)
simplecov (0.21.2)
docile (~> 1.1)
simplecov-html (~> 0.11)
simplecov_json_formatter (~> 0.1)
simplecov-html (0.12.3)
simplecov_json_formatter (0.1.2)
sinatra (2.1.0)
mustermann (~> 1.0)
rack (~> 2.2)
rack-protection (= 2.1.0)
tilt (~> 2.0)
simplecov_json_formatter (0.1.3)
spring (2.1.1)
spring-commands-rspec (1.0.4)
spring (>= 0.9.1)
@@ -563,17 +616,19 @@ GEM
activerecord (>= 5.1)
state_machines-activemodel (>= 0.8.0)
stringex (2.8.5)
stripe (5.30.0)
stripe (5.35.0)
temple (0.8.2)
test-prof (1.0.5)
test-unit (3.4.1)
test-prof (1.0.6)
test-unit (3.4.4)
power_assert
thor (0.20.3)
thread_safe (0.3.6)
thor (1.1.0)
thwait (0.2.0)
e2mmap
tilt (2.0.10)
timecop (0.9.4)
tzinfo (1.2.9)
thread_safe (~> 0.1)
ttfunk (1.7.0)
tzinfo (2.0.4)
concurrent-ruby (~> 1.0)
uglifier (4.2.0)
execjs (>= 0.3.0, < 3)
unicode-display_width (2.0.0)
@@ -586,13 +641,18 @@ GEM
unicorn-worker-killer (0.4.5)
get_process_mem (~> 0)
unicorn (>= 4, < 7)
uniform_notifier (1.14.1)
view_component (2.31.1)
uniform_notifier (1.14.2)
view_component (2.34.0)
activesupport (>= 5.0.0, < 7.0)
view_component_storybook (0.8.0)
view_component (>= 2.2)
warden (1.2.9)
rack (>= 2.0.9)
web-console (4.1.0)
actionview (>= 6.0.0)
activemodel (>= 6.0.0)
bindex (>= 0.4.0)
railties (>= 6.0.0)
webdrivers (4.6.0)
nokogiri (~> 1.6)
rubyzip (>= 1.3.0)
@@ -601,7 +661,12 @@ GEM
addressable (>= 2.3.6)
crack (>= 0.3.2)
hashdiff (>= 0.4.0, < 2.0.0)
websocket-driver (0.7.3)
webpacker (5.4.0)
activesupport (>= 5.2)
rack-proxy (>= 0.6.1)
railties (>= 5.2)
semantic_range (>= 2.3.0)
websocket-driver (0.7.5)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.5)
whenever (1.0.0)
@@ -612,6 +677,7 @@ GEM
xml-simple (1.1.8)
xpath (3.2.0)
nokogiri (~> 1.8)
zeitwerk (2.4.2)
PLATFORMS
ruby
@@ -623,7 +689,7 @@ DEPENDENCIES
activerecord-import
activerecord-postgresql-adapter
activerecord-session_store
acts-as-taggable-on (~> 7.0)
acts-as-taggable-on (~> 8.1)
acts_as_list (= 1.0.4)
andand
angular-rails-templates (>= 0.3.0)
@@ -633,6 +699,8 @@ DEPENDENCIES
awesome_nested_set
awesome_print
aws-sdk (= 1.67.0)
bigdecimal (= 3.0.2)
bootsnap
bugsnag
bullet
byebug
@@ -644,26 +712,23 @@ DEPENDENCIES
combine_pdf
compass-rails
custom_error_message!
daemons
dalli
database_cleaner
db2fog!
ddtrace
debugger-linecache
delayed_job_active_record
delayed_job_web
devise
devise-encryptable
devise-token_authenticatable
dfc_provider!
eventmachine (>= 1.2.3)
factory_bot_rails (= 6.2.0)
ffaker
figaro
flipper
flipper-active_record
flipper-ui
fog-aws (>= 0.6.0)
fog-aws (~> 2.0)
foreman
foundation-icons-sass-rails
foundation-rails (= 5.5.2.1)
fuubar (~> 2.5.1)
@@ -695,32 +760,34 @@ DEPENDENCIES
paperclip (~> 3.4.1)
paranoia (~> 2.4)
paypal-sdk-merchant (= 1.117.2)
pdf-reader
pg (~> 1.2.3)
pry
pry-byebug
rack-mini-profiler (< 3.0.0)
rack-rewrite
rack-ssl
rails (~> 5.2)
rails (~> 6.1.4)
rails-controller-testing
rails-i18n
rails_safe_tasks (~> 1.0)
ransack (= 2.4.1)
ransack (= 2.4.2)
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)
select2-rails (~> 3.4.7)
sass-rails (< 5.1.0)
select2-rails!
selenium-webdriver
shoulda-matchers
sidekiq
sidekiq-scheduler
simplecov
spring
spring-commands-rspec
@@ -736,14 +803,16 @@ DEPENDENCIES
view_component
view_component_storybook
web!
web-console
webdrivers
webmock
webpacker (~> 5)
whenever
wicked_pdf
wkhtmltopdf-binary
RUBY VERSION
ruby 2.5.8p224
ruby 2.7.3p183
BUNDLED WITH
1.17.3
2.1.4

5
Procfile Normal file
View File

@@ -0,0 +1,5 @@
# Foreman Procfile. Start all dev server processes with: `foreman start`
rails: bundle exec rails s -p 3000
webpack: ./bin/webpack-dev-server
sidekiq: bundle exec sidekiq -q mailers -q default

View File

@@ -34,7 +34,7 @@ We also have a [Super Admin Guide][super-admin-guide] to help with configuration
## Testing
If you'd like to help out with testing, please introduce yourself on the #testing channel on [Slack][slack-invite] and download the [ZenHub browser extension][zenhub] to view the development pipeline. Also, do have a look in our [Welcome New QAs board](https://github.com/openfoodfoundation/openfoodnetwork/projects/31) for some good first issues, both on manual and automated testing (RSpec/Capybara).
If you'd like to help out with testing, please introduce yourself on the #testing channel on [Slack][slack-invite] and download the [ZenHub browser extension][zenhub] to view the development pipeline. Also, do have a look in our [Welcome New QAs board](https://github.com/orgs/openfoodfoundation/projects/1) for some good first issues, both on manual and automated testing (RSpec/Capybara).
We use [BrowserStack](https://www.browserstack.com/) as a manual testing tool. BrowserStack provides open source projects with unlimited and free of charge accounts. A big thanks to them!
@@ -47,5 +47,5 @@ Copyright (c) 2012 - 2020 Open Food Foundation, released under the AGPL licence.
[ofn-handbook]: https://ofn-user-guide.gitbook.io/ofn-handbook/
[ofn-install]: https://github.com/openfoodfoundation/ofn-install
[super-admin-guide]: https://ofn-user-guide.gitbook.io/ofn-super-admin-guide
[welcome-dev]: https://github.com/openfoodfoundation/openfoodnetwork/projects/27
[welcome-dev]: https://github.com/orgs/openfoodfoundation/projects/2
[zenhub]: https://www.zenhub.com/extension

View File

@@ -8,6 +8,6 @@ require_relative 'config/application'
Openfoodnetwork::Application.load_tasks
unless ENV['DISABLE_KNAPSACK']
Knapsack.load_tasks if defined?(Knapsack)
if !ENV['DISABLE_KNAPSACK'] && defined?(Knapsack)
Knapsack.load_tasks
end

View File

@@ -8,6 +8,7 @@ angular.module("ofn.admin", [
"admin.dropdown",
"admin.products",
"admin.taxons",
"infinite-scroll"
"infinite-scroll",
"admin.orders"
]).config ($httpProvider) ->
$httpProvider.defaults.headers.common["Accept"] = "application/json, text/javascript, */*"

View File

@@ -110,5 +110,8 @@
// foundation
//= require ../shared/mm-foundation-tpls-0.9.0-20180826174721.min.js
// LocalStorage
//= require ../shared/angular-local-storage.js
// requires the rest of the JS code in this folder
//= require_tree .

View File

@@ -0,0 +1,8 @@
angular.module("ofn.admin").directive "select2WatchNgModel", () ->
restrict: 'E'
scope: true
require: "ngModel"
link: (scope, element, attrs, ngModel) ->
ngModel.$render = () ->
newValue = ngModel.$viewValue;
element.children(".select2").select2("val", newValue)

View File

@@ -52,6 +52,7 @@ angular.module("admin.lineItems").controller 'LineItemsCtrl', ($scope, $timeout,
$scope.loadOrders = ->
RequestMonitor.load $scope.orders = Orders.index(
"q[state_not_eq]": "canceled",
"q[shipment_state_not_eq]": "shipped",
"q[completed_at_not_null]": "true",
"q[distributor_id_eq]": $scope.distributorFilter,
"q[order_cycle_id_eq]": $scope.orderCycleFilter,
@@ -62,6 +63,7 @@ angular.module("admin.lineItems").controller 'LineItemsCtrl', ($scope, $timeout,
$scope.loadLineItems = ->
RequestMonitor.load LineItems.index(
"q[order_state_not_eq]": "canceled",
"q[order_shipment_state_not_eq]": "shipped",
"q[order_completed_at_not_null]": "true",
"q[order_distributor_id_eq]": $scope.distributorFilter,
"q[variant_product_supplier_id_eq]": $scope.supplierFilter,

View File

@@ -3,12 +3,18 @@ angular.module('admin.orderCycles', ['ngTagsInput', 'admin.indexUtils', 'admin.e
require: "ngModel"
link: (scope, element, attrs, ngModel) ->
$timeout ->
flatpickr(element, Object.assign({},
fp = flatpickr(element, Object.assign({},
window.FLATPICKR_DATETIME_DEFAULT, {
onOpen: (selectedDates, dateStr, instance) ->
instance.setDate(ngModel.$modelValue)
instance.input.dispatchEvent(new Event('focus', { bubbles: true }));
}));
fp.minuteElement.addEventListener "keyup", (e) ->
if !isNaN(event.target.value)
fp.setDate(fp.selectedDates[0].setMinutes(e.target.value), true)
fp.hourElement.addEventListener "keyup", (e) ->
if !isNaN(event.target.value)
fp.setDate(fp.selectedDates[0].setHours(e.target.value), true)
.directive 'ofnOnChange', ->
(scope, element, attrs) ->

View File

@@ -1,4 +1,4 @@
angular.module("admin.orders").controller "ordersCtrl", ($scope, $timeout, RequestMonitor, Orders, SortOptions, $window, $filter) ->
angular.module("admin.orders").controller "ordersCtrl", ($scope, $timeout, RequestMonitor, Orders, SortOptions, $window, $filter, $location, KeyValueMapStore) ->
$scope.RequestMonitor = RequestMonitor
$scope.pagination = Orders.pagination
$scope.orders = Orders.all
@@ -15,39 +15,54 @@ angular.module("admin.orders").controller "ordersCtrl", ($scope, $timeout, Reque
$scope.poll = 0
$scope.rowStatus = {}
KeyValueMapStore.localStorageKey = 'ordersFilters'
KeyValueMapStore.storableKeys = ["q", "sorting", "page", "per_page"]
$scope.initialise = ->
unless KeyValueMapStore.restoreValues($scope)
$scope.setDefaults()
$scope.fetchResults()
$scope.setDefaults = ->
$scope.per_page = 15
$scope.q = {
completed_at_not_null: true
}
$scope.clearFilters = () ->
KeyValueMapStore.clearKeyValueMap()
$scope.setDefaults()
$scope.fetchResults()
$scope.fetchResults = (page=1) ->
startDateWithTime = $scope.appendStringIfNotEmpty($scope['q']['completed_at_gteq'], ' 00:00:00')
endDateWithTime = $scope.appendStringIfNotEmpty($scope['q']['completed_at_lteq'], ' 23:59:59')
startDateWithTime = $scope.appendStringIfNotEmpty($scope.q?.completed_at_gteq, ' 00:00:00')
endDateWithTime = $scope.appendStringIfNotEmpty($scope.q?.completed_at_lteq, ' 23:59:59')
$scope.resetSelected()
params = {
'q[completed_at_gteq]': startDateWithTime,
'q[completed_at_lteq]': endDateWithTime,
'q[state_eq]': $scope['q']['state_eq'],
'q[number_cont]': $scope['q']['number_cont'],
'q[email_cont]': $scope['q']['email_cont'],
'q[bill_address_firstname_start]': $scope['q']['bill_address_firstname_start'],
'q[bill_address_lastname_start]': $scope['q']['bill_address_lastname_start'],
'q[state_eq]': $scope.q?.state_eq,
'q[number_cont]': $scope.q?.number_cont,
'q[email_cont]': $scope.q?.email_cont,
'q[bill_address_firstname_start]': $scope.q?.bill_address_firstname_start,
'q[bill_address_lastname_start]': $scope.q?.bill_address_lastname_start,
# Set default checkbox values to null. See: https://github.com/openfoodfoundation/openfoodnetwork/pull/3076#issuecomment-440010498
'q[completed_at_not_null]': $scope['q']['completed_at_not_null'] || null,
'q[distributor_id_in][]': $scope['q']['distributor_id_in'],
'q[order_cycle_id_in][]': $scope['q']['order_cycle_id_in'],
'q[completed_at_not_null]': $scope.q?.completed_at_not_null || null,
'q[distributor_id_in][]': $scope.q?.distributor_id_in,
'q[order_cycle_id_in][]': $scope.q?.order_cycle_id_in,
'q[s]': $scope.sorting || 'completed_at desc',
shipping_method_id: $scope.shipping_method_id,
shipping_method_id: $scope.q?.shipping_method_id,
per_page: $scope.per_page,
page: page
}
KeyValueMapStore.setStoredValues($scope)
RequestMonitor.load(Orders.index(params).$promise)
$scope.appendStringIfNotEmpty = (baseString, stringToAppend) ->
return baseString unless baseString
return baseString if baseString.endsWith(stringToAppend)
baseString + stringToAppend

View File

@@ -1 +1 @@
angular.module("admin.orders", ['admin.indexUtils', 'ngResource', 'mm.foundation'])
angular.module("admin.orders", ['admin.indexUtils', 'ngResource', 'mm.foundation', "OFNShared"])

View File

@@ -2,6 +2,6 @@ angular.module("admin.paymentMethods").controller "ProvidersCtrl", ($scope, paym
if paymentMethod.type
$scope.include_html = "/admin/payment_methods/show_provider_preferences?" +
"provider_type=#{paymentMethod.type};" +
"pm_id=#{paymentMethod.id};"
"pm_id=#{paymentMethod.id || ''};"
else
$scope.include_html = ""

View File

@@ -1,5 +1,5 @@
angular.module("admin.products")
.controller "unitsCtrl", ($scope, VariantUnitManager, OptionValueNamer, UnitPrices) ->
.controller "unitsCtrl", ($scope, VariantUnitManager, OptionValueNamer, UnitPrices, PriceParser) ->
$scope.product = { master: {} }
$scope.product.master.product = $scope.product
$scope.placeholder_text = ""
@@ -26,9 +26,9 @@ angular.module("admin.products")
$scope.processUnitValueWithDescription = ->
if $scope.product.master.hasOwnProperty("unit_value_with_description")
match = $scope.product.master.unit_value_with_description.match(/^([\d\.]+(?= *|$)|)( *)(.*)$/)
match = $scope.product.master.unit_value_with_description.match(/^([\d\.,]+(?= *|$)|)( *)(.*)$/)
if match
$scope.product.master.unit_value = parseFloat(match[1])
$scope.product.master.unit_value = PriceParser.parse(match[1])
$scope.product.master.unit_value = null if isNaN($scope.product.master.unit_value)
$scope.product.master.unit_value *= $scope.product.variant_unit_scale if $scope.product.master.unit_value && $scope.product.variant_unit_scale
$scope.product.master.unit_description = match[3]

View File

@@ -1,4 +1,4 @@
angular.module("admin.products").controller "variantUnitsCtrl", ($scope, VariantUnitManager, $timeout, UnitPrices) ->
angular.module("admin.products").controller "variantUnitsCtrl", ($scope, VariantUnitManager, $timeout, UnitPrices, PriceParser) ->
$scope.unitName = (scale, type) ->
VariantUnitManager.getUnitName(scale, type)
@@ -23,7 +23,7 @@ angular.module("admin.products").controller "variantUnitsCtrl", ($scope, Variant
$scope.updateValue = ->
unit_value_human = angular.element('#unit_value_human').val()
$scope.unit_value = unit_value_human * $scope.scale
$scope.unit_value = PriceParser.parse(unit_value_human) * $scope.scale
variant_unit_value = angular.element('#variant_unit_value').val()
$scope.unit_value_human = variant_unit_value / $scope.scale

View File

@@ -1,6 +1,7 @@
angular.module("admin.products").factory "UnitPrices", (VariantUnitManager, localizeCurrencyFilter) ->
angular.module("admin.products").factory "UnitPrices", (VariantUnitManager, localizeCurrencyFilter, PriceParser) ->
class UnitPrices
@displayableUnitPrice: (price, scale, unit_type, unit_value, variant_unit_name) ->
price = PriceParser.parse(price)
if price && !isNaN(price) && unit_type && unit_value
value = localizeCurrencyFilter(UnitPrices.price(price, scale, unit_type, unit_value, variant_unit_name))
unit = UnitPrices.unit(scale, unit_type, variant_unit_name)
@@ -29,4 +30,4 @@ angular.module("admin.products").factory "UnitPrices", (VariantUnitManager, loca
else if unit_type == "weight"
"kg"
else if unit_type == "volume"
"L"
"L"

View File

@@ -0,0 +1,29 @@
angular.module("admin.indexUtils").factory 'KeyValueMapStore', (localStorageService)->
new class KeyValueMapStore
localStorageKey: ''
storableKeys: []
constructor: ->
localStorageService.setStorageType("sessionStorage")
getStoredKeyValueMap: ->
localStorageService.get(@localStorageKey) || {}
setStoredValues: (source) ->
keyValueMap = {}
for key in @storableKeys
keyValueMap[key] = source[key]
localStorageService.set(@localStorageKey, keyValueMap)
restoreValues: (target) ->
storedKeyValueMap = @getStoredKeyValueMap()
return false if _.isEmpty(storedKeyValueMap)
for k,v of storedKeyValueMap
target[k] = v
return true
clearKeyValueMap: () ->
localStorageService.remove(@localStorageKey)

View File

@@ -2,10 +2,13 @@ angular.module("admin.utils").directive "datepicker", ($window, $timeout) ->
require: "ngModel"
link: (scope, element, attrs, ngModel) ->
$timeout ->
flatpickr(element, Object.assign(
flapickrInstance = flatpickr(element, Object.assign(
{},
$window.FLATPICKR_DATE_DEFAULT, {
onOpen: (selectedDates, dateStr, instance) ->
instance.setDate(ngModel.$modelValue)
}
));
ngModel.$render = () ->
newValue = ngModel.$viewValue;
flapickrInstance?.setDate(newValue)

View File

@@ -0,0 +1,31 @@
angular.module("admin.utils").factory "PriceParser", ->
new class PriceParser
parse: (price) =>
return null unless price
# used decimal and thousands separators from currency configuration
decimal_separator = I18n.toCurrency(.1, {precision: 1, unit: ''}).substring(1,2)
thousands_separator = I18n.toCurrency(1000, {precision: 1, unit: ''}).substring(1,2)
# Replace comma used as a decimal separator and remplace by "."
price = this.replaceCommaByFinalPoint(price)
# Remove configured thousands separator if it is actually a thousands separator
price = this.removeThousandsSeparator(price, thousands_separator)
if (decimal_separator == ",")
price = price.replace(",", ".")
price = parseFloat(price)
return null if isNaN(price)
return price
replaceCommaByFinalPoint : (price) =>
if price.match(/^[0-9]*(,{1})[0-9]{1,2}$/g) then price.replace(",", ".") else price
removeThousandsSeparator : (price, thousands_separator) =>
if (new RegExp("^([0-9]*(" + thousands_separator + "{1})[0-9]{3}[0-9\.,]*)*$", "g").test(price))
price.replaceAll(thousands_separator, '')
else
price

View File

@@ -1,9 +1,5 @@
Darkswarm.controller "ShopVariantCtrl", ($scope, $modal, Cart) ->
$scope.$watchGroup [
'variant.line_item.quantity',
'variant.line_item.max_quantity'
], (new_value, old_value) ->
return if old_value[0] == null && new_value[0] == null
$scope.updateCart = (line_item) ->
Cart.adjust($scope.variant.line_item)
$scope.variant.line_item.quantity ||= 0
@@ -44,10 +40,12 @@ Darkswarm.controller "ShopVariantCtrl", ($scope, $modal, Cart) ->
$scope.add = (quantity) ->
item = $scope.variant.line_item
item.quantity = $scope.sanitizedQuantity() + quantity
$scope.updateCart(item)
$scope.addMax = (quantity) ->
item = $scope.variant.line_item
item.max_quantity = $scope.sanitizedMaxQuantity() + quantity
$scope.updateCart(item)
$scope.canAdd = (quantity) ->
wantedQuantity = $scope.sanitizedQuantity() + quantity

View File

@@ -1,8 +0,0 @@
Darkswarm.directive "shopVariantWithUnitPrice", ->
restrict: 'E'
replace: true
templateUrl: 'shop_variant_with_unit_price.html'
scope:
variant: '='
show_unit_price: '=showunitprice'
controller: 'ShopVariantCtrl'

View File

@@ -1,4 +1,5 @@
window.OFNShared = angular.module("OFNShared", [
"mm.foundation"
"mm.foundation",
"LocalStorageModule"
]).config ($httpProvider) ->
$httpProvider.defaults.headers.common["Accept"] = "application/json, text/javascript, */*"

View File

@@ -8,7 +8,7 @@
.div
{{ variant.line_item.total_price | localizeCurrency }}
.unit-price{"ng-if": "show_unit_price"}
.unit-price
%question-mark-with-tooltip{"question-mark-with-tooltip": "_",
"question-mark-with-tooltip-append-to-body": "true",
"question-mark-with-tooltip-placement": "top",

View File

@@ -8,9 +8,16 @@
"price-breakdown-placement" => "bottom",
"price-breakdown-animation" => true}
{{ variant.price_with_fees | localizeCurrency }}
.unit-price.variant-unit-price
%question-mark-with-tooltip{"question-mark-with-tooltip" => "_",
"question-mark-with-tooltip-append-to-body" => "true",
"question-mark-with-tooltip-placement" => "top",
"question-mark-with-tooltip-animation" => true,
key: "'js.shopfront.unit_price_tooltip'"}
{{ variant.unit_price_price | localizeCurrency }}&nbsp;/&nbsp;{{ variant.unit_price_unit }}
.medium-2.large-2.columns.total-price
%span{"ng-class" => "{filled: variant.line_item.total_price}"}
{{ variant.line_item.total_price | localizeCurrency }}
%ng-include{src: "'partials/shop_variant_no_group_buy.html'"}
%ng-include{src: "'partials/shop_variant_with_group_buy.html'"}

View File

@@ -1,23 +0,0 @@
.variants.row
.small-4.medium-4.large-5.columns.variant-name
.inline{"ng-if" => "::variant.display_name"} {{ ::variant.display_name }}
.variant-unit {{ ::variant.unit_to_display }}
.small-3.medium-3.large-2.columns.variant-price
%price-breakdown{"price-breakdown" => "_", variant: "variant",
"price-breakdown-append-to-body" => "true",
"price-breakdown-placement" => "bottom",
"price-breakdown-animation" => true}
{{ variant.price_with_fees | localizeCurrency }}
.unit-price.variant-unit-price
%question-mark-with-tooltip{"question-mark-with-tooltip" => "_",
"question-mark-with-tooltip-append-to-body" => "true",
"question-mark-with-tooltip-placement" => "top",
"question-mark-with-tooltip-animation" => true,
key: "'js.shopfront.unit_price_tooltip'"}
{{ variant.unit_price_price | localizeCurrency }}&nbsp;/&nbsp;{{ variant.unit_price_unit }}
.medium-2.large-2.columns.total-price
%span{"ng-class" => "{filled: variant.line_item.total_price}"}
{{ variant.line_item.total_price | localizeCurrency }}
%ng-include{src: "'partials/shop_variant_no_group_buy.html'"}
%ng-include{src: "'partials/shop_variant_with_group_buy.html'"}

View File

@@ -1,5 +1,4 @@
#table-filter {
.field {
input[type="text"], input[type="phone"],
input[type="email"], input[type="number"],
@@ -9,6 +8,9 @@
}
.actions {
text-align: center;
display: flex;
align-items: center;
justify-content: center;
column-gap: 20px;
}
}
}

View File

@@ -84,6 +84,8 @@ $color-ste-sold-bg: $color-success !default;
$color-ste-sold-text: $color-1 !default;
$color-ste-pending-bg: $color-notice !default;
$color-ste-pending-text: $color-1 !default;
$color-ste-requires_authorization-bg: $color-notice !default;
$color-ste-requires_authorization-text: $color-1 !default;
$color-ste-awaiting_return-bg: $color-notice !default;
$color-ste-awaiting_return-text: $color-1 !default;
$color-ste-returned-bg: $color-notice !default;
@@ -124,9 +126,9 @@ $color-ste-inactive-bg: $color-notice !default;
$color-ste-inactive-text: $color-1 !default;
// Available states
$states: completed, complete, sold, pending, awaiting_return, returned, credit_owed, paid, shipped, balance_due, backorder, checkout, cart, address, delivery, payment, confirm, canceled, ready, void, active, inactive !default;
$states-bg-colors: $color-ste-completed-bg, $color-ste-complete-bg, $color-ste-sold-bg, $color-ste-pending-bg, $color-ste-awaiting_return-bg, $color-ste-returned-bg, $color-ste-credit_owed-bg, $color-ste-paid-bg, $color-ste-shipped-bg, $color-ste-balance_due-bg, $color-ste-backorder-bg, $color-ste-checkout-bg, $color-ste-cart-bg, $color-ste-address-bg, $color-ste-delivery-bg, $color-ste-payment-bg, $color-ste-confirm-bg, $color-ste-canceled-bg, $color-ste-ready-bg, $color-ste-void-bg, $color-ste-active-bg, $color-ste-inactive-bg !default;
$states-text-colors: $color-ste-completed-text, $color-ste-complete-text, $color-ste-sold-text, $color-ste-pending-text, $color-ste-awaiting_return-text, $color-ste-returned-text, $color-ste-credit_owed-text, $color-ste-paid-text, $color-ste-shipped-text, $color-ste-balance_due-text, $color-ste-backorder-text, $color-ste-checkout-text, $color-ste-cart-text, $color-ste-address-text, $color-ste-delivery-text, $color-ste-payment-text, $color-ste-confirm-text, $color-ste-canceled-text, $color-ste-ready-text, $color-ste-void-text, $color-ste-active-text, $color-ste-inactive-text !default;
$states: completed, complete, sold, pending, awaiting_return, returned, credit_owed, paid, shipped, balance_due, backorder, checkout, cart, address, delivery, payment, confirm, canceled, ready, void, requires_authorization, active, inactive !default;
$states-bg-colors: $color-ste-completed-bg, $color-ste-complete-bg, $color-ste-sold-bg, $color-ste-pending-bg, $color-ste-awaiting_return-bg, $color-ste-returned-bg, $color-ste-credit_owed-bg, $color-ste-paid-bg, $color-ste-shipped-bg, $color-ste-balance_due-bg, $color-ste-backorder-bg, $color-ste-checkout-bg, $color-ste-cart-bg, $color-ste-address-bg, $color-ste-delivery-bg, $color-ste-payment-bg, $color-ste-confirm-bg, $color-ste-canceled-bg, $color-ste-ready-bg, $color-ste-void-bg, $color-ste-requires_authorization-bg, $color-ste-active-bg, $color-ste-inactive-bg !default;
$states-text-colors: $color-ste-completed-text, $color-ste-complete-text, $color-ste-sold-text, $color-ste-pending-text, $color-ste-awaiting_return-text, $color-ste-returned-text, $color-ste-credit_owed-text, $color-ste-paid-text, $color-ste-shipped-text, $color-ste-balance_due-text, $color-ste-backorder-text, $color-ste-checkout-text, $color-ste-cart-text, $color-ste-address-text, $color-ste-delivery-text, $color-ste-payment-text, $color-ste-confirm-text, $color-ste-canceled-text, $color-ste-ready-text, $color-ste-void-text, $color-ste-requires_authorization-text, $color-ste-active-text, $color-ste-inactive-text !default;
// Available actions
$actions: edit, clone, remove, void, capture, save, cancel, mail !default;

View File

@@ -0,0 +1,6 @@
.admin-current-terms-of-service {
border: .1em solid $spree-blue;
border-radius: .5em;
margin: 1em 0;
padding: 1em;
}

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
module Admin
class BulkLineItemsController < Spree::Admin::BaseController
include PaginationData
@@ -32,10 +34,7 @@ module Admin
# See https://github.com/rails/rails/blob/3-2-stable/activerecord/lib/active_record/locking/pessimistic.rb#L69
# and https://www.postgresql.org/docs/current/static/sql-select.html#SQL-FOR-UPDATE-SHARE
order.with_lock do
if @line_item.update(line_item_params)
order.update_line_item_fees! @line_item
order.update_order_fees!
order.update_order!
if order.contents.update_item(@line_item, line_item_params)
render body: nil, status: :no_content # No Content, does not trigger ng resource auto-update
else
render json: { errors: @line_item.errors }, status: :precondition_failed
@@ -49,7 +48,7 @@ module Admin
load_line_item
authorize! :update, order
@line_item.destroy
order.contents.remove(@line_item.variant)
render body: nil, status: :no_content # No Content, does not trigger ng resource auto-update
end
@@ -63,16 +62,9 @@ module Admin
Spree::LineItem
end
# Returns the appropriate serializer for this controller
#
# @return [Api::Admin::LineItemSerializer]
def serializer(_ams_prefix)
Api::Admin::LineItemSerializer
end
def serialized_line_items
ActiveModel::ArraySerializer.new(
@line_items, each_serializer: serializer(nil)
@line_items, each_serializer: Api::Admin::LineItemSerializer
)
end

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
module Admin
class ColumnPreferencesController < Admin::ResourceController
before_action :load_collection, only: [:bulk_update]

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
module Admin
class ContentsController < Spree::Admin::BaseController
def edit
@@ -16,7 +18,8 @@ module Admin
# Save any uploaded images
ContentConfig.save
flash[:success] = t(:successfully_updated, resource: I18n.t('admin.contents.edit.your_content'))
flash[:success] =
t(:successfully_updated, resource: I18n.t('admin.contents.edit.your_content'))
redirect_to main_app.edit_admin_contents_path
end

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'open_food_network/address_finder'
module Admin
@@ -10,7 +12,10 @@ module Admin
tag_rule_mapping = TagRule.mapping_for(Enterprise.where(id: @customer.enterprise))
render_as_json @customer, tag_rule_mapping: tag_rule_mapping
},
failure: lambda { render json: { errors: @customer.errors.full_messages }, status: :unprocessable_entity }
failure: lambda {
render json: { errors: @customer.errors.full_messages },
status: :unprocessable_entity
}
} }
def index

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
module Admin
class EnterpriseFeesController < Admin::ResourceController
before_action :load_enterprise_fee_set, only: :index
@@ -16,7 +18,9 @@ module Admin
respond_to do |format|
format.html
format.json { render_as_json @collection, controller: self, include_calculators: @include_calculators }
format.json {
render_as_json @collection, controller: self, include_calculators: @include_calculators
}
# format.json { @presented_collection = @collection.each_with_index.map { |ef, i| EnterpriseFeePresenter.new(self, ef, i) } }
end
end
@@ -56,10 +60,12 @@ module Admin
order_cycle = OrderCycle.find_by(id: params[:order_cycle_id]) if params[:order_cycle_id]
coordinator = Enterprise.find_by(id: params[:coordinator_id]) if params[:coordinator_id]
order_cycle = OrderCycle.new(coordinator: coordinator) if order_cycle.nil? && coordinator.present?
enterprises = OpenFoodNetwork::OrderCyclePermissions.new(spree_current_user, order_cycle).visible_enterprises
enterprises = OpenFoodNetwork::OrderCyclePermissions.new(spree_current_user,
order_cycle).visible_enterprises
EnterpriseFee.for_enterprises(enterprises).order('enterprise_id', 'fee_type', 'name')
else
collection = EnterpriseFee.managed_by(spree_current_user).order('enterprise_id', 'fee_type', 'name')
collection = EnterpriseFee.managed_by(spree_current_user).order('enterprise_id',
'fee_type', 'name')
collection = collection.for_enterprise(current_enterprise) if current_enterprise
collection
end

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
module Admin
class EnterpriseGroupsController < Admin::ResourceController
before_action :load_data, except: :index

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
module Admin
class EnterpriseRelationshipsController < Admin::ResourceController
def index
@@ -16,7 +18,8 @@ module Admin
if @enterprise_relationship.save
render plain: Api::Admin::EnterpriseRelationshipSerializer.new(@enterprise_relationship).to_json
else
render status: :bad_request, json: { errors: @enterprise_relationship.errors.full_messages.join(', ') }
render status: :bad_request,
json: { errors: @enterprise_relationship.errors.full_messages.join(', ') }
end
end

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
module Admin
class EnterpriseRolesController < Admin::ResourceController
def index
@@ -13,7 +15,8 @@ module Admin
render plain: Api::Admin::EnterpriseRoleSerializer.new(@enterprise_role).to_json
else
render status: :bad_request, json: { errors: @enterprise_role.errors.full_messages.join(', ') }
render status: :bad_request,
json: { errors: @enterprise_role.errors.full_messages.join(', ') }
end
end

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'open_food_network/referer_parser'
require 'open_food_network/permissions'
require 'open_food_network/order_cycle_permissions'
@@ -32,7 +34,10 @@ module Admin
def index
respond_to do |format|
format.html
format.json { render_as_json @collection, ams_prefix: params[:ams_prefix], spree_current_user: spree_current_user }
format.json {
render_as_json @collection, ams_prefix: params[:ams_prefix],
spree_current_user: spree_current_user
}
end
end
@@ -56,11 +61,15 @@ module Admin
respond_with(@object) do |format|
format.html { redirect_to location_after_save }
format.js { render layout: false }
format.json { render_as_json @object, ams_prefix: 'index', spree_current_user: spree_current_user }
format.json {
render_as_json @object, ams_prefix: 'index', spree_current_user: spree_current_user
}
end
else
respond_with(@object) do |format|
format.json { render json: { errors: @object.errors.messages }, status: :unprocessable_entity }
format.json {
render json: { errors: @object.errors.messages }, status: :unprocessable_entity
}
end
end
end
@@ -101,7 +110,8 @@ module Admin
def for_order_cycle
respond_to do |format|
format.json do
render json: @collection, each_serializer: Api::Admin::ForOrderCycle::EnterpriseSerializer, order_cycle: @order_cycle, spree_current_user: spree_current_user
render json: @collection,
each_serializer: Api::Admin::ForOrderCycle::EnterpriseSerializer, order_cycle: @order_cycle, spree_current_user: spree_current_user
end
end
end
@@ -109,7 +119,8 @@ module Admin
def visible
respond_to do |format|
format.json do
render_as_json @collection, ams_prefix: params[:ams_prefix] || 'basic', spree_current_user: spree_current_user
render_as_json @collection, ams_prefix: params[:ams_prefix] || 'basic',
spree_current_user: spree_current_user
end
end
end
@@ -152,7 +163,7 @@ module Admin
if enterprises.present?
enterprises.includes(
supplied_products:
[:supplier, master: [:images], variants: { option_values: :option_type }]
[:supplier, { master: [:images], variants: { option_values: :option_type } }]
)
end
when :index
@@ -284,7 +295,8 @@ module Admin
end
def strip_new_properties
unless spree_current_user.admin? || params.dig(:enterprise, :producer_properties_attributes).nil?
unless spree_current_user.admin? || params.dig(:enterprise,
:producer_properties_attributes).nil?
names = Spree::Property.pluck(:name)
enterprise_params[:producer_properties_attributes].each do |key, property|
enterprise_params[:producer_properties_attributes].delete key unless names.include? property[:property_name]

View File

@@ -1,15 +1,23 @@
# frozen_string_literal: true
module Admin
class InventoryItemsController < Admin::ResourceController
respond_to :json
respond_override update: { json: {
success: lambda { render_as_json @inventory_item },
failure: lambda { render json: { errors: @inventory_item.errors.full_messages }, status: :unprocessable_entity }
failure: lambda {
render json: { errors: @inventory_item.errors.full_messages },
status: :unprocessable_entity
}
} }
respond_override create: { json: {
success: lambda { render_as_json @inventory_item },
failure: lambda { render json: { errors: @inventory_item.errors.full_messages }, status: :unprocessable_entity }
failure: lambda {
render json: { errors: @inventory_item.errors.full_messages },
status: :unprocessable_entity
}
} }
private

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
module Admin
class InvoiceSettingsController < Spree::Admin::BaseController
def update

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
module Admin
class ManagerInvitationsController < Spree::Admin::BaseController
authorize_resource class: false
@@ -11,7 +13,8 @@ module Admin
existing_user = Spree::User.find_by(email: @email)
if existing_user
render json: { errors: t('admin.enterprises.invite_manager.user_already_exists') }, status: :unprocessable_entity
render json: { errors: t('admin.enterprises.invite_manager.user_already_exists') },
status: :unprocessable_entity
return
end
@@ -20,7 +23,8 @@ module Admin
if new_user
render json: { user: new_user.id }, status: :ok
else
render json: { errors: t('admin.enterprises.invite_manager.error') }, status: :internal_server_error
render json: { errors: t('admin.enterprises.invite_manager.error') },
status: :internal_server_error
end
end

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
module Admin
class MatomoSettingsController < Spree::Admin::BaseController
def update

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
module Admin
class OrderCyclesController < Admin::ResourceController
include OrderCyclesHelper
@@ -62,7 +64,7 @@ module Admin
if @order_cycle_form.save
respond_to do |format|
flash[:notice] = I18n.t(:order_cycles_update_notice) if params[:reloading] == '1'
format.html { redirect_to main_app.edit_admin_order_cycle_path(@order_cycle) }
format.html { redirect_back(fallback_location: root_path) }
format.json { render json: { success: true } }
end
else
@@ -156,8 +158,8 @@ module Admin
orders_close_at_gt = raw_params[:q].andand.delete(:orders_close_at_gt) || 31.days.ago
raw_params[:q] = {
g: [raw_params.delete(:q) || {}, { m: 'or',
orders_close_at_gt: orders_close_at_gt,
orders_close_at_null: true }]
orders_close_at_gt: orders_close_at_gt,
orders_close_at_null: true }]
}
@collection = collection
end

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
module Admin
class ProducerPropertiesController < Admin::ResourceController
before_action :load_enterprise

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'roo'
module Admin
@@ -12,7 +14,8 @@ module Admin
def import
@filepath = save_uploaded_file(params[:file])
@importer = ProductImport::ProductImporter.new(File.new(@filepath), spree_current_user, params[:settings])
@importer = ProductImport::ProductImporter.new(File.new(@filepath), spree_current_user,
params[:settings])
@original_filename = params[:file].try(:original_filename)
@non_updatable_fields = ProductImport::EntryValidator.non_updatable_fields
@@ -34,7 +37,8 @@ module Admin
end
def reset_absent_products
@importer = ProductImport::ProductImporter.new(File.new(params[:filepath]), spree_current_user, import_into: params[:import_into], enterprises_to_reset: params[:enterprises_to_reset], updated_ids: params[:updated_ids], settings: params[:settings])
@importer = ProductImport::ProductImporter.new(File.new(params[:filepath]),
spree_current_user, import_into: params[:import_into], enterprises_to_reset: params[:enterprises_to_reset], updated_ids: params[:updated_ids], settings: params[:settings])
if params.key?(:enterprises_to_reset) && params.key?(:updated_ids)
@importer.reset_absent(params[:updated_ids])
@@ -52,7 +56,8 @@ module Admin
end
def process_data(method)
@importer = ProductImport::ProductImporter.new(File.new(params[:filepath]), spree_current_user, start: params[:start], end: params[:end], settings: params[:settings])
@importer = ProductImport::ProductImporter.new(File.new(params[:filepath]),
spree_current_user, start: params[:start], end: params[:end], settings: params[:settings])
begin
@importer.public_send("#{method}_entries")
@@ -75,7 +80,8 @@ module Admin
def check_spreadsheet_has_data(importer)
unless importer.item_count
redirect_to '/admin/product_import', notice: I18n.t(:product_import_no_data_in_spreadsheet_notice)
redirect_to '/admin/product_import',
notice: I18n.t(:product_import_no_data_in_spreadsheet_notice)
true
end
end

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
module Admin
class ProxyOrdersController < Admin::ResourceController
respond_to :json

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
module Admin
class ResourceController < Spree::Admin::BaseController
helper_method :new_object_url, :edit_object_url, :object_url, :collection_url

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'open_food_network/permissions'
require 'order_management/subscriptions/proxy_order_syncer'
@@ -15,18 +17,31 @@ module Admin
respond_to :json
respond_override create: { json: {
success: lambda { render_as_json @schedule, editable_schedule_ids: permissions.editable_schedules.pluck(:id) },
failure: lambda { render json: { errors: @schedule.errors.full_messages }, status: :unprocessable_entity }
success: lambda {
render_as_json @schedule,
editable_schedule_ids: permissions.editable_schedules.pluck(:id)
},
failure: lambda {
render json: { errors: @schedule.errors.full_messages },
status: :unprocessable_entity
}
} }
respond_override update: { json: {
success: lambda { render_as_json @schedule, editable_schedule_ids: permissions.editable_schedules.pluck(:id) },
failure: lambda { render json: { errors: @schedule.errors.full_messages }, status: :unprocessable_entity }
success: lambda {
render_as_json @schedule,
editable_schedule_ids: permissions.editable_schedules.pluck(:id)
},
failure: lambda {
render json: { errors: @schedule.errors.full_messages },
status: :unprocessable_entity
}
} }
def index
respond_to do |format|
format.json do
render_as_json @collection, ams_prefix: params[:ams_prefix], editable_schedule_ids: permissions.editable_schedules.pluck(:id)
render_as_json @collection, ams_prefix: params[:ams_prefix],
editable_schedule_ids: permissions.editable_schedules.pluck(:id)
end
end
end
@@ -111,7 +126,8 @@ module Admin
def check_dependent_subscriptions
return if Subscription.where(schedule_id: @schedule).empty?
render json: { errors: [t('admin.schedules.destroy.associated_subscriptions_error')] }, status: :conflict
render json: { errors: [t('admin.schedules.destroy.associated_subscriptions_error')] },
status: :conflict
end
def permissions

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'stripe/account_connector'
module Admin

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
# This controller is used by super admin users to update the settings the app is using
module Admin

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'open_food_network/permissions'
require 'open_food_network/order_cycle_permissions'
require 'open_food_network/scope_variant_to_hub'

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'open_food_network/permissions'
module Admin
@@ -85,7 +87,8 @@ module Admin
def collection
if request.format.json?
permissions.editable_subscriptions.ransack(params[:q]).result
.preload([:shop, :customer, :schedule, :subscription_line_items, :ship_address, :bill_address, proxy_orders: { order: :order_cycle }])
.preload([:shop, :customer, :schedule, :subscription_line_items, :ship_address,
:bill_address, { proxy_orders: { order: :order_cycle } }])
else
Subscription.where("1=0")
end
@@ -116,11 +119,13 @@ module Admin
end
def wrap_bill_address_attrs
subscription_params[:bill_address_attributes] = raw_params[:bill_address].slice(*Spree::Address.attribute_names)
subscription_params[:bill_address_attributes] =
raw_params[:bill_address].slice(*Spree::Address.attribute_names)
end
def wrap_ship_address_attrs
subscription_params[:ship_address_attributes] = raw_params[:ship_address].slice(*Spree::Address.attribute_names)
subscription_params[:ship_address_attributes] =
raw_params[:ship_address].slice(*Spree::Address.attribute_names)
end
def check_for_open_orders
@@ -129,14 +134,16 @@ module Admin
@open_orders_to_keep = @subscription.proxy_orders.placed_and_open.pluck(:id)
return if @open_orders_to_keep.empty? || params[:open_orders] == 'keep'
render json: { errors: { open_orders: t('admin.subscriptions.confirm_cancel_open_orders_msg') } }, status: :conflict
render json: { errors: { open_orders: t('admin.subscriptions.confirm_cancel_open_orders_msg') } },
status: :conflict
end
def check_for_canceled_orders
return if params[:canceled_orders] == 'notified'
return if @subscription.proxy_orders.active.canceled.empty?
render json: { errors: { canceled_orders: t('admin.subscriptions.resume_canceled_orders_msg') } }, status: :conflict
render json: { errors: { canceled_orders: t('admin.subscriptions.resume_canceled_orders_msg') } },
status: :conflict
end
def strip_banned_attrs

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
module Admin
class TagRulesController < Admin::ResourceController
respond_to :json

View File

@@ -0,0 +1,40 @@
# frozen_string_literal: true
module Admin
class TermsOfServiceFilesController < Spree::Admin::BaseController
def show
@current_file = TermsOfServiceFile.current
@new_file = TermsOfServiceFile.new
end
def new
show
render :show
end
def create
TermsOfServiceFile.create!(file_params)
redirect_to main_app.admin_terms_of_service_files_path
rescue ActionController::ParameterMissing
flash[:error] = t(".select_file")
redirect_to main_app.admin_terms_of_service_files_path
end
def destroy
TermsOfServiceFile.current.destroy!
redirect_to main_app.admin_terms_of_service_files_path
end
private
# Needed by Spree::Admin::BaseController#authorize_admin or it
# tries to find a Spree model.
def model_class
TermsOfServiceFile
end
def file_params
params.require(:terms_of_service_file).permit(:attachment)
end
end
end

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'open_food_network/spree_api_key_loader'
module Admin

View File

@@ -2,7 +2,6 @@
# Base controller for OFN's API
require "spree/api/controller_setup"
require "spree/core/controller_helpers/ssl"
module Api
module V0
@@ -11,7 +10,6 @@ module Api
include ActionController::StrongParameters
include ActionController::RespondWith
include Spree::Api::ControllerSetup
include Spree::Core::ControllerHelpers::SSL
include ::ActionController::Head
include ::ActionController::ConditionalGet
include ActionView::Layouts
@@ -27,8 +25,6 @@ module Api
rescue_from CanCan::AccessDenied, with: :unauthorized
rescue_from ActiveRecord::RecordNotFound, with: :not_found
ssl_allowed
# Include these because we inherit from ActionController::Metal
# rather than ActionController::Base and these are required for AMS
include ActionController::Serialization

View File

@@ -44,9 +44,9 @@ module Api
authorize! :update, @enterprise
if params[:logo] && @enterprise.update( logo: params[:logo] )
render plain: @enterprise.logo.url(:medium), status: :ok
render html: @enterprise.logo.url(:medium), status: :ok
elsif params[:promo] && @enterprise.update( promo_image: params[:promo] )
render plain: @enterprise.promo_image.url(:medium), status: :ok
render html: @enterprise.promo_image.url(:medium), status: :ok
else
invalid_resource!(@enterprise)
end

View File

@@ -81,7 +81,6 @@ module Api
quantity = params[:quantity].to_i
@order.contents.remove(variant, quantity, @shipment)
@order.recreate_all_fees!
@shipment.reload if @shipment.persisted?
render json: @shipment, serializer: Api::ShipmentSerializer, status: :ok

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
module Api
module V0
class TaxonsController < Api::V0::BaseController

View File

@@ -5,7 +5,6 @@ require "application_responder"
require 'cancan'
require 'spree/core/controller_helpers/auth'
require 'spree/core/controller_helpers/respond_with'
require 'spree/core/controller_helpers/ssl'
require 'spree/core/controller_helpers/common'
require 'open_food_network/referer_parser'
@@ -26,12 +25,12 @@ class ApplicationController < ActionController::Base
helper 'footer_links'
helper 'discourse'
helper 'checkout'
helper 'terms_and_conditions'
protect_from_forgery
include Spree::Core::ControllerHelpers::Auth
include Spree::Core::ControllerHelpers::RespondWith
include Spree::Core::ControllerHelpers::SSL
include Spree::Core::ControllerHelpers::Common
prepend_before_action :restrict_iframes
@@ -51,10 +50,10 @@ class ApplicationController < ActionController::Base
def redirect_to(options = {}, response_status = {})
::Rails.logger.error("Redirected by #{begin
caller(1).first
rescue StandardError
'unknown'
end}")
caller(1).first
rescue StandardError
'unknown'
end}")
super(options, response_status)
end
@@ -153,7 +152,7 @@ class ApplicationController < ActionController::Base
current_order.empty!
current_order.set_order_cycle! nil
flash[:info] = I18n.t('order_cycle_closed')
redirect_to main_app.root_url
redirect_to main_app.shop_path
end
end

View File

@@ -1,14 +1,12 @@
# frozen_string_literal: true
require 'spree/core/controller_helpers/order'
require 'spree/core/controller_helpers/ssl'
require 'open_food_network/tag_rule_applicator'
class BaseController < ApplicationController
layout 'darkswarm'
include Spree::Core::ControllerHelpers::Order
include Spree::Core::ControllerHelpers::SSL
include I18nHelper
include OrderCyclesHelper

View File

@@ -1,35 +1,32 @@
# frozen_string_literal: true
class CartController < BaseController
before_action :check_authorization
def populate
order = current_order(true)
cart_service = CartService.new(order)
cart_service.populate(params.slice(:variants, :quantity), true)
if cart_service.valid?
if cart_service.populate(params.slice(:variants, :quantity))
order.cap_quantity_at_stock!
order.recreate_all_fees!
variant_ids = variant_ids_in(cart_service.variants_h)
render json: { error: false,
stock_levels: VariantsStockLevels.new.call(order, variant_ids) },
status: :ok
render json: { error: false, stock_levels: stock_levels(order) }, status: :ok
else
render json: { error: cart_service.errors.full_messages.join(",") },
status: :precondition_failed
end
populate_variant_attributes
end
def variant_ids_in(variants_h)
variants_h.map { |v| v[:variant_id].to_i }
end
private
def stock_levels(order)
variants_in_cart = order.line_items.pluck(:variant_id)
variants_in_request = raw_params[:variants]&.map(&:first) || []
VariantsStockLevels.new.call(order, (variants_in_cart + variants_in_request).uniq)
end
def check_authorization
session[:access_token] ||= params[:token]
order = Spree::Order.find_by(number: params[:id]) || current_order
@@ -40,26 +37,4 @@ class CartController < BaseController
authorize! :create, Spree::Order
end
end
def populate_variant_attributes
order = current_order.reload
populate_variant_attributes_from_variant(order) if params.key? :variant_attributes
populate_variant_attributes_from_product(order) if params.key? :quantity
end
def populate_variant_attributes_from_variant(order)
params[:variant_attributes].each do |variant_id, attributes|
permitted = attributes.permit(:quantity, :max_quantity).to_h.with_indifferent_access
order.set_variant_attributes(Spree::Variant.find(variant_id), permitted)
end
end
def populate_variant_attributes_from_product(order)
params[:products].each do |_product_id, variant_id|
max_quantity = params[:max_quantity].to_i
order.set_variant_attributes(Spree::Variant.find(variant_id),
max_quantity: max_quantity)
end
end
end

View File

@@ -10,8 +10,6 @@ class CheckoutController < ::BaseController
helper 'terms_and_conditions'
helper 'checkout'
ssl_required
# We need pessimistic locking to avoid race conditions.
# Otherwise we fail on duplicate indexes or end up with negative stock.
prepend_around_action CurrentOrderLocker, only: [:edit, :update]
@@ -137,11 +135,13 @@ class CheckoutController < ::BaseController
last_payment = OrderPaymentFinder.new(@order).last_payment
@order.state == "payment" &&
last_payment&.state == "pending" &&
last_payment&.state == "requires_authorization" &&
last_payment&.response_code == params["payment_intent"]
end
def handle_redirect_from_stripe
return checkout_failed unless @order.process_payments!
if OrderWorkflow.new(@order).next && order_complete?
checkout_succeeded
redirect_to(order_path(@order)) && return
@@ -154,6 +154,8 @@ class CheckoutController < ::BaseController
while @order.state != "complete"
if @order.state == "payment"
return if redirect_to_payment_gateway
return action_failed unless @order.process_payments!
end
next if OrderWorkflow.new(@order).next({ shipping_method_id: shipping_method_id })

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'discourse/single_sign_on'
class DiscourseSsoController < ApplicationController

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'open_food_network/enterprise_injection_data'
class EnterprisesController < BaseController

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
class GroupsController < BaseController
layout 'darkswarm'

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
class HomeController < BaseController
layout 'darkswarm'

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
class LineItemsController < BaseController
respond_to :json
@@ -39,12 +41,8 @@ class LineItemsController < BaseController
def destroy_with_lock(item)
order = item.order
order.with_lock do
item.destroy
order.update_shipping_fees!
order.contents.remove(item.variant)
order.update_payment_fees!
order.update_order_fees!
order.update_order!
order.create_tax_charge!
end
end
end

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
class MapController < BaseController
layout 'darkswarm'

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
# For the API
ActionController::Metal.class_eval do
def spree_current_user

View File

@@ -1,8 +1,6 @@
# frozen_string_literal: true
class PaymentsController < BaseController
ssl_required :redirect_to_authorize
respond_to :html
prepend_before_action :require_logged_in, only: :redirect_to_authorize

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
class ProducersController < BaseController
layout 'darkswarm'

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'open_food_network/spree_api_key_loader'
class RegistrationController < BaseController

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
class ShopController < BaseController
layout "darkswarm"
before_action :require_distributor_chosen, :set_order_cycles, except: :changeable_orders_alert

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
class ShopsController < BaseController
layout 'darkswarm'

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
class SitemapController < ApplicationController
layout nil

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
module Spree
module Admin
class AdjustmentsController < ::Admin::ResourceController

View File

@@ -1,8 +1,8 @@
# frozen_string_literal: true
module Spree
module Admin
class BaseController < ApplicationController
ssl_required
helper 'shared'
helper 'spree/admin/navigation'
helper 'spree/admin/orders'
@@ -12,7 +12,7 @@ module Spree
helper 'enterprise_fees'
helper 'angular_form'
layout '/spree/layouts/admin'
layout 'spree/layouts/admin'
include I18nHelper

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
module Spree
module Admin
class CountriesController < ::Admin::ResourceController

View File

@@ -1,11 +1,12 @@
# frozen_string_literal: true
module Spree
module Admin
class GeneralSettingsController < Spree::Admin::BaseController
def edit
@preferences_general = [:site_name, :default_seo_title, :default_meta_keywords,
:default_meta_description, :site_url]
@preferences_security = [:allow_ssl_in_production,
:allow_ssl_in_staging, :allow_ssl_in_development_and_test]
@preferences_security = [:allow_ssl_in_production, :allow_ssl_in_staging]
@preferences_currency = [:display_currency, :hide_cents]
end

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
module Spree
module Admin
class ImagesController < ::Admin::ResourceController

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
module Spree
module Admin
class InvoicesController < Spree::Admin::BaseController

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
module Spree
module Admin
class MailMethodsController < Spree::Admin::BaseController

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
module Spree
module Admin
module Orders
@@ -23,7 +25,7 @@ module Spree
@order.associate_user!(Spree.user_class.find_by(email: @order.email))
end
OrderWorkflow.new(@order).complete
OrderWorkflow.new(@order).advance_to_payment
@order.shipments.map(&:refresh_rates)
flash[:success] = Spree.t('customer_details_updated')

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'open_food_network/spree_api_key_loader'
module Spree
@@ -26,17 +28,18 @@ module Spree
def edit
@order.shipments.map(&:refresh_rates)
OrderWorkflow.new(@order).complete
# The payment step shows an error of 'No pending payments'
# Clearing the errors from the order object will stop this error
# appearing on the edit page where we don't want it to.
OrderWorkflow.new(@order).advance_to_payment
@order.errors.clear
end
def update
@order.recreate_all_fees!
unless @order.cart?
@order.create_tax_charge!
@order.update_order!
end
unless order_params.present? && @order.update(order_params) && @order.line_items.present?
if @order.line_items.empty? && !params[:suppress_error_msg]
@order.errors.add(:line_items, Spree.t('errors.messages.blank'))
@@ -81,9 +84,7 @@ module Spree
end
def invoice
pdf = InvoiceRenderer.new.render_to_string(@order)
Spree::OrderMailer.invoice_email(@order.id, pdf).deliver_later
Spree::OrderMailer.invoice_email(@order.id).deliver_later
flash[:success] = t('admin.orders.invoice_email_sent')
respond_with(@order) { |format|

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
# this clas was inspired (heavily) from the mephisto admin architecture
module Spree
module Admin

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
module Spree
module Admin
class PaymentMethodsController < ::Admin::ResourceController

View File

@@ -11,7 +11,7 @@ module Spree
before_action :can_transition_to_payment
# We ensure that items are in stock before all screens if the order is in the Payment state.
# This way, we don't allow someone to enter credit card details for an order only to be told
# that it can't be processed.
# that it can't be processed.
before_action :ensure_sufficient_stock_lines
respond_to :html
@@ -35,15 +35,16 @@ module Spree
return
end
authorize_stripe_sca_payment
if @order.completed?
@payment.process!
authorize_stripe_sca_payment
@payment.process_offline!
flash[:success] = flash_message_for(@payment, :successfully_created)
redirect_to spree.admin_order_payments_path(@order)
else
OrderWorkflow.new(@order).complete!
authorize_stripe_sca_payment
@payment.process_offline!
flash[:success] = Spree.t(:new_order_completed)
redirect_to spree.edit_admin_order_url(@order)
@@ -150,7 +151,7 @@ module Spree
return if !@order.payment? || @order.insufficient_stock_lines.blank?
flash[:error] = I18n.t("spree.orders.line_item.insufficient_stock",
on_hand: "0 #{out_of_stock_item_names}")
on_hand: "0 #{out_of_stock_item_names}")
redirect_to spree.edit_admin_order_url(@order)
end
@@ -171,13 +172,15 @@ module Spree
end
def authorize_stripe_sca_payment
return unless @payment.payment_method.class == Spree::Gateway::StripeSCA
return unless @payment.payment_method.instance_of?(Spree::Gateway::StripeSCA)
@payment.authorize!(full_order_path(@payment.order))
raise Spree::Core::GatewayError, I18n.t('authorization_failure') unless @payment.pending?
unless @payment.pending? || @payment.requires_authorization?
raise Spree::Core::GatewayError, I18n.t('authorization_failure')
end
return unless @payment.authorization_action_required?
return unless @payment.requires_authorization?
PaymentMailer.authorize_payment(@payment).deliver_later
raise Spree::Core::GatewayError, I18n.t('action_required')

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
module Spree
module Admin
class ProductPropertiesController < ::Admin::ResourceController

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'open_food_network/spree_api_key_loader'
require 'open_food_network/referer_parser'
require 'open_food_network/permissions'
@@ -161,7 +163,9 @@ module Spree
private
def product_set_from_params
collection_hash = Hash[products_bulk_params[:products].each_with_index.map { |p, i| [i, p] }]
collection_hash = Hash[products_bulk_params[:products].each_with_index.map { |p, i|
[i, p]
} ]
Sets::ProductSet.new(collection_attributes: collection_hash)
end

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
module Spree
module Admin
class PropertiesController < ::Admin::ResourceController

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'csv'
require 'open_food_network/reports/list'
@@ -46,7 +48,8 @@ module Spree
def customers
@report_types = report_types[:customers]
@report_type = params[:report_type]
@report = OpenFoodNetwork::CustomersReport.new spree_current_user, raw_params, render_content?
@report = OpenFoodNetwork::CustomersReport.new spree_current_user, raw_params,
render_content?
render_report(@report.header, @report.table, params[:csv], "customers_#{timestamp}.csv")
end
@@ -91,7 +94,8 @@ module Spree
def sales_tax
@distributors = my_distributors
@report_type = params[:report_type]
@report = OpenFoodNetwork::SalesTaxReport.new spree_current_user, raw_params, render_content?
@report = OpenFoodNetwork::SalesTaxReport.new spree_current_user, raw_params,
render_content?
render_report(@report.header, @report.table, params[:csv], "sales_tax.csv")
end
@@ -101,7 +105,8 @@ module Spree
@report_type = params[:report_type]
# -- Build Report with Order Grouper
@report = OpenFoodNetwork::PaymentsReport.new spree_current_user, raw_params, render_content?
@report = OpenFoodNetwork::PaymentsReport.new spree_current_user, raw_params,
render_content?
@table = order_grouper_table
csv_file_name = "payments_#{timestamp}.csv"
@@ -279,14 +284,14 @@ module Spree
def describe_report(report)
name = I18n.t(:name, scope: [:admin, :reports, report])
description = begin
I18n.t!(:description, scope: [:admin, :reports, report])
rescue I18n::MissingTranslationData
render_to_string(
partial: "#{report}_description",
layout: false,
locals: { report_types: report_types[report] }
).html_safe
end
I18n.t!(:description, scope: [:admin, :reports, report])
rescue I18n::MissingTranslationData
render_to_string(
partial: "#{report}_description",
layout: false,
locals: { report_types: report_types[report] }
).html_safe
end
{ name: name, url: url_for_report(report), description: description }
end

Some files were not shown because too many files have changed in this diff Show More