fix(wallet): absorb cash left on old owner type

Deposits credited before customer type was set stayed on owner_type 0 and assets ignored them.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-11-14 14:41:24 +03:30
co-authored by Cursor
parent bdf70a4c05
commit 97d1077db6
5 changed files with 108 additions and 0 deletions
@@ -44,6 +44,22 @@ class WalletInterface
]);
$this->set_hash();
}
$this->absorbMismatchedOwnerTypeBalances();
}
/** واریزِ مانده روی owner_type قدیمی را به نوع فعلی مشتری برمی‌گرداند. */
private function absorbMismatchedOwnerTypeBalances(): void
{
$ownerType = (int) $this->owner_type;
$ownerId = (int) $this->owner_id;
if ($ownerType <= 0 || $ownerId <= 0 || !$this->wallet) {
return;
}
app(\App\Services\WalletBalanceService::class)
->absorbMismatchedOwnerTypeBalances($ownerId, $ownerType);
$this->wallet->refresh();
}
public function validate(): bool