Пример #1
0
 /**
  * Devuelve el final price del producto, formateado para Aplazame
  * @return int
  */
 public function getFinalPrice()
 {
     if ($this->getProduct() instanceof Mage_Catalog_Model_Product) {
         return Aplazame_Util::formatDecimals($this->getProduct()->getFinalPrice());
     }
     return Aplazame_Util::formatDecimals(0);
 }
Пример #2
0
 public function authorize(Varien_Object $payment, $amount)
 {
     if ($amount <= 0) {
         Mage::throwException(Mage::helper('aplazame')->__('Invalid amount for authorization.'));
     }
     $token = $payment->getAdditionalInformation(self::CHECKOUT_TOKEN);
     $api = Mage::getModel('aplazame/api_client');
     $result = $api->setOrderId($token)->authorize();
     if (isset($result["id"])) {
         $this->getInfoInstance()->setAdditionalInformation("charge_id", $result["id"]);
     } else {
         Mage::throwException(Mage::helper('aplazame')->__('Aplazame charge id not returned from call.'));
     }
     $this->_validate_amount_result(Aplazame_Util::formatDecimals($amount), $result);
     $payment->setTransactionId($this->getChargeId())->setIsTransactionClosed(0);
     return $this;
 }
Пример #3
0
 private static function formatDecimals($price)
 {
     return Aplazame_Util::formatDecimals($price);
 }
Пример #4
0
 public function getTotal()
 {
     return Aplazame_Util::formatDecimals($this->getMethod()->getCheckout()->getQuote()->getGrandTotal());
 }