2 Commits

Author SHA1 Message Date
ameye b67f736f04 fix 2022-03-19 11:05:21 -04:00
ameye 79bb8ed05d fix 2022-03-19 11:05:18 -04:00
2 changed files with 58 additions and 22 deletions
+30 -11
View File
@@ -278,7 +278,11 @@ long WrenchCanceContractPayment( CVars in, CVars &out )
CVars vw;
vw["currency"] = "NAIRA"; // this might become a variable based on the country
vw["currency"].set_valid( true );
long wallet_id = CheckWallet(in["member_id"].Long(),vw);
/*
// TEST FOR DUPLICATE
@@ -316,9 +320,12 @@ long WrenchCanceContractPayment( CVars in, CVars &out )
ret = PHP_CREATED_OK;
x["flags"] = FLAG_START; x["flags"].set_valid( true ); // done not completed yet
// now generate the confirmation
pgsql_exec("UPDATE members SET balance=balance + %lu WHERE id = %lu",x["amount"].Long(),x["member_id"].Long() ); // pay attention to who you pay here
//- Retired this method pgsql_exec("UPDATE members SET balance=balance + %lu WHERE id = %lu",x["amount"].Long(),x["member_id"].Long() ); // pay attention to who you pay here
char confirmation[15] = "";
Confirmation(payment_id, confirmation, sizeof (confirmation)); // this stamp the offer code directly in that call
Confirmation(payment_id, confirmation, sizeof (confirmation)); // this stamp the offer code directly in that call
UpdateMemberWallet( x["member_id"].Long(), wallet_id,x["amount"].Long(), payment_id); // correct this dont send amount
x["flags"] = FLAG_OK; x["flags"].set_valid( true );
x["payment_id"] = payment_id; x["payment_id"].set_valid( true );
pgsql_exec("UPDATE members_payments SET flags = %lu WHERE id = %lu",x["flags"].Long(),payment_id );
@@ -438,7 +445,7 @@ Foreign-key constraints:
ret = PHP_CREATED_OK;
x["flags"] = FLAG_START; x["flags"].set_valid( true ); // done not completed yet
// now generate the confirmation
pgsql_exec("UPDATE members SET balance=balance - %lu WHERE id = %lu",in["amount"].Long() + in["fee"].Long(),in["member_id"].Long() );
//pgsql_exec("UPDATE members SET balance=balance - %lu WHERE id = %lu",in["amount"].Long() + in["fee"].Long(),in["member_id"].Long() );
DeductMemberWallet(in["member_id"].Long(), wallet_id,in["amount"].Long(), payment_id);
char confirmation[15] = "";
Confirmation(payment_id, confirmation, sizeof (confirmation)); // this stamp the offer code directly in that call
@@ -468,7 +475,12 @@ long WrenchRefundoffer( CVars in, CVars &out )
REQ_LONG( in, "dir", 1, -1 );
long offer_id = REQ_LONG( in, "offer_id", 1, -1 );
long payment_id = REQ_LONG( in, "payment_id", 1, -1 );
CVars vw;
vw["currency"] = "NAIRA"; // this might become a variable based on the country
vw["currency"].set_valid( true );
long wallet_id = CheckWallet(in["member_id"].Long(),vw);
long retDb = load_db_record( out, "SELECT balance AS curr_balance FROM members WHERE id = %lu", in["member_id"].Long());
if (retDb)
@@ -500,9 +512,10 @@ long WrenchRefundoffer( CVars in, CVars &out )
ret = PHP_CREATED_OK;
x["flags"] = FLAG_START; x["flags"].set_valid( true ); // done not completed yet
// now generate the confirmation
pgsql_exec("UPDATE members SET balance=balance + %lu WHERE id = %lu",x["amount"].Long() + x["fee"].Long(),in["member_id"].Long() );
// pgsql_exec("UPDATE members SET balance=balance + %lu WHERE id = %lu",x["amount"].Long() + x["fee"].Long(),in["member_id"].Long() );
char confirmation[15] = "";
Confirmation(payment_id, confirmation, sizeof (confirmation)); // this stamp the offer code directly in that call
Confirmation(payment_id, confirmation, sizeof (confirmation)); // this stamp the offer code directly in that call
UpdateMemberWallet( member_id, wallet_id,x["amount"].Long(), payment_id); // correct this dont send amount
x["flags"] = FLAG_OK; x["flags"].set_valid( true );
x["payment_id"] = payment_id; x["payment_id"].set_valid( true );
pgsql_exec("UPDATE members_payments SET flags = %lu WHERE id = %lu",x["flags"].Long(),payment_id );
@@ -581,8 +594,11 @@ long WrenchContractPayment( CVars in, CVars &out )
return PHP_API_BAD_PARAM; }
CVars vw;
vw["currency"] = "NAIRA"; // this might become a variable based on the country
vw["currency"].set_valid( true );
long wallet_id = CheckWallet(in["member_id"].Long(),vw);
/*
// TEST FOR DUPLICATE
@@ -620,9 +636,12 @@ long WrenchContractPayment( CVars in, CVars &out )
ret = PHP_CREATED_OK;
x["flags"] = FLAG_START; x["flags"].set_valid( true ); // done not completed yet
// now generate the confirmation
pgsql_exec("UPDATE members SET balance=balance + %lu WHERE id = %lu",x["amount"].Long(),x["member_id"].Long() ); // pay attention to who you pay here
//pgsql_exec("UPDATE members SET balance=balance + %lu WHERE id = %lu",x["amount"].Long(),x["member_id"].Long() ); // pay attention to who you pay here
char confirmation[15] = "";
Confirmation(payment_id, confirmation, sizeof (confirmation)); // this stamp the offer code directly in that call
Confirmation(payment_id, confirmation, sizeof (confirmation)); // this stamp the offer code directly in that call
UpdateMemberWallet( x["member_id"].Long(), wallet_id,x["amount"].Long(), payment_id); // correct this dont send amount
x["flags"] = FLAG_OK; x["flags"].set_valid( true );
x["payment_id"] = payment_id; x["payment_id"].set_valid( true );
pgsql_exec("UPDATE members_payments SET flags = %lu WHERE id = %lu",x["flags"].Long(),payment_id );
@@ -6,6 +6,9 @@
<div class="col-xl-6">
<!--begin::Tables Widget 3-->
<div class="card card-xl-stretch mb-xl-8">
<!--begin::Header-->
<div class="card-header border-0 pt-5">
<h3 class="card-title align-items-start flex-column">
@@ -319,20 +322,34 @@
}
?>
</select>
<span class="input-group-btn">
<input name="B1" type="submit" class="btn btn-primary" value="Continue"/>
</span>
</div>
<div class="text-center pt-15">
<div class="alert alert-info no-border"> You will be transferred to the Paypal website to complete this transaction.
<p>
You will require an existing Paypal account to complete this transaction.</div>
<p><div class="alert alert-danger no-border">PLEASE DO NOT CLOSE THE PAYPAL PAGE AFTER PAYMENT IS COMPLETED, you will be automatically re-directed back to your WrenchBoard account once payment is approved. If you close the page before this, your payment may not be properly credited.
</div>
</div>
<!--begin::Actions-->
<div class="text-center pt-15">
<button type="reset" id="kt_modal_new_card_cancel" class="btn btn-light me-3">Discard</button>
<button type="submit" id="kt_modal_new_card_submit" class="btn btn-primary">
<span class="indicator-label">Continue</span>
<span class="indicator-progress">Please wait...
<span class="spinner-border spinner-border-sm align-middle ms-2"></span></span>
</button>
</div>
<!--end::Actions-->
</form>
<div class="alert alert-info no-border"> You will be transferred to the Paypal website to complete this transaction.
<p>
You will require an existing Paypal account to complete this transaction.</div>
<p><div class="alert alert-danger no-border">PLEASE DO NOT CLOSE THE PAYPAL PAGE AFTER PAYMENT IS COMPLETED, you will be automatically re-directed back to your WrenchBoard account once payment is approved. If you close the page before this, your payment may not be properly credited.</div>
<!--end::Table container-->
</div>
<!--begin::Body-->