pay.models.payment

Classes

Payment

Represents a payment done through various means.

ManualPayment

A manual payment is a payment without associated payment provider.

Module Contents

class pay.models.payment.Payment[source]

Bases: onegov.core.orm.Base, onegov.core.orm.mixins.TimestampMixin, onegov.core.orm.mixins.ContentMixin, onegov.core.orm.abstract.associable.Associable

Represents a payment done through various means.

__tablename__ = 'payments'[source]
id: sqlalchemy.Column[uuid.UUID][source]
source: sqlalchemy.Column[str][source]
amount: sqlalchemy.Column[decimal.Decimal | None][source]
currency: sqlalchemy.Column[str][source]
remote_id: sqlalchemy.Column[str | None][source]
state: sqlalchemy.Column[onegov.pay.types.PaymentState][source]
provider_id: sqlalchemy.Column[uuid.UUID | None][source]
provider: sqlalchemy.orm.relationship[onegov.pay.models.PaymentProvider[Self] | None][source]
ticket: sqlalchemy.orm.relationship[onegov.ticket.models.Ticket | None][source]
__mapper_args__[source]
linked_invoice_items: sqlalchemy.orm.relationship[list[onegov.pay.models.InvoiceItem]][source]
property fee: decimal.Decimal[source]

The fee associated with this payment. The payment amount includes the fee. To get the net amount use the net_amount property.

property net_amount: decimal.Decimal[source]
paid() bool[source]

Our states are essentially one paid and n unpaid states (indicating various ways in which the payment can end up being unpaid).

So this boolean acts as coarse filter to divide payemnts into the two states that really matter.

property remote_url: str[source]
Abstractmethod:

Returns the url of this object on the payment provider.

abstractmethod _sync_state(remote_obj: Any | None = None, capture: bool = False) bool[source]
sync_invoice_items() None[source]

Updates the paid state of any linked invoice items.

sync(remote_obj: Any | None = None, capture: bool = False, update_invoice_items: bool = True) None[source]

Updates the local payment information with the information from the remote payment provider and optionally try to capture the payment if it hasn’t been already.

class pay.models.payment.ManualPayment[source]

Bases: Payment

A manual payment is a payment without associated payment provider.

For example, a payment paid in cash.

__mapper_args__[source]
_sync_state(remote_obj: None = None, capture: bool = False) bool[source]