/home/mjc1/public_html/plugin/nicepay/nicePayResult.php


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
<?php
require_once dirname(__FILE__).'../lib/nicepay/web/NicePayWEB.php';
require_once 
dirname(__FILE__).'../lib/nicepay/core/Constants.php';
require_once 
dirname(__FILE__).'../lib/nicepay/web/NicePayHttpServletRequestWrapper.php';


/** 1. Request Wrapper Å¬·¡½º¸¦ µî·ÏÇÑ´Ù.  */ 
$httpRequestWrapper = new NicePayHttpServletRequestWrapper($_REQUEST);
$_REQUEST $httpRequestWrapper->getHttpRequestMap();

/** 2. ¼ÒÄÏ ¾î´ðÅͿ͠¿¬µ¿Çϴ Web ÀÎÅÍÆäÀ̽º °´Ã¼¸¦ »ý¼ºÇÑ´Ù.*/
$nicepayWEB = new NicePayWEB();

/** 2-1. ·Î±× µð·ºÅ丮 ¼³Á¤ */
$nicepayWEB->setParam("NICEPAY_LOG_HOME","C:\log");

/** 2-2. ¾îÇø®ÄÉÀ̼Ǡ·Î±× ¸ðµå ¼³Á¤(0: DISABLE, 1: ENABLE) */
$nicepayWEB->setParam("APP_LOG","1");

/** 2-3. ¾ÏȣȭÇ÷¡±× ¼³Á¤(N: Æò¹®, S:¾Ïȣȭ) */
$nicepayWEB->setParam("EncFlag","S");

/** 2-4. ¼­ºñ½º¸ðµå ¼³Á¤(°áÁ¦ ¼­ºñ½º : PY0 , Ãë¼Ò ¼­ºñ½º : CL0) */
$nicepayWEB->setParam("SERVICE_MODE""PY0");

/** 2-5. ÅëÈ­±¸ºÐ ¼³Á¤(ÇöÀç KRW(¿øÈ­) °¡´É)  */
$nicepayWEB->setParam("Currency""KRW");

/** 2-6. °áÁ¦¼ö´Ü ¼³Á¤ (½Å¿ëÄ«µå°áÁ¦ : CARD, °èÁÂÀÌü: BANK, °¡»ó°èÁÂÀÌü : VBANK, ÈÞ´ëÆù°áÁ¦ : CELLPHONE ) */
$payMethod $_REQUEST['PayMethod'];
$nicepayWEB->setParam("PayMethod",$_REQUEST['PayMethod']);

/** 2-7 ¶óÀ̼¾½ºÅ° ¼³Á¤ 
    »óÁ¡ ID¿¡ ¸Â´Â »óÁ¡Å°¸¦ ¼³Á¤ÇϽʽÿä.
    */
$nicepayWEB->setParam("LicenseKey","33F49GnCMS1mFYlGXisbUDzVf2ATWCl9k3R++d5hDd3Frmuos/XLx8XhXpe+LDYAbpGKZYSwtlyyLOtS/8aD7A==");

/** 3. °áÁ¦ ¿äû */
$responseDTO $nicepayWEB->doService($_REQUEST);

/** 4. °áÁ¦ °á°ú */
$resultCode $responseDTO->getParameter("ResultCode"); // °á°úÄÚµå (½Å¿ëÄ«µå Á¤»ó :3001 , ±× ¿Ü ¿¡·¯)
$resultMsg $responseDTO->getParameter("ResultMsg");   // °á°ú¸Þ½ÃÁö
$authDate $responseDTO->getParameter("AuthDate");   // ½ÂÀÎÀϽàYYMMDDHH24mmss
$authCode $responseDTO->getParameter("AuthCode");   // ½ÂÀιøÈ£
$buyerName $responseDTO->getParameter("BuyerName");   // ±¸¸ÅÀÚ¸í
$mallUserID $responseDTO->getParameter("MallUserID");   // È¸¿ø»ç°í°´ID
$goodsName $responseDTO->getParameter("GoodsName");   // »óǰ¸í
$mallUserID $responseDTO->getParameter("MallUserID");  // È¸¿ø»çID
$mid $responseDTO->getParameter("MID");  // »óÁ¡ID
$tid $responseDTO->getParameter("TID");  // °Å·¡ID
$moid $responseDTO->getParameter("Moid");  // ÁÖ¹®¹øÈ£
$amt $responseDTO->getParameter("Amt");  // ±Ý¾×

$cardQuota $responseDTO->getParameter("CardQuota");   // ÇҺΰ³¿ù
$cardCode $responseDTO->getParameter("CardCode");   // °áÁ¦Ä«µå»çÄÚµå
$cardName $responseDTO->getParameter("CardName");   // °áÁ¦Ä«µå»ç¸í

