Separate invoice and payment
Maybe also because of semantics (an invoice is not a payment), but particularly it would enable the following scenarios:
- Pay multiple invoices (3 EUR + 5 EUR) in one payment (8 EUR)
- Using djp_sepa with future FinTS support, import bank transactions (payments) which can then be linked to invoices.
Suggestion for a new Invoice model:
status: "pending" or "cleared"
created: datetime
modified: datetime
currency: str
total: decimal (?) or calculate using property method
delivery: decimal (?)
tax: decimal (?) or calculate using property method
description: str
billing_first_name: str
billing_last_name: str
billing_address_1: str
billing_address_2: str
billing_city: str
billing_postcode: str
billing_country_code: str
billing_country_area: str
billing_email: email
billing_phone: phonenumber
message: str
token: str
captured_amount: decimal
group: InvoiceGroup
number: str
due_date: date
for_content_type: ContentType
for_object_id: int
person: Person
items: [InvoiceItem]
payments: [Payment]
The Payment model can probably be very minimalistic based on BasePayment
. Access to invoices linked to a payment is done via Invoice.payment's related_name.