confirmation added
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
#define WRENCHBOARD_API_H
|
#define WRENCHBOARD_API_H
|
||||||
|
|
||||||
enum { DIR_TARGET, DIR_SOURCE };
|
enum { DIR_TARGET, DIR_SOURCE };
|
||||||
enum { FLAG_INIT,FLAG_START,FLAG_CANCEL,FLAG_FAIL,FLAG_OK };
|
enum { FLAG_INIT,FLAG_START,FLAG_CANCEL,FLAG_FAIL,FLAG_OK,FLAG_OK_PAID };
|
||||||
enum { WHAT_NEW_CARDADD, WHAT_PICKUP_INITIALPAYMENT };
|
enum { WHAT_NEW_CARDADD, WHAT_PICKUP_INITIALPAYMENT };
|
||||||
enum { PARTNER_STRIPE };
|
enum { PARTNER_STRIPE };
|
||||||
|
|
||||||
|
|||||||
@@ -1012,6 +1012,7 @@ long WrenchContractPayment( CVars in, CVars &out )
|
|||||||
REQ_STRING (in, "code", 4, 5, "(.*)");
|
REQ_STRING (in, "code", 4, 5, "(.*)");
|
||||||
//long offer_id = REQ_LONG( in, "offer_id", 1, -1 );
|
//long offer_id = REQ_LONG( in, "offer_id", 1, -1 );
|
||||||
long payment_id = 0; //
|
long payment_id = 0; //
|
||||||
|
long final_payment_id = 0; //
|
||||||
long client_id = 0;
|
long client_id = 0;
|
||||||
long offer_id = 0;
|
long offer_id = 0;
|
||||||
long amount = 0;
|
long amount = 0;
|
||||||
@@ -1094,21 +1095,22 @@ long WrenchContractPayment( CVars in, CVars &out )
|
|||||||
x["currency"] = y["currency"]; x["currency"].set_valid( true );
|
x["currency"] = y["currency"]; x["currency"].set_valid( true );
|
||||||
|
|
||||||
x["flags"] = FLAG_INIT; x["flags"].set_valid( true ); // starting the pprocess
|
x["flags"] = FLAG_INIT; x["flags"].set_valid( true ); // starting the pprocess
|
||||||
payment_id = insert_db_record( DBS_VALID, "members_payments", "members_payments_id_seq", x );
|
final_payment_id = insert_db_record( DBS_VALID, "members_payments", "members_payments_id_seq", x );
|
||||||
|
|
||||||
if (payment_id) {
|
if (final_payment_id) {
|
||||||
ret = PHP_CREATED_OK;
|
ret = PHP_CREATED_OK;
|
||||||
x["flags"] = FLAG_START; x["flags"].set_valid( true ); // done not completed yet
|
x["flags"] = FLAG_START; x["flags"].set_valid( true ); // done not completed yet
|
||||||
// now generate the confirmation
|
// 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] = "";
|
char confirmation[15] = "";
|
||||||
Confirmation(payment_id, confirmation, sizeof (confirmation)); // this stamp the offer code directly in that call
|
Confirmation(final_payment_id, confirmation, sizeof (confirmation)); // this stamp the offer code directly in that call
|
||||||
logfmt( logINFO, "paying for job completed, make sure you paythe correct person()" );
|
logfmt( logINFO, "paying for job completed, make sure you paythe correct person()" );
|
||||||
UpdateMemberWallet( x["member_id"].Long(), client_wallet_id,x["amount"].Long(), payment_id); // correct this dont send amount
|
UpdateMemberWallet( x["member_id"].Long(), client_wallet_id,x["amount"].Long(), final_payment_id); // correct this dont send amount
|
||||||
|
|
||||||
x["flags"] = FLAG_OK; x["flags"].set_valid( true );
|
x["flags"] = FLAG_OK; x["flags"].set_valid( true );
|
||||||
x["payment_id"] = payment_id; x["payment_id"].set_valid( true );
|
x["payment_id"] = final_payment_id; x["payment_id"].set_valid( true );
|
||||||
pgsql_exec("UPDATE members_payments SET flags = %lu WHERE id = %lu",x["flags"].Long(),payment_id );
|
pgsql_exec("UPDATE members_payments SET flags = %lu WHERE id = %lu",x["flags"].Long(),final_payment_id );
|
||||||
|
pgsql_exec("UPDATE members_payments SET flags = %lu WHERE id = %lu",FLAG_OK_PAID,payment_id ); // this is the holdings
|
||||||
//pgsql_exec("UPDATE members_jobs_offer SET payment_id = %lu WHERE id = %lu",x["payment_id"].Long(),x["what_offer"].Long() );
|
//pgsql_exec("UPDATE members_jobs_offer SET payment_id = %lu WHERE id = %lu",x["payment_id"].Long(),x["what_offer"].Long() );
|
||||||
load_db_record( out, "SELECT * FROM members_payments WHERE id = %lu ", payment_id );
|
load_db_record( out, "SELECT * FROM members_payments WHERE id = %lu ", payment_id );
|
||||||
} else {
|
} else {
|
||||||
@@ -1172,7 +1174,7 @@ long WrenchSendMoneyPayment( CVars in, CVars &out )
|
|||||||
x["amount"] = in["amount"]; x["amount"].set_valid( true );
|
x["amount"] = in["amount"]; x["amount"].set_valid( true );
|
||||||
x["fee"] = in["fee"]; x["fee"].set_valid( true );
|
x["fee"] = in["fee"]; x["fee"].set_valid( true );
|
||||||
x["what_sendmoney"] = in["sendmoney_id"]; x["what_sendmoney"].set_valid( true );
|
x["what_sendmoney"] = in["sendmoney_id"]; x["what_sendmoney"].set_valid( true );
|
||||||
x["currency"] = out["currency"]; x["currency"].set_valid( true );
|
x["currency"] = y["currency"]; x["currency"].set_valid( true );
|
||||||
x["flags"] = FLAG_INIT; x["flags"].set_valid( true ); // starting the pprocess
|
x["flags"] = FLAG_INIT; x["flags"].set_valid( true ); // starting the pprocess
|
||||||
payment_id = insert_db_record( DBS_VALID, "members_payments", "members_payments_id_seq", x );
|
payment_id = insert_db_record( DBS_VALID, "members_payments", "members_payments_id_seq", x );
|
||||||
logfmt(logINFO, "long WrenchSendMoneyPayment(CVars in, CVars &out) payment_id = %lu",payment_id);
|
logfmt(logINFO, "long WrenchSendMoneyPayment(CVars in, CVars &out) payment_id = %lu",payment_id);
|
||||||
|
|||||||
Reference in New Issue
Block a user