source: branches/feature-module-paygent/data/downloads/module/mdl_paygent/jp/co/ks/merchanttool/connectmodule/system/PaygentB2BModule.php @ 15162

Revision 15162, 16.6 KB checked in by naka, 17 years ago (diff)

ペイジェント決済モジュール

Line 
1<?php
2/**
3 * PAYGENT B2B MODULE
4 * PaygentB2BModule.php
5 *
6 * Copyright (C) 2007 by PAYGENT Co., Ltd.
7 * All rights reserved.
8 */
9
10include_once("jp/co/ks/merchanttool/connectmodule/util/HttpsRequestSender.php");
11include_once("jp/co/ks/merchanttool/connectmodule/entity/ReferenceResponseDataImpl.php");
12include_once("jp/co/ks/merchanttool/connectmodule/entity/ResponseData.php");
13include_once("jp/co/ks/merchanttool/connectmodule/util/PaygentB2BModuleLogger.php");
14include_once("jp/co/ks/merchanttool/connectmodule/entity/ResponseDataFactory.php");
15include_once("jp/co/ks/merchanttool/connectmodule/exception/PaygentB2BModuleConnectException.php");
16include_once("jp/co/ks/merchanttool/connectmodule/exception/PaygentB2BModuleException.php");
17include_once("jp/co/ks/merchanttool/connectmodule/util/StringUtil.php");
18
19/**
20 * Ú‘±ƒ‚ƒWƒ…[ƒ‹ ƒƒCƒ“ˆ——pƒNƒ‰ƒX
21 *
22 * @version $Revision: 1.4 $
23 * @author $Author: t-mori $
24 */
25
26
27    /**
28     * “d•¶ƒpƒ‰ƒ[ƒ^ Key Length
29     */
30    define("PaygentB2BModule__TELEGRAM_KEY_LENGTH", 30);
31
32    /**
33     * “d•¶ƒpƒ‰ƒ[ƒ^ Valeu Length
34     */
35    define("PaygentB2BModule__TELEGRAM_VALUE_LENGTH", 10240);
36
37    /**
38     * “d•¶ƒpƒ‰ƒ[ƒ^ €–ڐ”
39     */
40    define("PaygentB2BModule__TELEGRAM_ITEM_COUNT", 50);
41
42    /**
43     * Ú‘±ID
44     */
45    define("PaygentB2BModule__CONNECT_ID_KEY", "connect_id");
46
47    /**
48     * Ú‘±ƒpƒXƒ[ƒh
49     */
50    define("PaygentB2BModule__CONNECT_PASSWORD_KEY", "connect_password");
51
52    /**
53     * “d•¶Ží•ÊID
54     */
55    define("PaygentB2BModule__TELEGRAM_KIND_KEY", "telegram_kind");
56
57    /**
58     * Å‘匟õ”
59     */
60    define("PaygentB2BModule__LIMIT_COUNT_KEY", "limit_count");
61   
62    /**
63     * ˆ—Œ‹‰ÊF1
64     */
65    define("PaygentB2BModule__RESULT_STATUS_ERROR", "1");
66   
67    /**
68     * ƒŒƒXƒ|ƒ“ƒXƒR[ƒhF9003
69     */
70    define("PaygentB2BModule__RESPONSE_CODE_9003", "9003");
71
72
73class PaygentB2BModule {
74    /**
75     * ƒJƒi•ÏŠ·—p —v‹“d•¶ POSTƒpƒ‰ƒ[ƒ^–¼
76     */
77    var $REPLACE_KANA_PARAM = array("customer_family_name_kana", "customer_name_kana",
78            "payment_detail_kana", "claim_kana", "receipt_name_kana");
79
80    /** ƒNƒ‰ƒCƒAƒ“ƒgØ–¾‘ƒtƒ@ƒCƒ‹ƒpƒX */
81    var $clientFilePath;
82
83    /** CAØ–¾‘ƒtƒ@ƒCƒ‹ƒpƒX */
84    var $caFilePath;
85
86    /** ProxyƒT[ƒo–¼ */
87    var $proxyServerName;
88
89    /** ProxyIPƒAƒhƒŒƒX */
90    var $proxyServerIp;
91
92    /** Proxyƒ|[ƒg”ԍ† */
93    var $proxyServerPort;
94
95    /** ƒfƒtƒHƒ‹ƒgID */
96    var $defaultId;
97
98    /** ƒfƒtƒHƒ‹ƒgƒpƒXƒ[ƒh */
99    var $defaultPassword;
100
101    /** ƒ^ƒCƒ€ƒAƒEƒg’l */
102    var $timeout;
103
104    /** Œ‹‰ÊCSVƒtƒ@ƒCƒ‹–¼ */
105    var $resultCsv;
106
107    /** Æ‰ïMAXŒ” */
108    var $selectMaxCnt;
109
110    /** “d•¶Ží•ÊID */
111    var $telegramKind;
112
113    /** PropertiesFile ’l•ÛŽ */
114    var $masterFile;
115
116    /** ˆø”•ÛŽ */
117    var $telegramParam = array();
118
119    /** ’ʐMˆ— */
120    var $sender;
121
122    /** ˆ—Œ‹‰Ê */
123    var $responseData;
124
125    /** Logger */
126    var $logger = null;
127
128    /**
129     * ƒRƒ“ƒXƒgƒ‰ƒNƒ^
130     *
131     * @return ‚È‚µ ¬Œ÷‚µ‚Ä‚¢‚é‚©‚̃`ƒFƒbƒN‚Í
132     */
133    function PaygentB2BModule() {
134
135        // •Ï”‰Šú‰»
136        $this->telegramParam = array();
137
138    }
139   
140    /**
141     * ƒNƒ‰ƒX‚ð‰Šú‰»ˆ—
142     * @return mixed true:¬Œ÷A‘¼FƒGƒ‰[ƒR[ƒh
143     */
144    function init() {
145        // Ý’è’l‚ðŽæ“¾
146        $this->masterFile = PaygentB2BModuleResources::getInstance();
147
148        // Logger ‚ðŽæ“¾
149        $this->logger = PaygentB2BModuleLogger::getInstance();
150       
151        if ($this->masterFile == null
152            || strcasecmp(get_class($this->masterFile), "PaygentB2BModuleResources") != 0) {
153            // ƒGƒ‰[ƒR[ƒh
154            return $this->masterFile;
155        }
156
157        if ($this->logger == null
158            || strcasecmp(get_class($this->logger), "PaygentB2BModuleLogger") != 0) {
159            // ƒGƒ‰[ƒR[ƒh
160            return $this->logger;
161        }
162       
163        // Ý’è’l‚ðƒZƒbƒg
164        $this->clientFilePath = $this->masterFile->getClientFilePath();
165        $this->caFilePath = $this->masterFile->getCaFilePath();
166        $this->proxyServerName = $this->masterFile->getProxyServerName();
167        $this->proxyServerIp = $this->masterFile->getProxyServerIp();
168        $this->proxyServerPort = $this->masterFile->getProxyServerPort();
169        $this->defaultId = $this->masterFile->getDefaultId();
170        $this->defaultPassword = $this->masterFile->getDefaultPassword();
171        $this->timeout = $this->masterFile->getTimeout();
172        $this->selectMaxCnt = $this->masterFile->getSelectMaxCnt();
173
174        return true;
175    }
176
177    /**
178     * ƒfƒtƒHƒ‹ƒgID‚ðÝ’è
179     *
180     * @param defaultId String
181     */
182    function setDefaultId($defaultId) {
183        $this->defaultId = $defaultId;
184    }
185
186    /**
187     * ƒfƒtƒHƒ‹ƒgID‚ðŽæ“¾
188     *
189     * @return String defaultId
190     */
191    function getDefaultId() {
192        return $this->defaultId;
193    }
194
195    /**
196     * ƒfƒtƒHƒ‹ƒgƒpƒXƒ[ƒh‚ðÝ’è
197     *
198     * @param defaultPassword String
199     */
200    function setDefaultPassword($defaultPassword) {
201        $this->defaultPassword = $defaultPassword;
202    }
203
204    /**
205     * ƒfƒtƒHƒ‹ƒgƒpƒXƒ[ƒh‚ðŽæ“¾
206     *
207     * @return String defaultPassword
208     */
209    function getDefaultPassword() {
210        return $this->defaultPassword;
211    }
212
213    /**
214     * ƒ^ƒCƒ€ƒAƒEƒg’l‚ðÝ’è
215     *
216     * @param timeout int
217     */
218    function setTimeout($timeout) {
219        $this->timeout = $timeout;
220    }
221
222    /**
223     * ƒ^ƒCƒ€ƒAƒEƒg’l‚ðŽæ“¾
224     *
225     * @return int timeout
226     */
227    function getTimeout() {
228        return $this->timeout;
229    }
230
231    /**
232     * Œ‹‰ÊCSVƒtƒ@ƒCƒ‹–¼‚ðÝ’è
233     *
234     * @param resultCsv String
235     */
236    function setResultCsv($resultCsv) {
237        $this->resultCsv = $resultCsv;
238    }
239
240    /**
241     * Œ‹‰ÊCSVƒtƒ@ƒCƒ‹–¼‚ðŽæ“¾
242     *
243     * @return String resultCsv
244     */
245    function getResultCsv() {
246        return $this->resultCsv;
247    }
248
249    /**
250     * Æ‰ïMAXŒ”‚ðÝ’è
251     *
252     * @param selectMaxCnt int
253     */
254    function setSelectMaxCnt($selectMaxCnt) {
255        $this->selectMaxCnt = $selectMaxCnt;
256    }
257
258    /**
259     * Æ‰ïMAXŒ”‚ðŽæ“¾
260     *
261     * @return String selectMaxCnt
262     */
263    function getSelectMaxCnt() {
264        return $this->selectMaxCnt;
265    }
266
267    /**
268     * ˆø”‚ðÝ’è
269     *
270     * @param key String
271     * @param valuet String
272     */
273    function reqPut($key, $value) {
274        $tempVal = $value;
275       
276        if ($tempVal == null) {
277            // Value ’l‚Ì null Ý’è‚Í”F‚ß‚È‚¢
278            $tempVal = "";
279        }
280        $this->telegramParam[$key] = $tempVal;
281    }
282
283    /**
284     * ˆø”‚ðŽæ“¾
285     *
286     * @param key Stirng
287     * @return String value
288     */
289    function reqGet($key) {
290        return $this->telegramParam[$key];
291    }
292
293    /**
294     * Æ‰ïˆ—‚ðŽÀs
295     *
296     * @return String trueF¬Œ÷A‘¼:ƒGƒ‰[ƒR[ƒhA
297     */
298    function post() {
299
300        $rslt = "";
301       
302        // “d•¶Ží•ÊID ‚ðŽæ“¾
303        $this->telegramKind = "";
304       
305        if (array_key_exists(PaygentB2BModule__TELEGRAM_KIND_KEY, $this->telegramParam)) {
306            $this->telegramKind = $this->telegramParam[PaygentB2BModule__TELEGRAM_KIND_KEY];
307        }
308
309        // —v‹“d•¶ƒpƒ‰ƒ[ƒ^–¢Ý’è’l‚̐ݒè
310        $this->setTelegramParamUnsetting();
311
312        // PostŽžƒGƒ‰[ƒ`ƒFƒbƒN
313        $rslt = $this->postErrorCheck();
314        if (!($rslt === true)) {
315            // ƒGƒ‰[ƒR[ƒh
316            return  $rslt;
317        }
318
319        // URLŽæ“¾
320        $url = $this->masterFile->getUrl($this->telegramKind);
321        if ($url === false) {
322            return PaygentB2BModuleConnectException__TEREGRAM_PARAM_OUTSIDE_ERROR;
323        }
324
325        // HttpsRequestSenderŽæ“¾
326        $this->sender = new HttpsRequestSender($url);
327
328        // ƒNƒ‰ƒCƒAƒ“ƒgØ–¾‘ƒpƒXÝ’è
329        $this->sender->setClientCertificatePath($this->clientFilePath);
330
331        // CAØ–¾‘ƒpƒXÝ’è
332        $this->sender->setCaCertificatePath($this->caFilePath);
333
334        // ƒ^ƒCƒ€ƒAƒEƒgÝ’è
335        $this->sender->setTimeout($this->timeout);
336
337        // ProxyÚ‘±ƒ^ƒCƒ€ƒAƒEƒgÝ’è
338        $this->sender->setProxyConnectTimeout($this->timeout);
339
340        // Proxy“`‘—ƒ^ƒCƒ€ƒAƒEƒgÝ’è
341        $this->sender->setProxyCommunicateTimeout($this->timeout);
342
343        if ($this->isProxyDataSet()) {
344            if (!StringUtil::isEmpty($this->proxyServerIp)) {
345                $this->sender->setProxyInfo($this->proxyServerIp, $this->proxyServerPort);
346            } else if (!StringUtil::isEmpty($this->proxyServerName)) {
347                $this->sender->setProxyInfo($this->proxyServerName, $this->proxyServerPort);
348            }
349        }
350
351        // ƒJƒi•ÏŠ·ˆ—
352        $this->replaceTelegramKana();
353
354        // “d•¶’·ƒ`ƒFƒbƒN
355        if (!$this->sender->isTelegramLength($this->telegramParam)) {
356            // “d•¶’·ƒGƒ‰[
357            return PaygentB2BModuleConnectException__TEREGRAM_PARAM_REQUIRED_ERROR;
358        }
359
360        // Post
361        $rslt = $this->sender->postRequestBody($this->telegramParam);
362        if (!($rslt === true)) {
363            // ƒGƒ‰[ƒR[ƒh
364            return $rslt;
365        }
366
367        // Get Response
368        $resBody = $this->sender->getResponseBody();
369
370        // Create ResponseData
371        $this->responseData = ResponseDataFactory::create($this->telegramKind);
372
373        // Parse Stream
374        if ($this->isParseProcess()) {
375            $rslt = $this->responseData->parse($resBody);
376        } else {
377            $rslt = $this->responseData->parseResultOnly($resBody);
378        }
379
380        if (!($rslt === true)) {
381            return $rslt;
382        }
383
384        // CSV Fileo—Í”»’è
385        if ($this->isCSVOutput()) {
386            // CSV File o—Í
387            if (strcasecmp(get_class($this->responseData), "ReferenceResponseDataImpl") == 0) {
388               
389                $rslt = $this->responseData->writeCSV($resBody, $this->resultCsv);
390                if (!($rslt === true)) {
391                    // CSV File Output Error
392                    return $rslt;
393                }
394            }
395        }
396       
397        return true;
398    }
399
400    /**
401     * ˆ—Œ‹‰Ê‚ð•Ô‚·
402     *
403     * @return MapG‚È‚¢ê‡ANULL
404     */
405    function resNext() {
406        if ($this->responseData == null) {
407            return null;           
408        }
409        return $this->responseData->resNext();
410    }
411
412    /**
413     * ˆ—Œ‹‰Ê‚ª‘¶Ý‚·‚é‚©”»’è
414     *
415     * @return boolean
416     */
417    function hasResNext() {
418        if ($this->responseData == null) {
419            return false;
420        }
421
422        return $this->responseData->hasResNext();
423    }
424
425    /**
426     * ˆ—Œ‹‰Ê‚ðŽæ“¾
427     *
428     * @return String ˆ—Œ‹‰ÊG‚È‚¢ê‡ANULL
429     */
430    function getResultStatus() {
431        if ($this->responseData == null) {
432            return null;
433        }
434        return $this->responseData->getResultStatus();
435    }
436
437    /**
438     * ƒŒƒXƒ|ƒ“ƒXƒR[ƒh‚ðŽæ“¾
439     *
440     * @return String ƒŒƒXƒ|ƒ“ƒXƒR[ƒhG‚È‚¢ê‡ANULL
441     */
442    function getResponseCode() {
443        if ($this->responseData == null) {
444           
445            return null;
446        }
447        return $this->responseData->getResponseCode();
448    }
449
450    /**
451     * ƒŒƒXƒ|ƒ“ƒXÚ×‚ðŽæ“¾
452     *
453     * @return String ƒŒƒXƒ|ƒ“ƒXÚ×G‚È‚¢ê‡ANULL
454     */
455    function getResponseDetail() {
456        if ($this->responseData == null) {
457            return null;
458        }
459        return $this->responseData->getResponseDetail();
460    }
461
462    /**
463     * —v‹“d•¶ƒpƒ‰ƒ[ƒ^–¢Ý’è’l‚̐ݒè
464     */
465    function setTelegramParamUnsetting() {
466        // Ú‘±ID
467        if (!array_key_exists(PaygentB2BModule__CONNECT_ID_KEY, $this->telegramParam)) {
468            // Ú‘±ID ‚ª–¢Ý’è‚̏ꍇAƒfƒtƒHƒ‹ƒgID ‚ðÝ’è
469            $this->telegramParam[PaygentB2BModule__CONNECT_ID_KEY] = $this->defaultId;
470        }
471
472        // Ú‘±ƒpƒXƒ[ƒh
473        if (!array_key_exists(PaygentB2BModule__CONNECT_PASSWORD_KEY, $this->telegramParam)) {
474            // Ú‘±ƒpƒXƒ[ƒh‚ª–¢Ý’è‚̏ꍇAƒfƒtƒHƒ‹ƒgƒpƒXƒ[ƒh ‚ðÝ’è
475            $this->telegramParam[PaygentB2BModule__CONNECT_PASSWORD_KEY] = $this->defaultPassword;
476        }
477
478        // Å‘匟õ”
479        if ($this->telegramKind != null) {
480            if ($this->masterFile->isTelegramKindRef($this->telegramKind)) {
481                // ŒˆÏî•ñÆ‰ï‚̏ꍇ
482                if (!array_key_exists(PaygentB2BModule__LIMIT_COUNT_KEY, $this->telegramParam)) {
483                    // Å‘匟õ”‚ª–¢Ý’è‚̏ꍇAÆ‰ïMAXŒ”‚ðÝ’è
484                    $this->telegramParam[PaygentB2BModule__LIMIT_COUNT_KEY] =
485                        $this->selectMaxCnt;
486                }
487            }
488        }
489    }
490
491    /**
492     * PostŽžƒGƒ‰[ƒ`ƒFƒbƒN
493     *
494     * @return mixed ƒGƒ‰[‚È‚µ‚̏ꍇFTRUEA‘¼FƒGƒ‰[ƒR[ƒh
495     */
496    function postErrorCheck() {
497        // ƒpƒ‰ƒ[ƒ^•K{ƒ`ƒFƒbƒN
498        if (!$this->isModuleParamCheck()) {
499            // ƒ‚ƒWƒ…[ƒ‹ƒpƒ‰ƒ[ƒ^ƒGƒ‰[
500            trigger_error(PaygentB2BModuleConnectException__MODULE_PARAM_REQUIRED_ERROR
501                    . ": Error in indespensable HTTP request value.", E_USER_WARNING);
502            return PaygentB2BModuleConnectException__MODULE_PARAM_REQUIRED_ERROR;
503        }
504
505        if (!$this->isTeregramParamCheck()) {
506            // “d•¶—v‹ƒpƒ‰ƒ[ƒ^ƒGƒ‰[
507            trigger_error(PaygentB2BModuleConnectException__TEREGRAM_PARAM_OUTSIDE_ERROR
508                    . ": HTTP request contains unexpected value.", E_USER_WARNING);
509            return PaygentB2BModuleConnectException__TEREGRAM_PARAM_OUTSIDE_ERROR;
510        }
511
512        if (!$this->isResultCSV()) {
513            // Œ‹‰ÊCSVƒtƒ@ƒCƒ‹–¼Ý’èƒGƒ‰[
514            trigger_error(PaygentB2BModuleConnectException__RESPONSE_TYPE_ERROR
515                    . ": CVS file name error.", E_USER_WARNING);
516            return PaygentB2BModuleConnectException__RESPONSE_TYPE_ERROR;
517        }
518       
519        if (!$this->isTeregramParamKeyNullCheck()) {
520            // “d•¶—v‹Key null ƒGƒ‰[
521            trigger_error(PaygentB2BModuleConnectException__TEREGRAM_PARAM_REQUIRED_ERROR
522                    . ": HTTP request key must be null.", E_USER_WARNING);
523            return PaygentB2BModuleConnectException__TEREGRAM_PARAM_REQUIRED_ERROR;
524        }
525
526        if (!$this->isTelegramParamKeyLenCheck()) {
527            // “d•¶—v‹Key’·ƒGƒ‰[
528            trigger_error(PaygentB2BModuleConnectException__TEREGRAM_PARAM_REQUIRED_ERROR
529                    . ": HTTP request key must be shorter than "
530                    . PaygentB2BModule__TELEGRAM_KEY_LENGTH . " bytes.", E_USER_WARNING);
531            return PaygentB2BModuleConnectException__TEREGRAM_PARAM_REQUIRED_ERROR;
532        }
533
534        if (!$this->isTelegramParamValueLenCheck()) {
535            // “d•¶—v‹Value’·ƒGƒ‰[
536            trigger_error(PaygentB2BModuleConnectException__TEREGRAM_PARAM_REQUIRED_ERROR
537                    . ": HTTP request value must be shorter than "
538                    . PaygentB2BModule__TELEGRAM_VALUE_LENGTH . " bytes.", E_USER_WARNING);
539            return PaygentB2BModuleConnectException__TEREGRAM_PARAM_REQUIRED_ERROR;
540        }
541
542        if (!$this->isTelegramParamItemCountCheck()) {
543            // “d•¶—v‹€–ڐ”ƒGƒ‰[
544            trigger_error(PaygentB2BModuleConnectException__TEREGRAM_PARAM_REQUIRED_ERROR
545                    . ": The number of HTTP request keys must be smaller than "
546                    . PaygentB2BModule__TELEGRAM_ITEM_COUNT . ".", E_USER_WARNING);
547            return PaygentB2BModuleConnectException__TEREGRAM_PARAM_REQUIRED_ERROR;
548        }
549        return true;
550    }
551
552    /**
553     * ƒ‚ƒWƒ…[ƒ‹ƒpƒ‰ƒ[ƒ^ƒ`ƒFƒbƒN
554     *
555     * @return boolean true=NotError false=Error
556     */
557    function isModuleParamCheck() {
558        $rb = false;
559
560        // •K{ƒGƒ‰[ƒ`ƒFƒbƒN
561        if ((0 < $this->timeout) && (0 < $this->selectMaxCnt)) {
562            $rb = true;
563        }
564
565        return $rb;
566    }
567
568    /**
569     * “d•¶—v‹ƒpƒ‰ƒ[ƒ^ƒ`ƒFƒbƒN
570     *
571     * @return boolean true=NotError false=Error
572     */
573    function isTeregramParamCheck() {
574        $rb = false;
575
576        // “d•¶Ží•ÊID ƒGƒ‰[ƒ`ƒFƒbƒN
577        if (array_key_exists(PaygentB2BModule__TELEGRAM_KIND_KEY, $this->telegramParam)) {
578            if (!StringUtil::isEmpty($this->telegramParam[
579                PaygentB2BModule__TELEGRAM_KIND_KEY])) {
580                $rb = true;
581            }
582        }
583
584        return $rb;
585    }
586
587    /**
588     * Œ‹‰ÊCSVƒtƒ@ƒCƒ‹–¼Ý’èƒ`ƒFƒbƒN
589     *
590     * @return boolean true=NotError false=Error
591     */
592    function isResultCSV() {
593        $rb = true;
594
595        // Œ‹‰ÊCSVƒtƒ@ƒCƒ‹–¼Ý’èƒGƒ‰[ƒ`ƒFƒbƒN
596        if (!$this->masterFile->isTelegramKindRef($this->telegramKind)
597                && !StringUtil::isEmpty($this->resultCsv)) {
598            $rb = false;
599        }
600
601        return $rb;
602    }
603
604    /**
605     * “d•¶—v‹ƒpƒ‰ƒ[ƒ^ Key Null ƒ`ƒFƒbƒN
606     *
607     * @return boolean true=NotError false=Error
608     */
609    function isTeregramParamKeyNullCheck() {
610        $rb = true;
611
612        // Key null ƒ`ƒFƒbƒN
613        if (array_key_exists(null, $this->telegramParam)) {
614                $rb = false;
615        }
616
617        return $rb;
618    }
619
620    /**
621     * “d•¶—v‹ƒpƒ‰ƒ[ƒ^ Key ’·ƒ`ƒFƒbƒN
622     *
623     * @return boolean true=NoError false=Error
624     */
625    function isTelegramParamKeyLenCheck() {
626        $rb = true;
627
628        foreach($this->telegramParam as $keys => $values) {
629            if (!StringUtil::isEmpty($keys)) {
630                if (strlen($keys) > PaygentB2BModule__TELEGRAM_KEY_LENGTH) {
631                    $rb = false;
632                    break;
633                }
634            }
635        }
636       
637        return $rb;
638    }
639
640    /**
641     * “d•¶—v‹ƒpƒ‰ƒ[ƒ^ Value ’·ƒ`ƒFƒbƒN
642     *
643     * @return boolean true=NoError false=Error
644     */
645    function isTelegramParamValueLenCheck() {
646        $rb = true;
647
648        foreach($this->telegramParam as $keys => $values) {
649            if (!StringUtil::isEmpty($values)) {
650                if (strlen($values) > PaygentB2BModule__TELEGRAM_VALUE_LENGTH) {
651                    $rb = false;
652                    break;
653                }
654            }
655        }
656       
657        return $rb;
658    }
659
660    /**
661     * “d•¶—v‹ƒpƒ‰ƒ[ƒ^ €–ڐ”ƒ`ƒFƒbƒN
662     *
663     * @return boolean true=NoError false=Error
664     */
665    function isTelegramParamItemCountCheck() {
666        $rb = false;
667
668        if (count($this->telegramParam) <= PaygentB2BModule__TELEGRAM_ITEM_COUNT) {
669            $rb = true;
670        }
671
672        return $rb;
673    }
674
675    /**
676     * Proxy Ý’è”»’è
677     *
678     * @return boolean true=Set false=NotSet
679     */
680    function isProxyDataSet() {
681        $rb = false;
682
683        if (!(StringUtil::isEmpty($this->proxyServerIp) && StringUtil
684                ::isEmpty($this->proxyServerName))
685                && 0 < $this->proxyServerPort) {
686            // Proxy Ý’èÏ‚̏ꍇ
687            $rb = true;
688        }
689
690        return $rb;
691    }
692
693    /**
694     * Parse ˆ—”»’è
695     *
696     * @param InputStream
697     * @return boolean true=parse false=ResultOnly
698     */
699    function isParseProcess() {
700        $rb = true;
701
702        // Parse ˆ—ŽÀŽ{”»’è
703        if (strcasecmp(get_class($this->responseData), "ReferenceResponseDataImpl") == 0) {
704            // ReferenceResponseDataImpl ‚̏ꍇ‚̂݁ACSVo—͉”ۂ©‚çŽÀŽ{”»’è
705            if (!StringUtil::isEmpty($this->resultCsv)) {
706                $rb = false;
707            }
708        }
709
710        return $rb;
711    }
712   
713    /**
714     * CSV o—Í”»’è
715     *
716     * @return boolean true=CSV Output false=Non
717     */
718    function isCSVOutput() {
719        $rb = false;
720
721        if ($this->masterFile->isTelegramKindRef($this->telegramKind)
722                && !StringUtil::isEmpty($this->resultCsv)) {
723            // “d•¶Ží•Ê‚ªÆ‰ï ŠŽ‚ Œ‹‰ÊCSVƒtƒ@ƒCƒ‹–¼ ‚ªÝ’èÏ‚̏ꍇ
724            if ($this->getResultStatus() == PaygentB2BModule__RESULT_STATUS_ERROR) {
725                // ˆ—Œ‹‰Ê‚ªˆÙí‚̏ꍇ
726                if ($this->getResponseCode() == PaygentB2BModule__RESPONSE_CODE_9003) {
727                    // ƒŒƒXƒ|ƒ“ƒXƒR[ƒh‚ª 9003 ‚̏ꍇ
728                    $rb = true;
729                }
730            } else {
731                // ˆ—Œ‹‰Ê‚ª³í‚̏ꍇ
732                $rb = true;
733            }
734        }
735       
736        return $rb;
737    }
738
739    /**
740     * “d•¶—v‹ƒpƒ‰ƒ[ƒ^ ”¼ŠpƒJƒi ’uŠ·ˆ—
741     */
742    function replaceTelegramKana() {
743
744        foreach($this->telegramParam as $keys => $values) {
745            if (in_array(strtolower($keys), $this->REPLACE_KANA_PARAM)) {
746                $this->telegramParam[$keys] =
747                    StringUtil::convertKatakanaZenToHan($values);
748            }
749        }
750    }
751
752}
753
754?>
Note: See TracBrowser for help on using the repository browser.