source: branches/feature-module-update/html/test/naka/shopcgi.php @ 15079

Revision 15079, 2.7 KB checked in by nanasess, 17 years ago (diff)

svn:mime-type application/x-httpd-php; charset=UTF-8 設定

  • Property svn:mime-type set to application/x-httpd-php; charset=UTF-8
Line 
1<?php
2
3require_once("../../require.php");
4require_once(DATA_PATH . "module/Request.php");
5
6$entry_url = "http://mod-i.ccsware.net/ohayou/EntryTran.php";
7$exec_url = "https://mod-i.ccsware.net/ohayou/ExecTran.php";
8// 受注番号の取得
9$order_id = sfGetUniqRandomId();
10
11// 店舗情報の送信
12$arrData = array(
13    'OrderId' => $order_id,     // 店舗ごとに一意な注文IDを送信する。
14    'TdTenantName' => '',       // 3D認証時表示用店舗名
15    'TdFlag' => '',             // 3Dフラグ
16    'ShopId' => 'test000003087',// ショップID
17    'ShopPass' => 'lockon',     // ショップパスワード
18    'Currency' => 'JPN',        // 通貨コード
19    'Amount' => '1000',         // 金額
20    'Tax' => '50',              // 消費税
21    'JobCd' => 'CHECK',         // 処理区分
22    'TenantNo' => '111111111',  // cgi-4で作成した店舗IDを送信する。
23);
24
25$req = new HTTP_Request($entry_url);
26$req->setMethod(HTTP_REQUEST_METHOD_POST);
27       
28$req->addPostDataArray($arrData);
29
30if (!PEAR::isError($req->sendRequest())) {
31    $response = $req->getResponseBody();
32} else {
33    $response = "";
34}
35$req->clearPostData();
36$arrRet = lfGetPostArray($response);
37
38sfPrintR($arrRet);
39
40// 決済情報の送信
41$arrData = array(
42    'AccessId' => $arrRet['ACCESS_ID'],
43    'AccessPass' => $arrRet['ACCESS_PASS'],
44    'OrderId' => $order_id,
45    'RetURL' => 'http://test.ec-cube.net/ec-cube/test/naka/recv.php',
46    // プロパーカードを扱わない場合はVISA固定でOK
47    'CardType' => 'VISA, 11111, 111111111111111111111111111111111111, 1111111111',
48    // 支払い方法
49    /*
50        1:一括
51        2:分割
52        3:ボーナス一括
53        4:ボーナス分割
54        5:リボ払い
55     */
56    'Method' => '2',
57    // 支払回数
58    'PayTimes' => '4',
59    'CardNo1' => '4444',
60    'CardNo2' => '4444',
61    'CardNo3' => '4444',
62    'CardNo4' => '5780',
63    'ExpireMM' => '06',
64    'ExpireYY' => '07',
65    // 加盟店自由項目返却フラグ
66    'ClientFieldFlag' => '1',
67    'ClientField1' => 'f1',
68    'ClientField2' => 'f2',
69    'ClientField3' => 'f3',
70    // リダイレクトページでの応答を受け取らない
71    'ModiFlag' => '1', 
72);
73
74$req = new HTTP_Request($exec_url);
75$req->setMethod(HTTP_REQUEST_METHOD_POST);
76
77$req->addPostDataArray($arrData);
78
79if (!PEAR::isError($req->sendRequest())) {
80    $response = $req->getResponseBody();
81} else {
82    $response = "";
83}
84$req->clearPostData();
85
86$arrRet = lfGetPostArray($response);
87
88sfPrintR($arrRet);
89
90//---------------------------------------------------------------------------------------------------------------------------------
91function lfGetPostArray($text) {
92    if($text != "") {
93        $text = ereg_replace("[\n\r]", "", $text);
94        $arrTemp = split("&", $text);
95        foreach($arrTemp as $ret) {
96            list($key, $val) = split("=", $ret);
97            $arrRet[$key] = $val;
98        }
99    }
100    return $arrRet;
101}
102?>
Note: See TracBrowser for help on using the repository browser.