spree_api 4.3.0 → 4.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/concerns/spree/api/v2/caching.rb +7 -3
- data/app/controllers/concerns/spree/api/v2/coupon_codes_helper.rb +29 -0
- data/app/controllers/concerns/spree/api/v2/number_resource.rb +11 -0
- data/app/controllers/concerns/spree/api/v2/platform/nested_set_reposition_concern.rb +37 -0
- data/app/controllers/concerns/spree/api/v2/platform/promotion_calculator_params.rb +17 -0
- data/app/controllers/concerns/spree/api/v2/platform/promotion_rule_params.rb +16 -0
- data/app/controllers/concerns/spree/api/v2/storefront/metadata_controller_concern.rb +18 -0
- data/app/controllers/spree/api/v1/checkouts_controller.rb +1 -1
- data/app/controllers/spree/api/v2/base_controller.rb +7 -5
- data/app/controllers/spree/api/v2/platform/adjustments_controller.rb +19 -0
- data/app/controllers/spree/api/v2/platform/classifications_controller.rb +1 -22
- data/app/controllers/spree/api/v2/platform/cms_pages_controller.rb +4 -0
- data/app/controllers/spree/api/v2/platform/cms_sections_controller.rb +13 -18
- data/app/controllers/spree/api/v2/platform/digital_links_controller.rb +25 -0
- data/app/controllers/spree/api/v2/platform/digitals_controller.rb +19 -0
- data/app/controllers/spree/api/v2/platform/line_items_controller.rb +59 -0
- data/app/controllers/spree/api/v2/platform/menu_items_controller.rb +5 -19
- data/app/controllers/spree/api/v2/platform/menus_controller.rb +0 -4
- data/app/controllers/spree/api/v2/platform/orders_controller.rb +163 -0
- data/app/controllers/spree/api/v2/platform/payment_methods_controller.rb +27 -0
- data/app/controllers/spree/api/v2/platform/payments_controller.rb +17 -0
- data/app/controllers/spree/api/v2/platform/promotion_actions_controller.rb +30 -0
- data/app/controllers/spree/api/v2/platform/promotion_categories_controller.rb +19 -0
- data/app/controllers/spree/api/v2/platform/promotion_rules_controller.rb +25 -0
- data/app/controllers/spree/api/v2/platform/promotions_controller.rb +31 -0
- data/app/controllers/spree/api/v2/platform/resource_controller.rb +47 -16
- data/app/controllers/spree/api/v2/platform/roles_controller.rb +15 -0
- data/app/controllers/spree/api/v2/platform/shipments_controller.rb +143 -0
- data/app/controllers/spree/api/v2/platform/shipping_categories_controller.rb +15 -0
- data/app/controllers/spree/api/v2/platform/shipping_methods_controller.rb +24 -0
- data/app/controllers/spree/api/v2/platform/states_controller.rb +19 -0
- data/app/controllers/spree/api/v2/platform/stock_items_controller.rb +19 -0
- data/app/controllers/spree/api/v2/platform/stock_locations_controller.rb +19 -0
- data/app/controllers/spree/api/v2/platform/store_credit_categories_controller.rb +15 -0
- data/app/controllers/spree/api/v2/platform/store_credit_types_controller.rb +15 -0
- data/app/controllers/spree/api/v2/platform/store_credits_controller.rb +19 -0
- data/app/controllers/spree/api/v2/platform/tax_categories_controller.rb +19 -0
- data/app/controllers/spree/api/v2/platform/tax_rates_controller.rb +23 -0
- data/app/controllers/spree/api/v2/platform/taxonomies_controller.rb +19 -0
- data/app/controllers/spree/api/v2/platform/taxons_controller.rb +25 -0
- data/app/controllers/spree/api/v2/platform/users_controller.rb +4 -0
- data/app/controllers/spree/api/v2/platform/variants_controller.rb +19 -0
- data/app/controllers/spree/api/v2/platform/webhooks/events_controller.rb +21 -0
- data/app/controllers/spree/api/v2/platform/webhooks/subscribers_controller.rb +21 -0
- data/app/controllers/spree/api/v2/platform/wished_items_controller.rb +19 -0
- data/app/controllers/spree/api/v2/platform/wishlists_controller.rb +19 -0
- data/app/controllers/spree/api/v2/platform/zones_controller.rb +19 -0
- data/app/controllers/spree/api/v2/resource_controller.rb +3 -3
- data/app/controllers/spree/api/v2/storefront/account/addresses_controller.rb +2 -2
- data/app/controllers/spree/api/v2/storefront/account/credit_cards_controller.rb +4 -1
- data/app/controllers/spree/api/v2/storefront/cart_controller.rb +18 -28
- data/app/controllers/spree/api/v2/storefront/checkout_controller.rb +24 -0
- data/app/controllers/spree/api/v2/storefront/digitals_controller.rb +54 -0
- data/app/controllers/spree/api/v2/storefront/wishlists_controller.rb +171 -0
- data/app/helpers/spree/api/v2/collection_options_helpers.rb +1 -1
- data/app/jobs/spree/webhooks/subscribers/make_request_job.rb +17 -0
- data/app/models/concerns/spree/webhooks/has_webhooks.rb +60 -0
- data/app/models/spree/api/webhooks/order_decorator.rb +43 -0
- data/app/models/spree/api/webhooks/payment_decorator.rb +26 -0
- data/app/models/spree/api/webhooks/product_decorator.rb +27 -0
- data/app/models/spree/api/webhooks/shipment_decorator.rb +21 -0
- data/app/models/spree/api/webhooks/stock_item_decorator.rb +43 -0
- data/app/models/spree/api/webhooks/stock_movement_decorator.rb +52 -0
- data/app/models/spree/api/webhooks/variant_decorator.rb +26 -0
- data/app/models/spree/oauth_access_grant.rb +7 -0
- data/app/models/spree/oauth_access_token.rb +7 -0
- data/app/models/spree/oauth_application.rb +15 -0
- data/app/models/spree/webhooks/base.rb +11 -0
- data/app/models/spree/webhooks/event.rb +12 -0
- data/app/models/spree/webhooks/subscriber.rb +57 -0
- data/app/serializers/concerns/spree/api/v2/resource_serializer_concern.rb +19 -1
- data/app/serializers/spree/api/v2/base_serializer.rb +11 -4
- data/app/serializers/spree/api/v2/platform/address_serializer.rb +1 -1
- data/app/serializers/spree/api/v2/platform/adjustment_serializer.rb +20 -0
- data/app/serializers/spree/api/v2/platform/asset_serializer.rb +13 -0
- data/app/serializers/spree/api/v2/platform/calculator_serializer.rb +17 -0
- data/app/serializers/spree/api/v2/platform/classification_serializer.rb +1 -1
- data/app/serializers/spree/api/v2/platform/cms_page_serializer.rb +1 -1
- data/app/serializers/spree/api/v2/platform/cms_section_serializer.rb +8 -1
- data/app/serializers/spree/api/v2/platform/country_serializer.rb +1 -1
- data/app/serializers/spree/api/v2/platform/credit_card_serializer.rb +14 -0
- data/app/serializers/spree/api/v2/platform/customer_return_serializer.rb +17 -0
- data/app/serializers/spree/api/v2/platform/digital_link_serializer.rb +16 -0
- data/app/serializers/spree/api/v2/platform/digital_serializer.rb +30 -0
- data/app/serializers/spree/api/v2/platform/feature_page_serializer.rb +11 -0
- data/app/serializers/spree/api/v2/platform/homepage_serializer.rb +11 -0
- data/app/serializers/spree/api/v2/platform/inventory_unit_serializer.rb +19 -0
- data/app/serializers/spree/api/v2/platform/line_item_serializer.rb +19 -0
- data/app/serializers/spree/api/v2/platform/log_entry_serializer.rb +13 -0
- data/app/serializers/spree/api/v2/platform/menu_item_serializer.rb +1 -1
- data/app/serializers/spree/api/v2/platform/menu_serializer.rb +1 -1
- data/app/serializers/spree/api/v2/platform/option_type_serializer.rb +1 -1
- data/app/serializers/spree/api/v2/platform/option_value_serializer.rb +1 -1
- data/app/serializers/spree/api/v2/platform/order_promotion_serializer.rb +14 -0
- data/app/serializers/spree/api/v2/platform/order_serializer.rb +31 -0
- data/app/serializers/spree/api/v2/platform/payment_capture_event_serializer.rb +13 -0
- data/app/serializers/spree/api/v2/platform/payment_method_serializer.rb +18 -0
- data/app/serializers/spree/api/v2/platform/payment_serializer.rb +21 -0
- data/app/serializers/spree/api/v2/platform/price_serializer.rb +19 -0
- data/app/serializers/spree/api/v2/platform/product_property_serializer.rb +1 -1
- data/app/serializers/spree/api/v2/platform/product_serializer.rb +7 -3
- data/app/serializers/spree/api/v2/platform/promotion_action_line_item_serializer.rb +14 -0
- data/app/serializers/spree/api/v2/platform/promotion_action_serializer.rb +19 -0
- data/app/serializers/spree/api/v2/platform/promotion_category_serializer.rb +13 -0
- data/app/serializers/spree/api/v2/platform/promotion_rule_serializer.rb +21 -0
- data/app/serializers/spree/api/v2/platform/promotion_serializer.rb +17 -0
- data/app/serializers/spree/api/v2/platform/property_serializer.rb +11 -0
- data/app/serializers/spree/api/v2/platform/prototype_serializer.rb +15 -0
- data/app/serializers/spree/api/v2/platform/refund_reason_serializer.rb +11 -0
- data/app/serializers/spree/api/v2/platform/refund_serializer.rb +16 -0
- data/app/serializers/spree/api/v2/platform/reimbursement_credit_serializer.rb +10 -0
- data/app/serializers/spree/api/v2/platform/reimbursement_serializer.rb +18 -0
- data/app/serializers/spree/api/v2/platform/reimbursement_type_serializer.rb +11 -0
- data/app/serializers/spree/api/v2/platform/return_authorization_reason_serializer.rb +11 -0
- data/app/serializers/spree/api/v2/platform/return_authorization_serializer.rb +17 -0
- data/app/serializers/spree/api/v2/platform/return_item_serializer.rb +16 -0
- data/app/serializers/spree/api/v2/platform/role_serializer.rb +11 -0
- data/app/serializers/spree/api/v2/platform/shipment_serializer.rb +22 -0
- data/app/serializers/spree/api/v2/platform/shipping_category_serializer.rb +11 -0
- data/app/serializers/spree/api/v2/platform/shipping_method_serializer.rb +16 -0
- data/app/serializers/spree/api/v2/platform/shipping_rate_serializer.rb +15 -0
- data/app/serializers/spree/api/v2/platform/standard_page_serializer.rb +11 -0
- data/app/serializers/spree/api/v2/platform/state_change_serializer.rb +13 -0
- data/app/serializers/spree/api/v2/platform/state_serializer.rb +1 -1
- data/app/serializers/spree/api/v2/platform/stock_item_serializer.rb +1 -3
- data/app/serializers/spree/api/v2/platform/stock_location_serializer.rb +2 -4
- data/app/serializers/spree/api/v2/platform/stock_movement_serializer.rb +11 -0
- data/app/serializers/spree/api/v2/platform/stock_transfer_serializer.rb +15 -0
- data/app/serializers/spree/api/v2/platform/store_credit_category_serializer.rb +12 -0
- data/app/serializers/spree/api/v2/platform/store_credit_event_serializer.rb +14 -0
- data/app/serializers/spree/api/v2/platform/store_credit_serializer.rb +18 -0
- data/app/serializers/spree/api/v2/platform/store_credit_type_serializer.rb +12 -0
- data/app/serializers/spree/api/v2/platform/store_serializer.rb +1 -1
- data/app/serializers/spree/api/v2/platform/tax_category_serializer.rb +2 -2
- data/app/serializers/spree/api/v2/platform/tax_rate_serializer.rb +14 -0
- data/app/serializers/spree/api/v2/platform/taxon_serializer.rb +1 -1
- data/app/serializers/spree/api/v2/platform/taxonomy_serializer.rb +1 -1
- data/app/serializers/spree/api/v2/platform/user_serializer.rb +1 -1
- data/app/serializers/spree/api/v2/platform/variant_serializer.rb +3 -2
- data/app/serializers/spree/api/v2/platform/webhooks/event_serializer.rb +15 -0
- data/app/serializers/spree/api/v2/platform/webhooks/subscriber_serializer.rb +13 -0
- data/app/serializers/spree/api/v2/platform/wished_item_serializer.rb +29 -0
- data/app/serializers/spree/api/v2/platform/wishlist_serializer.rb +19 -0
- data/app/serializers/spree/api/v2/platform/zone_member_serializer.rb +13 -0
- data/app/serializers/spree/api/v2/platform/zone_serializer.rb +13 -0
- data/app/serializers/spree/v2/storefront/address_serializer.rb +1 -1
- data/app/serializers/spree/v2/storefront/cart_serializer.rb +1 -1
- data/app/serializers/spree/v2/storefront/cms_section_serializer.rb +5 -1
- data/app/serializers/spree/v2/storefront/credit_card_serializer.rb +1 -1
- data/app/serializers/spree/v2/storefront/digital_link_serializer.rb +11 -0
- data/app/serializers/spree/v2/storefront/estimated_shipping_rate_serializer.rb +2 -2
- data/app/serializers/spree/v2/storefront/line_item_serializer.rb +2 -1
- data/app/serializers/spree/v2/storefront/option_type_serializer.rb +1 -1
- data/app/serializers/spree/v2/storefront/option_value_serializer.rb +1 -1
- data/app/serializers/spree/v2/storefront/payment_method_serializer.rb +1 -1
- data/app/serializers/spree/v2/storefront/payment_serializer.rb +1 -1
- data/app/serializers/spree/v2/storefront/product_serializer.rb +2 -2
- data/app/serializers/spree/v2/storefront/promotion_serializer.rb +1 -1
- data/app/serializers/spree/v2/storefront/shipment_serializer.rb +2 -1
- data/app/serializers/spree/v2/storefront/store_credit_serializer.rb +1 -1
- data/app/serializers/spree/v2/storefront/store_serializer.rb +1 -1
- data/app/serializers/spree/v2/storefront/taxon_serializer.rb +1 -1
- data/app/serializers/spree/v2/storefront/taxonomy_serializer.rb +1 -1
- data/app/serializers/spree/v2/storefront/user_serializer.rb +1 -1
- data/app/serializers/spree/v2/storefront/variant_serializer.rb +1 -1
- data/app/serializers/spree/v2/storefront/wished_item_serializer.rb +29 -0
- data/app/serializers/spree/v2/storefront/wishlist_serializer.rb +17 -0
- data/app/services/spree/webhooks/subscribers/handle_request.rb +73 -0
- data/app/services/spree/webhooks/subscribers/make_request.rb +82 -0
- data/app/services/spree/webhooks/subscribers/queue_requests.rb +17 -0
- data/app/services/spree/webhooks.rb +13 -0
- data/config/i18n-tasks.yml +40 -0
- data/config/initializers/doorkeeper.rb +12 -12
- data/config/initializers/rabl.rb +2 -2
- data/config/locales/en.yml +29 -27
- data/config/routes.rb +83 -59
- data/db/migrate/20210902162826_create_spree_webhooks_tables.rb +16 -0
- data/db/migrate/20210919183228_enable_polymorphic_resource_owner.rb +21 -0
- data/db/migrate/20211025162826_create_spree_webhooks_events.rb +14 -0
- data/docs/oauth/index.yml +126 -33
- data/docs/v2/platform/index.yaml +19099 -1736
- data/docs/v2/storefront/index.yaml +14801 -14628
- data/{app/models/spree → lib/spree/api}/api_dependencies.rb +56 -4
- data/lib/spree/api/engine.rb +19 -3
- data/lib/spree/api/testing_support/factories/oauth_application_factory.rb +6 -0
- data/lib/spree/api/testing_support/factories/webhook_event_factory.rb +27 -0
- data/lib/spree/api/testing_support/factories/webhook_subscriber_factory.rb +13 -0
- data/lib/spree/api/testing_support/factories.rb +3 -0
- data/lib/spree/api/testing_support/helpers.rb +1 -1
- data/lib/spree/api/testing_support/jobs.rb +18 -0
- data/lib/spree/api/testing_support/matchers/webhooks.rb +67 -0
- data/lib/spree/api/testing_support/serializers.rb +25 -0
- data/lib/spree/api/testing_support/spree_webhooks.rb +9 -0
- data/lib/spree/api/testing_support/v2/base.rb +1 -1
- data/lib/spree/api/testing_support/v2/current_order.rb +34 -1
- data/lib/spree/api/testing_support/v2/platform_contexts.rb +101 -52
- data/lib/spree/api/testing_support/v2/serializers_params.rb +3 -1
- data/lib/spree/api.rb +1 -0
- data/spec/fixtures/files/icon_256x256.jpg +0 -0
- data/spree_api.gemspec +16 -15
- metadata +175 -28
- data/app/controllers/spree/api/errors_controller.rb +0 -9
@@ -0,0 +1,19 @@
|
|
1
|
+
module Spree
|
2
|
+
module Api
|
3
|
+
module V2
|
4
|
+
module Platform
|
5
|
+
class LineItemSerializer < BaseSerializer
|
6
|
+
include ResourceSerializerConcern
|
7
|
+
|
8
|
+
belongs_to :order
|
9
|
+
belongs_to :tax_category
|
10
|
+
belongs_to :variant
|
11
|
+
|
12
|
+
has_many :adjustments
|
13
|
+
has_many :inventory_units
|
14
|
+
has_many :digital_links
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
module Spree
|
2
|
+
module Api
|
3
|
+
module V2
|
4
|
+
module Platform
|
5
|
+
class OrderSerializer < BaseSerializer
|
6
|
+
include ResourceSerializerConcern
|
7
|
+
|
8
|
+
belongs_to :user
|
9
|
+
belongs_to :created_by, serializer: Dependencies.platform_admin_user_serializer.constantize
|
10
|
+
belongs_to :approver, serializer: Dependencies.platform_admin_user_serializer.constantize
|
11
|
+
belongs_to :canceler, serializer: Dependencies.platform_admin_user_serializer.constantize
|
12
|
+
|
13
|
+
belongs_to :bill_address, serializer: AddressSerializer
|
14
|
+
belongs_to :ship_address, serializer: AddressSerializer
|
15
|
+
|
16
|
+
has_many :line_items
|
17
|
+
has_many :payments
|
18
|
+
has_many :shipments
|
19
|
+
|
20
|
+
has_many :state_changes
|
21
|
+
has_many :return_authorizations
|
22
|
+
has_many :reimbursements
|
23
|
+
has_many :adjustments
|
24
|
+
has_many :all_adjustments, serializer: :adjustments, type: :adjustment
|
25
|
+
|
26
|
+
has_many :order_promotions
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module Spree
|
2
|
+
module Api
|
3
|
+
module V2
|
4
|
+
module Platform
|
5
|
+
class PaymentMethodSerializer < BaseSerializer
|
6
|
+
attributes :name, :type, :description, :active, :display_on, :auto_capture, :position,
|
7
|
+
:created_at, :updated_at, :deleted_at, :public_metadata, :private_metadata
|
8
|
+
|
9
|
+
attribute :preferences do |payment_method|
|
10
|
+
payment_method.preferences
|
11
|
+
end
|
12
|
+
|
13
|
+
has_many :stores
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module Spree
|
2
|
+
module Api
|
3
|
+
module V2
|
4
|
+
module Platform
|
5
|
+
class PaymentSerializer < BaseSerializer
|
6
|
+
include ResourceSerializerConcern
|
7
|
+
|
8
|
+
belongs_to :order
|
9
|
+
belongs_to :payment_method
|
10
|
+
belongs_to :source, polymorphic: true
|
11
|
+
|
12
|
+
has_many :log_entries
|
13
|
+
has_many :state_changes
|
14
|
+
has_many :payment_capture_events, object_method_name: :capture_events,
|
15
|
+
id_method_name: :capture_event_ids
|
16
|
+
has_many :refunds
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Spree
|
2
|
+
module Api
|
3
|
+
module V2
|
4
|
+
module Platform
|
5
|
+
class PriceSerializer < BaseSerializer
|
6
|
+
include ResourceSerializerConcern
|
7
|
+
|
8
|
+
attribute :display_price_including_vat_for do |price, params|
|
9
|
+
price.display_price_including_vat_for(params[:price_options].presence || {}).to_s
|
10
|
+
end
|
11
|
+
|
12
|
+
attribute :display_compare_at_price_including_vat_for do |price, params|
|
13
|
+
price.display_compare_at_price_including_vat_for(params[:price_options].presence || {}).to_s
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -3,8 +3,8 @@ module Spree
|
|
3
3
|
module V2
|
4
4
|
module Platform
|
5
5
|
class ProductSerializer < BaseSerializer
|
6
|
-
include
|
7
|
-
include
|
6
|
+
include ResourceSerializerConcern
|
7
|
+
include DisplayMoneyHelper
|
8
8
|
|
9
9
|
attribute :purchasable do |product|
|
10
10
|
product.purchasable?
|
@@ -60,7 +60,11 @@ module Spree
|
|
60
60
|
has_many :option_types
|
61
61
|
has_many :product_properties
|
62
62
|
has_many :taxons, serializer: :taxon, record_type: :taxon do |object, params|
|
63
|
-
|
63
|
+
if params[:store].present?
|
64
|
+
object.taxons_for_store(params[:store])
|
65
|
+
else
|
66
|
+
object.taxons
|
67
|
+
end
|
64
68
|
end
|
65
69
|
|
66
70
|
has_many :images,
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Spree
|
2
|
+
module Api
|
3
|
+
module V2
|
4
|
+
module Platform
|
5
|
+
class PromotionActionSerializer < BaseSerializer
|
6
|
+
include ResourceSerializerConcern
|
7
|
+
|
8
|
+
belongs_to :promotion
|
9
|
+
|
10
|
+
# Some promotion actions have a :calculator, while others do not.
|
11
|
+
has_one :calculator, if: proc { |record| record.respond_to?(:calculator) }
|
12
|
+
|
13
|
+
# Only the CreateLineItems promotion action uses :promotion_action_line_items.
|
14
|
+
has_many :promotion_action_line_items, if: proc { |record| record.respond_to?(:promotion_action_line_items) }
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module Spree
|
2
|
+
module Api
|
3
|
+
module V2
|
4
|
+
module Platform
|
5
|
+
class PromotionRuleSerializer < BaseSerializer
|
6
|
+
include ResourceSerializerConcern
|
7
|
+
|
8
|
+
attribute :preferences do |promotion_rule|
|
9
|
+
promotion_rule.preferences
|
10
|
+
end
|
11
|
+
|
12
|
+
belongs_to :promotion
|
13
|
+
|
14
|
+
has_many :products, through: :product_promotion_rules, if: proc { |record| record.respond_to?(:product_promotion_rules) }
|
15
|
+
has_many :users, through: :promotion_rule_users, if: proc { |record| record.respond_to?(:promotion_rule_users) }
|
16
|
+
has_many :taxons, through: :promotion_rule_taxons, if: proc { |record| record.respond_to?(:promotion_rule_taxons) }
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Spree
|
2
|
+
module Api
|
3
|
+
module V2
|
4
|
+
module Platform
|
5
|
+
class PromotionSerializer < BaseSerializer
|
6
|
+
include ResourceSerializerConcern
|
7
|
+
|
8
|
+
belongs_to :promotion_category
|
9
|
+
|
10
|
+
has_many :promotion_rules
|
11
|
+
has_many :promotion_actions
|
12
|
+
has_many :stores
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module Spree
|
2
|
+
module Api
|
3
|
+
module V2
|
4
|
+
module Platform
|
5
|
+
class RefundSerializer < BaseSerializer
|
6
|
+
include ResourceSerializerConcern
|
7
|
+
|
8
|
+
belongs_to :payment
|
9
|
+
belongs_to :reimbursement
|
10
|
+
belongs_to :refund_reason, object_method_name: :reason
|
11
|
+
has_many :log_entries
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module Spree
|
2
|
+
module Api
|
3
|
+
module V2
|
4
|
+
module Platform
|
5
|
+
class ReimbursementSerializer < BaseSerializer
|
6
|
+
include ResourceSerializerConcern
|
7
|
+
|
8
|
+
belongs_to :order
|
9
|
+
belongs_to :customer_return
|
10
|
+
|
11
|
+
has_many :refunds
|
12
|
+
has_many :reimbursement_credits, object_method_name: :credits, id_method_name: :credit_ids
|
13
|
+
has_many :return_items
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Spree
|
2
|
+
module Api
|
3
|
+
module V2
|
4
|
+
module Platform
|
5
|
+
class ReturnAuthorizationSerializer < BaseSerializer
|
6
|
+
include ResourceSerializerConcern
|
7
|
+
|
8
|
+
belongs_to :order
|
9
|
+
belongs_to :stock_location
|
10
|
+
belongs_to :return_authorization_reason, object_method_name: :reason
|
11
|
+
|
12
|
+
has_many :return_items
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module Spree
|
2
|
+
module Api
|
3
|
+
module V2
|
4
|
+
module Platform
|
5
|
+
class ReturnItemSerializer < BaseSerializer
|
6
|
+
include ResourceSerializerConcern
|
7
|
+
|
8
|
+
has_many :exchange_inventory_units, serializer: :inventory_unit, type: :inventory_unit
|
9
|
+
belongs_to :exchange_variant, serializer: :variant, type: :variant
|
10
|
+
belongs_to :preferred_reimbursement_type, serializer: :reimbursement_type, type: :reimbursement_type
|
11
|
+
belongs_to :override_reimbursement_type, serializer: :reimbursement_type, type: :reimbursement_type
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module Spree
|
2
|
+
module Api
|
3
|
+
module V2
|
4
|
+
module Platform
|
5
|
+
class ShipmentSerializer < BaseSerializer
|
6
|
+
include ResourceSerializerConcern
|
7
|
+
|
8
|
+
attribute :tracking_url
|
9
|
+
|
10
|
+
belongs_to :order
|
11
|
+
belongs_to :address
|
12
|
+
belongs_to :stock_location
|
13
|
+
has_many :adjustments
|
14
|
+
has_many :inventory_units
|
15
|
+
has_many :shipping_rates
|
16
|
+
has_many :state_changes
|
17
|
+
has_one :selected_shipping_rate, serializer: :shipping_rate, type: :shipping_rate
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module Spree
|
2
|
+
module Api
|
3
|
+
module V2
|
4
|
+
module Platform
|
5
|
+
class ShippingMethodSerializer < BaseSerializer
|
6
|
+
attributes :name, :code, :admin_name, :display_on, :tracking_url, :created_at, :updated_at, :deleted_at, :public_metadata, :private_metadata
|
7
|
+
|
8
|
+
has_many :shipping_categories
|
9
|
+
has_many :shipping_rates
|
10
|
+
belongs_to :tax_category
|
11
|
+
has_one :calculator
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Spree
|
2
|
+
module Api
|
3
|
+
module V2
|
4
|
+
module Platform
|
5
|
+
class ShippingRateSerializer < BaseSerializer
|
6
|
+
include ResourceSerializerConcern
|
7
|
+
|
8
|
+
belongs_to :shipment
|
9
|
+
belongs_to :tax_rate
|
10
|
+
belongs_to :shipping_method
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -3,9 +3,7 @@ module Spree
|
|
3
3
|
module V2
|
4
4
|
module Platform
|
5
5
|
class StockItemSerializer < BaseSerializer
|
6
|
-
include
|
7
|
-
|
8
|
-
set_type :stock_item
|
6
|
+
include ResourceSerializerConcern
|
9
7
|
|
10
8
|
attribute :is_available do |stock_item|
|
11
9
|
stock_item.available?
|
@@ -3,12 +3,10 @@ module Spree
|
|
3
3
|
module V2
|
4
4
|
module Platform
|
5
5
|
class StockLocationSerializer < BaseSerializer
|
6
|
-
include
|
6
|
+
include ResourceSerializerConcern
|
7
7
|
|
8
8
|
attributes :name
|
9
|
-
|
10
|
-
has_many :shipments
|
11
|
-
has_many :stock_items
|
9
|
+
belongs_to :country
|
12
10
|
end
|
13
11
|
end
|
14
12
|
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Spree
|
2
|
+
module Api
|
3
|
+
module V2
|
4
|
+
module Platform
|
5
|
+
class StockTransferSerializer < BaseSerializer
|
6
|
+
include ResourceSerializerConcern
|
7
|
+
|
8
|
+
belongs_to :destination_location, serializer: :stock_location
|
9
|
+
belongs_to :source_location, serializer: :stock_location
|
10
|
+
has_many :stock_movements
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|