zarbox added 10

This commit is contained in:
2026-06-04 19:16:37 +03:30
parent 7a3d8ab661
commit c13222055b
@@ -452,7 +452,7 @@ class WalletController extends Controller
*/
private function applyTransactionDisplayStatus($record): void
{
if ((int) $record->type === 4 && empty($record->withdraw_id)) {
if ($this->isShopRialTransaction($record)) {
$this->setWithdrawStsStr($record, 'برداشت ریالی توسط فروشگاه');
return;
@@ -465,6 +465,20 @@ class WalletController extends Controller
}
}
/** برداشت ریال از API خارجی — بدون رکورد withdraw در DB */
private function isShopRialTransaction($record): bool
{
if ((int) $record->type !== 4) {
return false;
}
if (!empty($record->withdraw_id) || !empty($record->withdraw)) {
return false;
}
return true;
}
/** برداشت طلا از API خارجی (RequestsController::processGoldTransaction) */
private function isShopGoldTransaction($record): bool
{
@@ -489,20 +503,21 @@ class WalletController extends Controller
private function setWithdrawStsStr($record, string $label): void
{
if ($record->withdraw instanceof Withdraw) {
$record->withdraw->setAttribute('sts_str', $label);
return;
}
$record->setRelation('withdraw', (object) ['sts_str' => $label]);
// آرایه — stdClass در toArray()/JSON نمی‌آید و UI خالی می‌ماند
$record->setRelation('withdraw', ['sts_str' => $label]);
}
private function setOrderStsStr($record, string $label): void
{
if (!empty($record->order)) {
$record->order->setAttribute('sts_str', $label);
if (empty($record->order)) {
return;
}
$order = $record->order instanceof Order
? $record->order->toArray()
: (array) $record->order;
$order['sts_str'] = $label;
$record->setRelation('order', $order);
}
private function resolveMainWalletBalanceCashForOrder($record): ?int