- Timestamp:
- 2007/08/04 21:21:13 (17 years ago)
- Location:
- branches/feature-module-paygent/data/downloads/module/mdl_paygent
- Files:
-
- 1 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/feature-module-paygent/data/downloads/module/mdl_paygent/jp/co/ks/merchanttool/connectmodule/system/PaygentB2BModuleResources.php
r15162 r15197 11 11 * vpeBt@CÇAlÛNX 12 12 * 13 * @version $Revision: 1. 5$13 * @version $Revision: 1.6 $ 14 14 * @author $Author: t-mori $ 15 15 */ … … 462 462 || StringUtil::isEmpty($prop[PaygentB2BModuleResources__CA_FILE_PATH]) 463 463 || StringUtil::isEmpty($prop[PaygentB2BModuleResources__TIMEOUT_VALUE]) 464 || StringUtil::isEmpty($prop[PaygentB2BModuleResources__LOG_OUTPUT_PATH])465 464 || StringUtil::isEmpty($prop[PaygentB2BModuleResources__SELECT_MAX_CNT])) { 466 465 // K{Ú¢ÝèG[ -
branches/feature-module-paygent/data/downloads/module/mdl_paygent/jp/co/ks/merchanttool/connectmodule/util/HttpsRequestSender.php
r15162 r15197 14 14 15 15 /** 16 * https Í×µá¤ò¤ª¤³¤Ê¤¦¥æ¡¼¥Æ¥£¥ê¥Æ¥£¥¯¥é¥¹¡£16 * httpsvð¨±È¤[eBeBNXB 17 17 * 18 18 * @vesrion $Revision: 1.5 $ … … 20 20 */ 21 21 22 // cURL ¥¨¥é¡¼¥³¡¼¥É22 // cURL G[R[h 23 23 // http://curl.haxx.se/libcurl/c/libcurl-errors.html 24 24 define("HttpsRequestSender__CURLE_COULDNT_CONNECT", 7); … … 29 29 30 30 /** 31 * HTTP POST ÄÌ¿®ÍѸÇÄêÃÍ31 * HTTP POST ÊMpÅèl 32 32 */ 33 33 define("HttpsRequestSender__POST", "POST"); 34 34 35 35 /** 36 * HTTP ¥×¥í¥È¥³¥ë¤òɽ¤¹Äê¿ô36 * HTTPvgRð\·è 37 37 */ 38 38 define("HttpsRequestSender__HTTP", "HTTP"); 39 39 40 40 /** 41 * HTTP/1.0 ¤òɽ¤¹Äê¿ô41 * HTTP/1.0ð\·è 42 42 */ 43 43 define("HttpsRequestSender__HTTP_1_0", "HTTP/1.0"); 44 44 45 45 /** 46 * HTTP ÄÌ¿®¤ÎÀ®¸ù¥³¡¼¥É46 * HTTPÊM̬÷R[h 47 47 */ 48 48 define("HttpsRequestSender__HTTP_1_0_200", "HTTP/1.0 200"); 49 49 50 50 /** 51 * HTTP ÄÌ¿®¤ÎÀ®¸ù¥³¡¼¥É¡§20051 * HTTPÊM̬÷R[hF200 52 52 */ 53 53 define("HttpsRequestSender__HTTP_SUCCESS", 200); 54 54 55 55 /** 56 * HTTP ÄÌ¿®¤ÎÀ®¸ù¥³¡¼¥É¡§20656 * HTTPÊM̬÷R[hF206 57 57 */ 58 58 define("HttpsRequestSender__HTTP_PARTIAL_CONTENT", 206); 59 59 60 60 /** 61 * ÅÅʸĹ61 * d¶· 62 62 */ 63 63 define("HttpsRequestSender__TELEGRAM_LENGTH", 10240); … … 69 69 70 70 /** 71 * ¥ê¥¯¥¨¥¹¥È¡¦¥ì¥¹¥Ý¥ó¥¹¤Î²þ¹Ô¥³¡¼¥É71 * NGXgEX|XÌüsR[h 72 72 */ 73 73 define("HttpsRequestSender__CRLF", "\r\n"); 74 74 75 75 /** 76 * ¥Ç¥Õ¥©¥ë¥È¤Î¥¨¥ó¥³¡¼¥Ç¥£¥ó¥°76 * ftHgÌGR[fBO 77 77 */ 78 78 define("HttpsRequestSender__DEFAULT_ENCODING", "SJIS-win"); 79 79 80 80 /** 81 * HTTP ¥¹¥Æ¡¼¥¿¥¹¥³¡¼¥ÉÊÑ¿ô¤Î½é´üÃÍ81 * HTTPXe[^XR[hÏÌúl 82 82 */ 83 83 define("HttpsRequestSender__HTTP_STATUS_INIT_VALUE", -1); 84 84 85 85 /** 86 * ¥¹¥Æ¡¼¥¿¥¹¥³¡¼¥É¤ÎŤµ86 * Xe[^XR[hÌ·³ 87 87 */ 88 88 define("HttpsRequestSender__REGEXPSTATUS_LEN", 3); … … 110 110 var $KEYSTORE_PASSWORD = "changeit"; 111 111 112 /** ¥ì¥¹¥Ý¥ó¥¹¥Ø¥Ã¥À*/112 /** X|Xwb_ */ 113 113 var $responseHeader; 114 114 115 /** ¥ì¥¹¥Ý¥ó¥¹¥Ü¥Ç¥£*/115 /** X|X{fB */ 116 116 var $responseBody; 117 117 118 /** ¥¹¥Æ¡¼¥¿¥¹¥³¡¼¥É¡¡*/118 /** Xe[^XR[h@*/ 119 119 var $statusCode; 120 120 121 /** ÀܳÀèURL */121 /** Ú±æ URL */ 122 122 var $url; 123 123 124 /** ¥¯¥é¥¤¥¢¥ó¥È¾ÚÌÀ½ñ¥Ñ¥¹*/124 /** NCAgؾpX */ 125 125 var $clientCertificatePath; 126 126 127 /** ǧ¾Ú¶É¾ÚÌÀ½ñ¥Ñ¥¹*/127 /** FØÇؾpX */ 128 128 var $caCertificatePath; 129 129 130 /** SSL ÄÌ¿®ÍÑ¥½¥±¥Ã¥È*/130 /** SSLÊMp\Pbg */ 131 131 var $ch; 132 132 133 /** ¥È¥ó¥Í¥ë¥½¥±¥Ã¥È*/133 /** gl\Pbg */ 134 134 //var $tunnelSocket; 135 135 136 /** ¥¿¥¤¥à¥¢¥¦¥ÈÃÍint */136 /** ^CAEgl int */ 137 137 var $timeout; 138 138 139 /** Proxy ¥Û¥¹¥È̾*/139 /** ProxyzXg¼ */ 140 140 var $proxyHostName; 141 141 142 /** Proxy ¥Ý¡¼¥ÈÈÖ¹æint */142 /** Proxy|[gÔ int */ 143 143 var $proxyPort; 144 144 145 /** Proxy Àܳ¥¿¥¤¥à¥¢¥¦¥ÈÃÍ*/145 /** ProxyÚ±^CAEgl */ 146 146 var $proxyConnectTimeout; 147 147 148 /** Proxy ÅÁÁ÷¥¿¥¤¥à¥¢¥¦¥ÈÃÍ*/148 /** Proxy`^CAEgl */ 149 149 var $proxyCommunicateTimeout; 150 150 151 /** Proxy »ÈÍÑȽÄê*/151 /** Proxygp»è */ 152 152 var $isUsingProxy = false; 153 153 154 154 /** 155 * ¥³¥ó¥¹¥È¥é¥¯¥¿<br>156 * ÀܳÀèURL¤òÀßÄê155 * RXgN^<br> 156 * Ú±æURLðÝè 157 157 * 158 158 * @param url String … … 168 168 169 169 /** 170 * ¥¯¥é¥¤¥¢¥ó¥È¾ÚÌÀ½ñ¥Ñ¥¹¤òÀßÄê170 * NCAgؾpXðÝè 171 171 * 172 172 * @param fileName String … … 177 177 178 178 /** 179 * ǧ¾Ú¶É¾ÚÌÀ½ñ¥Ñ¥¹¤òÀßÄê179 * FØÇؾpXðÝè 180 180 * 181 181 * @param fileName String … … 186 186 187 187 /** 188 * ¥¿¥¤¥à¥¢¥¦¥È¤òÀßÄê188 * ^CAEgðÝè 189 189 * 190 190 * @param timeout int … … 195 195 196 196 /** 197 * Proxy Àܳ¥¿¥¤¥à¥¢¥¦¥È¤òÀßÄê197 * ProxyÚ±^CAEgðÝè 198 198 * 199 199 * @param proxyConnectTimeout int … … 204 204 205 205 /** 206 * Proxy ÅÁÁ÷¥¿¥¤¥à¥¢¥¦¥È¤òÀßÄê206 * Proxy`^CAEgðÝè 207 207 * 208 208 * @param proxyCommunicateTimeout int … … 213 213 214 214 /** 215 * ProxyHostName, ProxyPort ¤òÀßÄê215 * ProxyHostName, ProxyPort ðÝè 216 216 * 217 217 * @param proxyHostName String … … 224 224 225 225 if (!StringUtil::isEmpty($this->proxyHostName) && 0 < $this->proxyPort) { 226 // Proxy ¾ðÊó¤¬ÀßÄꤵ¤ì¤¿°Ù¡¢true ¤òÀßÄê226 // ProxyîñªÝè³ê½×Atrue ðÝè 227 227 $this->isUsingProxy = true; 228 228 } … … 230 230 231 231 /** 232 * Post ¤ò¼Â»Ü232 * PostðÀ{ 233 233 * 234 234 * @param formData Map 235 * @return mixed TRUE: À®¸ù¡¢Â¾:¥¨¥é¡¼¥³¡¼¥É235 * @return mixed TRUE:¬÷A¼:G[R[h 236 236 */ 237 237 function postRequestBody($formData) { 238 238 239 // ÄÌ¿®³«»Ï239 // ÊMJn 240 240 $this->initCurl(); 241 241 242 242 if ($this->isUsingProxy) { 243 // ¥×¥í¥¥··Ðͳ¤ÇÄÌ¿®Àè¤ËÀܳ243 // vLVoRÅÊMæÉÚ± 244 244 $this->setProxy(); 245 245 } 246 246 247 // ¥ê¥¯¥¨¥¹¥È¤òÁ÷¿®247 // NGXgðM 248 248 $retCode = $this->send($formData); 249 249 250 // ¥ì¥¹¥Ý¥ó¥¹¤ò¼õ¿®250 // X|XðóM 251 251 $this->closeCurl(); 252 252 … … 255 255 256 256 /** 257 * ¼õ¿®¥Ç¡¼¥¿¤òÊÖ¤¹257 * óMf[^ðÔ· 258 258 * 259 259 * @return InputStream … … 264 264 265 265 /** 266 * ÅÅʸĹ¥Á¥§¥Ã¥¯266 * d¶·`FbN 267 267 * 268 268 * @return boolean true=NotError false=Error … … 284 284 285 285 /** 286 * Í×µáÅÅʸ¤òºîÀ®287 * 288 * @param formData Map Í×µáÅÅʸ289 * @return String ºîÀ®¤·¤¿Í×µáÅÅʸ¡ÊURL¡Ë286 * vd¶ðì¬ 287 * 288 * @param formData Map vd¶ 289 * @return String 쬵½vd¶iURLj 290 290 */ 291 291 function convertToUrlEncodedString($formData) { … … 316 316 317 317 /** 318 * ¥Ç¥Ð¥Ã¥°¥í¥°½ÐÎϥ᥽¥Ã¥É319 * ¥í¥°½ÐÎÏ¥¯¥é¥¹¤Î¥¤¥ó¥¹¥¿¥ó¥¹À¸À®¤Ë¼ºÇÔ¤·¤¿¤éɸ½à½ÐÎϤ˥¨¥é¡¼¥á¥Ã¥»¡¼¥¸¤ò320 * ½ÐÎϤ¹¤ë¡£321 * 322 * @param msg String ½ÐÎÏ¥á¥Ã¥»¡¼¥¸318 * fobOOoÍ\bh 319 * OoÍNXÌCX^X¶¬É¸sµ½çWoÍÉG[bZ[Wð 320 * oÍ·éB 321 * 322 * @param msg String oÍbZ[W 323 323 */ 324 324 function outputDebugLog($msg) { … … 332 332 333 333 /** 334 * Proxy ÀܳÍÑ334 * ProxyÚ±p 335 335 * 336 336 */ … … 342 342 343 343 /** 344 * Àܳ¤Î¤¿¤á¤Î½é´ü²½½èÍý344 * ڱ̽ßÌú» 345 345 * 346 346 */ 347 347 function initCurl() { 348 348 $rslt = true; 349 // ½é´ü²½349 // ú» 350 350 $this->ch = curl_init($this->url); 351 351 … … 355 355 $rslt = $rslt && curl_setopt($this->ch, CURLOPT_HEADER, true); 356 356 357 // ¾ÚÌÀ½ñ357 // ؾ 358 358 $rslt = $rslt && curl_setopt($this->ch, CURLOPT_SSL_VERIFYPEER, true); 359 359 $rslt = $rslt && curl_setopt($this->ch, CURLOPT_SSL_VERIFYHOST, false); … … 362 362 $rslt = $rslt && curl_setopt($this->ch, CURLOPT_CAINFO, $this->caCertificatePath); 363 363 364 // ¥¿¥¤¥à¥¢¥¦¥È364 // ^CAEg 365 365 $rslt = $rslt && curl_setopt($this->ch, CURLOPT_TIMEOUT, $this->timeout); 366 366 $rslt = $rslt && curl_setopt($this->ch, CURLOPT_CONNECTTIMEOUT, $this->proxyConnectTimeout); … … 370 370 371 371 /** 372 * ¥ê¥¯¥¨¥¹¥ÈÀ¸À®¤ÈÁ÷¿®373 * 374 * @param formData Map Í×µáÅÅʸ375 * @return mixed TRUE: À®¸ù¡¢Â¾:¥¨¥é¡¼¥³¡¼¥É372 * NGXg¶¬ÆM 373 * 374 * @param formData Map vd¶ 375 * @return mixed TRUE:¬÷A¼:G[R[h 376 376 */ 377 377 function send($formData) { 378 // ¥ê¥¯¥¨¥¹¥È¤ò Map ¤«¤é String ¤ËÊÑ´¹378 // NGXgð Map ©ç String ÉÏ· 379 379 380 380 $query = $this->convertToUrlEncodedString($formData); … … 404 404 405 405 /** 406 * Curl ¤Î¥¨¥é¡¼½èÍý407 * @return mixed True: ÌäÂê¤Ê¤·¡¢Â¾¡§¥¨¥é¡¼¥³¡¼¥É406 * CurlÌG[ 407 * @return mixed True:âèȵA¼FG[R[h 408 408 */ 409 409 function procError() { … … 413 413 414 414 if ($errorNo <= HttpsRequestSender__CURLE_COULDNT_CONNECT) { // 7 415 // ÀܳÌäÂê415 // Ú±âè 416 416 $retCode = PaygentB2BModuleConnectException__KS_CONNECT_ERROR; 417 417 $this->outputDebugLog($errorMsg); 418 418 } else if ($errorNo == HttpsRequestSender__CURLE_COULDNT_CONNECT) { // 7 419 // ÀܳÌäÂê419 // Ú±âè 420 420 $retCode = PaygentB2BModuleConnectException__KS_CONNECT_ERROR; 421 421 $this->outputDebugLog($errorMsg); 422 422 } else if ($errorNo == HttpsRequestSender__CURLE_SSL_CERTPROBLEM) { 423 // ǧ¾ÚÌäÂê423 // FØâè 424 424 $retCode = PaygentB2BModuleConnectException__CERTIFICATE_ERROR; 425 425 $this->outputDebugLog($errorMsg); 426 426 } else if ($errorNo == HttpsRequestSender__CURLE_SSL_CACERT) { 427 // ǧ¾ÚÌäÂê427 // FØâè 428 428 $retCode = PaygentB2BModuleConnectException__CERTIFICATE_ERROR; 429 429 $this->outputDebugLog($errorMsg); 430 430 } else if ($errorNo == HttpsRequestSender__CURLE_SSL_CACERT_BADFILE) { // CURLE_SSL_CACERT_BADFILE 431 // ǧ¾ÚÌäÂê431 // FØâè 432 432 $retCode = PaygentB2BModuleConnectException__CERTIFICATE_ERROR; 433 433 $this->outputDebugLog($errorMsg); … … 437 437 $this->outputDebugLog($errorMsg); 438 438 } else { 439 // ¤½¤Î¾¤Î¥¨¥é¡¼439 // »Ì¼ÌG[ 440 440 $retCode = PaygentB2BModuleConnectException__KS_CONNECT_ERROR; 441 441 $this->outputDebugLog($errorMsg); … … 447 447 448 448 /** 449 * ¥ì¥¹¥Ý¥ó¥¹¤ò¼õ¿®¡£450 * 451 * @param $data ¥ì¥¹¥Ý¥ó¥¹Ê¸»úÎó452 * @return mixed TRUE: À®¸ù¡¢Â¾:¥¨¥é¡¼¥³¡¼¥É449 * X|XðóMB 450 * 451 * @param $data X|X¶ñ 452 * @return mixed TRUE:¬÷A¼:G[R[h 453 453 */ 454 454 function parseResponse($data) { 455 455 456 // ¥ì¥¹¥Ý¥ó¥¹¼õ¿®456 // X|XóM 457 457 $line = null; 458 458 $retCode = HttpsRequestSender__HTTP_STATUS_INIT_VALUE; … … 461 461 462 462 $lines = mb_split(HttpsRequestSender__CRLF, $data); 463 // ¥Ø¥Ã¥À¤Þ¤Ç¤òÆɤ߹þ¤à463 // wb_ÜÅðÇÝÞ 464 464 foreach($lines as $i => $line) { 465 465 … … 470 470 471 471 if ($retCode === HttpsRequestSender__HTTP_STATUS_INIT_VALUE) { 472 // ¥¹¥Æ¡¼¥¿¥¹¤Î²òÀÏ472 // Xe[^XÌðÍ 473 473 $retCode = $this->parseStatusLine($line); 474 474 if ($retCode === true) { … … 479 479 } 480 480 481 // ¥Ø¥Ã¥À¤Î²òÀÏ481 // wb_ÌðÍ 482 482 if (!$this->parseResponseHeader($line)) { 483 483 continue; … … 491 491 492 492 /** 493 * ¥¹¥Æ¡¼¥¿¥¹¥é¥¤¥ó¤ò²òÀÏ493 * Xe[^XCððÍ 494 494 * (HTTP-Version SP Status-Code SP Reason-Phrase CRLF) 495 495 * 496 * @param line String ¥¹¥Æ¡¼¥¿¥¹¥é¥¤¥ó497 * @return mixed TRUE: À®¸ù¡¢Â¾:¥¨¥é¡¼¥³¡¼¥É496 * @param line String Xe[^XC 497 * @return mixed TRUE:¬÷A¼:G[R[h 498 498 */ 499 499 function parseStatusLine($line) { … … 501 501 if (StringUtil::isEmpty($line)) { 502 502 503 // ÉÔÀµ¤Ê¥¹¥Æ¡¼¥¿¥¹¥³¡¼¥É¤ò¼õ¤±¼è¤Ã¤¿503 // s³ÈXe[^XR[hðó¯æÁ½ 504 504 return PaygentB2BModuleConnectException__KS_CONNECT_ERROR; 505 505 } … … 511 511 } else { 512 512 513 // ÉÔÀµ¤Ê¥¹¥Æ¡¼¥¿¥¹¥³¡¼¥É¤ò¼õ¤±¼è¤Ã¤¿513 // s³ÈXe[^XR[hðó¯æÁ½ 514 514 return PaygentB2BModuleConnectException__KS_CONNECT_ERROR; 515 515 } … … 518 518 || !StringUtil::isNumericLength($statusLine[1], HttpsRequestSender__REGEXPSTATUS_LEN)) { 519 519 520 // ÉÔÀµ¤Ê¥¹¥Æ¡¼¥¿¥¹¥³¡¼¥É¤ò¼õ¤±¼è¤Ã¤¿520 // s³ÈXe[^XR[hðó¯æÁ½ 521 521 return PaygentB2BModuleConnectException__KS_CONNECT_ERROR; 522 522 } … … 525 525 && ($this->statusCode <= HttpsRequestSender__HTTP_PARTIAL_CONTENT))) { 526 526 527 // HTTP Status ¤¬ Success Code (200 - 206) ¤Ç¤Ê¤¤¾ì¹ç527 // HTTP Status ª Success Code (200 - 206) ÅÈ¢ê 528 528 return PaygentB2BModuleConnectException__KS_CONNECT_ERROR; 529 529 } … … 533 533 534 534 /** 535 * ¥ì¥¹¥Ý¥ó¥¹¥Ø¥Ã¥À¤ò°ì¹Ô²òÀϤ·¤Æ¡¢ÆâÉô¤Ë³ÊǼ¡£<br>536 * ¥ì¥¹¥Ý¥ó¥¹¥Ø¥Ã¥À¤ÎÃͤ¬Â¸ºß¤·¤Ê¤¤¾ì¹ç¤Ï¡¢null¤òÀßÄê¡£537 * 538 * @param line String ¥µ¡¼¥Ð¤«¤é¼õ¤±¼è¤Ã¤¿¥ì¥¹¥Ý¥ó¥¹¹Ô539 * @return boolean true= ¥Ø¥Ã¥À²òÀÏ¡¦³ÊǼ´°Î», false=¥Ø¥Ã¥À¤Ç¤Ï¤Ê¤¤¡Ê¥Ø¥Ã¥ÀÉô½ªÎ»¡Ë535 * X|Xwb_ðêsð͵ÄAàÉi[B<br> 536 * X|Xwb_Ìlª¶ÝµÈ¢êÍAnullðÝèB 537 * 538 * @param line String T[o©çó¯æÁ½X|Xs 539 * @return boolean true=wb_ðÍEi[®¹, false=wb_ÅÍÈ¢iwb_I¹j 540 540 */ 541 541 function parseResponseHeader($line) { 542 542 if (StringUtil::isEmpty($line)) { 543 // HEADER ½ªÎ»543 // HEADERI¹ 544 544 return false; 545 545 } … … 552 552 553 553 if (count($headerStr) == 1 || strlen(trim($headerStr[1])) == 0) { 554 // Ãͤ¬Â¸ºß¤·¤Ê¤¤ or Ãͤ¬¶õʸ»úÎó554 // lª¶ÝµÈ¢ or lªó¶ñ 555 555 $this->responseHeader[$headerStr[0]] = null; 556 556 } else { … … 566 566 */ 567 567 function closeCurl() { 568 // ¥×¥í¥¥·¥½¥±¥Ã¥ÈCLOSE568 // vLV\PbgCLOSE 569 569 if ($this->ch != null) { 570 570 curl_close($this->ch); -
branches/feature-module-paygent/data/downloads/module/mdl_paygent/jp/co/ks/merchanttool/connectmodule/util/PaygentB2BModuleLogger.php
r15162 r15197 8 8 */ 9 9 10 define('LOG4PHP_DIR', 'log4php');11 require_once(LOG4PHP_DIR . '/LoggerManager.php');12 require_once(LOG4PHP_DIR . '/layouts/LoggerPatternLayout.php');13 require_once(LOG4PHP_DIR . '/appenders/LoggerAppenderFile.php');14 15 include_once("jp/co/ks/merchanttool/connectmodule/exception/PaygentB2BModuleException.php");16 10 include_once("jp/co/ks/merchanttool/connectmodule/system/PaygentB2BModuleResources.php"); 17 11 … … 20 14 [p Logger NX 21 15 * 22 * @version $Revision: 1. 4$16 * @version $Revision: 1.6 $ 23 17 * @author $Author: t-mori $ 24 18 */ 25 19 26 /** LogoÍp^[¶ñ */27 define("PaygentB2BModuleLogger__PATTERN", "%d{Y/m/d H:i:s} %-5p %c %m%n");28 29 30 20 class PaygentB2BModuleLogger { 31 21 32 /** loggerÛ */33 //var $instance = null;34 35 22 /** FileAppender Û */ 36 var $ appender= null;23 var $filename = null; 37 24 38 25 /** … … 40 27 */ 41 28 function PaygentB2BModuleLogger() { 42 $layout = new LoggerPatternLayout();43 $layout->setConversionPattern(PaygentB2BModuleLogger__PATTERN);44 $layout->activateOptions();45 $this->appender = new LoggerAppenderFile("FileLogger");46 $this->appender->setLayout($layout);47 48 29 $inst = PaygentB2BModuleResources::getInstance(); 49 30 if (is_object($inst) && 50 31 !StringUtil::isEmpty($inst->getLogOutputPath())) { 51 $this->appender->setFile($inst->getLogOutputPath(), true); 52 $this->appender->activateOptions(); 53 } else { 54 $this->appender = null; 55 trigger_error("Cannot get log file.", E_USER_WARNING); 32 $this->filename = $inst->getLogOutputPath(); 56 33 } 57 34 } … … 69 46 70 47 $logInstance = new PaygentB2BModuleLogger(); 71 if ($logInstance->appender == null) {72 $logInstance = null;73 }74 48 } 75 49 return $logInstance; … … 81 55 * @param className String OÌoͳNX¼ oͳð¯Ê 82 56 * @param message Object ObZ[W 83 * @param throwable Throwable84 57 */ 85 function debug($className, $message, $throwable = null) { 86 $log = &LoggerManager::getLogger($className); 87 $log->setLevel(LoggerLevel::getLevelDebug()); 88 $log->addAppender($this->appender); 89 $log->debug($message, $throwable); 58 function debug($className, $message) { 59 if(is_null($this->filename) == false && $this->filename != "") { 60 if(! $handle = fopen( $this->filename, 'a')) { 61 // t@CªJ¯È¢ 62 trigger_error(PaygentB2BModuleException__OTHER_ERROR. ":File doesn't open.(".$this->filename.").", E_USER_WARNING); 63 return; 64 } 65 if(! fwrite($handle, $this->outputMsg($message, $className))) { 66 // t@CÉ«ßÈ¢ 67 trigger_error(PaygentB2BModuleException__OTHER_ERROR. ":It is not possible to write it in the file(".$this->filename.").", E_USER_WARNING); 68 return; 69 } 70 fclose($handle); 71 } 90 72 } 91 73 92 74 /** 93 * CtHOðoÍ75 * oÍbZ[Wð®`·é 94 76 * 95 * @param className String OÌoͳNX¼ oͳð¯Ê96 * @param message Object ObZ[W97 * @ param throwable Throwable77 * @param message ObZ[W 78 * @param className NX¼ 79 * @return ®`ãÌbZ[W 98 80 */ 99 function info($className, $message, $throwable = null) { 100 $log = &LoggerManager::getLogger($className); 101 $log->setLevel(LoggerLevel::getLevelDebug()); 102 $log->addAppender($this->appender); 103 $log->info($message, $throwable); 81 function outputMsg($message, $className) { 82 return date("Y/m/d H:i:s")." $className ".$message."\n"; 104 83 } 105 106 /**107 * [jOOðoÍ108 *109 * @param className String OÌoͳNX¼ oͳð¯Ê110 * @param message Object ObZ[W111 * @param throwable Throwable112 */113 function warn($className, $message, $throwable = null) {114 $log = &LoggerManager::getLogger($className);115 $log->setLevel(LoggerLevel::getLevelDebug());116 $log->addAppender($this->appender);117 $log->info($message, $throwable);118 }119 120 /**121 * G[OðoÍ122 *123 * @param className String OÌoͳNX¼ oͳð¯Ê124 * @param messageObject ObZ[W125 * @param throwable Throwable126 */127 function error($className, $message, $throwable = null) {128 $log = &LoggerManager::getLogger($className);129 $log->setLevel(LoggerLevel::getLevelDebug());130 $log->addAppender($this->appender);131 $log->error($message, $throwable);132 }133 134 /**135 * tF[^OðoÍ136 *137 * @param className String OÌoͳNX¼ oͳð¯Ê138 * @param message Object ObZ[W139 * @param throwable Throwable140 */141 function fatal($className, $message, $throwable = null) {142 $log = &LoggerManager::getLogger($className);143 $log->setLevel(LoggerLevel::getLevelDebug());144 $log->addAppender($this->appender);145 $log->fatal($message, $throwable);146 }147 148 84 } 149 85 -
branches/feature-module-paygent/data/downloads/module/mdl_paygent/mdl_paygent.inc
r15196 r15197 40 40 define("PAYGENT_CONVENI", '030'); 41 41 define("PAYGENT_CREDIT", '020'); 42 // ¥Ð¥Ã¥Á¤Ç»ÈÍѤ¹¤ë¡£ 43 define("PAYGENT_REF", '090'); 42 44 43 45 // »Ùʧ¤¤ÊýË¡¤Î̾Á° … … 92 94 * Ìá¤êÃÍ ¡§¼èÆÀ·ë²Ì 93 95 **************************************************************************************************************/ 94 function sfGetPaygentShare($telegram_kind, $ arrData, $arrParam) {96 function sfGetPaygentShare($telegram_kind, $order_id, $arrParam) { 95 97 96 98 /** ¶¦ÄÌÅÅʸ **/ … … 106 108 $arrSend['telegram_version'] = TELEGRAM_VERSION; 107 109 // ¥Þ¡¼¥Á¥ã¥ó¥È¼è°úID 108 $arrSend['trading_id'] = $ arrData['order_id'];110 $arrSend['trading_id'] = $order_id; 109 111 110 112 return $arrSend; … … 129 131 130 132 // ¶¦Ḁ̈ǡ¼¥¿¤Î¼èÆÀ 131 $arrSend = sfGetPaygentShare(PAYGENT_CREDIT, $arrData , $arrPaymentDB[0]);133 $arrSend = sfGetPaygentShare(PAYGENT_CREDIT, $arrData['order_id'], $arrPaymentDB[0]); 132 134 133 135 /** ¸ÄÊÌÅÅʸ **/ … … 187 189 188 190 // ¶¦Ḁ̈ǡ¼¥¿¤Î¼èÆÀ 189 $arrSend = sfGetPaygentShare(PAYGENT_CONVENI, $arrData , $arrPaymentDB[0]);191 $arrSend = sfGetPaygentShare(PAYGENT_CONVENI, $arrData['order_id'], $arrPaymentDB[0]); 190 192 191 193 /** ¸ÄÊÌÅÅʸ **/ … … 244 246 245 247 // ¶¦Ḁ̈ǡ¼¥¿¤Î¼èÆÀ 246 $arrSend = sfGetPaygentShare(PAYGENT_ATM, $arrData , $arrPaymentDB[0]);248 $arrSend = sfGetPaygentShare(PAYGENT_ATM, $arrData['order_id'], $arrPaymentDB[0]); 247 249 248 250 … … 301 303 302 304 // ¶¦Ḁ̈ǡ¼¥¿¤Î¼èÆÀ 303 $arrSend = sfGetPaygentShare(PAYGENT_BANK, $arrData , $arrPaymentDB[0]);305 $arrSend = sfGetPaygentShare(PAYGENT_BANK, $arrData['order_id'], $arrPaymentDB[0]); 304 306 305 307 /** ¸ÄÊÌÅÅʸ **/ … … 373 375 $arrRes[] = $objPaygent->resNext(); # Í×µá·ë²Ì¼èÆÀ 374 376 } 375 377 378 // ·èºÑËè¤Ë°Û¤Ê¤ë½èÍý 376 379 switch($telegram_kind) { 380 // ¥¯¥ì¥¸¥Ã¥È·èºÑ¤Î¾ì¹ç 381 case PAYGENT_CREDIT: 382 // ¥¹¥Æ¡¼¥¿¥¹¤ò¿·µ¬¼õÉդˤ¹¤ë¡£ 383 $arrVal["status"] = ORDER_NEW; 384 // ¶õ¤ÎÇÛÎó¤ò³ÊǼ¤·¤Æ¤ª¤¯ 385 $arrVal["memo02"] = serialize(array()); 386 break; 377 387 // ¥³¥ó¥Ó¥Ë·èºÑ¤Î¾ì¹ç 378 388 case PAYGENT_CONVENI: … … 399 409 // ¼õÃí¥Æ¡¼¥Ö¥ë¤ËÊݸ 400 410 $arrVal["memo02"] = serialize($arrMemo); 411 // ¥¹¥Æ¡¼¥¿¥¹¤òÆþ¶âÂÔ¤Á¤Ë¤¹¤ë¡£ 412 $arrVal["status"] = ORDER_PAY_WAIT; 401 413 break; 402 414 // ATM·èºÑ¤Î¾ì¹ç … … 410 422 $arrMemo['payment_limit_date'] = sfSetConvMSG("¤ª»Ùʧ´üÆü", date("Yǯm·îdÆü", strtotime($arrRes[0]['payment_limit_date']))); 411 423 // ¼õÃí¥Æ¡¼¥Ö¥ë¤ËÊݸ 412 $arrVal["memo02"] = serialize($arrMemo); 424 $arrVal["memo02"] = serialize($arrMemo); 425 // ¥¹¥Æ¡¼¥¿¥¹¤òÆþ¶âÂÔ¤Á¤Ë¤¹¤ë¡£ 426 $arrVal["status"] = ORDER_PAY_WAIT; 413 427 break; 414 default: 428 // ¶ä¹Ô¥Í¥Ã¥È¤Î¾ì¹ç 429 case PAYGENT_BANK: 430 // ¥¹¥Æ¡¼¥¿¥¹¤ò¿·µ¬¼õÉդˤ¹¤ë¡£ 431 $arrVal["status"] = ORDER_NEW; 415 432 // ¶õ¤ÎÇÛÎó¤ò³ÊǼ¤·¤Æ¤ª¤¯ 416 433 $arrVal["memo02"] = serialize(array()); 417 434 break; 435 default: 436 break; 418 437 } 419 438 420 439 // ¼õÃí¥Æ¡¼¥Ö¥ë¤ËµÏ¿¤¹¤ë 421 $arrVal["memo01"] = $resultStatus; // ½èÍý·ë²Ì 422 $arrVal["memo03"] = $responseCode; // ¥ì¥¹¥Ý¥ó¥¹¥³¡¼¥É 423 $arrVal["memo04"] = $responseDetail; // ¥¨¥é¡¼¥á¥Ã¥»¡¼¥¸ 424 $arrVal["memo05"] = $arrRes[0]['payment_id']; // ¾µÇ§ÈÖ¹æ 440 $arrVal["memo01"] = MDL_PAYGENT_ID; // ½èÍý·ë²Ì 441 442 // memo02¤Ï¡¢»Ùʧ¾ðÊó¤ò³ÊǼ¤¹¤ë¡£ 443 $arrVal["memo03"] = $resultStatus; // ½èÍý·ë²Ì 444 $arrVal["memo04"] = $responseCode; // ¥ì¥¹¥Ý¥ó¥¹¥³¡¼¥É 445 $arrVal["memo05"] = $responseDetail; // ¥¨¥é¡¼¥á¥Ã¥»¡¼¥¸ 446 $arrVal["memo06"] = $arrRes[0]['payment_id']; // ¾µÇ§ÈÖ¹æ 425 447 426 448 // ¼õÃí°ì»þ¥Æ¡¼¥Ö¥ë¤Ë¹¹¿· … … 468 490 * Ìá¤êÃÍ ¡§¼èÆÀ·ë²Ì 469 491 **************************************************************************************************************/ 470 function sfGetPaymentDB($module_id, $where , $arrWhereVal = array()){492 function sfGetPaymentDB($module_id, $where = "", $arrWhereVal = array()){ 471 493 $objQuery = new SC_Query(); 472 494 … … 487 509 return $arrRet; 488 510 } 511 512 /************************************************************************************************************** 513 * ´Ø¿ô̾ ¡§sfPaygentBatch 514 * ½èÍýÆâÍÆ ¡§Æþ¶â¥¹¥Æ¡¼¥¿¥¹³Îǧ¥Ð¥Ã¥Á 515 * °ú¿ô1 ¡§ 516 * °ú¿ô2 ¡§ 517 * °ú¿ô3 ¡§ 518 * Ìá¤êÃÍ ¡§¼èÆÀ·ë²Ì 519 **************************************************************************************************************/ 520 function sfPaygentBatch() { 521 $objQuery = new SC_Query(); 522 523 // Àܳ¥â¥¸¥å¡¼¥ë¤Î¥¤¥ó¥¹¥¿¥ó¥¹¼èÆÀ (¥³¥ó¥¹¥È¥é¥¯¥¿)¤È½é´ü²½ 524 $objPaygent = new PaygentB2BModule(); 525 $objPaygent->init(); 526 527 //¡¡ÀßÄê¥Ñ¥é¥á¡¼¥¿¤Î¼èÆÀ 528 $arrPaymentDB = sfGetPaymentDB(MDL_PAYGENT_ID); 529 530 $where = "memo01 = ? AND status = ?"; 531 $arrOrder = $objQuery->select("order_id", "dtb_order", $where, array(MDL_PAYGENT_ID, ORDER_PAY_WAIT)); 532 533 sfPrintR($arrRet); 534 535 // ¶¦Ḁ̈ǡ¼¥¿¤Î¼èÆÀ 536 $arrSend = sfGetPaygentShare(PAYGENT_REF, 0, $arrPaymentDB[0]); 537 538 for($i = 0; $i < count($arrOrder); $i++) { 539 $arrRet = sfCheckPaymentStatus($objPaygent, $arrOrder[$i]['order_id'], $arrSend); 540 } 541 542 sfPrintR($arrRet); 543 544 return $arrRet; 545 } 546 547 /************************************************************************************************************** 548 * ´Ø¿ô̾ ¡§sfCheckPaymentStatus 549 * ½èÍýÆâÍÆ ¡§Æþ¶â¥¹¥Æ¡¼¥¿¥¹³Îǧ¥Ð¥Ã¥Á 550 * °ú¿ô1 ¡§ 551 * °ú¿ô2 ¡§ 552 * °ú¿ô3 ¡§ 553 * Ìá¤êÃÍ ¡§¼èÆÀ·ë²Ì 554 **************************************************************************************************************/ 555 function sfCheckPaymentStatus($objPaygent, $order_id, $arrSend) { 556 // ¥Þ¡¼¥Á¥ã¥ó¥È¼è°úID¤ÎÆþ¤ìÂؤ¨ 557 $arrSend['trading_id'] = $order_id; 558 559 sfPrintR($arrSend); 560 561 // ÅÅʸ¤ÎÁ÷ÉÕ 562 foreach($arrSend as $key => $val) { 563 $objPaygent->reqPut($key, $val); 564 } 565 // ÅÅʸ¤ÎÁ÷¿® 566 $objPaygent->post(); 567 568 // ¥ì¥¹¥Ý¥ó¥¹¤Î¼èÆÀ 569 while($objPaygent->hasResNext()) { 570 # ¥Ç¡¼¥¿¤¬Â¸ºß¤¹¤ë¸Â¤ê¡¢¼èÆÀ 571 $arrRes[] = $objPaygent->resNext(); # Í×µá·ë²Ì¼èÆÀ 572 } 573 574 foreach($arrRes[0] as $key => $val) { 575 // Shift-JIS¤Ç±þÅú¤¬¤¢¤ë¤Î¤Ç¡¢¥¨¥ó¥³¡¼¥É¤¹¤ë¡£ 576 $arrRes[0][$key] = mb_convert_encoding($val, CHAR_CODE, "Shift-JIS"); 577 } 578 579 return $arrRes[0]; 580 } 581 489 582 ?>
Note: See TracChangeset
for help on using the changeset viewer.