fix parent pages and teachers and admin
API CI/CD / Validate (composer + pint) (push) Successful in 3m8s
API CI/CD / Build frontend assets (push) Successful in 1m2s
API CI/CD / Test (PHPUnit) (push) Failing after 6m5s
API CI/CD / Security audit (push) Failing after 52s
API CI/CD / Deploy to shared hosting (PHP) (push) Has been skipped
API CI/CD / Validate (composer + pint) (push) Successful in 3m8s
API CI/CD / Build frontend assets (push) Successful in 1m2s
API CI/CD / Test (PHPUnit) (push) Failing after 6m5s
API CI/CD / Security audit (push) Failing after 52s
API CI/CD / Deploy to shared hosting (PHP) (push) Has been skipped
This commit is contained in:
@@ -60,4 +60,39 @@ class InvoicePaymentServiceTest extends TestCase
|
||||
$this->assertSame(5.0, $data['invoices'][0]['refund_amount']);
|
||||
$this->assertSame(60.0, $data['invoices'][0]['last_paid_amount']);
|
||||
}
|
||||
|
||||
public function test_parent_invoice_summary_applies_full_discount_to_balance(): void
|
||||
{
|
||||
DB::table('invoices')->insert([
|
||||
[
|
||||
'id' => 1,
|
||||
'parent_id' => 10,
|
||||
'invoice_number' => 'INV-DISCOUNT',
|
||||
'total_amount' => 370,
|
||||
'balance' => 370,
|
||||
'paid_amount' => 0,
|
||||
'has_discount' => 1,
|
||||
'issue_date' => '2025-01-10',
|
||||
'status' => 'Paid',
|
||||
'school_year' => '2025-2026',
|
||||
],
|
||||
]);
|
||||
|
||||
DB::table('discount_usages')->insert([
|
||||
'id' => 1,
|
||||
'voucher_id' => 1,
|
||||
'parent_id' => 10,
|
||||
'invoice_id' => 1,
|
||||
'discount_amount' => 370,
|
||||
'description' => 'Full scholarship',
|
||||
'school_year' => '2025-2026',
|
||||
]);
|
||||
|
||||
$service = new InvoicePaymentService(new InvoiceConfigService);
|
||||
$data = $service->getParentInvoiceSummary(10, '2025-2026');
|
||||
|
||||
$this->assertSame(370.0, $data['invoices'][0]['discount']);
|
||||
$this->assertSame(0.0, $data['invoices'][0]['balance']);
|
||||
$this->assertSame('Paid', $data['invoices'][0]['status']);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user