Derive PayU return URLs from property
Some checks failed
build-and-deploy / build-deploy (push) Failing after 30s

This commit is contained in:
androidlover5842
2026-01-30 05:53:06 +05:30
parent 4168835d47
commit 461e94edd0
7 changed files with 35 additions and 51 deletions

View File

@@ -117,8 +117,8 @@ class PayuQrPayments(
add("firstname", firstname)
add("email", email)
add("phone", phone)
add("surl", settings.successUrl)
add("furl", settings.failureUrl)
add("surl", buildReturnUrl(propertyId, true))
add("furl", buildReturnUrl(propertyId, false))
add("pg", "DBQR")
add("bankcode", "UPIDBQR")
add("hash", hash)
@@ -191,6 +191,11 @@ class PayuQrPayments(
?: throw ResponseStatusException(HttpStatus.BAD_REQUEST, "PayU salt missing")
}
private fun buildReturnUrl(propertyId: UUID, success: Boolean): String {
val path = if (success) "success" else "failure"
return "https://api.hoteltrisolaris.in/properties/$propertyId/payu/return/$path"
}
private fun sha512(input: String): String {
val bytes = MessageDigest.getInstance("SHA-512").digest(input.toByteArray())
return bytes.joinToString("") { "%02x".format(it) }