paymentHelper = $paymentHelper; $this->urlBuilder = $urlBuilder; foreach ($this->methodCodes as $code) { $this->methods[$code] = $this->paymentHelper->getMethodInstance($code); } } /** * {@inheritdoc} */ public function getConfig() { $config = [ 'payment' => [ 'paypalIframe' => [], ], ]; foreach ($this->methodCodes as $code) { if ($this->methods[$code]->isAvailable()) { $config['payment']['paypalIframe']['actionUrl'][$code] = $this->getFrameActionUrl($code); } } return $config; } /** * Get frame action URL * * @param string $code * @return string */ protected function getFrameActionUrl($code) { $url = ''; switch ($code) { case Config::METHOD_PAYFLOWADVANCED: $url = $this->urlBuilder->getUrl('paypal/payflowadvanced/form', ['_secure' => true]); break; case Config::METHOD_PAYFLOWLINK: $url = $this->urlBuilder->getUrl('paypal/payflow/form', ['_secure' => true]); break; case Config::METHOD_HOSTEDPRO: $url = $this->urlBuilder->getUrl('paypal/hostedpro/redirect', ['_secure' => true]); break; } return $url; } }