/**
  * Decide whether authorization transaction may close (if the amount to capture will cover entire order)
  * @param float $amountToCapture
  * @return bool
  */
 protected function _isCaptureFinal($amountToCapture)
 {
     if (!Mage::helper('imagecc')->isActive()) {
         return parent::_isCaptureFinal($amountToCapture);
     }
     $amountToCapture = $this->_formatAmount($amountToCapture, true);
     $orderGrandTotal = $this->_formatAmount($this->getOrder()->getGrandTotal(), true);
     if ($orderGrandTotal == $this->_formatAmount($this->getBaseAmountPaid(), true) + $amountToCapture) {
         if (false !== $this->getShouldCloseParentTransaction()) {
             $this->setShouldCloseParentTransaction(true);
         }
         return true;
     }
     return false;
 }
Example #2
0
 /**
  * Decide whether authorization transaction may close (if the amount to capture will cover entire order)
  *
  * @param float $amountToCapture            
  * @return bool
  */
 protected function _isCaptureFinal($amountToCapture)
 {
     /**
      * Declare repeted string variable
      */
     $coreResource = 'core/resource';
     $coreWrite = 'core_write';
     $processing = 'processing';
     $orderNo = 'order_no=?';
     $superdealsOrders = 'superdeals_orders';
     /**
      * load order item
      */
     foreach ($this->getOrder()->getAllItems() as $oOrderItems) {
         /**
          * get order id from loop value
          */
         $ordrId = $this->getOrder()->getIncrementId();
         $connection = Mage::getSingleton($coreResource)->getConnection($coreWrite);
         $connection->beginTransaction();
         $fields = array();
         $fields = $this->statusForPayment($fields, $oOrderItems, $processing, $Processing);
         /**
          * check condition if order item is equal to pending paypal
          */
         if ($oOrderItems()->getStatus() == 'pending_paypal') {
             $fields['status'] = 'Pending PayPal';
         }
         /**
          * update and commit order status
          */
         $where = $connection->quoteInto($orderNo, $ordrId);
         $connection->update($superdealsOrders, $fields, $where);
         $connection->commit();
     }
     return parent::_isCaptureFinal($amountToCapture);
 }