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

Monthly Maintenance Fee API Enhancement

parent 8ded5489
......@@ -33,6 +33,12 @@ class MonthlyCharge extends System {
*/
private $requestMethod;
/**
*
* @var array
*/
private $collatedTransactions = [];
/**
*
* コンストラクタ
......@@ -96,11 +102,19 @@ class MonthlyCharge extends System {
* @param double $amount
*/
private function executeWithdraw($account, $currency, $amount){
if($amount <= NO_COUNT)
return;
$params = $this -> transactionParams($account, $currency, $amount);
if ($this -> forTest) {
$simulatedAmount = $this -> intToCurrency($amount, $currency);
echo "Simulation: Charged For {$currency} {$simulatedAmount}\n";
$params[] = "test-only";
} else
$this -> monthlyWithdraw($account, $currency, $amount);
$this -> monthlyWithdraw($params);
$params[VAL_INT_2] = $this -> intToCurrency($amount, $currency);
$this -> collatedTransactions[] = $params;
}
/**
......@@ -109,12 +123,32 @@ class MonthlyCharge extends System {
* @param string $currency
* @param double $amount
*/
private function monthlyWithdraw($account, $currency, $amount) {
$this -> registFeeCommon($account,
$currency,
$this -> intToCurrency($amount, $currency),
'Monthly Maintenance',
VAL_INT_2);
private function monthlyWithdraw($params) {
// データを登録する
return $this -> accessModify('INSERT_WITHDRAW_FEE', $params);
}
/**
*
* @param unknown $account
* @param unknown $currency
* @param unknown $amount
* @return string[]
*/
private function transactionParams($account, $currency, $amount){
$params = [];
$feeInt = $amount;
// パラメータの作成
$params[] = $account;
$params[] = $currency;
$params[] = $feeInt;
$params[] = VAR_WITHDRAW_TYPE_FEE;
$params[] = $this -> getTransactionNumberCommon(VAR_TRANSACTION_MONTHLY_FEE);
$params[] = "Monthly Maintenance";
$params[] = VAL_INT_2;
return $params;
}
/**
......@@ -195,6 +229,8 @@ class MonthlyCharge extends System {
*/
public function listen(){
$this -> charge();
echo json_encode($this -> collatedTransactions);
}
}
......
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