account, $this->serializer); return $this->includeCollection($invoice->invoice_items, $transformer, ENTITY_INVOICE_ITEMS); } public function includeInvitations(Invoice $invoice) { $transformer = new InvitationTransformer($this->account, $this->serializer); return $this->includeCollection($invoice->invitations, $transformer, ENTITY_INVITATION); } public function includePayments(Invoice $invoice) { $transformer = new PaymentTransformer($this->account, $this->serializer); return $this->includeCollection($invoice->payments, $transformer, ENTITY_PAYMENT); } public function transform(Invoice $invoice) { return [ 'id' => (int) $invoice->public_id, 'amount' => (float) $invoice->amount, 'balance' => (float) $invoice->balance, 'client_id' => (int) $invoice->client->public_id, 'invoice_status_id' => (int) $invoice->invoice_status_id, 'updated_at' => $this->getTimestamp($invoice->updated_at), 'archived_at' => $this->getTimestamp($invoice->deleted_at), 'invoice_number' => $invoice->invoice_number, 'discount' => (double) $invoice->discount, 'po_number' => $invoice->po_number, 'invoice_date' => $invoice->invoice_date, 'due_date' => $invoice->due_date, 'terms' => $invoice->terms, 'public_notes' => $invoice->public_notes, 'is_deleted' => (bool) $invoice->is_deleted, 'is_quote' => (bool) $invoice->is_quote, 'is_recurring' => (bool) $invoice->is_recurring, 'frequency_id' => (int) $invoice->frequency_id, 'start_date' => $invoice->start_date, 'end_date' => $invoice->end_date, 'last_sent_date' => $invoice->last_sent_date, 'recurring_invoice_id' => (int) $invoice->recurring_invoice_id, 'tax_name' => $invoice->tax_name, 'tax_rate' => (float) $invoice->tax_rate, 'amount' => (float) $invoice->amount, 'balance' => (float) $invoice->balance, 'is_amount_discount' => (bool) $invoice->is_amount_discount, 'invoice_footer' => $invoice->invoice_footer, 'partial' => (float) $invoice->partial, 'has_tasks' => (bool) $invoice->has_tasks, 'auto_bill' => (bool) $invoice->auto_bill, 'account_key' => $this->account->account_key, 'user_id' => (int) $invoice->user->public_id + 1, 'custom_value1' => (float) $invoice->custom_value1, 'custom_value2' => (float) $invoice->custom_value2, 'custom_taxes1' => (bool) $invoice->custom_taxes1, 'custom_taxes2' => (bool) $invoice->custom_taxes2, 'has_expenses' => (bool) $invoice->has_expenses, ]; } }