本文整理汇总了PHP中Mage_Sales_Model_Order::getBaseGrandTotal方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Sales_Model_Order::getBaseGrandTotal方法的具体用法?PHP Mage_Sales_Model_Order::getBaseGrandTotal怎么用?PHP Mage_Sales_Model_Order::getBaseGrandTotal使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Sales_Model_Order
的用法示例。
在下文中一共展示了Mage_Sales_Model_Order::getBaseGrandTotal方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: processOrder
/**
* Processes payment for specified order
* @param Mage_Sales_Model_Order $Order
* @return
*/
public function processOrder(Mage_Sales_Model_Order $PrimaryOrder, Mage_Sales_Model_Order $Order = null)
{
if ($Order->getBaseGrandTotal() > 0) {
$data = array('amount' => $Order->getBaseGrandTotal() * 100, 'invoice_reference' => $Order->getIncrementId());
$eWayCustomerId = $this->getSubscription()->getRealId();
try {
$response = $this->getWebService()->createTransaction($eWayCustomerId, $data);
$Order->getPayment()->setCcTransId(@$response->ewayResponse->ewayTrxnNumber);
} catch (Exception $e) {
Mage::throwException($e->getMessage());
return $this;
}
}
return $this;
}
示例2: _validate
/**
* Check the line items and totals according to PayPal business logic limitations
*/
protected function _validate()
{
$this->_areItemsValid = false;
$this->_areTotalsValid = false;
$referenceAmount = $this->_salesEntity->getBaseGrandTotal();
$itemsSubtotal = 0;
foreach ($this->_items as $i) {
$itemsSubtotal = $itemsSubtotal + $i['qty'] * $i['amount'];
}
$sum = $itemsSubtotal + $this->_totals[self::TOTAL_TAX];
if (!$this->_isShippingAsItem) {
$sum += $this->_totals[self::TOTAL_SHIPPING];
}
if (!$this->_isDiscountAsItem) {
$sum -= $this->_totals[self::TOTAL_DISCOUNT];
}
/**
* numbers are intentionally converted to strings because of possible comparison error
* see http://php.net/float
*/
// match sum of all the items and totals to the reference amount
if (sprintf('%.4F', $sum) == sprintf('%.4F', $referenceAmount)) {
$this->_areItemsValid = true;
}
// PayPal requires to have discount less than items subtotal
if (!$this->_isDiscountAsItem) {
$this->_areTotalsValid = round($this->_totals[self::TOTAL_DISCOUNT], 4) < round($itemsSubtotal, 4);
} else {
$this->_areTotalsValid = $itemsSubtotal > 1.0E-5;
}
$this->_areItemsValid = $this->_areItemsValid && $this->_areTotalsValid;
}
示例3: processOrder
/**
* Processes payment for specified order
* @param Mage_Sales_Model_Order $Order
* @return
*/
public function processOrder(Mage_Sales_Model_Order $PrimaryOrder, Mage_Sales_Model_Order $Order = null)
{
if ($Order->getBaseGrandTotal() > 0) {
$result = $this->getWebService()->setSubscription($this->getSubscription())->setOrder($Order)->createTransaction();
$ccTransId = @$result->transactionId;
$Order->getPayment()->setCcTransId($ccTransId);
}
}
示例4: _buildNewPayload
/**
* Fill in the values the order create request requires.
*
* @return self
*/
protected function _buildNewPayload()
{
$this->_payload->setBillingAddress($this->_getRomBillingAddress($this->_order->getBillingAddress()))->setCurrency($this->_order->getOrderCurrencyCode())->setLevelOfService($this->_config->levelOfService)->setLocale($this->_getLocale())->setOrderHistoryUrl($this->_helper->getOrderHistoryUrl($this->_order))->setOrderId($this->_order->getIncrementId())->setOrderTotal($this->_order->getBaseGrandTotal())->setOrderType($this->_config->orderType)->setRequestId($this->_coreHelper->generateRequestId('OCR-'));
$createdAt = $this->_getAsDateTime($this->_order->getCreatedAt());
if ($createdAt) {
$this->_payload->setCreateTime($createdAt);
}
return $this->_setCustomerData($this->_order, $this->_payload)->_setOrderContext($this->_order, $this->_payload)->_setShipGroups($this->_order, $this->_payload)->_setPaymentData($this->_order, $this->_payload);
}
示例5: collect
public function collect(Mage_Sales_Model_Order $order)
{
$order->setData('zitec_dpd_cashondelivery_surcharge', 0);
$order->setData('base_zitec_dpd_cashondelivery_surcharge', 0);
$amount = $order->getOrder()->getData('zitec_dpd_cashondelivery_surcharge');
$order->setData('zitec_dpd_cashondelivery_surcharge', $amount);
$amount = $order->getOrder()->getData('base_zitec_dpd_cashondelivery_surcharge');
$order->setData('base_zitec_dpd_cashondelivery_surcharge', $amount);
$order->setGrandTotal($order->getGrandTotal() + $order->getData('zitec_dpd_cashondelivery_surcharge'));
$order->setBaseGrandTotal($order->getBaseGrandTotal() + $order->getData('base_zitec_dpd_cashondelivery_surcharge'));
return $this;
}
示例6: insertSplitPayment
/**
*
* @param Mage_Sales_Model_Order $order
* @param Allopass_Hipay_Model_PaymentProfile|int $profile $profile
*/
public function insertSplitPayment($order, $profile, $customerId, $cardToken)
{
if (is_int($profile)) {
$profile = Mage::getModel('hipay/paymentProfile')->load($profile);
}
if (!$this->splitPaymentsExists($order->getId())) {
$paymentsSplit = $this->splitPayment($profile, $order->getBaseGrandTotal());
//remove first element because is already paid
array_shift($paymentsSplit);
//remove last element because the first split is already paid
//array_pop($paymentsSplit);
foreach ($paymentsSplit as $split) {
$splitPayment = Mage::getModel('hipay/splitPayment');
$data = array('order_id' => $order->getId(), 'real_order_id' => (int) $order->getRealOrderId(), 'customer_id' => $customerId, 'card_token' => $cardToken, 'total_amount' => $order->getBaseGrandTotal(), 'amount_to_pay' => $split['amountToPay'], 'date_to_pay' => $split['dateToPay'], 'method_code' => $order->getPayment()->getMethod(), 'status' => Allopass_Hipay_Model_SplitPayment::SPLIT_PAYMENT_STATUS_PENDING);
$splitPayment->setData($data);
try {
$splitPayment->save();
} catch (Exception $e) {
Mage::throwException("Error on save split payments!");
}
}
}
}
示例7: _saveInvoice
/**
* Saves an invoice and sets total-paid for the order
*
* @return bool
*/
protected function _saveInvoice()
{
if ($this->_order->canInvoice() && !$this->_order->hasInvoices()) {
$payment = $this->_order->getPayment();
$payment->registerCaptureNotification($this->_order->getBaseGrandTotal());
$this->_order->save();
$this->_debugEmail .= 'Invoice created and saved. \\n';
//sets the invoice's transaction ID as the Buckaroo TRX. This is to allow the order to be refunded using Buckaroo later on.
foreach ($this->_order->getInvoiceCollection() as $invoice) {
if (!isset($this->_postArray['brq_transactions'])) {
continue;
}
$invoice->setTransactionId($this->_postArray['brq_transactions'])->save();
}
return true;
}
return false;
}
示例8: getAmount
/**
* Get the amount of the order in cents, make sure that we return the right value even if the locale is set to
* something different than the default (e.g. nl_NL).
*
* @param Mage_Sales_Model_Order $order
* @return int
*/
protected function getAmount(Mage_Sales_Model_Order $order)
{
if ($order->getBaseCurrencyCode() === 'EUR') {
$grand_total = $order->getBaseGrandTotal();
} elseif ($order->getOrderCurrencyCode() === 'EUR') {
$grand_total = $order->getGrandTotal();
} else {
Mage::log(__METHOD__ . ' said: Neither Base nor Order currency is in Euros.');
Mage::throwException(__METHOD__ . ' said: Neither Base nor Order currency is in Euros.');
}
if (is_string($grand_total)) {
$locale_info = localeconv();
if ($locale_info['decimal_point'] !== '.') {
$grand_total = strtr($grand_total, array($locale_info['thousands_sep'] => '', $locale_info['decimal_point'] => '.'));
}
$grand_total = floatval($grand_total);
// Why U NO work with locales?
}
return floatval(round($grand_total, 2));
}
示例9: salesOrderPaymentPlaceEnd
/**
* Process the seamless Payment after Order is complete
*
* @param Varien_Event_Observer $observer
*
* @throws Exception
* @return Phoenix_WirecardCheckoutPage_Model_Observer
*/
public function salesOrderPaymentPlaceEnd(Varien_Event_Observer $observer)
{
/**
* @var Phoenix_WirecardCheckoutPage_Model_Abstract
*/
$payment = $observer->getPayment();
$this->_order = $payment->getOrder();
$storeId = $this->_order->getStoreId();
$paymentInstance = $payment->getMethodInstance();
if (Mage::getStoreConfigFlag('payment/' . $payment->getMethod() . '/useSeamless', $storeId)) {
$storageId = $payment->getAdditionalData();
$orderIdent = $this->_order->getQuoteId();
$customerId = Mage::getStoreConfig('payment/' . $payment->getMethod() . '/customer_id', $storeId);
$shopId = Mage::getStoreConfig('payment/' . $payment->getMethod() . '/shop_id', $storeId);
$secretKey = Mage::getStoreConfig('payment/' . $payment->getMethod() . '/secret_key', $storeId);
$serviceUrl = Mage::getUrl(Mage::getStoreConfig('payment/' . $payment->getMethod() . '/service_url', $storeId));
$paymentType = $this->_getMappedPaymentCode($payment->getMethod());
$returnurl = Mage::getUrl('wirecard_checkout_page/processing/checkresponse', array('_secure' => true, '_nosid' => true));
$pluginVersion = WirecardCEE_Client_QPay_Request_Initiation::generatePluginVersion('Magento', Mage::getVersion(), $paymentInstance->getPluginName(), $paymentInstance->getPluginVersion());
$initiation = new WirecardCEE_Client_QPay_Request_Initiation($customerId, $shopId, $secretKey, substr(Mage::app()->getLocale()->getLocaleCode(), 0, 2), $pluginVersion);
$consumerData = new WirecardCEE_Client_QPay_Request_Initiation_ConsumerData();
if (Mage::getStoreConfigFlag('payment/' . $payment->getMethod() . '/send_additional_data', $storeId)) {
$consumerData->setEmail($this->_order->getCustomerEmail());
$dob = $payment->getMethodInstance()->getCustomerDob();
if ($dob) {
$consumerData->setBirthDate($dob);
}
$consumerData->addAddressInformation($this->_getBillingObject());
if ($this->_order->hasShipments()) {
$consumerData->addAddressInformation($this->_getShippingObject());
}
}
if ($payment->getMethod() == 'wirecard_checkout_page_invoice' || $payment->getMethod() == 'wirecard_checkout_page_installment') {
$consumerData->setEmail($this->_order->getCustomerEmail());
$dob = $payment->getMethodInstance()->getCustomerDob();
if ($dob) {
$consumerData->setBirthDate($dob);
} else {
throw new Exception('Invalid dob');
}
$consumerData->addAddressInformation($this->_getBillingObject('invoice'));
}
$consumerData->setIpAddress($this->_order->getRemoteIp());
$consumerData->setUserAgent(Mage::app()->getRequest()->getServer('HTTP_USER_AGENT'));
$initiation->setConfirmUrl(Mage::getUrl('wirecard_checkout_page/processing/seamlessConfirm', array('_secure' => true, '_nosid' => true)));
$initiation->setWindowName('paymentIframe');
$initiation->orderId = $this->_order->getIncrementId();
$initiation->companyTradeRegistryNumber = $payment->getMethodInstance()->getCompanyTradeRegistrationNumber();
if ($orderIdent && $storageId) {
$initiation->setStorageReference($orderIdent, $storageId);
}
if (Mage::getStoreConfigFlag('payment/' . $payment->getMethod() . '/auto_deposit', $storeId)) {
$initiation->setAutoDeposit(true);
}
$initiation->setOrderReference($this->_order->getIncrementId());
$financialInstitution = $payment->getMethodInstance()->getFinancialInstitution();
if ($financialInstitution) {
$initiation->setFinancialInstitution($financialInstitution);
}
Phoenix_WirecardCheckoutPage_Helper_Configuration::configureWcsLibrary();
$response = $initiation->initiate(round($this->_order->getBaseGrandTotal(), 2), $this->_order->getBaseCurrencyCode(), $paymentType, $this->_order->getIncrementId(), $returnurl, $returnurl, $returnurl, $returnurl, $serviceUrl, $consumerData);
if (isset($response) && $response->getStatus() == WirecardCEE_Client_QPay_Response_Initiation::STATE_SUCCESS) {
$payment->setAdditionalData(serialize($payment->getAdditionalData()))->save();
Mage::getSingleton('core/session')->unsetData('wirecard_checkout_page_payment_info');
Mage::getSingleton('core/session')->setWirecardCheckoutPageRedirectUrl(urldecode($response->getRedirectUrl()));
} elseif (isset($response)) {
$errorMessage = '';
foreach ($response->getErrors() as $error) {
$errorMessage .= ' ' . $error->getMessage();
}
throw new Exception(trim($errorMessage));
} else {
$payment->setAdditionalData(serialize($payment->getAdditionalData()))->save();
Mage::getSingleton('core/session')->unsetData('wirecard_checkout_page_payment_info');
}
}
return $this;
}
示例10: _isOrderPaidNow
/**
* Check if order is paid exactly now
* If order was paid before Rewards were enabled, reward points should not be added
*
* @param Mage_Sales_Model_Order $order
* @return bool
*/
protected function _isOrderPaidNow($order)
{
$isOrderPaid = (double) $order->getBaseTotalPaid() > 0 && $order->getBaseGrandTotal() - $order->getBaseSubtotalCanceled() - $order->getBaseTotalPaid() < 0.0001;
if (!$order->getOrigData('base_grand_total')) {
//New order with "Sale" payment action
return $isOrderPaid;
}
return $isOrderPaid && $order->getOrigData('base_grand_total') - $order->getOrigData('base_subtotal_canceled') - $order->getOrigData('base_total_paid') >= 0.0001;
}
示例11: getMandatoryRequestFields
/**
* Returns the mandatory fields for requests to Barclaycard
*
* @param Mage_Sales_Model_Order $order
*
* @return array
*/
public function getMandatoryRequestFields(Mage_Sales_Model_Order $order)
{
$payment = $order->getPayment()->getMethodInstance();
$formFields = array();
$formFields['PSPID'] = $this->getConfig()->getPSPID($order->getStoreId());
$formFields['AMOUNT'] = Mage::helper('ops')->getAmount($order->getBaseGrandTotal());
$formFields['CURRENCY'] = Mage::app()->getStore()->getBaseCurrencyCode();
$formFields['ORDERID'] = Mage::helper('ops/order')->getOpsOrderId($order);
$formFields['LANGUAGE'] = Mage::app()->getLocale()->getLocaleCode();
$formFields['PM'] = $payment->getOpsCode($order->getPayment());
$formFields['EMAIL'] = $order->getCustomerEmail();
$formFields['ACCEPTURL'] = $this->getConfig()->getAcceptUrl();
$formFields['DECLINEURL'] = $this->getConfig()->getDeclineUrl();
$formFields['EXCEPTIONURL'] = $this->getConfig()->getExceptionUrl();
$formFields['CANCELURL'] = $this->getConfig()->getCancelUrl();
$formFields['BACKURL'] = $this->getConfig()->getCancelUrl();
return $formFields;
}
示例12: toQuoteShippingAddress
/**
* Convert order to shipping address
*
* @param Mage_Sales_Model_Order $order
* @return Mage_Sales_Model_Quote_Address
*/
public function toQuoteShippingAddress(Mage_Sales_Model_Order $order)
{
$address = $this->addressToQuoteAddress($order->getShippingAddress());
$address->setWeight($order->getWeight())->setShippingMethod($order->getShippingMethod())->setShippingDescription($order->getShippingDescription())->setShippingRate($order->getShippingRate())->setSubtotal($order->getSubtotal())->setTaxAmount($order->getTaxAmount())->setDiscountAmount($order->getDiscountAmount())->setShippingAmount($order->getShippingAmount())->setGiftcertAmount($order->getGiftcertAmount())->setCustbalanceAmount($order->getCustbalanceAmount())->setGrandTotal($order->getGrandTotal())->setBaseSubtotal($order->getBaseSubtotal())->setBaseTaxAmount($order->getBaseTaxAmount())->setBaseDiscountAmount($order->getBaseDiscountAmount())->setBaseShippingAmount($order->getBaseShippingAmount())->setBaseGiftcertAmount($order->getBaseGiftcertAmount())->setBaseCustbalanceAmount($order->getBaseCustbalanceAmount())->setBaseGrandTotal($order->getBaseGrandTotal());
return $address;
}
示例13: addInterestToOrder
/**
* Add interest to order
*/
protected function addInterestToOrder(Mage_Sales_Model_Order $order, $interest)
{
$mundipaggInterest = $order->getMundipaggInterest();
$setInterest = (double) ($mundipaggInterest + $interest);
$order->setMundipaggInterest($setInterest ? $setInterest : 0);
$order->setMundipaggBaseInterest($setInterest ? $setInterest : 0);
$order->setGrandTotal($order->getGrandTotal() + $interest);
$order->setBaseGrandTotal($order->getBaseGrandTotal() + $interest);
$order->save();
// $info = $this->getInfoInstance();
// $info->setPaymentInterest(($info->getPaymentInterest()+$setInterest));
// $info->save();
}
示例14: redirectAction
public function redirectAction()
{
$logActivo = Mage::getStoreConfig('payment/redsys/logactivo', Mage::app()->getStore());
//Obtenemos los valores de la configuración del módulo
$entorno = Mage::getStoreConfig('payment/redsys/entorno', Mage::app()->getStore());
$nombre = Mage::getStoreConfig('payment/redsys/nombre', Mage::app()->getStore());
$codigo = Mage::getStoreConfig('payment/redsys/num', Mage::app()->getStore());
$clave256 = Mage::getStoreConfig('payment/redsys/clave256', Mage::app()->getStore());
$terminal = Mage::getStoreConfig('payment/redsys/terminal', Mage::app()->getStore());
$moneda = Mage::getStoreConfig('payment/redsys/moneda', Mage::app()->getStore());
$trans = Mage::getStoreConfig('payment/redsys/trans', Mage::app()->getStore());
$notif = Mage::getStoreConfig('payment/redsys/notif', Mage::app()->getStore());
$ssl = Mage::getStoreConfig('payment/redsys/ssl', Mage::app()->getStore());
$error = Mage::getStoreConfig('payment/redsys/error', Mage::app()->getStore());
$idiomas = Mage::getStoreConfig('payment/redsys/idiomas', Mage::app()->getStore());
$tipopago = Mage::getStoreConfig('payment/redsys/tipopago', Mage::app()->getStore());
$correo = Mage::getStoreConfig('payment/redsys/correo', Mage::app()->getStore());
$mensaje = Mage::getStoreConfig('payment/redsys/mensaje', Mage::app()->getStore());
//Obtenemos datos del pedido
$_order = new Mage_Sales_Model_Order();
$orderId = Mage::getSingleton('checkout/session')->getLastRealOrderId();
$_order->loadByIncrementId($orderId);
//Actualizamos estado del pedido a "pendiente"
//INI MOD #7506
//Si se modifica el estado aquí el pedido vuelve a pending cuando el usuario
//pulsa el botón de atrás de su navegador
// $state = 'new';
// $status = 'pending';
// $comment = 'Redsys ha actualizado el estado del pedido con el valor "' . $status . '"';
// $isCustomerNotified = true;
// $_order->setState($state, $status, $comment, $isCustomerNotified);
// $_order->save();
//FIN MOD #7506
//Datos del cliente
$customer = Mage::getSingleton('customer/session')->getCustomer();
//Datos de los productos del pedido
$productos = '';
$items = $_order->getAllVisibleItems();
foreach ($items as $itemId => $item) {
$productos .= $item->getName();
$productos .= "X" . $item->getQtyToInvoice();
$productos .= "/";
}
//Formateamos el precio total del pedido
$transaction_amount = number_format($_order->getBaseGrandTotal(), 2, '', '');
//Establecemos los valores del cliente y el pedido
$numpedido = str_pad($orderId, 12, "0", STR_PAD_LEFT);
$cantidad = (double) $transaction_amount;
$titular = $customer->getFirstname() . " " . $customer->getMastname() . " " . $customer->getLastname() . "/ Correo:" . $customer->getEmail();
//Generamos el urlTienda -> respuesta ON-LINE que deberá ser la establecida bajo las pautas de WooCommerce
if ($ssl == "0") {
$urltienda = Mage::getBaseUrl() . 'redsys/index/notify';
} else {
$urltienda = Mage::getBaseUrl() . 'redsys/index/notify';
}
// INI MOD #7375
$urlok = Mage::getBaseUrl() . 'redsys/index/success';
$urlko = Mage::getBaseUrl() . 'redsys/index/cancel';
// FIN MOD #7375
//
// Obtenemos el valor de la config del idioma
if ($idiomas == "0") {
$idioma_tpv = "0";
} else {
$idioma_web = substr(Mage::getStoreConfig('general/locale/code', Mage::app()->getStore()->getId()), 0, 2);
switch ($idioma_web) {
case 'es':
$idioma_tpv = '001';
break;
case 'en':
$idioma_tpv = '002';
break;
case 'ca':
$idioma_tpv = '003';
break;
case 'fr':
$idioma_tpv = '004';
break;
case 'de':
$idioma_tpv = '005';
break;
case 'nl':
$idioma_tpv = '006';
break;
case 'it':
$idioma_tpv = '007';
break;
case 'sv':
$idioma_tpv = '008';
break;
case 'pt':
$idioma_tpv = '009';
break;
case 'pl':
$idioma_tpv = '011';
break;
case 'gl':
$idioma_tpv = '012';
break;
case 'eu':
//.........这里部分代码省略.........
示例15: getItemParams
/**
* return item params for the order
* for each item a ascending number will be added to the parameter name
*
* @param Mage_Sales_Model_Order $order
*
* @return array
*/
public function getItemParams(Mage_Sales_Model_Order $order)
{
$formFields = array();
$items = $order->getAllItems();
$subtotal = 0;
if (is_array($items)) {
$itemCounter = 1;
foreach ($items as $item) {
if ($item->getParentItemId()) {
continue;
}
$subtotal += $item->getBasePriceInclTax() * $item->getQtyOrdered();
$formFields['ITEMFDMPRODUCTCATEG' . $itemCounter] = $this->getKwixoCategoryFromOrderItem($item);
$formFields['ITEMID' . $itemCounter] = $item->getItemId();
$formFields['ITEMNAME' . $itemCounter] = substr($item->getName(), 0, 40);
$formFields['ITEMPRICE' . $itemCounter] = number_format($item->getBasePriceInclTax(), 2, '.', '');
$formFields['ITEMQUANT' . $itemCounter] = (int) $item->getQtyOrdered();
$formFields['ITEMVAT' . $itemCounter] = str_replace(',', '.', (string) (double) $item->getBaseTaxAmount());
$formFields['TAXINCLUDED' . $itemCounter] = 1;
$itemCounter++;
}
$shippingPrice = $order->getBaseShippingAmount();
$shippingPriceInclTax = $order->getBaseShippingInclTax();
$subtotal += $shippingPriceInclTax;
$shippingTaxAmount = $shippingPriceInclTax - $shippingPrice;
$roundingError = $order->getBaseGrandTotal() - $subtotal;
$shippingPrice += $roundingError;
/* add shipping item */
$formFields['ITEMFDMPRODUCTCATEG' . $itemCounter] = 1;
$formFields['ITEMID' . $itemCounter] = 'SHIPPING';
$shippingDescription = 0 < strlen(trim($order->getShippingDescription())) ? $order->getShippingDescription() : 'shipping';
$formFields['ITEMNAME' . $itemCounter] = substr($shippingDescription, 0, 30);
$formFields['ITEMPRICE' . $itemCounter] = number_format($shippingPrice, 2, '.', '');
$formFields['ITEMQUANT' . $itemCounter] = 1;
$formFields['ITEMVAT' . $itemCounter] = number_format($shippingTaxAmount, 2, '.', '');
}
return $formFields;
}