/** * @inheritdoc * @param ResolverInterface $localeResolver */ public function __construct(Context $context, ResolverInterface $localeResolver, ConfigFactory $configFactory, array $data = []) { parent::__construct($context, $data); $this->localeResolver = $localeResolver; $this->config = $configFactory->create(); $this->config->setMethod(Config::METHOD_EXPRESS); }
/** * @param CurrentCustomer $currentCustomer * @param Data $paypalData * @param ConfigFactory $paypalConfigFactory * @param UrlInterface $urlBuilder * @param Escaper $escaper */ public function __construct(CurrentCustomer $currentCustomer, Data $paypalData, ConfigFactory $paypalConfigFactory, UrlInterface $urlBuilder, Escaper $escaper) { $this->currentCustomer = $currentCustomer; $this->paypalData = $paypalData; $this->urlBuilder = $urlBuilder; $this->escaper = $escaper; $this->config = $paypalConfigFactory->create(); $this->config->setMethod(Config::METHOD_EXPRESS); }
/** * @param string $localeCode * @param float|null $orderTotal * @param string|null $pal * @param string|null $staticSize * @param string $areButtonDynamic * @param bool $sandboxFlag * @param string $result * @dataProvider dataProviderGetPaymentMarkImageUrl */ public function testGetPaymentMarkImageUrl($localeCode, $orderTotal, $pal, $staticSize, $areButtonDynamic, $sandboxFlag, $result) { $this->_model->setMethod(Config::METHOD_WPP_EXPRESS); $this->_model->setStoreId(123); $this->_scopeConfig->expects($this->any())->method('getValue')->willReturnMap([['paypal/wpp/button_flavor', ScopeInterface::SCOPE_STORE, 123, $areButtonDynamic], ['paypal/wpp/sandbox_flag', ScopeInterface::SCOPE_STORE, 123, $sandboxFlag]]); $this->assertEquals($result, $this->_model->getPaymentMarkImageUrl($localeCode, $orderTotal, $pal, $staticSize)); }
public function testGetSpecificConfigPathPayflow() { // _mapBmlPayflowFieldset $this->_model->setMethod(Config::METHOD_WPP_PE_BML); $this->_scopeConfig->expects($this->once())->method('getValue')->with('payment/' . Config::METHOD_WPP_PE_EXPRESS . '/allow_ba_signup')->will($this->returnValue(1)); $this->assertEquals(1, $this->_model->getConfigValue('allow_ba_signup')); }
/** * @return bool */ protected function shouldRender() { $this->config->setMethod(Config::METHOD_EXPRESS); $isInCatalog = $this->getIsInCatalogProduct(); $isInContext = (bool) (int) $this->config->getValue('in_context'); $isEnabled = $isInContext && $isInCatalog || !$isInContext; $this->config->setMethod($this->_paymentMethodCode); return $isEnabled && $this->_shouldRender; }
/** * Payment method code setter. Also instantiates/updates config * * @param string $code * @param int|null $storeId * @return $this */ public function setMethod($code, $storeId = null) { if (null === $this->_config) { $params = [$code]; if (null !== $storeId) { $params[] = $storeId; } $this->_config = $this->_configFactory->create($this->_configType, ['params' => $params]); } else { $this->_config->setMethod($code); if (null !== $storeId) { $this->_config->setStoreId($storeId); } } return $this; }
/** * Return billing agreement code for method * * @param string $code * @return null|string */ protected function getBillingAgreementCode($code) { $customerId = $this->currentCustomer->getCustomerId(); $this->config->setMethod($code); return $this->paypalHelper->shouldAskToCreateBillingAgreement($this->config, $customerId) ? Express\Checkout::PAYMENT_INFO_TRANSPORT_BILLING_AGREEMENT : null; }