From 7f9f5755ffcbc27107ab4aaf16923149c1d2d399 Mon Sep 17 00:00:00 2001 From: Ebano Lopes Date: Thu, 14 Nov 2019 12:29:16 +0000 Subject: [PATCH 1/3] MAG-496: Magento Code Standard Validation minor fixes --- Controller/Webhooks/Index.php | 15 +++++++++++++-- .../StripeIntegration/Payments/Helper/Generic.php | 2 +- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/Controller/Webhooks/Index.php b/Controller/Webhooks/Index.php index 0a3b42ba..c07a95b6 100644 --- a/Controller/Webhooks/Index.php +++ b/Controller/Webhooks/Index.php @@ -11,6 +11,7 @@ use Signifyd\Connect\Logger\Logger; use Magento\Framework\App\Action\Action; use Magento\Framework\App\RequestInterface; +use Magento\Framework\Filesystem\Driver\File; /** * Controller action for handling webhook posts from Signifyd service @@ -38,11 +39,19 @@ class Index extends Action protected $orderFactory; /** + * @var File + */ + protected $file; + + /** + * Index constructor. * @param Context $context * @param DateTime $dateTime * @param Logger $logger * @param \Signifyd\Connect\Helper\ConfigHelper $configHelper * @param \Magento\Sales\Model\OrderFactory $orderFactory + * @param \Magento\Framework\Data\Form\FormKey $formKey + * @param \Magento\Framework\View\File $file */ public function __construct( Context $context, @@ -50,7 +59,8 @@ public function __construct( Logger $logger, \Signifyd\Connect\Helper\ConfigHelper $configHelper, \Magento\Sales\Model\OrderFactory $orderFactory, - \Magento\Framework\Data\Form\FormKey $formKey + \Magento\Framework\Data\Form\FormKey $formKey, + File $file ) { parent::__construct($context); @@ -58,6 +68,7 @@ public function __construct( $this->objectManager = $context->getObjectManager(); $this->configHelper = $configHelper; $this->orderFactory = $orderFactory; + $this->file = $file; // Compatibility with Magento 2.3+ which required form_key on every request // Magento expects class to implement \Magento\Framework\App\CsrfAwareActionInterface but this causes @@ -79,7 +90,7 @@ protected function getRawPost() return $HTTP_RAW_POST_DATA; } - $post = file_get_contents("php://input"); + $post = $this->file->fileGetContents("php://input"); if ($post) { return $post; diff --git a/Plugin/StripeIntegration/Payments/Helper/Generic.php b/Plugin/StripeIntegration/Payments/Helper/Generic.php index 793238ae..9a6eedbe 100644 --- a/Plugin/StripeIntegration/Payments/Helper/Generic.php +++ b/Plugin/StripeIntegration/Payments/Helper/Generic.php @@ -38,4 +38,4 @@ public function afterIsAdmin(ParentGeneric $subject, $return) return $return; } -} \ No newline at end of file +} From 20ead719386f3c4d4e5b4fa309566e7a5f157c35 Mon Sep 17 00:00:00 2001 From: Ebano Lopes Date: Wed, 20 Nov 2019 01:39:29 +0000 Subject: [PATCH 2/3] MAG-496: Fix for PENDING guarantee disposition --- Model/Casedata.php | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/Model/Casedata.php b/Model/Casedata.php index 08d8a9e1..f462ed36 100644 --- a/Model/Casedata.php +++ b/Model/Casedata.php @@ -466,17 +466,18 @@ public function updateOrder($caseData, $orderAction, $case) break; + // Do nothing, but do not complete the case on Magento side + // This action should be used when something is processing on Signifyd end and extension should wait + // E.g.: Signifyd returns guarantee disposition PENDING because case it is on manual review + case 'wait': + $orderAction['action'] = false; + break; + // Nothing is an action from Signifyd workflow, different from when no action is given (null or empty) // If workflow is set to do nothing, so complete the case case 'nothing': $orderAction['action'] = false; - - try { - $completeCase = true; - } catch (\Exception $e) { - $this->logger->debug($e->__toString(), ['entity' => $case]); - return false; - } + $completeCase = true; break; } @@ -513,8 +514,13 @@ protected function handleGuaranteeChange($caseData) switch ($response->guaranteeDisposition) { case "DECLINED": return ["action" => $negativeAction, "reason" => "guarantee declined"]; + case "APPROVED": return ["action" => $positiveAction, "reason" => "guarantee approved"]; + + case 'PENDING': + return ["action" => 'wait', "reason" => 'case in manual review']; + default: $message = "Signifyd: Unknown guaranty: " . $response->guaranteeDisposition; $this->logger->debug($message, ['entity' => $caseData['case']]); From b3e7da93909e6d93a5fcb3af546b64efbd96f38c Mon Sep 17 00:00:00 2001 From: Ebano Lopes Date: Mon, 25 Nov 2019 10:58:48 +0000 Subject: [PATCH 3/3] 3.5.1: Change version number --- composer.json | 2 +- etc/module.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 17713e11..67e7b82b 100644 --- a/composer.json +++ b/composer.json @@ -7,7 +7,7 @@ "php": ">=5.5.22" }, "type": "magento2-module", - "version": "3.5.0", + "version": "3.5.1", "autoload": { "files": [ "registration.php" diff --git a/etc/module.xml b/etc/module.xml index ee3cec18..1f8ced4e 100644 --- a/etc/module.xml +++ b/etc/module.xml @@ -5,7 +5,7 @@ */ --> - +