Add feature tests for domain order management

- Implement AdminDomainOrderTest to cover admin functionalities for domain orders including listing, confirming registration, KYC updates, activation, rejection, and refunds.
- Implement ClientDomainOrderTest to cover client functionalities for placing domain orders, including validation for balance, duplicate orders, and domain normalization.
- Ensure proper handling of domain pricing and service statuses throughout the tests.
This commit is contained in:
baodev0
2026-07-10 14:16:35 +07:00
parent 61c0e026c8
commit dfb926055d
81 changed files with 35743 additions and 481 deletions
+164 -47
View File
@@ -1,5 +1,6 @@
@php
$brandColor = $brandColor ?? '#1a56db';
$companyLogo = $companyLogo ?? setting('setting.logo') ?? '';
$frontendLabels = [
'nextjs' => 'Next.js',
@@ -27,14 +28,29 @@ $fmt = fn ($n) => number_format((float) $n, 0, ',', '.');
<style>
@page { size: A4; margin: 16mm 18mm; }
* { box-sizing: border-box; margin: 0; padding: 0; }
* {
box-sizing: border-box;
font-family: "DejaVu Serif", "Times New Roman", serif;
}
html,
body {
margin: 0;
padding: 0;
}
body {
font-family: "DejaVu Sans", "Times New Roman", serif;
color: #1f2937;
font-size: 11px;
line-height: 1.5;
color: #111;
font-size: 10px;
line-height: 1.45;
background: #fff;
padding: 20px;
}
.quote-page {
min-height: 277mm;
padding: 3mm;
border: 1px solid #efefe;
}
/* Header */
@@ -47,18 +63,57 @@ body {
.meta-cell { width: 52mm; font-size: 10px; text-align: right; }
.doc-title { text-align: center; margin: 10px 0 2px; }
.doc-title h1 { font-size: 20px; font-weight: bold; text-transform: uppercase; letter-spacing: 1px; color: {{ $brandColor }}; }
.doc-title h1 { font-size: 21px; font-weight: bold; text-transform: uppercase; letter-spacing: 0; color: #111; }
.doc-title .sub { font-size: 11px; font-style: italic; color: #6b7280; }
.divider { border: none; border-top: 2px solid {{ $brandColor }}; margin: 8px 0 10px; }
.divider { border: none; border-top: 1px solid #bbb; margin: 8px 0 10px; }
.seller-section {
position: relative;
min-height: 120px;
padding-right: 120px;
}
.seller-section .company-name {
margin: 0 0 3px;
font-size: 16px;
font-weight: bold;
text-transform: uppercase;
}
.info-row {
margin: 4px 0;
}
.bank-table {
width: 100%;
margin: 4px 0;
border-collapse: collapse;
}
.bank-table td {
padding: 0;
vertical-align: top;
}
.bank-table-label {
width: 155px;
}
.qr-code {
position: absolute;
top: 8px;
right: 15px;
width: 90px;
height: 90px;
border: 1px solid #555;
text-align: center;
line-height: 90px;
}
/* Section */
.section { margin-bottom: 10px; }
.section-title {
font-size: 12px; font-weight: bold; text-transform: uppercase;
color: {{ $brandColor }}; border-bottom: 1px solid #e5e7eb;
padding-bottom: 3px; margin-bottom: 6px;
}
.section-title { font-size: 12px; font-weight: bold; text-transform: uppercase; color: #111; border-bottom: 1px solid #e5e7eb; padding-bottom: 3px; margin-bottom: 6px; }
.info-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.info-table td { padding: 2px 8px 2px 0; vertical-align: top; }
@@ -68,23 +123,42 @@ body {
.two-col > tbody > tr > td { width: 50%; vertical-align: top; padding-right: 10px; }
/* Items table */
.items-table { width: 100%; border-collapse: collapse; margin-top: 4px; font-size: 10px; table-layout: fixed; }
.items-table th, .items-table td { border: 1px solid #d1d5db; padding: 6px 7px; vertical-align: top; overflow-wrap: break-word; }
.items-table thead th { background: {{ $brandColor }}; color: #fff; font-weight: bold; text-align: center; }
.items-table-wrapper {
position: relative;
margin-top: 4px;
}
.items-table-watermark {
position: absolute;
top: 0;
left: 50%;
width: 430px;
height: auto;
opacity: 0.3;
margin-left: -215px;
z-index: 0;
}
.items-table { width: 100%; border-collapse: collapse; margin-top: 4px; font-size: 10px; table-layout: auto; }
.items-table th, .items-table td { border: 1px solid #777; vertical-align: top; overflow-wrap: break-word; }
.items-table th { padding: 4px; height: 38px; text-align: center; vertical-align: middle; }
.items-table td { padding: 1px 2px; line-height: 1.2; }
.items-table thead th { background: transparent; color: #111; font-weight: bold; text-align: center; }
.items-table tr { page-break-inside: avoid; }
.items-table td.center { text-align: center; }
.items-table td.right { text-align: right; }
.items-table td.summary-label { text-align: right; font-weight: bold; }
.items-table td.summary-value { text-align: right; font-weight: bold; }
.items-table tr.total td { font-size: 12px; font-weight: bold; }
.items-table .item-desc { color: #6b7280; font-size: 9px; }
.items-table { position: relative; z-index: 1; }
/* Summary */
.summary-table { width: 62mm; border-collapse: collapse; margin-top: 6px; margin-left: auto; font-size: 11px; }
.summary-table td { padding: 3px 6px; }
.summary-table .lbl { text-align: left; color: #374151; }
.summary-table .val { text-align: right; }
.summary-table tr.total td {
font-weight: bold; font-size: 13px; color: {{ $brandColor }};
border-top: 1.5px solid {{ $brandColor }};
}
.summary-table tr.total td { font-weight: bold; font-size: 13px; color: #111; border-top: 1px solid #777; }
.note-box { background: #f9fafb; border: 1px solid #e5e7eb; border-radius: 3px; padding: 7px 9px; margin-top: 6px; }
@@ -101,17 +175,15 @@ ul.ref-list { margin: 2px 0 0 14px; }
</style>
</head>
<body>
<div class="quote-page">
<table class="top-table">
<tr>
@if ($companyLogo)
<td class="logo-cell"><img src="{{ $companyLogo }}" alt="logo"/></td>
@endif
<td class="logo-cell">
<img src="{{ $companyLogo ?: public_path('images/image.png') }}" alt="logo"/>
</td>
<td class="company-cell">
<div class="company-name">{{ $companyName }}</div>
@if ($companyAddress)<div>Địa chỉ: {{ $companyAddress }}</div>@endif
@if ($companyPhone)<div>Điện thoại: {{ $companyPhone }}</div>@endif
@if ($companyEmail)<div>Email: {{ $companyEmail }}</div>@endif
@if ($companyTaxCode)<div>MST: {{ $companyTaxCode }}</div>@endif
<h1>BÁO GIÁ WEBSITE</h1>
</td>
<td class="meta-cell">
<div><strong>Số báo giá:</strong> {{ $quote->quote_number }}</div>
@@ -123,9 +195,41 @@ ul.ref-list { margin: 2px 0 0 14px; }
</tr>
</table>
<div class="doc-title">
<h1>Báo giá thiết kế website</h1>
<div class="sub">Kính gửi Quý khách hàng</div>
<hr class="divider"/>
<div class="seller-section">
<h3 class="company-name">{{ $companyName }}</h3>
@if ($companyTaxCode)
<div class="info-row">Mã số thuế <span style="font-style: italic">(Tax code)</span>: {{ $companyTaxCode }}</div>
@endif
@if ($companyAddress)
<div class="info-row">Địa chỉ <span style="font-style: italic">(Address)</span>: {{ $companyAddress }}</div>
@endif
@if ($companyPhone)
<div class="info-row">Điện thoại <span style="font-style: italic">(Tel)</span>: {{ $companyPhone }}</div>
@endif
@if ($companyEmail)
<div class="info-row">Email: {{ $companyEmail }}</div>
@endif
<table class="bank-table">
<tr>
<td class="bank-table-label">Số tài khoản <span style="font-style: italic">(Bank account)</span>:</td>
<td>7379868 Ngân hàng TMCP Á Châu (ACB) Chi nhánh TP. Hồ Chí Minh</td>
</tr>
<tr>
<td class="bank-table-label"></td>
<td>797379868 Ngân hàng TMCP Quân Đội (MB) Chi nhánh Phú Nhuận</td>
</tr>
</table>
<div class="qr-code">
<img src="{{ public_path('images/qr-code-tgs.jpg') }}" alt="QR Code" style="width: 100%; height: auto;">
</div>
</div>
<hr class="divider"/>
@@ -182,11 +286,9 @@ ul.ref-list { margin: 2px 0 0 14px; }
<tr>
<td class="lbl">Website mẫu:</td>
<td>
<ul class="ref-list">
@foreach ($referenceWebsites as $ref)
<li>{{ $ref }}</li>
@endforeach
</ul>
@foreach ($referenceWebsites as $ref)
{{ $ref }}<br/>
@endforeach
</td>
</tr>
@endif
@@ -195,10 +297,12 @@ ul.ref-list { margin: 2px 0 0 14px; }
<div class="section">
<div class="section-title">Chi tiết báo giá</div>
<div class="items-table-wrapper">
<img src="{{ public_path('images/image.png') }}" alt="Watermark" class="items-table-watermark">
<table class="items-table">
<thead>
<tr>
<th style="width: 8mm;">STT</th>
<th style="width: 8mm;">STT<br><span style="font-style: italic">(No)</span></th>
<th>Hạng mục</th>
<th style="width: 12mm;">SL</th>
<th style="width: 26mm;">Đơn giá ({{ $quote->currency }})</th>
@@ -220,19 +324,31 @@ ul.ref-list { margin: 2px 0 0 14px; }
<td class="right">{{ $fmt(($item['quantity'] ?? 1) * ($item['unit_price'] ?? 0)) }}</td>
</tr>
@endforeach
<tr>
<td colspan="4" class="summary-label">Tạm tính:</td>
<td class="summary-value">{{ $fmt($quote->subtotal) }}</td>
</tr>
@if ($quote->discount > 0)
<tr>
<td colspan="4" class="summary-label">Giảm giá:</td>
<td class="summary-value">-{{ $fmt($quote->discount) }}</td>
</tr>
@endif
@if ($quote->vat_percent > 0)
<tr>
<td colspan="4" class="summary-label">
VAT ({{ rtrim(rtrim(number_format($quote->vat_percent, 2, '.', ''), '0'), '.') }}%):
</td>
<td class="summary-value">{{ $fmt($vatAmount) }}</td>
</tr>
@endif
<tr class="total">
<td colspan="4" class="summary-label">Tổng cộng:</td>
<td class="summary-value">{{ $fmt($quote->total) }} {{ $quote->currency }}</td>
</tr>
</tbody>
</table>
<table class="summary-table">
<tr><td class="lbl">Tạm tính:</td><td class="val">{{ $fmt($quote->subtotal) }}</td></tr>
@if ($quote->discount > 0)
<tr><td class="lbl">Giảm giá:</td><td class="val">-{{ $fmt($quote->discount) }}</td></tr>
@endif
@if ($quote->vat_percent > 0)
<tr><td class="lbl">VAT ({{ rtrim(rtrim(number_format($quote->vat_percent, 2, '.', ''), '0'), '.') }}%):</td><td class="val">{{ $fmt($vatAmount) }}</td></tr>
@endif
<tr class="total"><td class="lbl">Tổng cộng:</td><td class="val">{{ $fmt($quote->total) }} {{ $quote->currency }}</td></tr>
</table>
</div>
</div>
@if ($quote->note)
@@ -261,5 +377,6 @@ ul.ref-list { margin: 2px 0 0 14px; }
Báo giá có hiệu lực {{ $quote->valid_until ? 'đến ngày ' . $quote->valid_until->format('d/m/Y') : 'trong 30 ngày kể từ ngày lập' }}.
Cảm ơn Quý khách đã quan tâm đến dịch vụ thiết kế website của {{ $companyName }}.
</div>
</div>
</body>
</html>