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


PHP Mage_Payment_Model_Info::getOrder方法代码示例

本文整理汇总了PHP中Mage_Payment_Model_Info::getOrder方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Payment_Model_Info::getOrder方法的具体用法?PHP Mage_Payment_Model_Info::getOrder怎么用?PHP Mage_Payment_Model_Info::getOrder使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Mage_Payment_Model_Info的用法示例。


在下文中一共展示了Mage_Payment_Model_Info::getOrder方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: _processFailureMultitransactionAction

 /**
  * Process exceptions for gateway action with a lot of transactions
  *
  * @param  Mage_Payment_Model_Info $payment
  * @param  string $messages
  * @param  bool $isSuccessfulTransactions
  */
 protected function _processFailureMultitransactionAction($payment, $messages, $isSuccessfulTransactions)
 {
     if ($isSuccessfulTransactions) {
         $messages[] = Mage::helper('paygate')->__('Gateway actions are locked because the gateway cannot complete one or more of the transactions. Please log in to your Authorize.Net account to manually resolve the issue(s).');
         /**
          * If there is successful transactions we can not to cancel order but
          * have to save information about processed transactions in order`s comments and disable
          * opportunity to voiding\capturing\refunding in future. Current order and payment will not be saved because we have to
          * load new order object and set information into this object.
          */
         $currentOrderId = $payment->getOrder()->getId();
         $copyOrder = Mage::getModel('sales/order')->load($currentOrderId);
         $copyOrder->getPayment()->setAdditionalInformation($this->_isGatewayActionsLockedKey, 1);
         foreach ($messages as $message) {
             $copyOrder->addStatusHistoryComment($message);
         }
         $copyOrder->save();
     }
     Mage::throwException(Mage::helper('paygate')->convertMessagesToMessage($messages));
 }
开发者ID:par-orillonsoft,项目名称:magento_work,代码行数:27,代码来源:Authorizenet.php

