pay.collections.payment

Classes

PaymentCollection

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.

page: int[source]
source = '*'[source]
start = None[source]
end = None[source]
status = None[source]
payment_type = None[source]
ticket_start = None[source]
ticket_end = None[source]
reservation_start = None[source]
reservation_end = None[source]
property model_class: type[onegov.pay.models.Payment][source]
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.

property page_index: int[source]

Returns the current page index (starting at 0).

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.

tickets_by_batch() dict[uuid.UUID, onegov.ticket.model.Ticket][source]
reservation_dates_by_batch() dict[uuid.UUID, tuple[datetime.date, datetime.date]][source]

A more efficient way of loading all links of the given batch (compared to loading payment.links one by one).

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.