Fix changes for Payment Transformer

This commit is contained in:
Anmol Gupta 2018-06-26 19:45:54 +05:30
parent 7f6cabae34
commit 865f4958ef

View File

@ -51,15 +51,15 @@ class PaymentTransformer extends EntityTransformer
return array_merge($this->getDefaults($payment), [ return array_merge($this->getDefaults($payment), [
'id' => (int) $payment->public_id, 'id' => (int) $payment->public_id,
'amount' => (float) $payment->amount, 'amount' => (float) $payment->amount,
'transaction_reference' => $payment->transaction_reference, 'transaction_reference' => $payment->transaction_reference ?: '',
'payment_date' => $payment->payment_date, 'payment_date' => $payment->payment_date ?: '',
'updated_at' => $this->getTimestamp($payment->updated_at), 'updated_at' => $this->getTimestamp($payment->updated_at),
'archived_at' => $this->getTimestamp($payment->deleted_at), 'archived_at' => $this->getTimestamp($payment->deleted_at),
'is_deleted' => (bool) $payment->is_deleted, 'is_deleted' => (bool) $payment->is_deleted,
'payment_type_id' => (int) $payment->payment_type_id, 'payment_type_id' => (int) ($payment->payment_type_id ?: 0),
'invoice_id' => (int) ($this->invoice ? $this->invoice->public_id : $payment->invoice->public_id), 'invoice_id' => (int) ($this->invoice ? $this->invoice->public_id : $payment->invoice->public_id),
'invoice_number' => $this->invoice ? $this->invoice->invoice_number : $payment->invoice->invoice_number, 'invoice_number' => $this->invoice ? $this->invoice->invoice_number : $payment->invoice->invoice_number,
'private_notes' => $payment->private_notes, 'private_notes' => $payment->private_notes ?: '',
'exchange_rate' => (float) $payment->exchange_rate, 'exchange_rate' => (float) $payment->exchange_rate,
'exchange_currency_id' => (int) $payment->exchange_currency_id, 'exchange_currency_id' => (int) $payment->exchange_currency_id,
]); ]);