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-paypal
Model
Payflow
AvsEmsCodeMapper.php
Go to the documentation of this file.
1
<?php
6
namespace
Magento\Paypal\Model\Payflow
;
7
8
use
Magento\Payment\Api\PaymentVerificationInterface
;
9
use
Magento\Paypal\Model\Config
;
10
use
Magento\Paypal\Model\Info
;
11
use
Magento\Sales\Api\Data\OrderPaymentInterface
;
12
20
class
AvsEmsCodeMapper
implements
PaymentVerificationInterface
21
{
27
private
static
$unavailableCode =
''
;
28
34
private
static
$avsMap = [
35
'YY'
=>
'Y'
,
36
'NY'
=>
'A'
,
37
'YN'
=>
'Z'
,
38
'NN'
=>
'N'
39
];
40
48
public
function
getCode
(
OrderPaymentInterface
$orderPayment)
49
{
50
if
($orderPayment->
getMethod
() !==
Config::METHOD_PAYFLOWPRO
) {
51
throw
new \InvalidArgumentException(
52
'The "'
. $orderPayment->
getMethod
() .
'" does not supported by Payflow AVS mapper.'
53
);
54
}
55
56
$additionalInfo = $orderPayment->
getAdditionalInformation
();
57
if
(empty($additionalInfo[
Info::PAYPAL_AVSADDR
]) ||
58
empty($additionalInfo[
Info::PAYPAL_AVSZIP
])
59
) {
60
return
self::$unavailableCode;
61
}
62
63
$streetCode = $additionalInfo[
Info::PAYPAL_AVSADDR
];
64
$zipCode = $additionalInfo[
Info::PAYPAL_AVSZIP
];
65
$key = $zipCode . $streetCode;
66
67
return
isset(self::$avsMap[$key]) ? self::$avsMap[$key] : self::$unavailableCode;
68
}
69
}
Magento\Paypal\Model\Info\PAYPAL_AVSZIP
const PAYPAL_AVSZIP
Definition:
Info.php:249
Magento\Sales\Api\Data\OrderPaymentInterface
Definition:
OrderPaymentInterface.php:17
Magento\Payment\Api\PaymentVerificationInterface
Definition:
PaymentVerificationInterface.php:24
Magento\Paypal\Model\Payflow\AvsEmsCodeMapper\getCode
getCode(OrderPaymentInterface $orderPayment)
Definition:
AvsEmsCodeMapper.php:48
Magento\Paypal\Model\Config\METHOD_PAYFLOWPRO
const METHOD_PAYFLOWPRO
Definition:
Config.php:66
Magento\Paypal\Model\Info
Definition:
Info.php:16
Magento\Sales\Api\Data\OrderPaymentInterface\getMethod
getMethod()
Magento\Sales\Api\Data\OrderPaymentInterface\getAdditionalInformation
getAdditionalInformation()
Magento\Paypal\Model\Payflow
Magento\Paypal\Model\Payflow\AvsEmsCodeMapper
Definition:
AvsEmsCodeMapper.php:20
Magento\Paypal\Model\Config
Magento\Paypal\Model\Info\PAYPAL_AVSADDR
const PAYPAL_AVSADDR
Definition:
Info.php:244