Compare commits

...

311 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
Paulo Vilarinho
747b747e2d adds translation key to the included in price validation 2020-12-17 18:04:55 -03: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
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
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
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
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
Arun Kumar Mohan
1edebade78 Extract Stripe credit card deletion logic to a service object 2020-12-11 19:52:59 -05:00
Luis Ramos
ca1a4db299 Bump to ruby 2.4.4 2020-12-01 15:16:39 +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
196 changed files with 3173 additions and 1010 deletions

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

@@ -102,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
@@ -433,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
@@ -695,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
@@ -728,6 +731,7 @@ 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

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-11-05 11:27:59 +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,21 +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: 10
Naming/AccessorMethodName:
@@ -88,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'
@@ -267,7 +266,7 @@ Rails/ReflectionClassName:
- 'app/models/spree/order.rb'
- 'app/models/subscription.rb'
# Offense count: 250
# 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:
@@ -276,6 +275,7 @@ Rails/SkipsModelValidations:
- 'app/controllers/spree/admin/payment_methods_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'
@@ -437,7 +437,7 @@ Style/FormatStringToken:
- 'lib/open_food_network/sales_tax_report.rb'
- 'spec/features/admin/bulk_order_management_spec.rb'
# Offense count: 760
# Offense count: 365
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle.
# SupportedStyles: always, always_true, never
@@ -483,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'
@@ -547,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'
@@ -566,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'
@@ -595,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'
@@ -756,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'
@@ -771,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'
@@ -791,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'
@@ -828,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'
@@ -841,6 +830,7 @@ Style/GuardClause:
- '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'
@@ -858,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
@@ -889,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

73
Gemfile
View File

@@ -1,17 +1,47 @@
# 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" }
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.2'
gem 'rails-i18n'
gem 'rails_safe_tasks', '~> 1.0'
gem "activerecord-import"
gem 'responders', '~> 2.0'
gem "catalog", path: "./engines/catalog"
gem 'dfc_provider', path: './engines/dfc_provider'
@@ -22,29 +52,18 @@ gem 'activerecord-postgresql-adapter'
gem 'pg', '~> 0.21.0'
gem 'acts_as_list', '0.9.19'
gem 'awesome_nested_set', '~> 3.2.1'
gem 'cancan', '~> 1.6.10'
gem 'cancancan', '~> 1.7.0'
gem 'ffaker'
gem 'highline', '2.0.3' # Necessary for the install generator
gem 'json'
gem 'money', '< 6.1.0'
gem 'paranoia', '~> 2.0'
gem 'ransack', '~> 1.8.10'
gem 'monetize', '~> 1.1'
gem 'paranoia', '~> 2.4'
gem 'state_machines-activerecord'
gem 'stringex', '~> 2.8.5'
# 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 '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'
gem 'devise-encryptable'
gem 'devise-token_authenticatable'
@@ -55,18 +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 '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'
@@ -105,7 +119,6 @@ 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'
@@ -129,7 +142,7 @@ group :test, :development do
gem 'capybara'
gem 'database_cleaner', require: false
gem "factory_bot_rails", '5.2.0', require: false
gem 'fuubar', '~> 2.5.0'
gem 'fuubar', '~> 2.5.1'
gem 'json_spec', '~> 1.1.4'
gem 'knapsack'
gem 'letter_opener', '>= 1.4.1'
@@ -153,10 +166,10 @@ group :test do
end
group :development do
gem 'byebug', '~> 11.0.0' # 11.1 requires ruby 2.4
gem 'byebug'
gem 'debugger-linecache'
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
@@ -116,9 +108,9 @@ GEM
angularjs-file-upload-rails (2.4.1)
angularjs-rails (1.5.5)
arel (6.0.4)
ast (2.4.0)
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)
@@ -127,18 +119,18 @@ GEM
json (~> 1.4)
nokogiri (~> 1)
bcrypt (3.1.16)
bugsnag (6.18.0)
bugsnag (6.19.0)
concurrent-ruby (~> 1.0)
builder (3.2.4)
byebug (11.0.1)
cancan (1.6.10)
capybara (3.15.1)
byebug (11.1.3)
cancancan (1.7.1)
capybara (3.32.2)
addressable
mini_mime (>= 0.1.3)
nokogiri (~> 1.8)
rack (>= 1.6.0)
rack-test (>= 0.6.3)
regexp_parser (~> 1.2)
regexp_parser (~> 1.5)
xpath (~> 3.2)
childprocess (3.0.0)
chronic (0.10.2)
@@ -146,7 +138,7 @@ GEM
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)
@@ -173,7 +165,8 @@ 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
@@ -184,7 +177,7 @@ GEM
activerecord (>= 3.2.0, < 5.0)
fog (~> 1.0)
rails (>= 3.2.0, < 5.0)
ddtrace (0.43.0)
ddtrace (0.44.0)
msgpack
debugger-linecache (1.2.0)
delayed_job (4.1.9)
@@ -208,7 +201,7 @@ GEM
devise-token_authenticatable (1.1.0)
devise (>= 4.0.0, < 5.0.0)
diff-lcs (1.4.4)
docile (1.3.2)
docile (1.3.4)
domain_name (0.5.20190701)
unf (>= 0.0.5, < 1.0.0)
dry-inflector (0.1.2)
@@ -223,7 +216,7 @@ GEM
railties (>= 4.2.0)
faraday (1.0.1)
multipart-post (>= 1.2, < 3)
ffaker (2.11.0)
ffaker (2.16.0)
ffi (1.13.1)
figaro (1.2.0)
thor (>= 0.14.0, < 2)
@@ -384,7 +377,7 @@ 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)
@@ -409,7 +402,6 @@ GEM
immigrant (0.3.6)
activerecord (>= 3.0)
ipaddress (0.8.3)
jaro_winkler (1.5.4)
jquery-migrate-rails (1.2.1)
jquery-rails (4.4.0)
rails-dom-testing (>= 1, < 3)
@@ -424,9 +416,18 @@ 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.20.0)
rake
@@ -440,7 +441,7 @@ GEM
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)
@@ -448,10 +449,11 @@ GEM
mini_portile2 (2.4.0)
mini_racer (0.2.15)
libv8 (> 7.3)
minitest (5.14.2)
money (5.0.0)
i18n (~> 0.4)
json
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)
@@ -465,11 +467,10 @@ GEM
multi_json (~> 1.3)
multi_xml (~> 0.5)
rack (>= 1.2, < 3)
oj (3.10.8)
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)
@@ -477,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
@@ -489,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.6.13)
rack-mini-profiler (2.0.2)
rack-mini-profiler (2.3.0)
rack (>= 1.2.0)
rack-protection (1.5.5)
rack
@@ -536,7 +537,7 @@ GEM
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)
@@ -550,7 +551,7 @@ GEM
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)
@@ -576,25 +577,25 @@ GEM
rspec-core (~> 3.10.0)
rspec-expectations (~> 3.10.0)
rspec-mocks (~> 3.10.0)
rspec-core (3.10.0)
rspec-core (3.10.1)
rspec-support (~> 3.10.0)
rspec-expectations (3.10.0)
rspec-expectations (3.10.1)
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)
rspec-rails (4.0.2)
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-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.10.0)
rspec-support (3.10.1)
rswag (2.3.1)
rswag-api (= 2.3.1)
rswag-specs (= 2.3.1)
@@ -608,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)
@@ -636,19 +640,17 @@ GEM
selenium-webdriver (3.142.7)
childprocess (>= 0.5, < 4.0)
rubyzip (>= 1.2.2)
shoulda-matchers (4.0.1)
shoulda-matchers (4.5.0)
activesupport (>= 4.2.0)
simplecov (0.17.1)
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 (2.0.2)
activesupport (>= 4.2)
spring (2.1.1)
spring-commands-rspec (1.0.4)
spring (>= 0.9.1)
sprockets (2.12.5)
@@ -668,10 +670,10 @@ GEM
activerecord (>= 4.1)
state_machines-activemodel (>= 0.5.0)
stringex (2.8.5)
stripe (5.28.0)
stripe (5.29.0)
temple (0.8.2)
test-prof (0.7.5)
test-unit (3.3.7)
test-prof (0.11.3)
test-unit (3.3.9)
power_assert
test_after_commit (1.2.2)
activerecord (>= 3.2, < 5.0)
@@ -679,15 +681,15 @@ GEM
thread_safe (0.3.6)
tilt (1.4.1)
timecop (0.9.2)
tzinfo (1.2.8)
tzinfo (1.2.9)
thread_safe (~> 0.1)
uglifier (4.2.0)
execjs (>= 0.3.0, < 3)
unf (0.1.4)
unf_ext
unf_ext (0.0.7.7)
unicode-display_width (1.7.0)
unicorn (5.7.0)
unicode-display_width (2.0.0)
unicorn (5.8.0)
kgio (~> 2.6)
raindrops (~> 0.7)
unicorn-rails (2.2.1)
@@ -698,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.10.0)
webmock (3.11.1)
addressable (>= 2.3.6)
crack (>= 0.3.2)
hashdiff (>= 0.4.0, < 2.0.0)
@@ -733,12 +735,12 @@ DEPENDENCIES
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)
byebug
cancancan (~> 1.7.0)
capybara
catalog!
coffee-rails (~> 4.2.2)
@@ -763,7 +765,7 @@ DEPENDENCIES
figaro
foundation-icons-sass-rails
foundation-rails (= 5.5.2.1)
fuubar (~> 2.5.0)
fuubar (~> 2.5.1)
geocoder
gmaps4rails
haml
@@ -777,21 +779,21 @@ DEPENDENCIES
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 (< 6.1.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
@@ -814,7 +816,6 @@ DEPENDENCIES
selenium-webdriver
shoulda-matchers
simplecov
spree_paypal_express!
spring
spring-commands-rspec
state_machines-activerecord
@@ -836,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

@@ -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

@@ -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,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

@@ -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

@@ -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

@@ -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
@@ -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

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

@@ -10,12 +10,14 @@ module Api
include Spree::Core::ControllerHelpers::SSL
include ::ActionController::Head
include ::ActionController::ConditionalGet
include ActionView::Layouts
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,16 +58,12 @@ 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)
Bugsnag.notify(exception)
render(json: { exception: exception.message },
status: :unprocessable_entity) && return
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 plain: products, content_type: "application/json"
render plain: products
rescue ProductsRenderer::NoProducts
render_no_products
end
@@ -33,19 +33,19 @@ module Api
render plain: ActiveModel::ArraySerializer.new(
taxons, each_serializer: Api::TaxonSerializer
).to_json, content_type: "application/json"
).to_json
end
def properties
render plain: ActiveModel::ArraySerializer.new(
product_properties | producer_properties, each_serializer: Api::PropertySerializer
).to_json, content_type: "application/json"
).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,33 +130,21 @@ 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] || {}).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
}
end
def product_params
params.require(:product).permit PermittedAttributes::Product.attributes
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

