'Create a snapshot of the invoice.
A snapshot is a JSON-serializable representation
of the invoice\'s state, including its line items
and associated transactions (payments/refunds).
This is useful for saving the history of changes
to the invoice.
Returns:
dict'

def snapshot(self):

    return {'internal_reference': self.internal_reference, 'customer_reference': self.customer_reference_number, 'is_valid': self.is_valid, 'contact_info': {'company_name': self.company_name, 'company_contact_name': self.company_contact_name, 'company_contact_email': self.company_contact_email, 'recipient_name': self.recipient_name, 'recipient_email': self.recipient_email, 'address_line_1': self.address_line_1, 'address_line_2': self.address_line_2, 'address_line_3': self.address_line_3, 'city': self.city, 'state': self.state, 'zip': self.zip, 'country': self.country}, 'items': [item.snapshot() for item in InvoiceItem.objects.filter(invoice=self).select_subclasses()], 'transactions': [trans.snapshot() for trans in InvoiceTransaction.objects.filter(invoice=self)]}
