diff --git a/src/Traits/HasWallet.php b/src/Traits/HasWallet.php index 6ac5d5214..5c9d39d1b 100644 --- a/src/Traits/HasWallet.php +++ b/src/Traits/HasWallet.php @@ -146,9 +146,16 @@ public function safeTransfer(Wallet $wallet, $amount, ?array $meta = null): ?Tra public function transfer(Wallet $wallet, $amount, ?array $meta = null): Transfer { /** @var Wallet $this */ - app(ConsistencyServiceInterface::class)->checkPotential($this, $amount); + return app(AtomicServiceInterface::class)->block( + $this, + function () use ($wallet, $amount, $meta) { + app(ConsistencyServiceInterface::class)->checkPotential($this, $amount); - return $this->forceTransfer($wallet, $amount, $meta); + return app(CommonServiceLegacy::class) + ->forceTransfer($this, $wallet, $amount, $meta) + ; + }, + ); } /** @@ -167,9 +174,16 @@ public function transfer(Wallet $wallet, $amount, ?array $meta = null): Transfer public function withdraw($amount, ?array $meta = null, bool $confirmed = true): Transaction { /** @var Wallet $this */ - app(ConsistencyServiceInterface::class)->checkPotential($this, $amount); + return app(AtomicServiceInterface::class)->block( + $this, + function () use ($amount, $meta, $confirmed) { + app(ConsistencyServiceInterface::class)->checkPotential($this, $amount); - return $this->forceWithdraw($amount, $meta, $confirmed); + return app(CommonServiceLegacy::class) + ->makeTransaction($this, Transaction::TYPE_WITHDRAW, $amount, $meta, $confirmed) + ; + }, + ); } /**