@@ -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

@@ -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

@@ -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

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,4 +1,6 @@
require 'stripe/credit_card_clone_destroyer'
# frozen_string_literal: true
require 'stripe/credit_card_remover'
module Spree
class CreditCardsController < BaseController
@@ -42,7 +44,7 @@ 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
@@ -64,14 +66,6 @@ module Spree
@credit_card.user.customers.update_all(allow_charges: false)
end
# It destroys the whole customer object
def destroy_at_stripe
Stripe::CreditCardCloneDestroyer.new.destroy_clones(@credit_card)
stripe_customer = Stripe::Customer.retrieve(@credit_card.gateway_customer_profile_id, {})
stripe_customer&.delete unless stripe_customer.deleted?
end
def create_customer(token)
Stripe::Customer.create(email: spree_current_user.email, source: token)
end

View File

@@ -1,6 +1,8 @@
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,157 +0,0 @@
# frozen_string_literal: true
Spree::PaypalController.class_eval do
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 #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?
# 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. 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 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
if current_order.complete?
flash[:notice] = t(:order_processed_successfully)
OrderCompletionReset.new(self, current_order).call
session[:access_token] = current_order.token
end
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 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

@@ -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,4 +1,4 @@
require 'spree/money_decorator'
require 'spree/money'
module Spree
module ReportsHelper

View File

@@ -2,7 +2,7 @@
class ConfirmOrderJob < ActiveJob::Base
def perform(order_id)
Spree::OrderMailer.confirm_email_for_customer(order_id).deliver
Spree::OrderMailer.confirm_email_for_shop(order_id).deliver
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,8 +0,0 @@
# frozen_string_literal: true
class ConfirmSignupJob < ActiveJob::Base
def perform(user_id)
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

View File

@@ -1,7 +0,0 @@
ManagerInvitationJob = Struct.new(:enterprise_id, :user_id) do
def perform
enterprise = Enterprise.find enterprise_id
user = Spree::User.find user_id
EnterpriseMailer.manager_invitation(enterprise, user).deliver
end
end

View File

@@ -5,7 +5,7 @@ class OrderCycleNotificationJob < ActiveJob::Base
def perform(order_cycle_id)
order_cycle = OrderCycle.find(order_cycle_id)
order_cycle.suppliers.each do |supplier|
ProducerMailer.order_cycle_report(supplier, order_cycle).deliver
ProducerMailer.order_cycle_report(supplier, order_cycle).deliver_now
end
end
end

View File

@@ -1,7 +1,7 @@
require 'order_management/subscriptions/summarizer'
# Confirms orders of unconfirmed proxy orders in recently closed Order Cycles
class SubscriptionConfirmJob
class SubscriptionConfirmJob < ActiveJob::Base
def perform
confirm_proxy_orders!
end
@@ -90,13 +90,13 @@ class SubscriptionConfirmJob
def send_confirmation_email(order)
order.update!
record_success(order)
SubscriptionMailer.confirmation_email(order).deliver
SubscriptionMailer.confirmation_email(order).deliver_now
end
def send_failed_payment_email(order, error_message = nil)
order.update!
record_and_log_error(:failed_payment, order, error_message)
SubscriptionMailer.failed_payment_email(order).deliver
SubscriptionMailer.failed_payment_email(order).deliver_now
rescue StandardError => e
Bugsnag.notify(e, order: order, error_message: error_message)
end

View File

@@ -1,6 +1,6 @@
require 'order_management/subscriptions/summarizer'
class SubscriptionPlacementJob
class SubscriptionPlacementJob < ActiveJob::Base
def perform
ids = proxy_orders.pluck(:id)
proxy_orders.update_all(placed_at: Time.zone.now)
@@ -87,11 +87,11 @@ class SubscriptionPlacementJob
def send_placement_email(order, changes)
record_issue(:changes, order) if changes.present?
record_success(order) if changes.blank?
SubscriptionMailer.placement_email(order, changes).deliver
SubscriptionMailer.placement_email(order, changes).deliver_now
end
def send_empty_email(order, changes)
record_issue(:empty, order)
SubscriptionMailer.empty_email(order, changes).deliver
SubscriptionMailer.empty_email(order, changes).deliver_now
end
end

View File

@@ -1,8 +0,0 @@
# frozen_string_literal: true
class WelcomeEnterpriseJob < ActiveJob::Base
def perform(enterprise_id)
enterprise = Enterprise.find enterprise_id
EnterpriseMailer.welcome(enterprise).deliver
end
end

