ifnex/04_Laravel/config/ifnex.php
Kazem Alghasi d6e04d53fa feat(core): integrate Kavenegar SMS notifications and audit logging
Implement a comprehensive notification system using Kavenegar SMS
gateway and enhance system traceability through audit logging and
detailed shipment status history.

- SMS Integration:
  - Add Kavenegar SMS service with configurable API keys and sender
    numbers via system settings.
  - Implement automated SMS notifications for shipment approval,
    rejection, successful payments, and tracking updates.
  - Add administrative UI in Filament to manage SMS gateway settings
    and toggle specific notification types.
- Audit & Tracking:
  - Apply `Auditable` trait to core models (User, Shipment, Wallet,
    etc.) to track changes.
  - Refactor `ShipmentStatusHistory` to include status transitions
    (`from_status` to `to_status`) and specific reasons for changes.
  - Implement `ShipmentObserver` to automate notification triggers
    on status changes.
- Database & Config:
  - Add migrations for enhanced shipment status history tracking.
  - Update `.env.example` and `config/ifnex.php` with Kavenegar
    configuration parameters.
2026-09-10 00:52:18 +03:30

176 lines
7.8 KiB
PHP
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
return [
'bridge_api_key' => env('IFNEX_BRIDGE_API_KEY', 'change-this-secret-key'), // This is the API key that you get from the IFNEX Bridge
/*
|--------------------------------------------------------------------------
| IFNEX API Settings
|--------------------------------------------------------------------------
| تنظیمات عمومی API سیستم ایف‌نکس
*/
'api_key' => env('IFNEX_API_KEY', 'change-me'),
'cors_allowed_origins' => explode(',', env('CORS_ALLOWED_ORIGINS', 'http://localhost,http://127.0.0.1')),
'tracking_rate_limit' => env('IFNEX_TRACKING_RATE_LIMIT', 60),
/*
|--------------------------------------------------------------------------
| Carrier Codes (کدهای شرکت‌های حمل‌ونقل)
|--------------------------------------------------------------------------
| لیست شرکت‌های حمل‌ونقل فعال در سیستم
*/
'carrier_codes' => [
'DHL',
'FEDEX',
'UPS',
'ARAMEX',
'NAGHEL',
'EMX',
'APSITEX',
'IMPEX',
'OTHER',
],
/*
|--------------------------------------------------------------------------
| Tracking Statuses (وضعیت‌های رهگیری مرسوله)
|--------------------------------------------------------------------------
*/
'tracking_statuses' => [
'processed',
'picked_up',
'in_transit',
'out_for_delivery',
'failed',
'delivered',
'returned',
],
/*
|--------------------------------------------------------------------------
| Currency API (به‌روزرسانی نرخ ارز)
|--------------------------------------------------------------------------
*/
'currency' => [
'api_key' => env('CURRENCY_API_KEY'),
'api_url' => env('CURRENCY_API_URL', 'https://api.freecurrencyapi.com/v1/latest'),
'base_currency' => 'USD',
'target_currencies' => ['IRR', 'AED', 'EUR', 'CNY'],
],
/*
|--------------------------------------------------------------------------
| Zarinpal Payment Gateway (درگاه پرداخت زرین‌پال)
|--------------------------------------------------------------------------
| تنظیمات اتصال به درگاه زرین‌پال برای شارژ کیف پول
*/
'zarinpal' => [
// شناسه پذیرنده (Merchant ID) از پنل زرین‌پال
'merchant_id' => env('ZARINPAL_MERCHANT_ID', 'fake-merchant-id-for-testing'),
// محیط Sandbox برای تست (true) یا Production (false)
'sandbox' => env('ZARINPAL_SANDBOX', true),
// URL Callback که زرین‌پال بعد از پرداخت کاربر را به آن redirect می‌کند
'callback_url' => env('ZARINPAL_CALLBACK_URL', null),
// اگر null باشد، از url('/api/v1/payment/callback') استفاده می‌شود
// URL فرانت‌اند برای redirect بعد از پرداخت موفق
'frontend_success_url' => env('ZARINPAL_FRONTEND_SUCCESS_URL', '/payment/success'),
// URL فرانت‌اند برای redirect بعد از پرداخت ناموفق
'frontend_failure_url' => env('ZARINPAL_FRONTEND_FAILURE_URL', '/payment/failed'),
// زمان انقضای تراکنش‌های pending (به دقیقه)
'transaction_expiry_minutes' => env('ZARINPAL_EXPIRY_MINUTES', 30),
],
/*
|--------------------------------------------------------------------------
| Wallet Settings (تنظیمات کیف پول)
|--------------------------------------------------------------------------
| قوانین و محدودیت‌های کیف پول کاربران
*/
'wallet' => [
// حداقل مبلغ شارژ آنلاین (ریال) - معمولاً ۱۰,۰۰۰ ریال
'min_deposit_amount' => env('WALLET_MIN_DEPOSIT', 10000),
// حداکثر مبلغ شارژ در هر تراکنش (ریال) - معمولاً ۵۰۰ میلیون ریال
'max_deposit_amount' => env('WALLET_MAX_DEPOSIT', 500000000),
// حداقل موجودی لازم برای پرداخت سفارش از کیف پول (ریال)
'min_balance_for_payment' => env('WALLET_MIN_BALANCE', 1000),
// کارمزد شارژ کیف پول (درصد) - معمولاً ۰٪
'deposit_fee_percent' => env('WALLET_DEPOSIT_FEE', 0),
// آیا کیف پول به‌صورت پیش‌فرض هنگام ثبت‌نام کاربر ساخته شود؟
'auto_create_on_register' => env('WALLET_AUTO_CREATE', true),
// آیا کاربران عادی اجازه برداشت (cash out) دارند؟
'allow_withdrawal' => env('WALLET_ALLOW_WITHDRAWAL', false),
],
/*
|--------------------------------------------------------------------------
| Financial Defaults (پیش‌فرض‌های مالی)
|--------------------------------------------------------------------------
| این مقادیر فقط fallback هستند — مقادیر واقعی از جدول system_settings خوانده می‌شوند
*/
'financial_defaults' => [
'vat_rate' => 0.09, // ۹٪ مالیات بر ارزش افزوده
'profit_margin' => 1.25, // ۲۵٪ حاشیه سود
'packing_cost' => 100000, // ۱۰۰,۰۰۰ ریال هزینه بسته‌بندی پیش‌فرض
'aed_to_irr' => 455000, // نرخ درهم به ریال (fallback)
],
/*
|--------------------------------------------------------------------------
| Notification Settings (تنظیمات اعلان‌ها)
|--------------------------------------------------------------------------
*/
'notifications' => [
// آیا هنگام شارژ موفق به کاربر ایمیل/پیامک زده شود؟
'notify_on_deposit' => env('NOTIFY_ON_DEPOSIT', true),
// آیا هنگام شارژ دستی توسط ادمین به کاربر اطلاع داده شود؟
'notify_on_manual_adjustment' => env('NOTIFY_ON_MANUAL_ADJUSTMENT', true),
// آیا هنگام رسیدن موجودی به آستانه هشدار، اطلاع داده شود؟
'low_balance_threshold' => env('LOW_BALANCE_THRESHOLD', 500000), // ۵۰۰,۰۰۰ ریال
],
/*
|--------------------------------------------------------------------------
| Kavenegar SMS Gateway (درگاه پیامک کاوه‌نگار)
|--------------------------------------------------------------------------
*/
'kavenegar' => [
'api_key' => env('KAVENEGAR_API_KEY', ''),
'sender' => env('KAVENEGAR_SENDER', '10008566'),
'send_shipment_approved' => env('KAVENEGAR_SEND_SHIPMENT_APPROVED', true),
'send_shipment_rejected' => env('KAVENEGAR_SEND_SHIPMENT_REJECTED', true),
'send_payment_success' => env('KAVENEGAR_SEND_PAYMENT_SUCCESS', true),
'send_tracking_update' => env('KAVENEGAR_SEND_TRACKING_UPDATE', false),
],
/*
|--------------------------------------------------------------------------
| Audit & Logging (ثبت فعالیت‌ها و لاگ)
|--------------------------------------------------------------------------
*/
'audit' => [
// آیا تمام عملیات مالی لاگ شوند؟ (توصیه می‌شود همیشه true باشد)
'log_financial_operations' => true,
// آیا IP و User Agent کاربر در تراکنش‌ها ذخیره شود؟
'track_client_info' => true,
// تعداد روز نگهداری لاگ‌های قدیمی (برای پاک‌سازی خودکار)
'log_retention_days' => env('AUDIT_LOG_RETENTION_DAYS', 365),
],
];