pay.utils ========= .. py:module:: pay.utils Classes ------- .. autoapisummary:: pay.utils._PriceBase pay.utils.Price pay.utils.InvoiceItemMeta pay.utils._InvoiceDiscountMetaBase pay.utils.InvoiceDiscountMeta Functions --------- .. autoapisummary:: pay.utils.payments_association_table_for Module Contents --------------- .. py:class:: _PriceBase Bases: :py:obj:`NamedTuple` .. py:attribute:: amount :type: decimal.Decimal .. py:attribute:: currency :type: str | None .. py:attribute:: fee :type: decimal.Decimal .. py:attribute:: credit_card_payment :type: bool .. py:class:: Price Bases: :py:obj:`_PriceBase` A single price. The amount includes the fee. To get the net amount use the net_amount property. .. py:method:: __bool__() -> bool .. py:method:: __lt__(other: Price) -> bool Return self Self Return self+value. .. py:method:: __sub__(other: Price) -> Self .. py:method:: __mul__(other: decimal.Decimal | float | SupportsIndex) -> Self Return self*value. .. py:attribute:: __rmul__ Return value*self. .. py:method:: __str__() -> str Return str(self). .. py:method:: __repr__() -> str Return repr(self). .. py:method:: zero() -> Self :classmethod: .. py:method:: as_dict() -> onegov.pay.types.PriceDict .. py:property:: net_amount :type: decimal.Decimal .. py:method:: apply_discount(discount: decimal.Decimal) -> Self .. py:class:: InvoiceItemMeta .. py:attribute:: text :type: str .. py:attribute:: group :type: str .. py:attribute:: unit :type: decimal.Decimal .. py:attribute:: quantity :type: decimal.Decimal .. py:attribute:: vat_rate :type: decimal.Decimal | None :value: None .. py:attribute:: family :type: str | None :value: None .. py:attribute:: extra :type: dict[str, Any] | None :value: None .. py:property:: amount :type: decimal.Decimal .. py:property:: vat :type: decimal.Decimal .. py:property:: net_amount :type: decimal.Decimal .. py:method:: total(items: collections.abc.Iterable[InvoiceItemMeta]) -> decimal.Decimal :staticmethod: .. py:method:: total_vat(items: collections.abc.Iterable[InvoiceItemMeta]) -> decimal.Decimal :staticmethod: .. py:method:: add_to_invoice(invoice: onegov.pay.models.Invoice) -> onegov.pay.models.InvoiceItem .. py:method:: refresh_item(item: onegov.pay.models.InvoiceItem) -> None .. py:class:: _InvoiceDiscountMetaBase Bases: :py:obj:`NamedTuple` .. py:attribute:: text :type: str .. py:attribute:: group :type: str .. py:attribute:: discount :type: decimal.Decimal .. py:attribute:: vat_rate :type: decimal.Decimal | None :value: None .. py:attribute:: family :type: str | None :value: None .. py:attribute:: extra :type: dict[str, Any] | None :value: None .. py:class:: InvoiceDiscountMeta Bases: :py:obj:`_InvoiceDiscountMetaBase` Built-in immutable sequence. If no argument is given, the constructor returns an empty tuple. If iterable is specified the tuple is initialized from iterable's items. If the argument is a tuple, the return value is the same object. .. py:method:: apply_discount(total: decimal.Decimal, remainder: decimal.Decimal) -> InvoiceItemMeta .. py:function:: payments_association_table_for(cls: type[onegov.core.orm.Base]) -> sqlalchemy.Table