shop.modules.order¶
Attributes¶
Classes¶
Abstract Class for all viur-shop sub/nested modules. |
Module Contents¶
- shop.modules.order.logger¶
- class shop.modules.order.Order(moduleName=None, modulePath=None, shop=None, *args, **kwargs)¶
Bases:
shop.modules.abstract.ShopModuleAbstract,viur.core.prototypes.ListAbstract Class for all viur-shop sub/nested modules.
The implementations should set moduleName as class variable, so the final module name for routing it not affected by the name of custom classes.
- Parameters:
moduleName (str)
modulePath (str)
shop (viur.shop.Shop)
- moduleName = 'order'¶
- kindName = '{{viur_shop_modulename}}_order'¶
- reference_user_created_skeletons_in_session = True¶
If True, keys of skeletons that the current user has created will be stored in the session.
- adminInfo()¶
- Return type:
dict
- property current_session_order_key: viur.core.db.Key | None¶
- Return type:
viur.core.db.Key | None
- property current_order_skel: viur.shop.types.SkeletonInstance_T[shop.skeletons.order.OrderSkel] | None¶
- Return type:
viur.shop.types.SkeletonInstance_T[shop.skeletons.order.OrderSkel] | None
- canView(skel)¶
- Parameters:
skel (viur.core.skeleton.SkeletonInstance)
- Return type:
bool
- payment_providers_list(only_available=True)¶
Get a list of payment providers.
This method returns a JSON response containing a dictionary of payment providers. The keys represent provider identifiers, and the values are instances of PaymentProviderResult (dict) containing the details of each provider.
- Parameters:
only_available (bool) – If
True(default), only payment providers that are currently available will be included in the response. IfFalse, all providers will be listed regardless of availability.- Returns:
A JSON response with a dictionary of payment providers.
- Return type:
viur.shop.types.JsonResponse[dict[str, viur.shop.types.results.PaymentProviderResult]]
- get_payment_providers(only_available=True)¶
- Parameters:
only_available (bool)
- Return type:
dict[str, viur.shop.types.results.PaymentProviderResult]
- order_get(order_key)¶
- Parameters:
order_key (viur.core.db.Key)
- Return type:
viur.shop.types.SkeletonInstance_T[shop.skeletons.order.OrderSkel] | None
- order_add(cart_key, payment_provider=SENTINEL, billing_address_key=SENTINEL, customer_key=SENTINEL, state_ordered=SENTINEL, state_paid=SENTINEL, state_rts=SENTINEL, **kwargs)¶
- Parameters:
cart_key (viur.core.db.Key)
payment_provider (str)
billing_address_key (viur.core.db.Key)
customer_key (viur.core.db.Key)
state_ordered (bool)
state_paid (bool)
state_rts (bool)
- order_update(order_key, payment_provider=SENTINEL, billing_address_key=SENTINEL, customer_key=SENTINEL, state_ordered=SENTINEL, state_paid=SENTINEL, state_rts=SENTINEL, **kwargs)¶
- Parameters:
order_key (viur.core.db.Key)
payment_provider (str)
billing_address_key (viur.core.db.Key)
customer_key (viur.core.db.Key)
state_ordered (bool)
state_paid (bool)
state_rts (bool)
- _order_set_values(skel, *, payment_provider=SENTINEL, billing_address_key=SENTINEL, customer_key=SENTINEL, state_ordered=SENTINEL, state_paid=SENTINEL, state_rts=SENTINEL)¶
- Parameters:
skel (viur.shop.types.SkeletonInstance_T[shop.skeletons.order.OrderSkel])
payment_provider (str)
billing_address_key (viur.core.db.Key)
customer_key (viur.core.db.Key)
state_ordered (bool)
state_paid (bool)
state_rts (bool)
- Return type:
viur.shop.types.SkeletonInstance_T[shop.skeletons.order.OrderSkel]
- customer_is_valid(order_skel, customer_key)¶
Checks if the given customer is a valid customer for this skel.
The customer must be the same user or an root user.
- Parameters:
order_skel (viur.shop.types.SkeletonInstance_T[shop.skeletons.order.OrderSkel])
customer_key (viur.core.db.Key)
- Return type:
bool
- checkout_start(order_key)¶
Start the checkout process.
Requires no errors in
self.can_checkout().- Parameters:
order_key (viur.core.db.Key)
- can_checkout(order_skel)¶
- Parameters:
order_skel (viur.core.skeleton.SkeletonInstance)
- Return type:
list[viur.shop.types.ClientError]
- freeze_order(order_skel)¶
- Parameters:
order_skel (viur.shop.types.SkeletonInstance_T[shop.skeletons.order.OrderSkel])
- Return type:
viur.shop.types.SkeletonInstance_T[shop.skeletons.order.OrderSkel]
- _default_assign_uid(order_skel)¶
Default order assign id method.
Called as default/fallback for
Hook.ORDER_ASSIGN_UID.- Parameters:
order_skel (viur.core.skeleton.SkeletonInstance)
- Return type:
viur.core.skeleton.SkeletonInstance
- checkout_order(order_key)¶
The final order now step.
Requires no errors in
self.can_order().- Parameters:
order_key (viur.core.db.Key)
- can_order(order_skel)¶
- Parameters:
order_skel (viur.core.skeleton.SkeletonInstance)
- Return type:
list[viur.shop.types.ClientError]
- set_checkout_in_progress(order_skel)¶
Set an order to the state is_checkout_in_progress
- Parameters:
order_skel (viur.core.skeleton.SkeletonInstance)
- Return type:
viur.core.skeleton.SkeletonInstance
- set_ordered(order_skel, payment)¶
Set an order to the state ordered
- Parameters:
order_skel (viur.core.skeleton.SkeletonInstance)
payment (viur.shop.types.t.Any)
- Return type:
viur.core.skeleton.SkeletonInstance
- set_paid(order_skel)¶
Set an order to the state paid
- Parameters:
order_skel (viur.core.skeleton.SkeletonInstance)
- Return type:
viur.core.skeleton.SkeletonInstance
- set_rts(order_skel)¶
Set an order to the state Ready to ship
- Parameters:
order_skel (viur.core.skeleton.SkeletonInstance)
- Return type:
viur.core.skeleton.SkeletonInstance
- additional_order_add(skel, /, **kwargs)¶
Hook method called by
order_add()before the skeleton is saved.This method can be overridden in a subclass to implement additional API fields or make further modifications to the order skeleton (skel). By default, it raises an exception if unexpected arguments (
kwargs) are provided and returns the unchanged skel object.- Parameters:
skel (viur.shop.types.SkeletonInstance_T[shop.skeletons.order.OrderSkel]) – The current instance of the order skeleton.
kwargs – Additional optional arguments for extended implementations.
- Raises:
TooManyArgumentsException – If unexpected arguments are passed in
kwargs.- Returns:
The (potentially modified) order skeleton.
- Return type:
viur.shop.types.SkeletonInstance_T[shop.skeletons.order.OrderSkel]
- additional_order_update(skel, /, **kwargs)¶
Hook method called by
order_update()before the skeleton is saved.This method can be overridden in a subclass to implement additional API fields or make further modifications to the order skeleton (skel). By default, it raises an exception if unexpected arguments (
kwargs) are provided and returns the unchanged skel object.- Parameters:
skel (viur.shop.types.SkeletonInstance_T[shop.skeletons.order.OrderSkel]) – The current instance of the order skeleton.
kwargs – Additional optional arguments for extended implementations.
- Raises:
TooManyArgumentsException – If unexpected arguments are passed in
kwargs.- Returns:
The (potentially modified) order skeleton.
- Return type:
viur.shop.types.SkeletonInstance_T[shop.skeletons.order.OrderSkel]
- get_payment_provider_by_name(payment_provider_name)¶
- Parameters:
payment_provider_name (str)
- Return type: