feat: nhắc gia hạn QR theo dịch vụ, failover server hosting, CCCD admin, log cấp phát dịch vụ

- Mail campaign: mẫu nhắc gia hạn thanh toán QR, chọn dịch vụ + chu kỳ từng dòng (renewal_services)
- Hosting: nhiều server Plesk cho một gói (service_plan_servers), chuyển server khi server chết
- Admin xem/sửa giấy tờ định danh khách, tuỳ chọn gia hạn cho khách, nhật ký cấp phát dịch vụ
- Đánh dấu mẫu email dịch vụ là non-marketing

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
baodev0
2026-10-30 18:36:41 +07:00
co-authored by Claude Sonnet 5.5
parent 047c23beff
commit 55a834a2f8
53 changed files with 1463 additions and 119 deletions
@@ -116,12 +116,33 @@ class ClientTwoFactorTest extends TestCase
$this->assertTrue($device->expires_at->between(now()->addDays(89), now()->addDays(91)));
$this->login($customer, $deviceToken)->assertOk()->assertJsonStructure(['data' => ['token']]);
$this->login($customer, str_repeat('x', 64))->assertOk()->assertJsonPath('data.two_factor.resend_in', 60);
$this->login($customer, str_repeat('x', 64))->assertOk()->assertJsonPath('data.two_factor.resend_in', 300);
$this->travel(91)->days();
$this->login($customer, $deviceToken)->assertOk()->assertJsonStructure(['data' => ['two_factor']]);
}
public function test_repeated_logins_from_same_client_reuse_code_until_it_expires(): void
{
Mail::fake();
$customer = $this->customer(twoFactor: true);
$first = $this->login($customer)->json('data.two_factor.challenge');
$this->travel(2)->minutes();
$second = $this->login($customer)->assertJsonPath('data.two_factor.resend_in', 180)->json('data.two_factor.challenge');
$this->assertSame($first, $second);
Mail::assertQueuedCount(1);
$this->withServerVariables(['REMOTE_ADDR' => '203.0.113.9'])->login($customer);
Mail::assertQueuedCount(2);
$this->travel(301)->seconds();
$third = $this->login($customer)->json('data.two_factor.challenge');
$this->assertNotSame($first, $third);
Mail::assertQueuedCount(3);
}
public function test_challenge_is_destroyed_after_five_wrong_codes(): void
{
Mail::fake();