示例2: collectPayment

 public function collectPayment(\Mage_Payment_Model_Info $payment, $amount, $capture = true)
 {
     $Currency = Mage::app()->getStore()->getBaseCurrencyCode();
     require_once MAGENTO_ROOT . '/lib/Start/autoload.php';
     # At the top of your PHP file
     $token = isset($_POST['payfortToken']) ? $_POST['payfortToken'] : false;
     $email = isset($_POST['payfortEmail']) ? $_POST['payfortEmail'] : false;
     if (!$token || !$email) {
         //this block will be executed if the order was authorized earlier and now trying to capture amount
         $token_array = $payment->getAdditionalInformation('token');
         $token = $token_array['token'];
         $email = $token_array['email'];
     }
     if (!$token || !$email) {
         Mage::throwException('Invalid Token');
     }
     $currency = !isset($Currency) ? 'AED' : $Currency;
     if (file_exists(MAGENTO_ROOT . '/data/currencies.json')) {
         $currency_json_data = json_decode(file_get_contents(MAGENTO_ROOT . '/data/currencies.json'), 1);
         $currency_multiplier = $currency_json_data[$currency];
     } else {
         $currency_multiplier = 100;
     }
     $amount_in_cents = $amount * $currency_multiplier;
     $order = $payment->getOrder();
     $order_items_array_full = array();
     foreach ($order->getAllVisibleItems() as $value) {
         $order_items_array['title'] = $value->getName();
         $order_items_array['amount'] = round($value->getPrice(), 2) * $currency_multiplier;
         $order_items_array['quantity'] = $value->getQtyOrdered();
         array_push($order_items_array_full, $order_items_array);
     }
     $shipping_amount = $order->getShippingAmount();
     $shipping_amount = $shipping_amount * $currency_multiplier;
     if (Mage::getSingleton('customer/session')->isLoggedIn()) {
         $customer = Mage::getSingleton('customer/session')->getCustomer();
         $username = $customer->getName();
         $registered_at = date(DATE_ISO8601, strtotime($customer->getCreatedAt()));
     } else {
         $username = "Guest";
         $registered_at = date(DATE_ISO8601, strtotime(date("Y-m-d H:i:s")));
     }
     $billing_data = $order->getBillingAddress()->getData();
     if (is_object($order->getShippingAddress())) {
         $shipping_data = $order->getShippingAddress()->getData();
         $shipping_address = array("first_name" => $shipping_data['firstname'], "last_name" => $shipping_data['lastname'], "country" => $shipping_data['country_id'], "city" => $shipping_data['city'], "address" => $shipping_data['customer_address'], "phone" => $shipping_data['telephone'], "postcode" => $shipping_data['postcode']);
     } else {
         $shipping_address = array();
     }
     $billing_address = array("first_name" => $billing_data['firstname'], "last_name" => $billing_data['lastname'], "country" => $billing_data['country_id'], "city" => $billing_data['city'], "address" => $billing_data['customer_address'], "phone" => $billing_data['telephone'], "postcode" => $billing_data['postcode']);
     $shopping_cart_array = array('user_name' => $username, 'registered_at' => $registered_at, 'items' => $order_items_array_full, 'billing_address' => $billing_address, 'shipping_address' => $shipping_address);
     $orderId = Mage::getSingleton('checkout/session')->getLastRealOrderId();
     $charge_args = array('description' => "Magento charge for " . $email, 'card' => $token, 'currency' => $currency, 'email' => $email, 'ip' => $_SERVER['REMOTE_ADDR'], 'amount' => $amount_in_cents, 'capture' => $capture, 'shipping_amount' => $shipping_amount, 'shopping_cart' => $shopping_cart_array, 'metadata' => array('reference_id' => $orderId));
     $ver = new Mage();
     $version = $ver->getVersion();
     $userAgent = 'Magento ' . $version . ' / Start Plugin ' . self::PLUGIN_VERSION;
     Start::setUserAgent($userAgent);
     $method = $payment->getMethodInstance();
     if ($method->getConfigData('test_mode') == 1) {
         Start::setApiKey($method->getConfigData('test_secret_key'));
     } else {
         Start::setApiKey($method->getConfigData('live_secret_key'));
     }
     try {
         // Charge the token
         $charge = Start_Charge::create($charge_args);
         //need to process charge as success or failed
         $payment->setTransactionId($charge["id"]);
         if ($capture) {
             $payment->setIsTransactionClosed(1);
         } else {
             $payment->setIsTransactionClosed(0);
         }
     } catch (Start_Error $e) {
         $error_code = $e->getErrorCode();
         if ($error_code === "card_declined") {
             $errorMsg = 'Charge was declined. Please, contact you bank for more information or use a different card.';
         } else {
             $errorMsg = $e->getMessage();
         }
         throw new Mage_Payment_Model_Info_Exception($errorMsg);
     }
     //need to process charge as success or failed
 }
开发者ID:payfort,项目名称:magento,代码行数:84,代码来源:Paymentmethod.php

示例3: _formatPrice

 /**
  * Format price with currency sign
  * @param  Mage_Payment_Model_Info $payment
  * @param float $amount
  * @return string
  */
 protected function _formatPrice($payment, $amount)
 {
     return $payment->getOrder()->getBaseCurrency()->formatTxt($amount);
 }
开发者ID:hyhoocchan,项目名称:mage-local,代码行数:10,代码来源:Data.php

示例4: _processFailureMultitransactionAction

 /**
  * Process exceptions for gateway action with a lot of transactions
  *
  * @param  Mage_Payment_Model_Info $payment
  * @param  string $messages
  * @param  bool $isSuccessfulTransactions
  */
 protected function _processFailureMultitransactionAction($payment, $messages, $isSuccessfulTransactions)
 {
     if ($isSuccessfulTransactions) {
         $currentOrderId = $payment->getOrder()->getId();
         $copyOrder = Mage::getModel('sales/order')->load($currentOrderId);
         foreach ($messages as $message) {
             $copyOrder->addStatusHistoryComment($message);
         }
         $copyOrder->save();
     }
     Mage::throwException(Mage::helper('paygate')->convertMessagesToMessage($messages));
 }
开发者ID:ankita-parashar,项目名称:magento,代码行数:19,代码来源:Gorilla_ChasePaymentech_Model_Gateway.php

示例5: _buildFormUrlRequest

 /**
  * Returns request object with needed data for API request to PayPal to get form URL.
  *
  * @param Mage_Payment_Model_Info $payment
  * @return Mage_Paypal_Model_Hostedpro_Request
  */
 protected function _buildFormUrlRequest(Mage_Payment_Model_Info $payment)
 {
     $request = $this->_buildBasicRequest()->setOrder($payment->getOrder())->setPaymentMethod($this);
     return $request;
 }
