Skip to content

Commit

Permalink
fix(loan): Removing bounty from loaner
Browse files Browse the repository at this point in the history
  • Loading branch information
Nickelza committed Nov 1, 2023
1 parent 1c30be7 commit 1227f49
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/chat/group/screens/screen_bounty_loan.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ async def manage(update: Update, context: ContextTypes.DEFAULT_TYPE, user: User,
await send_request(update, context, user, target_user, command, group_chat)
return

await keyboard_interaction(update, context, inbound_keyboard)
await keyboard_interaction(update, context, inbound_keyboard, user)


async def validate(update: Update, context: ContextTypes.DEFAULT_TYPE, loaner: User, borrower: User,
Expand Down Expand Up @@ -211,12 +211,14 @@ async def get_amounts(sender: User, receiver: User, command: Command = None, loa
return amount, tax_percentage, tax_amount, total_amount, repay_amount, duration


async def keyboard_interaction(update: Update, context: ContextTypes.DEFAULT_TYPE, inbound_keyboard: Keyboard) -> None:
async def keyboard_interaction(update: Update, context: ContextTypes.DEFAULT_TYPE, inbound_keyboard: Keyboard,
user: User) -> None:
"""
Keyboard interaction
:param update: The update object
:param context: The context object
:param inbound_keyboard: The inbound keyboard
:param user: The user object
:return: None
"""

Expand Down Expand Up @@ -257,11 +259,11 @@ async def keyboard_interaction(update: Update, context: ContextTypes.DEFAULT_TYP
# Update loaner
await add_or_remove_bounty(loaner, total_amount, add=False, update=update)
loaner.bounty_gift_tax += Env.BOUNTY_GIFT_TAX_INCREASE.get_int()
loaner.save()

# Update receiver
await add_or_remove_bounty(borrower, amount, update=update, tax_event_type=IncomeTaxEventType.BOUNTY_LOAN,
await add_or_remove_bounty(user, amount, update=update, tax_event_type=IncomeTaxEventType.BOUNTY_LOAN,
event_id=loan.id)
borrower.save()

# Send message
ot_text = get_text(loan, tax_amount, total_amount)
Expand Down

0 comments on commit 1227f49

Please sign in to comment.