Add success/failure URLs to PayU payment links
Some checks failed
build-and-deploy / build-deploy (push) Failing after 29s
Some checks failed
build-and-deploy / build-deploy (push) Failing after 29s
This commit is contained in:
@@ -102,6 +102,10 @@ class PayuPaymentLinksController(
|
||||
"viaEmail" to (request.viaEmail ?: false),
|
||||
"viaSms" to (request.viaSms ?: false)
|
||||
)
|
||||
body["successURL"] = request.successUrl?.trim()?.ifBlank { null }
|
||||
?: buildReturnUrl(propertyId, true)
|
||||
body["failureURL"] = request.failureUrl?.trim()?.ifBlank { null }
|
||||
?: buildReturnUrl(propertyId, false)
|
||||
if (amountLong != null) {
|
||||
body["subAmount"] = amountLong
|
||||
}
|
||||
@@ -137,6 +141,11 @@ class PayuPaymentLinksController(
|
||||
}
|
||||
}
|
||||
|
||||
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 computeExpectedPay(stays: List<com.android.trisolarisserver.models.room.RoomStay>, timezone: String?): Long {
|
||||
if (stays.isEmpty()) return 0
|
||||
val now = nowForProperty(timezone)
|
||||
|
||||
@@ -68,6 +68,8 @@ data class PayuPaymentLinkCreateRequest(
|
||||
val minAmountForCustomer: Long? = null,
|
||||
val description: String? = null,
|
||||
val expiryDate: String? = null,
|
||||
val successUrl: String? = null,
|
||||
val failureUrl: String? = null,
|
||||
val udf3: String? = null,
|
||||
val udf4: String? = null,
|
||||
val udf5: String? = null,
|
||||
|
||||
Reference in New Issue
Block a user