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
BillingAgreementConfigProvider.php
Go to the documentation of this file.
1
<?php
6
namespace
Magento\Paypal\Model
;
7
8
use
Magento\Checkout\Model\ConfigProviderInterface
;
9
use Magento\Paypal\Model\Billing\AgreementFactory;
10
use
Magento\Customer\Helper\Session\CurrentCustomer
;
11
use
Magento\Paypal\Model\Payment\Method\Billing\AbstractAgreement
;
12
16
class
BillingAgreementConfigProvider
implements
ConfigProviderInterface
17
{
21
protected
$currentCustomer
;
22
26
protected
$agreementFactory
;
27
32
public
function
__construct
(
33
CurrentCustomer
$currentCustomer
,
34
AgreementFactory
$agreementFactory
35
) {
36
$this->currentCustomer =
$currentCustomer
;
37
$this->agreementFactory =
$agreementFactory
;
38
}
39
43
public
function
getConfig
()
44
{
45
$config
= [
46
'payment'
=> [
47
'paypalBillingAgreement'
=> [
48
'agreements'
=> $this->
getBillingAgreements
(),
49
'transportName'
=>
AbstractAgreement::TRANSPORT_BILLING_AGREEMENT_ID
50
]
51
]
52
];
53
54
return
$config
;
55
}
56
62
protected
function
getBillingAgreements
()
63
{
64
$customerId
= $this->currentCustomer->getCustomerId();
65
$data
= [];
66
if
(!
$customerId
) {
67
return
$data
;
68
}
69
$collection
= $this->agreementFactory->create()->getAvailableCustomerBillingAgreements(
70
$customerId
71
);
72
foreach
(
$collection
as
$item
) {
73
$data
[] = [
'id'
=>
$item
->getId(),
'referenceId'
=>
$item
->getReferenceId()];
74
}
75
return
$data
;
76
}
77
}
Magento\Paypal\Model\Payment\Method\Billing\AbstractAgreement
Definition:
AbstractAgreement.php:18
Magento\Customer\Helper\Session\CurrentCustomer
Definition:
CurrentCustomer.php:19
Magento\Paypal\Model
$config
$config
Definition:
fraud_order.php:17
Magento\Paypal\Model\Payment\Method\Billing\AbstractAgreement\TRANSPORT_BILLING_AGREEMENT_ID
const TRANSPORT_BILLING_AGREEMENT_ID
Definition:
AbstractAgreement.php:23
$item
$item
Definition:
partial_invoice.php:27
Magento\Paypal\Model\BillingAgreementConfigProvider\$currentCustomer
$currentCustomer
Definition:
BillingAgreementConfigProvider.php:21
Magento\Paypal\Model\BillingAgreementConfigProvider\getBillingAgreements
getBillingAgreements()
Definition:
BillingAgreementConfigProvider.php:62
$data
$data
Definition:
attribute_set_with_image_attribute.php:16
Magento\Paypal\Model\BillingAgreementConfigProvider\__construct
__construct(CurrentCustomer $currentCustomer, AgreementFactory $agreementFactory)
Definition:
BillingAgreementConfigProvider.php:32
Magento\Paypal\Model\BillingAgreementConfigProvider
Definition:
BillingAgreementConfigProvider.php:16
Magento\Checkout\Model\ConfigProviderInterface
Definition:
ConfigProviderInterface.php:13
$customerId
$customerId
Definition:
quote_with_customer.php:16
Magento\Paypal\Model\BillingAgreementConfigProvider\getConfig
getConfig()
Definition:
BillingAgreementConfigProvider.php:43
Magento\Paypal\Model\BillingAgreementConfigProvider\$agreementFactory
$agreementFactory
Definition:
BillingAgreementConfigProvider.php:26
$collection
$collection
Definition:
catalog_category_with_apostrophe_rollback.php:17