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

Merchant Balance API: Enabler and Enhancements

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