Order service methods
Service providers are wrapper objects designed to make it easier to interact with Connect pipelines. The providers implement no logic other than calling Connect pipelines. All of the business logic is implemented in the pipeline processors.
The Order service provider contains the following methods for interacting with order data.
SubmitVisitorOrder method
- Name:: SubmitVisitorOrder
- Description:: Creates an order based on the shopping cart. Calls the
SubmitVisitorOrderpipeline. - Usage:: Called from Sitecore when a visitor is submitting the shopping cart to create an order.
- Signature::
- Input::
- : Cart– Cart. An instance of the shopping cart.
- Output::
- : Order – Cart.When successful, an order is returned and because the order is inherited from the Cart this works fine but it must be cast as an order.In case of failure, an instance of the cart object is returned, potentially modified and augmented with more data and error comments.
- : SystemMessages - Collection of messages from the external system.
Usage example:
GetAvailableCountries method
This method returns the list of countries supported by the ECS.
- Name:: GetAvailableCountries
- Description:: Provides a list of all countries supported by the ECS.
- Usage:: Called from Sitecore
- Signature::
- Input::
- Output::
- : SystemMessages - Collection of countries from the external system.
Usage example:
GetAvailableRegions method
Returns the list of regions in a country supported by the ECS.
- Name:: GetAvailableRegions
- Description:: Provides a list of all the regions in a country supported by the ECS.
- Usage:: Called from Sitecore
- Signature::
- Input::
- : CountryCode –The country to return regions for.
- Output::
- : SystemMessages - Collection of countries from the external system.
Usage example:
GetVisitorOrder method
- Name:: GetVisitorOrder
- Description:: Gets the order by the ID placed by the visitor. Calls the
GetVisitorOrderpipeline. - Usage:: Called from Sitecore when the order details are needed for a specific order.
- Signature::
- Input::
- : **ShopName –**The name of the shop.
- : OrderId –The ID of the order.
- : CustomerID – MandatoryThe ID of the customer/visitor/contact.If the customer ID is not provided there is a potential security risk that any visitor can access orders from all customers.
- Output::
- : Order – An instance of the order object is returned. The order object is created by the external commerce system.
- : SystemMessages - Collection of messages from the external system.
Usage example:
GetVisitorOrders method
- Name:: GetVisitorOrders
- Description:: Gets the order summary data of orders placed by the given visitor. Calls the
GetVisitorOrderspipeline. - Usage:: Called from Sitecore when the order history is needed for a visitor.
- Signature::
- Input::
- : **ShopName -**The name of the shop.
- : **CustomerId –**ID of the buyer customer party.
- Output::
- : IReadOnlyCollection
– An instance of the order object is returned. The order object is created by the external commerce system. - : SystemMessages - Collection of messages from the external system.
Usage example:
OrderStatusChanged method
- Name:: OrderStatusChanged
- Description:: Used to inform Sitecore that a change has been made to the status of an order.
- Usage:: Called from Sitecore to inform Sitecore about changes to an order’s status.
- Signature::
- Input:: OrderId -The ID of the order that the status has changed on.
- : CustomerId -The ID of the customer associated to the order.
- : OrderStatus –The new status of the order.
- Output::
Usage example:
Reorder method
- Name:: Reorder
- Description:: Adds one or more items from a previously placed order into the customer’s current cart. This calls the
reorderpipeline. - Usage:: Called when a customer wishes to reorder one or more items from a previously placed order.
- Signature::
- Input::
- : **ShopName –**The name of the shop.
- : OrderId –****MandatoryThe ID of the order.
- : CustomerID – MandatoryThe ID of the customer/visitor/contact.If the customer ID is not provided there is a potential security risk that any visitor can access orders from all customers.
- : ReorderLineExternalIds – OptionalThe external IDs of the order lines that are being reordered. If not specified, all items from the order are reordered.
- : ForceNewLines – OptionalIf true, the cart lines items is added as new cart lines in the customer cart. Otherwise, the lines are merged into existing cart lines if possible.NoteThis parameter is only supported if the external commerce system supports this functionality.
- Output::
- : Cart**–** An instance of the customer’s new cart contents returned.
- : **AddedCartLineExternalIds –**A list containing the IDs of the lines that were added to the customer’s cart.
- : SystemMessages - Collection of messages from the external system.
Usage example:
VisitorCancelOrder method
The purpose of this method is for a visitor to cancel an existing order if the option is present on the web shop and if business logic does not prevent it, for example, if the order has already been fulfilled and/or shipped.
This method is typically triggered when showing order details to the customer launched from the order history view and the customer chooses to cancel the order.
- Name:: VisitorCancelOrder
- Description:: Used to cancel an order placed by the visitor. The decision on whether the order is canceled or not lies in the business logic in the external commerce system. Typically an order cannot be canceled once its shop owner has started fulfilling/processing it.If the order cannot be canceled, it must be reflected in the returned SystemMessages.
- Usage:: Called from Sitecore.
- Signature::
- Input::
- : ShopName – MandatoryThe name of the shop.
- : OrderId – MandatoryThe ID of the order.
- : CustomerID – MandatoryThe ID of the customer/visitor.If the customer ID is not provided there is a potential security risk that any visitor can access orders from all customers.
- : OrderLineExternalIds – OptionalA list of the external IDs of the order lines to cancel. If not specified, all lines of the order are canceled.NoteConnect does not support this parameter by default. It is the responsibility of the external commerce system connectors to handle this property.
- Output::
- : SystemMessages**-** Collection of messages from the external system.
- : **CancelledOrder –**Contains the order that was canceled.NoteIt is the responsibility of the external commerce system connectors to populate this result property.
- : CancellationStatus – An extensible enumeration value that indicates the status of the order cancelation operation (that is, Granted, Denied, and so on).NoteIt is the responsibility of the external commerce system connectors to populate this result property.
Usage example: