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 | |
---|
10 | include_once("jp/co/ks/merchanttool/connectmodule/util/HttpsRequestSender.php"); |
---|
11 | include_once("jp/co/ks/merchanttool/connectmodule/entity/ReferenceResponseDataImpl.php"); |
---|
12 | include_once("jp/co/ks/merchanttool/connectmodule/entity/ResponseData.php"); |
---|
13 | include_once("jp/co/ks/merchanttool/connectmodule/util/PaygentB2BModuleLogger.php"); |
---|
14 | include_once("jp/co/ks/merchanttool/connectmodule/entity/ResponseDataFactory.php"); |
---|
15 | include_once("jp/co/ks/merchanttool/connectmodule/exception/PaygentB2BModuleConnectException.php"); |
---|
16 | include_once("jp/co/ks/merchanttool/connectmodule/exception/PaygentB2BModuleException.php"); |
---|
17 | include_once("jp/co/ks/merchanttool/connectmodule/util/StringUtil.php"); |
---|
18 | |
---|
19 | /** |
---|
20 | * Ú±W
[ CpNX |
---|
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 | * Ú±pX[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|XR[hF9003 |
---|
69 | */ |
---|
70 | define("PaygentB2BModule__RESPONSE_CODE_9003", "9003"); |
---|
71 | |
---|
72 | |
---|
73 | class PaygentB2BModule { |
---|
74 | /** |
---|
75 | * JiÏ·p vd¶ POSTp[^¼ |
---|
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 | /** NCAgؾt@CpX */ |
---|
81 | var $clientFilePath; |
---|
82 | |
---|
83 | /** CAؾt@CpX */ |
---|
84 | var $caFilePath; |
---|
85 | |
---|
86 | /** ProxyT[o¼ */ |
---|
87 | var $proxyServerName; |
---|
88 | |
---|
89 | /** ProxyIPAhX */ |
---|
90 | var $proxyServerIp; |
---|
91 | |
---|
92 | /** Proxy|[gÔ */ |
---|
93 | var $proxyServerPort; |
---|
94 | |
---|
95 | /** ftHgID */ |
---|
96 | var $defaultId; |
---|
97 | |
---|
98 | /** ftHgpX[h */ |
---|
99 | var $defaultPassword; |
---|
100 | |
---|
101 | /** ^CAEgl */ |
---|
102 | var $timeout; |
---|
103 | |
---|
104 | /** ÊCSVt@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 | * RXgN^ |
---|
130 | * |
---|
131 | * @return ȵ ¬÷µÄ¢é©Ì`FbNÍ |
---|
132 | */ |
---|
133 | function PaygentB2BModule() { |
---|
134 | |
---|
135 | // Ïú» |
---|
136 | $this->telegramParam = array(); |
---|
137 | |
---|
138 | } |
---|
139 | |
---|
140 | /** |
---|
141 | * NXðú» |
---|
142 | * @return mixed true:¬÷A¼FG[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ðZbg |
---|
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 | * ftHgIDðÝè |
---|
179 | * |
---|
180 | * @param defaultId String |
---|
181 | */ |
---|
182 | function setDefaultId($defaultId) { |
---|
183 | $this->defaultId = $defaultId; |
---|
184 | } |
---|
185 | |
---|
186 | /** |
---|
187 | * ftHgIDðæ¾ |
---|
188 | * |
---|
189 | * @return String defaultId |
---|
190 | */ |
---|
191 | function getDefaultId() { |
---|
192 | return $this->defaultId; |
---|
193 | } |
---|
194 | |
---|
195 | /** |
---|
196 | * ftHgpX[hðÝè |
---|
197 | * |
---|
198 | * @param defaultPassword String |
---|
199 | */ |
---|
200 | function setDefaultPassword($defaultPassword) { |
---|
201 | $this->defaultPassword = $defaultPassword; |
---|
202 | } |
---|
203 | |
---|
204 | /** |
---|
205 | * ftHgpX[hðæ¾ |
---|
206 | * |
---|
207 | * @return String defaultPassword |
---|
208 | */ |
---|
209 | function getDefaultPassword() { |
---|
210 | return $this->defaultPassword; |
---|
211 | } |
---|
212 | |
---|
213 | /** |
---|
214 | * ^CAEglðÝè |
---|
215 | * |
---|
216 | * @param timeout int |
---|
217 | */ |
---|
218 | function setTimeout($timeout) { |
---|
219 | $this->timeout = $timeout; |
---|
220 | } |
---|
221 | |
---|
222 | /** |
---|
223 | * ^CAEglðæ¾ |
---|
224 | * |
---|
225 | * @return int timeout |
---|
226 | */ |
---|
227 | function getTimeout() { |
---|
228 | return $this->timeout; |
---|
229 | } |
---|
230 | |
---|
231 | /** |
---|
232 | * ÊCSVt@C¼ðÝè |
---|
233 | * |
---|
234 | * @param resultCsv String |
---|
235 | */ |
---|
236 | function setResultCsv($resultCsv) { |
---|
237 | $this->resultCsv = $resultCsv; |
---|
238 | } |
---|
239 | |
---|
240 | /** |
---|
241 | * ÊCSVt@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 trueF¬÷A¼:G[R[hA |
---|
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 | // vd¶p[^¢ÝèlÌÝè |
---|
310 | $this->setTelegramParamUnsetting(); |
---|
311 | |
---|
312 | // PostG[`FbN |
---|
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 | // NCAgؾpXÝè |
---|
329 | $this->sender->setClientCertificatePath($this->clientFilePath); |
---|
330 | |
---|
331 | // CAؾpXÝè |
---|
332 | $this->sender->setCaCertificatePath($this->caFilePath); |
---|
333 | |
---|
334 | // ^CAEgÝè |
---|
335 | $this->sender->setTimeout($this->timeout); |
---|
336 | |
---|
337 | // ProxyÚ±^CAEgÝè |
---|
338 | $this->sender->setProxyConnectTimeout($this->timeout); |
---|
339 | |
---|
340 | // Proxy`^CAEgÝè |
---|
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 | // JiÏ· |
---|
352 | $this->replaceTelegramKana(); |
---|
353 | |
---|
354 | // d¶·`FbN |
---|
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 FileoÍ»è |
---|
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 MapG颐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|XR[hðæ¾ |
---|
439 | * |
---|
440 | * @return String X|XR[hG颐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 | * vd¶p[^¢ÝèlÌÝè |
---|
464 | */ |
---|
465 | function setTelegramParamUnsetting() { |
---|
466 | // Ú±ID |
---|
467 | if (!array_key_exists(PaygentB2BModule__CONNECT_ID_KEY, $this->telegramParam)) { |
---|
468 | // Ú±ID ª¢ÝèÌêAftHgID ðÝè |
---|
469 | $this->telegramParam[PaygentB2BModule__CONNECT_ID_KEY] = $this->defaultId; |
---|
470 | } |
---|
471 | |
---|
472 | // Ú±pX[h |
---|
473 | if (!array_key_exists(PaygentB2BModule__CONNECT_PASSWORD_KEY, $this->telegramParam)) { |
---|
474 | // Ú±pX[hª¢ÝèÌêAftHgpX[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 | * PostG[`FbN |
---|
493 | * |
---|
494 | * @return mixed G[ȵÌêFTRUEA¼FG[R[h |
---|
495 | */ |
---|
496 | function postErrorCheck() { |
---|
497 | // p[^K{`FbN |
---|
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¶vp[^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 | // ÊCSVt@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¶vKey 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¶vKey·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¶vValue·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[^`FbN |
---|
554 | * |
---|
555 | * @return boolean true=NotError false=Error |
---|
556 | */ |
---|
557 | function isModuleParamCheck() { |
---|
558 | $rb = false; |
---|
559 | |
---|
560 | // K{G[`FbN |
---|
561 | if ((0 < $this->timeout) && (0 < $this->selectMaxCnt)) { |
---|
562 | $rb = true; |
---|
563 | } |
---|
564 | |
---|
565 | return $rb; |
---|
566 | } |
---|
567 | |
---|
568 | /** |
---|
569 | * d¶vp[^`FbN |
---|
570 | * |
---|
571 | * @return boolean true=NotError false=Error |
---|
572 | */ |
---|
573 | function isTeregramParamCheck() { |
---|
574 | $rb = false; |
---|
575 | |
---|
576 | // d¶íÊID G[`FbN |
---|
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 | * ÊCSVt@C¼Ýè`FbN |
---|
589 | * |
---|
590 | * @return boolean true=NotError false=Error |
---|
591 | */ |
---|
592 | function isResultCSV() { |
---|
593 | $rb = true; |
---|
594 | |
---|
595 | // ÊCSVt@C¼ÝèG[`FbN |
---|
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¶vp[^ Key Null `FbN |
---|
606 | * |
---|
607 | * @return boolean true=NotError false=Error |
---|
608 | */ |
---|
609 | function isTeregramParamKeyNullCheck() { |
---|
610 | $rb = true; |
---|
611 | |
---|
612 | // Key null `FbN |
---|
613 | if (array_key_exists(null, $this->telegramParam)) { |
---|
614 | $rb = false; |
---|
615 | } |
---|
616 | |
---|
617 | return $rb; |
---|
618 | } |
---|
619 | |
---|
620 | /** |
---|
621 | * d¶vp[^ Key ·`FbN |
---|
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¶vp[^ Value ·`FbN |
---|
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¶vp[^ Ú`FbN |
---|
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 ÌêÌÝACSVoÍÂÛ©çÀ{»è |
---|
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¶íʪÆï  ÊCSVt@C¼ ªÝèÏÌê |
---|
724 | if ($this->getResultStatus() == PaygentB2BModule__RESULT_STATUS_ERROR) { |
---|
725 | // ʪÙíÌê |
---|
726 | if ($this->getResponseCode() == PaygentB2BModule__RESPONSE_CODE_9003) { |
---|
727 | // X|XR[hª 9003 Ìê |
---|
728 | $rb = true; |
---|
729 | } |
---|
730 | } else { |
---|
731 | // ʪ³íÌê |
---|
732 | $rb = true; |
---|
733 | } |
---|
734 | } |
---|
735 | |
---|
736 | return $rb; |
---|
737 | } |
---|
738 | |
---|
739 | /** |
---|
740 | * d¶vp[^ ¼pJi 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 | ?> |
---|