本文整理汇总了PHP中Mage_Sales_Model_Order_Invoice::getShippingAmount方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Sales_Model_Order_Invoice::getShippingAmount方法的具体用法?PHP Mage_Sales_Model_Order_Invoice::getShippingAmount怎么用?PHP Mage_Sales_Model_Order_Invoice::getShippingAmount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Sales_Model_Order_Invoice
的用法示例。
在下文中一共展示了Mage_Sales_Model_Order_Invoice::getShippingAmount方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: collect
/**
* Collect shipping amount to be invoiced based on already invoiced amount
*
* @param Mage_Sales_Model_Order_Invoice $invoice
* @return $this
*/
public function collect(Mage_Sales_Model_Order_Invoice $invoice)
{
$previousInvoices = $invoice->getOrder()->getInvoiceCollection();
if ($invoice->getShippingAmount() > 0) {
return $this;
}
$order = $invoice->getOrder();
$shippingAmount = $order->getShippingAmount() - $order->getShippingInvoiced() - $order->getShippingRefunded();
$baseShippingAmount = $order->getBaseShippingAmount() - $order->getBaseShippingInvoiced() - $order->getBaseShippingRefunded();
$invoice->setShippingAmount($shippingAmount);
$invoice->setBaseShippingAmount($baseShippingAmount);
$invoice->setGrandTotal($invoice->getGrandTotal() + $shippingAmount);
$invoice->setBaseGrandTotal($invoice->getBaseGrandTotal() + $baseShippingAmount);
return $this;
}
示例2: cancelInvoice
/**
* Cancel specified invoice: update self totals from it
*
* @param Mage_Sales_Model_Order_Invoice $invoice
* @return Mage_Sales_Model_Order_Payment
*/
public function cancelInvoice($invoice)
{
$this->_updateTotals(array('amount_paid' => -1 * $invoice->getGrandTotal(), 'base_amount_paid' => -1 * $invoice->getBaseGrandTotal(), 'shipping_captured' => -1 * $invoice->getShippingAmount(), 'base_shipping_captured' => -1 * $invoice->getBaseShippingAmount()));
Mage::dispatchEvent('sales_order_payment_cancel_invoice', array('payment' => $this, 'invoice' => $invoice));
return $this;
}
示例3: sendConfirmInvoiceRequest
/**
* @param Mage_Sales_Model_Order_Invoice $invoice
* @return array
*/
public function sendConfirmInvoiceRequest($invoice, $paymentMethod, $delayInDays, $useHTMLFormat)
{
$order = $invoice->getOrder();
$shippingPriceGross = $this->currencyToSmallerUnit($invoice->getShippingAmount() + $invoice->getShippingTaxAmount());
$cartTotalPriceGross = $this->calculateCartTotalGross($invoice);
// add trusted shops amount
if ($this->getConfigData('settings/use_trusted_shops_buyer_protection', $order->getStore()->getId())) {
$trustedShopsAmount = $invoice->getTrustedShopsAmount();
if (!empty($trustedShopsAmount)) {
$cartTotalPriceGross += $this->currencyToSmallerUnit($trustedShopsAmount);
}
}
$storeId = $order->getStore()->getStoreId();
$req = $this->createRequestObject('invoiceCreated', $paymentMethod, $storeId);
$req->set_invoice_params($cartTotalPriceGross, $order->getOrderCurrencyCode(), $order->getOriginalIncrementId() ? $order->getOriginalIncrementId() : $order->getIncrementId(), $delayInDays);
try {
$req->send();
$this->getLog()->logDebug('InvoiceCreated request xml:');
$this->getLog()->logDebug($req->get_request_xml());
$this->getLog()->logDebug('InvoiceCreated response xml:');
$this->getLog()->logDebug($req->get_response_xml());
} catch (Exception $e) {
$this->getLog()->logError('Error sending InvoiceCreated request:');
$this->getLog()->logException($e);
// This will be caught by calling Mage_Adminhtml_Sales_OrderController controller
throw new Mage_Core_Exception(Mage::helper('sales')->__('billpay_connection_failed_invoice'));
}
if ($req->has_error()) {
$this->getLog()->logError('InvoiceCreated request error code: ' . $req->get_error_code());
throw new Mage_Core_Exception($req->get_merchant_error_message() . ' (Error code: ' . $req->get_error_code() . ')');
}
$result = array();
$result['account_holder'] = $req->get_account_holder();
$result['account_number'] = $req->get_account_number();
$result['bank_code'] = $req->get_bank_code();
$result['bank_name'] = $req->get_bank_name();
$result['invoice_duedate'] = $req->get_invoice_duedate();
$result['invoice_reference'] = $req->get_invoice_reference();
$result['dues'] = $req->get_dues();
return $result;
}