本文整理汇总了PHP中Invoice::is_installment_user方法的典型用法代码示例。如果您正苦于以下问题:PHP Invoice::is_installment_user方法的具体用法?PHP Invoice::is_installment_user怎么用?PHP Invoice::is_installment_user使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Invoice
的用法示例。
在下文中一共展示了Invoice::is_installment_user方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_payment_section
public function get_payment_section($userid, $courseid, $slotid, $sum, $renew = null)
{
$list = "";
//echo "Sum inside model: ".$sum."<br>";
if ($userid != NULL) {
$invoice = new Invoice();
$user = $this->get_user_data($userid);
$user->courseid = $courseid;
$user->slotid = $slotid;
$group_status = $this->is_group_member($userid);
$installment_status = $invoice->is_installment_user($userid, $courseid);
if ($installment_status == 0) {
if ($group_status == 0) {
// Personal signup
$group_data = '';
$participants = 1;
$list .= $this->payment->get_payment_section($group_data, $user, $participants, null, 1, $sum, $renew);
} else {
// Group member signup
$group_name = $this->get_user_group($userid);
$group_data = new stdClass();
$group_data->group_name = $group_name;
$group_data->courseid = $courseid;
$participants = 1;
$list .= $this->payment->get_payment_section($group_data, $user, $participants, null, 1, $sum, $renew);
}
// end else
} else {
$installment_obj = $invoice->get_user_installment_payments($userid, $courseid);
$installment = array();
$installment['period'] = 28;
// days
$installment['num_payments'] = $installment_obj->num;
if ($group_status == 0) {
// Personal signup
$group_data = '';
$participants = 1;
$list .= $this->payment->get_payment_section($group_data, $user, $participants, $installment, 1);
} else {
// Group member signup
$group_name = $this->get_user_group($userid);
$group_data = new stdClass();
$group_data->group_name = $group_name;
$group_data->courseid = $courseid;
$participants = 1;
$list .= $this->payment->get_payment_section($group_data, $user, $participants, $installment, 1);
}
// end else
}
// end else when it is installment user
}
// end if $userid != NULL
return $list;
}
示例2: Mailer
function make_stub_payment($card)
{
$list = "";
$mailer = new Mailer();
$invoice = new Invoice();
$user_group = $card->user_group;
$userid = $card->userid;
$item = substr($this->get_course_name($card->courseid), 0, 27);
$cart_type_num = $this->get_card_type($card->card_type);
$user_payment_data = $this->get_user_payment_credentials($card->userid);
// compatible if user does not exist
//$renew_fee = $this->get_renew_fee();
// Make card object compatible with confirmation email
$names = explode(" ", $card->card_holder);
if (count($names) == 2) {
$firstname = $names[0];
$lastname = $names[1];
}
//end if
if (count($names) == 3) {
$firstname = $names[0] . " " . $names[1];
$lastname = $names[2];
}
// end else
$card->email = $user_payment_data->email;
$card->slotid = $this->get_user_slotid($card->courseid, $card->userid);
// compatible if user does not exist
$card->first_name = $firstname;
$card->signup_first = $user_payment_data->firstname;
$card->last_name = $lastname;
$card->signup_last = $user_payment_data->lastname;
$card->phone = $user_payment_data->phone1;
$card->pwd = $user_payment_data->purepwd;
$card->addr = $user_payment_data->address;
$card->city = $user_payment_data->city;
//$card->state = $user_payment_data->state;
$card->zip = $user_payment_data->zip;
$card->country = "US";
$card->payment_amount = $card->sum;
$installment_status = $invoice->is_installment_user($card->userid, $card->courseid);
if ($installment_status == 0) {
// Personal online payment
if ($user_group == '' && $userid > 0) {
$state_code = $this->get_state_code($card->state);
$user_payment_data = $this->get_user_payment_credentials($userid);
$order = new stdClass();
$order->cds_name = "{$firstname}/{$lastname}";
$order->cds_address_1 = $card->bill_addr;
$order->cds_city = $card->bill_city;
$order->cds_state = $state_code;
$order->cds_zip = $card->bill_zip;
$order->cds_email = $card->email;
$order->phone = $user_payment_data->phone1;
$order->cds_pay_type = $cart_type_num;
$order->cds_cc_number = $card->card_no;
$order->cds_cc_exp_month = $card->card_month;
$order->cds_cc_exp_year = $card->card_year;
$order->sum = $card->sum;
$order->cvv = $card->cvv;
// add card cvv code to processor
$order->item = $item;
$order->group = 0;
$pr = new ProcessPayment();
$status = $pr->make_transaction($order);
if ($status === false) {
$list .= "<div class='panel panel-default' id='personal_payment_details'>";
$list .= "<div class='panel-heading'style='text-align:left;'><h5 class='panel-title'>Payment Details</h5></div>";
$list .= "<div class='panel-body'>";
$list .= "<div class='container-fluid' style='text-align:left;'>";
$list .= "<span class='span8'>Transaction failed, please contact your bank for details.</span>";
$list .= "</div>";
$list .= "</div>";
$list .= "</div>";
} else {
$card->transid = $status['trans_id'];
$card->auth_code = $status['auth_code'];
$this->confirm_user($card->email);
$this->add_payment_to_db($card);
// adds payment result to DB
$mailer->send_payment_confirmation_message($card);
$list .= "<div class='panel panel-default' id='personal_payment_details'>";
$list .= "<div class='panel-heading'style='text-align:left;'><h5 class='panel-title'>Payment Details</h5></div>";
$list .= "<div class='panel-body'>";
$list .= "<div class='container-fluid' style='text-align:center;'>";
if ($card->renew > 0) {
$cert = new Certificates2();
$res = $cert->renew_certificate($card->courseid, $card->userid, $card->renew);
if ($res != '') {
$list .= "<span class='span8'>Payment is successful. Thank you! Your certificate has been renewed.</span>";
} else {
$list .= "<span class='span8'>Payment is successful, please contact us to get your updated certificate.</span>";
}
// end else
} else {
$list .= "<span class='span8'>Payment is successful. Thank you! You can print your registration data <a href='https://" . $_SERVER['SERVER_NAME'] . "/lms/custom/invoices/registrations/{$user_payment_data->email}.pdf' target='_blank'>here.</a></span>";
}
// end else
$list .= "</div>";
$list .= "</div>";
$list .= "</div>";
//.........这里部分代码省略.........
示例3: Invoice
function is_user_paid()
{
if ($this->user->id == 11772) {
return 1;
}
// end if $this->user->id==11772
$status = 0;
$courseid = $this->course->id;
$userid = $this->user->id;
$contextid = $this->get_course_context($courseid);
$roleid = $this->get_user_role($userid, $contextid);
if ($roleid <= 3) {
return 1;
} else {
$invoice = new Invoice();
$installment_status = $invoice->is_installment_user($userid, $courseid);
if ($installment_status == 0) {
// 1. Check among card payments
$query = "select * from mdl_card_payments " . "where userid={$userid} and courseid={$courseid} and refunded=0 ";
$card_payments_num = $this->db->numrows($query);
//echo "Card payments num: ".$card_payments_num."<br>";
// 2. Check among invoice payments
$query = "select * from mdl_invoice " . "where userid={$userid} and courseid={$courseid} and i_status=1";
$invoice_payments_num = $this->db->numrows($query);
// 3. Check among partial payments
$query = "select * from mdl_partial_payments " . "where userid={$userid} and courseid={$courseid}";
$partial_num = $this->db->numrows($query);
//4. Check among free access
$query = "select * from mdl_free where userid={$userid}";
$free_num = $this->db->numrows($query);
//5. Check among any invoice payments
$query = "select * from mdl_any_invoice_user where userid={$userid}";
$num = $this->db->numrows($query);
if ($num > 0) {
$result = $this->db->query($query);
while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
$invoiceid = $row['invoiceid'];
}
$query = "select * from mdl_invoice where id={$invoiceid}";
$result = $this->db->query($query);
while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
$db_courseid = $row['courseid'];
}
if ($db_courseid == $courseid) {
$any_invoice_num = 1;
} else {
$any_invoice_num = 0;
}
} else {
$any_invoice_num = 0;
}
if ($card_payments_num > 0 || $invoice_payments_num > 0 || $partial_num > 0 || $free_num > 0 || $any_invoice_num > 0) {
$status = 1;
}
// end if $card_payments_num>0 || $invoice_payments_num>0
} else {
$query = "select * from mdl_installment_users " . "where userid={$userid} " . "and courseid={$courseid} and canceled=0";
$result = $this->db->query($query);
while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
$status = $row['completed'];
// could be 0/1
}
}
// end else when it is installment user
}
// end else
return $status;
}
示例4: Invoice
function send_invoice($courseid, $userid)
{
$list = "";
$file_invoice = new Invoice();
$mailer = new Mailer();
$user = $this->get_user_details($userid);
$user->id = $userid;
$user->first_name = $user->firstname;
$user->last_name = $user->lastname;
$user->courseid = $courseid;
$user->invoice = $file_invoice->create_user_invoice($user, null, 1);
$path = $file_invoice->invoice_path . "/{$user->invoice}.pdf";
$user_installment_status = $file_invoice->is_installment_user($userid, $courseid);
if ($user_installment_status == 0) {
$installment = new stdClass();
$cost = $file_invoice->get_personal_course_cost($courseid);
$sum = $cost['cost'];
$installment->sum = $sum;
} else {
$installment = $file_invoice->get_user_installment_payments($userid, $courseid);
}
// end else
// State taxes section
$tax_status = $this->is_course_taxable($courseid);
if ($tax_status == 1) {
$user_state = $this->get_user_state($userid);
$tax = $this->get_state_taxes($user_state);
} else {
$tax = 0;
}
// end else
if ($tax > 0) {
$tax_sum = round($installment->sum * $tax / 100, 2);
$installment->sum = round($installment->sum + $tax_sum, 2);
}
$query = "insert into mdl_invoice" . "(i_num," . "userid," . "courseid," . "i_sum," . "i_status," . "i_file," . "i_date) " . "values ('" . $user->invoice . "'," . "'" . $userid . "', " . "'" . $courseid . "'," . "'" . $installment->sum . "'," . "'0'," . "'" . $path . "'," . "'" . time() . "')";
$this->db->query($query);
$mailer->send_invoice($user);
$list .= "Invoice has been sent.";
return $list;
}