Class: MOCO::InvoicePayment
- Inherits:
-
BaseEntity
- Object
- BaseEntity
- MOCO::InvoicePayment
- Defined in:
- lib/moco/entities/invoice_payment.rb
Overview
Represents a MOCO invoice payment record (Rechnungen / Zahlungen) for tracking received payments
Required attributes for create:
date - String, "YYYY-MM-DD" payment date
paid_total - Float, amount received
Optional attributes:
invoice_id - Integer, invoice being paid (required unless description set)
currency - String, payment currency (e.g., "EUR")
partially_paid - Boolean, mark as partial payment
description - String, payment description (required if no invoice_id)
Read-only attributes:
id, invoice (Hash), paid_total_in_account_currency,
created_at, updated_at
Example:
moco.invoice_payments.create(
date: "2024-01-20",
invoice_id: 456,
paid_total: 5000.0,
currency: "EUR"
)
Bulk create:
moco.post("invoices/payments/bulk", {
bulk_data: [
{ date: "2024-01-20", invoice_id: 123, paid_total: 1000 },
{ date: "2024-01-21", invoice_id: 456, paid_total: 2000 }
]
})
Filtering:
moco.invoice_payments.where(invoice_id: 123)
moco.invoice_payments.where(date_from: "2024-01-01", date_to: "2024-01-31")
Instance Attribute Summary
Attributes inherited from BaseEntity
Instance Method Summary collapse
-
#invoice ⇒ Object
Associations.
- #to_s ⇒ Object
Methods inherited from BaseEntity
#==, #association, #destroy, #eql?, #has_many, #hash, #id, #initialize, #inspect, #reload, #save, #to_h, #to_json, #update
Constructor Details
This class inherits a constructor from MOCO::BaseEntity
Instance Method Details
#invoice ⇒ Object
Associations
43 44 45 |
# File 'lib/moco/entities/invoice_payment.rb', line 43 def invoice association(:invoice) end |
#to_s ⇒ Object
47 48 49 |
# File 'lib/moco/entities/invoice_payment.rb', line 47 def to_s "Payment ##{id} (#{date})" end |