mirror of
				https://github.com/invoiceninja/invoiceninja.git
				synced 2025-11-03 23:47:32 -05:00 
			
		
		
		
	Merge branch 'master' of github.com:hillelcoren/invoice-ninja
This commit is contained in:
		
						commit
						aa94e786ba
					
				@ -176,6 +176,11 @@ class Invoice extends EntityModel implements BalanceAffecting
 | 
			
		||||
        return $this->belongsTo('App\Models\InvoiceDesign');
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public  function payments()
 | 
			
		||||
    {
 | 
			
		||||
        return $this->hasMany('App\Models\Payment', 'invoice_id', 'id');
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function recurring_invoice()
 | 
			
		||||
    {
 | 
			
		||||
        return $this->belongsTo('App\Models\Invoice');
 | 
			
		||||
 | 
			
		||||
@ -22,6 +22,7 @@ class InvoiceTransformer extends EntityTransformer
 | 
			
		||||
 | 
			
		||||
    protected $defaultIncludes = [
 | 
			
		||||
        'invoice_items',
 | 
			
		||||
        'payments'
 | 
			
		||||
    ];
 | 
			
		||||
    
 | 
			
		||||
    public function includeInvoiceItems(Invoice $invoice)
 | 
			
		||||
@ -30,6 +31,12 @@ class InvoiceTransformer extends EntityTransformer
 | 
			
		||||
        return $this->includeCollection($invoice->invoice_items, $transformer, ENTITY_INVOICE_ITEMS);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    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 [
 | 
			
		||||
 | 
			
		||||
@ -18,10 +18,7 @@ class PaymentTransformer extends EntityTransformer
 | 
			
		||||
    * @SWG\Property(property="amount", type="float", example=10, readOnly=true)
 | 
			
		||||
    * @SWG\Property(property="invoice_id", type="integer", example=1)
 | 
			
		||||
    */
 | 
			
		||||
    protected $defaultIncludes = [
 | 
			
		||||
        'invoice',
 | 
			
		||||
        'client',
 | 
			
		||||
    ];
 | 
			
		||||
    protected $defaultIncludes = [];
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    public function __construct(Account $account)
 | 
			
		||||
@ -50,6 +47,11 @@ class PaymentTransformer extends EntityTransformer
 | 
			
		||||
            'account_key' => $this->account->account_key,
 | 
			
		||||
            'user_id' => (int) $payment->user->public_id + 1,
 | 
			
		||||
            'transaction_reference' => $payment->transaction_reference,
 | 
			
		||||
            'payment_date' => $payment->payment_date,
 | 
			
		||||
            'updated_at' => $this->getTimestamp($payment->updated_at),
 | 
			
		||||
            'archived_at' => $this->getTimestamp($payment->deleted_at),
 | 
			
		||||
            'is_deleted' => (bool) $payment->is_deleted,
 | 
			
		||||
            'payment_type_id' => (int) $payment->payment_type_id,
 | 
			
		||||
        ];
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user