mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-12 18:36:49 +00:00
Compare commits
299 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e83a3ff76d | ||
|
|
6e689c4607 | ||
|
|
9cf71c703d | ||
|
|
b51d8c573a | ||
|
|
47774b3b2e | ||
|
|
3927f56ed4 | ||
|
|
bd83443595 | ||
|
|
27e83392bf | ||
|
|
11ce9b943f | ||
|
|
d78e8acee7 | ||
|
|
3073a9b588 | ||
|
|
0bb92e04b5 | ||
|
|
ca84e3eafb | ||
|
|
d27900d5fb | ||
|
|
7f3c4f2433 | ||
|
|
0fdf398dd0 | ||
|
|
ea29c62c5e | ||
|
|
18b84fc850 | ||
|
|
a8d07a7e80 | ||
|
|
cc88611b15 | ||
|
|
3387bf5821 | ||
|
|
45e4d86631 | ||
|
|
47f59a5d0a | ||
|
|
0fbf3d6cd9 | ||
|
|
019f4dfa24 | ||
|
|
7beba3debf | ||
|
|
3c123bb947 | ||
|
|
fc062a04a4 | ||
|
|
7f658d4c46 | ||
|
|
8a453abd26 | ||
|
|
3edf5fd6d9 | ||
|
|
381d5a5e37 | ||
|
|
c482173394 | ||
|
|
b842bfbc3d | ||
|
|
39fc80172e | ||
|
|
1b4906d55a | ||
|
|
6e6be09740 | ||
|
|
3a8b63b371 | ||
|
|
491dc387d7 | ||
|
|
02c63519c7 | ||
|
|
e58cd8a043 | ||
|
|
67bf6bb5fc | ||
|
|
540aa913a3 | ||
|
|
fe0a0395d8 | ||
|
|
4bb2653306 | ||
|
|
47f9a3f08a | ||
|
|
f53089c16c | ||
|
|
811480c8e0 | ||
|
|
dae065324d | ||
|
|
a14750933c | ||
|
|
20fd85786c | ||
|
|
c99b250a5f | ||
|
|
4d217c9e9d | ||
|
|
9a62ba8ed5 | ||
|
|
81c3c1cf32 | ||
|
|
330d42ea98 | ||
|
|
381880d281 | ||
|
|
87c9ec32e6 | ||
|
|
ba867e53d0 | ||
|
|
efd4b97f5c | ||
|
|
ccac16c5b2 | ||
|
|
ab586f58b1 | ||
|
|
3f324537a5 | ||
|
|
1c5f6e7222 | ||
|
|
9bb7096be1 | ||
|
|
0f00107de1 | ||
|
|
2085e183d4 | ||
|
|
5460fc9152 | ||
|
|
7ee8385902 | ||
|
|
a749bb602a | ||
|
|
749c7f4193 | ||
|
|
343d8d2686 | ||
|
|
59c981e14d | ||
|
|
b8f7ef27a6 | ||
|
|
22d2b078e8 | ||
|
|
bfbad0ae81 | ||
|
|
b49a773bca | ||
|
|
ca7548e8f4 | ||
|
|
258b25b453 | ||
|
|
1d28e7add3 | ||
|
|
b84820ad93 | ||
|
|
8452f174a1 | ||
|
|
cf485266fe | ||
|
|
180a49b501 | ||
|
|
115d3d0bfe | ||
|
|
4839b7bd63 | ||
|
|
3d8c7cc9f0 | ||
|
|
1e9b2b34f7 | ||
|
|
042b4faf1e | ||
|
|
97f1c586e1 | ||
|
|
322e1496a9 | ||
|
|
51ee21e294 | ||
|
|
9ddf3c4e5d | ||
|
|
fabde59671 | ||
|
|
d0888415e2 | ||
|
|
f6d0d43622 | ||
|
|
c9f2c63e1e | ||
|
|
e71908fbdd | ||
|
|
17782a5577 | ||
|
|
549bba0c4f | ||
|
|
74228242c0 | ||
|
|
e88972b989 | ||
|
|
106c42fe84 | ||
|
|
fc4634cd67 | ||
|
|
3199842ecc | ||
|
|
aa44615dd0 | ||
|
|
cb8d2e95d8 | ||
|
|
00e61f0a99 | ||
|
|
b9c41b4379 | ||
|
|
28f03947df | ||
|
|
4e3f4cb52e | ||
|
|
70f7d76723 | ||
|
|
ec4d171993 | ||
|
|
17faa7334e | ||
|
|
fdf997847d | ||
|
|
b4e47217ef | ||
|
|
d2ba4c8111 | ||
|
|
100d7275a6 | ||
|
|
5a16fd7075 | ||
|
|
c3661cece9 | ||
|
|
554a55ecc9 | ||
|
|
89f1d11e62 | ||
|
|
9a199ae02c | ||
|
|
91e5276140 | ||
|
|
1d08e30b45 | ||
|
|
ebe71429db | ||
|
|
2d636c8272 | ||
|
|
13d6d2c978 | ||
|
|
747b747e2d | ||
|
|
1269e5f2e9 | ||
|
|
85663d15d1 | ||
|
|
92649ca97c | ||
|
|
128a2ada5c | ||
|
|
0615c6ff3d | ||
|
|
10eea3b9e0 | ||
|
|
3d7a069b6b | ||
|
|
f0db7a22cc | ||
|
|
6225c83abb | ||
|
|
50955d735c | ||
|
|
7fc9cc9f31 | ||
|
|
6f8967f002 | ||
|
|
e2df5ebe5b | ||
|
|
934f4f278e | ||
|
|
484576d1ac | ||
|
|
cb29d05069 | ||
|
|
c79baead84 | ||
|
|
f26507b897 | ||
|
|
d4fc3f2118 | ||
|
|
fa812364ff | ||
|
|
9f517e1931 | ||
|
|
997b9b9a2e | ||
|
|
21efb4f3c6 | ||
|
|
020df3619f | ||
|
|
f02f2c540c | ||
|
|
6f763e1216 | ||
|
|
92aeab2ec3 | ||
|
|
b76261c61c | ||
|
|
94d10a45a7 | ||
|
|
18f642546d | ||
|
|
2afcdf9261 | ||
|
|
377febd8d7 | ||
|
|
1edebade78 | ||
|
|
1ea775cffb | ||
|
|
367622cea8 | ||
|
|
ada25fa2b2 | ||
|
|
480dfdf961 | ||
|
|
a745fceb53 | ||
|
|
182f0f66b6 | ||
|
|
62715a8060 | ||
|
|
26165cc08d | ||
|
|
f19946af8d | ||
|
|
c92e8de51f | ||
|
|
ed4a7bd361 | ||
|
|
6d37a15488 | ||
|
|
79c538fad9 | ||
|
|
b287d67f6b | ||
|
|
5ae955c27f | ||
|
|
fd5adab0d5 | ||
|
|
773f733c8e | ||
|
|
80e59a920e | ||
|
|
b58fddf098 | ||
|
|
bcf7cc1013 | ||
|
|
3b7313f7e3 | ||
|
|
3daccb6420 | ||
|
|
655512adab | ||
|
|
f50577b489 | ||
|
|
a1f6fe5522 | ||
|
|
8c747e4812 | ||
|
|
4c25edd91c | ||
|
|
0ac248f03a | ||
|
|
13b95f41bb | ||
|
|
50e87a023b | ||
|
|
b4b4d38d3b | ||
|
|
3bf58b5b7c | ||
|
|
3f6288d5c7 | ||
|
|
6bf041aa74 | ||
|
|
e6c411684f | ||
|
|
465d2d2f1c | ||
|
|
edf9dd7921 | ||
|
|
5ca10d5cd1 | ||
|
|
33d220e777 | ||
|
|
9728b088f9 | ||
|
|
c033fe70e7 | ||
|
|
c17998774e | ||
|
|
de786982dd | ||
|
|
9b6702946c | ||
|
|
7c6621a49b | ||
|
|
134c63f353 | ||
|
|
1d64230d4b | ||
|
|
8f796de35b | ||
|
|
b4a43e0554 | ||
|
|
f2c37ef64d | ||
|
|
f45d348dd7 | ||
|
|
351d694c13 | ||
|
|
22ef9a0fef | ||
|
|
7a03882314 | ||
|
|
b713bd7aa7 | ||
|
|
c70ea44091 | ||
|
|
7a27741cf5 | ||
|
|
2a3176f7f5 | ||
|
|
5c65f9bf55 | ||
|
|
0824f12472 | ||
|
|
ab6f6c463a | ||
|
|
e2181960bc | ||
|
|
e8ba16cb3e | ||
|
|
c233052ec6 | ||
|
|
d55343da1a | ||
|
|
eddf8da107 | ||
|
|
3a8203094a | ||
|
|
f1d439870e | ||
|
|
103366ea97 | ||
|
|
9c544ef2f4 | ||
|
|
bc3fd8c50c | ||
|
|
277d7f44b7 | ||
|
|
a466886a32 | ||
|
|
3d47ad7e33 | ||
|
|
fea7576ac1 | ||
|
|
13ab25ac45 | ||
|
|
cad8a018f9 | ||
|
|
215d1bbe20 | ||
|
|
b517d2f0c7 | ||
|
|
cc00f24569 | ||
|
|
d0098e190f | ||
|
|
1f8b4e05bb | ||
|
|
f875e406a8 | ||
|
|
3b44c8e7e2 | ||
|
|
6fdcd6218d | ||
|
|
c60dcc75cd | ||
|
|
4cdc1993b8 | ||
|
|
747345ece9 | ||
|
|
84730577da | ||
|
|
906dbffb29 | ||
|
|
aa8df639c4 | ||
|
|
70d1888cc2 | ||
|
|
feb0ad452d | ||
|
|
e866e983f6 | ||
|
|
33916cfff3 | ||
|
|
9333a6385e | ||
|
|
c37bd8e911 | ||
|
|
96462325d2 | ||
|
|
567e489716 | ||
|
|
868a19df6e | ||
|
|
81b03906f9 | ||
|
|
acddb496b7 | ||
|
|
d29773d297 | ||
|
|
0f27f57cbb | ||
|
|
1d327a61a6 | ||
|
|
0fb9f44dda | ||
|
|
c63d99dd20 | ||
|
|
99fd99cd33 | ||
|
|
1d075bbc90 | ||
|
|
6e08fccbbe | ||
|
|
fc4cf6a9a7 | ||
|
|
abc58f5bb4 | ||
|
|
0ceba7c0a8 | ||
|
|
f71de8123a | ||
|
|
a51d01efac | ||
|
|
7a35fabb22 | ||
|
|
67ee8c3500 | ||
|
|
5b00868c6f | ||
|
|
bfd4adbcee | ||
|
|
611de912a8 | ||
|
|
2b8f0abe49 | ||
|
|
de19efca64 | ||
|
|
6c9e12b4ea | ||
|
|
3162cf9abf | ||
|
|
9abdcd88e5 | ||
|
|
ca1a4db299 | ||
|
|
bd6b1dbfed | ||
|
|
ea148d7f51 | ||
|
|
a5761707d5 | ||
|
|
cd94b23277 | ||
|
|
4e155641fc | ||
|
|
5d93180081 | ||
|
|
fdfc0b330f | ||
|
|
63d62d7ce4 | ||
|
|
51451292bd | ||
|
|
2bb22fb7f4 | ||
|
|
5289a5b381 |
2
dependabot.yml → .github/dependabot.yml
vendored
2
dependabot.yml → .github/dependabot.yml
vendored
@@ -7,7 +7,7 @@ updates:
|
||||
interval: "daily"
|
||||
open-pull-requests-limit: 10
|
||||
|
||||
- package-ecosystem: "yarn"
|
||||
- package-ecosystem: "npm"
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: "daily"
|
||||
@@ -66,8 +66,9 @@ Layout/LineLength:
|
||||
- app/models/spree/image.rb
|
||||
- app/models/spree/order.rb
|
||||
- app/models/spree/payment_method.rb
|
||||
- app/models/spree/product_decorator.rb
|
||||
- app/models/spree/product.rb
|
||||
- app/models/spree/user.rb
|
||||
- app/models/spree/variant.rb
|
||||
- app/models/subscription.rb
|
||||
- app/models/variant_override.rb
|
||||
- app/models/variant_override_set.rb
|
||||
@@ -336,6 +337,7 @@ Metrics/AbcSize:
|
||||
- app/controllers/admin/enterprises_controller.rb
|
||||
- app/controllers/admin/order_cycles_controller.rb
|
||||
- app/controllers/admin/product_import_controller.rb
|
||||
- app/controllers/admin/resource_controller.rb
|
||||
- app/controllers/admin/stripe_accounts_controller.rb
|
||||
- app/controllers/admin/subscription_line_items_controller.rb
|
||||
- app/controllers/admin/subscriptions_controller.rb
|
||||
@@ -356,13 +358,13 @@ Metrics/AbcSize:
|
||||
- app/controllers/spree/admin/payments_controller.rb
|
||||
- app/controllers/spree/admin/products_controller.rb
|
||||
- app/controllers/spree/admin/reports_controller.rb
|
||||
- app/controllers/spree/admin/resource_controller.rb
|
||||
- app/controllers/spree/admin/search_controller.rb
|
||||
- app/controllers/spree/admin/taxons_controller.rb
|
||||
- app/controllers/spree/admin/users_controller.rb
|
||||
- app/controllers/spree/admin/variants_controller.rb
|
||||
- app/controllers/spree/credit_cards_controller.rb
|
||||
- app/controllers/spree/orders_controller.rb
|
||||
- app/controllers/spree/paypal_controller_decorator.rb
|
||||
- app/controllers/spree/user_passwords_controller.rb
|
||||
- app/controllers/spree/user_registrations_controller.rb
|
||||
- app/controllers/spree/users_controller.rb
|
||||
@@ -399,11 +401,12 @@ Metrics/AbcSize:
|
||||
- app/models/spree/preference.rb
|
||||
- app/models/spree/preferences/preferable_class_methods.rb
|
||||
- app/models/spree/preferences/preferable.rb
|
||||
- app/models/spree/product_decorator.rb
|
||||
- app/models/spree/product.rb
|
||||
- app/models/spree/return_authorization.rb
|
||||
- app/models/spree/shipment.rb
|
||||
- app/models/spree/taxon.rb
|
||||
- app/models/spree/tax_rate.rb
|
||||
- app/models/spree/variant.rb
|
||||
- app/models/spree/zone.rb
|
||||
- app/serializers/api/product_serializer.rb
|
||||
- app/serializers/api/variant_serializer.rb
|
||||
@@ -530,7 +533,7 @@ Metrics/CyclomaticComplexity:
|
||||
- app/models/spree/preference.rb
|
||||
- app/models/spree/preferences/preferable.rb
|
||||
- app/models/spree/preferences/preferable_class_methods.rb
|
||||
- app/models/spree/product_decorator.rb
|
||||
- app/models/spree/product.rb
|
||||
- app/models/spree/return_authorization.rb
|
||||
- app/models/spree/zone.rb
|
||||
- app/models/variant_override_set.rb
|
||||
@@ -550,39 +553,6 @@ Metrics/CyclomaticComplexity:
|
||||
Metrics/PerceivedComplexity:
|
||||
Max: 7
|
||||
Exclude:
|
||||
- app/controllers/admin/enterprise_fees_controller.rb
|
||||
- app/controllers/admin/enterprises_controller.rb
|
||||
- app/controllers/spree/admin/taxons_controller.rb
|
||||
- app/controllers/spree/orders_controller.rb
|
||||
- app/helpers/checkout_helper.rb
|
||||
- app/helpers/order_cycles_helper.rb
|
||||
- app/helpers/spree/admin/base_helper.rb
|
||||
- app/helpers/spree/admin/navigation_helper.rb
|
||||
- app/models/enterprise.rb
|
||||
- app/models/enterprise_relationship.rb
|
||||
- app/models/spree/ability.rb
|
||||
- app/models/spree/address.rb
|
||||
- app/models/spree/order/checkout.rb
|
||||
- app/models/spree/payment_method.rb
|
||||
- app/models/spree/payment.rb
|
||||
- app/models/spree/preferences/preferable.rb
|
||||
- app/models/spree/preferences/preferable_class_methods.rb
|
||||
- app/models/spree/product_decorator.rb
|
||||
- app/models/spree/return_authorization.rb
|
||||
- app/models/spree/zone.rb
|
||||
- app/models/variant_override_set.rb
|
||||
- app/services/cart_service.rb
|
||||
- engines/order_management/app/services/order_management/reports/bulk_coop/bulk_coop_report.rb
|
||||
- engines/order_management/app/services/order_management/stock/estimator.rb
|
||||
- lib/active_merchant/billing/gateways/stripe_payment_intents.rb
|
||||
- lib/discourse/single_sign_on.rb
|
||||
- lib/open_food_network/enterprise_issue_validator.rb
|
||||
- lib/spree/core/calculated_adjustments.rb
|
||||
- lib/spree/core/controller_helpers/order.rb
|
||||
- lib/spree/core/controller_helpers/respond_with.rb
|
||||
- lib/spree/core/controller_helpers/ssl.rb
|
||||
- lib/spree/localized_number.rb
|
||||
- spec/models/product_importer_spec.rb
|
||||
- app/controllers/admin/enterprises_controller.rb
|
||||
- app/controllers/api/variants_controller.rb
|
||||
- app/controllers/spree/admin/taxons_controller.rb
|
||||
@@ -595,7 +565,10 @@ Metrics/PerceivedComplexity:
|
||||
- app/models/spree/address.rb
|
||||
- app/models/spree/order/checkout.rb
|
||||
- app/models/spree/order.rb
|
||||
- app/models/spree/product_decorator.rb
|
||||
- app/models/spree/preferences/preferable_class_methods.rb
|
||||
- app/models/spree/preferences/preferable.rb
|
||||
- app/models/spree/product.rb
|
||||
- app/models/spree/return_authorization.rb
|
||||
- app/models/spree/zone.rb
|
||||
- engines/order_management/app/services/order_management/reports/bulk_coop/bulk_coop_report.rb
|
||||
- engines/order_management/app/services/order_management/stock/estimator.rb
|
||||
@@ -618,6 +591,7 @@ Metrics/MethodLength:
|
||||
- app/controllers/admin/enterprises_controller.rb
|
||||
- app/controllers/admin/manager_invitations_controller.rb
|
||||
- app/controllers/admin/order_cycles_controller.rb
|
||||
- app/controllers/admin/resource_controller.rb
|
||||
- app/controllers/admin/stripe_accounts_controller.rb
|
||||
- app/controllers/admin/subscriptions_controller.rb
|
||||
- app/controllers/api/products_controller.rb
|
||||
@@ -632,13 +606,13 @@ Metrics/MethodLength:
|
||||
- app/controllers/spree/admin/payments_controller.rb
|
||||
- app/controllers/spree/admin/products_controller.rb
|
||||
- app/controllers/spree/admin/reports_controller.rb
|
||||
- app/controllers/spree/admin/resource_controller.rb
|
||||
- app/controllers/spree/admin/tax_categories_controller.rb
|
||||
- app/controllers/spree/admin/taxons_controller.rb
|
||||
- app/controllers/spree/admin/users_controller.rb
|
||||
- app/controllers/spree/admin/variants_controller.rb
|
||||
- app/controllers/spree/credit_cards_controller.rb
|
||||
- app/controllers/spree/orders_controller.rb
|
||||
- app/controllers/spree/paypal_controller_decorator.rb
|
||||
- app/controllers/spree/user_sessions_controller.rb
|
||||
- app/controllers/stripe/callbacks_controller.rb
|
||||
- app/controllers/user_confirmations_controller.rb
|
||||
@@ -670,11 +644,13 @@ Metrics/MethodLength:
|
||||
- app/models/spree/preferences/preferable_class_methods.rb
|
||||
- app/models/spree/preferences/preferable.rb
|
||||
- app/models/spree/preferences/store.rb
|
||||
- app/models/spree/product.rb
|
||||
- app/models/spree/product_decorator.rb
|
||||
- app/models/spree/return_authorization.rb
|
||||
- app/models/spree/shipment.rb
|
||||
- app/models/spree/taxon.rb
|
||||
- app/models/spree/tax_rate.rb
|
||||
- app/models/spree/variant.rb
|
||||
- app/models/spree/zone.rb
|
||||
- app/serializers/api/admin/order_cycle_serializer.rb
|
||||
- app/serializers/api/cached_enterprise_serializer.rb
|
||||
@@ -732,6 +708,7 @@ Metrics/ClassLength:
|
||||
Exclude:
|
||||
- app/controllers/admin/enterprises_controller.rb
|
||||
- app/controllers/admin/order_cycles_controller.rb
|
||||
- app/controllers/admin/resource_controller.rb
|
||||
- app/controllers/admin/schedules_controller.rb
|
||||
- app/controllers/admin/subscriptions_controller.rb
|
||||
- app/controllers/api/products_controller.rb
|
||||
@@ -741,7 +718,6 @@ Metrics/ClassLength:
|
||||
- app/controllers/spree/admin/payment_methods_controller.rb
|
||||
- app/controllers/spree/admin/products_controller.rb
|
||||
- app/controllers/spree/admin/reports_controller.rb
|
||||
- app/controllers/spree/admin/resource_controller.rb
|
||||
- app/controllers/spree/admin/users_controller.rb
|
||||
- app/controllers/spree/orders_controller.rb
|
||||
- app/models/enterprise.rb
|
||||
@@ -755,8 +731,10 @@ Metrics/ClassLength:
|
||||
- app/models/spree/line_item.rb
|
||||
- app/models/spree/order.rb
|
||||
- app/models/spree/payment.rb
|
||||
- app/models/spree/product.rb
|
||||
- app/models/spree/shipment.rb
|
||||
- app/models/spree/user.rb
|
||||
- app/models/spree/variant.rb
|
||||
- app/models/spree/zone.rb
|
||||
- app/serializers/api/cached_enterprise_serializer.rb
|
||||
- app/serializers/api/enterprise_shopfront_serializer.rb
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# This configuration was generated by
|
||||
# `rubocop --auto-gen-config --exclude-limit 1400`
|
||||
# on 2020-10-30 17:18:53 +0000 using RuboCop version 0.81.0.
|
||||
# on 2020-11-05 11:27:59 +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
|
||||
@@ -27,13 +27,6 @@ Lint/UselessAccessModifier:
|
||||
- 'app/services/mail_configuration.rb'
|
||||
- 'lib/open_food_network/feature_toggle.rb'
|
||||
|
||||
# Offense count: 2
|
||||
Lint/UselessAssignment:
|
||||
Exclude:
|
||||
- 'spec/**/*'
|
||||
- 'app/models/spree/taxon.rb'
|
||||
- 'lib/spree/core/controller_helpers/common.rb'
|
||||
|
||||
# Offense count: 10
|
||||
Naming/AccessorMethodName:
|
||||
Exclude:
|
||||
@@ -60,7 +53,7 @@ Naming/MemoizedInstanceVariableName:
|
||||
- 'app/mailers/producer_mailer.rb'
|
||||
- 'lib/open_food_network/address_finder.rb'
|
||||
|
||||
# Offense count: 24
|
||||
# Offense count: 25
|
||||
# Configuration parameters: NamePrefix, ForbiddenPrefixes, AllowedMethods, MethodDefinitionMacros.
|
||||
# NamePrefix: is_, has_, have_
|
||||
# ForbiddenPrefixes: is_, has_, have_
|
||||
@@ -72,6 +65,7 @@ Naming/PredicateName:
|
||||
- 'app/models/enterprise.rb'
|
||||
- 'app/models/enterprise_relationship.rb'
|
||||
- 'app/models/order_cycle.rb'
|
||||
- 'app/models/spree/ability.rb'
|
||||
- 'app/models/spree/adjustment.rb'
|
||||
- 'app/models/spree/credit_card.rb'
|
||||
- 'app/models/spree/line_item.rb'
|
||||
@@ -125,7 +119,7 @@ Rails/Delegate:
|
||||
- 'app/models/spree/line_item.rb'
|
||||
- 'engines/order_management/app/services/order_management/reports/bulk_coop/renderers/html_renderer.rb'
|
||||
|
||||
# Offense count: 16
|
||||
# Offense count: 15
|
||||
# Configuration parameters: EnforcedStyle.
|
||||
# SupportedStyles: slashes, arguments
|
||||
Rails/FilePath:
|
||||
@@ -139,7 +133,6 @@ Rails/FilePath:
|
||||
- 'spec/factories/product_factory.rb'
|
||||
- 'spec/features/admin/enterprises/images_spec.rb'
|
||||
- 'spec/models/content_configuration_spec.rb'
|
||||
- 'spec/models/spree/variant_spec.rb'
|
||||
- 'spec/serializers/api/admin/enterprise_serializer_spec.rb'
|
||||
- 'spec/support/downloads_helper.rb'
|
||||
|
||||
@@ -163,7 +156,7 @@ Rails/FindEach:
|
||||
Exclude:
|
||||
- 'app/models/spree/shipment.rb'
|
||||
|
||||
# Offense count: 9
|
||||
# Offense count: 11
|
||||
# Configuration parameters: Include.
|
||||
# Include: app/models/**/*.rb
|
||||
Rails/HasAndBelongsToMany:
|
||||
@@ -172,12 +165,14 @@ Rails/HasAndBelongsToMany:
|
||||
- 'app/models/enterprise.rb'
|
||||
- 'app/models/enterprise_group.rb'
|
||||
- 'app/models/spree/line_item.rb'
|
||||
- 'app/models/spree/option_value.rb'
|
||||
- 'app/models/spree/role.rb'
|
||||
- 'app/models/spree/shipping_method.rb'
|
||||
- 'app/models/spree/user.rb'
|
||||
- 'app/models/spree/variant.rb'
|
||||
- 'app/models/spree/zone.rb'
|
||||
|
||||
# Offense count: 38
|
||||
# Offense count: 41
|
||||
# Configuration parameters: Include.
|
||||
# Include: app/models/**/*.rb
|
||||
Rails/HasManyOrHasOneDependent:
|
||||
@@ -197,7 +192,7 @@ Rails/HasManyOrHasOneDependent:
|
||||
- 'app/models/spree/shipping_method.rb'
|
||||
- 'app/models/spree/taxonomy.rb'
|
||||
- 'app/models/spree/user.rb'
|
||||
- 'app/models/spree/variant_decorator.rb'
|
||||
- 'app/models/spree/variant.rb'
|
||||
- 'app/models/subscription.rb'
|
||||
|
||||
# Offense count: 84
|
||||
@@ -272,13 +267,13 @@ Rails/ReflectionClassName:
|
||||
- 'app/models/spree/order.rb'
|
||||
- 'app/models/subscription.rb'
|
||||
|
||||
# Offense count: 247
|
||||
# Offense count: 250
|
||||
# Configuration parameters: Blacklist, Whitelist.
|
||||
# Blacklist: decrement!, decrement_counter, increment!, increment_counter, toggle!, touch, update_all, update_attribute, update_column, update_columns, update_counters
|
||||
Rails/SkipsModelValidations:
|
||||
Exclude:
|
||||
- 'app/controllers/admin/resource_controller.rb'
|
||||
- 'app/controllers/spree/admin/payment_methods_controller.rb'
|
||||
- 'app/controllers/spree/admin/resource_controller.rb'
|
||||
- 'app/controllers/spree/admin/shipping_methods_controller.rb'
|
||||
- 'app/controllers/spree/admin/taxons_controller.rb'
|
||||
- 'app/controllers/spree/orders_controller.rb'
|
||||
@@ -294,10 +289,12 @@ Rails/SkipsModelValidations:
|
||||
- 'app/models/spree/inventory_unit.rb'
|
||||
- 'app/models/spree/order.rb'
|
||||
- 'app/models/spree/payment.rb'
|
||||
- 'app/models/spree/product.rb'
|
||||
- 'app/models/spree/shipment.rb'
|
||||
- 'app/models/spree/shipping_method.rb'
|
||||
- 'app/models/spree/tax_category.rb'
|
||||
- 'app/models/spree/taxonomy.rb'
|
||||
- 'app/models/spree/variant.rb'
|
||||
- 'app/models/spree/zone.rb'
|
||||
- 'app/models/subscription.rb'
|
||||
- 'app/models/variant_override.rb'
|
||||
@@ -440,14 +437,12 @@ Style/FormatStringToken:
|
||||
- 'lib/open_food_network/sales_tax_report.rb'
|
||||
- 'spec/features/admin/bulk_order_management_spec.rb'
|
||||
|
||||
# Offense count: 765
|
||||
# Offense count: 760
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: EnforcedStyle.
|
||||
# SupportedStyles: always, always_true, never
|
||||
Style/FrozenStringLiteralComment:
|
||||
Exclude:
|
||||
- 'Gemfile'
|
||||
- 'Rakefile'
|
||||
- 'app/controllers/admin/bulk_line_items_controller.rb'
|
||||
- 'app/controllers/admin/column_preferences_controller.rb'
|
||||
- 'app/controllers/admin/contents_controller.rb'
|
||||
@@ -518,7 +513,6 @@ Style/FrozenStringLiteralComment:
|
||||
- 'app/controllers/spree/admin/products_controller.rb'
|
||||
- 'app/controllers/spree/admin/properties_controller.rb'
|
||||
- 'app/controllers/spree/admin/reports_controller.rb'
|
||||
- 'app/controllers/spree/admin/resource_controller.rb'
|
||||
- 'app/controllers/spree/admin/return_authorizations_controller.rb'
|
||||
- 'app/controllers/spree/admin/search_controller.rb'
|
||||
- 'app/controllers/spree/admin/shipping_categories_controller.rb'
|
||||
@@ -635,16 +629,10 @@ Style/FrozenStringLiteralComment:
|
||||
- 'app/models/spree/gateway/migs.rb'
|
||||
- 'app/models/spree/gateway/pin.rb'
|
||||
- 'app/models/spree/gateway/stripe_connect.rb'
|
||||
- 'app/models/spree/option_type_decorator.rb'
|
||||
- 'app/models/spree/preferences/file_configuration.rb'
|
||||
- 'app/models/spree/price_decorator.rb'
|
||||
- 'app/models/spree/product_decorator.rb'
|
||||
- 'app/models/spree/product_option_type_decorator.rb'
|
||||
- 'app/models/spree/product_property_decorator.rb'
|
||||
- 'app/models/spree/product_set.rb'
|
||||
- 'app/models/spree/property.rb'
|
||||
- 'app/models/spree/user.rb'
|
||||
- 'app/models/spree/variant_decorator.rb'
|
||||
- 'app/models/stripe_account.rb'
|
||||
- 'app/models/subscription.rb'
|
||||
- 'app/models/subscription_line_item.rb'
|
||||
@@ -725,7 +713,6 @@ Style/FrozenStringLiteralComment:
|
||||
- 'app/validators/date_time_string_validator.rb'
|
||||
- 'app/validators/distributors_validator.rb'
|
||||
- 'app/validators/integer_array_validator.rb'
|
||||
- 'config.ru'
|
||||
- 'engines/order_management/app/controllers/order_management/application_controller.rb'
|
||||
- 'engines/order_management/app/services/order_management/reports/enterprise_fee_summary/authorizer.rb'
|
||||
- 'engines/order_management/app/services/order_management/reports/enterprise_fee_summary/data_representations/coordinator_fee.rb'
|
||||
@@ -750,29 +737,11 @@ Style/FrozenStringLiteralComment:
|
||||
- 'engines/order_management/app/services/reports/permissions.rb'
|
||||
- 'engines/order_management/app/services/reports/renderers/base.rb'
|
||||
- 'engines/order_management/app/services/reports/report_data/base.rb'
|
||||
- 'engines/order_management/config/routes.rb'
|
||||
- 'engines/order_management/lib/order_management.rb'
|
||||
- 'engines/order_management/lib/order_management/engine.rb'
|
||||
- 'engines/order_management/lib/order_management/version.rb'
|
||||
- 'engines/order_management/order_management.gemspec'
|
||||
- 'engines/order_management/spec/services/order_management/reports/enterprise_fee_summary/authorizer_spec.rb'
|
||||
- 'engines/order_management/spec/services/order_management/reports/enterprise_fee_summary/parameters_spec.rb'
|
||||
- 'engines/order_management/spec/services/order_management/reports/enterprise_fee_summary/permissions_spec.rb'
|
||||
- 'engines/order_management/spec/services/order_management/reports/enterprise_fee_summary/renderers/csv_renderer_spec.rb'
|
||||
- 'engines/order_management/spec/services/order_management/reports/enterprise_fee_summary/renderers/html_renderer_spec.rb'
|
||||
- 'engines/order_management/spec/services/order_management/reports/enterprise_fee_summary/report_data/enterprise_fee_type_total_spec.rb'
|
||||
- 'engines/order_management/spec/services/order_management/reports/enterprise_fee_summary/report_service_spec.rb'
|
||||
- 'engines/web/app/controllers/web/angular_templates_controller.rb'
|
||||
- 'engines/web/app/controllers/web/api/cookies_consent_controller.rb'
|
||||
- 'engines/web/app/controllers/web/application_controller.rb'
|
||||
- 'engines/web/app/helpers/web/cookies_policy_helper.rb'
|
||||
- 'engines/web/config/routes.rb'
|
||||
- 'engines/web/lib/web.rb'
|
||||
- 'engines/web/lib/web/cookies_consent.rb'
|
||||
- 'engines/web/lib/web/engine.rb'
|
||||
- 'engines/web/lib/web/version.rb'
|
||||
- 'engines/web/spec/helpers/cookies_policy_helper_spec.rb'
|
||||
- 'engines/web/web.gemspec'
|
||||
- 'lib/discourse/single_sign_on.rb'
|
||||
- 'lib/open_food_network/address_finder.rb'
|
||||
- 'lib/open_food_network/available_payment_method_filter.rb'
|
||||
@@ -849,370 +818,8 @@ Style/FrozenStringLiteralComment:
|
||||
- 'lib/tasks/sample_data/user_factory.rb'
|
||||
- 'lib/tasks/specs.rake'
|
||||
- 'lib/tasks/users.rake'
|
||||
- 'spec/controllers/admin/bulk_line_items_controller_spec.rb'
|
||||
- 'spec/controllers/admin/column_preferences_controller_spec.rb'
|
||||
- 'spec/controllers/admin/customers_controller_spec.rb'
|
||||
- 'spec/controllers/admin/enterprises_controller_spec.rb'
|
||||
- 'spec/controllers/admin/inventory_items_controller_spec.rb'
|
||||
- 'spec/controllers/admin/manager_invitations_controller_spec.rb'
|
||||
- 'spec/controllers/admin/order_cycles_controller_spec.rb'
|
||||
- 'spec/controllers/admin/proxy_orders_controller_spec.rb'
|
||||
- 'spec/controllers/admin/schedules_controller_spec.rb'
|
||||
- 'spec/controllers/admin/stripe_accounts_controller_spec.rb'
|
||||
- 'spec/controllers/admin/stripe_connect_settings_controller_spec.rb'
|
||||
- 'spec/controllers/admin/subscription_line_items_controller_spec.rb'
|
||||
- 'spec/controllers/admin/subscriptions_controller_spec.rb'
|
||||
- 'spec/controllers/admin/tag_rules_controller_spec.rb'
|
||||
- 'spec/controllers/admin/variant_overrides_controller_spec.rb'
|
||||
- 'spec/controllers/api/base_controller_spec.rb'
|
||||
- 'spec/controllers/api/customers_controller_spec.rb'
|
||||
- 'spec/controllers/api/enterprise_fees_controller_spec.rb'
|
||||
- 'spec/controllers/api/enterprises_controller_spec.rb'
|
||||
- 'spec/controllers/api/logos_controller_spec.rb'
|
||||
- 'spec/controllers/api/order_cycles_controller_spec.rb'
|
||||
- 'spec/controllers/api/orders_controller_spec.rb'
|
||||
- 'spec/controllers/api/product_images_controller_spec.rb'
|
||||
- 'spec/controllers/api/products_controller_spec.rb'
|
||||
- 'spec/controllers/api/promo_images_controller_spec.rb'
|
||||
- 'spec/controllers/api/shipments_controller_spec.rb'
|
||||
- 'spec/controllers/api/statuses_controller_spec.rb'
|
||||
- 'spec/controllers/api/taxonomies_controller_spec.rb'
|
||||
- 'spec/controllers/api/taxons_controller_spec.rb'
|
||||
- 'spec/controllers/api/terms_and_conditions_controller_spec.rb'
|
||||
- 'spec/controllers/api/variants_controller_spec.rb'
|
||||
- 'spec/controllers/base_controller_spec.rb'
|
||||
- 'spec/controllers/cart_controller_spec.rb'
|
||||
- 'spec/controllers/checkout_controller_spec.rb'
|
||||
- 'spec/controllers/enterprises_controller_spec.rb'
|
||||
- 'spec/controllers/groups_controller_spec.rb'
|
||||
- 'spec/controllers/line_items_controller_spec.rb'
|
||||
- 'spec/controllers/registration_controller_spec.rb'
|
||||
- 'spec/controllers/shop_controller_spec.rb'
|
||||
- 'spec/controllers/shops_controller_spec.rb'
|
||||
- 'spec/controllers/spree/admin/adjustments_controller_spec.rb'
|
||||
- 'spec/controllers/spree/admin/base_controller_spec.rb'
|
||||
- 'spec/controllers/spree/admin/general_settings_controller_spec.rb'
|
||||
- 'spec/controllers/spree/admin/invoices_controller_spec.rb'
|
||||
- 'spec/controllers/spree/admin/mail_methods_controller_spec.rb'
|
||||
- 'spec/controllers/spree/admin/orders/customer_details_controller_spec.rb'
|
||||
- 'spec/controllers/spree/admin/orders_controller_spec.rb'
|
||||
- 'spec/controllers/spree/admin/overview_controller_spec.rb'
|
||||
- 'spec/controllers/spree/admin/payment_methods_controller_spec.rb'
|
||||
- 'spec/controllers/spree/admin/products_controller_spec.rb'
|
||||
- 'spec/controllers/spree/admin/reports_controller_spec.rb'
|
||||
- 'spec/controllers/spree/admin/search_controller_spec.rb'
|
||||
- 'spec/controllers/spree/admin/shipping_methods_controller_spec.rb'
|
||||
- 'spec/controllers/spree/admin/users_controller_spec.rb'
|
||||
- 'spec/controllers/spree/admin/variants_controller_spec.rb'
|
||||
- 'spec/controllers/spree/credit_cards_controller_spec.rb'
|
||||
- 'spec/controllers/spree/orders_controller_spec.rb'
|
||||
- 'spec/controllers/spree/user_sessions_controller_spec.rb'
|
||||
- 'spec/controllers/spree/users_controller_spec.rb'
|
||||
- 'spec/controllers/stripe/callbacks_controller_spec.rb'
|
||||
- 'spec/controllers/stripe/webhooks_controller_spec.rb'
|
||||
- 'spec/controllers/user_confirmations_controller_spec.rb'
|
||||
- 'spec/controllers/user_passwords_controller_spec.rb'
|
||||
- 'spec/controllers/user_registrations_controller_spec.rb'
|
||||
- 'spec/factories.rb'
|
||||
- 'spec/factories/address_factory.rb'
|
||||
- 'spec/factories/calculated_adjustment_factory.rb'
|
||||
- 'spec/factories/calculator_factory.rb'
|
||||
- 'spec/factories/enterprise_factory.rb'
|
||||
- 'spec/factories/order_cycle_factory.rb'
|
||||
- 'spec/factories/order_factory.rb'
|
||||
- 'spec/factories/product_factory.rb'
|
||||
- 'spec/factories/return_authorization_factory.rb'
|
||||
- 'spec/factories/shipment_factory.rb'
|
||||
- 'spec/factories/shipping_method_factory.rb'
|
||||
- 'spec/factories/state_factory.rb'
|
||||
- 'spec/factories/stock_movement_factory.rb'
|
||||
- 'spec/factories/subscription_factory.rb'
|
||||
- 'spec/factories/tag_rule_factory.rb'
|
||||
- 'spec/factories/user_factory.rb'
|
||||
- 'spec/factories/variant_factory.rb'
|
||||
- 'spec/features/admin/adjustments_spec.rb'
|
||||
- 'spec/features/admin/authentication_spec.rb'
|
||||
- 'spec/features/admin/bulk_order_management_spec.rb'
|
||||
- 'spec/features/admin/bulk_product_update_spec.rb'
|
||||
- 'spec/features/admin/configuration/content_spec.rb'
|
||||
- 'spec/features/admin/configuration/general_settings_spec.rb'
|
||||
- 'spec/features/admin/configuration/mail_methods_spec.rb'
|
||||
- 'spec/features/admin/configuration/states_spec.rb'
|
||||
- 'spec/features/admin/configuration/tax_categories_spec.rb'
|
||||
- 'spec/features/admin/configuration/tax_rates_spec.rb'
|
||||
- 'spec/features/admin/configuration/taxonomies_spec.rb'
|
||||
- 'spec/features/admin/configuration/zones_spec.rb'
|
||||
- 'spec/features/admin/customers_spec.rb'
|
||||
- 'spec/features/admin/enterprise_fees_spec.rb'
|
||||
- 'spec/features/admin/enterprise_groups_spec.rb'
|
||||
- 'spec/features/admin/enterprise_relationships_spec.rb'
|
||||
- 'spec/features/admin/enterprise_roles_spec.rb'
|
||||
- 'spec/features/admin/enterprise_user_spec.rb'
|
||||
- 'spec/features/admin/enterprises/index_spec.rb'
|
||||
- 'spec/features/admin/enterprises_spec.rb'
|
||||
- 'spec/features/admin/external_services_spec.rb'
|
||||
- 'spec/features/admin/multilingual_spec.rb'
|
||||
- 'spec/features/admin/overview_spec.rb'
|
||||
- 'spec/features/admin/payment_method_spec.rb'
|
||||
- 'spec/features/admin/payments_spec.rb'
|
||||
- 'spec/features/admin/product_import_spec.rb'
|
||||
- 'spec/features/admin/products_spec.rb'
|
||||
- 'spec/features/admin/reports/packing_report_spec.rb'
|
||||
- 'spec/features/admin/reports_spec.rb'
|
||||
- 'spec/features/admin/schedules_spec.rb'
|
||||
- 'spec/features/admin/shipping_methods_spec.rb'
|
||||
- 'spec/features/admin/subscriptions_spec.rb'
|
||||
- 'spec/features/admin/tag_rules_spec.rb'
|
||||
- 'spec/features/admin/tax_settings_spec.rb'
|
||||
- 'spec/features/admin/users_spec.rb'
|
||||
- 'spec/features/admin/variant_overrides_spec.rb'
|
||||
- 'spec/features/admin/variants_spec.rb'
|
||||
- 'spec/features/consumer/account/cards_spec.rb'
|
||||
- 'spec/features/consumer/account/settings_spec.rb'
|
||||
- 'spec/features/consumer/account_spec.rb'
|
||||
- 'spec/features/consumer/authentication_spec.rb'
|
||||
- 'spec/features/consumer/confirm_invitation_spec.rb'
|
||||
- 'spec/features/consumer/footer_links_spec.rb'
|
||||
- 'spec/features/consumer/groups_spec.rb'
|
||||
- 'spec/features/consumer/multilingual_spec.rb'
|
||||
- 'spec/features/consumer/producers_spec.rb'
|
||||
- 'spec/features/consumer/registration_spec.rb'
|
||||
- 'spec/features/consumer/shopping/cart_spec.rb'
|
||||
- 'spec/features/consumer/shopping/checkout_auth_spec.rb'
|
||||
- 'spec/features/consumer/shopping/checkout_paypal_spec.rb'
|
||||
- 'spec/features/consumer/shopping/checkout_spec.rb'
|
||||
- 'spec/features/consumer/shopping/embedded_groups_spec.rb'
|
||||
- 'spec/features/consumer/shopping/embedded_shopfronts_spec.rb'
|
||||
- 'spec/features/consumer/shopping/orders_spec.rb'
|
||||
- 'spec/features/consumer/shopping/products_spec.rb'
|
||||
- 'spec/features/consumer/shopping/shopping_spec.rb'
|
||||
- 'spec/features/consumer/shopping/variant_overrides_spec.rb'
|
||||
- 'spec/features/consumer/shops_spec.rb'
|
||||
- 'spec/features/consumer/sitemap_spec.rb'
|
||||
- 'spec/helpers/admin/orders_helper_spec.rb'
|
||||
- 'spec/helpers/admin/subscriptions_helper_spec.rb'
|
||||
- 'spec/helpers/checkout_helper_spec.rb'
|
||||
- 'spec/helpers/enterprises_helper_spec.rb'
|
||||
- 'spec/helpers/groups_helper_spec.rb'
|
||||
- 'spec/helpers/html_helper_spec.rb'
|
||||
- 'spec/helpers/i18n_helper_spec.rb'
|
||||
- 'spec/helpers/injection_helper_spec.rb'
|
||||
- 'spec/helpers/navigation_helper_spec.rb'
|
||||
- 'spec/helpers/order_cycles_helper_spec.rb'
|
||||
- 'spec/helpers/serializer_helper_spec.rb'
|
||||
- 'spec/helpers/shared_helper_spec.rb'
|
||||
- 'spec/helpers/shop_helper_spec.rb'
|
||||
- 'spec/helpers/spree/admin/base_helper_spec.rb'
|
||||
- 'spec/helpers/spree/admin/orders_helper_spec.rb'
|
||||
- 'spec/helpers/spree/orders_helper_spec.rb'
|
||||
- 'spec/jobs/confirm_order_job_spec.rb'
|
||||
- 'spec/jobs/confirm_signup_job_spec.rb'
|
||||
- 'spec/jobs/heartbeat_job_spec.rb'
|
||||
- 'spec/jobs/order_cycle_notification_job_spec.rb'
|
||||
- 'spec/jobs/subscription_confirm_job_spec.rb'
|
||||
- 'spec/jobs/subscription_placement_job_spec.rb'
|
||||
- 'spec/jobs/welcome_enterprise_job_spec.rb'
|
||||
- 'spec/lib/open_food_network/address_finder_spec.rb'
|
||||
- 'spec/lib/open_food_network/customers_report_spec.rb'
|
||||
- 'spec/lib/open_food_network/enterprise_fee_applicator_spec.rb'
|
||||
- 'spec/lib/open_food_network/enterprise_fee_calculator_spec.rb'
|
||||
- 'spec/lib/open_food_network/enterprise_issue_validator_spec.rb'
|
||||
- 'spec/lib/open_food_network/error_logger_spec.rb'
|
||||
- 'spec/lib/open_food_network/feature_toggle_spec.rb'
|
||||
- 'spec/lib/open_food_network/group_buy_report_spec.rb'
|
||||
- 'spec/lib/open_food_network/i18n_config_spec.rb'
|
||||
- 'spec/lib/open_food_network/lettuce_share_report_spec.rb'
|
||||
- 'spec/lib/open_food_network/order_and_distributor_report_spec.rb'
|
||||
- 'spec/lib/open_food_network/order_cycle_form_applicator_spec.rb'
|
||||
- 'spec/lib/open_food_network/order_cycle_management_report_spec.rb'
|
||||
- 'spec/lib/open_food_network/order_cycle_permissions_spec.rb'
|
||||
- 'spec/lib/open_food_network/order_grouper_spec.rb'
|
||||
- 'spec/lib/open_food_network/orders_and_fulfillments_report/customer_totals_report_spec.rb'
|
||||
- 'spec/lib/open_food_network/orders_and_fulfillments_report/distributor_totals_by_supplier_report_spec.rb'
|
||||
- 'spec/lib/open_food_network/orders_and_fulfillments_report/supplier_totals_by_distributor_report_spec.rb'
|
||||
- 'spec/lib/open_food_network/orders_and_fulfillments_report/supplier_totals_report_spec.rb'
|
||||
- 'spec/lib/open_food_network/orders_and_fulfillments_report_spec.rb'
|
||||
- 'spec/lib/open_food_network/packing_report_spec.rb'
|
||||
- 'spec/lib/open_food_network/permissions_spec.rb'
|
||||
- 'spec/lib/open_food_network/products_and_inventory_report_spec.rb'
|
||||
- 'spec/lib/open_food_network/property_merge_spec.rb'
|
||||
- 'spec/lib/open_food_network/referer_parser_spec.rb'
|
||||
- 'spec/lib/open_food_network/sales_tax_report_spec.rb'
|
||||
- 'spec/lib/open_food_network/scope_variant_to_hub_spec.rb'
|
||||
- 'spec/lib/open_food_network/scope_variants_to_search_spec.rb'
|
||||
- 'spec/lib/open_food_network/tag_rule_applicator_spec.rb'
|
||||
- 'spec/lib/open_food_network/user_balance_calculator_spec.rb'
|
||||
- 'spec/lib/open_food_network/users_and_enterprises_report_spec.rb'
|
||||
- 'spec/lib/open_food_network/xero_invoices_report_spec.rb'
|
||||
- 'spec/lib/spree/localized_number_spec.rb'
|
||||
- 'spec/lib/stripe/account_connector_spec.rb'
|
||||
- 'spec/lib/stripe/webhook_handler_spec.rb'
|
||||
- 'spec/lib/tasks/enterprises_rake_spec.rb'
|
||||
- 'spec/lib/tasks/users_rake_spec.rb'
|
||||
- 'spec/mailers/enterprise_mailer_spec.rb'
|
||||
- 'spec/mailers/producer_mailer_spec.rb'
|
||||
- 'spec/mailers/subscription_mailer_spec.rb'
|
||||
- 'spec/mailers/user_mailer_spec.rb'
|
||||
- 'spec/models/adjustment_metadata_spec.rb'
|
||||
- 'spec/models/calculator/flat_percent_item_total_spec.rb'
|
||||
- 'spec/models/calculator/flat_percent_per_item_spec.rb'
|
||||
- 'spec/models/calculator/flat_rate_spec.rb'
|
||||
- 'spec/models/calculator/flexi_rate_spec.rb'
|
||||
- 'spec/models/calculator/per_item_spec.rb'
|
||||
- 'spec/models/calculator/price_sack_spec.rb'
|
||||
- 'spec/models/calculator/weight_spec.rb'
|
||||
- 'spec/models/column_preference_spec.rb'
|
||||
- 'spec/models/concerns/order_shipment_spec.rb'
|
||||
- 'spec/models/concerns/product_stock_spec.rb'
|
||||
- 'spec/models/concerns/variant_stock_spec.rb'
|
||||
- 'spec/models/content_configuration_spec.rb'
|
||||
- 'spec/models/customer_spec.rb'
|
||||
- 'spec/models/enterprise_caching_spec.rb'
|
||||
- 'spec/models/enterprise_fee_spec.rb'
|
||||
- 'spec/models/enterprise_group_spec.rb'
|
||||
- 'spec/models/enterprise_relationship_spec.rb'
|
||||
- 'spec/models/enterprise_spec.rb'
|
||||
- 'spec/models/exchange_spec.rb'
|
||||
- 'spec/models/model_set_spec.rb'
|
||||
- 'spec/models/order_cycle_spec.rb'
|
||||
- 'spec/models/product_import/entry_processor_spec.rb'
|
||||
- 'spec/models/product_import/inventory_reset_strategy_spec.rb'
|
||||
- 'spec/models/product_import/reset_absent_spec.rb'
|
||||
- 'spec/models/product_import/settings_spec.rb'
|
||||
- 'spec/models/product_importer_spec.rb'
|
||||
- 'spec/models/proxy_order_spec.rb'
|
||||
- 'spec/models/spree/ability_spec.rb'
|
||||
- 'spec/models/spree/addresses_spec.rb'
|
||||
- 'spec/models/spree/adjustment_spec.rb'
|
||||
- 'spec/models/spree/calculator_spec.rb'
|
||||
- 'spec/models/spree/classification_spec.rb'
|
||||
- 'spec/models/spree/credit_card_spec.rb'
|
||||
- 'spec/models/spree/gateway/stripe_connect_spec.rb'
|
||||
- 'spec/models/spree/line_item_spec.rb'
|
||||
- 'spec/models/spree/order/checkout_spec.rb'
|
||||
- 'spec/models/spree/order_spec.rb'
|
||||
- 'spec/models/spree/payment_method_spec.rb'
|
||||
- 'spec/models/spree/payment_spec.rb'
|
||||
- 'spec/models/spree/preferences/file_configuration_spec.rb'
|
||||
- 'spec/models/spree/price_spec.rb'
|
||||
- 'spec/models/spree/product_set_spec.rb'
|
||||
- 'spec/models/spree/product_spec.rb'
|
||||
- 'spec/models/spree/shipping_method_spec.rb'
|
||||
- 'spec/models/spree/stock/availability_validator_spec.rb'
|
||||
- 'spec/models/spree/tax_rate_spec.rb'
|
||||
- 'spec/models/spree/user_spec.rb'
|
||||
- 'spec/models/spree/variant_spec.rb'
|
||||
- 'spec/models/stripe_account_spec.rb'
|
||||
- 'spec/models/subscription_line_item_spec.rb'
|
||||
- 'spec/models/subscription_spec.rb'
|
||||
- 'spec/models/tag_rule/discount_order_spec.rb'
|
||||
- 'spec/models/tag_rule/filter_order_cycles_spec.rb'
|
||||
- 'spec/models/tag_rule/filter_payment_methods_spec.rb'
|
||||
- 'spec/models/tag_rule/filter_products_spec.rb'
|
||||
- 'spec/models/tag_rule/filter_shipping_methods_spec.rb'
|
||||
- 'spec/models/tag_rule_spec.rb'
|
||||
- 'spec/models/variant_override_spec.rb'
|
||||
- 'spec/performance/injection_helper_spec.rb'
|
||||
- 'spec/performance/orders_controller_spec.rb'
|
||||
- 'spec/performance/shop_controller_spec.rb'
|
||||
- 'spec/requests/checkout/failed_checkout_spec.rb'
|
||||
- 'spec/requests/checkout/paypal_spec.rb'
|
||||
- 'spec/requests/checkout/stripe_connect_spec.rb'
|
||||
- 'spec/requests/embedded_shopfronts_headers_spec.rb'
|
||||
- 'spec/requests/large_request_spec.rb'
|
||||
- 'spec/serializers/api/admin/customer_serializer_spec.rb'
|
||||
- 'spec/serializers/api/admin/enterprise_serializer_spec.rb'
|
||||
- 'spec/serializers/api/admin/exchange_serializer_spec.rb'
|
||||
- 'spec/serializers/api/admin/for_order_cycle/supplied_product_serializer_spec.rb'
|
||||
- 'spec/serializers/api/admin/index_enterprise_serializer_spec.rb'
|
||||
- 'spec/serializers/api/admin/order_cycle_serializer_spec.rb'
|
||||
- 'spec/serializers/api/admin/product_serializer_spec.rb'
|
||||
- 'spec/serializers/api/admin/subscription_customer_serializer_spec.rb'
|
||||
- 'spec/serializers/api/admin/subscription_line_item_serializer_spec.rb'
|
||||
- 'spec/serializers/api/admin/variant_override_serializer_spec.rb'
|
||||
- 'spec/serializers/api/admin/variant_serializer_spec.rb'
|
||||
- 'spec/serializers/api/cached_enterprise_serializer_spec.rb'
|
||||
- 'spec/serializers/api/credit_card_serializer_spec.rb'
|
||||
- 'spec/serializers/api/current_order_serializer_spec.rb'
|
||||
- 'spec/serializers/api/enterprise_serializer_spec.rb'
|
||||
- 'spec/serializers/api/enterprise_shopfront_list_serializer_spec.rb'
|
||||
- 'spec/serializers/api/enterprise_shopfront_serializer_spec.rb'
|
||||
- 'spec/serializers/api/group_list_serializer_spec.rb'
|
||||
- 'spec/serializers/api/order_cycle_serializer_spec.rb'
|
||||
- 'spec/serializers/api/order_serializer_spec.rb'
|
||||
- 'spec/serializers/api/product_serializer_spec.rb'
|
||||
- 'spec/serializers/api/shipping_method_serializer_spec.rb'
|
||||
- 'spec/serializers/api/variant_serializer_spec.rb'
|
||||
- 'spec/services/bulk_invoice_service_spec.rb'
|
||||
- 'spec/services/cart_service_spec.rb'
|
||||
- 'spec/services/default_shipping_category_spec.rb'
|
||||
- 'spec/services/default_stock_location_spec.rb'
|
||||
- 'spec/services/embedded_page_service_spec.rb'
|
||||
- 'spec/services/exchange_products_renderer_spec.rb'
|
||||
- 'spec/services/exchange_variant_bulk_updater_spec.rb'
|
||||
- 'spec/services/invoice_renderer_spec.rb'
|
||||
- 'spec/services/mail_configuration_spec.rb'
|
||||
- 'spec/services/order_cycle_distributed_products_spec.rb'
|
||||
- 'spec/services/order_cycle_distributed_variants_spec.rb'
|
||||
- 'spec/services/order_cycle_form_spec.rb'
|
||||
- 'spec/services/order_cycle_warning_spec.rb'
|
||||
- 'spec/services/order_factory_spec.rb'
|
||||
- 'spec/services/order_syncer_spec.rb'
|
||||
- 'spec/services/order_workflow_spec.rb'
|
||||
- 'spec/services/permissions/order_spec.rb'
|
||||
- 'spec/services/product_tag_rules_filterer_spec.rb'
|
||||
- 'spec/services/products_renderer_spec.rb'
|
||||
- 'spec/services/search_orders_spec.rb'
|
||||
- 'spec/services/tax_rate_finder_spec.rb'
|
||||
- 'spec/services/upload_sanitizer_spec.rb'
|
||||
- 'spec/services/variant_units/option_value_namer_spec.rb'
|
||||
- 'spec/services/variants_stock_levels_spec.rb'
|
||||
- 'spec/spec_helper.rb'
|
||||
- 'spec/support/ability_helper.rb'
|
||||
- 'spec/support/api_helper.rb'
|
||||
- 'spec/support/cancan_helper.rb'
|
||||
- 'spec/support/controller_helper.rb'
|
||||
- 'spec/support/delayed_job_helper.rb'
|
||||
- 'spec/support/downloads_helper.rb'
|
||||
- 'spec/support/email_helper.rb'
|
||||
- 'spec/support/embedded_pages_helper.rb'
|
||||
- 'spec/support/enterprise_groups_helper.rb'
|
||||
- 'spec/support/feature_toggle_helper.rb'
|
||||
- 'spec/support/features/datepicker_helper.rb'
|
||||
- 'spec/support/filters_helper.rb'
|
||||
- 'spec/support/html_helper.rb'
|
||||
- 'spec/support/i18n_error_raising.rb'
|
||||
- 'spec/support/localized_number_helper.rb'
|
||||
- 'spec/support/matchers/date_time_validator_matchers.rb'
|
||||
- 'spec/support/matchers/delegate_matchers.rb'
|
||||
- 'spec/support/matchers/email_confirmation_matchers.rb'
|
||||
- 'spec/support/matchers/flash_message_matchers.rb'
|
||||
- 'spec/support/matchers/integer_array_validator_matchers.rb'
|
||||
- 'spec/support/matchers/select2_matchers.rb'
|
||||
- 'spec/support/matchers/table_matchers.rb'
|
||||
- 'spec/support/performance_helper.rb'
|
||||
- 'spec/support/products_helper.rb'
|
||||
- 'spec/support/request/admin_helper.rb'
|
||||
- 'spec/support/request/authentication_helper.rb'
|
||||
- 'spec/support/request/cookie_helper.rb'
|
||||
- 'spec/support/request/distribution_helper.rb'
|
||||
- 'spec/support/request/menu_helper.rb'
|
||||
- 'spec/support/request/shop_workflow.rb'
|
||||
- 'spec/support/request/ui_component_helper.rb'
|
||||
- 'spec/support/request/web_helper.rb'
|
||||
- 'spec/support/seeds.rb'
|
||||
- 'spec/support/spree/checkout_helpers.rb'
|
||||
- 'spec/support/spree/money_helper.rb'
|
||||
- 'spec/support/spree/url_helpers.rb'
|
||||
- 'spec/support/timecop.rb'
|
||||
- 'spec/validators/date_time_string_validator_spec.rb'
|
||||
- 'spec/validators/integer_array_validator_spec.rb'
|
||||
- 'spec/views/spree/admin/orders/edit.html.haml_spec.rb'
|
||||
- 'spec/views/spree/admin/orders/index.html.haml_spec.rb'
|
||||
- 'spec/views/spree/admin/payment_methods/index.html.haml_spec.rb'
|
||||
- 'spec/views/spree/admin/shared/_order_links.html.haml_spec.rb'
|
||||
|
||||
# Offense count: 44
|
||||
# Offense count: 39
|
||||
# Configuration parameters: MinBodyLength.
|
||||
Style/GuardClause:
|
||||
Exclude:
|
||||
@@ -1229,8 +836,6 @@ Style/GuardClause:
|
||||
- 'app/models/enterprise_group.rb'
|
||||
- 'app/models/producer_property.rb'
|
||||
- 'app/models/spree/preferences/preferable_class_methods.rb'
|
||||
- 'app/models/spree/price_decorator.rb'
|
||||
- 'app/models/spree/product_decorator.rb'
|
||||
- 'app/services/order_syncer.rb'
|
||||
- 'app/services/variant_units/variant_and_line_item_naming.rb'
|
||||
- 'lib/discourse/single_sign_on.rb'
|
||||
|
||||
@@ -1 +1 @@
|
||||
2.3.7
|
||||
2.4.4
|
||||
|
||||
37
Gemfile
37
Gemfile
@@ -1,5 +1,7 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
source 'https://rubygems.org'
|
||||
ruby "2.3.7"
|
||||
ruby "2.4.4"
|
||||
git_source(:github) { |repo_name| "https://github.com/#{repo_name}.git" }
|
||||
|
||||
gem 'i18n'
|
||||
@@ -19,20 +21,18 @@ gem 'web', path: './engines/web'
|
||||
gem 'activerecord-postgresql-adapter'
|
||||
gem 'pg', '~> 0.21.0'
|
||||
|
||||
gem 'acts_as_list', '= 0.3.0'
|
||||
gem 'awesome_nested_set', '~> 3.2.1'
|
||||
gem 'acts_as_list', '0.9.19'
|
||||
gem 'awesome_nested_set', '~> 3.3.1'
|
||||
gem 'cancan', '~> 1.6.10'
|
||||
gem 'ffaker'
|
||||
gem 'highline', '2.0.3' # Necessary for the install generator
|
||||
gem 'json'
|
||||
gem 'money', '< 6.1.0'
|
||||
gem 'paranoia', '~> 2.0'
|
||||
gem 'monetize', '~> 1.1'
|
||||
gem 'paranoia', '~> 2.4'
|
||||
gem 'ransack', '~> 1.8.10'
|
||||
gem 'state_machines-activerecord'
|
||||
gem 'stringex', '~> 2.8.5'
|
||||
|
||||
gem 'spree_i18n', github: 'openfoodfoundation/spree_i18n', branch: '1-3-stable'
|
||||
|
||||
# Our branch contains the following changes:
|
||||
# - Pass customer email and phone number to PayPal (merged to upstream master)
|
||||
# - Change type of password from string to password to hide it in the form
|
||||
@@ -45,9 +45,9 @@ gem 'stripe'
|
||||
# which is needed for Pin Payments (and possibly others).
|
||||
gem 'activemerchant', '~> 1.78.0'
|
||||
|
||||
gem 'devise', '~> 3.5.10' # v4.0.0 needs rails 4.1
|
||||
gem 'devise'
|
||||
gem 'devise-encryptable'
|
||||
gem 'devise-token_authenticatable', '~> 0.4.10' # v0.5.0 needs devise v4
|
||||
gem 'devise-token_authenticatable'
|
||||
gem 'jwt', '~> 2.2'
|
||||
gem 'oauth2', '~> 1.4.4' # Used for Stripe Connect
|
||||
|
||||
@@ -55,7 +55,7 @@ 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'
|
||||
@@ -80,7 +80,6 @@ gem 'dalli'
|
||||
gem 'figaro'
|
||||
gem 'geocoder'
|
||||
gem 'gmaps4rails'
|
||||
gem 'oj'
|
||||
gem 'paper_trail', '~> 7.1.3'
|
||||
gem 'paperclip', '~> 3.4.1'
|
||||
gem 'rack-rewrite'
|
||||
@@ -111,7 +110,7 @@ gem 'foundation-icons-sass-rails'
|
||||
gem 'foundation-rails', '= 5.5.2.1'
|
||||
|
||||
gem 'jquery-migrate-rails'
|
||||
gem 'jquery-rails', '3.1.5'
|
||||
gem 'jquery-rails', '4.4.0'
|
||||
gem 'jquery-ui-rails', '~> 4.2'
|
||||
gem 'select2-rails', '~> 3.4.7'
|
||||
|
||||
@@ -126,10 +125,10 @@ group :test, :development do
|
||||
# Pretty printed test output
|
||||
gem 'atomic'
|
||||
gem 'awesome_print'
|
||||
gem 'capybara', '>= 2.18.0' # 3.0 requires rack 1.6 that only works with Rails 4.2
|
||||
gem 'capybara'
|
||||
gem 'database_cleaner', require: false
|
||||
gem "factory_bot_rails", '4.10.0', require: false
|
||||
gem 'fuubar', '~> 2.5.0'
|
||||
gem "factory_bot_rails", '5.2.0', require: false
|
||||
gem 'fuubar', '~> 2.5.1'
|
||||
gem 'json_spec', '~> 1.1.4'
|
||||
gem 'knapsack'
|
||||
gem 'letter_opener', '>= 1.4.1'
|
||||
@@ -146,17 +145,17 @@ end
|
||||
group :test do
|
||||
gem 'simplecov', require: false
|
||||
gem 'test-prof'
|
||||
gem 'test_after_commit' # needed to test Devise callbacks
|
||||
gem 'webmock'
|
||||
# See spec/spec_helper.rb for instructions
|
||||
# gem 'perftools.rb'
|
||||
end
|
||||
|
||||
group :development do
|
||||
gem 'byebug', '~> 11.0.0' # 11.1 requires ruby 2.4
|
||||
gem 'byebug'
|
||||
gem 'debugger-linecache'
|
||||
gem "newrelic_rpm", "~> 3.0"
|
||||
gem "pry", "~> 0.12.0" # pry 0.13 is not compatible with pry-byebug 3.7
|
||||
gem 'pry-byebug', '~> 3.7.0' # 3.8 requires ruby 2.4
|
||||
gem 'pry'
|
||||
gem 'pry-byebug'
|
||||
gem 'rubocop'
|
||||
gem 'rubocop-rails'
|
||||
gem 'spring'
|
||||
|
||||
236
Gemfile.lock
236
Gemfile.lock
@@ -19,15 +19,6 @@ GIT
|
||||
specs:
|
||||
ofn-qz (0.1.0)
|
||||
|
||||
GIT
|
||||
remote: https://github.com/openfoodfoundation/spree_i18n.git
|
||||
revision: 12f18312232f0ce70270d47859d2951d12f7791c
|
||||
branch: 1-3-stable
|
||||
specs:
|
||||
spree_i18n (1.0.0)
|
||||
i18n (~> 0.5)
|
||||
rails-i18n
|
||||
|
||||
PATH
|
||||
remote: engines/catalog
|
||||
specs:
|
||||
@@ -110,7 +101,7 @@ GEM
|
||||
tzinfo (~> 1.1)
|
||||
acts-as-taggable-on (4.0.0)
|
||||
activerecord (>= 4.0)
|
||||
acts_as_list (0.3.0)
|
||||
acts_as_list (0.9.19)
|
||||
activerecord (>= 3.0)
|
||||
addressable (2.7.0)
|
||||
public_suffix (>= 2.0.2, < 5.0)
|
||||
@@ -125,9 +116,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)
|
||||
@@ -136,25 +127,26 @@ 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)
|
||||
byebug (11.1.3)
|
||||
cancan (1.6.10)
|
||||
capybara (2.18.0)
|
||||
capybara (3.32.2)
|
||||
addressable
|
||||
mini_mime (>= 0.1.3)
|
||||
nokogiri (>= 1.3.3)
|
||||
rack (>= 1.0.0)
|
||||
rack-test (>= 0.5.4)
|
||||
xpath (>= 2.0, < 4.0)
|
||||
nokogiri (~> 1.8)
|
||||
rack (>= 1.6.0)
|
||||
rack-test (>= 0.6.3)
|
||||
regexp_parser (~> 1.5)
|
||||
xpath (~> 3.2)
|
||||
childprocess (3.0.0)
|
||||
chronic (0.10.2)
|
||||
chunky_png (1.3.14)
|
||||
climate_control (0.2.0)
|
||||
cocaine (0.5.8)
|
||||
climate_control (>= 0.0.3, < 1.0)
|
||||
coderay (1.1.2)
|
||||
coderay (1.1.3)
|
||||
coffee-rails (4.2.2)
|
||||
coffee-script (>= 2.2.0)
|
||||
railties (>= 4.0.0)
|
||||
@@ -162,7 +154,7 @@ GEM
|
||||
coffee-script-source
|
||||
execjs
|
||||
coffee-script-source (1.12.2)
|
||||
combine_pdf (1.0.16)
|
||||
combine_pdf (1.0.21)
|
||||
ruby-rc4 (>= 0.1.5)
|
||||
compass (1.0.3)
|
||||
chunky_png (~> 1.2)
|
||||
@@ -192,32 +184,31 @@ GEM
|
||||
activerecord (>= 3.2.0, < 5.0)
|
||||
fog (~> 1.0)
|
||||
rails (>= 3.2.0, < 5.0)
|
||||
ddtrace (0.42.0)
|
||||
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 (4.1.9)
|
||||
activesupport (>= 3.0, < 6.2)
|
||||
delayed_job_active_record (4.1.5)
|
||||
activerecord (>= 3.0, < 6.2)
|
||||
delayed_job (>= 3.0, < 5)
|
||||
delayed_job_web (1.4.3)
|
||||
activerecord (> 3.0.0)
|
||||
delayed_job (> 2.0.3)
|
||||
rack-protection (>= 1.5.5)
|
||||
sinatra (>= 1.4.4)
|
||||
devise (3.5.10)
|
||||
devise (4.7.3)
|
||||
bcrypt (~> 3.0)
|
||||
orm_adapter (~> 0.1)
|
||||
railties (>= 3.2.6, < 5)
|
||||
railties (>= 4.1.0)
|
||||
responders
|
||||
thread_safe (~> 0.1)
|
||||
warden (~> 1.2.3)
|
||||
devise-encryptable (0.2.0)
|
||||
devise (>= 2.1.0)
|
||||
devise-token_authenticatable (0.4.10)
|
||||
devise (>= 3.5.2, < 4.0.0)
|
||||
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)
|
||||
@@ -225,14 +216,14 @@ GEM
|
||||
eventmachine (1.2.7)
|
||||
excon (0.78.0)
|
||||
execjs (2.7.0)
|
||||
factory_bot (4.10.0)
|
||||
activesupport (>= 3.0.0)
|
||||
factory_bot_rails (4.10.0)
|
||||
factory_bot (~> 4.10.0)
|
||||
railties (>= 3.0.0)
|
||||
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)
|
||||
ffaker (2.16.0)
|
||||
ffi (1.13.1)
|
||||
figaro (1.2.0)
|
||||
thor (>= 0.14.0, < 2)
|
||||
@@ -393,7 +384,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)
|
||||
@@ -402,7 +393,7 @@ GEM
|
||||
globalid (0.4.2)
|
||||
activesupport (>= 4.2.0)
|
||||
gmaps4rails (2.1.2)
|
||||
haml (5.2.0)
|
||||
haml (5.2.1)
|
||||
temple (>= 0.8.0)
|
||||
tilt
|
||||
hashdiff (1.0.1)
|
||||
@@ -418,10 +409,10 @@ 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 (3.1.5)
|
||||
railties (>= 3.0, < 5.0)
|
||||
jquery-rails (4.4.0)
|
||||
rails-dom-testing (>= 1, < 3)
|
||||
railties (>= 4.2.0)
|
||||
thor (>= 0.14, < 2.0)
|
||||
jquery-ui-rails (4.2.1)
|
||||
railties (>= 3.2.16)
|
||||
@@ -432,23 +423,32 @@ GEM
|
||||
multi_json (~> 1.0)
|
||||
rspec (>= 2.0, < 4.0)
|
||||
jwt (2.2.2)
|
||||
kaminari (0.17.0)
|
||||
actionpack (>= 3.0.0)
|
||||
activesupport (>= 3.0.0)
|
||||
kaminari (1.2.1)
|
||||
activesupport (>= 4.1.0)
|
||||
kaminari-actionview (= 1.2.1)
|
||||
kaminari-activerecord (= 1.2.1)
|
||||
kaminari-core (= 1.2.1)
|
||||
kaminari-actionview (1.2.1)
|
||||
actionview
|
||||
kaminari-core (= 1.2.1)
|
||||
kaminari-activerecord (1.2.1)
|
||||
activerecord
|
||||
kaminari-core (= 1.2.1)
|
||||
kaminari-core (1.2.1)
|
||||
kgio (2.11.3)
|
||||
knapsack (1.19.0)
|
||||
knapsack (1.20.0)
|
||||
rake
|
||||
launchy (2.4.3)
|
||||
addressable (~> 2.3)
|
||||
letter_opener (1.7.0)
|
||||
launchy (~> 2.2)
|
||||
libv8 (7.3.492.27.1)
|
||||
loofah (2.7.0)
|
||||
loofah (2.8.0)
|
||||
crass (~> 1.0.2)
|
||||
nokogiri (>= 1.5.9)
|
||||
mail (2.7.1)
|
||||
mini_mime (>= 0.1.1)
|
||||
method_source (0.9.2)
|
||||
method_source (1.0.0)
|
||||
mime-types (3.3.1)
|
||||
mime-types-data (~> 3.2015)
|
||||
mime-types-data (3.2020.0512)
|
||||
@@ -456,16 +456,16 @@ 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)
|
||||
multipart-post (2.1.1)
|
||||
netrc (0.11.0)
|
||||
newrelic_rpm (3.18.1.330)
|
||||
nokogiri (1.10.10)
|
||||
mini_portile2 (~> 2.4.0)
|
||||
oauth2 (1.4.4)
|
||||
@@ -474,7 +474,6 @@ 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)
|
||||
@@ -486,11 +485,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
|
||||
@@ -498,15 +497,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
|
||||
@@ -545,7 +544,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)
|
||||
@@ -559,7 +558,8 @@ 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)
|
||||
responders (2.4.1)
|
||||
@@ -584,25 +584,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)
|
||||
@@ -616,21 +616,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.0)
|
||||
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)
|
||||
@@ -644,18 +647,17 @@ GEM
|
||||
selenium-webdriver (3.142.7)
|
||||
childprocess (>= 0.5, < 4.0)
|
||||
rubyzip (>= 1.2.2)
|
||||
shoulda-matchers (4.0.1)
|
||||
shoulda-matchers (4.4.1)
|
||||
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 (1.7.2)
|
||||
spring (2.1.1)
|
||||
spring-commands-rspec (1.0.4)
|
||||
spring (>= 0.9.1)
|
||||
sprockets (2.12.5)
|
||||
@@ -675,24 +677,26 @@ 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)
|
||||
thor (0.20.3)
|
||||
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)
|
||||
@@ -703,11 +707,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.0)
|
||||
addressable (>= 2.3.6)
|
||||
crack (>= 0.3.2)
|
||||
hashdiff (>= 0.4.0, < 2.0.0)
|
||||
@@ -732,19 +736,19 @@ DEPENDENCIES
|
||||
activerecord-postgresql-adapter
|
||||
activerecord-session_store
|
||||
acts-as-taggable-on (~> 4.0)
|
||||
acts_as_list (= 0.3.0)
|
||||
acts_as_list (= 0.9.19)
|
||||
andand
|
||||
angular-rails-templates (~> 0.3.0)
|
||||
angularjs-file-upload-rails (~> 2.4.1)
|
||||
angularjs-rails (= 1.5.5)
|
||||
atomic
|
||||
awesome_nested_set (~> 3.2.1)
|
||||
awesome_nested_set (~> 3.3.1)
|
||||
awesome_print
|
||||
aws-sdk (= 1.67.0)
|
||||
bugsnag
|
||||
byebug (~> 11.0.0)
|
||||
byebug
|
||||
cancan (~> 1.6.10)
|
||||
capybara (>= 2.18.0)
|
||||
capybara
|
||||
catalog!
|
||||
coffee-rails (~> 4.2.2)
|
||||
combine_pdf
|
||||
@@ -758,17 +762,17 @@ DEPENDENCIES
|
||||
debugger-linecache
|
||||
delayed_job_active_record
|
||||
delayed_job_web
|
||||
devise (~> 3.5.10)
|
||||
devise
|
||||
devise-encryptable
|
||||
devise-token_authenticatable (~> 0.4.10)
|
||||
devise-token_authenticatable
|
||||
dfc_provider!
|
||||
eventmachine (>= 1.2.3)
|
||||
factory_bot_rails (= 4.10.0)
|
||||
factory_bot_rails (= 5.2.0)
|
||||
ffaker
|
||||
figaro
|
||||
foundation-icons-sass-rails
|
||||
foundation-rails (= 5.5.2.1)
|
||||
fuubar (~> 2.5.0)
|
||||
fuubar (~> 2.5.1)
|
||||
geocoder
|
||||
gmaps4rails
|
||||
haml
|
||||
@@ -777,27 +781,25 @@ DEPENDENCIES
|
||||
i18n-js (~> 3.8.0)
|
||||
immigrant
|
||||
jquery-migrate-rails
|
||||
jquery-rails (= 3.1.5)
|
||||
jquery-rails (= 4.4.0)
|
||||
jquery-ui-rails (~> 4.2)
|
||||
json
|
||||
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)
|
||||
newrelic_rpm (~> 3.0)
|
||||
monetize (~> 1.1)
|
||||
oauth2 (~> 1.4.4)
|
||||
ofn-qz!
|
||||
oj
|
||||
order_management!
|
||||
paper_trail (~> 7.1.3)
|
||||
paperclip (~> 3.4.1)
|
||||
paranoia (~> 2.0)
|
||||
paranoia (~> 2.4)
|
||||
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
|
||||
@@ -820,7 +822,6 @@ DEPENDENCIES
|
||||
selenium-webdriver
|
||||
shoulda-matchers
|
||||
simplecov
|
||||
spree_i18n!
|
||||
spree_paypal_express!
|
||||
spring
|
||||
spring-commands-rspec
|
||||
@@ -829,6 +830,7 @@ DEPENDENCIES
|
||||
stripe
|
||||
test-prof
|
||||
test-unit (~> 3.3)
|
||||
test_after_commit
|
||||
timecop
|
||||
uglifier (>= 1.0.3)
|
||||
unicorn
|
||||
@@ -842,7 +844,7 @@ DEPENDENCIES
|
||||
wkhtmltopdf-binary
|
||||
|
||||
RUBY VERSION
|
||||
ruby 2.3.7p456
|
||||
ruby 2.4.4p296
|
||||
|
||||
BUNDLED WITH
|
||||
1.17.3
|
||||
|
||||
2
Rakefile
2
Rakefile
@@ -1,4 +1,6 @@
|
||||
#!/usr/bin/env rake
|
||||
# frozen_string_literal: true
|
||||
|
||||
# Add your own tasks in files placed in lib/tasks ending in .rake,
|
||||
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -127,7 +127,16 @@ $(document).ready(function() {
|
||||
nextText: Spree.translations.next,
|
||||
showOn: "focus"
|
||||
});
|
||||
|
||||
|
||||
$.datepicker.regional[I18n.locale] = {
|
||||
prevText: Spree.translations.previous,
|
||||
nextText: Spree.translations.next,
|
||||
monthNames: Spree.translations.month_names,
|
||||
dayNames: Spree.translations.abbr_day_names,
|
||||
dayNamesMin: Spree.translations.abbr_day_names,
|
||||
dateFormat: Spree.translations.date_picker
|
||||
};
|
||||
$.datepicker.setDefaults( $.datepicker.regional[I18n.locale]);
|
||||
// Correctly display range dates
|
||||
$('.date-range-filter .datepicker-from').datepicker('option', 'onSelect', function(selectedDate) {
|
||||
$(".date-range-filter .datepicker-to" ).datepicker( "option", "minDate", selectedDate );
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
Darkswarm.controller "CreditCardsCtrl", ($scope, CreditCard, CreditCards) ->
|
||||
angular.extend(this, new FieldsetMixin($scope))
|
||||
$scope.savedCreditCards = CreditCards.saved
|
||||
$scope.setDefault = CreditCards.setDefault
|
||||
$scope.confirmSetDefault = CreditCards.confirmSetDefault
|
||||
$scope.CreditCard = CreditCard
|
||||
$scope.secrets = CreditCard.secrets
|
||||
$scope.showForm = CreditCard.show
|
||||
|
||||
@@ -25,3 +25,6 @@ Darkswarm.controller "OrderCycleChangeCtrl", ($scope, $rootScope, $timeout, Orde
|
||||
Cart.reloadFinalisedLineItems()
|
||||
ChangeableOrdersAlert.reload()
|
||||
$rootScope.$broadcast 'orderCycleSelected'
|
||||
|
||||
$scope.closesInLessThan3Months = () ->
|
||||
moment().diff(moment(OrderCycle.orders_close_at(), "YYYY-MM-DD HH:mm:SS Z"), 'days') > -75
|
||||
|
||||
@@ -5,15 +5,13 @@ Darkswarm.directive "tabsetCtrl", (Tabsets, $location) ->
|
||||
selected: "@"
|
||||
navigate: "="
|
||||
prefix: "@?"
|
||||
alwaysopen: "="
|
||||
controller: ($scope, $element) ->
|
||||
if $scope.navigate
|
||||
path = $location.path()?.match(/^\/\w+$/)?[0]
|
||||
$scope.selected = path[1..] if path
|
||||
|
||||
this.toggle = (name) ->
|
||||
state = if $scope.alwaysopen then 'open' else null
|
||||
Tabsets.toggle($scope.id, name, state)
|
||||
Tabsets.toggle($scope.id, name)
|
||||
|
||||
this.select = (selection) ->
|
||||
$scope.$broadcast("selection:changed", selection)
|
||||
|
||||
@@ -50,7 +50,7 @@ Darkswarm.factory 'Cart', (CurrentOrder, Variants, $timeout, $http, $modal, $roo
|
||||
@popQueue() if @update_enqueued
|
||||
|
||||
.error (response, status)=>
|
||||
Messages.flash({error: t('js.cart.add_to_cart_failed')})
|
||||
Messages.flash({error: response.error})
|
||||
@update_running = false
|
||||
|
||||
compareAndNotifyStockLevels: (stockLevels) =>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Darkswarm.factory 'CreditCards', ($http, $filter, savedCreditCards, Messages)->
|
||||
Darkswarm.factory 'CreditCards', ($http, $filter, savedCreditCards, Messages, Customers)->
|
||||
new class CreditCard
|
||||
saved: $filter('orderBy')(savedCreditCards,'-is_default')
|
||||
|
||||
@@ -11,5 +11,13 @@ Darkswarm.factory 'CreditCards', ($http, $filter, savedCreditCards, Messages)->
|
||||
othercard.is_default = false
|
||||
$http.put("/credit_cards/#{card.id}", is_default: true).then (data) ->
|
||||
Messages.success(t('js.default_card_updated'))
|
||||
Customers.clearAllAllowCharges()
|
||||
, (response) ->
|
||||
Messages.flash(response.data.flash)
|
||||
|
||||
confirmSetDefault: (card, event) =>
|
||||
if confirm t("js.default_card_voids_auth")
|
||||
@setDefault(card)
|
||||
else
|
||||
event.preventDefault()
|
||||
return false
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
angular.module("Darkswarm").factory 'Customer', ($resource, Messages) ->
|
||||
angular.module("Darkswarm").factory 'Customer', ($resource, $injector, Messages) ->
|
||||
Customer = $resource('/api/customers/:id/:action.json', {}, {
|
||||
'index':
|
||||
method: 'GET'
|
||||
@@ -12,8 +12,21 @@ angular.module("Darkswarm").factory 'Customer', ($resource, Messages) ->
|
||||
})
|
||||
|
||||
Customer.prototype.update = ->
|
||||
if @allow_charges
|
||||
Messages.loading(t('js.authorising'))
|
||||
@$update().then (response) =>
|
||||
Messages.success(t('js.changes_saved'))
|
||||
if response.gateway_recurring_payment_client_secret && $injector.has('stripePublishableKey')
|
||||
Messages.clear()
|
||||
stripe = Stripe($injector.get('stripePublishableKey'), { stripeAccount: response.gateway_shop_id })
|
||||
stripe.confirmCardSetup(response.gateway_recurring_payment_client_secret).then (result) =>
|
||||
if result.error
|
||||
@allow_charges = false
|
||||
@$update(allow_charges: false)
|
||||
Messages.error(result.error.message)
|
||||
else
|
||||
Messages.success(t('js.changes_saved'))
|
||||
else
|
||||
Messages.success(t('js.changes_saved'))
|
||||
, (response) =>
|
||||
Messages.error(response.data.error)
|
||||
|
||||
|
||||
@@ -12,3 +12,7 @@ angular.module("Darkswarm").factory 'Customers', (Customer) ->
|
||||
for customer in customers
|
||||
@all.push customer
|
||||
@byID[customer.id] = customer
|
||||
|
||||
clearAllAllowCharges: () ->
|
||||
for customer in @index()
|
||||
customer.allow_charges = false
|
||||
|
||||
@@ -7,12 +7,10 @@ Darkswarm.factory 'Tabsets', ->
|
||||
@tabsets.push { ctrl: ctrl, id: id, selected: selected }
|
||||
ctrl.select(selected) if selected?
|
||||
|
||||
toggle: (id, name, state=null) ->
|
||||
toggle: (id, name) ->
|
||||
tabset = @findTabsetByObject(id)
|
||||
if tabset.selected == name
|
||||
@select(tabset, null) unless state == "open"
|
||||
else
|
||||
@select(tabset, name) unless state == "closed"
|
||||
if tabset.selected != name
|
||||
@select(tabset, name)
|
||||
|
||||
select: (tabset, name) ->
|
||||
tabset.selected = name
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
module Admin
|
||||
class ColumnPreferencesController < ResourceController
|
||||
class ColumnPreferencesController < Admin::ResourceController
|
||||
before_action :load_collection, only: [:bulk_update]
|
||||
|
||||
respond_to :json
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
require 'open_food_network/address_finder'
|
||||
|
||||
module Admin
|
||||
class CustomersController < ResourceController
|
||||
class CustomersController < Admin::ResourceController
|
||||
before_action :load_managed_shops, only: :index, if: :html_request?
|
||||
respond_to :json
|
||||
|
||||
@@ -42,7 +42,7 @@ module Admin
|
||||
end
|
||||
end
|
||||
|
||||
# copy of Spree::Admin::ResourceController without flash notice
|
||||
# copy of Admin::ResourceController without flash notice
|
||||
def destroy
|
||||
invoke_callbacks(:destroy, :before)
|
||||
if @object.destroy
|
||||
@@ -95,7 +95,7 @@ module Admin
|
||||
)
|
||||
end
|
||||
|
||||
# Used in ResourceController#update
|
||||
# Used in Admin::ResourceController#update
|
||||
def permitted_resource_params
|
||||
customer_params
|
||||
end
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
module Admin
|
||||
class EnterpriseFeesController < ResourceController
|
||||
class EnterpriseFeesController < Admin::ResourceController
|
||||
before_action :load_enterprise_fee_set, only: :index
|
||||
before_action :load_data
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
module Admin
|
||||
class EnterpriseGroupsController < ResourceController
|
||||
class EnterpriseGroupsController < Admin::ResourceController
|
||||
before_action :load_data, except: :index
|
||||
before_action :load_object_data, only: [:new, :edit, :create, :update]
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
module Admin
|
||||
class EnterpriseRelationshipsController < ResourceController
|
||||
class EnterpriseRelationshipsController < Admin::ResourceController
|
||||
def index
|
||||
@my_enterprises = Enterprise.
|
||||
includes(:shipping_methods, :payment_methods).
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
module Admin
|
||||
class EnterpriseRolesController < ResourceController
|
||||
class EnterpriseRolesController < Admin::ResourceController
|
||||
def index
|
||||
@enterprise_roles = EnterpriseRole.by_user_email
|
||||
@users = Spree::User.order('spree_users.email')
|
||||
|
||||
@@ -3,7 +3,7 @@ require 'open_food_network/permissions'
|
||||
require 'open_food_network/order_cycle_permissions'
|
||||
|
||||
module Admin
|
||||
class EnterprisesController < ResourceController
|
||||
class EnterprisesController < Admin::ResourceController
|
||||
# These need to run before #load_resource so that @object is initialised with sanitised values
|
||||
prepend_before_action :override_owner, only: :create
|
||||
prepend_before_action :override_sells, only: :create
|
||||
@@ -326,7 +326,7 @@ module Admin
|
||||
)
|
||||
end
|
||||
|
||||
# Used in ResourceController#create
|
||||
# Used in Admin::ResourceController#create
|
||||
def permitted_resource_params
|
||||
enterprise_params
|
||||
end
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
module Admin
|
||||
class InventoryItemsController < ResourceController
|
||||
class InventoryItemsController < Admin::ResourceController
|
||||
respond_to :json
|
||||
|
||||
respond_override update: { json: {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
module Admin
|
||||
class OrderCyclesController < ResourceController
|
||||
class OrderCyclesController < Admin::ResourceController
|
||||
include OrderCyclesHelper
|
||||
include PaperTrailLogging
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
module Admin
|
||||
class ProducerPropertiesController < ResourceController
|
||||
class ProducerPropertiesController < Admin::ResourceController
|
||||
before_action :load_enterprise
|
||||
before_action :load_properties
|
||||
before_action :setup_property, only: [:index]
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
module Admin
|
||||
class ProxyOrdersController < ResourceController
|
||||
class ProxyOrdersController < Admin::ResourceController
|
||||
respond_to :json
|
||||
|
||||
def edit
|
||||
|
||||
@@ -1,41 +1,303 @@
|
||||
require 'action_callbacks'
|
||||
|
||||
module Admin
|
||||
class ResourceController < Spree::Admin::ResourceController
|
||||
class ResourceController < Spree::Admin::BaseController
|
||||
helper_method :new_object_url, :edit_object_url, :object_url, :collection_url
|
||||
before_action :load_resource, except: [:update_positions]
|
||||
rescue_from ActiveRecord::RecordNotFound, with: :resource_not_found
|
||||
rescue_from CanCan::AccessDenied, with: :unauthorized
|
||||
|
||||
respond_to :html
|
||||
respond_to :js, except: [:show, :index]
|
||||
|
||||
def new
|
||||
invoke_callbacks(:new_action, :before)
|
||||
respond_with(@object) do |format|
|
||||
format.html { render layout: !request.xhr? }
|
||||
format.js { render layout: false }
|
||||
end
|
||||
end
|
||||
|
||||
def edit
|
||||
respond_with(@object) do |format|
|
||||
format.html { render layout: !request.xhr? }
|
||||
format.js { render layout: false }
|
||||
end
|
||||
end
|
||||
|
||||
def update
|
||||
invoke_callbacks(:update, :before)
|
||||
if @object.update(permitted_resource_params)
|
||||
invoke_callbacks(:update, :after)
|
||||
flash[:success] = flash_message_for(@object, :successfully_updated)
|
||||
respond_with(@object) do |format|
|
||||
format.html { redirect_to location_after_save }
|
||||
format.js { render layout: false }
|
||||
end
|
||||
else
|
||||
invoke_callbacks(:update, :fails)
|
||||
respond_with(@object)
|
||||
end
|
||||
end
|
||||
|
||||
def create
|
||||
invoke_callbacks(:create, :before)
|
||||
@object.attributes = permitted_resource_params
|
||||
if @object.save
|
||||
invoke_callbacks(:create, :after)
|
||||
flash[:success] = flash_message_for(@object, :successfully_created)
|
||||
respond_with(@object) do |format|
|
||||
format.html { redirect_to location_after_save }
|
||||
format.js { render layout: false }
|
||||
end
|
||||
else
|
||||
invoke_callbacks(:create, :fails)
|
||||
respond_with(@object)
|
||||
end
|
||||
end
|
||||
|
||||
def update_positions
|
||||
params[:positions].each do |id, index|
|
||||
model_class.where(id: id).update_all(position: index)
|
||||
end
|
||||
|
||||
respond_to do |format|
|
||||
format.js { render text: 'Ok' }
|
||||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
invoke_callbacks(:destroy, :before)
|
||||
if @object.destroy
|
||||
invoke_callbacks(:destroy, :after)
|
||||
flash[:success] = flash_message_for(@object, :successfully_removed)
|
||||
respond_with(@object) do |format|
|
||||
format.html { redirect_to collection_url }
|
||||
format.js { render partial: "spree/admin/shared/destroy" }
|
||||
end
|
||||
else
|
||||
invoke_callbacks(:destroy, :fails)
|
||||
respond_with(@object) do |format|
|
||||
format.html { redirect_to collection_url }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
def resource_not_found
|
||||
flash[:error] = flash_message_for(model_class.new, :not_found)
|
||||
redirect_to collection_url
|
||||
end
|
||||
|
||||
class << self
|
||||
attr_accessor :parent_data
|
||||
attr_accessor :callbacks
|
||||
|
||||
def belongs_to(model_name, options = {})
|
||||
@parent_data ||= {}
|
||||
@parent_data[:model_name] = model_name
|
||||
@parent_data[:model_class] = model_name.to_s.classify.constantize
|
||||
@parent_data[:find_by] = options[:find_by] || :id
|
||||
end
|
||||
|
||||
def new_action
|
||||
@callbacks ||= {}
|
||||
@callbacks[:new_action] ||= ActionCallbacks.new
|
||||
end
|
||||
|
||||
def create
|
||||
@callbacks ||= {}
|
||||
@callbacks[:create] ||= ActionCallbacks.new
|
||||
end
|
||||
|
||||
def update
|
||||
@callbacks ||= {}
|
||||
@callbacks[:update] ||= ActionCallbacks.new
|
||||
end
|
||||
|
||||
def destroy
|
||||
@callbacks ||= {}
|
||||
@callbacks[:destroy] ||= ActionCallbacks.new
|
||||
end
|
||||
end
|
||||
|
||||
def model_class
|
||||
controller_name.classify.to_s.constantize
|
||||
controller_class_name.constantize
|
||||
end
|
||||
|
||||
def model_name
|
||||
parent_data[:model_name].gsub('spree/', '')
|
||||
end
|
||||
|
||||
def object_name
|
||||
controller_name.singularize
|
||||
end
|
||||
|
||||
def load_resource
|
||||
if member_action?
|
||||
@object ||= load_resource_instance
|
||||
|
||||
# call authorize! a third time (called twice already in Admin::BaseController)
|
||||
# this time we pass the actual instance so fine-grained abilities can control
|
||||
# access to individual records, not just entire models.
|
||||
authorize! action, @object
|
||||
|
||||
instance_variable_set("@#{object_name}", @object)
|
||||
|
||||
# If we don't have access, clear the object
|
||||
unless can? action, @object
|
||||
instance_variable_set("@#{object_name}", nil)
|
||||
end
|
||||
|
||||
authorize! action, @object
|
||||
else
|
||||
@collection ||= collection
|
||||
|
||||
# note: we don't call authorize here as the collection method should use
|
||||
# CanCan's accessible_by method to restrict the actual records returned
|
||||
|
||||
instance_variable_set("@#{controller_name}", @collection)
|
||||
end
|
||||
end
|
||||
|
||||
def load_resource_instance
|
||||
if new_actions.include?(action)
|
||||
build_resource
|
||||
elsif params[:id]
|
||||
find_resource
|
||||
end
|
||||
end
|
||||
|
||||
def parent_data
|
||||
self.class.parent_data
|
||||
end
|
||||
|
||||
def parent
|
||||
return nil if parent_data.blank?
|
||||
|
||||
@parent ||= parent_data[:model_class].
|
||||
public_send("find_by", parent_data[:find_by] => params["#{model_name}_id"])
|
||||
instance_variable_set("@#{model_name}", @parent)
|
||||
end
|
||||
|
||||
def find_resource
|
||||
if parent_data.present?
|
||||
parent.public_send(controller_name).find(params[:id])
|
||||
else
|
||||
model_class.find(params[:id])
|
||||
end
|
||||
end
|
||||
|
||||
def build_resource
|
||||
if parent_data.present?
|
||||
parent.public_send(controller_name).build
|
||||
else
|
||||
model_class.new
|
||||
end
|
||||
end
|
||||
|
||||
def collection
|
||||
return parent.public_send(controller_name) if parent_data.present?
|
||||
|
||||
if model_class.respond_to?(:accessible_by) &&
|
||||
!current_ability.has_block?(params[:action], model_class)
|
||||
model_class.accessible_by(current_ability, action)
|
||||
else
|
||||
model_class.scoped
|
||||
end
|
||||
end
|
||||
|
||||
def location_after_save
|
||||
collection_url
|
||||
end
|
||||
|
||||
def invoke_callbacks(action, callback_type)
|
||||
callbacks = self.class.callbacks || {}
|
||||
return if callbacks[action].nil?
|
||||
|
||||
case callback_type.to_sym
|
||||
when :before then callbacks[action].before_methods.each { |method| __send__ method }
|
||||
when :after then callbacks[action].after_methods.each { |method| __send__ method }
|
||||
when :fails then callbacks[action].fails_methods.each { |method| __send__ method }
|
||||
end
|
||||
end
|
||||
|
||||
# URL helpers
|
||||
def new_object_url(options = {})
|
||||
if parent_data.present?
|
||||
main_app.new_polymorphic_url([:admin, parent, model_class], options)
|
||||
url_helper.new_polymorphic_url([:admin, parent, model_class], options)
|
||||
else
|
||||
main_app.new_polymorphic_url([:admin, model_class], options)
|
||||
url_helper.new_polymorphic_url([:admin, model_class], options)
|
||||
end
|
||||
end
|
||||
|
||||
def edit_object_url(object, options = {})
|
||||
if parent_data.present?
|
||||
main_app.public_send "edit_admin_#{model_name}_#{object_name}_url", parent, object, options
|
||||
url_helper.public_send "edit_admin_#{model_name}_#{object_name}_url",
|
||||
parent, object, options
|
||||
else
|
||||
main_app.public_send "edit_admin_#{object_name}_url", object, options
|
||||
url_helper.public_send "edit_admin_#{object_name}_url",
|
||||
object, options
|
||||
end
|
||||
end
|
||||
|
||||
def object_url(object = nil, options = {})
|
||||
target = object || @object
|
||||
if parent_data.present?
|
||||
main_app.public_send "admin_#{model_name}_#{object_name}_url", parent, target, options
|
||||
url_helper.public_send "admin_#{model_name}_#{object_name}_url", parent, target, options
|
||||
else
|
||||
main_app.public_send "admin_#{object_name}_url", target, options
|
||||
url_helper.public_send "admin_#{object_name}_url", target, options
|
||||
end
|
||||
end
|
||||
|
||||
# Permit specific list of params
|
||||
#
|
||||
# Example: params.require(object_name).permit(:name)
|
||||
def permitted_resource_params
|
||||
raise "All extending controllers need to override the method permitted_resource_params"
|
||||
end
|
||||
|
||||
def collection_url(options = {})
|
||||
if parent_data.present?
|
||||
main_app.polymorphic_url([:admin, parent, model_class], options)
|
||||
url_helper.polymorphic_url([:admin, parent, model_class], options)
|
||||
else
|
||||
main_app.polymorphic_url([:admin, model_class], options)
|
||||
url_helper.polymorphic_url([:admin, model_class], options)
|
||||
end
|
||||
end
|
||||
|
||||
def collection_actions
|
||||
[:index]
|
||||
end
|
||||
|
||||
def member_action?
|
||||
!collection_actions.include? action
|
||||
end
|
||||
|
||||
def new_actions
|
||||
[:new, :create]
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def controller_class_name
|
||||
if spree_controller?
|
||||
"Spree::#{controller_name.classify}"
|
||||
else
|
||||
controller_name.classify.to_s
|
||||
end
|
||||
end
|
||||
|
||||
def url_helper
|
||||
if spree_controller?
|
||||
spree
|
||||
else
|
||||
main_app
|
||||
end
|
||||
end
|
||||
|
||||
def spree_controller?
|
||||
controller_path.starts_with? "spree"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -2,7 +2,7 @@ require 'open_food_network/permissions'
|
||||
require 'order_management/subscriptions/proxy_order_syncer'
|
||||
|
||||
module Admin
|
||||
class SchedulesController < ResourceController
|
||||
class SchedulesController < Admin::ResourceController
|
||||
include PaperTrailLogging
|
||||
|
||||
before_action :adapt_params, only: [:update]
|
||||
|
||||
@@ -3,7 +3,7 @@ require 'open_food_network/order_cycle_permissions'
|
||||
require 'open_food_network/scope_variant_to_hub'
|
||||
|
||||
module Admin
|
||||
class SubscriptionLineItemsController < ResourceController
|
||||
class SubscriptionLineItemsController < Admin::ResourceController
|
||||
before_action :load_build_context, only: [:build]
|
||||
before_action :ensure_shop, only: [:build]
|
||||
before_action :ensure_variant, only: [:build]
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
require 'open_food_network/permissions'
|
||||
|
||||
module Admin
|
||||
class SubscriptionsController < ResourceController
|
||||
class SubscriptionsController < Admin::ResourceController
|
||||
before_action :load_shops, only: [:index]
|
||||
before_action :load_form_data, only: [:new, :edit]
|
||||
before_action :strip_banned_attrs, only: [:update]
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
module Admin
|
||||
class TagRulesController < ResourceController
|
||||
class TagRulesController < Admin::ResourceController
|
||||
respond_to :json
|
||||
|
||||
respond_override destroy: { json: {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
require 'open_food_network/spree_api_key_loader'
|
||||
|
||||
module Admin
|
||||
class VariantOverridesController < ResourceController
|
||||
class VariantOverridesController < Admin::ResourceController
|
||||
include OpenFoodNetwork::SpreeApiKeyLoader
|
||||
include EnterprisesHelper
|
||||
|
||||
|
||||
@@ -15,7 +15,6 @@ module Api
|
||||
|
||||
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 +33,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 +55,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
|
||||
|
||||
@@ -11,13 +11,25 @@ module Api
|
||||
@customer = Customer.find(params[:id])
|
||||
authorize! :update, @customer
|
||||
|
||||
client_secret = RecurringPayments.setup_for(@customer) if params[:customer][:allow_charges]
|
||||
|
||||
if @customer.update(customer_params)
|
||||
add_recurring_payment_info(client_secret)
|
||||
render json: @customer, serializer: CustomerSerializer, status: :ok
|
||||
else
|
||||
invalid_resource!(@customer)
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def add_recurring_payment_info(client_secret)
|
||||
return unless client_secret
|
||||
|
||||
@customer.gateway_recurring_payment_client_secret = client_secret
|
||||
@customer.gateway_shop_id = @customer.enterprise.stripe_account&.stripe_user_id
|
||||
end
|
||||
|
||||
def customer_params
|
||||
params.require(:customer).permit(:code, :email, :enterprise_id, :allow_charges)
|
||||
end
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -11,7 +11,8 @@ class CartController < BaseController
|
||||
Spree::Adjustment.without_callbacks do
|
||||
cart_service = CartService.new(order)
|
||||
|
||||
if cart_service.populate(params.slice(:products, :variants, :quantity), true)
|
||||
cart_service.populate(params.slice(:products, :variants, :quantity), true)
|
||||
if cart_service.valid?
|
||||
order.update_distribution_charge!
|
||||
order.cap_quantity_at_stock!
|
||||
order.update!
|
||||
@@ -22,7 +23,8 @@ class CartController < BaseController
|
||||
stock_levels: VariantsStockLevels.new.call(order, variant_ids) },
|
||||
status: :ok
|
||||
else
|
||||
render json: { error: true }, status: :precondition_failed
|
||||
render json: { error: cart_service.errors.full_messages.join(",") },
|
||||
status: :precondition_failed
|
||||
end
|
||||
end
|
||||
populate_variant_attributes
|
||||
|
||||
26
app/controllers/concerns/pagination_data.rb
Normal file
26
app/controllers/concerns/pagination_data.rb
Normal 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
|
||||
@@ -1,6 +1,6 @@
|
||||
module Spree
|
||||
module Admin
|
||||
class AdjustmentsController < ResourceController
|
||||
class AdjustmentsController < ::Admin::ResourceController
|
||||
belongs_to 'spree/order', find_by: :number
|
||||
destroy.after :reload_order
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
module Spree
|
||||
module Admin
|
||||
class CountriesController < ResourceController
|
||||
class CountriesController < ::Admin::ResourceController
|
||||
protected
|
||||
|
||||
def permitted_resource_params
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
module Spree
|
||||
module Admin
|
||||
class ImagesController < ResourceController
|
||||
class ImagesController < ::Admin::ResourceController
|
||||
# This will make resource controller redirect correctly after deleting product images.
|
||||
# This can be removed after upgrading to Spree 2.1.
|
||||
# See here https://github.com/spree/spree/commit/334a011d2b8e16355e4ae77ae07cd93f7cbc8fd1
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
module Spree
|
||||
module Admin
|
||||
class PaymentMethodsController < ResourceController
|
||||
class PaymentMethodsController < ::Admin::ResourceController
|
||||
skip_before_action :load_resource, only: [:create, :show_provider_preferences]
|
||||
before_action :load_data
|
||||
before_action :validate_payment_method_provider, only: [:create]
|
||||
@@ -51,7 +51,7 @@ module Spree
|
||||
end
|
||||
|
||||
# Only show payment methods that user has access to and sort by distributor name
|
||||
# ! Redundant code copied from Spree::Admin::ResourceController with modifications marked
|
||||
# ! Redundant code copied from Admin::ResourceController with modifications marked
|
||||
def collection
|
||||
return parent.public_send(controller_name) if parent_data.present?
|
||||
|
||||
|
||||
@@ -135,7 +135,9 @@ module Spree
|
||||
return unless @payment.payment_method.class == Spree::Gateway::StripeSCA
|
||||
|
||||
@payment.authorize!
|
||||
raise Spree::Core::GatewayError, I18n.t('authorization_failure') unless @payment.pending?
|
||||
return if @payment.pending? && @payment.cvv_response_message.nil?
|
||||
|
||||
raise Spree::Core::GatewayError, I18n.t('authorization_failure')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
module Spree
|
||||
module Admin
|
||||
class ProductPropertiesController < ResourceController
|
||||
class ProductPropertiesController < ::Admin::ResourceController
|
||||
belongs_to 'spree/product', find_by: :permalink
|
||||
before_action :find_properties
|
||||
before_action :setup_property, only: [:index]
|
||||
|
||||
@@ -4,7 +4,7 @@ require 'open_food_network/permissions'
|
||||
|
||||
module Spree
|
||||
module Admin
|
||||
class ProductsController < ResourceController
|
||||
class ProductsController < ::Admin::ResourceController
|
||||
helper 'spree/products'
|
||||
include OpenFoodNetwork::SpreeApiKeyLoader
|
||||
include OrderCyclesHelper
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
module Spree
|
||||
module Admin
|
||||
class PropertiesController < ResourceController
|
||||
class PropertiesController < ::Admin::ResourceController
|
||||
def permitted_resource_params
|
||||
params.require(:property).permit(:name, :presentation)
|
||||
end
|
||||
|
||||
@@ -1,282 +0,0 @@
|
||||
require 'action_callbacks'
|
||||
|
||||
module Spree
|
||||
module Admin
|
||||
class ResourceController < Spree::Admin::BaseController
|
||||
helper_method :new_object_url, :edit_object_url, :object_url, :collection_url
|
||||
before_action :load_resource, except: [:update_positions]
|
||||
rescue_from ActiveRecord::RecordNotFound, with: :resource_not_found
|
||||
rescue_from CanCan::AccessDenied, with: :unauthorized
|
||||
|
||||
respond_to :html
|
||||
respond_to :js, except: [:show, :index]
|
||||
|
||||
def new
|
||||
invoke_callbacks(:new_action, :before)
|
||||
respond_with(@object) do |format|
|
||||
format.html { render layout: !request.xhr? }
|
||||
format.js { render layout: false }
|
||||
end
|
||||
end
|
||||
|
||||
def edit
|
||||
respond_with(@object) do |format|
|
||||
format.html { render layout: !request.xhr? }
|
||||
format.js { render layout: false }
|
||||
end
|
||||
end
|
||||
|
||||
def update
|
||||
invoke_callbacks(:update, :before)
|
||||
if @object.update(permitted_resource_params)
|
||||
invoke_callbacks(:update, :after)
|
||||
flash[:success] = flash_message_for(@object, :successfully_updated)
|
||||
respond_with(@object) do |format|
|
||||
format.html { redirect_to location_after_save }
|
||||
format.js { render layout: false }
|
||||
end
|
||||
else
|
||||
invoke_callbacks(:update, :fails)
|
||||
respond_with(@object)
|
||||
end
|
||||
end
|
||||
|
||||
def create
|
||||
invoke_callbacks(:create, :before)
|
||||
@object.attributes = permitted_resource_params
|
||||
if @object.save
|
||||
invoke_callbacks(:create, :after)
|
||||
flash[:success] = flash_message_for(@object, :successfully_created)
|
||||
respond_with(@object) do |format|
|
||||
format.html { redirect_to location_after_save }
|
||||
format.js { render layout: false }
|
||||
end
|
||||
else
|
||||
invoke_callbacks(:create, :fails)
|
||||
respond_with(@object)
|
||||
end
|
||||
end
|
||||
|
||||
def update_positions
|
||||
params[:positions].each do |id, index|
|
||||
model_class.where(id: id).update_all(position: index)
|
||||
end
|
||||
|
||||
respond_to do |format|
|
||||
format.js { render text: 'Ok' }
|
||||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
invoke_callbacks(:destroy, :before)
|
||||
if @object.destroy
|
||||
invoke_callbacks(:destroy, :after)
|
||||
flash[:success] = flash_message_for(@object, :successfully_removed)
|
||||
respond_with(@object) do |format|
|
||||
format.html { redirect_to collection_url }
|
||||
format.js { render partial: "spree/admin/shared/destroy" }
|
||||
end
|
||||
else
|
||||
invoke_callbacks(:destroy, :fails)
|
||||
respond_with(@object) do |format|
|
||||
format.html { redirect_to collection_url }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
def resource_not_found
|
||||
flash[:error] = flash_message_for(model_class.new, :not_found)
|
||||
redirect_to collection_url
|
||||
end
|
||||
|
||||
class << self
|
||||
attr_accessor :parent_data
|
||||
attr_accessor :callbacks
|
||||
|
||||
def belongs_to(model_name, options = {})
|
||||
@parent_data ||= {}
|
||||
@parent_data[:model_name] = model_name
|
||||
@parent_data[:model_class] = model_name.to_s.classify.constantize
|
||||
@parent_data[:find_by] = options[:find_by] || :id
|
||||
end
|
||||
|
||||
def new_action
|
||||
@callbacks ||= {}
|
||||
@callbacks[:new_action] ||= ActionCallbacks.new
|
||||
end
|
||||
|
||||
def create
|
||||
@callbacks ||= {}
|
||||
@callbacks[:create] ||= ActionCallbacks.new
|
||||
end
|
||||
|
||||
def update
|
||||
@callbacks ||= {}
|
||||
@callbacks[:update] ||= ActionCallbacks.new
|
||||
end
|
||||
|
||||
def destroy
|
||||
@callbacks ||= {}
|
||||
@callbacks[:destroy] ||= ActionCallbacks.new
|
||||
end
|
||||
end
|
||||
|
||||
def model_class
|
||||
"Spree::#{controller_name.classify}".constantize
|
||||
end
|
||||
|
||||
def model_name
|
||||
parent_data[:model_name].gsub('spree/', '')
|
||||
end
|
||||
|
||||
def object_name
|
||||
controller_name.singularize
|
||||
end
|
||||
|
||||
def load_resource
|
||||
if member_action?
|
||||
@object ||= load_resource_instance
|
||||
|
||||
# call authorize! a third time (called twice already in Admin::BaseController)
|
||||
# this time we pass the actual instance so fine-grained abilities can control
|
||||
# access to individual records, not just entire models.
|
||||
authorize! action, @object
|
||||
|
||||
instance_variable_set("@#{object_name}", @object)
|
||||
|
||||
# If we don't have access, clear the object
|
||||
unless can? action, @object
|
||||
instance_variable_set("@#{object_name}", nil)
|
||||
end
|
||||
|
||||
authorize! action, @object
|
||||
else
|
||||
@collection ||= collection
|
||||
|
||||
# note: we don't call authorize here as the collection method should use
|
||||
# CanCan's accessible_by method to restrict the actual records returned
|
||||
|
||||
instance_variable_set("@#{controller_name}", @collection)
|
||||
end
|
||||
end
|
||||
|
||||
def load_resource_instance
|
||||
if new_actions.include?(action)
|
||||
build_resource
|
||||
elsif params[:id]
|
||||
find_resource
|
||||
end
|
||||
end
|
||||
|
||||
def parent_data
|
||||
self.class.parent_data
|
||||
end
|
||||
|
||||
def parent
|
||||
return nil if parent_data.blank?
|
||||
|
||||
@parent ||= parent_data[:model_class].
|
||||
public_send("find_by", parent_data[:find_by] => params["#{model_name}_id"])
|
||||
instance_variable_set("@#{model_name}", @parent)
|
||||
end
|
||||
|
||||
def find_resource
|
||||
if parent_data.present?
|
||||
parent.public_send(controller_name).find(params[:id])
|
||||
else
|
||||
model_class.find(params[:id])
|
||||
end
|
||||
end
|
||||
|
||||
def build_resource
|
||||
if parent_data.present?
|
||||
parent.public_send(controller_name).build
|
||||
else
|
||||
model_class.new
|
||||
end
|
||||
end
|
||||
|
||||
def collection
|
||||
return parent.public_send(controller_name) if parent_data.present?
|
||||
|
||||
if model_class.respond_to?(:accessible_by) &&
|
||||
!current_ability.has_block?(params[:action], model_class)
|
||||
model_class.accessible_by(current_ability, action)
|
||||
else
|
||||
model_class.scoped
|
||||
end
|
||||
end
|
||||
|
||||
def location_after_save
|
||||
collection_url
|
||||
end
|
||||
|
||||
def invoke_callbacks(action, callback_type)
|
||||
callbacks = self.class.callbacks || {}
|
||||
return if callbacks[action].nil?
|
||||
|
||||
case callback_type.to_sym
|
||||
when :before then callbacks[action].before_methods.each { |method| __send__ method }
|
||||
when :after then callbacks[action].after_methods.each { |method| __send__ method }
|
||||
when :fails then callbacks[action].fails_methods.each { |method| __send__ method }
|
||||
end
|
||||
end
|
||||
|
||||
# URL helpers
|
||||
|
||||
def new_object_url(options = {})
|
||||
if parent_data.present?
|
||||
spree.new_polymorphic_url([:admin, parent, model_class], options)
|
||||
else
|
||||
spree.new_polymorphic_url([:admin, model_class], options)
|
||||
end
|
||||
end
|
||||
|
||||
def edit_object_url(object, options = {})
|
||||
if parent_data.present?
|
||||
spree.public_send "edit_admin_#{model_name}_#{object_name}_url", parent, object, options
|
||||
else
|
||||
spree.public_send "edit_admin_#{object_name}_url", object, options
|
||||
end
|
||||
end
|
||||
|
||||
def object_url(object = nil, options = {})
|
||||
target = object || @object
|
||||
if parent_data.present?
|
||||
spree.public_send "admin_#{model_name}_#{object_name}_url", parent, target, options
|
||||
else
|
||||
spree.public_send "admin_#{object_name}_url", target, options
|
||||
end
|
||||
end
|
||||
|
||||
# Permit specific list of params
|
||||
#
|
||||
# Example: params.require(object_name).permit(:name)
|
||||
def permitted_resource_params
|
||||
raise "All extending controllers need to override the method permitted_resource_params"
|
||||
end
|
||||
|
||||
def collection_url(options = {})
|
||||
if parent_data.present?
|
||||
spree.polymorphic_url([:admin, parent, model_class], options)
|
||||
else
|
||||
spree.polymorphic_url([:admin, model_class], options)
|
||||
end
|
||||
end
|
||||
|
||||
def collection_actions
|
||||
[:index]
|
||||
end
|
||||
|
||||
def member_action?
|
||||
!collection_actions.include? action
|
||||
end
|
||||
|
||||
def new_actions
|
||||
[:new, :create]
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -1,6 +1,6 @@
|
||||
module Spree
|
||||
module Admin
|
||||
class ReturnAuthorizationsController < ResourceController
|
||||
class ReturnAuthorizationsController < ::Admin::ResourceController
|
||||
belongs_to 'spree/order', find_by: :number
|
||||
|
||||
update.after :associate_inventory_units
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
module Spree
|
||||
module Admin
|
||||
class ShippingCategoriesController < ResourceController
|
||||
class ShippingCategoriesController < ::Admin::ResourceController
|
||||
protected
|
||||
|
||||
def permitted_resource_params
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
module Spree
|
||||
module Admin
|
||||
class ShippingMethodsController < ResourceController
|
||||
class ShippingMethodsController < ::Admin::ResourceController
|
||||
before_action :load_data, except: [:index]
|
||||
before_action :set_shipping_category, only: [:create, :update]
|
||||
before_action :set_zones, only: [:create, :update]
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
module Spree
|
||||
module Admin
|
||||
class StatesController < ResourceController
|
||||
class StatesController < ::Admin::ResourceController
|
||||
belongs_to 'spree/country'
|
||||
before_action :load_data
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
module Spree
|
||||
module Admin
|
||||
class TaxCategoriesController < ResourceController
|
||||
class TaxCategoriesController < ::Admin::ResourceController
|
||||
def destroy
|
||||
if @object.destroy
|
||||
flash[:success] = flash_message_for(@object, :successfully_removed)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
module Spree
|
||||
module Admin
|
||||
class TaxRatesController < ResourceController
|
||||
class TaxRatesController < ::Admin::ResourceController
|
||||
before_action :load_data
|
||||
|
||||
private
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
module Spree
|
||||
module Admin
|
||||
class TaxonomiesController < ResourceController
|
||||
class TaxonomiesController < ::Admin::ResourceController
|
||||
respond_to :json, only: [:get_children]
|
||||
|
||||
def get_children
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
module Spree
|
||||
module Admin
|
||||
class UsersController < ResourceController
|
||||
class UsersController < ::Admin::ResourceController
|
||||
rescue_from Spree::User::DestroyWithOrdersError, with: :user_destroy_with_orders_error
|
||||
|
||||
after_action :sign_in_if_change_own_password, only: :update
|
||||
@@ -100,7 +100,7 @@ module Spree
|
||||
|
||||
private
|
||||
|
||||
# handling raise from Spree::Admin::ResourceController#destroy
|
||||
# handling raise from Admin::ResourceController#destroy
|
||||
def user_destroy_with_orders_error
|
||||
invoke_callbacks(:destroy, :fails)
|
||||
render status: :forbidden, text: Spree.t(:error_user_destroy_with_orders)
|
||||
|
||||
@@ -2,7 +2,7 @@ require 'open_food_network/scope_variants_for_search'
|
||||
|
||||
module Spree
|
||||
module Admin
|
||||
class VariantsController < ResourceController
|
||||
class VariantsController < ::Admin::ResourceController
|
||||
helper 'spree/products'
|
||||
|
||||
belongs_to 'spree/product', find_by: :permalink
|
||||
@@ -23,7 +23,9 @@ module Spree
|
||||
flash[:success] = flash_message_for(@object, :successfully_updated)
|
||||
redirect_to spree.admin_product_variants_url(params[:product_id], @url_filters)
|
||||
else
|
||||
redirect_to spree.edit_admin_product_variant_url(params[:product_id], @object, @url_filters)
|
||||
redirect_to spree.edit_admin_product_variant_url(params[:product_id],
|
||||
@object,
|
||||
@url_filters)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
module Spree
|
||||
module Admin
|
||||
class ZonesController < ResourceController
|
||||
class ZonesController < ::Admin::ResourceController
|
||||
before_action :load_data, except: [:index]
|
||||
|
||||
def new
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'stripe/credit_card_remover'
|
||||
|
||||
module Spree
|
||||
class CreditCardsController < BaseController
|
||||
def new_from_token
|
||||
@@ -27,6 +31,7 @@ module Spree
|
||||
authorize! :update, @credit_card
|
||||
|
||||
if @credit_card.update(credit_card_params)
|
||||
remove_shop_authorizations if credit_card_params["is_default"]
|
||||
render json: @credit_card, serializer: ::Api::CreditCardSerializer, status: :ok
|
||||
else
|
||||
update_failed
|
||||
@@ -39,11 +44,12 @@ module Spree
|
||||
@credit_card = Spree::CreditCard.find_by(id: params[:id])
|
||||
if @credit_card
|
||||
authorize! :destroy, @credit_card
|
||||
destroy_at_stripe
|
||||
Stripe::CreditCardRemover.new(@credit_card).call
|
||||
end
|
||||
|
||||
# Using try because we may not have a card here
|
||||
if @credit_card.try(:destroy)
|
||||
remove_shop_authorizations if @credit_card.is_default
|
||||
flash[:success] = I18n.t(:card_has_been_removed, number: "x-#{@credit_card.last_digits}")
|
||||
else
|
||||
flash[:error] = I18n.t(:card_could_not_be_removed)
|
||||
@@ -56,18 +62,8 @@ module Spree
|
||||
|
||||
private
|
||||
|
||||
# It destroys the whole customer object
|
||||
def destroy_at_stripe
|
||||
stripe_customer = Stripe::Customer.retrieve(@credit_card.gateway_customer_profile_id, {})
|
||||
|
||||
stripe_customer&.delete
|
||||
end
|
||||
|
||||
def stripe_account_id
|
||||
StripeAccount.
|
||||
find_by(enterprise_id: @credit_card.payment_method.preferred_enterprise_id).
|
||||
andand.
|
||||
stripe_user_id
|
||||
def remove_shop_authorizations
|
||||
@credit_card.user.customers.update_all(allow_charges: false)
|
||||
end
|
||||
|
||||
def create_customer(token)
|
||||
|
||||
@@ -18,26 +18,6 @@ module Spree
|
||||
before_action :check_permissions, only: [:edit, :update]
|
||||
skip_before_action :require_no_authentication
|
||||
|
||||
# GET /resource/sign_up
|
||||
def new
|
||||
super
|
||||
@user = resource
|
||||
end
|
||||
|
||||
# POST /resource/sign_up
|
||||
def create
|
||||
@user = build_resource(params[:spree_user])
|
||||
if resource.save
|
||||
set_flash_message(:notice, :signed_up)
|
||||
sign_in(:spree_user, @user)
|
||||
associate_user
|
||||
respond_with resource, location: after_sign_up_path_for(resource)
|
||||
else
|
||||
clean_up_passwords(resource)
|
||||
render :new
|
||||
end
|
||||
end
|
||||
|
||||
# GET /resource/edit
|
||||
def edit
|
||||
super
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
module ApplicationHelper
|
||||
def feature?(feature)
|
||||
OpenFoodNetwork::FeatureToggle.enabled? feature
|
||||
def feature?(feature, user = nil)
|
||||
OpenFoodNetwork::FeatureToggle.enabled?(feature, user)
|
||||
end
|
||||
|
||||
def ng_form_for(name, *args, &block)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
require 'spree/money_decorator'
|
||||
require 'spree/money'
|
||||
|
||||
module Spree
|
||||
module ReportsHelper
|
||||
|
||||
@@ -62,7 +62,7 @@ class SubscriptionConfirmJob
|
||||
return unless order.payment_required?
|
||||
|
||||
prepare_for_payment!(order)
|
||||
order.process_payments!
|
||||
order.process_payments_offline!
|
||||
raise if order.errors.any?
|
||||
end
|
||||
|
||||
|
||||
@@ -25,6 +25,9 @@ class Customer < ActiveRecord::Base
|
||||
|
||||
before_create :associate_user
|
||||
|
||||
attr_accessor :gateway_recurring_payment_client_secret
|
||||
attr_accessor :gateway_shop_id
|
||||
|
||||
private
|
||||
|
||||
def downcase_email
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'open_food_network/locking'
|
||||
require 'open_food_network/permalink_generator'
|
||||
require 'spree/core/s3_support'
|
||||
@@ -66,10 +68,10 @@ class EnterpriseGroup < ActiveRecord::Base
|
||||
def unset_undefined_address_fields
|
||||
return if address.blank?
|
||||
|
||||
address.phone.sub!(/^#{I18n.t(:undefined)}$/, '')
|
||||
address.address1.sub!(/^#{I18n.t(:undefined)}$/, '')
|
||||
address.city.sub!(/^#{I18n.t(:undefined)}$/, '')
|
||||
address.zipcode.sub!(/^#{I18n.t(:undefined)}$/, '')
|
||||
address.phone = address.phone.sub(/^#{I18n.t(:undefined)}$/, '')
|
||||
address.address1 = address.address1.sub(/^#{I18n.t(:undefined)}$/, '')
|
||||
address.city = address.city.sub(/^#{I18n.t(:undefined)}$/, '')
|
||||
address.zipcode = address.zipcode.sub(/^#{I18n.t(:undefined)}$/, '')
|
||||
end
|
||||
|
||||
def to_param
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -31,6 +31,10 @@ module Spree
|
||||
failed_activemerchant_billing_response(e.message)
|
||||
end
|
||||
|
||||
def charge_offline(money, creditcard, gateway_options)
|
||||
purchase(money, creditcard, gateway_options)
|
||||
end
|
||||
|
||||
# NOTE: the name of this method is determined by Spree::Payment::Processing
|
||||
def void(response_code, _creditcard, gateway_options)
|
||||
gateway_options[:stripe_account] = stripe_account_id
|
||||
|
||||
@@ -45,11 +45,21 @@ module Spree
|
||||
failed_activemerchant_billing_response(e.message)
|
||||
end
|
||||
|
||||
# NOTE: the name of this method is determined by Spree::Payment::Processing
|
||||
def charge_offline(money, creditcard, gateway_options)
|
||||
customer, payment_method =
|
||||
Stripe::CreditCardCloner.new(creditcard, stripe_account_id).find_or_clone
|
||||
|
||||
options = basic_options(gateway_options).merge(customer: customer, off_session: true)
|
||||
provider.purchase(money, payment_method, options)
|
||||
rescue Stripe::StripeError => e
|
||||
failed_activemerchant_billing_response(e.message)
|
||||
end
|
||||
|
||||
# NOTE: the name of this method is determined by Spree::Payment::Processing
|
||||
def authorize(money, creditcard, gateway_options)
|
||||
authorize_response = provider.authorize(*options_for_authorize(money,
|
||||
creditcard,
|
||||
gateway_options))
|
||||
authorize_response =
|
||||
provider.authorize(*options_for_authorize(money, creditcard, gateway_options))
|
||||
Stripe::AuthorizeResponsePatcher.new(authorize_response).call!
|
||||
rescue Stripe::StripeError => e
|
||||
failed_activemerchant_billing_response(e.message)
|
||||
@@ -61,7 +71,7 @@ module Spree
|
||||
payment_intent_response = Stripe::PaymentIntent.retrieve(payment_intent_id,
|
||||
stripe_account: stripe_account_id)
|
||||
gateway_options[:stripe_account] = stripe_account_id
|
||||
provider.refund(payment_intent_response.amount_received, response_code, gateway_options)
|
||||
provider.refund(refundable_amount(payment_intent_response), response_code, gateway_options)
|
||||
end
|
||||
|
||||
# NOTE: the name of this method is determined by Spree::Payment::Processing
|
||||
@@ -79,6 +89,11 @@ module Spree
|
||||
|
||||
private
|
||||
|
||||
def refundable_amount(payment_intent_response)
|
||||
payment_intent_response.amount_received -
|
||||
payment_intent_response.charges.data.map(&:amount_refunded).sum
|
||||
end
|
||||
|
||||
# In this gateway, what we call 'secret_key' is the 'login'
|
||||
def options
|
||||
options = super
|
||||
@@ -97,8 +112,8 @@ module Spree
|
||||
options = basic_options(gateway_options)
|
||||
options[:return_url] = full_checkout_path
|
||||
|
||||
customer_id, payment_method_id = Stripe::CreditCardCloner.new.clone(creditcard,
|
||||
stripe_account_id)
|
||||
customer_id, payment_method_id =
|
||||
Stripe::CreditCardCloner.new(creditcard, stripe_account_id).find_or_clone
|
||||
options[:customer] = customer_id
|
||||
[money, payment_method_id, options]
|
||||
end
|
||||
|
||||
@@ -34,14 +34,24 @@ module Spree
|
||||
end
|
||||
|
||||
def find_dimensions
|
||||
temporary = attachment.queued_for_write[:original]
|
||||
filename = temporary.path unless temporary.nil?
|
||||
filename = attachment.path if filename.blank?
|
||||
geometry = Paperclip::Geometry.from_file(filename)
|
||||
return if attachment.errors.present?
|
||||
|
||||
geometry = Paperclip::Geometry.from_file(local_filename_of_original)
|
||||
|
||||
self.attachment_width = geometry.width
|
||||
self.attachment_height = geometry.height
|
||||
end
|
||||
|
||||
def local_filename_of_original
|
||||
temporary = attachment.queued_for_write[:original]
|
||||
|
||||
if temporary&.path.present?
|
||||
temporary.path
|
||||
else
|
||||
attachment.path
|
||||
end
|
||||
end
|
||||
|
||||
# if there are errors from the plugin, then add a more meaningful message
|
||||
def no_attachment_errors
|
||||
return if attachment.errors.empty?
|
||||
|
||||
@@ -500,22 +500,19 @@ module Spree
|
||||
# :allow_checkout_on_gateway_error is set to false
|
||||
#
|
||||
def process_payments!
|
||||
raise Core::GatewayError, Spree.t(:no_pending_payments) if pending_payments.empty?
|
||||
|
||||
pending_payments.each do |payment|
|
||||
break if payment_total >= total
|
||||
|
||||
payment.process!
|
||||
|
||||
if payment.completed?
|
||||
self.payment_total += payment.amount
|
||||
end
|
||||
end
|
||||
process_each_payment(&:process!)
|
||||
rescue Core::GatewayError => e
|
||||
result = !!Spree::Config[:allow_checkout_on_gateway_error]
|
||||
errors.add(:base, e.message) && (return result)
|
||||
end
|
||||
|
||||
def process_payments_offline!
|
||||
process_each_payment(&:process_offline!)
|
||||
rescue Core::GatewayError => e
|
||||
errors.add(:base, e.message)
|
||||
false
|
||||
end
|
||||
|
||||
def billing_firstname
|
||||
bill_address.try(:firstname)
|
||||
end
|
||||
@@ -778,6 +775,20 @@ module Spree
|
||||
|
||||
private
|
||||
|
||||
def process_each_payment
|
||||
raise Core::GatewayError, Spree.t(:no_pending_payments) if pending_payments.empty?
|
||||
|
||||
pending_payments.each do |payment|
|
||||
break if payment_total >= total
|
||||
|
||||
yield payment
|
||||
|
||||
if payment.completed?
|
||||
self.payment_total += payment.amount
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def link_by_email
|
||||
self.email = user.email if user
|
||||
end
|
||||
|
||||
@@ -4,16 +4,7 @@ module Spree
|
||||
class Payment < ActiveRecord::Base
|
||||
module Processing
|
||||
def process!
|
||||
return unless payment_method&.source_required?
|
||||
|
||||
raise Core::GatewayError, Spree.t(:payment_processing_failed) unless source
|
||||
|
||||
return if processing?
|
||||
|
||||
unless payment_method.supports?(source)
|
||||
invalidate!
|
||||
raise Core::GatewayError, Spree.t(:payment_method_not_supported)
|
||||
end
|
||||
return unless validate!
|
||||
|
||||
if payment_method.auto_capture?
|
||||
purchase!
|
||||
@@ -22,6 +13,16 @@ module Spree
|
||||
end
|
||||
end
|
||||
|
||||
def process_offline!
|
||||
return unless validate!
|
||||
|
||||
if payment_method.auto_capture?
|
||||
charge_offline!
|
||||
else
|
||||
authorize!
|
||||
end
|
||||
end
|
||||
|
||||
def authorize!
|
||||
started_processing!
|
||||
gateway_action(source, :authorize, :pend)
|
||||
@@ -32,6 +33,11 @@ module Spree
|
||||
gateway_action(source, :purchase, :complete)
|
||||
end
|
||||
|
||||
def charge_offline!
|
||||
started_processing!
|
||||
gateway_action(source, :charge_offline, :complete)
|
||||
end
|
||||
|
||||
def capture!
|
||||
return true if completed?
|
||||
|
||||
@@ -193,6 +199,20 @@ module Spree
|
||||
|
||||
private
|
||||
|
||||
def validate!
|
||||
return false unless payment_method&.source_required?
|
||||
|
||||
raise Core::GatewayError, Spree.t(:payment_processing_failed) unless source
|
||||
|
||||
return false if processing?
|
||||
|
||||
unless payment_method.supports?(source)
|
||||
invalidate!
|
||||
raise Core::GatewayError, Spree.t(:payment_method_not_supported)
|
||||
end
|
||||
true
|
||||
end
|
||||
|
||||
def calculate_refund_amount(refund_amount = nil)
|
||||
refund_amount ||= if credit_allowed >= order.outstanding_balance.abs
|
||||
order.outstanding_balance.abs
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# frozen_string_literal: true
|
||||
# frozen_string_literal: false
|
||||
|
||||
module Spree
|
||||
class Price < ActiveRecord::Base
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
module Spree
|
||||
class User < ActiveRecord::Base
|
||||
devise :database_authenticatable, :token_authenticatable, :registerable, :recoverable,
|
||||
:rememberable, :trackable, :validatable, :encryptable, encryptor: 'authlogic_sha512'
|
||||
:rememberable, :trackable, :validatable,
|
||||
:encryptable, :confirmable, encryptor: 'authlogic_sha512', reconfirmable: true
|
||||
|
||||
has_many :orders
|
||||
belongs_to :ship_address, foreign_key: 'ship_address_id', class_name: 'Spree::Address'
|
||||
@@ -39,9 +40,6 @@ module Spree
|
||||
|
||||
validate :limit_owned_enterprises
|
||||
|
||||
# We use the same options as Spree and add :confirmable
|
||||
devise :confirmable, reconfirmable: true
|
||||
|
||||
class DestroyWithOrdersError < StandardError; end
|
||||
|
||||
def self.admin_created?
|
||||
|
||||
@@ -1,5 +1,14 @@
|
||||
module Api
|
||||
class CustomerSerializer < ActiveModel::Serializer
|
||||
attributes :id, :enterprise_id, :name, :code, :email, :allow_charges
|
||||
|
||||
def attributes
|
||||
hash = super
|
||||
if secret = object.gateway_recurring_payment_client_secret
|
||||
hash.merge!(gateway_recurring_payment_client_secret: secret)
|
||||
end
|
||||
hash.merge!(gateway_shop_id: object.gateway_shop_id) if object.gateway_shop_id
|
||||
hash
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -22,6 +22,10 @@ class CartService
|
||||
valid?
|
||||
end
|
||||
|
||||
def valid?
|
||||
errors.empty?
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def attempt_cart_add_variants(variants_data)
|
||||
@@ -109,10 +113,6 @@ class CartService
|
||||
end
|
||||
end
|
||||
|
||||
def valid?
|
||||
errors.empty?
|
||||
end
|
||||
|
||||
def cart_remove(variant_id)
|
||||
variant = Spree::Variant.find(variant_id)
|
||||
@order.remove_variant(variant)
|
||||
@@ -145,7 +145,7 @@ class CartService
|
||||
|
||||
def check_order_cycle_provided
|
||||
order_cycle_provided = @order_cycle.present?
|
||||
errors.add(:base, "Please choose an order cycle for this order.") unless order_cycle_provided
|
||||
errors.add(:base, I18n.t(:spree_order_cycle_error)) unless order_cycle_provided
|
||||
order_cycle_provided
|
||||
end
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
16
app/services/recurring_payments.rb
Normal file
16
app/services/recurring_payments.rb
Normal file
@@ -0,0 +1,16 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class RecurringPayments
|
||||
def self.setup_for(customer)
|
||||
return unless card = customer.user.default_card
|
||||
return unless stripe_account = customer.enterprise.stripe_account&.stripe_user_id
|
||||
|
||||
customer_id, payment_method_id =
|
||||
Stripe::CreditCardCloner.new(card, stripe_account).find_or_clone
|
||||
setup_intent = Stripe::SetupIntent.create(
|
||||
{ payment_method: payment_method_id, customer: customer_id },
|
||||
stripe_account: stripe_account
|
||||
)
|
||||
setup_intent.client_secret
|
||||
end
|
||||
end
|
||||
@@ -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
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
%div{"ng-controller" => "OrderCycleChangeCtrl", "ng-cloak" => true}
|
||||
%closing
|
||||
%div{"ng-if" => "OrderCycle.selected()"}
|
||||
= t :enterprises_next_closing
|
||||
%strong {{ OrderCycle.orders_close_at() | date_in_words }}
|
||||
%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
|
||||
|
||||
|
||||
@@ -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/
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
%table
|
||||
%tr
|
||||
%td{ colspan: 2 }
|
||||
= t('spree.users.cards.authorised_shops_agreement')
|
||||
%tr
|
||||
%th= t(".shop_name")
|
||||
%th= t(".allow_charges?")
|
||||
|
||||
@@ -18,9 +18,7 @@
|
||||
.new_card{ ng: { show: 'CreditCard.visible', class: '{visible: CreditCard.visible}' } }
|
||||
%h3= t(:add_new_credit_card)
|
||||
= render 'new_card_form'
|
||||
.authorised_shops{ ng: { controller: 'AuthorisedShopsCtrl', hide: 'CreditCard.visible' } }
|
||||
.authorised_shops{ ng: { controller: 'AuthorisedShopsCtrl', hide: 'CreditCard.visible || savedCreditCards.length == 0' } }
|
||||
%h3
|
||||
= t('.authorised_shops')
|
||||
%button.button.secondary.tiny.help-btn.ng-scope{ "help-modal" => t('.authorised_shops_popover') }
|
||||
%i.ofn-i_013-help
|
||||
= render 'authorised_shops'
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
%td.number{ ng: { bind: '::card.number' } }
|
||||
%td.expiry{ ng: { bind: '::card.expiry' } }
|
||||
%td.is-default
|
||||
%input{ type: 'radio', name: 'default_card', ng: { model: 'card.is_default', change: 'setDefault(card)', value: "true"} }
|
||||
%input{ type: 'radio', name: 'default_card', ng: { model: 'card.is_default', click: 'confirmSetDefault(card, $event)', value: "true"} }
|
||||
%td.actions
|
||||
%a{"rel" => "nofollow", "data-method" => "delete", "ng-href" => "{{card.delete_link}}" }
|
||||
= t(:delete)
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
- if Stripe.publishable_key
|
||||
:javascript
|
||||
angular.module('Darkswarm').value("stripeObject", Stripe("#{Stripe.publishable_key}"))
|
||||
angular.module('Darkswarm').value("stripePublishableKey", "#{Stripe.publishable_key}")
|
||||
|
||||
.darkswarm
|
||||
.row.pad-top
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# This file is used by Rack-based servers to start the application.
|
||||
|
||||
if ENV.fetch('KILL_UNICORNS', false) && ['production', 'staging'].include?(ENV['RAILS_ENV'])
|
||||
|
||||
@@ -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'
|
||||
|
||||
5
config/initializers/feature_toggles.rb
Normal file
5
config/initializers/feature_toggles.rb
Normal 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)
|
||||
@@ -1568,6 +1568,7 @@ ar:
|
||||
shopping_groups_part_of: "جزء من:"
|
||||
shopping_producers_of_hub: "منتجو %{hub}:"
|
||||
enterprises_next_closing: "إغلاق الطلب التالي"
|
||||
enterprises_currently_open: "الطلبات متاحة حاليا"
|
||||
enterprises_ready_for: "جاهز ل"
|
||||
enterprises_choose: "اختر عندما تريد طلبك:"
|
||||
maps_open: "افتح"
|
||||
@@ -2081,6 +2082,7 @@ ar:
|
||||
spree_classification_primary_taxon_error: "Taxon %{taxon} هو التصنيف الأساسي %{product} ولا يمكن حذفه"
|
||||
spree_order_availability_error: "لا يمكن لموزع أو دورة طلب توفير المنتجات في سلة التسوق"
|
||||
spree_order_populator_error: "لا يمكن لهذا الموزع أو دورة الطلب توفير جميع المنتجات في سلة التسوق. الرجاء اختيار آخر."
|
||||
spree_order_cycle_error: "الرجاء اختيار دورة الطلب لهذا الطلب."
|
||||
spree_order_populator_availability_error: "هذا المنتج غير متوفر من الموزع المختار أو دورة الطلب."
|
||||
spree_distributors_error: "يجب تحديد مركز واحد على الأقل"
|
||||
spree_user_enterprise_limit_error: "^ %{email} غير مسموح به لامتلاك أي مؤسسات أخرى (الحد الأقصى هو %{enterprise_limit})."
|
||||
@@ -2386,6 +2388,7 @@ ar:
|
||||
resolve_errors: يرجى حل الأخطاء التالية
|
||||
more_items: "+ %{count} ايضا"
|
||||
default_card_updated: تم تحديث البطاقة الافتراضية
|
||||
default_card_voids_auth: سيؤدي تغيير بطاقتك الافتراضية إلى إزالة تفويضات المتاجر الحالية لشحنها. يمكنك إعادة تفويض المحلات التجارية بعد تحديث البطاقة الافتراضية. هل ترغب في تغيير البطاقة الافتراضية؟"
|
||||
cart:
|
||||
add_to_cart_failed: >
|
||||
حدثت مشكلة أثناء إضافة هذا المنتج إلى عربة التسوق. ربما أصبح غير متوفر أو
|
||||
@@ -3622,11 +3625,11 @@ ar:
|
||||
delete?: حذف؟
|
||||
cards:
|
||||
authorised_shops: المتاجر المعتمدة
|
||||
authorised_shops_popover: هذه هي قائمة المتاجر التي يُسمح لها باستحقاق الدفع عن طريق بطاقتك الائتمانية الافتراضية عن أي اشتراكات (على سبيل المثال ، الطلبات المتكررة) التي قد قمت بعملها. سيتم الاحتفاظ بتفاصيل بطاقتك بأمان ولن تتم مشاركتها مع أصحاب المتاجر. سيتم إخطارك دائمًا عند تحصيل الرسوم منك.
|
||||
authorised_shops_agreement: هذه قائمة بالمحلات التجارية المسموح لها بشحن بطاقة الائتمان الافتراضية الخاصة بك مقابل أي اشتراكات (مثل تكرار الطلبات) قد تكون لديك. سيتم الاحتفاظ بتفاصيل بطاقتك بشكل آمن ولن يتم مشاركتها مع أصحاب المتاجر. سيتم إخطارك دائمًا عند محاسبتك. من خلال تحديد المربع الخاص بمتجر ، فإنك توافق على تخويل هذا المتجر بإرسال تعليمات إلى المؤسسة المالية التي أصدرت بطاقتك لتلقي المدفوعات وفقًا لشروط أي اشتراك تقوم بإنشائه مع هذا المتجر.
|
||||
saved_cards_popover: هذه قائمة البطاقات التي اخترت حفظها لاستخدامها لاحقًا. سيتم تحديد "الافتراضي" الخاص بك تلقائيًا عند إتمام طلب الشراء ، ويمكن أن يتم تحصيل رسوم من أي متاجر سمحت لها بالقيام بذلك (انظر إلى اليمين).
|
||||
authorised_shops:
|
||||
shop_name: "اسم المتجر"
|
||||
allow_charges?: "السماح للرسوم؟"
|
||||
allow_charges?: "السماح بالسحب من البطاقة الافتراضية؟"
|
||||
localized_number:
|
||||
invalid_format: لديه تنسيق غير صالح. الرجاء إدخال رقم.
|
||||
api:
|
||||
|
||||
@@ -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"
|
||||
@@ -2085,6 +2086,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})."
|
||||
@@ -3538,11 +3540,10 @@ ca:
|
||||
delete?: Suprimeix?
|
||||
cards:
|
||||
authorised_shops: Botigues autoritzades
|
||||
authorised_shops_popover: Aquesta és la llista de botigues que tenen permís per carregar la teva targeta de crèdit predeterminada per a qualsevol subscripció (és a dir, comandes de repetició) que puguis tenir. Les dades de la targeta es mantindran segures i no es compartiran amb els propietaris de botigues. Sempre se us notificarà quan se us faci un càrrec.
|
||||
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?: "Permetre càrrecs?"
|
||||
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:
|
||||
|
||||
@@ -3582,11 +3582,9 @@ cy:
|
||||
delete?: Dileu?
|
||||
cards:
|
||||
authorised_shops: Siopau Awdurdodedig
|
||||
authorised_shops_popover: Dyma'r rhestr o siopau y caniateir iddynt godi tâl ar eich cerdyn credyd diofyn am unrhyw danysgrifiadau (h.y. ailadrodd archebion) a allai fod gennych. Bydd manylion eich cerdyn yn cael eu cadw'n ddiogel ac ni fyddant yn cael eu rhannu â pherchnogion siopau. Fe'ch hysbysir bob amser pan godir tâl arnoch.
|
||||
saved_cards_popover: Dyma'r rhestr o gardiau rydych chi wedi dewis eu cadw i'w defnyddio'n ddiweddarach. Bydd eich 'rhagosodiad' yn cael ei ddewis yn awtomatig pan fyddwch chi'n talu archeb, a gall unrhyw siopau rydych chi wedi caniatáu gwneud hynny godi tâl arnyn nhw (gweler ar y dde).
|
||||
authorised_shops:
|
||||
shop_name: "Enw'r Siop"
|
||||
allow_charges?: "Caniatáu Taliadau?"
|
||||
localized_number:
|
||||
invalid_format: mae fformat annilys. Rhowch rif.
|
||||
api:
|
||||
|
||||
@@ -3537,11 +3537,9 @@ de_DE:
|
||||
delete?: Löschen?
|
||||
cards:
|
||||
authorised_shops: Bevollmächtigte Läden
|
||||
authorised_shops_popover: Dies ist die Liste der Shops, die Ihre Standardkreditkarte für eventuell vorhandene Abonnements (dh wiederkehrende Bestellungen) belasten dürfen. Ihre Kartendetails werden sicher aufbewahrt und nicht an Ladenbesitzer weitergegeben. Sie werden immer benachrichtigt, wenn Sie belastet werden.
|
||||
saved_cards_popover: Dies ist die Liste der Karten, die Sie für spätere Verwendung gespeichert haben. Ihr "Standard" wird automatisch beim Abschließen einer Bestellung ausgewählt und kann von allen Geschäften belastet werden, die Sie dazu berechtigt haben (siehe rechts).
|
||||
authorised_shops:
|
||||
shop_name: "Ladenname"
|
||||
allow_charges?: "Gebühren erlauben?"
|
||||
localized_number:
|
||||
invalid_format: hat ein ungültiges Format. Bitte Ziffern eingeben.
|
||||
api:
|
||||
|
||||
@@ -1398,6 +1398,7 @@ en:
|
||||
unconfirmed: unconfirmed
|
||||
days: days
|
||||
authorization_failure: "Authorization Failure"
|
||||
description: "Description"
|
||||
|
||||
label_shop: "Shop"
|
||||
label_shops: "Shops"
|
||||
@@ -1677,6 +1678,7 @@ See the %{link} to find out more about %{sitename}'s features and to start using
|
||||
shopping_producers_of_hub: "%{hub}'s producers:"
|
||||
|
||||
enterprises_next_closing: "Next order closing"
|
||||
enterprises_currently_open: "Orders are currently open"
|
||||
enterprises_ready_for: "Ready for"
|
||||
enterprises_choose: "Choose when you want your order:"
|
||||
|
||||
@@ -2147,6 +2149,9 @@ See the %{link} to find out more about %{sitename}'s features and to start using
|
||||
delivery_method: Delivery Method
|
||||
fee_type: "Fee Type"
|
||||
tax_category: "Tax Category"
|
||||
description: "Description"
|
||||
display: "Display"
|
||||
tags: "Tags"
|
||||
calculator: "Calculator"
|
||||
calculator_values: "Calculator values"
|
||||
calculator_settings_warning: "If you are changing the calculator type, you must save first before you can edit the calculator settings"
|
||||
@@ -2213,6 +2218,7 @@ See the %{link} to find out more about %{sitename}'s features and to start using
|
||||
spree_classification_primary_taxon_error: "Taxon %{taxon} is the primary taxon of %{product} and cannot be deleted"
|
||||
spree_order_availability_error: "Distributor or order cycle cannot supply the products in your cart"
|
||||
spree_order_populator_error: "That distributor or order cycle can't supply all the products in your cart. Please choose another."
|
||||
spree_order_cycle_error: "Please choose an order cycle for this order."
|
||||
spree_order_populator_availability_error: "That product is not available from the chosen distributor or order cycle."
|
||||
spree_distributors_error: "At least one hub must be selected"
|
||||
spree_user_enterprise_limit_error: "^%{email} is not permitted to own any more enterprises (limit is %{enterprise_limit})."
|
||||
@@ -2509,6 +2515,7 @@ See the %{link} to find out more about %{sitename}'s features and to start using
|
||||
js:
|
||||
saving: 'Saving...'
|
||||
changes_saved: 'Changes saved.'
|
||||
authorising: "Authorising..."
|
||||
save_changes_first: Save changes first.
|
||||
all_changes_saved: All changes saved
|
||||
unsaved_changes: You have unsaved changes
|
||||
@@ -2524,6 +2531,7 @@ See the %{link} to find out more about %{sitename}'s features and to start using
|
||||
resolve_errors: Please resolve the following errors
|
||||
more_items: "+ %{count} More"
|
||||
default_card_updated: Default Card Updated
|
||||
default_card_voids_auth: Changing your default card will remove shops' existing authorizations to charge it. You can re-authorize shops after updating the default card. Do you wish to change the default card?"
|
||||
cart:
|
||||
add_to_cart_failed: >
|
||||
There was a problem adding this product to the cart.
|
||||
@@ -3202,6 +3210,7 @@ See the %{link} to find out more about %{sitename}'s features and to start using
|
||||
|
||||
actions:
|
||||
update: "Update"
|
||||
cancel: "Cancel"
|
||||
shared:
|
||||
error_messages:
|
||||
errors_prohibited_this_record_from_being_saved:
|
||||
@@ -3217,6 +3226,7 @@ See the %{link} to find out more about %{sitename}'s features and to start using
|
||||
payment_state: "Payment State"
|
||||
errors:
|
||||
messages:
|
||||
included_price_validation: "cannot be selected unless you have set a Default Tax Zone"
|
||||
blank: "can't be blank"
|
||||
layouts:
|
||||
admin:
|
||||
@@ -3427,6 +3437,14 @@ See the %{link} to find out more about %{sitename}'s features and to start using
|
||||
deactivation_warning: "De-activating a payment method can make the payment method disappear from your list. Alternatively, you can hide a payment method from the checkout page by setting the option 'Display' to 'back office only'."
|
||||
providers:
|
||||
provider: "Provider"
|
||||
check: "Cash/EFT/etc. (payments for which automatic validation is not required)"
|
||||
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:
|
||||
@@ -3699,11 +3717,11 @@ See the %{link} to find out more about %{sitename}'s features and to start using
|
||||
delete?: Delete?
|
||||
cards:
|
||||
authorised_shops: Authorised Shops
|
||||
authorised_shops_popover: This is the list of shops which are permitted to charge your default credit card for any subscriptions (ie. repeating orders) you may have. Your card details will be kept secure and will not be shared with shop owners. You will always be notified when you are charged.
|
||||
authorised_shops_agreement: This is the list of shops which are permitted to charge your default credit card for any subscriptions (ie. repeating orders) you may have. Your card details will be kept secure and will not be shared with shop owners. You will always be notified when you are charged. By checking the box for a shop, you are agreeing to authorise that shop to send instructions to the financial institution that issued your card to take payments in accordance with the terms of any subscription you create with that shop.
|
||||
saved_cards_popover: This is the list of cards you have opted to save for later use. Your 'default' will be selected automatically when you checkout an order, and can be charged by any shops you have allowed to do so (see right).
|
||||
authorised_shops:
|
||||
shop_name: "Shop Name"
|
||||
allow_charges?: "Allow Charges?"
|
||||
allow_charges?: "Allow Charges to Default Card?"
|
||||
localized_number:
|
||||
invalid_format: has an invalid format. Please enter a number.
|
||||
api:
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user