Magento Extensions Rating 2024
EXTENSIONS BY CATEGORY
B2B (Business-To-Business)
Blog
Customer
ERP (Enterprise Resource Planning)
Mega Menu
One Step Checkout
Order
POS (Point Of Sale)
Search
Shopping Cart
Sitemap
SEO
Social
Stock & Inventory Management
EXTENSIONS BY DEVELOPER
aheadWorks
Amasty
Boost My Shop
BSS Commerce
Magestore
MageWorx
Mirasvit
Templates Master
Wyomind
XTENTO
Magento 2 Documentation
Magento 2 Documentation
2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
vendor
magento
module-braintree
Gateway
Response
RiskDataHandler.php
Go to the documentation of this file.
1
<?php
6
namespace
Magento\Braintree\Gateway\Response
;
7
8
use
Magento\Payment\Gateway\Helper\ContextHelper
;
9
use
Magento\Braintree\Gateway\SubjectReader
;
10
use
Magento\Payment\Gateway\Response\HandlerInterface
;
11
15
class
RiskDataHandler
implements
HandlerInterface
16
{
20
const
RISK_DATA_ID
=
'riskDataId'
;
21
25
const
RISK_DATA_DECISION
=
'riskDataDecision'
;
26
30
private
static
$statusReview =
'Review'
;
31
35
private
$subjectReader;
36
42
public
function
__construct
(
SubjectReader
$subjectReader)
43
{
44
$this->subjectReader = $subjectReader;
45
}
46
54
public
function
handle
(array $handlingSubject, array
$response
)
55
{
56
$paymentDO = $this->subjectReader->readPayment($handlingSubject);
57
59
$transaction
= $this->subjectReader->readTransaction(
$response
);
60
61
if
(!isset(
$transaction
->riskData)) {
62
return
;
63
}
64
65
$payment
= $paymentDO->getPayment();
66
ContextHelper::assertOrderPayment
(
$payment
);
67
68
$payment
->setAdditionalInformation(self::RISK_DATA_ID,
$transaction
->riskData->id);
69
$payment
->setAdditionalInformation(self::RISK_DATA_DECISION,
$transaction
->riskData->decision);
70
71
// mark payment as fraud
72
if
(
$transaction
->riskData->decision === self::$statusReview) {
73
$payment
->setIsFraudDetected(
true
);
74
}
75
}
76
}
$transaction
$transaction
Definition:
partial_invoice.php:43
Magento\Braintree\Gateway\Response\RiskDataHandler\RISK_DATA_DECISION
const RISK_DATA_DECISION
Definition:
RiskDataHandler.php:25
$response
$response
Definition:
404.php:11
Magento\Braintree\Gateway\Response\RiskDataHandler\__construct
__construct(SubjectReader $subjectReader)
Definition:
RiskDataHandler.php:42
Magento\Braintree\Gateway\Response
Definition:
CancelDetailsHandler.php:8
Magento\Payment\Gateway\Response\HandlerInterface\handle
handle(array $handlingSubject, array $response)
$payment
$payment
Definition:
order.php:17
Magento\Payment\Gateway\Helper\ContextHelper
Definition:
ContextHelper.php:17
Magento\Braintree\Gateway\Response\RiskDataHandler
Definition:
RiskDataHandler.php:15
Magento\Payment\Gateway\Response\HandlerInterface
Definition:
HandlerInterface.php:14
Magento\Braintree\Gateway\SubjectReader
Definition:
SubjectReader.php:16
Magento\Payment\Gateway\Helper\ContextHelper\assertOrderPayment
static assertOrderPayment(InfoInterface $paymentInfo)
Definition:
ContextHelper.php:26
Magento\Braintree\Gateway\Response\RiskDataHandler\RISK_DATA_ID
const RISK_DATA_ID
Definition:
RiskDataHandler.php:20