/**
* ÆÄÀϸí : AGSLib.php
* ÃÖÁ¾¼öÁ¤ÀÏÀÚ : 2009/05/22
*
* ¿Ã´õ°ÔÀÌÆ® °áÁ¦¿ë ¶óÀ̺귯¸® ÆÄÀÏÀÔ´Ï´Ù.
* Copyright AEGIS ENTERPRISE.Co.,Ltd. All rights reserved.
*
*/
/* GLOBAL */
define("PROGRAM", "AgsPay40");
define("TYPE", "php");
/* LOG LEVEL */
define("FATAL", 1);
define("ERROR", 2);
define("WARN", 3);
define("INFO", 4);
define("DEBUG", 5);
class agspay40
{
/**************************************************************************************
*
* [1] ¿Ã´õ°ÔÀÌÆ® °áÁ¦½Ã »ç¿ëÇÒ ·ÎÄà Åë½Å¼¹ö IP/Port ¹øÈ£
*
* $LOCALADDR : PG¼¹ö¿Í Åë½ÅÀ» ´ã´çÇÏ´Â ¾ÏÈ£ÈProcess°¡ À§Ä¡ÇØ ÀÖ´Â IP
* $LOCALPORT : Æ÷Æ®
* $ENCRYPT : 0:¾È½ÉŬ¸¯,ÀϹݰáÁ¦ 2:ISP
* $CONN_TIMEOUT : ¾ÏÈ£È µ¥¸ó°ú Á¢¼Ó ConnectŸÀӾƿô ½Ã°£(ÃÊ)
* $READ_TIMEOUT : µ¥ÀÌÅÍ ¼ö½Å ŸÀӾƿô ½Ã°£(ÃÊ)
*
***************************************************************************************/
var $LOCALADDR = "121.133.126.1";
var $LOCALPORT = "29760";
var $ENCTYPE = 0;
var $CONN_TIMEOUT = 10;
var $READ_TIMEOUT = 30;
var $ERRMSG;
var $log;
var $fp;
var $REQUEST = array();
var $RESULT = array();
var $sDataMsg;
var $sSendMsg;
var $sRecvMsg;
var $sRecvLen;
var $SendValArray;
var $RecvValArray;
var $TID;
/*
Aegis °áÁ¦/Ãë¼Ò ó¸®
*/
function startPay( )
{
$this->ERRMSG = "";
/*
Log ±â·Ï °´Ã¼»ý¼º
*/
$this->log = new PayLog( $this->REQUEST );
if(!$this->log->InitLog())
{
$this->ERRMSG .= "·Î±×ÆÄÀÏÀ» ¿¼ö°¡ ¾ø½À´Ï´Ù.[".$this->REQUEST["AgsPayHome"]."]" ;
$this->RESULT["rSuccYn"] = "n";
$this->RESULT["rResMsg"] = $this->ERRMSG;
$this->RESULT["rCancelSuccYn"] = "n";
$this->RESULT["rCancelResMsg"] = $this->ERRMSG;
return false;
}
$this->log->WriteLog( INFO, $this->REQUEST["AuthTy"]." ".$this->REQUEST["Type"]." Start!" );
if($this->REQUEST["Type"] == "Cancel")
{
if($this->REQUEST["AuthTy"] == "virtual" )
{
$this->log->WriteLog( WARN, "Cannot Cancel AuthTy[".$this->REQUEST["AuthTy"]."]" );
$this->log->CloseLog( "AuthTy[".$this->REQUEST["AuthTy"]."] End");
return false;
}
}
/*
¿äû°ª ·Î±×±â·Ï
*/
$this->writeLogArray($this->REQUEST);
//Ãë¼Ò¿äû
if($this->REQUEST["Type"] == "Cancel")
{
if( $this->NetCancel() == false )
{
/*
°á°ú°ª ·Î±×±â·Ï
*/
$this->log->WriteLog( ERROR,$this->REQUEST["AuthTy"]." ".$this->REQUEST["Type"]." Result Value [" );
$this->writeLogArray($this->RESULT);
$this->log->WriteLog( ERROR, "]" );
$this->log->WriteLog( ERROR, $this->REQUEST["AuthTy"]." ".$this->REQUEST["Type"]." Fail End" );
$this->payQuit();
return false;
}
/*
°á°ú°ª ·Î±×±â·Ï
*/
$this->log->WriteLog( WARN,$this->REQUEST["AuthTy"]." ".$this->REQUEST["Type"]." Result Value [" );
$this->writeLogArray($this->RESULT);
$this->log->WriteLog( WARN, "]" );
$this->log->WriteLog( WARN, $this->REQUEST["AuthTy"]." ".$this->REQUEST["Type"]." Success End" );
//log °´Ã¼ ´Ý±â
$this->log->CloseLog( $this->GetResult("rCancelResMsg") );
return true;
}
if( empty( $this->REQUEST["StoreId"] ) || $this->REQUEST["StoreId"] == "" )
{
$this->ERRMSG .= "»óÁ¡¾ÆÀ̵ð ÀԷ¿©ºÎ È®Àοä¸Á
"; //»óÁ¡¾ÆÀ̵ð
}
if( empty( $this->REQUEST["OrdNo"] ) || $this->REQUEST["OrdNo"] == "" )
{
$this->ERRMSG .= "ÁÖ¹®¹øÈ£ ÀԷ¿©ºÎ È®Àοä¸Á
"; //ÁÖ¹®¹øÈ£
}
if( empty( $this->REQUEST["ProdNm"] ) || $this->REQUEST["ProdNm"] == "" )
{
$this->ERRMSG .= "»óǰ¸í ÀԷ¿©ºÎ È®Àοä¸Á
"; //»óǰ¸í
}
if( empty( $this->REQUEST["Amt"] ) || $this->REQUEST["Amt"] == "" )
{
$this->ERRMSG .= "±Ý¾× ÀԷ¿©ºÎ È®Àοä¸Á
"; //±Ý¾×
}
if( empty( $this->REQUEST["DeviId"] ) || $this->REQUEST["DeviId"] == "" )
{
$this->ERRMSG .= "´Ü¸»±â¾ÆÀ̵ð ÀԷ¿©ºÎ È®Àοä¸Á
"; //´Ü¸»±â¾ÆÀ̵ð
}
if( empty( $this->REQUEST["AuthYn"] ) || $this->REQUEST["AuthYn"] == "" )
{
$this->ERRMSG .= "ÀÎÁõ¿©ºÎ ÀԷ¿©ºÎ È®Àοä¸Á
"; //ÀÎÁõ¿©ºÎ
}
if( strlen($this->ERRMSG) == 0 ){
/* Make Tid */
if( ($MakeTIDResult = $this->MakeNetCancID()) != true){
$this->log->WriteLog( FATAL, "Make NetCancelID Fail" );
$this->payQuit();
return false;
}else{
$this->log->WriteLog( INFO, "Make NetCancelID OK" );
}
/* Make Pay Msg */
if( ($MakeMsgResult = $this->MakeMsg()) != true){
$this->log->WriteLog( FATAL, "Make Pay Msg Fail" );
$this->ERRMSG = "°áÁ¦¿äûÀü¹®»ý¼º ¿À·ù.";
$this->RESULT["rSuccYn"] = "n";
$this->RESULT["rResMsg"] = $this->ERRMSG;
$this->payQuit();
return false;
}else{
$this->log->WriteLog( INFO, "Make Pay Msg OK" );
}
/* Send & Recv Msg */
if( ($ParseResult = $this->SendRecvMsg()) != true){
$this->log->WriteLog( FATAL, "Send & Recv Msg Fail" );
$this->ERRMSG = "°áÁ¦¿äûÀü¹® ¼Û¼ö½Å ¿À·ù.(°áÁ¦³»¿ªÀ» ²À È®ÀÎÇØÁÖ¼¼¿ä)";
$this->RESULT["rSuccYn"] = "n";
$this->RESULT["rResMsg"] = $this->ERRMSG;
$this->REQUEST["CancelMsg"] = "Send & Recv Msg Fail";
$this->log->WriteLog( WARN, "NetCancel Call" );
if( $this->NetCancel() == false ) //¸ÁÃë¼Ò
{
$this->log->WriteLog( FATAL, "NetCancel Fail End" );
$this->payQuit();
return false;
}
$this->log->WriteLog( INFO, "NetCancel Success End" );
$this->payQuit();
return false;
}else{
$this->log->WriteLog( INFO, "Send & Recv Msg OK" );
}
/* RecvMsg Parsing */
if( ($ParseResult = $this->ParseMsg()) != true){
$this->log->WriteLog( FATAL, "Msg Parsing Fail" );
$this->ERRMSG = "°áÁ¦°á°úÀü¹® ó¸®Áß ¿À·ù.(°áÁ¦³»¿ªÀ» ²À È®ÀÎÇØÁÖ¼¼¿ä)";
$this->RESULT["rSuccYn"] = "n";
$this->RESULT["rResMsg"] = $this->ERRMSG;
$this->REQUEST["CancelMsg"] = "Msg Parsing Fail";
$this->log->WriteLog( WARN, "NetCancel Call" );
if( $this->NetCancel() == false ) //¸ÁÃë¼Ò
{
$this->log->WriteLog( FATAL, "NetCancel Fail End" );
$this->payQuit();
return false;
}
$this->log->WriteLog( INFO, "NetCancel Success End" );
$this->payQuit();
return false;
}else{
$this->log->WriteLog( INFO, "Msg Parsing OK" );
}
}
else
{
$this->RESULT["rSuccYn"] = "n";
$this->RESULT["rResMsg"] = $this->ERRMSG;
}
/*
°á°ú°ª ·Î±×±â·Ï
*/
$this->log->WriteLog( INFO,$this->REQUEST["AuthTy"]." ".$this->REQUEST["Type"]." Result Value [" );
$this->writeLogArray($this->RESULT);
$this->log->WriteLog( INFO, "]" );
//log °´Ã¼ ´Ý±â
$this->log->CloseLog( $this->GetResult("rResMsg") );
return true;
} //startPay() End
/*
ÇÁ·Î¼¼½º Á¾·á
*/
function payQuit()
{
//log °´Ã¼ ´Ý±â
$this->log->CloseLog( $this->GetResult("rResMsg") );
/** ¼ÒÄÏ close **/
if($this->fp != false ){
fclose( $this->fp );
}
}
/*
ÇÁ·Î¼¼½º Á¾·á
*/
function writeLogArray($array)
{
foreach ($array as $key => $value)
{
$this->log->WriteLog( INFO, $key.":".$value );
}
}
/*
°áÁ¦¿äû Msg ¼Û½Å ¹× °á°ú Msg¼ö½Å
*/
function SendRecvMsg()
{
$this->log->WriteLog( INFO, "Send & Recv Msg Start" );
/****************************************************************************
*
* ¾ÏÈ£ÈProcess¿Í ¿¬°áÀ» ÇÏ°í ½ÂÀÎ µ¥ÀÌÅÍ ¼Û¼ö½Å
*
****************************************************************************/
/** ½ÂÀÎ Àü¹®À» ¾ÏÈ£ÈProcess·Î Àü¼Û **/
$this->log->WriteLog( INFO, "Send Data To PG Start [ " );
$this->SendValArray = array();
$this->SendValArray = explode( "|", $this->sSendMsg );
$this->log->WriteLog( INFO, $this->SendValArray);
$this->log->WriteLog( INFO, "] Send Data To PG End " );
$this->log->WriteLog( INFO, "SendMsg : [".$this->sSendMsg."]" );
/** ¼ÒÄÏ open **/
$this->log->WriteLog( INFO, "Connect IP:[".$this->LOCALADDR."] Port:[".$this->LOCALPORT."]" );
$this->fp = fsockopen( $this->LOCALADDR, $this->LOCALPORT , &$errno, &$errstr, $this->CONN_TIMEOUT );
if( !$this->fp )
{
$this->log->WriteLog( ERROR, "Socket Connect Error: [".$errno."-".$errstr."]" );
/** ¿¬°á ½ÇÆÐ·Î ÀÎÇÑ ½ÇÆÐ ¸Þ¼¼Áö Àü¼Û **/
if($this->REQUEST["Type"] == "Cancel")
{
$this->RESULT["rCancelSuccYn"] = "n";
$this->RESULT["rCancelResMsg"] = "Socket Connect Fail";
$this->log->WriteLog( ERROR, $this->RESULT["rCancelResMsg"] );
}
else
{
$this->RESULT["rSuccYn"] = "n";
$this->RESULT["rResMsg"] = "Socket Connect Fail";
$this->log->WriteLog( ERROR, $this->RESULT["rResMsg"] );
}
if($this->fp) fclose( $this->fp );
return false;
}
/** ¿¬°á¿¡ ¼º°øÇÏ¿´À¸¹Ç·Î µ¥ÀÌÅ͸¦ ¹Þ´Â´Ù. **/
$this->log->WriteLog( INFO, "Socket Open OK" );
fputs( $this->fp, $this->sSendMsg );
socket_set_timeout($this->fp, $this->READ_TIMEOUT);
/** ÃÖÃÊ 6¹ÙÀÌÆ®¸¦ ¼ö½ÅÇØ µ¥ÀÌÅÍ ±æÀ̸¦ üũÇÑ ÈÄ µ¥ÀÌÅ͸¸Å¸¸ ¹Þ´Â´Ù. **/
/****************************************************************************
*
* PHP ¹öÀü¿¡ µû¶ó ¼ö½Å µ¥ÀÌÅÍ ±æÀÌ Ã¼Å©½Ã ÆäÀÌÁö¿À·ù°¡ ¹ß»ýÇÒ ¼ö ÀÖ½À´Ï´Ù
* ¿¡·¯¸Þ¼¼Áö:¼ö½Å µ¥ÀÌÅÍ(±æÀÌ) üũ ¿¡·¯ Åë½Å¿À·ù¿¡ ÀÇÇÑ ½ÂÀÎ ½ÇÆÐ
* µ¥ÀÌÅÍ ±æÀÌ Ã¼Å© ¿À·ù½Ã ¾Æ·¡¿Í °°ÀÌ º¯°æÇÏ¿© »ç¿ëÇϽʽÿÀ
* $this->sRecvLen = fgets( $this->fp, 6 );
* $this->sRecvMsg = fgets( $this->fp, $this->sRecvLen );
*
****************************************************************************/
if($this->REQUEST["RecvLen"] == 7)
{
$this->sRecvLen = fgets( $this->fp, $this->REQUEST["RecvLen"] );
$this->sRecvMsg = fgets( $this->fp, $this->sRecvLen + 1 );
}
else if($this->REQUEST["RecvLen"] == 6)
{
$this->sRecvLen = fgets( $this->fp, $this->REQUEST["RecvLen"] );
$this->sRecvMsg = fgets( $this->fp, $this->sRecvLen);
}
else
{
$this->REQUEST["RecvLen"] = 7;
$this->sRecvLen = fgets( $this->fp, $this->REQUEST["RecvLen"] );
$this->sRecvMsg = fgets( $this->fp, $this->sRecvLen + 1 );
}
$this->log->WriteLog( INFO, "RecvMsg Length : [".$this->sRecvLen."]" );
$this->log->WriteLog( INFO, "RecvMsg : [".$this->sRecvMsg."]" );
/** ¼ÒÄÏ close **/
fclose( $this->fp );
$this->log->WriteLog( INFO, "Socket Close OK");
if( strlen( $this->sRecvMsg ) > 0 && strlen( $this->sRecvMsg ) == $this->sRecvLen )
{
/** ¼ö½Å µ¥ÀÌÅÍ(±æÀÌ) üũ Á¤»ó **/
$this->log->WriteLog( INFO, "RecvMsg Length Check OK");
$this->RecvValArray = array();
$this->RecvValArray = explode( "|", $this->sRecvMsg );
/** null ¶Ç´Â NULL ¹®ÀÚ, 0 À» °ø¹éÀ¸·Î º¯È¯
for( $i = 0; $i < sizeof( $this->RecvValArray); $i++ )
{
$this->RecvValArray[$i] = trim( $this->RecvValArray[$i] );
if( !strcmp( $this->RecvValArray[$i], "null" ) || !strcmp( $this->RecvValArray[$i], "NULL" ) )
{
$this->RecvValArray[$i] = "";
}
if( IsNumber( $this->RecvValArray[$i] ) )
{
if( $this->RecvValArray[$i] == 0 ) $this->RecvValArray[$i] = "";
}
}
**/
$this->log->WriteLog( INFO, "Send & Recv Msg End" );
return true;
}
else
{
/** ¼ö½Å µ¥ÀÌÅÍ(±æÀÌ) üũ ¿¡·¯½Ã Åë½Å¿À·ù¿¡ ÀÇÇÑ ½ÂÀÎ ½ÇÆÐ·Î °£ÁÖ **/
if($this->REQUEST["Type"] == "Cancel")
{
$this->RESULT["rCancelSuccYn"] = "n";
$this->RESULT["rCancelResMsg"] = "Recv Msg Length Check Errror";
$this->log->WriteLog( ERROR, $this->RESULT["rCancelResMsg"]." : sRecvLen[".$this->sRecvLen."]"."sRecvMsg Length[".strlen( $this->sRecvMsg )."]");
}
else
{
$this->RESULT["rSuccYn"] = "n";
$this->RESULT["rResMsg"] = "Recv Msg Length Check Errror";
$this->log->WriteLog( ERROR, $this->RESULT["rResMsg"]." : sRecvLen[".$this->sRecvLen."]"."sRecvMsg Length[".strlen( $this->sRecvMsg )."]");
}
return false;
}
} //SendMsg() End
/*
À¥À» ÅëÇÑ Msg ¼Û½Å ¹× °á°ú Msg¼ö½Å
*/
function SendRecvMsgWeb()
{
//ÃßÈÄ ÀÛ¾÷¿¹Á¤
return false;
}
/*
Make Pay Msg
*/
function MakeMsg()
{
$this->log->WriteLog( INFO, "Make Msg Start" );
/****************************************************************************
* ¡Ø °áÁ¦ ÇüÅ º¯¼öÀÇ °ª¿¡ µû¸¥ °áÁ¦ ±¸ºÐ
*
* £ª AuthTy = "card" ½Å¿ëÄ«µå°áÁ¦
* - SubTy = "isp" ¾ÈÀü°áÁ¦ISP
* - SubTy = "visa3d" ¾È½ÉŬ¸¯
* - SubTy = "normal" ÀϹݰáÁ¦
*
* £ª AuthTy = "iche" ÀϹÝ-°èÁÂÀÌü
*
* £ª AuthTy = "virtual" ÀϹÝ-°¡»ó°èÁÂ(¹«ÅëÀåÀÔ±Ý)
*
* £ª AuthTy = "hp" ÇÚµåÆù°áÁ¦
*
* £ª AuthTy = "ars" ARS°áÁ¦
*
****************************************************************************/
if( strcmp( $this->REQUEST["AuthTy"], "card" ) == 0 )
{
if( strcmp( $this->REQUEST["SubTy"], "isp" ) == 0 )
{
/****************************************************************************
*
* [1-1] ½Å¿ëÄ«µå°áÁ¦ - ISP
*
* -- À̺κÐÀº ½ÂÀΠ󸮸¦ À§ÇØ ¾ÏÈ£ÈProcess¿Í SocketÅë½ÅÇÏ´Â ºÎºÐÀÌ´Ù.
* °¡Àå ÇÙ½ÉÀÌ µÇ´Â ºÎºÐÀ̹ǷΠ¼öÁ¤ÈÄ¿¡´Â Å×½ºÆ®¸¦ ÇÏ¿©¾ß ÇÑ´Ù.
* -- µ¥ÀÌÅÍ ±æÀÌ´Â ¸Å´º¾ó Âü°í
*
* -- ½ÂÀÎ ¿äû Àü¹® Æ÷¸ä
* + µ¥ÀÌÅͱæÀÌ(6) + ISP±¸ºÐÄÚµå(1) + µ¥ÀÌÅÍ
* + µ¥ÀÌÅÍ Æ÷¸ä(µ¥ÀÌÅÍ ±¸ºÐÀº "|"·Î ÇÑ´Ù.)
* °áÁ¦Á¾·ù(6) | ¾÷üID(20) | ȸ¿øID(20) | °áÁ¦±Ý¾×(12) |
* ÁÖ¹®¹øÈ£(40) | ´Ü¸»±â¹øÈ£(10) | ¼ö½ÅÀÎ(40) | ¼ö½ÅÀÎÀüÈ(21) |
* ¹è¼ÛÁö(100) | ÁÖ¹®ÀÚ¸í(40) | ÁÖ¹®ÀÚ¿¬¶ôó(100) | ±âŸ¿ä±¸»çÇ×(350) |
* »óǰ¸í(300) | ÅëÈÄÚµå(3) | ÀϹÝÇҺαⰣ(2) | ¹«ÀÌÀÚÇҺαⰣ(2) |
* KVPÄ«µåÄÚµå(22) | ¼¼¼ÇŰ(256) | ¾Ïȣȵ¥ÀÌÅÍ(2048) | Ä«µå¸í(50) |
* ȸ¿ø IP(20) | ȸ¿ø Email(50) | ¸ÁÃë¼ÒID (50) |
*
****************************************************************************/
$this->ENCTYPE = 2;
/****************************************************************************
*
* Àü¼Û Àü¹® Make
*
****************************************************************************/
$this->sDataMsg = $this->ENCTYPE.
"plug15"."|".
$this->REQUEST["StoreId"]."|".
$this->REQUEST["UserId"]."|".
$this->REQUEST["Amt"]."|".
$this->REQUEST["OrdNo"]."|".
$this->REQUEST["DeviId"]."|".
$this->REQUEST["RcpNm"]."|".
$this->REQUEST["RcpPhone"]."|".
$this->REQUEST["DlvAddr"]."|".
$this->REQUEST["OrdNm"]."|".
$this->REQUEST["OrdPhone"]."|".
$this->REQUEST["Remark"]."|".
$this->REQUEST["ProdNm"]."|".
$this->REQUEST["KVP_CURRENCY"]."|".
$this->REQUEST["partial_mm"]."|".
$this->REQUEST["noIntMonth"]."|".
$this->REQUEST["KVP_CARDCODE"]."|".
$this->REQUEST["KVP_SESSIONKEY"]."|".
$this->REQUEST["KVP_ENCDATA"]."|".
$this->REQUEST["KVP_CONAME"]."|".
$this->REQUEST["UserIp"]."|".
$this->REQUEST["UserEmail"]."|".
$this->RESULT["NetCancID"]."|";
$this->sSendMsg = sprintf( "%06d%s", strlen( $this->sDataMsg ), $this->sDataMsg );
$this->log->WriteLog( INFO, $this->REQUEST["AuthTy"]."-".$this->REQUEST["SubTy"]." "."Make MSG OK " );
}
else if( ( strcmp( $this->REQUEST["SubTy"], "visa3d" ) == 0 ) || ( strcmp( $this->REQUEST["SubTy"], "normal" ) == 0 ) )
{
/****************************************************************************
*
* [1-2] ½Å¿ëÄ«µå°áÁ¦ - VISA3D, ÀϹÝ
*
* -- À̺κÐÀº ½ÂÀΠ󸮸¦ À§ÇØ ¾ÏÈ£ÈProcess¿Í SocketÅë½ÅÇÏ´Â ºÎºÐÀÌ´Ù.
* °¡Àå ÇÙ½ÉÀÌ µÇ´Â ºÎºÐÀ̹ǷΠ¼öÁ¤ÈÄ¿¡´Â ½ÇÁ¦ ¼ºñ½ºÀü±îÁö ÀûÀýÇÑ Å×½ºÆ®¸¦ ÇÏ¿©¾ß ÇÑ´Ù.
* -- µ¥ÀÌÅÍ ±æÀÌ´Â ¸Å´º¾ó Âü°í
*
* -- ½ÂÀÎ ¿äû Àü¹® Æ÷¸ä
* + µ¥ÀÌÅͱæÀÌ(6) + ¾Ïȣȿ©ºÎ(1) + µ¥ÀÌÅÍ
* + µ¥ÀÌÅÍ Æ÷¸ä(µ¥ÀÌÅÍ ±¸ºÐÀº "|"·Î Çϸç Ä«µå¹øÈ£,À¯È¿±â°£,ºñ¹Ð¹øÈ£,ÁֹιøÈ£´Â ¾ÏȣȵȴÙ.)
* °áÁ¦Á¾·ù(6) | ¾÷üID(20) | ȸ¿øID(20) | °áÁ¦±Ý¾×(12) | ÁÖ¹®¹øÈ£(40) |
* ´Ü¸»±â¹øÈ£(10) | Ä«µå¹øÈ£(16) | À¯È¿±â°£(6) | ÇҺαⰣ(4) | ÀÎÁõÀ¯¹«(1) |
* Ä«µåºñ¹Ð¹øÈ£(2) | Áֹεî·Ï¹øÈ£/»ç¾÷ÀÚ¹øÈ£(10) | ¼ö½ÅÀÎ(40) | ¼ö½ÅÀÎÀüÈ(21) | ¹è¼ÛÁö(100) |
* ÁÖ¹®ÀÚ¸í(40) | ÁÖ¹®ÀÚ¿¬¶ôó(100) | ±âŸ¿ä±¸»çÇ×(350) | »óǰ¸í(300) | MPI_CAVV | MPI_MD64 | MPI_ECI | ¸ÁÃë¼ÒID (50) |
*
****************************************************************************/
$this->ENCTYPE = 0;
/****************************************************************************
*
* Àü¼Û Àü¹® Make
*
****************************************************************************/
$this->sDataMsg = $this->ENCTYPE.
"plug15"."|".
$this->REQUEST["StoreId"]."|".
$this->REQUEST["UserId"]."|".
$this->REQUEST["Amt"]."|".
$this->REQUEST["OrdNo"]."|".
$this->REQUEST["DeviId"]."|".
$this->encrypt_aegis($this->REQUEST["CardNo"])."|".
$this->encrypt_aegis($this->REQUEST["ExpYear"].$this->REQUEST["ExpMon"])."|".
$this->REQUEST["Instmt"]."|".
$this->REQUEST["AuthYn"]."|".
$this->encrypt_aegis($this->REQUEST["Passwd"])."|".
$this->encrypt_aegis($this->REQUEST["SocId"])."|".
$this->REQUEST["RcpNm"]."|".
$this->REQUEST["RcpPhone"]."|".
$this->REQUEST["DlvAddr"]."|".
$this->REQUEST["OrdNm"]."|".
$this->REQUEST["UserIp"].";".$this->REQUEST["OrdPhone"]."|".
$this->REQUEST["UserEmail"].";".$this->REQUEST["Remark"]."|".
$this->REQUEST["ProdNm"]."|".
$this->REQUEST["MPI_CAVV"]."|".
$this->REQUEST["MPI_MD64"]."|".
$this->REQUEST["MPI_ECI"]."|".
$this->REQUEST["UserEmail"]."|".
$this->RESULT["NetCancID"]."|";
$this->sSendMsg = sprintf( "%06d%s", strlen( $this->sDataMsg ), $this->sDataMsg );
$this->log->WriteLog( INFO, $this->REQUEST["AuthTy"]."-".$this->REQUEST["SubTy"]." "."Make MSG OK " );
}
}
else if( strcmp( $this->REQUEST["AuthTy"], "iche" ) == 0 && strcmp( $this->REQUEST["ICHE_SOCKETYN"], "Y" ) == 0)
{
/****************************************************************************
*
* [2-1] ÀÎÅͳݹðÅ· °èÁÂÀÌü(¼ÒÄÏ) ó¸®
*
* -- À̺κÐÀº ÀÎÅͳݹðÅ· °áÁ¦ 󸮸¦ À§ÇØ ¾ÏÈ£ÈProcess¿Í SocketÅë½ÅÇÏ´Â ºÎºÐÀÌ´Ù.
* °¡Àå ÇÙ½ÉÀÌ µÇ´Â ºÎºÐÀ̹ǷΠ¼öÁ¤ÈÄ¿¡´Â ½ÇÁ¦ ¼ºñ½ºÀü±îÁö ÀûÀýÇÑ Å×½ºÆ®¸¦ ÇÏ¿©¾ß ÇÑ´Ù.
* -- µ¥ÀÌÅÍ ±æÀÌ´Â ¸Å´º¾ó Âü°í
*
* -- ÀÎÅͳݹðÅ· °áÁ¦ ¿äû Àü¹® Æ÷¸ä
* + µ¥ÀÌÅͱæÀÌ(6) + ¾Ïȣȿ©ºÎ(1) + µ¥ÀÌÅÍ
* + µ¥ÀÌÅÍ Æ÷¸ä(µ¥ÀÌÅÍ ±¸ºÐÀº "|"·Î ÇÑ´Ù.)
* °áÁ¦Á¾·ù(10) | ¾÷üID(20) | ÁÖ¹®¹øÈ£(40) | ¿¹±ÝÁÖ¸í(20) | °Å·¡±Ý¾×(8) |
* ÀºÇàÄÚµå(2) | ¿¹±ÝÁÖÁֹιøÈ£(13) | ÁÖ¹®ÀÚ¿¬¶ôó(16) | À̸ÞÀÏÁÖ¼Ò(50) | »óǰ¸í(100) |
* ÀÌ¿ë±â°üÁÖ¹®¹øÈ£(50) | FNBC °Å·¡¹øÈ£(20) | ÀÌü½Ã°¢(14) | Çö±Ý¿µ¼öÁõ¹ßÇà¿©ºÎ(1) | ȸ¿ø¾ÆÀ̵ð(20) |
* °Å·¡ÀÚ±¸ºÐ(2) | ½ÅºÐÈ®ÀιøÈ£(13) | ¿¡½ºÅ©·Î»ç¿ë¿©ºÎ(1) | ¿¡½ºÅ©·Îȸ¿ø¹øÈ£(17) | ¿¡½ºÅ©·Î°áÁ¦±Ý¾×(8)|
* ¿¡½ºÅ©·Î¼ö¼ö·á±Ý¾×(8) |
*
****************************************************************************/
$this->ENCTYPE = R;
/****************************************************************************
*
* Àü¼Û Àü¹® Make
*
****************************************************************************/
$this->sDataMsg = $this->ENCTYPE.
"RB-PayReq"."|".
$this->REQUEST["StoreId"]."|".
$this->REQUEST["OrdNo"]."|".
$this->REQUEST["ICHE_OUTBANKMASTER"]."|".
$this->REQUEST["Amt"]."|".
$this->REQUEST["ICHE_OUTBANKNAME"]."|".
$this->REQUEST["ICHE_OUTACCTNO"]."|".
$this->REQUEST["OrdPhone"]."|".
$this->REQUEST["UserEmail"]."|".
$this->REQUEST["ProdNm"]."|".
$this->REQUEST["ICHE_POSMTID"]."|".
$this->REQUEST["ICHE_FNBCMTID"]."|".
$this->REQUEST["ICHE_APTRTS"]."|".
$this->REQUEST["ICHE_CASHYN"]."|".
$this->REQUEST["UserId"]."|".
$this->REQUEST["ICHE_CASHGUBUN_CD"]."|".
$this->REQUEST["ICHE_CASHID_NO"]."|".
$this->REQUEST["ICHE_ECWYN"]."|".
$this->REQUEST["ICHE_ECWID"]."|".
$this->REQUEST["ICHE_ECWAMT1"]."|".
$this->REQUEST["ICHE_ECWAMT2"]."|".
$this->RESULT["NetCancID"]."|";
$this->sSendMsg = sprintf( "%06d%s", strlen( $this->sDataMsg ), $this->sDataMsg );
$this->log->WriteLog( INFO, $this->REQUEST["AuthTy"]." "."Make MSG OK " );
}
else if( strcmp( $this->REQUEST["AuthTy"], "iche" ) == 0 && strcmp( $this->REQUEST["ICHEARS_SOCKETYN"], "Y" ) == 0)
{
/****************************************************************************
*
* [2-2] ÅÚ·¹¹ðÅ· °èÁÂÀÌü(¼ÒÄÏ) ó¸®
*
* -- À̺κÐÀº ÅÚ·¹¹ðÅ· °áÁ¦ 󸮸¦ À§ÇØ ¾ÏÈ£ÈProcess¿Í SocketÅë½ÅÇÏ´Â ºÎºÐÀÌ´Ù.
* °¡Àå ÇÙ½ÉÀÌ µÇ´Â ºÎºÐÀ̹ǷΠ¼öÁ¤ÈÄ¿¡´Â ½ÇÁ¦ ¼ºñ½ºÀü±îÁö ÀûÀýÇÑ Å×½ºÆ®¸¦ ÇÏ¿©¾ß ÇÑ´Ù.
* -- µ¥ÀÌÅÍ ±æÀÌ´Â ¸Å´º¾ó Âü°í
*
* -- ÅÚ·¹¹ðÅ· °áÁ¦ ¿äû Àü¹® Æ÷¸ä
* + µ¥ÀÌÅͱæÀÌ(6) + ¾Ïȣȿ©ºÎ(1) + µ¥ÀÌÅÍ
* + µ¥ÀÌÅÍ Æ÷¸ä(µ¥ÀÌÅÍ ±¸ºÐÀº "|"·Î ÇÑ´Ù.)
* °áÁ¦Á¾·ù(10) | ¾÷üID(20) | ÁÖ¹®¹øÈ£(40) | ¿¹±ÝÁÖ¸í(20) |
* °Å·¡±Ý¾×(8) | ÀºÇàÄÚµå(2) | ¿¹±ÝÁÖÁֹιøÈ£(13) | ÁÖ¹®ÀÚ¿¬¶ôó(16) |
* À̸ÞÀÏÁÖ¼Ò(50) | »óǰ¸í(100) | ÀÌ¿ë±â°üÁÖ¹®¹øÈ£(50) | FNBC °Å·¡¹øÈ£(20) |
* ÀÌü½Ã°¢(14) | Çö±Ý¿µ¼öÁõ¹ßÇà¿©ºÎ(1) | ȸ¿ø¾ÆÀ̵ð(20) | °Å·¡ÀÚ±¸ºÐ(2) |
* ½ÅºÐÈ®ÀιøÈ£(13) | ¿¡½ºÅ©·Î»ç¿ë¿©ºÎ(1) | ¿¡½ºÅ©·Îȸ¿ø¹øÈ£(17) | ¿¡½ºÅ©·Î°áÁ¦±Ý¾×(8) |
* ¿¡½ºÅ©·Î¼ö¼ö·á±Ý¾×(8) |
*
****************************************************************************/
$this->ENCTYPE = B;
/****************************************************************************
*
* Àü¼Û Àü¹® Make
*
****************************************************************************/
$this->sDataMsg = $this->ENCTYPE.
"TB-PayReq"."|".
$this->REQUEST["StoreId"]."|".
$this->REQUEST["OrdNo"]."|".
$this->REQUEST["ICHEARS_POSMTID"]."|".
$this->REQUEST["ICHEARS_ADMNO"]."|".
$this->REQUEST["ICHEARS_CENTERCD"]."|".
$this->REQUEST["Amt"]."|".
$this->REQUEST["ICHE_OUTACCTNO"]."|".
$this->REQUEST["ICHE_OUTBANKMASTER"]."|".
$this->REQUEST["ICHEARS_HPNO"]."|".
$this->REQUEST["UserEmail"]."|".
$this->REQUEST["ProdNm"]."|".
$this->REQUEST["ICHE_ECWYN"]."|".
$this->REQUEST["ICHE_ECWID"]."|".
$this->REQUEST["ICHE_ECWAMT1"]."|".
$this->REQUEST["ICHE_ECWAMT2"]."|".
$this->REQUEST["ICHE_CASHYN"]."|".
$this->REQUEST["ICHE_CASHGUBUN_CD"]."|".
$this->REQUEST["ICHE_CASHID_NO"]."|".
$this->RESULT["NetCancID"]."|";
$this->sSendMsg = sprintf( "%06d%s", strlen( $this->sDataMsg ), $this->sDataMsg );
$this->log->WriteLog( INFO, $this->REQUEST["AuthTy"]." "."Make MSG OK " );
}
else if( strcmp( $this->REQUEST["AuthTy"], "virtual" ) == 0 ) //°¡»ó°èÁÂÃß°¡
{
/****************************************************************************
*
* [3] °¡»ó°èÁ °áÁ¦
*
* -- À̺κÐÀº ½ÂÀΠ󸮸¦ À§ÇØ ¾ÏÈ£ÈProcess¿Í SocketÅë½ÅÇÏ´Â ºÎºÐÀÌ´Ù.
* °¡Àå ÇÙ½ÉÀÌ µÇ´Â ºÎºÐÀ̹ǷΠ¼öÁ¤ÈÄ¿¡´Â Å×½ºÆ®¸¦ ÇÏ¿©¾ß ÇÑ´Ù.
* -- µ¥ÀÌÅÍ ±æÀÌ´Â ¸Å´º¾ó Âü°í
*
* -- ½ÂÀÎ ¿äû Àü¹® Æ÷¸ä
* + µ¥ÀÌÅͱæÀÌ(6) + ¾ÏÈ£È ±¸ºÐ(1) + µ¥ÀÌÅÍ
* + µ¥ÀÌÅÍ Æ÷¸ä(µ¥ÀÌÅÍ ±¸ºÐÀº "|"·Î ÇÑ´Ù.)
* °áÁ¦Á¾·ù(10) | ¾÷üID(20) | ÁÖ¹®¹øÈ£(40) | ÀºÇàÄÚµå(4) | °¡»ó°èÁ¹øÈ£(20) |
* °Å·¡±Ý¾×(13) | ÀԱݿ¹Á¤ÀÏ(8) | ±¸¸ÅÀÚ¸í(20) | ÁֹιøÈ£(13) |
* À̵¿ÀüÈ(21) | À̸ÞÀÏ(50) | ±¸¸ÅÀÚÁÖ¼Ò(100) | ¼ö½ÅÀÚ¸í(20) |
* ¼ö½ÅÀÚ¿¬¶ôó(21) | ¹è¼ÛÁöÁÖ¼Ò(100) | »óǰ¸í(100) | ±âŸ¿ä±¸»çÇ×(300) | »óÁ¡ µµ¸ÞÀÎ(50) | »óÁ¡ ÆäÀÌÁö(100)|
*
****************************************************************************/
$this->ENCTYPE = "V";
/****************************************************************************
*
* Àü¼Û Àü¹® Make
*
****************************************************************************/
$this->sDataMsg = $this->ENCTYPE.
/* $this->REQUEST["AuthTy"]."|". */
"vir_n|".
$this->REQUEST["StoreId"]."|".
$this->REQUEST["OrdNo"]."|".
$this->REQUEST["VIRTUAL_CENTERCD"]."|".
$this->REQUEST["VIRTUAL_NO"]."|".
$this->REQUEST["Amt"]."|".
$this->REQUEST["VIRTUAL_DEPODT"]."|".
$this->REQUEST["OrdNm"]."|".
$this->REQUEST["ZuminCode"]."|".
$this->REQUEST["OrdPhone"]."|".
$this->REQUEST["UserEmail"]."|".
$this->REQUEST["OrdAddr"]."|".
$this->REQUEST["RcpNm"]."|".
$this->REQUEST["RcpPhone"]."|".
$this->REQUEST["DlvAddr"]."|".
$this->REQUEST["ProdNm"]."|".
$this->REQUEST["Remark"]."|".
$this->REQUEST["MallUrl"]."|".
$this->REQUEST["MallPage"]."|".
$this->RESULT["NetCancID"]."|";
$this->sSendMsg = sprintf( "%06d%s", strlen( $this->sDataMsg ), $this->sDataMsg );
$this->log->WriteLog( INFO, $this->REQUEST["AuthTy"]." "."Make MSG OK " );
}
else if( strcmp( $this->REQUEST["AuthTy"], "hp" ) == 0 )
{
/****************************************************************************
*
* [4] ÇÚµåÆù °áÁ¦
*
* ÇÚµåÆù °áÁ¦¸¦ »ç¿ëÇÏÁö¾Ê´Â »óÁ¡Àº AGS_pay.html¿¡¼ ÁöºÒ¹æ¹ýÀ» ²À ½Å¿ëÄ«µå(Àü¿ë)À¸·Î ¼³Á¤ÇØ ³õÀ¸½Ã±â ¹Ù¶ø´Ï´Ù.
*
* À̺κÐÀº ½ÂÀΠ󸮸¦ À§ÇØ ¾ÏÈ£ÈProcess¿Í SocketÅë½ÅÇÏ´Â ºÎºÐÀÌ´Ù.
* °¡Àå ÇÙ½ÉÀÌ µÇ´Â ºÎºÐÀ̹ǷΠ¼öÁ¤ÈÄ¿¡´Â Å×½ºÆ®¸¦ ÇÏ¿©¾ß ÇÑ´Ù.
* -- ½ÂÀÎ ¿äû Àü¹® Æ÷¸ä
* + µ¥ÀÌÅͱæÀÌ(6) + ÇÚµåÆù±¸ºÐÄÚµå(1) + µ¥ÀÌÅÍ
* + µ¥ÀÌÅÍ Æ÷¸ä(µ¥ÀÌÅÍ ±¸ºÐÀº "|"·Î ÇÑ´Ù.)
*
****************************************************************************/
$this->ENCTYPE = "h";
$this->REQUEST["StrSubTy"] = "Bill";
/****************************************************************************
*
* Àü¼Û Àü¹® Make
*
****************************************************************************/
$this->sDataMsg = $this->ENCTYPE.
$this->REQUEST["StrSubTy"]."|".
$this->REQUEST["StoreId"]."|".
$this->REQUEST["HP_SERVERINFO"]."|".
$this->REQUEST["HP_ID"]."|".
$this->REQUEST["HP_SUBID"]."|".
$this->REQUEST["OrdNo"]."|".
$this->REQUEST["Amt"]."|".
$this->REQUEST["HP_UNITType"]."|".
$this->REQUEST["HP_HANDPHONE"]."|".
$this->REQUEST["HP_COMPANY"]."|".
$this->REQUEST["HP_IDEN"]."|".
$this->REQUEST["UserId"]."|".
$this->REQUEST["UserEmail"]."|".
$this->REQUEST["HP_IPADDR"]."|".
$this->REQUEST["ProdNm"]."|".
$this->RESULT["NetCancID"]."|";
$this->sSendMsg = sprintf( "%06d%s", strlen( $this->sDataMsg ), $this->sDataMsg );
$this->log->WriteLog( INFO, $this->REQUEST["AuthTy"]." "."Make MSG OK " );
}
else if( strcmp( $this->REQUEST["AuthTy"], "ars" ) == 0 )
{
/****************************************************************************
*
* [5] ARS °áÁ¦
*
* ARS °áÁ¦¸¦ »ç¿ëÇÏÁö¾Ê´Â »óÁ¡Àº AGS_pay.html¿¡¼ ÁöºÒ¹æ¹ýÀ» ²À ½Å¿ëÄ«µå(Àü¿ë)À¸·Î ¼³Á¤ÇØ ³õÀ¸½Ã±â ¹Ù¶ø´Ï´Ù.
*
* À̺κÐÀº ½ÂÀΠ󸮸¦ À§ÇØ ¾ÏÈ£ÈProcess¿Í SocketÅë½ÅÇÏ´Â ºÎºÐÀÌ´Ù.
* °¡Àå ÇÙ½ÉÀÌ µÇ´Â ºÎºÐÀ̹ǷΠ¼öÁ¤ÈÄ¿¡´Â Å×½ºÆ®¸¦ ÇÏ¿©¾ß ÇÑ´Ù.
* -- ½ÂÀÎ ¿äû Àü¹® Æ÷¸ä
* + µ¥ÀÌÅͱæÀÌ(6) + ARS±¸ºÐÄÚµå(1) + µ¥ÀÌÅÍ
* + µ¥ÀÌÅÍ Æ÷¸ä(µ¥ÀÌÅÍ ±¸ºÐÀº "|"·Î ÇÑ´Ù.)
*
****************************************************************************/
$this->ENCTYPE = "A";
$this->REQUEST["StrSubTy"] = "ABill";
/****************************************************************************
*
* Àü¼Û Àü¹® Make
*
****************************************************************************/
$this->sDataMsg = $this->ENCTYPE.
$this->REQUEST["StrSubTy"]."|".
$this->REQUEST["StoreId"]."|".
$this->REQUEST["HP_SERVERINFO"]."|".
$this->REQUEST["HP_ID"]."|".
$this->REQUEST["HP_UNITType"]."|".
$this->REQUEST["Amt"]."|".
$this->REQUEST["ProdNm"]."|".
$this->REQUEST["UserEmail"]."|".
$this->REQUEST["HP_SUBID"]."|".
$this->REQUEST["OrdNo"]."|".
$this->REQUEST["UserId"]."|".
$this->REQUEST["ARS_PHONE"]."|".
$this->REQUEST["HP_IDEN"]."|".
$this->REQUEST["ARS_NAME"]."|".
$this->REQUEST["HP_COMPANY"]."|".
$this->REQUEST["HP_IPADDR"]."|".
$this->RESULT["NetCancID"]."|";
$this->sSendMsg = sprintf( "%06d%s", strlen( $this->sDataMsg ), $this->sDataMsg );
$this->log->WriteLog( INFO, $this->REQUEST["AuthTy"]." "."Make MSG OK " );
}else{
$this->ERRMSG .= "°áÁ¦¼ö´Ü ¿À·ù. AuthTy:[".$this->REQUEST["AuthTy"]."],SubTy:[".$this->REQUEST["SubTy"]."]";
$this->log->WriteLog( ERROR, $this->ERRMSG );
$this->RESULT["rSuccYn"] = "n";
$this->RESULT["rResMsg"] = $this->ERRMSG;
return false;
}
$this->log->WriteLog( INFO, "Make Msg End" );
return true;
} // MakeMsg() End
/*
Make Cancel Msg
*/
function MakeCancelMsg()
{
$this->log->WriteLog( INFO, "Make Cancel Msg Start" );
if( strcmp( $this->REQUEST["AuthTy"], "card" ) == 0 )
{
if( strcmp( $this->REQUEST["SubTy"], "isp" ) == 0 )
{
/****************************************************************************
*
* [1-1] ½Å¿ëÄ«µå½ÂÀÎÃë¼Ò - ISP
*
* -- À̺κÐÀº Ãë¼Ò ½ÂÀΠ󸮸¦ À§ÇØ PG¼¹öProcess¿Í SocketÅë½ÅÇÏ´Â ºÎºÐÀÌ´Ù.
* °¡Àå ÇÙ½ÉÀÌ µÇ´Â ºÎºÐÀ̹ǷΠ¼öÁ¤ÈÄ¿¡´Â ½ÇÁ¦ ¼ºñ½ºÀü±îÁö ÀûÀýÇÑ Å×½ºÆ®¸¦ ÇÏ¿©¾ß ÇÑ´Ù.
* -- µ¥ÀÌÅÍ ±æÀÌ´Â ¸Å´º¾ó Âü°í
*
* -- Ãë¼Ò ½ÂÀÎ ¿äû Àü¹® Æ÷¸ä
* + µ¥ÀÌÅͱæÀÌ(6) + ¾Ïȣȿ©ºÎ(1) + µ¥ÀÌÅÍ
* + µ¥ÀÌÅÍ Æ÷¸ä(µ¥ÀÌÅÍ ±¸ºÐÀº "|"·Î ÇÑ´Ù.
* °áÁ¦Á¾·ù(6) | ¾÷ü¾ÆÀ̵ð(20) | ½ÂÀιøÈ£(20) | ½ÂÀνð£(8) | °Å·¡°íÀ¯¹øÈ£(6) |
*
* -- Ãë¼Ò ½ÂÀÎ ÀÀ´ä Àü¹® Æ÷¸ä
* + µ¥ÀÌÅͱæÀÌ(6) + µ¥ÀÌÅÍ
* + µ¥ÀÌÅÍ Æ÷¸ä(µ¥ÀÌÅÍ ±¸ºÐÀº "|"·Î ÇÑ´Ù.
* ¾÷üID(20) | ½ÂÀιøÈ£(20) | ½ÂÀνð¢(8) | Àü¹®ÄÚµå(4) | °Å·¡°íÀ¯¹øÈ£(6) | ¼º°ø¿©ºÎ(1) |
*
****************************************************************************/
$this->ENCTYPE = 2;
/****************************************************************************
*
* Àü¼Û Àü¹® Make
*
****************************************************************************/
$this->sDataMsg = $this->ENCTYPE.
"cancel"."|".
$this->GetResult("StoreId")."|".
$this->GetResult("rApprNo")."|".
substr($this->GetResult("rApprTm"),0,8)."|".
$this->GetResult("rDealNo")."|".
$this->GetResult("NetCancID")."|";
$this->sSendMsg = sprintf( "%06d%s", strlen( $this->sDataMsg ), $this->sDataMsg );
$this->log->WriteLog( INFO, $this->REQUEST["AuthTy"]."-".$this->REQUEST["SubTy"]." "."Make Cancel MSG OK " );
}
else if( ( strcmp( $this->REQUEST["SubTy"], "visa3d" ) == 0 ) || ( strcmp( $this->REQUEST["SubTy"], "normal" ) == 0 ) )
{
/****************************************************************************
*
* [1-2] ½Å¿ëÄ«µå½ÂÀÎÃë¼Ò - VISA3D, ÀϹÝ
*
* -- À̺κÐÀº Ãë¼Ò ½ÂÀΠ󸮸¦ À§ÇØ ¾ÏÈ£ÈProcess¿Í SocketÅë½ÅÇÏ´Â ºÎºÐÀÌ´Ù.
* °¡Àå ÇÙ½ÉÀÌ µÇ´Â ºÎºÐÀ̹ǷΠ¼öÁ¤ÈÄ¿¡´Â ½ÇÁ¦ ¼ºñ½ºÀü±îÁö ÀûÀýÇÑ Å×½ºÆ®¸¦ ÇÏ¿©¾ß ÇÑ´Ù.
*
* -- Ãë¼Ò ½ÂÀÎ ¿äû Àü¹® Æ÷¸ä
* + µ¥ÀÌÅͱæÀÌ(6) + ¾Ïȣȿ©ºÎ(1) + µ¥ÀÌÅÍ
* + µ¥ÀÌÅÍ Æ÷¸ä(µ¥ÀÌÅÍ ±¸ºÐÀº "|"·Î Çϸç Ä«µå¹øÈ£,À¯È¿±â°£,ºñ¹Ð¹øÈ£,ÁֹιøÈ£´Â ¾ÏȣȵȴÙ.)
* °áÁ¦Á¾·ù(6) | ¾÷ü¾ÆÀ̵ð(20) | ½ÂÀιøÈ£(8) | ½ÂÀνð£(14) | Ä«µå¹øÈ£(16) |
*
* -- Ãë¼Ò ½ÂÀÎ ÀÀ´ä Àü¹® Æ÷¸ä
* + µ¥ÀÌÅͱæÀÌ(6) + µ¥ÀÌÅÍ
* + µ¥ÀÌÅÍ Æ÷¸ä(µ¥ÀÌÅÍ ±¸ºÐÀº "|"·Î ÇÏ¸ç ¾ÏÈ£ÈProcess¿¡¼ ÇØµ¶µÈÈÄ ½Çµ¥ÀÌÅ͸¦ ¼ö½ÅÇÏ°Ô µÈ´Ù.
* ¾÷üID(20) | ½ÂÀιøÈ£(8) | ½ÂÀνð¢(14) | Àü¹®ÄÚµå(4) | ¼º°ø¿©ºÎ(1) |
* ÁÖ¹®¹øÈ£(20) | ÇҺΰ³¿ù(2) | °áÁ¦±Ý¾×(20) | Ä«µå»ç¸í(20) | Ä«µå»çÄÚµå(4) |
* °¡¸ÍÁ¡¹øÈ£(15) | ¸ÅÀÔ»çÄÚµå(4) | ¸ÅÀÔ»ç¸í(20) | ÀüÇ¥¹øÈ£(6)
*
****************************************************************************/
$this->ENCTYPE = 0;
/****************************************************************************
*
* Àü¼Û Àü¹® Make
*
****************************************************************************/
$this->sDataMsg = $this->ENCTYPE.
"cancel"."|".
$this->GetResult("StoreId")."|".
$this->GetResult("rApprNo")."|".
substr($this->GetResult("rApprTm"),0,8)."|".
$this->GetResult("rDealNo")."|".
$this->GetResult("NetCancID")."|";
$this->sSendMsg = sprintf( "%06d%s", strlen( $this->sDataMsg ), $this->sDataMsg );
$this->log->WriteLog( INFO, $this->REQUEST["AuthTy"]."-".$this->REQUEST["SubTy"]." "."Make Cancel MSG OK " );
}
}else if( strcmp( $this->REQUEST["AuthTy"], "iche" ) == 0 && strcmp( $this->REQUEST["ICHE_SOCKETYN"], "Y" ) == 0){
/****************************************************************************
*
* [2-1] ÀÎÅͳݹðÅ· °èÁÂÀÌü(¼ÒÄÏ) Ãë¼Òó¸®
*
* -- À̺κÐÀº ÀÎÅͳݹðÅ· °áÁ¦ Ãë¼Ò󸮸¦ À§ÇØ ¾ÏÈ£ÈProcess¿Í SocketÅë½ÅÇÏ´Â ºÎºÐÀÌ´Ù.
* °¡Àå ÇÙ½ÉÀÌ µÇ´Â ºÎºÐÀ̹ǷΠ¼öÁ¤ÈÄ¿¡´Â ½ÇÁ¦ ¼ºñ½ºÀü±îÁö ÀûÀýÇÑ Å×½ºÆ®¸¦ ÇÏ¿©¾ß ÇÑ´Ù.
* -- µ¥ÀÌÅÍ ±æÀÌ´Â ¸Å´º¾ó Âü°í
*
* -- ÀÎÅͳݹðÅ· °áÁ¦ ¿äû Àü¹® Æ÷¸ä
* + µ¥ÀÌÅͱæÀÌ(6) + ¾Ïȣȿ©ºÎ(1) + µ¥ÀÌÅÍ
* + µ¥ÀÌÅÍ Æ÷¸ä(µ¥ÀÌÅÍ ±¸ºÐÀº "|"·Î ÇÑ´Ù.)
* °áÁ¦Á¾·ù(10) | ¾÷üID(20) | MTID(°èÁÂÀÌü°áÁ¦ °á°ú°ª) | °áÁ¦±Ý¾×(8) | ÀºÇàÄÚµå(2)
*
****************************************************************************/
$this->ENCTYPE = R;
/****************************************************************************
*
* Àü¼Û Àü¹® Make
*
****************************************************************************/
$this->sDataMsg = $this->ENCTYPE.
"RB-CanReq"."|".
$this->GetResult("StoreId")."|".
$this->GetResult("ICHE_POSMTID")."|".
$this->GetResult("Amt")."|".
$this->GetResult("ICHE_OUTBANKNAME")."|".
$this->GetResult("NetCancID")."|";
$this->sSendMsg = sprintf( "%06d%s", strlen( $this->sDataMsg ), $this->sDataMsg );
$this->log->WriteLog( INFO, $this->REQUEST["AuthTy"]." "."Make Cancel MSG OK " );
}else if( strcmp( $this->REQUEST["AuthTy"], "iche" ) == 0 && strcmp( $this->REQUEST["ICHEARS_SOCKETYN"], "Y" ) == 0){
/****************************************************************************
*
* [2-1] ÅÚ·¹¹ðÅ· °èÁÂÀÌü(¼ÒÄÏ) Ãë¼Òó¸®
*
* -- À̺κÐÀº ÅÚ·¹¹ðÅ· °áÁ¦ Ãë¼Ò󸮸¦ À§ÇØ ¾ÏÈ£ÈProcess¿Í SocketÅë½ÅÇÏ´Â ºÎºÐÀÌ´Ù.
* °¡Àå ÇÙ½ÉÀÌ µÇ´Â ºÎºÐÀ̹ǷΠ¼öÁ¤ÈÄ¿¡´Â ½ÇÁ¦ ¼ºñ½ºÀü±îÁö ÀûÀýÇÑ Å×½ºÆ®¸¦ ÇÏ¿©¾ß ÇÑ´Ù.
* -- µ¥ÀÌÅÍ ±æÀÌ´Â ¸Å´º¾ó Âü°í
*
* -- ÅÚ·¹¹ðÅ· °áÁ¦ ¿äû Àü¹® Æ÷¸ä
* + µ¥ÀÌÅͱæÀÌ(6) + ¾Ïȣȿ©ºÎ(1) + µ¥ÀÌÅÍ
* + µ¥ÀÌÅÍ Æ÷¸ä(µ¥ÀÌÅÍ ±¸ºÐÀº "|"·Î ÇÑ´Ù.)
* °áÁ¦Á¾·ù(10) | ¾÷üID(20) | MTID(°èÁÂÀÌü°áÁ¦ °á°ú°ª) | °áÁ¦±Ý¾×(8) | ÀºÇàÄÚµå(2)
*
****************************************************************************/
$this->ENCTYPE = B;
/****************************************************************************
*
* Àü¼Û Àü¹® Make
*
****************************************************************************/
$this->sDataMsg = $this->ENCTYPE.
"TB-CanReq"."|".
$this->GetResult("StoreId")."|".
""."|".
""."|".
$this->GetResult("NetCancID")."|";
$this->sSendMsg = sprintf( "%06d%s", strlen( $this->sDataMsg ), $this->sDataMsg );
$this->log->WriteLog( INFO, $this->REQUEST["AuthTy"]." "."Make Cancel MSG OK " );
}else if( strcmp( $this->REQUEST["AuthTy"], "hp" ) == 0 ){
/****************************************************************************
*
* [3] ÇÚµåÆù Ãë¼Òó¸®
*
* -- À̺κÐÀº ÇÚµåÆù °áÁ¦ Ãë¼Ò󸮸¦ À§ÇØ ¾ÏÈ£ÈProcess¿Í SocketÅë½ÅÇÏ´Â ºÎºÐÀÌ´Ù.
* °¡Àå ÇÙ½ÉÀÌ µÇ´Â ºÎºÐÀ̹ǷΠ¼öÁ¤ÈÄ¿¡´Â ½ÇÁ¦ ¼ºñ½ºÀü±îÁö ÀûÀýÇÑ Å×½ºÆ®¸¦ ÇÏ¿©¾ß ÇÑ´Ù.
* -- µ¥ÀÌÅÍ ±æÀÌ´Â ¸Å´º¾ó Âü°í
*
* -- ÇÚµåÆù °áÁ¦ ¿äû Àü¹® Æ÷¸ä
* + µ¥ÀÌÅͱæÀÌ(6) + ¾Ïȣȿ©ºÎ(1) + µ¥ÀÌÅÍ
* + µ¥ÀÌÅÍ Æ÷¸ä(µ¥ÀÌÅÍ ±¸ºÐÀº "|"·Î ÇÑ´Ù.)
* °áÁ¦Á¾·ù(10) | ¾÷üID(20) | NetCancID |
*
****************************************************************************/
$this->ENCTYPE = H;
/****************************************************************************
*
* Àü¼Û Àü¹® Make
*
****************************************************************************/
$this->sDataMsg = $this->ENCTYPE.
"MobileCanReq"."|".
$this->GetResult("StoreId")."|".
$this->GetResult("NetCancID")."|";
$this->sSendMsg = sprintf( "%06d%s", strlen( $this->sDataMsg ), $this->sDataMsg );
$this->log->WriteLog( INFO, $this->REQUEST["AuthTy"]." "."Make Cancel MSG OK " );
}else if( strcmp( $this->REQUEST["AuthTy"], "ars" ) == 0 ){
/****************************************************************************
*
* [4] ARS Ãë¼Òó¸®
*
* -- À̺κÐÀº ARS °áÁ¦ Ãë¼Ò󸮸¦ À§ÇØ ¾ÏÈ£ÈProcess¿Í SocketÅë½ÅÇÏ´Â ºÎºÐÀÌ´Ù.
* °¡Àå ÇÙ½ÉÀÌ µÇ´Â ºÎºÐÀ̹ǷΠ¼öÁ¤ÈÄ¿¡´Â ½ÇÁ¦ ¼ºñ½ºÀü±îÁö ÀûÀýÇÑ Å×½ºÆ®¸¦ ÇÏ¿©¾ß ÇÑ´Ù.
* -- µ¥ÀÌÅÍ ±æÀÌ´Â ¸Å´º¾ó Âü°í
*
* -- ARS °áÁ¦ ¿äû Àü¹® Æ÷¸ä
* + µ¥ÀÌÅͱæÀÌ(6) + ¾Ïȣȿ©ºÎ(1) + µ¥ÀÌÅÍ
* + µ¥ÀÌÅÍ Æ÷¸ä(µ¥ÀÌÅÍ ±¸ºÐÀº "|"·Î ÇÑ´Ù.)
* °áÁ¦Á¾·ù(10) | ¾÷üID(20) | NetCancID |
*
****************************************************************************/
$this->ENCTYPE = A;
/****************************************************************************
*
* Àü¼Û Àü¹® Make
*
****************************************************************************/
$this->sDataMsg = $this->ENCTYPE.
"ARSCanReq"."|".
$this->GetResult("StoreId")."|".
$this->GetResult("NetCancID")."|";
$this->sSendMsg = sprintf( "%06d%s", strlen( $this->sDataMsg ), $this->sDataMsg );
$this->log->WriteLog( INFO, $this->REQUEST["AuthTy"]." "."Make Cancel MSG OK " );
}else{
//½Å¿ëÄ«µå,°èÁÂÀÌü ÀÌ¿ÜÀÇ °áÁ¦¼ö´ÜÀº Ãë¼Ò±â´É Àû¿ëµÇÁö ¾ÊÀ½.
$this->log->WriteLog( WARN, "Cancel Passed. AuthTy : [".$this->REQUEST["AuthTy"]."-".$this->REQUEST["SubTy"]."] " );
$this->RESULT["rCancelSuccYn"] = "n";
$this->RESULT["rCancelResMsg"] = "Cannot Cancel AuthTy[".$this->REQUEST["AuthTy"]."]";
return false;
}
$this->log->WriteLog( INFO, "Make Cancel Msg End" );
return true;
} //MakeCancelMsg End
/*
RecvMsg Parsing
*/
function ParseMsg()
{
$this->log->WriteLog( INFO, "Parse Msg Start" );
/****************************************************************************
* ¡Ø °áÁ¦ ÇüÅ º¯¼öÀÇ °ª¿¡ µû¸¥ °áÁ¦ ±¸ºÐ
*
* £ª AuthTy = "card" ½Å¿ëÄ«µå°áÁ¦
* - SubTy = "isp" ¾ÈÀü°áÁ¦ISP
* - SubTy = "visa3d" ¾È½ÉŬ¸¯
* - SubTy = "normal" ÀϹݰáÁ¦
*
* £ª AuthTy = "iche" ÀϹÝ-°èÁÂÀÌü
*
* £ª AuthTy = "virtual" ÀϹÝ-°¡»ó°èÁÂ(¹«ÅëÀåÀÔ±Ý)
*
* £ª AuthTy = "hp" ÇÚµåÆù°áÁ¦
*
* £ª AuthTy = "ars" ARS°áÁ¦
*
****************************************************************************/
if( strcmp( $this->REQUEST["AuthTy"], "card" ) == 0 )
{
if( strcmp( $this->REQUEST["SubTy"], "isp" ) == 0 )
{
/****************************************************************************
*
* [1-1] ½Å¿ëÄ«µå ¾ÈÀü°áÁ¦ISP ó¸®
*
*
* -- ½ÂÀÎ ÀÀ´ä Àü¹® Æ÷¸ä
* + µ¥ÀÌÅͱæÀÌ(6) + µ¥ÀÌÅÍ
* + µ¥ÀÌÅÍ Æ÷¸ä(µ¥ÀÌÅÍ ±¸ºÐÀº "|"·Î ÇÑ´Ù.
* ¾÷üID(20) | Àü¹®ÄÚµå(4) | °Å·¡°íÀ¯¹øÈ£(6) | ½ÂÀιøÈ£(8) |
* °Å·¡±Ý¾×(12) | ¼º°ø¿©ºÎ(1) | ½ÇÆÐ»çÀ¯(20) | ½ÂÀνð¢(14) |
* Ä«µå»çÄÚµå(4) |
*
****************************************************************************/
$this->RESULT["rStoreId"] = $this->RecvValArray[0];
$this->RESULT["rBusiCd"] = $this->RecvValArray[1];
$this->RESULT["rOrdNo"] = $this->REQUEST["OrdNo"];
$this->RESULT["rDealNo"] = $this->RecvValArray[2];
$this->RESULT["rApprNo"] = $this->RecvValArray[3];
$this->RESULT["rProdNm"] = $this->REQUEST["ProdNm"];
$this->RESULT["rAmt"] = $this->RecvValArray[4];
$this->RESULT["rInstmt"] = $this->REQUEST["KVP_QUOTA"];
$this->RESULT["rSuccYn"] = $this->RecvValArray[5];
$this->RESULT["rResMsg"] = $this->RecvValArray[6];
$this->RESULT["rApprTm"] = $this->RecvValArray[7];
$this->RESULT["rCardCd"] = $this->RecvValArray[8];
$this->log->WriteLog( INFO, $this->REQUEST["AuthTy"]."-".$this->REQUEST["SubTy"]." "."RECV MSG Parsing OK " );
}
else if( ( strcmp( $this->REQUEST["SubTy"], "visa3d" ) == 0 ) || ( strcmp( $this->REQUEST["SubTy"], "normal" ) == 0 ) )
{
/****************************************************************************
*
* [1-2] ¾È½ÉŬ¸¯ or ÀϹݰáÁ¦ ó¸® ½ÂÀÎÀÀ´ä Àü¹®Æ÷¸Ë
* + µ¥ÀÌÅͱæÀÌ(6) + µ¥ÀÌÅÍ
* + µ¥ÀÌÅÍ Æ÷¸ä(µ¥ÀÌÅÍ ±¸ºÐÀº "|"·Î ÇÏ¸ç ¾ÏÈ£ÈProcess¿¡¼ ÇØµ¶µÈÈÄ ½Çµ¥ÀÌÅ͸¦ ¼ö½ÅÇÏ°Ô µÈ´Ù.
* ¾÷üID(20) | Àü¹®ÄÚµå(4) | ÁÖ¹®¹øÈ£(40) | ½ÂÀιøÈ£(8) | °Å·¡±Ý¾×(12) |
* ¼º°ø¿©ºÎ(1) | ½ÇÆÐ»çÀ¯(20) | Ä«µå»ç¸í(20) | ½ÂÀνð¢(14) | Ä«µå»çÄÚµå(4) |
* °¡¸ÍÁ¡¹øÈ£(15) | ¸ÅÀÔ»çÄÚµå(4) | ¸ÅÀÔ»ç¸í(20) | ÀüÇ¥¹øÈ£(6) |
*
****************************************************************************/
$this->RESULT["rStoreId"] = $this->RecvValArray[0];
$this->RESULT["rBusiCd"] = $this->RecvValArray[1];
$this->RESULT["rOrdNo"] = $this->RecvValArray[2];
$this->RESULT["rApprNo"] = $this->RecvValArray[3];
$this->RESULT["rInstmt"] = $this->REQUEST["Instmt"];
$this->RESULT["rAmt"] = $this->RecvValArray[4];
$this->RESULT["rSuccYn"] = $this->RecvValArray[5];
$this->RESULT["rResMsg"] = $this->RecvValArray[6];
$this->RESULT["rCardNm"] = $this->RecvValArray[7];
$this->RESULT["rApprTm"] = $this->RecvValArray[8];
$this->RESULT["rCardCd"] = $this->RecvValArray[9];
$this->RESULT["rMembNo"] = $this->RecvValArray[10];
$this->RESULT["rAquiCd"] = $this->RecvValArray[11];
$this->RESULT["rAquiNm"] = $this->RecvValArray[12];
$this->RESULT["rDealNo"] = $this->RecvValArray[13];
$this->RESULT["rProdNm"] = $this->REQUEST["ProdNm"];
$this->log->WriteLog( INFO, $this->REQUEST["AuthTy"]."-".$this->REQUEST["SubTy"]." "."RECV MSG Parsing OK " );
}
}
else if( strcmp( $this->REQUEST["AuthTy"], "iche" ) == 0 && strcmp( $this->REQUEST["ICHE_SOCKETYN"], "Y" ) == 0)
{
/****************************************************************************
*
* [2-1] °èÁÂÀÌü ¼ÒÄϹæ½Ä(ÀÎÅͳݹðÅ·) °áÁ¦ ¿äû ÀÀ´ä Àü¹® Æ÷¸ä
* + µ¥ÀÌÅͱæÀÌ(6) + µ¥ÀÌÅÍ
* + µ¥ÀÌÅÍ Æ÷¸ä(µ¥ÀÌÅÍ ±¸ºÐÀº "|"·Î ÇÏ¸ç ¾ÏÈ£ÈProcess¿¡¼ ÇØµ¶µÈÈÄ ½Çµ¥ÀÌÅ͸¦ ¼ö½ÅÇÏ°Ô µÈ´Ù.
* °áÁ¦Á¾·ù(10) | »óÁ¡¾ÆÀ̵ð(20) | ÁÖ¹®¹øÈ£(40) | ÀÌ¿ë±â°üÁÖ¹®¹øÈ£(50) | °á°úÄÚµå(4) | °á°ú¸Þ½ÃÁö(300) |
*
****************************************************************************/
$this->RESULT["rStoreId"] = $this->RecvValArray[1];
$this->RESULT["rOrdNo"] = $this->RecvValArray[2];
$this->RESULT["rMTid"] = $this->RecvValArray[3];
$this->RESULT["ES_SENDNO"] = $this->RecvValArray[4];
$this->RESULT["rSuccYn"] = $this->RecvValArray[5];
$this->RESULT["rResMsg"] = $this->RecvValArray[6];
$this->RESULT["rAmt"] = $this->REQUEST["Amt"];
$this->RESULT["rProdNm"] = $this->REQUEST["ProdNm"];
$this->log->WriteLog( INFO, $this->REQUEST["AuthTy"]." "."RECV MSG Parsing OK " );
}
else if( strcmp( $this->REQUEST["AuthTy"], "iche" ) == 0 && strcmp( $this->REQUEST["ICHEARS_SOCKETYN"], "Y" ) == 0)
{
/****************************************************************************
*
* [2-2] °èÁÂÀÌü ÅÚ·¹¹ðÅ· ó¸®
*
* -- ÅÚ·¹¹ðÅ· °áÁ¦ ¿äû ÀÀ´ä Àü¹® Æ÷¸ä
* + µ¥ÀÌÅͱæÀÌ(6) + µ¥ÀÌÅÍ
* + µ¥ÀÌÅÍ Æ÷¸ä(µ¥ÀÌÅÍ ±¸ºÐÀº "|"·Î ÇÏ¸ç ¾ÏÈ£ÈProcess¿¡¼ ÇØµ¶µÈÈÄ ½Çµ¥ÀÌÅ͸¦ ¼ö½ÅÇÏ°Ô µÈ´Ù.
* °áÁ¦Á¾·ù(10) | »óÁ¡¾ÆÀ̵ð(20) | ÁÖ¹®¹øÈ£(40) | ÀÌ¿ë±â°üÁÖ¹®¹øÈ£(50) | °á°úÄÚµå(4) | °á°ú¸Þ½ÃÁö(300) |*
*
****************************************************************************/
$this->RESULT["rStoreId"] = $this->RecvValArray[1];
$this->RESULT["rOrdNo"] = $this->RecvValArray[2];
$this->RESULT["rMTid"] = $this->RecvValArray[3];
$this->RESULT["rSuccYn"] = $this->RecvValArray[4];
$this->RESULT["rResMsg"] = $this->RecvValArray[5];
$this->RESULT["rAmt"] = $this->REQUEST["Amt"];
$this->RESULT["rProdNm"] = $this->REQUEST["ProdNm"];
$this->log->WriteLog( INFO, $this->REQUEST["AuthTy"]." "."Parse MSG Passed " );
$pos = strpos($this->RESULT["rResMsg"],':');
if( $pos !== false )
{
$this->RESULT["ES_SENDNO"] = substr($this->RESULT["rResMsg"],$pos+1,6) ;
$this->log->WriteLog( INFO, "ES_SENDNO : [".$this->RESULT["ES_SENDNO"]."] ");
}
}
else if( strcmp( $this->REQUEST["AuthTy"], "virtual" ) == 0 )
{
/****************************************************************************
*
* [3] °¡»ó°èÁÂ(¹«ÅëÀåÀÔ±Ý) ó¸®
*
* -- ½ÂÀÎ ÀÀ´ä Àü¹® Æ÷¸ä
* + µ¥ÀÌÅͱæÀÌ(6) + ¾ÏÈ£È ±¸ºÐ(1) + µ¥ÀÌÅÍ
* + µ¥ÀÌÅÍ Æ÷¸ä(µ¥ÀÌÅÍ ±¸ºÐÀº "|"·Î ÇÑ´Ù.
* °áÁ¦Á¾·ù(10) | ¾÷üID(20) | ½ÂÀÎÀÏÀÚ(14) | °¡»ó°èÁ¹øÈ£(20) | °á°úÄÚµå(1) | °á°ú¸Þ½ÃÁö(100) |
*
****************************************************************************/
$this->RESULT["rAuthTy"] = $this->RecvValArray[0];
$this->RESULT["rStoreId"] = $this->RecvValArray[1];
$this->RESULT["rApprTm"] = $this->RecvValArray[2];
$this->RESULT["rVirNo"] = $this->RecvValArray[3];
$this->RESULT["rSuccYn"] = $this->RecvValArray[4];
$this->RESULT["rResMsg"] = $this->RecvValArray[5];
$this->RESULT["rOrdNo"] = $this->REQUEST["OrdNo"];
$this->RESULT["rProdNm"] = $this->REQUEST["ProdNm"];
$this->RESULT["rAmt"] = $this->REQUEST["Amt"];
$pos = strpos($this->RESULT["rResMsg"],':');
if( $pos !== false )
{
$this->RESULT["ES_SENDNO"] = substr($this->RESULT["rResMsg"],$pos+1,6) ;
$this->log->WriteLog( INFO, "ES_SENDNO : [".$this->RESULT["ES_SENDNO"]."] ");
}
$this->log->WriteLog( INFO, $this->REQUEST["AuthTy"]." "."RECV MSG Parsing OK " );
}
else if( strcmp( $this->REQUEST["AuthTy"], "hp" ) == 0 )
{
/****************************************************************************
*
* [4] ÇÚµåÆù °áÁ¦
*
* -- ½ÂÀÎ ÀÀ´ä Àü¹® Æ÷¸ä
* + µ¥ÀÌÅͱæÀÌ(6) + µ¥ÀÌÅÍ
* + µ¥ÀÌÅÍ Æ÷¸ä(µ¥ÀÌÅÍ ±¸ºÐÀº "|"·Î ÇÑ´Ù.)
* ¾÷üID(20) | °á°úÄÚµå(1) | °á°ú¸Þ½ÃÁö(100) | ÇÚµåÆù°áÁ¦ÀÏ(8) | ÇÚµåÆù°áÁ¦ TID(12) | °Å·¡±Ý¾×(12) | ÁÖ¹®¹øÈ£(40) |
*
****************************************************************************/
$this->RESULT["rStoreId"] = $this->RecvValArray[0];
$this->RESULT["rSuccYn"] = $this->RecvValArray[1];
$this->RESULT["rResMsg"] = $this->RecvValArray[2];
$this->RESULT["rHP_DATE"] = $this->RecvValArray[3];
$this->RESULT["rHP_TID"] = $this->RecvValArray[4];
$this->RESULT["rAmt"] = $this->REQUEST["Amt"];
$this->RESULT["rOrdNo"] = $this->REQUEST["OrdNo"];
$this->RESULT["rProdNm"] = $this->REQUEST["ProdNm"];
$this->log->WriteLog( INFO, $this->REQUEST["AuthTy"]." "."RECV MSG Parsing OK " );
}
else if( strcmp( $this->REQUEST["AuthTy"], "ars" ) == 0 )
{
/****************************************************************************
*
* [5] ARS °áÁ¦
*
* -- ½ÂÀÎ ÀÀ´ä Àü¹® Æ÷¸ä
* + µ¥ÀÌÅͱæÀÌ(6) + µ¥ÀÌÅÍ
* + µ¥ÀÌÅÍ Æ÷¸ä(µ¥ÀÌÅÍ ±¸ºÐÀº "|"·Î ÇÑ´Ù.)
* ¾÷üID(20) | °á°úÄÚµå(1) | °á°ú¸Þ½ÃÁö(100) | ARS°áÁ¦ÀÏ(8) | ARS°áÁ¦ TID(12) | °Å·¡±Ý¾×(12) | ÁÖ¹®¹øÈ£(40) |
*
****************************************************************************/
$this->RESULT["rStoreId"] = $this->RecvValArray[0];
$this->RESULT["rSuccYn"] = $this->RecvValArray[1];
$this->RESULT["rResMsg"] = $this->RecvValArray[2];
$this->RESULT["rHP_DATE"] = $this->RecvValArray[3];
$this->RESULT["rHP_TID"] = $this->RecvValArray[4];
$this->RESULT["rAmt"] = $this->REQUEST["Amt"];
$this->RESULT["rOrdNo"] = $this->REQUEST["OrdNo"];
$this->RESULT["rProdNm"] = $this->REQUEST["ProdNm"];
$this->log->WriteLog( INFO, $this->REQUEST["AuthTy"]." "."RECV MSG Parsing OK " );
}else{
$this->log->WriteLog( FATAL, "Unknown AuthTy. AuthTy:[".$this->REQUEST["AuthTy"]."],SubTy:[".$this->REQUEST["SubTy"]."]");
return false;
}
$this->log->WriteLog( INFO, "Parse Msg End" );
return true;
} //ParseMsg() End
/*
RecvCancelMsg Parsing
*/
function ParseCancelMsg()
{
$this->log->WriteLog( INFO, "Parse Cancel Msg Start" );
if( strcmp( $this->REQUEST["AuthTy"], "card" ) == 0 )
{
if( strcmp( $this->REQUEST["SubTy"], "isp" ) == 0 )
{
/* [1-1] ¾ÈÀü°áÁ¦ISP ó¸® */
$this->RESULT["rStoreId"] = $this->RecvValArray[0];
$this->RESULT["rApprNo"] = $this->RecvValArray[1];
$this->RESULT["rApprTm"] = $this->RecvValArray[2];
$this->RESULT["rBusiCd"] = $this->RecvValArray[3];
$this->RESULT["rDealNo"] = $this->RecvValArray[4];
$this->RESULT["rCancelSuccYn"] = $this->RecvValArray[5];
$this->RESULT["rCancelResMsg"] = $this->RecvValArray[6];
$this->log->WriteLog( INFO, $this->REQUEST["AuthTy"]."-".$this->REQUEST["SubTy"]." "."RECV MSG Parsing OK " );
}
else if( ( strcmp( $this->REQUEST["SubTy"], "visa3d" ) == 0 ) || ( strcmp( $this->REQUEST["SubTy"], "normal" ) == 0 ) )
{
/* [1-2] ¾È½ÉŬ¸¯ or ÀϹݰáÁ¦ ó¸® */
$this->RESULT["rStoreId"] = $this->RecvValArray[0];
$this->RESULT["rApprNo"] = $this->RecvValArray[1];
$this->RESULT["rApprTm"] = $this->RecvValArray[2];
$this->RESULT["rBusiCd"] = $this->RecvValArray[3];
$this->RESULT["rCancelSuccYn"] = $this->RecvValArray[4];
$this->RESULT["rOrdNo"] = $this->RecvValArray[5];
$this->RESULT["rInstmt"] = $this->RecvValArray[6];
$this->RESULT["rAmt"] = $this->RecvValArray[7];
$this->RESULT["rCardNm"] = $this->RecvValArray[8];
$this->RESULT["rCardCd"] = $this->RecvValArray[9];
$this->RESULT["rMembNo"] = $this->RecvValArray[10];
$this->RESULT["rAquiCd"] = $this->RecvValArray[11];
$this->RESULT["rAquiNm"] = $this->RecvValArray[12];
$this->RESULT["rDealNo"] = $this->RecvValArray[13];
if($this->RESULT["rCancelSuccYn"] == "y")
{
$this->RESULT["rCancelResMsg"] = "Á¤»óÃë¼Ò";
}
else
{
$this->RESULT["rCancelResMsg"] = "Ãë¼Ò½ÇÆÐ";
}
$this->log->WriteLog( INFO, $this->REQUEST["AuthTy"]."-".$this->REQUEST["SubTy"]." "."RECV MSG Parsing OK " );
}
}
else if( strcmp( $this->REQUEST["AuthTy"], "iche" ) == 0 && strcmp( $this->REQUEST["ICHE_SOCKETYN"], "Y" ) == 0)
{
/* [2-1] °èÁÂÀÌü ÀÎÅͳݹðÅ· Ãë¼Ò*/
/* [RB-CanRes|»óÁ¡ID|posmTid|ÁÖ¹®¹øÈ£|y|Ãë¼Ò¼º°ø|] */
$this->RESULT["rStoreId"] = $this->RecvValArray[1];
$this->RESULT["ICHE_POSMTID"] = $this->RecvValArray[2];
$this->RESULT["rOrdNo"] = $this->RecvValArray[3];
$this->RESULT["rCancelSuccYn"] = $this->RecvValArray[4];
$this->RESULT["rCancelResMsg"] = $this->RecvValArray[5];
}
else if( strcmp( $this->REQUEST["AuthTy"], "iche" ) == 0 && strcmp( $this->REQUEST["ICHEARS_SOCKETYN"], "Y" ) == 0)
{
/* [2-2] °èÁÂÀÌü ÅÚ·¹¹ðÅ· Ãë¼Ò*/
/* [TB-CanRes|»óÁ¡ID|posmTid|ÁÖ¹®¹øÈ£|y|Ãë¼Ò¼º°ø|] */
$this->RESULT["rStoreId"] = $this->RecvValArray[1];
$this->RESULT["rMTid"] = $this->RecvValArray[2];
$this->RESULT["rCancelSuccYn"] = $this->RecvValArray[3];
$this->RESULT["rCancelResMsg"] = $this->RecvValArray[4];
}
else if( strcmp( $this->REQUEST["AuthTy"], "hp" ) == 0 )
{
/****************************************************************************
*
* [4] ÇÚµåÆù °áÁ¦ Ãë¼Ò
*
* -- Ãë¼Ò ÀÀ´ä Àü¹® Æ÷¸ä
* + µ¥ÀÌÅͱæÀÌ(6) + µ¥ÀÌÅÍ
* + µ¥ÀÌÅÍ Æ÷¸ä(µ¥ÀÌÅÍ ±¸ºÐÀº "|"·Î ÇÏ¸ç ¾ÏÈ£ÈProcess¿¡¼ ÇØµ¶µÈÈÄ ½Çµ¥ÀÌÅ͸¦ ¼ö½ÅÇÏ°Ô µÈ´Ù.
* | MobileCanRes | ¾÷üID(20) | ¼º°ø¿©ºÎ(1) | °á°ú¸Þ¼¼Áö | Ãë¼Òó¸®ÀϽà | ÀÌ¿ë±â°üÁÖ¹®¹øÈ£ |
*
****************************************************************************/
/* [MobileCanRes|»óÁ¡ID|°á°ú(y/n)|°á°ú¸Þ¼¼Áö|Ãë¼ÒÀϽÃ|ÀÌ¿ë±â°üÁÖ¹®¹øÈ£|] */
$this->RESULT["rStoreId"] = $this->RecvValArray[1];
$this->RESULT["rCancelSuccYn"] = $this->RecvValArray[2];
$this->RESULT["rCancelResMsg"] = $this->RecvValArray[3];
$this->RESULT["rCancelDate"] = $this->RecvValArray[4];
$this->RESULT["rTid"] = $this->RecvValArray[5];
}
else if( strcmp( $this->REQUEST["AuthTy"], "ars" ) == 0 )
{
/****************************************************************************
*
* [5] ARS °áÁ¦ Ãë¼Ò
*
* -- Ãë¼Ò ÀÀ´ä Àü¹® Æ÷¸ä
* + µ¥ÀÌÅͱæÀÌ(6) + µ¥ÀÌÅÍ
* + µ¥ÀÌÅÍ Æ÷¸ä(µ¥ÀÌÅÍ ±¸ºÐÀº "|"·Î ÇÏ¸ç ¾ÏÈ£ÈProcess¿¡¼ ÇØµ¶µÈÈÄ ½Çµ¥ÀÌÅ͸¦ ¼ö½ÅÇÏ°Ô µÈ´Ù.
* | ArsCanRes | ¾÷üID(20) | ¼º°ø¿©ºÎ(1) | °á°ú¸Þ¼¼Áö | Ãë¼Òó¸®ÀϽà | ÀÌ¿ë±â°üÁÖ¹®¹øÈ£ |
*
****************************************************************************/
/* [ArsCanRes|»óÁ¡ID|°á°ú(y/n)|°á°ú¸Þ¼¼Áö|Ãë¼ÒÀϽÃ|ÀÌ¿ë±â°üÁÖ¹®¹øÈ£|] */
$this->RESULT["rStoreId"] = $this->RecvValArray[1];
$this->RESULT["rCancelSuccYn"] = $this->RecvValArray[2];
$this->RESULT["rCancelResMsg"] = $this->RecvValArray[3];
$this->RESULT["rCancelDate"] = $this->RecvValArray[4];
$this->RESULT["rTid"] = $this->RecvValArray[5];
}
else
{
$this->log->WriteLog( INFO, $this->REQUEST["AuthTy"]." "."Parse CancelMSG Passed " );
$this->RESULT["rCancelSuccYn"] = "n";
$this->RESULT["rCancelResMsg"] = "Cannot Cancel AuthTy[".$this->REQUEST["AuthTy"]."]";
return false;
}
$this->log->WriteLog( INFO, "Parse Cancel Msg End" );
return true;
}
/*
¸ÁÃë¼Ò ¿äû
*/
function NetCancel()
{
$this->log->WriteLog( WARN, $this->REQUEST["AuthTy"]."-".$this->REQUEST["SubTy"]." Cancel Start");
if( $this->REQUEST["UseNetCancel"] == "true" || $this->REQUEST["Type"] == "Cancel" )
{
$this->log->WriteLog( WARN, "Cancel Reason : ".$this->REQUEST["CancelMsg"]);
if( !($this->MakeCancelMsg()) )
{
$this->log->WriteLog( ERROR, "Make CancelMsg Error");
return false;
}
if( !($this->SendRecvMsg()) )
{
$this->log->WriteLog( ERROR, "Send & Recv Msg Error");
return false;
}
if( !($this->ParseCancelMsg()) )
{
$this->log->WriteLog( ERROR, "ParseCancelMsg Error");
return false;
}
if( $this->RESULT["rCancelSuccYn"] == "y")
{
$this->log->WriteLog( WARN, "Cancel Success");
}
else
{
$this->log->WriteLog( FATAL, "Cancel FAIL");
}
}
else
{
$this->log->WriteLog( WARN, "Cancel Passed (UseNetCancel value Is false)");
}
$this->log->WriteLog( WARN, $this->REQUEST["AuthTy"]."-".$this->REQUEST["SubTy"]." Cancel End");
if($this->RESULT["rCancelSuccYn"] == "y"){
//°áÁ¦°á°ú°ª ½ÇÆÐ·Î ¼³Á¤
$this->SetPayResult( "rSuccYn", "n" );
$this->SetPayResult( "rResMsg", $this->REQUEST["CancelMsg"] );
return true;
}else{
return false;
}
}
/*
µ¥ÀÌÅÍ È®Àοäû
*/
function checkPayResult( $TID )
{
/*
Log ±â·Ï °´Ã¼»ý¼º
*/
$this->log = new PayLog( $this->REQUEST );
if(!$this->log->InitLog())
{
$this->ERRMSG .= "·Î±×ÆÄÀÏÀ» ¿¼ö°¡ ¾ø½À´Ï´Ù.[".$this->REQUEST["AgsPayHome"]."]" ;
$this->RESULT["rSuccYn"] = "n";
$this->RESULT["rResMsg"] = $this->ERRMSG;
$this->RESULT["rCancelSuccYn"] = "n";
$this->RESULT["rCancelResMsg"] = $this->ERRMSG;
return false;
}
$this->log->WriteLog( INFO, "[".$TID."] Check PayResult Start");
//"AEGIS_".$TidTp . $this->REQUEST["StoreId"] . $datestr . rand(100,999);
switch(substr($TID,6,4)){
case("ISP_"): // ½Å¿ëÄ«µå ISP
$this->REQUEST["AuthTy"] = "card" ;
$this->REQUEST["SubTy"] = "isp" ;
break;
case("VISA"): // ½Å¿ëÄ«µå ¾È½ÉŬ¸¯/ÀϹÝ
$this->REQUEST["AuthTy"] = "card" ;
$this->REQUEST["SubTy"] = "visa3d" ;
break;
case("IBK_"): // ÀÎÅͳݹðÅ·
$this->REQUEST["AuthTy"] = "iche" ;
break;
case("TBK_"): // ÅÚ·¹¹ðÅ·
$this->REQUEST["AuthTy"] = "iche" ;
break;
case("VIR_"): // °¡»ó°èÁÂ
$this->REQUEST["AuthTy"] = "virtual" ;
break;
case("HPP_"): // ÈÞ´ëÆù °áÁ¦
$this->REQUEST["AuthTy"] = "hp" ;
break;
case("ARS_"): // ARS ÀüȰáÁ¦
$this->REQUEST["AuthTy"] = "ars" ;
break;
default: // ¹ÌÈ®ÀÎ °áÁ¦¹æ½Ä
$this->REQUEST["AuthTy"] = "unknown" ;
break;
}
/****************************************************************************
* Àü¼Û Àü¹® Make
****************************************************************************/
$this->ENCTYPE = "I";
$this->sDataMsg = $this->ENCTYPE.
"PayInfo"."|".
$this->REQUEST["StoreId"]."|".
$TID."|";
$this->sSendMsg = sprintf( "%06d%s", strlen( $this->sDataMsg ), $this->sDataMsg );
if( !($this->SendRecvMsg()) ) //¼ÒÄÏÀ» ÅëÇØ °Å·¡°á°ú È®ÀÎ
{
if( !($this->SendRecvMsgWeb()) ) //À¥À» ÅëÇØ °Å·¡°á°ú È®ÀÎ
{
}
}
if( !($this->ParseMsg()) )
{
$this->log->WriteLog( ERROR, "Parse Check PayResult Error");
return false;
}
$this->log->WriteLog( INFO, "[".$TID."] Check PayResult End");
$this->writeLogArray($this->RESULT);
//log °´Ã¼ ´Ý±â
$this->log->CloseLog( $this->GetResult("rResMsg") );
return true;
}
/*
°áÁ¦µ¥ÀÌÅÍ Set
*/
function SetValue( $key, $val )
{
$this->REQUEST[$key] = $val;
}
/*
°áÁ¦µ¥ÀÌÅÍ Get
*/
function GetResult( $name )
{
$result = $this->RESULT[$name];
if( strlen($result) == 0 || $result == "") $result = $this->REQUEST[$name];
return $result;
}
/*
°áÁ¦°á°ú rSuccYn Set
*/
function SetPayResult( $key, $val )
{
$this->RESULT[$key] = $val;
}
/*
Make NetCancel ID();
*/
function MakeNetCancID()
{
$this->log->WriteLog( INFO, "Make NetCancel ID Start" );
switch($this->REQUEST["AuthTy"]){
case("card"): // ½Å¿ëÄ«µå
if( strcmp( $this->REQUEST["SubTy"], "isp" ) == 0 ) $TidTp = "ISP_"; else $TidTp = "VISA";
break;
case("iche"): // ÀºÇà °èÁ ÀÌü (IBK:ÀÎÅͳݹðÅ·, TBK:ÅÚ·¹¹ðÅ·)
if( strcmp( $this->REQUEST["ICHE_SOCKETYN"], "Y" ) == 0 ) $TidTp = "IBK_"; else $TidTp = "TBK_";
break;
case("virtual"): // °¡»ó°èÁÂ
$TidTp = "VIR_"; break;
case("hp"): // ÈÞ´ëÆù °áÁ¦
$TidTp = "HPP_"; break;
case("ars"): // ARS ÀüȰáÁ¦
$TidTp = "ARS_"; break;
default:
$TidTp = "UNKW"; //¹ÌÈ®ÀÎ °áÁ¦¹æ½Ä
}
list($usec, $sec) = explode(" ", microtime());
$datestr = date("YmdHis", $sec).substr($usec,2,3); //YYYYMMDDHHMMSSSSS
//TID´Â ÃÖ¼Ò 31ÀÚ¸® ,ÃÖ´ë 51ÀÚ¸®¸¦ ³ÑÁö ¾Ê´Â´Ù.
$this->RESULT["NetCancID"] = "AEGIS_".$TidTp . $this->REQUEST["StoreId"] . "_" . $datestr . rand(100,999);
if( (!strlen( $this->RESULT["NetCancID"] ) >= 31 && strlen( $this->RESULT["NetCancID"] ) <= 51) )
{
$this->log->WriteLog( ERROR, $this->RESULT["NetCancID"]);
return false;
}
$this->log->WriteLog( INFO, $this->RESULT["NetCancID"]);
$this->log->WriteLog( INFO, "Make NetCancel ID End" );
return true;
}
/*
Set Error Msg ;
*/
function SetErrorMsg($rSuccYn,$rResMsg)
{
$this->log->WriteLog( INFO, "Set Result Msg Start");
$this->RESULT["rSuccYn"] = $rSuccYn;
$this->RESULT["rResMsg"] = $rResMsg;
$this->log->WriteLog( INFO, "Set Result Msg End");
}
/*
Aegis Ä«µåµ¥ÀÌÅÍ Encrypt
*/
function encrypt_aegis( $OrgData )
{
$this->log->WriteLog( INFO, "Encrypt Start");
if( empty( $OrgData ) || $OrgData == "" )
{
$this->log->WriteLog( INFO, "Encrypt End");
return "";
}
$temp = "";
for( $i = 0; $i < strlen( $OrgData ); $i++ )
{
$temp .= substr( $OrgData, (strlen( $OrgData ) - 1) - $i, 1 );
}
//print "Reverse data : ".$temp."
";
$one_char = "";
$EncData = "";
for( $i = 0; $i < strlen( $temp ); $i++ )
{
$one_char = substr( $temp, $i, 1 );
$EncData .= ($one_char + $i * 77) % 10 ;
}
//print "Enc Data : ".$EncData."
";
$this->log->WriteLog( INFO, "Encrypt End");
return $EncData;
}
/*
¹®ÀÚ¿ Æ÷¸ä
*/
function format_string($TSTR,$TLEN,$TAG)
{
if ( !isset($TSTR) )
{
for ( $i=0 ; $i < $TLEN ; $i++ )
{
if( $TAG == 'Y' )
{
$TSTR = $TSTR.chr(32);
}
else
{
$TSTR = $TSTR.'+';
}
}
}
$TSTR = trim($TSTR);
$TSTR = stripslashes($TSTR);
// ÀÔ·ÂÀÚ·á°¡ ±æÀ̺¸´Ù ±ä °æ¿ì ÀÚ¸£°í ÇѱÛó¸®
if ( strlen($TSTR) > $TLEN )
{
// $flag == 1 ÀÌ¸é ±× ¹ÙÀÌÆ®´Â ÇѱÛÀÇ ½ÃÀÛ ¹ÙÀÌÆ® ÀÌ¶ó¼ °Å±â±îÁö ÀÚ¸£°Ô µÇ¸é
// ÇѱÛÀÌ ±úÁö°Ô µÇ´Â Çö»óÀÌ ¹ß»ýÇÕ´Ï´Ù.
$flag = 0;
for($i=0 ; $i< $TLEN ; $i++)
{
$j = ord($TSTR[$i]); // ¹®ÀÚÀÇ ASCII °ªÀ» ±¸ÇÕ´Ï´Ù.
// ±¸ÇÑ ASCII°ªÀÌ 127º¸´Ù Å©¸é ±× ¹ÙÀÌÆ®°¡ ÇѱÛÀÇ ½ÃÀÛ¹ÙÀÌÆ®À̰ųª ³¡¹ÙÀÌÆ®(?)¶ó´Â ¶æÀÌÁÒ.
if($j > 127)
{
if( $flag ) $flag = 0; // $flag °ªÀÌ Á¸ÀçÇÑ´Ù´Â °ÍÀº À̹ø ¹®ÀÚ´Â ÇѱÛÀÇ ³¡¹ÙÀÌÆ®À̱⠶§¹®¿¡
// $flag ¸¦ 0À¸·Î ÇØÁÝ´Ï´Ù.
else $flag = 1; // °ªÀÌ Á¸ÀçÇÏÁö ¾ÊÀ¸¸é ÇѱÛÀÇ ½ÃÀÛ¹ÙÀÌÆ®ÀÌÁÒ. ±×·¯¹Ç·Î $flag ´Â 1!
}
else $flag = 0; // ´Ù¸¥ ¼ýÀÚ³ª ¿µ¹®À϶§´Â ±×³É ³Ñ¾î°¡¸é µÇ°ÚÁÒ.
}
if( $flag )
{
// ÀÌ·¸°Ô ÇØ¼ ¸¶Áö¸· ¹®ÀÚ±îÁöÀÇ $flag¸¦ °è»êÇØ¼ $flag°¡ Á¸ÀçÇϸé
$TSTR = substr($TSTR, 0, $TLEN - 1);
if( $TAG == 'Y' )
{
$TSTR = $TSTR.chr(32);
}
else
{
$TSTR = $TSTR.'+';
}
}
else
{
// ÇѹÙÀÌÆ®¸¦ ´õÇØ¼ ÀÚ¸£´øÁö »©¼ ÀÚ¸£´øÁö ÇØ¾ß°ÚÁÒ.
$TSTR = substr($TSTR, 0, $TLEN); // ¾Æ´Ô ¸»±¸....
}
return $TSTR; // ÀÌÁ¦ °áÁ¤µÈ ½ºÆ®¸µÀ» ¹ÝȯÇÕ´Ï´Ù.
// ÀÔ·ÂÀÚ·á°¡ ±æÀ̺¸´Ù ÀÛÀº °æ¿ì SPACE·Î ä¿î´Ù
}
else if ( strlen($TSTR) < $TLEN )
{
$TLENGTH = strlen($TSTR);
for ( $i=0 ; $i < $TLEN - $TLENGTH; $i++ )
{
if( $TAG == 'Y' )
{
$TSTR = $TSTR.chr(32);
}
else
{
$TSTR = $TSTR.'+';
}
}
return ($TSTR);
// ÀÔ·ÂÀÚ·á°¡ ±æÀÌ¿Í °°Àº°æ¿ì
}
else if ( strlen($TSTR) == $TLEN )
{
return ($TSTR);
}
}
/*
ÀÔ·ÂÇÑ ±ÛÀÚ°¡ ¼ýÀھƽºÅ°°ª¿¡ ÇØ´çÇÏ´ÂÁö ÆÇ´Ü.
*/
function IsNumber($word)
{
for($i = 0; $i < strlen($word); $i++)
{
$wordNum = ord( substr( $word, $i, 1 ) );
if( $wordNum < 48 || $wordNum > 57 )
{
return false;
}
}
return true;
}
/*
°æ°í ¸Þ¼¼Áö
*/
function AlertMsg( $msg , $go=0)
{
$msg = str_replace( "\"" ,"'" ,$msg );
$msg = str_replace( "\n" ,"\\n" ,$msg );
print "";
}
function HistoryGo( $go )
{
print "";
}
function AlertExit( $msg )
{
AlertMsg( $msg );
exit;
}
function AlertGoBack( $msg )
{
AlertMsg( $msg, -1);
exit;
}
}
/**************************************************************************************
*
* ¿Ã´õ°ÔÀÌÆ® °áÁ¦·Î±× ±â·Ï Ŭ·¡½º
*
***************************************************************************************/
class PayLog
{
var $log_fd;
var $log;
var $logLevel;
var $array_key;
var $debug_msg;
var $starttime;
var $homedir;
var $StoreId;
function PayLog( $request )
{
$this->debug_msg = array( "", "FATAL", "ERROR", "WARN", "INFO", "DEBUG" );
$this->log = $request["log"];
$this->logLevel = $request["logLevel"];
$this->homedir = $request["AgsPayHome"];
$this->StoreId = $request["StoreId"];
$this->starttime=GetTime();
}
function InitLog()
{
if( $this->log == "false" ) return true;
$logfile = $this->homedir. "/log/".PROGRAM."_".TYPE."_".$this->StoreId."_".date("ymd").".log";
$this->log_fd = fopen( $logfile, "a+" );
if( !$this->log_fd ) return false;
$this->WriteLog( INFO, "===============================================================" );
$this->WriteLog( INFO, "START ".PROGRAM." ".TYPE." (OS:".php_uname('s').php_uname('r').",PHP:".phpversion().")" );
return true;
}
function WriteLog($debug, $data)
{
if( $this->log == "false" || !$this->log_fd ) return;
if(strtoupper($this->logLevel) == "FATAL") $logLevel_int = 1;
if(strtoupper($this->logLevel) == "ERROR") $logLevel_int = 2;
if(strtoupper($this->logLevel) == "WARN") $logLevel_int = 3;
if(strtoupper($this->logLevel) == "INFO") $logLevel_int = 4;
if(strtoupper($this->logLevel) == "DEBUG") $logLevel_int = 5;
if( $debug > $logLevel_int ){ return; }
$prefix = $this->debug_msg[$debug]."\t[" . SetTimeStamp() . "] <" . getmypid() . "> ";
if( is_array( $data ) )
{
foreach ($data as $key => $val)
{
fwrite( $this->log_fd, $prefix . $key . ":" . $val . "\r\n");
}
}
else
{
fwrite( $this->log_fd, $prefix . $data . "\r\n" );
}
fflush( $this->log_fd );
}
function CloseLog($msg)
{
if( $this->log == "false" ) return;
$Transaction_time=GetTime()-$this->starttime;
$this->WriteLog( INFO, "END ".$this->REQUEST["Type"]." ".$msg." Transaction time:[".round($Transaction_time,3)."sec]" );
$this->WriteLog( INFO, "===============================================================" );
fclose( $this->log_fd );
}
}
function GetTime()
{
list($sec1, $sec2) = explode(" ", microtime(true));
return (float)$sec1 + (float)$sec2;
}
function SetTimeStamp()
{
$microtm = explode(' ',microtime());
list($t_Seconds, $Milliseconds) = array($microtm[1], (int)round($microtm[0]*1000,3));
return date("Y-m-d H:i:s", $t_Seconds) . ":$Milliseconds";
}
?>