本文整理汇总了PHP中product::recurrDates方法的典型用法代码示例。如果您正苦于以下问题:PHP product::recurrDates方法的具体用法?PHP product::recurrDates怎么用?PHP product::recurrDates使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类product
的用法示例。
在下文中一共展示了product::recurrDates方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: round
function bill_checkout($amount, $invoice, $currency_iso, $acct_fields, $total_recurring = false, $recurr_bill_arr = false)
{
# Validate the currency:
if (!$this->validate_currency($currency_iso)) {
return false;
}
# Special JPY formatting:
if ($currency_iso == 'JPY') {
$amount = round($amount);
}
# Get the regular period for this subscription:
$sched = $recurr_bill_arr[0]["recurr_schedule"];
if ($sched == 0) {
$p3 = '1';
$t3 = 'W';
} elseif ($sched == 1) {
$p3 = '1';
$t3 = 'M';
} elseif ($sched == 2) {
$p3 = '3';
$t3 = 'M';
} elseif ($sched == 3) {
$p3 = '6';
$t3 = 'M';
} elseif ($sched == 4) {
$p3 = '1';
$t3 = 'Y';
} elseif ($sched == 5) {
$p3 = '2';
$t3 = 'Y';
}
$url = "https://www.paypal.com/cgi-bin/webscr";
# Get the next bill date for this subscription:
if ($recurr_bill_arr[0]["recurr_type"] == "1") {
# Pro-rate billing:
include_once PATH_MODULES . 'product/product.inc.php';
$product = new product();
$arr = $product->recurrDates($recurr_bill_arr[0]["recurr_schedule"], $recurr_bill_arr[0]["recurr_weekday"], $recurr_bill_arr[0]["recurr_week"]);
$remain_time = $arr['end'] - time();
$period1 = round($remain_time / 86400);
$subscr_date = date("Y-m-d", $arr["end"]);
$vals = array(array('cmd', '_xclick-subscriptions'), array('bn', 'Agileco.AgileBill'), array('business', $this->cfg['email']), array('item_name', "Invoice No:" . $invoice), array('return', $this->success_url . $invoice), array('cancel_return', $this->decline_url . $invoice), array('notify_url', $this->return_url), array('currency_code', $currency_iso), array('invoice', $invoice), array('first_name', $acct_fields['first_name']), array('last_name', $acct_fields['last_name']), array('payer_business_name', $acct_fields['company']), array('address_street', $acct_fields['address1']), array('address_city', $acct_fields['city']), array('address_state', $acct_fields['state']), array('address_zip', $acct_fields['zip']), array('address_country', $acct_fields['country_id']), array('payer_email', $acct_fields['email']), array('payer_id', $acct_fields['id']), array('txn_type', 'subscr_signup'), array('a1', $amount), array('p1', $period1), array('t1', 'D'), array('a3', $total_recurring), array('p3', $p3), array('t3', $t3), array('src', "1"), array('sra', "1"));
} else {
# Bill on anniversary:
$vals = array(array('cmd', '_xclick-subscriptions'), array('business', $this->cfg['email']), array('item_name', "Invoice No:" . $invoice), array('return', $this->success_url . $invoice), array('cancel_return', $this->decline_url . $invoice), array('notify_url', $this->return_url), array('currency_code', $currency_iso), array('invoice', $invoice), array('first_name', $acct_fields['first_name']), array('last_name', $acct_fields['last_name']), array('payer_business_name', $acct_fields['company']), array('address_street', $acct_fields['address1']), array('address_city', $acct_fields['city']), array('address_state', $acct_fields['state']), array('address_zip', $acct_fields['zip']), array('address_country', $acct_fields['country_id']), array('payer_email', $acct_fields['email']), array('payer_id', $acct_fields['id']), array('txn_type', 'subscr_signup'), array('a1', $amount), array('p1', $p3), array('t1', $t3), array('a3', $total_recurring), array('p3', $p3), array('t3', $t3), array('src', "1"), array('sra', "1"));
}
$this->post_vars($url, $vals);
return true;
}
示例2: elseif
function bill_checkout($amount, $invoice, $currency_iso, $acct_fields, $total_recurring = false, $recurr_bill_arr = false)
{
# Get the regular period for this subscription:
$sched = $recurr_bill_arr[0]["recurr_schedule"];
if ($sched == 0) {
$rec_period = '7';
} elseif ($sched == 1) {
$rec_period = '30';
} elseif ($sched == 2) {
$rec_period = '91';
} elseif ($sched == 3) {
$rec_period = '182';
} elseif ($sched == 4) {
$rec_period = '365';
} elseif ($sched == 5) {
return false;
}
$url = "https://www.moneybookers.com/app/payment.pl";
# Get the next bill date for this subscription:
if ($recurr_bill_arr[0]["recurr_type"] == "1") {
# Pro-rate billing:
include_once PATH_MODULES . 'product/product.inc.php';
$product = new product();
$arr = $product->recurrDates($recurr_bill_arr[0]["recurr_schedule"], $recurr_bill_arr[0]["recurr_weekday"], $recurr_bill_arr[0]["recurr_week"]);
$rec_start_date = date("d/m/Y", $arr["end"]);
$end = $arr["end"] + 86400 * 365 * 10;
$rec_end_date = date("d/m/Y", $end);
$vals = array(array('pay_to_email', $this->cfg['account']), array('detail1_description', "Payment For Invoice No. " . $invoice), array('amount', $amount), array('currency', $currency_iso), array('status_url', $this->return_url), array('return_url', $this->success_url . $invoice), array('cancel_url', $this->decline_url . $invoice), array('firstname', $acct_fields["first_name"]), array('lastname', $acct_fields["last_name"]), array('address', $acct_fields["address1"]), array('postal_code', $acct_fields["zip"]), array('city', $acct_fields["city"]), array('state', $acct_fields["state"]), array('transaction_id', $invoice), array('rec_amount', $total_recurring), array('rec_start_date', $rec_start_date), array('rec_end_date', $rec_end_date), array('rec_period', $rec_period));
} else {
# Bill on anniversary:
$rec_start_date = date("d/m/Y", time());
$end = time() + 86400 * 365 * 10;
$rec_end_date = date("d/m/Y", $end);
$vals = array(array('pay_to_email', $this->cfg['account']), array('detail1_description', "Payment For Invoice No. " . $invoice), array('amount', $amount), array('currency', $currency_iso), array('status_url', $this->return_url), array('return_url', $this->success_url), array('cancel_url', $this->decline_url), array('firstname', $acct_fields["first_name"]), array('lastname', $acct_fields["last_name"]), array('address', $acct_fields["address1"]), array('postal_code', $acct_fields["zip"]), array('city', $acct_fields["city"]), array('state', $acct_fields["state"]), array('transaction_id', $invoice), array('rec_amount', $total_recurring), array('rec_start_date', $rec_start_date), array('rec_end_date', $rec_end_date), array('rec_period', $rec_period));
}
$this->post_vars($url, $vals);
return true;
}
示例3: alert
function bill_checkout($amount, $invoice, $currency_iso, $acct_fields, $total_recurring = false, $recurr_bill_arr = false)
{
if (!$this->validate_currency($currency_iso)) {
return false;
}
# Get the regular period for this subscription:
$sched = @$recurr_bill_arr[0]["recurr_schedule"];
if ($sched <= 0) {
echo '<script language=Javascript> alert(\'Sorry, weekly subscriptions are not supported by this payment option!\'); </script>';
return false;
} elseif ($sched == 1) {
$intervalUnit = 3;
$intervalMult = 1;
$start_date = date("Y-m-d", time() + 86400 * 31);
} elseif ($sched == 2) {
$intervalUnit = 3;
$intervalMult = 3;
$start_date = date("Y-m-d", time() + 86400 * 90);
} elseif ($sched == 3) {
$intervalUnit = 3;
$intervalMult = 6;
$start_date = date("Y-m-d", time() + 86400 * 181);
} elseif ($sched == 4) {
$intervalUnit = 4;
$intervalMult = 1;
$start_date = date("Y-m-d", time() + 86400 * 365);
} elseif ($sched == 5) {
$intervalUnit = 4;
$intervalMult = 2;
$start_date = date("Y-m-d", time() + 86400 * 730);
}
$url = "https://select.worldpay.com/wcc/purchase";
# Pro-rated subscriptions:
if ($recurr_bill_arr[0]["recurr_type"] == "1") {
# Pro-rate billing:
include_once PATH_MODULES . 'product/product.inc.php';
$product = new product();
$arr = $product->recurrDates($recurr_bill_arr[0]["recurr_schedule"], $recurr_bill_arr[0]["recurr_weekday"], $recurr_bill_arr[0]["recurr_week"]);
$remain_time = $arr['end'] - time();
$period1 = round($remain_time / 86400);
$start_date = date("Y-m-d", $arr["end"]);
$vals = array(array('instId', $this->cfg['instId']), array('testMode', $this->cfg['testMode']), array('desc', "Invoice No:" . $invoice), array('currency', $currency_iso), array('cartId', $invoice), array('cardname', $acct_fields['first_name'] . ' ' . $acct_fields['last_name']), array('address', $acct_fields['address1'] . ' ' . $acct_fields['address2']), array('city', $acct_fields['city']), array('state', $acct_fields['state']), array('postcode', $acct_fields['zip']), array('country', $acct_fields['country_id']), array('email', $acct_fields['email']), array('MC_callback', $this->return_url), array('MC_invoice', $invoice), array('MC_gw', "B"), array('MC_post_type', 3), array('subst', 'yes'), array('option', 1), array('futurePayType', 'regular'), array('startDate', $start_date), array('intervalMult', $intervalMult), array('intervalUnit', $intervalUnit), array('amount', $amount), array('normalAmount', $total_recurring));
} else {
$vals = array(array('instId', $this->cfg['instId']), array('testMode', $this->cfg['testMode']), array('desc', "Invoice No:" . $invoice), array('currency', $currency_iso), array('cartId', $invoice), array('cardname', $acct_fields['first_name'] . ' ' . $acct_fields['last_name']), array('address', $acct_fields['address1'] . ' ' . $acct_fields['address2']), array('city', $acct_fields['city']), array('state', $acct_fields['state']), array('postcode', $acct_fields['zip']), array('country', $acct_fields['country_id']), array('email', $acct_fields['email']), array('MC_callback', $this->return_url), array('MC_invoice', $invoice), array('MC_gw', "B"), array('MC_post_type', 3), array('subst', 'yes'), array('option', 1), array('futurePayType', 'regular'), array('startDate', $start_date), array('intervalMult', $intervalMult), array('intervalUnit', $intervalUnit), array('amount', $amount), array('normalAmount', $total_recurring));
}
$this->post_vars($url, $vals);
return true;
}