fix(zarin): send mazaneh on rial wallet docs so deposits are not rejected

Zarin pooli returns HTTP 400 when fi is empty; a quote within 25% of market is required, which still posts as خرید فی.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-09-01 15:45:11 +03:30
co-authored by Cursor
parent d12b38a1e8
commit 102a8e1473
+11 -3
View File
@@ -2066,18 +2066,26 @@ class ZarinController extends Controller
$isWithdraw = (int) ($data['direction'] ?? 0) === 1; $isWithdraw = (int) ($data['direction'] ?? 0) === 1;
$uidSource = $data['withdraw_id'] ?? $zarin->id; $uidSource = $data['withdraw_id'] ?? $zarin->id;
// kind=pooli فی خالی را با HTTP 400 «ERROR: fi is empty» رد می‌کند و فی باید در ۲۵٪ مظنه روز باشد.
// نتیجه همیشه نوع ۵۳ «پولی(خرید و فروش)» / عنوان «خرید فی» است (تبدیل ریال به گرم). نوع ۵۵ «وجه نقد» در API این پنل در دسترس نیست.
$prices = $this->lastPriceData();
$mazaneh = $isWithdraw ? (int) ($prices['sell'] ?? 0) : (int) ($prices['buy'] ?? 0);
if ($mazaneh <= 0) {
$this->sync()->markFailed($zarin, null, 'مظنه برای سند ریالی زرین در دسترس نیست');
return 'مظنه برای سند ریالی زرین در دسترس نیست.';
}
try { try {
// سند ریالی خالص: فی/مظنه نفرست — وگرنه زرین همان مبلغ را به گرم طلا تبدیل می‌کند («خرید فی»).
$http = $this->zarinRequest([ $http = $this->zarinRequest([
'kind' => 'pooli', 'kind' => 'pooli',
'radif' => 1, 'radif' => 1,
'korf' => $isWithdraw ? 'f' : 'k', 'korf' => $isWithdraw ? 'f' : 'k',
'poolorvazn' => 'pool', 'poolorvazn' => 'pool',
'meghdar' => $data['value'], 'meghdar' => $data['value'],
'fi' => '', 'fi' => $mazaneh,
'hesab' => $customer->moshtari_code, 'hesab' => $customer->moshtari_code,
'sharh' => $sharh, 'sharh' => $sharh,
'ayar' => '', 'ayar' => '750',
'movaghat' => '', 'movaghat' => '',
'idFactor' => '', 'idFactor' => '',
'uid' => $this->zarinUid('20', $uidSource), 'uid' => $this->zarinUid('20', $uidSource),