aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/juick/www/api/webhooks/VkWebhook.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com/juick/www/api/webhooks/VkWebhook.java')
-rw-r--r--src/main/java/com/juick/www/api/webhooks/VkWebhook.java8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/main/java/com/juick/www/api/webhooks/VkWebhook.java b/src/main/java/com/juick/www/api/webhooks/VkWebhook.java
index 9e4477b1..d69d00be 100644
--- a/src/main/java/com/juick/www/api/webhooks/VkWebhook.java
+++ b/src/main/java/com/juick/www/api/webhooks/VkWebhook.java
@@ -29,7 +29,7 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;
-import javax.inject.Inject;
+import jakarta.inject.Inject;
import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
@@ -62,9 +62,9 @@ public class VkWebhook {
if (secretKey.equals(secret)) {
if (type.startsWith("donut_")) {
var vkId = json.get("object").get("user_id").asLong(0);
- var userId = userService.getUIDbyVKID(vkId);
- if (userId > 0) {
- vkService.updatePremiumStatus(userId);
+ var user = userService.getUserByVKID(vkId);
+ if (user.isPresent()) {
+ vkService.updatePremiumStatus(user.get().getUid());
}
}
return "ok";