mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 18:16:38 +08:00
log illegit requests
This commit is contained in:
parent
c14d46cc32
commit
e3e54aee9c
1 changed files with 15 additions and 1 deletions
|
@ -65,8 +65,22 @@ class IncomingWebhookEndpoint
|
||||||
try {
|
try {
|
||||||
$data = (array) get_option(WebhookRegistrar::KEY, []);
|
$data = (array) get_option(WebhookRegistrar::KEY, []);
|
||||||
$webhook = $this->webhookFactory->fromArray($data);
|
$webhook = $this->webhookFactory->fromArray($data);
|
||||||
return $this->webhookEndpoint->verifyCurrentRequestForWebhook($webhook);
|
$result = $this->webhookEndpoint->verifyCurrentRequestForWebhook($webhook);
|
||||||
|
if (! $result) {
|
||||||
|
$this->logger->log(
|
||||||
|
'error',
|
||||||
|
__('Illegit Webhook request detected.', 'woocommerce-paypal-commerce-gateway'),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return $result;
|
||||||
} catch (RuntimeException $exception) {
|
} catch (RuntimeException $exception) {
|
||||||
|
$this->logger->log(
|
||||||
|
'error',
|
||||||
|
sprintf(
|
||||||
|
__('Illegit Webhook request detected: %s', 'woocommerce-paypal-commerce-gateway'),
|
||||||
|
$exception->getMessage()
|
||||||
|
)
|
||||||
|
);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue