Invoice Payment

class moco_wrapper.models.InvoicePayment(moco)

Class for handling invoice payments.

create(payment_date: datetime.date, invoice_id: int, paid_total: float, currency: str)

Create a new invoice payment.

Parameters:
  • payment_date (datetime.date, str) – Date of the payment
  • invoice_id (int) – Id of the invoice this payment belongs to
  • paid_total (float) – Amount that was paid
  • currency (str) – Currency used (e.g. EUR)
Returns:

The created invoice payment object

Return type:

moco_wrapper.util.response.ObjectResponse

create_bulk(items: list = [])

Create multiple new invoice payments.

Parameters:items (list) – Payment items
Returns:List of created invoice payments
Return type:moco_wrapper.util.response.ListResponse

Bulk creation if invoice payments items with generator:

from moco_wrapper.util.generator import InvoicePaymentGenerator()
from moco_wrapper import Moco

items = [
    gen.generate(..),
    gen.generate(..)
]

m = Moco()

created_payments = m.InvoicePayment.create_bulk(items)
delete(payment_id: int)

Deletes an invoice payment.

Parameters:payment_id (int) – Id of the payment to delete
Returns:Empty response on success
Return type:moco_wrapper.util.response.EmptyResponse
static endpoints() → List[moco_wrapper.util.endpoint.endpoint.Endpoint]

Returns all endpoints associated with the model

Returns:List of Endpoint objects
Return type:moco_wrapper.util.endpoint.Endpoint
get(payment_id: int)

Retrieve a single invoice payment.

Parameters:payment_id (int) – Invoice payment id
Returns:Single invoice payment object
Return type:moco_wrapper.util.response.ObjectResponse
getlist(invoice_id: int = None, date_from: datetime.date = None, date_to: datetime.date = None, sort_by: str = None, sort_order: str = 'asc', page: int = 1)

Retrieve a list of invoice payments.

Parameters:
  • invoice_id (int) – Id of a corresponding invoice (default None)
  • date_from (datetime.date, str) – Start date (default None)
  • date_to (datetime.date, str) – End date (default None)
  • sort_by (str) – Field to sort results by (default None)
  • sort_order (str) – asc or desc (default "asc")
  • page (int) – Page number (default 1)
Returns:

List of invoice payments

Return type:

moco_wrapper.util.response.PagedListResponse

update(payment_id: int, payment_date: datetime.date = None, paid_total: float = None, currency: str = None)

Updates an existing invoice payment.

Parameters:
  • payment_id (int) – Id of the payment to update
  • payment_date (datetime.date, str) – Date of the payment (default None)
  • paid_total (float) – Amount that was paid (default None)
  • currency (str) – Currency (e.g. EUR) (default None)
Returns:

The updated invoice payment object

Return type:

moco_wrapper.util.response.ObjectResponse