Skip to content

Commit

Permalink
New transfer category
Browse files Browse the repository at this point in the history
(REFERENT_COMMISSION)
  • Loading branch information
AmirRajabii committed Dec 15, 2024
1 parent 0fdc395 commit 0139ace
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ enum class TransferCategory {
FEE,
REFERRAL_COMMISSION,
REFERRAL_KYC_REWARD,
REFERENT_COMMISSION,
KYC_ACCEPTED_REWARD,
NORMAL //TODO TEST?
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ enum class UserTransactionCategory {
FEE,
REFERRAL_COMMISSION,
REFERRAL_KYC_REWARD,
REFERENT_COMMISSION,
KYC_ACCEPTED_REWARD,
SYSTEM
}
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,36 @@ class TransferManagerImpl(
userTransactionManager.save(gainerTx)
}

TransferCategory.REFERENT_COMMISSION -> {
val loserOwner = command.sourceWallet.owner.id!!
val loserMainWallet = command.sourceWallet
val loserBalance = loserMainWallet.balance.amount

val gainerOwner = command.destWallet.owner.id!!
val gainerMainWallet = command.destWallet
val gainerBalance = gainerMainWallet.balance.amount

val loserTx = UserTransaction(
loserOwner,
txId,
currency,
loserBalance - amount,
-amount,
UserTransactionCategory.REFERENT_COMMISSION
)
userTransactionManager.save(loserTx)

val gainerTx = UserTransaction(
gainerOwner,
txId,
currency,
gainerBalance + amount,
amount,
UserTransactionCategory.REFERENT_COMMISSION,
)
userTransactionManager.save(gainerTx)
}

TransferCategory.REFERRAL_KYC_REWARD -> {
val loserOwner = command.sourceWallet.owner.id!!
val loserMainWallet = command.sourceWallet
Expand Down

0 comments on commit 0139ace

Please sign in to comment.