shop.payment_providers¶
Submodules¶
- shop.payment_providers.abstract
- shop.payment_providers.amazon_pay
- shop.payment_providers.invoice
- shop.payment_providers.paypal_checkout
- shop.payment_providers.prepayment
- shop.payment_providers.unzer_abstract
- shop.payment_providers.unzer_applepay
- shop.payment_providers.unzer_bancontact
- shop.payment_providers.unzer_card
- shop.payment_providers.unzer_googlepay
- shop.payment_providers.unzer_ideal
- shop.payment_providers.unzer_paylater_invoice
- shop.payment_providers.unzer_paypal
- shop.payment_providers.unzer_sofort
Classes¶
Abstract base class for all payment providers in the ViUR Shop. |
|
Amazon Pay integration for the ViUR Shop. |
|
Invoice payment method for the ViUR Shop. |
|
Prepayment method for the ViUR Shop. |
|
Prepayment method for the ViUR Shop. |
Package Contents¶
- class shop.payment_providers.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
- class shop.payment_providers.AmazonPay(*, mws_access_key, mws_secret_key, merchant_id, client_id, client_secret, region='de', currency_code='EUR', sandbox=False, language='en', **kwargs)¶
Bases:
shop.payment_providers.PaymentProviderAbstractAmazon Pay integration for the ViUR Shop.
Handles the checkout process using Amazon Pay, including authorization and payment capture. Requires Amazon MWS credentials and configuration parameters.
- Parameters:
mws_access_key (str) – Amazon MWS access key.
mws_secret_key (str) – Amazon MWS secret key.
merchant_id (str) – Amazon merchant ID.
client_id (str) – Amazon client ID.
client_secret (str) – Amazon client secret.
region (str) – Region code (default: ‘de’).
currency_code (str) – Currency code (default: ‘EUR’).
sandbox (bool) – Use sandbox environment (default: False).
language (str) – Language code (default: ‘en’).
kwargs (viur.shop.types.t.Any)
- name: viur.shop.types.t.Final[str] = 'amazonpay'¶
Define the internal name of the payment provider
- mws_access_key¶
- mws_secret_key¶
- merchant_id¶
- client_id¶
- client_secret¶
- sandbox = False¶
- language = 'en'¶
- checkout(order_skel)¶
- Parameters:
order_skel (viur.core.skeleton.SkeletonInstance)
- Return type:
viur.shop.types.t.Any
- get_checkout_start_data(order_skel)¶
- Parameters:
order_skel (viur.core.skeleton.SkeletonInstance)
- Return type:
viur.shop.types.t.Any
- charge(order_skel, payment=None)¶
- Parameters:
order_skel (viur.shop.types.SkeletonInstance_T[shop.skeletons.OrderSkel])
payment (viur.shop.types.t.Any | None)
- Return type:
tuple[viur.shop.types.SkeletonInstance_T[shop.skeletons.OrderSkel], viur.shop.types.t.Any]
- 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, viur.shop.types.t.Any]
- return_handler()¶
Frontend Endpoint where the might be redirected to by the payment provider during the payment flow
- webhook()¶
API Endpoint (Webhook) to listen for events from payment provider
- get_debug_information()¶
Provide information about the payment of an order.
Only for debugging purposes. It’s not an API endpoint.
- class shop.payment_providers.Invoice(*, image_path=None, is_available=None)¶
Bases:
shop.payment_providers.PaymentProviderAbstractInvoice payment method for the ViUR Shop.
Allows customers to place orders with the agreement to pay later via invoice. The order can be marked as ready to ship (RTS) immediately but is not considered paid.
- Note:
Payment processing (the customer pays this order in the next x days) and verification are handled externally and not within this module.
- Parameters:
image_path (str | None)
is_available (t.Callable[[t.Self, SkeletonInstance_T[viur.shop.skeletons.order.OrderSkel] | None], bool] | None)
- name: Final[str] = 'invoice'¶
Define the internal name of the payment provider
- checkout(order_skel)¶
- Parameters:
order_skel (shop.types.SkeletonInstance_T[shop.skeletons.OrderSkel])
- Return type:
None
- charge(order_skel, payment=None)¶
- Parameters:
order_skel (shop.types.SkeletonInstance_T[shop.skeletons.OrderSkel])
payment (Any | None)
- Return type:
tuple[shop.types.SkeletonInstance_T[shop.skeletons.OrderSkel], Any]
- 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, Any]
- return_handler()¶
Frontend Endpoint where the might be redirected to by the payment provider during the payment flow
- webhook()¶
API Endpoint (Webhook) to listen for events from payment provider
- get_debug_information()¶
Provide information about the payment of an order.
Only for debugging purposes. It’s not an API endpoint.
- class shop.payment_providers.PrePayment(*, image_path=None, is_available=None)¶
Bases:
PrepaymentPrepayment method for the ViUR Shop.
Allows customers to place orders with the agreement to pay in advance. The order is marked as ready to ship (RTS) once payment is received.
The customer pays this order in the next x days, shipping will wait.
- Note:
Payment receipt verification (The customer pays this order in the next x days, shipping will wait) is handled externally and not within this module.
- Parameters:
image_path (str | None)
is_available (t.Callable[[t.Self, SkeletonInstance_T[viur.shop.skeletons.order.OrderSkel] | None], bool] | None)
- class shop.payment_providers.Prepayment(*, image_path=None, is_available=None)¶
Bases:
shop.payment_providers.PaymentProviderAbstractPrepayment method for the ViUR Shop.
Allows customers to place orders with the agreement to pay in advance. The order is marked as ready to ship (RTS) once payment is received.
The customer pays this order in the next x days, shipping will wait.
- Note:
Payment receipt verification (The customer pays this order in the next x days, shipping will wait) is handled externally and not within this module.
- Parameters:
image_path (str | None)
is_available (t.Callable[[t.Self, SkeletonInstance_T[viur.shop.skeletons.order.OrderSkel] | None], bool] | None)
- name: Final[str] = 'prepayment'¶
Define the internal name of the payment provider
- checkout(order_skel)¶
- Parameters:
order_skel (shop.types.SkeletonInstance_T[shop.skeletons.OrderSkel])
- Return type:
None
- charge(order_skel, payment=None)¶
- Parameters:
order_skel (shop.types.SkeletonInstance_T[shop.skeletons.OrderSkel])
payment (Any | None)
- Return type:
tuple[shop.types.SkeletonInstance_T[shop.skeletons.OrderSkel], Any]
- 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, Any]
- return_handler()¶
Frontend Endpoint where the might be redirected to by the payment provider during the payment flow
- webhook()¶
API Endpoint (Webhook) to listen for events from payment provider
- get_debug_information()¶
Provide information about the payment of an order.
Only for debugging purposes. It’s not an API endpoint.