pay.collections.payment
Classes
Manages the payment records. |
Module Contents
- class pay.collections.payment.PaymentCollection(session: sqlalchemy.orm.Session, source: str = '*', page: int = 0, start: datetime.datetime | None = None, end: datetime.datetime | None = None, ticket_start: datetime.datetime | None = None, ticket_end: datetime.datetime | None = None, reservation_start: datetime.datetime | None = None, reservation_end: datetime.datetime | None = None, status: str | None = None, payment_type: str | None = None)[source]
Bases:
onegov.core.collection.GenericCollection
[onegov.pay.models.Payment
],onegov.core.collection.Pagination
[onegov.pay.models.Payment
]Manages the payment records.
To render a list of payments you might want to also consider the
onegov.pay.collection.payable.Paybale
collection, which renders payments by loading the linked records first.- add(*, source: str | None = None, amount: decimal.Decimal | None = None, currency: str = 'CHF', remote_id: str | None = None, state: onegov.pay.types.PaymentState = 'open', **kwargs: Any) onegov.pay.models.Payment [source]
- __eq__(other: object) bool [source]
Returns True if the current and the other Pagination instance are equal. Used to find the current page in a list of pages.
- subset() sqlalchemy.orm.Query[onegov.pay.models.Payment] [source]
Returns an SQLAlchemy query containing all records that should be considered for pagination.
- page_by_index(index: int) PaymentCollection [source]
Returns the page at the given index. A page here means an instance of the class inheriting from the
Pagination
base class.
- payment_links_for(items: collections.abc.Collection[onegov.pay.models.Payment]) dict[uuid.UUID, list[onegov.pay.types.AnyPayableBase]] [source]
A more efficient way of loading all links of the given batch (compared to loading payment.links one by one).
- payment_links_by_subset(subset: collections.abc.Iterable[onegov.pay.models.Payment] | None = None) dict[uuid.UUID, list[onegov.pay.types.AnyPayableBase]] [source]
- payment_links_by_batch(batch: collections.abc.Collection[onegov.pay.models.Payment] | None = None) dict[uuid.UUID, list[onegov.pay.types.AnyPayableBase]] | None [source]
- by_state(state: onegov.pay.types.PaymentState) PaymentCollection [source]
Returns a new collection that only contains payments with the given state. Resets all other filters.