Migrate exchange rate handling from static system settings to a centralized `ExchangeRateService`. This change ensures that currency rates are managed through a single source of truth that supports history tracking, approval workflows, and API updates. Laravel: - Remove manual exchange rate fields (`aed_to_irr`, `usd_to_irr`, etc.) from `IfnexSettingsPage` and the `SystemSetting` persistence logic. - Update `PricingPageController` and `PriceCalculatorService` to retrieve live rates from `ExchangeRateService` instead of `SystemSetting`. - Refactor `IfnexSettingsPage` UI to display current rates as read-only information with a link to the dedicated exchange rate management resource. Documentation: - Update `CLIENT_DELIVERY.md` to reflect the change in exchange rate management workflow.
23 lines
663 B
PHP
23 lines
663 B
PHP
<?php
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
use App\Models\Country;
|
|
use App\Models\SystemSetting;
|
|
use Illuminate\Http\Request;
|
|
|
|
class PricingPageController extends Controller
|
|
{
|
|
public function __invoke()
|
|
{
|
|
$countries = Country::orderBy('name')->get(['id', 'name', 'iso_code']);
|
|
$settings = [
|
|
'aed_to_irr' => app(\App\Services\ExchangeRateService::class)->getCurrentRate('AED', 'IRR'),
|
|
'profit_margin' => (float) SystemSetting::get('profit_margin', 1.25),
|
|
'vat_rate' => (float) SystemSetting::get('vat_rate', 0.09),
|
|
];
|
|
|
|
return view('pricing.index', compact('countries', 'settings'));
|
|
}
|
|
}
|