add refund and event logic
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Services\Refunds;
|
||||
|
||||
use App\Services\Refunds\RefundPayoutService;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Tests\TestCase;
|
||||
|
||||
class RefundPayoutServiceTest extends TestCase
|
||||
{
|
||||
use RefreshDatabase;
|
||||
|
||||
public function test_record_payment_marks_partial(): void
|
||||
{
|
||||
DB::table('refunds')->insert([
|
||||
'id' => 1,
|
||||
'parent_id' => 10,
|
||||
'invoice_id' => 1,
|
||||
'school_year' => '2025-2026',
|
||||
'semester' => 'Fall',
|
||||
'refund_amount' => 100,
|
||||
'refund_paid_amount' => 0,
|
||||
'status' => 'Approved',
|
||||
'request' => 'overpayment',
|
||||
'created_at' => now(),
|
||||
'updated_at' => now(),
|
||||
]);
|
||||
|
||||
$service = new RefundPayoutService();
|
||||
$result = $service->recordPayment(1, [
|
||||
'paid_amount' => 40,
|
||||
'payment_method' => 'Cash',
|
||||
], 2);
|
||||
|
||||
$this->assertTrue($result['ok']);
|
||||
$this->assertDatabaseHas('refunds', [
|
||||
'id' => 1,
|
||||
'status' => 'Partial',
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user