/** * Check if method can be used * * @param unknown_type $method * @param unknown_type $quote * @return boolean */ protected function _canUseMethod($method, $quote) { if (!$method->canUseForCountry($quote->getBillingAddress()->getCountry())) { return false; } if (method_exists($method, 'canUseForCurrency') && !$method->canUseForCurrency(Mage::app()->getStore()->getBaseCurrencyCode())) { return false; } /** * Checking for min/max order total for assigned payment method */ $total = $quote->getBaseGrandTotal(); $minTotal = $method->getConfigData('min_order_total'); $maxTotal = $method->getConfigData('max_order_total'); if (!empty($minTotal) && $total < $minTotal || !empty($maxTotal) && $total > $maxTotal) { return false; } return true; }
/** * Cancel invoice * * @param unknown_type $invoice * @return unknown */ public function cancelInvoice($invoice) { $this->setAmountPaid($this->getAmountPaid() - $invoice->getGrandTotal()); $this->setBaseAmountPaid($this->getBaseAmountPaid() - $invoice->getBaseGrandTotal()); $this->setShippingCaptured($this->getShippingCaptured() - $invoice->getShippingAmount()); $this->setBaseShippingCaptured($this->getBaseShippingCaptured() - $invoice->getBaseShippingAmount()); Mage::dispatchEvent('sales_order_payment_cancel_invoice', array('payment' => $this, 'invoice' => $invoice)); return $this; }
/** * Cancel invoice * * @param unknown_type $invoice * @return unknown */ public function cancelInvoice($invoice) { $this->setAmountPaid($this->getAmountPaid() - $invoice->getGrandTotal()); $this->setBaseAmountPaid($this->getBaseAmountPaid() - $invoice->getBaseGrandTotal()); $this->setShippingCaptured($this->getShippingCaptured() - $invoice->getShippingAmount()); $this->setBaseShippingCaptured($this->getBaseShippingCaptured() - $invoice->getBaseShippingAmount()); return $this; }