Skip to content

Wallet Module

Mục đích

Quản lý ví tiền, giao dịch, hoa hồng (commission), hoàn tiền (refund) cho nhân viên và khách hàng. Wallet là "hệ thống tài chính nội bộ" của Diva — mọi dòng tiền vào/ra đều đi qua đây.

Quy mô

  • Không có FE module riêng; UI wallet nằm phân tán ở nhiều module.
  • Phạm vi bao phủ cả ví khách hàng lẫn ví nhân viên.
  • Tác động trực tiếp tới commission, refund, payment gateway và báo cáo tài chính nội bộ.

Actors & Permissions

RoleQuyềnScope
Staff (user)Xem ví bản thân, xem commissionSelf
Manager (user)Duyệt giao dịch, xem commission branchBranch
Admin (user)Toàn quyền ví, giao dịch, refundSystem
CustomerXem ví bản thân, yêu cầu rút tiềnSelf

Capability Highlights

Wallet Type IDTênCurrencyMục đích
VNDVí tiền mặtVNDThanh toán, hoàn tiền
COMMISSIONVí hoa hồngVNDCommission NV từ đơn hàng
VND_PROMOTIONVí khuyến mãiVNDKhuyến mãi, không rút được
POINT (P)Ví điểm thưởngPTích điểm, đổi thưởng

Feature Groups

GroupMô tảDocs
Giao dịch & VíTransaction requests, wallet balance, hold amountBusiness
CommissionHoa hồng NV từ đơn hàng, truy thu khi hoànBusiness
Hoàn tiền (Refund)Hoàn tiền đơn hàng, hoàn hoa hồng, hoàn topupBusiness

Liên kết Modules

  • ecommerce — đơn hàng tạo commission, hoàn tiền tạo refund request
  • user — hiển thị ví NV/KH, lịch sử commission
  • salary — commission ảnh hưởng lương
  • settings — cấu hình ví khuyến mãi, payment gateway
  • notification — gửi ZNS khi nạp/rút thành công
  • report — báo cáo hoa hồng, doanh số

Backend Services

ServiceVai trò
wallet-apiXử lý action (walletBalances, changeStatusTransaction), event triggers (6 handlers)
ecommerce-apiTạo transaction_request khi order paid, refund

Databases

DBKey tables
walletwallet, wallet_type, transaction, transaction_request, transaction_request_user, wallet_user, payment_gateway, order_commission_refund (view)

Đặc điểm kiến trúc

Wallet KHÔNG có FE module riêng — UI nằm rải rác trong modules khác (user, ecommerce, settings). Xem chi tiết component list tại wallet.technical.md.

Deep Dives