/** * {@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; }
/** * {@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; }