-
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.
Version 2.2.0 - MAG1-119 - MAG1-117 - MAG1-101
- Put back implementation of MAG1-101, previously reverted
- Loading branch information
1 parent
aed8918
commit dffe466
Showing
3 changed files
with
131 additions
and
0 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,89 @@ | ||
<?php | ||
|
||
namespace Signifyd\Connect\Block\Adminhtml; | ||
|
||
use Magento\Framework\View\Element\Template; | ||
use Magento\Framework\View\Element\Template\Context; | ||
use Magento\Framework\Registry; | ||
use Signifyd\Connect\Model\Casedata; | ||
|
||
/** | ||
* Get Signifyd Case Info | ||
* | ||
* @api | ||
* @since 100.2.0 | ||
*/ | ||
class CaseInfo extends Template | ||
{ | ||
/** | ||
* @var Casedata | ||
*/ | ||
private $caseEntity = false; | ||
|
||
/** | ||
* @var Registry | ||
*/ | ||
private $coreRegistry = false; | ||
|
||
/** | ||
* CaseInfo constructor. | ||
* @param Context $context | ||
* @param Casedata $caseEntity | ||
* @param Registry $registry | ||
* @param array $data | ||
*/ | ||
public function __construct( | ||
Context $context, | ||
Casedata $caseEntity, | ||
Registry $registry, | ||
array $data = [] | ||
) { | ||
$this->caseEntity = $caseEntity; | ||
$this->coreRegistry = $registry; | ||
|
||
parent::__construct($context, $data); | ||
} | ||
|
||
/** | ||
* Gets case entity associated with order id. | ||
* | ||
* @return Casedata|null | ||
*/ | ||
public function getCaseEntity() | ||
{ | ||
if ($this->caseEntity->isEmpty()) { | ||
$order = $this->getOrder(); | ||
if (!$order->isEmpty()) { | ||
$this->caseEntity = $this->caseEntity->load($order->getIncrementId()); | ||
} | ||
} | ||
|
||
return $this->caseEntity; | ||
} | ||
|
||
/** | ||
* Retrieve order model object | ||
* | ||
* @return \Magento\Sales\Model\Order | ||
*/ | ||
public function getOrder() | ||
{ | ||
return $this->coreRegistry->registry('sales_order'); | ||
} | ||
|
||
/** | ||
* Gets case guarantee disposition status | ||
*/ | ||
public function getCaseGuaranteeDisposition() | ||
{ | ||
return $this->getCaseEntity()->getData('guarantee'); | ||
} | ||
|
||
/** | ||
* Gets case score | ||
*/ | ||
public function getCaseScore() | ||
{ | ||
return floor($this->getCaseEntity()->getData('score')); | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
|
||
// @codingStandardsIgnoreFile | ||
?> | ||
<?php /** @var $block Signifyd\Connect\Block\Adminhtml\CaseInfo */ ?> | ||
<?php | ||
|
||
if ($block->getCaseEntity()->isEmpty()) { | ||
return ''; | ||
} | ||
?> | ||
<section class="admin__page-section order-case-info"> | ||
<div class="admin__page-section-title"> | ||
<span class="title"><?= $block->escapeHtml(__('Fraud Protection Information')) ?></span> | ||
</div> | ||
<div class="admin__page-section-content"> | ||
<div class="admin__page-section-item case-information"> | ||
<div class="admin__table-wrapper"> | ||
<table class="admin__table-secondary order-case-table"> | ||
<tbody> | ||
<tr> | ||
<th class="col-guarantee-disposition"><?= $block->escapeHtml(__('Signifyd Guarantee Decision')) ?></th> | ||
<td class="col-guarantee-disposition"><?= $block->escapeHtml($block->getCaseGuaranteeDisposition()) ?></td> | ||
</tr> | ||
<tr> | ||
<th class="col-guarantee-disposition"><?= $block->escapeHtml(__('Signifyd Score')) ?></th> | ||
<td class="col-guarantee-disposition"><?= $block->escapeHtml($block->getCaseScore()) ?></td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
</div> | ||
</div> | ||
</div> | ||
</section> |