/** * @param ShopgatePaymentMethod $c */ public function visitPaymentMethod(ShopgatePaymentMethod $c) { $properties = $c->buildProperties(); // iterate the simple variables $properties = $this->iterateSimpleProperties($properties); // set last value to converted array $this->array = $properties; }
/** * Returns all valid payment methods base on current quote. * (check address, order total amount etc.) * * @param Mage_Checkout_Model_Cart $mageCart * @return array */ public function getPaymentMethods($mageCart) { /** @var Mage_Sales_Model_quote $quote */ $quote = $mageCart->getQuote(); $methods = array(); $paymentMethods = Mage::helper('payment')->getStoreMethods(Mage::app()->getStore()->getId(), $quote); foreach ($paymentMethods as $_paymentMethod) { if (!$_paymentMethod->canUseForCountry($quote->getBillingAddress()->getCountry()) || !$_paymentMethod->canUseForCurrency($quote->getStore()->getBaseCurrencyCode())) { continue; } /** * Checking for min/max order total for assigned payment method */ $total = $quote->getBaseGrandTotal(); $minTotal = $_paymentMethod->getConfigData('min_order_total'); $maxTotal = $_paymentMethod->getConfigData('max_order_total'); if (!empty($minTotal) && $total < $minTotal || !empty($maxTotal) && $total > $maxTotal) { continue; } $method = new ShopgatePaymentMethod(); $method->setId($_paymentMethod->getCode()); $method->setAmount(0.0); $method->setAmountWithTax(0.0); $method->setTaxClass(''); $method->setTaxPercent(0.0); $methods[] = $method; } return $methods; }