mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Additional tests
This commit is contained in:
parent
9332be7831
commit
63de5df95e
@ -112,6 +112,12 @@ class QuoteFilters extends QueryFilters
|
||||
->orderBy('due_date', 'DESC');
|
||||
});
|
||||
}
|
||||
|
||||
if(in_array('convert', $status_parameters)) {
|
||||
$query->orWhere(function ($q) {
|
||||
$q->whereNotNull('invoice_id');
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
return $this->builder;
|
||||
|
@ -69,32 +69,16 @@ class ApplyPayment extends AbstractService
|
||||
}
|
||||
}
|
||||
|
||||
nlog($this->invoice->id. " " . $this->invoice->paid_to_date);
|
||||
$this->payment
|
||||
->ledger()
|
||||
->updatePaymentBalance($amount_paid);
|
||||
|
||||
// nlog("updating client balance by amount {$amount_paid}");
|
||||
|
||||
$this->invoice
|
||||
->client
|
||||
->service()
|
||||
->updateBalance($amount_paid)
|
||||
->save();
|
||||
|
||||
// /* Update Pivot Record amount */
|
||||
// $this->payment->invoices->each(function ($inv) use ($amount_paid) {
|
||||
// if ($inv->id == $this->invoice->id) {
|
||||
// // $inv->pivot->amount = ($amount_paid * -1);
|
||||
// // $inv->pivot->save();
|
||||
// //25-06-2023
|
||||
// nlog($inv);
|
||||
// nlog($amount_paid);
|
||||
// $inv->paid_to_date += floatval($amount_paid * -1);
|
||||
// $inv->save();
|
||||
// }
|
||||
// });
|
||||
|
||||
$this->invoice
|
||||
->service()
|
||||
->applyNumber()
|
||||
|
@ -135,6 +135,7 @@ class RefundTest extends TestCase
|
||||
|
||||
$this->assertEquals(50, $arr['data']['refunded']);
|
||||
$this->assertEquals(Payment::STATUS_REFUNDED, $arr['data']['status_id']);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -289,6 +290,12 @@ class RefundTest extends TestCase
|
||||
$this->assertNotNull($payment->invoices());
|
||||
$this->assertEquals(1, $payment->invoices()->count());
|
||||
|
||||
|
||||
$i = $this->invoice->fresh();
|
||||
|
||||
$this->assertEquals(0, $i->balance);
|
||||
$this->assertEquals(round($this->invoice->amount,2), round($i->paid_to_date,2));
|
||||
|
||||
$data = [
|
||||
'id' => $this->encodePrimaryKey($payment->id),
|
||||
'amount' => 50,
|
||||
@ -309,6 +316,12 @@ class RefundTest extends TestCase
|
||||
])->post('/api/v1/payments/refund', $data);
|
||||
|
||||
$response->assertStatus(200);
|
||||
|
||||
$i = $this->invoice->fresh();
|
||||
|
||||
$this->assertEquals($i->amount, $i->balance);
|
||||
$this->assertEquals(0, round($i->paid_to_date, 2));
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user