diff --git a/src/Services/WalletService.php b/src/Services/WalletService.php index f54e1ed..5f8014a 100644 --- a/src/Services/WalletService.php +++ b/src/Services/WalletService.php @@ -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()); } @@ -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();