From da93e702d5ec1b5b68c709152b04cc358c156c4b Mon Sep 17 00:00:00 2001 From: "CHIEFSOFT\\ameye" Date: Sat, 26 Oct 2024 23:44:34 -0400 Subject: [PATCH] Wallet --- www-api/app/Controllers/WrenchWallet.php | 85 +++++------------------- 1 file changed, 15 insertions(+), 70 deletions(-) diff --git a/www-api/app/Controllers/WrenchWallet.php b/www-api/app/Controllers/WrenchWallet.php index 56d8f237..72e5925d 100644 --- a/www-api/app/Controllers/WrenchWallet.php +++ b/www-api/app/Controllers/WrenchWallet.php @@ -175,7 +175,7 @@ class WrenchWallet extends BaseController return json_encode( $final_out ); } - //getKidWallet + //getKidWallet from parent side public function getKidWallet(){ log_message('critical', "0001"); // header('Access-Control-Allow-Origin: *'); @@ -183,14 +183,19 @@ class WrenchWallet extends BaseController $raw_json = file_get_contents('php://input'); $in = json_decode($raw_json, true); $out=[]; - + $endpoint = "WALLETS-USERS-KIDS-". $in["family_uid"]; $in["loc"] = $_SERVER["REMOTE_ADDR"]; log_message('critical', "IN ARRAY for call 0001 -> ".serialize($in)); $in["action"] = 'getkidswallets'; //WRENCHBOARD_ACCOUNT_JOBLIST; - log_message('critical', "before APIN call 0001"); - if ( $in["action"] !='' ){ + //log_message('critical', "before APIN call 0001"); + $out = $this->getCache($endpoint); + if (!is_array($out) || count($out)==0 ){ + // if ( $in["action"] !='' ){ $local_url = "http://".$this->micro_service_net1.":3037/getkidswallets"; $out = $this->APIcall('GET', $local_url, $in); + if (count($out['result_list']) > 0 ){ // dont cache empty + $this->saveCache($endpoint,$out,1500); + } } $out["result_list"][] = [ @@ -207,6 +212,7 @@ class WrenchWallet extends BaseController "transfer_limit" => 0, "wallet_uid" => "", "escrow" => 0, + "status" => 1, "show_balance" => false, "rt_action_text" => "Add Card", "banner" => 'https://www.wrenchboard.com/assets/images/apps/wallet/wallet-card.jpg', @@ -221,7 +227,7 @@ class WrenchWallet extends BaseController $in = json_decode($raw_json, true); $in["action"] = 'getwallets'; $out=[]; - $endpoint = "USERS_WALLETS-". $in["uid"]; + $endpoint = "WALLETS-USERS-". $in["uid"]; $out = $this->getCache($endpoint); if (!is_array($out) || count($out)==0 ){ @@ -240,70 +246,6 @@ class WrenchWallet extends BaseController $out["result_list"][] = $item; } } - - /* - $out["result_list"][] = [ - "wallet_country" => ['US'], - "amount" => 0, - "id" => 1, - "code" => "USD", - "description" => "Add Virtual Debit Card", - "symbol" => "$", - "action_type" => "AC_AD_VIRTUAL_CARD", - "lorder" => 0, - "country" => "", - "processor" => 9010, - "current_balance" => 0, - "transfer_limit" => 0, - "wallet_uid" => "", - "escrow" => 0, - "show_balance" => false, - "rt_action_text" => "Add Card", - "banner" => 'https://www.wrenchboard.com/assets/images/apps/wallet/wallet-card.jpg', - "icon" => 'https://www.wrenchboard.com/assets/images/apps/wallet/icon/cards.png' - ]; - $out["result_list"][] = [ - "wallet_country" => [], - "amount" => 0, - "id" => 1, - "code" => "USD", - "description" => "Wrench Token", - "symbol" => "$", - "action_type" => "AC_AD_WR_TOKEN", - "lorder" => 0, - "country" => "", - "processor" => 9012, - "current_balance" => 0, - "transfer_limit" => 0, - "wallet_uid" => "", - "escrow" => 0, - "show_balance" => true, - "rt_action_text" => "View", - "banner" => 'https://www.wrenchboard.com/assets/images/apps/wallet/wallet-token.jpg', - "icon" => 'https://www.wrenchboard.com/assets/images/apps/wallet/icon/token.png' - ]; - $out["result_list"][] = [ - "wallet_country" => [], - "amount" => 0, - "id" => 1, - "code" => "USD", - "description" => "Wrench Points", - "symbol" => "$", - "action_type" => "AC_AD_WR_POINTS", - "lorder" => 0, - "country" => "", - "processor" => 9014, - "current_balance" => 0, - "transfer_limit" => 0, - "wallet_uid" => "", - "escrow" => 0, - "show_balance" => true, - "rt_action_text" => "Redeem", - "banner" => 'https://www.wrenchboard.com/assets/images/apps/wallet/wallet-point.jpg', - "icon" => 'https://www.wrenchboard.com/assets/images/apps/wallet/icon/point.png' - ]; - */ - /**/ log_message('critical', "***** ***** WrenchJobs::getWallet Ret "); return $this->respond( $this->summaryReturnData($in,$out), 200); } @@ -325,6 +267,7 @@ class WrenchWallet extends BaseController "transfer_limit" => 0, "wallet_uid" => "", "escrow" => 0, + "status" => 1, "show_balance" => false, "rt_action_text" => "Add Card", "banner" => 'https://www.wrenchboard.com/assets/images/apps/wallet/wallet-card.jpg', @@ -345,6 +288,7 @@ class WrenchWallet extends BaseController "transfer_limit" => 0, "wallet_uid" => "", "escrow" => 0, + "status" => 0, "show_balance" => true, "rt_action_text" => "View", "banner" => 'https://www.wrenchboard.com/assets/images/apps/wallet/wallet-token.jpg', @@ -365,6 +309,7 @@ class WrenchWallet extends BaseController "transfer_limit" => 0, "wallet_uid" => "", "escrow" => 0, + "status" => 0, "show_balance" => true, "rt_action_text" => "Redeem", "banner" => 'https://www.wrenchboard.com/assets/images/apps/wallet/wallet-point.jpg', @@ -374,7 +319,7 @@ class WrenchWallet extends BaseController $retArr=[]; foreach ( $auxWallet as $item){ - if ( in_array( $owner_country, $item['wallet_country']) ){ + if ( in_array( $owner_country, $item['wallet_country']) && $item['status'] == 1 ){ log_message('critical', "***** ***** auxiliaryWallets::ITEM ". serialize($item)); $retArr[] =$item; }