diff --git a/src/main/kotlin/com/android/trisolarisserver/controller/PayuPaymentLinksController.kt b/src/main/kotlin/com/android/trisolarisserver/controller/PayuPaymentLinksController.kt index 8319eb7..fd06721 100644 --- a/src/main/kotlin/com/android/trisolarisserver/controller/PayuPaymentLinksController.kt +++ b/src/main/kotlin/com/android/trisolarisserver/controller/PayuPaymentLinksController.kt @@ -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, timezone: String?): Long { if (stays.isEmpty()) return 0 val now = nowForProperty(timezone) diff --git a/src/main/kotlin/com/android/trisolarisserver/controller/dto/PayuDtos.kt b/src/main/kotlin/com/android/trisolarisserver/controller/dto/PayuDtos.kt index 84fe6a0..8ab34f1 100644 --- a/src/main/kotlin/com/android/trisolarisserver/controller/dto/PayuDtos.kt +++ b/src/main/kotlin/com/android/trisolarisserver/controller/dto/PayuDtos.kt @@ -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,