View File

@@ -400,7 +400,7 @@ class Enterprise < ActiveRecord::Base
end
def send_welcome_email
WelcomeEnterpriseJob.perform_later(id)
EnterpriseMailer.welcome(self).deliver_later
end
def strip_url(url)

View File

@@ -86,18 +86,10 @@ module Spree
# Update the boolean _eligible_ attribute which determines which adjustments
# count towards the order's adjustment_total.
def set_eligibility
result = mandatory || (amount != 0 && eligible_for_originator?)
result = mandatory || amount != 0
update_column(:eligible, result)
end
# Allow originator of the adjustment to perform an additional eligibility of the adjustment
# Should return _true_ if originator is absent or doesn't implement _eligible?_
def eligible_for_originator?
return true if originator.nil?
!originator.respond_to?(:eligible?) || originator.eligible?(source)
end
# Update both the eligibility and amount of the adjustment. Adjustments
# delegate updating of amount to their Originator when present, but only if
# +locked+ is false. Adjustments that are +locked+ will never change their amount.

View File

@@ -0,0 +1,114 @@
# frozen_string_literal: true
require 'paypal-sdk-merchant'
module Spree
class Gateway
class PayPalExpress < Gateway
preference :login, :string
preference :password, :password
preference :signature, :string
preference :server, :string, default: 'sandbox'
preference :solution, :string, default: 'Mark'
preference :landing_page, :string, default: 'Billing'
preference :logourl, :string, default: ''
def supports?(_source)
true
end
def provider_class
::PayPal::SDK::Merchant::API
end
def provider
::PayPal::SDK.configure(
mode: preferred_server.presence || "sandbox",
username: preferred_login,
password: preferred_password,
signature: preferred_signature
)
provider_class.new
end
def auto_capture?
true
end
def method_type
'paypal'
end
def purchase(_amount, express_checkout, _gateway_options = {})
pp_details_request = provider.build_get_express_checkout_details(
Token: express_checkout.token
)
pp_details_response = provider.get_express_checkout_details(pp_details_request)
pp_request = provider.build_do_express_checkout_payment(
DoExpressCheckoutPaymentRequestDetails: {
PaymentAction: "Sale",
Token: express_checkout.token,
PayerID: express_checkout.payer_id,
PaymentDetails: pp_details_response.
get_express_checkout_details_response_details.PaymentDetails
}
)
pp_response = provider.do_express_checkout_payment(pp_request)
if pp_response.success?
# We need to store the transaction id for the future.
# This is mainly so we can use it later on to refund the payment if the user wishes.
transaction_id = pp_response.do_express_checkout_payment_response_details.
payment_info.first.transaction_id
express_checkout.update_column(:transaction_id, transaction_id)
# This is rather hackish, required for payment/processing handle_response code.
Class.new do
def success?; true; end
def authorization; nil; end
end.new
else
class << pp_response
def to_s
errors.map(&:long_message).join(" ")
end
end
pp_response
end
end
def refund(payment, amount)
refund_type = payment.amount == amount.to_f ? "Full" : "Partial"
refund_transaction = provider.build_refund_transaction(
TransactionID: payment.source.transaction_id,
RefundType: refund_type,
Amount: {
currencyID: payment.currency,
value: amount
},
RefundSource: "any"
)
refund_transaction_response = provider.refund_transaction(refund_transaction)
if refund_transaction_response.success?
payment.source.update_attributes(
refunded_at: Time.now,
refund_transaction_id: refund_transaction_response.RefundTransactionID,
state: "refunded",
refund_type: refund_type
)
payment.class.create!(
order: payment.order,
source: payment,
payment_method: payment.payment_method,
amount: amount.to_f.abs * -1,
response_code: refund_transaction_response.RefundTransactionID,
state: 'completed'
)
end
refund_transaction_response
end
end
end
end

View File

@@ -5,7 +5,8 @@ module Spree
belongs_to :variant, class_name: "Spree::Variant"
belongs_to :order, class_name: "Spree::Order"
belongs_to :shipment, class_name: "Spree::Shipment"
belongs_to :return_authorization, class_name: "Spree::ReturnAuthorization"
belongs_to :return_authorization, class_name: "Spree::ReturnAuthorization",
inverse_of: :inventory_units
scope :backordered, -> { where state: 'backordered' }
scope :shipped, -> { where state: 'shipped' }

View File

