Ejemplo n.º 1
0
 /**
  * return banks with code
  * 
  * @return array
  */
 public function getBanks()
 {
     if (empty($this->_relatedBanks)) {
         $sofort = new SofortLib_iDealClassic(Mage::getStoreConfig('payment/sofort_ideal/configkey'), Mage::getStoreConfig('payment/sofort_ideal/password'), 'sha1');
         $this->_relatedBanks = $sofort->getRelatedBanks();
     }
     return $this->_relatedBanks;
 }
Ejemplo n.º 2
0
 /**
  * This shows the plugin for choosing in the payment list of the checkout process.
  *
  * @author Valerie Cartan Isaksen
  */
 function plgVmDisplayListFEPayment(VirtueMartCart $cart, $selected = 0, &$htmlIn)
 {
     if ($this->getPluginMethods($cart->vendorId) === 0) {
         if (empty($this->_name)) {
             $app = JFactory::getApplication();
             $app->enqueueMessage(vmText::_('COM_VIRTUEMART_CART_NO_' . strtoupper($this->_psType)));
             return false;
         } else {
             return false;
         }
     }
     $htmla = array();
     $html = '';
     vmdebug('methods', $this->methods);
     VmConfig::loadJLang('com_virtuemart');
     $currency = CurrencyDisplay::getInstance();
     foreach ($this->methods as $method) {
         if ($this->checkConditions($cart, $method, $cart->cartPrices)) {
             $methodSalesPrice = $this->calculateSalesPrice($cart, $method, $cart->cartPrices);
             //$method->payment_name = $method->payment_name
             if (!class_exists('SofortLib')) {
                 require VMPATH_ROOT . DS . 'plugins' . DS . 'vmpayment' . DS . 'sofort' . DS . 'sofort' . DS . 'library' . DS . 'sofortLib.php';
             }
             if (!class_exists('SofortLib_iDealClassic')) {
                 require VMPATH_ROOT . DS . 'plugins' . DS . 'vmpayment' . DS . 'sofort' . DS . 'sofort' . DS . 'library' . DS . 'sofortLib_ideal_classic.php';
             }
             $selected_bank = self::_getSelectedBank($method->virtuemart_paymentmethod_id);
             if (empty($method->configuration_key) or empty($method->project_password)) {
                 vmError('Missing essentials infos for this published payment. Check the configuration  key and the password:'******' (' . $method->virtuemart_paymentmethod_id . ')');
                 continue;
             }
             $sofort_ideal = new SofortLib_iDealClassic(trim($method->configuration_key), trim($method->project_password));
             $relatedBanks = $sofort_ideal->getRelatedBanks();
             if (empty($relatedBanks)) {
                 vmError('getRelatedBanks: error, returned NULL' . $method->virtuemart_paymentmethod_id . '.');
                 continue;
             }
             $relatedBanksDropDown = $this->getRelatedBanksDropDown($relatedBanks, $method->virtuemart_paymentmethod_id, $selected_bank);
             $logo = $this->displayLogos($method->payment_logos);
             $payment_cost = '';
             if ($methodSalesPrice) {
                 $payment_cost = $currency->priceDisplay($methodSalesPrice);
             }
             if ($selected == $method->virtuemart_paymentmethod_id) {
                 $checked = 'checked="checked"';
             } else {
                 $checked = '';
             }
             $html = $this->renderByLayout('display_payment', array('plugin' => $method, 'checked' => $checked, 'payment_logo' => $logo, 'payment_cost' => $payment_cost, 'relatedBanks' => $relatedBanksDropDown));
             $htmla[] = $html;
         }
     }
     if (!empty($htmla)) {
         $htmlIn[] = $htmla;
     }
     return true;
 }