Compare commits

...

618 Commits

Author SHA1 Message Date
Andy Brett
473ac820aa Merge pull request #6676 from openfoodfoundation/transifex
Transifex
2021-01-18 13:34:44 -08:00
Pau Pérez Fabregat
c9d2149ef9 Merge pull request #6688 from coopdevs/remove-unneeded-deprecation-warning
Remove old deprecation warning
2021-01-18 21:06:56 +01:00
Pau Pérez Fabregat
cd7ba2c62b Merge pull request #6690 from coopdevs/update-static-files-config
Update old setting to serve static assets
2021-01-18 18:05:44 +01:00
Pau Perez
fd80d4a67f Remove old deprecation warning
We're in Rails 4.2 so we can remove it. This gets rid of the following
message when running tests:

```
DEPRECATION WARNING: Suppressing Selenium deprecation warnings is not needed any more. (called from block in <top (required)> at /usr/src/app/spec/spec_helper.rb:214)
```
2021-01-18 17:01:43 +01:00
Pau Perez
006abee23d Update old setting to serve static assets
Fixes the following deprecation warning:

```
DEPRECATION WARNING: The configuration option `config.serve_static_assets` has been renamed to `config.serve_static_files` to clarify its role (it merely enables serving everything in the `public` folder and is unrelated to the asset pipeline). The `serve_
static_assets` alias will be removed in Rails 5.0. Please migrate your configuration files accordingly. (called from block in <top (required)> at /usr/src/app/config/environments/test.rb:13)
```
2021-01-18 17:01:33 +01:00
Pau Pérez Fabregat
158aa78f89 Merge pull request #6692 from Matt-Yorkley/deliver-specs
Update mail delivery mocks in subscription specs
2021-01-18 16:41:02 +01:00
Matt-Yorkley
bc9020a555 Update mail delivery mocks in subscription specs 2021-01-18 12:27:07 +00:00
Andy Brett
1287cb1e56 Merge pull request #6686 from Matt-Yorkley/devise-spec-helper
Update deprecated devise spec helper
2021-01-17 19:57:49 -08:00
Andy Brett
ca022e505a Merge pull request #6684 from Matt-Yorkley/subs-delivery
Use deliver_now in Jobs
2021-01-16 09:11:25 -08:00
Matt-Yorkley
a7ad62a735 Update deprecated devise spec helper
Devise has been complaining about this for a while in the test suite:
```
[Devise] including `Devise::TestHelpers` is deprecated and will be removed from Devise.
For controller tests, please include `Devise::Test::ControllerHelpers` instead.
```
2021-01-16 13:54:09 +00:00
Matt-Yorkley
b713219690 Use deliver_now in Jobs 2021-01-16 13:19:00 +00:00
Andy Brett
2c405a5705 Merge pull request #6672 from Matt-Yorkley/update-hooks
Delete dead code #update_hooks
2021-01-15 19:03:14 -08:00
Matt-Yorkley
5593da2928 Delete dead code #update_hooks
These hooks allow Spree core to be modified by other gems and apps without changing Spree code. We don't use it. #YAGNI
2021-01-15 16:49:45 +00:00
Andy Brett
f179214920 Merge pull request #6677 from Matt-Yorkley/remove-debugging
Remove debugging code from spec
2021-01-15 08:30:00 -08:00
Transifex-Openfoodnetwork
8f8f430e87 Updating translations for config/locales/en_CA.yml 2021-01-16 02:04:42 +11:00
Transifex-Openfoodnetwork
6be14dfb29 Updating translations for config/locales/fr_CA.yml 2021-01-16 01:58:02 +11:00
Matt-Yorkley
c870af8981 Remove debugging output. 2021-01-15 13:21:03 +00:00
Transifex-Openfoodnetwork
c132a5351f Updating translations for config/locales/it.yml 2021-01-15 23:46:42 +11:00
Transifex-Openfoodnetwork
dc76f161a3 Updating translations for config/locales/es.yml 2021-01-15 23:42:27 +11:00
Transifex-Openfoodnetwork
26e817818f Updating translations for config/locales/ca.yml 2021-01-15 23:34:40 +11:00
Pau Pérez Fabregat
5129611cff Merge pull request #6668 from luisramos0/disable_cache_instrumentation
[Rails 5] Make app startup in rails 5 and update Gemfile_next.lock
2021-01-15 13:15:07 +01:00
Pau Pérez Fabregat
f240402c43 Merge pull request #6654 from Matt-Yorkley/update-without-callbacks
Remove #update_attributes_without_callbacks
2021-01-15 12:24:42 +01:00
Andy Brett
9639c2af57 Update all locales with the latest Transifex translations 2021-01-14 17:24:42 -08:00
Andy Brett
cd383189c9 Merge pull request #6667 from openfoodfoundation/transifex
Transifex
2021-01-14 17:11:20 -08:00
Luis Ramos
209e2f20c5 Add rails 5 version for js template helpers 2021-01-15 00:23:37 +00:00
Luis Ramos
bc2d966e5f Remove commented code 2021-01-15 00:22:20 +00:00
Luis Ramos
874da929d3 Disable db2fog in rails 5, it doesnt work, we need to find an alternative for rails 5 2021-01-15 00:21:28 +00:00
Luis Ramos
02a1116fff Remove cache intrumentation
It doesnt work in rails 5 and apparently it was introduced to debug already deleted products cache in staging

