spree_api 6.0.0.rc1 → 6.0.0.rc2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Rakefile +0 -17
- data/app/controllers/concerns/spree/api/v3/admin/product_membership.rb +10 -0
- data/app/controllers/concerns/spree/api/v3/admin/stock_receipt_actions.rb +26 -4
- data/app/controllers/concerns/spree/api/v3/admin/subclassed_resource.rb +14 -28
- data/app/controllers/concerns/spree/api/v3/admin/validation_details.rb +1 -1
- data/app/controllers/concerns/spree/api/v3/cart_resolvable.rb +3 -2
- data/app/controllers/concerns/spree/api/v3/channel_resolution.rb +1 -1
- data/app/controllers/concerns/spree/api/v3/company_address_writes.rb +3 -1
- data/app/controllers/concerns/spree/api/v3/error_handler.rb +48 -2
- data/app/controllers/concerns/spree/api/v3/file_uploads.rb +35 -0
- data/app/controllers/concerns/spree/api/v3/money_params.rb +52 -0
- data/app/controllers/concerns/spree/api/v3/orders/claim_actions.rb +1 -5
- data/app/controllers/concerns/spree/api/v3/orders/delivery_actions.rb +6 -6
- data/app/controllers/concerns/spree/api/v3/orders/exchange_actions.rb +1 -4
- data/app/controllers/concerns/spree/api/v3/orders/fulfillment_actions.rb +1 -5
- data/app/controllers/concerns/spree/api/v3/orders/return_actions.rb +1 -4
- data/app/controllers/concerns/spree/api/v3/orders/shipping_label_actions.rb +5 -21
- data/app/controllers/concerns/spree/api/v3/params_normalizer.rb +5 -0
- data/app/controllers/concerns/spree/api/v3/purchase_serialization.rb +26 -0
- data/app/controllers/concerns/spree/api/v3/request_params.rb +65 -0
- data/app/controllers/concerns/spree/api/v3/strict_money_params.rb +94 -0
- data/app/controllers/spree/api/v3/admin/admin_users_controller.rb +10 -1
- data/app/controllers/spree/api/v3/admin/allowed_origins_controller.rb +8 -1
- data/app/controllers/spree/api/v3/admin/api_keys_controller.rb +15 -7
- data/app/controllers/spree/api/v3/admin/base_controller.rb +1 -0
- data/app/controllers/spree/api/v3/admin/catalogs/order_minimums_controller.rb +3 -1
- data/app/controllers/spree/api/v3/admin/catalogs/quantity_rules_controller.rb +7 -5
- data/app/controllers/spree/api/v3/admin/catalogs_controller.rb +60 -33
- data/app/controllers/spree/api/v3/admin/categories/products_controller.rb +4 -1
- data/app/controllers/spree/api/v3/admin/categories_controller.rb +40 -20
- data/app/controllers/spree/api/v3/admin/channels_controller.rb +39 -6
- data/app/controllers/spree/api/v3/admin/claim_reasons_controller.rb +5 -1
- data/app/controllers/spree/api/v3/admin/collections/products_controller.rb +4 -1
- data/app/controllers/spree/api/v3/admin/collections_controller.rb +44 -15
- data/app/controllers/spree/api/v3/admin/commission_rates_controller.rb +60 -12
- data/app/controllers/spree/api/v3/admin/companies/addresses_controller.rb +11 -0
- data/app/controllers/spree/api/v3/admin/companies/memberships_controller.rb +9 -1
- data/app/controllers/spree/api/v3/admin/companies/tax_exemption_certificates_controller.rb +19 -18
- data/app/controllers/spree/api/v3/admin/companies/tax_identifiers_controller.rb +6 -1
- data/app/controllers/spree/api/v3/admin/companies_controller.rb +17 -3
- data/app/controllers/spree/api/v3/admin/countries_controller.rb +5 -1
- data/app/controllers/spree/api/v3/admin/custom_field_definitions_controller.rb +21 -11
- data/app/controllers/spree/api/v3/admin/custom_fields_controller.rb +12 -5
- data/app/controllers/spree/api/v3/admin/customer_groups_controller.rb +9 -1
- data/app/controllers/spree/api/v3/admin/customers/addresses_controller.rb +12 -7
- data/app/controllers/spree/api/v3/admin/customers/store_credits_controller.rb +11 -9
- data/app/controllers/spree/api/v3/admin/customers/tax_identifiers_controller.rb +6 -1
- data/app/controllers/spree/api/v3/admin/customers_controller.rb +35 -7
- data/app/controllers/spree/api/v3/admin/data_requests_controller.rb +8 -0
- data/app/controllers/spree/api/v3/admin/delivery_method_rules_controller.rb +1 -1
- data/app/controllers/spree/api/v3/admin/delivery_methods/rules_controller.rb +15 -7
- data/app/controllers/spree/api/v3/admin/delivery_methods_controller.rb +92 -57
- data/app/controllers/spree/api/v3/admin/delivery_profiles/origin_groups_controller.rb +8 -1
- data/app/controllers/spree/api/v3/admin/delivery_profiles_controller.rb +13 -1
- data/app/controllers/spree/api/v3/admin/delivery_zones_controller.rb +21 -5
- data/app/controllers/spree/api/v3/admin/email_templates/drafts_controller.rb +14 -1
- data/app/controllers/spree/api/v3/admin/email_templates/previews_controller.rb +4 -0
- data/app/controllers/spree/api/v3/admin/email_templates/publications_controller.rb +7 -0
- data/app/controllers/spree/api/v3/admin/email_templates/restorations_controller.rb +8 -0
- data/app/controllers/spree/api/v3/admin/email_templates/test_emails_controller.rb +4 -0
- data/app/controllers/spree/api/v3/admin/exports_controller.rb +23 -6
- data/app/controllers/spree/api/v3/admin/files_controller.rb +29 -0
- data/app/controllers/spree/api/v3/admin/gift_card_batches_controller.rb +20 -1
- data/app/controllers/spree/api/v3/admin/gift_cards_controller.rb +19 -1
- data/app/controllers/spree/api/v3/admin/imports_controller.rb +36 -9
- data/app/controllers/spree/api/v3/admin/integrations_controller.rb +13 -1
- data/app/controllers/spree/api/v3/admin/invitation_acceptances_controller.rb +9 -2
- data/app/controllers/spree/api/v3/admin/invitations_controller.rb +8 -1
- data/app/controllers/spree/api/v3/admin/locales_controller.rb +1 -1
- data/app/controllers/spree/api/v3/admin/markets_controller.rb +30 -9
- data/app/controllers/spree/api/v3/admin/me_controller.rb +12 -3
- data/app/controllers/spree/api/v3/admin/media_controller.rb +22 -9
- data/app/controllers/spree/api/v3/admin/media_library_controller.rb +4 -0
- data/app/controllers/spree/api/v3/admin/option_types_controller.rb +24 -7
- data/app/controllers/spree/api/v3/admin/order_cancellation_reasons_controller.rb +5 -1
- data/app/controllers/spree/api/v3/admin/order_routing_rules_controller.rb +13 -1
- data/app/controllers/spree/api/v3/admin/orders/claims_controller.rb +39 -1
- data/app/controllers/spree/api/v3/admin/orders/deliveries_controller.rb +19 -1
- data/app/controllers/spree/api/v3/admin/orders/discount_codes_controller.rb +5 -1
- data/app/controllers/spree/api/v3/admin/orders/discounts_controller.rb +29 -5
- data/app/controllers/spree/api/v3/admin/orders/exchanges_controller.rb +36 -1
- data/app/controllers/spree/api/v3/admin/orders/fees_controller.rb +22 -1
- data/app/controllers/spree/api/v3/admin/orders/fulfillments_controller.rb +66 -7
- data/app/controllers/spree/api/v3/admin/orders/gift_cards_controller.rb +6 -2
- data/app/controllers/spree/api/v3/admin/orders/items_controller.rb +11 -1
- data/app/controllers/spree/api/v3/admin/orders/labels_controller.rb +35 -2
- data/app/controllers/spree/api/v3/admin/orders/payments_controller.rb +16 -5
- data/app/controllers/spree/api/v3/admin/orders/refunds_controller.rb +6 -0
- data/app/controllers/spree/api/v3/admin/orders/returns_controller.rb +37 -1
- data/app/controllers/spree/api/v3/admin/orders/store_credits_controller.rb +6 -3
- data/app/controllers/spree/api/v3/admin/orders_controller.rb +74 -60
- data/app/controllers/spree/api/v3/admin/package_types_controller.rb +30 -5
- data/app/controllers/spree/api/v3/admin/password_resets_controller.rb +17 -0
- data/app/controllers/spree/api/v3/admin/payment_methods_controller.rb +38 -22
- data/app/controllers/spree/api/v3/admin/policies_controller.rb +8 -4
- data/app/controllers/spree/api/v3/admin/price_lists_controller.rb +27 -15
- data/app/controllers/spree/api/v3/admin/prices_controller.rb +51 -4
- data/app/controllers/spree/api/v3/admin/product_types_controller.rb +25 -8
- data/app/controllers/spree/api/v3/admin/products/digital_assets_controller.rb +27 -10
- data/app/controllers/spree/api/v3/admin/products/variants_controller.rb +9 -14
- data/app/controllers/spree/api/v3/admin/products_controller.rb +121 -70
- data/app/controllers/spree/api/v3/admin/promotion_actions_controller.rb +11 -2
- data/app/controllers/spree/api/v3/admin/promotion_rules_controller.rb +10 -1
- data/app/controllers/spree/api/v3/admin/promotions_controller.rb +50 -14
- data/app/controllers/spree/api/v3/admin/purchase_orders_controller.rb +54 -7
- data/app/controllers/spree/api/v3/admin/refund_reasons_controller.rb +5 -1
- data/app/controllers/spree/api/v3/admin/reporting/saved_reports_controller.rb +9 -1
- data/app/controllers/spree/api/v3/admin/reporting_controller.rb +34 -0
- data/app/controllers/spree/api/v3/admin/resource_controller.rb +1 -0
- data/app/controllers/spree/api/v3/admin/return_reasons_controller.rb +5 -1
- data/app/controllers/spree/api/v3/admin/roles_controller.rb +13 -1
- data/app/controllers/spree/api/v3/admin/seller_payouts_controller.rb +6 -0
- data/app/controllers/spree/api/v3/admin/seller_requirement_submissions_controller.rb +15 -0
- data/app/controllers/spree/api/v3/admin/seller_requirements_controller.rb +32 -6
- data/app/controllers/spree/api/v3/admin/sellers_controller.rb +75 -22
- data/app/controllers/spree/api/v3/admin/setup_controller.rb +54 -15
- data/app/controllers/spree/api/v3/admin/stock_levels_controller.rb +38 -9
- data/app/controllers/spree/api/v3/admin/stock_locations_controller.rb +41 -9
- data/app/controllers/spree/api/v3/admin/stock_transfers_controller.rb +48 -7
- data/app/controllers/spree/api/v3/admin/store_controller.rb +122 -53
- data/app/controllers/spree/api/v3/admin/store_credits_controller.rb +1 -7
- data/app/controllers/spree/api/v3/admin/suppliers_controller.rb +16 -6
- data/app/controllers/spree/api/v3/admin/tax_categories_controller.rb +7 -4
- data/app/controllers/spree/api/v3/admin/tax_rates_controller.rb +21 -3
- data/app/controllers/spree/api/v3/admin/tracking_carriers_controller.rb +4 -0
- data/app/controllers/spree/api/v3/admin/translations/batches_controller.rb +17 -9
- data/app/controllers/spree/api/v3/admin/translations_controller.rb +4 -0
- data/app/controllers/spree/api/v3/admin/translations_coverage_controller.rb +5 -0
- data/app/controllers/spree/api/v3/admin/updates_controller.rb +39 -0
- data/app/controllers/spree/api/v3/admin/webhook_endpoints_controller.rb +23 -1
- data/app/controllers/spree/api/v3/base_controller.rb +2 -0
- data/app/controllers/spree/api/v3/resource_controller.rb +63 -10
- data/app/controllers/spree/api/v3/seller/auth_controller.rb +8 -0
- data/app/controllers/spree/api/v3/seller/base_controller.rb +1 -0
- data/app/controllers/spree/api/v3/seller/countries_controller.rb +2 -2
- data/app/controllers/spree/api/v3/seller/delivery_methods_controller.rb +49 -60
- data/app/controllers/spree/api/v3/seller/exports_controller.rb +18 -1
- data/app/controllers/spree/api/v3/seller/files_controller.rb +27 -0
- data/app/controllers/spree/api/v3/seller/imports_controller.rb +25 -9
- data/app/controllers/spree/api/v3/seller/invitation_acceptances_controller.rb +9 -1
- data/app/controllers/spree/api/v3/seller/me_controller.rb +14 -3
- data/app/controllers/spree/api/v3/seller/onboarding_controller.rb +11 -0
- data/app/controllers/spree/api/v3/seller/orders/claims_controller.rb +35 -0
- data/app/controllers/spree/api/v3/seller/orders/deliveries_controller.rb +12 -0
- data/app/controllers/spree/api/v3/seller/orders/exchanges_controller.rb +33 -0
- data/app/controllers/spree/api/v3/seller/orders/fulfillments_controller.rb +28 -2
- data/app/controllers/spree/api/v3/seller/orders/labels_controller.rb +22 -1
- data/app/controllers/spree/api/v3/seller/orders/notes_controller.rb +8 -1
- data/app/controllers/spree/api/v3/seller/orders/returns_controller.rb +32 -0
- data/app/controllers/spree/api/v3/seller/orders_controller.rb +35 -14
- data/app/controllers/spree/api/v3/seller/package_types_controller.rb +21 -9
- data/app/controllers/spree/api/v3/seller/password_resets_controller.rb +10 -0
- data/app/controllers/spree/api/v3/seller/policies_controller.rb +12 -4
- data/app/controllers/spree/api/v3/seller/products_controller.rb +114 -28
- data/app/controllers/spree/api/v3/seller/profile_controller.rb +33 -10
- data/app/controllers/spree/api/v3/seller/requirement_submissions_controller.rb +12 -5
- data/app/controllers/spree/api/v3/seller/resource_controller.rb +12 -0
- data/app/controllers/spree/api/v3/seller/stock_locations_controller.rb +44 -13
- data/app/controllers/spree/api/v3/seller/tax_identifiers_controller.rb +10 -1
- data/app/controllers/spree/api/v3/seller/team_controller.rb +4 -0
- data/app/controllers/spree/api/v3/store/auth_controller.rb +10 -0
- data/app/controllers/spree/api/v3/store/carts/discount_codes_controller.rb +8 -1
- data/app/controllers/spree/api/v3/store/carts/fulfillments_controller.rb +10 -2
- data/app/controllers/spree/api/v3/store/carts/gift_cards_controller.rb +8 -1
- data/app/controllers/spree/api/v3/store/carts/items_controller.rb +17 -5
- data/app/controllers/spree/api/v3/store/carts/payment_sessions_controller.rb +20 -6
- data/app/controllers/spree/api/v3/store/carts/payments_controller.rb +11 -0
- data/app/controllers/spree/api/v3/store/carts/po_documents_controller.rb +24 -26
- data/app/controllers/spree/api/v3/store/carts/store_credits_controller.rb +7 -1
- data/app/controllers/spree/api/v3/store/carts/tax_identifiers_controller.rb +5 -1
- data/app/controllers/spree/api/v3/store/carts_controller.rb +56 -47
- data/app/controllers/spree/api/v3/store/companies/addresses_controller.rb +12 -4
- data/app/controllers/spree/api/v3/store/companies/members_controller.rb +4 -0
- data/app/controllers/spree/api/v3/store/companies_controller.rb +5 -1
- data/app/controllers/spree/api/v3/store/company_invitations_controller.rb +9 -1
- data/app/controllers/spree/api/v3/store/customer/addresses_controller.rb +8 -7
- data/app/controllers/spree/api/v3/store/customer/data_requests_controller.rb +5 -0
- data/app/controllers/spree/api/v3/store/customer/password_resets_controller.rb +17 -0
- data/app/controllers/spree/api/v3/store/customer/payment_setup_sessions_controller.rb +10 -5
- data/app/controllers/spree/api/v3/store/customer/tax_identifiers_controller.rb +5 -1
- data/app/controllers/spree/api/v3/store/customers_controller.rb +28 -2
- data/app/controllers/spree/api/v3/store/newsletter_subscribers_controller.rb +22 -0
- data/app/controllers/spree/api/v3/store/orders/claims_controller.rb +11 -2
- data/app/controllers/spree/api/v3/store/orders/returns_controller.rb +10 -1
- data/app/controllers/spree/api/v3/store/orders_controller.rb +47 -10
- data/app/controllers/spree/api/v3/store/products_controller.rb +8 -0
- data/app/controllers/spree/api/v3/store/wishlist_items_controller.rb +10 -4
- data/app/controllers/spree/api/v3/store/wishlists_controller.rb +12 -4
- data/app/request_schemas/spree/api/v3/address_request_schema.rb +27 -0
- data/app/request_schemas/spree/api/v3/admin/address_request_schema.rb +13 -0
- data/app/request_schemas/spree/api/v3/admin/bulk_tags_request_schema.rb +17 -0
- data/app/request_schemas/spree/api/v3/admin/catalog_order_minimum_request_schema.rb +17 -0
- data/app/request_schemas/spree/api/v3/admin/email_template_language_request_schema.rb +17 -0
- data/app/request_schemas/spree/api/v3/admin/email_template_preview_request_schema.rb +32 -0
- data/app/request_schemas/spree/api/v3/admin/price_adjustment_tier_request_schema.rb +21 -0
- data/app/request_schemas/spree/api/v3/admin/price_list_price_request_schema.rb +21 -0
- data/app/request_schemas/spree/api/v3/admin/price_list_rule_request_schema.rb +19 -0
- data/app/request_schemas/spree/api/v3/admin/product_membership_reposition_request_schema.rb +17 -0
- data/app/request_schemas/spree/api/v3/admin/promotion_action_calculator_request_schema.rb +18 -0
- data/app/request_schemas/spree/api/v3/admin/promotion_action_line_item_request_schema.rb +15 -0
- data/app/request_schemas/spree/api/v3/admin/promotion_action_request_schema.rb +19 -0
- data/app/request_schemas/spree/api/v3/admin/promotion_rule_request_schema.rb +22 -0
- data/app/request_schemas/spree/api/v3/admin/reason_request_schema.rb +14 -0
- data/app/request_schemas/spree/api/v3/admin/tax_identifier_request_schema.rb +15 -0
- data/app/request_schemas/spree/api/v3/custom_field_value_request_schema.rb +15 -0
- data/app/request_schemas/spree/api/v3/file_upload_request_schema.rb +20 -0
- data/app/request_schemas/spree/api/v3/media_request_schema.rb +27 -0
- data/app/request_schemas/spree/api/v3/price_request_schema.rb +17 -0
- data/app/request_schemas/spree/api/v3/stock_level_request_schema.rb +18 -0
- data/app/request_schemas/spree/api/v3/store/address_request_schema.rb +29 -0
- data/app/request_schemas/spree/api/v3/tax_identifier_request_schema.rb +18 -0
- data/app/request_schemas/spree/api/v3/variant_option_request_schema.rb +13 -0
- data/app/request_schemas/spree/api/v3/variant_request_schema.rb +52 -0
- data/app/serializers/concerns/spree/api/v3/purchase_summary.rb +48 -0
- data/app/serializers/spree/api/v3/address_serializer.rb +4 -2
- data/app/serializers/spree/api/v3/admin/address_serializer.rb +3 -0
- data/app/serializers/spree/api/v3/admin/applied_promotion_serializer.rb +3 -1
- data/app/serializers/spree/api/v3/admin/cart_serializer.rb +3 -1
- data/app/serializers/spree/api/v3/admin/catalog_order_minimum_serializer.rb +3 -2
- data/app/serializers/spree/api/v3/admin/catalog_price_serializer.rb +3 -4
- data/app/serializers/spree/api/v3/admin/catalog_price_tier_serializer.rb +4 -3
- data/app/serializers/spree/api/v3/admin/channel_serializer.rb +5 -7
- data/app/serializers/spree/api/v3/admin/claim_line_item_serializer.rb +7 -0
- data/app/serializers/spree/api/v3/admin/claim_serializer.rb +5 -0
- data/app/serializers/spree/api/v3/admin/commission_line_serializer.rb +7 -18
- data/app/serializers/spree/api/v3/admin/commission_rate_serializer.rb +7 -11
- data/app/serializers/spree/api/v3/admin/commission_rule_serializer.rb +0 -2
- data/app/serializers/spree/api/v3/admin/country_serializer.rb +4 -0
- data/app/serializers/spree/api/v3/admin/customer_serializer.rb +3 -7
- data/app/serializers/spree/api/v3/admin/delivery_method_rule_serializer.rb +0 -2
- data/app/serializers/spree/api/v3/admin/delivery_method_serializer.rb +14 -10
- data/app/serializers/spree/api/v3/admin/delivery_method_service_serializer.rb +9 -1
- data/app/serializers/spree/api/v3/admin/delivery_rate_serializer.rb +8 -0
- data/app/serializers/spree/api/v3/admin/discount_serializer.rb +3 -1
- data/app/serializers/spree/api/v3/admin/exchange_line_item_serializer.rb +5 -0
- data/app/serializers/spree/api/v3/admin/exchange_serializer.rb +5 -0
- data/app/serializers/spree/api/v3/admin/fee_serializer.rb +3 -1
- data/app/serializers/spree/api/v3/admin/file_upload_serializer.rb +11 -0
- data/app/serializers/spree/api/v3/admin/file_upload_target_serializer.rb +10 -0
- data/app/serializers/spree/api/v3/admin/fulfillment_serializer.rb +13 -11
- data/app/serializers/spree/api/v3/admin/gift_card_serializer.rb +3 -3
- data/app/serializers/spree/api/v3/admin/import_serializer.rb +2 -2
- data/app/serializers/spree/api/v3/admin/integration_serializer.rb +1 -3
- data/app/serializers/spree/api/v3/admin/line_item_serializer.rb +12 -12
- data/app/serializers/spree/api/v3/admin/locale_serializer.rb +13 -0
- data/app/serializers/spree/api/v3/admin/market_serializer.rb +3 -0
- data/app/serializers/spree/api/v3/admin/media_serializer.rb +3 -2
- data/app/serializers/spree/api/v3/admin/order_group_serializer.rb +2 -0
- data/app/serializers/spree/api/v3/admin/order_routing_rule_serializer.rb +1 -3
- data/app/serializers/spree/api/v3/admin/order_serializer.rb +33 -33
- data/app/serializers/spree/api/v3/admin/payment_method_serializer.rb +1 -4
- data/app/serializers/spree/api/v3/admin/payment_serializer.rb +6 -3
- data/app/serializers/spree/api/v3/admin/payment_split_serializer.rb +8 -9
- data/app/serializers/spree/api/v3/admin/price_adjustment_tier_serializer.rb +3 -6
- data/app/serializers/spree/api/v3/admin/price_history_serializer.rb +5 -2
- data/app/serializers/spree/api/v3/admin/price_list_serializer.rb +1 -5
- data/app/serializers/spree/api/v3/admin/price_rule_serializer.rb +1 -3
- data/app/serializers/spree/api/v3/admin/price_serializer.rb +2 -0
- data/app/serializers/spree/api/v3/admin/product_serializer.rb +2 -0
- data/app/serializers/spree/api/v3/admin/promotion_action_serializer.rb +4 -6
- data/app/serializers/spree/api/v3/admin/promotion_rule_serializer.rb +0 -2
- data/app/serializers/spree/api/v3/admin/purchase_order_item_serializer.rb +5 -11
- data/app/serializers/spree/api/v3/admin/purchase_order_serializer.rb +4 -4
- data/app/serializers/spree/api/v3/admin/refund_serializer.rb +7 -3
- data/app/serializers/spree/api/v3/admin/reporting_result_serializer.rb +9 -2
- data/app/serializers/spree/api/v3/admin/return_line_item_serializer.rb +8 -0
- data/app/serializers/spree/api/v3/admin/return_serializer.rb +8 -4
- data/app/serializers/spree/api/v3/admin/seller_balance_serializer.rb +15 -10
- data/app/serializers/spree/api/v3/admin/seller_payout_serializer.rb +3 -5
- data/app/serializers/spree/api/v3/admin/seller_serializer.rb +3 -1
- data/app/serializers/spree/api/v3/admin/seller_transfer_serializer.rb +7 -8
- data/app/serializers/spree/api/v3/admin/shipping_label_serializer.rb +4 -4
- data/app/serializers/spree/api/v3/admin/stock_location_serializer.rb +3 -0
- data/app/serializers/spree/api/v3/admin/stock_movement_serializer.rb +2 -6
- data/app/serializers/spree/api/v3/admin/store_credit_event_serializer.rb +5 -0
- data/app/serializers/spree/api/v3/admin/store_credit_serializer.rb +9 -4
- data/app/serializers/spree/api/v3/admin/store_serializer.rb +17 -98
- data/app/serializers/spree/api/v3/admin/supplier_serializer.rb +1 -1
- data/app/serializers/spree/api/v3/admin/tax_exemption_certificate_serializer.rb +3 -1
- data/app/serializers/spree/api/v3/admin/tax_line_serializer.rb +4 -2
- data/app/serializers/spree/api/v3/admin/tax_rate_serializer.rb +2 -12
- data/app/serializers/spree/api/v3/admin/update_status_serializer.rb +28 -0
- data/app/serializers/spree/api/v3/admin/variant_serializer.rb +7 -3
- data/app/serializers/spree/api/v3/base_serializer.rb +112 -7
- data/app/serializers/spree/api/v3/cart_serializer.rb +11 -29
- data/app/serializers/spree/api/v3/claim_line_item_serializer.rb +5 -13
- data/app/serializers/spree/api/v3/claim_serializer.rb +2 -3
- data/app/serializers/spree/api/v3/country_serializer.rb +2 -1
- data/app/serializers/spree/api/v3/currency_serializer.rb +9 -1
- data/app/serializers/spree/api/v3/customer_serializer.rb +3 -2
- data/app/serializers/spree/api/v3/delivery_rate_serializer.rb +8 -12
- data/app/serializers/spree/api/v3/delivery_zone_member_serializer.rb +1 -1
- data/app/serializers/spree/api/v3/discount_serializer.rb +4 -1
- data/app/serializers/spree/api/v3/exchange_line_item_serializer.rb +2 -8
- data/app/serializers/spree/api/v3/exchange_serializer.rb +2 -3
- data/app/serializers/spree/api/v3/file_upload_serializer.rb +28 -0
- data/app/serializers/spree/api/v3/file_upload_target_serializer.rb +17 -0
- data/app/serializers/spree/api/v3/gift_card_batch_serializer.rb +2 -4
- data/app/serializers/spree/api/v3/gift_card_serializer.rb +4 -2
- data/app/serializers/spree/api/v3/import_serializer.rb +0 -12
- data/app/serializers/spree/api/v3/line_item_serializer.rb +15 -5
- data/app/serializers/spree/api/v3/locale_serializer.rb +3 -1
- data/app/serializers/spree/api/v3/market_serializer.rb +5 -5
- data/app/serializers/spree/api/v3/media_serializer.rb +7 -2
- data/app/serializers/spree/api/v3/order_group_serializer.rb +12 -4
- data/app/serializers/spree/api/v3/order_serializer.rb +5 -23
- data/app/serializers/spree/api/v3/payment_session_serializer.rb +2 -4
- data/app/serializers/spree/api/v3/price_history_serializer.rb +5 -5
- data/app/serializers/spree/api/v3/price_serializer.rb +6 -9
- data/app/serializers/spree/api/v3/product_filter_price_range_serializer.rb +10 -4
- data/app/serializers/spree/api/v3/product_serializer.rb +3 -3
- data/app/serializers/spree/api/v3/refund_serializer.rb +8 -5
- data/app/serializers/spree/api/v3/return_line_item_serializer.rb +3 -11
- data/app/serializers/spree/api/v3/return_serializer.rb +3 -6
- data/app/serializers/spree/api/v3/seller/address_serializer.rb +12 -0
- data/app/serializers/spree/api/v3/seller/balance_serializer.rb +15 -10
- data/app/serializers/spree/api/v3/seller/claim_line_item_serializer.rb +7 -0
- data/app/serializers/spree/api/v3/seller/claim_serializer.rb +5 -0
- data/app/serializers/spree/api/v3/seller/country_serializer.rb +19 -0
- data/app/serializers/spree/api/v3/seller/delivery_method_rule_serializer.rb +1 -3
- data/app/serializers/spree/api/v3/seller/delivery_method_serializer.rb +4 -8
- data/app/serializers/spree/api/v3/seller/delivery_rate_serializer.rb +9 -8
- data/app/serializers/spree/api/v3/seller/exchange_line_item_serializer.rb +5 -0
- data/app/serializers/spree/api/v3/seller/exchange_serializer.rb +5 -0
- data/app/serializers/spree/api/v3/seller/file_upload_serializer.rb +11 -0
- data/app/serializers/spree/api/v3/seller/file_upload_target_serializer.rb +10 -0
- data/app/serializers/spree/api/v3/seller/import_serializer.rb +2 -2
- data/app/serializers/spree/api/v3/seller/media_serializer.rb +2 -5
- data/app/serializers/spree/api/v3/seller/order_line_item_serializer.rb +4 -3
- data/app/serializers/spree/api/v3/seller/order_serializer.rb +16 -16
- data/app/serializers/spree/api/v3/seller/payment_split_serializer.rb +8 -9
- data/app/serializers/spree/api/v3/seller/payout_serializer.rb +2 -4
- data/app/serializers/spree/api/v3/seller/price_history_serializer.rb +11 -0
- data/app/serializers/spree/api/v3/seller/price_serializer.rb +11 -0
- data/app/serializers/spree/api/v3/seller/product_serializer.rb +2 -0
- data/app/serializers/spree/api/v3/seller/profile_serializer.rb +7 -7
- data/app/serializers/spree/api/v3/seller/return_line_item_serializer.rb +8 -0
- data/app/serializers/spree/api/v3/seller/return_serializer.rb +8 -5
- data/app/serializers/spree/api/v3/seller/state_serializer.rb +10 -0
- data/app/serializers/spree/api/v3/seller/stock_location_serializer.rb +3 -0
- data/app/serializers/spree/api/v3/seller/transfer_serializer.rb +6 -7
- data/app/serializers/spree/api/v3/seller/variant_serializer.rb +8 -4
- data/app/serializers/spree/api/v3/stock_location_serializer.rb +8 -1
- data/app/serializers/spree/api/v3/store_credit_event_serializer.rb +1 -3
- data/app/serializers/spree/api/v3/store_credit_serializer.rb +3 -5
- data/app/serializers/spree/api/v3/tax_line_serializer.rb +2 -4
- data/app/serializers/spree/api/v3/variant_serializer.rb +3 -3
- data/app/services/spree/api/v3/filter_predicates.rb +29 -0
- data/app/services/spree/api/v3/filter_table.rb +337 -0
- data/app/services/spree/api/v3/filters_aggregator.rb +2 -2
- data/app/services/spree/api/v3/request_schema.rb +430 -0
- data/app/services/spree/webhooks/deliver_webhook.rb +7 -3
- data/config/initializers/typelizer.rb +1 -1
- data/config/routes.rb +5 -3
- data/lib/spree/api/configuration.rb +5 -0
- data/lib/spree/api/dependencies.rb +7 -6
- data/lib/spree/api/middleware/request_size_limit.rb +24 -3
- data/lib/spree/api/openapi/filter_documentation.rb +136 -0
- data/lib/spree/api/openapi/schema_helper.rb +126 -80
- data/lib/spree/api/preference_families.rb +46 -0
- data/lib/spree/api/preference_types.rb +138 -0
- data/lib/spree/api/typelizer_generation.rb +4 -0
- data/lib/tasks/filters.rake +12 -0
- data/lib/typelizer/open_enums.rb +10 -0
- metadata +60 -10
- data/app/controllers/concerns/spree/api/v3/address_params.rb +0 -17
- data/app/controllers/concerns/spree/api/v3/direct_uploads.rb +0 -35
- data/app/controllers/spree/api/v3/admin/direct_uploads_controller.rb +0 -54
- data/app/controllers/spree/api/v3/seller/direct_uploads_controller.rb +0 -21
|
@@ -17,6 +17,15 @@ module Spree
|
|
|
17
17
|
# standard actions are listed alongside the label download.
|
|
18
18
|
before_action :set_resource, only: [:show, :update, :destroy, :label]
|
|
19
19
|
|
|
20
|
+
request_params 'CreateReturnParams', action: :create do |body|
|
|
21
|
+
body.attribute :items, :array, required: true do |item|
|
|
22
|
+
item.attribute :fulfillment_item_id, :id, required: true, description: 'The shipped unit coming back.'
|
|
23
|
+
item.attribute :quantity, :integer, required: true
|
|
24
|
+
end
|
|
25
|
+
body.attribute :reason_id, :id, description: "One of the store's return reasons."
|
|
26
|
+
body.attribute :memo, :string
|
|
27
|
+
end
|
|
28
|
+
|
|
20
29
|
# GET /api/v3/store/orders/:order_id/returns/:id/label
|
|
21
30
|
#
|
|
22
31
|
# The customer's return label, streamed to whoever owns the order.
|
|
@@ -85,7 +94,7 @@ module Spree
|
|
|
85
94
|
end
|
|
86
95
|
|
|
87
96
|
def create_params
|
|
88
|
-
@create_params ||= params.permit(
|
|
97
|
+
@create_params ||= params.permit(*declared_permitted_attributes)
|
|
89
98
|
end
|
|
90
99
|
|
|
91
100
|
private
|
|
@@ -3,6 +3,8 @@ module Spree
|
|
|
3
3
|
module V3
|
|
4
4
|
module Store
|
|
5
5
|
class OrdersController < Store::BaseController
|
|
6
|
+
include Spree::Api::V3::PurchaseSerialization
|
|
7
|
+
|
|
6
8
|
# GET /api/v3/store/orders/:id
|
|
7
9
|
# Single order lookup — accessible via order token (guests) or JWT (authenticated users)
|
|
8
10
|
before_action :find_order!
|
|
@@ -13,26 +15,61 @@ module Spree
|
|
|
13
15
|
|
|
14
16
|
private
|
|
15
17
|
|
|
16
|
-
# The cart's prefixed id stays the client's stable checkout handle
|
|
17
|
-
#
|
|
18
|
-
#
|
|
18
|
+
# The cart's prefixed id stays the client's stable checkout handle.
|
|
19
|
+
# A plain completion leaves the order it created carrying that id
|
|
20
|
+
# (Order#cart_id is unique; the order copies the cart token). A
|
|
21
|
+
# checkout that reached several sellers divided into one order per
|
|
22
|
+
# seller and moved the id up to the group holding them, so the same
|
|
23
|
+
# handle resolves to the group — a confirmation asking what its cart
|
|
24
|
+
# became is answered with the whole purchase either way, never one
|
|
25
|
+
# seller's share of it.
|
|
26
|
+
#
|
|
27
|
+
# The group's own id resolves here too, for a client re-reading what
|
|
28
|
+
# completion handed back, the way +carts#complete+ already accepts it.
|
|
19
29
|
def find_order!
|
|
20
30
|
cart_pk = Spree::Cart.decode_own_prefixed_id(params[:id])
|
|
21
|
-
@order = cart_pk ?
|
|
31
|
+
@order = cart_pk ? find_by_cart!(cart_pk) : find_by_prefixed_id!(params[:id])
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
# @return [Spree::Order, Spree::OrderGroup]
|
|
35
|
+
def find_by_cart!(cart_pk)
|
|
36
|
+
scope.find_by(cart_id: cart_pk) || group_scope.find_by(cart_id: cart_pk) || not_found!
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
# @return [Spree::Order, Spree::OrderGroup]
|
|
40
|
+
def find_by_prefixed_id!(id)
|
|
41
|
+
scope.find_by_prefix_id(id) || group_scope.find_by_prefix_id(id) || not_found!
|
|
22
42
|
end
|
|
23
43
|
|
|
24
|
-
#
|
|
25
|
-
# the
|
|
26
|
-
#
|
|
27
|
-
|
|
44
|
+
# Neither lookup answered. The caller asked `/orders`, so that is what
|
|
45
|
+
# the 404 names — which of the two ran last is this endpoint's
|
|
46
|
+
# business, and `order_not_found` is the code clients already handle.
|
|
47
|
+
def not_found!
|
|
48
|
+
raise ActiveRecord::RecordNotFound.new(nil, Spree::Order.name)
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
# Preloaded lazily, which `collection` would do for a list: this
|
|
52
|
+
# controller loads through `find_order!`, so it asks for it itself.
|
|
53
|
+
# Every association the serializer walks — items, parcels, their
|
|
54
|
+
# rates and discounts — is then fetched once for all the rows that
|
|
55
|
+
# need it, rather than once per row.
|
|
28
56
|
def scope
|
|
29
57
|
storefront_access_policy.
|
|
30
58
|
scope(current_store.orders.complete, token: order_token).
|
|
31
|
-
|
|
59
|
+
preload_associations_lazily
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
# A group renders every child through the order serializer, so this
|
|
63
|
+
# matters most here: without it each seller in the checkout adds its
|
|
64
|
+
# own round of queries for the same associations.
|
|
65
|
+
def group_scope
|
|
66
|
+
storefront_access_policy.
|
|
67
|
+
scope(current_store.order_groups, token: order_token).
|
|
68
|
+
preload_associations_lazily
|
|
32
69
|
end
|
|
33
70
|
|
|
34
71
|
def serializer_class
|
|
35
|
-
|
|
72
|
+
purchase_serializer_for(@order)
|
|
36
73
|
end
|
|
37
74
|
end
|
|
38
75
|
end
|
|
@@ -7,6 +7,16 @@ module Spree
|
|
|
7
7
|
|
|
8
8
|
prepend_before_action :require_authentication!
|
|
9
9
|
|
|
10
|
+
request_params 'CreateWishlistItemParams', action: :create do |body|
|
|
11
|
+
body.attribute :variant_id, :id, required: true, example: 'variant_abc123'
|
|
12
|
+
body.attribute :quantity, :integer, example: 1
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
request_params 'UpdateWishlistItemParams', action: :update do |body|
|
|
16
|
+
body.attribute :variant_id, :id, description: 'Moves the item to another variant.'
|
|
17
|
+
body.attribute :quantity, :integer, example: 2
|
|
18
|
+
end
|
|
19
|
+
|
|
10
20
|
protected
|
|
11
21
|
|
|
12
22
|
def set_parent
|
|
@@ -24,10 +34,6 @@ module Spree
|
|
|
24
34
|
Spree.api.wishlist_item_serializer
|
|
25
35
|
end
|
|
26
36
|
|
|
27
|
-
def resource_permitted_attributes
|
|
28
|
-
[:variant_id, :quantity]
|
|
29
|
-
end
|
|
30
|
-
|
|
31
37
|
# The item renders its variant and product, so the variant must be
|
|
32
38
|
# one the buyer could find in the listing — not a draft, another
|
|
33
39
|
# catalog's product, or an id guessed from the sequence.
|
|
@@ -5,6 +5,18 @@ module Spree
|
|
|
5
5
|
class WishlistsController < ResourceController
|
|
6
6
|
prepend_before_action :require_authentication!
|
|
7
7
|
|
|
8
|
+
request_params 'CreateWishlistParams', action: :create do |body|
|
|
9
|
+
body.attribute :name, :string, required: true, example: 'Birthday Ideas'
|
|
10
|
+
body.attribute :is_private, :boolean
|
|
11
|
+
body.attribute :is_default, :boolean
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
request_params 'UpdateWishlistParams', action: :update do |body|
|
|
15
|
+
body.attribute :name, :string, example: 'Updated Name'
|
|
16
|
+
body.attribute :is_private, :boolean
|
|
17
|
+
body.attribute :is_default, :boolean
|
|
18
|
+
end
|
|
19
|
+
|
|
8
20
|
# POST /api/v3/store/wishlists
|
|
9
21
|
def create
|
|
10
22
|
@resource = current_user.wishlists.build(permitted_params)
|
|
@@ -30,10 +42,6 @@ module Spree
|
|
|
30
42
|
def serializer_class
|
|
31
43
|
Spree.api.wishlist_serializer
|
|
32
44
|
end
|
|
33
|
-
|
|
34
|
-
def resource_permitted_attributes
|
|
35
|
-
[:name, :is_default, :is_private]
|
|
36
|
-
end
|
|
37
45
|
end
|
|
38
46
|
end
|
|
39
47
|
end
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
module Spree
|
|
2
|
+
module Api
|
|
3
|
+
module V3
|
|
4
|
+
# The writable attributes of an address, wherever it hangs. One list
|
|
5
|
+
# rather than one per endpoint: an address is the same record on every
|
|
6
|
+
# write path, so a column added on one but missed on another would be
|
|
7
|
+
# dropped silently. Not published on its own: each endpoint includes
|
|
8
|
+
# these attributes into its own type, beside what it adds.
|
|
9
|
+
class AddressRequestSchema < Spree::Api::V3::RequestSchema
|
|
10
|
+
attribute :first_name, :string
|
|
11
|
+
attribute :last_name, :string
|
|
12
|
+
attribute :company, :string
|
|
13
|
+
attribute :address1, :string
|
|
14
|
+
attribute :address2, :string
|
|
15
|
+
attribute :city, :string
|
|
16
|
+
attribute :postal_code, :string
|
|
17
|
+
attribute :phone, :string
|
|
18
|
+
attribute :label, :string
|
|
19
|
+
attribute :country_code, :country, example: 'US', description: 'ISO 3166-1 alpha-2 code, such as `US`.'
|
|
20
|
+
attribute :state_code, :string,
|
|
21
|
+
example: 'NY',
|
|
22
|
+
description: 'The state or province abbreviation, such as `NY`.'
|
|
23
|
+
attribute :state_name, :string, description: 'For countries without states in the database.'
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
module Spree
|
|
2
|
+
module Api
|
|
3
|
+
module V3
|
|
4
|
+
module Admin
|
|
5
|
+
# The Admin API's address: the shared one plus the second phone number
|
|
6
|
+
# orders and customer address books keep.
|
|
7
|
+
class AddressRequestSchema < Spree::Api::V3::AddressRequestSchema
|
|
8
|
+
attribute :alternative_phone, :string
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
module Spree
|
|
2
|
+
module Api
|
|
3
|
+
module V3
|
|
4
|
+
module Admin
|
|
5
|
+
# The body of the shared bulk tag actions (Spree::Api::V3::BulkOperations).
|
|
6
|
+
# Each controller declares it as `BulkTagsParams` with only these fields,
|
|
7
|
+
# so the published component is the same wherever it is used.
|
|
8
|
+
class BulkTagsRequestSchema < Spree::Api::V3::RequestSchema
|
|
9
|
+
attribute :ids, :array, of: :id,
|
|
10
|
+
required: true,
|
|
11
|
+
description: 'The records to change. Records the caller cannot update are skipped; an empty list changes nothing.'
|
|
12
|
+
attribute :tags, :array, of: :string, required: true, example: %w[vip wholesale]
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
module Spree
|
|
2
|
+
module Api
|
|
3
|
+
module V3
|
|
4
|
+
module Admin
|
|
5
|
+
# The least a whole order must come to under a catalog, in one currency.
|
|
6
|
+
class CatalogOrderMinimumRequestSchema < Spree::Api::V3::RequestSchema
|
|
7
|
+
publishes 'CatalogOrderMinimumParams'
|
|
8
|
+
|
|
9
|
+
attribute :currency, :currency,
|
|
10
|
+
example: 'USD',
|
|
11
|
+
description: 'ISO 4217 code. Required on create; one minimum per currency.'
|
|
12
|
+
attribute :amount, :decimal, example: '500.00'
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
module Spree
|
|
2
|
+
module Api
|
|
3
|
+
module V3
|
|
4
|
+
module Admin
|
|
5
|
+
# The language every email template endpoint takes. Read from the raw
|
|
6
|
+
# params (Admin::EmailTemplateLookup), so never permitted. Not
|
|
7
|
+
# published on its own.
|
|
8
|
+
class EmailTemplateLanguageRequestSchema < Spree::Api::V3::RequestSchema
|
|
9
|
+
attribute :language, :string,
|
|
10
|
+
permit: false,
|
|
11
|
+
example: 'any',
|
|
12
|
+
description: 'A language code, or `any` (the default) for the version every language uses.'
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
module Spree
|
|
2
|
+
module Api
|
|
3
|
+
module V3
|
|
4
|
+
module Admin
|
|
5
|
+
# What the email template preview and test email endpoints render.
|
|
6
|
+
# Not published on its own: both declare it as `EmailTemplatePreviewParams`.
|
|
7
|
+
class EmailTemplatePreviewRequestSchema < Spree::Api::V3::Admin::EmailTemplateLanguageRequestSchema
|
|
8
|
+
attribute :subject, :string,
|
|
9
|
+
nullable: true,
|
|
10
|
+
example: 'Your order {{ order.number }} is confirmed',
|
|
11
|
+
description: 'An unsaved subject, in place of the current one.'
|
|
12
|
+
attribute :body, :string,
|
|
13
|
+
example: '<mj-section><mj-column><mj-text>Thanks, {{ order.customer_name }}!</mj-text></mj-column></mj-section>',
|
|
14
|
+
description: 'An unsaved body, in place of the current one.'
|
|
15
|
+
attribute :record_id, :id,
|
|
16
|
+
example: 'or_m3Rp9wXz',
|
|
17
|
+
description: "The record to build sample data from; the store's latest matching record otherwise."
|
|
18
|
+
attribute :email_key, :string,
|
|
19
|
+
permit: false,
|
|
20
|
+
example: 'spree.order_mailer.confirm_email',
|
|
21
|
+
description: 'For the layout or a partial, the email to show it in.'
|
|
22
|
+
attribute :branding, :object,
|
|
23
|
+
permit: false,
|
|
24
|
+
description: "Unsaved colors and font to preview, named like the store's `email_*` settings." do |branding|
|
|
25
|
+
Spree::Emails::Branding::COLORS.each { |name| branding.attribute name, :string, nullable: true }
|
|
26
|
+
branding.attribute :font, :string, nullable: true, choices: Spree::Emails::Branding::FONTS.keys
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
module Spree
|
|
2
|
+
module Api
|
|
3
|
+
module V3
|
|
4
|
+
module Admin
|
|
5
|
+
# One quantity tier of a price list's percentage adjustment.
|
|
6
|
+
class PriceAdjustmentTierRequestSchema < Spree::Api::V3::RequestSchema
|
|
7
|
+
publishes 'PriceAdjustmentTierParams'
|
|
8
|
+
|
|
9
|
+
attribute :min_quantity, :integer,
|
|
10
|
+
required: true,
|
|
11
|
+
example: 10,
|
|
12
|
+
description: "Above 1; quantity 1 is the list's own `price_adjustment_percentage`."
|
|
13
|
+
attribute :percentage, :decimal,
|
|
14
|
+
required: true,
|
|
15
|
+
example: '-10.0',
|
|
16
|
+
description: 'Signed: negative discounts, positive marks up.'
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
module Spree
|
|
2
|
+
module Api
|
|
3
|
+
module V3
|
|
4
|
+
module Admin
|
|
5
|
+
# A fixed price a price list sets for one variant, currency and quantity.
|
|
6
|
+
class PriceListPriceRequestSchema < Spree::Api::V3::RequestSchema
|
|
7
|
+
publishes 'PriceListPriceOverrideParams'
|
|
8
|
+
|
|
9
|
+
attribute :id, :id,
|
|
10
|
+
description: 'Updates this price row. Without it, the row upserts on `(variant_id, currency, min_quantity)`.'
|
|
11
|
+
attribute :variant_id, :id, example: 'variant_xY9'
|
|
12
|
+
attribute :currency, :currency, example: 'USD'
|
|
13
|
+
attribute :min_quantity, :integer,
|
|
14
|
+
description: "The rung of the variant's ladder. Omit for the bottom rung."
|
|
15
|
+
attribute :amount, :decimal, nullable: true, example: '19.99'
|
|
16
|
+
attribute :compare_at_amount, :decimal, nullable: true, example: '19.99'
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
module Spree
|
|
2
|
+
module Api
|
|
3
|
+
module V3
|
|
4
|
+
module Admin
|
|
5
|
+
# A rule deciding when a price list applies, as price lists and catalogs write it.
|
|
6
|
+
class PriceListRuleRequestSchema < Spree::Api::V3::RequestSchema
|
|
7
|
+
publishes 'PriceListRuleParams'
|
|
8
|
+
|
|
9
|
+
attribute :id, :id, nullable: true, description: 'Present for existing rules. Omit to create a new one.'
|
|
10
|
+
attribute :type, :string,
|
|
11
|
+
required: true,
|
|
12
|
+
example: 'volume_rule',
|
|
13
|
+
description: 'Wire shorthand for the rule kind, from the price rule types endpoint.'
|
|
14
|
+
attribute :preferences, :hash, description: "The rule kind's settings, keyed by preference name."
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
module Spree
|
|
2
|
+
module Api
|
|
3
|
+
module V3
|
|
4
|
+
module Admin
|
|
5
|
+
# Moving a product within a category's or a collection's product list.
|
|
6
|
+
class ProductMembershipRepositionRequestSchema < Spree::Api::V3::RequestSchema
|
|
7
|
+
publishes 'ProductMembershipRepositionParams'
|
|
8
|
+
|
|
9
|
+
attribute :new_position, :integer,
|
|
10
|
+
required: true,
|
|
11
|
+
example: 0,
|
|
12
|
+
description: "0-based index among the parent's products."
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
module Spree
|
|
2
|
+
module Api
|
|
3
|
+
module V3
|
|
4
|
+
module Admin
|
|
5
|
+
# The calculator of an adjustment promotion action.
|
|
6
|
+
class PromotionActionCalculatorRequestSchema < Spree::Api::V3::RequestSchema
|
|
7
|
+
publishes 'PromotionActionCalculatorParams'
|
|
8
|
+
|
|
9
|
+
attribute :type, :string,
|
|
10
|
+
example: 'flat_percent_item_total',
|
|
11
|
+
description: 'The calculator kind, from `GET /promotion_actions/calculators`. Changing it swaps the calculator.'
|
|
12
|
+
attribute :preferences, :hash,
|
|
13
|
+
description: "Values for the calculator's settings, such as `amount` or `flat_percent`."
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
module Spree
|
|
2
|
+
module Api
|
|
3
|
+
module V3
|
|
4
|
+
module Admin
|
|
5
|
+
# A variant and quantity the `create_line_items` promotion action adds.
|
|
6
|
+
class PromotionActionLineItemRequestSchema < Spree::Api::V3::RequestSchema
|
|
7
|
+
publishes 'PromotionActionLineItemParams'
|
|
8
|
+
|
|
9
|
+
attribute :variant_id, :id, required: true
|
|
10
|
+
attribute :quantity, :integer, required: true
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
module Spree
|
|
2
|
+
module Api
|
|
3
|
+
module V3
|
|
4
|
+
module Admin
|
|
5
|
+
# The keys of a promotion action beyond `type`, shared by the promotion action endpoints and the `actions` written with a promotion.
|
|
6
|
+
class PromotionActionRequestSchema < Spree::Api::V3::RequestSchema
|
|
7
|
+
attribute :preferences, :hash,
|
|
8
|
+
description: "Values for the action kind's settings schema, from `GET /promotion_actions/types`."
|
|
9
|
+
attribute :calculator, :object, shape: Spree::Api::V3::Admin::PromotionActionCalculatorRequestSchema,
|
|
10
|
+
permit: false,
|
|
11
|
+
description: 'For adjustment actions.'
|
|
12
|
+
attribute :line_items, :array, of: Spree::Api::V3::Admin::PromotionActionLineItemRequestSchema,
|
|
13
|
+
permit: false,
|
|
14
|
+
description: 'For `create_line_items`: the variants to add and their quantities. Variants left out are removed.'
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
module Spree
|
|
2
|
+
module Api
|
|
3
|
+
module V3
|
|
4
|
+
module Admin
|
|
5
|
+
# The keys of a promotion rule or action beyond `type`, shared by the
|
|
6
|
+
# nested promotion rule and action endpoints and by the `rules` and
|
|
7
|
+
# `actions` written with a promotion. Kind-specific keys are read
|
|
8
|
+
# per kind from its `additional_permitted_attributes`, so they are
|
|
9
|
+
# documented here and left out of the permit list.
|
|
10
|
+
class PromotionRuleRequestSchema < Spree::Api::V3::RequestSchema
|
|
11
|
+
attribute :preferences, :hash,
|
|
12
|
+
description: "Values for the rule kind's settings schema, from `GET /promotion_rules/types`."
|
|
13
|
+
attribute :product_ids, :array, of: :id, permit: false, description: 'For the `product` rule.'
|
|
14
|
+
attribute :category_ids, :array, of: :id, permit: false, description: 'For the `category` rule.'
|
|
15
|
+
attribute :customer_ids, :array, of: :id,
|
|
16
|
+
permit: false,
|
|
17
|
+
description: 'For the `user` rule: the customers who qualify.'
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
module Spree
|
|
2
|
+
module Api
|
|
3
|
+
module V3
|
|
4
|
+
module Admin
|
|
5
|
+
# A reason staff pick from: claim, refund, return and order
|
|
6
|
+
# cancellation reasons all take the same body.
|
|
7
|
+
class ReasonRequestSchema < Spree::Api::V3::RequestSchema
|
|
8
|
+
attribute :name, :string, required: true, on: :create
|
|
9
|
+
attribute :active, :boolean, description: 'Whether the reason is offered on new records.'
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
module Spree
|
|
2
|
+
module Api
|
|
3
|
+
module V3
|
|
4
|
+
module Admin
|
|
5
|
+
# A customer's or a company's tax registration, as staff write it.
|
|
6
|
+
class TaxIdentifierRequestSchema < Spree::Api::V3::RequestSchema
|
|
7
|
+
attribute :kind, :string,
|
|
8
|
+
example: 'gb_vat',
|
|
9
|
+
description: "#{Spree::Api::V3::TaxIdentifierRequestSchema::KIND_DESCRIPTION}"
|
|
10
|
+
attribute :value, :string, example: 'GB123456789'
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
module Spree
|
|
2
|
+
module Api
|
|
3
|
+
module V3
|
|
4
|
+
# A custom field value written inline with its owner (product, category, seller…).
|
|
5
|
+
class CustomFieldValueRequestSchema < Spree::Api::V3::RequestSchema
|
|
6
|
+
publishes 'CustomFieldValueParams'
|
|
7
|
+
|
|
8
|
+
attribute :id, :id
|
|
9
|
+
attribute :custom_field_definition_id, :id
|
|
10
|
+
attribute :value, :any,
|
|
11
|
+
description: 'A scalar for text, number and boolean fields; a list or a hash for JSON fields.'
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
module Spree
|
|
2
|
+
module Api
|
|
3
|
+
module V3
|
|
4
|
+
# A file sent to `POST /files` (Spree::Api::V3::FileUploads): its
|
|
5
|
+
# details for a direct upload, or its bytes in a multipart request.
|
|
6
|
+
class FileUploadRequestSchema < Spree::Api::V3::RequestSchema
|
|
7
|
+
attribute :filename, :string, required: true, example: 'registration.pdf'
|
|
8
|
+
attribute :content_type, :string, required: true, example: 'application/pdf'
|
|
9
|
+
attribute :byte_size, :integer, example: 51_234
|
|
10
|
+
attribute :checksum, :string,
|
|
11
|
+
example: 'rL0Y20zC+Fzt72VPzMSk2A==',
|
|
12
|
+
description: 'Base64-encoded MD5 digest of the file; the storage service checks the bytes against it.'
|
|
13
|
+
attribute :visibility, :string,
|
|
14
|
+
choices: Spree::FileUpload::VISIBILITIES,
|
|
15
|
+
description: '`public` (the default) for images, videos and CSV files anyone may fetch, `private` for any type.'
|
|
16
|
+
attribute :file, :string, format: :binary, description: 'The bytes, for a multipart upload.'
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
module Spree
|
|
2
|
+
module Api
|
|
3
|
+
module V3
|
|
4
|
+
# What a media row itself carries, whichever endpoint writes it. Not
|
|
5
|
+
# published on its own: each endpoint adds how the file arrives.
|
|
6
|
+
class MediaRequestSchema < Spree::Api::V3::RequestSchema
|
|
7
|
+
attribute :alt, :string, nullable: true, example: 'Front view'
|
|
8
|
+
attribute :position, :integer, example: 1
|
|
9
|
+
attribute :media_type, :string,
|
|
10
|
+
choices: Spree::Media::MEDIA_TYPES,
|
|
11
|
+
example: 'image',
|
|
12
|
+
description: 'Defaults to `image`. `video` needs a `signed_id`; `external_video` needs an `external_video_url`.'
|
|
13
|
+
attribute :external_video_url, :string,
|
|
14
|
+
nullable: true,
|
|
15
|
+
description: 'YouTube or Vimeo link. Required when `media_type` is `external_video`.'
|
|
16
|
+
attribute :poster_signed_id, :string,
|
|
17
|
+
description: "A `signed_id` from `files.upload()` for a video's poster frame."
|
|
18
|
+
attribute :focal_point_x, :number,
|
|
19
|
+
nullable: true,
|
|
20
|
+
description: 'Where the image is anchored when cropped, from 0 to 1.'
|
|
21
|
+
attribute :focal_point_y, :number,
|
|
22
|
+
nullable: true,
|
|
23
|
+
description: 'Where the image is anchored when cropped, from 0 to 1.'
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
module Spree
|
|
2
|
+
module Api
|
|
3
|
+
module V3
|
|
4
|
+
# A variant's price in one currency.
|
|
5
|
+
class PriceRequestSchema < Spree::Api::V3::RequestSchema
|
|
6
|
+
publishes 'PriceParams'
|
|
7
|
+
|
|
8
|
+
attribute :currency, :currency, required: true, example: 'USD'
|
|
9
|
+
attribute :amount, :decimal,
|
|
10
|
+
required: true,
|
|
11
|
+
example: '29.99',
|
|
12
|
+
description: 'A canonical decimal string (`"1234.56"`: period decimal, no grouping). The API does not parse localized input.'
|
|
13
|
+
attribute :compare_at_amount, :decimal, nullable: true, example: '39.99'
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
module Spree
|
|
2
|
+
module Api
|
|
3
|
+
module V3
|
|
4
|
+
# A variant's stock at one location.
|
|
5
|
+
class StockLevelRequestSchema < Spree::Api::V3::RequestSchema
|
|
6
|
+
publishes 'StockLevelParams'
|
|
7
|
+
|
|
8
|
+
# Rows are matched by location: an `id` would be ignored.
|
|
9
|
+
attribute :stock_location_id, :id, required: true, description: 'The location holding the stock (`sloc_...`).'
|
|
10
|
+
attribute :count_on_hand, :integer,
|
|
11
|
+
required: true,
|
|
12
|
+
description: 'Units physically at the location, not units available to sell: stock promised to placed orders counts until it ships. Sent as the count the shelf should end at; the API records the difference as an adjustment in the stock history.'
|
|
13
|
+
attribute :backorderable, :boolean,
|
|
14
|
+
description: 'Whether this location sells the variant beyond what it holds.'
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
module Spree
|
|
2
|
+
module Api
|
|
3
|
+
module V3
|
|
4
|
+
module Store
|
|
5
|
+
# An address as a shopper writes it on the Store API: on a cart and in
|
|
6
|
+
# their own address book. Not published on its own.
|
|
7
|
+
class AddressRequestSchema < Spree::Api::V3::RequestSchema
|
|
8
|
+
attribute :first_name, :string
|
|
9
|
+
attribute :last_name, :string
|
|
10
|
+
attribute :company, :string
|
|
11
|
+
attribute :address1, :string
|
|
12
|
+
attribute :address2, :string
|
|
13
|
+
attribute :city, :string
|
|
14
|
+
attribute :postal_code, :string
|
|
15
|
+
attribute :phone, :string
|
|
16
|
+
attribute :country_code, :country,
|
|
17
|
+
example: 'US',
|
|
18
|
+
description: 'ISO 3166-1 alpha-2 country code, such as `US` or `DE`.'
|
|
19
|
+
attribute :state_code, :string,
|
|
20
|
+
example: 'NY',
|
|
21
|
+
description: 'ISO 3166-2 subdivision code without the country prefix, such as `CA` or `NY`.'
|
|
22
|
+
attribute :state_name, :string, description: 'The state name, for countries without predefined states.'
|
|
23
|
+
attribute :country_iso, :string, deprecated: 'Use `country_code`. Removed in 6.1.'
|
|
24
|
+
attribute :state_abbr, :string, deprecated: 'Use `state_code`. Removed in 6.1.'
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|