ifnex/04_Laravel/routes/web.php
Kazem Alghasi 2e7f975094 feat(wallet): complete online payment with Zarinpal + mock gateway
- Add ZarinpalService for production payment gateway
- Add MockZarinpalService for testing without real merchant ID
- Add MockGatewayController for simulating payment page
- Add beautiful mock gateway UI with RTL support
- Update PaymentController to switch between mock/real based on config
- Fix double-click bug: prevent re-processing completed transactions
- Add payment-result page with success/failure UI
- All API endpoints tested successfully:
  * balance, transactions, activity-log
  * admin-adjust (deposit/withdrawal)
  * freeze/unfreeze
  * online payment redirect + callback + verify
- Wallet balance verified: 67,700,000 IRR after all transactions
- 5 transactions recorded with correct gateways (manual/zarinpal)

Closes: Payment gateway integration for Phase 2
2026-08-08 00:46:54 +03:30

42 lines
1.6 KiB
PHP

<?php
use App\Http\Controllers\OrderController;
use App\Http\Controllers\PricingPageController;
use App\Http\Controllers\ShipmentPdfController;
use Illuminate\Support\Facades\Route;
Route::get('/', function () {
return view('welcome');
});
Route::get('/pricing', PricingPageController::class)->name('pricing.index');
Route::get('/order', [OrderController::class, 'create'])->name('orders.create');
Route::post('/order', [OrderController::class, 'store'])->name('orders.store');
Route::get('/order/success/{shipment}', [OrderController::class, 'success'])->name('orders.success');
Route::middleware('auth')->group(function () {
Route::get('/shipments/{shipment}/pdf/awb', [ShipmentPdfController::class, 'awb'])->name('shipments.pdf.awb');
Route::get('/shipments/{shipment}/pdf/invoice', [ShipmentPdfController::class, 'invoice'])->name('shipments.pdf.invoice');
Route::get('/shipments/{shipment}/pdf/label', [ShipmentPdfController::class, 'label'])->name('shipments.pdf.label');
});
// صفحات نتیجه پرداخت (برای تست)
Route::get('/payment-result', function (Illuminate\Http\Request $request) {
$status = $request->input('status');
$transactionId = $request->input('transaction_id');
$refId = $request->input('ref_id');
$amount = $request->input('amount');
$message = $request->input('message');
$isSuccess = $status === 'success';
return view('payment-result', [
'status' => $status,
'isSuccess' => $isSuccess,
'transactionId' => $transactionId,
'refId' => $refId,
'amount' => $amount,
'message' => $message,
]);
})->name('payment.result');