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

Monthly Maintenance Fee API Enhancement

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