示例#1
0
文件: Data.php 项目: buttasg/cowgirlk
 /**
  * check if order total is correct
  *
  * @param ShopgateOrder          $order
  * @param Mage_Sales_Model_Order $oMageOrder
  * @param string                 $message
  *
  * @return bool
  */
 public function isOrderTotalCorrect(ShopgateOrder $order, Mage_Sales_Model_Order $oMageOrder, &$message = "")
 {
     $totalShopgate = $order->getAmountComplete();
     $totalMagento = $oMageOrder->getTotalDue() + $oMageOrder->getTotalPaid();
     ShopgateLogger::getInstance()->log("Total Shopgate: {$totalShopgate} {$order->getCurrency()} \n            Total Magento: {$totalMagento} {$order->getCurrency()}", ShopgateLogger::LOGTYPE_DEBUG);
     if (abs($totalShopgate - $totalMagento) > 0.02) {
         $msg = "differing total order amounts:\n";
         $msg .= "\tShopgate:\t{$totalShopgate} {$order->getCurrency()} \n";
         $msg .= "\tMagento:\t{$totalMagento} {$oMageOrder->getOrderCurrencyCode()}\n";
         $message = $msg;
         return false;
     }
     return true;
 }