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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user