fix(pally): strip 'payment-' prefix from InvId before database lookup

This commit is contained in:
2026-05-31 14:44:43 +07:00
parent 18f4997ca6
commit 102a0ebf96

View File

@@ -34,7 +34,7 @@ async def pally_callback(
bot: Bot = Depends(get_bot), bot: Bot = Depends(get_bot),
deps: APIDependenciesDTO = Depends(get_deps), deps: APIDependenciesDTO = Depends(get_deps),
): ):
oid = InvId oid = InvId.removeprefix("payment-")
raw_string = f"{OutSum}:{InvId}:{settings.pally_token}" raw_string = f"{OutSum}:{InvId}:{settings.pally_token}"
expected_signature = hashlib.md5(raw_string.encode("utf-8")).hexdigest().upper() expected_signature = hashlib.md5(raw_string.encode("utf-8")).hexdigest().upper()
@@ -49,7 +49,7 @@ async def pally_callback(
logger.info("Received successfully paid bill %s", TrsId) logger.info("Received successfully paid bill %s", TrsId)
if not oid.isdigit(): if not oid.isdigit():
logger.critical("Invalid InvId format for TrsId %s", TrsId) logger.critical("Invalid InvId format for TrsId %s: %s", TrsId, InvId)
return "OK" return "OK"
bill = await deps.bills_repository.get_bill_by_id(session, int(oid)) bill = await deps.bills_repository.get_bill_by_id(session, int(oid))