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
Method
Checks
SpecificationPlugin.php
Go to the documentation of this file.
1
<?php
6
namespace
Magento\Paypal\Model\Method\Checks
;
7
8
use
Magento\Payment\Model\MethodInterface
;
9
use
Magento\Payment\Model\Checks\SpecificationInterface
;
10
use
Magento\Paypal\Model\Config
;
11
use Magento\Paypal\Model\Billing\AgreementFactory;
12
use
Magento\Quote\Model\Quote
;
13
17
class
SpecificationPlugin
18
{
22
private
$agreementFactory;
23
27
public
function
__construct
(AgreementFactory $agreementFactory)
28
{
29
$this->agreementFactory = $agreementFactory;
30
}
31
43
public
function
afterIsApplicable
(
44
SpecificationInterface
$specification,
45
$result
,
46
MethodInterface
$paymentMethod,
47
Quote
$quote
48
) {
49
if
(!
$result
) {
50
return
false
;
51
}
52
53
if
($paymentMethod->
getCode
() ==
Config::METHOD_BILLING_AGREEMENT
) {
54
if
(
$quote
->getCustomerId()) {
55
$availableBA = $this->agreementFactory->create()->getAvailableCustomerBillingAgreements(
56
$quote
->getCustomerId()
57
);
58
59
return
count($availableBA) > 0;
60
}
61
62
return
false
;
63
}
64
65
return
true
;
66
}
67
}
$result
$result
Definition:
product_configurable_not_available_rollback.php:26
Magento\Paypal\Model\Method\Checks\SpecificationPlugin\__construct
__construct(AgreementFactory $agreementFactory)
Definition:
SpecificationPlugin.php:27
$quote
$quote
Definition:
paypal_quote.php:17
Magento\Paypal\Model\Method\Checks\SpecificationPlugin
Definition:
SpecificationPlugin.php:17
Magento\Payment\Model\MethodInterface\getCode
getCode()
Magento\Payment\Model\Checks\SpecificationInterface
Definition:
SpecificationInterface.php:17
Magento\Payment\Model\MethodInterface
Definition:
MethodInterface.php:16
Magento\Quote\Model\Quote
Definition:
AddressTest.php:6
Magento\Framework\DB\Platform\Quote
Definition:
Quote.php:13
Magento\Paypal\Model\Method\Checks\SpecificationPlugin\afterIsApplicable
afterIsApplicable(SpecificationInterface $specification, $result, MethodInterface $paymentMethod, Quote $quote)
Definition:
SpecificationPlugin.php:43
Magento\Paypal\Model\Config
Magento\Paypal\Model\Config\METHOD_BILLING_AGREEMENT
const METHOD_BILLING_AGREEMENT
Definition:
Config.php:74
Magento\Paypal\Model\Method\Checks
Definition:
SpecificationPlugin.php:6