Commit 339abc8a authored by iWallet Dev's avatar iWallet Dev

Added Exception to Admin Corp Account

parent 12598b57
......@@ -126,6 +126,10 @@ class WithdrawModelClass extends ModelClassEx {
$this -> account = $this -> getRowData($this -> getAccountCommon($this -> getUserData(PARAM_USER_ACCOUNT)));
$this -> administrativeExceptions = $this -> getSettingConfiguration("administrative_exception");
$this -> administrativeExceptions = array_map(function($element){
return $element -> user_account;
}, $this -> administrativeExceptions);
//if moneyout solution is not null save it to session
if($this -> moneyoutSolution != NO_STRING && in_array($this -> moneyoutSolution, VAL_ARR_MONEYOUT_SOLUTIONS)){
......@@ -185,7 +189,7 @@ class WithdrawModelClass extends ModelClassEx {
* @parameter : なし
* @return : TRUE:成功、FALSE:失敗
-------------------------------------------------------------------------*/
public function validate() {
public function validate() {
$rtn = true;
//set type confirm, type complete and type back based on money out solution
......@@ -312,12 +316,8 @@ class WithdrawModelClass extends ModelClassEx {
, $this -> getUserData(PARAM_USER_ACCOUNT));
}
// 手数料なし
$accounts = array_map(function($element){
return $element -> user_account;
}, $this -> administrativeExceptions);
if(!in_array($this -> getUserData(PARAM_USER_ACCOUNT), $accounts)){
// 手数料なし
if(!in_array($this -> getUserData(PARAM_USER_ACCOUNT), $this -> administrativeExceptions)){
// バランスと(送金額 + 手数料)のチェック
if($this -> fromCurrency == USD)
$this -> setFeeEx($fee[USD . VAL_INT_1]);
......@@ -443,14 +443,9 @@ class WithdrawModelClass extends ModelClassEx {
, NO_STRING
, $this -> getUserData(PARAM_USER_ACCOUNT));
}
// setting exception
$accounts = array_map(function($element){
return $element -> user_account;
}, $this -> administrativeExceptions);
// バランスと(送金額 + 手数料)のチェック
if(!in_array($this -> getUserData(PARAM_USER_ACCOUNT), $accounts)){
if(!in_array($this -> getUserData(PARAM_USER_ACCOUNT), $this -> administrativeExceptions)){
if($this -> fromCurrency == USD)
$this -> setFeeEx($fee[USD . VAL_INT_1]);
else
......@@ -479,7 +474,8 @@ class WithdrawModelClass extends ModelClassEx {
$rtn = false;
}
if($this -> amount > 500000){
if(!in_array($this -> getUserData(PARAM_USER_ACCOUNT), $this -> administrativeExceptions)
&& $this -> amount > 500000){
$this -> popUpSessionMessage(ERROR, 'E_ERROR_AMOUNT', array());
$rtn = false;
}
......@@ -517,12 +513,8 @@ class WithdrawModelClass extends ModelClassEx {
//check if flat 3
if($_SESSION['moneyoutSolution'] == 'Flat3'){
$flat3Fee = round($this -> debitAmount * VAL_FLOAT_FLAT3_WITHDRAW_FEE, 2);
$accounts = array_map(function($element){
return $element -> user_account;
}, $this -> administrativeExceptions);
if(!in_array($this -> getUserData(PARAM_USER_ACCOUNT), $accounts)){
if(!in_array($this -> getUserData(PARAM_USER_ACCOUNT), $this -> administrativeExceptions)){
$this -> arrangeMinimumFee();
}
}
......@@ -789,7 +781,8 @@ class WithdrawModelClass extends ModelClassEx {
//check if method is Flat3
if($_SESSION['moneyoutSolution'] == 'Flat3'){
if(count($this -> getPendingWithdrawalTransactions())){
if(!in_array($this -> getUserData(PARAM_USER_ACCOUNT), $this -> administrativeExceptions)
&& count($this -> getPendingWithdrawalTransactions())){
$this -> popUpSessionMessage(ERROR, 'E_ERROR_PENDING_FLAT3_WITHDRAWAL', array());
$this -> setType();
return;
......@@ -1602,19 +1595,10 @@ class WithdrawModelClass extends ModelClassEx {
}
$this -> drawFee = $standardJPYFee["published_amount"];
$loggedInUserAcc = $this -> getUserData(PARAM_USER_ACCOUNT);
$adminException = $this -> getSettingConfiguration("administrative_exception");
foreach($adminException as $data){
if(isset($data -> user_account) && $data -> user_account === $loggedInUserAcc){
if(isset($data -> ignore_f3withdrawal_fee) && $data -> ignore_f3withdrawal_fee){
$this -> setFeeEx(NO_COUNT);
$this -> drawFee = NO_COUNT;
}
break;
}
if(in_array($this -> getUserData(PARAM_USER_ACCOUNT), $this -> administrativeExceptions)){
$this -> setFeeEx(NO_COUNT);
$this -> drawFee = NO_COUNT;
}
}
......@@ -2214,12 +2198,8 @@ class WithdrawModelClass extends ModelClassEx {
public function getOutStatus()
{
$rtn = array();
$userAccounts = array_map(function($element){
return $element -> user_account;
}, $this -> administrativeExceptions);
if(in_array($this -> getUserData(PARAM_USER_ACCOUNT), $userAccounts)){
if(in_array($this -> getUserData(PARAM_USER_ACCOUNT), $this -> administrativeExceptions)){
$method = getOutMoney();
} else {
$method = getOouMoney();
......@@ -2278,12 +2258,8 @@ class WithdrawModelClass extends ModelClassEx {
} elseif(!$this -> checkStringNumber($this -> amount)) {
$this -> popUpSessionMessage(ERROR, 'E_ERROR_REGULAR_NUMBER', array(VAL_STR_AMOUNT));
$rtn = false;
} elseif(!$this->CheckWithdrawMinimum($this -> currency, $this -> amount)) { //check withdrawal minimum
$userAccounts = array_map(function($element){
return $element -> user_account;
}, $this -> administrativeExceptions);
if(!in_array($this -> getUserData(PARAM_USER_ACCOUNT), $userAccounts)){
} elseif(!$this->CheckWithdrawMinimum($this -> currency, $this -> amount)) { //check withdrawal minimum
if(!in_array($this -> getUserData(PARAM_USER_ACCOUNT), $this -> administrativeExceptions)){
$exchange = $this -> getExchangeCommon(VAL_INT_MINIMUM_WITHDRAW_AMOUNT, 'USD', $this -> currency,
false, false, NO_STRING, $this -> getUserData(PARAM_USER_ACCOUNT)); // anton
$this -> popUpSessionMessage(ERROR, 'E_ERROR_WITHDRAW_MINIMUM', array($this -> currency, $exchange[PARAM_ORIGINAL_AMOUNT]));
......
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