mirror of
https://github.com/arkorty/B.Tech-Project-III.git
synced 2026-04-19 12:41:48 +00:00
17 lines
699 B
Python
17 lines
699 B
Python
from urllib.parse import quote
|
|
|
|
class UPIGeneratorTool:
|
|
name = "generate_upi_link"
|
|
|
|
async def execute(self, payee_upi: str, payee_name: str, amount: float, note: str = "") -> dict:
|
|
# upi.link is a web-based redirect service that opens any UPI app on mobile.
|
|
# This format works as a Telegram inline-button URL (https:// required).
|
|
upi_link = f"https://upi.link/{quote(payee_upi, safe='')}?amount={amount:.2f}&cu=INR"
|
|
if note:
|
|
upi_link += f"&remarks={quote(note)}"
|
|
return {
|
|
"upi_link": upi_link,
|
|
"display_text": f"Pay ₹{amount:,.0f} to {payee_name}",
|
|
"payee_upi": payee_upi, "amount": amount
|
|
}
|