Skip to content

Commit

Permalink
cycle condirmed
Browse files Browse the repository at this point in the history
  • Loading branch information
krutyosila committed Dec 11, 2020
1 parent 11c9d79 commit a24c3f9
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/Services/WalletService.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,10 @@ public function create(WalletTransactionType $types)
$wallet->save();
}
$types->setTxn();
if(in_array($types->getType(), self::CYCLE_TYPES)) {
$this->updateCycle($wallet->cycle, $types->getAmount());
if($types->getConfirmed()) {
if (in_array($types->getType(), self::CYCLE_TYPES)) {
$this->updateCycle($wallet->cycle, $types->getAmount());
}
}
return $wallet->transactions()->create($types->getAll());
}
Expand All @@ -44,6 +46,7 @@ public function confirm(WalletTransaction $transaction)
if ($transaction->type == self::TYPE_DEPOSIT) {
$wallet->balance = $wallet->balance + $transaction->amount;
$wallet->save();
$this->updateCycle($wallet->cycle, $transaction->amount);
}
$transaction->confirmed = true;
$transaction->save();
Expand Down

0 comments on commit a24c3f9

Please sign in to comment.