$bankCode $responseDTO->getParameter("BankCode");   // ÀºÇàÄÚµå
$bankName $responseDTO->getParameter("BankName");   // ÀºÇà¸í
$rcptType $responseDTO->getParameter("RcptType"); //Çö±Ý ¿µ¼öÁõ Å¸ÀÔ (0:¹ßÇàµÇÁö¾ÊÀ½,1:¼Òµæ°øÁ¦,2:ÁöÃâÁõºù)
$rcptAuthCode $responseDTO->getParameter("RcptAuthCode");   // Çö±Ý¿µ¼öÁõ ½ÂÀιøÈ£

$carrier $responseDTO->getParameter("Carrier");       // ÀÌÅë»ç±¸ºÐ
$dstAddr $responseDTO->getParameter("DstAddr");       // ÈÞ´ëÆù¹øÈ£

$vbankBankCode $responseDTO->getParameter("VbankBankCode");   // °¡»ó°èÁÂÀºÇàÄÚµå
$vbankBankName $responseDTO->getParameter("VbankBankName");   // °¡»ó°èÁÂÀºÇà¸í
$vbankNum $responseDTO->getParameter("VbankNum");   // °¡»ó°èÁ¹øÈ£
$vbankExpDate $responseDTO->getParameter("VbankExpDate");   // °¡»ó°èÁÂÀԱݿ¹Á¤ÀÏ

/** À§ÀÇ ÀÀ´ä µ¥ÀÌÅÍ ¿Ü¿¡µµ Àü¹® Header¿Í °³º°ºÎ µ¥ÀÌÅÍ Get °¡´É */

