Skip to content

Commit

Permalink
Check for null
Browse files Browse the repository at this point in the history
  • Loading branch information
gcatanese committed Jul 13, 2023
1 parent c412af1 commit 2570150
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
*/

@RestController
@CrossOrigin
@RequestMapping("/api")
public class WebhookController {
private final Logger logger = LoggerFactory.getLogger(WebhookController.class);
Expand Down Expand Up @@ -49,7 +50,7 @@ public ResponseEntity<String> webhooks(@RequestHeader Map<String, String> header

String hmacsignature = headers.get("hmacsignature");

if (hmacsignature.isBlank()) {
if (hmacsignature == null || hmacsignature.isBlank()) {
logger.warn("HMAC Signature not found");
throw new RuntimeException("HMAC Signature not found");
}
Expand All @@ -61,7 +62,7 @@ public ResponseEntity<String> webhooks(@RequestHeader Map<String, String> header

// process AccountHolder webhook
AccountHolderNotificationRequest accountHolderNotificationRequest = eventHandler.getAccountHolderNotificationRequest(json);
logger.info("environment--->{}", accountHolderNotificationRequest.getEnvironment());
logger.info("type--->{}", accountHolderNotificationRequest.getType());

// Acknowledge event has been consumed
return ResponseEntity.ok().body("[accepted]");
Expand Down

0 comments on commit 2570150

Please sign in to comment.