You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: zgw/notificaties-api/src/main/kotlin/com/ritense/notificatiesapi/NotificatiesApiPlugin.kt
+26-3
Original file line number
Diff line number
Diff line change
@@ -99,7 +99,7 @@ class NotificatiesApiPlugin(
99
99
client.deleteAbonnement(
100
100
authenticationPluginConfiguration,
101
101
url,
102
-
it.url.substringAfterLast("/")
102
+
it.getAbonnementId()
103
103
)
104
104
logger.info { "Abonnement with url '${it.url}' successfully deleted for Notificaties API configuration with id '${notificatiesApiConfigurationId.id}'" }
105
105
} catch (e:Exception) {
@@ -118,8 +118,31 @@ class NotificatiesApiPlugin(
118
118
PluginConfiguration::class.java.canonicalName to notificatiesApiConfigurationId.toString()
119
119
) {
120
120
logger.debug { "Updating abonnement for Notificaties API configuration with id '${notificatiesApiConfigurationId.id}'" }
121
-
deleteAbonnement()
122
-
createAbonnement()
121
+
val dbAbonnement = notificatiesApiAbonnementLinkRepository.findByIdOrNull(notificatiesApiConfigurationId)
122
+
if (dbAbonnement ==null) {
123
+
createAbonnement()
124
+
} else {
125
+
val abonnement = client.getAbonnement(
126
+
authenticationPluginConfiguration,
127
+
url,
128
+
dbAbonnement.getAbonnementId(),
129
+
)
130
+
if (abonnement.equals(dbAbonnement.url, callbackUrl.toASCIIString(), DEFAULT_KANALEN_NAMES)) {
131
+
logger.debug { "Skipping abonnement update. No change to abonnement detected for Notificaties API configuration with id '${notificatiesApiConfigurationId.id}'" }
logger.info { "Abonnement with url '${dbAbonnement.url}' successfully updated for Notificaties API configuration with id '${notificatiesApiConfigurationId.id}'" }
0 commit comments