Skip to content

Commit

Permalink
Merge pull request #173 in PLUG_OPEN/swagpaymentpaypalunified from pt…
Browse files Browse the repository at this point in the history
…-10176/5.2/fix-risk-management to master

* commit '54829d3d819cdd9389b5d2557a8c6d437aa238f2':
  PT-10176 - Fix check for risk management
  • Loading branch information
mitelg committed Feb 15, 2019
2 parents a2c09f4 + 54829d3 commit bc3452a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions Components/Services/ExceptionHandlerService.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

use GuzzleHttp\Exception\ClientException;
use Shopware\Components\HttpClient\RequestException;
use Shopware_Controllers_Backend_PaypalUnifiedSettings as SettingsController;
use SwagPaymentPayPalUnified\Components\ExceptionHandlerServiceInterface;
use SwagPaymentPayPalUnified\Components\PayPalApiException;
use SwagPaymentPayPalUnified\PayPalBundle\Components\LoggerServiceInterface;
Expand All @@ -21,6 +20,7 @@ class ExceptionHandlerService implements ExceptionHandlerServiceInterface
{
const DEFAULT_MESSAGE = 'An error occurred: ';
const LOG_MESSAGE = 'Could not %s due to a communication failure';
const WEBHOOK_ALREADY_EXISTS_ERROR = 'WEBHOOK_URL_ALREADY_EXISTS';

/**
* @var LoggerServiceInterface
Expand Down Expand Up @@ -62,7 +62,7 @@ public function handle(\Exception $e, $currentAction)
}
}

if (strpos($requestBody, SettingsController::WEBHOOK_ALREADY_EXISTS_ERROR) === false) {
if (strpos($requestBody, self::WEBHOOK_ALREADY_EXISTS_ERROR) === false) {
$this->loggerService->error(sprintf(self::LOG_MESSAGE, $currentAction), [
'message' => $exceptionMessage,
'payload' => $requestBody,
Expand Down
5 changes: 2 additions & 3 deletions Controllers/Backend/PaypalUnifiedSettings.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
*/

use SwagPaymentPayPalUnified\Components\ExceptionHandlerServiceInterface;
use SwagPaymentPayPalUnified\Components\Services\ExceptionHandlerService;
use SwagPaymentPayPalUnified\Models\Settings\General as GeneralSettingsModel;
use SwagPaymentPayPalUnified\PayPalBundle\Components\SettingsServiceInterface;
use SwagPaymentPayPalUnified\PayPalBundle\Resources\WebhookResource;
Expand All @@ -15,8 +16,6 @@

class Shopware_Controllers_Backend_PaypalUnifiedSettings extends Shopware_Controllers_Backend_Application
{
const WEBHOOK_ALREADY_EXISTS_ERROR = 'WEBHOOK_URL_ALREADY_EXISTS';

/**
* {@inheritdoc}
*/
Expand Down Expand Up @@ -80,7 +79,7 @@ public function registerWebhookAction()
} catch (Exception $e) {
$error = $this->exceptionHandler->handle($e, 'register webhooks');

if ($error->getName() === self::WEBHOOK_ALREADY_EXISTS_ERROR) {
if ($error->getName() === ExceptionHandlerService::WEBHOOK_ALREADY_EXISTS_ERROR) {
$this->View()->assign([
'success' => true,
'url' => $url,
Expand Down
3 changes: 2 additions & 1 deletion Subscriber/Plus.php
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,8 @@ public function onPostDispatchCheckout(\Enlight_Controller_ActionEventArgs $args
}

$unifiedPaymentId = $this->paymentMethodProvider->getPaymentId($this->connection);
if (!array_key_exists($unifiedPaymentId, $view->getAssign('sPayments'))) {
$paymentIds = array_column($view->getAssign('sPayments'), 'id');
if (!in_array($unifiedPaymentId, $paymentIds)) {
return;
}

Expand Down

0 comments on commit bc3452a

Please sign in to comment.