Changeset 15197 for branches/feature-module-paygent/data/downloads/module/mdl_paygent/mdl_paygent.inc
- Timestamp:
- 2007/08/04 21:21:13 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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.