Return empty PayU settings when not configured
All checks were successful
build-and-deploy / build-deploy (push) Successful in 36s

This commit is contained in:
androidlover5842
2026-01-30 06:07:49 +05:30
parent d1f98c8cb1
commit 9345930722
2 changed files with 14 additions and 2 deletions

View File

@@ -35,7 +35,17 @@ class PayuSettingsController(
): PayuSettingsResponse {
requireRole(propertyAccess, propertyId, principal, Role.ADMIN, Role.MANAGER)
val settings = payuSettingsRepo.findByPropertyId(propertyId)
?: throw ResponseStatusException(HttpStatus.NOT_FOUND, "PayU settings not configured")
if (settings == null) {
return PayuSettingsResponse(
propertyId = propertyId,
configured = false,
merchantKey = null,
isTest = false,
useSalt256 = true,
hasSalt32 = false,
hasSalt256 = false
)
}
return settings.toResponse()
}
@@ -88,6 +98,7 @@ private fun PayuSettings.toResponse(): PayuSettingsResponse {
val propertyId = property.id ?: throw ResponseStatusException(HttpStatus.INTERNAL_SERVER_ERROR, "Property id missing")
return PayuSettingsResponse(
propertyId = propertyId,
configured = true,
merchantKey = merchantKey,
isTest = isTest,
useSalt256 = useSalt256,

View File

@@ -12,7 +12,8 @@ data class PayuSettingsUpsertRequest(
data class PayuSettingsResponse(
val propertyId: UUID,
val merchantKey: String,
val configured: Boolean,
val merchantKey: String?,
val isTest: Boolean,
val useSalt256: Boolean,
val hasSalt32: Boolean,