-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #51 from signifyd/4.2
4.2.0
- Loading branch information
Showing
33 changed files
with
1,044 additions
and
197 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
<?php | ||
|
||
namespace Signifyd\Connect\Block\Adminhtml\Grid\Column; | ||
|
||
use Magento\Backend\Block\Widget\Grid\Column\Renderer\AbstractRenderer; | ||
use Signifyd\Connect\Model\ResourceModel\Casedata as CasedataResourceModel; | ||
use Signifyd\Connect\Model\CasedataFactory; | ||
|
||
class SignifydGuarantee extends AbstractRenderer | ||
{ | ||
/** | ||
* @var CasedataResourceModel | ||
*/ | ||
protected $casedataResourceModel; | ||
|
||
/** | ||
* @var CasedataFactory | ||
*/ | ||
protected $casedataFactory; | ||
|
||
/** | ||
* SignifydGuarantee constructor. | ||
* @param CasedataResourceModel $casedataResourceModel | ||
* @param CasedataFactory $casedataFactory | ||
* @param \Magento\Backend\Block\Context $context | ||
* @param array $data | ||
*/ | ||
public function __construct( | ||
CasedataResourceModel $casedataResourceModel, | ||
CasedataFactory $casedataFactory, | ||
\Magento\Backend\Block\Context $context, | ||
array $data = [] | ||
) { | ||
$this->casedataResourceModel = $casedataResourceModel; | ||
$this->casedataFactory = $casedataFactory; | ||
parent::__construct($context, $data); | ||
} | ||
|
||
public function render(\Magento\Framework\DataObject $row) | ||
{ | ||
$return = ''; | ||
$quoteId = $row->getData('quote_id'); | ||
|
||
/** @var \Signifyd\Connect\Model\Casedata $case */ | ||
$case = $this->casedataFactory->create(); | ||
$this->casedataResourceModel->load($case, $quoteId, 'quote_id'); | ||
|
||
if ($case->isEmpty() === false) { | ||
$guarantee = $case->getGuarantee(); | ||
$url = "https://www.signifyd.com/cases/" . $case->getCode(); | ||
$return = "<a href=\"$url\" target=\"_blank\">$guarantee</a>"; | ||
} | ||
|
||
return $return; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
<?php | ||
|
||
namespace Signifyd\Connect\Block\Adminhtml\Shopcart\Abandoned; | ||
|
||
use Magento\Store\Model\ScopeInterface; | ||
use Signifyd\Connect\Helper\PurchaseHelper; | ||
|
||
class Grid extends \Magento\Reports\Block\Adminhtml\Shopcart\Abandoned\Grid | ||
{ | ||
/** | ||
* @var PurchaseHelper | ||
*/ | ||
protected $purchaseHelper; | ||
|
||
/** | ||
* Grid constructor. | ||
* @param \Magento\Backend\Block\Template\Context $context | ||
* @param \Magento\Backend\Helper\Data $backendHelper | ||
* @param \Magento\Reports\Model\ResourceModel\Quote\CollectionFactory $quotesFactory | ||
* @param PurchaseHelper $purchaseHelper | ||
* @param array $data | ||
*/ | ||
public function __construct( | ||
\Magento\Backend\Block\Template\Context $context, | ||
\Magento\Backend\Helper\Data $backendHelper, | ||
\Magento\Reports\Model\ResourceModel\Quote\CollectionFactory $quotesFactory, | ||
PurchaseHelper $purchaseHelper, | ||
array $data = [] | ||
) { | ||
$this->purchaseHelper = $purchaseHelper; | ||
parent::__construct($context, $backendHelper, $quotesFactory, $data); | ||
} | ||
|
||
/** | ||
* Prepare columns | ||
* | ||
* @return \Magento\Backend\Block\Widget\Grid\Extended | ||
* @SuppressWarnings(PHPMD.ExcessiveMethodLength) | ||
*/ | ||
protected function _prepareColumns() | ||
{ | ||
$return = parent::_prepareColumns(); | ||
|
||
if ($this->getRequest()->getParam('store')) { | ||
$storeId = (int)$this->getRequest()->getParam('store'); | ||
$policyName = $this->purchaseHelper->getPolicyName(ScopeInterface::SCOPE_STORES, $storeId); | ||
} else { | ||
$policyName = $this->purchaseHelper->getPolicyName(); | ||
} | ||
|
||
if ($policyName == 'PRE_AUTH') { | ||
$this->addColumn( | ||
'signifyd_guarantee', | ||
[ | ||
'header' => __('Signifyd Decision'), | ||
'index' => 'signifyd_guarantee', | ||
'sortable' => false, | ||
'header_css_class' => 'col-name', | ||
'column_css_class' => 'col-name', | ||
'renderer' => \Signifyd\Connect\Block\Adminhtml\Grid\Column\SignifydGuarantee::class | ||
] | ||
); | ||
} | ||
|
||
return $return; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.