开发者ID:hazaeluz,项目名称:magento_connect,代码行数:11,代码来源:Hostedpro.php

示例6: _validateCountry

 /**
  * Validate payment method is allowed for the customer's billing address country.
  * @param Mage_Payment_Model_Info $info
  * @return self
  */
 protected function _validateCountry(Mage_Payment_Model_Info $info)
 {
     /**
      * Get the order when dealing with an order payment, quote otherwise.
      * @see Mage_Payment_Model_Method_Abstract
      */
     if ($info instanceof Mage_Sales_Model_Order_Payment) {
         $billingCountry = $info->getOrder()->getBillingAddress()->getCountryId();
     } else {
         $billingCountry = $info->getQuote()->getBillingAddress()->getCountryId();
     }
     if (!$this->canUseForCountry($billingCountry)) {
         throw Mage::exception('EbayEnterprise_CreditCard', $this->_helper->__(self::METHOD_NOT_ALLOWED_FOR_COUNTRY));
     }
     return $this;
 }
开发者ID:WinstonN,项目名称:magento-retail-order-management,代码行数:21,代码来源:Ccpayment.php

示例7: _void

 /**
  * Send void request to MerchantWare gateway
  *
  * @param Mage_Payment_Model_Info $payment
  * @return $result
  * @throws Mage_Core_Exception
  */
 private function _void($payment)
 {
     $error = false;
     $soapClient = $this->getSoapApi();
     $this->iniRequest();
     //Add token
     if ($payment->getParentTransactionId() !== FALSE) {
         $this->_request->token = $payment->getParentTransactionId();
     } else {
         //Cannot void
         $error = Mage::helper('merchantware_directpost')->__('No previous transactions could be found.  Cannot void this transaction.');
         Mage::throwException($error);
     }
     //Add order info
     $order = $payment->getOrder();
     $this->_request->merchantTransactionId = $order->getIncrementId();
     $additionalInfo = array();
     try {
         $result = $soapClient->Void($this->_request);
         $result = $result->VoidResult;
         if (!empty($result->ErrorMessage)) {
             $additionalInfo['ErrorMessage'] = $result->ErrorMessage;
         }
         //Authorization is approved.
         $additionalInfo['ApprovalStatus'] = $result->ApprovalStatus;
         $additionalInfo['Amount'] = $result->Amount;
         $additionalInfo['AuthorizationCode'] = $result->AuthorizationCode;
         if (!empty($result->Cardholder)) {
             $additionalInfo['Cardholder'] = $result->Cardholder;
         }
         if (!empty($result->AvsResponse)) {
             $additionalInfo['AvsResponse'] = $result->AvsResponse;
         }
         if (!empty($result->CvResponse)) {
             $additionalInfo['CvResponse'] = $result->AvsResponse;
         }
         $additionalInfo['CardType'] = $result->CardType;
         if (!empty($result->InvoiceNumber)) {
             $additionalInfo['InvoiceNumber'] = $result->InvoiceNumber;
         }
         $additionalInfo['Token'] = $result->Token;
         $additionalInfo['TransactionDate'] = $result->TransactionDate;
         $additionalInfo['TransactionType'] = $result->TransactionType;
         if (!empty($result->ExtraData)) {
             $additionalInfo['ExtraData'] = $result->ExtraData;
         }
         switch ($this->_parseApprovalStatus($result->ApprovalStatus)) {
             case self::APPROVAL_STATUS_APPROVED:
                 //Void Approved.
                 $message = 'Type: Void | ApprovalStatus: ' . $result->ApprovalStatus . ' |  Amount: ' . $result->Amount;
                 $payment->setSkipTransactionCreation(false);
                 $payment->setTransactionId($result->Token)->addTransaction(Mage_Sales_Model_Order_Payment_Transaction::TYPE_VOID, null, false, $message)->setTransactionAdditionalInfo(Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS, $additionalInfo)->setIsTransactionClosed(1)->save();
                 break;
             case self::APPROVAL_STATUS_DECLINED:
             case self::APPROVAL_STATUS_DECLINED_DUPLICATE:
             case self::APPROVAL_STATUS_FAILED:
                 $error = Mage::helper('merchantware_directpost')->__('Void request failed.  Gateway error response: %s', $result->ApprovalStatus, $result->ErrorMessage);
                 Mage::throwException($error);
                 break;
             case self::APPROVAL_STATUS_REFERRAL:
             default:
                 $error = Mage::helper('merchantware_directpost')->__('Unable to void this transaction. Gateway approval status: %s | Gateway error response: %s', $result->ApprovalStatus, $result->ErrorMessage);
                 Mage::throwException($error);
                 break;
         }
         return $result;
     } catch (Exception $e) {
         Mage::throwException(Mage::helper('merchantware_directpost')->__('Gateway request error: %s', $e->getMessage()));
     }
     if ($error !== false) {
         Mage::throwException($error);
     }
     return false;
 }
