update wallet
This commit is contained in:
@@ -18,6 +18,7 @@ long DeductMemberWallet(long member_id,long wallet_id,long amount, long payment
|
||||
long WrenchMemberCouponPayment( CVars in, CVars &out );
|
||||
long WrenchMemberTopupPayment( CVars in, CVars &out );
|
||||
long WrenchFamilyPayment( CVars in, CVars &out );
|
||||
long AssignVirtualCardWallet( CVars in,CVars out);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -14,6 +14,12 @@ enum { PARTNER_STRIPE };
|
||||
#define WRENCH_FILE_JOB 500
|
||||
#define WRENCH_FILE_JOBFILE 600
|
||||
|
||||
#define CARD_REQUESTED 1
|
||||
#define CARD_HOLDER_CREATED 10
|
||||
#define CARD_OWNER_ACTIVE 30
|
||||
#define CARD_ASSIGNED 40
|
||||
#define CARD_ACTIVATE_CARD 50
|
||||
#define CARD_WALLET_ADD 60
|
||||
|
||||
#define PHP_API_OK 0
|
||||
#define PHP_CREATED_OK 10
|
||||
@@ -169,6 +175,7 @@ enum { PARTNER_STRIPE };
|
||||
#define WRB_CRONJOB_PROCESSTRANSFER 781
|
||||
#define WRB_CRONJOB_APPEMAILS 782
|
||||
#define WRB_CRONJOB_REFRESHBLOG 783
|
||||
#define WRB_CRONJOB_PROCESS_VUSA 784
|
||||
|
||||
#define WRB_CRONJOB_AUTO_OFFEREXPIRE 785
|
||||
#define WRB_CRONJOB_HOLIDAY_BROADCAST 786
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@ define('WRB_CRONJOB_SCHEULETRANSFER', 780);
|
||||
define('WRB_CRONJOB_PROCESSTRANSFER', 781);
|
||||
define('WRB_CRONJOB_APPEMAILS', 782);
|
||||
define('WRB_CRONJOB_REFRESHBLOG', 783);
|
||||
define('WRB_CRONJOB_PROCESS_VUSA', 784);
|
||||
|
||||
define('WRB_CRONJOB_AUTO_OFFEREXPIRE', 785);
|
||||
define('WRB_CRONJOB_HOLIDAY_BROADCAST', 786);
|
||||
@@ -176,7 +177,21 @@ class AirFlow extends BaseController
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//LET US CREATE THE WALLET NOW
|
||||
$in['limit'] = 2;
|
||||
$in['status'] = CARD_ACTIVATE_CARD; // pick from holders
|
||||
$local_url = "http://".$this->micro_service_net1.":3038/cardapplications";
|
||||
$outZ = $this->APIcall('POST', $local_url, $in);
|
||||
log_message('critical', "AirFlow::flowStripeCard ********* ALL ".serialize($outZ) );
|
||||
foreach ($outZ['result_list'] as $index=>$in){
|
||||
if ( $in['request_id'] !='' && $in['request_uid'] !=''){
|
||||
$in["action"] =WRB_JOB_CRONJOB;
|
||||
$in['call_action'] = WRB_CRONJOB_PROCESS_VUSA;
|
||||
$in['one_limit'] = 3;
|
||||
$ret['WRB_CRONJOB_JOBDUE_REMINDER'] = $this->wrenchboard->wrenchboard_api($in, $out);
|
||||
}
|
||||
}
|
||||
|
||||
log_message('critical', "AirFlow::flowStripeCard ********* ALL ".serialize($in) );
|
||||
return []; //json_encode( $final_out );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user