feat(service): huỷ dịch vụ, SSL, đổi mật khẩu hosting, lịch sử thanh toán theo hình thức

- Lịch sử thanh toán hoá đơn trả thêm `method` (tự động gia hạn / số dư / admin / chuyển khoản / hoàn tiền), bỏ đuôi `(method)` khỏi ghi chú
- `DnsServer::panelUrl()` = https://<domain>/ dùng cho email cấp hosting và nút Plesk của khách
- Order item trả thêm `uuid`/`type` của dịch vụ để FE dẫn tới trang quản lý
- Yêu cầu huỷ dịch vụ, chứng chỉ SSL, lịch sử gia hạn, đổi mật khẩu hosting cho khách

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
baodev0
2026-10-28 16:40:24 +07:00
co-authored by Claude Sonnet 5.5
parent a6b641015e
commit b44a88bb52
72 changed files with 1701 additions and 231 deletions
+13 -32
View File
@@ -1,44 +1,25 @@
<?php
declare(strict_types=1);
namespace App\Support;
use RuntimeException;
class ResponseCipher
{
private const CIPHER = 'aes-256-gcm';
public static function keyFrom(?string $encoded): ?string
public static function encrypt(?string $value): ?string
{
$key = $encoded ? base64_decode($encoded, true) : false;
return $key !== false && strlen($key) === 32 ? $key : null;
}
public static function seal(string $plain, string $key): string
{
$iv = random_bytes(12);
$cipherText = openssl_encrypt($plain, self::CIPHER, $key, OPENSSL_RAW_DATA, $iv, $tag);
return base64_encode($iv . $cipherText . $tag);
}
public static function open(string $sealed, string $key): ?string
{
$raw = base64_decode($sealed, true);
if ($raw === false || strlen($raw) < 29) {
return null;
if ($value === null || $value === '') {
return $value;
}
$plain = openssl_decrypt(
substr($raw, 12, -16),
self::CIPHER,
$key,
OPENSSL_RAW_DATA,
substr($raw, 0, 12),
substr($raw, -16),
);
$key = (string) config('services.client_api.response_key');
if (!preg_match('/^[a-fA-F0-9]{64}$/', $key)) {
throw new RuntimeException('CLIENT_RESPONSE_KEY must be a 64-character hex string');
}
return $plain === false ? null : $plain;
$iv = random_bytes(12);
$ciphertext = openssl_encrypt($value, 'aes-256-gcm', hex2bin($key), OPENSSL_RAW_DATA, $iv, $tag);
return base64_encode($iv . $ciphertext . $tag);
}
}