當前位置: 首頁>>代碼示例>>PHP>>正文


PHP CASHSystem::redirectToUrl方法代碼示例

本文整理匯總了PHP中CASHSystem::redirectToUrl方法的典型用法代碼示例。如果您正苦於以下問題:PHP CASHSystem::redirectToUrl方法的具體用法?PHP CASHSystem::redirectToUrl怎麽用?PHP CASHSystem::redirectToUrl使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在CASHSystem的用法示例。


在下文中一共展示了CASHSystem::redirectToUrl方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: redirectToAsset

 /**
  * Reads asset details and redirects to the file directly. The success
  * Response is set here rather than in processRequest(), allowing it to
  * exist in the session
  *
  * @param {integer} $id - the asset you are trying to retrieve
  * @return string
  */
 protected function redirectToAsset($id, $element_id = 0)
 {
     if ($this->getUnlockedStatus($id)) {
         $asset = $this->getAssetInfo($id);
         $final_asset_location = $this->getFinalAssetLocation($asset['connection_id'], $asset['user_id'], $asset['location']);
         if ($final_asset_location !== false) {
             $this->pushSuccess(array('asset' => $id), 'redirect executed successfully');
             $this->recordAnalytics($id, $element_id);
             CASHSystem::redirectToUrl($final_asset_location);
             die;
         } else {
             return $this->response->pushResponse(500, $this->request_type, $this->action, $this->request, 'unknown asset type, please as an admin to check the asset type');
         }
     }
 }
開發者ID:JamesLinus,項目名稱:platform,代碼行數:23,代碼來源:AssetPlant.php

示例2: initiatePaymentRedirect

 protected function initiatePaymentRedirect($order_id, $element_id = false, $price_addition = 0, $url_only = false, $finalize_url = false, $session_id = false)
 {
     $order_details = $this->getOrder($order_id);
     $transaction_details = $this->getTransaction($order_details['transaction_id']);
     $order_totals = $this->getOrderTotals($order_details['order_contents']);
     $connection_type = $this->getConnectionType($transaction_details['connection_id']);
     $currency = $this->getCurrencyForUser($order_details['user_id']);
     if ($finalize_url) {
         $r = new CASHRequest();
         $r->startSession(false, $session_id);
         $r->sessionSet('payment_finalize_url', $finalize_url);
     }
     if ($order_totals['price'] + $price_addition < 0.35) {
         // basically a zero dollar transaction. hard-coding a 35¢ minimum for now
         // we can add a system minimum later, or a per-connection minimum, etc...
         return 'force_success';
     }
     switch ($connection_type) {
         case 'com.paypal':
             $pp = new PaypalSeed($order_details['user_id'], $transaction_details['connection_id']);
             if (!$finalize_url) {
                 $finalize_url = CASHSystem::getCurrentURL();
             }
             $return_url = $finalize_url . '?cash_request_type=commerce&cash_action=finalizepayment&order_id=' . $order_id . '&creation_date=' . $order_details['creation_date'];
             if ($element_id) {
                 $return_url .= '&element_id=' . $element_id;
             }
             $require_shipping = false;
             $allow_note = false;
             if ($order_details['physical']) {
                 $require_shipping = true;
                 $allow_note = true;
             }
             $redirect_url = $pp->setExpressCheckout($order_totals['price'] + $price_addition, 'order-' . $order_id, $order_totals['description'], $return_url, $return_url, $require_shipping, $allow_note, $currency, 'Sale', false, $price_addition);
             if (!$url_only) {
                 $redirect = CASHSystem::redirectToUrl($redirect_url);
                 // the return will only happen if headers have already been sent
                 // if they haven't redirectToUrl() will handle it and call exit
                 return $redirect;
             } else {
                 return $redirect_url;
             }
             break;
         default:
             return false;
     }
     return false;
 }
開發者ID:jmcclenon,項目名稱:platform,代碼行數:48,代碼來源:CommercePlant.php

示例3: initiatePaymentRedirect

 protected function initiatePaymentRedirect($order_id, $element_id = false)
 {
     $order_details = $this->getOrder($order_id);
     $transaction_details = $this->getTransaction($order_details['transaction_id']);
     $order_totals = $this->getOrderTotals($order_details['order_contents']);
     $connection_type = $this->getConnectionType($transaction_details['connection_id']);
     switch ($connection_type) {
         case 'com.paypal':
             $pp = new PaypalSeed($order_details['user_id'], $transaction_details['connection_id']);
             $return_url = CASHSystem::getCurrentURL() . '?cash_request_type=commerce&cash_action=finalizepayment&order_id=' . $order_id . '&creation_date=' . $order_details['creation_date'];
             if ($element_id) {
                 $return_url .= '&element_id=' . $element_id;
             }
             $redirect_url = $pp->setExpressCheckout($order_totals['price'], 'order-' . $order_id, $order_totals['description'], $return_url, $return_url);
             $redirect = CASHSystem::redirectToUrl($redirect_url);
             // the return will only happen if headers have already been sent
             // if they haven't redirectToUrl() will handle it and call exit
             return $redirect;
             break;
         default:
             return false;
     }
     return $final_redirect;
 }
開發者ID:blacktire,項目名稱:DIY,代碼行數:24,代碼來源:CommercePlant.php


注:本文中的CASHSystem::redirectToUrl方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。