update wallet
This commit is contained in:
@@ -390,8 +390,40 @@ long WrenchMemberCouponPayment( CVars in, CVars &out )
|
||||
logfmt(FLOG_MAX, "/long WrenchMemberCouponPayment(CVars in, CVars &out)" );
|
||||
return ret;
|
||||
}
|
||||
/*
|
||||
Construct Virtual card Wallet
|
||||
*/
|
||||
long AssignVirtualCardWallet(CVars in,CVars out){
|
||||
logfmt(FLOG_MAX, "long CheckWallet()" );
|
||||
long wallet_id = 0;
|
||||
CVars y;
|
||||
try{
|
||||
REQ_STRING(in, "request_uid", 12, 160, "(.*)");
|
||||
long request_id = REQ_LONG(in, "request_id", 0, -1);
|
||||
|
||||
|
||||
if ( load_db_record( y, "SELECT * FROM members_card_request WHERE status = %lu AND uid::text ='%s' AND id =%lu",CARD_ACTIVATE_CARD, in["request_uid"].c_str(),request_id ) > 0 )
|
||||
{
|
||||
CVars x;
|
||||
x["member_id"] = y["member_id"]; x["member_id"].set_valid( true );
|
||||
x["currency"] = "VUSD"; x["currency"].set_valid( true );
|
||||
x["transfer_limit"] = "100000"; x["transfer_limit"].set_valid( true );
|
||||
x["card_issue_id"] = y["card_issue_id"]; x["card_issue_id"].set_valid( true );
|
||||
x["card_id"] = y["card_id"]; x["card_id"].set_valid( true );
|
||||
x["brand"] = y["brand"]; x["brand"].set_valid( true );
|
||||
x["card_last4"] = y["card_last4"]; x["card_last4"].set_valid( true );
|
||||
wallet_id = insert_db_record( DBS_VALID, "members_wallet", "members_wallet_id_seq", x );
|
||||
if(wallet_id> 0){
|
||||
pgsql_exec("UPDATE members_card_request SET status = %lu WHERE uid::text ='%s' AND id =%lu",CARD_WALLET_ADD, in["request_uid"].c_str(),request_id); //
|
||||
}
|
||||
}
|
||||
else{
|
||||
wallet_id = -1;
|
||||
}
|
||||
} catch (bad_parameter) {
|
||||
logfmt(logINFO, "ERROR CALL long AssignVirtualCardWallet(CVars in, CVars &out)");
|
||||
}
|
||||
return wallet_id;
|
||||
}
|
||||
|
||||
/*
|
||||
call to verify the user have the wallet in place - or create it
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
#include "jobs.h"
|
||||
#include "bko.h"
|
||||
#include "cron_email.h"
|
||||
#include "payments.h"
|
||||
|
||||
long ReviewReminder(CVars in, CVars &out);
|
||||
long OfferPending(CVars in, CVars &out);
|
||||
@@ -172,6 +173,13 @@ long sitecrons_calls(CVars in, CVars &out) {
|
||||
return RefreshBlogs(in, out);
|
||||
break;
|
||||
|
||||
case WRB_CRONJOB_PROCESS_VUSA:
|
||||
ct["job_type"]="WRB_CRONJOB_PROCESS_VUSA"; ct["job_type"].set_valid( true );
|
||||
ct["description"]="Process Virtual Card"; ct["WRB_CRONJOB_PROCESS_VUSA"].set_valid( true );
|
||||
CronTracker(ct, co);
|
||||
return AssignVirtualCardWallet(in, out);
|
||||
break;
|
||||
|
||||
// define('WRB_CRONJOB_APPEMAILS', 782);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user