Commit e9039541 authored by Antonio.Suerte's avatar Antonio.Suerte

Setting Centralization

parent 52f8966d
......@@ -75,14 +75,7 @@ class Flat3Webhook extends System {
$this -> transLog = "../Logs/SAPAY";
$this -> errorLog = "../Logs/SAPAY/Error";
$this -> devSetting = $this -> getRowData($this -> accessSelect("SELECT_DEV_SETTING", ["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"));
}
$this -> devSetting = $this -> getSettingConfiguration("flat3_webhook");
}
private function requestDetails(){
......
......@@ -16,11 +16,9 @@ class help2PayAPI extends System {
}
private function fillCredentials(){
$h2pSettings = $this -> getRowData($this -> accessSelect("SELECT_DEV_SETTING", ["help2pay_conf"]));
if($this -> isLoopData($h2pSettings)){
$h2pSettings = json_decode($this -> getColumnData($h2pSettings, "dev_setting_value"));
$h2pSettings = $this -> getSettingConfiguration("help2pay_conf");
if($h2pSettings){
$this -> payoutUrl = $h2pSettings -> payout_url;
$this -> ip = $h2pSettings -> ip_address;
$this -> merchant_code = $h2pSettings -> merchant_code;
......
......@@ -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(){
$accessArray = [
"IP_Address" => $this -> getColumnData($_SERVER, "REMOTE_ADDR"),
......@@ -289,8 +274,8 @@ class Settle extends System {
$this -> getColumnData($_SERVER, "HTTP_REFERER"),
"[SERVER_TO_SERVER]{$this -> payload}"));
$middlewareSettings = $this -> getConfiguration("middleware_conf");
$settlementSettings = $this -> getConfiguration("payment_api_conf");
$middlewareSettings = $this -> getSettingConfiguration("middleware_conf");
$settlementSettings = $this -> getSettingConfiguration("payment_api_conf");
$jwtPayload = [
"purpose" => "PaymentAPI",
......
......@@ -84,8 +84,8 @@ class EasyPaymentLinkAPI extends System {
}
private function setParameter(){
$this -> eplconf = $this -> getConfiguration("easy_payment_link");
$this -> midconf = $this -> getConfiguration("middleware_conf");
$this -> eplconf = $this -> getSettingConfiguration("easy_payment_link");
$this -> midconf = $this -> getSettingConfiguration("middleware_conf");
}
private function validation(){
......@@ -103,21 +103,6 @@ class EasyPaymentLinkAPI extends System {
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){
$timestamp = date("Y-m-d H:i:s");
......
......@@ -2454,7 +2454,7 @@ class DepositModelClass extends ModelClassEx {
$this -> popUpSessionMessage(ERROR, 'E_REQUIRED_HELP2PAY_NOTAGGREE_OTHER', array());
$this -> setType(TYPE_H2P_CONFIRM);
} else {
$h2pSettings = $this -> getConfiguration("help2pay_conf");
$h2pSettings = $this -> getSettingConfiguration("help2pay_conf");
$this -> h2pTransferUrl = $h2pSettings -> transfer_url;
$this -> h2pSecurityCode = $h2pSettings -> security_code;
......@@ -2800,8 +2800,8 @@ class DepositModelClass extends ModelClassEx {
$this -> getType() == TYPE_CCD_SUCCESS ||
$this -> getType() == TYPE_CCD_FAIL){
$this -> eplconf = $this -> getConfiguration("easy_payment_link");
$midconf = $this -> getConfiguration("middleware_conf");
$this -> eplconf = $this -> getSettingConfiguration("easy_payment_link");
$midconf = $this -> getSettingConfiguration("middleware_conf");
if(!$this -> getUserBypassValue(PARAM_DEPOSIT, VAL_STR_CCDEPOSIT_METHOD, $this -> getUserData(PARAM_USER_ACCOUNT))){
$this -> popUpSessionMessage(ERROR, 'E_ERROR_OPTION_NOT_AVAILABLE', array());
......@@ -2900,29 +2900,6 @@ class DepositModelClass extends ModelClassEx {
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
......
......@@ -54,22 +54,7 @@ class MiddlewareModelClass extends ModelClassEx {
private function setParameter() {
$this -> token = $this -> getDataGet("token");
$this -> midconf = $this -> getConfiguration();
}
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;
$this -> midconf = $this -> getSettingConfiguration("middleware_conf");
}
private function decodeToken(){
......
......@@ -66,7 +66,7 @@ class EasyPaymentLink extends System {
*/
public function __construct(){
parent::__construct();
$this -> eplconf = $this -> getConfiguration();
$this -> eplconf = $this -> getSettingConfiguration("easy_payment_link");
$this -> eplTransactionId = $this -> getDataGet("transaction_id");
}
......@@ -108,27 +108,6 @@ class EasyPaymentLink extends System {
$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 {
}
private function initSettings(){
$this -> paymentAPIconf = $this -> getConfiguration("payment_api_conf");
$this -> midconf = $this -> getConfiguration("middleware_conf");
$this -> paymentAPIconf = $this -> getSettingConfiguration("payment_api_conf");
$this -> midconf = $this -> getSettingConfiguration("middleware_conf");
if(isset($this -> paymentAPIconf -> middleware_sig_passphrase)){
$replacements = [
......@@ -142,24 +142,6 @@ class PaymentAPI extends System {
$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 {
}
private function initSettings(){
$this -> midconf = $this -> getConfiguration("middleware_conf");
$this -> paymentAPIConf = $this -> getConfiguration("payment_api_conf");
$this -> midconf = $this -> getSettingConfiguration("middleware_conf");
$this -> paymentAPIConf = $this -> getSettingConfiguration("payment_api_conf");
if(isset($this -> paymentAPIConf -> middleware_sig_passphrase)){
$replacements = [
......@@ -153,24 +153,6 @@ class SettlementModelClass extends ModelClassEx {
$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
......
......@@ -27,7 +27,7 @@ class DevComponents extends System {
* @return array
*/
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 {
}
}
$res = $this -> getRowData($this -> accessSelect("SELECT_DEV_SETTING", ["maintenance_mode_{$location}"]));
$maintenanceMode = $this -> getSettingConfiguration("maintenance_mode_{$location}");
if($this -> isLoopData($res)){
$maintenanceMode = json_decode($res["dev_setting_value"]);
if($maintenanceMode){
$whitelistedIpAddress = explode(",", $maintenanceMode -> exceptIpAddress);
if($maintenanceMode -> enabled){
if(!in_array($_SERVER["REMOTE_ADDR"], $whitelistedIpAddress)){
if(!in_array($this -> getColumnData($_SERVER, "REMOTE_ADDR"), $whitelistedIpAddress)){
if($callback != null)
$callback();
......
......@@ -439,12 +439,10 @@ class Common extends HtmlBuilder {
* @return : 配列
-------------------------------------------------------------------------*/
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($result["dev_setting_enabled"] == VAL_INT_1)
return $result["dev_setting_value"];
}
if($grant)
return $grant;
return NO_STRING;
}
......@@ -485,6 +483,28 @@ class Common extends HtmlBuilder {
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: ユーザデータを取得する
* @parameter : なし
......
......@@ -97,11 +97,9 @@ class H2PPayoutTesting extends FrameworkTest{
private function setParameter(){
date_default_timezone_set('Asia/Manila');
$h2pSettings = $this -> getRowData($this -> accessSelect("SELECT_DEV_SETTING", ["help2pay_conf"]));
if($this -> isLoopData($h2pSettings)){
$h2pSettings = json_decode($this -> getColumnData($h2pSettings, "dev_setting_value"));
$h2pSettings = $this -> getSettingConfiguration("help2pay_conf");
if($h2pSettings){
$this -> merchantCode = $h2pSettings -> merchant_code;
$this -> payoutURL = str_replace("{merchantcode}", $this -> merchantCode, $h2pSettings -> payout_url);
$this -> ipAddress = $h2pSettings -> ip_address;
......
......@@ -124,14 +124,12 @@ class TestDeposit extends FrameworkTest {
}
private function setParameter(){
$h2pSettings = $this -> getRowData($this -> accessSelect("SELECT_DEV_SETTING", ["help2pay_conf"]));
if($this -> isLoopData($h2pSettings)){
$h2pSettings = json_decode($this -> getColumnData($h2pSettings, "dev_setting_value"));
$h2pSettings = $this -> getSettingConfiguration("help2pay_conf");
if($h2pSettings){
$this -> merchantCode = $h2pSettings -> merchant_code;
$this -> transferURL = $h2pSettings -> transfer_url;
$this -> ipAddress = $_SERVER["REMOTE_ADDR"];
$this -> ipAddress = $this -> getColumnData($_SERVER, "REMOTE_ADDR");
$this -> securityCode = $h2pSettings -> security_code;
}
......
......@@ -7,22 +7,15 @@ class FrameworkTest extends System {
}
public function checkRemoteAddress(){
$devSetting = $this -> getRowData($this -> accessSelect("SELECT_DEV_SETTING", ["tester_tool_conf"]));
if($this -> isLoopData($devSetting)){
if(!$this -> getColumnData($devSetting, "dev_setting_enabled"))
return true;
if($this -> checkJSONString($this -> getColumnData($devSetting, "dev_setting_value"))){
$devSetting = json_decode($this -> getColumnData($devSetting, "dev_setting_value"));
$devSetting = $this -> getSettingConfiguration("tester_tool_conf");
if($devSetting){
$ipAddresses = explode(",", $devSetting -> ip_address);
$remoteAddress = $this -> getColumnData($_SERVER, "REMOTE_ADDR");
if(in_array($remoteAddress, $ipAddresses))
return true;
}
}
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