See this commit that introduced it 10a79d5a65
2021-01-14 23:45:05 +00:00
Luis Ramos
d06c1fa665 Update Gemfile_next.lock 2021-01-14 23:44:09 +00:00
Maikel
d16bfbad93 Merge pull request #6662 from luisramos0/action_dispatch
First rails 5 upgrade PR with dual boot: remove action_dispatch/request if on rails 5 so we can boot the app in rails 5
2021-01-15 10:17:05 +11:00
Maikel
52b417877a Merge pull request #6660 from openfoodfoundation/dependabot/bundler/webmock-3.11.1
Bump webmock from 3.11.0 to 3.11.1
2021-01-15 09:52:10 +11:00
Andy Brett
7ca81f45d0 Merge pull request #6641 from Matt-Yorkley/shipping-method-soft-deletion
Ensure ShippingMethod is correctly using soft-deletion
2021-01-14 11:53:19 -08:00
Transifex-Openfoodnetwork
3610827869 Updating translations for config/locales/en_GB.yml 2021-01-15 06:42:28 +11:00
Transifex-Openfoodnetwork
a0ee8cb1b3 Updating translations for config/locales/en_FR.yml 2021-01-15 06:01:40 +11:00
Andy Brett
18dcbbd892 Merge pull request #6613 from Matt-Yorkley/variant-override-serialization
Don't serialize all variant override objects where they are not needed
2021-01-14 10:59:11 -08:00
Transifex-Openfoodnetwork
577be5f70b Updating translations for config/locales/fr.yml 2021-01-15 05:57:20 +11:00
Andy Brett
81ea71af94 Merge pull request #6652 from jibees/6651-remove-trailing-asterisk-on-non-mandatory-field
remove asterisk on 'display as' field unit value for a product
2021-01-14 10:09:15 -08:00
Pau Pérez Fabregat
929ae82e00 Merge pull request #6574 from Matt-Yorkley/bye-bye-spree-paypal
Bye Bye Spree Paypal
2021-01-14 18:16:44 +01:00
Pau Pérez Fabregat
9689fe2edf Merge pull request #6384 from andrewpbrett/fix-product-descriptions
correctly display '&' and '&nbsp;' in product descriptions
2021-01-14 17:00:16 +01:00
Luis Ramos
82b2777cb3 Remove action_dispatch/request if on rails 5 so we can boot the app in rails 5 2021-01-14 09:48:59 +00:00
Pau Pérez Fabregat
9db4f9be15 Merge pull request #6634 from Matt-Yorkley/jobs-cleanup
Jobs cleanup
2021-01-14 10:08:15 +01:00
Pau Pérez Fabregat
85e932274d Merge pull request #6442 from luisramos0/rails5-dualboot
Rails 5 upgrade with dualboot
2021-01-14 10:00:54 +01:00
Maikel
168958311a Merge pull request #6656 from Matt-Yorkley/payment-identifier
Fix payment identifier generation
2021-01-14 17:34:38 +11:00
Maikel
fbda1fffd7 Merge pull request #6653 from Matt-Yorkley/dead-code-available-payment
Dead code: #has_available_payment
2021-01-14 17:33:07 +11:00
Maikel
50472d18e0 Merge pull request #6642 from coopdevs/doc-customer-serializer
Doc customer serializer
2021-01-14 17:28:34 +11:00
Maikel
14842f52fc Merge pull request #6633 from Matt-Yorkley/inverse-of
Adding inverse_of
2021-01-14 17:25:51 +11:00
dependabot[bot]
3cee999032 Bump webmock from 3.11.0 to 3.11.1
Bumps [webmock](https://github.com/bblimke/webmock) from 3.11.0 to 3.11.1.
- [Release notes](https://github.com/bblimke/webmock/releases)
- [Changelog](https://github.com/bblimke/webmock/blob/master/CHANGELOG.md)
- [Commits](https://github.com/bblimke/webmock/compare/v3.11.0...v3.11.1)

Signed-off-by: dependabot[bot] <support@github.com>
2021-01-14 05:42:02 +00:00
Andy Brett
08d9ef5832 rename spec file; add test for nil content 2021-01-13 21:01:12 -08:00
Andy Brett
bbd7fd0350 handle nil product descriptions 2021-01-13 20:57:27 -08:00
Matt-Yorkley
5f2dc38241 Merge pull request #6098 from brymut/item-counter-fix
Fix #5989 Item counter accepts higher amount than available stock
2021-01-13 22:33:08 +01:00
Andy Brett
c29d57b54e Merge pull request #6369 from Matt-Yorkley/broken-variants
Fix variant data inconsistencies
2021-01-13 11:10:44 -08:00
Pau Pérez Fabregat
6e48607760 Merge pull request #6629 from jibees/6199-alignment-readyfor-ipad
6199 adjust alignment on the Order Cycle component on ipad
2021-01-13 19:20:14 +01:00
Matt-Yorkley
9633ddf7ce Add test for variant override symbol and tooltip 2021-01-13 18:19:16 +00:00
Matt-Yorkley
18c9e16303 Fix payment identifier generation
Upstream fix from Spree 2.2.

See: 4e747187d7
2021-01-13 17:37:22 +00:00
Matt-Yorkley
305ae103ce Use :create instead of :build in order updater specs
The order updater requires a persisted order
2021-01-13 17:09:02 +00:00
Matt-Yorkley
561cf23dc1 Remove #update_attributes_without_callbacks
This is a hacky Spree method that's removed in Spree 2.2

See: 7deba6a152
2021-01-13 16:02:21 +00:00
Matt-Yorkley
8d338a06f3 Delete dead code #has_available_payment
This is removed in Spree 2.2, as it serves no purpose.

See: 0617bdce30
2021-01-13 15:48:02 +00:00
Pau Perez
acd4dddf1b Doc how balance_value works
[skip ci]
2021-01-13 12:50:41 +01:00
Jean-Baptiste Bellet
dcbf02bc47 remove asterisk on 'display as' field unit value for a product
as it's not a mandatory field
2021-01-13 11:30:08 +01:00
Pau Pérez Fabregat
0b686bbd32 Merge pull request #6366 from coopdevs/fix-customer-balance-n+1
Fix customer balance n+1
2021-01-13 10:25:47 +01:00
Andy Brett
f633f1809f Merge pull request #6646 from openfoodfoundation/dependabot/bundler/shoulda-matchers-4.5.0
Bump shoulda-matchers from 4.4.1 to 4.5.0
2021-01-12 09:07:39 -08:00
Andy Brett
667bc08f05 Merge pull request #6647 from openfoodfoundation/dependabot/bundler/rubocop-1.8.1
Bump rubocop from 1.8.0 to 1.8.1
2021-01-12 09:05:26 -08:00
dependabot[bot]
735c3ce022 Bump rubocop from 1.8.0 to 1.8.1
Bumps [rubocop](https://github.com/rubocop-hq/rubocop) from 1.8.0 to 1.8.1.
- [Release notes](https://github.com/rubocop-hq/rubocop/releases)
- [Changelog](https://github.com/rubocop-hq/rubocop/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rubocop-hq/rubocop/compare/v1.8.0...v1.8.1)

Signed-off-by: dependabot[bot] <support@github.com>
2021-01-12 05:47:39 +00:00
dependabot[bot]
c635c0f541 Bump shoulda-matchers from 4.4.1 to 4.5.0
Bumps [shoulda-matchers](https://github.com/thoughtbot/shoulda-matchers) from 4.4.1 to 4.5.0.
- [Release notes](https://github.com/thoughtbot/shoulda-matchers/releases)
- [Changelog](https://github.com/thoughtbot/shoulda-matchers/blob/master/CHANGELOG.md)
- [Commits](https://github.com/thoughtbot/shoulda-matchers/compare/v4.4.1...v4.5.0)

Signed-off-by: dependabot[bot] <support@github.com>
2021-01-12 05:46:41 +00:00
Andy Brett
67e5825739 add specs for content sanitizer 2021-01-11 21:34:59 -08:00
Andy Brett
5723a79409 check for content.present? 2021-01-11 21:21:24 -08:00
Matt-Yorkley
46ff247bc9 Ensure ShippingMethod#destroy is using soft-deletion
25f5c2daf8

We've already applied some of the changes in this commit during previous Spree upgrade work, but there were a couple of bits missing.
2021-01-11 15:46:38 +00:00
Pau Perez
33c72ecab0 Defend from nil BETA_TESTERS var 2021-01-11 15:55:34 +01:00
Pau Perez
dfed20d634 Consider awaiting_return, returned in balance
These states are reached when the order is complete and shipped. An
admin can create a new return authorization, which will set the order in
`awaiting_return` state. It's only after, when we call
`return_authorization#receive` that the return authorization moves to
`received` state and the order to `returned`.

You can do so from the UI by editing the return authorization and
clicking on Receive. However, we didn't find any order in such state in
UK, FR and AU. The UX is quite obfuscated. That must be why no users
clicked on it.

The `returned` state cannot count for the balance as is, since some of
the products are returned to the shop. That's enough for now.
2021-01-11 15:50:19 +01:00
Pau Perez
aa3fc71626 Consider resumed & payment orders in balance
These order states are already taken care of because they fall in the
`WHEN state IS NOT NULL` case.
2021-01-11 15:50:19 +01:00
Pau Perez
5018e88a34 Consider all states prior to checkout in balance 2021-01-11 15:50:19 +01:00
Pau Perez
398467e7ed Hide new balance impl. under feature toggle
This makes it possible to deploy it without releasing it to users since
the toggle is not enabled for anyone.

It aims to make the balance calculation consistent across pages.
2021-01-11 15:50:19 +01:00
Pau Perez
2e9bae0ea5 Move relation includes out of query object
This query object is meant to be reusable but those includes are
context-specific and will likely not be needed when reusing the query
elsewhere. If we keep them there, chances are next dev might not notice
it and will introduce a performance regression.
2021-01-11 15:50:19 +01:00
Pau Perez
46d997406a Filter out cart orders when fetching customers
We only care about non-cart orders and skipping carts, saves PostgreSQL
query planner to go through thousands of records in production use cases
(my food hub).

We go from

```sql
 ->  Index Scan using index_spree_orders_on_customer_id on spree_orders  (cost=0.42..12049.45 rows=152002 width=15) (actual time=0.015..11.703 rows=13867 loops=1)
```

to

```sql
->  Index Scan using index_spree_orders_on_customer_id on spree_orders  (cost=0.42..12429.46 rows=10802 width=15) (actual time=0.025..17.705 rows=9954 loops=1)
```
2021-01-11 15:50:19 +01:00
Pau Perez
539c5d067a Update order payment_total when voiding a payment
As is, `payment_total` is only increased after successfully processing
a payment and never updated. This inconsistency breaks
`CustomerWithBalance` which relies on it.

Needless to say that if we keep this denormalized column, we better make
it consistent. I investigated current Spree's master branch (709e686cc0)
and they also realized it was broken. Now `Payment` runs the following
from the `after_save` `update_order` callback.

```rb
order.updater.update_payment_total if completed? || void?
```

I also took the chance to rearrange tests a bit.
2021-01-11 15:50:19 +01:00
Pau Perez
04930877dd Test that payment_total is stored after payment
CustomerWithBalance totally relies on `spree_orders.payment_total` so we
better cover it with tests.
2021-01-11 15:50:19 +01:00
Pau Perez
93cdca85c6 Return 0 balance when the customer has no orders 2021-01-11 15:50:19 +01:00
Pau Perez
96a91969c9 Extract balance-specific serializer
So we only show the customer balance where really needed. Aggregating
the balance can be costly. Also, we avoid defensive coding.
2021-01-11 15:50:19 +01:00
Pau Perez
9d0dd968b1 Test customer balance query with guest orders
Guest orders also have an associated customer record that is created
by Spree::Order#ensure_customer at checkout. Subsequent orders will use
that one due to Spree::Order#associate_customer.
2021-01-11 15:50:19 +01:00
Pau Perez
d8872bc785 Explain why Arel can't be used in statement 2021-01-11 15:50:19 +01:00
Pau Perez
1e9a1f340e Don't consider order total when it is canceled 2021-01-11 15:50:19 +01:00
Pau Perez
e404225de0 Extract query object 2021-01-11 15:50:19 +01:00
Pau Perez
d62ab06504 Refactor DB query to aggregate customer balance
It's simpler and many orders of magnitude more efficient to ask the DB
to aggregate the customer balance based on their orders. It removes
a nasty N+1.

The resulting SQL query is:

```sql
SELECT customers.*, SUM(spree_orders.total - spree_orders.payment_total) AS balance
FROM "customers"
INNER JOIN "spree_orders"
    ON "spree_orders"."customer_id" = "customers"."id"
WHERE "customers"."enterprise_id" = 1
    AND (completed_at IS NOT NULL)
    AND (state != 'canceled')
GROUP BY customers.id
ORDER BY email;
```
2021-01-11 15:50:19 +01:00
Pau Pérez Fabregat
ad6165c446 Merge pull request #6480 from openfoodfoundation/dependabot/bundler/paper_trail-10.3.1
Bump paper_trail from 7.1.3 to 10.3.1
2021-01-11 12:02:34 +01:00
Andy Brett
ffeea631b3 add spec for exceeding available quantity 2021-01-09 18:49:53 -08:00
Andy Brett
c8c576ce38 keep size attribute 2021-01-09 17:49:47 -08:00
Bryan Mutai
eef6396de3 Add max attribute to item counter input 2021-01-09 17:36:35 -08:00
dependabot[bot]
b6a115e271 Bump paper_trail from 7.1.3 to 10.3.1
Bumps [paper_trail](https://github.com/airblade/paper_trail) from 7.1.3 to 10.3.1.
- [Release notes](https://github.com/airblade/paper_trail/releases)
- [Changelog](https://github.com/paper-trail-gem/paper_trail/blob/master/CHANGELOG.md)
- [Commits](https://github.com/airblade/paper_trail/compare/v7.1.3...v10.3.1)

Signed-off-by: dependabot[bot] <support@github.com>
2021-01-09 22:50:08 +00:00
Andy Brett
c12abf8057 Merge pull request #6617 from Matt-Yorkley/stock-items-variant-deletion
Stock items and variant deletion
2021-01-09 12:12:24 -08:00
Andy Brett
9cc0f74314 Merge pull request #6620 from mkllnk/6616-emphasize-qty-button-disabled
Emphasize disabled Add button when out of stock
2021-01-09 11:34:57 -08:00
Matt-Yorkley
e5be249f2c Update comment on #expire_current_order 2021-01-09 13:26:30 +00:00
Matt-Yorkley
f9f830e0e1 Bring in Paypal certificates hack via new initializer 2021-01-09 13:26:30 +00:00
Matt-Yorkley
c07a4fcb5e Remove data-hooks from views 2021-01-09 13:26:30 +00:00
Matt-Yorkley
8439b68b36 Update code comment and link 2021-01-09 13:26:30 +00:00
Matt-Yorkley
09b7512cd8 Remove dead code around unused payment_method_field data-hook 2021-01-09 13:26:30 +00:00
Matt-Yorkley
2e5810d64d Fix more Rubocop offences 2021-01-09 13:26:30 +00:00
Matt-Yorkley
bf47db1792 Fix missing route in Spree::OrdersController
I'm not sure why this spec started failing. Fixes:

```
Spree::OrdersController viewing cart when an item is in the cart the page provides the right registration path
     Failure/Error: expect(subject.registration_path).to eq registration_path

     ActionController::UrlGenerationError:
       No route matches {:action=>"index", :controller=>"registration"}
     # ./spec/controllers/spree/orders_controller_spec.rb:140:in `block (5 levels) in <top (required)>'
```
2021-01-09 13:26:30 +00:00
Matt-Yorkley
83f58368c7 Fix class-loading issue in test suite
Fixes:

```
Failure/Error: include Spree::Core::ControllerHelpers::Auth

NameError:
  uninitialized constant Spree::Core::ControllerHelpers::Auth
# ./lib/spree/api/controller_setup.rb:19:in `block in included'
# ./lib/spree/api/controller_setup.rb:5:in `class_eval'
# ./lib/spree/api/controller_setup.rb:5:in `included'
# ./app/controllers/api/base_controller.rb:9:in `include'
# ./app/controllers/api/base_controller.rb:9:in `<class:BaseController>'
# ./app/controllers/api/base_controller.rb:6:in `<module:Api>'
# ./app/controllers/api/base_controller.rb:5:in `<top (required)>'
# ./app/controllers/api/products_controller.rb:5:in `<module:Api>'
# ./app/controllers/api/products_controller.rb:4:in `<top (required)>'
# ./spec/controllers/api/products_controller_spec.rb:6:in `<top (required)>'
```
2021-01-09 13:26:30 +00:00
Matt-Yorkley
c34ae0af4b Bring in paypal-sdk-merchant gem dependency 2021-01-09 13:26:30 +00:00
Matt-Yorkley
3487898f68 Remove better_spree_paypal_express gem 2021-01-09 13:24:51 +00:00
Matt-Yorkley
618738db69 Fix more Rubocop offences 2021-01-09 13:22:25 +00:00
Matt-Yorkley
2864f62a08 Fix missing semicolons in spree_paypal_express.js 2021-01-09 13:22:25 +00:00
Matt-Yorkley
ab43c04ca8 Bring in translations 2021-01-09 13:22:25 +00:00
Matt-Yorkley
5c7dc6621b Bring in views (and convert from ERB to HAML) 2021-01-09 13:22:25 +00:00
Matt-Yorkley
7f8fe631dd Bring in Spree::PaypalExpressCheckout 2021-01-09 13:22:25 +00:00
Matt-Yorkley
2a27da1cc5 Bring in Spree::Gateway::PayPalExpress 2021-01-09 13:22:25 +00:00
Matt-Yorkley
2dce66f079 Fix some simple Rubocop offences 2021-01-09 13:22:25 +00:00
Matt-Yorkley
4ca3e29458 Apply changes from and remove Spree::PaypalController decorator 2021-01-09 13:22:25 +00:00
Matt-Yorkley
94549e98ba Bring in Spree::PaypalController 2021-01-09 13:22:09 +00:00
Matt-Yorkley
597eed5285 Bring in Spree::Admin::PaypalPaymentsController 2021-01-09 13:22:09 +00:00
Matt-Yorkley
42468e2ef3 Apply Spree::Admin::PaymentsController decorator 2021-01-09 13:22:09 +00:00
Matt-Yorkley
2fb7dfa430 Bring in Paypal Express javascript 2021-01-09 13:22:09 +00:00
Matt-Yorkley
478f761188 Add Spree::Gateway::PayPalExpress to spree payment_methods list 2021-01-09 13:22:09 +00:00
Matt-Yorkley
dd5a197fb3 Remove ManagerInvitationJob 2021-01-09 11:56:27 +00:00
Matt-Yorkley
ca42b1fff7 Remove ConfirmSignupJob 2021-01-09 11:38:29 +00:00
Matt-Yorkley
6a7f795f64 Remove WelcomeEnterpriseJob 2021-01-09 11:33:10 +00:00
Andy Brett
3877721209 Merge pull request #6631 from Matt-Yorkley/actionmailer-deliver
[Deprecation] Replace ActionMailer#deliver with ActionMailer#deliver_now
2021-01-08 17:42:31 -08:00
Andy Brett
d6656804eb Merge pull request #6557 from luisramos0/rubocop
Rubocop exceptions update
2021-01-08 17:36:23 -08:00
Andy Brett
08dcb13fca Merge pull request #6578 from Matt-Yorkley/products-endpoint-content-type
Products endpoint content type
2021-01-08 17:34:26 -08:00
Andy Brett
ebecabdda5 Merge pull request #22 from Matt-Yorkley/sanitizer-service
Content Sanitizer
2021-01-08 17:31:59 -08:00
Matt-Yorkley
b7ecf4791a Extract more sanitizing logic from Api::ProductSerializer and make service more generic/re-usable. 2021-01-09 01:07:11 +00:00
Matt-Yorkley
69640dc785 Tidy up producer mailer spec
This is covered in two other spec files relating to order cycles, the producer mailer spec doesn't need to know what calls the producer mailer.
2021-01-09 00:07:50 +00:00
Matt-Yorkley
a9706fa5f1 Update syntax in rake task 2021-01-08 23:18:55 +00:00
Matt-Yorkley
9d5eaa1790 Delete dead code in delayed job spec helper 2021-01-08 23:18:55 +00:00
Matt-Yorkley
496f2dab69 Ensure Jobs are instantiated correctly
We should not be using `Delayed::Job.enqueue` anywhere...
2021-01-08 23:18:55 +00:00
Matt-Yorkley
2dc918ff59 Ensure all Job classes correctly inherit from ActiveJob 2021-01-08 23:18:55 +00:00
Matt-Yorkley
ff962c1c9b Change various Mailer invocations from #deliver_now to #deliver_later 2021-01-08 23:18:55 +00:00
Luis Ramos
2e4a206825 Add new offenses to exceptions file 2021-01-08 22:43:15 +00:00
Luis Ramos
0b45533237 Update rubocop todo list 2021-01-08 22:43:15 +00:00
Luis Ramos
42fff560fb Attempt at rails 5 upgrade 2021-01-08 22:40:47 +00:00
Andy Brett
53b119ddb7 Merge pull request #6630 from coopdevs/update-haml-lint-config
Update haml lint config
2021-01-08 13:46:57 -08:00
Andy Brett
05f6337e7d Merge pull request #6622 from openfoodfoundation/dependabot/bundler/ddtrace-0.44.0
Bump ddtrace from 0.43.0 to 0.44.0
2021-01-08 13:39:07 -08:00
Andy Brett
59527ab38a refactor filter to a service 2021-01-08 13:37:18 -08:00
Luis Ramos
c2c491ced2 Setup dualboot for rails 5 upgrade 2021-01-08 21:34:13 +00:00
Matt-Yorkley
3e6445c51c Replace deprecated ActionMailer#deliver with ActionMailer#deliver_now
DEPRECATION WARNING: `#deliver` is deprecated and will be removed in Rails 5. Use `#deliver_now` to deliver immediately or `#deliver_later` to deliver through Active Job.
2021-01-08 20:35:47 +00:00
Matt-Yorkley
87b14f0237 Avoid using #allow_any_instance_of 2021-01-08 17:47:09 +00:00
Matt-Yorkley
3b1ad29d20 Fix view rendering in Api::BaseController 2021-01-08 17:47:09 +00:00
Matt-Yorkley
eec9f27353 Move controller concern to correct directory
This is a controller concern, it should live in app/controllers/concerns/
2021-01-08 17:47:09 +00:00
Matt-Yorkley
d90ed56603 Add missing test for Api::OrderCyclesController responses 2021-01-08 17:47:09 +00:00
Matt-Yorkley
0dd57fc3de Render an empty JSON object instead of a blank string 2021-01-08 17:47:09 +00:00
Matt-Yorkley
04e4893723 Update route declarations in caching spec 2021-01-08 17:47:09 +00:00
Matt-Yorkley
4ba3c81f90 Update route declaration in karma test 2021-01-08 17:47:09 +00:00
Matt-Yorkley
261ed751cb Remove explicit content_type declarations in Api::OrderCyclesController
This should be handled in `Api::BaseController`
2021-01-08 17:47:09 +00:00
Matt-Yorkley
d0800b5e32 Specify json format for API routes that return json in OrderCycleResource 2021-01-08 17:47:09 +00:00
Pau Pérez Fabregat
95ab6c7d83 Merge pull request #6627 from Matt-Yorkley/dead-code-product-available
Delete dead code Spree::Product#available?
2021-01-08 17:35:21 +01:00
Pau Perez
b08a918ba5 Do not check for spaces inside the braces of hash
This shuts the annoying lint error

```
Hash attribute should start with one space after the opening brace
Hash attribute should end with one space before the closing brace
```

and it aligns with our existing style. See
https://github.com/openfoodfoundation/openfoodnetwork/pull/6629 as an
example.
2021-01-08 17:22:37 +01:00
Pau Perez
03bb9899fa Copy Hound's default Haml lint config 2021-01-08 17:22:36 +01:00
dependabot[bot]
96cf1c0514 Bump ddtrace from 0.43.0 to 0.44.0
Bumps [ddtrace](https://github.com/DataDog/dd-trace-rb) from 0.43.0 to 0.44.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.43.0...v0.44.0)

Signed-off-by: dependabot[bot] <support@github.com>
2021-01-08 16:20:47 +00:00
Pau Pérez Fabregat
8ca51c8b72 Merge pull request #6626 from Matt-Yorkley/flaky-oc-simple-spec
[Flaky Spec] Improve simple OC spec
2021-01-08 17:18:43 +01:00
Matt-Yorkley
0949e72c88 Merge pull request #6597 from Matt-Yorkley/cancancan
Switch from cancan to cancancan
2021-01-08 17:15:08 +01:00
Matt-Yorkley
139773bc22 Add inverse_of to associations between shipping methods and rates
See 20d913c21c
2021-01-08 15:42:58 +00:00
Matt-Yorkley
f07c2dcd84 Add inverse_of for associations involved in cart processing
7bac3e7b2c

and

61bd5446e1
2021-01-08 15:42:58 +00:00
Pau Perez
6e689c4607 Update all locales with the latest Transifex translations 2021-01-08 16:18:31 +01:00
Pau Pérez Fabregat
9cf71c703d Merge pull request #6615 from Matt-Yorkley/money
Money!
2021-01-08 13:24:14 +01:00
Matt-Yorkley
c281c67d0e Switch from cancan to cancancan
Development of cancan stopped in 2013. cancancan is the active fork of the defunct original, and has been updated many times to keep up with changes in newer Rails and Ruby versions.
2021-01-08 12:02:18 +00:00
Pau Pérez Fabregat
b51d8c573a Merge pull request #6614 from Matt-Yorkley/api-errors
API Bugnag errors
2021-01-08 12:59:11 +01:00
Pau Pérez Fabregat
47774b3b2e Merge pull request #6628 from openfoodfoundation/dependabot/bundler/rubocop-1.8.0
Bump rubocop from 1.7.0 to 1.8.0
2021-01-08 12:57:14 +01:00
Pau Pérez Fabregat
3927f56ed4 Merge pull request #6444 from openfoodfoundation/dependabot/bundler/kaminari-1.2.1
[Security] Bump kaminari from 0.17.0 to 1.2.1
2021-01-08 12:47:59 +01:00
Pau Pérez Fabregat
bd83443595 Merge pull request #6611 from jibees/6196-fix-text-wrapping-on-oc
6196 fix text wrapping on oc
2021-01-08 11:48:41 +01:00
Pau Pérez Fabregat
27e83392bf Merge pull request #6536 from coopdevs/enable-new-customer-balance-to-core-team
Enable new customer balance for the beta testers
2021-01-08 11:24:23 +01:00
Jean-Baptiste Bellet
fc71808517 use flex property to manage responsive
and remove unsued properties
2021-01-08 11:24:16 +01:00
Jean-Baptiste Bellet
5869eb1841 add new div container
to use flexbox properties for its two child divs
named: select-and-closing-container
2021-01-08 11:23:23 +01:00
dependabot[bot]
11ce9b943f Bump rubocop from 1.7.0 to 1.8.0
Bumps [rubocop](https://github.com/rubocop-hq/rubocop) from 1.7.0 to 1.8.0.
- [Release notes](https://github.com/rubocop-hq/rubocop/releases)
- [Changelog](https://github.com/rubocop-hq/rubocop/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rubocop-hq/rubocop/compare/v1.7.0...v1.8.0)

Signed-off-by: dependabot[bot] <support@github.com>
2021-01-08 05:39:09 +00:00
Andy Brett
72a65426a0 allow '&' and spaces 2021-01-07 20:50:43 -08:00
Andy Brett
d78e8acee7 Merge pull request #6619 from luisramos0/remove_oj
Remove unused dependency
2021-01-07 12:43:09 -08:00
Andy Brett
3073a9b588 Merge pull request #6618 from luisramos0/byebug
Upgrade pry
2021-01-07 12:41:43 -08:00
Andy Brett
0bb92e04b5 Merge pull request #6621 from openfoodfoundation/dependabot/bundler/bugsnag-6.19.0
Bump bugsnag from 6.18.0 to 6.19.0
2021-01-07 12:35:51 -08:00
Matt-Yorkley
52b43d8c23 Delete dead code
This method isn't called from anywhere
2021-01-07 16:03:04 +00:00
Pau Pérez Fabregat
ca84e3eafb Merge pull request #6610 from openfoodfoundation/dependabot/bundler/stripe-5.29.0
Bump stripe from 5.28.0 to 5.29.0
2021-01-07 16:58:02 +01:00
Matt-Yorkley
d27900d5fb Merge pull request #6525 from openfoodfoundation/transifex
Transifex
2021-01-07 16:54:22 +01:00
Pau Pérez Fabregat
7f3c4f2433 Merge pull request #6551 from coopdevs/track-request-queuing
Track request queuing in Datadog
2021-01-07 16:34:42 +01:00
Matt-Yorkley
0c9df590d3 Add some improvements to help ensure UI elements are actually loaded by Angular before they are clicked on by Capybara 2021-01-07 14:50:09 +00:00
dependabot[bot]
0fdf398dd0 Bump bugsnag from 6.18.0 to 6.19.0
Bumps [bugsnag](https://github.com/bugsnag/bugsnag-ruby) from 6.18.0 to 6.19.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.18.0...v6.19.0)

Signed-off-by: dependabot[bot] <support@github.com>
2021-01-07 05:42:58 +00:00
Maikel Linke
18b1504935 Emphasize disabled Add button when out of stock
Using the same grey as was used in the bulk modal already. This makes it
more consistent and hopefully more clear.
2021-01-07 10:32:10 +11:00
Luis Ramos
ea29c62c5e Remove unused dependency 2021-01-06 22:50:55 +00:00
Luis Ramos
18b84fc850 Upgrade pry 2021-01-06 22:41:20 +00:00
Matt-Yorkley
a8d07a7e80 Merge pull request #6602 from openfoodfoundation/dependabot/bundler/awesome_nested_set-3.3.1
Bump awesome_nested_set from 3.2.1 to 3.3.1
2021-01-06 21:43:12 +01:00
Matt-Yorkley
cca16c6e1f Fix stock issue and update specs (now passing)
See: dcd5944a29
2021-01-06 20:13:38 +00:00
Matt-Yorkley
c0c7c4f440 Import failing specs for stock items
See: dcd5944a29
2021-01-06 20:12:52 +00:00
Matt-Yorkley
cc88611b15 Update Spree::Money to use Monetize#parse instead of Money#parse
This method was removed from the money gem without replacement. It's now provided by the monetize gem.
2021-01-06 19:20:19 +00:00
Matt-Yorkley
3387bf5821 Switch from direct dependency on money gem to monetize gem
This change is actually made around Spree 2.0, but we missed it. The `monetize` gem also installs the `money` gem.
2021-01-06 19:17:00 +00:00
Matt-Yorkley
45e4d86631 Merge money_decorator.rb with money.rb
The #rounded method was left out, as it appears to be dead code.
2021-01-06 19:17:00 +00:00
dependabot-preview[bot]
47f59a5d0a [Security] Bump kaminari from 0.17.0 to 1.2.1
Bumps [kaminari](https://github.com/kaminari/kaminari) from 0.17.0 to 1.2.1. **This update includes security fixes.**
- [Release notes](https://github.com/kaminari/kaminari/releases)
- [Changelog](https://github.com/kaminari/kaminari/blob/master/CHANGELOG.md)
- [Commits](https://github.com/kaminari/kaminari/compare/v0.17.0...v1.2.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-01-06 19:09:53 +00:00
Matt-Yorkley
0fbf3d6cd9 Merge pull request #6555 from filipefurtad0/tax_rates_spec
Extends spec coverage of Tax Rates settings - CRUD operations
2021-01-06 19:16:14 +01:00
Matt-Yorkley
019f4dfa24 Merge pull request #6605 from PauloVilarinho/refactor-pagination-data
Refactor pagination data
2021-01-06 19:06:23 +01:00
Matt-Yorkley
7beba3debf Merge pull request #6609 from openfoodfoundation/dependabot/bundler/rubocop-rails-2.9.1
Bump rubocop-rails from 2.5.2 to 2.9.1
2021-01-06 17:46:50 +01:00
filipefurtad0
3c123bb947 Simplified the delete test-case
Using :xpath may compromise the stability of the test, and make it break upon slight changes to the page.
2021-01-06 16:23:46 +00:00
filipefurtad0
fc062a04a4 Updated the assertion/error to consider PR #6545 2021-01-06 16:23:46 +00:00
filipefurtad0
7f658d4c46 Removed the "_id" ending from objects
Renamed objects ":zone_id" and ":tax_category_id" into ":zone" and ":tax_category," as these are full objects and not just ids.
2021-01-06 16:23:46 +00:00
filipefurtad0
8a453abd26 Adding "frozen_string_literal" back to the file
Mistakenly removed the line "# frozen_string_literal: true". This commit adds it back in.
2021-01-06 16:23:46 +00:00
filipefurtad0
3edf5fd6d9 Extends spec coverage of Tax Rates settings - CRUD operations 2021-01-06 16:23:46 +00:00
Matt-Yorkley
bd4560cff6 Don't serialize all variant override objects where they are not needed
This is only needed in one place, and only as a count, and can cause huge amounts of superfluous data to be fetched and serialized, for example in the admin products index page (where variant override data is not used at all).
2021-01-06 16:04:47 +00:00
Andy Brett
381d5a5e37 Merge pull request #6599 from openfoodfoundation/dependabot/bundler/capybara-3.32.2
Bump capybara from 3.15.1 to 3.32.2
2021-01-06 07:40:39 -08:00
Matt-Yorkley
c482173394 Delete dead code
This AMS injection method is no longer referenced anywhere in the codebase
2021-01-06 13:20:31 +00:00
Matt-Yorkley
b842bfbc3d Explicitly notify Bugsnag on errors during API response processing
These errors are currently not being sent :/
2021-01-06 12:59:19 +00:00
Jean-Baptiste Bellet
39fc80172e move css property 2021-01-06 09:49:12 +01:00
Jean-Baptiste Bellet
1b4906d55a adjust margin according to old design 2021-01-06 09:17:11 +01:00
Jean-Baptiste Bellet
6e6be09740 use display flex to align 2021-01-06 09:16:38 +01:00
Jean-Baptiste Bellet
3a8b63b371 remove height constraint 2021-01-06 09:16:19 +01:00
dependabot[bot]
491dc387d7 Bump stripe from 5.28.0 to 5.29.0
Bumps [stripe](https://github.com/stripe/stripe-ruby) from 5.28.0 to 5.29.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.28.0...v5.29.0)

Signed-off-by: dependabot[bot] <support@github.com>
2021-01-06 05:31:08 +00:00
dependabot[bot]
02c63519c7 Bump rubocop-rails from 2.5.2 to 2.9.1
Bumps [rubocop-rails](https://github.com/rubocop-hq/rubocop-rails) from 2.5.2 to 2.9.1.
- [Release notes](https://github.com/rubocop-hq/rubocop-rails/releases)
- [Changelog](https://github.com/rubocop-hq/rubocop-rails/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rubocop-hq/rubocop-rails/compare/v2.5.2...v2.9.1)

Signed-off-by: dependabot[bot] <support@github.com>
2021-01-06 05:28:02 +00:00
Andy Brett
e58cd8a043 overwrite existing field value 2021-01-05 16:01:04 -08:00
Andy Brett
67bf6bb5fc Merge pull request #6604 from openfoodfoundation/dependabot/bundler/webdrivers-4.4.2
Bump webdrivers from 4.2.0 to 4.4.2
2021-01-05 14:55:03 -08:00
Matt-Yorkley
540aa913a3 Tidy up Api::OrderController#index 2021-01-05 21:08:02 +00:00
Matt-Yorkley
fe0a0395d8 Remove DEFAULT_PAGE constants 2021-01-05 19:07:46 +00:00
Matt-Yorkley
4bb2653306 Tidy up pagination in Api::ProductsController#overridable and Angular PagedFetcher service
Refactors away some unnecessary mess and unblocks the last remaining issue in upgrading the Kaminari gem (deprecated calls to #num_pages method)
2021-01-05 18:57:08 +00:00
Matt-Yorkley
47f9a3f08a Add guard clause and remove conditionals
Sometimes the objects are not paginated. In this case we need to avoid trying to render pagination data, as it will throw an error. This guard clause also means we can remove messy conditionals from several controllers.
2021-01-05 18:51:24 +00:00
Paulo Vilarinho
f53089c16c fix products controller spec erros 2021-01-05 15:11:26 -03:00
dependabot[bot]
811480c8e0 Bump awesome_nested_set from 3.2.1 to 3.3.1
Bumps [awesome_nested_set](https://github.com/collectiveidea/awesome_nested_set) from 3.2.1 to 3.3.1.
- [Release notes](https://github.com/collectiveidea/awesome_nested_set/releases)
- [Changelog](https://github.com/collectiveidea/awesome_nested_set/blob/master/CHANGELOG)
- [Commits](https://github.com/collectiveidea/awesome_nested_set/compare/v3.2.1...v3.3.1)

Signed-off-by: dependabot[bot] <support@github.com>
2021-01-05 16:56:21 +00:00
Pau Pérez Fabregat
dae065324d Merge pull request #6600 from openfoodfoundation/dependabot/bundler/shoulda-matchers-4.4.1
Bump shoulda-matchers from 4.0.1 to 4.4.1
2021-01-05 17:54:47 +01:00
Pau Pérez Fabregat
a14750933c Merge pull request #6592 from openfoodfoundation/dependabot/bundler/rubocop-1.7.0
Bump rubocop from 0.81.0 to 1.7.0
2021-01-05 17:54:22 +01:00
Pau Pérez Fabregat
20fd85786c Merge pull request #6603 from openfoodfoundation/dependabot/bundler/rack-mini-profiler-2.3.0
Bump rack-mini-profiler from 2.0.2 to 2.3.0
2021-01-05 16:48:56 +01:00
Paulo Vilarinho
c99b250a5f refactor pagination data removing default_per_page parameter 2021-01-05 12:18:47 -03:00
Paulo Vilarinho
4d217c9e9d refactor render paginated products 2021-01-05 12:04:59 -03:00
Paulo Vilarinho
9a62ba8ed5 remove hound errors 2021-01-05 11:59:49 -03:00
Paulo Vilarinho
81c3c1cf32 remove default page 2021-01-05 11:57:54 -03:00
Paulo Vilarinho
330d42ea98 change inclue position to start of class 2021-01-05 11:48:02 -03:00
dependabot[bot]
381880d281 Bump webdrivers from 4.2.0 to 4.4.2
Bumps [webdrivers](https://github.com/titusfortner/webdrivers) from 4.2.0 to 4.4.2.
- [Release notes](https://github.com/titusfortner/webdrivers/releases)
- [Changelog](https://github.com/titusfortner/webdrivers/blob/master/CHANGELOG.md)
- [Commits](https://github.com/titusfortner/webdrivers/compare/v4.2.0...v4.4.2)

Signed-off-by: dependabot[bot] <support@github.com>
2021-01-05 12:07:15 +00:00
dependabot[bot]
87c9ec32e6 Bump shoulda-matchers from 4.0.1 to 4.4.1
Bumps [shoulda-matchers](https://github.com/thoughtbot/shoulda-matchers) from 4.0.1 to 4.4.1.
- [Release notes](https://github.com/thoughtbot/shoulda-matchers/releases)
- [Changelog](https://github.com/thoughtbot/shoulda-matchers/blob/master/CHANGELOG.md)
- [Commits](https://github.com/thoughtbot/shoulda-matchers/compare/v4.0.1...v4.4.1)

Signed-off-by: dependabot[bot] <support@github.com>
2021-01-05 12:04:57 +00:00
dependabot[bot]
ba867e53d0 Bump rack-mini-profiler from 2.0.2 to 2.3.0
Bumps [rack-mini-profiler](https://github.com/MiniProfiler/rack-mini-profiler) from 2.0.2 to 2.3.0.
- [Release notes](https://github.com/MiniProfiler/rack-mini-profiler/releases)
- [Changelog](https://github.com/MiniProfiler/rack-mini-profiler/blob/master/CHANGELOG.md)
- [Commits](https://github.com/MiniProfiler/rack-mini-profiler/compare/v2.0.2...v2.3.0)

Signed-off-by: dependabot[bot] <support@github.com>
2021-01-05 12:01:20 +00:00
Paulo Vilarinho
efd4b97f5c fix depracation warnings from kaminary 2021-01-05 00:33:29 -03:00
Paulo Vilarinho
ccac16c5b2 fix orders controllers specs errors 2021-01-05 00:07:38 -03:00
Paulo Vilarinho
ab586f58b1 apply pagination data concern to bulk line items controller 2021-01-04 20:22:58 -03:00
Paulo Vilarinho
3f324537a5 apply pagination data concern to exchange products controller 2021-01-04 20:22:43 -03:00
Paulo Vilarinho
1c5f6e7222 apply pagination data concern to orders controller 2021-01-04 20:22:14 -03:00
Paulo Vilarinho
9bb7096be1 apply pagination data concern to products_controller 2021-01-04 20:21:39 -03:00
Paulo Vilarinho
0f00107de1 add pagination data concern 2021-01-04 20:21:24 -03:00
Andy Brett
2085e183d4 Merge pull request #6601 from openfoodfoundation/dependabot/bundler/spring-2.1.1
Bump spring from 2.0.2 to 2.1.1
2021-01-04 12:37:59 -08:00
dependabot[bot]
5460fc9152 Bump rubocop from 0.81.0 to 1.7.0
Bumps [rubocop](https://github.com/rubocop-hq/rubocop) from 0.81.0 to 1.7.0.
- [Release notes](https://github.com/rubocop-hq/rubocop/releases)
- [Changelog](https://github.com/rubocop-hq/rubocop/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rubocop-hq/rubocop/compare/v0.81.0...v1.7.0)

Signed-off-by: dependabot[bot] <support@github.com>
2021-01-04 20:14:06 +00:00
dependabot[bot]
7ee8385902 Bump capybara from 3.15.1 to 3.32.2
Bumps [capybara](https://github.com/teamcapybara/capybara) from 3.15.1 to 3.32.2.
- [Release notes](https://github.com/teamcapybara/capybara/releases)
- [Changelog](https://github.com/teamcapybara/capybara/blob/master/History.md)
- [Commits](https://github.com/teamcapybara/capybara/compare/3.15.1...3.32.2)

Signed-off-by: dependabot[bot] <support@github.com>
2021-01-04 20:14:05 +00:00
Andy Brett
a749bb602a Merge pull request #6589 from openfoodfoundation/dependabot/bundler/ffaker-2.16.0
Bump ffaker from 2.11.0 to 2.16.0
2021-01-04 12:13:06 -08:00
Andy Brett
749c7f4193 Merge pull request #6585 from openfoodfoundation/dependabot/bundler/fuubar-2.5.1
Bump fuubar from 2.5.0 to 2.5.1
2021-01-04 12:11:52 -08:00
dependabot[bot]
343d8d2686 Bump spring from 2.0.2 to 2.1.1
Bumps [spring](https://github.com/rails/spring) from 2.0.2 to 2.1.1.
- [Release notes](https://github.com/rails/spring/releases)
- [Changelog](https://github.com/rails/spring/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rails/spring/compare/v2.0.2...v2.1.1)

Signed-off-by: dependabot[bot] <support@github.com>
2021-01-04 18:58:40 +00:00
Andy Brett
59c981e14d Merge pull request #6591 from openfoodfoundation/dependabot/bundler/test-prof-0.11.3
Bump test-prof from 0.7.5 to 0.11.3
2021-01-04 10:55:47 -08:00
dependabot[bot]
b8f7ef27a6 Bump fuubar from 2.5.0 to 2.5.1
Bumps [fuubar](https://github.com/thekompanee/fuubar) from 2.5.0 to 2.5.1.
- [Release notes](https://github.com/thekompanee/fuubar/releases)
- [Changelog](https://github.com/thekompanee/fuubar/blob/master/CHANGELOG.md)
- [Commits](https://github.com/thekompanee/fuubar/compare/releases/v2.5.0...releases/2.5.1)

Signed-off-by: dependabot[bot] <support@github.com>
2021-01-04 18:34:00 +00:00
dependabot[bot]
22d2b078e8 Bump ffaker from 2.11.0 to 2.16.0
Bumps [ffaker](https://github.com/ffaker/ffaker) from 2.11.0 to 2.16.0.
- [Release notes](https://github.com/ffaker/ffaker/releases)
- [Changelog](https://github.com/ffaker/ffaker/blob/master/Changelog.md)
- [Commits](https://github.com/ffaker/ffaker/commits/v2.16.0)

Signed-off-by: dependabot[bot] <support@github.com>
2021-01-04 17:53:45 +00:00
Pau Pérez Fabregat
bfbad0ae81 Merge pull request #6560 from openfoodfoundation/dependabot/bundler/unicorn-5.8.0
Bump unicorn from 5.7.0 to 5.8.0
2021-01-04 18:07:54 +01:00
dependabot[bot]
b49a773bca Bump test-prof from 0.7.5 to 0.11.3
Bumps [test-prof](https://github.com/test-prof/test-prof) from 0.7.5 to 0.11.3.
- [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/v0.7.5...v0.11.3)

Signed-off-by: dependabot[bot] <support@github.com>
2021-01-04 17:07:30 +00:00
Pau Pérez Fabregat
ca7548e8f4 Merge pull request #6573 from openfoodfoundation/dependabot/bundler/test-unit-3.3.9
Bump test-unit from 3.3.7 to 3.3.9
2021-01-04 18:06:07 +01:00
Pau Pérez Fabregat
258b25b453 Merge pull request #6596 from openfoodfoundation/dependabot/bundler/simplecov-0.18.5
Bump simplecov from 0.17.1 to 0.18.5
2021-01-04 18:05:03 +01:00
Pau Pérez Fabregat
1d28e7add3 Merge pull request #6588 from openfoodfoundation/dependabot/bundler/pry-byebug-3.8.0
Bump pry-byebug from 3.7.0 to 3.8.0
2021-01-04 18:02:17 +01:00
dependabot[bot]
b84820ad93 Bump simplecov from 0.17.1 to 0.18.5
Bumps [simplecov](https://github.com/simplecov-ruby/simplecov) from 0.17.1 to 0.18.5.
- [Release notes](https://github.com/simplecov-ruby/simplecov/releases)
- [Changelog](https://github.com/simplecov-ruby/simplecov/blob/main/CHANGELOG.md)
- [Commits](https://github.com/simplecov-ruby/simplecov/compare/v0.17.1...v0.18.5)

Signed-off-by: dependabot[bot] <support@github.com>
2021-01-03 10:38:35 +00:00
Andy Brett
8452f174a1 Merge pull request #6575 from PauloVilarinho/remove-choose-currency-from-admin-general-settings
remove choose currency from admin general settings
2021-01-02 21:25:47 -08:00
dependabot[bot]
cf485266fe Bump pry-byebug from 3.7.0 to 3.8.0
Bumps [pry-byebug](https://github.com/deivid-rodriguez/pry-byebug) from 3.7.0 to 3.8.0.
- [Release notes](https://github.com/deivid-rodriguez/pry-byebug/releases)
- [Changelog](https://github.com/deivid-rodriguez/pry-byebug/blob/master/CHANGELOG.md)
- [Commits](https://github.com/deivid-rodriguez/pry-byebug/compare/v3.7.0...v3.8.0)

Signed-off-by: dependabot[bot] <support@github.com>
2021-01-02 23:12:57 +00:00
Andy Brett
180a49b501 Merge pull request #6590 from openfoodfoundation/dependabot/bundler/byebug-11.1.3
Bump byebug from 11.0.1 to 11.1.3
2021-01-02 15:11:38 -08:00
Andy Brett
115d3d0bfe Merge pull request #6587 from andrewpbrett/comment-out-oc-spec
Comment out flaky spec for complex order cycle updating
2021-01-02 15:03:20 -08:00
Paulo Vilarinho
4839b7bd63 remove choose currency from admin general settings 2021-01-02 15:00:15 -08:00
Andy Brett
3d8c7cc9f0 Merge pull request #6522 from arku/feat/stripe-credit-card-removal
Extract Stripe credit card deletion logic to a service object
2021-01-02 14:56:00 -08:00
Andy Brett
1e9b2b34f7 Merge pull request #6545 from PauloVilarinho/add-internationalization-to-included_price_validation
adds translation key to the included in price validation
2021-01-02 14:55:16 -08:00
Andy Brett
042b4faf1e comment out flaky spec 2021-01-02 14:53:55 -08:00
Andy Brett
97f1c586e1 Merge pull request #6595 from arku/chore/jsonp-format-handler-removal
Remove jsonp request handling logic
2021-01-02 14:51:30 -08:00
Arun Kumar Mohan
322e1496a9 Remove jsonp request handling logic 2021-01-02 02:17:30 -05:00
Andy Brett
51ee21e294 Merge pull request #6556 from Matt-Yorkley/adjustments-eligible
[Adjustments] Delete dead code #eligible_for_originator?
2021-01-01 20:48:27 -08:00
Andy Brett
9ddf3c4e5d Merge pull request #6562 from romale/patch-11
Added translation key "en.spree.actions.cancel"
2021-01-01 20:48:04 -08:00
Andy Brett
fabde59671 Merge pull request #6564 from romale/patch-12
Added translation keys "en.description" "en.display" "en.tags"
2021-01-01 20:47:14 -08:00
Andy Brett
d0888415e2 Merge pull request #6594 from Matt-Yorkley/credit-card-spec-expired
Ensure credit card is not out of date in credit card spec
2021-01-01 17:29:31 -08:00
Matt-Yorkley
f6d0d43622 Ensure credit card is not out of date in credit card spec
This just blew up on New Years Eve 🙈
2021-01-01 11:54:14 +00:00
dependabot[bot]
c9f2c63e1e Bump byebug from 11.0.1 to 11.1.3
Bumps [byebug](https://github.com/deivid-rodriguez/byebug) from 11.0.1 to 11.1.3.
- [Release notes](https://github.com/deivid-rodriguez/byebug/releases)
- [Changelog](https://github.com/deivid-rodriguez/byebug/blob/master/CHANGELOG.md)
- [Commits](https://github.com/deivid-rodriguez/byebug/compare/v11.0.1...v11.1.3)

Signed-off-by: dependabot[bot] <support@github.com>
2021-01-01 06:08:33 +00:00
Andy Brett
e71908fbdd Merge pull request #6566 from openfoodfoundation/dependabot/bundler/rspec-rails-4.0.2
Bump rspec-rails from 4.0.1 to 4.0.2
2020-12-31 13:10:21 -08:00
Andy Brett
17782a5577 Merge pull request #6570 from romale/patch-13
Added translation key "en.description"
2020-12-31 13:08:42 -08:00
Andy Brett
549bba0c4f Merge pull request #6583 from PauloVilarinho/remove-xml-format
remove xml format
2020-12-31 13:08:05 -08:00
Matt-Yorkley
74228242c0 Merge pull request #6576 from andrewpbrett/flaky-tag-spec
Comment out flaky tag rules spec
2020-12-31 16:59:46 +01:00
Matt-Yorkley
e88972b989 Merge pull request #6441 from luisramos0/ruby24
Bump to ruby 2.4.4
2020-12-31 15:31:45 +01:00
Paulo Vilarinho
106c42fe84 remove xml format 2020-12-30 16:06:50 -03:00
Andy Brett
fc4634cd67 comment out flaky spec 2020-12-29 19:22:09 -08:00
dependabot[bot]
3199842ecc Bump test-unit from 3.3.7 to 3.3.9
Bumps [test-unit](https://github.com/test-unit/test-unit) from 3.3.7 to 3.3.9.
- [Release notes](https://github.com/test-unit/test-unit/releases)
- [Commits](https://github.com/test-unit/test-unit/compare/3.3.7...3.3.9)

Signed-off-by: dependabot[bot] <support@github.com>
2020-12-29 05:52:23 +00:00
romale
aa44615dd0 Missing translation key "en.description" 2020-12-28 19:04:03 +03:00
dependabot[bot]
cb8d2e95d8 Bump rspec-rails from 4.0.1 to 4.0.2
Bumps [rspec-rails](https://github.com/rspec/rspec-rails) from 4.0.1 to 4.0.2.
- [Release notes](https://github.com/rspec/rspec-rails/releases)
- [Changelog](https://github.com/rspec/rspec-rails/blob/main/Changelog.md)
- [Commits](https://github.com/rspec/rspec-rails/compare/v4.0.1...v4.0.2)

Signed-off-by: dependabot[bot] <support@github.com>
2020-12-28 06:41:44 +00:00
romale
00e61f0a99 Missing translation keys "en.description" "en.display" "en.tags" 2020-12-26 23:22:19 +03:00
Transifex-Openfoodnetwork
b9c41b4379 Updating translations for config/locales/ru.yml 2020-12-26 01:31:07 +11:00
romale
28f03947df Added translation key "en.spree.actions.cancel" 2020-12-25 14:39:11 +03:00
dependabot[bot]
4e3f4cb52e Bump unicorn from 5.7.0 to 5.8.0
Bumps [unicorn](https://yhbt.net/unicorn/) from 5.7.0 to 5.8.0.

Signed-off-by: dependabot[bot] <support@github.com>
2020-12-25 05:43:50 +00:00
Matt-Yorkley
70f7d76723 Delete dead code #eligible_for_originator?
This check is used only by Spree::Promotion objects, which are not used in OFN. There are no objects which can be originators of an adjustment that respond to #eligible? in this way, so the method always returns true.
2020-12-23 08:29:12 +00:00
Andy Brett
ec4d171993 Merge pull request #6542 from openfoodfoundation/dependabot/bundler/paranoia-2.4.3
Bump paranoia from 2.4.2 to 2.4.3
2020-12-22 20:27:10 -08:00
Andy Brett
49a2dd6211 Update product set spec to allow changing the unit_value
These specs were introduced in cbac916e66 so we'll want to verify that we want to change them
2020-12-22 19:46:47 -08:00
Andy Brett
fade1696e2 update variant spec based on new validation behavior 2020-12-22 19:46:47 -08:00
Andy Brett
79aaa38173 update outdated spec
This spec was added as part of cbac916e66 - now that we're updating the unit_value to be 1, we expect this not to fail
2020-12-22 19:46:40 -08:00
Andy Brett
17faa7334e Merge pull request #6538 from openfoodfoundation/dependabot/bundler/redcarpet-3.5.1
Bump redcarpet from 3.5.0 to 3.5.1
2020-12-22 19:32:59 -08:00
Andy Brett
fdf997847d Merge pull request #6553 from openfoodfoundation/dependabot/bundler/webmock-3.11.0
Bump webmock from 3.10.0 to 3.11.0
2020-12-22 19:27:29 -08:00
Andy Brett
b4e47217ef Merge pull request #6523 from arku/fix/credit-card-clone-destroyer
Handle nil stripe customer in credit card clone removal logic
2020-12-21 14:27:16 -08:00
Transifex-Openfoodnetwork
d2ba4c8111 Updating translations for config/locales/pt_BR.yml 2020-12-22 01:31:45 +11:00
Transifex-Openfoodnetwork
100d7275a6 Updating translations for config/locales/pt_BR.yml 2020-12-22 01:28:39 +11:00
Transifex-Openfoodnetwork
5a16fd7075 Updating translations for config/locales/tr.yml 2020-12-21 23:34:02 +11:00
Transifex-Openfoodnetwork
c3661cece9 Updating translations for config/locales/tr.yml 2020-12-21 23:33:59 +11:00
dependabot[bot]
554a55ecc9 Bump webmock from 3.10.0 to 3.11.0
Bumps [webmock](https://github.com/bblimke/webmock) from 3.10.0 to 3.11.0.
- [Release notes](https://github.com/bblimke/webmock/releases)
- [Changelog](https://github.com/bblimke/webmock/blob/master/CHANGELOG.md)
- [Commits](https://github.com/bblimke/webmock/compare/v3.10.0...v3.11.0)

Signed-off-by: dependabot[bot] <support@github.com>
2020-12-21 06:27:09 +00:00
Transifex-Openfoodnetwork
89f1d11e62 Updating translations for config/locales/en_US.yml 2020-12-19 05:14:00 +11:00
Pau Pérez Fabregat
9a199ae02c Merge pull request #6540 from PauloVilarinho/add-internationalization-to-payment-method-clean-name
Add internationalization to payment method clean name
2020-12-18 18:06:19 +01:00
Pau Perez
91e5276140 Enable request queuing tracking in Datadog
Request queuing is critical to understand whether our app servers are
able to cope with all the traffic or requests pile up in Nginx queues.
I find the article
https://www.speedshop.co/2015/07/29/scaling-ruby-apps-to-1000-rpm.html
incredibly enlightening on this topic. Thanks @nateberkopec ❤️.

This requires
https://github.com/openfoodfoundation/ofn-install/pull/689.
2020-12-18 17:33:11 +01:00
Transifex-Openfoodnetwork
1d08e30b45 Updating translations for config/locales/ru.yml 2020-12-18 20:16:57 +11:00
Andy Brett
ebe71429db Merge pull request #6541 from mkllnk/fix-subscription-script
Fix typo in subs test script
2020-12-17 17:10:05 -08:00
Andy Brett
2d636c8272 Merge pull request #6546 from andrewpbrett/sca-backend
Fix #6543
2020-12-17 14:00:36 -08:00
Andy Brett
13d6d2c978 separate conditionals 🤦 2020-12-17 13:23:14 -08:00
Paulo Vilarinho
747b747e2d adds translation key to the included in price validation 2020-12-17 18:04:55 -03:00
Matt-Yorkley
1269e5f2e9 Merge pull request #6533 from andrewpbrett/sca-backend
Patch #6469: use `purchase` to charge offline for Stripe Connect
2020-12-17 17:17:14 +01:00
Paulo Vilarinho
85663d15d1 Fix dynamic constant assignment issues 2020-12-17 10:14:54 -03:00
Paulo Vilarinho
92649ca97c Refactor payment method clean name method 2020-12-17 10:06:41 -03:00
Transifex-Openfoodnetwork
128a2ada5c Updating translations for config/locales/nb.yml 2020-12-17 20:47:05 +11:00
Transifex-Openfoodnetwork
0615c6ff3d Updating translations for config/locales/nb.yml 2020-12-17 20:43:59 +11:00
Transifex-Openfoodnetwork
10eea3b9e0 Updating translations for config/locales/en_NZ.yml 2020-12-17 20:39:39 +11:00
dependabot[bot]
3d7a069b6b Bump paranoia from 2.4.2 to 2.4.3
Bumps [paranoia](https://github.com/rubysherpas/paranoia) from 2.4.2 to 2.4.3.
- [Release notes](https://github.com/rubysherpas/paranoia/releases)
- [Changelog](https://github.com/rubysherpas/paranoia/blob/core/CHANGELOG.md)
- [Commits](https://github.com/rubysherpas/paranoia/compare/v2.4.2...2.4.3)

Signed-off-by: dependabot[bot] <support@github.com>
2020-12-17 05:42:57 +00:00
Maikel Linke
f0db7a22cc Fix typo in subs test script 2020-12-17 16:08:59 +11:00
Paulo Vilarinho
6225c83abb Add internationalization of payment method clean name
The clean name payment method now uses the internationalization string
2020-12-17 00:35:57 -03:00
Paulo Vilarinho
50955d735c Add tests for internationalization of payment method clean name
The clean name payment method tests now uses the internationalization string
2020-12-17 00:34:21 -03:00
Andy Brett
7fc9cc9f31 test that purchase is called by SCA and Connect providers 2020-12-16 11:09:15 -08:00
Pau Perez
6f8967f002 Enable new customer balance for the core team
This enables the use of the new customer balance implementation to
whatever users we specify in the BETA_TESTERS env var through
ofn-install.

This var is meant to contain the user emails that will log in such as
personal accounts (I have an account with admin access to my hub) or
superadmin accounts used by the core team. This way can gather early
feedback ourselves while not releasing the new logic to users.
2020-12-16 11:09:54 +01:00
dependabot[bot]
e2df5ebe5b Bump redcarpet from 3.5.0 to 3.5.1
Bumps [redcarpet](https://github.com/vmg/redcarpet) from 3.5.0 to 3.5.1.
- [Release notes](https://github.com/vmg/redcarpet/releases)
- [Changelog](https://github.com/vmg/redcarpet/blob/master/CHANGELOG.md)
- [Commits](https://github.com/vmg/redcarpet/compare/v3.5.0...v3.5.1)

Signed-off-by: dependabot[bot] <support@github.com>
2020-12-16 05:47:50 +00:00
Andy Brett
934f4f278e add spec to subscription confirm job 2020-12-15 12:24:38 -08:00
Andy Brett
484576d1ac add unit test for stripe connect 2020-12-15 10:30:05 -08:00
Andy Brett
cb29d05069 use purchase to charge offline for Stripe Connect 2020-12-14 11:54:03 -08:00
Pau Pérez Fabregat
c79baead84 Merge pull request #6524 from ankis17/DatePickerTranslation
Fixed Translation for DatePicker
2020-12-14 16:41:51 +01:00
Pau Pérez Fabregat
f26507b897 Merge pull request #6454 from arku/fix/signup-route
Remove /signup routes
2020-12-14 16:38:23 +01:00
Pau Pérez Fabregat
d4fc3f2118 Merge pull request #6516 from coopdevs/per-user-feature-toggles
Refactor FeatureToggle to toggle depending on user
2020-12-14 16:03:05 +01:00
Pau Pérez Fabregat
fa812364ff Merge pull request #6453 from andrewpbrett/fix-void-payment-error
fix #5829 (Voiding an initial payment (i.e. a full refund) after partially refunding the order is not possible with Stripe-SCA)
2020-12-14 09:48:41 +01:00
Pau Pérez Fabregat
9f517e1931 Merge pull request #6455 from arku/fix/tabs
Fix tab toggle
2020-12-14 09:34:05 +01:00
Luis Ramos
997b9b9a2e Merge pull request #6526 from openfoodfoundation/dependabot/bundler/combine_pdf-1.0.21
Bump combine_pdf from 1.0.16 to 1.0.21
2020-12-13 22:40:55 +00:00
Transifex-Openfoodnetwork
21efb4f3c6 Updating translations for config/locales/en_GB.yml 2020-12-14 07:19:09 +11:00
Arun Kumar Mohan
020df3619f Add tests for Stripe::CreditCardRemover 2020-12-12 21:39:21 -05:00
Arun Kumar Mohan
f02f2c540c Handle nil stripe customer in credit card clone removal logic 2020-12-12 21:31:06 -05:00
dependabot[bot]
6f763e1216 Bump combine_pdf from 1.0.16 to 1.0.21
Bumps [combine_pdf](https://github.com/boazsegev/combine_pdf) from 1.0.16 to 1.0.21.
- [Release notes](https://github.com/boazsegev/combine_pdf/releases)
- [Changelog](https://github.com/boazsegev/combine_pdf/blob/master/CHANGELOG.md)
- [Commits](https://github.com/boazsegev/combine_pdf/compare/v1.0.16...v1.0.21)

Signed-off-by: dependabot[bot] <support@github.com>
2020-12-12 21:17:26 +00:00
Andy Brett
92aeab2ec3 Merge pull request #6490 from openfoodfoundation/dependabot/bundler/capybara-3.15.1
Bump capybara from 2.18.0 to 3.15.1
2020-12-12 13:16:04 -08:00
Luis Ramos
b76261c61c Adapt preferable to work with new BigDecimal version
BigDecimal raises exception if called with nil or empty values
2020-12-12 18:50:57 +00:00
Andy Brett
94d10a45a7 Merge pull request #6486 from openfoodfoundation/dependabot/bundler/factory_bot_rails-5.2.0
Bump factory_bot_rails from 4.10.0 to 5.2.0
2020-12-12 08:58:53 -08:00
Transifex-Openfoodnetwork
18f642546d Updating translations for config/locales/it.yml 2020-12-12 20:58:50 +11:00
Transifex-Openfoodnetwork
2afcdf9261 Updating translations for config/locales/it.yml 2020-12-12 20:55:35 +11:00
Ankita Satyavarapu
377febd8d7 Fixed Translation for DatePicker 2020-12-11 22:52:22 -05:00
Arun Kumar Mohan
1edebade78 Extract Stripe credit card deletion logic to a service object 2020-12-11 19:52:59 -05:00
Luis Ramos
1ea775cffb Keep factory bot v4 behaviour
In v5 the default value is true, that means that all parent objects (for example the order od a line item) will be built using the same strategy as the object (build or create), in v4 and now with this config, the parent is always created

We can revert this and use the default value but that will require some adaptions, quite a lot of specs are broken with that behaviour activated
2020-12-12 00:23:24 +00:00
Luis Ramos
367622cea8 Capybara v3 is not cleaning up the html into text so the permissions that are inside html li elements are not matched with the matcher have_table_row when there are multiple permissions. So, in this case, we need to do the work ourselves: looking up the correct row and then asserting the permissions are the ones required 2020-12-12 00:07:33 +00:00
Luis Ramos
ada25fa2b2 Improve stripe spec
I am not sure why this was passing without these stubbed requests for
the second order, but now they were correctly failing. This commit fixes
the spec.
2020-12-11 23:15:08 +00:00
Luis Ramos
480dfdf961 Handle redirect case
For some reason the process is now working correctly, the authorization step succeeds and a redirect link is stored in the payment with state pending. The payment state is correctly left at pending. Here we add a check for the redirect path sent by stripe and fail the authorization if there is one (it means the payment would need an extra auth step only available in the frontoffice now and probably through email to customer at some point in the future). For some reason the flash with the authorization failure message is not showing up for the user
2020-12-11 23:14:23 +00:00
Andy Brett
a745fceb53 Merge pull request #6469 from andrewpbrett/sca-backend
Allow SCA cards to be setup and charged offline for subscriptions
2020-12-11 14:23:12 -08:00
Pau Perez
182f0f66b6 Refactor FeatureToggle to toggle depending on user
This enables showing features to individual users only, which enables us
to deploy features that are not yet released to gather feedback from
product and testing, while no users have access to it.
2020-12-11 09:13:07 +01:00
Luis Ramos
62715a8060 Adapt matcher to capybara v3 2020-12-11 00:21:46 +00:00
Luis Ramos
26165cc08d Adapt matcher to capybara v3 2020-12-11 00:20:58 +00:00
Luis Ramos
f19946af8d Remove unnecessary test step that is breaking in capybara v3 2020-12-11 00:16:31 +00:00
Luis Ramos
c92e8de51f Adapt matchers to capybara v3 2020-12-11 00:13:46 +00:00
Luis Ramos
ed4a7bd361 Adapt matchers to capybara v3 2020-12-11 00:09:34 +00:00
Luis Ramos
6d37a15488 Adapt matchers to capybara v3 2020-12-11 00:02:22 +00:00
Luis Ramos
79c538fad9 Fix syntax for nil property 2020-12-10 23:44:24 +00:00
Luis Ramos
b287d67f6b Adapt matchers to capybara v3 2020-12-10 23:36:40 +00:00
Luis Ramos
5ae955c27f Adapt matchers to capybara v3 2020-12-10 23:35:34 +00:00
Luis Ramos
fd5adab0d5 Adapt matchers to capybara v3 2020-12-10 23:27:56 +00:00
Luis Ramos
773f733c8e Adapt matchers to capybara v3 2020-12-10 23:05:15 +00:00
Luis Ramos
80e59a920e Adpat matcher to capybara v3 2020-12-10 23:01:01 +00:00
Luis Ramos
b58fddf098 Adapt matcher to capybara v3 2020-12-10 22:59:37 +00:00
Luis Ramos
bcf7cc1013 Replace ignore with transient according to changes in factory bot v5 2020-12-10 22:16:17 +00:00
Andy Brett
3b7313f7e3 add spec for deleting the default card 2020-12-10 12:31:58 -08:00
Andy Brett
3daccb6420 update specs with new method signature 2020-12-10 12:17:55 -08:00
Andy Brett
655512adab add missing require statements 2020-12-10 12:17:42 -08:00
Andy Brett
f50577b489 refactor cloner to use ivars 2020-12-10 11:42:28 -08:00
Andy Brett
a1f6fe5522 remove unused method now that we use autopaging 2020-12-10 11:22:14 -08:00
Andy Brett
8c747e4812 refactor destroy_clones to separate class 2020-12-10 11:22:02 -08:00
Andy Brett
4c25edd91c refactor find_cloned_card to separate class 2020-12-10 11:04:27 -08:00
Andy Brett
0ac248f03a refactor offline payment methods 2020-12-10 10:26:38 -08:00
Andy Brett
13b95f41bb use built-in auto_paging_each with stripe 2020-12-10 08:19:41 -08:00
Andy Brett
50e87a023b rename method to validate! since it can raise an error 2020-12-10 07:45:07 -08:00
Pau Pérez Fabregat
b4b4d38d3b Merge pull request #6509 from mkllnk/image-tweaks
Image code tweaks
2020-12-10 12:50:18 +01:00
Pau Pérez Fabregat
3bf58b5b7c Merge pull request #6503 from openfoodfoundation/dependabot/bundler/delayed_job_active_record-4.1.5
Bump delayed_job_active_record from 4.1.4 to 4.1.5
2020-12-10 12:33:41 +01:00
Maikel Linke
3f6288d5c7 Load rake task under test for all its specs
If you ran only the second spec without the first, the rake file wasn't
loaded and the test failed.
2020-12-10 15:35:05 +11:00
Maikel Linke
6bf041aa74 Reduce complexity 2020-12-10 15:33:34 +11:00
Maikel Linke
e6c411684f Don't fail on missing images when resizing
The changed code obtains the image dimensions when you first upload an
image. Unfortunately it's also triggered when thumbnails are refreshed.
That doesn't change the size of the original image though.
2020-12-10 15:32:43 +11:00
Luis Ramos
465d2d2f1c Remove unused dependency 2020-12-09 18:35:44 -08:00
Maikel Linke
edf9dd7921 Update translations from Transifex 2020-12-10 13:34:05 +11:00
Maikel
5ca10d5cd1 Merge pull request #6465 from openfoodfoundation/transifex
Transifex
2020-12-10 13:29:12 +11:00
Maikel
33d220e777 Merge pull request #6291 from luisramos0/subs_tasks
Add tasks to help manually test subscriptions
2020-12-10 12:55:59 +11:00
Luis Ramos
9728b088f9 Fix syntax for nil properties 2020-12-09 23:38:16 +00:00
dependabot[bot]
c033fe70e7 Bump delayed_job_active_record from 4.1.4 to 4.1.5
Bumps [delayed_job_active_record](https://github.com/collectiveidea/delayed_job_active_record) from 4.1.4 to 4.1.5.
- [Release notes](https://github.com/collectiveidea/delayed_job_active_record/releases)
- [Commits](https://github.com/collectiveidea/delayed_job_active_record/compare/v4.1.4...v4.1.5)

Signed-off-by: dependabot[bot] <support@github.com>
2020-12-09 23:28:46 +00:00
Luis Ramos
c17998774e Adapt factories to factory_bot_rails v5 syntax 2020-12-09 23:09:33 +00:00
Andy Brett
de786982dd bump karma coffee preprocessor 2020-12-09 12:31:36 -08:00
dependabot[bot]
9b6702946c Bump moment from 2.28.0 to 2.29.1
Bumps [moment](https://github.com/moment/moment) from 2.28.0 to 2.29.1.
- [Release notes](https://github.com/moment/moment/releases)
- [Changelog](https://github.com/moment/moment/blob/develop/CHANGELOG.md)
- [Commits](https://github.com/moment/moment/compare/2.28.0...2.29.1)

Signed-off-by: dependabot[bot] <support@github.com>
2020-12-09 11:40:06 -08:00
Transifex-Openfoodnetwork
7c6621a49b Updating translations for config/locales/en_FR.yml 2020-12-10 00:36:39 +11:00
Transifex-Openfoodnetwork
134c63f353 Updating translations for config/locales/en_FR.yml 2020-12-10 00:33:37 +11:00
Transifex-Openfoodnetwork
1d64230d4b Updating translations for config/locales/fr.yml 2020-12-10 00:31:44 +11:00
Transifex-Openfoodnetwork
8f796de35b Updating translations for config/locales/ar.yml 2020-12-10 00:03:43 +11:00
Transifex-Openfoodnetwork
b4a43e0554 Updating translations for config/locales/ar.yml 2020-12-10 00:00:34 +11:00
dependabot[bot]
f2c37ef64d Bump karma-chrome-launcher from 2.2.0 to 3.1.0
Bumps [karma-chrome-launcher](https://github.com/karma-runner/karma-chrome-launcher) from 2.2.0 to 3.1.0.
- [Release notes](https://github.com/karma-runner/karma-chrome-launcher/releases)
- [Changelog](https://github.com/karma-runner/karma-chrome-launcher/blob/master/CHANGELOG.md)
- [Commits](https://github.com/karma-runner/karma-chrome-launcher/compare/v2.2.0...v3.1.0)

Signed-off-by: dependabot[bot] <support@github.com>
2020-12-08 17:58:00 -08:00
dependabot[bot]
f45d348dd7 Bump ddtrace from 0.42.0 to 0.43.0
Bumps [ddtrace](https://github.com/DataDog/dd-trace-rb) from 0.42.0 to 0.43.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.42.0...v0.43.0)

Signed-off-by: dependabot[bot] <support@github.com>
2020-12-08 17:56:37 -08:00
dependabot-preview[bot]
351d694c13 Bump haml from 5.2.0 to 5.2.1
Bumps [haml](https://github.com/haml/haml) from 5.2.0 to 5.2.1.
- [Release notes](https://github.com/haml/haml/releases)
- [Changelog](https://github.com/haml/haml/blob/main/CHANGELOG.md)
- [Commits](https://github.com/haml/haml/compare/v5.2.0...5.2.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-12-08 17:53:03 -08:00
Andy Brett
22ef9a0fef fix long line 2020-12-08 14:37:16 -08:00
Andy Brett
7a03882314 re-refactor cart_service 2020-12-08 14:37:16 -08:00
Andy Brett
b713bd7aa7 spec updates 2020-12-08 14:37:16 -08:00
Andy Brett
c70ea44091 show specific error message when add-to-cart fails 2020-12-08 14:37:16 -08:00
Luis Ramos
7a27741cf5 Remove unnecessary capybara version control in Gemfile 2020-12-08 22:15:54 +00:00
dependabot[bot]
2a3176f7f5 Bump capybara from 2.18.0 to 3.15.1
Bumps [capybara](https://github.com/teamcapybara/capybara) from 2.18.0 to 3.15.1.
- [Release notes](https://github.com/teamcapybara/capybara/releases)
- [Changelog](https://github.com/teamcapybara/capybara/blob/master/History.md)
- [Commits](https://github.com/teamcapybara/capybara/compare/2.18.0...3.15.1)

Signed-off-by: dependabot[bot] <support@github.com>
2020-12-08 21:24:15 +00:00
dependabot[bot]
5c65f9bf55 Bump factory_bot_rails from 4.10.0 to 5.2.0
Bumps [factory_bot_rails](https://github.com/thoughtbot/factory_bot_rails) from 4.10.0 to 5.2.0.
- [Release notes](https://github.com/thoughtbot/factory_bot_rails/releases)
- [Changelog](https://github.com/thoughtbot/factory_bot_rails/blob/master/NEWS.md)
- [Commits](https://github.com/thoughtbot/factory_bot_rails/compare/v4.10.0...v5.2.0)

Signed-off-by: dependabot[bot] <support@github.com>
2020-12-08 20:24:41 +00:00
Luis Ramos
0824f12472 Merge pull request #6472 from luisramos0/depen
Fix dependabot config
2020-12-08 20:02:26 +00:00
Luis Ramos
ab6f6c463a Fix problem in dependabot config, yarn is not a valid package-ecosystem, we can try npm 2020-12-08 20:00:19 +00:00
Luis Ramos
e2181960bc Merge pull request #6450 from openfoodfoundation/dependabot/bundler/knapsack-1.20.0
Bump knapsack from 1.19.0 to 1.20.0
2020-12-08 19:39:13 +00:00
Luis Ramos
e8ba16cb3e Merge pull request #6457 from openfoodfoundation/dependabot/bundler/spring-2.0.2
Bump spring from 1.7.2 to 2.0.2
2020-12-08 19:38:55 +00:00
Luis Ramos
c233052ec6 Merge pull request #6438 from luisramos0/devise4
Upgrade to devise 4.7
2020-12-08 17:19:13 +00:00
Andy Brett
d55343da1a only return gateway payment info if set on customer 2020-12-08 07:52:42 -08:00
Andy Brett
eddf8da107 update subscription spec with new method name 2020-12-08 07:52:42 -08:00
Andy Brett
3a8203094a refactor to remove boolean flag param 2020-12-08 07:52:42 -08:00
Andy Brett
f1d439870e use a named argument for offline param 2020-12-08 07:52:42 -08:00
Andy Brett
103366ea97 add request limits to credit card cloner 2020-12-08 07:52:42 -08:00
Andy Brett
9c544ef2f4 remove cloned cards after removing the platform card 2020-12-08 07:52:42 -08:00
Andy Brett
bc3fd8c50c remove unused method 2020-12-08 07:52:42 -08:00
Andy Brett
277d7f44b7 refactor api customers controller; resolve merge conflict 2020-12-08 07:52:42 -08:00
Andy Brett
a466886a32 fix rubocop warnings 2020-12-08 07:52:42 -08:00
Andy Brett
3d47ad7e33 add stubs for stripe requests 2020-12-08 07:52:42 -08:00
Andy Brett
fea7576ac1 update CreditCardCloner to find existing clone 2020-12-08 07:52:42 -08:00
Andy Brett
13ab25ac45 separate method for charging offline 2020-12-08 07:52:41 -08:00
Andy Brett
cad8a018f9 put SetupIntent on the connected Stripe account 2020-12-08 07:52:41 -08:00
Andy Brett
215d1bbe20 create js setup intent when authing shop 2020-12-08 07:52:41 -08:00
Andy Brett
b517d2f0c7 guard against a stripe customer already being deleted 2020-12-08 07:52:41 -08:00
Andy Brett
cc00f24569 add spec for clearing authorizations to credit_card_controller_spec 2020-12-08 07:46:10 -08:00
Andy Brett
d0098e190f close #4175 2020-12-08 07:46:10 -08:00
Andy Brett
1f8b4e05bb allow charges in subscriptions spec 2020-12-08 07:46:10 -08:00
Andy Brett
f875e406a8 update karma specs for setting default card 2020-12-08 07:46:10 -08:00
Andy Brett
3b44c8e7e2 update UI after changing default card 2020-12-08 07:46:10 -08:00
Andy Brett
6fdcd6218d add remove_shop_authorizations method to controller 2020-12-08 07:46:10 -08:00
Andy Brett
c60dcc75cd confirm changes to default card 2020-12-08 07:46:10 -08:00
Andy Brett
4cdc1993b8 add more specific copy on cc authorization 2020-12-08 07:46:10 -08:00
Andy Brett
747345ece9 only show authorized shops if there is a default card 2020-12-08 07:46:10 -08:00
Maikel Linke
84730577da Fail with better message when giving wrong OC id
The script was failing with:

  NoMethodError: undefined method `update!' for nil:NilClass

Now it's failing with:

  ActiveRecord::RecordNotFound: Couldn't find OrderCycle with id=1
2020-12-08 11:48:34 +11:00
Maikel Linke
906dbffb29 Fail loudly when task doesn't work 2020-12-08 11:43:21 +11:00
Maikel Linke
aa8df639c4 Style to avoid indent changes with context changes
When the indent of arguments is aligned with the method brackets, it
needs to be changed when the method changes. Putting all arguments on
their own line makes diffs of method changes or argument changes
clearer. See the next commit.
2020-12-08 11:38:50 +11:00
Maikel Linke
70d1888cc2 Ease reading of times 2020-12-08 11:36:15 +11:00
Maikel Linke
feb0ad452d Safeguard production env from test script 2020-12-08 11:33:37 +11:00
Andy Brett
e866e983f6 add spec for partially refunded SCA orders 2020-12-07 14:51:47 -08:00
Transifex-Openfoodnetwork
33916cfff3 Updating translations for config/locales/nb.yml 2020-12-08 08:21:50 +11:00
Transifex-Openfoodnetwork
9333a6385e Updating translations for config/locales/nb.yml 2020-12-08 08:00:43 +11:00
Transifex-Openfoodnetwork
c37bd8e911 Updating translations for config/locales/nb.yml 2020-12-08 07:40:37 +11:00
Andy Brett
96462325d2 fix #5829 2020-12-04 18:13:43 -08:00
dependabot-preview[bot]
567e489716 Bump spring from 1.7.2 to 2.0.2
Bumps [spring](https://github.com/rails/spring) from 1.7.2 to 2.0.2.
- [Release notes](https://github.com/rails/spring/releases)
- [Changelog](https://github.com/rails/spring/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rails/spring/compare/v1.7.2...v2.0.2)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-12-04 19:14:16 +00:00
Arun Kumar Mohan
868a19df6e Fix tab toggle 2020-12-03 21:03:44 -05:00
Arun Kumar Mohan
81b03906f9 Remove /signup routes 2020-12-03 20:43:28 -05:00
Luis Ramos
acddb496b7 Remove spree_i18n dependency 2020-12-03 15:34:46 -08:00
dependabot-preview[bot]
d29773d297 [Security] Bump jquery-rails from 3.1.5 to 4.4.0
Bumps [jquery-rails](https://github.com/rails/jquery-rails) from 3.1.5 to 4.4.0. **This update includes a security fix.**
- [Release notes](https://github.com/rails/jquery-rails/releases)
- [Changelog](https://github.com/rails/jquery-rails/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rails/jquery-rails/compare/v3.1.5...v4.4.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-12-03 15:33:41 -08:00
Luis Ramos
0f27f57cbb Use new Admin::ResourceController 2020-12-03 15:32:20 -08:00
Luis Ramos
1d327a61a6 Fix rubocop issue and adapt rubocop exceptions 2020-12-03 15:32:20 -08:00
Luis Ramos
0fb9f44dda Make all controllers use new Admin::ResourceController 2020-12-03 15:32:20 -08:00
Luis Ramos
c63d99dd20 Remove Spree namespace from controller 2020-12-03 15:32:20 -08:00
Luis Ramos
99fd99cd33 Move spree admin resource controller to admin resource controller 2020-12-03 15:32:20 -08:00
Luis Ramos
1d075bbc90 Remove empty resource controller 2020-12-03 15:32:20 -08:00
Luis Ramos
6e08fccbbe Merge resource_controller url helpers with parent version 2020-12-03 15:32:20 -08:00
Luis Ramos
fc4cf6a9a7 Merge resource_controller model_class method with parent version 2020-12-03 15:32:20 -08:00
dependabot-preview[bot]
abc58f5bb4 Bump acts_as_list from 0.3.0 to 0.9.19
Bumps [acts_as_list](https://github.com/brendon/acts_as_list) from 0.3.0 to 0.9.19.
- [Release notes](https://github.com/brendon/acts_as_list/releases)
- [Changelog](https://github.com/brendon/acts_as_list/blob/master/CHANGELOG.md)
- [Commits](https://github.com/brendon/acts_as_list/compare/0.3.0...v0.9.19)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-12-03 15:30:24 -08:00
Matt-Yorkley
0ceba7c0a8 Update orders closing message 2020-12-03 15:29:14 -08:00
Luis Ramos
f71de8123a Dont show 'closing in' message when oc closes in more than 3 months 2020-12-03 15:29:14 -08:00
Luis Ramos
a51d01efac Merge pull request #6452 from luisramos0/dep
Move dependabot file to correct location
2020-12-03 21:35:49 +00:00
Luis Ramos
7a35fabb22 Move dependendabot config file to .github 2020-12-03 21:32:57 +00:00
dependabot-preview[bot]
67ee8c3500 Bump knapsack from 1.19.0 to 1.20.0
Bumps [knapsack](https://github.com/ArturT/knapsack) from 1.19.0 to 1.20.0.
- [Release notes](https://github.com/ArturT/knapsack/releases)
- [Changelog](https://github.com/ArturT/knapsack/blob/master/CHANGELOG.md)
- [Commits](https://github.com/ArturT/knapsack/compare/v1.19.0...v1.20.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-12-03 19:14:05 +00:00
Luis Ramos
5b00868c6f Allow mutable strings in some specs 2020-12-03 06:38:24 -08:00
Luis Ramos
bfd4adbcee Adapt code to work with frozen strings 2020-12-03 06:38:24 -08:00
Luis Ramos
611de912a8 Switch frozen_string_literal to false so that price code keeps working 2020-12-03 06:38:24 -08:00
Luis Ramos
2b8f0abe49 Try some mass auto-correct adding frozen-string-literal to all specs 2020-12-03 06:38:24 -08:00
Luis Ramos
de19efca64 Fix rubocop issue and add missing exceptions to manual_todo to get a green rubocop run 2020-12-03 06:38:24 -08:00
Luis Ramos
6c9e12b4ea Update rubocop exceptions file after bye bye spree 2020-12-03 06:38:24 -08:00
Andy Brett
dfabc5fa06 Update all locales with the latest Transifex translations 2020-12-02 21:41:18 -08:00
Luis Ramos
7a5a4f956a Replace use of Faker with FFaker 2020-12-02 11:40:50 -08:00
Luis Ramos
720edb4b05 Relax ffaker version requirement so that upgrades come as possible 2020-12-02 11:40:50 -08:00
dependabot-preview[bot]
3ec1af104f Bump ffaker from 1.32.1 to 2.11.0
Bumps [ffaker](https://github.com/ffaker/ffaker) from 1.32.1 to 2.11.0.
- [Release notes](https://github.com/ffaker/ffaker/releases)
- [Changelog](https://github.com/ffaker/ffaker/blob/master/Changelog.md)
- [Commits](https://github.com/ffaker/ffaker/commits)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-12-02 11:40:50 -08:00
dependabot-preview[bot]
80d034706c Bump test-unit from 3.3.6 to 3.3.7
Bumps [test-unit](https://github.com/test-unit/test-unit) from 3.3.6 to 3.3.7.
- [Release notes](https://github.com/test-unit/test-unit/releases)
- [Commits](https://github.com/test-unit/test-unit/compare/3.3.6...3.3.7)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-12-02 11:40:04 -08:00
Andy Brett
902f8caea9 direct specifically to shop tab 2020-12-02 11:39:02 -08:00
Andy Brett
14091cd106 fix #6415 2020-12-02 11:39:02 -08:00
Andy Brett
936f5c1a0c remove extraneous page call 2020-12-02 11:38:10 -08:00
Andy Brett
8963a787d6 only validate unit_value presence if "items" is not chosen 2020-12-02 11:38:10 -08:00
Andy Brett
59cab902f0 add numericality validation 2020-12-02 11:38:10 -08:00
Andy Brett
4d2c93930b resolve merge conflict 2020-12-02 11:38:10 -08:00
Tsara Sudrajat
fb769d37f9 Fix error when setting stock for new product 2020-12-02 11:38:10 -08:00
Andy Brett
65f6f1febf rearrange css 2020-12-02 11:37:25 -08:00
Andy Brett
99b5d9e0c5 use white-space: nowrap on variant prices 2020-12-02 11:37:25 -08:00
Andy Brett
c4cd574242 fix currency spec 2020-12-02 11:37:25 -08:00
Andy Brett
a3a6205343 fix #6252 2020-12-02 11:37:25 -08:00
Maikel
25c363feba Merge pull request #6356 from openfoodfoundation/dependabot/bundler/stringex-2.8.5
Bump stringex from 1.5.1 to 2.8.5
2020-12-02 16:39:00 +11:00
Luis Ramos
839278fc75 Add dependendabot config to increase limit to 10 PRs 2020-12-01 12:40:24 -08:00
Luis Ramos
3162cf9abf Add gem to make tests work with devise callbacks
This is noted in the devise 4.1 release notes: https://github.com/heartcombo/devise/blob/master/CHANGELOG.md#410
2020-12-01 17:19:07 +00:00
Luis Ramos
9abdcd88e5 Move confirmable config together with other devise configs in user model 2020-12-01 17:06:39 +00:00
Luis Ramos
ca1a4db299 Bump to ruby 2.4.4 2020-12-01 15:16:39 +00:00
Luis Ramos
bd6b1dbfed Upgrade to devise 4.7 2020-12-01 11:59:41 +00:00
Matt-Yorkley
1cab9e473b Merge pull request #6378 from openfoodfoundation/dependabot/bundler/webmock-3.10.0
Bump webmock from 3.9.5 to 3.10.0
2020-12-01 11:58:01 +01:00
dependabot-preview[bot]
93a73b4823 Bump stringex from 1.5.1 to 2.8.5
Bumps [stringex](https://github.com/rsl/stringex) from 1.5.1 to 2.8.5.
- [Release notes](https://github.com/rsl/stringex/releases)
- [Commits](https://github.com/rsl/stringex/compare/v1.5.1...v2.8.5)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-12-01 09:58:08 +00:00
Matt-Yorkley
7408c45980 Merge pull request #6297 from openfoodfoundation/rails-4-1
[Rails 4.1] Merge Rails 4.1 branch into master
2020-12-01 10:56:08 +01:00
Matt-Yorkley
fe4b20dd7b Merge pull request #6354 from openfoodfoundation/rails-4-2-rebased
Rails 4.2 upgrade
2020-12-01 10:55:25 +01:00
Pau Pérez Fabregat
3c71b7f6be Merge pull request #6428 from coopdevs/upgrade-brakeman-dependencies
Upgrade Ruby and Ubuntu to latest in GH action
2020-11-30 21:13:25 +01:00
Transifex-Openfoodnetwork
ea148d7f51 Updating translations for config/locales/en_US.yml 2020-12-01 00:15:59 +11:00
Transifex-Openfoodnetwork
a5761707d5 Updating translations for config/locales/en_US.yml 2020-12-01 00:12:50 +11:00
Pau Perez
259e139c47 Update all locales with the latest Transifex translations 2020-11-30 09:21:13 +01:00
Pau Perez
8c1e222788 Upgrade Ruby and Ubuntu to latest in GH action
It was asked for in
https://github.com/openfoodfoundation/openfoodnetwork/pull/6163/ to use
the latest stable Ruby version. It's also better to use Ubuntu's latest
as well.
2020-11-30 09:11:41 +01:00
Pau Pérez Fabregat
4ca930bdad Merge pull request #6163 from openfoodfoundation/luisramos0-patch-2
Add brakeman config
2020-11-30 09:08:32 +01:00
Pau Pérez Fabregat
f0a052b65b Merge pull request #6357 from Matt-Yorkley/secret-key-base
Update secret key base
2020-11-27 17:32:14 +01:00
Pau Pérez Fabregat
07a72eccd4 Merge pull request #6391 from Matt-Yorkley/paypal-stock-clashes
Paypal stock clashes
2020-11-27 17:08:15 +01:00
Matt-Yorkley
b04a76e8bf Update payments_report totals 2020-11-27 14:00:29 +00:00
Matt-Yorkley
1ceb6ac916 Update orders_and_fulfilment report totals 2020-11-27 14:00:29 +00:00
Andy Brett
049f66c2aa address #6411 2020-11-27 14:00:29 +00:00
Matt-Yorkley
9c41c296e4 Remove default comments from ApplicationResponder 2020-11-27 14:00:29 +00:00
Matt-Yorkley
d299c8cf01 Update test setup in Packer spec.
This is the correct way to set a variant's weight.
2020-11-27 14:00:29 +00:00
Matt-Yorkley
2b2f1ac0cd Improve specificity of expectation in reset password email test 2020-11-27 14:00:29 +00:00
Matt-Yorkley
d2998f1190 Remove spaces in payments report 2020-11-27 14:00:29 +00:00
Matt-Yorkley
c6c20dc0f6 Add ActionController::ConditionalGet to Api::BaseController
This was added in Spree around the time of Rails 4.2 and seems to fix some of the response errors around the `responders` gem.
2020-11-27 14:00:29 +00:00
Matt-Yorkley
60aaf8100a Fix some Rubocop offences 2020-11-27 14:00:29 +00:00
Matt-Yorkley
98f42a1f81 Fix output of Package#inspect 2020-11-27 14:00:29 +00:00
Matt-Yorkley
f589d278cf Add failing spec for Package#inspect 2020-11-27 14:00:29 +00:00
Matt-Yorkley
2b884be8dd Update specs to work with ActionMailer::DeliveryJob 2020-11-27 14:00:29 +00:00
Matt-Yorkley
64153c5072 Remove #handle_asyncronously and update to recommended asyncronous devise mail method 2020-11-27 14:00:29 +00:00
Matt-Yorkley
9de3370a8a Fix precision in adjustment form display
The tests here were looking for values with a format like "10.00" but the output had changed to "10.0"
2020-11-27 14:00:29 +00:00
Matt-Yorkley
63fb46f440 Delete some dead code
There are some really weird issues in the spec here, and this module is not in use anywhere.
2020-11-27 14:00:29 +00:00
Matt-Yorkley
aa718824d8 Fix touch spec
The behavior in #change blocks ironically seems to have changed
2020-11-27 14:00:29 +00:00
Matt-Yorkley
4394d2fe43 Fix tag_rules ForbiddenAttributes errors
Example error:
Tag Rules creating allows creation of rules of each type
     Failure/Error: expect(tag_rule.preferred_shipping_method_tags).to eq "volunteers-only"

       expected: "volunteers-only"
            got: ""

       (compared using ==)
     # ./spec/features/admin/tag_rules_spec.rb:81:in `block (3 levels) in <top (required)>'
2020-11-27 14:00:29 +00:00
Matt-Yorkley
ea5c7c5990 Fix broken redirect after bulk product update
Error:
As an Administrator
  I want to be able to manage products in bulk
 updating when a filter has been applied
     Failure/Error: expect(page.find("#status-message")).to have_content "Changes saved."
       expected to find text "Changes saved." in "Saving.."
     # ./spec/features/admin/bulk_product_update_spec.rb:451:in `block (2 levels) in <top (required)>'
2020-11-27 14:00:29 +00:00
Matt-Yorkley
2905267142 Fix broken variant weight assignment in spec
OrderManagement::Stock::Packer builds a package with all the items
     Failure/Error: expect(package.weight).to be_positive
       expected `0.0 (#<BigDecimal:7f156c99fda8,'0.0',9(18)>).positive?` to be truthy, got false
     # ./engines/order_management/spec/services/order_management/stock/packer_spec.rb:19:in `block (2 levels) in <module:Stock>'
2020-11-27 14:00:29 +00:00
Matt-Yorkley
71c6cee94c Fix "modifying frozen string" error in Package#inspect 2020-11-27 14:00:29 +00:00
Matt-Yorkley
7ef0056225 Fix invoice rendering issue
Setting `locals: { :@order => order }` no longer works; `@order` is not set as expected in the partial. Fixes various errors eg:

Failure/Error: = "#{@order.number}"

     ActionView::Template::Error:
       undefined method `number' for nil:NilClass
     # ./app/views/spree/admin/orders/invoice.html.haml:14:in `_app_views_spree_admin_orders_invoice_html_haml__1740595365701113578_70025078036080'
     # ./app/services/invoice_renderer.rb:3:in `render_to_string'
     # ./app/controllers/spree/admin/orders_controller.rb:89:in `invoice'
2020-11-27 14:00:29 +00:00
Matt-Yorkley
b512d3ce21 Fix column preferences spec
Failure/Error: expect(preferences.map(&:column_name)).to eq [:col1, :col2, :col3]

        expected: [:col1, :col2, :col3]
             got: ["col1", "col2", "col3"]

        (compared using ==)

        Diff:
        @@ -1 +1 @@
        -[:col1, :col2, :col3]
        +["col1", "col2", "col3"]

      # ./spec/models/column_preference_spec.rb:56:in `block (4 levels) in <top (required)>'
2020-11-27 14:00:29 +00:00
Matt-Yorkley
98c99de835 Use ActiveJob::Testhelper where needed 2020-11-27 14:00:29 +00:00
Matt-Yorkley
1aa2b7274b Fix test mailer delivery 2020-11-27 14:00:29 +00:00
Matt-Yorkley
ae33df946e Fix StateMachine specs 2020-11-27 14:00:29 +00:00
Matt-Yorkley
54ad90e071 Replace deprecated ActiveRecord::ConnectionAdapters::Column#value_to_boolean
This method has been removed in Rails 4.2
2020-11-27 14:00:29 +00:00
Matt-Yorkley
e1c1574931 Refactor BulkInvoiceService to use ActiveJob
Removes use of #handle_asynchronously, which we need to do elsewhere. Fixes:
BulkInvoiceService#start_pdf_job starts a background process to create a pdf with multiple invoices
      Failure/Error:
        expect do
          service.start_pdf_job [1, 2]
        end.to enqueue_job Delayed::PerformableMethod

        expected to enqueue exactly 1 jobs, but enqueued 0
      # ./spec/services/bulk_invoice_service_spec.rb:8:in `block (3 levels) in <top (required)>'
2020-11-27 14:00:29 +00:00
Matt-Yorkley
8f8973b6f9 Call #deliver in user_mailer_spec so mail is sent 2020-11-27 14:00:29 +00:00
Matt-Yorkley
3c74541145 Fix misbehaving params in Api::ProductsController
In some cases the given params were being deleted here.
2020-11-27 14:00:29 +00:00
Matt-Yorkley
1ab62fddcb Patch Paranoia#delete to resolve ActiveRecord::ConnectionAdapters::NullTransaction errors
Patches Paranoia gem to fix a conflict with transactions in Rspec: https://github.com/rubysherpas/paranoia/issues/274

Example error:
```
Failure/Error: order.line_items.first.variant.tap(&:delete)
NoMethodError:
       undefined method `state' for #<ActiveRecord::ConnectionAdapters::NullTransaction:0x0000564117dddd18>
```
2020-11-27 14:00:29 +00:00
Matt-Yorkley
1e8d400534 Add Paranoia#delete (original) 2020-11-27 14:00:29 +00:00
Matt-Yorkley
1a4e292178 Fix json "empty body" expectations 2020-11-27 14:00:29 +00:00
Matt-Yorkley
49081e171e Fix PG::UndefinedTable errors
The logic of #includes has changed slightly in Rails 4.2 and now usually needs the #references method as well.

PG::UndefinedTable:
     #   ERROR:  missing FROM-clause entry for table "enterprises"
     #   LINE 1: SELECT "spree_users".* FROM "spree_users" WHERE (enterprises...
     #                                                            ^
     #   ./spec/models/spree/user_spec.rb:125:in `block (4 levels) in <top (required)>'
2020-11-27 14:00:29 +00:00
Matt-Yorkley
a5472d6b64 Convert ConfirmSignupJob to ActiveJob 2020-11-27 14:00:29 +00:00
Matt-Yorkley
62b80043ba Fix mailer specs
These methods are not actually called now until the email is being delivered.
2020-11-27 14:00:29 +00:00
Matt-Yorkley
eb040de422 Fix expectation in base_helper_spec
The attribute on this element are now rendered in alphabetical order
2020-11-27 14:00:29 +00:00
Matt-Yorkley
b36b0eddee Fix Rubocop issues 2020-11-27 14:00:29 +00:00
Matt-Yorkley
aaf7a90f8b Convert OrderCycleNotificationJob to ActiveJob 2020-11-27 14:00:29 +00:00
Matt-Yorkley
9e334a4c1e Convert ConfirmOrderJob to ActiveJob 2020-11-27 14:00:29 +00:00
Matt-Yorkley
56f2d38714 Use "raise_in_transactional_callbacks"
https://guides.rubyonrails.org/upgrading_ruby_on_rails.html#error-handling-in-transaction-callbacks
2020-11-27 14:00:29 +00:00
Matt-Yorkley
6b3da4ac89 Fix "PG::ProtocolViolation: ERROR: bind message supplies 0 parameters" errors 2020-11-27 14:00:28 +00:00
Matt-Yorkley
31415d00e6 TEMP - Fix deprecated cache store naming 2020-11-27 14:00:28 +00:00
Matt-Yorkley
e155b00ab9 Fix undefined constant Spree::Responder 2020-11-27 14:00:28 +00:00
Matt-Yorkley
3c0172c507 Fix Spree::Preferences cache issue
In some cases this method was trying to delete a Rails.cache entry with `nil` as the key, leading to lots of errors.
2020-11-27 14:00:28 +00:00
Matt-Yorkley
3cba9a16aa Use ActionController::Base for Api::BaseController
It looks like ActionController::Metal does not play nicely with the big changes to controller responders: https://guides.rubyonrails.org/upgrading_ruby_on_rails.html#responders
2020-11-27 14:00:28 +00:00
Matt-Yorkley
58350ed338 Set ActiveJob configs and convert WelcomeEnterpriseJob to new format
This needs to be done for all jobs.

Docs: https://guides.rubyonrails.org/v4.2/active_job_basics.html
2020-11-27 14:00:28 +00:00
Matt-Yorkley
54a4952dc5 Fix ForbiddenAttributesError on tag rules 2020-11-27 14:00:28 +00:00
Matt-Yorkley
34bfd877cc Fix #bulk_update in EnterprisesController 2020-11-27 14:00:28 +00:00
Matt-Yorkley
16cc0afe8f Replace removed method #retrieve_collector_from_mimes
https://apidock.com/rails/v4.1.8/ActionController/MimeResponds/retrieve_collector_from_mimes
2020-11-27 14:00:28 +00:00
Matt-Yorkley
ccaff08928 Re-add ForbiddenAttributesError debugging helper 2020-11-27 14:00:28 +00:00
Matt-Yorkley
91908a0e4c Switch from state_machine to state_machines gem
The old version is completely unmaintained and does not work with Rails 4.2
2020-11-27 14:00:28 +00:00
Matt-Yorkley
6b45208cf1 Define Capybara server
The server type now has to be set explicitly for Capybara
2020-11-27 14:00:28 +00:00
Matt-Yorkley
fb333c37e7 Fix Api controller setup for responders gem 2020-11-27 14:00:28 +00:00
Matt-Yorkley
3090cfa909 Add setup for responders gem 2020-11-27 14:00:28 +00:00
Matt-Yorkley
9205c85d4d Run rake db:migrate 2020-11-27 14:00:28 +00:00
Matt-Yorkley
ff9f6c3317 Remove foreigner gem
https://guides.rubyonrails.org/upgrading_ruby_on_rails.html#foreign-key-support
2020-11-27 14:00:28 +00:00
Matt-Yorkley
25dd47e511 Add responders gem
https://guides.rubyonrails.org/upgrading_ruby_on_rails.html#responders
2020-11-27 14:00:28 +00:00
Matt-Yorkley
ece3e7aa69 Update gems to Rails 4.2 2020-11-27 14:00:28 +00:00
Luis Ramos
ff8d935699 Fix problem in enterprises controller 2020-11-27 13:59:46 +00:00
Luis Ramos
1d32ecab98 Fix spec by adding necessary references statement 2020-11-27 13:59:46 +00:00
Luis Ramos
ff17ced101 Fix enterprises spec by adding needed references statement 2020-11-27 13:59:46 +00:00
Luis Ramos
fa6cf0f281 Fix prod importer spec in rails 4.1 2020-11-27 13:59:46 +00:00
Luis Ramos
7e39d78733 Fix Long Method rubocop issue 2020-11-27 13:59:46 +00:00
Luis Ramos
0152b4da55 Fix rubocop issues 2020-11-27 13:59:46 +00:00
Luis Ramos
2a03e42f2a Update deep_munge patch to rails 4.1 where the code is now in ActionDispatch::Request::Utils 2020-11-27 13:59:46 +00:00
Matt-Yorkley
01a726d9bd Fix stubbing of stock totals
Recent changes to the way count_on_hand is summed in Spree::Stock::Quantifier mean the old method here will not work. Error:
```
  2) Spree::Variant#in_stock? when stock_items are not backorderable when stock_items out of stock return false if stock_items out of stock
     Failure/Error: expect(variant.in_stock?).to be_falsy

       expected: falsey value
            got: true
     # ./spec/models/spree/variant_spec.rb:241:in `block (5 levels) in <module:Spree>'
  ```
2020-11-27 13:59:46 +00:00
Matt-Yorkley
93fe8dbc5f Replace #scoped, which is now deprecated and removed in Rails 4.1 2020-11-27 13:59:46 +00:00
Matt-Yorkley
5c5a6361bf Fix nasty json encoding issue
The enterprise id returned by these json endpoints was being returned in *unicode* format, so where Angular was expecting a simple integer it was instead getting strings like: "\u0017"
2020-11-27 13:59:46 +00:00
Matt-Yorkley
0f2cbe8a52 Fix API exception response handling
For some reason when using `render text:` instead of `render json:` for this response, the status code being returned was 200 instead of the clearly explicitly defined 422 (:unprocessable_entity). I absolutely have no idea why!
2020-11-27 13:59:46 +00:00
Matt-Yorkley
f1002b953d Disable Javascript CSRF protection on EnterprisesController#check_permalink route
This route checks if an enterprise permalink is taken or not. Allowing the route to be accessed via Javascript without strict CSRF protection is reasonable. Fixes the following errors:

ActionController::InvalidCrossOriginRequest: Security warning: an embedded <script> tag on another site requested protected JavaScript. If you know what you're doing, go ahead and disable forgery protection on this action to permit cross-origin JavaScript embedding.
2020-11-27 13:59:46 +00:00
Luis Ramos
3ebc8145df Avoid calling update with nil values 2020-11-27 13:59:46 +00:00
Luis Ramos
edc1773676 Fix some calls to sum in reports code 2020-11-27 13:59:46 +00:00
Luis Ramos
6814eb663f Fix respond_with error 2020-11-27 13:59:46 +00:00
Luis Ramos
78cfcd905f Adapt more & and no & when using sum 2020-11-27 13:59:46 +00:00
Luis Ramos
9bbef16804 Converting all calls to ActiveRelation#sum to use a symbol with &
This is only applicable to database columns, if we are summing using a method in the model than the & is required!
2020-11-27 13:59:46 +00:00
Luis Ramos
974240fd4b Fix two sum calls in checkout helper 2020-11-27 13:59:46 +00:00
Luis Ramos
7472b7cc27 Fix sum call in quantifier 2020-11-27 13:59:46 +00:00
Eduardo
a8a933d73a change from render json to render plain due to template missing issue 2020-11-27 13:59:46 +00:00
Luis Ramos
bcd07e1791 Upgrade to rails 4.1 2020-11-27 13:59:46 +00:00
Luis Ramos
ecb29ec830 Add state machine patch to fix error with state machine
See here for details: https://github.com/pluginaweek/state_machine/issues/251#issuecomment-32133267
2020-11-27 13:59:46 +00:00
Luis Ramos
202aa3e5b7 Use reflections instead of, now gone, reflections 2020-11-27 13:59:46 +00:00
Luis Ramos
a05f43000a ActionView was extracted from ActionPack in rails 4.1 so we need to use ActionView 2020-11-27 13:59:46 +00:00
Luis Ramos
61708e5deb AbstractController::ViewPaths was moved to ActionView::ViewPaths in rails 4.1 2020-11-27 13:59:46 +00:00
Matt-Yorkley
27586d072d Merge pull request #6423 from openfoodfoundation/revert-6277-controllers
Revert "Move Spree::Admin::BaseController to Admin::BaseController"
2020-11-27 14:29:15 +01:00
Matt-Yorkley
3bfa903912 Revert "Move Spree::Admin::BaseController to Admin::BaseController" 2020-11-27 14:11:57 +01:00
Matt-Yorkley
0ba670b180 Ensure order is cleanly reset to cart state when redirecting to cart 2020-11-27 11:42:46 +00:00
Matt-Yorkley
c4cfc1dc05 Improve order test in paypal controller spec 2020-11-27 11:42:06 +00:00
Pau Pérez Fabregat
17957ed6c0 Merge pull request #6408 from openfoodfoundation/transifex
Transifex
2020-11-27 10:31:56 +01:00
Pau Pérez Fabregat
8b6a08457a Merge pull request #6293 from luisramos0/subs_debug
Add task to print Subscriptions debug info
2020-11-27 10:17:57 +01:00
Maikel
9e2a3d6973 Merge pull request #6277 from luisramos0/controllers
Move Spree::Admin::BaseController to Admin::BaseController
2020-11-27 16:13:55 +11:00
Icker
55b21310e4 Added introductory information for testing. 2020-11-25 09:44:02 -08:00
Transifex-Openfoodnetwork
1266a37ac5 Updating translations for config/locales/en_NZ.yml 2020-11-25 05:39:17 +11:00
Transifex-Openfoodnetwork
54feb2f57d Updating translations for config/locales/en_AU.yml 2020-11-24 07:31:32 +11:00
Transifex-Openfoodnetwork
e9eb90507e Updating translations for config/locales/ca.yml 2020-11-24 07:22:28 +11:00
Transifex-Openfoodnetwork
ee44159c83 Updating translations for config/locales/es.yml 2020-11-24 07:19:47 +11:00
Transifex-Openfoodnetwork
8861f5c6aa Updating translations for config/locales/ca.yml 2020-11-24 07:19:18 +11:00
Matt-Yorkley
b089404891 Merge pull request #6362 from coopdevs/remove-unused-truncate-html-gem
Remove unused truncate_html gem
2020-11-23 00:49:34 +01:00
Matt-Yorkley
2fa2a30c67 Add spec coverage, refactor, avoid double-render errors
👍
2020-11-22 18:37:31 +00:00
Matt-Yorkley
cabec7e73f Fix Rubocop warnings and tidy up 2020-11-22 18:02:54 +00:00
Matt-Yorkley
87df44764f Extract stock-check logic to controller concern and inject prior to final Paypal payment confirmation. 2020-11-22 18:02:52 +00:00
Andy Brett
8f25568530 Merge pull request #6390 from jhsu802701/qtest
SIMPLE: added scripts for running test suite in quiet mode
2020-11-20 12:15:04 -08:00
Andy Brett
b1b422b90e fix/silence rubocop styles 2020-11-20 10:41:31 -08:00
Andy Brett
cd94b23277 fix rubocop styles 2020-11-20 10:35:02 -08:00
Andy Brett
4e155641fc fix nil error if no proxy orders found 2020-11-20 10:32:48 -08:00
Andy Brett
85d99f3bf2 Merge branch 'master' into controllers 2020-11-20 08:12:03 -08:00
Andy Brett
c6b3a615f1 Merge pull request #6385 from jhsu802701/update_db_schema
SIMPLE: updated db/schema.rb with 'bundle exec rake db:migrate'
2020-11-20 08:03:27 -08:00
Matt-Yorkley
242c1a2715 Add new Paypal feature spec 2020-11-19 01:44:53 +00:00
Matt-Yorkley
21d67a0723 Extract some more paypal-specific test code to new helper 2020-11-19 01:44:38 +00:00
Jason Hsu
59b3bfa161 Added scripts for running test suite in quiet mode and updated docker/README.md 2020-11-18 16:25:03 -06:00
Matt-Yorkley
41a5787830 Extract paypal response stubbing to helper 2020-11-18 15:39:01 +00:00
Matt-Yorkley
010c1c799d Add some notes on paypal checkout flow 2020-11-18 14:55:29 +00:00
Matt-Yorkley
2faea65f82 Bring in Spree::PaypalController#confirm method
Original method from the gem. This handles the post-payment response from paypal.
2020-11-18 14:51:23 +00:00
Matt-Yorkley
dd8f139c1b Memoize Spree::PaypalController#payment_method
This gets called 4 or 5 times in a single request just to read basic attributes from the object. The query doesn't need to be repeated each time
2020-11-18 13:45:14 +00:00
Matt-Yorkley
6d0d4b5096 Bring in Spree::PaypalController#payment_method
Original method from the gem. Modified in preceding commit.
2020-11-18 13:45:13 +00:00
Jason Hsu
b85f8d4b45 Updated db/schema.rb with 'bundle exec rake db:migrate' 2020-11-16 18:23:00 -06:00
dependabot-preview[bot]
66799bad46 Bump webmock from 3.9.5 to 3.10.0
Bumps [webmock](https://github.com/bblimke/webmock) from 3.9.5 to 3.10.0.
- [Release notes](https://github.com/bblimke/webmock/releases)
- [Changelog](https://github.com/bblimke/webmock/blob/master/CHANGELOG.md)
- [Commits](https://github.com/bblimke/webmock/compare/v3.9.5...v3.10.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-11-13 19:16:37 +00:00
Matt-Yorkley
3d4f0ebb7b Ensure variants don't end up with invalid data when a product's variant_unit is changed
Fixes an issue where a product's variant_unit value is changed from "weight" to "items" and some of the product's variants can be left in an invalid state, which in turn breaks cloning of order cycles (with fatal errors).
2020-11-11 20:24:21 +00:00
Pau Perez
f9869d4360 Remove unused truncate_html gem
It seems that we don't use this gem in OFN. It was used in Spree in
https://github.com/openfoodfoundation/spree/blob/2-1-0-stable/core/app/helpers/spree/orders_helper.rb
to truncate the product description. We don't because we show it in
the product modal, and there's no trace of that helper method in our
codebase nor I see the gem used at all.
2020-11-11 13:18:23 +01:00
Matt-Yorkley
1cad631bdb Replace secret_token and update comments
`secret_token` is apparently still called directly in other places...
2020-11-11 01:30:52 +00:00
Luis Ramos
5d93180081 Move subs tasks into subs:test namespace 2020-11-10 22:03:36 +00:00
Luis Ramos
fdfc0b330f Remove some duplicated code 2020-11-10 22:03:36 +00:00
Luis Ramos
63d62d7ce4 Improve subs task by making it handle open and close times of the Order Cycle being tested 2020-11-10 22:03:36 +00:00
Luis Ramos
51451292bd Add task to closse OC and confirm orders 2020-11-10 22:03:36 +00:00
Luis Ramos
2bb22fb7f4 Add task to reset Orders inside a specific Order Cycle by repeating the
placement job
2020-11-10 22:03:36 +00:00
Luis Ramos
5289a5b381 Add namespace to all sample data factories
These factories are not used in testing and this way we avoid collisions on the root namespace as it was happening already with OrderFactory
2020-11-10 22:03:36 +00:00
Matt-Yorkley
03d49c7987 Update secret key base
`secret_token` is no longer used in Rails 4+
2020-11-10 20:46:15 +00:00
Luis Ramos
c07215552e Add log entries to log 2020-11-02 20:59:57 +00:00
Luis Ramos
2b01c80c54 Add subs debug task that prints out basic info about a specific Order Cycle 2020-11-02 20:59:57 +00:00
Luis Ramos
fa77204e14 Adapt spec to the move of the controller, in prod the call to request.env['PATH_INFO'] will work correctly 2020-10-31 10:44:19 +00:00
Luis Ramos
af713385d8 Add frozen string literal 2020-10-31 10:16:37 +00:00
Luis Ramos
c9972189d0 Change usage of Spree::Admin::BaseController to Admin::BaseController 2020-10-31 09:56:59 +00:00
Luis Ramos
eb07a91acb Adapt code from Spree::Admin::BaseController to Admin::BaseController 2020-10-31 09:52:34 +00:00
Luis Ramos
66ba9ff73d Move Spree::Admin::BaseController to Admin::BaseController 2020-10-31 09:51:37 +00:00
Luis Ramos
dbd41e9d31 Use ruby 2.4 as github actions do not support ruby 2.3. 2020-10-13 10:31:26 +01:00
Luis Ramos
87327dcf57 Add brakeman config 2020-10-13 10:31:13 +01:00
707 changed files with 7674 additions and 3877 deletions

13
.github/dependabot.yml vendored Normal file
View File

@@ -0,0 +1,13 @@
version: 2
updates:
- package-ecosystem: "bundler"
directory: "/"
schedule:
interval: "daily"
open-pull-requests-limit: 10
- package-ecosystem: "npm"
directory: "/"
schedule:
interval: "daily"

44
.github/workflows/brakeman-analysis.yml vendored Normal file
View File

@@ -0,0 +1,44 @@
# This workflow integrates Brakeman with GitHub's Code Scanning feature
# Brakeman is a static analysis security vulnerability scanner for Ruby on Rails applications
name: Brakeman Scan
# This section configures the trigger for the workflow. Feel free to customize depending on your convention
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
jobs:
brakeman-scan:
name: Brakeman Scan
runs-on: ubuntu-latest
steps:
# Checkout the repository to the GitHub Actions runner
- name: Checkout
uses: actions/checkout@v2
# Customize the ruby version depending on your needs
- name: Setup Ruby
uses: actions/setup-ruby@v1
with:
ruby-version: '2.7'
- name: Setup Brakeman
env:
BRAKEMAN_VERSION: '4.10' # SARIF support is provided in Brakeman version 4.10+
run: |
gem install brakeman --version $BRAKEMAN_VERSION
# Execute Brakeman CLI and generate a SARIF output with the security issues identified during the analysis
- name: Scan
continue-on-error: true
run: |
brakeman -f sarif -o output.sarif.json .
# Upload the SARIF file generated in the previous step
- name: Upload SARIF
uses: github/codeql-action/upload-sarif@v1
with:
sarif_file: output.sarif.json

70
.haml-lint.yml Normal file
View File

@@ -0,0 +1,70 @@
# Whether to ignore frontmatter at the beginning of HAML documents for
# frameworks such as Jekyll/Middleman
skip_frontmatter: false
linters:
AltText:
enabled: false
ClassAttributeWithStaticValue:
enabled: true
ClassesBeforeIds:
enabled: true
ConsecutiveComments:
enabled: true
ConsecutiveSilentScripts:
enabled: true
max_consecutive: 2
EmptyScript:
enabled: true
HtmlAttributes:
enabled: true
ImplicitDiv:
enabled: true
LeadingCommentSpace:
enabled: true
LineLength:
enabled: true
max: 80
MultilinePipe:
enabled: true
MultilineScript:
enabled: true
ObjectReferenceAttributes:
enabled: true
RuboCop:
enabled: false
RubyComments:
enabled: true
SpaceBeforeScript:
enabled: true
SpaceInsideHashAttributes:
enabled: true
style: no_space
TagName:
enabled: true
TrailingWhitespace:
enabled: true
UnnecessaryInterpolation:
enabled: true
UnnecessaryStringOutput:
enabled: true

View File

@@ -2,3 +2,5 @@ rubocop:
config_file: .rubocop_styleguide.yml
scss:
config_file: .scss-lint.yml
haml:
config_file: .haml-lint.yml

View File

@@ -66,8 +66,9 @@ Layout/LineLength:
- app/models/spree/image.rb
- app/models/spree/order.rb
- app/models/spree/payment_method.rb
- app/models/spree/product_decorator.rb
- app/models/spree/product.rb
- app/models/spree/user.rb
- app/models/spree/variant.rb
- app/models/subscription.rb
- app/models/variant_override.rb
- app/models/variant_override_set.rb
@@ -101,6 +102,7 @@ Layout/LineLength:
- lib/open_food_network/scope_variants_for_search.rb
- lib/open_food_network/xero_invoices_report.rb
- lib/spree/localized_number.rb
- lib/stripe/credit_card_clone_finder.rb
- lib/tasks/data.rake
- lib/tasks/enterprises.rake
- spec/controllers/admin/bulk_line_items_controller_spec.rb
@@ -336,6 +338,7 @@ Metrics/AbcSize:
- app/controllers/admin/enterprises_controller.rb
- app/controllers/admin/order_cycles_controller.rb
- app/controllers/admin/product_import_controller.rb
- app/controllers/admin/resource_controller.rb
- app/controllers/admin/stripe_accounts_controller.rb
- app/controllers/admin/subscription_line_items_controller.rb
- app/controllers/admin/subscriptions_controller.rb
@@ -356,13 +359,13 @@ Metrics/AbcSize:
- app/controllers/spree/admin/payments_controller.rb
- app/controllers/spree/admin/products_controller.rb
- app/controllers/spree/admin/reports_controller.rb
- app/controllers/spree/admin/resource_controller.rb
- app/controllers/spree/admin/search_controller.rb
- app/controllers/spree/admin/taxons_controller.rb
- app/controllers/spree/admin/users_controller.rb
- app/controllers/spree/admin/variants_controller.rb
- app/controllers/spree/credit_cards_controller.rb
- app/controllers/spree/orders_controller.rb
- app/controllers/spree/paypal_controller_decorator.rb
- app/controllers/spree/user_passwords_controller.rb
- app/controllers/spree/user_registrations_controller.rb
- app/controllers/spree/users_controller.rb
@@ -399,11 +402,12 @@ Metrics/AbcSize:
- app/models/spree/preference.rb
- app/models/spree/preferences/preferable_class_methods.rb
- app/models/spree/preferences/preferable.rb
- app/models/spree/product_decorator.rb
- app/models/spree/product.rb
- app/models/spree/return_authorization.rb
- app/models/spree/shipment.rb
- app/models/spree/taxon.rb
- app/models/spree/tax_rate.rb
- app/models/spree/variant.rb
- app/models/spree/zone.rb
- app/serializers/api/product_serializer.rb
- app/serializers/api/variant_serializer.rb
@@ -430,6 +434,7 @@ Metrics/AbcSize:
- lib/open_food_network/order_cycle_form_applicator.rb
- lib/open_food_network/order_cycle_management_report.rb
- lib/open_food_network/order_cycle_permissions.rb
- lib/open_food_network/orders_and_fulfillments_report/supplier_totals_report.rb
- lib/open_food_network/packing_report.rb
- lib/open_food_network/payments_report.rb
- lib/open_food_network/permissions.rb
@@ -530,7 +535,7 @@ Metrics/CyclomaticComplexity:
- app/models/spree/preference.rb
- app/models/spree/preferences/preferable.rb
- app/models/spree/preferences/preferable_class_methods.rb
- app/models/spree/product_decorator.rb
- app/models/spree/product.rb
- app/models/spree/return_authorization.rb
- app/models/spree/zone.rb
- app/models/variant_override_set.rb
@@ -550,39 +555,6 @@ Metrics/CyclomaticComplexity:
Metrics/PerceivedComplexity:
Max: 7
Exclude:
- app/controllers/admin/enterprise_fees_controller.rb
- app/controllers/admin/enterprises_controller.rb
- app/controllers/spree/admin/taxons_controller.rb
- app/controllers/spree/orders_controller.rb
- app/helpers/checkout_helper.rb
- app/helpers/order_cycles_helper.rb
- app/helpers/spree/admin/base_helper.rb
- app/helpers/spree/admin/navigation_helper.rb
- app/models/enterprise.rb
- app/models/enterprise_relationship.rb
- app/models/spree/ability.rb
- app/models/spree/address.rb
- app/models/spree/order/checkout.rb
- app/models/spree/payment_method.rb
- app/models/spree/payment.rb
- app/models/spree/preferences/preferable.rb
- app/models/spree/preferences/preferable_class_methods.rb
- app/models/spree/product_decorator.rb
- app/models/spree/return_authorization.rb
- app/models/spree/zone.rb
- app/models/variant_override_set.rb
- app/services/cart_service.rb
- engines/order_management/app/services/order_management/reports/bulk_coop/bulk_coop_report.rb
- engines/order_management/app/services/order_management/stock/estimator.rb
- lib/active_merchant/billing/gateways/stripe_payment_intents.rb
- lib/discourse/single_sign_on.rb
- lib/open_food_network/enterprise_issue_validator.rb
- 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
- app/controllers/admin/enterprises_controller.rb
- app/controllers/api/variants_controller.rb
- app/controllers/spree/admin/taxons_controller.rb
@@ -595,7 +567,10 @@ Metrics/PerceivedComplexity:
- app/models/spree/address.rb
- app/models/spree/order/checkout.rb
- app/models/spree/order.rb
- app/models/spree/product_decorator.rb
- app/models/spree/preferences/preferable_class_methods.rb
- app/models/spree/preferences/preferable.rb
- app/models/spree/product.rb
- app/models/spree/return_authorization.rb
- app/models/spree/zone.rb
- engines/order_management/app/services/order_management/reports/bulk_coop/bulk_coop_report.rb
- engines/order_management/app/services/order_management/stock/estimator.rb
@@ -618,6 +593,7 @@ Metrics/MethodLength:
- app/controllers/admin/enterprises_controller.rb
- app/controllers/admin/manager_invitations_controller.rb
- app/controllers/admin/order_cycles_controller.rb
- app/controllers/admin/resource_controller.rb
- app/controllers/admin/stripe_accounts_controller.rb
- app/controllers/admin/subscriptions_controller.rb
- app/controllers/api/products_controller.rb
@@ -632,13 +608,13 @@ Metrics/MethodLength:
- app/controllers/spree/admin/payments_controller.rb
- app/controllers/spree/admin/products_controller.rb
- app/controllers/spree/admin/reports_controller.rb
- app/controllers/spree/admin/resource_controller.rb
- app/controllers/spree/admin/tax_categories_controller.rb
- app/controllers/spree/admin/taxons_controller.rb
- app/controllers/spree/admin/users_controller.rb
- app/controllers/spree/admin/variants_controller.rb
- app/controllers/spree/credit_cards_controller.rb
- app/controllers/spree/orders_controller.rb
- app/controllers/spree/paypal_controller_decorator.rb
- app/controllers/spree/user_sessions_controller.rb
- app/controllers/stripe/callbacks_controller.rb
- app/controllers/user_confirmations_controller.rb
@@ -670,11 +646,13 @@ Metrics/MethodLength:
- app/models/spree/preferences/preferable_class_methods.rb
- app/models/spree/preferences/preferable.rb
- app/models/spree/preferences/store.rb
- app/models/spree/product.rb
- app/models/spree/product_decorator.rb
- app/models/spree/return_authorization.rb
- app/models/spree/shipment.rb
- app/models/spree/taxon.rb
- app/models/spree/tax_rate.rb
- app/models/spree/variant.rb
- app/models/spree/zone.rb
- app/serializers/api/admin/order_cycle_serializer.rb
- app/serializers/api/cached_enterprise_serializer.rb
@@ -719,6 +697,7 @@ Metrics/MethodLength:
- lib/spree/core/s3_support.rb
- lib/spree/localized_number.rb
- lib/spree/responder.rb
- lib/stripe/credit_card_clone_finder.rb
- lib/stripe/profile_storer.rb
- lib/tasks/sample_data/group_factory.rb
- lib/tasks/sample_data/order_factory.rb
@@ -732,6 +711,7 @@ Metrics/ClassLength:
Exclude:
- app/controllers/admin/enterprises_controller.rb
- app/controllers/admin/order_cycles_controller.rb
- app/controllers/admin/resource_controller.rb
- app/controllers/admin/schedules_controller.rb
- app/controllers/admin/subscriptions_controller.rb
- app/controllers/api/products_controller.rb
@@ -741,7 +721,6 @@ Metrics/ClassLength:
- app/controllers/spree/admin/payment_methods_controller.rb
- app/controllers/spree/admin/products_controller.rb
- app/controllers/spree/admin/reports_controller.rb
- app/controllers/spree/admin/resource_controller.rb
- app/controllers/spree/admin/users_controller.rb
- app/controllers/spree/orders_controller.rb
- app/models/enterprise.rb
@@ -752,11 +731,14 @@ Metrics/ClassLength:
- app/models/spree/ability.rb
- app/models/spree/address.rb
- app/models/spree/credit_card.rb
- app/models/spree/gateway/stripe_sca.rb
- app/models/spree/line_item.rb
- app/models/spree/order.rb
- app/models/spree/payment.rb
- app/models/spree/product.rb
- app/models/spree/shipment.rb
- app/models/spree/user.rb
- app/models/spree/variant.rb
- app/models/spree/zone.rb
- app/serializers/api/cached_enterprise_serializer.rb
- app/serializers/api/enterprise_shopfront_serializer.rb

View File

@@ -46,6 +46,9 @@ Lint/RaiseException:
Lint/StructNewOverride:
Enabled: true
Bundler/DuplicatedGem:
Enabled: false
## TEMPORARY/CONTESTED SETTINGS
#
# These are still to be decided upon, but recommended for inclusion by

View File

@@ -1,6 +1,6 @@
# This configuration was generated by
# `rubocop --auto-gen-config --exclude-limit 1400`
# on 2020-10-30 17:18:53 +0000 using RuboCop version 0.81.0.
# on 2020-12-23 22:07:55 +0000 using RuboCop version 0.81.0.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
@@ -11,28 +11,19 @@ Lint/DuplicateMethods:
Exclude:
- 'lib/discourse/single_sign_on.rb'
# Offense count: 8
# Offense count: 5
Lint/IneffectiveAccessModifier:
Exclude:
- 'app/models/column_preference.rb'
- 'app/models/spree/user.rb'
- 'app/services/mail_configuration.rb'
- 'lib/open_food_network/feature_toggle.rb'
# Offense count: 3
# Offense count: 2
# Configuration parameters: ContextCreatingMethods, MethodCreatingMethods.
Lint/UselessAccessModifier:
Exclude:
- 'app/models/column_preference.rb'
- 'app/services/mail_configuration.rb'
- 'lib/open_food_network/feature_toggle.rb'
# Offense count: 2
Lint/UselessAssignment:
Exclude:
- 'spec/**/*'
- 'app/models/spree/taxon.rb'
- 'lib/spree/core/controller_helpers/common.rb'
# Offense count: 10
Naming/AccessorMethodName:
@@ -60,7 +51,7 @@ Naming/MemoizedInstanceVariableName:
- 'app/mailers/producer_mailer.rb'
- 'lib/open_food_network/address_finder.rb'
# Offense count: 24
# Offense count: 25
# Configuration parameters: NamePrefix, ForbiddenPrefixes, AllowedMethods, MethodDefinitionMacros.
# NamePrefix: is_, has_, have_
# ForbiddenPrefixes: is_, has_, have_
@@ -72,6 +63,7 @@ Naming/PredicateName:
- 'app/models/enterprise.rb'
- 'app/models/enterprise_relationship.rb'
- 'app/models/order_cycle.rb'
- 'app/models/spree/ability.rb'
- 'app/models/spree/adjustment.rb'
- 'app/models/spree/credit_card.rb'
- 'app/models/spree/line_item.rb'
@@ -94,12 +86,13 @@ Naming/VariableNumber:
Exclude:
- 'spec/factories/stock_location_factory.rb'
# Offense count: 7
# Offense count: 8
# Cop supports --auto-correct.
Rails/ActiveRecordAliases:
Exclude:
- 'spec/controllers/line_items_controller_spec.rb'
- 'spec/controllers/spree/orders_controller_spec.rb'
- 'spec/features/admin/subscriptions_spec.rb'
- 'spec/features/consumer/shopping/orders_spec.rb'
- 'spec/requests/api/orders_spec.rb'
@@ -125,7 +118,7 @@ Rails/Delegate:
- 'app/models/spree/line_item.rb'
- 'engines/order_management/app/services/order_management/reports/bulk_coop/renderers/html_renderer.rb'
# Offense count: 16
# Offense count: 15
# Configuration parameters: EnforcedStyle.
# SupportedStyles: slashes, arguments
Rails/FilePath:
@@ -139,7 +132,6 @@ Rails/FilePath:
- 'spec/factories/product_factory.rb'
- 'spec/features/admin/enterprises/images_spec.rb'
- 'spec/models/content_configuration_spec.rb'
- 'spec/models/spree/variant_spec.rb'
- 'spec/serializers/api/admin/enterprise_serializer_spec.rb'
- 'spec/support/downloads_helper.rb'
@@ -163,7 +155,7 @@ Rails/FindEach:
Exclude:
- 'app/models/spree/shipment.rb'
# Offense count: 9
# Offense count: 11
# Configuration parameters: Include.
# Include: app/models/**/*.rb
Rails/HasAndBelongsToMany:
@@ -172,12 +164,14 @@ Rails/HasAndBelongsToMany:
- 'app/models/enterprise.rb'
- 'app/models/enterprise_group.rb'
- 'app/models/spree/line_item.rb'
- 'app/models/spree/option_value.rb'
- 'app/models/spree/role.rb'
- 'app/models/spree/shipping_method.rb'
- 'app/models/spree/user.rb'
- 'app/models/spree/variant.rb'
- 'app/models/spree/zone.rb'
# Offense count: 38
# Offense count: 41
# Configuration parameters: Include.
# Include: app/models/**/*.rb
Rails/HasManyOrHasOneDependent:
@@ -197,7 +191,7 @@ Rails/HasManyOrHasOneDependent:
- 'app/models/spree/shipping_method.rb'
- 'app/models/spree/taxonomy.rb'
- 'app/models/spree/user.rb'
- 'app/models/spree/variant_decorator.rb'
- 'app/models/spree/variant.rb'
- 'app/models/subscription.rb'
# Offense count: 84
@@ -272,15 +266,16 @@ Rails/ReflectionClassName:
- 'app/models/spree/order.rb'
- 'app/models/subscription.rb'
# Offense count: 247
# Offense count: 252
# Configuration parameters: Blacklist, Whitelist.
# Blacklist: decrement!, decrement_counter, increment!, increment_counter, toggle!, touch, update_all, update_attribute, update_column, update_columns, update_counters
Rails/SkipsModelValidations:
Exclude:
- 'app/controllers/admin/resource_controller.rb'
- 'app/controllers/spree/admin/payment_methods_controller.rb'
- 'app/controllers/spree/admin/resource_controller.rb'
- 'app/controllers/spree/admin/shipping_methods_controller.rb'
- 'app/controllers/spree/admin/taxons_controller.rb'
- 'app/controllers/spree/credit_cards_controller.rb'
- 'app/controllers/spree/orders_controller.rb'
- 'app/jobs/subscription_confirm_job.rb'
- 'app/jobs/subscription_placement_job.rb'
@@ -294,10 +289,12 @@ Rails/SkipsModelValidations:
- 'app/models/spree/inventory_unit.rb'
- 'app/models/spree/order.rb'
- 'app/models/spree/payment.rb'
- 'app/models/spree/product.rb'
- 'app/models/spree/shipment.rb'
- 'app/models/spree/shipping_method.rb'
- 'app/models/spree/tax_category.rb'
- 'app/models/spree/taxonomy.rb'
- 'app/models/spree/variant.rb'
- 'app/models/spree/zone.rb'
- 'app/models/subscription.rb'
- 'app/models/variant_override.rb'
@@ -440,14 +437,12 @@ Style/FormatStringToken:
- 'lib/open_food_network/sales_tax_report.rb'
- 'spec/features/admin/bulk_order_management_spec.rb'
# Offense count: 765
# Offense count: 365
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle.
# SupportedStyles: always, always_true, never
Style/FrozenStringLiteralComment:
Exclude:
- 'Gemfile'
- 'Rakefile'
- 'app/controllers/admin/bulk_line_items_controller.rb'
- 'app/controllers/admin/column_preferences_controller.rb'
- 'app/controllers/admin/contents_controller.rb'
@@ -488,7 +483,6 @@ Style/FrozenStringLiteralComment:
- 'app/controllers/api/taxonomies_controller.rb'
- 'app/controllers/api/taxons_controller.rb'
- 'app/controllers/api/variants_controller.rb'
- 'app/controllers/application_controller.rb'
- 'app/controllers/base_controller.rb'
- 'app/controllers/cart_controller.rb'
- 'app/controllers/discourse_sso_controller.rb'
@@ -518,7 +512,6 @@ Style/FrozenStringLiteralComment:
- 'app/controllers/spree/admin/products_controller.rb'
- 'app/controllers/spree/admin/properties_controller.rb'
- 'app/controllers/spree/admin/reports_controller.rb'
- 'app/controllers/spree/admin/resource_controller.rb'
- 'app/controllers/spree/admin/return_authorizations_controller.rb'
- 'app/controllers/spree/admin/search_controller.rb'
- 'app/controllers/spree/admin/shipping_categories_controller.rb'
@@ -553,7 +546,6 @@ Style/FrozenStringLiteralComment:
- 'app/helpers/enterprises_helper.rb'
- 'app/helpers/footer_links_helper.rb'
- 'app/helpers/groups_helper.rb'
- 'app/helpers/html_helper.rb'
- 'app/helpers/i18n_helper.rb'
- 'app/helpers/injection_helper.rb'
- 'app/helpers/map_helper.rb'
@@ -572,14 +564,10 @@ Style/FrozenStringLiteralComment:
- 'app/helpers/spree/orders_helper.rb'
- 'app/helpers/spree/reports_helper.rb'
- 'app/helpers/spree_currency_helper.rb'
- 'app/jobs/confirm_order_job.rb'
- 'app/jobs/confirm_signup_job.rb'
- 'app/jobs/heartbeat_job.rb'
- 'app/jobs/manager_invitation_job.rb'
- 'app/jobs/order_cycle_notification_job.rb'
- 'app/jobs/subscription_confirm_job.rb'
- 'app/jobs/subscription_placement_job.rb'
- 'app/jobs/welcome_enterprise_job.rb'
- 'app/mailers/enterprise_mailer.rb'
- 'app/mailers/spree/user_mailer.rb'
- 'app/mailers/subscription_mailer.rb'
@@ -601,7 +589,6 @@ Style/FrozenStringLiteralComment:
- 'app/models/distributor_shipping_method.rb'
- 'app/models/enterprise_fee.rb'
- 'app/models/enterprise_fee_set.rb'
- 'app/models/enterprise_group.rb'
- 'app/models/enterprise_relationship_permission.rb'
- 'app/models/enterprise_role.rb'
- 'app/models/enterprise_set.rb'
@@ -635,16 +622,10 @@ Style/FrozenStringLiteralComment:
- 'app/models/spree/gateway/migs.rb'
- 'app/models/spree/gateway/pin.rb'
- 'app/models/spree/gateway/stripe_connect.rb'
- 'app/models/spree/option_type_decorator.rb'
- 'app/models/spree/preferences/file_configuration.rb'
- 'app/models/spree/price_decorator.rb'
- 'app/models/spree/product_decorator.rb'
- 'app/models/spree/product_option_type_decorator.rb'
- 'app/models/spree/product_property_decorator.rb'
- 'app/models/spree/product_set.rb'
- 'app/models/spree/property.rb'
- 'app/models/spree/user.rb'
- 'app/models/spree/variant_decorator.rb'
- 'app/models/stripe_account.rb'
- 'app/models/subscription.rb'
- 'app/models/subscription_line_item.rb'
@@ -725,7 +706,6 @@ Style/FrozenStringLiteralComment:
- 'app/validators/date_time_string_validator.rb'
- 'app/validators/distributors_validator.rb'
- 'app/validators/integer_array_validator.rb'
- 'config.ru'
- 'engines/order_management/app/controllers/order_management/application_controller.rb'
- 'engines/order_management/app/services/order_management/reports/enterprise_fee_summary/authorizer.rb'
- 'engines/order_management/app/services/order_management/reports/enterprise_fee_summary/data_representations/coordinator_fee.rb'
@@ -750,29 +730,11 @@ Style/FrozenStringLiteralComment:
- 'engines/order_management/app/services/reports/permissions.rb'
- 'engines/order_management/app/services/reports/renderers/base.rb'
- 'engines/order_management/app/services/reports/report_data/base.rb'
- 'engines/order_management/config/routes.rb'
- 'engines/order_management/lib/order_management.rb'
- 'engines/order_management/lib/order_management/engine.rb'
- 'engines/order_management/lib/order_management/version.rb'
- 'engines/order_management/order_management.gemspec'
- 'engines/order_management/spec/services/order_management/reports/enterprise_fee_summary/authorizer_spec.rb'
- 'engines/order_management/spec/services/order_management/reports/enterprise_fee_summary/parameters_spec.rb'
- 'engines/order_management/spec/services/order_management/reports/enterprise_fee_summary/permissions_spec.rb'
- 'engines/order_management/spec/services/order_management/reports/enterprise_fee_summary/renderers/csv_renderer_spec.rb'
- 'engines/order_management/spec/services/order_management/reports/enterprise_fee_summary/renderers/html_renderer_spec.rb'
- 'engines/order_management/spec/services/order_management/reports/enterprise_fee_summary/report_data/enterprise_fee_type_total_spec.rb'
- 'engines/order_management/spec/services/order_management/reports/enterprise_fee_summary/report_service_spec.rb'
- 'engines/web/app/controllers/web/angular_templates_controller.rb'
- 'engines/web/app/controllers/web/api/cookies_consent_controller.rb'
- 'engines/web/app/controllers/web/application_controller.rb'
- 'engines/web/app/helpers/web/cookies_policy_helper.rb'
- 'engines/web/config/routes.rb'
- 'engines/web/lib/web.rb'
- 'engines/web/lib/web/cookies_consent.rb'
- 'engines/web/lib/web/engine.rb'
- 'engines/web/lib/web/version.rb'
- 'engines/web/spec/helpers/cookies_policy_helper_spec.rb'
- 'engines/web/web.gemspec'
- 'lib/discourse/single_sign_on.rb'
- 'lib/open_food_network/address_finder.rb'
- 'lib/open_food_network/available_payment_method_filter.rb'
@@ -787,7 +749,6 @@ Style/FrozenStringLiteralComment:
- 'lib/open_food_network/group_buy_report.rb'
- 'lib/open_food_network/i18n_config.rb'
- 'lib/open_food_network/lettuce_share_report.rb'
- 'lib/open_food_network/locking.rb'
- 'lib/open_food_network/order_and_distributor_report.rb'
- 'lib/open_food_network/order_cycle_form_applicator.rb'
- 'lib/open_food_network/order_cycle_management_report.rb'
@@ -802,7 +763,6 @@ Style/FrozenStringLiteralComment:
- 'lib/open_food_network/packing_report.rb'
- 'lib/open_food_network/paperclippable.rb'
- 'lib/open_food_network/payments_report.rb'
- 'lib/open_food_network/permalink_generator.rb'
- 'lib/open_food_network/permissions.rb'
- 'lib/open_food_network/products_and_inventory_report.rb'
- 'lib/open_food_network/products_and_inventory_report_base.rb'
@@ -822,7 +782,6 @@ Style/FrozenStringLiteralComment:
- 'lib/open_food_network/xero_invoices_report.rb'
- 'lib/spree/api/controller_setup.rb'
- 'lib/spree/authentication_helpers.rb'
- 'lib/spree/localized_number.rb'
- 'lib/spree/money_decorator.rb'
- 'lib/stripe/account_connector.rb'
- 'lib/stripe/profile_storer.rb'
@@ -849,370 +808,8 @@ Style/FrozenStringLiteralComment:
- 'lib/tasks/sample_data/user_factory.rb'
- 'lib/tasks/specs.rake'
- 'lib/tasks/users.rake'
- 'spec/controllers/admin/bulk_line_items_controller_spec.rb'
- 'spec/controllers/admin/column_preferences_controller_spec.rb'
- 'spec/controllers/admin/customers_controller_spec.rb'
- 'spec/controllers/admin/enterprises_controller_spec.rb'
- 'spec/controllers/admin/inventory_items_controller_spec.rb'
- 'spec/controllers/admin/manager_invitations_controller_spec.rb'
- 'spec/controllers/admin/order_cycles_controller_spec.rb'
- 'spec/controllers/admin/proxy_orders_controller_spec.rb'
- 'spec/controllers/admin/schedules_controller_spec.rb'
- 'spec/controllers/admin/stripe_accounts_controller_spec.rb'
- 'spec/controllers/admin/stripe_connect_settings_controller_spec.rb'
- 'spec/controllers/admin/subscription_line_items_controller_spec.rb'
- 'spec/controllers/admin/subscriptions_controller_spec.rb'
- 'spec/controllers/admin/tag_rules_controller_spec.rb'
- 'spec/controllers/admin/variant_overrides_controller_spec.rb'
- 'spec/controllers/api/base_controller_spec.rb'
- 'spec/controllers/api/customers_controller_spec.rb'
- 'spec/controllers/api/enterprise_fees_controller_spec.rb'
- 'spec/controllers/api/enterprises_controller_spec.rb'
- 'spec/controllers/api/logos_controller_spec.rb'
- 'spec/controllers/api/order_cycles_controller_spec.rb'
- 'spec/controllers/api/orders_controller_spec.rb'
- 'spec/controllers/api/product_images_controller_spec.rb'
- 'spec/controllers/api/products_controller_spec.rb'
- 'spec/controllers/api/promo_images_controller_spec.rb'
- 'spec/controllers/api/shipments_controller_spec.rb'
- 'spec/controllers/api/statuses_controller_spec.rb'
- 'spec/controllers/api/taxonomies_controller_spec.rb'
- 'spec/controllers/api/taxons_controller_spec.rb'
- 'spec/controllers/api/terms_and_conditions_controller_spec.rb'
- 'spec/controllers/api/variants_controller_spec.rb'
- 'spec/controllers/base_controller_spec.rb'
- 'spec/controllers/cart_controller_spec.rb'
- 'spec/controllers/checkout_controller_spec.rb'
- 'spec/controllers/enterprises_controller_spec.rb'
- 'spec/controllers/groups_controller_spec.rb'
- 'spec/controllers/line_items_controller_spec.rb'
- 'spec/controllers/registration_controller_spec.rb'
- 'spec/controllers/shop_controller_spec.rb'
- 'spec/controllers/shops_controller_spec.rb'
- 'spec/controllers/spree/admin/adjustments_controller_spec.rb'
- 'spec/controllers/spree/admin/base_controller_spec.rb'
- 'spec/controllers/spree/admin/general_settings_controller_spec.rb'
- 'spec/controllers/spree/admin/invoices_controller_spec.rb'
- 'spec/controllers/spree/admin/mail_methods_controller_spec.rb'
- 'spec/controllers/spree/admin/orders/customer_details_controller_spec.rb'
- 'spec/controllers/spree/admin/orders_controller_spec.rb'
- 'spec/controllers/spree/admin/overview_controller_spec.rb'
- 'spec/controllers/spree/admin/payment_methods_controller_spec.rb'
- 'spec/controllers/spree/admin/products_controller_spec.rb'
- 'spec/controllers/spree/admin/reports_controller_spec.rb'
- 'spec/controllers/spree/admin/search_controller_spec.rb'
- 'spec/controllers/spree/admin/shipping_methods_controller_spec.rb'
- 'spec/controllers/spree/admin/users_controller_spec.rb'
- 'spec/controllers/spree/admin/variants_controller_spec.rb'
- 'spec/controllers/spree/credit_cards_controller_spec.rb'
- 'spec/controllers/spree/orders_controller_spec.rb'
- 'spec/controllers/spree/user_sessions_controller_spec.rb'
- 'spec/controllers/spree/users_controller_spec.rb'
- 'spec/controllers/stripe/callbacks_controller_spec.rb'
- 'spec/controllers/stripe/webhooks_controller_spec.rb'
- 'spec/controllers/user_confirmations_controller_spec.rb'
- 'spec/controllers/user_passwords_controller_spec.rb'
- 'spec/controllers/user_registrations_controller_spec.rb'
- 'spec/factories.rb'
- 'spec/factories/address_factory.rb'
- 'spec/factories/calculated_adjustment_factory.rb'
- 'spec/factories/calculator_factory.rb'
- 'spec/factories/enterprise_factory.rb'
- 'spec/factories/order_cycle_factory.rb'
- 'spec/factories/order_factory.rb'
- 'spec/factories/product_factory.rb'
- 'spec/factories/return_authorization_factory.rb'
- 'spec/factories/shipment_factory.rb'
- 'spec/factories/shipping_method_factory.rb'
- 'spec/factories/state_factory.rb'
- 'spec/factories/stock_movement_factory.rb'
- 'spec/factories/subscription_factory.rb'
- 'spec/factories/tag_rule_factory.rb'
- 'spec/factories/user_factory.rb'
- 'spec/factories/variant_factory.rb'
- 'spec/features/admin/adjustments_spec.rb'
- 'spec/features/admin/authentication_spec.rb'
- 'spec/features/admin/bulk_order_management_spec.rb'
- 'spec/features/admin/bulk_product_update_spec.rb'
- 'spec/features/admin/configuration/content_spec.rb'
- 'spec/features/admin/configuration/general_settings_spec.rb'
- 'spec/features/admin/configuration/mail_methods_spec.rb'
- 'spec/features/admin/configuration/states_spec.rb'
- 'spec/features/admin/configuration/tax_categories_spec.rb'
- 'spec/features/admin/configuration/tax_rates_spec.rb'
- 'spec/features/admin/configuration/taxonomies_spec.rb'
- 'spec/features/admin/configuration/zones_spec.rb'
- 'spec/features/admin/customers_spec.rb'
- 'spec/features/admin/enterprise_fees_spec.rb'
- 'spec/features/admin/enterprise_groups_spec.rb'
- 'spec/features/admin/enterprise_relationships_spec.rb'
- 'spec/features/admin/enterprise_roles_spec.rb'
- 'spec/features/admin/enterprise_user_spec.rb'
- 'spec/features/admin/enterprises/index_spec.rb'
- 'spec/features/admin/enterprises_spec.rb'
- 'spec/features/admin/external_services_spec.rb'
- 'spec/features/admin/multilingual_spec.rb'
- 'spec/features/admin/overview_spec.rb'
- 'spec/features/admin/payment_method_spec.rb'
- 'spec/features/admin/payments_spec.rb'
- 'spec/features/admin/product_import_spec.rb'
- 'spec/features/admin/products_spec.rb'
- 'spec/features/admin/reports/packing_report_spec.rb'
- 'spec/features/admin/reports_spec.rb'
- 'spec/features/admin/schedules_spec.rb'
- 'spec/features/admin/shipping_methods_spec.rb'
- 'spec/features/admin/subscriptions_spec.rb'
- 'spec/features/admin/tag_rules_spec.rb'
- 'spec/features/admin/tax_settings_spec.rb'
- 'spec/features/admin/users_spec.rb'
- 'spec/features/admin/variant_overrides_spec.rb'
- 'spec/features/admin/variants_spec.rb'
- 'spec/features/consumer/account/cards_spec.rb'
- 'spec/features/consumer/account/settings_spec.rb'
- 'spec/features/consumer/account_spec.rb'
- 'spec/features/consumer/authentication_spec.rb'
- 'spec/features/consumer/confirm_invitation_spec.rb'
- 'spec/features/consumer/footer_links_spec.rb'
- 'spec/features/consumer/groups_spec.rb'
- 'spec/features/consumer/multilingual_spec.rb'
- 'spec/features/consumer/producers_spec.rb'
- 'spec/features/consumer/registration_spec.rb'
- 'spec/features/consumer/shopping/cart_spec.rb'
- 'spec/features/consumer/shopping/checkout_auth_spec.rb'
- 'spec/features/consumer/shopping/checkout_paypal_spec.rb'
- 'spec/features/consumer/shopping/checkout_spec.rb'
- 'spec/features/consumer/shopping/embedded_groups_spec.rb'
- 'spec/features/consumer/shopping/embedded_shopfronts_spec.rb'
- 'spec/features/consumer/shopping/orders_spec.rb'
- 'spec/features/consumer/shopping/products_spec.rb'
- 'spec/features/consumer/shopping/shopping_spec.rb'
- 'spec/features/consumer/shopping/variant_overrides_spec.rb'
- 'spec/features/consumer/shops_spec.rb'
- 'spec/features/consumer/sitemap_spec.rb'
- 'spec/helpers/admin/orders_helper_spec.rb'
- 'spec/helpers/admin/subscriptions_helper_spec.rb'
- 'spec/helpers/checkout_helper_spec.rb'
- 'spec/helpers/enterprises_helper_spec.rb'
- 'spec/helpers/groups_helper_spec.rb'
- 'spec/helpers/html_helper_spec.rb'
- 'spec/helpers/i18n_helper_spec.rb'
- 'spec/helpers/injection_helper_spec.rb'
- 'spec/helpers/navigation_helper_spec.rb'
- 'spec/helpers/order_cycles_helper_spec.rb'
- 'spec/helpers/serializer_helper_spec.rb'
- 'spec/helpers/shared_helper_spec.rb'
- 'spec/helpers/shop_helper_spec.rb'
- 'spec/helpers/spree/admin/base_helper_spec.rb'
- 'spec/helpers/spree/admin/orders_helper_spec.rb'
- 'spec/helpers/spree/orders_helper_spec.rb'
- 'spec/jobs/confirm_order_job_spec.rb'
- 'spec/jobs/confirm_signup_job_spec.rb'
- 'spec/jobs/heartbeat_job_spec.rb'
- 'spec/jobs/order_cycle_notification_job_spec.rb'
- 'spec/jobs/subscription_confirm_job_spec.rb'
- 'spec/jobs/subscription_placement_job_spec.rb'
- 'spec/jobs/welcome_enterprise_job_spec.rb'
- 'spec/lib/open_food_network/address_finder_spec.rb'
- 'spec/lib/open_food_network/customers_report_spec.rb'
- 'spec/lib/open_food_network/enterprise_fee_applicator_spec.rb'
- 'spec/lib/open_food_network/enterprise_fee_calculator_spec.rb'
- 'spec/lib/open_food_network/enterprise_issue_validator_spec.rb'
- 'spec/lib/open_food_network/error_logger_spec.rb'
- 'spec/lib/open_food_network/feature_toggle_spec.rb'
- 'spec/lib/open_food_network/group_buy_report_spec.rb'
- 'spec/lib/open_food_network/i18n_config_spec.rb'
- 'spec/lib/open_food_network/lettuce_share_report_spec.rb'
- 'spec/lib/open_food_network/order_and_distributor_report_spec.rb'
- 'spec/lib/open_food_network/order_cycle_form_applicator_spec.rb'
- 'spec/lib/open_food_network/order_cycle_management_report_spec.rb'
- 'spec/lib/open_food_network/order_cycle_permissions_spec.rb'
- 'spec/lib/open_food_network/order_grouper_spec.rb'
- 'spec/lib/open_food_network/orders_and_fulfillments_report/customer_totals_report_spec.rb'
- 'spec/lib/open_food_network/orders_and_fulfillments_report/distributor_totals_by_supplier_report_spec.rb'
- 'spec/lib/open_food_network/orders_and_fulfillments_report/supplier_totals_by_distributor_report_spec.rb'
- 'spec/lib/open_food_network/orders_and_fulfillments_report/supplier_totals_report_spec.rb'
- 'spec/lib/open_food_network/orders_and_fulfillments_report_spec.rb'
- 'spec/lib/open_food_network/packing_report_spec.rb'
- 'spec/lib/open_food_network/permissions_spec.rb'
- 'spec/lib/open_food_network/products_and_inventory_report_spec.rb'
- 'spec/lib/open_food_network/property_merge_spec.rb'
- 'spec/lib/open_food_network/referer_parser_spec.rb'
- 'spec/lib/open_food_network/sales_tax_report_spec.rb'
- 'spec/lib/open_food_network/scope_variant_to_hub_spec.rb'
- 'spec/lib/open_food_network/scope_variants_to_search_spec.rb'
- 'spec/lib/open_food_network/tag_rule_applicator_spec.rb'
- 'spec/lib/open_food_network/user_balance_calculator_spec.rb'
- 'spec/lib/open_food_network/users_and_enterprises_report_spec.rb'
- 'spec/lib/open_food_network/xero_invoices_report_spec.rb'
- 'spec/lib/spree/localized_number_spec.rb'
- 'spec/lib/stripe/account_connector_spec.rb'
- 'spec/lib/stripe/webhook_handler_spec.rb'
- 'spec/lib/tasks/enterprises_rake_spec.rb'
- 'spec/lib/tasks/users_rake_spec.rb'
- 'spec/mailers/enterprise_mailer_spec.rb'
- 'spec/mailers/producer_mailer_spec.rb'
- 'spec/mailers/subscription_mailer_spec.rb'
- 'spec/mailers/user_mailer_spec.rb'
- 'spec/models/adjustment_metadata_spec.rb'
- 'spec/models/calculator/flat_percent_item_total_spec.rb'
- 'spec/models/calculator/flat_percent_per_item_spec.rb'
- 'spec/models/calculator/flat_rate_spec.rb'
- 'spec/models/calculator/flexi_rate_spec.rb'
- 'spec/models/calculator/per_item_spec.rb'
- 'spec/models/calculator/price_sack_spec.rb'
- 'spec/models/calculator/weight_spec.rb'
- 'spec/models/column_preference_spec.rb'
- 'spec/models/concerns/order_shipment_spec.rb'
- 'spec/models/concerns/product_stock_spec.rb'
- 'spec/models/concerns/variant_stock_spec.rb'
- 'spec/models/content_configuration_spec.rb'
- 'spec/models/customer_spec.rb'
- 'spec/models/enterprise_caching_spec.rb'
- 'spec/models/enterprise_fee_spec.rb'
- 'spec/models/enterprise_group_spec.rb'
- 'spec/models/enterprise_relationship_spec.rb'
- 'spec/models/enterprise_spec.rb'
- 'spec/models/exchange_spec.rb'
- 'spec/models/model_set_spec.rb'
- 'spec/models/order_cycle_spec.rb'
- 'spec/models/product_import/entry_processor_spec.rb'
- 'spec/models/product_import/inventory_reset_strategy_spec.rb'
- 'spec/models/product_import/reset_absent_spec.rb'
- 'spec/models/product_import/settings_spec.rb'
- 'spec/models/product_importer_spec.rb'
- 'spec/models/proxy_order_spec.rb'
- 'spec/models/spree/ability_spec.rb'
- 'spec/models/spree/addresses_spec.rb'
- 'spec/models/spree/adjustment_spec.rb'
- 'spec/models/spree/calculator_spec.rb'
- 'spec/models/spree/classification_spec.rb'
- 'spec/models/spree/credit_card_spec.rb'
- 'spec/models/spree/gateway/stripe_connect_spec.rb'
- 'spec/models/spree/line_item_spec.rb'
- 'spec/models/spree/order/checkout_spec.rb'
- 'spec/models/spree/order_spec.rb'
- 'spec/models/spree/payment_method_spec.rb'
- 'spec/models/spree/payment_spec.rb'
- 'spec/models/spree/preferences/file_configuration_spec.rb'
- 'spec/models/spree/price_spec.rb'
- 'spec/models/spree/product_set_spec.rb'
- 'spec/models/spree/product_spec.rb'
- 'spec/models/spree/shipping_method_spec.rb'
- 'spec/models/spree/stock/availability_validator_spec.rb'
- 'spec/models/spree/tax_rate_spec.rb'
- 'spec/models/spree/user_spec.rb'
- 'spec/models/spree/variant_spec.rb'
- 'spec/models/stripe_account_spec.rb'
- 'spec/models/subscription_line_item_spec.rb'
- 'spec/models/subscription_spec.rb'
- 'spec/models/tag_rule/discount_order_spec.rb'
- 'spec/models/tag_rule/filter_order_cycles_spec.rb'
- 'spec/models/tag_rule/filter_payment_methods_spec.rb'
- 'spec/models/tag_rule/filter_products_spec.rb'
- 'spec/models/tag_rule/filter_shipping_methods_spec.rb'
- 'spec/models/tag_rule_spec.rb'
- 'spec/models/variant_override_spec.rb'
- 'spec/performance/injection_helper_spec.rb'
- 'spec/performance/orders_controller_spec.rb'
- 'spec/performance/shop_controller_spec.rb'
- 'spec/requests/checkout/failed_checkout_spec.rb'
- 'spec/requests/checkout/paypal_spec.rb'
- 'spec/requests/checkout/stripe_connect_spec.rb'
- 'spec/requests/embedded_shopfronts_headers_spec.rb'
- 'spec/requests/large_request_spec.rb'
- 'spec/serializers/api/admin/customer_serializer_spec.rb'
- 'spec/serializers/api/admin/enterprise_serializer_spec.rb'
- 'spec/serializers/api/admin/exchange_serializer_spec.rb'
- 'spec/serializers/api/admin/for_order_cycle/supplied_product_serializer_spec.rb'
- 'spec/serializers/api/admin/index_enterprise_serializer_spec.rb'
- 'spec/serializers/api/admin/order_cycle_serializer_spec.rb'
- 'spec/serializers/api/admin/product_serializer_spec.rb'
- 'spec/serializers/api/admin/subscription_customer_serializer_spec.rb'
- 'spec/serializers/api/admin/subscription_line_item_serializer_spec.rb'
- 'spec/serializers/api/admin/variant_override_serializer_spec.rb'
- 'spec/serializers/api/admin/variant_serializer_spec.rb'
- 'spec/serializers/api/cached_enterprise_serializer_spec.rb'
- 'spec/serializers/api/credit_card_serializer_spec.rb'
- 'spec/serializers/api/current_order_serializer_spec.rb'
- 'spec/serializers/api/enterprise_serializer_spec.rb'
- 'spec/serializers/api/enterprise_shopfront_list_serializer_spec.rb'
- 'spec/serializers/api/enterprise_shopfront_serializer_spec.rb'
- 'spec/serializers/api/group_list_serializer_spec.rb'
- 'spec/serializers/api/order_cycle_serializer_spec.rb'
- 'spec/serializers/api/order_serializer_spec.rb'
- 'spec/serializers/api/product_serializer_spec.rb'
- 'spec/serializers/api/shipping_method_serializer_spec.rb'
- 'spec/serializers/api/variant_serializer_spec.rb'
- 'spec/services/bulk_invoice_service_spec.rb'
- 'spec/services/cart_service_spec.rb'
- 'spec/services/default_shipping_category_spec.rb'
- 'spec/services/default_stock_location_spec.rb'
- 'spec/services/embedded_page_service_spec.rb'
- 'spec/services/exchange_products_renderer_spec.rb'
- 'spec/services/exchange_variant_bulk_updater_spec.rb'
- 'spec/services/invoice_renderer_spec.rb'
- 'spec/services/mail_configuration_spec.rb'
- 'spec/services/order_cycle_distributed_products_spec.rb'
- 'spec/services/order_cycle_distributed_variants_spec.rb'
- 'spec/services/order_cycle_form_spec.rb'
- 'spec/services/order_cycle_warning_spec.rb'
- 'spec/services/order_factory_spec.rb'
- 'spec/services/order_syncer_spec.rb'
- 'spec/services/order_workflow_spec.rb'
- 'spec/services/permissions/order_spec.rb'
- 'spec/services/product_tag_rules_filterer_spec.rb'
- 'spec/services/products_renderer_spec.rb'
- 'spec/services/search_orders_spec.rb'
- 'spec/services/tax_rate_finder_spec.rb'
- 'spec/services/upload_sanitizer_spec.rb'
- 'spec/services/variant_units/option_value_namer_spec.rb'
- 'spec/services/variants_stock_levels_spec.rb'
- 'spec/spec_helper.rb'
- 'spec/support/ability_helper.rb'
- 'spec/support/api_helper.rb'
- 'spec/support/cancan_helper.rb'
- 'spec/support/controller_helper.rb'
- 'spec/support/delayed_job_helper.rb'
- 'spec/support/downloads_helper.rb'
- 'spec/support/email_helper.rb'
- 'spec/support/embedded_pages_helper.rb'
- 'spec/support/enterprise_groups_helper.rb'
- 'spec/support/feature_toggle_helper.rb'
- 'spec/support/features/datepicker_helper.rb'
- 'spec/support/filters_helper.rb'
- 'spec/support/html_helper.rb'
- 'spec/support/i18n_error_raising.rb'
- 'spec/support/localized_number_helper.rb'
- 'spec/support/matchers/date_time_validator_matchers.rb'
- 'spec/support/matchers/delegate_matchers.rb'
- 'spec/support/matchers/email_confirmation_matchers.rb'
- 'spec/support/matchers/flash_message_matchers.rb'
- 'spec/support/matchers/integer_array_validator_matchers.rb'
- 'spec/support/matchers/select2_matchers.rb'
- 'spec/support/matchers/table_matchers.rb'
- 'spec/support/performance_helper.rb'
- 'spec/support/products_helper.rb'
- 'spec/support/request/admin_helper.rb'
- 'spec/support/request/authentication_helper.rb'
- 'spec/support/request/cookie_helper.rb'
- 'spec/support/request/distribution_helper.rb'
- 'spec/support/request/menu_helper.rb'
- 'spec/support/request/shop_workflow.rb'
- 'spec/support/request/ui_component_helper.rb'
- 'spec/support/request/web_helper.rb'
- 'spec/support/seeds.rb'
- 'spec/support/spree/checkout_helpers.rb'
- 'spec/support/spree/money_helper.rb'
- 'spec/support/spree/url_helpers.rb'
- 'spec/support/timecop.rb'
- 'spec/validators/date_time_string_validator_spec.rb'
- 'spec/validators/integer_array_validator_spec.rb'
- 'spec/views/spree/admin/orders/edit.html.haml_spec.rb'
- 'spec/views/spree/admin/orders/index.html.haml_spec.rb'
- 'spec/views/spree/admin/payment_methods/index.html.haml_spec.rb'
- 'spec/views/spree/admin/shared/_order_links.html.haml_spec.rb'
# Offense count: 44
# Offense count: 39
# Configuration parameters: MinBodyLength.
Style/GuardClause:
Exclude:
@@ -1221,7 +818,6 @@ Style/GuardClause:
- 'app/controllers/admin/product_import_controller.rb'
- 'app/controllers/api/shipments_controller.rb'
- 'app/controllers/application_controller.rb'
- 'app/controllers/checkout_controller.rb'
- 'app/controllers/home_controller.rb'
- 'app/controllers/spree/orders_controller.rb'
- 'app/controllers/spree/paypal_controller_decorator.rb'
@@ -1229,13 +825,12 @@ Style/GuardClause:
- 'app/models/enterprise_group.rb'
- 'app/models/producer_property.rb'
- 'app/models/spree/preferences/preferable_class_methods.rb'
- 'app/models/spree/price_decorator.rb'
- 'app/models/spree/product_decorator.rb'
- 'app/services/order_syncer.rb'
- 'app/services/variant_units/variant_and_line_item_naming.rb'
- 'lib/discourse/single_sign_on.rb'
- 'lib/open_food_network/order_cycle_form_applicator.rb'
- 'lib/open_food_network/rack_request_blocker.rb'
- 'lib/spree/core/controller_helpers/respond_with.rb'
- 'spec/support/delayed_job_helper.rb'
- 'spec/support/request/distribution_helper.rb'
- 'spec/support/request/shop_workflow.rb'
@@ -1253,7 +848,7 @@ Style/MixinUsage:
- 'lib/open_food_network/orders_and_fulfillments_report.rb'
- 'spec/lib/open_food_network/packing_report_spec.rb'
# Offense count: 43
# Offense count: 42
# Cop supports --auto-correct.
# Configuration parameters: AutoCorrect, EnforcedStyle, IgnoredMethods.
# SupportedStyles: predicate, comparison
@@ -1284,7 +879,7 @@ Style/NumericPredicate:
- 'lib/spree/money_decorator.rb'
- 'lib/tasks/sample_data.rake'
# Offense count: 241
# Offense count: 243
Style/Send:
Exclude:
- 'spec/controllers/admin/subscriptions_controller_spec.rb'

View File

@@ -1 +1 @@
2.3.7
2.4.4

104
Gemfile
View File

@@ -1,11 +1,44 @@
# frozen_string_literal: true
source 'https://rubygems.org'
ruby "2.3.7"
ruby "2.4.4"
git_source(:github) { |repo_name| "https://github.com/#{repo_name}.git" }
gem 'i18n', '~> 0.6.11'
plugin 'bootboot', '~> 0.1.1' unless Bundler.settings[:frozen]
Plugin.__send__(:load_plugin, 'bootboot') if Plugin.installed?('bootboot')
if ENV['DEPENDENCIES_NEXT']
enable_dual_booting if Plugin.installed?('bootboot')
# This will only be loaded when running
# bundler command prefixed with `DEPENDENCIES_NEXT=1
gem 'rails', '> 5.0', '< 5.1'
gem 'activemerchant', '>= 1.78.0'
gem 'angular-rails-templates', '>= 0.3.0'
gem 'awesome_nested_set'
gem 'ransack', '2.3.0'
gem 'responders'
gem 'sass', '<= 4.7.1'
gem 'sass-rails', '< 6.0.0'
else
gem 'rails', '~> 4.2'
gem 'activemerchant', '~> 1.78.0'
gem 'angular-rails-templates', '~> 0.3.0'
gem 'awesome_nested_set', '~> 3.3.1'
gem 'ransack', '~> 1.8.10'
gem 'responders', '~> 2.0'
gem 'sass'
gem 'sass-rails'
gem 'db2fog'
gem 'unicorn'
end
gem 'i18n'
gem 'i18n-js', '~> 3.8.0'
gem 'rails', '~> 4.0.13'
gem 'rails-i18n', '~> 4.0'
gem 'rails-i18n'
gem 'rails_safe_tasks', '~> 1.0'
gem "activerecord-import"
@@ -18,35 +51,22 @@ gem 'web', path: './engines/web'
gem 'activerecord-postgresql-adapter'
gem 'pg', '~> 0.21.0'
gem 'acts_as_list', '= 0.3.0'
gem 'awesome_nested_set', '~> 3.2.1'
gem 'cancan', '~> 1.6.10'
gem 'ffaker', '~> 1.16'
gem 'acts_as_list', '0.9.19'
gem 'cancancan', '~> 1.7.0'
gem 'ffaker'
gem 'highline', '2.0.3' # Necessary for the install generator
gem 'json', '>= 1.7.7'
gem 'money', '5.1.1'
gem 'paranoia', '~> 2.0'
gem 'ransack', '~> 1.8.10'
gem 'state_machine', '1.2.0'
gem 'stringex', '~> 1.5.1'
gem 'spree_i18n', github: 'openfoodfoundation/spree_i18n', branch: '1-3-stable'
# Our branch contains the following changes:
# - Pass customer email and phone number to PayPal (merged to upstream master)
# - Change type of password from string to password to hide it in the form
# - Skip CA cert file and use the ones provided by the OS
gem 'spree_paypal_express', github: 'openfoodfoundation/better_spree_paypal_express', branch: '2-1-0-stable'
gem 'json'
gem 'monetize', '~> 1.1'
gem 'paranoia', '~> 2.4'
gem 'state_machines-activerecord'
gem 'stringex', '~> 2.8.5'
gem 'paypal-sdk-merchant', '1.106.1'
gem 'stripe'
# We need at least this version to have Digicert's root certificate
# which is needed for Pin Payments (and possibly others).
gem 'activemerchant', '~> 1.78.0'
gem 'devise', '~> 3.5.10' # v4.0.0 needs rails 4.1
gem 'devise'
gem 'devise-encryptable'
gem 'devise-token_authenticatable', '~> 0.4.10' # v0.5.0 needs devise v4
gem 'devise-token_authenticatable'
gem 'jwt', '~> 2.2'
gem 'oauth2', '~> 1.4.4' # Used for Stripe Connect
@@ -54,19 +74,14 @@ gem 'daemons'
gem 'delayed_job_active_record'
gem 'delayed_job_web'
gem 'kaminari', '~> 0.17.0'
gem 'kaminari', '~> 1.2.1'
gem 'andand'
gem 'angularjs-rails', '1.5.5'
gem 'aws-sdk', '1.67.0'
gem 'bugsnag'
gem 'db2fog'
gem 'haml'
gem 'redcarpet'
gem 'sass'
gem 'sass-rails'
gem 'truncate_html', '0.9.2'
gem 'unicorn'
gem 'actionpack-action_caching'
# AMS 0.9.x and 0.10.x are very different from 0.8.4 and the upgrade is not straight forward
@@ -80,8 +95,7 @@ gem 'dalli'
gem 'figaro'
gem 'geocoder'
gem 'gmaps4rails'
gem 'oj'
gem 'paper_trail', '~> 7.1.3'
gem 'paper_trail', '~> 10.3.1'
gem 'paperclip', '~> 3.4.1'
gem 'rack-rewrite'
gem 'rack-ssl', require: 'rack/ssl'
@@ -91,7 +105,6 @@ gem 'combine_pdf'
gem 'wicked_pdf'
gem 'wkhtmltopdf-binary'
gem 'foreigner'
gem 'immigrant'
gem 'roo', '~> 2.8.3'
@@ -106,13 +119,12 @@ gem 'mini_racer', '0.2.15'
gem 'uglifier', '>= 1.0.3'
gem 'angular-rails-templates', '~> 0.3.0'
gem 'foundation-icons-sass-rails'
gem 'foundation-rails', '= 5.5.2.1'
gem 'jquery-migrate-rails'
gem 'jquery-rails', '3.1.5'
gem 'jquery-rails', '4.4.0'
gem 'jquery-ui-rails', '~> 4.2'
gem 'select2-rails', '~> 3.4.7'
@@ -127,10 +139,10 @@ group :test, :development do
# Pretty printed test output
gem 'atomic'
gem 'awesome_print'
gem 'capybara', '>= 2.18.0' # 3.0 requires rack 1.6 that only works with Rails 4.2
gem 'capybara'
gem 'database_cleaner', require: false
gem "factory_bot_rails", '4.10.0', require: false
gem 'fuubar', '~> 2.5.0'
gem "factory_bot_rails", '5.2.0', require: false
gem 'fuubar', '~> 2.5.1'
gem 'json_spec', '~> 1.1.4'
gem 'knapsack'
gem 'letter_opener', '>= 1.4.1'
@@ -147,17 +159,17 @@ end
group :test do
gem 'simplecov', require: false
gem 'test-prof'
gem 'test_after_commit' # needed to test Devise callbacks
gem 'webmock'
# See spec/spec_helper.rb for instructions
# gem 'perftools.rb'
end
group :development do
gem 'byebug', '~> 11.0.0' # 11.1 requires ruby 2.4
gem 'byebug'
gem 'debugger-linecache'
gem "newrelic_rpm", "~> 3.0"
gem "pry", "~> 0.12.0" # pry 0.13 is not compatible with pry-byebug 3.7
gem 'pry-byebug', '~> 3.7.0' # 3.8 requires ruby 2.4
gem 'pry'
gem 'pry-byebug'
gem 'rubocop'
gem 'rubocop-rails'
gem 'spring'

View File

@@ -4,14 +4,6 @@ GIT
specs:
custom_error_message (1.1.1)
GIT
remote: https://github.com/openfoodfoundation/better_spree_paypal_express.git
revision: 1a477e9f7763297944cc99b6f4dd3d962aa963e9
branch: 2-1-0-stable
specs:
spree_paypal_express (2.0.3)
paypal-sdk-merchant (= 1.106.1)
GIT
remote: https://github.com/openfoodfoundation/ofn-qz.git
revision: 467f6ea1c44529c7c91cac4c8211bbd863588c0b
@@ -19,15 +11,6 @@ GIT
specs:
ofn-qz (0.1.0)
GIT
remote: https://github.com/openfoodfoundation/spree_i18n.git
revision: 12f18312232f0ce70270d47859d2951d12f7791c
branch: 1-3-stable
specs:
spree_i18n (1.0.0)
i18n (~> 0.5)
rails-i18n
PATH
remote: engines/catalog
specs:
@@ -55,33 +38,44 @@ GEM
remote: https://rubygems.org/
specs:
CFPropertyList (2.3.6)
actionmailer (4.0.13)
actionpack (= 4.0.13)
actionmailer (4.2.11.3)
actionpack (= 4.2.11.3)
actionview (= 4.2.11.3)
activejob (= 4.2.11.3)
mail (~> 2.5, >= 2.5.4)
actionpack (4.0.13)
activesupport (= 4.0.13)
builder (~> 3.1.0)
erubis (~> 2.7.0)
rack (~> 1.5.2)
rails-dom-testing (~> 1.0, >= 1.0.5)
actionpack (4.2.11.3)
actionview (= 4.2.11.3)
activesupport (= 4.2.11.3)
rack (~> 1.6)
rack-test (~> 0.6.2)
rails-dom-testing (~> 1.0, >= 1.0.5)
rails-html-sanitizer (~> 1.0, >= 1.0.2)
actionpack-action_caching (1.2.1)
actionpack (>= 4.0.0)
actionview (4.2.11.3)
activesupport (= 4.2.11.3)
builder (~> 3.1)
erubis (~> 2.7.0)
rails-dom-testing (~> 1.0, >= 1.0.5)
rails-html-sanitizer (~> 1.0, >= 1.0.3)
active_model_serializers (0.8.4)
activemodel (>= 3.0)
activejob (4.2.11.3)
activesupport (= 4.2.11.3)
globalid (>= 0.3.0)
activemerchant (1.78.0)
activesupport (>= 3.2.14, < 6.x)
builder (>= 2.1.2, < 4.0.0)
i18n (>= 0.6.9)
nokogiri (~> 1.4)
activemodel (4.0.13)
activesupport (= 4.0.13)
builder (~> 3.1.0)
activerecord (4.0.13)
activemodel (= 4.0.13)
activerecord-deprecated_finders (~> 1.0.2)
activesupport (= 4.0.13)
arel (~> 4.0.0)
activerecord-deprecated_finders (1.0.4)
activemodel (4.2.11.3)
activesupport (= 4.2.11.3)
builder (~> 3.1)
activerecord (4.2.11.3)
activemodel (= 4.2.11.3)
activesupport (= 4.2.11.3)
arel (~> 6.0)
activerecord-import (1.0.7)
activerecord (>= 3.2)
activerecord-postgresql-adapter (0.0.1)
@@ -92,18 +86,20 @@ GEM
multi_json (~> 1.11, >= 1.11.2)
rack (>= 1.5.2, < 3)
railties (>= 4.0)
activesupport (4.0.13)
i18n (~> 0.6, >= 0.6.9)
minitest (~> 4.2)
multi_json (~> 1.3)
thread_safe (~> 0.1)
tzinfo (~> 0.3.37)
activesupport (4.2.11.3)
i18n (~> 0.7)
minitest (~> 5.1)
thread_safe (~> 0.3, >= 0.3.4)
tzinfo (~> 1.1)
acts-as-taggable-on (4.0.0)
activerecord (>= 4.0)
acts_as_list (0.3.0)
acts_as_list (0.9.19)
activerecord (>= 3.0)
addressable (2.7.0)
public_suffix (>= 2.0.2, < 5.0)
aliyun-sdk (0.8.0)
nokogiri (~> 1.6)
rest-client (~> 2.0)
andand (1.3.3)
angular-rails-templates (0.3.0)
railties (>= 3.1)
@@ -111,10 +107,10 @@ GEM
tilt
angularjs-file-upload-rails (2.4.1)
angularjs-rails (1.5.5)
arel (4.0.2)
ast (2.4.0)
arel (6.0.4)
ast (2.4.1)
atomic (1.1.101)
awesome_nested_set (3.2.1)
awesome_nested_set (3.3.1)
activerecord (>= 4.0.0, < 7.0)
awesome_print (1.8.0)
aws-sdk (1.67.0)
@@ -122,26 +118,27 @@ GEM
aws-sdk-v1 (1.67.0)
json (~> 1.4)
nokogiri (~> 1)
bcrypt (3.1.13)
bugsnag (6.18.0)
bcrypt (3.1.16)
bugsnag (6.19.0)
concurrent-ruby (~> 1.0)
builder (3.1.4)
byebug (11.0.1)
cancan (1.6.10)
capybara (2.18.0)
builder (3.2.4)
byebug (11.1.3)
cancancan (1.7.1)
capybara (3.32.2)
addressable
mini_mime (>= 0.1.3)
nokogiri (>= 1.3.3)
rack (>= 1.0.0)
rack-test (>= 0.5.4)
xpath (>= 2.0, < 4.0)
nokogiri (~> 1.8)
rack (>= 1.6.0)
rack-test (>= 0.6.3)
regexp_parser (~> 1.5)
xpath (~> 3.2)
childprocess (3.0.0)
chronic (0.10.2)
chunky_png (1.3.11)
chunky_png (1.3.14)
climate_control (0.2.0)
cocaine (0.5.8)
climate_control (>= 0.0.3, < 1.0)
coderay (1.1.2)
coderay (1.1.3)
coffee-rails (4.2.2)
coffee-script (>= 2.2.0)
railties (>= 4.0.0)
@@ -149,7 +146,7 @@ GEM
coffee-script-source
execjs
coffee-script-source (1.12.2)
combine_pdf (1.0.16)
combine_pdf (1.0.21)
ruby-rc4 (>= 0.1.5)
compass (1.0.3)
chunky_png (~> 1.2)
@@ -168,7 +165,9 @@ GEM
sass-rails (< 5.1)
sprockets (< 4.0)
concurrent-ruby (1.1.7)
crack (0.4.4)
crack (0.4.5)
rexml
crass (1.0.6)
css_parser (1.7.1)
addressable
daemons (1.3.1)
@@ -178,48 +177,49 @@ GEM
activerecord (>= 3.2.0, < 5.0)
fog (~> 1.0)
rails (>= 3.2.0, < 5.0)
ddtrace (0.42.0)
ddtrace (0.44.0)
msgpack
debugger-linecache (1.2.0)
delayed_job (4.1.8)
activesupport (>= 3.0, < 6.1)
delayed_job_active_record (4.1.4)
activerecord (>= 3.0, < 6.1)
delayed_job (4.1.9)
activesupport (>= 3.0, < 6.2)
delayed_job_active_record (4.1.5)
activerecord (>= 3.0, < 6.2)
delayed_job (>= 3.0, < 5)
delayed_job_web (1.4.3)
activerecord (> 3.0.0)
delayed_job (> 2.0.3)
rack-protection (>= 1.5.5)
sinatra (>= 1.4.4)
devise (3.5.10)
devise (4.7.3)
bcrypt (~> 3.0)
orm_adapter (~> 0.1)
railties (>= 3.2.6, < 5)
railties (>= 4.1.0)
responders
thread_safe (~> 0.1)
warden (~> 1.2.3)
devise-encryptable (0.2.0)
devise (>= 2.1.0)
devise-token_authenticatable (0.4.10)
devise (>= 3.5.2, < 4.0.0)
diff-lcs (1.3)
docile (1.3.2)
devise-token_authenticatable (1.1.0)
devise (>= 4.0.0, < 5.0.0)
diff-lcs (1.4.4)
docile (1.3.4)
domain_name (0.5.20190701)
unf (>= 0.0.5, < 1.0.0)
dry-inflector (0.1.2)
erubis (2.7.0)
eventmachine (1.2.7)
excon (0.71.1)
excon (0.78.0)
execjs (2.7.0)
factory_bot (4.10.0)
activesupport (>= 3.0.0)
factory_bot_rails (4.10.0)
factory_bot (~> 4.10.0)
railties (>= 3.0.0)
faraday (1.0.0)
factory_bot (5.2.0)
activesupport (>= 4.2.0)
factory_bot_rails (5.2.0)
factory_bot (~> 5.2.0)
railties (>= 4.2.0)
faraday (1.0.1)
multipart-post (>= 1.2, < 3)
ffaker (1.32.1)
ffi (1.12.2)
figaro (1.1.1)
thor (~> 0.14)
ffaker (2.16.0)
ffi (1.13.1)
figaro (1.2.0)
thor (>= 0.14.0, < 2)
fission (0.5.0)
CFPropertyList (~> 2.2)
fog (1.41.0)
@@ -256,7 +256,8 @@ GEM
fog-xml (~> 0.1.1)
ipaddress (~> 0.5)
json (>= 1.8, < 2.0)
fog-aliyun (0.3.5)
fog-aliyun (0.3.19)
aliyun-sdk (~> 0.8.0)
fog-core
fog-json
ipaddress (~> 0.8)
@@ -302,7 +303,7 @@ GEM
fog-core
fog-json
fog-xml
fog-internet-archive (0.0.1)
fog-internet-archive (0.0.2)
fog-core
fog-json
fog-xml
@@ -359,7 +360,7 @@ GEM
fog-voxel (0.1.0)
fog-core
fog-xml
fog-vsphere (3.2.1)
fog-vsphere (3.4.0)
fog-core
rbvmomi (>= 1.9, < 3)
fog-xenserver (1.0.0)
@@ -369,8 +370,6 @@ GEM
fog-xml (0.1.3)
fog-core
nokogiri (>= 1.5.11, < 2.0.0)
foreigner (1.7.4)
activerecord (>= 3.0.0)
formatador (0.2.5)
foundation-icons-sass-rails (3.0.0)
railties (>= 3.1.1)
@@ -378,29 +377,35 @@ GEM
foundation-rails (5.5.2.1)
railties (>= 3.1.0)
sass (>= 3.3.0, < 3.5)
fuubar (2.5.0)
fuubar (2.5.1)
rspec-core (~> 3.0)
ruby-progressbar (~> 1.4)
geocoder (1.6.4)
get_process_mem (0.2.5)
get_process_mem (0.2.7)
ffi (~> 1.0)
globalid (0.4.2)
activesupport (>= 4.2.0)
gmaps4rails (2.1.2)
haml (5.2.0)
haml (5.2.1)
temple (>= 0.8.0)
tilt
hashdiff (1.0.1)
highline (2.0.3)
hike (1.2.3)
i18n (0.6.11)
http-accept (1.7.0)
http-cookie (1.0.3)
domain_name (~> 0.5)
i18n (0.9.5)
concurrent-ruby (~> 1.0)
i18n-js (3.8.0)
i18n (>= 0.6.6)
immigrant (0.3.6)
activerecord (>= 3.0)
ipaddress (0.8.3)
jaro_winkler (1.5.4)
jquery-migrate-rails (1.2.1)
jquery-rails (3.1.5)
railties (>= 3.0, < 5.0)
jquery-rails (4.4.0)
rails-dom-testing (>= 1, < 3)
railties (>= 4.2.0)
thor (>= 0.14, < 2.0)
jquery-ui-rails (4.2.1)
railties (>= 3.2.16)
@@ -411,20 +416,32 @@ GEM
multi_json (~> 1.0)
rspec (>= 2.0, < 4.0)
jwt (2.2.2)
kaminari (0.17.0)
actionpack (>= 3.0.0)
activesupport (>= 3.0.0)
kaminari (1.2.1)
activesupport (>= 4.1.0)
kaminari-actionview (= 1.2.1)
kaminari-activerecord (= 1.2.1)
kaminari-core (= 1.2.1)
kaminari-actionview (1.2.1)
actionview
kaminari-core (= 1.2.1)
kaminari-activerecord (1.2.1)
activerecord
kaminari-core (= 1.2.1)
kaminari-core (1.2.1)
kgio (2.11.3)
knapsack (1.19.0)
knapsack (1.20.0)
rake
launchy (2.4.3)
addressable (~> 2.3)
letter_opener (1.7.0)
launchy (~> 2.2)
libv8 (7.3.492.27.1)
loofah (2.8.0)
crass (~> 1.0.2)
nokogiri (>= 1.5.9)
mail (2.7.1)
mini_mime (>= 0.1.1)
method_source (0.9.2)
method_source (1.0.0)
mime-types (3.3.1)
mime-types-data (~> 3.2015)
mime-types-data (3.2020.0512)
@@ -432,15 +449,17 @@ GEM
mini_portile2 (2.4.0)
mini_racer (0.2.15)
libv8 (> 7.3)
minitest (4.7.5)
money (5.1.1)
i18n (~> 0.6.0)
minitest (5.14.3)
monetize (1.9.4)
money (~> 6.12)
money (6.13.8)
i18n (>= 0.6.4, <= 2)
msgpack (1.3.3)
multi_json (1.15.0)
multi_xml (0.6.0)
multipart-post (2.1.1)
newrelic_rpm (3.18.1.330)
nokogiri (1.10.9)
netrc (0.11.0)
nokogiri (1.10.10)
mini_portile2 (~> 2.4.0)
oauth2 (1.4.4)
faraday (>= 0.8, < 2.0)
@@ -448,11 +467,10 @@ GEM
multi_json (~> 1.3)
multi_xml (~> 0.5)
rack (>= 1.2, < 3)
oj (3.10.8)
optimist (3.0.0)
optimist (3.0.1)
orm_adapter (0.5.0)
paper_trail (7.1.3)
activerecord (>= 4.0, < 5.2)
paper_trail (10.3.1)
activerecord (>= 4.2)
request_store (~> 1.1)
paperclip (3.4.2)
activemodel (>= 3.0.0)
@@ -460,11 +478,11 @@ GEM
activesupport (>= 3.0.0)
cocaine (~> 0.5.0)
mime-types
parallel (1.19.1)
paranoia (2.4.2)
activerecord (>= 4.0, < 6.1)
parser (2.7.1.0)
ast (~> 2.4.0)
parallel (1.20.1)
paranoia (2.4.3)
activerecord (>= 4.0, < 6.2)
parser (3.0.0.0)
ast (~> 2.4.1)
paypal-sdk-core (0.2.10)
multi_json (~> 1.0)
xml-simple
@@ -472,15 +490,15 @@ GEM
paypal-sdk-core (~> 0.2.3)
pg (0.21.0)
power_assert (1.2.0)
pry (0.12.2)
coderay (~> 1.1.0)
method_source (~> 0.9.0)
pry-byebug (3.7.0)
pry (0.13.1)
coderay (~> 1.1)
method_source (~> 1.0)
pry-byebug (3.9.0)
byebug (~> 11.0)
pry (~> 0.10)
pry (~> 0.13.0)
public_suffix (4.0.6)
rack (1.5.5)
rack-mini-profiler (2.0.2)
rack (1.6.13)
rack-mini-profiler (2.3.0)
rack (>= 1.2.0)
rack-protection (1.5.5)
rack
@@ -489,77 +507,95 @@ GEM
rack
rack-test (0.6.3)
rack (>= 1.0)
rails (4.0.13)
actionmailer (= 4.0.13)
actionpack (= 4.0.13)
activerecord (= 4.0.13)
activesupport (= 4.0.13)
rails (4.2.11.3)
actionmailer (= 4.2.11.3)
actionpack (= 4.2.11.3)
actionview (= 4.2.11.3)
activejob (= 4.2.11.3)
activemodel (= 4.2.11.3)
activerecord (= 4.2.11.3)
activesupport (= 4.2.11.3)
bundler (>= 1.3.0, < 2.0)
railties (= 4.0.13)
sprockets-rails (~> 2.0)
rails-i18n (4.0.5)
i18n (~> 0.6)
railties (= 4.2.11.3)
sprockets-rails
rails-deprecated_sanitizer (1.0.3)
activesupport (>= 4.2.0.alpha)
rails-dom-testing (1.0.9)
activesupport (>= 4.2.0, < 5.0)
nokogiri (~> 1.6)
rails-deprecated_sanitizer (>= 1.0.1)
rails-html-sanitizer (1.3.0)
loofah (~> 2.3)
rails-i18n (4.0.9)
i18n (~> 0.7)
railties (~> 4.0)
rails_safe_tasks (1.0.0)
railties (4.0.13)
actionpack (= 4.0.13)
activesupport (= 4.0.13)
railties (4.2.11.3)
actionpack (= 4.2.11.3)
activesupport (= 4.2.11.3)
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
rainbow (3.0.0)
raindrops (0.19.1)
rake (13.0.1)
rake (13.0.3)
ransack (1.8.10)
actionpack (>= 3.0, < 5.2)
activerecord (>= 3.0, < 5.2)
activesupport (>= 3.0, < 5.2)
i18n
rb-fsevent (0.10.3)
rb-fsevent (0.10.4)
rb-inotify (0.10.1)
ffi (~> 1.0)
rbvmomi (2.2.0)
rbvmomi (2.4.1)
builder (~> 3.0)
json (>= 1.8)
nokogiri (~> 1.5)
optimist (~> 3.0)
redcarpet (3.5.0)
redcarpet (3.5.1)
regexp_parser (1.8.2)
request_store (1.5.0)
rack (>= 1.4)
responders (1.1.2)
railties (>= 3.2, < 4.2)
responders (2.4.1)
actionpack (>= 4.2.0, < 6.0)
railties (>= 4.2.0, < 6.0)
rest-client (2.1.0)
http-accept (>= 1.7.0, < 2.0)
http-cookie (>= 1.0.2, < 2.0)
mime-types (>= 1.16, < 4.0)
netrc (~> 0.8)
rexml (3.2.4)
roadie (3.4.0)
roadie (3.5.1)
css_parser (~> 1.4)
nokogiri (~> 1.5)
nokogiri (~> 1.8)
roadie-rails (1.3.0)
railties (>= 3.0, < 5.3)
roadie (~> 3.1)
roo (2.8.3)
nokogiri (~> 1)
rubyzip (>= 1.3.0, < 3.0.0)
rspec (3.9.0)
rspec-core (~> 3.9.0)
rspec-expectations (~> 3.9.0)
rspec-mocks (~> 3.9.0)
rspec-core (3.9.1)
rspec-support (~> 3.9.1)
rspec-expectations (3.9.0)
rspec (3.10.0)
rspec-core (~> 3.10.0)
rspec-expectations (~> 3.10.0)
rspec-mocks (~> 3.10.0)
rspec-core (3.10.1)
rspec-support (~> 3.10.0)
rspec-expectations (3.10.1)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.9.0)
rspec-mocks (3.9.1)
rspec-support (~> 3.10.0)
rspec-mocks (3.10.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.9.0)
rspec-rails (3.9.1)
actionpack (>= 3.0)
activesupport (>= 3.0)
railties (>= 3.0)
rspec-core (~> 3.9.0)
rspec-expectations (~> 3.9.0)
rspec-mocks (~> 3.9.0)
rspec-support (~> 3.9.0)
rspec-support (~> 3.10.0)
rspec-rails (4.0.2)
actionpack (>= 4.2)
activesupport (>= 4.2)
railties (>= 4.2)
rspec-core (~> 3.10)
rspec-expectations (~> 3.10)
rspec-mocks (~> 3.10)
rspec-support (~> 3.10)
rspec-retry (0.6.2)
rspec-core (> 3.3)
rspec-support (3.9.2)
rspec-support (3.10.1)
rswag (2.3.1)
rswag-api (= 2.3.1)
rswag-specs (= 2.3.1)
@@ -573,21 +609,24 @@ GEM
rswag-ui (2.3.1)
actionpack (>= 3.1, < 7.0)
railties (>= 3.1, < 7.0)
rubocop (0.81.0)
jaro_winkler (~> 1.5.1)
rubocop (1.8.1)
parallel (~> 1.10)
parser (>= 2.7.0.1)
parser (>= 3.0.0.0)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
rexml
rubocop-ast (>= 1.2.0, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 2.0)
rubocop-rails (2.5.2)
activesupport
unicode-display_width (>= 1.4.0, < 3.0)
rubocop-ast (1.4.0)
parser (>= 2.7.1.5)
rubocop-rails (2.9.1)
activesupport (>= 4.2.0)
rack (>= 1.1)
rubocop (>= 0.72.0)
ruby-progressbar (1.10.1)
rubocop (>= 0.90.0, < 2.0)
ruby-progressbar (1.11.0)
ruby-rc4 (0.1.5)
rubyzip (1.3.0)
rubyzip (2.3.0)
sass (3.4.25)
sass-rails (5.0.7)
railties (>= 4.0.0, < 6)
@@ -601,18 +640,17 @@ GEM
selenium-webdriver (3.142.7)
childprocess (>= 0.5, < 4.0)
rubyzip (>= 1.2.2)
shoulda-matchers (3.1.3)
activesupport (>= 4.0.0)
simplecov (0.17.1)
shoulda-matchers (4.5.0)
activesupport (>= 4.2.0)
simplecov (0.18.5)
docile (~> 1.1)
json (>= 1.8, < 3)
simplecov-html (~> 0.10.0)
simplecov-html (0.10.2)
simplecov-html (~> 0.11)
simplecov-html (0.12.3)
sinatra (1.4.8)
rack (~> 1.5)
rack-protection (~> 1.4)
tilt (>= 1.3, < 3)
spring (1.7.2)
spring (2.1.1)
spring-commands-rspec (1.0.4)
spring (>= 0.9.1)
sprockets (2.12.5)
@@ -624,23 +662,34 @@ GEM
actionpack (>= 3.0)
activesupport (>= 3.0)
sprockets (>= 2.8, < 4.0)
state_machine (1.2.0)
stringex (1.5.1)
stripe (5.25.0)
state_machines (0.5.0)
state_machines-activemodel (0.7.1)
activemodel (>= 4.1)
state_machines (>= 0.5.0)
state_machines-activerecord (0.6.0)
activerecord (>= 4.1)
state_machines-activemodel (>= 0.5.0)
stringex (2.8.5)
stripe (5.29.0)
temple (0.8.2)
test-prof (0.7.5)
test-unit (3.3.6)
test-prof (0.11.3)
test-unit (3.3.9)
power_assert
test_after_commit (1.2.2)
activerecord (>= 3.2, < 5.0)
thor (0.20.3)
thread_safe (0.3.6)
tilt (1.4.1)
timecop (0.9.2)
truncate_html (0.9.2)
tzinfo (0.3.57)
tzinfo (1.2.9)
thread_safe (~> 0.1)
uglifier (4.2.0)
execjs (>= 0.3.0, < 3)
unicode-display_width (1.7.0)
unicorn (5.7.0)
unf (0.1.4)
unf_ext
unf_ext (0.0.7.7)
unicode-display_width (2.0.0)
unicorn (5.8.0)
kgio (~> 2.6)
raindrops (~> 0.7)
unicorn-rails (2.2.1)
@@ -651,11 +700,11 @@ GEM
unicorn (>= 4, < 6)
warden (1.2.7)
rack (>= 1.0)
webdrivers (4.2.0)
webdrivers (4.4.2)
nokogiri (~> 1.6)
rubyzip (>= 1.3.0)
selenium-webdriver (>= 3.0, < 4.0)
webmock (3.9.5)
webmock (3.11.1)
addressable (>= 2.3.6)
crack (>= 0.3.2)
hashdiff (>= 0.4.0, < 2.0.0)
@@ -666,8 +715,8 @@ GEM
wkhtmltopdf-binary (0.12.5)
xml-simple (1.1.5)
xmlrpc (0.3.0)
xpath (2.1.0)
nokogiri (~> 1.3)
xpath (3.2.0)
nokogiri (~> 1.8)
PLATFORMS
ruby
@@ -680,19 +729,19 @@ DEPENDENCIES
activerecord-postgresql-adapter
activerecord-session_store
acts-as-taggable-on (~> 4.0)
acts_as_list (= 0.3.0)
acts_as_list (= 0.9.19)
andand
angular-rails-templates (~> 0.3.0)
angularjs-file-upload-rails (~> 2.4.1)
angularjs-rails (= 1.5.5)
atomic
awesome_nested_set (~> 3.2.1)
awesome_nested_set (~> 3.3.1)
awesome_print
aws-sdk (= 1.67.0)
bugsnag
byebug (~> 11.0.0)
cancan (~> 1.6.10)
capybara (>= 2.18.0)
byebug
cancancan (~> 1.7.0)
capybara
catalog!
coffee-rails (~> 4.2.2)
combine_pdf
@@ -706,55 +755,54 @@ DEPENDENCIES
debugger-linecache
delayed_job_active_record
delayed_job_web
devise (~> 3.5.10)
devise
devise-encryptable
devise-token_authenticatable (~> 0.4.10)
devise-token_authenticatable
dfc_provider!
eventmachine (>= 1.2.3)
factory_bot_rails (= 4.10.0)
ffaker (~> 1.16)
factory_bot_rails (= 5.2.0)
ffaker
figaro
foreigner
foundation-icons-sass-rails
foundation-rails (= 5.5.2.1)
fuubar (~> 2.5.0)
fuubar (~> 2.5.1)
geocoder
gmaps4rails
haml
highline (= 2.0.3)
i18n (~> 0.6.11)
i18n
i18n-js (~> 3.8.0)
immigrant
jquery-migrate-rails
jquery-rails (= 3.1.5)
jquery-rails (= 4.4.0)
jquery-ui-rails (~> 4.2)
json (>= 1.7.7)
json
json_spec (~> 1.1.4)
jwt (~> 2.2)
kaminari (~> 0.17.0)
kaminari (~> 1.2.1)
knapsack
letter_opener (>= 1.4.1)
mini_racer (= 0.2.15)
money (= 5.1.1)
newrelic_rpm (~> 3.0)
monetize (~> 1.1)
oauth2 (~> 1.4.4)
ofn-qz!
oj
order_management!
paper_trail (~> 7.1.3)
paper_trail (~> 10.3.1)
paperclip (~> 3.4.1)
paranoia (~> 2.0)
paranoia (~> 2.4)
paypal-sdk-merchant (= 1.106.1)
pg (~> 0.21.0)
pry (~> 0.12.0)
pry-byebug (~> 3.7.0)
pry
pry-byebug
rack-mini-profiler (< 3.0.0)
rack-rewrite
rack-ssl
rails (~> 4.0.13)
rails-i18n (~> 4.0)
rails (~> 4.2)
rails-i18n
rails_safe_tasks (~> 1.0)
ransack (~> 1.8.10)
redcarpet
responders (~> 2.0)
roadie-rails (~> 1.3.0)
roo (~> 2.8.3)
rspec-rails (>= 3.5.2)
@@ -768,17 +816,15 @@ DEPENDENCIES
selenium-webdriver
shoulda-matchers
simplecov
spree_i18n!
spree_paypal_express!
spring
spring-commands-rspec
state_machine (= 1.2.0)
stringex (~> 1.5.1)
state_machines-activerecord
stringex (~> 2.8.5)
stripe
test-prof
test-unit (~> 3.3)
test_after_commit
timecop
truncate_html (= 0.9.2)
uglifier (>= 1.0.3)
unicorn
unicorn-rails
@@ -791,7 +837,7 @@ DEPENDENCIES
wkhtmltopdf-binary
RUBY VERSION
ruby 2.3.7p456
ruby 2.4.4p296
BUNDLED WITH
1.17.3

665
Gemfile_next.lock Normal file
View File

@@ -0,0 +1,665 @@
GIT
remote: https://github.com/jeremydurham/custom-err-msg.git
revision: 3a8ec9dddc7a5b0aab7c69a6060596de300c68f4
specs:
custom_error_message (1.1.1)
GIT
remote: https://github.com/openfoodfoundation/ofn-qz.git
revision: 467f6ea1c44529c7c91cac4c8211bbd863588c0b
branch: ofn-rails-4
specs:
ofn-qz (0.1.0)
PATH
remote: engines/catalog
specs:
catalog (0.0.1)
PATH
remote: engines/dfc_provider
specs:
dfc_provider (0.0.1)
active_model_serializers (~> 0.8.4)
jwt (~> 2.2)
rspec (~> 3.9)
PATH
remote: engines/order_management
specs:
order_management (0.0.1)
PATH
remote: engines/web
specs:
web (0.0.1)
GEM
remote: https://rubygems.org/
specs:
actioncable (5.0.7.2)
actionpack (= 5.0.7.2)
nio4r (>= 1.2, < 3.0)
websocket-driver (~> 0.6.1)
actionmailer (5.0.7.2)
actionpack (= 5.0.7.2)
actionview (= 5.0.7.2)
activejob (= 5.0.7.2)
mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 2.0)
actionpack (5.0.7.2)
actionview (= 5.0.7.2)
activesupport (= 5.0.7.2)
rack (~> 2.0)
rack-test (~> 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.2)
actionpack-action_caching (1.2.1)
actionpack (>= 4.0.0)
actionview (5.0.7.2)
activesupport (= 5.0.7.2)
builder (~> 3.1)
erubis (~> 2.7.0)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.3)
active_model_serializers (0.8.4)
activemodel (>= 3.0)
activejob (5.0.7.2)
activesupport (= 5.0.7.2)
globalid (>= 0.3.6)
activemerchant (1.107.4)
activesupport (>= 4.2)
builder (>= 2.1.2, < 4.0.0)
i18n (>= 0.6.9)
nokogiri (~> 1.4)
activemodel (5.0.7.2)
activesupport (= 5.0.7.2)
activerecord (5.0.7.2)
activemodel (= 5.0.7.2)
activesupport (= 5.0.7.2)
arel (~> 7.0)
activerecord-import (1.0.7)
activerecord (>= 3.2)
activerecord-postgresql-adapter (0.0.1)
pg
activerecord-session_store (1.1.3)
actionpack (>= 4.0)
activerecord (>= 4.0)
multi_json (~> 1.11, >= 1.11.2)
rack (>= 1.5.2, < 3)
railties (>= 4.0)
activesupport (5.0.7.2)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 0.7, < 2)
minitest (~> 5.1)
tzinfo (~> 1.1)
acts-as-taggable-on (4.0.0)
activerecord (>= 4.0)
acts_as_list (0.9.19)
activerecord (>= 3.0)
addressable (2.7.0)
public_suffix (>= 2.0.2, < 5.0)
andand (1.3.3)
angular-rails-templates (1.1.0)
railties (>= 4.2, < 7)
sprockets (>= 3.0, < 5)
tilt
angularjs-file-upload-rails (2.4.1)
angularjs-rails (1.5.5)
arel (7.1.4)
ast (2.4.1)
atomic (1.1.101)
awesome_nested_set (3.2.1)
activerecord (>= 4.0.0, < 7.0)
awesome_print (1.8.0)
aws-sdk (1.67.0)
aws-sdk-v1 (= 1.67.0)
aws-sdk-v1 (1.67.0)
json (~> 1.4)
nokogiri (~> 1)
bcrypt (3.1.16)
bugsnag (6.18.0)
concurrent-ruby (~> 1.0)
builder (3.2.4)
byebug (11.0.1)
cancancan (1.7.1)
capybara (3.15.0)
addressable
mini_mime (>= 0.1.3)
nokogiri (~> 1.8)
rack (>= 1.6.0)
rack-test (>= 0.6.3)
regexp_parser (~> 1.2)
xpath (~> 3.2)
childprocess (3.0.0)
chronic (0.10.2)
chunky_png (1.3.14)
climate_control (0.2.0)
cocaine (0.5.8)
climate_control (>= 0.0.3, < 1.0)
coderay (1.1.3)
coffee-rails (4.2.2)
coffee-script (>= 2.2.0)
railties (>= 4.0.0)
coffee-script (2.4.1)
coffee-script-source
execjs
coffee-script-source (1.12.2)
combine_pdf (1.0.19)
ruby-rc4 (>= 0.1.5)
compass (1.0.3)
chunky_png (~> 1.2)
compass-core (~> 1.0.2)
compass-import-once (~> 1.0.5)
rb-fsevent (>= 0.9.3)
rb-inotify (>= 0.9)
sass (>= 3.3.13, < 3.5)
compass-core (1.0.3)
multi_json (~> 1.0)
sass (>= 3.3.0, < 3.5)
compass-import-once (1.0.5)
sass (>= 3.2, < 3.5)
compass-rails (2.0.1)
compass (~> 1.0.0)
concurrent-ruby (1.1.7)
crack (0.4.4)
crass (1.0.6)
css_parser (1.7.1)
addressable
daemons (1.3.1)
dalli (2.7.11)
database_cleaner (1.8.5)
ddtrace (0.43.0)
msgpack
debugger-linecache (1.2.0)
delayed_job (4.1.8)
activesupport (>= 3.0, < 6.1)
delayed_job_active_record (4.1.4)
activerecord (>= 3.0, < 6.1)
delayed_job (>= 3.0, < 5)
delayed_job_web (1.4.3)
activerecord (> 3.0.0)
delayed_job (> 2.0.3)
rack-protection (>= 1.5.5)
sinatra (>= 1.4.4)
devise (4.7.3)
bcrypt (~> 3.0)
orm_adapter (~> 0.1)
railties (>= 4.1.0)
responders
warden (~> 1.2.3)
devise-encryptable (0.2.0)
devise (>= 2.1.0)
devise-token_authenticatable (1.1.0)
devise (>= 4.0.0, < 5.0.0)
diff-lcs (1.4.4)
docile (1.3.2)
erubis (2.7.0)
eventmachine (1.2.7)
execjs (2.7.0)
factory_bot (5.2.0)
activesupport (>= 4.2.0)
factory_bot_rails (5.2.0)
factory_bot (~> 5.2.0)
railties (>= 4.2.0)
faraday (1.0.1)
multipart-post (>= 1.2, < 3)
ffaker (2.11.0)
ffi (1.13.1)
figaro (1.2.0)
thor (>= 0.14.0, < 2)
foundation-icons-sass-rails (3.0.0)
railties (>= 3.1.1)
sass-rails (>= 3.1.1)
foundation-rails (5.5.2.1)
railties (>= 3.1.0)
sass (>= 3.3.0, < 3.5)
fuubar (2.5.1)
rspec-core (~> 3.0)
ruby-progressbar (~> 1.4)
geocoder (1.6.4)
get_process_mem (0.2.7)
ffi (~> 1.0)
globalid (0.4.2)
activesupport (>= 4.2.0)
gmaps4rails (2.1.2)
haml (5.2.0)
temple (>= 0.8.0)
tilt
hashdiff (1.0.1)
highline (2.0.3)
i18n (1.8.5)
concurrent-ruby (~> 1.0)
i18n-js (3.8.0)
i18n (>= 0.6.6)
immigrant (0.3.6)
activerecord (>= 3.0)
jaro_winkler (1.5.4)
jquery-migrate-rails (1.2.1)
jquery-rails (4.4.0)
rails-dom-testing (>= 1, < 3)
railties (>= 4.2.0)
thor (>= 0.14, < 2.0)
jquery-ui-rails (4.2.1)
railties (>= 3.2.16)
json (1.8.6)
json-schema (2.8.1)
addressable (>= 2.4)
json_spec (1.1.5)
multi_json (~> 1.0)
rspec (>= 2.0, < 4.0)
jwt (2.2.2)
kaminari (1.2.1)
activesupport (>= 4.1.0)
kaminari-actionview (= 1.2.1)
kaminari-activerecord (= 1.2.1)
kaminari-core (= 1.2.1)
kaminari-actionview (1.2.1)
actionview
kaminari-core (= 1.2.1)
kaminari-activerecord (1.2.1)
activerecord
kaminari-core (= 1.2.1)
kaminari-core (1.2.1)
kgio (2.11.3)
knapsack (1.20.0)
rake
launchy (2.4.3)
addressable (~> 2.3)
letter_opener (1.7.0)
launchy (~> 2.2)
libv8 (8.4.255.0)
loofah (2.7.0)
crass (~> 1.0.2)
nokogiri (>= 1.5.9)
mail (2.7.1)
mini_mime (>= 0.1.1)
method_source (1.0.0)
mime-types (3.3.1)
mime-types-data (~> 3.2015)
mime-types-data (3.2020.1104)
mini_mime (1.0.2)
mini_portile2 (2.4.0)
mini_racer (0.2.15)
libv8 (> 7.3)
minitest (5.14.2)
monetize (1.9.4)
money (~> 6.12)
money (6.13.8)
i18n (>= 0.6.4, <= 2)
msgpack (1.3.3)
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.2)
nokogiri (1.10.10)
mini_portile2 (~> 2.4.0)
oauth2 (1.4.4)
faraday (>= 0.8, < 2.0)
jwt (>= 1.0, < 3.0)
multi_json (~> 1.3)
multi_xml (~> 0.5)
rack (>= 1.2, < 3)
orm_adapter (0.5.0)
paper_trail (10.3.1)
activerecord (>= 4.2)
request_store (~> 1.1)
paperclip (3.4.2)
activemodel (>= 3.0.0)
activerecord (>= 3.0.0)
activesupport (>= 3.0.0)
cocaine (~> 0.5.0)
mime-types
parallel (1.19.2)
paranoia (2.4.2)
activerecord (>= 4.0, < 6.1)
parser (2.7.2.0)
ast (~> 2.4.1)
paypal-sdk-core (0.2.10)
multi_json (~> 1.0)
xml-simple
paypal-sdk-merchant (1.106.1)
paypal-sdk-core (~> 0.2.3)
pg (0.21.0)
polyamorous (2.3.0)
activerecord (>= 5.0)
power_assert (1.2.0)
pry (0.13.1)
coderay (~> 1.1)
method_source (~> 1.0)
pry-byebug (3.9.0)
byebug (~> 11.0)
pry (~> 0.13.0)
public_suffix (4.0.6)
rack (2.2.3)
rack-mini-profiler (2.0.2)
rack (>= 1.2.0)
rack-protection (2.1.0)
rack
rack-rewrite (1.5.1)
rack-ssl (1.4.1)
rack
rack-test (0.6.3)
rack (>= 1.0)
rails (5.0.7.2)
actioncable (= 5.0.7.2)
actionmailer (= 5.0.7.2)
actionpack (= 5.0.7.2)
actionview (= 5.0.7.2)
activejob (= 5.0.7.2)
activemodel (= 5.0.7.2)
activerecord (= 5.0.7.2)
activesupport (= 5.0.7.2)
bundler (>= 1.3.0)
railties (= 5.0.7.2)
sprockets-rails (>= 2.0.0)
rails-dom-testing (2.0.3)
activesupport (>= 4.2.0)
nokogiri (>= 1.6)
rails-html-sanitizer (1.3.0)
loofah (~> 2.3)
rails-i18n (5.1.3)
i18n (>= 0.7, < 2)
railties (>= 5.0, < 6)
rails_safe_tasks (1.0.0)
railties (5.0.7.2)
actionpack (= 5.0.7.2)
activesupport (= 5.0.7.2)
method_source
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
rainbow (3.0.0)
raindrops (0.19.1)
rake (13.0.1)
ransack (2.3.0)
actionpack (>= 5.0)
activerecord (>= 5.0)
activesupport (>= 5.0)
i18n
polyamorous (= 2.3.0)
rb-fsevent (0.10.4)
rb-inotify (0.10.1)
ffi (~> 1.0)
redcarpet (3.5.0)
regexp_parser (1.8.2)
request_store (1.5.0)
rack (>= 1.4)
responders (2.4.1)
actionpack (>= 4.2.0, < 6.0)
railties (>= 4.2.0, < 6.0)
rexml (3.2.4)
roadie (3.5.1)
css_parser (~> 1.4)
nokogiri (~> 1.8)
roadie-rails (1.3.0)
railties (>= 3.0, < 5.3)
roadie (~> 3.1)
roo (2.8.3)
nokogiri (~> 1)
rubyzip (>= 1.3.0, < 3.0.0)
rspec (3.10.0)
rspec-core (~> 3.10.0)
rspec-expectations (~> 3.10.0)
rspec-mocks (~> 3.10.0)
rspec-core (3.10.0)
rspec-support (~> 3.10.0)
rspec-expectations (3.10.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.10.0)
rspec-mocks (3.10.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.10.0)
rspec-rails (4.0.1)
actionpack (>= 4.2)
activesupport (>= 4.2)
railties (>= 4.2)
rspec-core (~> 3.9)
rspec-expectations (~> 3.9)
rspec-mocks (~> 3.9)
rspec-support (~> 3.9)
rspec-retry (0.6.2)
rspec-core (> 3.3)
rspec-support (3.10.0)
rswag (2.3.1)
rswag-api (= 2.3.1)
rswag-specs (= 2.3.1)
rswag-ui (= 2.3.1)
rswag-api (2.3.1)
railties (>= 3.1, < 7.0)
rswag-specs (2.3.1)
activesupport (>= 3.1, < 7.0)
json-schema (~> 2.2)
railties (>= 3.1, < 7.0)
rswag-ui (2.3.1)
actionpack (>= 3.1, < 7.0)
railties (>= 3.1, < 7.0)
rubocop (0.81.0)
jaro_winkler (~> 1.5.1)
parallel (~> 1.10)
parser (>= 2.7.0.1)
rainbow (>= 2.2.2, < 4.0)
rexml
ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 2.0)
rubocop-rails (2.5.2)
activesupport
rack (>= 1.1)
rubocop (>= 0.72.0)
ruby-progressbar (1.10.1)
ruby-rc4 (0.1.5)
ruby2_keywords (0.0.2)
rubyzip (1.3.0)
sass (3.4.25)
sass-rails (5.0.7)
railties (>= 4.0.0, < 6)
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)
shoulda-matchers (4.0.1)
activesupport (>= 4.2.0)
simplecov (0.17.1)
docile (~> 1.1)
json (>= 1.8, < 3)
simplecov-html (~> 0.10.0)
simplecov-html (0.10.2)
sinatra (2.1.0)
mustermann (~> 1.0)
rack (~> 2.2)
rack-protection (= 2.1.0)
tilt (~> 2.0)
spring (2.0.2)
activesupport (>= 4.2)
spring-commands-rspec (1.0.4)
spring (>= 0.9.1)
sprockets (3.7.2)
concurrent-ruby (~> 1.0)
rack (> 1, < 3)
sprockets-rails (3.2.2)
actionpack (>= 4.0)
activesupport (>= 4.0)
sprockets (>= 3.0.0)
state_machines (0.5.0)
state_machines-activemodel (0.7.1)
activemodel (>= 4.1)
state_machines (>= 0.5.0)
state_machines-activerecord (0.6.0)
activerecord (>= 4.1)
state_machines-activemodel (>= 0.5.0)
stringex (2.8.5)
stripe (5.28.0)
temple (0.8.2)
test-prof (0.7.5)
test-unit (3.3.7)
power_assert
test_after_commit (1.1.0)
activerecord (>= 3.2)
thor (0.20.3)
thread_safe (0.3.6)
tilt (2.0.10)
timecop (0.9.2)
tzinfo (1.2.8)
thread_safe (~> 0.1)
uglifier (4.2.0)
execjs (>= 0.3.0, < 3)
unicode-display_width (1.7.0)
unicorn (5.7.0)
kgio (~> 2.6)
raindrops (~> 0.7)
unicorn-rails (2.2.1)
rack
unicorn
unicorn-worker-killer (0.4.4)
get_process_mem (~> 0)
unicorn (>= 4, < 6)
warden (1.2.9)
rack (>= 2.0.9)
webdrivers (4.2.0)
nokogiri (~> 1.6)
rubyzip (>= 1.3.0)
selenium-webdriver (>= 3.0, < 4.0)
webmock (3.10.0)
addressable (>= 2.3.6)
crack (>= 0.3.2)
hashdiff (>= 0.4.0, < 2.0.0)
websocket-driver (0.6.5)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.5)
whenever (1.0.0)
chronic (>= 0.6.3)
wicked_pdf (2.1.0)
activesupport
wkhtmltopdf-binary (0.12.6.5)
xml-simple (1.1.5)
xpath (3.2.0)
nokogiri (~> 1.8)
PLATFORMS
ruby
DEPENDENCIES
actionpack-action_caching
active_model_serializers (= 0.8.4)
activemerchant (>= 1.78.0)
activerecord-import
activerecord-postgresql-adapter
activerecord-session_store
acts-as-taggable-on (~> 4.0)
acts_as_list (= 0.9.19)
andand
angular-rails-templates (>= 0.3.0)
angularjs-file-upload-rails (~> 2.4.1)
angularjs-rails (= 1.5.5)
atomic
awesome_nested_set
awesome_print
aws-sdk (= 1.67.0)
bugsnag
byebug
cancancan (~> 1.7.0)
capybara
catalog!
coffee-rails (~> 4.2.2)
combine_pdf
compass-rails
custom_error_message!
daemons
dalli
database_cleaner
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 (= 5.2.0)
ffaker
figaro
foundation-icons-sass-rails
foundation-rails (= 5.5.2.1)
fuubar (~> 2.5.1)
geocoder
gmaps4rails
haml
highline (= 2.0.3)
i18n
i18n-js (~> 3.8.0)
immigrant
jquery-migrate-rails
jquery-rails (= 4.4.0)
jquery-ui-rails (~> 4.2)
json
json_spec (~> 1.1.4)
jwt (~> 2.2)
kaminari (~> 1.2.1)
knapsack
letter_opener (>= 1.4.1)
mini_racer (= 0.2.15)
monetize (~> 1.1)
oauth2 (~> 1.4.4)
ofn-qz!
order_management!
paper_trail (~> 10.3.1)
paperclip (~> 3.4.1)
paranoia (~> 2.4)
paypal-sdk-merchant (= 1.106.1)
pg (~> 0.21.0)
pry
pry-byebug
rack-mini-profiler (< 3.0.0)
rack-rewrite
rack-ssl
rails (> 5.0, < 5.1)
rails-i18n
rails_safe_tasks (~> 1.0)
ransack (= 2.3.0)
redcarpet
responders
roadie-rails (~> 1.3.0)
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)
selenium-webdriver
shoulda-matchers
simplecov
spring
spring-commands-rspec
state_machines-activerecord
stringex (~> 2.8.5)
stripe
test-prof
test-unit (~> 3.3)
test_after_commit
timecop
uglifier (>= 1.0.3)
unicorn-rails
unicorn-worker-killer
web!
webdrivers
webmock
whenever
wicked_pdf
wkhtmltopdf-binary
RUBY VERSION
ruby 2.4.4p296
BUNDLED WITH
1.17.3

View File

@@ -33,7 +33,9 @@ We also have a [Super Admin Guide][super-admin-guide] to help with configuration
## Testing
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!
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.
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!
## Licence
@@ -45,3 +47,4 @@ Copyright (c) 2012 - 2020 Open Food Foundation, released under the AGPL licence.
[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
[zenhub]: https://www.zenhub.com/extension

View File

@@ -1,4 +1,6 @@
#!/usr/bin/env rake
# frozen_string_literal: true
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.

View File

@@ -16,7 +16,7 @@ angular.module("admin.indexUtils").factory "PagedFetcher", (dataFetcher) ->
fetchPages: (url, page, pageCallback) ->
dataFetcher(@urlForPage(url, page)).then (data) =>
@page++
@last_page = data.pages
@last_page = data.pagination.pages
pageCallback(data) if pageCallback

View File

@@ -127,7 +127,16 @@ $(document).ready(function() {
nextText: Spree.translations.next,
showOn: "focus"
});
$.datepicker.regional[I18n.locale] = {
prevText: Spree.translations.previous,
nextText: Spree.translations.next,
monthNames: Spree.translations.month_names,
dayNames: Spree.translations.abbr_day_names,
dayNamesMin: Spree.translations.abbr_day_names,
dateFormat: Spree.translations.date_picker
};
$.datepicker.setDefaults( $.datepicker.regional[I18n.locale]);
// Correctly display range dates
$('.date-range-filter .datepicker-from').datepicker('option', 'onSelect', function(selectedDate) {
$(".date-range-filter .datepicker-to" ).datepicker( "option", "minDate", selectedDate );

View File

@@ -0,0 +1,17 @@
//= require admin/spree_backend
SpreePaypalExpress = {
hideSettings: function(paymentMethod) {
if (SpreePaypalExpress.paymentMethodID && paymentMethod.val() == SpreePaypalExpress.paymentMethodID) {
$('.payment-method-settings').children().hide();
$('#payment_amount').prop('disabled', 'disabled');
$('button[type="submit"]').prop('disabled', 'disabled');
$('#paypal-warning').show();
} else if (SpreePaypalExpress.paymentMethodID) {
$('.payment-method-settings').children().show();
$('button[type=submit]').prop('disabled', '');
$('#payment_amount').prop('disabled', '');
$('#paypal-warning').hide();
}
}
}

View File

@@ -1,7 +1,7 @@
Darkswarm.controller "CreditCardsCtrl", ($scope, CreditCard, CreditCards) ->
angular.extend(this, new FieldsetMixin($scope))
$scope.savedCreditCards = CreditCards.saved
$scope.setDefault = CreditCards.setDefault
$scope.confirmSetDefault = CreditCards.confirmSetDefault
$scope.CreditCard = CreditCard
$scope.secrets = CreditCard.secrets
$scope.showForm = CreditCard.show

View File

@@ -25,3 +25,6 @@ Darkswarm.controller "OrderCycleChangeCtrl", ($scope, $rootScope, $timeout, Orde
Cart.reloadFinalisedLineItems()
ChangeableOrdersAlert.reload()
$rootScope.$broadcast 'orderCycleSelected'
$scope.closesInLessThan3Months = () ->
moment().diff(moment(OrderCycle.orders_close_at(), "YYYY-MM-DD HH:mm:SS Z"), 'days') > -75

View File

@@ -5,15 +5,13 @@ Darkswarm.directive "tabsetCtrl", (Tabsets, $location) ->
selected: "@"
navigate: "="
prefix: "@?"
alwaysopen: "="
controller: ($scope, $element) ->
if $scope.navigate
path = $location.path()?.match(/^\/\w+$/)?[0]
$scope.selected = path[1..] if path
this.toggle = (name) ->
state = if $scope.alwaysopen then 'open' else null
Tabsets.toggle($scope.id, name, state)
Tabsets.toggle($scope.id, name)
this.select = (selection) ->
$scope.$broadcast("selection:changed", selection)

View File

@@ -6,7 +6,7 @@ Darkswarm.filter "localizeCurrency", (currencyConfig)->
# Set decimal points, 2 or 0 if hide_cents.
decimals = if currencyConfig.hide_cents == "true" then 0 else 2
# Set format if the currency symbol should come after the number, otherwise (default) use the locale setting.
format = if currencyConfig.symbol_position == "after" then "%n %u" else undefined
format = if currencyConfig.symbol_position == "after" then "%n%u" else undefined
# We need to use parseFloat as the amount should come in as a string.
amount = parseFloat(amount)

View File

@@ -50,7 +50,7 @@ Darkswarm.factory 'Cart', (CurrentOrder, Variants, $timeout, $http, $modal, $roo
@popQueue() if @update_enqueued
.error (response, status)=>
Messages.flash({error: t('js.cart.add_to_cart_failed')})
Messages.flash({error: response.error})
@update_running = false
compareAndNotifyStockLevels: (stockLevels) =>

View File

@@ -1,4 +1,4 @@
Darkswarm.factory 'CreditCards', ($http, $filter, savedCreditCards, Messages)->
Darkswarm.factory 'CreditCards', ($http, $filter, savedCreditCards, Messages, Customers)->
new class CreditCard
saved: $filter('orderBy')(savedCreditCards,'-is_default')
@@ -11,5 +11,13 @@ Darkswarm.factory 'CreditCards', ($http, $filter, savedCreditCards, Messages)->
othercard.is_default = false
$http.put("/credit_cards/#{card.id}", is_default: true).then (data) ->
Messages.success(t('js.default_card_updated'))
Customers.clearAllAllowCharges()
, (response) ->
Messages.flash(response.data.flash)
confirmSetDefault: (card, event) =>
if confirm t("js.default_card_voids_auth")
@setDefault(card)
else
event.preventDefault()
return false

View File

@@ -1,4 +1,4 @@
angular.module("Darkswarm").factory 'Customer', ($resource, Messages) ->
angular.module("Darkswarm").factory 'Customer', ($resource, $injector, Messages) ->
Customer = $resource('/api/customers/:id/:action.json', {}, {
'index':
method: 'GET'
@@ -12,8 +12,21 @@ angular.module("Darkswarm").factory 'Customer', ($resource, Messages) ->
})
Customer.prototype.update = ->
if @allow_charges
Messages.loading(t('js.authorising'))
@$update().then (response) =>
Messages.success(t('js.changes_saved'))
if response.gateway_recurring_payment_client_secret && $injector.has('stripePublishableKey')
Messages.clear()
stripe = Stripe($injector.get('stripePublishableKey'), { stripeAccount: response.gateway_shop_id })
stripe.confirmCardSetup(response.gateway_recurring_payment_client_secret).then (result) =>
if result.error
@allow_charges = false
@$update(allow_charges: false)
Messages.error(result.error.message)
else
Messages.success(t('js.changes_saved'))
else
Messages.success(t('js.changes_saved'))
, (response) =>
Messages.error(response.data.error)

View File

@@ -12,3 +12,7 @@ angular.module("Darkswarm").factory 'Customers', (Customer) ->
for customer in customers
@all.push customer
@byID[customer.id] = customer
clearAllAllowCharges: () ->
for customer in @index()
customer.allow_charges = false

View File

@@ -1,21 +1,21 @@
Darkswarm.factory 'OrderCycleResource', ($resource) ->
$resource('/api/order_cycles/:id', {}, {
$resource('/api/order_cycles/:id.json', {}, {
'products':
method: 'GET'
isArray: true
url: '/api/order_cycles/:id/products'
url: '/api/order_cycles/:id/products.json'
params:
id: '@id'
'taxons':
method: 'GET'
isArray: true
url: '/api/order_cycles/:id/taxons'
url: '/api/order_cycles/:id/taxons.json'
params:
id: '@id'
'properties':
method: 'GET'
isArray: true
url: '/api/order_cycles/:id/properties'
url: '/api/order_cycles/:id/properties.json'
params:
id: '@id'
})

View File

@@ -7,12 +7,10 @@ Darkswarm.factory 'Tabsets', ->
@tabsets.push { ctrl: ctrl, id: id, selected: selected }
ctrl.select(selected) if selected?
toggle: (id, name, state=null) ->
toggle: (id, name) ->
tabset = @findTabsetByObject(id)
if tabset.selected == name
@select(tabset, null) unless state == "open"
else
@select(tabset, name) unless state == "closed"
if tabset.selected != name
@select(tabset, name)
select: (tabset, name) ->
tabset.selected = name

View File

@@ -14,8 +14,9 @@
{{'hubs_delivery' | t}}
.row
.columns.small-12
%a.cta-hub{"ng-href" => "{{::enterprise.path}}", "ng-attr-target" => "{{ embedded_layout ? '_blank' : undefined}}",
%a.cta-hub{"ng-href" => "{{::enterprise.path}}#/shop", "ng-attr-target" => "{{ embedded_layout ? '_blank' : undefined}}",
"ng-class" => "{primary: enterprise.active, secondary: !enterprise.active}",
"ng-click" => "$close()",
"ofn-change-hub" => "enterprise"}
.hub-name{"ng-bind" => "::enterprise.name"}
%span{"ng-if" => "::enterprise.active"} ({{'maps_open' | t}})

View File

@@ -12,8 +12,9 @@
.row
.columns.small-12
%a.cta-hub{"ng-repeat" => "hub in enterprise.hubs | filter:{id: '!'+enterprise.id} | orderBy:'-active'",
"ng-href" => "{{::hub.path}}", "ofn-empties-cart" => "hub",
"ng-class" => "::{primary: hub.active, secondary: !hub.active}"}
"ng-href" => "{{::hub.path}}#/shop", "ofn-empties-cart" => "hub",
"ng-class" => "::{primary: hub.active, secondary: !hub.active}",
"ng-click" => "$close()"}
.hub-name{"ng-bind" => "::hub.name"}
%span{"ng-if" => "::hub.active"} ({{'maps_open' | t}})
%span{"ng-if" => "::!hub.active"} ({{'maps_closed' | t}})

View File

@@ -29,9 +29,12 @@ button.add-variant, button.variant-quantity {
&:hover {
background-color: $orange-600;
}
&[disabled] {
background-color: $grey-400;
&:hover, &:focus {
background-color: $orange-500;
background-color: $grey-400;
}
}
&:nth-of-type(1) {
@@ -84,14 +87,6 @@ button.bulk-buy.variant-quantity {
button.bulk-buy-add.variant-quantity {
width: 2.5rem;
&[disabled] {
background-color: $grey-400;
&:hover, &:focus {
background-color: $grey-400;
}
}
}
span.bulk-buy.variant-quantity {

View File

@@ -41,19 +41,21 @@ ordercycle {
.order-cycle-select {
border: 1px solid $teal-300;
display: inline-block;
display: flex;
font-size: 1em;
border-radius: $radius-small;
margin-right: 10px;
margin-left: 10px;
.select-label {
background-color: rgba($teal-300, 0.5);
display: inline-block;
display: flex;
align-items: center;
justify-content: center;
border-radius: $radius-small 0 0 $radius-small;
float: left;
font-size: 1em;
line-height: 1.3em;
padding: 0.5em 0.75em;
height: 2.35em;
span {
width: max-content;
@@ -65,6 +67,7 @@ ordercycle {
background-image: image-url('white-caret.svg');
background-size: 30px auto;
background-position-x: 102%;
height: 2.35em;
}
p {
@@ -82,7 +85,6 @@ ordercycle {
padding: 0.5em 1.25em 0.5em 0.75em;
font-size: 1em;
line-height: 1.3em;
height: 2.35em;
min-width: 13em;
width: 200px;
@@ -154,22 +156,24 @@ shop ordercycle {
}
}
.select-and-closing-container {
@include breakpoint(desktop) {
display: flex;
align-items: center;
justify-content: center;
flex-wrap: wrap;
}
}
closing {
color: $white;
padding: 0 0 12px;
@include breakpoint(desktop) {
float: none;
display: inline-block;
padding: 0.2em 0 0;
padding: 0;
font-size: 1.2em;
margin-right: 1em;
}
@include breakpoint(tablet) {
float: none;
padding: 0;
}
}
form.custom {

View File

@@ -59,6 +59,7 @@
// Variant price
.variant-price {
white-space: nowrap;
@include breakpoint(phablet) {
padding-left: 1rem;
}

View File

@@ -1,5 +1,6 @@
module Admin
class BulkLineItemsController < Spree::Admin::BaseController
include PaginationData
# GET /admin/bulk_line_items.json
#
def index
@@ -12,9 +13,12 @@ module Admin
ransack(params[:q]).result.
reorder('spree_line_items.order_id ASC, spree_line_items.id ASC')
@line_items = @line_items.page(page).per(params[:per_page]) if using_pagination?
@line_items = @line_items.page(page).per(params[:per_page]) if pagination_required?
render json: { line_items: serialized_line_items, pagination: pagination_data }
render json: {
line_items: serialized_line_items,
pagination: pagination_data(@line_items)
}
end
# PUT /admin/bulk_line_items/:id.json
@@ -87,21 +91,6 @@ module Admin
::Permissions::Order.new(spree_current_user)
end
def using_pagination?
params[:per_page]
end
def pagination_data
return unless using_pagination?
{
results: @line_items.total_count,
pages: @line_items.num_pages,
page: page.to_i,
per_page: params[:per_page].to_i
}
end
def page
params[:page] || 1
end

View File

@@ -1,5 +1,5 @@
module Admin
class ColumnPreferencesController < ResourceController
class ColumnPreferencesController < Admin::ResourceController
before_action :load_collection, only: [:bulk_update]
respond_to :json

View File

@@ -1,7 +1,7 @@
require 'open_food_network/address_finder'
module Admin
class CustomersController < ResourceController
class CustomersController < Admin::ResourceController
before_action :load_managed_shops, only: :index, if: :html_request?
respond_to :json
@@ -17,13 +17,22 @@ module Admin
respond_to do |format|
format.html
format.json do
render_as_json @collection,
tag_rule_mapping: tag_rule_mapping,
customer_tags: customer_tags_by_id
render json: @collection,
each_serializer: index_each_serializer,
tag_rule_mapping: tag_rule_mapping,
customer_tags: customer_tags_by_id
end
end
end
def index_each_serializer
if OpenFoodNetwork::FeatureToggle.enabled?(:customer_balance, spree_current_user)
::Api::Admin::CustomerWithBalanceSerializer
else
::Api::Admin::CustomerWithCalculatedBalanceSerializer
end
end
def show
render_as_json @customer, ams_prefix: params[:ams_prefix]
end
@@ -42,7 +51,7 @@ module Admin
end
end
# copy of Spree::Admin::ResourceController without flash notice
# copy of Admin::ResourceController without flash notice
def destroy
invoke_callbacks(:destroy, :before)
if @object.destroy
@@ -63,10 +72,20 @@ module Admin
private
def collection
return Customer.where("1=0") unless json_request? && params[:enterprise_id].present?
if json_request? && params[:enterprise_id].present?
customers_relation.
includes(:bill_address, :ship_address, user: :credit_cards)
else
Customer.where('1=0')
end
end
Customer.of(managed_enterprise_id).
includes(:bill_address, :ship_address, user: :credit_cards)
def customers_relation
if OpenFoodNetwork::FeatureToggle.enabled?(:customer_balance, spree_current_user)
CustomersWithBalance.new(managed_enterprise_id).query
else
Customer.of(managed_enterprise_id)
end
end
def managed_enterprise_id
@@ -95,7 +114,7 @@ module Admin
)
end
# Used in ResourceController#update
# Used in Admin::ResourceController#update
def permitted_resource_params
customer_params
end

View File

@@ -1,5 +1,5 @@
module Admin
class EnterpriseFeesController < ResourceController
class EnterpriseFeesController < Admin::ResourceController
before_action :load_enterprise_fee_set, only: :index
before_action :load_data

View File

@@ -1,5 +1,5 @@
module Admin
class EnterpriseGroupsController < ResourceController
class EnterpriseGroupsController < Admin::ResourceController
before_action :load_data, except: :index
before_action :load_object_data, only: [:new, :edit, :create, :update]

View File

@@ -1,5 +1,5 @@
module Admin
class EnterpriseRelationshipsController < ResourceController
class EnterpriseRelationshipsController < Admin::ResourceController
def index
@my_enterprises = Enterprise.
includes(:shipping_methods, :payment_methods).

View File

@@ -1,5 +1,5 @@
module Admin
class EnterpriseRolesController < ResourceController
class EnterpriseRolesController < Admin::ResourceController
def index
@enterprise_roles = EnterpriseRole.by_user_email
@users = Spree::User.order('spree_users.email')

View File

@@ -3,7 +3,7 @@ require 'open_food_network/permissions'
require 'open_food_network/order_cycle_permissions'
module Admin
class EnterprisesController < ResourceController
class EnterprisesController < Admin::ResourceController
# These need to run before #load_resource so that @object is initialised with sanitised values
prepend_before_action :override_owner, only: :create
prepend_before_action :override_sells, only: :create
@@ -81,14 +81,14 @@ module Admin
end
def bulk_update
@enterprise_set = EnterpriseSet.new(collection, params[:enterprise_set])
@enterprise_set = EnterpriseSet.new(collection, bulk_params)
if @enterprise_set.save
flash[:success] = I18n.t(:enterprise_bulk_update_success_notice)
redirect_to main_app.admin_enterprises_path
else
touched_enterprises = @enterprise_set.collection.select(&:changed?)
@enterprise_set.collection.select! { |e| touched_enterprises.include? e }
@enterprise_set.collection.to_a.select! { |e| touched_enterprises.include? e }
flash[:error] = I18n.t(:enterprise_bulk_update_error)
render :index
end
@@ -214,7 +214,8 @@ module Admin
rule = @object.tag_rules.find_by(id: attrs.delete(:id)) ||
attrs[:type].constantize.new(enterprise: @object)
create_calculator_for(rule, attrs) if rule.type == "TagRule::DiscountOrder" && rule.calculator.nil?
rule.update(attrs)
rule.update(attrs.permit(PermittedAttributes::TagRules.attributes))
end
end
end
@@ -319,7 +320,13 @@ module Admin
PermittedAttributes::Enterprise.new(params).call
end
# Used in ResourceController#create
def bulk_params
params.require(:enterprise_set).permit(
collection_attributes: PermittedAttributes::Enterprise.attributes
)
end
# Used in Admin::ResourceController#create
def permitted_resource_params
enterprise_params
end

View File

@@ -1,5 +1,5 @@
module Admin
class InventoryItemsController < ResourceController
class InventoryItemsController < Admin::ResourceController
respond_to :json
respond_override update: { json: {

View File

@@ -35,7 +35,7 @@ module Admin
new_user.save!
@enterprise.users << new_user
Delayed::Job.enqueue ManagerInvitationJob.new(@enterprise.id, new_user.id)
EnterpriseMailer.manager_invitation(@enterprise, new_user).deliver_later
new_user
end

View File

@@ -1,5 +1,5 @@
module Admin
class OrderCyclesController < ResourceController
class OrderCyclesController < Admin::ResourceController
include OrderCyclesHelper
include PaperTrailLogging
@@ -91,7 +91,7 @@ module Admin
# Send notifications to all producers who are part of the order cycle
def notify_producers
Delayed::Job.enqueue OrderCycleNotificationJob.new(params[:id].to_i)
OrderCycleNotificationJob.perform_later params[:id].to_i
redirect_to main_app.admin_order_cycles_path,
notice: I18n.t(:order_cycles_email_to_producers_notice)

View File

@@ -1,5 +1,5 @@
module Admin
class ProducerPropertiesController < ResourceController
class ProducerPropertiesController < Admin::ResourceController
before_action :load_enterprise
before_action :load_properties
before_action :setup_property, only: [:index]

View File

@@ -1,5 +1,5 @@
module Admin
class ProxyOrdersController < ResourceController
class ProxyOrdersController < Admin::ResourceController
respond_to :json
def edit

View File

@@ -1,41 +1,303 @@
require 'action_callbacks'
module Admin
class ResourceController < Spree::Admin::ResourceController
class ResourceController < Spree::Admin::BaseController
helper_method :new_object_url, :edit_object_url, :object_url, :collection_url
before_action :load_resource, except: [:update_positions]
rescue_from ActiveRecord::RecordNotFound, with: :resource_not_found
rescue_from CanCan::AccessDenied, with: :unauthorized
respond_to :html
respond_to :js, except: [:show, :index]
def new
invoke_callbacks(:new_action, :before)
respond_with(@object) do |format|
format.html { render layout: !request.xhr? }
format.js { render layout: false }
end
end
def edit
respond_with(@object) do |format|
format.html { render layout: !request.xhr? }
format.js { render layout: false }
end
end
def update
invoke_callbacks(:update, :before)
if @object.update(permitted_resource_params)
invoke_callbacks(:update, :after)
flash[:success] = flash_message_for(@object, :successfully_updated)
respond_with(@object) do |format|
format.html { redirect_to location_after_save }
format.js { render layout: false }
end
else
invoke_callbacks(:update, :fails)
respond_with(@object)
end
end
def create
invoke_callbacks(:create, :before)
@object.attributes = permitted_resource_params
if @object.save
invoke_callbacks(:create, :after)
flash[:success] = flash_message_for(@object, :successfully_created)
respond_with(@object) do |format|
format.html { redirect_to location_after_save }
format.js { render layout: false }
end
else
invoke_callbacks(:create, :fails)
respond_with(@object)
end
end
def update_positions
params[:positions].each do |id, index|
model_class.where(id: id).update_all(position: index)
end
respond_to do |format|
format.js { render text: 'Ok' }
end
end
def destroy
invoke_callbacks(:destroy, :before)
if @object.destroy
invoke_callbacks(:destroy, :after)
flash[:success] = flash_message_for(@object, :successfully_removed)
respond_with(@object) do |format|
format.html { redirect_to collection_url }
format.js { render partial: "spree/admin/shared/destroy" }
end
else
invoke_callbacks(:destroy, :fails)
respond_with(@object) do |format|
format.html { redirect_to collection_url }
end
end
end
protected
def resource_not_found
flash[:error] = flash_message_for(model_class.new, :not_found)
redirect_to collection_url
end
class << self
attr_accessor :parent_data
attr_accessor :callbacks
def belongs_to(model_name, options = {})
@parent_data ||= {}
@parent_data[:model_name] = model_name
@parent_data[:model_class] = model_name.to_s.classify.constantize
@parent_data[:find_by] = options[:find_by] || :id
end
def new_action
@callbacks ||= {}
@callbacks[:new_action] ||= ActionCallbacks.new
end
def create
@callbacks ||= {}
@callbacks[:create] ||= ActionCallbacks.new
end
def update
@callbacks ||= {}
@callbacks[:update] ||= ActionCallbacks.new
end
def destroy
@callbacks ||= {}
@callbacks[:destroy] ||= ActionCallbacks.new
end
end
def model_class
controller_name.classify.to_s.constantize
controller_class_name.constantize
end
def model_name
parent_data[:model_name].gsub('spree/', '')
end
def object_name
controller_name.singularize
end
def load_resource
if member_action?
@object ||= load_resource_instance
# call authorize! a third time (called twice already in Admin::BaseController)
# this time we pass the actual instance so fine-grained abilities can control
# access to individual records, not just entire models.
authorize! action, @object
instance_variable_set("@#{object_name}", @object)
# If we don't have access, clear the object
unless can? action, @object
instance_variable_set("@#{object_name}", nil)
end
authorize! action, @object
else
@collection ||= collection
# note: we don't call authorize here as the collection method should use
# CanCan's accessible_by method to restrict the actual records returned
instance_variable_set("@#{controller_name}", @collection)
end
end
def load_resource_instance
if new_actions.include?(action)
build_resource
elsif params[:id]
find_resource
end
end
def parent_data
self.class.parent_data
end
def parent
return nil if parent_data.blank?
@parent ||= parent_data[:model_class].
public_send("find_by", parent_data[:find_by] => params["#{model_name}_id"])
instance_variable_set("@#{model_name}", @parent)
end
def find_resource
if parent_data.present?
parent.public_send(controller_name).find(params[:id])
else
model_class.find(params[:id])
end
end
def build_resource
if parent_data.present?
parent.public_send(controller_name).build
else
model_class.new
end
end
def collection
return parent.public_send(controller_name) if parent_data.present?
if model_class.respond_to?(:accessible_by) &&
!current_ability.has_block?(params[:action], model_class)
model_class.accessible_by(current_ability, action)
else
model_class.scoped
end
end
def location_after_save
collection_url
end
def invoke_callbacks(action, callback_type)
callbacks = self.class.callbacks || {}
return if callbacks[action].nil?
case callback_type.to_sym
when :before then callbacks[action].before_methods.each { |method| __send__ method }
when :after then callbacks[action].after_methods.each { |method| __send__ method }
when :fails then callbacks[action].fails_methods.each { |method| __send__ method }
end
end
# URL helpers
def new_object_url(options = {})
if parent_data.present?
main_app.new_polymorphic_url([:admin, parent, model_class], options)
url_helper.new_polymorphic_url([:admin, parent, model_class], options)
else
main_app.new_polymorphic_url([:admin, model_class], options)
url_helper.new_polymorphic_url([:admin, model_class], options)
end
end
def edit_object_url(object, options = {})
if parent_data.present?
main_app.public_send "edit_admin_#{model_name}_#{object_name}_url", parent, object, options
url_helper.public_send "edit_admin_#{model_name}_#{object_name}_url",
parent, object, options
else
main_app.public_send "edit_admin_#{object_name}_url", object, options
url_helper.public_send "edit_admin_#{object_name}_url",
object, options
end
end
def object_url(object = nil, options = {})
target = object || @object
if parent_data.present?
main_app.public_send "admin_#{model_name}_#{object_name}_url", parent, target, options
url_helper.public_send "admin_#{model_name}_#{object_name}_url", parent, target, options
else
main_app.public_send "admin_#{object_name}_url", target, options
url_helper.public_send "admin_#{object_name}_url", target, options
end
end
# Permit specific list of params
#
# Example: params.require(object_name).permit(:name)
def permitted_resource_params
raise "All extending controllers need to override the method permitted_resource_params"
end
def collection_url(options = {})
if parent_data.present?
main_app.polymorphic_url([:admin, parent, model_class], options)
url_helper.polymorphic_url([:admin, parent, model_class], options)
else
main_app.polymorphic_url([:admin, model_class], options)
url_helper.polymorphic_url([:admin, model_class], options)
end
end
def collection_actions
[:index]
end
def member_action?
!collection_actions.include? action
end
def new_actions
[:new, :create]
end
private
def controller_class_name
if spree_controller?
"Spree::#{controller_name.classify}"
else
controller_name.classify.to_s
end
end
def url_helper
if spree_controller?
spree
else
main_app
end
end
def spree_controller?
controller_path.starts_with? "spree"
end
end
end

View File

@@ -2,7 +2,7 @@ require 'open_food_network/permissions'
require 'order_management/subscriptions/proxy_order_syncer'
module Admin
class SchedulesController < ResourceController
class SchedulesController < Admin::ResourceController
include PaperTrailLogging
before_action :adapt_params, only: [:update]

View File

@@ -3,7 +3,7 @@ require 'open_food_network/order_cycle_permissions'
require 'open_food_network/scope_variant_to_hub'
module Admin
class SubscriptionLineItemsController < ResourceController
class SubscriptionLineItemsController < Admin::ResourceController
before_action :load_build_context, only: [:build]
before_action :ensure_shop, only: [:build]
before_action :ensure_variant, only: [:build]

View File

@@ -1,7 +1,7 @@
require 'open_food_network/permissions'
module Admin
class SubscriptionsController < ResourceController
class SubscriptionsController < Admin::ResourceController
before_action :load_shops, only: [:index]
before_action :load_form_data, only: [:new, :edit]
before_action :strip_banned_attrs, only: [:update]

View File

@@ -1,5 +1,5 @@
module Admin
class TagRulesController < ResourceController
class TagRulesController < Admin::ResourceController
respond_to :json
respond_override destroy: { json: {

View File

@@ -1,7 +1,7 @@
require 'open_food_network/spree_api_key_loader'
module Admin
class VariantOverridesController < ResourceController
class VariantOverridesController < Admin::ResourceController
include OpenFoodNetwork::SpreeApiKeyLoader
include EnterprisesHelper

View File

@@ -5,17 +5,19 @@ require "spree/core/controller_helpers/ssl"
module Api
class BaseController < ActionController::Metal
include ActionController::StrongParameters
include ActionController::RespondWith
include Spree::Api::ControllerSetup
include Spree::Core::ControllerHelpers::SSL
include ::ActionController::Head
include ::ActionController::ConditionalGet
include ActionView::Layouts
respond_to :json
layout false
attr_accessor :current_api_user
before_action :set_content_type
before_action :authenticate_user
after_action :set_jsonp_format
rescue_from Exception, with: :error_during_processing
rescue_from CanCan::AccessDenied, with: :unauthorized
@@ -34,13 +36,6 @@ module Api
use_renderers :json
check_authorization
def set_jsonp_format
return unless params[:callback] && request.get?
self.response_body = "#{params[:callback]}(#{response_body})"
headers["Content-Type"] = 'application/javascript'
end
def respond_with_conflict(json_hash)
render json: json_hash, status: :conflict
end
@@ -63,17 +58,13 @@ module Api
end
def set_content_type
content_type = case params[:format]
when "json"
"application/json"
when "xml"
"text/xml"
end
headers["Content-Type"] = content_type
headers["Content-Type"] = "application/json"
end
def error_during_processing(exception)
render(text: { exception: exception.message }.to_json,
Bugsnag.notify(exception)
render(json: { exception: exception.message },
status: :unprocessable_entity) && return
end

View File

@@ -11,13 +11,25 @@ module Api
@customer = Customer.find(params[:id])
authorize! :update, @customer
client_secret = RecurringPayments.setup_for(@customer) if params[:customer][:allow_charges]
if @customer.update(customer_params)
add_recurring_payment_info(client_secret)
render json: @customer, serializer: CustomerSerializer, status: :ok
else
invalid_resource!(@customer)
end
end
private
def add_recurring_payment_info(client_secret)
return unless client_secret
@customer.gateway_recurring_payment_client_secret = client_secret
@customer.gateway_shop_id = @customer.enterprise.stripe_account&.stripe_user_id
end
def customer_params
params.require(:customer).permit(:code, :email, :enterprise_id, :allow_charges)
end

View File

@@ -15,7 +15,7 @@ module Api
@enterprise = Enterprise.new(enterprise_params)
if @enterprise.save
@enterprise.user_ids = user_ids
render text: @enterprise.id, status: :created
render json: @enterprise.id, status: :created
else
invalid_resource!(@enterprise)
end
@@ -26,7 +26,7 @@ module Api
authorize! :update, @enterprise
if @enterprise.update(enterprise_params)
render text: @enterprise.id, status: :ok
render json: @enterprise.id, status: :ok
else
invalid_resource!(@enterprise)
end

View File

@@ -5,6 +5,7 @@
# Pagination is optional and can be required by using param[:page]
module Api
class ExchangeProductsController < Api::BaseController
include PaginationData
DEFAULT_PER_PAGE = 100
skip_authorization_check only: [:index]
@@ -77,29 +78,16 @@ module Api
end
def render_paginated_products(paginated_products)
serializer = ActiveModel::ArraySerializer.new(
serialized_products = ActiveModel::ArraySerializer.new(
paginated_products,
each_serializer: Api::Admin::ForOrderCycle::SuppliedProductSerializer,
order_cycle: @order_cycle
)
result = { products: serializer }
result = result.merge(pagination: pagination_data(paginated_products)) if pagination_required?
render text: result.to_json
end
def pagination_data(paginated_products)
{
results: paginated_products.total_count,
pages: paginated_products.num_pages,
page: params[:page].to_i,
per_page: (params[:per_page] || DEFAULT_PER_PAGE).to_i
render json: {
products: serialized_products,
pagination: pagination_data(paginated_products)
}
end
def pagination_required?
params[:page].present?
end
end
end

View File

@@ -20,7 +20,7 @@ module Api
search_params
).products_json
render json: products
render plain: products
rescue ProductsRenderer::NoProducts
render_no_products
end
@@ -31,19 +31,21 @@ module Api
where(spree_products: { id: distributed_products }).
select('DISTINCT spree_taxons.*')
render json: ActiveModel::ArraySerializer.new(taxons, each_serializer: Api::TaxonSerializer)
render plain: ActiveModel::ArraySerializer.new(
taxons, each_serializer: Api::TaxonSerializer
).to_json
end
def properties
render json: ActiveModel::ArraySerializer.new(
render plain: ActiveModel::ArraySerializer.new(
product_properties | producer_properties, each_serializer: Api::PropertySerializer
)
).to_json
end
private
def render_no_products
render status: :not_found, json: ''
render status: :not_found, json: {}
end
def product_properties

View File

@@ -1,5 +1,7 @@
module Api
class OrdersController < Api::BaseController
include PaginationData
def show
authorize! :read, order
render json: order, serializer: Api::OrderDetailedSerializer, current_order: order
@@ -8,11 +10,11 @@ module Api
def index
authorize! :admin, Spree::Order
search_results = SearchOrders.new(params, current_api_user)
orders = SearchOrders.new(params, current_api_user).orders
render json: {
orders: serialized_orders(search_results.orders),
pagination: search_results.pagination_data
orders: serialized_orders(orders),
pagination: pagination_data(orders)
}
end

View File

@@ -3,8 +3,8 @@ require 'spree/core/product_duplicator'
module Api
class ProductsController < Api::BaseController
include PaginationData
respond_to :json
DEFAULT_PAGE = 1
DEFAULT_PER_PAGE = 15
skip_authorization_check only: [:show, :bulk_products, :overridable]
@@ -63,7 +63,7 @@ module Api
@products = product_query.
ransack(query_params_with_defaults).
result.
page(params[:page] || DEFAULT_PAGE).
page(params[:page] || 1).
per(params[:per_page] || DEFAULT_PER_PAGE)
render_paged_products @products
@@ -130,31 +130,19 @@ module Api
end
def render_paged_products(products, product_serializer = ::Api::Admin::ProductSerializer)
serializer = ActiveModel::ArraySerializer.new(
serialized_products = ActiveModel::ArraySerializer.new(
products,
each_serializer: product_serializer
)
render text: {
products: serializer,
# This line is used by the PagedFetcher JS service (inventory).
pages: products.num_pages,
# This hash is used by the BulkProducts JS service.
render json: {
products: serialized_products,
pagination: pagination_data(products)
}.to_json
}
end
def query_params_with_defaults
params[:q].to_h.reverse_merge(s: 'created_at desc')
end
def pagination_data(results)
{
results: results.total_count,
pages: results.num_pages,
page: (params[:page] || DEFAULT_PAGE).to_i,
per_page: (params[:per_page] || DEFAULT_PER_PAGE).to_i
}
(params[:q] || {}).reverse_merge(s: 'created_at desc')
end
def product_params

View File

@@ -1,7 +1,13 @@
# frozen_string_literal: true
require "application_responder"
require 'open_food_network/referer_parser'
require_dependency 'spree/authentication_helpers'
class ApplicationController < ActionController::Base
self.responder = ApplicationResponder
respond_to :html
protect_from_forgery
prepend_before_action :restrict_iframes
@@ -10,6 +16,12 @@ class ApplicationController < ActionController::Base
include EnterprisesHelper
include Spree::AuthenticationHelpers
# Helper for debugging strong_parameters
rescue_from ActiveModel::ForbiddenAttributesError, with: :print_params
def print_params
raise ActiveModel::ForbiddenAttributesError, params.to_s
end
def redirect_to(options = {}, response_status = {})
::Rails.logger.error("Redirected by #{begin
caller(1).first

View File

@@ -1,5 +1,3 @@
require 'spree/core/controller_helpers/order'
class CartController < BaseController
before_action :check_authorization
@@ -13,7 +11,8 @@ class CartController < BaseController
Spree::Adjustment.without_callbacks do
cart_service = CartService.new(order)
if cart_service.populate(params.slice(:products, :variants, :quantity), true)
cart_service.populate(params.slice(:products, :variants, :quantity), true)
if cart_service.valid?
order.update_distribution_charge!
order.cap_quantity_at_stock!
order.update!
@@ -24,7 +23,8 @@ class CartController < BaseController
stock_levels: VariantsStockLevels.new.call(order, variant_ids) },
status: :ok
else
render json: { error: true }, status: :precondition_failed
render json: { error: cart_service.errors.full_messages.join(",") },
status: :precondition_failed
end
end
populate_variant_attributes

View File

@@ -5,6 +5,7 @@ require 'open_food_network/address_finder'
class CheckoutController < Spree::StoreController
layout 'darkswarm'
include OrderStockCheck
include CheckoutHelper
include OrderCyclesHelper
include EnterprisesHelper
@@ -24,7 +25,7 @@ class CheckoutController < Spree::StoreController
before_action :ensure_order_not_completed
before_action :ensure_checkout_allowed
before_action :ensure_sufficient_stock_lines
before_action :handle_insufficient_stock
before_action :associate_user
before_action :check_authorization
@@ -77,13 +78,6 @@ class CheckoutController < Spree::StoreController
redirect_to main_app.cart_path if @order.completed?
end
def ensure_sufficient_stock_lines
if @order.insufficient_stock_lines.present?
flash[:error] = Spree.t(:inventory_error_flash_for_insufficient_quantity)
redirect_to main_app.cart_path
end
end
def load_order
@order = current_order

View File

@@ -9,7 +9,7 @@ module ApiActionCaching
included do
include ActionController::Caching
include ActionController::Caching::Actions
include AbstractController::Layouts
include ActionView::Layouts
# These configs are not assigned to the controller automatically with ActionController::Metal
self.cache_store = Rails.configuration.cache_store

View File

@@ -0,0 +1,18 @@
# frozen_string_literal: true
module OrderStockCheck
extend ActiveSupport::Concern
def handle_insufficient_stock
return if sufficient_stock?
flash[:error] = Spree.t(:inventory_error_flash_for_insufficient_quantity)
redirect_to main_app.cart_path
end
private
def sufficient_stock?
@sufficient_stock ||= @order.insufficient_stock_lines.blank?
end
end

View File

@@ -0,0 +1,26 @@
# frozen_string_literal: true
module PaginationData
extend ActiveSupport::Concern
def pagination_data(objects)
return unless objects.respond_to? :total_count
{
results: objects.total_count,
pages: objects.total_pages,
page: (params[:page] || 1).to_i,
per_page: (params[:per_page] || default_per_page).to_i
}
end
def pagination_required?
params[:page].present? || params[:per_page].present?
end
def default_per_page
return unless defined? self.class::DEFAULT_PER_PAGE
self.class::DEFAULT_PER_PAGE
end
end

View File

@@ -6,6 +6,8 @@ class EnterprisesController < BaseController
include OrderCyclesHelper
include SerializerHelper
protect_from_forgery except: :check_permalink
# These prepended filters are in the reverse order of execution
prepend_before_action :set_order_cycles, :require_distributor_chosen, :reset_order, only: :shop

View File

@@ -1,6 +1,6 @@
module Spree
module Admin
class AdjustmentsController < ResourceController
class AdjustmentsController < ::Admin::ResourceController
belongs_to 'spree/order', find_by: :number
destroy.after :reload_order

View File

@@ -1,6 +1,6 @@
module Spree
module Admin
class CountriesController < ResourceController
class CountriesController < ::Admin::ResourceController
protected
def permitted_resource_params

View File

@@ -1,6 +1,6 @@
module Spree
module Admin
class ImagesController < ResourceController
class ImagesController < ::Admin::ResourceController
# This will make resource controller redirect correctly after deleting product images.
# This can be removed after upgrading to Spree 2.1.
# See here https://github.com/spree/spree/commit/334a011d2b8e16355e4ae77ae07cd93f7cbc8fd1

View File

@@ -15,7 +15,7 @@ module Spree
end
def testmail
if TestMailer.test_email(spree_current_user).deliver
if TestMailer.test_email(spree_current_user).deliver_now
flash[:success] = Spree.t('admin.mail_methods.testmail.delivery_success')
else
flash[:error] = Spree.t('admin.mail_methods.testmail.delivery_error')

View File

@@ -43,7 +43,7 @@ module Spree
end
def update
unless @order.update(order_params) && @order.line_items.present?
unless order_params.present? && @order.update(order_params) && @order.line_items.present?
if @order.line_items.empty?
@order.errors.add(:line_items, Spree.t('errors.messages.blank'))
end
@@ -78,7 +78,7 @@ module Spree
end
def resend
Spree::OrderMailer.confirm_email_for_customer(@order.id, true).deliver
Spree::OrderMailer.confirm_email_for_customer(@order.id, true).deliver_later
flash[:success] = t('admin.orders.order_email_resent')
respond_with(@order) { |format| format.html { redirect_to :back } }
@@ -87,7 +87,7 @@ module Spree
def invoice
pdf = InvoiceRenderer.new.render_to_string(@order)
Spree::OrderMailer.invoice_email(@order.id, pdf).deliver
Spree::OrderMailer.invoice_email(@order.id, pdf).deliver_later
flash[:success] = t('admin.orders.invoice_email_sent')
respond_with(@order) { |format|

View File

@@ -1,6 +1,6 @@
module Spree
module Admin
class PaymentMethodsController < ResourceController
class PaymentMethodsController < ::Admin::ResourceController
skip_before_action :load_resource, only: [:create, :show_provider_preferences]
before_action :load_data
before_action :validate_payment_method_provider, only: [:create]
@@ -51,7 +51,7 @@ module Spree
end
# Only show payment methods that user has access to and sort by distributor name
# ! Redundant code copied from Spree::Admin::ResourceController with modifications marked
# ! Redundant code copied from Admin::ResourceController with modifications marked
def collection
return parent.public_send(controller_name) if parent_data.present?

View File

@@ -67,6 +67,25 @@ module Spree
redirect_to request.referer
end
def paypal_refund
if request.get?
if @payment.source.state == 'refunded'
flash[:error] = Spree.t(:already_refunded, scope: 'paypal')
redirect_to admin_order_payment_path(@order, @payment)
end
elsif request.post?
response = @payment.payment_method.refund(@payment, params[:refund_amount])
if response.success?
flash[:success] = Spree.t(:refund_successful, scope: 'paypal')
redirect_to admin_order_payments_path(@order)
else
flash.now[:error] = Spree.t(:refund_unsuccessful, scope: 'paypal') +
" (#{response.errors.first.long_message})"
render
end
end
end
private
def load_payment_source
@@ -135,7 +154,9 @@ module Spree
return unless @payment.payment_method.class == Spree::Gateway::StripeSCA
@payment.authorize!
raise Spree::Core::GatewayError, I18n.t('authorization_failure') unless @payment.pending?
return if @payment.pending? && @payment.cvv_response_message.nil?
raise Spree::Core::GatewayError, I18n.t('authorization_failure')
end
end
end

View File

@@ -0,0 +1,20 @@
# frozen_string_literal: true
module Spree
module Admin
class PaypalPaymentsController < Spree::Admin::BaseController
before_action :load_order
def index
@payments = @order.payments.includes(:payment_method).
where(spree_payment_methods: { type: "Spree::Gateway::PayPalExpress" })
end
private
def load_order
@order = Spree::Order.where(number: params[:order_id]).first
end
end
end
end

View File

@@ -1,6 +1,6 @@
module Spree
module Admin
class ProductPropertiesController < ResourceController
class ProductPropertiesController < ::Admin::ResourceController
belongs_to 'spree/product', find_by: :permalink
before_action :find_properties
before_action :setup_property, only: [:index]

View File

@@ -4,7 +4,7 @@ require 'open_food_network/permissions'
module Spree
module Admin
class ProductsController < ResourceController
class ProductsController < ::Admin::ResourceController
helper 'spree/products'
include OpenFoodNetwork::SpreeApiKeyLoader
include OrderCyclesHelper
@@ -179,7 +179,7 @@ module Spree
end
def bulk_index_query(params)
params[:filters].to_h.merge(page: params[:page], per_page: params[:per_page])
(params[:filters] || {}).merge(page: params[:page], per_page: params[:per_page])
end
def load_form_data

View File

@@ -1,6 +1,6 @@
module Spree
module Admin
class PropertiesController < ResourceController
class PropertiesController < ::Admin::ResourceController
def permitted_resource_params
params.require(:property).permit(:name, :presentation)
end

View File

@@ -1,282 +0,0 @@
require 'action_callbacks'
module Spree
module Admin
class ResourceController < Spree::Admin::BaseController
helper_method :new_object_url, :edit_object_url, :object_url, :collection_url
before_action :load_resource, except: [:update_positions]
rescue_from ActiveRecord::RecordNotFound, with: :resource_not_found
rescue_from CanCan::AccessDenied, with: :unauthorized
respond_to :html
respond_to :js, except: [:show, :index]
def new
invoke_callbacks(:new_action, :before)
respond_with(@object) do |format|
format.html { render layout: !request.xhr? }
format.js { render layout: false }
end
end
def edit
respond_with(@object) do |format|
format.html { render layout: !request.xhr? }
format.js { render layout: false }
end
end
def update
invoke_callbacks(:update, :before)
if @object.update(permitted_resource_params)
invoke_callbacks(:update, :after)
flash[:success] = flash_message_for(@object, :successfully_updated)
respond_with(@object) do |format|
format.html { redirect_to location_after_save }
format.js { render layout: false }
end
else
invoke_callbacks(:update, :fails)
respond_with(@object)
end
end
def create
invoke_callbacks(:create, :before)
@object.attributes = permitted_resource_params
if @object.save
invoke_callbacks(:create, :after)
flash[:success] = flash_message_for(@object, :successfully_created)
respond_with(@object) do |format|
format.html { redirect_to location_after_save }
format.js { render layout: false }
end
else
invoke_callbacks(:create, :fails)
respond_with(@object)
end
end
def update_positions
params[:positions].each do |id, index|
model_class.where(id: id).update_all(position: index)
end
respond_to do |format|
format.js { render text: 'Ok' }
end
end
def destroy
invoke_callbacks(:destroy, :before)
if @object.destroy
invoke_callbacks(:destroy, :after)
flash[:success] = flash_message_for(@object, :successfully_removed)
respond_with(@object) do |format|
format.html { redirect_to collection_url }
format.js { render partial: "spree/admin/shared/destroy" }
end
else
invoke_callbacks(:destroy, :fails)
respond_with(@object) do |format|
format.html { redirect_to collection_url }
end
end
end
protected
def resource_not_found
flash[:error] = flash_message_for(model_class.new, :not_found)
redirect_to collection_url
end
class << self
attr_accessor :parent_data
attr_accessor :callbacks
def belongs_to(model_name, options = {})
@parent_data ||= {}
@parent_data[:model_name] = model_name
@parent_data[:model_class] = model_name.to_s.classify.constantize
@parent_data[:find_by] = options[:find_by] || :id
end
def new_action
@callbacks ||= {}
@callbacks[:new_action] ||= ActionCallbacks.new
end
def create
@callbacks ||= {}
@callbacks[:create] ||= ActionCallbacks.new
end
def update
@callbacks ||= {}
@callbacks[:update] ||= ActionCallbacks.new
end
def destroy
@callbacks ||= {}
@callbacks[:destroy] ||= ActionCallbacks.new
end
end
def model_class
"Spree::#{controller_name.classify}".constantize
end
def model_name
parent_data[:model_name].gsub('spree/', '')
end
def object_name
controller_name.singularize
end
def load_resource
if member_action?
@object ||= load_resource_instance
# call authorize! a third time (called twice already in Admin::BaseController)
# this time we pass the actual instance so fine-grained abilities can control
# access to individual records, not just entire models.
authorize! action, @object
instance_variable_set("@#{object_name}", @object)
# If we don't have access, clear the object
unless can? action, @object
instance_variable_set("@#{object_name}", nil)
end
authorize! action, @object
else
@collection ||= collection
# note: we don't call authorize here as the collection method should use
# CanCan's accessible_by method to restrict the actual records returned
instance_variable_set("@#{controller_name}", @collection)
end
end
def load_resource_instance
if new_actions.include?(action)
build_resource
elsif params[:id]
find_resource
end
end
def parent_data
self.class.parent_data
end
def parent
return nil if parent_data.blank?
@parent ||= parent_data[:model_class].
public_send("find_by", parent_data[:find_by] => params["#{model_name}_id"])
instance_variable_set("@#{model_name}", @parent)
end
def find_resource
if parent_data.present?
parent.public_send(controller_name).find(params[:id])
else
model_class.find(params[:id])
end
end
def build_resource
if parent_data.present?
parent.public_send(controller_name).build
else
model_class.new
end
end
def collection
return parent.public_send(controller_name) if parent_data.present?
if model_class.respond_to?(:accessible_by) &&
!current_ability.has_block?(params[:action], model_class)
model_class.accessible_by(current_ability, action)
else
model_class.scoped
end
end
def location_after_save
collection_url
end
def invoke_callbacks(action, callback_type)
callbacks = self.class.callbacks || {}
return if callbacks[action].nil?
case callback_type.to_sym
when :before then callbacks[action].before_methods.each { |method| __send__ method }
when :after then callbacks[action].after_methods.each { |method| __send__ method }
when :fails then callbacks[action].fails_methods.each { |method| __send__ method }
end
end
# URL helpers
def new_object_url(options = {})
if parent_data.present?
spree.new_polymorphic_url([:admin, parent, model_class], options)
else
spree.new_polymorphic_url([:admin, model_class], options)
end
end
def edit_object_url(object, options = {})
if parent_data.present?
spree.public_send "edit_admin_#{model_name}_#{object_name}_url", parent, object, options
else
spree.public_send "edit_admin_#{object_name}_url", object, options
end
end
def object_url(object = nil, options = {})
target = object || @object
if parent_data.present?
spree.public_send "admin_#{model_name}_#{object_name}_url", parent, target, options
else
spree.public_send "admin_#{object_name}_url", target, options
end
end
# Permit specific list of params
#
# Example: params.require(object_name).permit(:name)
def permitted_resource_params
raise "All extending controllers need to override the method permitted_resource_params"
end
def collection_url(options = {})
if parent_data.present?
spree.polymorphic_url([:admin, parent, model_class], options)
else
spree.polymorphic_url([:admin, model_class], options)
end
end
def collection_actions
[:index]
end
def member_action?
!collection_actions.include? action
end
def new_actions
[:new, :create]
end
end
end
end

View File

@@ -1,6 +1,6 @@
module Spree
module Admin
class ReturnAuthorizationsController < ResourceController
class ReturnAuthorizationsController < ::Admin::ResourceController
belongs_to 'spree/order', find_by: :number
update.after :associate_inventory_units

View File

@@ -1,6 +1,6 @@
module Spree
module Admin
class ShippingCategoriesController < ResourceController
class ShippingCategoriesController < ::Admin::ResourceController
protected
def permitted_resource_params

View File

@@ -1,6 +1,6 @@
module Spree
module Admin
class ShippingMethodsController < ResourceController
class ShippingMethodsController < ::Admin::ResourceController
before_action :load_data, except: [:index]
before_action :set_shipping_category, only: [:create, :update]
before_action :set_zones, only: [:create, :update]

View File

@@ -1,6 +1,6 @@
module Spree
module Admin
class StatesController < ResourceController
class StatesController < ::Admin::ResourceController
belongs_to 'spree/country'
before_action :load_data

View File

@@ -1,6 +1,6 @@
module Spree
module Admin
class TaxCategoriesController < ResourceController
class TaxCategoriesController < ::Admin::ResourceController
def destroy
if @object.destroy
flash[:success] = flash_message_for(@object, :successfully_removed)

View File

@@ -1,6 +1,6 @@
module Spree
module Admin
class TaxRatesController < ResourceController
class TaxRatesController < ::Admin::ResourceController
before_action :load_data
private

View File

@@ -1,6 +1,6 @@
module Spree
module Admin
class TaxonomiesController < ResourceController
class TaxonomiesController < ::Admin::ResourceController
respond_to :json, only: [:get_children]
def get_children

View File

@@ -1,6 +1,6 @@
module Spree
module Admin
class UsersController < ResourceController
class UsersController < ::Admin::ResourceController
rescue_from Spree::User::DestroyWithOrdersError, with: :user_destroy_with_orders_error
after_action :sign_in_if_change_own_password, only: :update
@@ -100,7 +100,7 @@ module Spree
private
# handling raise from Spree::Admin::ResourceController#destroy
# handling raise from Admin::ResourceController#destroy
def user_destroy_with_orders_error
invoke_callbacks(:destroy, :fails)
render status: :forbidden, text: Spree.t(:error_user_destroy_with_orders)

View File

@@ -2,7 +2,7 @@ require 'open_food_network/scope_variants_for_search'
module Spree
module Admin
class VariantsController < ResourceController
class VariantsController < ::Admin::ResourceController
helper 'spree/products'
belongs_to 'spree/product', find_by: :permalink
@@ -23,7 +23,9 @@ module Spree
flash[:success] = flash_message_for(@object, :successfully_updated)
redirect_to spree.admin_product_variants_url(params[:product_id], @url_filters)
else
redirect_to spree.edit_admin_product_variant_url(params[:product_id], @object, @url_filters)
redirect_to spree.edit_admin_product_variant_url(params[:product_id],
@object,
@url_filters)
end
end

View File

@@ -1,6 +1,6 @@
module Spree
module Admin
class ZonesController < ResourceController
class ZonesController < ::Admin::ResourceController
before_action :load_data, except: [:index]
def new

View File

@@ -1,3 +1,7 @@
# frozen_string_literal: true
require 'stripe/credit_card_remover'
module Spree
class CreditCardsController < BaseController
def new_from_token
@@ -27,6 +31,7 @@ module Spree
authorize! :update, @credit_card
if @credit_card.update(credit_card_params)
remove_shop_authorizations if credit_card_params["is_default"]
render json: @credit_card, serializer: ::Api::CreditCardSerializer, status: :ok
else
update_failed
@@ -39,11 +44,12 @@ module Spree
@credit_card = Spree::CreditCard.find_by(id: params[:id])
if @credit_card
authorize! :destroy, @credit_card
destroy_at_stripe
Stripe::CreditCardRemover.new(@credit_card).call
end
# Using try because we may not have a card here
if @credit_card.try(:destroy)
remove_shop_authorizations if @credit_card.is_default
flash[:success] = I18n.t(:card_has_been_removed, number: "x-#{@credit_card.last_digits}")
else
flash[:error] = I18n.t(:card_could_not_be_removed)
@@ -56,18 +62,8 @@ module Spree
private
# It destroys the whole customer object
def destroy_at_stripe
stripe_customer = Stripe::Customer.retrieve(@credit_card.gateway_customer_profile_id, {})
stripe_customer&.delete
end
def stripe_account_id
StripeAccount.
find_by(enterprise_id: @credit_card.payment_method.preferred_enterprise_id).
andand.
stripe_user_id
def remove_shop_authorizations
@credit_card.user.customers.update_all(allow_charges: false)
end
def create_customer(token)

View File

@@ -1,9 +1,8 @@
require 'spree/core/controller_helpers/order'
require 'spree/core/controller_helpers/auth'
module Spree
class OrdersController < Spree::StoreController
include OrderCyclesHelper
include Rails.application.routes.url_helpers
layout 'darkswarm'
ssl_required :show

View File

@@ -0,0 +1,244 @@
# frozen_string_literal: true
module Spree
class PaypalController < StoreController
ssl_allowed
include OrderStockCheck
before_action :enable_embedded_shopfront
before_action :destroy_orphaned_paypal_payments, only: :confirm
after_action :reset_order_when_complete, only: :confirm
before_action :permit_parameters!
def express
order = current_order || raise(ActiveRecord::RecordNotFound)
items = order.line_items.map(&method(:line_item))
tax_adjustments = order.adjustments.tax
# TODO: Remove in Spree 2.2
tax_adjustments = tax_adjustments.additional if tax_adjustments.respond_to?(:additional)
shipping_adjustments = order.adjustments.shipping
order.adjustments.eligible.each do |adjustment|
next if (tax_adjustments + shipping_adjustments).include?(adjustment)
items << {
Name: adjustment.label,
Quantity: 1,
Amount: {
currencyID: order.currency,
value: adjustment.amount
}
}
end
# Because PayPal doesn't accept $0 items at all.
# See https://github.com/spree-contrib/better_spree_paypal_express/issues/10
# "It can be a positive or negative value but not zero."
items.reject! do |item|
item[:Amount][:value].zero?
end
pp_request = provider.build_set_express_checkout(
express_checkout_request_details(order, items)
)
begin
pp_response = provider.set_express_checkout(pp_request)
if pp_response.success?
# At this point Paypal has *provisionally* accepted that the payment can now be placed,
# and the user will be redirected to a Paypal payment page. On completion, the user is
# sent back and the response is handled in the #confirm action in this controller.
redirect_to provider.express_checkout_url(pp_response, useraction: 'commit')
else
flash[:error] = Spree.t('flash.generic_error', scope: 'paypal', reasons: pp_response.errors.map(&:long_message).join(" "))
redirect_to spree.checkout_state_path(:payment)
end
rescue SocketError
flash[:error] = Spree.t('flash.connection_failed', scope: 'paypal')
redirect_to spree.checkout_state_path(:payment)
end
end
def confirm
@order = current_order || raise(ActiveRecord::RecordNotFound)
# At this point the user has come back from the Paypal form, and we get one
# last chance to interact with the payment process before the money moves...
return reset_to_cart unless sufficient_stock?
@order.payments.create!(
source: Spree::PaypalExpressCheckout.create(
token: params[:token],
payer_id: params[:PayerID]
),
amount: @order.total,
payment_method: payment_method
)
@order.next
if @order.complete?
flash.notice = Spree.t(:order_processed_successfully)
flash[:commerce_tracking] = "nothing special"
session[:order_id] = nil
redirect_to completion_route(@order)
else
redirect_to checkout_state_path(@order.state)
end
end
def cancel
flash[:notice] = Spree.t('flash.cancel', scope: 'paypal')
redirect_to main_app.checkout_path
end
# Clears the cached order. Required for #current_order to return a new order to serve as cart.
def expire_current_order
session[:order_id] = nil
@current_order = nil
end
private
def line_item(item)
{
Name: item.product.name,
Number: item.variant.sku,
Quantity: item.quantity,
Amount: {
currencyID: item.order.currency,
value: item.price
},
ItemCategory: "Physical"
}
end
def express_checkout_request_details(order, items)
{
SetExpressCheckoutRequestDetails: {
InvoiceID: order.number,
BuyerEmail: order.email,
ReturnURL: spree.confirm_paypal_url(
payment_method_id: params[:payment_method_id], utm_nooverride: 1
),
CancelURL: spree.cancel_paypal_url,
SolutionType: payment_method.preferred_solution.presence || "Mark",
LandingPage: payment_method.preferred_landing_page.presence || "Billing",
cppheaderimage: payment_method.preferred_logourl.presence || "",
NoShipping: 1,
PaymentDetails: [payment_details(items)]
}
}
end
def payment_method
@payment_method ||= Spree::PaymentMethod.find(params[:payment_method_id])
end
def permit_parameters!
params.permit(:token, :payment_method_id, :PayerID)
end
def reset_order_when_complete
return unless current_order.complete?
flash[:notice] = t(:order_processed_successfully)
OrderCompletionReset.new(self, current_order).call
session[:access_token] = current_order.token
end
def reset_to_cart
OrderCheckoutRestart.new(@order).call
handle_insufficient_stock
end
# See #1074 and #1837 for more detail on why we need this
# An 'orphaned' Spree::Payment is created for every call to CheckoutController#update
# for orders that are processed using a Spree::Gateway::PayPalExpress payment method
# These payments are 'orphaned' because they are never used by the spree_paypal_express gem
# which creates a brand new Spree::Payment from scratch in PayPalController#confirm
# However, the 'orphaned' payments are useful when applying a transaction fee, because the fees
# need to be calculated before the order details are sent to PayPal for confirmation
# This is our best hook for removing the orphaned payments at an appropriate time. ie. after
# the payment details have been confirmed, but before any payments have been processed
def destroy_orphaned_paypal_payments
return unless payment_method.is_a?(Spree::Gateway::PayPalExpress)
orphaned_payments = current_order.payments.
where(payment_method_id: payment_method.id, source_id: nil)
orphaned_payments.each(&:destroy)
end
def provider
payment_method.provider
end
def payment_details(items)
item_sum = items.sum { |i| i[:Quantity] * i[:Amount][:value] }
# Would use tax_total here, but it can include "included" taxes as well.
# For instance, tax_total would include the 10% GST in Australian stores.
# A quick sum will get us around that little problem.
# TODO: Remove additional check in 2.2
tax_adjustments = current_order.adjustments.tax
tax_adjustments = tax_adjustments.additional if tax_adjustments.respond_to?(:additional)
tax_adjustments_total = tax_adjustments.sum(:amount)
if item_sum.zero?
# Paypal does not support no items or a zero dollar ItemTotal
# This results in the order summary being simply "Current purchase"
{
OrderTotal: {
currencyID: current_order.currency,
value: current_order.total
}
}
else
{
OrderTotal: {
currencyID: current_order.currency,
value: current_order.total
},
ItemTotal: {
currencyID: current_order.currency,
value: item_sum
},
ShippingTotal: {
currencyID: current_order.currency,
value: current_order.ship_total
},
TaxTotal: {
currencyID: current_order.currency,
value: tax_adjustments_total,
},
ShipToAddress: address_options,
PaymentDetailsItem: items,
ShippingMethod: "Shipping Method Name Goes Here",
PaymentAction: "Sale"
}
end
end
def address_options
return {} unless address_required?
{
Name: current_order.bill_address.try(:full_name),
Street1: current_order.bill_address.address1,
Street2: current_order.bill_address.address2,
CityName: current_order.bill_address.city,
Phone: current_order.bill_address.phone,
StateOrProvince: current_order.bill_address.state_text,
Country: current_order.bill_address.country.iso,
PostalCode: current_order.bill_address.zipcode
}
end
def completion_route(order)
spree.order_path(order, token: order.token)
end
def address_required?
payment_method.preferred_solution.eql?('Sole')
end
end
end

View File

@@ -1,117 +0,0 @@
# frozen_string_literal: true
Spree::PaypalController.class_eval do
before_action :enable_embedded_shopfront
before_action :destroy_orphaned_paypal_payments, only: :confirm
after_action :reset_order_when_complete, only: :confirm
before_action :permit_parameters!
def express
order = current_order || raise(ActiveRecord::RecordNotFound)
items = order.line_items.map(&method(:line_item))
tax_adjustments = order.adjustments.tax
# TODO: Remove in Spree 2.2
tax_adjustments = tax_adjustments.additional if tax_adjustments.respond_to?(:additional)
shipping_adjustments = order.adjustments.shipping
order.adjustments.eligible.each do |adjustment|
next if (tax_adjustments + shipping_adjustments).include?(adjustment)
items << {
Name: adjustment.label,
Quantity: 1,
Amount: {
currencyID: order.currency,
value: adjustment.amount
}
}
end
# Because PayPal doesn't accept $0 items at all.
# See #10
# https://cms.paypal.com/uk/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_api_ECCustomizing
# "It can be a positive or negative value but not zero."
items.reject! do |item|
item[:Amount][:value].zero?
end
pp_request = provider.build_set_express_checkout(express_checkout_request_details(order, items))
begin
pp_response = provider.set_express_checkout(pp_request)
if pp_response.success?
redirect_to provider.express_checkout_url(pp_response, useraction: 'commit')
else
flash[:error] = Spree.t('flash.generic_error', scope: 'paypal', reasons: pp_response.errors.map(&:long_message).join(" "))
redirect_to spree.checkout_state_path(:payment)
end
rescue SocketError
flash[:error] = Spree.t('flash.connection_failed', scope: 'paypal')
redirect_to spree.checkout_state_path(:payment)
end
end
def cancel
flash[:notice] = Spree.t('flash.cancel', scope: 'paypal')
redirect_to main_app.checkout_path
end
# Clears the cached order. Required for #current_order to return a new order
# to serve as cart. See https://github.com/spree/spree/blob/1-3-stable/core/lib/spree/core/controller_helpers/order.rb#L14
# for details.
def expire_current_order
session[:order_id] = nil
@current_order = nil
end
private
def permit_parameters!
params.permit(:token, :payment_method_id, :PayerID)
end
def reset_order_when_complete
if current_order.complete?
flash[:notice] = t(:order_processed_successfully)
OrderCompletionReset.new(self, current_order).call
session[:access_token] = current_order.token
end
end
# See #1074 and #1837 for more detail on why we need this
# An 'orphaned' Spree::Payment is created for every call to CheckoutController#update
# for orders that are processed using a Spree::Gateway::PayPalExpress payment method
# These payments are 'orphaned' because they are never used by the spree_paypal_express gem
# which creates a brand new Spree::Payment from scratch in PayPalController#confirm
# However, the 'orphaned' payments are useful when applying a transaction fee, because the fees
# need to be calculated before the order details are sent to PayPal for confirmation
# This is our best hook for removing the orphaned payments at an appropriate time. ie. after
# the payment details have been confirmed, but before any payments have been processed
def destroy_orphaned_paypal_payments
return unless payment_method.is_a?(Spree::Gateway::PayPalExpress)
orphaned_payments = current_order.payments.where(payment_method_id: payment_method.id, source_id: nil)
orphaned_payments.each(&:destroy)
end
def completion_route(order)
spree.order_path(order, token: order.token)
end
def express_checkout_request_details(order, items)
{
SetExpressCheckoutRequestDetails: {
InvoiceID: order.number,
BuyerEmail: order.email,
ReturnURL: spree.confirm_paypal_url(payment_method_id: params[:payment_method_id], utm_nooverride: 1),
CancelURL: spree.cancel_paypal_url,
SolutionType: payment_method.preferred_solution.presence || "Mark",
LandingPage: payment_method.preferred_landing_page.presence || "Billing",
cppheaderimage: payment_method.preferred_logourl.presence || "",
NoShipping: 1,
PaymentDetails: [payment_details(items)]
}
}
end
end

View File

@@ -18,26 +18,6 @@ module Spree
before_action :check_permissions, only: [:edit, :update]
skip_before_action :require_no_authentication
# GET /resource/sign_up
def new
super
@user = resource
end
# POST /resource/sign_up
def create
@user = build_resource(params[:spree_user])
if resource.save
set_flash_message(:notice, :signed_up)
sign_in(:spree_user, @user)
associate_user
respond_with resource, location: after_sign_up_path_for(resource)
else
clean_up_passwords(resource)
render :new
end
end
# GET /resource/edit
def edit
super

View File

@@ -130,10 +130,6 @@ module Admin
json: @hub_permissions.to_json }
end
def admin_inject_products
admin_inject_json_ams_array "ofn.admin", "products", @products, Api::Admin::ProductSerializer
end
def admin_inject_tax_categories(opts = { module: 'ofn.admin' })
admin_inject_json_ams_array opts[:module],
"tax_categories",

View File

@@ -1,6 +1,6 @@
module ApplicationHelper
def feature?(feature)
OpenFoodNetwork::FeatureToggle.enabled? feature
def feature?(feature, user = nil)
OpenFoodNetwork::FeatureToggle.enabled?(feature, user)
end
def ng_form_for(name, *args, &block)

View File

@@ -18,7 +18,9 @@ module CheckoutHelper
enterprise_fee_adjustments = adjustments.select { |a| a.originator_type == 'EnterpriseFee' && a.source_type != 'Spree::LineItem' }
adjustments.reject! { |a| a.originator_type == 'EnterpriseFee' && a.source_type != 'Spree::LineItem' }
unless exclude.include? :admin_and_handling
adjustments << Spree::Adjustment.new(label: I18n.t(:orders_form_admin), amount: enterprise_fee_adjustments.sum(&:amount))
adjustments << Spree::Adjustment.new(
label: I18n.t(:orders_form_admin), amount: enterprise_fee_adjustments.map(&:amount).sum
)
end
adjustments
@@ -26,7 +28,7 @@ module CheckoutHelper
def display_checkout_admin_and_handling_adjustments_total_for(order)
adjustments = order.adjustments.eligible.where('originator_type = ? AND source_type != ? ', 'EnterpriseFee', 'Spree::LineItem')
Spree::Money.new adjustments.sum(&:amount), currency: order.currency
Spree::Money.new adjustments.map(&:amount).sum, currency: order.currency
end
def checkout_line_item_adjustments(order)
@@ -34,7 +36,7 @@ module CheckoutHelper
end
def checkout_subtotal(order)
order.item_total + checkout_line_item_adjustments(order).sum(&:amount)
order.item_total + checkout_line_item_adjustments(order).map(&:amount).sum
end
def display_checkout_subtotal(order)

View File

@@ -1,21 +0,0 @@
module HtmlHelper
def strip_html(html)
strip_surrounding_whitespace substitute_entities strip_tags add_linebreaks html
end
def substitute_entities(html)
html.andand.gsub(/&nbsp;/i, ' ').andand.gsub(/&amp;/i, '&')
end
def add_linebreaks(html)
# I know Cthulu is coming for me. Forgive me.
# http://stackoverflow.com/a/1732454/2720566
html.
andand.gsub(%r{</h[^>]>|</p>|</div>}, "\\1\n\n").
andand.gsub(/<br[^>]*>/, "\\1\n")
end
def strip_surrounding_whitespace(html)
html.andand.strip
end
end

View File

@@ -1,4 +1,4 @@
require 'spree/money_decorator'
require 'spree/money'
module Spree
module ReportsHelper

View File

@@ -0,0 +1,25 @@
# frozen_string_literal: true
class BulkInvoiceJob < ActiveJob::Base
def perform(order_ids, filepath)
pdf = CombinePDF.new
orders_from(order_ids).each do |order|
invoice = renderer.render_to_string(order)
pdf << CombinePDF.parse(invoice)
end
pdf.save filepath
end
private
def orders_from(order_ids)
Spree::Order.where(id: order_ids).order("completed_at DESC")
end
def renderer
@renderer ||= InvoiceRenderer.new
end
end

View File

@@ -1,6 +1,8 @@
ConfirmOrderJob = Struct.new(:order_id) do
def perform
Spree::OrderMailer.confirm_email_for_customer(order_id).deliver
Spree::OrderMailer.confirm_email_for_shop(order_id).deliver
# frozen_string_literal: true
class ConfirmOrderJob < ActiveJob::Base
def perform(order_id)
Spree::OrderMailer.confirm_email_for_customer(order_id).deliver_now
Spree::OrderMailer.confirm_email_for_shop(order_id).deliver_now
end
end

View File

@@ -1,6 +0,0 @@
ConfirmSignupJob = Struct.new(:user_id) do
def perform
user = Spree::User.find user_id
Spree::UserMailer.signup_confirmation(user).deliver
end
end

View File

@@ -1,4 +1,6 @@
class HeartbeatJob
# frozen_string_literal: true
class HeartbeatJob < ActiveJob::Base
def perform
Spree::Config.last_job_queue_heartbeat_at = Time.now.in_time_zone
end

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