Skip to content

Commit

Permalink
Fix wallet amount condition
Browse files Browse the repository at this point in the history
Fix retry status after giving up
  • Loading branch information
Marchosiax committed Jun 2, 2024
1 parent fd49c92 commit b153906
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -103,14 +103,15 @@ class FinancialActionPersisterImpl(
//Do nothing
} else {
with(retryModel) {
val giveUp = retries + 1 >= retryCount
faRetryRepository.scheduleNext(
id!!,
retries + 1,
LocalDateTime.now().plusSeconds(retries * delayMultiplier * delaySeconds),
retries >= retryCount
giveUp
).awaitSingleOrNull()

if (hasGivenUp)
if (giveUp)
status = FinancialActionStatus.ERROR
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ class WalletManagerImpl(
}

override suspend fun isWithdrawAllowed(wallet: Wallet, amount: BigDecimal): Boolean {
if (amount <= BigDecimal.ZERO)
if (amount < BigDecimal.ZERO)
throw OpexError.InvalidAmount.exception()

var evaluate = wallet.balance.amount >= amount
Expand Down

0 comments on commit b153906

Please sign in to comment.