shop.payment_providers.unzer_abstract ===================================== .. py:module:: shop.payment_providers.unzer_abstract Attributes ---------- .. autoapisummary:: shop.payment_providers.unzer_abstract.logger shop.payment_providers.unzer_abstract.P shop.payment_providers.unzer_abstract.R Classes ------- .. autoapisummary:: shop.payment_providers.unzer_abstract.UnzerClientViURShop shop.payment_providers.unzer_abstract.UnzerAbstract Functions --------- .. autoapisummary:: shop.payment_providers.unzer_abstract.log_unzer_error Module Contents --------------- .. py:data:: logger .. py:data:: P .. py:data:: R .. py:function:: log_unzer_error(func) Decorator to log unzer errors Decorator that logs details of an unzer.model.ErrorResponse if raised, then re-raises the error. .. py:class:: UnzerClientViURShop(private_key, public_key, sandbox = False, language = 'en') Bases: :py:obj:`unzer.UnzerClient` .. py:attribute:: language :value: 'en' .. py:property:: private_key :type: str .. py:property:: public_key :type: str .. py:property:: sandbox :type: bool .. py:method:: _request(url, method, headers, payload, auth) .. py:class:: UnzerAbstract(*, private_key, public_key, sandbox = False, language = None, **kwargs) Bases: :py:obj:`shop.payment_providers.PaymentProviderAbstract` Abstract 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. :param private_key: The private key to use for authentication. :param public_key: The public key to use for authentication. :param sandbox: Use sandbox mode (development mode). :param language: Enforce this language. If ``None``, the language of the current request is used. .. py:attribute:: language :value: None .. py:attribute:: client .. py:property:: private_key :type: str .. py:property:: public_key :type: str .. py:property:: sandbox :type: bool .. py:method:: 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. .. py:method:: checkout(order_skel) .. py:method:: get_payment_type(order_skel) :abstractmethod: .. py:method:: get_checkout_start_data(order_skel) .. py:method:: can_order(order_skel) .. py:method:: charge(order_skel, payment = None) .. py:method:: get_order_by_pay_id(payment_id, public_key, *args, **kwargs) Helper method to get the order skel for a payment-id. :param payment_id: The payment id. (ex: s-pay-1). :param public_key: Public key of the key pair. :return: The order-skel if the key seems valid. None otherwise. .. py:method:: check_payment_state(order_skel) Get the payment state for a order. Checks all payments stored in order_skel["payment"]["payments"] for a completed and full charge. In case of a completed charge, only the payment data of the charged payment is returned. Otherwise (failed or missing payment), data of all payments is returned. :param order_skel: OrderSkel SkeletonInstance to check :return: A tuple: [is_paid-boolean, payment-data] .. py:method:: return_handler(order_key) Return Endpoint Endpoint to which customers are redirected once they have processed a payment on the payment server. .. py:method:: webhook(*args, **kwargs) Webhook for unzer. Listens to all events, but handle payment-complete as backup currently only. .. py:method:: get_debug_information(*, order_key = None, payment_id = None) Get information about a payment / order. :param order_key: Key of the order skeleton. :param payment_id: Unzer ID of the order / payment. .. py:method:: save_type(order_key, type_id) .. py:method:: customer_from_order_skel(order_skel) .. py:method:: customer_id_from_order_skel(order_skel) .. py:method:: address_from_address_skel(address_skel) .. py:method:: shop_salutation_to_unzer_salutation(salutation) :staticmethod: .. py:method:: model_to_dict(obj) :classmethod: Convert any nested unzer model to dict representation