Derive PayU return URLs from property
Some checks failed
build-and-deploy / build-deploy (push) Failing after 30s
Some checks failed
build-and-deploy / build-deploy (push) Failing after 30s
This commit is contained in:
@@ -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) }
|
||||
|
||||
Reference in New Issue
Block a user