本文整理汇总了PHP中Mage_Payment_Model_Method_Abstract::order方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Payment_Model_Method_Abstract::order方法的具体用法?PHP Mage_Payment_Model_Method_Abstract::order怎么用?PHP Mage_Payment_Model_Method_Abstract::order使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Payment_Model_Method_Abstract
的用法示例。
在下文中一共展示了Mage_Payment_Model_Method_Abstract::order方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: order
/**
* @param Varien_Object $payment
* @param float $amount
*
* @return $this
*/
public function order(Varien_Object $payment, $amount)
{
parent::order($payment, $amount);
/** @var Mage_Sales_Model_Order_Payment $payment */
$order = $payment->getOrder();
/** @var Rede_ClickPag_Model_Processor $processor */
$processor = $this->_processor();
$processor->setOrder($order);
$validation = $this->_validateOrderParameters($processor->getOrderParams());
if ($validation !== true) {
Mage::throwException($validation);
}
$this->getApi()->request();
$body = $this->getApi()->getBody();
if ($this->getApi()->getResult()->getStatus() !== 201) {
$errors = array();
foreach ($body as $error) {
$errors[] = $this->_helper()->__($error['message']);
}
Mage::throwException(implode("\n", $errors));
}
if (!isset($body['id']) || empty($body['id'])) {
Mage::throwException($this->_helper()->__('Some error has occurred when trying to process your payment.'));
}
/** @var Rede_ClickPag_Model_Payments $payments */
$payments = Mage::getModel('rede_clickpag/payments');
$payments->setOrderId($order->getId());
$payments->setOrderIncrementId($order->getIncrementId());
$payments->setPaymentId($body['id']);
try {
$payments->save();
$this->_getSession()->setLastTransaction($payments);
$this->_getCheckoutSession()->setData('payment_id', $payments->getPaymentId());
} catch (Exception $e) {
Mage::logException($e);
$this->_logger()->finishTransactionLog($order->getRealOrderId());
Mage::throwException($this->_helper()->__('Some error occurred when trying to save the payment data.'));
}
return $this;
}
示例2: order
/**
* Order payment abstract method
*
* @param Mage_Sales_Model_Order_Payment|Varien_Object $payment
* @param float $amount
* @return Payin7_Payments_Model_Payin7daysPaymentMethod
*/
public function order(Varien_Object $payment, $amount)
{
parent::order($payment, $amount);
/** @var Payin7_Payments_Helper_Data $phelper */
$phelper = Mage::helper('payin7payments');
$order = $payment->getOrder();
// if it's a sandbox order mark it as such
$is_sandbox = $phelper->getApiSandboxEnabled();
if ($is_sandbox) {
$order->setData('payin7_sandbox_order', true);
}
$this->_callPostOrder($order);
return $this;
}