From f248474ef846123c716ce2a1b61e593afbab5d64 Mon Sep 17 00:00:00 2001
From: dany47788 <65661948+dany47788@users.noreply.github.com>
Date: Wed, 18 Oct 2023 20:51:33 -0300
Subject: [PATCH] add exceptions, change client version
---
pom.xml | 4 ++--
src/main/java/com/greenapi/server/pkg/WebhookServer.java | 3 ++-
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/pom.xml b/pom.xml
index aa8c0e3..ca86b75 100644
--- a/pom.xml
+++ b/pom.xml
@@ -10,7 +10,7 @@
com.green-api
whatsapp-api-webhook-server-java
- 0.0.1
+ 0.0.2
whatsapp-api-webhook-server-java
whatsapp-api-webhook-server-java
@@ -34,7 +34,7 @@
17
- 0.0.6
+ 0.0.7
diff --git a/src/main/java/com/greenapi/server/pkg/WebhookServer.java b/src/main/java/com/greenapi/server/pkg/WebhookServer.java
index 6ceddf5..4a1b2bf 100644
--- a/src/main/java/com/greenapi/server/pkg/WebhookServer.java
+++ b/src/main/java/com/greenapi/server/pkg/WebhookServer.java
@@ -1,6 +1,7 @@
package com.greenapi.server.pkg;
import com.fasterxml.jackson.databind.ObjectMapper;
+import com.greenapi.client.pkg.api.exceptions.GreenApiClientException;
import com.greenapi.client.pkg.api.webhook.NotificationMapper;
import com.greenapi.client.pkg.api.webhook.WebhookHandler;
import lombok.RequiredArgsConstructor;
@@ -28,7 +29,7 @@ public void receiveAsyncWebhook(@RequestBody String jsonString,
@RequestHeader(required = false) String Authorization) {
if (Authorization != null &&
!Authorization.replaceAll("Bearer ", "").equals(webhookToken)) {
- log.info("request with invalid webhookToken");
+ throw new GreenApiClientException("Invalid webhookToken - request is ignored");
} else {
CompletableFuture.runAsync(() -> {