atkhayar-spree-dev-api 0.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/Gemfile +5 -0
- data/LICENSE +26 -0
- data/Rakefile +29 -0
- data/app/controllers/concerns/spree/api/v2/caching.rb +37 -0
- 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/product_list_includes.rb +25 -0
- data/app/controllers/concerns/spree/api/v2/storefront/metadata_controller_concern.rb +18 -0
- data/app/controllers/concerns/spree/api/v2/storefront/order_concern.rb +52 -0
- data/app/controllers/spree/api/v2/base_controller.rb +171 -0
- data/app/controllers/spree/api/v2/platform/addresses_controller.rb +19 -0
- data/app/controllers/spree/api/v2/platform/adjustments_controller.rb +19 -0
- data/app/controllers/spree/api/v2/platform/classifications_controller.rb +22 -0
- data/app/controllers/spree/api/v2/platform/cms_pages_controller.rb +19 -0
- data/app/controllers/spree/api/v2/platform/cms_sections_controller.rb +29 -0
- data/app/controllers/spree/api/v2/platform/countries_controller.rb +19 -0
- 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/firebase_controller.rb +76 -0
- data/app/controllers/spree/api/v2/platform/images_controller.rb +20 -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 +21 -0
- data/app/controllers/spree/api/v2/platform/menus_controller.rb +19 -0
- data/app/controllers/spree/api/v2/platform/option_types_controller.rb +15 -0
- data/app/controllers/spree/api/v2/platform/option_values_controller.rb +19 -0
- 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/products_controller.rb +37 -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 +146 -0
- 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/stores_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 +55 -0
- data/app/controllers/spree/api/v2/platform/users_controller.rb +32 -0
- data/app/controllers/spree/api/v2/platform/users_resource_controller.rb +144 -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 +76 -0
- data/app/controllers/spree/api/v2/storefront/account/addresses_controller.rb +77 -0
- data/app/controllers/spree/api/v2/storefront/account/credit_cards_controller.rb +52 -0
- data/app/controllers/spree/api/v2/storefront/account/orders_controller.rb +50 -0
- data/app/controllers/spree/api/v2/storefront/account_controller.rb +52 -0
- data/app/controllers/spree/api/v2/storefront/cart_controller.rb +245 -0
- data/app/controllers/spree/api/v2/storefront/checkout_controller.rb +160 -0
- data/app/controllers/spree/api/v2/storefront/cms_pages_controller.rb +41 -0
- data/app/controllers/spree/api/v2/storefront/countries_controller.rb +57 -0
- data/app/controllers/spree/api/v2/storefront/digitals_controller.rb +58 -0
- data/app/controllers/spree/api/v2/storefront/menus_controller.rb +35 -0
- data/app/controllers/spree/api/v2/storefront/order_status_controller.rb +34 -0
- data/app/controllers/spree/api/v2/storefront/products_controller.rb +61 -0
- data/app/controllers/spree/api/v2/storefront/stores_controller.rb +27 -0
- data/app/controllers/spree/api/v2/storefront/taxons_controller.rb +50 -0
- data/app/controllers/spree/api/v2/storefront/wishlists_controller.rb +171 -0
- data/app/helpers/spree/api/v2/collection_options_helpers.rb +46 -0
- data/app/helpers/spree/api/v2/display_money_helper.rb +43 -0
- data/app/helpers/spree/api/v2/store_media_serializer_images_concern.rb +35 -0
- data/app/jobs/spree/webhooks/subscribers/make_request_job.rb +17 -0
- data/app/models/concerns/spree/user_api_authentication.rb +19 -0
- data/app/models/concerns/spree/user_api_methods.rb +7 -0
- data/app/models/concerns/spree/webhooks/has_webhooks.rb +84 -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 +46 -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 +61 -0
- data/app/presenters/spree/api/products/filters_presenter.rb +39 -0
- data/app/serializers/concerns/spree/api/v2/image_transformation_concern.rb +15 -0
- data/app/serializers/concerns/spree/api/v2/resource_serializer_concern.rb +34 -0
- data/app/serializers/concerns/spree/api/v2/taxon_image_transformation_concern.rb +15 -0
- data/app/serializers/spree/api/v2/base_serializer.rb +39 -0
- data/app/serializers/spree/api/v2/platform/address_serializer.rb +15 -0
- 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/base_serializer.rb +10 -0
- data/app/serializers/spree/api/v2/platform/calculator_serializer.rb +17 -0
- data/app/serializers/spree/api/v2/platform/classification_serializer.rb +14 -0
- data/app/serializers/spree/api/v2/platform/cms_page_serializer.rb +13 -0
- data/app/serializers/spree/api/v2/platform/cms_section_image_one_serializer.rb +9 -0
- data/app/serializers/spree/api/v2/platform/cms_section_image_three_serializer.rb +9 -0
- data/app/serializers/spree/api/v2/platform/cms_section_image_two_serializer.rb +9 -0
- data/app/serializers/spree/api/v2/platform/cms_section_serializer.rb +18 -0
- data/app/serializers/spree/api/v2/platform/country_serializer.rb +13 -0
- 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/hero_image_serializer.rb +10 -0
- data/app/serializers/spree/api/v2/platform/homepage_serializer.rb +11 -0
- data/app/serializers/spree/api/v2/platform/icon_serializer.rb +16 -0
- data/app/serializers/spree/api/v2/platform/image_gallery_serializer.rb +10 -0
- data/app/serializers/spree/api/v2/platform/image_serializer.rb +17 -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 +45 -0
- data/app/serializers/spree/api/v2/platform/menu_serializer.rb +13 -0
- data/app/serializers/spree/api/v2/platform/option_type_serializer.rb +13 -0
- data/app/serializers/spree/api/v2/platform/option_value_serializer.rb +13 -0
- 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 +11 -0
- data/app/serializers/spree/api/v2/platform/product_serializer.rb +82 -0
- 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/side_by_side_image_serializer.rb +10 -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 +13 -0
- data/app/serializers/spree/api/v2/platform/stock_item_serializer.rb +18 -0
- data/app/serializers/spree/api/v2/platform/stock_location_serializer.rb +14 -0
- 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 +15 -0
- data/app/serializers/spree/api/v2/platform/tax_category_serializer.rb +13 -0
- data/app/serializers/spree/api/v2/platform/tax_rate_serializer.rb +14 -0
- data/app/serializers/spree/api/v2/platform/taxon_image_serializer.rb +15 -0
- data/app/serializers/spree/api/v2/platform/taxon_serializer.rb +38 -0
- data/app/serializers/spree/api/v2/platform/taxonomy_serializer.rb +14 -0
- data/app/serializers/spree/api/v2/platform/user_serializer.rb +39 -0
- data/app/serializers/spree/api/v2/platform/variant_serializer.rb +58 -0
- 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 +20 -0
- data/app/serializers/spree/v2/storefront/base_serializer.rb +10 -0
- data/app/serializers/spree/v2/storefront/cart_serializer.rb +36 -0
- data/app/serializers/spree/v2/storefront/cms_page_serializer.rb +14 -0
- data/app/serializers/spree/v2/storefront/cms_section_serializer.rb +32 -0
- data/app/serializers/spree/v2/storefront/country_serializer.rb +24 -0
- data/app/serializers/spree/v2/storefront/credit_card_serializer.rb +13 -0
- data/app/serializers/spree/v2/storefront/digital_link_serializer.rb +11 -0
- data/app/serializers/spree/v2/storefront/estimated_shipping_rate_serializer.rb +29 -0
- data/app/serializers/spree/v2/storefront/icon_serializer.rb +14 -0
- data/app/serializers/spree/v2/storefront/image_serializer.rb +13 -0
- data/app/serializers/spree/v2/storefront/line_item_serializer.rb +20 -0
- data/app/serializers/spree/v2/storefront/menu_item_serializer.rb +43 -0
- data/app/serializers/spree/v2/storefront/menu_serializer.rb +13 -0
- data/app/serializers/spree/v2/storefront/option_type_serializer.rb +13 -0
- data/app/serializers/spree/v2/storefront/option_value_serializer.rb +13 -0
- data/app/serializers/spree/v2/storefront/order_serializer.rb +9 -0
- data/app/serializers/spree/v2/storefront/payment_method_serializer.rb +15 -0
- data/app/serializers/spree/v2/storefront/payment_serializer.rb +15 -0
- data/app/serializers/spree/v2/storefront/product_property_serializer.rb +19 -0
- data/app/serializers/spree/v2/storefront/product_serializer.rb +76 -0
- data/app/serializers/spree/v2/storefront/promotion_serializer.rb +12 -0
- data/app/serializers/spree/v2/storefront/shipment_serializer.rb +24 -0
- data/app/serializers/spree/v2/storefront/shipping_rate_serializer.rb +16 -0
- data/app/serializers/spree/v2/storefront/state_serializer.rb +11 -0
- data/app/serializers/spree/v2/storefront/stock_location_serializer.rb +11 -0
- data/app/serializers/spree/v2/storefront/store_credit_category_serializer.rb +11 -0
- data/app/serializers/spree/v2/storefront/store_credit_event_serializer.rb +15 -0
- data/app/serializers/spree/v2/storefront/store_credit_serializer.rb +17 -0
- data/app/serializers/spree/v2/storefront/store_credit_type_serializer.rb +11 -0
- data/app/serializers/spree/v2/storefront/store_serializer.rb +20 -0
- data/app/serializers/spree/v2/storefront/taxon_image_serializer.rb +13 -0
- data/app/serializers/spree/v2/storefront/taxon_serializer.rb +37 -0
- data/app/serializers/spree/v2/storefront/taxonomy_serializer.rb +11 -0
- data/app/serializers/spree/v2/storefront/user_serializer.rb +31 -0
- data/app/serializers/spree/v2/storefront/variant_serializer.rb +49 -0
- 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/api/error_handler.rb +40 -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 +23 -0
- data/app/services/spree/webhooks.rb +13 -0
- data/config/i18n-tasks.yml +40 -0
- data/config/initializers/doorkeeper.rb +48 -0
- data/config/initializers/json_api_mime_types.rb +8 -0
- data/config/initializers/user_class_extensions.rb +7 -0
- data/config/locales/en.yml +38 -0
- data/config/routes.rb +214 -0
- data/db/migrate/20100107141738_add_api_key_to_spree_users.rb +7 -0
- data/db/migrate/20120411123334_resize_api_key_field.rb +7 -0
- data/db/migrate/20120530054546_rename_api_key_to_spree_api_key.rb +7 -0
- data/db/migrate/20131017162334_add_index_to_user_spree_api_key.rb +7 -0
- data/db/migrate/20180320110726_create_doorkeeper_tables.rb +69 -0
- data/db/migrate/20210727102516_change_integer_id_columns_type.rb +9 -0
- 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 +233 -0
- data/docs/v2/platform/index.yaml +21111 -0
- data/docs/v2/storefront/index.yaml +16504 -0
- data/lib/spree/api/configuration.rb +11 -0
- data/lib/spree/api/dependencies.rb +165 -0
- data/lib/spree/api/engine.rb +34 -0
- data/lib/spree/api/testing_support/caching.rb +10 -0
- 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/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 +13 -0
- data/lib/spree/api/testing_support/v2/current_order.rb +112 -0
- data/lib/spree/api/testing_support/v2/platform_contexts.rb +273 -0
- data/lib/spree/api/testing_support/v2/serializers_params.rb +16 -0
- data/lib/spree/api.rb +8 -0
- data/lib/spree_api.rb +3 -0
- data/script/rails +9 -0
- data/spec/fixtures/files/icon_256x256.jpg +0 -0
- data/spec/fixtures/thinking-cat.jpg +0 -0
- data/spree_api.gemspec +35 -0
- metadata +427 -0
@@ -0,0 +1,29 @@
|
|
1
|
+
module Spree
|
2
|
+
module V2
|
3
|
+
module Storefront
|
4
|
+
class WishedItemSerializer < BaseSerializer
|
5
|
+
set_type :wished_item
|
6
|
+
|
7
|
+
attributes :quantity
|
8
|
+
|
9
|
+
attribute :price do |wished_item, params|
|
10
|
+
wished_item.price(currency: params[:currency])
|
11
|
+
end
|
12
|
+
|
13
|
+
attribute :total do |wished_item, params|
|
14
|
+
wished_item.total(currency: params[:currency])
|
15
|
+
end
|
16
|
+
|
17
|
+
attribute :display_price do |wished_item, params|
|
18
|
+
wished_item.display_price(currency: params[:currency]).to_s
|
19
|
+
end
|
20
|
+
|
21
|
+
attribute :display_total do |wished_item, params|
|
22
|
+
wished_item.display_total(currency: params[:currency]).to_s
|
23
|
+
end
|
24
|
+
|
25
|
+
belongs_to :variant
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Spree
|
2
|
+
module V2
|
3
|
+
module Storefront
|
4
|
+
class WishlistSerializer < BaseSerializer
|
5
|
+
set_type :wishlist
|
6
|
+
|
7
|
+
attributes :token, :name, :is_private, :is_default
|
8
|
+
|
9
|
+
attribute :variant_included do |wishlist, params|
|
10
|
+
wishlist.include?(params[:is_variant_included])
|
11
|
+
end
|
12
|
+
|
13
|
+
has_many :wished_items
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
module Spree
|
2
|
+
module Api
|
3
|
+
class ErrorHandler
|
4
|
+
prepend ::Spree::ServiceModule::Base
|
5
|
+
|
6
|
+
def call(exception:, opts: {})
|
7
|
+
run :format_message
|
8
|
+
run :log_error
|
9
|
+
run :report_error
|
10
|
+
end
|
11
|
+
|
12
|
+
protected
|
13
|
+
|
14
|
+
def format_message(exception:, opts:)
|
15
|
+
message = if exception.respond_to?(:original_message)
|
16
|
+
exception.original_message
|
17
|
+
else
|
18
|
+
exception.message
|
19
|
+
end
|
20
|
+
|
21
|
+
success(exception: exception, message: message, opts: opts)
|
22
|
+
end
|
23
|
+
|
24
|
+
def log_error(exception:, message:, opts:)
|
25
|
+
Rails.logger.error message
|
26
|
+
Rails.logger.error "User ID: #{opts[:user]&.id}" if opts[:user]
|
27
|
+
Rails.logger.error exception.backtrace.join("\n")
|
28
|
+
|
29
|
+
success(exception: exception, message: message, opts: opts)
|
30
|
+
end
|
31
|
+
|
32
|
+
def report_error(exception:, message:, opts:)
|
33
|
+
# overwrite this method in your application to support different error handlers
|
34
|
+
# eg. Sentry, Rollbar, etc
|
35
|
+
|
36
|
+
success(exception: exception, message: message)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,73 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Spree
|
4
|
+
module Webhooks
|
5
|
+
module Subscribers
|
6
|
+
class HandleRequest
|
7
|
+
def initialize(event_name:, subscriber:, webhook_payload_body:)
|
8
|
+
@event_name = event_name
|
9
|
+
@subscriber = subscriber
|
10
|
+
@webhook_payload_body = JSON.parse(webhook_payload_body)
|
11
|
+
end
|
12
|
+
|
13
|
+
def call
|
14
|
+
Rails.logger.debug(msg("sending to '#{url}'"))
|
15
|
+
Rails.logger.debug(msg("webhook_payload_body: #{body_with_event_metadata}"))
|
16
|
+
|
17
|
+
if request.unprocessable_uri?
|
18
|
+
return process(:warn, msg("can not make a request to '#{url}'"))
|
19
|
+
end
|
20
|
+
return process(:warn, msg("failed for '#{url}'")) if request.failed_request?
|
21
|
+
|
22
|
+
process(:debug, msg("success for URL '#{url}'"))
|
23
|
+
end
|
24
|
+
|
25
|
+
private
|
26
|
+
|
27
|
+
attr_reader :webhook_payload_body, :event_name, :subscriber
|
28
|
+
|
29
|
+
delegate :execution_time, :failed_request?, :response_code, :success?, :unprocessable_uri?, to: :request
|
30
|
+
delegate :id, :url, to: :subscriber
|
31
|
+
delegate :created_at, :id, to: :event, prefix: true
|
32
|
+
|
33
|
+
def process(log_level, msg)
|
34
|
+
Rails.logger.public_send(log_level, msg)
|
35
|
+
make_request
|
36
|
+
update_event(msg)
|
37
|
+
nil
|
38
|
+
end
|
39
|
+
|
40
|
+
def request
|
41
|
+
@request ||=
|
42
|
+
Spree::Webhooks::Subscribers::MakeRequest.new(webhook_payload_body: body_with_event_metadata, url: url)
|
43
|
+
end
|
44
|
+
alias make_request request
|
45
|
+
|
46
|
+
def body_with_event_metadata
|
47
|
+
webhook_payload_body.
|
48
|
+
merge(event_created_at: event_created_at, event_id: event_id, event_type: event.name).
|
49
|
+
to_json
|
50
|
+
end
|
51
|
+
|
52
|
+
def event
|
53
|
+
@event ||= Spree::Webhooks::Event.create!(
|
54
|
+
name: event_name, subscriber_id: subscriber.id, url: url
|
55
|
+
)
|
56
|
+
end
|
57
|
+
|
58
|
+
def update_event(msg)
|
59
|
+
event.update(
|
60
|
+
execution_time: execution_time,
|
61
|
+
request_errors: msg,
|
62
|
+
response_code: response_code,
|
63
|
+
success: success?
|
64
|
+
)
|
65
|
+
end
|
66
|
+
|
67
|
+
def msg(msg)
|
68
|
+
"[SPREE WEBHOOKS] '#{event_name}' #{msg}"
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
@@ -0,0 +1,82 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Spree
|
4
|
+
module Webhooks
|
5
|
+
module Subscribers
|
6
|
+
class MakeRequest
|
7
|
+
def initialize(url:, webhook_payload_body:)
|
8
|
+
@execution_time_in_milliseconds = 0
|
9
|
+
@url = url
|
10
|
+
@webhook_payload_body = webhook_payload_body
|
11
|
+
@webhooks_timeout = ENV['SPREE_WEBHOOKS_TIMEOUT']
|
12
|
+
end
|
13
|
+
|
14
|
+
def execution_time
|
15
|
+
request
|
16
|
+
@execution_time_in_milliseconds
|
17
|
+
end
|
18
|
+
|
19
|
+
def failed_request?
|
20
|
+
(200...300).exclude?(response_code)
|
21
|
+
end
|
22
|
+
|
23
|
+
def response_code
|
24
|
+
request.code.to_i
|
25
|
+
end
|
26
|
+
|
27
|
+
def success?
|
28
|
+
!unprocessable_uri? && !failed_request?
|
29
|
+
end
|
30
|
+
|
31
|
+
def unprocessable_uri?
|
32
|
+
uri_path == '' && uri_host.nil? && uri_port.nil?
|
33
|
+
end
|
34
|
+
|
35
|
+
private
|
36
|
+
|
37
|
+
attr_reader :execution_time_in_milliseconds, :url, :webhook_payload_body, :webhooks_timeout
|
38
|
+
|
39
|
+
HEADERS = { 'Content-Type' => 'application/json' }.freeze
|
40
|
+
private_constant :HEADERS
|
41
|
+
|
42
|
+
delegate :host, :path, :port, to: :uri, prefix: true
|
43
|
+
|
44
|
+
def http
|
45
|
+
http = Net::HTTP.new(uri_host, uri_port)
|
46
|
+
http.read_timeout = webhooks_timeout.to_i if custom_read_timeout?
|
47
|
+
http.use_ssl = true if use_ssl?
|
48
|
+
http
|
49
|
+
end
|
50
|
+
|
51
|
+
def request
|
52
|
+
req = Net::HTTP::Post.new(uri_path, HEADERS)
|
53
|
+
req.body = webhook_payload_body
|
54
|
+
@request ||= begin
|
55
|
+
start_time = Process.clock_gettime(Process::CLOCK_MONOTONIC)
|
56
|
+
request_result = http.request(req)
|
57
|
+
@execution_time_in_milliseconds = (Process.clock_gettime(Process::CLOCK_MONOTONIC) - start_time).in_milliseconds
|
58
|
+
request_result
|
59
|
+
end
|
60
|
+
rescue Errno::ECONNREFUSED, Net::ReadTimeout, SocketError
|
61
|
+
Class.new do
|
62
|
+
def self.code
|
63
|
+
'0'
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
def custom_read_timeout?
|
69
|
+
webhooks_timeout.present?
|
70
|
+
end
|
71
|
+
|
72
|
+
def use_ssl?
|
73
|
+
!(Rails.env.development? || Rails.env.test?)
|
74
|
+
end
|
75
|
+
|
76
|
+
def uri
|
77
|
+
URI(url)
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module Spree
|
2
|
+
module Webhooks
|
3
|
+
module Subscribers
|
4
|
+
class QueueRequests
|
5
|
+
prepend Spree::ServiceModule::Base
|
6
|
+
|
7
|
+
def call(event_name:, webhook_payload_body:, **options)
|
8
|
+
filtered_subscribers(event_name, webhook_payload_body, options).each do |subscriber|
|
9
|
+
Spree::Webhooks::Subscribers::MakeRequestJob.perform_later(
|
10
|
+
webhook_payload_body, event_name, subscriber
|
11
|
+
)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
private
|
16
|
+
|
17
|
+
def filtered_subscribers(event_name, _, _)
|
18
|
+
Spree::Webhooks::Subscriber.active.with_urls_for(event_name)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module Spree
|
2
|
+
module Webhooks
|
3
|
+
def self.disable_webhooks
|
4
|
+
webhooks_disabled_previously = ENV['DISABLE_SPREE_WEBHOOKS']
|
5
|
+
begin
|
6
|
+
ENV['DISABLE_SPREE_WEBHOOKS'] = 'true'
|
7
|
+
yield
|
8
|
+
ensure
|
9
|
+
ENV['DISABLE_SPREE_WEBHOOKS'] = webhooks_disabled_previously
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -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}']] %>
|
@@ -0,0 +1,48 @@
|
|
1
|
+
Doorkeeper.configure do
|
2
|
+
orm :active_record
|
3
|
+
use_refresh_token
|
4
|
+
api_only
|
5
|
+
base_controller 'Spree::Api::V2::BaseController'
|
6
|
+
base_metal_controller 'Spree::Api::V2::BaseController'
|
7
|
+
|
8
|
+
# FIXME: we should only skip this for Storefront API until v5
|
9
|
+
# we should not skip this for Platform API
|
10
|
+
skip_client_authentication_for_password_grant { true } if defined?(skip_client_authentication_for_password_grant)
|
11
|
+
|
12
|
+
resource_owner_authenticator { current_spree_user }
|
13
|
+
use_polymorphic_resource_owner
|
14
|
+
|
15
|
+
resource_owner_from_credentials do
|
16
|
+
user = Spree.user_class.find_for_database_authentication(email: params[:username])
|
17
|
+
|
18
|
+
next if user.nil?
|
19
|
+
|
20
|
+
if defined?(Spree::Auth::Config) && Spree::Auth::Config[:confirmable] == true
|
21
|
+
user if user.active_for_authentication? && user.valid_for_authentication? { user.valid_password?(params[:password]) }
|
22
|
+
elsif user&.valid_for_authentication? { user.valid_password?(params[:password]) }
|
23
|
+
user
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
admin_authenticator do |routes|
|
28
|
+
current_spree_user&.spree_admin? || redirect_to(routes.root_url)
|
29
|
+
end
|
30
|
+
|
31
|
+
grant_flows %w[password client_credentials]
|
32
|
+
|
33
|
+
allow_blank_redirect_uri true
|
34
|
+
|
35
|
+
handle_auth_errors :raise
|
36
|
+
|
37
|
+
access_token_methods :from_bearer_authorization, :from_access_token_param
|
38
|
+
|
39
|
+
optional_scopes :admin, :write, :read
|
40
|
+
|
41
|
+
access_token_class 'Spree::OauthAccessToken'
|
42
|
+
access_grant_class 'Spree::OauthAccessGrant'
|
43
|
+
application_class 'Spree::OauthApplication'
|
44
|
+
|
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
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
---
|
2
|
+
en:
|
3
|
+
spree:
|
4
|
+
api:
|
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
|
11
|
+
order:
|
12
|
+
could_not_transition: The order could not be transitioned. Please fix the errors and try again.
|
13
|
+
insufficient_quantity: An item in your cart has become unavailable.
|
14
|
+
invalid_shipping_method: Invalid shipping method specified.
|
15
|
+
payment:
|
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.
|
19
|
+
shipment:
|
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.
|
25
|
+
v2:
|
26
|
+
cart:
|
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
ADDED
@@ -0,0 +1,214 @@
|
|
1
|
+
spree_path = Rails.application.routes.url_helpers.try(:spree_path, trailing_slash: true) || '/'
|
2
|
+
|
3
|
+
Rails.application.routes.draw do
|
4
|
+
use_doorkeeper scope: "#{spree_path}/spree_oauth"
|
5
|
+
end
|
6
|
+
|
7
|
+
Spree::Core::Engine.add_routes do
|
8
|
+
namespace :api, defaults: { format: 'json' } do
|
9
|
+
namespace :v2 do
|
10
|
+
namespace :storefront do
|
11
|
+
resource :cart, controller: :cart, only: %i[show create destroy] do
|
12
|
+
post :add_item
|
13
|
+
patch :empty
|
14
|
+
delete 'remove_line_item/:line_item_id', to: 'cart#remove_line_item', as: :cart_remove_line_item
|
15
|
+
patch :set_quantity
|
16
|
+
patch :apply_coupon_code
|
17
|
+
delete 'remove_coupon_code/:coupon_code', to: 'cart#remove_coupon_code', as: :cart_remove_coupon_code
|
18
|
+
delete 'remove_coupon_code', to: 'cart#remove_coupon_code', as: :cart_remove_coupon_code_without_code
|
19
|
+
get :estimate_shipping_rates
|
20
|
+
patch :associate
|
21
|
+
patch :change_currency
|
22
|
+
end
|
23
|
+
|
24
|
+
resource :checkout, controller: :checkout, only: %i[update] do
|
25
|
+
patch :next
|
26
|
+
patch :advance
|
27
|
+
patch :complete
|
28
|
+
post :create_payment
|
29
|
+
post :add_store_credit
|
30
|
+
post :remove_store_credit
|
31
|
+
get :payment_methods
|
32
|
+
get :shipping_rates
|
33
|
+
patch :select_shipping_method
|
34
|
+
end
|
35
|
+
|
36
|
+
resource :account, controller: :account, only: %i[show create update]
|
37
|
+
|
38
|
+
namespace :account do
|
39
|
+
resources :addresses, controller: :addresses
|
40
|
+
resources :credit_cards, controller: :credit_cards, only: %i[index show destroy]
|
41
|
+
resources :orders, controller: :orders, only: %i[index show]
|
42
|
+
end
|
43
|
+
|
44
|
+
resources :countries, only: %i[index]
|
45
|
+
get '/countries/:iso', to: 'countries#show', as: :country
|
46
|
+
get '/order_status/:number', to: 'order_status#show', as: :order_status
|
47
|
+
resources :products, only: %i[index show]
|
48
|
+
resources :taxons, only: %i[index show], id: /.+/
|
49
|
+
get '/stores/:code', to: 'stores#show', as: :store
|
50
|
+
get '/store', to: 'stores#current', as: :current_store
|
51
|
+
|
52
|
+
resources :menus, only: %i[index show]
|
53
|
+
resources :cms_pages, only: %i[index show]
|
54
|
+
|
55
|
+
resources :wishlists do
|
56
|
+
get :default, on: :collection
|
57
|
+
|
58
|
+
member do
|
59
|
+
post :add_item
|
60
|
+
patch 'set_item_quantity/:item_id', to: 'wishlists#set_item_quantity', as: :set_item_quantity
|
61
|
+
delete 'remove_item/:item_id', to: 'wishlists#remove_item', as: :remove_item
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
get '/digitals/:token', to: 'digitals#download', as: 'digital'
|
66
|
+
end
|
67
|
+
|
68
|
+
namespace :platform do
|
69
|
+
# Promotions API
|
70
|
+
resources :promotions
|
71
|
+
resources :promotion_actions
|
72
|
+
resources :promotion_categories
|
73
|
+
resources :promotion_rules
|
74
|
+
|
75
|
+
# Returns API
|
76
|
+
resources :customer_returns
|
77
|
+
resources :reimbursements
|
78
|
+
resources :return_authorizations do
|
79
|
+
member do
|
80
|
+
patch :add
|
81
|
+
patch :cancel
|
82
|
+
patch :receive
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
# Product Catalog API
|
87
|
+
resources :products
|
88
|
+
resources :taxonomies
|
89
|
+
resources :taxons do
|
90
|
+
member do
|
91
|
+
patch :reposition
|
92
|
+
end
|
93
|
+
end
|
94
|
+
resources :classifications
|
95
|
+
resources :images
|
96
|
+
resources :variants
|
97
|
+
resources :properties
|
98
|
+
resources :product_properties
|
99
|
+
resources :option_types
|
100
|
+
resources :option_values
|
101
|
+
|
102
|
+
# Order API
|
103
|
+
resources :orders do
|
104
|
+
member do
|
105
|
+
patch :next
|
106
|
+
patch :advance
|
107
|
+
patch :approve
|
108
|
+
patch :cancel
|
109
|
+
patch :empty
|
110
|
+
patch :apply_coupon_code
|
111
|
+
patch :complete
|
112
|
+
patch :use_store_credit
|
113
|
+
patch :cancel
|
114
|
+
patch :approve
|
115
|
+
end
|
116
|
+
end
|
117
|
+
resources :line_items
|
118
|
+
resources :adjustments
|
119
|
+
|
120
|
+
# Payments API
|
121
|
+
resources :payments do
|
122
|
+
# TODO: support custom actions
|
123
|
+
# member do
|
124
|
+
# patch :authorize
|
125
|
+
# patch :capture
|
126
|
+
# patch :purchase
|
127
|
+
# patch :void
|
128
|
+
# patch :credit
|
129
|
+
# end
|
130
|
+
end
|
131
|
+
|
132
|
+
# Store Credit API
|
133
|
+
resources :store_credits
|
134
|
+
resources :store_credit_categories
|
135
|
+
resources :store_credit_types
|
136
|
+
|
137
|
+
# Geo API
|
138
|
+
resources :zones
|
139
|
+
resources :countries, only: [:index, :show]
|
140
|
+
resources :states, only: [:index, :show]
|
141
|
+
|
142
|
+
# Shipment API
|
143
|
+
resources :shipments do
|
144
|
+
member do
|
145
|
+
%w[ready ship cancel resume pend].each do |state|
|
146
|
+
patch state.to_sym
|
147
|
+
end
|
148
|
+
patch :add_item
|
149
|
+
patch :remove_item
|
150
|
+
patch :transfer_to_location
|
151
|
+
patch :transfer_to_shipment
|
152
|
+
end
|
153
|
+
end
|
154
|
+
|
155
|
+
# Tax API
|
156
|
+
resources :tax_rates
|
157
|
+
resources :tax_categories
|
158
|
+
|
159
|
+
# Inventory API
|
160
|
+
resources :inventory_units
|
161
|
+
resources :stock_items
|
162
|
+
resources :stock_locations
|
163
|
+
resources :stock_movements
|
164
|
+
|
165
|
+
# User API
|
166
|
+
resources :users
|
167
|
+
resources :credit_cards
|
168
|
+
resources :addresses
|
169
|
+
|
170
|
+
resources :roles
|
171
|
+
|
172
|
+
# Menu API
|
173
|
+
resources :menus
|
174
|
+
resources :menu_items do
|
175
|
+
member do
|
176
|
+
patch :reposition
|
177
|
+
end
|
178
|
+
end
|
179
|
+
|
180
|
+
# CMS
|
181
|
+
resources :cms_pages
|
182
|
+
resources :cms_sections
|
183
|
+
|
184
|
+
# Wishlists API
|
185
|
+
resources :wishlists
|
186
|
+
resources :wished_items
|
187
|
+
|
188
|
+
# Digitals API
|
189
|
+
resources :digitals
|
190
|
+
resources :digital_links do
|
191
|
+
member do
|
192
|
+
patch :reset
|
193
|
+
end
|
194
|
+
end
|
195
|
+
|
196
|
+
# Store API
|
197
|
+
resources :stores
|
198
|
+
|
199
|
+
# Configurations API
|
200
|
+
resources :payment_methods
|
201
|
+
resources :shipping_categories
|
202
|
+
resources :shipping_methods
|
203
|
+
|
204
|
+
# Webhooks API
|
205
|
+
namespace :webhooks do
|
206
|
+
resources :events, only: :index
|
207
|
+
resources :subscribers
|
208
|
+
end
|
209
|
+
|
210
|
+
post "/firebase", to: "firebase#firebase_login"
|
211
|
+
end
|
212
|
+
end
|
213
|
+
end
|
214
|
+
end
|