feat: email gửi tay/nhắc gia hạn, gói hosting, sửa dữ liệu sản phẩm

- Gửi email theo template cho 1 khách, tab lịch sử email, nhắc gia hạn dịch vụ hàng loạt
- Mail lưu from/bcc/sent_by; mẫu MARKETING và mẫu cũ trong TemplateSeeder
- Gói hosting: giới hạn, trạng thái, lấy plan Plesk qua CLI gateway
- Backfill payment_method và ngày đơn hàng còn thiếu
- Bổ sung field CPU/RAM/Disk/Băng thông cho loại sản phẩm vps và cloud

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
baodev0
2026-10-09 11:32:05 +07:00
co-authored by Claude Opus 5.5
parent 8651dde6b1
commit 30898ea46f
59 changed files with 1771 additions and 108 deletions
@@ -145,6 +145,35 @@ class InvoicePaymentServiceTest extends TestCase
$this->assertSame(400_000, (int) $customer->fresh()->total);
}
public function test_admin_payment_records_source_and_note(): void
{
$customer = Customer::factory()->create(['total' => 0]);
$invoice = $this->makeInvoice($customer, 100_000);
$invoice = app(InvoicePaymentService::class)->markPaidByAdmin(
$invoice,
null,
method: 'manual',
receivedAmount: 40_000,
note: 'Khách chuyển khoản đợt 1',
);
$this->assertSame(40_000, (int) $invoice->amount_paid);
$this->assertSame('Khách chuyển khoản đợt 1', $invoice->note);
$this->assertDatabaseHas('transactions', [
'customer_id' => $customer->id,
'received_amount' => 40_000,
]);
$this->assertStringContainsString(
'Khách chuyển khoản đợt 1',
(string) Transaction::where('customer_id', $customer->id)->value('note'),
);
$this->assertStringContainsString(
'(manual)',
(string) Transaction::where('customer_id', $customer->id)->value('note'),
);
}
/** Hoàn tiền: cộng lại số dư, ghi Transaction âm, hoá đơn sang REFUNDED. */
public function test_refund_returns_balance_and_records_a_negative_transaction(): void
{