Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions | Data Fields | Protected Attributes | Static Protected Attributes
Data Class Reference
Inheritance diagram for Data:
AbstractHelper

Public Member Functions

 __construct (\Magento\Framework\App\Helper\Context $context, \Magento\Payment\Helper\Data $paymentData, \Magento\Paypal\Model\Billing\AgreementFactory $agreementFactory, \Magento\Paypal\Model\ConfigFactory $configFactory, array $methodCodes)
 
 shouldAskToCreateBillingAgreement (\Magento\Paypal\Model\Config $config, $customerId)
 
 getBillingAgreementMethods ($store=null, $quote=null)
 
- Public Member Functions inherited from AbstractHelper
 __construct (Context $context)
 
 isModuleOutputEnabled ($moduleName=null)
 

Data Fields

const HTML_TRANSACTION_ID
 

Protected Attributes

 $_paymentData
 
 $_agreementFactory
 
- Protected Attributes inherited from AbstractHelper
 $_moduleName
 
 $_request
 
 $_moduleManager
 
 $_logger
 
 $_urlBuilder
 
 $_httpHeader
 
 $_eventManager
 
 $_remoteAddress
 
 $urlEncoder
 
 $urlDecoder
 
 $scopeConfig
 
 $_cacheConfig
 

Static Protected Attributes

static $_shouldAskToCreateBillingAgreement = null
 

Additional Inherited Members

- Protected Member Functions inherited from AbstractHelper
 _getRequest ()
 
 _getModuleName ()
 
 _getUrl ($route, $params=[])
 

Detailed Description

Paypal Data helper

Definition at line 18 of file Data.php.

Constructor & Destructor Documentation

◆ __construct()

__construct ( \Magento\Framework\App\Helper\Context  $context,
\Magento\Payment\Helper\Data  $paymentData,
\Magento\Paypal\Model\Billing\AgreementFactory  $agreementFactory,
\Magento\Paypal\Model\ConfigFactory  $configFactory,
array  $methodCodes 
)
Parameters
\Magento\Framework\App\Helper\Context$context
\Magento\Payment\Helper\Data$paymentData
\Magento\Paypal\Model\Billing\AgreementFactory$agreementFactory
\Magento\Paypal\Model\ConfigFactory$configFactory
array$methodCodes

Definition at line 67 of file Data.php.

73  {
74  $this->_paymentData = $paymentData;
75  $this->_agreementFactory = $agreementFactory;
76  $this->methodCodes = $methodCodes;
77  $this->configFactory = $configFactory;
78  parent::__construct($context);
79  }
$configFactory
Definition: config_data.php:43

Member Function Documentation

◆ getBillingAgreementMethods()

getBillingAgreementMethods (   $store = null,
  $quote = null 
)

Retrieve available billing agreement methods

Parameters
null | string | bool | int | \Magento\Store\Model\Store$store
\Magento\Quote\Model\Quote | null$quote
Returns
BillingAgreementMethodInterface[]

Definition at line 108 of file Data.php.

109  {
110  $activeMethods = array_map(
111  function (PaymentMethodInterface $method) {
112  return $this->getPaymentMethodInstanceFactory()->create($method);
113  },
114  $this->getPaymentMethodList()->getActiveList($store)
115  );
116 
117  $result = array_filter(
118  $activeMethods,
119  function (MethodInterface $method) use ($quote) {
120  return $method instanceof BillingAgreementMethodInterface && $method->isAvailable($quote);
121  }
122  );
123 
124  return $result;
125  }
getPaymentMethodList($sorted=true, $asLabelValue=false, $withGroups=false, $store=null)
Definition: Data.php:255
$quote
$method
Definition: info.phtml:13

◆ shouldAskToCreateBillingAgreement()

shouldAskToCreateBillingAgreement ( \Magento\Paypal\Model\Config  $config,
  $customerId 
)

Check whether customer should be asked confirmation whether to sign a billing agreement

Parameters
\Magento\Paypal\Model\Config$config
int$customerId
Returns
bool

Definition at line 88 of file Data.php.

89  {
90  if (null === self::$_shouldAskToCreateBillingAgreement) {
91  self::$_shouldAskToCreateBillingAgreement = false;
92  if ($customerId && $config->shouldAskToCreateBillingAgreement()) {
93  if ($this->_agreementFactory->create()->needToCreateForCustomer($customerId)) {
94  self::$_shouldAskToCreateBillingAgreement = true;
95  }
96  }
97  }
98  return self::$_shouldAskToCreateBillingAgreement;
99  }
$config
Definition: fraud_order.php:17

Field Documentation

◆ $_agreementFactory

$_agreementFactory
protected

Definition at line 38 of file Data.php.

◆ $_paymentData

$_paymentData
protected

Definition at line 33 of file Data.php.

◆ $_shouldAskToCreateBillingAgreement

$_shouldAskToCreateBillingAgreement = null
staticprotected

Definition at line 28 of file Data.php.

◆ HTML_TRANSACTION_ID

const HTML_TRANSACTION_ID
Initial value:
=
'<a target="_blank" href="https://www%1$s.paypal.com/cgi-bin/webscr?cmd=_view-a-trans&id=%2$s">%2$s</a>'

Definition at line 20 of file Data.php.


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