Esempio n. 1
0
 /**
  * @param $store
  * @param $country
  * @return array
  */
 protected function _fetchHppMethods($store, $country)
 {
     $skinCode = $this->_adyenHelper->getAdyenHppConfigData('skin_code');
     $merchantAccount = $this->_adyenHelper->getAdyenAbstractConfigData('merchant_account');
     if (!$skinCode || !$merchantAccount) {
         return [];
     }
     $adyFields = ["paymentAmount" => (int) $this->_adyenHelper->formatAmount($this->_getCurrentPaymentAmount(), $this->_getCurrentCurrencyCode($store)), "currencyCode" => $this->_getCurrentCurrencyCode($store), "merchantReference" => "Get Payment methods", "skinCode" => $skinCode, "merchantAccount" => $merchantAccount, "sessionValidity" => date(DATE_ATOM, mktime(date("H") + 1, date("i"), date("s"), date("m"), date("j"), date("Y"))), "countryCode" => $this->_getCurrentCountryCode($store, $country), "shopperLocale" => $this->_getCurrentLocaleCode($store)];
     $responseData = $this->_getDirectoryLookupResponse($adyFields, $store);
     $paymentMethods = [];
     if (isset($responseData['paymentMethods'])) {
         foreach ($responseData['paymentMethods'] as $paymentMethod) {
             $paymentMethodCode = $paymentMethod['brandCode'];
             $paymentMethod = $this->_fieldMapPaymentMethod($paymentMethod);
             // check if payment method is an openinvoice method
             $paymentMethod['isPaymentMethodOpenInvoiceMethod'] = $this->_adyenHelper->isPaymentMethodOpenInvoiceMethod($paymentMethodCode);
             // add icon location in result
             if ($this->_adyenHelper->showLogos()) {
                 $params = [];
                 // use frontend area
                 $params = array_merge(['area' => 'frontend', '_secure' => $this->_request->isSecure()], $params);
                 $asset = $this->_assetRepo->createAsset('Adyen_Payment::images/logos/' . $paymentMethodCode . '.png', $params);
                 $placeholder = $this->_assetSource->findSource($asset);
                 $icon = null;
                 if ($placeholder) {
                     list($width, $height) = getimagesize($asset->getSourceFile());
                     $icon = ['url' => $asset->getUrl(), 'width' => $width, 'height' => $height];
                 }
                 $paymentMethod['icon'] = $icon;
             }
             $paymentMethods[$paymentMethodCode] = $paymentMethod;
         }
     }
     return $paymentMethods;
 }
 public function testGetStaticViewFileContext()
 {
     $this->mockDesign();
     $context = $this->object->getStaticViewFileContext();
     $this->assertInstanceOf('\\Magento\\Framework\\View\\Asset\\ContextInterface', $context);
     $this->assertSame($context, $this->object->getStaticViewFileContext());
     // to ensure in-memory caching
     $asset = $this->object->createAsset('test/file.js');
     $this->assertSame($context, $asset->getContext());
     // and once again to ensure in-memory caching for real
 }
Esempio n. 3
0
 /**
  * Create a file asset that's subject of fallback system
  *
  * @param string $fileId
  * @param array $params
  * @return \Magento\Framework\View\Asset\File
  */
 public function createAsset($fileId, array $params = [])
 {
     $params = array_merge(['_secure' => $this->_request->isSecure()], $params);
     return $this->_assetRepo->createAsset($fileId, $params);
 }