@@ -41,7 +41,7 @@ module Spree
has_many :state_changes, as: :stateful
has_many :line_items, -> { order('created_at ASC') }, dependent: :destroy
has_many :payments, dependent: :destroy
has_many :return_authorizations, dependent: :destroy
has_many :return_authorizations, dependent: :destroy, inverse_of: :order
has_many :adjustments, -> { order "#{Spree::Adjustment.table_name}.created_at ASC" },
as: :adjustable,
dependent: :destroy
@@ -87,7 +87,6 @@ module Spree
after_create :create_tax_charge!
validate :has_available_shipment
validate :has_available_payment
validates :email, presence: true,
format: /\A([\w\.%\+\-']+)@([\w\-]+\.)+([\w]{2,})\z/i,
if: :require_email
@@ -97,9 +96,6 @@ module Spree
before_save :update_shipping_fees!, if: :complete?
before_save :update_payment_fees!, if: :complete?
class_attribute :update_hooks
self.update_hooks = Set.new
# -- Scopes
scope :managed_by, lambda { |user|
if user.has_spree_role?('admin')
@@ -158,12 +154,6 @@ module Spree
where(completed_at: nil)
end
# Use this method in other gems that wish to register their own custom logic
# that should be called after Order#update
def self.register_update_hook(hook)
update_hooks.add(hook)
end
# For compatiblity with Calculator::PriceSack
def amount
line_items.inject(0.0) { |sum, li| sum + li.amount }
@@ -451,7 +441,6 @@ module Spree
updater.update_shipment_state
updater.before_save_hook
save
updater.run_hooks
deliver_order_confirmation_email
@@ -766,13 +755,6 @@ module Spree
address
end
# Update attributes of a record in the database without callbacks, validations etc.
# This was originally an extension to ActiveRecord in Spree but only used for Spree::Order
def update_attributes_without_callbacks(attributes)
assign_attributes(attributes)
Spree::Order.where(id: id).update_all(attributes)
end
private
def process_each_payment
@@ -816,15 +798,10 @@ module Spree
errors.add(:base, Spree.t(:items_cannot_be_shipped)) && (return false)
end
def has_available_payment
return unless delivery?
# errors.add(:base, :no_payment_methods_available) if available_payment_methods.empty?
end
def after_cancel
shipments.each(&:cancel!)
OrderMailer.cancel_email(id).deliver
OrderMailer.cancel_email(id).deliver_later
self.payment_state = 'credit_owed' unless shipped?
end

View File

@@ -23,7 +23,7 @@ module Spree
has_one :adjustment, as: :source, dependent: :destroy
validate :validate_source
before_save :set_unique_identifier
before_create :set_unique_identifier
after_save :create_payment_profile, if: :profiles_supported?

View File

@@ -110,23 +110,8 @@ module Spree
end
def self.clean_name
case name
when "Spree::PaymentMethod::Check"
"Cash/EFT/etc. (payments for which automatic validation is not required)"
when "Spree::Gateway::Migs"
"MasterCard Internet Gateway Service (MIGS)"
when "Spree::Gateway::Pin"
"Pin Payments"
when "Spree::Gateway::StripeConnect"
"Stripe"
when "Spree::Gateway::StripeSCA"
"Stripe SCA"
when "Spree::Gateway::PayPalExpress"
"PayPal Express"
else
i = name.rindex('::') + 2
name[i..-1]
end
i18n_key = "spree.admin.payment_methods.providers." + name.demodulize.downcase
I18n.t(i18n_key)
end
private

View File

@@ -0,0 +1,6 @@
# frozen_string_literal: true
module Spree
class PaypalExpressCheckout < ActiveRecord::Base
end
end

View File

@@ -115,6 +115,7 @@ module Spree
when :password
value.to_s
when :decimal
value = 0 if value.blank?
BigDecimal(value.to_s).round(2, BigDecimal::ROUND_HALF_UP)
when :integer
value.to_i

View File

@@ -274,10 +274,6 @@ module Spree
!!deleted_at
end
def available?
!(available_on.nil? || available_on.future?)
end
# split variants list into hash which shows mapping of opt value onto matching variants
# eg categorise_variants_from_option(color) => {"red" -> [...], "blue" -> [...]}
def categorise_variants_from_option(opt_type)

View File

@@ -2,9 +2,9 @@
module Spree
class ReturnAuthorization < ActiveRecord::Base
belongs_to :order, class_name: 'Spree::Order'
belongs_to :order, class_name: 'Spree::Order', inverse_of: :return_authorizations
has_many :inventory_units
has_many :inventory_units, inverse_of: :return_authorization
has_one :stock_location
before_create :generate_number
before_save :force_positive_amount

View File

@@ -319,7 +319,7 @@ module Spree
end
def send_shipped_email
ShipmentMailer.shipped_email(id).deliver
ShipmentMailer.shipped_email(id).deliver_later
end
def update_adjustment_included_tax

View File

@@ -4,7 +4,7 @@ module Spree
class ShippingCategory < ActiveRecord::Base
validates :name, presence: true
has_many :products
has_many :shipping_method_categories
has_many :shipping_method_categories, inverse_of: :shipping_method
has_many :shipping_methods, through: :shipping_method_categories
end
end

View File

@@ -5,6 +5,7 @@ module Spree
include Spree::Core::CalculatedAdjustments
DISPLAY = [:both, :front_end, :back_end].freeze
acts_as_paranoid
acts_as_taggable
default_scope -> { where(deleted_at: nil) }
@@ -12,7 +13,7 @@ module Spree
has_many :shipments
has_many :shipping_method_categories
has_many :shipping_categories, through: :shipping_method_categories
has_many :shipping_rates
has_many :shipping_rates, inverse_of: :shipping_method
has_many :distributor_shipping_methods
has_many :distributors, through: :distributor_shipping_methods,
class_name: 'Enterprise',

View File

@@ -3,6 +3,7 @@
module Spree
class ShippingMethodCategory < ActiveRecord::Base
belongs_to :shipping_method, class_name: 'Spree::ShippingMethod'
belongs_to :shipping_category, class_name: 'Spree::ShippingCategory'
belongs_to :shipping_category, class_name: 'Spree::ShippingCategory',
inverse_of: :shipping_method_categories
end
end

View File

@@ -3,7 +3,7 @@
module Spree
class ShippingRate < ActiveRecord::Base
belongs_to :shipment, class_name: 'Spree::Shipment'
belongs_to :shipping_method, class_name: 'Spree::ShippingMethod'
belongs_to :shipping_method, class_name: 'Spree::ShippingMethod', inverse_of: :shipping_rates
scope :frontend,
-> {

View File

@@ -4,9 +4,9 @@ module Spree
class StockItem < ActiveRecord::Base
acts_as_paranoid
belongs_to :stock_location, class_name: 'Spree::StockLocation'
belongs_to :stock_location, class_name: 'Spree::StockLocation', inverse_of: :stock_items
belongs_to :variant, class_name: 'Spree::Variant'
has_many :stock_movements, dependent: :destroy
has_many :stock_movements
validates :stock_location, :variant, presence: true
validates :variant_id, uniqueness: { scope: [:stock_location_id, :deleted_at] }

View File

@@ -2,7 +2,7 @@
module Spree
class StockLocation < ActiveRecord::Base
has_many :stock_items, dependent: :delete_all
has_many :stock_items, dependent: :delete_all, inverse_of: :stock_location
has_many :stock_movements, through: :stock_items
belongs_to :state, class_name: 'Spree::State'

View File

@@ -5,7 +5,7 @@ module Spree
acts_as_paranoid
validates :name, presence: true, uniqueness: { scope: :deleted_at }
has_many :tax_rates, dependent: :destroy
has_many :tax_rates, dependent: :destroy, inverse_of: :tax_category
before_save :set_default_category

View File

@@ -7,7 +7,7 @@ module Spree
return if Zone.default_tax
record.errors.add(:included_in_price, Spree.t(:included_price_validation))
record.errors.add(:included_in_price, Spree.t("errors.messages.included_price_validation"))
end
end
end
@@ -16,8 +16,8 @@ module Spree
class TaxRate < ActiveRecord::Base
acts_as_paranoid
include Spree::Core::CalculatedAdjustments
belongs_to :zone, class_name: "Spree::Zone"
belongs_to :tax_category, class_name: "Spree::TaxCategory"
belongs_to :zone, class_name: "Spree::Zone", inverse_of: :tax_rates
belongs_to :tax_category, class_name: "Spree::TaxCategory", inverse_of: :tax_rates
validates :amount, presence: true, numericality: true
validates :tax_category_id, presence: true

View File

@@ -101,7 +101,7 @@ module Spree
end
def send_signup_confirmation
ConfirmSignupJob.perform_later(id)
Spree::UserMailer.signup_confirmation(self).deliver_later
end
def associate_customers

View File

@@ -18,10 +18,10 @@ module Spree
:tax_category_id, :shipping_category_id, :meta_description,
:meta_keywords, :tax_category, :shipping_category
has_many :inventory_units
has_many :line_items
has_many :inventory_units, inverse_of: :variant
has_many :line_items, inverse_of: :variant
has_many :stock_items, dependent: :destroy
has_many :stock_items, dependent: :destroy, inverse_of: :variant
has_many :stock_locations, through: :stock_items
has_many :stock_movements
@@ -65,6 +65,7 @@ module Spree
before_validation :set_cost_currency
before_validation :update_weight_from_unit_value, if: ->(v) { v.product.present? }
before_validation :ensure_unit_value
after_save :save_default_price
after_save :update_units
@@ -297,5 +298,11 @@ module Spree
exchange_variants(:reload).destroy_all
yield
end
def ensure_unit_value
return unless product&.variant_unit == "items" && unit_value.nil?
self.unit_value = 1.0
end
end
end

View File

@@ -2,8 +2,8 @@
module Spree
class Zone < ActiveRecord::Base
has_many :zone_members, dependent: :destroy, class_name: "Spree::ZoneMember"
has_many :tax_rates, dependent: :destroy
has_many :zone_members, dependent: :destroy, class_name: "Spree::ZoneMember", inverse_of: :zone
has_many :tax_rates, dependent: :destroy, inverse_of: :zone
has_and_belongs_to_many :shipping_methods, join_table: 'spree_shipping_methods_zones'
validates :name, presence: true, uniqueness: true

View File

@@ -2,7 +2,7 @@
module Spree
class ZoneMember < ActiveRecord::Base
belongs_to :zone, class_name: 'Spree::Zone', counter_cache: true
belongs_to :zone, class_name: 'Spree::Zone', counter_cache: true, inverse_of: :zone_members
belongs_to :zoneable, polymorphic: true
def name

View File

@@ -4,7 +4,7 @@ module Api
module Admin
class CustomerSerializer < ActiveModel::Serializer
attributes :id, :email, :enterprise_id, :user_id, :code, :tags, :tag_list, :name,
:allow_charges, :default_card_present?, :balance, :balance_status
:allow_charges, :default_card_present?
has_one :ship_address, serializer: Api::AddressSerializer
has_one :bill_address, serializer: Api::AddressSerializer
@@ -17,20 +17,6 @@ module Api
customer_tag_list.join(",")
end
def balance
Spree::Money.new(balance_value, currency: Spree::Config[:currency]).to_s
end
def balance_status
if balance_value.positive?
"credit_owed"
elsif balance_value.negative?
"balance_due"
else
""
end
end
def tags
customer_tag_list.map do |tag|
tag_rule_map = options[:tag_rule_mapping].andand[tag]
@@ -51,11 +37,6 @@ module Api
options[:customer_tags].andand[object.id] || []
end
def balance_value
@balance_value ||=
OpenFoodNetwork::UserBalanceCalculator.new(object.email, object.enterprise).balance
end
end
end
end

View File

@@ -0,0 +1,29 @@
# frozen_string_literal: true
module Api
module Admin
# This serializer relies on `object` to respond to `#balance_value`. That's done in
# `CustomersWithBalance` due to the fact that ActiveRecord maps the DB result set's columns to
# instance methods. This way, the `balance_value` alias on that class ends up being
# `object.balance_value` here.
class CustomerWithBalanceSerializer < CustomerSerializer
attributes :balance, :balance_status
delegate :balance_value, to: :object
def balance
Spree::Money.new(balance_value, currency: Spree::Config[:currency]).to_s
end
def balance_status
if balance_value.positive?
"credit_owed"
elsif balance_value.negative?
"balance_due"
else
""
end
end
end
end
end

View File

@@ -0,0 +1,28 @@
# frozen_string_literal: true
module Api
module Admin
class CustomerWithCalculatedBalanceSerializer < CustomerSerializer
attributes :balance, :balance_status
def balance
Spree::Money.new(balance_value, currency: Spree::Config[:currency]).to_s
end
def balance_status
if balance_value.positive?
"credit_owed"
elsif balance_value.negative?
"balance_due"
else
""
end
end
def balance_value
@balance_value ||=
OpenFoodNetwork::UserBalanceCalculator.new(object.email, object.enterprise).balance
end
end
end
end

View File

@@ -5,11 +5,9 @@ module Api
class VariantSerializer < ActiveModel::Serializer
attributes :id, :name, :producer_name, :image, :sku, :import_date,
:options_text, :unit_value, :unit_description, :unit_to_display,
:display_as, :display_name, :name_to_display,
:display_as, :display_name, :name_to_display, :variant_overrides_count,
:price, :on_demand, :on_hand, :in_stock, :stock_location_id, :stock_location_name
has_many :variant_overrides
def name
if object.full_name.present?
"#{object.name} - #{object.full_name}"
@@ -55,6 +53,10 @@ module Api
object.stock_items.first.stock_location.name
end
def variant_overrides_count
object.variant_overrides.count
end
end
end
end

View File

@@ -1,8 +1,6 @@
require "open_food_network/scope_variant_to_hub"
class Api::ProductSerializer < ActiveModel::Serializer
include ActionView::Helpers::SanitizeHelper
attributes :id, :name, :permalink, :meta_keywords
attributes :group_buy, :notes, :description, :description_html
attributes :properties_with_values, :price
@@ -18,14 +16,12 @@ class Api::ProductSerializer < ActiveModel::Serializer
# return an unformatted descripton
def description
strip_tags object.description&.strip
sanitizer.strip_content(object.description)
end
# return a sanitized html description
def description_html
d = sanitize(object.description, tags: ["p", "b", "strong", "em", "i", "a", "u"],
attributes: ["href", "target"])
d.to_s.html_safe
sanitizer.sanitize_content(object.description)&.html_safe
end
def properties_with_values
@@ -47,4 +43,10 @@ class Api::ProductSerializer < ActiveModel::Serializer
object.master.price_with_fees(options[:current_distributor], options[:current_order_cycle])
end
end
private
def sanitizer
@sanitizer ||= ContentSanitizer.new
end
end

View File

@@ -0,0 +1,40 @@
# frozen_string_literal: true
# Sanitizes and cleans up user-provided content that may contain tags, special characters, etc.
class ContentSanitizer
include ActionView::Helpers::SanitizeHelper
ALLOWED_TAGS = ["p", "b", "strong", "em", "i", "a", "u"].freeze
ALLOWED_ATTRIBUTES = ["href", "target"].freeze
FILTERED_CHARACTERS = {
"&amp;amp;" => "&",
"&amp;" => "&",
"&nbsp;" => " "
}.freeze
def strip_content(content)
return unless content.present?
content = strip_tags(content.to_s.strip)
filter_characters(content)
end
def sanitize_content(content)
return unless content.present?
content = sanitize(content.to_s, tags: ALLOWED_TAGS, attributes: ALLOWED_ATTRIBUTES)
filter_characters(content)
end
private
def filter_characters(content)
FILTERED_CHARACTERS.each do |character, sub|
content = content.gsub(character, sub)
end
content
end
end

View File

@@ -0,0 +1,61 @@
# frozen_string_literal: true
class CustomersWithBalance
def initialize(enterprise)
@enterprise = enterprise
end
def query
Customer.of(enterprise).
joins(left_join_complete_orders).
group("customers.id").
select("customers.*").
select(outstanding_balance)
end
private
attr_reader :enterprise
# Arel doesn't support CASE statements until v7.1.0 so we'll have to wait with SQL literals
# a little longer. See https://github.com/rails/arel/pull/400 for details.
def outstanding_balance
<<-SQL.strip_heredoc
SUM(
CASE WHEN state IN #{non_fulfilled_states_group.to_sql} THEN payment_total
WHEN state IS NOT NULL THEN payment_total - total
ELSE 0 END
) AS balance_value
SQL
end
# The resulting orders are in states that belong after the checkout. Only these can be considered
# for a customer's balance.
def left_join_complete_orders
<<-SQL.strip_heredoc
LEFT JOIN spree_orders ON spree_orders.customer_id = customers.id
AND #{complete_orders.to_sql}
SQL
end
def complete_orders
states_group = prior_to_completion_states.map { |state| Arel::Nodes.build_quoted(state) }
Arel::Nodes::NotIn.new(Spree::Order.arel_table[:state], states_group)
end
def non_fulfilled_states_group
states_group = non_fulfilled_states.map { |state| Arel::Nodes.build_quoted(state) }
Arel::Nodes::Grouping.new(states_group)
end
# All the states an order can be in before completing the checkout
def prior_to_completion_states
%w(cart address delivery payment)
end
# All the states of a complete order but that shouldn't count towards the balance. Those that the
# customer won't enjoy.
def non_fulfilled_states
%w(canceled returned)
end
end

View File

@@ -2,7 +2,6 @@ require 'open_food_network/scope_product_to_hub'
class ProductsRenderer
class NoProducts < RuntimeError; end
DEFAULT_PAGE = 1
DEFAULT_PER_PAGE = 10
def initialize(distributor, order_cycle, customer, args = {})
@@ -51,7 +50,7 @@ class ProductsRenderer
query.
ransack(args[:q]).
result.
page(args[:page] || DEFAULT_PAGE).
page(args[:page] || 1).
per(args[:per_page] || DEFAULT_PER_PAGE)
end

View File

@@ -8,17 +8,6 @@ class SearchOrders
@orders = fetch_orders
end
def pagination_data
return unless using_pagination?
{
results: @orders.total_count,
pages: @orders.num_pages,
page: params[:page].to_i,
per_page: params[:per_page].to_i
}
end
private
attr_reader :params, :current_user
@@ -50,6 +39,6 @@ class SearchOrders
end
def using_pagination?
params[:per_page]
params[:page]
end
end

View File

@@ -1,27 +1,28 @@
%div{"ng-controller" => "OrderCycleChangeCtrl", "ng-cloak" => true}
%closing
%div{"ng-if" => "OrderCycle.selected()"}
%div{"ng-if" => "closesInLessThan3Months()"}
= t :enterprises_next_closing
%strong {{ OrderCycle.orders_close_at() | date_in_words }}
%div{"ng-if" => "!closesInLessThan3Months()"}
= t :enterprises_currently_open
%div{"ng-if" => "!OrderCycle.selected()"}
= t :enterprises_choose
.select-and-closing-container
%closing
%div{"ng-if" => "OrderCycle.selected()"}
%div{"ng-if" => "closesInLessThan3Months()"}
= t :enterprises_next_closing
%strong {{ OrderCycle.orders_close_at() | date_in_words }}
%div{"ng-if" => "!closesInLessThan3Months()"}
= t :enterprises_currently_open
%div{"ng-if" => "!OrderCycle.selected()"}
= t :enterprises_choose
.order-cycle-select
.select-label
%span= t :enterprises_ready_for
.order-cycle-select
.select-label
%span= t :enterprises_ready_for
- if oc_select_options.count == 1
%p
= oc_select_options.first[:time]
- if oc_select_options.count == 1
%p
= oc_select_options.first[:time]
- else
%select.select2.avenir#order_cycle_id{"ng-model" => "order_cycle.order_cycle_id",
"ofn-change-order-cycle" => true,
"disabled" => require_customer?,
"ng-options" => "oc.id as oc.time for oc in #{oc_select_options.to_json}"}
- else
%select.select2.avenir#order_cycle_id{"ng-model" => "order_cycle.order_cycle_id",
"ofn-change-order-cycle" => true,
"disabled" => require_customer?,
"ng-options" => "oc.id as oc.time for oc in #{oc_select_options.to_json}"}
- if oc_select_options.count > 1
%option{value: "", disabled: "", selected: ""}= t :shopping_oc_select
- if oc_select_options.count > 1
%option{value: "", disabled: "", selected: ""}= t :shopping_oc_select

View File

@@ -59,10 +59,6 @@
= label_tag(key, Spree.t(key) + ': ') + tag(:br) if type != :boolean
= preference_field_tag(key, Spree::Config[key], :type => type)
= label_tag(key, Spree.t(key)) + tag(:br) if type == :boolean
.field
= label_tag :currency, Spree.t(:choose_currency)
%br/
= select_tag :currency, currency_options, :class => 'fullwidth'
.field
= label_tag Spree.t(:currency_symbol_position)
%br/

View File

@@ -14,7 +14,7 @@
= "#{count} x #{t(state.humanize.downcase, scope: [:spree, :shipment_states], default: [:missing, "none"])}"
- unless shipment.shipped?
%td.item-qty-edit.hidden
= number_field_tag :quantity, item.quantity, :min => 0, :class => "line_item_quantity", :size => 5
= number_field_tag :quantity, item.quantity, :min => 0, :class => "line_item_quantity", :size => 5, :max => item.variant.on_hand
%td.item-total.align-center
= line_item_shipment_price(line_item, item.quantity)

View File

@@ -0,0 +1,18 @@
= form_tag paypal_refund_admin_order_payment_path(@order, @payment) do
.label-block.left.five.columns.alpha
%div
%fieldset
%legend= Spree.t('refund', :scope => :paypal)
.field
= label_tag 'refund_amount', Spree.t(:refund_amount, :scope => 'paypal')
%small
%em= Spree.t(:original_amount, :scope => 'paypal', :amount => @payment.display_amount)
%br/
- symbol = ::Money.new(1, Spree::Config[:currency]).symbol
- if Spree::Config[:currency_symbol_position] == "before"
= symbol
= text_field_tag 'refund_amount', @payment.amount
- else
= text_field_tag 'refund_amount', @payment.amount
= symbol
= button Spree.t(:refund, :scope => 'paypal'), 'icon-dollar'

View File

@@ -0,0 +1,28 @@
= render partial: 'spree/admin/shared/order_tabs', locals: { current: 'Payments' }
- content_for :page_title do
%i.icon-arrow-right
= link_to Spree.t(:payments), admin_order_payments_path(@order)
%i.icon-arrow-right
= payment_method_name(@payment)
%i.icon-arrow-right
= Spree.t('refund', scope: :paypal)
= form_tag paypal_refund_admin_order_payment_path(@order, @payment) do
.label-block.left.five.columns.alpha
%div
%fieldset
%legend= Spree.t('refund', scope: :paypal)
.field
= label_tag 'refund_amount', Spree.t(:refund_amount, scope: 'paypal')
%small
%em= Spree.t(:original_amount, scope: 'paypal', amount: @payment.display_amount)
%br/
- symbol = ::Money.new(1, Spree::Config[:currency]).symbol
- if Spree::Config[:currency_symbol_position] == "before"
= symbol
= text_field_tag 'refund_amount', @payment.amount
- else
= text_field_tag 'refund_amount', @payment.amount
= symbol
= button Spree.t(:refund, scope: 'paypal'), 'icon-dollar'

View File

@@ -1,8 +1,2 @@
-# We can remove this file as soon as we have a version of better_spree_paypal_express that includes:
-# https://github.com/spree-contrib/better_spree_paypal_express/commit/4360a1fb82d30d7601bc6a98e7b74819f0b377f0
-# The selectors in app/assets/javascripts/spree/backend/paypal_express.js don't work with the version
-# of the views we are using, so the warning below wasn't displaying without this override.
#paypal-warning
%strong= t('.no_payment_via_admin_backend', :scope => 'paypal')

View File

@@ -0,0 +1,36 @@
%fieldset
%legend{align: "center"}= Spree.t(:transaction, scope: :paypal)
.row
.alpha.six.columns
%dl
%dt
= Spree.t(:payer_id, scope: :paypal)
\:
%dd= payment.source.payer_id
%dt
= Spree.t(:token, scope: :paypal)
\:
%dd= payment.source.token
%dt
= Spree.t(:transaction_id)
\:
%dd= payment.source.transaction_id
- if payment.source.state != 'refunded'
= button_link_to Spree.t('actions.refund', scope: :paypal),
spree.paypal_refund_admin_order_payment_path(@order, payment),
icon: 'icon-dollar'
- else
.alpha.six.columns
%dl
%dt
= Spree.t(:state, scope: :paypal)
\:
%dd= payment.source.state.titleize
%dt
= Spree.t(:refunded_at, scope: :paypal)
\:
%dd= pretty_time(payment.source.refunded_at)
%dt
= Spree.t(:refund_transaction_id, scope: :paypal)
\:
%dd= payment.source.refund_transaction_id

View File

@@ -1,5 +1,4 @@
.three.columns.omega{ "ng-if" => "product.variant_unit_with_scale != 'items'" }
= f.field_container :display_as do
= f.label :product_display_as, t('.display_as')
%span.required *
%input#product_display_as.fullwidth{name: "product[display_as]", placeholder: "{{ placeholder_text }}", type: "text"}

View File

@@ -29,6 +29,6 @@
%td.actions
%a{ 'ng-click' => 'editWarn(product,variant)', :class => "edit-variant icon-edit no-text", 'ng-show' => "variantSaved(variant)", 'ofn-with-tip' => t(:edit) }
%td.actions
%span.icon-warning-sign{ 'ng-if' => 'variant.variant_overrides', 'ofn-with-tip' => "{{ 'spree.admin.products.index.products_variant.variant_has_n_overrides' | t:{n: variant.variant_overrides.length} }}" }
%span.icon-warning-sign{ 'ng-if' => 'variant.variant_overrides_count > 0', 'ofn-with-tip' => "{{ 'spree.admin.products.index.products_variant.variant_has_n_overrides' | t:{n: variant.variant_overrides_count} }}" }
%td.actions
%a{ 'ng-click' => 'deleteVariant(product,variant)', "ng-class" => '{disabled: product.variants.length < 2}', :class => "delete-variant icon-trash no-text", 'ofn-with-tip' => t(:remove) }

View File

@@ -129,6 +129,7 @@ module Openfoodnetwork
app.config.spree.payment_methods << Spree::Gateway::Pin
app.config.spree.payment_methods << Spree::Gateway::StripeConnect
app.config.spree.payment_methods << Spree::Gateway::StripeSCA
app.config.spree.payment_methods << Spree::Gateway::PayPalExpress
end
# Settings in config/environments/* take precedence over those specified here.

View File

@@ -60,4 +60,11 @@ SMTP_PASSWORD: 'f00d'
# STRIPE_CLIENT_ID: "ca_xxxx" # This can be a development ID or a production ID
# STRIPE_ENDPOINT_SECRET: "whsec_xxxx"
# Feature toggles
#
# Adding user emails separated by commas will enable them the use of certain features. See
# config/initializers/feature_toggles.rb for details.
#
# BETA_TESTERS: ofn@example.com,superadmin@example.com
MEMCACHED_VALUE_MAX_MEGABYTES: '4'

View File

@@ -11,7 +11,7 @@ Openfoodnetwork::Application.configure do
config.action_controller.perform_caching = true
# Disable Rails's static asset server (Apache or nginx will already do this)
config.serve_static_assets = false
config.serve_static_files = false
# Compress JavaScripts and CSS
config.assets.compress = true

View File

@@ -11,7 +11,7 @@ Openfoodnetwork::Application.configure do
config.action_controller.perform_caching = true
# Disable Rails's static asset server (Apache or nginx will already do this)
config.serve_static_assets = false
config.serve_static_files = false
# Compress JavaScripts and CSS
config.assets.compress = true

View File

@@ -10,7 +10,7 @@ Openfoodnetwork::Application.configure do
config.eager_load = false
# Configure static asset server for tests with Cache-Control for performance
config.serve_static_assets = true
config.serve_static_files = true
config.static_cache_control = "public, max-age=3600"
# Separate cache stores when running in parallel

View File

@@ -1 +1 @@
require "action_dispatch/request"
require "action_dispatch/request" unless ENV['DEPENDENCIES_NEXT']

View File

@@ -1,7 +1,4 @@
unless Rails.env.production?
# Enable cache instrumentation, which is disabled by default
ActiveSupport::Cache::Store.instrument = true
# Log message in the same default logger
ActiveSupport::Cache::Store.logger = Rails.logger
end

View File

@@ -3,7 +3,9 @@ if ENV['DATADOG_RAILS_APM']
c.use :rails, service_name: 'rails'
c.use :delayed_job, service_name: 'delayed_job'
c.use :dalli, service_name: 'memcached'
c.analytics_enabled = true
c.runtime_metrics_enabled = true
c.request_queuing = true
end
end

View File

@@ -1,15 +1,17 @@
require_relative 'spree'
unless ENV['DEPENDENCIES_NEXT']
require_relative 'spree'
# See: https://github.com/itbeaver/db2fog
DB2Fog.config = {
:aws_access_key_id => Spree::Config[:s3_access_key],
:aws_secret_access_key => Spree::Config[:s3_secret],
:directory => ENV['S3_BACKUPS_BUCKET'],
:provider => 'AWS'
}
# See: https://github.com/itbeaver/db2fog
DB2Fog.config = {
:aws_access_key_id => Spree::Config[:s3_access_key],
:aws_secret_access_key => Spree::Config[:s3_secret],
:directory => ENV['S3_BACKUPS_BUCKET'],
:provider => 'AWS'
}
region = ENV['S3_BACKUPS_REGION'] || ENV['S3_REGION']
region = ENV['S3_BACKUPS_REGION'] || ENV['S3_REGION']
# If no region is defined we leave this config key undefined (instead of nil),
# so that db2fog correctly applies it's default
DB2Fog.config[:region] = region if region
# If no region is defined we leave this config key undefined (instead of nil),
# so that db2fog correctly applies it's default
DB2Fog.config[:region] = region if region
end

View File

@@ -0,0 +1,5 @@
require 'open_food_network/feature_toggle'
beta_testers = ENV['BETA_TESTERS']&.split(/[\s,]+/)
OpenFoodNetwork::FeatureToggle.enable(:customer_balance, beta_testers)

View File

@@ -1,13 +1,14 @@
# Make helpers (#t in particular) available to javascript templates
# https://github.com/pitr/angular-rails-templates/issues/45#issuecomment-43229086
Rails.application.assets.context_class.class_eval do
# include ApplicationHelper
# include ActionView::Helpers
# include Rails.application.routes.url_helpers
# Including all of the helpers (above) has caused some intermittent CSS include issues
# (not finding mixins from an @include in sass). Therefore, we're only including the
# bare minimum here.
include ActionView::Helpers::TranslationHelper
if ENV['DEPENDENCIES_NEXT']
Rails.application.config.assets.configure do |env|
env.context_class.class_eval do
include ActionView::Helpers::TranslationHelper
end
end
else
Rails.application.assets.context_class.class_eval do
include ActionView::Helpers::TranslationHelper
end
end

View File

@@ -0,0 +1,15 @@
# Fixes the issue about some PayPal requests failing with
# OpenSSL::SSL::SSLError (SSL_connect returned=1 errno=0 state=error: certificate verify failed)
module CAFileHack
# This overrides paypal-sdk-core default so we don't pass the cert the gem provides to the
# NET::HTTP instance. This way we rely on the default behavior of validating the server's cert
# against the CA certs of the OS (we assume), which tend to be up to date.
#
# See https://github.com/openfoodfoundation/openfoodnetwork/issues/5855 for details.
def default_ca_file
nil
end
end
require 'paypal-sdk-merchant'
PayPal::SDK::Core::Util::HTTPHelper.prepend(CAFileHack)

View File

@@ -2016,6 +2016,9 @@ ar:
delivery_method: طريقة التوصيل
fee_type: "نوع الرسوم"
tax_category: "الفئة الضريبية"
description: "وصف"
display: "عرض"
tags: "الاوسمة"
calculator: "آلة حاسبة"
calculator_values: "القيم المحوسبة"
calculator_settings_warning: "إذا كنت تقوم بتغيير نوع الحاسبة ، فيجب عليك الحفظ أولاً قبل أن تتمكن من تحرير إعدادات الحاسبة"
@@ -3128,6 +3131,7 @@ ar:
out_of_stock: '%{item} غير متوفر.'
actions:
update: "تحديث"
cancel: "إلغاء"
shared:
error_messages:
errors_prohibited_this_record_from_being_saved:
@@ -3587,6 +3591,8 @@ ar:
ended: انتهى
paused: التعليق
canceled: الالغاء
paypal:
refund_amount: "القيمة"
users:
form:
account_settings: إعدادت الحساب

View File

@@ -1572,6 +1572,7 @@ ca:
shopping_groups_part_of: "forma part de:"
shopping_producers_of_hub: "Productores de%{hub}:"
enterprises_next_closing: "La següent comanda tanca"
enterprises_currently_open: "Les comandes estan obertes"
enterprises_ready_for: "Llest per"
enterprises_choose: "Escull quan vols la teva comanda:"
maps_open: "Obert"
@@ -2019,6 +2020,9 @@ ca:
delivery_method: Mètode de lliurament
fee_type: "Tipus de comissió"
tax_category: "Categoria d'impostos"
description: "Descripció"
display: "Mostra"
tags: "Etiquetes"
calculator: "Calculadora"
calculator_values: "Valors de la calculadora"
calculator_settings_warning: "Si canvieu el tipus de calculadora, primer heu de desar abans de poder editar la configuració de la calculadora"
@@ -2085,6 +2089,7 @@ ca:
spree_classification_primary_taxon_error: "El taxó %{taxon} és el principal taxó d'%{product} i no es pot eliminar"
spree_order_availability_error: "La distribuïdora o el cicle de comanda no pot subministrar els productes de la vostra cistella"
spree_order_populator_error: "Aquesta distribuïdora o cicle de comanda no pot subministrar tots els productes de la vostra cistella. Si us plau trieu-ne d'altres."
spree_order_cycle_error: "Seleccioneu un cicle per a aquesta comanda."
spree_order_populator_availability_error: "Aquest producte no està disponible des de la distribuïdora o cicle de comanda seleccionat."
spree_distributors_error: "Cal seleccionar almenys un grup"
spree_user_enterprise_limit_error: "^ %{email} no està autoritzat a tenir més organitzacions (el límit és %{enterprise_limit})."
@@ -2377,6 +2382,7 @@ ca:
js:
saving: 'Desant...'
changes_saved: 'S''han desat els canvis.'
authorising: "Autoritzant..."
save_changes_first: Desa els canvis en primer lloc.
all_changes_saved: S'han desat tots els canvis
unsaved_changes: Teniu canvis sense desar
@@ -2392,6 +2398,7 @@ ca:
resolve_errors: Si us plau, resol els errors següents
more_items: "+ %{count} Més"
default_card_updated: Targeta predeterminada actualitzada
default_card_voids_auth: Si canvieu la targeta predeterminada, seliminaran les autoritzacions existents de les botigues per cobrar-la. Podeu tornar a autoritzar les botigues després d'actualitzar la targeta predeterminada. Voleu canviar la targeta predeterminada?
cart:
add_to_cart_failed: >
S'ha produït un problema en afegir aquest producte a la cistella. Potser
@@ -3041,6 +3048,7 @@ ca:
out_of_stock: '%{item} està esgotat.'
actions:
update: "Actualitzar"
cancel: "Cancel·lar"
shared:
error_messages:
errors_prohibited_this_record_from_being_saved:
@@ -3056,6 +3064,7 @@ ca:
payment_state: "Estat del pagament"
errors:
messages:
included_price_validation: "no es pot seleccionar tret que hàgiu establert una zona fiscal predeterminada"
blank: "no es pot deixar en blanc"
layouts:
admin:
@@ -3266,6 +3275,14 @@ ca:
deactivation_warning: "Desactivar un mètode de pagament pot fer que el mètode de pagament desapareixi de la vostra llista. De forma alternativa, podeu amagar un mètode de pagament a la pàgina de compra configurant l'opció \"Mostrar\" a \"només a la pàgina d'administració\" (back end)."
providers:
provider: "Proveïdor"
check: "Efectiu / transferència / etc. (pagaments per als quals no és necessària la validació automàtica)"
migs: "MasterCard Internet Gateway Service (MIGS)"
pin: "Pin Payments"
paypalexpress: "PayPal Express"
stripeconnect: "Stripe"
stripesca: "Stripe SCA"
bogus: "Bogus"
bogussimple: "BogusSimple"
payments:
source_forms:
stripe:
@@ -3500,6 +3517,24 @@ ca:
ended: acabat
paused: en pausa
canceled: cancel·lat
paypal:
already_refunded: "Aquest pagament s'ha reembossat i no es poden emprendre mesures addicionals."
no_payment_via_admin_backend: "En aquest moment no podeu carregar comptes de PayPal mitjançant el panell dadministració."
transaction: "Transacció PayPal"
payer_id: "Id de pagador"
transaction_id: "Id de transacció"
token: "Token"
refund: "Reembossament"
refund_amount: "Quantitat"
original_amount: "Import original: %{amount}"
refund_successful: "reembossament de PayPal exitós"
refund_unsuccessful: "reembossament de PayPal fallat"
actions:
refund: "Reembossament"
flash:
cancel: "No voleu utilitzar PayPal? Cap problema."
connection_failed: "No s'ha pogut connectar a PayPal."
generic_error: "PayPal ha fallat. %{reasons}"
users:
form:
account_settings: Configuració del compte
@@ -3538,9 +3573,11 @@ ca:
delete?: Suprimeix?
cards:
authorised_shops: Botigues autoritzades
authorised_shops_agreement: Aquesta és la llista de botigues que tenen permís per carregar la vostra targeta de crèdit per defecte per les subscripcions (per exemple, comandes repetides) que tingueu. Les dades de la vostra targeta es mantindran segures i no es compartiran amb els propietaris de botigues. Sempre se us notificarà quan us cobrin. En marcar la casella duna botiga, accepteu autoritzar la botiga perquè enviï instruccions a la institució financera que va emetre la vostra targeta per fer els pagaments dacord amb els termes de qualsevol subscripció que creeu amb aquesta botiga.
saved_cards_popover: Aquesta és la llista de targetes que heu optat per guardar per a un ús posterior. El vostre "valor predeterminat" es seleccionarà automàticament quan valideu una comanda i es pot carregar per qualsevol botiga a la que li hagueu permès fer-ho (vegeu a la dreta).
authorised_shops:
shop_name: "Nom de la botiga"
allow_charges?: "Vols permetre els càrrecs a la targeta per defecte?"
localized_number:
invalid_format: té un format no vàlid. Si us plau introdueix un número.
api:

View File

@@ -2016,6 +2016,9 @@ cy:
delivery_method: Dull Cyflenwi
fee_type: "Math o Ffi"
tax_category: "Categori Treth"
description: "Disgrifiad"
display: "Arddangos"
tags: "Tagiau"
calculator: "Cyfrifiannell"
calculator_values: "Gwerthoedd cyfrifiannell"
calculator_settings_warning: "Os ydych chi&#39;n newid y math cyfrifiannell, rhaid i chi gynilo gyntaf cyn y gallwch chi olygu gosodiadau&#39;r gyfrifiannell"
@@ -3085,6 +3088,7 @@ cy:
out_of_stock: 'mae %{item} allan o stoc.'
actions:
update: "Diweddariad"
cancel: "Canslo"
shared:
error_messages:
errors_prohibited_this_record_from_being_saved:
@@ -3544,6 +3548,8 @@ cy:
ended: daeth i ben
paused: seibio
canceled: wedi&#39;i ganslo
paypal:
refund_amount: "Swm"
users:
form:
account_settings: Gosodiadau Cyfrif

View File

@@ -2018,6 +2018,9 @@ de_DE:
delivery_method: Lieferart
fee_type: "Art der Gebühr"
tax_category: "Steuerkategorie"
description: "Beschreibung"
display: "Anzeige"
tags: "Stichwörter"
calculator: "Rechner"
calculator_values: "Rechnerwerte"
calculator_settings_warning: "Wenn Sie den Gebühren-Typ ändern, müssen Sie zuerst speichern, bevor Sie die Gebühren-Einstellungen bearbeiten können"
@@ -3040,6 +3043,7 @@ de_DE:
out_of_stock: '%{item} ist nicht vorrätig.'
actions:
update: "Aktualisieren"
cancel: "Abbrechen"
shared:
error_messages:
errors_prohibited_this_record_from_being_saved:
@@ -3499,6 +3503,8 @@ de_DE:
ended: beendet
paused: pausiert
canceled: storniert
paypal:
refund_amount: "Betrag"
users:
form:
account_settings: Konto Einstellungen

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