fix some bugs

This commit is contained in:
2026-07-29 19:57:32 +03:30
parent 67c31c9bce
commit 381d28aae5
2 changed files with 30 additions and 2 deletions
@@ -596,6 +596,12 @@ class SingleOrderController extends Controller
// سمت کسر کارمزد برای گزارش تفکیک‌شده در داشبورد
$data['fee_asset'] = $rialLocked ? 'gold' : 'rial';
if (!$rialLocked && (float) $data['total_price'] < 0) {
throw new UnprocessableEntityHttpException(
'مبلغ دریافتی فروش پس از کارمزد منفی شد. درصد کارمزد سفارش را بررسی کنید (باید اعشاری باشد؛ مثلاً ۰٫۰۱ برای ۱٪).'
);
}
$grossTotal = $data['amount'] * $data['price'];
$this->enforceProductOrderLimits($data, (float) $grossTotal);
@@ -675,6 +681,11 @@ class SingleOrderController extends Controller
$data['total_price'] = $data['amount'] * $data['price'] - $data['service_charge_price'];
$data['payment_amount'] = $data['total_price'];
$data['fee_asset'] = 'rial';
if ($data['total_price'] < 0) {
throw new UnprocessableEntityHttpException(
'مبلغ دریافتی فروش پس از کارمزد منفی شد. درصد کارمزد سفارش را بررسی کنید (باید اعشاری باشد؛ مثلاً ۰٫۰۱ برای ۱٪).'
);
}
$grossTotal = (float) ($data['amount'] * $data['price']);
$this->enforceProductOrderLimits($data, $grossTotal);
$wallet_interface_product = $this->productWalletInterface((int) $data["product_id"]);