source: branches/feature-module-paygent/data/downloads/module/mdl_paygent/mdl_paygent.inc @ 15197

Revision 15197, 18.5 KB checked in by naka, 15 years ago (diff)
Line 
1<?php
2/**
3 *
4 * @copyright   2000-2006 LOCKON CO.,LTD. All Rights Reserved.
5 * @version CVS: $Id: mdl_epsilon.inc 7162 2006-11-18 09:53:33Z kakinaka $
6 * @link        http://www.lockon.co.jp/
7 *
8 */
9$paygent_credit_php_dir = realpath(dirname( __FILE__));
10ini_set('include_path', $paygent_credit_php_dir . PATH_SEPARATOR . ini_get('include_path'));
11
12$check_path = $paygent_credit_php_dir . "/" . "jp/co/ks/merchanttool/connectmodule/";
13
14// paygent¥â¥¸¥å¡¼¥ë¤ÎÆɹþ
15include_once("jp/co/ks/merchanttool/connectmodule/entity/ResponseDataFactory.php");
16include_once("jp/co/ks/merchanttool/connectmodule/system/PaygentB2BModule.php");
17include_once("jp/co/ks/merchanttool/connectmodule/exception/PaygentB2BModuleConnectException.php");
18include_once("jp/co/ks/merchanttool/connectmodule/exception/PaygentB2BModuleException.php");
19
20// ¥Ú¥¤¥¸¥§¥ó¥È·èºÑ¤Î¥â¥¸¥å¡¼¥ëID¡Êdtb_module¤È¹ç¤ï¤»¤ë¡Ë
21define("MDL_PAYGENT_ID", 9);
22
23// ¥Ú¥¤¥¸¥§¥ó¥È¤Î³Æʧ¹þ¤ÎÂбþÈÖ¹æ
24/*
25    ÅÅʸ¼ïÊ̤òɽ¤¹¶èʬ
26    010¡§ATM·èºÑ¿½¹þ
27    020¡§Ž¶Ž°ŽÄŽÞ·èºÑŽµŽ°Ž¿ŽØ
28    021¡§Ž¶Ž°ŽÄŽÞ·èºÑŽµŽ°Ž¿ŽØŽ·Ž¬ŽÝŽ¾ŽÙ
29    022¡§Ž¶Ž°ŽÄŽÞ·èºÑÇä¾å
30    023¡§Ž¶Ž°ŽÄŽÞ·èºÑÇä¾åŽ·Ž¬ŽÝŽ¾ŽÙ
31    024¡§Ž¶Ž°ŽÄŽÞ·èºÑ3DŽµŽ°Ž¿ŽØ
32    030¡§ŽºŽÝŽËŽÞŽÆ·èºÑ(ÈÖ¹æÊý¼°)¿½¹þ
33    040¡§ŽºŽÝŽËŽÞŽÆ·èºÑ(ʧ¹þɼÊý¼°)¿½¹þ
34    050¡§¶ä¹ÔŽÈŽ¯ŽÄ·èºÑ¿½¹þ
35    060¡§¶ä¹Ô¥Í¥Ã¥È·èºÑASP
36    090¡§·èºÑ¾ðÊó¾È²ñ
37 */
38define("PAYGENT_BANK", '050');
39define("PAYGENT_ATM", '010');
40define("PAYGENT_CONVENI", '030');
41define("PAYGENT_CREDIT", '020');
42// ¥Ð¥Ã¥Á¤Ç»ÈÍѤ¹¤ë¡£
43define("PAYGENT_REF", '090');   
44
45// »Ùʧ¤¤ÊýË¡¤Î̾Á°
46define("MDL_PAYGENT_CREDIT_NAME", "PAYGENT¥¯¥ì¥¸¥Ã¥È·èºÑ");
47define("MDL_PAYGENT_CONVENI_NAME", "PAYGENT¥³¥ó¥Ó¥Ë·èºÑ");
48
49define ("CHARGE_MAX", 500000);
50define ("SEVEN_CHARGE_MAX", 300000);
51
52// ÅÅʸ¥Ð¡¼¥¸¥ç¥ó
53define ("TELEGRAM_VERSION", '1.0');
54
55//¥³¥ó¥Ó¥Ë¤Î¼ïÎà
56$arrConvenience = array(
57    '00C016' => '¥»¥¤¥³¡¼¥Þ¡¼¥È',
58    '00C002' => '¥í¡¼¥½¥ó',
59    '00C004' => '¥ß¥Ë¥¹¥È¥Ã¥×',
60    '00C005' => '¥Õ¥¡¥ß¥ê¡¼¥Þ¡¼¥È',
61    '00C006' => '¥µ¥ó¥¯¥¹',
62    '00C007' => '¥µ¡¼¥¯¥ëK',
63    '00C014' => '¥Ç¥¤¥ê¡¼¥ä¥Þ¥¶¥­',
64    '00C001' => '¥»¥Ö¥ó¥¤¥ì¥Ö¥ó'
65);
66   
67// ¥Í¥Ã¥È¥Ð¥ó¥¯¤Î¼ïÎà
68$arrNetBank = array(
69    'D005' => 'e-payment',
70    'D008' => '¥Í¥Ã¥È¿¶¹þEDI',
71    'D009' => 'One\'s ¥À¥¤¥ì¥¯¥È',
72    'D033' => '¥¸¥ã¥Ñ¥ó¥Í¥Ã¥È¶ä¹Ô',
73    'D036' => '¥¤¡¼¥Ð¥ó¥¯' 
74);
75   
76// ¥¯¥ì¥¸¥Ã¥Èʬ³ä²ó¿ô
77$arrPaymentClass = array(
78    '10' => '°ì³çʧ¤¤',
79    '61-2' => 'ʬ³ä2²óʧ¤¤',
80    '61-3' => 'ʬ³ä3²óʧ¤¤',
81    '61-6' => 'ʬ³ä6²óʧ¤¤',
82    '61-10' => 'ʬ³ä10²óʧ¤¤',
83    '61-15' => 'ʬ³ä15²óʧ¤¤',
84    '61-20' => 'ʬ³ä20²óʧ¤¤',
85    '80' => '¥ê¥Üʧ¤¤'
86);
87
88/**************************************************************************************************************
89 * ´Ø¿ô̾   ¡§sfGetPaygentShare
90 * ½èÍýÆâÍÆ ¡§¥Ú¥¤¥¸¥§¥ó¥È¾ðÊóÁ÷¿®¤Î¶¦Ä̽èÍý
91 * °ú¿ô1    ¡§
92 * °ú¿ô2    ¡§
93 * °ú¿ô3    ¡§
94 * Ìá¤êÃÍ   ¡§¼èÆÀ·ë²Ì
95 **************************************************************************************************************/
96function sfGetPaygentShare($telegram_kind, $order_id, $arrParam) {
97   
98    /** ¶¦ÄÌÅÅʸ **/   
99    // ¥Þ¡¼¥Á¥ã¥ó¥ÈID
100    $arrSend['merchant_id'] = $arrParam['merchant_id'];
101    // ÀܳID
102    $arrSend['connect_id'] = $arrParam['connect_id'];
103    // Àܳ¥Ñ¥¹¥ï¡¼¥É
104    $arrSend['connect_password'] = $arrParam['connect_password'];
105    // ÅÅʸ¼ïÊÌID
106    $arrSend['telegram_kind'] = $telegram_kind;
107    // ÅÅʸ¥Ð¡¼¥¸¥ç¥ó
108    $arrSend['telegram_version'] = TELEGRAM_VERSION;
109    // ¥Þ¡¼¥Á¥ã¥ó¥È¼è°úID
110    $arrSend['trading_id'] = $order_id;
111
112    return $arrSend;
113}
114   
115/**************************************************************************************************************
116 * ´Ø¿ô̾   ¡§sfSendPaygentCredit
117 * ½èÍýÆâÍÆ ¡§¥¯¥ì¥¸¥Ã¥È¾ðÊó¤ÎÁ÷¿®
118 * °ú¿ô1    ¡§
119 * °ú¿ô2    ¡§
120 * °ú¿ô3    ¡§
121 * Ìá¤êÃÍ   ¡§¼èÆÀ·ë²Ì
122 **************************************************************************************************************/
123function sfSendPaygentCredit($arrData, $arrInput, $uniqid) {
124// Àܳ¥â¥¸¥å¡¼¥ë¤Î¥¤¥ó¥¹¥¿¥ó¥¹¼èÆÀ (¥³¥ó¥¹¥È¥é¥¯¥¿)¤È½é´ü²½
125    $p = new PaygentB2BModule();
126    $p->init();
127   
128    //¡¡¥¯¥ì¥¸¥Ã¥ÈÍѥѥé¥á¡¼¥¿¤Î¼èÆÀ
129    $arrPaymentDB = sfGetPaymentDB(MDL_PAYGENT_ID, "AND memo03 = 1");
130    $arrOtherParam = unserialize($arrPaymentDB[0]['other_param']);
131   
132    // ¶¦Ḁ̈ǡ¼¥¿¤Î¼èÆÀ
133    $arrSend = sfGetPaygentShare(PAYGENT_CREDIT, $arrData['order_id'], $arrPaymentDB[0]);
134   
135    /** ¸ÄÊÌÅÅʸ **/
136   
137    // ·èºÑ¶â³Û
138    $arrSend['payment_amount'] = $arrData['payment_total'];
139    // ¥«¡¼¥ÉÈÖ¹æ
140    $arrSend['card_number'] = $arrInput['card_no01'].$arrInput['card_no02'].$arrInput['card_no03'].$arrInput['card_no04'];
141    // ¥«¡¼¥ÉÍ­¸ú´ü¸Â(MMYY)
142    $arrSend['card_valid_term'] = $arrInput['card_month'].$arrInput['card_year'];
143    // »Ùʧ¤¤¶èʬ¡¢Ê¬³ä²ó¿ô¤Î¼èÆÀ
144    list($payment_class, $split_count) = split("-", $arrInput['payment_class']);
145       
146    // »Ùʧ¤¤¶èʬ
147    /*
148     * 10:1²ó
149     * 23:¥Ü¡¼¥Ê¥¹1²ó
150     * 61:ʬ³ä
151     * 80:¥ê¥Ü¥ë¥Ó¥ó¥°
152     */
153    $arrSend['payment_class'] = $payment_class;
154    // ʬ³ä²ó¿ô
155    $arrSend['split_count'] = $split_count;
156    // 3D¥»¥­¥å¥¢ÉÞÍܶèʬ
157    $arrSend['3dsecure_ryaku'] = '1';
158   
159    // ÅÅʸ¤ÎÁ÷ÉÕ
160    foreach($arrSend as $key => $val) {
161        $p->reqPut($key, $val);
162    }
163   
164    // ÅÅʸ¤ÎÁ÷¿®
165    $p->post();
166
167    // ±þÅú¤ò½èÍý
168    $arrRet = sfPaygentResponse(PAYGENT_CREDIT, $p, $uniqid);
169   
170    return $arrRet;
171}
172
173/**************************************************************************************************************
174 * ´Ø¿ô̾   ¡§sfSendPaygentConveni
175 * ½èÍýÆâÍÆ ¡§¥³¥ó¥Ó¥Ë¾ðÊó¤ÎÁ÷¿®
176 * °ú¿ô1    ¡§
177 * °ú¿ô2    ¡§
178 * °ú¿ô3    ¡§
179 * Ìá¤êÃÍ   ¡§¼èÆÀ·ë²Ì
180 **************************************************************************************************************/
181function sfSendPaygentConveni($arrData, $arrInput, $uniqid) {
182// Àܳ¥â¥¸¥å¡¼¥ë¤Î¥¤¥ó¥¹¥¿¥ó¥¹¼èÆÀ (¥³¥ó¥¹¥È¥é¥¯¥¿)¤È½é´ü²½
183    $p = new PaygentB2BModule();
184    $p->init();
185   
186    //¡¡¥³¥ó¥Ó¥ËÍѥѥé¥á¡¼¥¿¤Î¼èÆÀ
187    $arrPaymentDB = sfGetPaymentDB(MDL_PAYGENT_ID, "AND memo03 = 2");
188    $arrOtherParam = unserialize($arrPaymentDB[0]['other_param']);
189   
190    // ¶¦Ḁ̈ǡ¼¥¿¤Î¼èÆÀ
191    $arrSend = sfGetPaygentShare(PAYGENT_CONVENI, $arrData['order_id'], $arrPaymentDB[0]);
192   
193    /** ¸ÄÊÌÅÅʸ **/
194   
195    // ·èºÑ¶â³Û
196    $arrSend['payment_amount'] = $arrData['payment_total'];
197    // ÍøÍѼÔÀ«
198    $arrSend['customer_family_name'] = $arrInput['customer_family_name'];
199    // ÍøÍѼÔ̾
200    $arrSend['customer_name'] = $arrInput['customer_name'];
201    // ÍøÍѼÔÀ«È¾³Ñ¥«¥Ê
202    $arrSend['customer_family_name_kana'] = mb_convert_kana($arrInput['customer_family_name_kana'],'k');
203    // ÍøÍѼÔ̾Ⱦ³Ñ¥«¥Ê
204    $arrSend['customer_name_kana'] = mb_convert_kana($arrInput['customer_name_kana'],'k');
205    // ÍøÍѼÔÅÅÏÃÈÖ¹æ
206    $arrSend['customer_tel'] = $arrInput['customer_tel'];
207    // »Ùʧ´ü¸ÂÆü
208    $arrSend['payment_limit_date'] = $arrOtherParam['payment_limit_date'];
209    // ¥³¥ó¥Ó¥Ë´ë¶È¥³¡¼¥É
210    $arrSend['cvs_company_id'] = $arrInput['cvs_company_id'];
211    // »Ùʧ¼ïÊÌ
212    $arrSend['sales_type'] = '1';
213   
214    // ÅÅʸ¤ÎÁ÷ÉÕ
215    foreach($arrSend as $key => $val) {
216        // Shift-JIS¤Ë¥¨¥ó¥³¡¼¥É¤¹¤ëɬÍפ¢¤ê
217        $enc_val = mb_convert_encoding($val, "Shift-JIS", CHAR_CODE);       
218        $p->reqPut($key, $enc_val);
219    }
220   
221    // ÅÅʸ¤ÎÁ÷¿®
222    $p->post();
223
224    // ±þÅú¤ò½èÍý
225    $arrRet = sfPaygentResponse(PAYGENT_CONVENI, $p, $uniqid);
226       
227    return $arrRet;
228}
229
230/**************************************************************************************************************
231 * ´Ø¿ô̾   ¡§sfSendPaygentATM
232 * ½èÍýÆâÍÆ ¡§ATM·èºÑ¾ðÊó¤ÎÁ÷¿®
233 * °ú¿ô1    ¡§
234 * °ú¿ô2    ¡§
235 * °ú¿ô3    ¡§
236 * Ìá¤êÃÍ   ¡§¼èÆÀ·ë²Ì
237 **************************************************************************************************************/
238function sfSendPaygentATM($arrData, $arrInput, $uniqid) {
239// Àܳ¥â¥¸¥å¡¼¥ë¤Î¥¤¥ó¥¹¥¿¥ó¥¹¼èÆÀ (¥³¥ó¥¹¥È¥é¥¯¥¿)¤È½é´ü²½
240    $p = new PaygentB2BModule();
241    $p->init();
242   
243    //¡¡ATM·èºÑÍѥѥé¥á¡¼¥¿¤Î¼èÆÀ
244    $arrPaymentDB = sfGetPaymentDB(MDL_PAYGENT_ID, "AND memo03 = 3");
245    $arrOtherParam = unserialize($arrPaymentDB[0]['other_param']);
246   
247    // ¶¦Ḁ̈ǡ¼¥¿¤Î¼èÆÀ
248    $arrSend = sfGetPaygentShare(PAYGENT_ATM, $arrData['order_id'], $arrPaymentDB[0]);
249   
250   
251    /** ¸ÄÊÌÅÅʸ **/
252   
253    // ·èºÑ¶â³Û
254    $arrSend['payment_amount'] = $arrData['payment_total'];
255
256    // ÍøÍѼÔÀ«
257    $arrSend['customer_family_name'] = $arrInput['customer_family_name'];
258    // ÍøÍѼÔ̾
259    $arrSend['customer_name'] = $arrInput['customer_name'];
260    // ÍøÍѼÔÀ«È¾³Ñ¥«¥Ê
261    $arrSend['customer_family_name_kana'] = mb_convert_kana($arrInput['customer_family_name_kana'],'k');
262    // ÍøÍѼÔ̾Ⱦ³Ñ¥«¥Ê
263    $arrSend['customer_name_kana'] = mb_convert_kana($arrInput['customer_name_kana'],'k');
264    // ·èºÑÆâÍÆ
265    $arrSend['payment_detail'] = $arrOtherParam['payment_detail'];
266    // ·èºÑÆâÍÆȾ³Ñ¥«¥Ê
267    $arrSend['payment_detail_kana'] = mb_convert_kana($arrOtherParam['payment_detail'],'k');
268    // »Ùʧ´ü¸ÂÆü
269    $arrSend['payment_limit_date'] = $arrOtherParam['payment_limit_date'];
270   
271    // ÅÅʸ¤ÎÁ÷ÉÕ
272    foreach($arrSend as $key => $val) {
273        // Shift-JIS¤Ë¥¨¥ó¥³¡¼¥É¤¹¤ëɬÍפ¢¤ê
274        $enc_val = mb_convert_encoding($val, "Shift-JIS", CHAR_CODE);       
275        $p->reqPut($key, $enc_val);
276    }
277   
278    // ÅÅʸ¤ÎÁ÷¿®
279    $p->post();
280   
281    // ±þÅú¤ò½èÍý
282    $arrRet = sfPaygentResponse(PAYGENT_ATM, $p, $uniqid);
283   
284    return $arrRet;
285}
286
287/**************************************************************************************************************
288 * ´Ø¿ô̾   ¡§sfSendPaygentBANK
289 * ½èÍýÆâÍÆ ¡§¶ä¹ÔNET·èºÑ¾ðÊó¤ÎÁ÷¿®
290 * °ú¿ô1    ¡§
291 * °ú¿ô2    ¡§
292 * °ú¿ô3    ¡§
293 * Ìá¤êÃÍ   ¡§¼èÆÀ·ë²Ì
294 **************************************************************************************************************/
295function sfSendPaygentBANK($arrData, $arrInput, $uniqid) {
296// Àܳ¥â¥¸¥å¡¼¥ë¤Î¥¤¥ó¥¹¥¿¥ó¥¹¼èÆÀ (¥³¥ó¥¹¥È¥é¥¯¥¿)¤È½é´ü²½
297    $p = new PaygentB2BModule();
298    $p->init();
299   
300    //¡¡¶ä¹ÔNETÍѥѥé¥á¡¼¥¿¤Î¼èÆÀ
301    $arrPaymentDB = sfGetPaymentDB(MDL_PAYGENT_ID, "AND memo03 = 4");
302    $arrOtherParam = unserialize($arrPaymentDB[0]['other_param']);
303   
304    // ¶¦Ḁ̈ǡ¼¥¿¤Î¼èÆÀ
305    $arrSend = sfGetPaygentShare(PAYGENT_BANK, $arrData['order_id'], $arrPaymentDB[0]);
306
307    /** ¸ÄÊÌÅÅʸ **/
308   
309    $arrSend['bank_code'] = $arrInput['bank_code'];
310    // ·èºÑ¶â³Û
311    $arrSend['amount'] = $arrData['payment_total'];
312    // ÀÁµáÆâÍÆ¥«¥Ê
313    $arrSend['claim_kana'] = $arrOtherParam['claim_kana'];
314    // ÀÁµáÆâÍÆ´Á»ú
315    $arrSend['claim_kanji'] = $arrOtherParam['claim_kanji'];   
316    // ÍøÍѼÔÀ«
317    $arrSend['customer_family_name'] = $arrInput['customer_family_name'];
318    // ÍøÍѼÔ̾
319    $arrSend['customer_name'] = $arrInput['customer_name'];
320    // ÍøÍѼÔÀ«È¾³Ñ¥«¥Ê
321    $arrSend['customer_family_name_kana'] = mb_convert_kana($arrInput['customer_family_name_kana'],'k');
322    // ÍøÍѼÔ̾Ⱦ³Ñ¥«¥Ê
323    $arrSend['customer_name_kana'] = mb_convert_kana($arrInput['customer_name_kana'],'k');
324    // PC-Mobile¶èʬ
325    /*
326     * 0:PC
327     * 1:docomo
328     * 2:au
329     * 3:softbank
330     */
331    $arrSend['pc_mobile_type'] = '0';
332    // Ìá¤ê£Õ£Ò£Ì
333    $arrSend['return_url'] = SSL_URL . "shopping/load_payment_module.php";
334   
335    // ÅÅʸ¤ÎÁ÷ÉÕ
336    foreach($arrSend as $key => $val) {
337        // Shift-JIS¤Ë¥¨¥ó¥³¡¼¥É¤¹¤ëɬÍפ¢¤ê
338        $enc_val = mb_convert_encoding($val, "Shift-JIS", CHAR_CODE);
339        $p->reqPut($key, $enc_val);
340    }
341   
342    // ÅÅʸ¤ÎÁ÷¿®
343    $p->post();
344   
345    // ±þÅú¤ò½èÍý
346    $arrRet = sfPaygentResponse(PAYGENT_BANK, $p, $uniqid);
347   
348    return $arrRet;
349}
350
351/**************************************************************************************************************
352 * ´Ø¿ô̾   ¡§sfPaygentResponse
353 * ½èÍýÆâÍÆ ¡§±þÅú¤ò½èÍý¤¹¤ë
354 * °ú¿ô1    ¡§
355 * °ú¿ô2    ¡§
356 * °ú¿ô3    ¡§
357 * Ìá¤êÃÍ   ¡§¼èÆÀ·ë²Ì
358 **************************************************************************************************************/
359
360function sfPaygentResponse($telegram_kind, $objPaygent, $uniqid) {
361    global $arrConvenience;
362   
363    // ½èÍý·ë²Ì¼èÆÀ¡Ê¶¦ÄÌ¡Ë
364    $resultStatus = $objPaygent->getResultStatus(); # ½èÍý·ë²Ì 0=Àµ¾ï½ªÎ», 1=°Û¾ï½ªÎ»
365    $responseCode = $objPaygent->getResponseCode(); # °Û¾ï½ªÎ»»þ¡¢¥ì¥¹¥Ý¥ó¥¹¥³¡¼¥É¤¬¼èÆÀ¤Ç¤­¤ë
366    $responseDetail = $objPaygent->getResponseDetail(); # °Û¾ï½ªÎ»»þ¡¢¥ì¥¹¥Ý¥ó¥¹¾ÜºÙ¤¬¼èÆÀ¤Ç¤­¤ë
367
368    // Shift-JIS¤Ç±þÅú¤¬¤¢¤ë¤Î¤Ç¡¢¥¨¥ó¥³¡¼¥É¤¹¤ë¡£
369    $responseDetail = mb_convert_encoding($responseDetail, CHAR_CODE, "Shift-JIS");
370       
371   
372    // ¥ì¥¹¥Ý¥ó¥¹¤Î¼èÆÀ
373    while($objPaygent->hasResNext()) {
374        # ¥Ç¡¼¥¿¤¬Â¸ºß¤¹¤ë¸Â¤ê¡¢¼èÆÀ
375        $arrRes[] = $objPaygent->resNext(); # Í×µá·ë²Ì¼èÆÀ
376    }
377   
378    // ·èºÑËè¤Ë°Û¤Ê¤ë½èÍý
379    switch($telegram_kind) {
380    // ¥¯¥ì¥¸¥Ã¥È·èºÑ¤Î¾ì¹ç
381    case PAYGENT_CREDIT:
382        // ¥¹¥Æ¡¼¥¿¥¹¤ò¿·µ¬¼õÉդˤ¹¤ë¡£
383        $arrVal["status"] = ORDER_NEW;
384        // ¶õ¤ÎÇÛÎó¤ò³ÊǼ¤·¤Æ¤ª¤¯
385        $arrVal["memo02"] = serialize(array());     
386        break;
387    // ¥³¥ó¥Ó¥Ë·èºÑ¤Î¾ì¹ç
388    case PAYGENT_CONVENI:       
389        // ¥¿¥¤¥È¥ë¤òÀßÄꤹ¤ë
390        $arrMemo['title'] = sfSetConvMSG("¥³¥ó¥Ó¥Ë¤ª»Ùʧ¾ðÊó", true);   
391        //ʧ¹þɼURL(PC)
392        if($arrRes[0]['receipt_print_url'] != "") {
393            $arrMemo['receipt_print_url'] = sfSetConvMSG("ʧ¹þɼURL", $arrRes[0]['receipt_print_url']);
394        }
395        //ʧ¹þɼÈÖ¹æ
396        $arrMemo['receipt_number'] = sfSetConvMSG("ʧ¹þɼÈÖ¹æ", $arrRes[0]['receipt_number']);
397        $arrCVS = split("-", $arrRes[0]['usable_cvs_company_id']);
398        foreach($arrCVS as $val) {
399            if($cvsLine != "") {
400                $cvsLine.= ",".$arrConvenience[$val];               
401            } else {
402                $cvsLine = $arrConvenience[$val];
403            }
404        }
405        //Âоݥ³¥ó¥Ó¥Ë
406        $arrMemo['usable_cvs_company_id'] = sfSetConvMSG("¤ª»Ùʧ²Äǽ¤Ê¥³¥ó¥Ó¥Ë", $cvsLine);         
407        // »Ùʧ´üÆü
408        $arrMemo['payment_limit_date'] = sfSetConvMSG("¤ª»Ùʧ´üÆü", date("Yǯm·îdÆü", strtotime($arrRes[0]['payment_limit_date'])));
409        // ¼õÃí¥Æ¡¼¥Ö¥ë¤ËÊݸ
410        $arrVal["memo02"] = serialize($arrMemo);
411        // ¥¹¥Æ¡¼¥¿¥¹¤òÆþ¶âÂÔ¤Á¤Ë¤¹¤ë¡£
412        $arrVal["status"] = ORDER_PAY_WAIT;     
413        break;
414    // ATM·èºÑ¤Î¾ì¹ç
415    case PAYGENT_ATM:
416        // ¥¿¥¤¥È¥ë¤òÀßÄꤹ¤ë
417        $arrMemo['title'] = sfSetConvMSG("ATM¤ª»Ùʧ¾ðÊó", true);   
418        $arrMemo['pay_center_number'] = sfSetConvMSG("¼ýǼµ¡´ØÈÖ¹æ", $arrRes[0]['pay_center_number']);
419        $arrMemo['customer_number'] = sfSetConvMSG("¤ªµÒÍÍÈÖ¹æ", $arrRes[0]['customer_number']);
420        $arrMemo['conf_number'] = sfSetConvMSG("³ÎǧÈÖ¹æ", $arrRes[0]['pay_center_number']);
421        // »Ùʧ´üÆü
422        $arrMemo['payment_limit_date'] = sfSetConvMSG("¤ª»Ùʧ´üÆü", date("Yǯm·îdÆü", strtotime($arrRes[0]['payment_limit_date'])));
423        // ¼õÃí¥Æ¡¼¥Ö¥ë¤ËÊݸ
424        $arrVal["memo02"] = serialize($arrMemo);
425        // ¥¹¥Æ¡¼¥¿¥¹¤òÆþ¶âÂÔ¤Á¤Ë¤¹¤ë¡£
426        $arrVal["status"] = ORDER_PAY_WAIT;     
427        break;
428    // ¶ä¹Ô¥Í¥Ã¥È¤Î¾ì¹ç
429    case PAYGENT_BANK:
430        // ¥¹¥Æ¡¼¥¿¥¹¤ò¿·µ¬¼õÉդˤ¹¤ë¡£
431        $arrVal["status"] = ORDER_NEW;
432        // ¶õ¤ÎÇÛÎó¤ò³ÊǼ¤·¤Æ¤ª¤¯
433        $arrVal["memo02"] = serialize(array());
434        break;
435    default:
436        break;
437    }
438   
439    // ¼õÃí¥Æ¡¼¥Ö¥ë¤Ëµ­Ï¿¤¹¤ë
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'];       // ¾µÇ§ÈÖ¹æ
447
448    // ¼õÃí°ì»þ¥Æ¡¼¥Ö¥ë¤Ë¹¹¿·
449    sfRegistTempOrder($uniqid, $arrVal);
450   
451    // ¾µÇ§ÈÖ¹æ¤È¥á¥Ã¥»¡¼¥¸¤òÊÖ¤¹
452    return $arrRes[0];
453}
454
455/**************************************************************************************************************
456 * ´Ø¿ô̾   ¡§sfSetConvMSG
457 * ½èÍýÆâÍÆ ¡§¥³¥ó¥Ó¥Ë¾ðÊóɽ¼¨ÍÑ
458 * °ú¿ô1    ¡§
459 * °ú¿ô2    ¡§
460 * °ú¿ô3    ¡§
461 * Ìá¤êÃÍ   ¡§¼èÆÀ·ë²Ì
462 **************************************************************************************************************/
463function sfSetConvMSG($name, $value){
464    return array("name" => $name, "value" => $value);
465}
466
467/**************************************************************************************************************
468 * ´Ø¿ô̾   ¡§sfPaygentDisp
469 * ½èÍýÆâÍÆ ¡§¶¦Ä̤Îɽ¼¨½èÍý
470 * °ú¿ô1    ¡§
471 * °ú¿ô2    ¡§
472 * °ú¿ô3    ¡§
473 * Ìá¤êÃÍ   ¡§¼èÆÀ·ë²Ì
474 **************************************************************************************************************/
475function sfPaygentDisp($objPage, $payment_id) {
476    $objQuery = new SC_Query();
477    // »Ùʧ¤¤ÊýË¡¤ÎÀâÌÀ²èÁü¤ò¼èÆÀ¤¹¤ë¡£
478    $arrRet = $objQuery->select("payment_method, payment_image", "dtb_payment", "payment_id = ?", array($payment_id));
479    $objPage->tpl_payment_method = $arrRet[0]['payment_method'];
480    $objPage->tpl_payment_image = $arrRet[0]['payment_image'];
481    return $objPage;
482}
483
484/**************************************************************************************************************
485 * ´Ø¿ô̾   ¡§sfGetPaymentDB
486 * ½èÍýÆâÍÆ ¡§É¬Íפʥǡ¼¥¿¤ò¼èÆÀ¤¹¤ë¡£
487 * °ú¿ô1    ¡§
488 * °ú¿ô2    ¡§
489 * °ú¿ô3    ¡§
490 * Ìá¤êÃÍ   ¡§¼èÆÀ·ë²Ì
491 **************************************************************************************************************/
492function sfGetPaymentDB($module_id, $where = "", $arrWhereVal = array()){
493    $objQuery = new SC_Query();
494       
495    $arrVal = array($module_id);
496    $arrVal = array_merge($arrVal, $arrWhereVal);
497   
498    $arrRet = array();
499    $sql = "SELECT
500                module_id,
501                memo01 as merchant_id,
502                memo02 as connect_id,
503                memo03 as payment,
504                memo04 as connect_password,
505                memo05 as other_param
506            FROM dtb_payment WHERE module_id = ? " . $where;
507    $arrRet = $objQuery->getall($sql, $arrVal);
508
509    return $arrRet;
510}
511
512/**************************************************************************************************************
513 * ´Ø¿ô̾   ¡§sfPaygentBatch
514 * ½èÍýÆâÍÆ ¡§Æþ¶â¥¹¥Æ¡¼¥¿¥¹³Îǧ¥Ð¥Ã¥Á
515 * °ú¿ô1    ¡§
516 * °ú¿ô2    ¡§
517 * °ú¿ô3    ¡§
518 * Ìá¤êÃÍ   ¡§¼èÆÀ·ë²Ì
519 **************************************************************************************************************/
520function 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 **************************************************************************************************************/
555function 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
582?>
Note: See TracBrowser for help on using the repository browser.