本文整理汇总了PHP中pmpro_isLevelRecurring函数的典型用法代码示例。如果您正苦于以下问题:PHP pmpro_isLevelRecurring函数的具体用法?PHP pmpro_isLevelRecurring怎么用?PHP pmpro_isLevelRecurring使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了pmpro_isLevelRecurring函数的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: process
function process(&$order)
{
//check for initial payment
if (floatval($order->InitialPayment) == 0) {
//just subscribe
return $this->subscribe($order);
} else {
//charge then subscribe
if ($this->charge($order)) {
if (pmpro_isLevelRecurring($order->membership_level)) {
if ($this->subscribe($order)) {
//yay!
return true;
} else {
//try to refund initial charge
return false;
}
} else {
//only a one time charge
$order->status = "success";
//saved on checkout page
return true;
}
} else {
if (empty($order->error)) {
$order->error = __("Unknown error: Initial payment failed.", "pmpro");
}
return false;
}
}
}
开发者ID:Seravo,项目名称:wp-paid-subscriptions,代码行数:31,代码来源:class.pmprogateway_stripe.php
示例2: process
function process(&$order)
{
if (pmpro_isLevelRecurring($order->membership_level)) {
$order->ProfileStartDate = date("Y-m-d", strtotime("+ " . $order->BillingFrequency . " " . $order->BillingPeriod)) . "T0:0:0";
$order->ProfileStartDate = apply_filters("pmpro_profile_start_date", $order->ProfileStartDate, $order);
return $this->subscribe($order);
} else {
return $this->charge($order);
}
}
开发者ID:danielcoats,项目名称:schoolpress,代码行数:10,代码来源:class.pmprogateway_paypalexpress.php
示例3: process
function process(&$order)
{
if (floatval($order->InitialPayment) == 0) {
//auth first, then process
$authorization_id = $this->authorize($order);
if ($authorization_id) {
$this->void($order, $authorization_id);
$order->ProfileStartDate = date("Y-m-d", strtotime("+ " . $order->BillingFrequency . " " . $order->BillingPeriod, current_time("timestamp"))) . "T0:0:0";
$order->ProfileStartDate = apply_filters("pmpro_profile_start_date", $order->ProfileStartDate, $order);
return $this->subscribe($order);
} else {
if (empty($order->error)) {
$order->error = __("Unknown error: Authorization failed.", "pmpro");
}
return false;
}
} else {
//charge first payment
if ($this->charge($order)) {
//setup recurring billing
if (pmpro_isLevelRecurring($order->membership_level)) {
$order->ProfileStartDate = date("Y-m-d", strtotime("+ " . $order->BillingFrequency . " " . $order->BillingPeriod, current_time("timestamp"))) . "T0:0:0";
$order->ProfileStartDate = apply_filters("pmpro_profile_start_date", $order->ProfileStartDate, $order);
if ($this->subscribe($order)) {
return true;
} else {
if ($this->void($order, $order->payment_transaction_id)) {
if (empty($order->error)) {
$order->error = __("Unknown error: Payment failed.", "pmpro");
}
} else {
if (empty($order->error)) {
$order->error = __("Unknown error: Payment failed.", "pmpro");
}
$order->error .= " " . __("A partial payment was made that we could not refund. Please contact the site owner immediately to correct this.", "pmpro");
}
return false;
}
} else {
//only a one time charge
$order->status = "success";
//saved on checkout page
$order->saveOrder();
return true;
}
}
}
}
开发者ID:Tanya-atsocial,项目名称:paid-memberships-pro,代码行数:48,代码来源:class.pmprogateway_payflowpro.php
示例4: sornot
?>
:</strong> <?php
echo $level->billing_limit . ' ' . sornot($level->cycle_period, $level->billing_limit);
?>
</li>
<?php
}
?>
</ul>
<?php
}
?>
<?php
if (pmpro_isLevelRecurring($level)) {
?>
<?php
if ($show_paypal_link) {
?>
<p><?php
_e('Your payment subscription is managed by PayPal. Please <a href="http://www.paypal.com">login to PayPal here</a> to update your billing information.', 'pmpro');
?>
</p>
<?php
} else {
?>
<form class="pmpro_form" action="<?php
开发者ID:6226,项目名称:wp,代码行数:31,代码来源:billing.php
示例5: cancel
function cancel(&$order)
{
// If recurring, stop the recurring payment
if (pmpro_isLevelRecurring($order->membership_level)) {
$params['sale_id'] = $order->payment_transaction_id;
$result = Twocheckout_Sale::stop($params);
// Stop the recurring billing
// Successfully cancelled
if (isset($result['response_code']) && $result['response_code'] === 'OK') {
$order->updateStatus("cancelled");
return true;
} else {
$order->status = "error";
$order->errorcode = $result->getCode();
$order->error = $result->getMessage();
return false;
}
}
return $order;
}
开发者ID:srinivasulurao,项目名称:transcharity,代码行数:20,代码来源:class.pmprogateway_twocheckout.php
示例6: _e
</a>
-->
<a class="pmpro_btn pmpro_btn-select change-subscription" href="<?php
echo "/billing/subscription-checkout?level=" . $level->id;
?>
"><?php
_e('Select Plan', 'pmpro');
?>
</a>
<?php
} elseif ($current_level) {
?>
<?php
//if it's a one-time-payment level, offer a link to renew
if (!pmpro_isLevelRecurring($current_user->membership_level) && !empty($current_user->membership_level->enddate)) {
?>
<a class="pmpro_btn pmpro_btn-select renew" href="<?php
echo pmpro_url("checkout", "?level=" . $level->id, "https");
?>
"><?php
_e('Renew', 'pmpro');
?>
</a>
<?php
} else {
?>
<a class="pmpro_btn disabled your-current-level" href="<?php
echo pmpro_url("account");
?>
"><?php
开发者ID:TakenCdosG,项目名称:admissionsrevolution_new,代码行数:31,代码来源:levels.php
示例7: pmpro_url
<a class="pmpro_btn pmpro_btn-select" href="<?php
echo pmpro_url("checkout", "?level=" . $level->id, "https");
?>
"><?php
_e('Select', 'pmpro');
?>
</a>
<?php
} elseif ($current_level) {
?>
<?php
//if it's a one-time-payment level, offer a link to renew
if (!pmpro_isLevelRecurring($current_user->membership_level)) {
?>
<a class="pmpro_btn pmpro_btn-select" href="<?php
echo pmpro_url("checkout", "?level=" . $level->id, "https");
?>
"><?php
_e('Renew', 'pmpro');
?>
</a>
<?php
} else {
?>
<a class="pmpro_btn disabled" href="<?php
echo pmpro_url("account");
?>
"><?php
开发者ID:danielcoats,项目名称:schoolpress,代码行数:30,代码来源:levels.php
示例8: if
foreach($levels as $level)
{
?>
<tr class="<?php if(!$level->allow_signups) { ?>pmpro_gray<?php } ?> <?php if(!pmpro_checkLevelForStripeCompatibility($level) || !pmpro_checkLevelForBraintreeCompatibility($level) || !pmpro_checkLevelForPayflowCompatibility($level)) { ?>pmpro_error<?php } ?>">
<td><?php echo $level->id?></td>
<td><?php echo $level->name?></td>
<td>
<?php if(pmpro_isLevelFree($level)) { ?>
FREE
<?php } else { ?>
<?php echo $pmpro_currency_symbol?><?php echo $level->initial_payment?>
<?php } ?>
</td>
<td>
<?php if(!pmpro_isLevelRecurring($level)) { ?>
--
<?php } else { ?>
<?php echo $pmpro_currency_symbol?><?php echo $level->billing_amount?> every <?php echo $level->cycle_number.' '.sornot($level->cycle_period,$level->cycle_number)?>
<?php if($level->billing_limit) { ?>(for <?php echo $level->billing_limit?> <?php echo sornot($level->cycle_period,$level->billing_limit)?>)<?php } ?>
<?php } ?>
</td>
<td>
<?php if(!pmpro_isLevelTrial($level)) { ?>
--
<?php } else { ?>
<?php echo $pmpro_currency_symbol?><?php echo $level->trial_amount?> for <?php echo $level->trial_limit?> <?php echo sornot("payment",$level->trial_limit)?>
<?php } ?>
</td>
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:30,代码来源:membershiplevels.php
示例9: sendToMigs
function sendToMigs(&$order)
{
global $pmpro_currency;
//$order_id = $order->code;
//taxes on initial amount
$initial_payment = $order->InitialPayment;
$initial_payment_tax = $order->getTaxForPrice($initial_payment);
$initial_payment = round((double) $initial_payment + (double) $initial_payment_tax, 2);
$details = '';
//taxes on the amount (NOT CURRENTLY USED)
$amount = $order->PaymentAmount;
$amount_tax = $order->getTaxForPrice($amount);
$amount = round((double) $amount + (double) $amount_tax, 2);
// Recurring membership
if (pmpro_isLevelRecurring($order->membership_level)) {
$amount = number_format($initial_payment - $amount, 2, ".", "");
//negative amount for lower initial payments
$recurring_payment = number_format($order->membership_level->billing_amount, 2, ".", "");
$recurring_payment_tax = number_format($order->getTaxForPrice($recurring_payment), 2, ".", "");
$recurring_payment = number_format(round((double) $recurring_payment + (double) $recurring_payment_tax, 2), 2, ".", "");
$amount = number_format($recurring_payment, 2, ".", "");
$details = $order->BillingFrequency == 1 ? $order->BillingFrequency . ' ' . $order->BillingPeriod : $order->BillingFrequency . ' ' . $order->BillingPeriod . 's';
if (property_exists($order, 'TotalBillingCycles')) {
$details = $order->BillingFrequency * $order->TotalBillingCycles . ' ' . $order->BillingPeriod;
} else {
$details = 'Forever';
}
} else {
$amount = number_format($initial_payment, 2, ".", "");
}
if (!empty($order->TrialBillingPeriod)) {
$trial_amount = $order->TrialAmount;
$trial_tax = $order->getTaxForPrice($trial_amount);
$trial_amount = pmpro_formatPrice(round((double) $trial_amount + (double) $trial_tax, 2), false, false);
$amount = $trial_amount;
// Negative trial amount
}
global $pmpro_level;
//create a code for the order
if (empty($order->code)) {
$order->code = $order->getRandomCode();
}
//what amount to charge?
$amount = $order->InitialPayment;
//tax
$order->subtotal = $amount;
$tax = $order->getTax(true);
$amount = round((double) $order->subtotal + (double) $tax, 2);
//create a customer
//$result = $this->getCustomer($order);
/*if(empty($result))
{
//failed to create customer
return false;
}*/
//charge
try {
$order_id = $order->code;
$order_amount = 100 * $amount;
$md5Hash = pmpro_getOption("securehashe");
/* Make sure user entered MIGS url, otherwise use the default one */
if (trim($this->service_host) == "" || $this->service_host == null) {
$this->service_host = "https://migs.mastercard.com.au/vpcpay";
}
$service_host = $this->service_host . "?";
$rurl = admin_url("admin-ajax.php") . "?action=migspaymenthandler";
//$rurl='https://nibaya.com/ccc/wp-content/plugins/pmpro-example-gateway/classes/paymenthandler.php?';
//$rurl = pmpro_url("confirmation", "?level=" . $order->membership_level);
$user_ID = get_current_user_id();
$DigitalOrder = array("vpc_Version" => "1", "vpc_Command" => "pay", "vpc_AccessCode" => pmpro_getOption("accescodee"), "vpc_MerchTxnRef" => $order_id . '_' . date("Y-m-d"), "vpc_Merchant" => pmpro_getOption("merchantide"), "vpc_OrderInfo" => $order_id . '_' . date("Y-m-d"), "vpc_Amount" => $order_amount, "vpc_Locale" => "en", "vpc_ReturnURL" => $rurl . '&level=1');
ksort($DigitalOrder);
foreach ($DigitalOrder as $key => $value) {
if (strlen($value) > 0) {
if ($appendAmp == 0) {
$service_host .= urlencode($key) . '=' . urlencode($value);
$appendAmp = 1;
} else {
$service_host .= '&' . urlencode($key) . "=" . urlencode($value);
}
$md5Hash .= $value;
}
}
$service_host .= "&vpc_SecureHash=" . strtoupper(md5($md5Hash));
//$order->saveOrder();
//echo $service_host;
header("Location:" . $service_host);
exit;
} catch (Exception $e) {
//$order->status = "error";
$order->errorcode = true;
$order->error = "Error: " . $e->getMessage();
$order->shorterror = $order->error;
return false;
}
//$order->saveOrder();
//echo $service_host;
//header("Location:".$service_host);
//exit();
// Demo mode?
// if(empty($order->gateway_environment))
//.........这里部分代码省略.........
开发者ID:Madu-rosh,项目名称:MIGS-for-paid-membership-pro,代码行数:101,代码来源:class.pmprogateway_migs.php
示例10: getLevels
//.........这里部分代码省略.........
if (empty($current_user->membership_level->ID)) {
?>
<a class="pmpro_btn pmpro_btn-select sign-up" href="<?php
echo pmpro_url("checkout", "?level=" . $level->id, "https");
?>
"><?php
_e('Sign Up', 'pmpro');
?>
</a>
<?php
} elseif (!$current_level) {
?>
<!--
<a class="pmpro_btn pmpro_btn-select" href="<?php
//echo pmpro_url("checkout", "?level=" . $level->id, "https")
?>
"><?php
//_e('Change Subscription', 'pmpro');
?>
</a>
-->
<a class="pmpro_btn pmpro_btn-select change-subscription" href="<?php
echo "/billing/subscription-checkout?level=" . $level->id;
?>
"><?php
_e('Change Subscription', 'pmpro');
?>
</a>
<?php
} elseif ($current_level) {
?>
<?php
//if it's a one-time-payment level, offer a link to renew
if (!pmpro_isLevelRecurring($current_user->membership_level) && !empty($current_user->membership_level->enddate)) {
?>
<a class="pmpro_btn pmpro_btn-select renew" href="<?php
echo pmpro_url("checkout", "?level=" . $level->id, "https");
?>
"><?php
_e('Renew', 'pmpro');
?>
</a>
<?php
} else {
?>
<a class="pmpro_btn disabled your-current-level" href="<?php
echo pmpro_url("account");
?>
"><?php
_e('Your Current Level', 'pmpro');
?>
</a>
<?php
}
?>
<?php
}
?>
</div>
</div>
<?php
}
?>
<div class="clear clearfix"></div>
<nav id="nav-below" class="navigation" role="navigation">
<div class="nav-previous alignleft">
<?php
if (!empty($current_user->membership_level->ID)) {
?>
<!--
<a href="<?php
echo pmpro_url("account");
?>
"><?php
_e('← Return to Your Account', 'pmpro');
?>
</a>
-->
<?php
} else {
?>
<a href="<?php
echo home_url();
?>
"><?php
_e('← Return to Home', 'pmpro');
?>
</a>
<?php
}
?>
</div>
</nav>
</div>
</div>
<?php
}
开发者ID:TakenCdosG,项目名称:admissionsrevolution_new,代码行数:101,代码来源:shortcode.php
示例11: memberlite_levels_shortcode
//.........这里部分代码省略.........
</td>
<?php
}
?>
<td>
<?php
if (empty($current_user->membership_level->ID)) {
?>
<a class="pmpro_btn pmpro_btn-select" href="<?php
echo pmpro_url("checkout", "?level=" . $level->id, "https");
?>
"><?php
echo $checkout_button;
?>
</a>
<?php
} elseif (!$current_level) {
?>
<a class="pmpro_btn pmpro_btn-select" href="<?php
echo pmpro_url("checkout", "?level=" . $level->id, "https");
?>
"><?php
echo $checkout_button;
?>
</a>
<?php
} elseif ($current_level) {
?>
<?php
//if it's a one-time-payment level, offer a link to renew
if (!pmpro_isLevelRecurring($current_user->membership_level) && !empty($current_user->membership_level->enddate)) {
?>
<a class="pmpro_btn pmpro_btn-select" href="<?php
echo pmpro_url("checkout", "?level=" . $level->id, "https");
?>
"><?php
echo $renew_button;
?>
</a>
<?php
} else {
?>
<a class="pmpro_btn disabled" href="<?php
echo pmpro_url("account");
?>
"><?php
echo $account_button;
?>
</a>
<?php
}
?>
<?php
}
?>
</td>
</tr>
<?php
}
?>
</tbody>
</table>
开发者ID:greathmaster,项目名称:memberlite,代码行数:67,代码来源:levels.php
示例12: pmpropbc_isMemberPending
function pmpropbc_isMemberPending($user_id)
{
global $pmpropbc_pending_member_cache;
//check the cache first
if (isset($pmpropbc_pending_member_cache[$user_id])) {
return $pmpropbc_pending_member_cache[$user_id];
}
//no cache, assume they aren't pending
$pmpropbc_pending_member_cache[$user_id] = false;
//check their last order
$order = new MemberOrder();
$order->getLastMemberOrder($user_id, NULL);
//NULL here means any status
if (!empty($order)) {
if ($order->status == "pending") {
//for recurring levels, we should check if there is an older successful order
$membership_level = pmpro_getMembershipLevelForUser($user_id);
if (pmpro_isLevelRecurring($membership_level)) {
//unless the previous order has status success and we are still within the grace period
$paid_order = new MemberOrder();
$paid_order->getLastMemberOrder($user_id, 'success', $order->membership_id);
if (!empty($paid_order) && !empty($paid_order->id)) {
//how long ago is too long?
$options = pmpropbc_getOptions($membership_level->id);
$cutoff = strtotime("- " . $membership_level->cycle_number . " " . $membership_level->cycle_period, current_time("timestamp")) - $options['cancel_days'] * 3600 * 24;
//too long ago?
if ($paid_order->timestamp < $cutoff) {
$pmpropbc_pending_member_cache[$user_id] = true;
} else {
$pmpropbc_pending_member_cache[$user_id] = false;
}
} else {
//no previous order, this must be the first
$pmpropbc_pending_member_cache[$user_id] = true;
}
} else {
//one time payment, so only interested in the last payment
$pmpropbc_pending_member_cache[$user_id] = true;
}
}
}
return $pmpropbc_pending_member_cache[$user_id];
}
开发者ID:eighty20results,项目名称:pmpro-pay-by-check,代码行数:43,代码来源:pmpro-pay-by-check.php
示例13: pmpro_shortcode_account
function pmpro_shortcode_account($atts, $content = null, $code = "")
{
global $wpdb, $pmpro_msg, $pmpro_msgt, $pmpro_levels, $current_user, $levels;
// $atts ::= array of attributes
// $content ::= text within enclosing form of shortcode element
// $code ::= the shortcode found, when == callback name
// examples: [pmpro_account] [pmpro_account sections="membership,profile"/]
extract(shortcode_atts(array('section' => '', 'sections' => 'membership,profile,invoices,links'), $atts));
//did they use 'section' instead of 'sections'?
if (!empty($section)) {
$sections = $section;
}
//Extract the user-defined sections for the shortcode
$sections = array_map('trim', explode(",", $sections));
ob_start();
//if a member is logged in, show them some info here (1. past invoices. 2. billing information with button to update.)
if (pmpro_hasMembershipLevel()) {
$ssorder = new MemberOrder();
$ssorder->getLastMemberOrder();
$mylevels = pmpro_getMembershipLevelsForUser();
$pmpro_levels = pmpro_getAllLevels(false, true);
// just to be sure - include only the ones that allow signups
$invoices = $wpdb->get_results("SELECT *, UNIX_TIMESTAMP(timestamp) as timestamp FROM {$wpdb->pmpro_membership_orders} WHERE user_id = '{$current_user->ID}' AND status NOT IN('refunded', 'review', 'token', 'error') ORDER BY timestamp DESC LIMIT 6");
?>
<div id="pmpro_account">
<?php
if (in_array('membership', $sections) || in_array('memberships', $sections)) {
?>
<div id="pmpro_account-membership" class="pmpro_box">
<h3><?php
_e("My Memberships", "pmpro");
?>
</h3>
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<thead>
<tr>
<th><?php
_e("Level", "pmpro");
?>
</th>
<th><?php
_e("Billing", "pmpro");
?>
</th>
<th><?php
_e("Expiration", "pmpro");
?>
</th>
</tr>
</thead>
<tbody>
<?php
foreach ($mylevels as $level) {
?>
<tr>
<td class="pmpro_account-membership-levelname">
<?php
echo $level->name;
?>
<div class="pmpro_actionlinks">
<?php
do_action("pmpro_member_action_links_before");
?>
<?php
if (array_key_exists($level->id, $pmpro_levels) && pmpro_isLevelExpiringSoon($level)) {
?>
<a href="<?php
echo pmpro_url("checkout", "?level=" . $level->id, "https");
?>
"><?php
_e("Renew", "pmpro");
?>
</a>
<?php
}
?>
<?php
if (isset($ssorder->status) && $ssorder->status == "success" && (isset($ssorder->gateway) && in_array($ssorder->gateway, array("authorizenet", "paypal", "stripe", "braintree", "payflow", "cybersource"))) && pmpro_isLevelRecurring($level)) {
?>
<a href="<?php
echo pmpro_url("billing", "", "https");
?>
"><?php
_e("Update Billing Info", "pmpro");
?>
</a>
<?php
}
?>
<?php
//To do: Only show CHANGE link if this level is in a group that has upgrade/downgrade rules
if (count($pmpro_levels) > 1 && !defined("PMPRO_DEFAULT_LEVEL")) {
?>
<a href="<?php
echo pmpro_url("levels");
//.........这里部分代码省略.........
开发者ID:uwmadisoncals,项目名称:Cluster-Plugins,代码行数:101,代码来源:pmpro_account.php
示例14: if
}
?>
</select>
<br /><small>The amount to be billed one cycle after the initial payment.</small>
</td>
</tr>
<tr class="recurring_info" <?php if(!pmpro_isLevelRecurring($level)) {?>style="display: none;"<?php } ?>>
<th scope="row" valign="top"><label for="billing_limit">Billing Cycle Limit:</label></th>
<td>
<input name="billing_limit[]" type="text" size="20" value="<?php echo $level->billing_limit?>" />
<br /><small>The <strong>total</strong> number of billing cycles for this level, including the trial period (if applicable). Set to zero if membership is indefinite.</small>
</td>
</tr>
<tr class="recurring_info" <?php if (!pmpro_isLevelRecurring($level)) echo "style='display:none;'";?>>
<th scope="row" valign="top"><label>Custom Trial:</label></th>
<td><input id="custom_trial_<?php echo $level->id?>" name="custom_trial[]" type="checkbox" value="<?php echo $level->id?>" <?php if ( pmpro_isLevelTrial($level) ) { echo "checked='checked'"; } ?> onclick="if(jQuery(this).attr('checked')) jQuery(this).parent().parent().siblings('.trial_info').show(); else jQuery(this).parent().parent().siblings('.trial_info').hide();" /> Check to add a custom trial period.</td>
</tr>
<tr class="trial_info recurring_info" <?php if (!pmpro_isLevelTrial($level)) echo "style='display:none;'";?>>
<th scope="row" valign="top"><label for="trial_amount">Trial Billing Amount:</label></th>
<td>
<?php echo $pmpro_currency_symbol?><input name="trial_amount[]" type="text" size="20" value="<?php echo str_replace("\"", """, stripslashes($level->trial_amount))?>" />
<small>for the first</small>
<input name="trial_limit[]" type="text" size="10" value="<?php echo str_replace("\"", """, stripslashes($level->trial_limit))?>" />
<small>subscription payments.</small>
</td>
</tr>
<tr>
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:31,代码来源:discountcodes.php
示例15: process
function process(&$order)
{
//clean up a couple values
$order->payment_type = "Check";
$order->CardType = "";
$order->cardtype = "";
//check for initial payment
if(floatval($order->InitialPayment) == 0)
{
//auth first, then process
if($this->authorize($order))
{
$this->void($order);
if(!pmpro_isLevelTrial($order->membership_level))
{
//subscription will start today with a 1 period trial
$order->ProfileStartDate = date("Y-m-d") . "T0:0:0";
$order->TrialBillingPeriod = $order->BillingPeriod;
$order->TrialBillingFrequency = $order->BillingFrequency;
$order->TrialBillingCycles = 1;
$order->TrialAmount = 0;
//add a billing cycle to make up for the trial, if applicable
if(!empty($order->TotalBillingCycles))
$order->TotalBillingCycles++;
}
elseif($order->InitialPayment == 0 && $order->TrialAmount == 0)
{
//it has a trial, but the amount is the same as the initial payment, so we can squeeze it in there
$order->ProfileStartDate = date("Y-m-d") . "T0:0:0";
$order->TrialBillingCycles++;
//add a billing cycle to make up for the trial, if applicable
if($order->TotalBillingCycles)
$order->TotalBillingCycles++;
}
else
{
//add a period to the start date to account for the initial payment
$order->ProfileStartDate = date("Y-m-d", strtotime("+ " . $order->BillingFrequency . " " . $order->BillingPeriod)) . "T0:0:0";
}
$order->ProfileStartDate = apply_filters("pmpro_profile_start_date", $order->ProfileStartDate, $order);
return $this->subscribe($order);
}
else
{
if(empty($order->error))
$order->error = "Unknown error: Authorization failed.";
return false;
}
}
else
{
//charge first payment
if($this->charge($order))
{
//setup recurring billing
if(pmpro_isLevelRecurring($order->membership_level))
{
if(!pmpro_isLevelTrial($order->membership_level))
{
//subscription will start today with a 1 period trial
$order->ProfileStartDate = date("Y-m-d") . "T0:0:0";
$order->TrialBillingPeriod = $order->BillingPeriod;
$order->TrialBillingFrequency = $order->BillingFrequency;
$order->TrialBillingCycles = 1;
$order->TrialAmount = 0;
//add a billing cycle to make up for the trial, if applicable
if(!empty($order->TotalBillingCycles))
$order->TotalBillingCycles++;
}
elseif($order->InitialPayment == 0 && $order->TrialAmount == 0)
{
//it has a trial, but the amount is the same as the initial payment, so we can squeeze it in there
$order->ProfileStartDate = date("Y-m-d") . "T0:0:0";
$order->TrialBillingCycles++;
//add a billing cycle to make up for the trial, if applicable
if(!empty($order->TotalBillingCycles))
$order->TotalBillingCycles++;
}
else
{
//add a period to the start date to account for the initial payment
$order->ProfileStartDate = date("Y-m-d", strtotime("+ " . $this->BillingFrequency . " " . $this->BillingPeriod)) . "T0:0:0";
}
$order->ProfileStartDate = apply_filters("pmpro_profile_start_date", $order->ProfileStartDate, $order);
if($this->subscribe($order))
{
return true;
}
else
{
if($this->void($order))
{
if(!$order->error)
//.........这里部分代码省略.........
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:101,代码来源:class.pmprogateway_check.php
示例16: sendToTwocheckout
function sendToTwocheckout(&$order)
{
global $pmpro_currency;
$tco_args = array('sid' => pmpro_getOption("twocheckout_accountnumber"), 'mode' => '2CO', 'li_0_type' => 'product', 'li_0_name' => substr($order->membership_level->name . " at " . get_bloginfo("name"), 0, 127), 'li_0_quantity' => 1, 'li_0_tangible' => 'N', 'li_0_product_id' => $order->code, 'merchant_order_id' => $order->code, 'currency_code' => $pmpro_currency, 'pay_method' => 'CC', 'purchase_step' => 'billing-information', 'x_receipt_link_url' => admin_url("admin-ajax.php") . "?action=twocheckout-ins");
//taxes on initial amount
$initial_payment = $order->InitialPayment;
$initial_payment_tax = $order->getTaxForPrice($initial_payment);
$initial_payment = round((double) $initial_payment + (double) $initial_payment_tax, 2);
//taxes on the amount (NOT CURRENTLY USED)
$amount = $order->PaymentAmount;
$amount_tax = $order->getTaxForPrice($amount);
$amount = round((double) $amount + (double) $amount_tax, 2);
// Recurring membership
if (pmpro_isLevelRecurring($order->membership_level)) {
$tco_args['li_0_startup_fee'] = number_format($initial_payment - $amount, 2, ".", "");
//negative amount for lower initial payments
$recurring_payment = number_format($order->membership_level->billing_amount, 2, ".", "");
$recurring_payment_tax = number_format($order->getTaxForPrice($recurring_payment), 2, ".", "");
$recurring_payment = number_format(round((double) $recurring_payment + (double) $recurring_payment_tax, 2), 2, ".", "");
$tco_args['li_0_price'] = number_format($recurring_payment, 2, ".", "");
$tco_args['li_0_recurrence'] = $order->BillingFrequency == 1 ? $order->BillingFrequency . ' ' . $order->BillingPeriod : $order->BillingFrequency . ' ' . $order->BillingPeriod . 's';
if (property_exists($order, 'TotalBillingCycles')) {
$tco_args['li_0_duration'] = $order->BillingFrequency * $order->TotalBillingCycles . ' ' . $order->BillingPeriod;
} else {
$tco_args['li_0_duration'] = 'Forever';
}
} else {
$tco_args['li_0_price'] = number_format($initial_payment, 2, ".", "");
}
// Demo mode?
if (empty($order->gateway_environment)) {
$gateway_environment = pmpro_getOption("gateway_environment");
} else {
$gateway_environment = $order->gateway_environment;
}
if ("sandbox" === $gateway_environment || "beta-sandbox" === $gateway_environment) {
Twocheckout::sandbox(true);
$tco_args['demo'] = 'Y';
} else {
Twocheckout::sandbox(false);
}
// Trial?
//li_#_startup_fee Any start up fees for the product or service. Can be negative to provide discounted first installment pricing, but cannot equal or surpass the product price.
if (!empty($order->TrialBillingPeriod)) {
$trial_amount = $order->TrialAmount;
$trial_tax = $order->getTaxForPrice($trial_amount);
$trial_amount = pmpro_formatPrice(round((double) $trial_amount + (double) $trial_tax, 2), false, false);
$tco_args['li_0_startup_fee'] = $trial_amount;
// Negative trial amount
}
$ptpStr = '';
foreach ($tco_args as $key => $value) {
reset($tco_args);
// Used to verify whether or not we're on the first argument
$ptpStr .= $key == key($tco_args) ? '?' . $key . '=' . urlencode($value) : '&' . $key . '=' . urlencode($value);
}
//anything modders might add
$additional_parameters = apply_filters('pmpro_twocheckout_return_url_parameters', array());
if (!empty($additional_parameters)) {
foreach ($additional_parameters as $key => $value) {
$ptpStr .= "&" . urlencode($key) . "=" . urlencode($value);
}
}
$ptpStr = apply_filters('pmpro_twocheckout_ptpstr', $ptpStr, $order);
///useful for debugging
///echo str_replace("&", "&<br />", $ptpStr);
///exit;
//figure out gateway environment and URL to use
if ($gateway_environment == "live") {
$host = "www.2checkout.com";
} else {
$host = "sandbox.2checkout.com";
}
$tco_url = 'https://' . $host . '/checkout/purchase' . $ptpStr;
//redirect to 2checkout
wp_redirect($tco_url);
exit;
}
开发者ID:MediaPreneur,项目名称:paid-memberships-pro,代码行数:78,代码来源:class.pmprogateway_twocheckout.php
示例17: sendToPayPal
function sendToPayPal(&$order)
{
global $pmpro_currency;
//taxes on initial amount
$initial_payment = $order->InitialPayment;
$initial_payment_tax = $order->getTaxForPrice($initial_payment);
$initial_payment = round((double) $initial_payment + (double) $initial_payment_tax, 2);
//taxes on the amount
$amount = $order->PaymentAmount;
$amount_tax = $order->getTaxForPrice($amount);
$amount = round((double) $amount + (double) $amount_tax, 2);
//build PayPal Redirect
$environment = pmpro_getOption("gateway_environment");
if ("sandbox" === $environment || "beta-sandbox" === $environment) {
$paypal_url = "https://www.sandbox.paypal.com/cgi-bin/webscr?business=" . urlencode(pmpro_getOption("gateway_email"));
} else {
$paypal_url = "https://www.paypal.com/cgi-bin/webscr?business=" . urlencode(pmpro_getOption("gateway_email"));
}
if (pmpro_isLevelRecurring($order->membership_level)) {
//convert billing period
if ($order->BillingPeriod == "Day") {
$period = "D";
} elseif ($o
|
请发表评论