spree_api 6.0.0.rc1 → 6.0.0.rc3
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/store/search_provider_support.rb +8 -3
- 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 +19 -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 +54 -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 +31 -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 +6 -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 +4 -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 +16 -30
- 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 +11 -6
- data/app/serializers/spree/api/v3/price_serializer.rb +17 -10
- 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 +12 -0
- data/app/serializers/spree/api/v3/seller/price_serializer.rb +13 -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
|
@@ -3,25 +3,27 @@ module Spree
|
|
|
3
3
|
module V3
|
|
4
4
|
module Admin
|
|
5
5
|
class FulfillmentSerializer < V3::FulfillmentSerializer
|
|
6
|
+
without_formatted_money
|
|
7
|
+
|
|
6
8
|
# The Admin API has no guest gating — money fields inherited from the
|
|
7
9
|
# store serializer are always present, so override their nullability.
|
|
8
|
-
typelize cost: [:string, nullable: false],
|
|
9
|
-
total: [:string, nullable: false],
|
|
10
|
-
discount_total: [:string, nullable: false],
|
|
11
|
-
additional_tax_total: [:string, nullable: false],
|
|
12
|
-
included_tax_total: [:string, nullable: false],
|
|
13
|
-
tax_total: [:string, nullable: false]
|
|
10
|
+
typelize cost: [:string, nullable: false],
|
|
11
|
+
total: [:string, nullable: false],
|
|
12
|
+
discount_total: [:string, nullable: false],
|
|
13
|
+
additional_tax_total: [:string, nullable: false],
|
|
14
|
+
included_tax_total: [:string, nullable: false],
|
|
15
|
+
tax_total: [:string, nullable: false]
|
|
14
16
|
|
|
15
17
|
typelize metadata: 'Record<string, unknown>',
|
|
16
18
|
documents: "Array<{ kind: string; url: string }>",
|
|
17
19
|
provider_generates_labels: :boolean,
|
|
18
20
|
order_id: [:string, nullable: true],
|
|
19
|
-
stock_location_id: [:string, nullable: true]
|
|
20
|
-
|
|
21
|
-
|
|
21
|
+
stock_location_id: [:string, nullable: true]
|
|
22
|
+
|
|
23
|
+
attributes :metadata, created_at: :iso8601, updated_at: :iso8601
|
|
22
24
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
+
money_attributes :adjustment_total, :pre_tax_amount
|
|
26
|
+
typelize adjustment_total: [:string, nullable: false], pre_tax_amount: [:string, nullable: false]
|
|
25
27
|
|
|
26
28
|
prefixed_id_attributes :order, :stock_location
|
|
27
29
|
|
|
@@ -6,12 +6,12 @@ module Spree
|
|
|
6
6
|
# context the admin UI needs: who the card was issued to (customer),
|
|
7
7
|
# who issued it (admin), and the orders that consumed it.
|
|
8
8
|
class GiftCardSerializer < V3::GiftCardSerializer
|
|
9
|
+
without_formatted_money
|
|
10
|
+
|
|
9
11
|
# The Admin API has no guest gating — money fields inherited from the
|
|
10
12
|
# store serializer are always present, so override their nullability.
|
|
11
13
|
typelize amount: [:string, nullable: false], amount_used: [:string, nullable: false],
|
|
12
|
-
amount_authorized: [:string, nullable: false], amount_remaining: [:string, nullable: false]
|
|
13
|
-
display_amount: [:string, nullable: false], display_amount_used: [:string, nullable: false],
|
|
14
|
-
display_amount_remaining: [:string, nullable: false]
|
|
14
|
+
amount_authorized: [:string, nullable: false], amount_remaining: [:string, nullable: false]
|
|
15
15
|
|
|
16
16
|
typelize customer_id: [:string, nullable: true],
|
|
17
17
|
created_by_id: [:string, nullable: true]
|
|
@@ -9,7 +9,7 @@ module Spree
|
|
|
9
9
|
completed_rows_count: :number,
|
|
10
10
|
failed_rows_count: :number,
|
|
11
11
|
processing_errors: [:string, nullable: true],
|
|
12
|
-
|
|
12
|
+
delimiter: :string,
|
|
13
13
|
schema_fields: 'Array<{ name: string; label: string; required: boolean }>',
|
|
14
14
|
csv_headers: [:string, multi: true],
|
|
15
15
|
sample_row: 'Record<string, string | null>',
|
|
@@ -18,7 +18,7 @@ module Spree
|
|
|
18
18
|
original_file_url: [:string, nullable: true],
|
|
19
19
|
price_list_id: [:string, nullable: true]
|
|
20
20
|
|
|
21
|
-
attributes :processing_errors, :
|
|
21
|
+
attributes :processing_errors, :delimiter
|
|
22
22
|
|
|
23
23
|
# The list a price-list import writes into; nil for every other type.
|
|
24
24
|
attribute :price_list_id do |import|
|
|
@@ -9,8 +9,7 @@ module Spree
|
|
|
9
9
|
name: :string,
|
|
10
10
|
group: [:string, nullable: true],
|
|
11
11
|
active: :boolean,
|
|
12
|
-
preferences: 'Record<string, unknown>'
|
|
13
|
-
preference_schema: "Array<{ key: string; type: string; default: unknown; choices?: string[] }>"
|
|
12
|
+
preferences: 'Record<string, unknown>'
|
|
14
13
|
|
|
15
14
|
attributes :name, :active,
|
|
16
15
|
created_at: :iso8601, updated_at: :iso8601
|
|
@@ -24,7 +23,6 @@ module Spree
|
|
|
24
23
|
end
|
|
25
24
|
|
|
26
25
|
attribute :preferences, &:serialized_preferences
|
|
27
|
-
attribute :preference_schema, &:serialized_preference_schema
|
|
28
26
|
end
|
|
29
27
|
end
|
|
30
28
|
end
|
|
@@ -5,16 +5,18 @@ module Spree
|
|
|
5
5
|
# Admin API Line Item Serializer
|
|
6
6
|
# Extends the store serializer with metadata visibility
|
|
7
7
|
class LineItemSerializer < V3::LineItemSerializer
|
|
8
|
+
without_formatted_money
|
|
9
|
+
|
|
8
10
|
# The Admin API has no guest gating — money fields inherited from the
|
|
9
11
|
# store serializer are always present, so override their nullability.
|
|
10
|
-
typelize price: [:string, nullable: false],
|
|
11
|
-
total: [:string, nullable: false],
|
|
12
|
-
adjustment_total: [:string, nullable: false],
|
|
13
|
-
additional_tax_total: [:string, nullable: false],
|
|
14
|
-
included_tax_total: [:string, nullable: false],
|
|
15
|
-
discount_total: [:string, nullable: false],
|
|
16
|
-
pre_tax_amount: [:string, nullable: false],
|
|
17
|
-
discounted_amount: [:string, nullable: false]
|
|
12
|
+
typelize price: [:string, nullable: false],
|
|
13
|
+
total: [:string, nullable: false],
|
|
14
|
+
adjustment_total: [:string, nullable: false],
|
|
15
|
+
additional_tax_total: [:string, nullable: false],
|
|
16
|
+
included_tax_total: [:string, nullable: false],
|
|
17
|
+
discount_total: [:string, nullable: false],
|
|
18
|
+
pre_tax_amount: [:string, nullable: false],
|
|
19
|
+
discounted_amount: [:string, nullable: false]
|
|
18
20
|
|
|
19
21
|
typelize metadata: 'Record<string, unknown>',
|
|
20
22
|
cost_price: [:string, nullable: true],
|
|
@@ -34,7 +36,7 @@ module Spree
|
|
|
34
36
|
# Base price, not resolved: resolving would call the pricing provider
|
|
35
37
|
# once per line on a read path that must stay provider-free.
|
|
36
38
|
attribute :catalog_price do |line_item|
|
|
37
|
-
line_item.variant&.amount_in(line_item.currency)
|
|
39
|
+
Spree::Money::Rounding.format(line_item.variant&.amount_in(line_item.currency), line_item.currency, unit_price: true)
|
|
38
40
|
end
|
|
39
41
|
|
|
40
42
|
# Which agreement priced this line. The list id is stamped on the
|
|
@@ -58,9 +60,7 @@ module Spree
|
|
|
58
60
|
line_item.price_list&.catalog&.name
|
|
59
61
|
end
|
|
60
62
|
|
|
61
|
-
|
|
62
|
-
line_item.cost_price&.to_s
|
|
63
|
-
end
|
|
63
|
+
money_attributes :cost_price, unit_price: true
|
|
64
64
|
|
|
65
65
|
prefixed_id_attributes :tax_category
|
|
66
66
|
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
module Spree
|
|
2
|
+
module Api
|
|
3
|
+
module V3
|
|
4
|
+
module Admin
|
|
5
|
+
# The dashboard names locales with Intl.DisplayNames in the admin's
|
|
6
|
+
# own language, so the Admin API sends the code alone.
|
|
7
|
+
class LocaleSerializer < V3::LocaleSerializer
|
|
8
|
+
_attributes.delete(:name)
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
@@ -3,6 +3,9 @@ module Spree
|
|
|
3
3
|
module V3
|
|
4
4
|
module Admin
|
|
5
5
|
class MarketSerializer < V3::MarketSerializer
|
|
6
|
+
# The Store API keeps this deprecated name until 6.1.
|
|
7
|
+
_attributes.delete(:country_isos)
|
|
8
|
+
|
|
6
9
|
typelize tax_provider: [:string, nullable: true, comment: 'Tax provider; null uses the store default. Built-in: internal. Provider gems register more.']
|
|
7
10
|
|
|
8
11
|
attributes created_at: :iso8601, updated_at: :iso8601
|
|
@@ -52,9 +52,10 @@ module Spree
|
|
|
52
52
|
# (a category image, a store logo) accepts on write. Handing it over
|
|
53
53
|
# lets those fields adopt a library file, sharing the blob instead of
|
|
54
54
|
# uploading a second copy — the same economics as placing media on a
|
|
55
|
-
# product, through endpoints that need no change.
|
|
55
|
+
# product, through endpoints that need no change. Minted fresh, with
|
|
56
|
+
# the same expiry as an upload, on every read.
|
|
56
57
|
attribute :signed_id do |asset|
|
|
57
|
-
asset.attachment_blob
|
|
58
|
+
Spree::Uploads.signed_id_for(asset.attachment_blob) if asset.attachment_blob
|
|
58
59
|
end
|
|
59
60
|
|
|
60
61
|
prefixed_id_attributes :viewable
|
|
@@ -9,6 +9,8 @@ module Spree
|
|
|
9
9
|
# place and this adds only what an operator needs on top: the payment
|
|
10
10
|
# shares, and the timestamps every admin surface carries.
|
|
11
11
|
class OrderGroupSerializer < V3::OrderGroupSerializer
|
|
12
|
+
without_formatted_money
|
|
13
|
+
|
|
12
14
|
typelize customer_id: 'string | null',
|
|
13
15
|
cart_id: 'string | null',
|
|
14
16
|
seller_count: :number,
|
|
@@ -12,8 +12,7 @@ module Spree
|
|
|
12
12
|
channel_id: :string,
|
|
13
13
|
position: :number,
|
|
14
14
|
active: :boolean,
|
|
15
|
-
preferences: 'Record<string, unknown>'
|
|
16
|
-
preference_schema: "Array<{ key: string; type: string; default: unknown; choices?: string[] }>"
|
|
15
|
+
preferences: 'Record<string, unknown>'
|
|
17
16
|
|
|
18
17
|
attributes :position, :active
|
|
19
18
|
attributes created_at: :iso8601, updated_at: :iso8601
|
|
@@ -25,7 +24,6 @@ module Spree
|
|
|
25
24
|
prefixed_id_attributes :channel
|
|
26
25
|
|
|
27
26
|
attribute :preferences, &:serialized_preferences
|
|
28
|
-
attribute :preference_schema, &:serialized_preference_schema
|
|
29
27
|
|
|
30
28
|
end
|
|
31
29
|
end
|
|
@@ -5,6 +5,8 @@ module Spree
|
|
|
5
5
|
# Admin API Order Serializer
|
|
6
6
|
# Full order data including admin-only fields
|
|
7
7
|
class OrderSerializer < V3::OrderSerializer
|
|
8
|
+
without_formatted_money
|
|
9
|
+
|
|
8
10
|
include Concerns::ExternalReferencesAttribute
|
|
9
11
|
|
|
10
12
|
|
|
@@ -16,37 +18,23 @@ module Spree
|
|
|
16
18
|
|
|
17
19
|
# The Admin API has no guest gating — money fields inherited from the
|
|
18
20
|
# store serializer are always present, so override their nullability.
|
|
19
|
-
typelize item_total: [:string, nullable: false],
|
|
20
|
-
delivery_total: [:string, nullable: false],
|
|
21
|
-
adjustment_total: [:string, nullable: false],
|
|
22
|
-
discount_total: [:string, nullable: false],
|
|
23
|
-
tax_total: [:string, nullable: false],
|
|
24
|
-
included_tax_total: [:string, nullable: false],
|
|
25
|
-
additional_tax_total: [:string, nullable: false],
|
|
26
|
-
store_credit_total: [:string, nullable: false],
|
|
27
|
-
gift_card_total: [:string, nullable: false],
|
|
28
|
-
fee_total: [:string, nullable: false],
|
|
29
|
-
total: [:string, nullable: false],
|
|
30
|
-
amount_due: [:string, nullable: false]
|
|
31
|
-
|
|
32
|
-
# Back-office only: what the marketplace earned on this sale — the fee,
|
|
33
|
-
# the tax charged on it, and the two together. Never on the store
|
|
34
|
-
# serializer: a commission settles between the platform and the
|
|
35
|
-
# seller, and the shopper does not pay it.
|
|
36
|
-
#
|
|
37
|
-
# The tax stands on its own because it is separately reportable —
|
|
38
|
-
# the platform files it as output tax on a B2B supply to the seller.
|
|
39
|
-
typelize commission_amount_total: [:string, nullable: false],
|
|
40
|
-
display_commission_amount_total: [:string, nullable: false],
|
|
41
|
-
commission_tax_total: [:string, nullable: false],
|
|
42
|
-
display_commission_tax_total: [:string, nullable: false],
|
|
43
|
-
commission_total: [:string, nullable: false],
|
|
44
|
-
display_commission_total: [:string, nullable: false]
|
|
21
|
+
typelize item_total: [:string, nullable: false],
|
|
22
|
+
delivery_total: [:string, nullable: false],
|
|
23
|
+
adjustment_total: [:string, nullable: false],
|
|
24
|
+
discount_total: [:string, nullable: false],
|
|
25
|
+
tax_total: [:string, nullable: false],
|
|
26
|
+
included_tax_total: [:string, nullable: false],
|
|
27
|
+
additional_tax_total: [:string, nullable: false],
|
|
28
|
+
store_credit_total: [:string, nullable: false],
|
|
29
|
+
gift_card_total: [:string, nullable: false],
|
|
30
|
+
fee_total: [:string, nullable: false],
|
|
31
|
+
total: [:string, nullable: false],
|
|
32
|
+
amount_due: [:string, nullable: false]
|
|
45
33
|
|
|
46
34
|
typelize status: [:string, enum: Spree::Order::STATUSES],
|
|
47
35
|
last_ip_address: [:string, nullable: true],
|
|
48
36
|
considered_risky: :boolean, confirmation_delivered: :boolean,
|
|
49
|
-
store_owner_notification_delivered: :boolean,
|
|
37
|
+
store_owner_notification_delivered: [:boolean, nullable: true],
|
|
50
38
|
internal_note: [:string, nullable: true], internal_note_html: [:string, nullable: true],
|
|
51
39
|
approver_id: [:string, nullable: true],
|
|
52
40
|
approver_type: [:string, nullable: true, enum: Spree::Actor::BUILT_IN_KINDS, enum_type_name: 'ActorKind'],
|
|
@@ -59,21 +47,33 @@ module Spree
|
|
|
59
47
|
cancel_reason_id: [:string, nullable: true],
|
|
60
48
|
cancel_reason_name: [:string, nullable: true],
|
|
61
49
|
cancel_note: [:string, nullable: true],
|
|
62
|
-
payment_total: :string, display_payment_total: :string,
|
|
63
50
|
tags: [:string, multi: true],
|
|
64
51
|
metadata: 'Record<string, unknown>'
|
|
65
52
|
|
|
66
53
|
# Admin-only attributes
|
|
67
54
|
attributes :status, :last_ip_address, :considered_risky,
|
|
68
55
|
:confirmation_delivered, :store_owner_notification_delivered,
|
|
69
|
-
:
|
|
70
|
-
:cancel_note,
|
|
71
|
-
:commission_amount_total, :display_commission_amount_total,
|
|
72
|
-
:commission_tax_total, :display_commission_tax_total,
|
|
73
|
-
:commission_total, :display_commission_total,
|
|
56
|
+
:metadata, :cancel_note,
|
|
74
57
|
canceled_at: :iso8601, approved_at: :iso8601,
|
|
75
58
|
created_at: :iso8601, updated_at: :iso8601
|
|
76
59
|
|
|
60
|
+
money_attributes :payment_total
|
|
61
|
+
typelize payment_total: [:string, nullable: false]
|
|
62
|
+
|
|
63
|
+
# Back-office only: what the marketplace earned on this sale — the fee,
|
|
64
|
+
# the tax charged on it, and the two together. Never on the store
|
|
65
|
+
# serializer: a commission settles between the platform and the
|
|
66
|
+
# seller, and the shopper does not pay it.
|
|
67
|
+
#
|
|
68
|
+
# The tax stands on its own because it is separately reportable —
|
|
69
|
+
# the platform files it as output tax on a B2B supply to the seller.
|
|
70
|
+
money_attributes :commission_amount_total,
|
|
71
|
+
:commission_tax_total,
|
|
72
|
+
:commission_total
|
|
73
|
+
typelize commission_amount_total: [:string, nullable: false],
|
|
74
|
+
commission_tax_total: [:string, nullable: false],
|
|
75
|
+
commission_total: [:string, nullable: false]
|
|
76
|
+
|
|
77
77
|
prefixed_id_attributes :preferred_stock_location
|
|
78
78
|
|
|
79
79
|
# Our own endpoint rather than a pre-signed storage URL: the
|
|
@@ -4,14 +4,12 @@ module Spree
|
|
|
4
4
|
module Admin
|
|
5
5
|
class PaymentMethodSerializer < V3::PaymentMethodSerializer
|
|
6
6
|
typelize active: :boolean,
|
|
7
|
-
auto_capture: [:boolean, nullable: true],
|
|
8
7
|
capture_method: "'checkout' | 'on_dispatch' | 'manual' | null",
|
|
9
8
|
resolved_capture_method: "'checkout' | 'on_dispatch' | 'manual'",
|
|
10
9
|
storefront_visible: :boolean,
|
|
11
10
|
position: :number,
|
|
12
11
|
metadata: 'Record<string, unknown>',
|
|
13
12
|
preferences: 'Record<string, unknown>',
|
|
14
|
-
preference_schema: "Array<{ key: string; type: string; default: unknown; choices?: string[] }>",
|
|
15
13
|
logo_url: [:string, nullable: true],
|
|
16
14
|
docs_url: [:string, nullable: true],
|
|
17
15
|
third_party: :boolean
|
|
@@ -19,12 +17,11 @@ module Spree
|
|
|
19
17
|
# Null capture_method means the method inherits from its store;
|
|
20
18
|
# resolved_capture_method is what actually applies, so the dashboard
|
|
21
19
|
# can show the inherited value.
|
|
22
|
-
attributes :metadata, :active, :
|
|
20
|
+
attributes :metadata, :active, :capture_method, :resolved_capture_method,
|
|
23
21
|
:storefront_visible, :position,
|
|
24
22
|
created_at: :iso8601, updated_at: :iso8601
|
|
25
23
|
|
|
26
24
|
attribute :preferences, &:serialized_preferences
|
|
27
|
-
attribute :preference_schema, &:serialized_preference_schema
|
|
28
25
|
attribute(:logo_url) { |payment_method| payment_method.class.logo_url }
|
|
29
26
|
attribute(:docs_url) { |payment_method| payment_method.class.docs_url }
|
|
30
27
|
attribute(:third_party) { |payment_method| payment_method.class.third_party? }
|
|
@@ -3,12 +3,13 @@ module Spree
|
|
|
3
3
|
module V3
|
|
4
4
|
module Admin
|
|
5
5
|
class PaymentSerializer < V3::PaymentSerializer
|
|
6
|
+
without_formatted_money
|
|
7
|
+
|
|
6
8
|
# The Admin API has no guest gating — money fields inherited from the
|
|
7
9
|
# store serializer are always present, so override their nullability.
|
|
8
|
-
typelize amount: [:string, nullable: false]
|
|
10
|
+
typelize amount: [:string, nullable: false]
|
|
9
11
|
|
|
10
12
|
typelize metadata: 'Record<string, unknown>',
|
|
11
|
-
captured_amount: :string,
|
|
12
13
|
order_id: [:string, nullable: true],
|
|
13
14
|
avs_response: [:string, nullable: true],
|
|
14
15
|
cvv_response_code: [:string, nullable: true],
|
|
@@ -17,7 +18,9 @@ module Spree
|
|
|
17
18
|
attributes :metadata, :avs_response, :cvv_response_code, :cvv_response_message,
|
|
18
19
|
created_at: :iso8601, updated_at: :iso8601
|
|
19
20
|
|
|
20
|
-
|
|
21
|
+
money_attributes :captured_amount
|
|
22
|
+
typelize captured_amount: [:string, nullable: false]
|
|
23
|
+
|
|
21
24
|
prefixed_id_attributes :order
|
|
22
25
|
|
|
23
26
|
# Override inherited associations to use admin serializers
|
|
@@ -11,23 +11,22 @@ module Spree
|
|
|
11
11
|
AMOUNTS = %i[authorized_amount captured_amount refunded_amount claimed_amount
|
|
12
12
|
net_captured_amount refundable_amount].freeze
|
|
13
13
|
|
|
14
|
-
typelize currency: :string,
|
|
14
|
+
typelize currency: [:string, enum: Spree::Money::Rounding::CURRENCY_CODES, enum_type_name: 'CurrencyCode'],
|
|
15
15
|
payment_id: :string,
|
|
16
16
|
payment_number: 'string | null',
|
|
17
17
|
order_id: :string,
|
|
18
18
|
order_number: 'string | null',
|
|
19
|
-
authorized_amount: :string,
|
|
20
|
-
captured_amount: :string,
|
|
21
|
-
refunded_amount: :string,
|
|
22
|
-
claimed_amount: :string,
|
|
23
|
-
net_captured_amount: :string,
|
|
24
|
-
refundable_amount: :string
|
|
19
|
+
authorized_amount: :string,
|
|
20
|
+
captured_amount: :string,
|
|
21
|
+
refunded_amount: :string,
|
|
22
|
+
claimed_amount: :string,
|
|
23
|
+
net_captured_amount: :string,
|
|
24
|
+
refundable_amount: :string
|
|
25
25
|
|
|
26
26
|
attributes :currency, created_at: :iso8601, updated_at: :iso8601
|
|
27
27
|
|
|
28
28
|
AMOUNTS.each do |amount|
|
|
29
|
-
attribute(amount) { |split| split.public_send(amount).
|
|
30
|
-
attribute(:"display_#{amount}") { |split| split.public_send(:"display_#{amount}").to_s }
|
|
29
|
+
attribute(amount) { |split| Spree::Money::Rounding.format(split.public_send(amount), split.currency) }
|
|
31
30
|
end
|
|
32
31
|
|
|
33
32
|
attribute(:payment_id) { |split| split.payment&.prefixed_id }
|
|
@@ -6,15 +6,12 @@ module Spree
|
|
|
6
6
|
# the list itself — the storefront sees resolved prices, never the
|
|
7
7
|
# arithmetic behind them.
|
|
8
8
|
class PriceAdjustmentTierSerializer < V3::BaseSerializer
|
|
9
|
-
typelize min_quantity: :number
|
|
9
|
+
typelize min_quantity: :number
|
|
10
10
|
|
|
11
11
|
attributes :min_quantity
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
attribute :percentage do |tier|
|
|
16
|
-
tier.percentage&.to_s
|
|
17
|
-
end
|
|
13
|
+
rate_attributes :percentage
|
|
14
|
+
typelize percentage: [:string, nullable: false]
|
|
18
15
|
end
|
|
19
16
|
end
|
|
20
17
|
end
|
|
@@ -5,9 +5,11 @@ module Spree
|
|
|
5
5
|
module V3
|
|
6
6
|
module Admin
|
|
7
7
|
class PriceHistorySerializer < V3::PriceHistorySerializer
|
|
8
|
+
without_formatted_money
|
|
9
|
+
_attributes.delete(:amount_in_cents)
|
|
10
|
+
|
|
8
11
|
typelize variant_id: :string,
|
|
9
12
|
price_id: :string,
|
|
10
|
-
compare_at_amount: [:string, nullable: true],
|
|
11
13
|
created_at: :string
|
|
12
14
|
|
|
13
15
|
attribute :variant_id do |price_history|
|
|
@@ -18,7 +20,9 @@ module Spree
|
|
|
18
20
|
price_history.price.prefixed_id
|
|
19
21
|
end
|
|
20
22
|
|
|
21
|
-
|
|
23
|
+
money_attributes :compare_at_amount, unit_price: true
|
|
24
|
+
|
|
25
|
+
attributes created_at: :iso8601
|
|
22
26
|
end
|
|
23
27
|
end
|
|
24
28
|
end
|
|
@@ -27,11 +27,7 @@ module Spree
|
|
|
27
27
|
starts_at: :iso8601, ends_at: :iso8601, deleted_at: :iso8601,
|
|
28
28
|
created_at: :iso8601, updated_at: :iso8601
|
|
29
29
|
|
|
30
|
-
|
|
31
|
-
# wire — a float would round the merchant's own figure.
|
|
32
|
-
attribute :price_adjustment_percentage do |price_list|
|
|
33
|
-
price_list.price_adjustment_percentage&.to_s
|
|
34
|
-
end
|
|
30
|
+
rate_attributes :price_adjustment_percentage
|
|
35
31
|
|
|
36
32
|
attribute :automatic_pricing, &:automatic_pricing?
|
|
37
33
|
|
|
@@ -8,8 +8,7 @@ module Spree
|
|
|
8
8
|
class PriceRuleSerializer < V3::BaseSerializer
|
|
9
9
|
typelize type: [:string, comment: 'Rule type. Built-in: channel_rule, customer_group_rule, market_rule, user_rule, volume_rule, zone_rule. Extensions may register more.'],
|
|
10
10
|
price_list_id: :string,
|
|
11
|
-
preferences: 'Record<string, unknown>'
|
|
12
|
-
preference_schema: 'Array<{ key: string; type: string; default: unknown }>'
|
|
11
|
+
preferences: 'Record<string, unknown>'
|
|
13
12
|
|
|
14
13
|
attributes created_at: :iso8601, updated_at: :iso8601
|
|
15
14
|
|
|
@@ -20,7 +19,6 @@ module Spree
|
|
|
20
19
|
prefixed_id_attributes :price_list
|
|
21
20
|
|
|
22
21
|
attribute :preferences, &:serialized_preferences
|
|
23
|
-
attribute :preference_schema, &:serialized_preference_schema
|
|
24
22
|
|
|
25
23
|
# Embeds skip rules that don't carry the association (e.g.
|
|
26
24
|
# VolumeRule has no markets/customers — the keys are omitted).
|
|
@@ -5,6 +5,10 @@ module Spree
|
|
|
5
5
|
# Admin API Price Serializer
|
|
6
6
|
# Extends Store Price Serializer with admin-only fields
|
|
7
7
|
class PriceSerializer < V3::PriceSerializer
|
|
8
|
+
without_formatted_money
|
|
9
|
+
_attributes.delete(:amount_in_cents)
|
|
10
|
+
_attributes.delete(:compare_at_amount_in_cents)
|
|
11
|
+
|
|
8
12
|
typelize variant_id: [:string, nullable: true],
|
|
9
13
|
min_quantity: :number,
|
|
10
14
|
created_at: :string,
|
|
@@ -6,6 +6,8 @@ module Spree
|
|
|
6
6
|
# Full product data including admin-only fields
|
|
7
7
|
# Extends the store serializer with additional attributes
|
|
8
8
|
class ProductSerializer < V3::ProductSerializer
|
|
9
|
+
without_formatted_money
|
|
10
|
+
|
|
9
11
|
include Concerns::ExternalReferencesAttribute
|
|
10
12
|
|
|
11
13
|
include Spree::Api::V3::Admin::Translatable
|
|
@@ -7,13 +7,13 @@ module Spree
|
|
|
7
7
|
# Serializes Spree::PromotionAction (and its STI subclasses) for the
|
|
8
8
|
# admin promotion editor. The shape is intentionally generic so a
|
|
9
9
|
# single component can render any subclass — `preferences` is the
|
|
10
|
-
# current value hash, `
|
|
10
|
+
# current value hash, described by the `schema` its type's entry in
|
|
11
|
+
# `/promotion_actions/types` carries.
|
|
11
12
|
class PromotionActionSerializer < BaseSerializer
|
|
12
13
|
typelize type: [:string, comment: 'Action type. Built-in: create_adjustment, create_item_adjustments, create_line_items, free_shipping. Extensions may register more.'],
|
|
13
14
|
promotion_id: :string,
|
|
14
15
|
preferences: 'Record<string, unknown>',
|
|
15
|
-
|
|
16
|
-
calculator: "{ type: string; preferences: Record<string, unknown>; preference_schema: Array<{ key: string; type: string; default: unknown }> } | null",
|
|
16
|
+
calculator: 'TypedPromotionCalculator | null',
|
|
17
17
|
line_items: 'Array<{ variant_id: string; quantity: number }> | null'
|
|
18
18
|
|
|
19
19
|
attributes created_at: :iso8601, updated_at: :iso8601
|
|
@@ -25,7 +25,6 @@ module Spree
|
|
|
25
25
|
prefixed_id_attributes :promotion
|
|
26
26
|
|
|
27
27
|
attribute :preferences, &:serialized_preferences
|
|
28
|
-
attribute :preference_schema, &:serialized_preference_schema
|
|
29
28
|
|
|
30
29
|
# Calculator is exposed as a nested object so the SPA can render
|
|
31
30
|
# the calculator picker + its own preference fields. Null for
|
|
@@ -38,8 +37,7 @@ module Spree
|
|
|
38
37
|
calc = action.calculator
|
|
39
38
|
{
|
|
40
39
|
type: calc.class.api_type,
|
|
41
|
-
preferences: calc.serialized_preferences
|
|
42
|
-
preference_schema: calc.serialized_preference_schema
|
|
40
|
+
preferences: calc.serialized_preferences
|
|
43
41
|
}
|
|
44
42
|
end
|
|
45
43
|
|
|
@@ -11,7 +11,6 @@ module Spree
|
|
|
11
11
|
typelize type: [:string, comment: 'Rule type. Built-in: currency, country, channel, market, item_total, product, customer, customer_group, first_order, customer_logged_in, one_use_per_user, category, option_value. Extensions may register more.'],
|
|
12
12
|
promotion_id: :string,
|
|
13
13
|
preferences: 'Record<string, unknown>',
|
|
14
|
-
preference_schema: "Array<{ key: string; type: string; default: unknown; choices?: string[] }>",
|
|
15
14
|
product_ids: 'Array<string> | null',
|
|
16
15
|
category_ids: 'Array<string> | null',
|
|
17
16
|
customer_ids: 'Array<string> | null',
|
|
@@ -26,7 +25,6 @@ module Spree
|
|
|
26
25
|
prefixed_id_attributes :promotion
|
|
27
26
|
|
|
28
27
|
attribute :preferences, &:serialized_preferences
|
|
29
|
-
attribute :preference_schema, &:serialized_preference_schema
|
|
30
28
|
|
|
31
29
|
# Association IDs for rules that wire products/taxons/users through
|
|
32
30
|
# join tables. Returned as prefixed IDs to match the rest of the
|
|
@@ -9,11 +9,7 @@ module Spree
|
|
|
9
9
|
quantity_rejected: :number,
|
|
10
10
|
quantity_over: :number,
|
|
11
11
|
outstanding: :number,
|
|
12
|
-
|
|
13
|
-
display_unit_cost: :string,
|
|
14
|
-
total_cost: :string,
|
|
15
|
-
display_total_cost: :string,
|
|
16
|
-
currency: 'string | null',
|
|
12
|
+
currency: [:string, nullable: true, enum: Spree::Money::Rounding::CURRENCY_CODES, enum_type_name: 'CurrencyCode'],
|
|
17
13
|
purchase_order_id: 'string | null',
|
|
18
14
|
thumbnail_url: 'string | null',
|
|
19
15
|
product_id: 'string | null',
|
|
@@ -26,13 +22,11 @@ module Spree
|
|
|
26
22
|
:outstanding, :currency,
|
|
27
23
|
created_at: :iso8601, updated_at: :iso8601
|
|
28
24
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
end
|
|
25
|
+
money_attributes :unit_cost, unit_price: true
|
|
26
|
+
money_attributes :total_cost
|
|
27
|
+
typelize unit_cost: [:string, nullable: false],
|
|
28
|
+
total_cost: [:string, nullable: false]
|
|
34
29
|
|
|
35
|
-
attributes total_cost: :string, display_unit_cost: :string, display_total_cost: :string
|
|
36
30
|
attribute :purchase_order_id do |item|
|
|
37
31
|
Spree::PurchaseOrder.prefixed_id_for(item.purchase_order_id)
|
|
38
32
|
end
|
|
@@ -7,7 +7,7 @@ module Spree
|
|
|
7
7
|
class PurchaseOrderSerializer < V3::BaseSerializer
|
|
8
8
|
typelize number: :string,
|
|
9
9
|
status: :string,
|
|
10
|
-
currency: :string,
|
|
10
|
+
currency: [:string, enum: Spree::Money::Rounding::CURRENCY_CODES, enum_type_name: 'CurrencyCode'],
|
|
11
11
|
reference: 'string | null',
|
|
12
12
|
notes: 'string | null',
|
|
13
13
|
supplier_id: 'string | null',
|
|
@@ -21,8 +21,6 @@ module Spree
|
|
|
21
21
|
quantity_rejected_total: :number,
|
|
22
22
|
quantity_ordered_total: :number,
|
|
23
23
|
quantity_received_total: :number,
|
|
24
|
-
subtotal: :string,
|
|
25
|
-
display_subtotal: :string,
|
|
26
24
|
editable: :boolean,
|
|
27
25
|
ordered_at: 'string | null',
|
|
28
26
|
received_at: 'string | null',
|
|
@@ -56,7 +54,9 @@ module Spree
|
|
|
56
54
|
|
|
57
55
|
attribute :editable, &:editable?
|
|
58
56
|
|
|
59
|
-
|
|
57
|
+
money_attributes :subtotal
|
|
58
|
+
typelize subtotal: [:string, nullable: false]
|
|
59
|
+
|
|
60
60
|
prefixed_id_attributes :supplier, :destination_location
|
|
61
61
|
|
|
62
62
|
many :items,
|