Commit 94da94c7 authored by Antonio.Suerte's avatar Antonio.Suerte

Setting Centralization

parent e9836269
...@@ -75,14 +75,7 @@ class Flat3Webhook extends System { ...@@ -75,14 +75,7 @@ class Flat3Webhook extends System {
$this -> transLog = "../Logs/SAPAY"; $this -> transLog = "../Logs/SAPAY";
$this -> errorLog = "../Logs/SAPAY/Error"; $this -> errorLog = "../Logs/SAPAY/Error";
$this -> devSetting = $this -> getRowData($this -> accessSelect("SELECT_DEV_SETTING", ["flat3_webhook"])); $this -> devSetting = $this -> getSettingConfiguration("flat3_webhook");
if($this -> isLoopData($this -> devSetting)){
$this -> devSettingEnabled = $this -> getColumnData($this -> devSetting, "dev_setting_enabled");
if($this -> checkJSONString($this -> getColumnData($this -> devSetting, "dev_setting_value")))
$this -> devSetting = json_decode($this -> getColumnData($this -> devSetting, "dev_setting_value"));
}
} }
private function requestDetails(){ private function requestDetails(){
......
...@@ -16,11 +16,9 @@ class help2PayAPI extends System { ...@@ -16,11 +16,9 @@ class help2PayAPI extends System {
} }
private function fillCredentials(){ private function fillCredentials(){
$h2pSettings = $this -> getRowData($this -> accessSelect("SELECT_DEV_SETTING", ["help2pay_conf"])); $h2pSettings = $this -> getSettingConfiguration("help2pay_conf");
if($this -> isLoopData($h2pSettings)){ if($h2pSettings){
$h2pSettings = json_decode($this -> getColumnData($h2pSettings, "dev_setting_value"));
$this -> payoutUrl = $h2pSettings -> payout_url; $this -> payoutUrl = $h2pSettings -> payout_url;
$this -> ip = $h2pSettings -> ip_address; $this -> ip = $h2pSettings -> ip_address;
$this -> merchant_code = $h2pSettings -> merchant_code; $this -> merchant_code = $h2pSettings -> merchant_code;
......
...@@ -150,21 +150,6 @@ class Settle extends System { ...@@ -150,21 +150,6 @@ class Settle extends System {
} }
} }
private function getConfiguration($settingId){
$devSetting = $this -> getRowData($this -> accessSelect("SELECT_DEV_SETTING", [$settingId]));
if($this -> isLoopData($devSetting)){
$enabled = $this -> getColumnData($devSetting, "dev_setting_enabled");
if(!$enabled)
return false;
if($this -> checkJSONString($this -> getColumnData($devSetting, "dev_setting_value")))
return json_decode($this -> getColumnData($devSetting, "dev_setting_value"));
}else
return false;
}
private function validation(){ private function validation(){
$accessArray = [ $accessArray = [
"IP_Address" => $this -> getColumnData($_SERVER, "REMOTE_ADDR"), "IP_Address" => $this -> getColumnData($_SERVER, "REMOTE_ADDR"),
...@@ -289,8 +274,8 @@ class Settle extends System { ...@@ -289,8 +274,8 @@ class Settle extends System {
$this -> getColumnData($_SERVER, "HTTP_REFERER"), $this -> getColumnData($_SERVER, "HTTP_REFERER"),
"[SERVER_TO_SERVER]{$this -> payload}")); "[SERVER_TO_SERVER]{$this -> payload}"));
$middlewareSettings = $this -> getConfiguration("middleware_conf"); $middlewareSettings = $this -> getSettingConfiguration("middleware_conf");
$settlementSettings = $this -> getConfiguration("payment_api_conf"); $settlementSettings = $this -> getSettingConfiguration("payment_api_conf");
$jwtPayload = [ $jwtPayload = [
"purpose" => "PaymentAPI", "purpose" => "PaymentAPI",
......
...@@ -84,8 +84,8 @@ class EasyPaymentLinkAPI extends System { ...@@ -84,8 +84,8 @@ class EasyPaymentLinkAPI extends System {
} }
private function setParameter(){ private function setParameter(){
$this -> eplconf = $this -> getConfiguration("easy_payment_link"); $this -> eplconf = $this -> getSettingConfiguration("easy_payment_link");
$this -> midconf = $this -> getConfiguration("middleware_conf"); $this -> midconf = $this -> getSettingConfiguration("middleware_conf");
} }
private function validation(){ private function validation(){
...@@ -103,21 +103,6 @@ class EasyPaymentLinkAPI extends System { ...@@ -103,21 +103,6 @@ class EasyPaymentLinkAPI extends System {
throw new Exception(print_r($invalid, true)); throw new Exception(print_r($invalid, true));
} }
private function getConfiguration($settingId){
$devSetting = $this -> getRowData($this -> accessSelect("SELECT_DEV_SETTING", [$settingId]));
if($this -> isLoopData($devSetting)){
$enabled = $this -> getColumnData($devSetting, "dev_setting_enabled");
if(!$enabled)
return false;
if($this -> checkJSONString($this -> getColumnData($devSetting, "dev_setting_value")))
return json_decode($this -> getColumnData($devSetting, "dev_setting_value"));
}else
return false;
}
private function logDetails($content){ private function logDetails($content){
$timestamp = date("Y-m-d H:i:s"); $timestamp = date("Y-m-d H:i:s");
......
...@@ -2454,7 +2454,7 @@ class DepositModelClass extends ModelClassEx { ...@@ -2454,7 +2454,7 @@ class DepositModelClass extends ModelClassEx {
$this -> popUpSessionMessage(ERROR, 'E_REQUIRED_HELP2PAY_NOTAGGREE_OTHER', array()); $this -> popUpSessionMessage(ERROR, 'E_REQUIRED_HELP2PAY_NOTAGGREE_OTHER', array());
$this -> setType(TYPE_H2P_CONFIRM); $this -> setType(TYPE_H2P_CONFIRM);
} else { } else {
$h2pSettings = $this -> getConfiguration("help2pay_conf"); $h2pSettings = $this -> getSettingConfiguration("help2pay_conf");
$this -> h2pTransferUrl = $h2pSettings -> transfer_url; $this -> h2pTransferUrl = $h2pSettings -> transfer_url;
$this -> h2pSecurityCode = $h2pSettings -> security_code; $this -> h2pSecurityCode = $h2pSettings -> security_code;
...@@ -2800,8 +2800,8 @@ class DepositModelClass extends ModelClassEx { ...@@ -2800,8 +2800,8 @@ class DepositModelClass extends ModelClassEx {
$this -> getType() == TYPE_CCD_SUCCESS || $this -> getType() == TYPE_CCD_SUCCESS ||
$this -> getType() == TYPE_CCD_FAIL){ $this -> getType() == TYPE_CCD_FAIL){
$this -> eplconf = $this -> getConfiguration("easy_payment_link"); $this -> eplconf = $this -> getSettingConfiguration("easy_payment_link");
$midconf = $this -> getConfiguration("middleware_conf"); $midconf = $this -> getSettingConfiguration("middleware_conf");
if(!$this -> getUserBypassValue(PARAM_DEPOSIT, VAL_STR_CCDEPOSIT_METHOD, $this -> getUserData(PARAM_USER_ACCOUNT))){ if(!$this -> getUserBypassValue(PARAM_DEPOSIT, VAL_STR_CCDEPOSIT_METHOD, $this -> getUserData(PARAM_USER_ACCOUNT))){
$this -> popUpSessionMessage(ERROR, 'E_ERROR_OPTION_NOT_AVAILABLE', array()); $this -> popUpSessionMessage(ERROR, 'E_ERROR_OPTION_NOT_AVAILABLE', array());
...@@ -2900,29 +2900,6 @@ class DepositModelClass extends ModelClassEx { ...@@ -2900,29 +2900,6 @@ class DepositModelClass extends ModelClassEx {
return true; return true;
} }
/**
*
* @param string $settingId
* @return boolean|mixed|array|unknown
*/
private function getConfiguration($settingId){
$devSetting = $this -> getRowData($this -> accessSelect("SELECT_DEV_SETTING", [$settingId]));
if($this -> isLoopData($devSetting)){
$enabled = $this -> getColumnData($devSetting, "dev_setting_enabled");
if(!$enabled)
return false;
if($this -> checkJSONString($this -> getColumnData($devSetting, "dev_setting_value"))){
$devSetting = json_decode($this -> getColumnData($devSetting, "dev_setting_value"));
return $devSetting;
}
}
return false;
}
/** /**
* *
* @param unknown $paramName * @param unknown $paramName
......
...@@ -54,22 +54,7 @@ class MiddlewareModelClass extends ModelClassEx { ...@@ -54,22 +54,7 @@ class MiddlewareModelClass extends ModelClassEx {
private function setParameter() { private function setParameter() {
$this -> token = $this -> getDataGet("token"); $this -> token = $this -> getDataGet("token");
$this -> midconf = $this -> getConfiguration(); $this -> midconf = $this -> getSettingConfiguration("middleware_conf");
}
private function getConfiguration(){
$devSetting = $this -> getRowData($this -> accessSelect("SELECT_DEV_SETTING", ["middleware_conf"]));
if($this -> isLoopData($devSetting)){
$enabled = $this -> getColumnData($devSetting, "dev_setting_enabled");
if(!$enabled)
return false;
if($this -> checkJSONString($this -> getColumnData($devSetting, "dev_setting_value")))
return json_decode($this -> getColumnData($devSetting, "dev_setting_value"));
}else
return false;
} }
private function decodeToken(){ private function decodeToken(){
......
...@@ -66,7 +66,7 @@ class EasyPaymentLink extends System { ...@@ -66,7 +66,7 @@ class EasyPaymentLink extends System {
*/ */
public function __construct(){ public function __construct(){
parent::__construct(); parent::__construct();
$this -> eplconf = $this -> getConfiguration(); $this -> eplconf = $this -> getSettingConfiguration("easy_payment_link");
$this -> eplTransactionId = $this -> getDataGet("transaction_id"); $this -> eplTransactionId = $this -> getDataGet("transaction_id");
} }
...@@ -108,27 +108,6 @@ class EasyPaymentLink extends System { ...@@ -108,27 +108,6 @@ class EasyPaymentLink extends System {
$purpose -> redirection(); $purpose -> redirection();
} }
/**
*
* 開発者の設定
*
* @return boolean|mixed
*/
private function getConfiguration(){
$devSetting = $this -> getRowData($this -> accessSelect("SELECT_DEV_SETTING", ["easy_payment_link"]));
if($this -> isLoopData($devSetting)){
$enabled = $this -> getColumnData($devSetting, "dev_setting_enabled");
if(!$enabled)
return false;
if($this -> checkJSONString($this -> getColumnData($devSetting, "dev_setting_value")))
return json_decode($this -> getColumnData($devSetting, "dev_setting_value"));
}else
return false;
}
/** /**
* *
* 取引の処理 * 取引の処理
......
...@@ -57,8 +57,8 @@ class PaymentAPI extends System { ...@@ -57,8 +57,8 @@ class PaymentAPI extends System {
} }
private function initSettings(){ private function initSettings(){
$this -> paymentAPIconf = $this -> getConfiguration("payment_api_conf"); $this -> paymentAPIconf = $this -> getSettingConfiguration("payment_api_conf");
$this -> midconf = $this -> getConfiguration("middleware_conf"); $this -> midconf = $this -> getSettingConfiguration("middleware_conf");
if(isset($this -> paymentAPIconf -> middleware_sig_passphrase)){ if(isset($this -> paymentAPIconf -> middleware_sig_passphrase)){
$replacements = [ $replacements = [
...@@ -142,24 +142,6 @@ class PaymentAPI extends System { ...@@ -142,24 +142,6 @@ class PaymentAPI extends System {
$this -> data = $data; $this -> data = $data;
} }
/**
*
* 開発者の設定
*
* @return boolean|mixed
*/
private function getConfiguration($settingId){
$devSetting = $this -> getRowData($this -> accessSelect("SELECT_DEV_SETTING", [$settingId]));
if($this -> isLoopData($devSetting)){
if($this -> checkJSONString($this -> getColumnData($devSetting, "dev_setting_value"))){
$settingsValue = json_decode($this -> getColumnData($devSetting, "dev_setting_value"));
return $settingsValue;
}
}else
return false;
}
/** /**
* *
* 確認の結果設定 * 確認の結果設定
......
...@@ -132,8 +132,8 @@ class SettlementModelClass extends ModelClassEx { ...@@ -132,8 +132,8 @@ class SettlementModelClass extends ModelClassEx {
} }
private function initSettings(){ private function initSettings(){
$this -> midconf = $this -> getConfiguration("middleware_conf"); $this -> midconf = $this -> getSettingConfiguration("middleware_conf");
$this -> paymentAPIConf = $this -> getConfiguration("payment_api_conf"); $this -> paymentAPIConf = $this -> getSettingConfiguration("payment_api_conf");
if(isset($this -> paymentAPIConf -> middleware_sig_passphrase)){ if(isset($this -> paymentAPIConf -> middleware_sig_passphrase)){
$replacements = [ $replacements = [
...@@ -153,24 +153,6 @@ class SettlementModelClass extends ModelClassEx { ...@@ -153,24 +153,6 @@ class SettlementModelClass extends ModelClassEx {
$this -> setType(TYPE_SETTLEMENT_EXPRESS_FORM); $this -> setType(TYPE_SETTLEMENT_EXPRESS_FORM);
} }
/**
*
* 開発者の設定
*
* @return boolean|mixed
*/
private function getConfiguration($settingId){
$devSetting = $this -> getRowData($this -> accessSelect("SELECT_DEV_SETTING", [$settingId]));
if($this -> isLoopData($devSetting)){
if($this -> checkJSONString($this -> getColumnData($devSetting, "dev_setting_value"))){
$settingsValue = json_decode($this -> getColumnData($devSetting, "dev_setting_value"));
return $settingsValue;
}
}else
return false;
}
/** /**
* *
* @param unknown $formName * @param unknown $formName
......
...@@ -27,7 +27,7 @@ class DevComponents extends System { ...@@ -27,7 +27,7 @@ class DevComponents extends System {
* @return array * @return array
*/ */
public function getDevSetting($devSettingId){ public function getDevSetting($devSettingId){
return $this -> getRowData($this -> accessSelect("SELECT_DEV_SETTING", [$devSettingId]), NO_COUNT); return $this -> getSettingConfiguration($devSettingId);
} }
/** /**
......
...@@ -399,14 +399,13 @@ class Checker extends Chiket { ...@@ -399,14 +399,13 @@ class Checker extends Chiket {
} }
} }
$res = $this -> getRowData($this -> accessSelect("SELECT_DEV_SETTING", ["maintenance_mode_{$location}"])); $maintenanceMode = $this -> getSettingConfiguration("maintenance_mode_{$location}");
if($this -> isLoopData($res)){ if($maintenanceMode){
$maintenanceMode = json_decode($res["dev_setting_value"]);
$whitelistedIpAddress = explode(",", $maintenanceMode -> exceptIpAddress); $whitelistedIpAddress = explode(",", $maintenanceMode -> exceptIpAddress);
if($maintenanceMode -> enabled){ if($maintenanceMode -> enabled){
if(!in_array($_SERVER["REMOTE_ADDR"], $whitelistedIpAddress)){ if(!in_array($this -> getColumnData($_SERVER, "REMOTE_ADDR"), $whitelistedIpAddress)){
if($callback != null) if($callback != null)
$callback(); $callback();
......
...@@ -439,12 +439,10 @@ class Common extends HtmlBuilder { ...@@ -439,12 +439,10 @@ class Common extends HtmlBuilder {
* @return : 配列 * @return : 配列
-------------------------------------------------------------------------*/ -------------------------------------------------------------------------*/
private function grantDepositSolution(){ private function grantDepositSolution(){
$result = $this -> getRowData($this -> accessSelect("SELECT_DEV_SETTING", ["grant_deposit_solution"])); $grant = $this -> getSettingConfiguration("grant_deposit_solution");
if($this -> isLoopData($result)){ if($grant)
if($result["dev_setting_enabled"] == VAL_INT_1) return $grant;
return $result["dev_setting_value"];
}
return NO_STRING; return NO_STRING;
} }
...@@ -484,6 +482,28 @@ class Common extends HtmlBuilder { ...@@ -484,6 +482,28 @@ class Common extends HtmlBuilder {
return $rtn; return $rtn;
} }
/*-------------------------------------------------------------------------
* @function_name: 設定コンフィグレーション
* @parameter : 設定ID
* @return : 物
-------------------------------------------------------------------------*/
public function getSettingConfiguration($settingId){
$result = $this -> getRowData($this -> accessSelect("SELECT_DEV_SETTING", [$settingId]));
if($this -> isLoopData($result)){
$enabled = $this -> getColumnData($result, "dev_setting_enabled");
if($enabled){
$confData = $this -> getColumnData($result, "dev_setting_value");
if($this -> checkJSONString($confData))
return json_decode($confData);
}
}
return null;
}
/*------------------------------------------------------------------------- /*-------------------------------------------------------------------------
* @function_name: ユーザデータを取得する * @function_name: ユーザデータを取得する
......
...@@ -97,11 +97,9 @@ class H2PPayoutTesting extends FrameworkTest{ ...@@ -97,11 +97,9 @@ class H2PPayoutTesting extends FrameworkTest{
private function setParameter(){ private function setParameter(){
date_default_timezone_set('Asia/Manila'); date_default_timezone_set('Asia/Manila');
$h2pSettings = $this -> getRowData($this -> accessSelect("SELECT_DEV_SETTING", ["help2pay_conf"])); $h2pSettings = $this -> getSettingConfiguration("help2pay_conf");
if($this -> isLoopData($h2pSettings)){ if($h2pSettings){
$h2pSettings = json_decode($this -> getColumnData($h2pSettings, "dev_setting_value"));
$this -> merchantCode = $h2pSettings -> merchant_code; $this -> merchantCode = $h2pSettings -> merchant_code;
$this -> payoutURL = str_replace("{merchantcode}", $this -> merchantCode, $h2pSettings -> payout_url); $this -> payoutURL = str_replace("{merchantcode}", $this -> merchantCode, $h2pSettings -> payout_url);
$this -> ipAddress = $h2pSettings -> ip_address; $this -> ipAddress = $h2pSettings -> ip_address;
......
...@@ -124,14 +124,12 @@ class TestDeposit extends FrameworkTest { ...@@ -124,14 +124,12 @@ class TestDeposit extends FrameworkTest {
} }
private function setParameter(){ private function setParameter(){
$h2pSettings = $this -> getRowData($this -> accessSelect("SELECT_DEV_SETTING", ["help2pay_conf"])); $h2pSettings = $this -> getSettingConfiguration("help2pay_conf");
if($this -> isLoopData($h2pSettings)){ if($h2pSettings){
$h2pSettings = json_decode($this -> getColumnData($h2pSettings, "dev_setting_value"));
$this -> merchantCode = $h2pSettings -> merchant_code; $this -> merchantCode = $h2pSettings -> merchant_code;
$this -> transferURL = $h2pSettings -> transfer_url; $this -> transferURL = $h2pSettings -> transfer_url;
$this -> ipAddress = $_SERVER["REMOTE_ADDR"]; $this -> ipAddress = $this -> getColumnData($_SERVER, "REMOTE_ADDR");
$this -> securityCode = $h2pSettings -> security_code; $this -> securityCode = $h2pSettings -> security_code;
} }
......
...@@ -7,21 +7,14 @@ class FrameworkTest extends System { ...@@ -7,21 +7,14 @@ class FrameworkTest extends System {
} }
public function checkRemoteAddress(){ public function checkRemoteAddress(){
$devSetting = $this -> getRowData($this -> accessSelect("SELECT_DEV_SETTING", ["tester_tool_conf"])); $devSetting = $this -> getSettingConfiguration("tester_tool_conf");
if($this -> isLoopData($devSetting)){ if($devSetting){
if(!$this -> getColumnData($devSetting, "dev_setting_enabled")) $ipAddresses = explode(",", $devSetting -> ip_address);
return true; $remoteAddress = $this -> getColumnData($_SERVER, "REMOTE_ADDR");
if($this -> checkJSONString($this -> getColumnData($devSetting, "dev_setting_value"))){ if(in_array($remoteAddress, $ipAddresses))
$devSetting = json_decode($this -> getColumnData($devSetting, "dev_setting_value")); return true;
$ipAddresses = explode(",", $devSetting -> ip_address);
$remoteAddress = $this -> getColumnData($_SERVER, "REMOTE_ADDR");
if(in_array($remoteAddress, $ipAddresses))
return true;
}
} }
return false; return false;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment