/**
  * {@inheritdoc}
  */
 public function getConfig()
 {
     $config = ['payment' => ['paypalExpress' => ['paymentAcceptanceMarkHref' => $this->config->getPaymentMarkWhatIsPaypalUrl($this->localeResolver), 'paymentAcceptanceMarkSrc' => $this->config->getPaymentMarkImageUrl($this->localeResolver->getLocale())]]];
     foreach ($this->methodCodes as $code) {
         if ($this->methods[$code]->isAvailable()) {
             $config['payment']['paypalExpress']['redirectUrl'][$code] = $this->getMethodRedirectUrl($code);
             $config['payment']['paypalExpress']['billingAgreementCode'][$code] = $this->getBillingAgreementCode($code);
         }
     }
     return $config;
 }
示例#2
0
 /**
  * @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));
 }
 /**
  * {@inheritdoc}
  */
 public function getConfig()
 {
     $locale = $this->localeResolver->getLocale();
     $config = ['payment' => ['paypalExpress' => ['paymentAcceptanceMarkHref' => $this->config->getPaymentMarkWhatIsPaypalUrl($this->localeResolver), 'paymentAcceptanceMarkSrc' => $this->config->getPaymentMarkImageUrl($locale), 'isContextCheckout' => false, 'inContextConfig' => []]]];
     $isInContext = $this->isInContextCheckout();
     if ($isInContext) {
         $config['payment']['paypalExpress']['isContextCheckout'] = $isInContext;
         $config['payment']['paypalExpress']['inContextConfig'] = ['inContextId' => self::IN_CONTEXT_BUTTON_ID, 'merchantId' => $this->config->getValue('merchant_id'), 'path' => $this->urlBuilder->getUrl('paypal/express/gettoken', ['_secure' => true]), 'clientConfig' => ['environment' => (int) $this->config->getValue('sandbox_flag') ? 'sandbox' : 'production', 'locale' => $locale, 'button' => [self::IN_CONTEXT_BUTTON_ID]]];
     }
     foreach ($this->methodCodes as $code) {
         if ($this->methods[$code]->isAvailable()) {
             $config['payment']['paypalExpress']['redirectUrl'][$code] = $this->getMethodRedirectUrl($code);
             $config['payment']['paypalExpress']['billingAgreementCode'][$code] = $this->getBillingAgreementCode($code);
         }
     }
     return $config;
 }