mirror of
https://github.com/arkorty/B.Tech-Project-III.git
synced 2026-04-19 20:51:49 +00:00
init
This commit is contained in:
16
negot8/backend/tools/upi_generator.py
Normal file
16
negot8/backend/tools/upi_generator.py
Normal file
@@ -0,0 +1,16 @@
|
||||
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
|
||||
}
|
||||
Reference in New Issue
Block a user