feat: khởi tạo/huỷ domain Plesk qua job, gửi mail hoá đơn qua queue, đính kèm triển khai
- ProvisionDnsDomainJob/SuspendDnsDomainJob: tạo domain admin lên Plesk, huỷ = suspend (is_created=3) - Khách xem zone DNS được gán ở /dich-vu/domain, quản lý bản ghi A/AAAA/CNAME/TXT/MX/SRV - send-mail hoá đơn đẩy SendInvoiceMailJob, preview + sửa nội dung, ghi mail.order_id - invoice_attachments.type (payment_proof/deployment) - CacheService xoá theo SCAN pattern, Redis không persistent mặc định - Backfill transactions.public_code Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
30898ea46f
commit
94614d9cb3
@@ -4,6 +4,7 @@ namespace App\Services\Customer;
|
||||
|
||||
use App\Models\Invoice;
|
||||
use App\Models\Order;
|
||||
use App\Enums\TransactionStatus;
|
||||
use App\Models\Transaction;
|
||||
use App\Repositories\Customer\CustomerRepositoryInterface;
|
||||
use App\Repositories\Invoice\InvoiceRepositoryInterface;
|
||||
@@ -11,6 +12,7 @@ use App\Repositories\Order\OrderRepositoryInterface;
|
||||
use App\Repositories\Transaction\TransactionRepositoryInterface;
|
||||
use App\Services\Customer\Concerns\ResolvesCustomer;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class CustomerBillingService
|
||||
{
|
||||
@@ -91,6 +93,36 @@ class CustomerBillingService
|
||||
return $transaction->refresh()->load('user');
|
||||
}
|
||||
|
||||
public function createTransaction(string $uuid, array $data, ?int $adminId): Transaction
|
||||
{
|
||||
$customer = $this->resolveCustomer($uuid);
|
||||
|
||||
$transaction = $this->transactionRepository->create([
|
||||
'uuid' => (string) Str::uuid(),
|
||||
'public_code' => Transaction::newPublicCode('ADM'),
|
||||
'trans' => $data['trans'] ?? null,
|
||||
'amount' => $data['amount'],
|
||||
'received_amount' => $data['amount'],
|
||||
'customer_id' => $customer->id,
|
||||
'user_id' => $adminId,
|
||||
'status' => $data['status'] ?? TransactionStatus::COMPLETED->value,
|
||||
'type' => 'admin_record',
|
||||
'note' => $data['note'] ?? null,
|
||||
]);
|
||||
|
||||
return $transaction->load('user');
|
||||
}
|
||||
|
||||
public function deleteTransaction(string $uuid, int $transactionId): void
|
||||
{
|
||||
$customer = $this->resolveCustomer($uuid);
|
||||
|
||||
$exists = Transaction::where('customer_id', $customer->id)->where('id', $transactionId)->exists();
|
||||
abort_if(!$exists, 404, 'Không tìm thấy giao dịch');
|
||||
|
||||
$this->transactionRepository->delete($transactionId);
|
||||
}
|
||||
|
||||
public function getOrders(string $uuid): Collection
|
||||
{
|
||||
$customer = $this->resolveCustomer($uuid);
|
||||
|
||||
Reference in New Issue
Block a user