shop.services¶
Submodules¶
Attributes¶
Classes¶
Defines the available events used within the system. |
|
Abstract base class for own implementations. |
|
The hook'able events / actions. |
|
Note: Methods should be called only with positional arguments. Or keyword-only if really necessary. |
Functions¶
|
Package Contents¶
- shop.services.EVENT_SERVICE¶
- class shop.services.Event¶
Bases:
enum.IntEnumDefines the available events used within the system.
This enumeration serves as the central registry for all predefined events that can be triggered and observed by the EventService.
Initialize self. See help(type(self)) for accurate signature.
- ARTICLE_CHANGED¶
Triggered when an article inside the cart (leaf) changed.
- CART_CHANGED¶
Triggered when a cart (node) changed.
- ORDER_CHANGED¶
Triggered when an order changed.
- CHECKOUT_STARTED¶
Triggered when a user begins the checkout process.
- ORDER_ORDERED¶
Triggered when a user confirmed the order (“order now”) in the final checkout step.
- ORDER_PAID¶
Triggered when payment for an order is completed.
- ORDER_RTS¶
Triggered when an order is marked as ready to ship (RTS).
- class shop.services.EventService¶
- class shop.services.Customization¶
Bases:
abc.ABCAbstract base class for own implementations.
- abstract __call__(*args, **kwargs)¶
The main logic of this implementation
- Return type:
Any
- __repr__()¶
- Return type:
str
- shop.services.HOOK_SERVICE¶
- class shop.services.Hook¶
Bases:
enum.IntEnumThe hook’able events / actions.
Initialize self. See help(type(self)) for accurate signature.
- ORDER_ASSIGN_UID¶
Hook that assign a order id on a OrderSkel type: (order_skel: SkeletonInstance_T[OrderSkel]) -> SkeletonInstance_T[OrderSkel]
- CURRENT_COUNTRY¶
Provide the country of a global site context type: (context: t.Literal[“cart”, “article”, “vat_rate”]) -> str
- ORDER_ADD_ADDITION¶
Do some additional modifications on the OrderSkel on order_add action. Called in
viur.shop.modules.order.Order.order_add()before saving withSkeleton.write(). type: (order_skel: SkeletonInstance_T[OrderSkel]) -> SkeletonInstance_T[OrderSkel]
- ORDER_UPDATE_ADDITION¶
Do some additional modifications on the OrderSkel on order_update action. Called in
viur.shop.modules.order.Order.order_update()before saving withSkeleton.write(). type: (order_skel: SkeletonInstance_T[OrderSkel]) -> SkeletonInstance_T[OrderSkel]
- ORDER_CHECKOUT_START_ADDITION¶
Do some additional modifications on the OrderSkel on checkout_start action. Called in
viur.shop.modules.order.Order.checkout_start()before saving withSkeleton.write(). type: (order_skel: SkeletonInstance_T[OrderSkel]) -> SkeletonInstance_T[OrderSkel]
- PAYMENT_RETURN_HANDLER_SUCCESS¶
The action that is executed after the customer has returned from the payment provider and the payment has been successful. This can be, for example, a rendered template or a redirect to another page. type: (order_skel: SkeletonInstance_T[OrderSkel], payment_data: t.Any) -> t.Any
- PAYMENT_RETURN_HANDLER_ERROR¶
The action that is executed after the customer has returned from the payment provider and the payment has failed. This can be, for example, a rendered template or a redirect to another page. type: (order_skel: SkeletonInstance_T[OrderSkel], payment_data: t.Any) -> t.Any
- class shop.services.HookService¶
Note: Methods should be called only with positional arguments. Or keyword-only if really necessary.
- customizations: Final[list[Customization]] = []¶
- register(customization)¶
Register a customization with this service
Can be used as class decorator too
@HOOK_SERVICE.register class MyImplementation(Customization): kind = Hook.ORDER_ASSIGN_UID def __call__(self, *args, **kwargs) -> t.Any: ...
- Parameters:
customization (Customization | Type[Customization])
- Return type:
- unregister(customization)¶
- Parameters:
customization (Customization)