Example #1
0
 /**
  * Checkout with PayPal image URL getter
  * Spares API calls of getting "pal" variable, by putting it into cache per store view
  *
  * @return string
  */
 public function getCheckoutShortcutImageUrl()
 {
     // get "pal" thing from cache or lookup it via API
     $pal = null;
     if ($this->_config->areButtonsDynamic()) {
         $cacheId = self::PAL_CACHE_ID . $this->_storeManager->getStore()->getId();
         $pal = $this->_configCacheType->load($cacheId);
         if (self::PAL_CACHE_ID == $pal) {
             $pal = null;
         } elseif (!$pal) {
             $pal = null;
             $this->_getApi();
             try {
                 $this->_api->callGetPalDetails();
                 $pal = $this->_api->getPal();
                 $this->_configCacheType->save($pal, $cacheId);
             } catch (\Exception $e) {
                 $this->_configCacheType->save(self::PAL_CACHE_ID, $cacheId);
                 $this->_logger->critical($e);
             }
         }
     }
     return $this->_config->getExpressCheckoutShortcutImageUrl($this->_localeResolver->getLocale(), $this->_quote->getBaseGrandTotal(), $pal);
 }