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

Payment API Callback Sender Issue Fix [Multiple CB Prevention]

parent fc1c2eb3
......@@ -127,25 +127,11 @@ class LogicSettlement extends SettlementModelClass {
}
/*-------------------------------------------------------------------------
* @function_name: データの登録
* @function_name: データは商人へ送信する処理
* @parameter : なし
* @return : なし
-------------------------------------------------------------------------*/
private function forward($result) {
// 変数宣言部
$url = NO_STRING;
$data = null;
// 転送先
$url = $this -> getUrl();
$callBack = $this -> getCallBackUrl();
$failUrl = $this -> getFailUrl();
// コールバック
$data = $this -> getForwardParams($result);
$jsonData = json_encode($data);
$data = http_build_query($data, '', '&');
private function sendCallbackToIntegrator($callBack, $data){
//log directory
$apiPath = dirname(SYSTEM_PATH).DIRECTORY_SEPARATOR.'api';
$responseUrl = $apiPath.DIRECTORY_SEPARATOR.'Logs'.DIRECTORY_SEPARATOR.'settlement'.DIRECTORY_SEPARATOR.'settlement_response_data';
......@@ -192,6 +178,29 @@ class LogicSettlement extends SettlementModelClass {
chmod($logFileName, 511);
// end of logging response data
}
/*-------------------------------------------------------------------------
* @function_name: データの登録
* @parameter : なし
* @return : なし
-------------------------------------------------------------------------*/
private function forward($result) {
header("Content-type: text/plain");
// 変数宣言部
$url = NO_STRING;
$data = null;
// 転送先
$url = $this -> getUrl();
$callBack = $this -> getCallBackUrl();
$failUrl = $this -> getFailUrl();
// コールバック
$data = $this -> getForwardParams($result);
$jsonData = json_encode($data);
$data = http_build_query($data, '', '&');
if(isset($_SERVER['REMOTE_ADDR'])) {
$ip = $_SERVER['REMOTE_ADDR'];
......@@ -205,24 +214,31 @@ class LogicSettlement extends SettlementModelClass {
}
// 転送をする
if($url != NO_STRING && $result == NO_COUNT) { // 正常終了
if($result == NO_COUNT) { // 正常終了
$this -> sendCallbackToIntegrator($callBack, $data);
// this insert command also comtains data that will passed to merchant's system.
$this -> accessModifyCommon('INSERT_LOG_POST', array(
$ip,
$this -> getProgramCode(),
$referer,
"[CALLBACK_SUCCESSFUL]{$jsonData}"));
header('Location: ' . $url);
if($url != NO_STRING)
header("Location: {$url}");
else
echo "Successfully transferred!";
} else { // 異常
$this -> accessModifyCommon('INSERT_LOG_POST', array(
$ip,
$this -> getProgramCode(),
$referer,
"[CALLBACK_ERROR]{$jsonData}"));
if($failUrl != NO_STRING) {
header('Location: ' . $failUrl);
}
if($failUrl != NO_STRING)
header("Location: {$failUrl}");
else
echo "The settlement failed to proceed!";
}
}
......
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