prefix('v1')->group(function () { Route::get('/track/{awb_no}', [TrackController::class, 'show']); }); // ══════════════════════════════════════════════════════════════ // Auth API (عمومی - برای دریافت توکن) // ══════════════════════════════════════════════════════════════ Route::post('/v1/auth/login', [AuthController::class, 'login']); Route::middleware(['auth:sanctum'])->post('/v1/auth/logout', [AuthController::class, 'logout']); // ══════════════════════════════════════════════════════════════ // API برای کاربران لاگین‌شده (با Sanctum / Bearer Token) // ══════════════════════════════════════════════════════════════ Route::middleware(['auth:sanctum'])->prefix('v1')->group(function () { // ─── Wallet API (کاربر عادی) ─── Route::get('/wallet/balance', [WalletController::class, 'balance']); Route::get('/wallet/transactions', [WalletController::class, 'transactions']); // ─── Payment API ─── Route::post('/payment/redirect', [PaymentController::class, 'redirectToGateway']); Route::get('/payment/check/{transaction}', [PaymentController::class, 'checkStatus']); // ─── Admin Wallet API ─── Route::post('/wallet/admin-adjust', [WalletController::class, 'adminAdjust']); Route::post('/wallet/{wallet}/freeze', [WalletController::class, 'freeze']); Route::post('/wallet/{wallet}/unfreeze', [WalletController::class, 'unfreeze']); Route::get('/wallet/{wallet}/activity-log', [WalletController::class, 'activityLog']); // ─── Customer Orders API (جدید) ─── Route::prefix('customer')->group(function () { // پروفایل و آمار Route::get('/profile', [CustomerOrderController::class, 'profile']); // لیست کشورها Route::get('/countries', [CustomerOrderController::class, 'countries']); // سفارشات Route::get('/orders', [CustomerOrderController::class, 'index']); Route::post('/orders', [CustomerOrderController::class, 'store']); Route::get('/orders/{shipment}', [CustomerOrderController::class, 'show']); Route::post('/orders/{shipment}/cancel', [CustomerOrderController::class, 'cancel']); }); }); // ══════════════════════════════════════════════════════════════ // Mock Gateway Routes (عمومی - برای شبیه‌سازی درگاه) // ══════════════════════════════════════════════════════════════ Route::prefix('v1/payment')->group(function () { Route::get('/mock-gateway', [MockGatewayController::class, 'showGateway']); Route::get('/mock-gateway/success', [MockGatewayController::class, 'simulateSuccess']); Route::get('/mock-gateway/failure', [MockGatewayController::class, 'simulateFailure']); }); // Callback از درگاه (بدون auth) Route::any('/v1/payment/callback', [PaymentController::class, 'callback']) ->name('payment.callback'); // ══════════════════════════════════════════════════════════════ // APIهای عمومی (بدون auth) // ══════════════════════════════════════════════════════════════ Route::post('/v1/calculate', [PricingController::class, 'calculate']); Route::get('/v1/discount-codes', [DiscountCodeController::class, 'index']); Route::post('/v1/discount-codes/validate', [DiscountCodeController::class, 'validate']);