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


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怎么用?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;
 }
开发者ID:marcoescudeiro,项目名称:clickpag-magento,代码行数:46,代码来源:Standard.php


示例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;
 }
开发者ID:payin7-payments,项目名称:payin7-magento,代码行数:21,代码来源:Payin7daysPaymentMethod.php



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