Skip to content

Commit 9c0a1a9

Browse files
author
Babichev Maxim
committed
fix transaction
1 parent b021844 commit 9c0a1a9

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/Traits/CanExchange.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,12 @@ public function forceExchange(Wallet $to, int $amount, ?array $meta = null): Tra
5252
return DB::transaction(function() use ($from, $to, $amount, $meta) {
5353
$rate = app(ExchangeService::class)->rate($from, $to);
5454
$fee = app(WalletService::class)->fee($to, $amount);
55-
$withdraw = $from->forceWithdraw($amount + $fee, $meta);
56-
$deposit = $to->deposit($amount * $rate, $meta);
55+
56+
$withdraw = app(CommonService::class)
57+
->forceWithdraw($from, $amount + $fee, $meta);
58+
59+
$deposit = app(CommonService::class)
60+
->deposit($to, $amount * $rate, $meta);
5761

5862
$transfers = app(CommonService::class)->multiBrings([
5963
(new Bring())

0 commit comments

Comments
 (0)