开发者ID:xiaoguizhidao,项目名称:tyler-live,代码行数:81,代码来源:Directpost.php

示例8: createReversalTransaction

 /**
  * Perform transaction for void/Reversal
  *
  * @param Mage_Payment_Model_Info $payment
  * @return string $directResponse|bool
  */
 public function createReversalTransaction($payment)
 {
     /**
      * Set the order in its own object
      */
     $order = $payment->getOrder();
     $amount = $payment->getAmount() * 100;
     // Must set 100.00 to 10000 per api
     /**
      * Create the transaction
      */
     $data = array('txRefNum' => $payment->getTransId(), 'txRefIdx' => null, 'orderID' => $this->_getUniqueOrderId($payment, $order), 'adjustedAmount' => $amount > 0 ? $amount : null, 'reversalRetryNumber' => null, 'onlineReversalInd' => "N");
     $soap_env = array(self::TRANS_REFUND_TRANS_REQUEST => array_merge($this->_getAuthentication(), $data));
     if (!($response = $this->doCall(self::TRANS_REFUND, $soap_env))) {
         return false;
     }
     $response = $response->return;
     //Mage::log("full response");
     //Mage::log($response);
     /*
     if ($response->error != null) {
         foreach ($response->error as $error) {
             if (strpos($error, self::SOAPFAULT_LOCKED_DOWN)) {
                 $this->debugData($error);
                 $this->c($paymentInfo, $amount);
             } else {
                 //$this->addError($this->_response->procStatusMessage);
                 $this->addError($error);
             }
         }
     }
     */
     $hasErrors = $this->_checkErrors();
     if ($response) {
         if (!$hasErrors) {
             $response->return->respCode = '0';
             // set for successful request (this is not set on a reversal...)
             return $response;
         } else {
             return false;
         }
     } else {
         return false;
     }
 }
开发者ID:ankita-parashar,项目名称:magento,代码行数:51,代码来源:Gorilla_ChasePaymentech_Model_Profile.php

示例9: _getCancelOrderRequest

 /**
  * Builds the base queryOrder object
  *
  * @param Mage_Payment_Model_Info $payment
  * @param $transactionId
  * @return mixed
  */
 protected function _getCancelOrderRequest(Mage_Payment_Model_Info $payment, $transactionId)
 {
     $order = $payment->getOrder();
     $paymentMethodConfig = $this->getSveaStoreConfClass($order->getStoreId());
     $config = new SveaMageConfigProvider($paymentMethodConfig);
     $countryId = $order->getBillingAddress()->getCountryId();
     $request = WebPayAdmin::cancelOrder($config)->setOrderId($transactionId)->setCountryCode($countryId);
     return $request;
 }
开发者ID:LybeAB,项目名称:magento-module,代码行数:16,代码来源:Abstract.php

示例10: fetchTransactionInfo

 /**
  * Retrieve transaction info details
  * @param Mage_Payment_Model_Info $payment
  * @param int $transactionId
  * @return bool
  */
 public function fetchTransactionInfo(Mage_Payment_Model_Info $payment, $transactionId)
 {
     if (!$transactionId) {
         return false;
     }
     $request = $this->_getApiRequest();
     $request->setData('transaction_id', $transactionId)->setData('order_id', $payment->getOrder()->getIncrementId());
     $api = $this->_getApi()->doFetchTransactionInfo($request);
     $this->_importResultToPayment($payment, $api->getResponse());
     $apiResponse = $api->getResponse();
     return $apiResponse;
 }
开发者ID:QiuLihua83,项目名称:magento-enterprise-1.13.1.0,代码行数:18,代码来源:Pbridge.php


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