Tất cả HTTP calls nằm trong src/services/api.ts.
Base URL: {REACT_APP_API_BASE_URL} — mặc định http://localhost:3001/api
Auth header: Authorization: Bearer {shop_auth_token}
401 handling: Axios interceptor dispatch auth:unauthorized → logout.
Auth & Account
| Method | Endpoint | Function | Mục đích |
|---|
| POST | /portal-auth/login | portalLogin | Login shop (hoặc cashier — bị chặn trên UI) |
| POST | /shop-auth/login | loginWithUsernameOrEmail | Login shop (legacy) |
| POST | /shop-auth/verify-otp | verifyPortalLoginOtp | Xác minh OTP login |
| POST | /shop-auth/forgot-password/request-otp | requestForgotPasswordOtp | Bước 1 quên mật khẩu |
| POST | /shop-auth/forgot-password/verify-otp | verifyForgotPasswordOtp | Bước 2 quên mật khẩu |
| POST | /shop-auth/forgot-password/confirm | confirmForgotPasswordReset | Bước 3 đặt mật khẩu mới |
| GET | /shop/me | fetchShopMe | Profile shop |
| PATCH | /shop/settings/two-factor | patchPortalTwoFactor | Bật/tắt 2FA |
| PATCH | /shop/settings/low-balance-warning | patchShopLowBalanceWarning | Cảnh báo số dư thấp |
| POST | /shop/verify/send-otp | sendShopVerificationOtp | Gửi OTP xác minh shop |
| POST | /shop/verify/confirm | confirmShopVerificationOtp | Xác nhận OTP shop |
Dashboard & Credits
| Method | Endpoint | Function | Mục đích |
|---|
| GET | /shop/dashboard | fetchDashboard | Số dư, player count, flags |
| POST | /shop/credits/purchase | purchaseShopCredits | Mua credits (redirect payment) |
| POST | /shop/convert-balance-to-credits | convertBalanceToCredits | USD → credits |
| GET | /shop/payments/zeroxprocessing/static-wallets | listZeroxStaticWallets | Danh sách ví crypto tĩnh |
| POST | /shop/payments/zeroxprocessing/static-wallets/init | initZeroxStaticWallets | Khởi tạo ví crypto |
Players
| Method | Endpoint | Function | Mục đích |
|---|
| GET | /shop/players | fetchShopPlayers | Danh sách player |
| POST | /shop/players | createShopPlayer | Tạo player mới |
| GET | /shop/players/:id | fetchShopPlayer | Chi tiết player |
| GET | /shop/players/lookup | lookupPlayerByPhone | Lookup theo phone |
| POST | /shop/players/register-initiate | registerPlayerInitiate | Đăng ký OTP — bước 1 |
| POST | /shop/players/register-resend | resendPlayerRegistrationOtp | Gửi lại OTP đăng ký |
| POST | /shop/players/register-verify | verifyPlayerRegistration | Đăng ký OTP — bước 2 |
| POST | /shop/players/:id/credits | postShopPlayerCredits | Deposit/deduct credits |
| POST | /shop/players/:id/ban | banShopPlayer | Ban player |
| POST | /shop/players/:id/unban | unbanShopPlayer | Unban player |
| POST | /shop/players/:id/credentials/reissue | postShopPlayerReissueCredentials | Cấp lại credentials |
| POST | /shop/players/:id/send-verification | sendPlayerVerification | Gửi OTP player |
| POST | /shop/players/:id/verify | verifyPlayerVerification | Xác minh OTP player |
| GET | /shop/players/:id/transactions | fetchPlayerTransactions | Lịch sử giao dịch player |
Transactions & Ledger
| Method | Endpoint | Function | Mục đích |
|---|
| GET | /shop/transactions | fetchShopWalletTransactions | Credit ledger |
| GET | /shop/transactions/:id | fetchShopCreditTransactionById | Chi tiết giao dịch credits |
| GET | /shop/transactions/export | exportShopWalletTransactions | Export CSV credits |
| GET | /shop/online-balance/ledger | fetchShopOnlineBalanceLedger | USD ledger |
| GET | /shop/online-balance/ledger/:id | fetchShopUsdLedgerEntryById | Chi tiết USD entry |
| GET | /shop/online-balance/ledger/export | exportShopOnlineBalanceLedger | Export CSV USD |
Withdrawals
Player withdrawals (shop duyệt)
| Method | Endpoint | Function | Mục đích |
|---|
| GET | /shop/withdrawals/pending | fetchPendingWithdrawalsForApproval | Danh sách chờ duyệt |
| GET | /shop/withdrawals | fetchShopWithdrawals | Lịch sử rút tiền |
| POST | /shop/withdrawals/:id/approve | approveShopWithdrawal | Duyệt |
| POST | /shop/withdrawals/:id/reject | rejectShopWithdrawal | Từ chối |
Shop USD withdrawal
| Method | Endpoint | Function | Mục đích |
|---|
| GET | /shop/online-balance/withdrawals/otp/eligibility | fetchShopWithdrawalOtpEligibility | Kiểm tra OTP |
| POST | /shop/online-balance/withdrawals/otp/send | sendShopWithdrawalOtp | Gửi OTP |
| POST | /shop/online-balance/withdrawals/otp/verify | verifyShopWithdrawalOtp | Xác minh OTP |
| POST | /shop/online-balance/withdrawals | createShopOnlineBalanceWithdrawal | Tạo rút USD |
| GET | /shop/online-balance/withdrawals/fee | fetchShopOnlineBalanceWithdrawalFee | Preview phí |
| GET | /shop/portal-withdrawal-limits | fetchShopPortalWithdrawalLimits | Giới hạn rút |
Provider fees & Payment
| Method | Endpoint | Function | Mục đích |
|---|
| GET | /shop/provider-fees | fetchProviderFeeConfigs | Cấu hình phí shop |
| PUT | /shop/provider-fees | upsertShopProviderFeeConfigs | Cập nhật phí |
| GET | /payment/provider-fee-rate | getProviderFeeRate | Tỷ lệ phí |
| GET | /payment/supported-methods | fetchSupportedMethods | Phương thức hỗ trợ (public) |
Cashiers & Fraud
| Method | Endpoint | Function | Mục đích |
|---|
| GET | /shop/cashiers | fetchShopCashiers | Danh sách cashier |
| POST | /shop/cashiers | createShopCashier | Tạo cashier |
| PATCH | /shop/cashiers/:id/suspend | suspendShopCashier | Suspend |
| PATCH | /shop/cashiers/:id/terminate | terminateShopCashier | Terminate |
| GET | /shop/cashiers/:id/report | fetchCashierReport | Báo cáo |
| GET | /shop/cashiers/:id/shifts | fetchCashierShifts | Lịch sử shifts |
| GET | /shop/fraud-indicators | fetchFraudIndicators | Fraud cashier |
| GET | /shop/player-fraud-indicators | fetchPlayerFraudIndicators | Fraud player (list) |
| GET | /shop/player-fraud-indicators/:id | fetchPlayerFraudIndicatorDetail | Chi tiết |
| GET | /shop/player-fraud-indicators/transaction/:id/profit-analysis | fetchPlayerFraudWithdrawalAnalysis | Phân tích profit |
| POST | /shop/player-fraud-indicators/:id/resolve | resolvePlayerFraudIndicator | Resolve indicator |
Communication & Domain
| Method | Endpoint | Function | Mục đích |
|---|
| GET | /shop/broadcasts | fetchShopBroadcasts | Danh sách broadcast |
| POST | /shop/broadcasts/:id/ack | ackShopBroadcast | Acknowledge broadcast |
| POST | /shop/broadcasts | createShopBroadcast | Gửi broadcast |
| GET | /shop/in-app-popups/unseen | fetchShopInAppPopupsUnseen | Popup chưa xem |
| POST | /shop/in-app-popups/:id/seen | markShopInAppPopupSeen | Đánh dấu đã xem |
| POST | /shop/in-app-popups/:id/never-again | markShopInAppPopupNeverAgain | Không hiện lại |
| POST | /shop/in-app-popups | createShopInAppPopup | Gửi popup |
| GET | /shop/kiosk-domain | fetchShopKioskDomain | Lấy subdomain |
| POST | /shop/kiosk-domain | createShopKioskDomain | Tạo subdomain |
| PATCH | /shop/kiosk-domain | patchShopKioskDomain | Sửa subdomain |
Cashier API (client riêng)
cashierClient dùng token cashier_auth_token. Các function này tồn tại trong api.ts nhưng không phải flow chính của Shop Portal — cashier dùng Cashier App.
| Method | Endpoint | Function |
|---|
| POST | /cashier-auth/login | cashierLogin |
| GET | /cashier/me | fetchCashierMe |
| POST | /cashier/shifts/open | cashierOpenShift |
| POST | /cashier/shifts/close | cashierCloseShift |
| GET | /cashier/players | cashierFetchPlayers |
| POST | /cashier/players | cashierCreatePlayer |
| POST | /cashier/players/:id/deposit | cashierDepositCredits |
| POST | /cashier/players/:id/redeem | cashierRedeemCredits |