<?php $_SESSION['direct_to_emp'] = "account/"; include_once 'sessioninc.php'; $page2 = return_url(); $invoice_id = $page2[2]; $username = $session->get_username(); $user_id = $session->get_user_id(); $invoice = PackageInvoice::find_invoice($user_id, $invoice_id); $success = $invoice->package_status == "Completed" ? true : false; $smarty->assign('success', $success); $payment_status = $invoice->package_status; $smarty->assign('payment_status', $payment_status); $payment_method = empty($invoice->payment_method) ? "None" : $invoice->payment_method; $smarty->assign('payment_method', $payment_method); $payment_date = "on " . $invoice->payment_method; $smarty->assign('payment_date', $payment_date); $invoice_no = $invoice->id; $smarty->assign('invoice_no', $invoice_no); $invoice_date = strftime(DATE_FORMAT, strtotime($invoice->invoice_date)); $smarty->assign('invoice_date', $invoice_date); $payment_date = $invoice->processed_date == 'null' || $invoice->processed_date == "0000-00-00 00:00:00" ? "" : strftime(DATE_FORMAT, strtotime($invoice->processed_date)); $smarty->assign('payment_date', $payment_date); ///$invoice_to $emp = Employer::find_by_username($username); $invoice_to = $emp->address(); $invoice_to = str_replace(":", "<br />", $invoice_to); $name = $emp->full_name(); $invoice_to = $name . "<br />" . $invoice_to; $smarty->assign('invoice_to', $invoice_to); $payment_to = "Jobberland<br />Address1 <br />Address1<br />Code";
function process_payment($invoice_id = null, $params) { $success = false; $invoice = PackageInvoice::find_by_id($invoice_id); // process payment $clint = Employer::find_by_id($invoice->fk_employer_id); if ($invoice->cv_views == "Y") { $clint->cv_qty = $invoice->posts_quantity; $clint->add_cvs(); $success = true; } if ($invoice->spotlight == "Y") { $clint->spotlight_qty = $invoice->posts_quantity; $clint->add_more_spotlight_job_post(); $success = true; } if ($invoice->standard == "Y") { $clint->job_qty = $invoice->posts_quantity; $clint->add_more_job_post(); $success = true; } else { } if ($success) { $invoice->package_status = 'Completed'; $invoice->processed_date = date("Y-m-d H:i:s", time()); $invoice->update_package_status(); $invoice_item = new Invoice(); /* start **/ /** $param['payment_status'] = ""; //what is the status of the payment $param['amount'] = ""; // how much was paid for this total amount for each item $param['currency'] = ""; //what currecy they used to pay for this $param['receiver_id'] = ""; // what is the id of person who is paying $param['payment_email']; // what email have they used to pay $param['txn_id'] = ""; // txt id $param['txn_type'] = ""; // how are they pay for this web or ext. $param['payer_status'] = ""; //is user verfied by the method they pay from $param['residence_country'] = ""; //which country does user belogn to //$param['origin'] = ""; //where is the payment come from $param['payment_method'] = ""; // what methoid of payment they used e.g. paypal, ccbill $param['payment_vars'] = ""; //get all var which are return from online site. $param['payment_type'] = ""; //how they pay for this $param['reason'] = ""; // if they cancel then tell user why **/ $invoice_item->fk_invoice_id = $invoice_id; $invoice_item->payment_status = $params['payment_status']; $invoice_item->payment_type = $params['payment_type']; $invoice_item->amount = $params['amount']; $invoice_item->currency = $params['currency']; $invoice_item->receiver_id = $params['receiver_id']; $invoice_item->payment_email = $params['payment_email']; $invoice_item->txn_id = $params['txn_id']; $invoice_item->txn_type = $params['txn_type']; $invoice_item->payer_status = $params['payer_status']; $invoice_item->residence_country = $params['residence_country']; $invoice_item->payment_date = date("Y-m-d H:i:s", time()); $invoice_item->reason = $params['reason']; $invoice_item->origin = $params['payment_method']; $invoice_item->payment_vars = $params['payment_vars']; if ($invoice_item->save()) { /** EMAIL TEXT **/ $email_template = get_lang('email_template', 'confirm_order'); $subject = str_replace("#SiteName#", SITE_NAME, $email_template['email_subject']); $body = $email_template['email_text']; $body = str_replace("#FullName#", $clint->full_name(), $body); $body = str_replace("#SiteName#", SITE_NAME, $body); $body = str_replace("#InvoiceId#", $invoice_id, $body); $body = str_replace("#Qty#", $invoice->posts_quantity, $body); $body = str_replace("#Amount#", $invoice->amount, $body); $body = str_replace("#PayMethod#", 'None', $body); $body = str_replace("#Domain#", $_SERVER['HTTP_HOST'], $body); $body = str_replace("#ContactUs#", ADMIN_EMAIL, $body); $body = str_replace("#Link#", BASE_URL, $body); $to = array("email" => $clint->email_address, "name" => $clint->full_name()); $from = array("email" => NO_REPLY_EMAIL, "name" => SITE_NAME); /** end email text **/ $mail = send_mail($body, $subject, $to, $from, "", ""); //redirect_to(BASE_URL."employer/credits/"); //die; return $mail; } } return false; }
<?php $_SESSION['direct_to_emp'] = "credits/"; include_once 'sessioninc.php'; $username = $session->get_username(); $user_id = $session->get_user_id(); $invoice = new PackageInvoice(); $invoice->fk_employer_id = $user_id; $recent_orders = $invoice->orders_by_user(); if ($recent_orders) { $package_list = array(); $i = 1; foreach ($recent_orders as $list) { $pack = Package::find_by_id($list->fk_package_id); $package_list[$i]['invoice_date'] = strftime(DATE_FORMAT, strtotime($list->invoice_date)); $package_list[$i]['processed_date'] = $list->processed_date == "0000-00-00 00:00:00" || $list->processed_date == 'null' ? "Not Confirmed" : strftime(DATE_FORMAT, strtotime($list->processed_date)); $package_list[$i]['id'] = $list->id; $package_list[$i]['item_name'] = $list->item_name; $package_list[$i]['package_desc'] = $pack->package_desc; $package_list[$i]['posts_quantity'] = $list->posts_quantity; $package_list[$i]['standard'] = $list->standard; $package_list[$i]['spotlight'] = $list->spotlight; $package_list[$i]['cv_views'] = $list->cv_views; $package_list[$i]['package_status'] = $list->package_status; $package_list[$i]['amount'] = $list->amount; $package_list[$i]['package_id'] = $list->fk_package_id; $i++; } $smarty->assign('recent_orders', $package_list); } $smarty->assign('dont_include_left', true);
<?php $_SESSION['direct_to_emp'] = "order/?" . $_SERVER['QUERY_STRING']; include_once 'sessioninc.php'; if (FREE_SITE == "Y") { redirect_to(BASE_URL . "employer/account/"); die; } if (!isset($_REQUEST['package_id'])) { redirect_to(BASE_URL . "employer/credits/"); } $user_id = $session->get_user_id(); $username = $session->get_username(); $user = Employer::find_by_id($user_id); $packageinvoice = new PackageInvoice(); $packageinvoice->fk_employer_id = $user_id; //$user->username; $packageinvoice->fk_package_id = (int) $_REQUEST['package_id']; if ($_REQUEST['action'] == 'post' || $_REQUEST['action'] == 'premium_post') { $pack_invoice = $packageinvoice->check_invoice(); if ($pack_invoice) { $invoice_id = $pack_invoice->id; } else { $package = Package::find_by_id($_REQUEST['package_id']); if ($package) { $status = 'Selected'; $packageinvoice->invoice_date = gmdate("Y-m-d H:i:s"); $packageinvoice->processed_date = "null"; $packageinvoice->package_status = $status; $packageinvoice->fk_employer_id = $user_id; $packageinvoice->fk_package_id = $package->id;
$body = str_replace("#Domain#", $_SERVER['HTTP_HOST'], $body); $body = str_replace("#ContactUs#", ADMIN_EMAIL, $body); $body = str_replace("#Link#", BASE_URL, $body); $to = array("email" => $clint->email_address, "name" => $clint->full_name()); $from = array("email" => NO_REPLY_EMAIL, "name" => SITE_NAME); /** end email text **/ $mail = send_mail($body, $subject, $to, $from, "", ""); redirect_to(BASE_URL . "employer/credits/"); die; } } } if (isset($_POST['bt_confirm'])) { if ($package_invoice->package_status != "Confirmed") { $id = $package_invoice->id; $packageinvoice = new PackageInvoice(); $packageinvoice->id = $id; $packageinvoice->package_status = "Confirmed"; $packageinvoice->update_package_status(); } $package_invoice = PackageInvoice::find_by_id($_POST['invoice_id']); $smarty->assign('package_invoice', $package_invoice); } else { redirect_to(BASE_URL . "employer/credits/"); die; } $smarty->assign('dont_include_left', true); $html_title = SITE_NAME . " - Credits "; $smarty->assign('lang', $lang); $smarty->assign('message', $message); $smarty->assign('rendered_page', $smarty->fetch('employer/payment.tpl'));
//confirmation_page.php if (FREE_SITE == "Y") { redirect_to(BASE_URL . "employer/account/"); die; } $invoice_id = (int) $_REQUEST['invoice_id']; $payment_method = $_REQUEST['payment_method']; if (!isset($invoice_id)) { redirect_to(BASE_URL . "employer/credits/"); } $user_id = $session->get_user_id(); $smarty->assign('user_id', $user_id); $username = $session->get_username(); $smarty->assign('username', $username); $user = Employer::find_by_id($user_id); $packageinvoice = PackageInvoice::find_by_id($invoice_id); $status = 'Confirmed'; $packageinvoice->package_status = $status; $packageinvoice->payment_method = $payment_method; if ($packageinvoice->amount == 0.0) { $payment_method = 'free'; $packageinvoice->payment_method = 'free'; } // if ($packageinvoice->amount != 0.0 && $payment_method == 'free') { $session->message("<div class='error'>" . format_lang('error', 'noPaymentSelected') . "</div>"); redirect_to(BASE_URL . "employer/credits/"); exit; } $packageinvoice->save(); $smarty->assign('p_invoice', $packageinvoice);
function processing($payment_status, $params) { global $paypal_email, $paypal_currency; $invoice_id = $params['item_number']; $invoice = PackageInvoice::find_by_id($invoice_id); switch ($payment_status) { case "Canceled_Reversal": $invoice->package_status = 'Canceled_Reversal'; $invoice->update_package_status(); break; case "Completed": if ($paypal_email == $params['receiver_email'] && $paypal_currency == $params['mc_currency'] && $invoice->amount == $params['mc_gross'] && $invoice->package_status != "Completed") { $param['payment_status'] = "Completed"; //what is the status of the payment $param['amount'] = $params['mc_gross']; // how much was paid for this total amount for each item $param['currency'] = $paypal_currency; //what currecy they used to pay for this $param['receiver_id'] = $params['receiver_id']; // what is the id of person who is paying $param['payment_email'] = $params['payer_email']; // what email have they used to pay $param['txn_id'] = $params['txn_id']; // txt id $param['txn_type'] = $params['txn_type']; // how are they pay for this web or ext. $param['payer_status'] = $params['payer_status']; //is user verfied by the method they pay from $param['residence_country'] = $params['residence_country']; //which country does user belogn to //$params['origin'] = ""; //where is the payment come from $param['payment_method'] = "paypal"; // what methoid of payment they used e.g. paypal, ccbill $param['payment_vars'] = addslashes(serialize($params)); //get all var which are return from online site. $param['payment_type'] = $params['payment_type']; //how they pay for this $param['reason'] = ""; // if they cancel then tell user why process_payment($invoice_id, $param); } break; case "Denied": // denied by merchant //$invoice->id = $invoice_id; $invoice->package_status = 'Denied'; $invoice->update_package_status(); break; case "Failed": // only happens when payment is from customers' bank account //$invoice->id = $invoice_id; $invoice->package_status = 'Failed'; $invoice->update_package_status(); break; case "Pending": //$invoice->id = $invoice_id; $invoice->package_status = 'Pending'; $invoice->update_package_status(); break; case "Refunded": //$invoice->id = $invoice_id; $invoice->package_status = 'Refunded'; $invoice->update_package_status(); break; case "Reversed": //$invoice->id = $invoice_id; $invoice->package_status = 'Reversed'; $invoice->update_package_status(); break; case "Expired": //$invoice->id = $invoice_id; $invoice->package_status = 'Expired'; $invoice->update_package_status(); break; default: break; } }
if( $i < sizeof($cv_credits) ) $package_list[$i]['line']= true; else $package_list[$i]['line']= false; $i++; } $smarty->assign('cv_credits', $package_list); } */ $clint->username = $username; $total_post = $clint->total_job_post(); $smarty->assign('total_post', $total_post); $total_spotlight_post = $clint->total_spotlight_job_post(); $smarty->assign('total_spotlight_post', $total_spotlight_post); $total_cv = $clint->total_cv(); $smarty->assign('total_cv', $total_cv); $invoice = new PackageInvoice(); $invoice->fk_employer_id = $user_id; $recent_orders = $invoice->recent_order_by_clint(); if ($recent_orders) { $package_list = array(); $i = 1; foreach ($recent_orders as $list) { $package_list[$i]['invoice_date'] = strftime(DATE_FORMAT, strtotime($list->invoice_date)); $package_list[$i]['id'] = $list->id; $package_list[$i]['item_name'] = $list->item_name; $package_list[$i]['package_status'] = $list->package_status; $package_list[$i]['amount'] = $list->amount; $package_list[$i]['package_id'] = $list->fk_package_id; $i++; } $smarty->assign('recent_orders', $package_list);