Skip to content

Commit 213c220

Browse files
authored
Correctly increment and decrement amount when using transactions
1 parent 6e1047a commit 213c220

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Models/Wallet.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public function incrementBalance($transaction)
5858
throw new Exception('Increment balance expects parameter to be a float or a WalletTransaction object.');
5959
}
6060

61-
$this->increment('raw_balance', $transaction->getAmount());
61+
$this->increment('raw_balance', $transaction->getAmount() * pow(10, $this->walletType->decimals));
6262

6363
// Record in ledger
6464
$this->createWalletLedgerEntry($transaction, $this->raw_balance);
@@ -85,7 +85,7 @@ public function decrementBalance($transaction)
8585
throw new Exception('Decrement balance expects parameter to be a number or a WalletTransaction object.');
8686
}
8787

88-
$this->decrement('raw_balance', $transaction->getAmount());
88+
$this->decrement('raw_balance', $transaction->getAmount() * pow(10, $this->walletType->decimals));
8989

9090
// Record in ledger
9191
$this->createWalletLedgerEntry($transaction, $this->raw_balance, 'decrement');

0 commit comments

Comments
 (0)