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
Model
CvvEmsCodeMapper.php
Go to the documentation of this file.
1
<?php
6
namespace
Magento\Braintree\Model
;
7
8
use
Magento\Braintree\Gateway\Response\PaymentDetailsHandler
;
9
use
Magento\Braintree\Model\Ui\ConfigProvider
;
10
use
Magento\Payment\Api\PaymentVerificationInterface
;
11
use
Magento\Sales\Api\Data\OrderPaymentInterface
;
12
20
class
CvvEmsCodeMapper
implements
PaymentVerificationInterface
21
{
27
private
static
$notProvidedCode =
'P'
;
28
34
private
static
$cvvMap = [
35
'M'
=>
'M'
,
36
'N'
=>
'N'
,
37
'U'
=>
'P'
,
38
'I'
=>
'P'
,
39
'S'
=>
'S'
,
40
'A'
=>
''
41
];
42
50
public
function
getCode
(
OrderPaymentInterface
$orderPayment)
51
{
52
if
($orderPayment->
getMethod
() !==
ConfigProvider::CODE
) {
53
throw
new \InvalidArgumentException(
54
'The "'
. $orderPayment->
getMethod
() .
'" does not supported by Braintree CVV mapper.'
55
);
56
}
57
58
$additionalInfo = $orderPayment->
getAdditionalInformation
();
59
if
(empty($additionalInfo[
PaymentDetailsHandler::CVV_RESPONSE_CODE
])) {
60
return
self::$notProvidedCode;
61
}
62
63
$cvv = $additionalInfo[
PaymentDetailsHandler::CVV_RESPONSE_CODE
];
64
return
isset(self::$cvvMap[$cvv]) ? self::$cvvMap[$cvv] : self::$notProvidedCode;
65
}
66
}
Magento\Braintree\Model
Magento\Sales\Api\Data\OrderPaymentInterface
Definition:
OrderPaymentInterface.php:17
Magento\Braintree\Gateway\Response\PaymentDetailsHandler\CVV_RESPONSE_CODE
const CVV_RESPONSE_CODE
Definition:
PaymentDetailsHandler.php:22
Magento\Braintree\Gateway\Response\PaymentDetailsHandler
Definition:
PaymentDetailsHandler.php:16
Magento\Payment\Api\PaymentVerificationInterface
Definition:
PaymentVerificationInterface.php:24
Magento\Braintree\Model\CvvEmsCodeMapper
Definition:
CvvEmsCodeMapper.php:20
Magento\Braintree\Model\Ui\ConfigProvider
Definition:
ConfigProvider.php:17
Magento\Sales\Api\Data\OrderPaymentInterface\getMethod
getMethod()
Magento\Sales\Api\Data\OrderPaymentInterface\getAdditionalInformation
getAdditionalInformation()
Magento\Braintree\Model\Ui\ConfigProvider\CODE
const CODE
Definition:
ConfigProvider.php:19
Magento\Braintree\Model\CvvEmsCodeMapper\getCode
getCode(OrderPaymentInterface $orderPayment)
Definition:
CvvEmsCodeMapper.php:50