shop.payment_providers.unzer_abstract¶
Module Contents¶
Classes¶
Abstract base class for Unzer payment methods in the ViUR Shop. |
Attributes¶
- shop.payment_providers.unzer_abstract.logger¶
- class shop.payment_providers.unzer_abstract.UnzerClientViURShop¶
Bases:
unzer.UnzerClient- _request(url, method, headers, payload, auth)¶
- class shop.payment_providers.unzer_abstract.UnzerAbstract(*, private_key, public_key, sandbox=False, language=None, **kwargs)¶
Bases:
shop.payment_providers.PaymentProviderAbstractAbstract base class for Unzer payment methods in the ViUR Shop.
Provides common functionality for Unzer-based payment providers, including API communication and payment type handling.
Create a new Unzer payment provider.
- Parameters:
private_key (str) – The private key to use for authentication.
public_key (str) – The public key to use for authentication.
sandbox (bool) – Use sandbox mode (development mode).
language (str | None) – Enforce this language. If
None, the language of the current request is used.kwargs (viur.shop.types.t.Any)
- 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 (viur.core.skeleton.SkeletonInstance)
- Return type:
list[viur.shop.types.ClientError]
- checkout(order_skel)¶
- Parameters:
order_skel (viur.core.skeleton.SkeletonInstance)
- Return type:
viur.shop.types.t.Any
- abstract get_payment_type(order_skel)¶
- Parameters:
order_skel (viur.core.skeleton.SkeletonInstance)
- Return type:
unzer.model.PaymentType
- get_checkout_start_data(order_skel)¶
- Parameters:
order_skel (viur.core.skeleton.SkeletonInstance)
- Return type:
viur.shop.types.t.Any
- can_order(order_skel)¶
- Parameters:
order_skel (viur.core.skeleton.SkeletonInstance)
- Return type:
list[viur.shop.types.ClientError]
- charge()¶
- get_order_by_pay_id(payment_id, public_key, *args, **kwargs)¶
Helper method to get the order skel for a payment-id.
- Parameters:
payment_id (str) – The payment id. (ex: s-pay-1).
public_key (str) – Public key of the key pair.
- Returns:
The order-skel if the key seems valid. None otherwise.
- Return type:
viur.shop.types.SkeletonInstance_T[viur.shop.skeletons.OrderSkel] | None
- 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, unzer.PaymentGetResponse]
- return_handler(order_key)¶
- Parameters:
order_key (viur.core.db.Key)
- Return type:
viur.shop.types.t.Any
- webhook(*args, **kwargs)¶
Webhook for unzer.
Listens to all events, but handle payment-complete as backup currently only.
- check_payment_deferred(order_key)¶
Check the status for an unzer payment deferred
- Parameters:
order_key (viur.core.db.Key)
- Return type:
None
- get_debug_information()¶
- save_type(order_key, type_id)¶
- Parameters:
order_key (str | viur.core.db.Key)
type_id (str)
- customer_from_order_skel(order_skel)¶
- Parameters:
order_skel (viur.core.skeleton.SkeletonInstance)
- Return type:
unzer.Customer
- customer_id_from_order_skel(order_skel)¶
- Parameters:
order_skel (viur.core.skeleton.SkeletonInstance)
- Return type:
str
- address_from_address_skel(address_skel)¶
- Parameters:
address_skel (viur.core.skeleton.SkeletonInstance)
- Return type:
unzer.Address
- static shop_salutation_to_unzer_salutation(salutation)¶
- Parameters:
salutation (viur.shop.types.Salutation)
- Return type:
unzer.model.customer.Salutation