Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions
BillingAgreement Class Reference
Inheritance diagram for BillingAgreement:
SectionSourceInterface

Public Member Functions

 __construct (CurrentCustomer $currentCustomer, Data $paypalData, ConfigFactory $paypalConfigFactory, UrlInterface $urlBuilder, Escaper $escaper)
 
 getSectionData ()
 

Detailed Description

BillingAgreement section

Definition at line 19 of file BillingAgreement.php.

Constructor & Destructor Documentation

◆ __construct()

__construct ( CurrentCustomer  $currentCustomer,
Data  $paypalData,
ConfigFactory  $paypalConfigFactory,
UrlInterface  $urlBuilder,
Escaper  $escaper 
)
Parameters
CurrentCustomer$currentCustomer
Data$paypalData
ConfigFactory$paypalConfigFactory
UrlInterface$urlBuilder
Escaper$escaper

Definition at line 66 of file BillingAgreement.php.

72  {
73  $this->currentCustomer = $currentCustomer;
74  $this->paypalData = $paypalData;
75  $this->urlBuilder = $urlBuilder;
76  $this->escaper = $escaper;
77  $this->config = $paypalConfigFactory->create();
78  $this->config->setMethod(Config::METHOD_EXPRESS);
79  }

Member Function Documentation

◆ getSectionData()

getSectionData ( )

{Get data

Returns
array
}

Implements SectionSourceInterface.

Definition at line 84 of file BillingAgreement.php.

85  {
86  $customerId = $this->currentCustomer->getCustomerId();
87  if ($this->paypalData->shouldAskToCreateBillingAgreement($this->config, $customerId)) {
88  return [
89  'askToCreate' => true,
90  'confirmUrl' => $this->escaper->escapeUrl(
91  $this->urlBuilder->getUrl(
92  $this->startAction,
93  [\Magento\Paypal\Model\Express\Checkout::PAYMENT_INFO_TRANSPORT_BILLING_AGREEMENT => 1]
94  )
95  ),
96  'confirmMessage' => $this->escaper->escapeJs(
97  __('Would you like to sign a billing agreement to streamline further purchases with PayPal?')
98  )
99  ];
100  }
101 
102  return [];
103  }
__()
Definition: __.php:13

The documentation for this class was generated from the following file: