本文整理汇总了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');
}
}
}
示例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;
}
示例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;
}