Send guest details to Razorpay
All checks were successful
build-and-deploy / build-deploy (push) Successful in 35s

This commit is contained in:
androidlover5842
2026-02-01 16:39:48 +05:30
parent ab7d13c1ad
commit 758919c969
2 changed files with 16 additions and 1 deletions

View File

@@ -83,6 +83,10 @@ class RazorpayPaymentLinksController(
)
}
val guest = booking.primaryGuest
val guestName = guest?.name?.trim()?.ifBlank { null }
val guestPhone = guest?.phoneE164?.trim()?.ifBlank { null }
val notes = mapOf(
"bookingId" to bookingId.toString(),
"propertyId" to propertyId.toString()
@@ -96,6 +100,12 @@ class RazorpayPaymentLinksController(
// Razorpay requires reference_id to be unique per active link
"reference_id" to "bk_${bookingId.toString().replace("-", "").take(12)}_${OffsetDateTime.now().toEpochSecond()}"
)
if (guestName != null || guestPhone != null) {
val customer = linkedMapOf<String, Any>()
guestName?.let { customer["name"] = it }
guestPhone?.let { customer["contact"] = it }
payload["customer"] = customer
}
parseExpiryEpoch(request.expiryDate)?.let { payload["expire_by"] = it }
request.isPartialPaymentAllowed?.let { payload["partial_payment"] = it }
request.minAmountForCustomer?.let { payload["first_min_partial_amount"] = it * 100 }

View File

@@ -95,10 +95,15 @@ class RazorpayQrPayments(
val expirySeconds = request.expirySeconds ?: request.expiryMinutes?.let { it * 60 } ?: 600
val expiresAt = expirySeconds?.let { OffsetDateTime.now().plusSeconds(it.toLong()) }
val notes = mapOf(
val guest = booking.primaryGuest
val guestName = guest?.name?.trim()?.ifBlank { null }
val guestPhone = guest?.phoneE164?.trim()?.ifBlank { null }
val notes = linkedMapOf(
"bookingId" to bookingId.toString(),
"propertyId" to propertyId.toString()
)
guestName?.let { notes["guestName"] = it }
guestPhone?.let { notes["guestPhone"] = it }
val payload = linkedMapOf<String, Any>(
"type" to "upi_qr",