2 Commits

Author SHA1 Message Date
ameye 186ee393a2 fix 2022-05-14 20:28:30 -04:00
ameye ee04eaa22c fix 2022-05-14 20:28:23 -04:00
6 changed files with 122 additions and 24 deletions
+11 -3
View File
@@ -508,6 +508,8 @@ long CreateWrenchBoardAccount(CVars in, CVars &out) {
ret = insert_db_record(DBS_VALID, "members", "members_id_seq", x);
if (ret > 0) {
out["member_id"] = ret;
out["member_id"].set_valid(true);
x["member_id"] = ret;
@@ -515,10 +517,16 @@ long CreateWrenchBoardAccount(CVars in, CVars &out) {
x["pending_id"] = out["pending_id"];
x["pending_id"].set_valid(true);
CVars u;
load_db_record(u,"SELECT code AS currency FROM currency WHERE country = '%s'", x["country"].c_str() );
logfmt(logINFO, " The Currency code = %s", u["currency"].c_str());
out["wallet_id"] = CheckWallet( x["member_id"].Long() , u);
logfmt(logINFO, " The wallet_id = %lu", out["wallet_id"].Long());
CVars vw;
vw["currency"] = "NAIRA"; // this will become a variable based on the country
vw["currency"].set_valid( true );
out["wallet_id"] = CheckWallet(out["member_id"].Long(),vw); // initial wallet
// vw["currency"] = "NAIRA"; // this will become a variable based on the country
// vw["currency"].set_valid( true );
// out["wallet_id"] = CheckWallet(out["member_id"].Long(),vw); // initial wallet
// - password already set pgsql_query("UPDATE members SET password = md5('%s') WHERE id = %lu",in["pass1"].c_str(),ret);
pgsql_query("UPDATE members_pending SET status = 5 WHERE id = %lu", out["pending_id"].Long());
+36 -14
View File
@@ -705,7 +705,7 @@ long WrenchSendJobsOfferPublic(CVars in, CVars &out) {
CVars x;
CVars y;
CVars z;
CVars u;
// we need this job id
@@ -716,6 +716,10 @@ long WrenchSendJobsOfferPublic(CVars in, CVars &out) {
return ret;
}
load_db_record(u,"SELECT code AS currency FROM currency WHERE country = '%s'", y["country"].c_str() );
logfmt(logINFO, " The Currency code = %s", u["currency"].c_str());
long wallet_id = CheckWallet( in["member_id"].Long() , u);
logfmt(logINFO, " The wallet_id = %lu", wallet_id);
if (y["price"].Long() > 0) {
} else {
@@ -726,20 +730,20 @@ long WrenchSendJobsOfferPublic(CVars in, CVars &out) {
// Now do you have money to do this ....
z["balance"] = "0";
z["balance"].set_valid(true); // just initialize it
if (load_db_record(z, " SELECT * FROM members WHERE id =%lu AND balance >= %lu", in["member_id"].Long(), y["price"].Long())) {
if (load_db_record(z, " SELECT * FROM members_wallet WHERE id =%lu AND member_id =%lu AND amount >= %lu",wallet_id, in["member_id"].Long(), y["price"].Long())) {
} else {
out["status"] = "Insuficient balancde to create this offer";
logfmt(logINFO, "Price2 = %lu Balance = %lu", y["price"].Long(), z["balance"].Long());
out["status"] = "Insufficient balance to create this offer";
logfmt(logINFO, "Price2 = %lu Balance = %lu", y["price"].Long(), z["amount"].Long());
}
if (y["price"].Long() >= z["balance"].Long()) {
out["status"] = "Insuficient balancde to create this offer";
logfmt(logINFO, "Price = %lu Balance = %lu", y["price"].Long(), z["balance"].Long());
if (y["price"].Long() >= z["amount"].Long()) {
out["status"] = "Insufficient balance to create this offer";
logfmt(logINFO, "Price = %lu Balance = %lu", y["price"].Long(), z["amount"].Long());
return ret;
}
logfmt(logINFO, "Price = %lu Balance = %lu", y["price"].Long(), z["balance"].Long());
logfmt(logINFO, "Price = %lu Balance = %lu", y["price"].Long(), z["amount"].Long());
try {
// if ( load_db_record( out, "SELECT count(id) AS duplicate_name FROM members_jobs_offer WHERE LOWER(group_name)=LOWER('%s') AND member_id =%lu AND status = 1",in["group_name"].c_str(), in["member_id"].Long() ))
@@ -811,6 +815,7 @@ long WrenchSendJobsOfferGroup(CVars in, CVars &out) {
CVars x;
CVars y;
CVars z;
CVars u;
long total_member = 0;
load_db_record(out, "SELECT count(id) AS m_count FROM members_job_groupmember WHERE group_id = %lu AND member_id= %lu", in["group_id"].Long(), in["member_id"].Long());
@@ -825,6 +830,7 @@ long WrenchSendJobsOfferGroup(CVars in, CVars &out) {
}
// we need this job id
if (load_db_record(y, " SELECT * FROM members_jobs WHERE id =%lu", in["job_id"].Long())) {
// valid load of job needed
@@ -833,6 +839,10 @@ long WrenchSendJobsOfferGroup(CVars in, CVars &out) {
return ret;
}
load_db_record(u,"SELECT code AS currency FROM currency WHERE country = '%s'", y["country"].c_str() );
logfmt(logINFO, " The Currency code = %s", u["currency"].c_str());
long wallet_id = CheckWallet( in["member_id"].Long() , u);
logfmt(logINFO, " The wallet_id = %lu", wallet_id);
if (y["price"].Long() > 0) {
} else {
@@ -841,20 +851,32 @@ long WrenchSendJobsOfferGroup(CVars in, CVars &out) {
} // no price zero for job on this path
// Now do you have money to do this ....
if (load_db_record(z, " SELECT * FROM members WHERE id =%lu AND balance >= %lu", in["member_id"].Long(), y["price"].Long())) {
z["balance"] = "0";
z["balance"].set_valid(true); // just initialize it
if (load_db_record(z, " SELECT * FROM members_wallet WHERE id =%lu AND member_id =%lu AND amount >= %lu",wallet_id, in["member_id"].Long(), y["price"].Long())) {
} else {
out["status"] = "Insufficient balance to create this offer";
logfmt(logINFO, "Price2 = %lu Balance = %lu", y["price"].Long(), z["balance"].Long());
}
if (y["price"].Long() * total_member >= z["balance"].Long()) // note that we have all members here for the price
{
out["status"] = "Insuficient balancde to create this offer";
if (y["price"].Long() >= z["amount"].Long()) {
out["status"] = "Insufficient balance to create this offer";
logfmt(logINFO, "Price = %lu Balance = %lu", y["price"].Long(), z["balance"].Long());
return ret;
}
logfmt(logINFO, "Price = %lu Balance = %lu", y["price"].Long() * total_member, z["balance"].Long());
/*
if (y["price"].Long() * total_member >= z["balance"].Long()) // note that we have all members here for the price
{
out["status"] = "Insufficient balance to create this offer";
logfmt(logINFO, "Price = %lu Balance = %lu", y["price"].Long(), z["balance"].Long());
return ret;
}
*/
logfmt(logINFO, "Price = %lu Balance = %lu", y["price"].Long() * total_member, z["amount"].Long());
try {
+2 -1
View File
@@ -1087,6 +1087,7 @@ $data['page_title'] = "Create Job";
// $this->load->view('users/view_header_user', $data);
// $this->load->view('jobs/view_joboffer', $data);
// $this->load->view('users/view_footer_user', $data);
$data['page_title'] ="View Job";
$this->renderSecurePage('jobs/view_joboffer', $data);
} else {
@@ -1238,7 +1239,7 @@ $data['page_title'] = "Create Job";
$out = array();
$res = $this->backend_model->wrenchboard_api($in, $out);
$out["status"] = '';
//$out["status"] = '';
//$res = $this->wrenchboard_api($in, $out);
// print_r($out);
+6 -3
View File
@@ -86,8 +86,10 @@ class Paymnt extends Users_Controller {
$cd['cvc'] = $this->input->post('cvc');
$cd['description']= $this->input->post('description');
//$amount = rand(5555,9999);
$amount = rand(450,700);
//$amount = rand(450,700);
$cd['amount'] = $this->input->post('amount');
$cd['postal'] = $this->input->post('postal');
$cardTestResult= $this->cardpay_model->verifyCardData($cd);
//var_dump($cardTestResult);
@@ -104,10 +106,11 @@ class Paymnt extends Users_Controller {
"exp_month" => $cd['exp_month'],
"exp_year" => $cd['exp_year'],
"cvc" => $cd['cvc'],
"amount" => $amount ,
"amount" => $cd['amount'],
"email" => $email,
"description" => $cd['description'],
"member_id" => $member_id,
"postal" => $cd['postal'] ,
"paymenttype" => 100
);
$out=array();
+3 -2
View File
@@ -72,15 +72,16 @@
</td>
<td><?= $job_table_row->create_date ?></td>
</tr>
<tr><td colspan='2'>Please provide clear deliverables for this task.</td></tr>
<tr><td colspan='2'>Please provide clear deliverables for this task.</td></tr>
<tr>
<td>
<a href="#" class="text-dark fw-bolder text-hover-primary mb-1 fs-6"> Delivery Detail</a>
</td>
<td>
<form name="job_detail">
<textarea cols="18" rows="3" name='jobdescription' class="wysihtml5 wysihtml5-min form-control" style="height:180px;" placeholder="Enter description here ..."> <?= $job_table_row->job_detail ?></textarea>
</form>
</td>
</tr>
@@ -10,6 +10,8 @@
<!--begin::Header-->
<div class="card-header border-0 pt-5">
<h3 class="card-title align-items-start flex-column">
@@ -26,6 +28,37 @@
<form method="POST" action="/paymnt/newcc">
<div class="row mb-10">
<!--begin::Col-->
<div class="col-md-8 fv-row">
<!--begin::Label-->
<label class="required fs-6 fw-bold form-label mb-2">Amount($)</label>
<!--end::Label-->
<!--begin::Row-->
<div class="row fv-row">
<!--begin::Col-->
<div class="col-6">
<input type="text" class="form-control form-control-solid" placeholder="" name="amount" value="" />
</div>
<!--end::Col-->
<!--begin::Col-->
<div class="col-6">
</div>
<!--end::Col-->
</div>
<!--end::Row-->
</div>
<!--end::Col-->
<!--begin::Col-->
<div class="col-md-4 fv-row">
</div>
<!--end::Col-->
</div>
<!--begin::Input group-->
<div class="d-flex flex-column mb-7 fv-row">
<!--begin::Label-->
@@ -153,10 +186,40 @@
<!--end::Label-->
<input type="text" class="form-control form-control-solid" placeholder="" readonly name="billing_address" value="" />
<input type="text" class="form-control form-control-solid" placeholder="" name="billing_address" value="" />
</div>
<!--end::Input group-->
<div class="row mb-10">
<!--begin::Col-->
<div class="col-md-8 fv-row">
<!--begin::Label-->
<label class="required fs-6 fw-bold form-label mb-2">Postal code</label>
<!--end::Label-->
<!--begin::Row-->
<div class="row fv-row">
<!--begin::Col-->
<div class="col-6">
<input type="text" class="form-control form-control-solid" placeholder="" name="postal" value="" />
</div>
<!--end::Col-->
<!--begin::Col-->
<div class="col-6">
</div>
<!--end::Col-->
</div>
<!--end::Row-->
</div>
<!--end::Col-->
<!--begin::Col-->
<div class="col-md-4 fv-row">
</div>
<!--end::Col-->
</div>
<!--begin::Input group-->
<div class="d-flex flex-stack">
<!--begin::Label-->