本文整理汇总了PHP中Mage_Sales_Model_Order_Payment::getIsInitialFee方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Sales_Model_Order_Payment::getIsInitialFee方法的具体用法?PHP Mage_Sales_Model_Order_Payment::getIsInitialFee怎么用?PHP Mage_Sales_Model_Order_Payment::getIsInitialFee使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Sales_Model_Order_Payment
的用法示例。
在下文中一共展示了Mage_Sales_Model_Order_Payment::getIsInitialFee方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _buildRequest
protected function _buildRequest(Mage_Sales_Model_Order_Payment $payment, $amount)
{
// Empty Varien_Object's data
$this->unsetData();
// in case recurring profile, $methodInstance is not exist, and $payment->getIsRecurring() is used
if (!$payment->getIsRecurring()) {
$methodInstance = $payment->getMethodInstance();
$infoInstance = $methodInstance->getInfoInstance();
Mage::helper('ewayrapid')->unserializeInfoInstace($infoInstance);
}
$order = $payment->getOrder();
$shipping = $order->getShippingAddress();
$this->setCustomerIP(Mage::helper('core/http')->getRemoteAddr());
if (Mage::helper('ewayrapid')->isBackendOrder()) {
$this->setTransactionType(Eway_Rapid31_Model_Config::TRANSACTION_MOTO);
} elseif ($payment->getIsRecurring()) {
$this->setTransactionType(Eway_Rapid31_Model_Config::TRANSACTION_RECURRING);
} else {
$this->setTransactionType(Eway_Rapid31_Model_Config::TRANSACTION_PURCHASE);
}
$this->setDeviceID('Magento ' . Mage::getEdition() . ' ' . Mage::getVersion());
$this->setShippingMethod('Other');
$paymentParam = Mage::getModel('ewayrapid/field_payment');
$paymentParam->setTotalAmount($amount)->setCurrencyCode($order->getBaseCurrencyCode());
$this->setPayment($paymentParam);
$customerParam = Mage::getModel('ewayrapid/field_customer');
$customerTokenId = null;
/** get $customerTokenId if product is recurring profile */
if ($payment->getIsRecurring()) {
/** @todo save customer id and tokent id into payment when place order */
$customer = Mage::getModel('customer/customer')->load($payment->getCustomerId());
$customerHelper = Mage::helper('ewayrapid/customer');
$customerHelper->setCurrentCustomer($customer);
$customerTokenId = $customerHelper->getCustomerTokenId($payment->getTokenId());
} else {
/** get $customerTokenId if product is normal item */
if ($infoInstance->getSavedToken()) {
$customerHelper = Mage::helper('ewayrapid/customer');
$customerTokenId = $customerHelper->getCustomerTokenId($infoInstance->getSavedToken());
} else {
Mage::throwException(Mage::helper('ewayrapid')->__('An error occurred while making the transaction: Token info does not exist.'));
}
}
if ($customerTokenId) {
$customerParam->setTokenCustomerID($customerTokenId);
if ($this->getTransactionType() == Eway_Rapid31_Model_Config::TRANSACTION_PURCHASE) {
$cardDetails = Mage::getModel('ewayrapid/field_cardDetails');
$cardDetails->setCVN($infoInstance->getCcCid());
$customerParam->setCardDetails($cardDetails);
}
$this->setCustomer($customerParam);
} else {
Mage::throwException(Mage::helper('ewayrapid')->__('An error occurred while making the transaction: Token info does not exist.'));
}
$shippingParam = Mage::getModel('ewayrapid/field_shippingAddress');
$shippingParam->setFirstName($shipping->getFirstname())->setLastName($shipping->getLastname())->setStreet1($shipping->getStreet1())->setStreet2($shipping->getStreet2())->setCity($shipping->getCity())->setState($shipping->getRegion())->setPostalCode($shipping->getPostcode())->setCountry(strtolower($shipping->getCountryModel()->getIso2Code()))->setEmail($shipping->getEmail())->setPhone($shipping->getTelephone())->setFax($shipping->getFax());
$this->setShippingAddress($shippingParam);
if (isset($methodInstance) && $methodInstance->getConfigData('transfer_cart_items') || $payment->getIsRecurring() || !$payment->getIsInitialFee()) {
$orderItems = $order->getAllVisibleItems();
$lineItems = array();
foreach ($orderItems as $orderItem) {
/* @var Mage_Sales_Model_Order_Item $orderItem */
$lineItem = Mage::getModel('ewayrapid/field_lineItem');
$lineItem->setSKU($orderItem->getSku());
$lineItem->setDescription(substr($orderItem->getName(), 0, 26));
$lineItem->setQuantity($orderItem->getQtyOrdered());
$lineItem->setUnitCost(round($orderItem->getBasePrice() * 100));
$lineItem->setTax(round($orderItem->getBaseTaxAmount() * 100));
$lineItem->setTotal(round($orderItem->getBaseRowTotalInclTax() * 100));
$lineItems[] = $lineItem;
}
$this->setItems($lineItems);
}
return $this;
}