diff --git a/app/Http/Controllers/Customer/WalletController.php b/app/Http/Controllers/Customer/WalletController.php index 4c83dc8..c41e2bb 100644 --- a/app/Http/Controllers/Customer/WalletController.php +++ b/app/Http/Controllers/Customer/WalletController.php @@ -133,6 +133,7 @@ class WalletController extends Controller $this->applyProductTransactionTitle($record); $this->applyProductOrderDisplayFields($record); $this->applyProductTransactionUnit($record); + $this->applyTransactionDisplayStatus($record); } return response()->json($records); @@ -461,6 +462,20 @@ class WalletController extends Controller return !empty($record->wallet?->product); } + /** + * برداشت API فروشگاه (RequestsController) withdraw_id ندارد — برای UI همان withdraw.sts_str. + */ + private function applyTransactionDisplayStatus($record): void + { + if (!empty($record->withdraw) || !empty($record->order)) { + return; + } + + if ((int) $record->type === 4 && empty($record->withdraw_id)) { + $record->setRelation('withdraw', (object) ['sts_str' => 'درخواست از فروشگاه']); + } + } + private function resolveMainWalletBalanceCashForOrder($record): ?int { $customerId = $record->customer_id ?? auth('customer')->id();