spree_api 4.3.3 → 4.4.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/concerns/spree/api/v2/caching.rb +7 -3
- data/app/controllers/concerns/spree/api/v2/coupon_codes_helper.rb +29 -0
- data/app/controllers/concerns/spree/api/v2/number_resource.rb +11 -0
- data/app/controllers/concerns/spree/api/v2/platform/nested_set_reposition_concern.rb +37 -0
- data/app/controllers/concerns/spree/api/v2/platform/promotion_calculator_params.rb +17 -0
- data/app/controllers/concerns/spree/api/v2/platform/promotion_rule_params.rb +16 -0
- data/app/controllers/concerns/spree/api/v2/storefront/metadata_controller_concern.rb +18 -0
- data/app/controllers/spree/api/v1/checkouts_controller.rb +1 -1
- data/app/controllers/spree/api/v2/base_controller.rb +6 -5
- data/app/controllers/spree/api/v2/platform/adjustments_controller.rb +19 -0
- data/app/controllers/spree/api/v2/platform/classifications_controller.rb +1 -22
- data/app/controllers/spree/api/v2/platform/cms_pages_controller.rb +4 -0
- data/app/controllers/spree/api/v2/platform/cms_sections_controller.rb +13 -18
- data/app/controllers/spree/api/v2/platform/digital_links_controller.rb +25 -0
- data/app/controllers/spree/api/v2/platform/digitals_controller.rb +19 -0
- data/app/controllers/spree/api/v2/platform/line_items_controller.rb +59 -0
- data/app/controllers/spree/api/v2/platform/menu_items_controller.rb +5 -19
- data/app/controllers/spree/api/v2/platform/menus_controller.rb +0 -4
- data/app/controllers/spree/api/v2/platform/orders_controller.rb +163 -0
- data/app/controllers/spree/api/v2/platform/payment_methods_controller.rb +27 -0
- data/app/controllers/spree/api/v2/platform/payments_controller.rb +17 -0
- data/app/controllers/spree/api/v2/platform/promotion_actions_controller.rb +30 -0
- data/app/controllers/spree/api/v2/platform/promotion_categories_controller.rb +19 -0
- data/app/controllers/spree/api/v2/platform/promotion_rules_controller.rb +25 -0
- data/app/controllers/spree/api/v2/platform/promotions_controller.rb +31 -0
- data/app/controllers/spree/api/v2/platform/resource_controller.rb +47 -16
- data/app/controllers/spree/api/v2/platform/roles_controller.rb +15 -0
- data/app/controllers/spree/api/v2/platform/shipments_controller.rb +143 -0
- data/app/controllers/spree/api/v2/platform/shipping_categories_controller.rb +15 -0
- data/app/controllers/spree/api/v2/platform/shipping_methods_controller.rb +24 -0
- data/app/controllers/spree/api/v2/platform/states_controller.rb +19 -0
- data/app/controllers/spree/api/v2/platform/stock_items_controller.rb +19 -0
- data/app/controllers/spree/api/v2/platform/stock_locations_controller.rb +19 -0
- data/app/controllers/spree/api/v2/platform/store_credit_categories_controller.rb +15 -0
- data/app/controllers/spree/api/v2/platform/store_credit_types_controller.rb +15 -0
- data/app/controllers/spree/api/v2/platform/store_credits_controller.rb +19 -0
- data/app/controllers/spree/api/v2/platform/tax_categories_controller.rb +19 -0
- data/app/controllers/spree/api/v2/platform/tax_rates_controller.rb +23 -0
- data/app/controllers/spree/api/v2/platform/taxonomies_controller.rb +19 -0
- data/app/controllers/spree/api/v2/platform/taxons_controller.rb +25 -0
- data/app/controllers/spree/api/v2/platform/users_controller.rb +4 -0
- data/app/controllers/spree/api/v2/platform/variants_controller.rb +19 -0
- data/app/controllers/spree/api/v2/platform/webhooks/events_controller.rb +21 -0
- data/app/controllers/spree/api/v2/platform/webhooks/subscribers_controller.rb +21 -0
- data/app/controllers/spree/api/v2/platform/wished_items_controller.rb +19 -0
- data/app/controllers/spree/api/v2/platform/wishlists_controller.rb +19 -0
- data/app/controllers/spree/api/v2/platform/zones_controller.rb +19 -0
- data/app/controllers/spree/api/v2/resource_controller.rb +3 -3
- data/app/controllers/spree/api/v2/storefront/account/addresses_controller.rb +2 -2
- data/app/controllers/spree/api/v2/storefront/account/credit_cards_controller.rb +4 -1
- data/app/controllers/spree/api/v2/storefront/cart_controller.rb +18 -28
- data/app/controllers/spree/api/v2/storefront/checkout_controller.rb +24 -0
- data/app/controllers/spree/api/v2/storefront/digitals_controller.rb +54 -0
- data/app/controllers/spree/api/v2/storefront/wishlists_controller.rb +171 -0
- data/app/helpers/spree/api/v2/collection_options_helpers.rb +1 -1
- data/app/jobs/spree/webhooks/subscribers/make_request_job.rb +17 -0
- data/app/models/concerns/spree/webhooks/has_webhooks.rb +58 -0
- data/app/models/spree/api/webhooks/order_decorator.rb +43 -0
- data/app/models/spree/api/webhooks/payment_decorator.rb +26 -0
- data/app/models/spree/api/webhooks/product_decorator.rb +27 -0
- data/app/models/spree/api/webhooks/shipment_decorator.rb +21 -0
- data/app/models/spree/api/webhooks/stock_item_decorator.rb +43 -0
- data/app/models/spree/api/webhooks/stock_movement_decorator.rb +52 -0
- data/app/models/spree/api/webhooks/variant_decorator.rb +26 -0
- data/app/models/spree/oauth_access_grant.rb +7 -0
- data/app/models/spree/oauth_access_token.rb +7 -0
- data/app/models/spree/oauth_application.rb +15 -0
- data/app/models/spree/webhooks/base.rb +11 -0
- data/app/models/spree/webhooks/event.rb +12 -0
- data/app/models/spree/webhooks/subscriber.rb +57 -0
- data/app/serializers/concerns/spree/api/v2/resource_serializer_concern.rb +19 -1
- data/app/serializers/spree/api/v2/base_serializer.rb +11 -4
- data/app/serializers/spree/api/v2/platform/address_serializer.rb +1 -1
- data/app/serializers/spree/api/v2/platform/adjustment_serializer.rb +20 -0
- data/app/serializers/spree/api/v2/platform/asset_serializer.rb +13 -0
- data/app/serializers/spree/api/v2/platform/calculator_serializer.rb +17 -0
- data/app/serializers/spree/api/v2/platform/classification_serializer.rb +1 -1
- data/app/serializers/spree/api/v2/platform/cms_page_serializer.rb +1 -1
- data/app/serializers/spree/api/v2/platform/cms_section_serializer.rb +8 -1
- data/app/serializers/spree/api/v2/platform/country_serializer.rb +1 -1
- data/app/serializers/spree/api/v2/platform/credit_card_serializer.rb +14 -0
- data/app/serializers/spree/api/v2/platform/customer_return_serializer.rb +17 -0
- data/app/serializers/spree/api/v2/platform/digital_link_serializer.rb +16 -0
- data/app/serializers/spree/api/v2/platform/digital_serializer.rb +30 -0
- data/app/serializers/spree/api/v2/platform/feature_page_serializer.rb +11 -0
- data/app/serializers/spree/api/v2/platform/homepage_serializer.rb +11 -0
- data/app/serializers/spree/api/v2/platform/inventory_unit_serializer.rb +19 -0
- data/app/serializers/spree/api/v2/platform/line_item_serializer.rb +19 -0
- data/app/serializers/spree/api/v2/platform/log_entry_serializer.rb +13 -0
- data/app/serializers/spree/api/v2/platform/menu_item_serializer.rb +1 -1
- data/app/serializers/spree/api/v2/platform/menu_serializer.rb +1 -1
- data/app/serializers/spree/api/v2/platform/option_type_serializer.rb +1 -1
- data/app/serializers/spree/api/v2/platform/option_value_serializer.rb +1 -1
- data/app/serializers/spree/api/v2/platform/order_promotion_serializer.rb +14 -0
- data/app/serializers/spree/api/v2/platform/order_serializer.rb +31 -0
- data/app/serializers/spree/api/v2/platform/payment_capture_event_serializer.rb +13 -0
- data/app/serializers/spree/api/v2/platform/payment_method_serializer.rb +18 -0
- data/app/serializers/spree/api/v2/platform/payment_serializer.rb +21 -0
- data/app/serializers/spree/api/v2/platform/price_serializer.rb +19 -0
- data/app/serializers/spree/api/v2/platform/product_property_serializer.rb +1 -1
- data/app/serializers/spree/api/v2/platform/product_serializer.rb +7 -3
- data/app/serializers/spree/api/v2/platform/promotion_action_line_item_serializer.rb +14 -0
- data/app/serializers/spree/api/v2/platform/promotion_action_serializer.rb +19 -0
- data/app/serializers/spree/api/v2/platform/promotion_category_serializer.rb +13 -0
- data/app/serializers/spree/api/v2/platform/promotion_rule_serializer.rb +21 -0
- data/app/serializers/spree/api/v2/platform/promotion_serializer.rb +17 -0
- data/app/serializers/spree/api/v2/platform/property_serializer.rb +11 -0
- data/app/serializers/spree/api/v2/platform/prototype_serializer.rb +15 -0
- data/app/serializers/spree/api/v2/platform/refund_reason_serializer.rb +11 -0
- data/app/serializers/spree/api/v2/platform/refund_serializer.rb +16 -0
- data/app/serializers/spree/api/v2/platform/reimbursement_credit_serializer.rb +10 -0
- data/app/serializers/spree/api/v2/platform/reimbursement_serializer.rb +18 -0
- data/app/serializers/spree/api/v2/platform/reimbursement_type_serializer.rb +11 -0
- data/app/serializers/spree/api/v2/platform/return_authorization_reason_serializer.rb +11 -0
- data/app/serializers/spree/api/v2/platform/return_authorization_serializer.rb +17 -0
- data/app/serializers/spree/api/v2/platform/return_item_serializer.rb +16 -0
- data/app/serializers/spree/api/v2/platform/role_serializer.rb +11 -0
- data/app/serializers/spree/api/v2/platform/shipment_serializer.rb +22 -0
- data/app/serializers/spree/api/v2/platform/shipping_category_serializer.rb +11 -0
- data/app/serializers/spree/api/v2/platform/shipping_method_serializer.rb +16 -0
- data/app/serializers/spree/api/v2/platform/shipping_rate_serializer.rb +15 -0
- data/app/serializers/spree/api/v2/platform/standard_page_serializer.rb +11 -0
- data/app/serializers/spree/api/v2/platform/state_change_serializer.rb +13 -0
- data/app/serializers/spree/api/v2/platform/state_serializer.rb +1 -1
- data/app/serializers/spree/api/v2/platform/stock_item_serializer.rb +1 -3
- data/app/serializers/spree/api/v2/platform/stock_location_serializer.rb +2 -4
- data/app/serializers/spree/api/v2/platform/stock_movement_serializer.rb +11 -0
- data/app/serializers/spree/api/v2/platform/stock_transfer_serializer.rb +15 -0
- data/app/serializers/spree/api/v2/platform/store_credit_category_serializer.rb +12 -0
- data/app/serializers/spree/api/v2/platform/store_credit_event_serializer.rb +14 -0
- data/app/serializers/spree/api/v2/platform/store_credit_serializer.rb +18 -0
- data/app/serializers/spree/api/v2/platform/store_credit_type_serializer.rb +12 -0
- data/app/serializers/spree/api/v2/platform/store_serializer.rb +1 -1
- data/app/serializers/spree/api/v2/platform/tax_category_serializer.rb +2 -2
- data/app/serializers/spree/api/v2/platform/tax_rate_serializer.rb +14 -0
- data/app/serializers/spree/api/v2/platform/taxon_serializer.rb +1 -1
- data/app/serializers/spree/api/v2/platform/taxonomy_serializer.rb +1 -1
- data/app/serializers/spree/api/v2/platform/user_serializer.rb +1 -1
- data/app/serializers/spree/api/v2/platform/variant_serializer.rb +3 -2
- data/app/serializers/spree/api/v2/platform/webhooks/event_serializer.rb +15 -0
- data/app/serializers/spree/api/v2/platform/webhooks/subscriber_serializer.rb +13 -0
- data/app/serializers/spree/api/v2/platform/wished_item_serializer.rb +29 -0
- data/app/serializers/spree/api/v2/platform/wishlist_serializer.rb +19 -0
- data/app/serializers/spree/api/v2/platform/zone_member_serializer.rb +13 -0
- data/app/serializers/spree/api/v2/platform/zone_serializer.rb +13 -0
- data/app/serializers/spree/v2/storefront/address_serializer.rb +1 -1
- data/app/serializers/spree/v2/storefront/cart_serializer.rb +1 -1
- data/app/serializers/spree/v2/storefront/cms_section_serializer.rb +5 -1
- data/app/serializers/spree/v2/storefront/credit_card_serializer.rb +1 -1
- data/app/serializers/spree/v2/storefront/digital_link_serializer.rb +11 -0
- data/app/serializers/spree/v2/storefront/estimated_shipping_rate_serializer.rb +2 -2
- data/app/serializers/spree/v2/storefront/line_item_serializer.rb +2 -1
- data/app/serializers/spree/v2/storefront/option_type_serializer.rb +1 -1
- data/app/serializers/spree/v2/storefront/option_value_serializer.rb +1 -1
- data/app/serializers/spree/v2/storefront/payment_method_serializer.rb +1 -1
- data/app/serializers/spree/v2/storefront/payment_serializer.rb +1 -1
- data/app/serializers/spree/v2/storefront/product_serializer.rb +2 -2
- data/app/serializers/spree/v2/storefront/promotion_serializer.rb +1 -1
- data/app/serializers/spree/v2/storefront/shipment_serializer.rb +2 -1
- data/app/serializers/spree/v2/storefront/store_credit_serializer.rb +1 -1
- data/app/serializers/spree/v2/storefront/store_serializer.rb +1 -1
- data/app/serializers/spree/v2/storefront/taxon_serializer.rb +1 -1
- data/app/serializers/spree/v2/storefront/taxonomy_serializer.rb +1 -1
- data/app/serializers/spree/v2/storefront/user_serializer.rb +1 -1
- data/app/serializers/spree/v2/storefront/variant_serializer.rb +1 -1
- data/app/serializers/spree/v2/storefront/wished_item_serializer.rb +29 -0
- data/app/serializers/spree/v2/storefront/wishlist_serializer.rb +17 -0
- data/app/services/spree/webhooks/subscribers/handle_request.rb +73 -0
- data/app/services/spree/webhooks/subscribers/make_request.rb +82 -0
- data/app/services/spree/webhooks/subscribers/queue_requests.rb +17 -0
- data/app/services/spree/webhooks.rb +13 -0
- data/config/i18n-tasks.yml +40 -0
- data/config/initializers/doorkeeper.rb +12 -12
- data/config/initializers/rabl.rb +2 -2
- data/config/locales/en.yml +29 -27
- data/config/routes.rb +83 -59
- data/db/migrate/20210902162826_create_spree_webhooks_tables.rb +16 -0
- data/db/migrate/20210919183228_enable_polymorphic_resource_owner.rb +21 -0
- data/db/migrate/20211025162826_create_spree_webhooks_events.rb +14 -0
- data/docs/oauth/index.yml +126 -33
- data/docs/v2/platform/index.yaml +19100 -1736
- data/docs/v2/storefront/index.yaml +14797 -14609
- data/{app/models/spree → lib/spree/api}/api_dependencies.rb +56 -4
- data/lib/spree/api/engine.rb +24 -1
- data/lib/spree/api/testing_support/factories/oauth_application_factory.rb +6 -0
- data/lib/spree/api/testing_support/factories/webhook_event_factory.rb +27 -0
- data/lib/spree/api/testing_support/factories/webhook_subscriber_factory.rb +13 -0
- data/lib/spree/api/testing_support/factories.rb +3 -0
- data/lib/spree/api/testing_support/helpers.rb +1 -1
- data/lib/spree/api/testing_support/jobs.rb +18 -0
- data/lib/spree/api/testing_support/matchers/webhooks.rb +67 -0
- data/lib/spree/api/testing_support/serializers.rb +25 -0
- data/lib/spree/api/testing_support/spree_webhooks.rb +9 -0
- data/lib/spree/api/testing_support/v2/base.rb +1 -1
- data/lib/spree/api/testing_support/v2/current_order.rb +34 -1
- data/lib/spree/api/testing_support/v2/platform_contexts.rb +101 -52
- data/lib/spree/api/testing_support/v2/serializers_params.rb +3 -1
- data/lib/spree/api.rb +1 -0
- data/spec/fixtures/files/icon_256x256.jpg +0 -0
- data/spree_api.gemspec +16 -15
- metadata +177 -30
- data/app/controllers/spree/api/errors_controller.rb +0 -9
@@ -0,0 +1,40 @@
|
|
1
|
+
base_locale: en
|
2
|
+
data:
|
3
|
+
yaml:
|
4
|
+
write:
|
5
|
+
# do not wrap lines at 80 characters
|
6
|
+
line_width: -1
|
7
|
+
|
8
|
+
# Find translate calls
|
9
|
+
search:
|
10
|
+
paths:
|
11
|
+
- '../api/app'
|
12
|
+
- '../api/lib'
|
13
|
+
|
14
|
+
#### For API v1 only, START ####
|
15
|
+
exclude:
|
16
|
+
- '../api/app/controllers/spree/api/v1/*'
|
17
|
+
- '../api/app/views/*'
|
18
|
+
|
19
|
+
ignore_unused:
|
20
|
+
- 'spree.api.gateway_error'
|
21
|
+
- 'spree.api.invalid_api_key'
|
22
|
+
- 'spree.api.invalid_resource'
|
23
|
+
- 'spree.api.invalid_taxonomy_id'
|
24
|
+
- 'spree.api.must_specify_api_key'
|
25
|
+
- 'spree.api.negative_quantity'
|
26
|
+
- 'spree.api.order.could_not_transition'
|
27
|
+
- 'spree.api.order.insufficient_quantity'
|
28
|
+
- 'spree.api.order.invalid_shipping_method'
|
29
|
+
- 'spree.api.payment.credit_over_limit'
|
30
|
+
- 'spree.api.payment.update_forbidden'
|
31
|
+
- 'spree.api.shipment.cannot_ready'
|
32
|
+
- 'spree.api.shipment_transfer_errors_occurred'
|
33
|
+
- 'spree.api.shipment_transfer_success'
|
34
|
+
- 'spree.api.stock_location_required'
|
35
|
+
- 'spree.api.unauthorized'
|
36
|
+
- 'spree.api.wrong_shipment_target'
|
37
|
+
#### For API v1 only, END ####
|
38
|
+
|
39
|
+
# The PatternMapper for Spree.t
|
40
|
+
<% I18n::Tasks.add_scanner 'I18n::Tasks::Scanners::PatternMapper', patterns: [['\bSpree\.t[( ]\s*%{key}', 'spree.%{key}']] %>
|
@@ -2,11 +2,15 @@ Doorkeeper.configure do
|
|
2
2
|
orm :active_record
|
3
3
|
use_refresh_token
|
4
4
|
api_only
|
5
|
-
base_controller '
|
5
|
+
base_controller 'Spree::Api::V2::BaseController'
|
6
|
+
base_metal_controller 'Spree::Api::V2::BaseController'
|
6
7
|
|
8
|
+
# FIXME: we should only skip this for Storefront API until v5
|
9
|
+
# we should not skip this for Platform API
|
7
10
|
skip_client_authentication_for_password_grant { true } if defined?(skip_client_authentication_for_password_grant)
|
8
11
|
|
9
12
|
resource_owner_authenticator { current_spree_user }
|
13
|
+
use_polymorphic_resource_owner
|
10
14
|
|
11
15
|
resource_owner_from_credentials do
|
12
16
|
user = Spree.user_class.find_for_database_authentication(email: params[:username])
|
@@ -21,7 +25,7 @@ Doorkeeper.configure do
|
|
21
25
|
end
|
22
26
|
|
23
27
|
admin_authenticator do |routes|
|
24
|
-
current_spree_user&.
|
28
|
+
current_spree_user&.spree_admin? || redirect_to(routes.root_url)
|
25
29
|
end
|
26
30
|
|
27
31
|
grant_flows %w[password client_credentials]
|
@@ -33,16 +37,12 @@ Doorkeeper.configure do
|
|
33
37
|
access_token_methods :from_bearer_authorization, :from_access_token_param
|
34
38
|
|
35
39
|
optional_scopes :admin, :write, :read
|
36
|
-
end
|
37
|
-
|
38
|
-
Doorkeeper::AccessGrant.class_eval do
|
39
|
-
self.table_name = 'spree_oauth_access_grants'
|
40
|
-
end
|
41
40
|
|
42
|
-
|
43
|
-
|
44
|
-
|
41
|
+
access_token_class 'Spree::OauthAccessToken'
|
42
|
+
access_grant_class 'Spree::OauthAccessGrant'
|
43
|
+
application_class 'Spree::OauthApplication'
|
45
44
|
|
46
|
-
Doorkeeper
|
47
|
-
|
45
|
+
# using Bcrupt for token secrets is currently not supported by Doorkeeper
|
46
|
+
hash_token_secrets fallback: :plain
|
47
|
+
hash_application_secrets fallback: :plain, using: '::Doorkeeper::SecretStoring::BCrypt'
|
48
48
|
end
|
data/config/initializers/rabl.rb
CHANGED
@@ -3,7 +3,7 @@ Rabl.configure do |config|
|
|
3
3
|
config.include_child_root = false
|
4
4
|
|
5
5
|
# Motivation here it make it call as_json when rendering timestamps
|
6
|
-
# and therefore display
|
7
|
-
# JSON.dump which doesn't display the
|
6
|
+
# and therefore display milliseconds. Otherwise it would fall to
|
7
|
+
# JSON.dump which doesn't display the milliseconds
|
8
8
|
config.json_engine = ActiveSupport::JSON
|
9
9
|
end
|
data/config/locales/en.yml
CHANGED
@@ -1,36 +1,38 @@
|
|
1
|
+
---
|
1
2
|
en:
|
2
3
|
spree:
|
3
4
|
api:
|
4
|
-
|
5
|
-
invalid_api_key:
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
access: "API Access"
|
11
|
-
key: "Key"
|
12
|
-
clear_key: "Clear key"
|
13
|
-
regenerate_key: "Regenerate Key"
|
14
|
-
no_key: "No key"
|
15
|
-
generate_key: "Generate API key"
|
16
|
-
key_generated: "Key generated"
|
17
|
-
key_cleared: "Key cleared"
|
5
|
+
gateway_error: 'There was a problem with the payment gateway: %{text}'
|
6
|
+
invalid_api_key: Invalid API key (%{key}) specified.
|
7
|
+
invalid_resource: Invalid resource. Please fix errors and try again.
|
8
|
+
invalid_taxonomy_id: Invalid taxonomy id.
|
9
|
+
must_specify_api_key: You must specify an API key.
|
10
|
+
negative_quantity: quantity is negative
|
18
11
|
order:
|
19
|
-
could_not_transition:
|
20
|
-
invalid_shipping_method: "Invalid shipping method specified."
|
12
|
+
could_not_transition: The order could not be transitioned. Please fix the errors and try again.
|
21
13
|
insufficient_quantity: An item in your cart has become unavailable.
|
14
|
+
invalid_shipping_method: Invalid shipping method specified.
|
22
15
|
payment:
|
23
|
-
credit_over_limit:
|
24
|
-
update_forbidden:
|
16
|
+
credit_over_limit: This payment can only be credited up to %{limit}. Please specify an amount less than or equal to this number.
|
17
|
+
update_forbidden: This payment cannot be updated because it is %{state}.
|
18
|
+
resource_not_found: The resource you were looking for could not be found.
|
25
19
|
shipment:
|
26
|
-
cannot_ready:
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
wrong_shipment_target: "target shipment is the same as original shipment"
|
32
|
-
|
20
|
+
cannot_ready: Cannot ready shipment.
|
21
|
+
shipment_transfer_errors_occurred: 'Following errors occurred while attempting this action:'
|
22
|
+
shipment_transfer_success: Variants successfully transferred
|
23
|
+
stock_location_required: A stock_location_id parameter must be provided in order to retrieve stock movements.
|
24
|
+
unauthorized: You are not authorized to perform that action.
|
33
25
|
v2:
|
34
26
|
cart:
|
35
|
-
|
36
|
-
|
27
|
+
no_coupon_code: No coupon code provided and the Order doesn't have any coupon code promotions applied
|
28
|
+
wrong_quantity: Quantity has to be greater than 0
|
29
|
+
digitals:
|
30
|
+
missing_file: 'Missing Digital Item: attachment'
|
31
|
+
unauthorized: Error, you are not authorized to access this asset
|
32
|
+
metadata:
|
33
|
+
invalid_params: Public and private metadata parameters should be objects
|
34
|
+
wishlist:
|
35
|
+
errors:
|
36
|
+
the_wishlist_could_not_be_destroyed: The wishlist could not be destroyed.
|
37
|
+
wrong_quantity: Quantity has to be greater than 0
|
38
|
+
wrong_shipment_target: target shipment is the same as original shipment
|
data/config/routes.rb
CHANGED
@@ -145,10 +145,12 @@ Spree::Core::Engine.add_routes do
|
|
145
145
|
patch :next
|
146
146
|
patch :advance
|
147
147
|
patch :complete
|
148
|
+
post :create_payment
|
148
149
|
post :add_store_credit
|
149
150
|
post :remove_store_credit
|
150
151
|
get :payment_methods
|
151
152
|
get :shipping_rates
|
153
|
+
patch :select_shipping_method
|
152
154
|
end
|
153
155
|
|
154
156
|
resource :account, controller: :account, only: %i[show create update]
|
@@ -168,32 +170,47 @@ Spree::Core::Engine.add_routes do
|
|
168
170
|
|
169
171
|
resources :menus, only: %i[index show]
|
170
172
|
resources :cms_pages, only: %i[index show]
|
173
|
+
|
174
|
+
resources :wishlists do
|
175
|
+
get :default, on: :collection
|
176
|
+
|
177
|
+
member do
|
178
|
+
post :add_item
|
179
|
+
patch 'set_item_quantity/:item_id', to: 'wishlists#set_item_quantity', as: :set_item_quantity
|
180
|
+
delete 'remove_item/:item_id', to: 'wishlists#remove_item', as: :remove_item
|
181
|
+
end
|
182
|
+
end
|
183
|
+
|
184
|
+
get '/digitals/:token', to: 'digitals#download', as: 'digital'
|
171
185
|
end
|
172
186
|
|
173
187
|
namespace :platform do
|
174
188
|
# Promotions API
|
175
189
|
resources :promotions
|
190
|
+
resources :promotion_actions
|
191
|
+
resources :promotion_categories
|
192
|
+
resources :promotion_rules
|
176
193
|
|
177
194
|
# Returns API
|
178
195
|
resources :customer_returns
|
179
196
|
resources :reimbursements
|
180
197
|
resources :return_authorizations do
|
181
198
|
member do
|
182
|
-
|
183
|
-
|
184
|
-
|
199
|
+
patch :add
|
200
|
+
patch :cancel
|
201
|
+
patch :receive
|
185
202
|
end
|
186
203
|
end
|
187
204
|
|
188
205
|
# Product Catalog API
|
189
206
|
resources :products
|
190
207
|
resources :taxonomies
|
191
|
-
resources :taxons
|
192
|
-
resources :classifications do
|
208
|
+
resources :taxons do
|
193
209
|
member do
|
194
|
-
|
210
|
+
patch :reposition
|
195
211
|
end
|
196
212
|
end
|
213
|
+
resources :classifications
|
197
214
|
resources :images
|
198
215
|
resources :variants
|
199
216
|
resources :properties
|
@@ -204,26 +221,38 @@ Spree::Core::Engine.add_routes do
|
|
204
221
|
# Order API
|
205
222
|
resources :orders do
|
206
223
|
member do
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
224
|
+
patch :next
|
225
|
+
patch :advance
|
226
|
+
patch :approve
|
227
|
+
patch :cancel
|
228
|
+
patch :empty
|
229
|
+
patch :apply_coupon_code
|
230
|
+
patch :complete
|
231
|
+
patch :use_store_credit
|
232
|
+
patch :cancel
|
233
|
+
patch :approve
|
214
234
|
end
|
215
235
|
end
|
216
236
|
resources :line_items
|
237
|
+
resources :adjustments
|
238
|
+
|
239
|
+
# Payments API
|
217
240
|
resources :payments do
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
241
|
+
# TODO: support custom actions
|
242
|
+
# member do
|
243
|
+
# patch :authorize
|
244
|
+
# patch :capture
|
245
|
+
# patch :purchase
|
246
|
+
# patch :void
|
247
|
+
# patch :credit
|
248
|
+
# end
|
225
249
|
end
|
226
250
|
|
251
|
+
# Store Credit API
|
252
|
+
resources :store_credits
|
253
|
+
resources :store_credit_categories
|
254
|
+
resources :store_credit_types
|
255
|
+
|
227
256
|
# Geo API
|
228
257
|
resources :zones
|
229
258
|
resources :countries, only: [:index, :show]
|
@@ -231,18 +260,21 @@ Spree::Core::Engine.add_routes do
|
|
231
260
|
|
232
261
|
# Shipment API
|
233
262
|
resources :shipments do
|
234
|
-
collection do
|
235
|
-
post 'transfer_to_location'
|
236
|
-
post 'transfer_to_shipment'
|
237
|
-
end
|
238
263
|
member do
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
264
|
+
%w[ready ship cancel resume pend].each do |state|
|
265
|
+
patch state.to_sym
|
266
|
+
end
|
267
|
+
patch :add_item
|
268
|
+
patch :remove_item
|
269
|
+
patch :transfer_to_location
|
270
|
+
patch :transfer_to_shipment
|
243
271
|
end
|
244
272
|
end
|
245
273
|
|
274
|
+
# Tax API
|
275
|
+
resources :tax_rates
|
276
|
+
resources :tax_categories
|
277
|
+
|
246
278
|
# Inventory API
|
247
279
|
resources :inventory_units
|
248
280
|
resources :stock_items
|
@@ -254,6 +286,8 @@ Spree::Core::Engine.add_routes do
|
|
254
286
|
resources :credit_cards
|
255
287
|
resources :addresses
|
256
288
|
|
289
|
+
resources :roles
|
290
|
+
|
257
291
|
# Menu API
|
258
292
|
resources :menus
|
259
293
|
resources :menu_items do
|
@@ -262,46 +296,36 @@ Spree::Core::Engine.add_routes do
|
|
262
296
|
end
|
263
297
|
end
|
264
298
|
|
265
|
-
# CMS
|
266
|
-
resources :cms_pages
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
299
|
+
# CMS
|
300
|
+
resources :cms_pages
|
301
|
+
resources :cms_sections
|
302
|
+
|
303
|
+
# Wishlists API
|
304
|
+
resources :wishlists
|
305
|
+
resources :wished_items
|
271
306
|
|
272
|
-
|
307
|
+
# Digitals API
|
308
|
+
resources :digitals
|
309
|
+
resources :digital_links do
|
273
310
|
member do
|
274
|
-
patch :
|
311
|
+
patch :reset
|
275
312
|
end
|
276
313
|
end
|
277
314
|
|
278
315
|
# Store API
|
279
316
|
resources :stores
|
280
|
-
end
|
281
|
-
end
|
282
317
|
|
283
|
-
|
318
|
+
# Configurations API
|
319
|
+
resources :payment_methods
|
320
|
+
resources :shipping_categories
|
321
|
+
resources :shipping_methods
|
284
322
|
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
"#{spree_path}api/404"
|
291
|
-
else
|
292
|
-
"#{spree_path}api/v1/#{params[:path]}#{format}#{query}"
|
293
|
-
end
|
294
|
-
}, via: [:get, :post, :put, :patch, :delete]
|
295
|
-
|
296
|
-
match '*path', to: redirect { |params, request|
|
297
|
-
format = ".#{params[:format]}" unless params[:format].blank?
|
298
|
-
query = "?#{request.query_string}" unless request.query_string.blank?
|
299
|
-
|
300
|
-
if request.path == "#{spree_path}api/v1/#{params[:path]}#{format}#{query}"
|
301
|
-
"#{spree_path}api/404"
|
302
|
-
else
|
303
|
-
"#{spree_path}api/v1/#{params[:path]}#{format}#{query}"
|
323
|
+
# Webhooks API
|
324
|
+
namespace :webhooks do
|
325
|
+
resources :events, only: :index
|
326
|
+
resources :subscribers
|
327
|
+
end
|
304
328
|
end
|
305
|
-
|
329
|
+
end
|
306
330
|
end
|
307
331
|
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
class CreateSpreeWebhooksTables < ActiveRecord::Migration[5.2]
|
2
|
+
def change
|
3
|
+
create_table :spree_webhooks_subscribers do |t|
|
4
|
+
t.string :url, null: false
|
5
|
+
t.boolean :active, default: false, index: true
|
6
|
+
|
7
|
+
if t.respond_to? :jsonb
|
8
|
+
t.jsonb :subscriptions
|
9
|
+
else
|
10
|
+
t.json :subscriptions
|
11
|
+
end
|
12
|
+
|
13
|
+
t.timestamps
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
class EnablePolymorphicResourceOwner < ActiveRecord::Migration[5.2]
|
2
|
+
def change
|
3
|
+
add_column :spree_oauth_access_tokens, :resource_owner_type, :string
|
4
|
+
add_column :spree_oauth_access_grants, :resource_owner_type, :string
|
5
|
+
change_column_null :spree_oauth_access_grants, :resource_owner_type, false
|
6
|
+
|
7
|
+
add_index :spree_oauth_access_tokens,
|
8
|
+
[:resource_owner_id, :resource_owner_type],
|
9
|
+
name: 'polymorphic_owner_oauth_access_tokens'
|
10
|
+
|
11
|
+
add_index :spree_oauth_access_grants,
|
12
|
+
[:resource_owner_id, :resource_owner_type],
|
13
|
+
name: 'polymorphic_owner_oauth_access_grants'
|
14
|
+
|
15
|
+
Spree::OauthAccessToken.reset_column_information
|
16
|
+
Spree::OauthAccessToken.update_all(resource_owner_type: Spree.user_class)
|
17
|
+
|
18
|
+
Spree::OauthAccessGrant.reset_column_information
|
19
|
+
Spree::OauthAccessGrant.update_all(resource_owner_type: Spree.user_class)
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
class CreateSpreeWebhooksEvents < ActiveRecord::Migration[5.2]
|
2
|
+
def change
|
3
|
+
create_table :spree_webhooks_events do |t|
|
4
|
+
t.integer "execution_time"
|
5
|
+
t.string "name", null: false
|
6
|
+
t.string "request_errors"
|
7
|
+
t.string "response_code", index: true
|
8
|
+
t.belongs_to "subscriber", null: false, index: true
|
9
|
+
t.boolean "success", index: true
|
10
|
+
t.string "url", null: false
|
11
|
+
t.timestamps
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|