当前位置: 首页>>代码示例>>PHP>>正文


PHP Mage_Sales_Model_Order_Creditmemo::getBasePaymentFeeTax方法代码示例

本文整理汇总了PHP中Mage_Sales_Model_Order_Creditmemo::getBasePaymentFeeTax方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Sales_Model_Order_Creditmemo::getBasePaymentFeeTax方法的具体用法?PHP Mage_Sales_Model_Order_Creditmemo::getBasePaymentFeeTax怎么用?PHP Mage_Sales_Model_Order_Creditmemo::getBasePaymentFeeTax使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Mage_Sales_Model_Order_Creditmemo的用法示例。


在下文中一共展示了Mage_Sales_Model_Order_Creditmemo::getBasePaymentFeeTax方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: collect

 public function collect(Mage_Sales_Model_Order_Creditmemo $creditmemo)
 {
     $order = $creditmemo->getOrder();
     //recalculate tax amounts in case if refund shipping value was changed
     if ((double) $creditmemo->getBasePaymentFeeAmount() && (double) $order->getBasePaymentFeeAmount()) {
         $taxFactor = $creditmemo->getBasePaymentFeeAmount() / $order->getBasePaymentFeeAmount();
         $paymentFeeTax = $creditmemo->getPaymentFeeTax() * $taxFactor;
         $paymentBaseFeeTax = $creditmemo->getBasePaymentFeeTax() * $taxFactor;
     } else {
         $paymentFeeTax = $creditmemo->getPaymentFeeTax();
         $paymentBaseFeeTax = $creditmemo->getBasePaymentFeeTax();
     }
     // set the tax fee
     $creditmemo->setPaymentFeeTax($paymentFeeTax);
     $creditmemo->setBasePaymentFeeTax($paymentBaseFeeTax);
     // use the tax fee to calculate total tax amount
     $creditmemo->setTaxAmount($creditmemo->getTaxAmount() + $creditmemo->getPaymentFeeTax());
     $creditmemo->setBaseTaxAmount($creditmemo->getBaseTaxAmount() + $creditmemo->getBasePaymentFeeTax());
     return $this;
 }
开发者ID:LybeAB,项目名称:magento,代码行数:20,代码来源:Creditmemo.php

示例2: collect

 public function collect(Mage_Sales_Model_Order_Creditmemo $creditmemo)
 {
     $creditmemo->setTaxAmount($creditmemo->getTaxAmount() + $creditmemo->getPaymentFeeTax());
     $creditmemo->setBaseTaxAmount($creditmemo->getBaseTaxAmount() + $creditmemo->getBasePaymentFeeTax());
     return $this;
 }
开发者ID:Maikel-Koek,项目名称:magento,代码行数:6,代码来源:Creditmemo.php

