From 3286efe6501b520ae160ce7fefcd60e01ba90b8d Mon Sep 17 00:00:00 2001 From: "CHIEFSOFT\\ameye" Date: Sun, 27 Oct 2024 15:48:41 -0400 Subject: [PATCH] extra wallet settings --- www-api/app/Controllers/WrenchWallet.php | 25 +++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/www-api/app/Controllers/WrenchWallet.php b/www-api/app/Controllers/WrenchWallet.php index 0663dce0..ca08ffbc 100644 --- a/www-api/app/Controllers/WrenchWallet.php +++ b/www-api/app/Controllers/WrenchWallet.php @@ -175,6 +175,25 @@ class WrenchWallet extends BaseController return json_encode( $final_out ); } + private function getSettings($settingkey, $defaultVal=''){ + $raw_json = file_get_contents('php://input'); + $in = json_decode($raw_json, true); + $out=[]; + $endpoint = "SETTINGS"; + $out = $this->getCache($endpoint); + if (!is_array($out) || count($out)==0 ) { + $local_url = "http://".$this->micro_service_net1.":3037/settings"; + $out = $this->APIcall('GET', $local_url, $in); + if (count($out['result_list']) > 0 ){ // dont cache empty + $this->saveCache($endpoint,$out,55500); + } + } + + if (is_array($out) && count($out['result_list']) > 0 ) { + return (isset($out['result_list'][$settingkey])) ? $out['result_list'][$settingkey]: $defaultVal; + } + return $defaultVal; + } //getKidWallet from parent side public function getKidWallet(){ log_message('critical', "0001"); @@ -267,7 +286,7 @@ class WrenchWallet extends BaseController "transfer_limit" => 0, "wallet_uid" => "", "escrow" => 0, - "status" => 1, + "status" => $this->getSettings('ENABLE_EXTRA_WALLET', 0), "show_balance" => false, "rt_action_text" => "Add Card", "banner" => 'https://www.wrenchboard.com/assets/images/apps/wallet/wallet-card.jpg', @@ -288,7 +307,7 @@ class WrenchWallet extends BaseController "transfer_limit" => 0, "wallet_uid" => "", "escrow" => 0, - "status" => 0, + "status" => $this->getSettings('ENABLE_EXTRA_WALLET', 0), "show_balance" => true, "rt_action_text" => "View", "banner" => 'https://www.wrenchboard.com/assets/images/apps/wallet/wallet-token.jpg', @@ -309,7 +328,7 @@ class WrenchWallet extends BaseController "transfer_limit" => 0, "wallet_uid" => "", "escrow" => 0, - "status" => 0, + "status" => $this->getSettings('ENABLE_EXTRA_WALLET', 0), "show_balance" => true, "rt_action_text" => "Redeem", "banner" => 'https://www.wrenchboard.com/assets/images/apps/wallet/wallet-point.jpg',