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 (ex. 193.50)
- currency (str) – Currency used (e.g. EUR)
Returns: The created invoice payment object
-
create_bulk
(items: list = [])¶ Create multiple new invoice payments.
Parameters: items (list) – Payment items Returns: List of created invoice payments 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
-
get
(payment_id: int)¶ Retrieve a single invoice payment.
Parameters: payment_id (int) – Invoice payment id Returns: Single invoice payment object
-
getlist
(invoice_id: int = None, date_from: datetime.date = None, date_to: datetime.date = None, sort_by: str = None, sort_order='asc', page=1)¶ Retrieve a list of invoice payments.
Parameters: - invoice_id (int) – Id of a corresponding invoice
- date_from (datetime.date, str) – Start date
- date_to (datetime.date, str) – End date
- sort_by (str) – Field to sort results by
- sort_order (str) – asc or desc (default asc)
- page (int) – Page number (default 1)
Returns: List of invoice payments
-
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
- paid_total (float) – Amount that was paid
- currency (str) – Currency (e.g. EUR)
Returns: The updated invoice payment object
-