public void attachOurServerWebhookToEfiPayToReceivePaymentNotifications(String webhookUrl, String pixPaymentKey) {
HttpHeaders headers = new HttpHeaders();
String accessToken = authenticate().getAccessToken();
headers.setBearerAuth(accessToken);
headers.set("x-skip-mtls-checking", "true");
WebhookRequest webhookRequest = new WebhookRequest(webhookUrl);
try {
String jsonBody = objectMapper.writeValueAsString(webhookRequest);
ResponseEntity response = restTemplate.exchange(URL + "/v2/webhook/" + pixPaymentKey,
HttpMethod.PUT, new HttpEntity<>(jsonBody, headers), String.class);
LOGGER.info("Resposta do EfiPay: {}", response.getBody());
} catch (Exception e) {
LOGGER.error(e.getMessage());
}
}