Reset link token on credential changes
All checks were successful
build-and-deploy / build-deploy (push) Successful in 36s
All checks were successful
build-and-deploy / build-deploy (push) Successful in 36s
This commit is contained in:
@@ -76,10 +76,20 @@ class PayuPaymentLinkSettingsController(
|
||||
)
|
||||
} else {
|
||||
existing.merchantId = merchantId
|
||||
val oldClientId = existing.clientId
|
||||
val oldClientSecret = existing.clientSecret
|
||||
val oldIsTest = existing.isTest
|
||||
if (request.clientId != null) existing.clientId = request.clientId.trim().ifBlank { null }
|
||||
if (request.clientSecret != null) existing.clientSecret = request.clientSecret.trim().ifBlank { null }
|
||||
if (request.accessToken != null) existing.accessToken = request.accessToken.trim().ifBlank { null }
|
||||
existing.isTest = isTest
|
||||
val credsChanged = (request.clientId != null && existing.clientId != oldClientId) ||
|
||||
(request.clientSecret != null && existing.clientSecret != oldClientSecret) ||
|
||||
oldIsTest != isTest
|
||||
if (credsChanged) {
|
||||
existing.accessToken = null
|
||||
existing.tokenExpiresAt = null
|
||||
}
|
||||
existing.updatedAt = OffsetDateTime.now()
|
||||
existing
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user