78 parent::__construct($context);
79 $this->_layout = $layoutFactory->
create();
80 $this->_methodFactory = $paymentMethodFactory;
81 $this->_appEmulation = $appEmulation;
82 $this->_paymentConfig = $paymentConfig;
83 $this->_initialConfig = $initialConfig;
92 return sprintf(
'%s/%s/model', self::XML_PATH_PAYMENT_METHODS,
$code);
105 $class = $this->scopeConfig->getValue(
111 throw new \UnexpectedValueException(
'Payment model name is not provided in config!');
114 return $this->_methodFactory->create(
$class);
126 public function getStoreMethods(
$store =
null,
$quote =
null)
132 $model = $this->scopeConfig->getValue(
142 $methodInstance = $this->_methodFactory->create(
$model);
143 $methodInstance->setStore(
$store);
144 if (!$methodInstance->isAvailable(
$quote)) {
148 $res[] = $methodInstance;
153 function (MethodInterface $a, MethodInterface $b) {
154 return (
int)$a->getConfigData(
'sort_order') <=> (int)$b->getConfigData(
'sort_order');
185 $blockType =
$info->getMethodInstance()->getInfoBlockType();
186 $block = $layout->createBlock($blockType);
201 $this->_appEmulation->startEnvironmentEmulation(
$storeId);
206 $paymentBlock->setArea(\
Magento\Framework\
App\Area::AREA_FRONTEND)
207 ->setIsSecureMode(
true);
208 $paymentBlock->getMethod()
210 $paymentBlockHtml = $paymentBlock->toHtml();
212 $this->_appEmulation->stopEnvironmentEmulation();
216 $this->_appEmulation->stopEnvironmentEmulation();
218 return $paymentBlockHtml;
259 $groupRelations = [];
262 if (isset(
$data[
'title'])) {
267 if ($asLabelValue && $withGroups && isset(
$data[
'group'])) {
271 if ($asLabelValue && $withGroups) {
272 $groups = $this->_paymentConfig->getGroups();
283 $labelValues[
$code] = [];
286 if (isset($groups[
$code])) {
288 if (!isset($labelValues[
$code][
'value'])) {
289 $labelValues[
$code][
'value'] =
null;
292 unset($labelValues[
$code]);
312 return $this->scopeConfig->getValue(
327 return $this->scopeConfig->getValue(
328 \
Magento\
Payment\Model\Method\Free::XML_PATH_PAYMENT_FREE_ORDER_STATUS,
342 return $this->scopeConfig->getValue(
343 \
Magento\
Payment\Model\Method\Free::XML_PATH_PAYMENT_FREE_PAYMENT_ACTION,
getMethodFormBlock(MethodInterface $method, LayoutInterface $layout)
getPaymentMethodList($sorted=true, $asLabelValue=false, $withGroups=false, $store=null)
elseif(isset( $params[ 'redirect_parent']))
__construct(\Magento\Framework\App\Helper\Context $context, LayoutFactory $layoutFactory, \Magento\Payment\Model\Method\Factory $paymentMethodFactory, \Magento\Store\Model\App\Emulation $appEmulation, \Magento\Payment\Model\Config $paymentConfig, \Magento\Framework\App\Config\Initial $initialConfig)
createBlock($type, $name='', array $arguments=[])
getZeroSubTotalOrderStatus($store=null)
$_option $_optionId $class
const XML_PATH_PAYMENT_METHODS
getMethodModelConfigName($code)
isZeroSubTotal($store=null)
getInfoBlockHtml(InfoInterface $info, $storeId)
getZeroSubTotalPaymentAutomaticInvoice($store=null)
getInfoBlock(InfoInterface $info, LayoutInterface $layout=null)
foreach( $_productCollection as $_product)() ?>" class $info