$paySuccess false;        // °áÁ¦ ¼º°ø ¿©ºÎ
if($payMethod == "CARD"){    //½Å¿ëÄ«µå
    
if($resultCode == "3001"$paySuccess true;    // °á°úÄÚµå (Á¤»ó :3001 , ±× ¿Ü ¿¡·¯)
}else if($payMethod == "BANK"){        //°èÁÂÀÌü
    
if($resultCode == "4000"$paySuccess true;    // °á°úÄÚµå (Á¤»ó :4000 , ±× ¿Ü ¿¡·¯)
}else if($payMethod == "CELLPHONE"){            //ÈÞ´ëÆù
    
if($resultCode == "A000"$paySuccess true;    //°á°úÄÚµå (Á¤»ó : A000, ±× ¿Ü ºñÁ¤»ó)
}else if($payMethod == "VBANK"){        //°¡»ó°èÁÂ
    
if($resultCode == "4100"$paySuccess true;    // °á°úÄÚµå (Á¤»ó :4100 , ±× ¿Ü ¿¡·¯)
}

if(
$paySuccess == true){
   
// °áÁ¦ ¼º°ø½Ã DB󸮠Çϼ¼¿ä.
}else{
   
// °áÁ¦ ½ÇÆÐ½Ã DB󸮠Çϼ¼¿ä.
}

?>

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=euc-kr" />
<title>NICEPAY :: °áÁ¦ ¿äû °á°ú</title>
<link rel="stylesheet" href="css/basic.css" type="text/css" />
<link rel="stylesheet" href="css/style.css" type="text/css" />
</head>
<body>
<br>
<table width="632" border="0" cellspacing="0" cellpadding="0" align="center">
  <tr>
      <td >
        <table width="632" border="0" cellspacing="0" cellpadding="0" class="title">
        <tr>
          <td width="35">&nbsp;</td>
          <td>°áÁ¦ ¿äû °á°ú</td>
          <td>&nbsp;</td>
        </tr>
      </table>
    </td>
  </tr>
  <tr>
    <td align="left" valign="top" background="images/bodyMiddle.gif"><table width="632" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="35" height="10">&nbsp;</td> <!--»ó´Ü¿©¹é ³ôÀÌ 10px -->
        <td width="562">&nbsp;</td>
        <td width="35">&nbsp;</td>
      </tr>
      <tr>
        <td height="30">&nbsp;</td>
        <td>°áÁ¦ ¿äûÀÌ ¿Ï·áµÇ¾ú½À´Ï´Ù.
        </td> 
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td height="15">&nbsp;</td> <!--ÄÁÅÙÃ÷¿Í ÄÁÅÙÃ÷ »çÀÌ °£°Ý 15px-->
        <td>&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td height="30">&nbsp;</td> 
        <td class="bold"><img src="images/bullet.gif" /> °áÁ¦ ³»¿ªÀÔ´Ï´Ù.
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td >&nbsp;</td>
        <td ><table width="562" border="0" cellspacing="0" cellpadding="0" class="talbeBorder" >
          <tr>
            <!-- Å×À̺í ÀϹÝÀÇ ³ôÀ̴ 30px // È¦¼öÇ༿ÀÇ °æ¿ì class="thead01" »ç¿ë -->
            <td width="100" height="30" id="borderBottom" class="thead01">°á°ú ³»¿ë</td> 
            <td id="borderBottom" >&nbsp;[<?php echo $resultCode?><?php echo $resultMsg?></td>
          </tr>
          <tr>
            <!-- Å×À̺í ÀϹÝÀÇ ³ôÀ̴ 30px // È¦¼öÇ༿ÀÇ °æ¿ì class="thead02" »ç¿ë -->
            <td width="100" height="30" id="borderBottom" class="thead02">°áÁ¦ ¼ö´Ü</td> 
            <td id="borderBottom" >&nbsp;<?php echo $payMethod ?></td>
          </tr>
          <tr>
            <td width="100" height="30" id="borderBottom" class="thead01">»óǰ¸í</td> 
            <td id="borderBottom" >&nbsp;<?php echo $goodsName ?></td>
          </tr>
          <tr>
            <td width="100" height="30" id="borderBottom" class="thead02">±Ý¾×</td> 
            <td id="borderBottom" >&nbsp;<?php echo $amt ?> ¿ø</td>
          </tr>
          <tr>
            <td width="100" height="30" id="borderBottom" class="thead01">°Å·¡¾ÆÀ̵ð</td> 
            <td id="borderBottom" >&nbsp;<?php echo $tid ?></td>
          </tr>
             <?if($payMethod == "CARD"){?>
              <tr>
                <td width="100" height="30" id="borderBottom" class="thead02">Ä«µå»ç¸í</td> 
                <td id="borderBottom" ><?php echo  $cardName ?>&nbsp;</td>
              </tr>
               <tr>
                <td width="100" height="30" id="borderBottom" class="thead01">ÇҺΰ³¿ù</td> 
                <td id="borderBottom" ><?php echo  $cardQuota ?>&nbsp;</td>
              </tr>
           <?}else if($payMethod == "BANK"){?>
              <tr>
                <td width="100" height="30" id="borderBottom" class="thead02">ÀºÇà</td> 
                <td id="borderBottom" ><?php echo  $bankName ?>&nbsp;</td>
              </tr>
               <tr>
                <td width="100" height="30" id="borderBottom" class="thead01">Çö±Ý¿µ¼öÁõ Å¸ÀÔ</td> 
                <td id="borderBottom" ><?php echo  $rcptType ?>&nbsp;&nbsp;(0:¹ßÇà¾ÈÇÔ,1:¼Òµæ°øÁ¦,2:ÁöÃâÁõºù)</td>
              </tr>
               <tr>
                <td width="100" height="30" id="borderBottom" class="thead02">Çö±Ý¿µ¼öÁõ ½ÂÀιøÈ£</td> 
                <td id="borderBottom" ><?php echo  $rcptAuthCode ?>&nbsp;</td>
              </tr>
          <?}else if($payMethod== "CELLPHONE"){?>
              <tr>
                <td width="100" height="30" id="borderBottom" class="thead02">ÀÌÅë»ç ±¸ºÐ</td> 
                <td id="borderBottom" ><?php echo  $carrier ?>&nbsp;</td>
              </tr>
               <tr>
                <td width="100" height="30" id="borderBottom" class="thead01">ÈÞ´ëÆù ¹øÈ£</td> 
                <td id="borderBottom" ><?php echo  $dstAddr ?>&nbsp;</td>
              </tr>
          <?}else if($payMethod == "VBANK"){?>
              <tr>
                <td width="100" height="30" id="borderBottom" class="thead02">ÀԱݠÀºÇà</td> 
                <td id="borderBottom" ><?php echo  $vbankBankName ?>&nbsp;</td>
              </tr>
               <tr>
                <td width="100" height="30" id="borderBottom" class="thead01">ÀԱݠ°èÁÂ</td> 
                <td id="borderBottom" ><?php echo  $vbankNum ?>&nbsp;</td>
              </tr>
              <tr>
                <td width="100" height="30" id="borderBottom" class="thead02">ÀԱݠ±âÇÑ</td> 
                <td id="borderBottom" ><?php echo  $vbankExpDate ?>&nbsp;</td>
              </tr>
          <?}?>


        </table></td>
        <td height="15">&nbsp;</td>
      </tr>
      <tr>
        <td height="15"></td>  <!--ÄÁÅÙÃ÷¿Í ÄÁÅÙÃ÷ »çÀÌ °£°Ý 15px-->
        <td >&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td></td>
        <td class="comment">Å×½ºÆ® ¾ÆÀ̵ðÀΰæ¿ì ´çÀÏ ¿ÀÈÄ 11½Ã 30ºÐ¿¡ Ãë¼ÒµË´Ï´Ù.        
        </td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td height="10"></td>  <!--ÇÏ´Ü¿©¹é ³ôÀÌ 10px -->
        <td >&nbsp;</td>
        <td>&nbsp;</td>
      </tr>  
    </table></td>
  </tr>
  <tr>
    <td><img src="images/bodyBottom.gif" /></td>
  </tr>
</table>
</body>
</html>