Appearance
Khuyến mãi, Trả trước & Request Flows — Technical Map
Route map
| Subdomain | Routes / pages |
|---|---|
| Prepaid order | /e/prepaid-order, create, detail, payments, commissions, notes |
| Withdraw / Refund | /e/requests/withdraw/* và /e/withdraw-requests/* |
| Fund management | fund-management list/create/detail/update |
| Negative payment | /e/negative-payment-requests/:id |
| Promotion | Constants/pages/GraphQL còn tồn tại, nhưng route registration đang comment |
FE GraphQL / pages chính
| File | Vai trò |
|---|---|
prepaid_order.graphql | Prepaid order list/detail/payments/commission |
withdraw_request.graphql | Refund / withdraw request |
fund.graphql | Fund list/detail/filter |
negative_payment_request.graphql | Approval flow negative payment |
promotion.graphql | Promotion/voucher-related operations còn trong code |
PrepaidOrderCreate.tsx | Rule create prepaid |
WithdrawRequestDetail.tsx | Approval/refund detail |
NegativePaymentRequestDetail.tsx | Approval negative payment |
Data model cốt lõi
| Bảng | DB | Vai trò |
|---|---|---|
order, invoice, order_commission, campaign_order | ecommerce | Prepaid/order/payment |
transaction_request, transaction_request_user, transaction_request_log | wallet | Refund / withdraw lifecycle |
transaction_refund_log | ecommerce | Audit refund |
wallet_reference_file | wallet | File đính kèm refund |
fund, fund_file | ecommerce | Fund management |
voucher_campaigns, user_vouchers, voucher_logs | ecommerce | Voucher lifecycle |
request_working_schedule | hrm | Approval của negative payment |
Action / event map
| Thành phần | File | Vai trò |
|---|---|---|
| Action | create_order.go | Tạo service/prepaid order |
| Action | payment_order.go | createInvoiceTransaction cho parent/sub invoice |
| Action | order_payment.go | payInvoice |
| Action | change_status_transaction_refund.go | Approve/reject/cancel refund request |
| Action | negative_payment.go | Tạo negative invoice + approval request |
| Event | invoice_insert_update.go | Commission, invoice side effects |
| Event | transaction_request_insert.go | Insert lifecycle cho refund/withdraw |
| Event | transaction_request_update.go | Revenue rollback, refund commission, wallet updates |
| Event | restore_voucher_on_order_cancel.go | Restore voucher khi order cancel |
| Action | approve_voucher_campaign.go | Publish voucher campaign |
| Action | activate_offline_voucher.go | Activate voucher offline |
Data semantics cần ghi rõ
| Field | Ý nghĩa |
|---|---|
order.invoice_draft | Đơn đang có invoice draft |
order.is_refunded_order | Đơn đã có refund flow success |
order.refund_amount | Tổng tiền đã refund |
invoice.negative | Invoice âm cho negative payment |
invoice.request_negative_id | Link ngược sang request approval |
invoice.wallet_promotion_amount | Phần wallet promotion trên invoice |
transaction_request.reference_id | Không canonical tuyệt đối; có thể trỏ invoice hoặc order tùy flow |
Boundary matrix
| Flow | Canonical engine |
|---|---|
| Prepaid create/payment | ecommerce-api + ecommerce.invoice |
| Refund / withdraw | wallet-api + wallet.transaction_request |
| Negative payment | ecommerce-api + hrm.request_working_schedule |
| Voucher publish/activate/restore | ecommerce-api |
| Fund reporting | FE fund screens + ecommerce tables/views |
Rủi ro / Findings kỹ thuật
| Mức | Mô tả |
|---|---|
| P1 | reference_id trong transaction_request đang bị overload, phải fallback invoice -> order hoặc order trực tiếp để hiểu nghĩa thật. |
| P1 | Product order diverge với service/prepaid vì invoice được insert trực tiếp ở FE, không đi cùng action backend chuẩn. |
| P1 | Refund/negative approval guard ở FE có dấu hiệu check sai actor. |
| P2 | Promotion routes bị comment nhưng code còn đầy đủ, tạo vùng dead-code / dormant feature. |