示例3: collect

 public function collect(Mage_Sales_Model_Order_Creditmemo $creditmemo)
 {
     /**
      * Only option to receive the payment fee entered to modify the creditMemo refund fee.
      */
     $order = $creditmemo->getOrder();
     $data = $this->_getRequest('creditmemo');
     // add Refunded amount to refunded
     $basePaymentFeeAmountRefunded = $order->getPayment()->getAdditionalInformation("base_payment_fee_amount_refunded");
     $paymentFeeAmountRefunded = $order->getPayment()->getAdditionalInformation("payment_fee_amount_refunded");
     $isPaymentFeeInclTax = Mage::getSingleton('adyen_fee/tax_config')->displaySalesPaymentFeeInclTax($order->getStoreId());
     if ($this->_isLoggedIn()) {
         if ($data) {
             if (isset($data['adyen_fee_payment_fee_refund'])) {
                 if ($data['adyen_fee_payment_fee_refund'] == '') {
                     $data['adyen_fee_payment_fee_refund'] = 0;
                 }
                 $store = $order->getStore();
                 $refundAmount = $data['adyen_fee_payment_fee_refund'];
                 $baseRefundAmount = $store->convertPrice($refundAmount, false);
                 // if refundAmount is set to empty set amount to zero
                 if ($refundAmount == 0 || $refundAmount == "") {
                     $creditmemo->setPaymentFeeAmount(0);
                     $creditmemo->setPaymentFeeTax(0);
                     $creditmemo->setBasePaymentFeeAmount(0);
                     $creditmemo->setBasePaymentFeeTax(0);
                     $creditmemo->setGrandTotal($creditmemo->getGrandTotal() + $creditmemo->getPaymentFeeAmount() + $creditmemo->getPaymentFeeTax());
                     $creditmemo->setBaseGrandTotal($creditmemo->getBaseGrandTotal() + $creditmemo->getBasePaymentFeeAmount() + $creditmemo->getBasePaymentFeeTax());
                     return $this;
                 }
                 /*
                  * if payment fee is incl tax remove the tax from the amount
                  */
                 if ($isPaymentFeeInclTax && $refundAmount > 0) {
                     $refundAmountInclTax = $refundAmount;
                     $baseRefundAmountInclTax = $baseRefundAmount;
                     // calculate tax
                     // get base tax rate
                     $basePaymentFeeAmount = Mage::app()->getStore()->roundPrice($order->getBasePaymentFeeAmount());
                     $basePaymentFeeTax = Mage::app()->getStore()->roundPrice($order->getBasePaymentFeeTax());
                     // get tax rate
                     $paymentFeeAmount = Mage::app()->getStore()->roundPrice($order->getPaymentFeeAmount());
                     $paymentFeeTax = Mage::app()->getStore()->roundPrice($order->getPaymentFeeTax());
                     // tax rate
                     $baseRate = $basePaymentFeeTax / $basePaymentFeeAmount;
                     // rate is already in the amount so + 1 because example 21% = 121% = 1.21
                     $baseRate = $baseRate + 1;
                     $rate = $paymentFeeTax / $paymentFeeAmount;
                     // rate is already in the amount so + 1 because example 21% = 121% = 1.21
                     $rate = $rate + 1;
                     // tax amount
                     $baseRefundAmount = $baseRefundAmountInclTax / $baseRate;
                     $refundAmount = $refundAmountInclTax / $rate;
                     $baseRefundAmount = $store->convertPrice($baseRefundAmount, false);
                     // tax amount
                     $taxAmount = $refundAmountInclTax - $refundAmount;
                     $baseTaxAmount = $baseRefundAmountInclTax - $baseRefundAmount;
                     $creditmemo->setPaymentFeeAmount($refundAmount);
                     $creditmemo->setBasePaymentFeeAmount($baseRefundAmount);
                     $creditmemo->setGrandTotal($creditmemo->getGrandTotal() + $creditmemo->getPaymentFeeAmount() + $taxAmount);
                     $creditmemo->setBaseGrandTotal($creditmemo->getBaseGrandTotal() + $creditmemo->getBasePaymentFeeAmount() + $baseTaxAmount);
                 } else {
                     // set amount
                     $creditmemo->setPaymentFeeAmount($refundAmount);
                     $baseRefundAmount = $store->convertPrice($refundAmount, false);
                     $creditmemo->setBasePaymentFeeAmount($baseRefundAmount);
                     // get base tax rate
                     $basePaymentFeeAmount = Mage::app()->getStore()->roundPrice($order->getBasePaymentFeeAmount());
                     $basePaymentFeeTax = Mage::app()->getStore()->roundPrice($order->getBasePaymentFeeTax());
                     // get tax rate
                     $paymentFeeAmount = Mage::app()->getStore()->roundPrice($order->getPaymentFeeAmount());
                     $paymentFeeTax = Mage::app()->getStore()->roundPrice($order->getPaymentFeeTax());
                     // tax rate
                     $baseRate = $basePaymentFeeTax / $basePaymentFeeAmount;
                     $rate = $paymentFeeTax / $paymentFeeAmount;
                     // tax amount
                     $baseTaxAmount = $refundAmount * $baseRate;
                     $taxAmount = $refundAmount * $rate;
                     $creditmemo->setGrandTotal($creditmemo->getGrandTotal() + $creditmemo->getPaymentFeeAmount() + $taxAmount);
                     $creditmemo->setBaseGrandTotal($creditmemo->getBaseGrandTotal() + $creditmemo->getBasePaymentFeeAmount() + $baseTaxAmount);
                 }
                 // add fee to refunded variable so it can be substracten from open amount
                 if ($basePaymentFeeAmountRefunded > 0) {
                     $order->getPayment()->setAdditionalInformation("base_payment_fee_amount_refunded", $basePaymentFeeAmountRefunded + $baseRefundAmount);
                 } else {
                     $order->getPayment()->setAdditionalInformation("base_payment_fee_amount_refunded", $baseRefundAmount);
                 }
                 if ($paymentFeeAmountRefunded > 0) {
                     $order->getPayment()->setAdditionalInformation("payment_fee_amount_refunded", $paymentFeeAmountRefunded + $refundAmount);
                 } else {
                     $order->getPayment()->setAdditionalInformation("payment_fee_amount_refunded", $refundAmount);
                 }
                 // do not do other logic
                 return $this;
             }
         }
     }
     // Substract the already refunded amount off the GrandTotal and paymentFee amount.
     if ($basePaymentFeeAmountRefunded > 0) {
         $allowedRefundedAmount = $creditmemo->getPaymentFeeAmount() - $paymentFeeAmountRefunded;
//.........这里部分代码省略.........
开发者ID:LybeAB,项目名称:magento,代码行数:101,代码来源:Creditmemo.php


注:本文中的Mage_Sales_Model_Order_Creditmemo::getBasePaymentFeeTax方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。