19 if (!Main\Loader::includeModule(
'seo'))
25 $authAdapter = Seo\Checkout\Service::getAuthAdapter(Seo\Checkout\Service::TYPE_YOOKASSA);
26 $hasAuth = $authAdapter->hasAuth();
29 Main\Config\Option::set(
'sale',
'YANDEX_CHECKOUT_OAUTH',
true);
31 $oauthService = Seo\Checkout\Services\Factory::createService($authAdapter->getType());
32 $this->registerWebhooks($oauthService);
40 private function registerWebhooks(Seo\Checkout\Services\AccountYookassa $oauthService): void
42 $registerPaymentSucceededResult = $oauthService->registerPaymentSucceededWebhook();
43 $registerPaymentCanceledWebhookResult = $oauthService->registerPaymentCanceledWebhook();
44 if ($registerPaymentSucceededResult->isSuccess() && $registerPaymentCanceledWebhookResult->isSuccess())
46 Main\Config\Option::set(
'sale',
'YANDEX_CHECKOUT_OAUTH_WEBHOOK_REGISTER',
true);
49 if (!$registerPaymentSucceededResult->isSuccess())
51 $this->
addErrors($registerPaymentSucceededResult->getErrors());
53 if (!$registerPaymentCanceledWebhookResult->isSuccess())
55 $this->
addErrors(($registerPaymentCanceledWebhookResult->getErrors()));