Commit 0b5c6f3c authored by Antonio.Suerte's avatar Antonio.Suerte

Merchant Balance API: Enabler and Enhancements

parent 6133c69e
...@@ -94,6 +94,12 @@ class MerchantBalance extends System { ...@@ -94,6 +94,12 @@ class MerchantBalance extends System {
$registPassword = $this -> getColumnData($macc, COLUMN_PASSWORD); $registPassword = $this -> getColumnData($macc, COLUMN_PASSWORD);
if($this -> password == $registPassword){ if($this -> password == $registPassword){
$wlistSettings = $this -> getColumnData($macc, COLUMN_WHITELIST_SETTING);
if($this -> checkJSONString($wlistSettings)){
$wlistSettings = json_decode($wlistSettings);
if(isset($wlistSettings -> allow_merchant_balance) && $wlistSettings -> allow_merchant_balance){
$wIpAddresses = $this -> getColumnData($macc, COLUMN_IP_ADDRESS); $wIpAddresses = $this -> getColumnData($macc, COLUMN_IP_ADDRESS);
$wIpAddresses = explode(DELIMIT_COMMA, $wIpAddresses); $wIpAddresses = explode(DELIMIT_COMMA, $wIpAddresses);
...@@ -105,7 +111,12 @@ class MerchantBalance extends System { ...@@ -105,7 +111,12 @@ class MerchantBalance extends System {
}else }else
$invalid[] = "Account for pnum {$this -> pnum} doesn't exist."; $invalid[] = "Account for pnum {$this -> pnum} doesn't exist.";
}else }else
$invalid[] = "Invalid IP Address"; $invalid[] = "Invalid IP Address: {{$this -> remoteAddress}}";
}else
$invalid[] = "Balance API isn't enabled to pnum {{$this -> pnum}}";
}else
$invalid[] = "Internal Error Occurred";
}else }else
$invalid[] = "Incorrect Password"; $invalid[] = "Incorrect Password";
} }
...@@ -137,9 +148,18 @@ class MerchantBalance extends System { ...@@ -137,9 +148,18 @@ class MerchantBalance extends System {
foreach($balances as &$balance){ foreach($balances as &$balance){
unset($balance[COLUMN_USER_ACCOUNT]); unset($balance[COLUMN_USER_ACCOUNT]);
$balance[COLUMN_BALANCE] = $this -> intToCurrency( $props = [
$balance[COLUMN_BALANCE], COLUMN_BALANCE,
$balance[COLUMN_CURRENCY]); COLUMN_WITHDRAW_AMOUNT,
COLUMN_DEPOSIT_AMOUNT
];
foreach($props as $prop){
if(is_numeric($balance[$prop])){
$currency = $balance[COLUMN_CURRENCY];
$balance[$prop] = $this -> intToCurrency($balance[$prop], $currency);
}
}
} }
echo json_encode($balances); echo json_encode($balances);
......
...@@ -123,6 +123,7 @@ define('VAL_STR_TARGET_COUNTRY', 'サービス主要対象国'); ...@@ -123,6 +123,7 @@ define('VAL_STR_TARGET_COUNTRY', 'サービス主要対象国');
define('VAL_STR_URL', 'URL'); define('VAL_STR_URL', 'URL');
define('VAL_STR_IP_ADDRESS_VALIDATION', 'IPアドレス確認'); define('VAL_STR_IP_ADDRESS_VALIDATION', 'IPアドレス確認');
define('VAL_STR_DOMAIN_NAME_VALIDATION', 'ドメイン名の確認'); define('VAL_STR_DOMAIN_NAME_VALIDATION', 'ドメイン名の確認');
define('VAL_STR_ENABLE_BALANCE_API', '法人残高APIを有効にする');
define('VAL_STR_ALLOW_SERVER_TO_SERVER', 'ウェブサービスの許可'); define('VAL_STR_ALLOW_SERVER_TO_SERVER', 'ウェブサービスの許可');
define('VAL_STR_SITE_URL', 'サイトURL'); define('VAL_STR_SITE_URL', 'サイトURL');
define('VAL_STR_MANAGER_NAME', '口座取引責任者氏名'); define('VAL_STR_MANAGER_NAME', '口座取引責任者氏名');
......
...@@ -125,6 +125,7 @@ define('VAL_STR_TARGET_COUNTRY', 'Targeted country'); ...@@ -125,6 +125,7 @@ define('VAL_STR_TARGET_COUNTRY', 'Targeted country');
define('VAL_STR_URL', 'URL'); define('VAL_STR_URL', 'URL');
define('VAL_STR_IP_ADDRESS_VALIDATION', 'IP Address Validation'); define('VAL_STR_IP_ADDRESS_VALIDATION', 'IP Address Validation');
define('VAL_STR_DOMAIN_NAME_VALIDATION', 'Domain Name Validation'); define('VAL_STR_DOMAIN_NAME_VALIDATION', 'Domain Name Validation');
define('VAL_STR_ENABLE_BALANCE_API', 'Enable Balance API');
define('VAL_STR_ALLOW_SERVER_TO_SERVER', 'Allow Server-to-Server'); define('VAL_STR_ALLOW_SERVER_TO_SERVER', 'Allow Server-to-Server');
define('VAL_STR_SITE_URL', 'Website URL'); define('VAL_STR_SITE_URL', 'Website URL');
define('VAL_STR_MANAGER_NAME', 'Name of personal in charge of account'); define('VAL_STR_MANAGER_NAME', 'Name of personal in charge of account');
......
...@@ -299,7 +299,8 @@ class ApiSignatureModelClass extends ModelClassEx { ...@@ -299,7 +299,8 @@ class ApiSignatureModelClass extends ModelClassEx {
"allow_domain_in_payment" => false, "allow_domain_in_payment" => false,
"allow_curl_in_payment" => false, "allow_curl_in_payment" => false,
"allow_ip_in_remittance" => false, "allow_ip_in_remittance" => false,
"allow_domain_in_remittance" => false "allow_domain_in_remittance" => false,
"allow_merchant_balance" => false
]; ];
foreach(array_keys($whitelistSetting) as $key){ foreach(array_keys($whitelistSetting) as $key){
...@@ -485,6 +486,9 @@ class ApiSignatureModelClass extends ModelClassEx { ...@@ -485,6 +486,9 @@ class ApiSignatureModelClass extends ModelClassEx {
"Remittance API" => [ "Remittance API" => [
VAL_STR_IP_ADDRESS_VALIDATION => "allow_ip_in_remittance", VAL_STR_IP_ADDRESS_VALIDATION => "allow_ip_in_remittance",
VAL_STR_DOMAIN_NAME_VALIDATION => "allow_domain_in_remittance" VAL_STR_DOMAIN_NAME_VALIDATION => "allow_domain_in_remittance"
],
"Merchant Balance API" => [
VAL_STR_ENABLE_BALANCE_API => "allow_merchant_balance"
] ]
]; ];
......
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