shop.payment_providers.abstract¶
Attributes¶
Classes¶
Abstract base class for all payment providers in the ViUR Shop. |
Module Contents¶
- shop.payment_providers.abstract.logger¶
- class shop.payment_providers.abstract.PaymentProviderAbstract(*, image_path=None, is_available=None)¶
Bases:
viur.core.prototypes.instanced_module.InstancedModule,viur.core.Module,abc.ABCAbstract base class for all payment providers in the ViUR Shop.
Provides a standardized interface for implementing different payment methods, including methods for checkout, charging, and handling payment states.
Subclasses must implement the required methods to integrate specific payment providers.
- Parameters:
image_path (str | None)
is_available (t.Callable[[t.Self, SkeletonInstance_T[viur.shop.skeletons.order.OrderSkel] | None], bool] | None)
- shop: shop.shop.Shop = None¶
Reference to the main
Shopinstance.
- image_path = None¶
- property name: str¶
- Abstractmethod:
- Return type:
str
Define the internal name of the payment provider
- property title: viur.core.translate¶
Define the external title of the payment provider
- Return type:
viur.core.translate
- property description: viur.core.translate¶
Define the description of the payment provider
- Return type:
viur.core.translate
- is_available(order_skel)¶
Decide whether the payment provider is available.
- Parameters:
order_skel (SkeletonInstance_T[viur.shop.skeletons.order.OrderSkel] | None)
- Return type:
bool
- can_checkout(order_skel)¶
Check if a checkout process can be started
An empty list means not error, a list with errors rejects the checkout start.
- Parameters:
order_skel (SkeletonInstance_T[viur.shop.skeletons.order.OrderSkel] | None)
- Return type:
list[ClientError]
- abstract checkout(order_skel)¶
- Parameters:
order_skel (viur.core.skeleton.SkeletonInstance)
- Return type:
t.Any
- get_checkout_start_data(order_skel)¶
- Parameters:
order_skel (viur.core.skeleton.SkeletonInstance)
- Return type:
t.Any
- can_order(order_skel)¶
- Parameters:
order_skel (viur.core.skeleton.SkeletonInstance)
- Return type:
list[ClientError]
- abstract charge(order_skel, payment=None)¶
- Parameters:
order_skel (SkeletonInstance_T[viur.shop.skeletons.order.OrderSkel])
payment (t.Any | None)
- Return type:
tuple[SkeletonInstance_T[viur.shop.skeletons.order.OrderSkel], t.Any]
- abstract check_payment_state(order_skel)¶
Check the payment state from the PaymentProvider API/service
Access
OrderSkel.is_paidto get the payment state of an order.- Parameters:
order_skel (viur.core.skeleton.SkeletonInstance)
- Return type:
tuple[bool, t.Any]
- check_payment_deferred(order_key)¶
Check the status for a payment deferred
- Parameters:
order_key (viur.core.db.Key)
- Return type:
None
- abstract return_handler()¶
Frontend Endpoint where the might be redirected to by the payment provider during the payment flow
- abstract webhook()¶
API Endpoint (Webhook) to listen for events from payment provider
- abstract get_debug_information()¶
Provide information about the payment of an order.
Only for debugging purposes. It’s not an API endpoint.
- _append_payment_to_order_skel(order_skel, payment=None)¶
Append payment data to an order
Append payment_provider name and creationdate by default. Write safely in a transaction.
- Parameters:
order_skel (SkeletonInstance_T[viur.shop.skeletons.order.OrderSkel])
payment (PaymentTransactionSpecific | None)
- Return type:
SkeletonInstance_T[viur.shop.skeletons.order.OrderSkel]
- serialize_for_api(order_skel)¶
Serialize this Payment Provider for the API
Used by
Order.get_payment_providers()andOrder.payment_providers_list()Can be subclasses to expose more information via API.- Parameters:
order_skel (SkeletonInstance_T[viur.shop.skeletons.order.OrderSkel] | None)
- Return type:
- classmethod model_to_dict(obj)¶
Convert any nested model to a JSON-compatible representation
- Parameters:
obj (t.Any)
- Return type:
t.Any