PluginProbe
Welcart e-Commerce / 2.12.4
Welcart e-Commerce v2.12.4
2.12.4 2.12.3 2.11.35 2.12.2 2.12.1 2.11.34 2.11.33 2.11.32 2.11.31 2.11.30 1.3.16 1.3.17 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.7 1.3.8 1.3.9 1.4.0 1.4.1 1.4.10 1.4.11 1.4.12 All 292 releases
usc-e-shop / classes / paymentESCOTT.main.class.php

paymentESCOTT.main.class.php in Welcart e-Commerce 2.12.4, at classes/paymentESCOTT.main.class.php

5,160 lines 209.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Settlement Class.
4 * e-SCOTT Smart
5 *
6 * @package Welcart
7 * @author Welcart Inc.
8 * @version 1.2.0
9 * @since 1.9.0
10 */
11
12 /**
13 * e-SCOTT Smart Main Class.
14 */
15 class ESCOTT_MAIN {
16
17 /**
18 * �
19 �金通知の送信�
20 �IP許可リスト(本番環境)
21 *
22 * @var array
23 */
24 const ACTING_NOTICE_IPADDRS_PUBLIC = array(
25 '54.238.10.224',
26 '3.114.145.91',
27 '54.248.234.19',
28 /* DR */
29 '13.208.56.91',
30 '13.208.108.172',
31 '15.152.0.135',
32 );
33
34 /**
35 * �
36 �金通知の送信�
37 �IP許可リスト(試験環境)
38 *
39 * @var array
40 */
41 const ACTING_NOTICE_IPADDRS_TEST = array(
42 '35.72.54.3',
43 '54.248.208.159',
44 '35.72.47.156',
45 /* DR */
46 '13.208.56.91',
47 '13.208.108.172',
48 '15.152.0.135',
49 );
50
51 /**
52 * 決済代行会社ID
53 * ex) 'escott'
54 *
55 * @var string
56 */
57 protected $paymod_id;
58
59 /**
60 * 決済代行会社略称
61 * ex) 'e-SCOTT'
62 *
63 * @var string
64 */
65 protected $acting_name;
66
67 /**
68 * 決済代行会社正式名称
69 * ex) 'e-SCOTT Smart'
70 *
71 * @var string
72 */
73 protected $acting_formal_name;
74
75 /**
76 * 決済代行会社URL
77 *
78 * @var string
79 */
80 protected $acting_company_url;
81
82 /**
83 * クレジットカード
84 * ex) 'escott_card'
85 *
86 * @var string
87 */
88 protected $acting_card;
89
90 /**
91 * オンライン収納代行
92 * ex) 'escott_conv'
93 *
94 * @var string
95 */
96 protected $acting_conv;
97
98 /**
99 * アトディーネ
100 * ex) 'escott_atodene'
101 *
102 * @var string
103 */
104 protected $acting_atodene;
105
106 /**
107 * Apple Pay
108 *
109 * @var string
110 */
111 protected $acting_applepay;
112
113 /**
114 * UnionPay(銀聯)
115 *
116 * @var string
117 */
118 protected $acting_unionpay;
119
120 /**
121 * クレジットカード決済フラグ
122 * ex) 'acting_escott_card'
123 *
124 * @var string
125 */
126 protected $acting_flg_card;
127
128 /**
129 * オンライン収納代行決済フラグ
130 * ex) 'acting_escott_conv'
131 *
132 * @var string
133 */
134 protected $acting_flg_conv;
135
136 /**
137 * アトディーネ決済フラグ
138 * ex) 'acting_escott_atodene'
139 *
140 * @var string
141 */
142 protected $acting_flg_atodene;
143
144 /**
145 * Apple Pay決済フラグ
146 *
147 * @var string
148 */
149 protected $acting_flg_applepay;
150
151 /**
152 * UnionPay(銀聯)決済フラグ
153 *
154 * @var string
155 */
156 protected $acting_flg_unionpay;
157
158 /**
159 * 決済種別
160 * ex) array( 'acting_escott_card', 'acting_escott_conv' )
161 *
162 * @var array
163 */
164 protected $pay_method;
165
166 /**
167 * 併用不可決済モジュール
168 * ex) array( 'acting_zeus_card', 'acting_zeus_conv' )
169 *
170 * @var array
171 */
172 protected $unavailable_method;
173
174 /**
175 * 自由領域3
176 * ex) 'wc1collne'
177 *
178 * @var string
179 */
180 protected $merchantfree3;
181
182 /**
183 * e-SCOTT 会員キープレフィックス
184 * ex) 'escott'
185 *
186 * @var string
187 */
188 protected $quick_key_pre;
189
190 /**
191 * エラーメッセージ
192 *
193 * @var string
194 */
195 protected $error_mes;
196
197 /**
198 * Construct.
199 *
200 * @param string $mode Payment mode.
201 */
202 public function __construct( $mode ) {
203
204 $this->paymod_id = $mode;
205
206 $this->acting_company_url = 'https://www.splinks.co.jp/intro-multipay/';
207
208 if ( is_admin() ) {
209 add_action( 'admin_print_footer_scripts', array( $this, 'admin_scripts' ) );
210 add_action( 'usces_action_admin_settlement_update', array( $this, 'settlement_update' ) );
211 add_action( 'usces_action_settlement_tab_title', array( $this, 'settlement_tab_title' ) );
212 add_action( 'usces_action_settlement_tab_body', array( $this, 'settlement_tab_body' ) );
213 }
214
215 if ( $this->is_activate_card() || $this->is_activate_conv() ) {
216 add_action( 'usces_after_cart_instant', array( $this, 'acting_transaction' ), 9 );
217 add_filter( 'usces_filter_order_confirm_mail_payment', array( $this, 'order_confirm_mail_payment' ), 10, 5 );
218 add_filter( 'usces_filter_is_complete_settlement', array( $this, 'is_complete_settlement' ), 10, 3 );
219 add_action( 'usces_action_revival_order_data', array( $this, 'revival_orderdata' ), 10, 3 );
220
221 if ( is_admin() ) {
222 add_filter( 'usces_filter_settle_info_field_keys', array( $this, 'settlement_info_field_keys' ), 10, 2 );
223 add_filter( 'usces_filter_settle_info_field_value', array( $this, 'settlement_info_field_value' ), 10, 3 );
224 add_action( 'usces_action_admin_member_info', array( $this, 'admin_member_info' ), 10, 3 );
225 add_action( 'usces_action_post_update_memberdata', array( $this, 'admin_update_memberdata' ), 10, 2 );
226
227 } else {
228 add_filter( 'usces_filter_payment_detail', array( $this, 'payment_detail' ), 10, 2 );
229 add_filter( 'usces_filter_payments_str', array( $this, 'payments_str' ), 10, 2 );
230 add_filter( 'usces_filter_payments_arr', array( $this, 'payments_arr' ), 10, 2 );
231 add_filter( 'usces_filter_confirm_inform', array( $this, 'confirm_inform' ), 10, 5 );
232 add_action( 'usces_action_confirm_page_point_inform', array( $this, 'e_point_inform' ), 10, 5 );
233 add_filter( 'usces_filter_confirm_point_inform', array( $this, 'point_inform' ), 10, 5 );
234 if ( defined( 'WCEX_COUPON' ) ) {
235 add_filter( 'wccp_filter_coupon_inform', array( $this, 'point_inform' ), 10, 5 );
236 }
237 add_action( 'usces_pre_purchase', array( $this, 'pre_purchase' ), 1 );
238 add_action( 'usces_action_acting_processing', array( $this, 'acting_processing' ), 10, 2 );
239 add_filter( 'usces_filter_check_acting_return_results', array( $this, 'acting_return' ) );
240 add_filter( 'usces_filter_check_acting_return_duplicate', array( $this, 'check_acting_return_duplicate' ), 10, 2 );
241 add_action( 'usces_action_reg_orderdata', array( $this, 'register_orderdata' ) );
242 add_action( 'usces_post_reg_orderdata', array( $this, 'post_register_orderdata' ), 10, 2 );
243 add_filter( 'usces_filter_get_error_settlement', array( $this, 'error_page_message' ) );
244 add_filter( 'usces_filter_send_order_mail_payment', array( $this, 'order_mail_payment' ), 10, 6 );
245 }
246 }
247
248 if ( $this->is_validity_acting( 'card' ) ) {
249 add_action( 'init', array( $this, 'done_3dsecure' ) );
250 add_action( 'admin_notices', array( $this, 'display_admin_notices' ) );
251 add_action( 'wp_print_footer_scripts', array( $this, 'footer_scripts' ), 9 );
252 add_filter( 'usces_filter_delivery_check', array( $this, 'delivery_check' ), 15 );
253 add_filter( 'usces_filter_delivery_secure_form', array( $this, 'delivery_secure_form' ), 10, 2 );
254 add_filter( 'usces_filter_delivery_secure_form_loop', array( $this, 'delivery_secure_form_loop' ), 10, 2 );
255 add_filter( 'usces_filter_delete_member_check', array( $this, 'delete_member_check' ), 10, 2 );
256 add_filter( 'usces_filter_delete_member_check_front', array( $this, 'delete_member_check' ), 10, 2 );
257 add_action( 'wp_print_styles', array( $this, 'print_styles' ) );
258 add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
259 add_filter( 'usces_filter_uscesL10n', array( $this, 'set_uscesL10n' ), 12, 2 );
260 add_action( 'usces_front_ajax', array( $this, 'front_ajax' ) );
261 }
262
263 if ( $this->is_validity_acting( 'conv' ) || $this->is_validity_acting( 'atodene' ) ) {
264 add_filter( 'usces_filter_cod_label', array( $this, 'set_fee_label' ) );
265 add_filter( 'usces_filter_member_history_cod_label', array( $this, 'set_member_history_fee_label' ), 10, 2 );
266 add_filter( 'usces_fiter_the_payment_method', array( $this, 'payment_method' ) );
267 add_filter( 'usces_filter_set_cart_fees_cod', array( $this, 'add_fee' ), 10, 7 );
268 add_filter( 'usces_filter_delivery_check', array( $this, 'check_fee_limit' ) );
269 add_filter( 'usces_filter_point_check_last', array( $this, 'check_fee_limit' ) );
270 }
271 }
272
273 /**
274 * Initialize.
275 */
276 public function initialize_data() {
277
278 }
279
280 /**
281 * 決済有効判定
282 * 引数が指定されたとき、支払方法で使用している場合に「有効」とする
283 *
284 * @param string $type Module type.
285 * @return boolean
286 */
287 public function is_validity_acting( $type = '' ) {
288 $acting_opts = $this->get_acting_settings();
289 if ( empty( $acting_opts ) ) {
290 return false;
291 }
292
293 $payment_method = usces_get_system_option( 'usces_payment_method', 'sort' );
294 $method = false;
295
296 switch ( $type ) {
297 case 'card':
298 foreach ( $payment_method as $payment ) {
299 if ( $this->acting_flg_card === $payment['settlement'] && 'activate' === $payment['use'] ) {
300 $method = true;
301 break;
302 }
303 }
304 if ( $method && $this->is_activate_card() ) {
305 return true;
306 } else {
307 return false;
308 }
309 break;
310
311 case 'conv':
312 foreach ( $payment_method as $payment ) {
313 if ( $this->acting_flg_conv === $payment['settlement'] && 'activate' === $payment['use'] ) {
314 $method = true;
315 break;
316 }
317 }
318 if ( $method && $this->is_activate_conv() ) {
319 return true;
320 } else {
321 return false;
322 }
323 break;
324
325 case 'atodene':
326 foreach ( $payment_method as $payment ) {
327 if ( $this->acting_flg_atodene === $payment['settlement'] && 'activate' === $payment['use'] ) {
328 $method = true;
329 break;
330 }
331 }
332 if ( $method && $this->is_activate_atodene() ) {
333 return true;
334 } else {
335 return false;
336 }
337 break;
338
339 case 'applepay':
340 foreach ( $payment_method as $payment ) {
341 if ( $this->acting_flg_applepay === $payment['settlement'] && 'activate' === $payment['use'] ) {
342 $method = true;
343 break;
344 }
345 }
346 if ( $method && $this->is_activate_applepay() ) {
347 return true;
348 } else {
349 return false;
350 }
351 break;
352
353 case 'unionpay':
354 foreach ( $payment_method as $payment ) {
355 if ( $this->acting_flg_unionpay === $payment['settlement'] && 'activate' === $payment['use'] ) {
356 $method = true;
357 break;
358 }
359 }
360 if ( $method && $this->is_activate_unionpay() ) {
361 return true;
362 } else {
363 return false;
364 }
365 break;
366
367 default:
368 if ( 'on' === $acting_opts['activate'] ) {
369 return true;
370 } else {
371 return false;
372 }
373 }
374 }
375
376 /**
377 * カード決済有効判定
378 *
379 * @return boolean
380 */
381 public function is_activate_card() {
382 $acting_opts = $this->get_acting_settings();
383 if ( ( isset( $acting_opts['activate'] ) && 'on' === $acting_opts['activate'] ) &&
384 ( isset( $acting_opts['card_activate'] ) && ( 'on' === $acting_opts['card_activate'] || 'link' === $acting_opts['card_activate'] || 'token' === $acting_opts['card_activate'] ) ) ) {
385 $res = true;
386 } else {
387 $res = false;
388 }
389 return $res;
390 }
391
392 /**
393 * オンライン収納代行有効判定
394 *
395 * @return boolean
396 */
397 public function is_activate_conv() {
398 $acting_opts = $this->get_acting_settings();
399 if ( ( isset( $acting_opts['activate'] ) && 'on' === $acting_opts['activate'] ) &&
400 ( isset( $acting_opts['conv_activate'] ) && 'on' === $acting_opts['conv_activate'] ) ) {
401 $res = true;
402 } else {
403 $res = false;
404 }
405 return $res;
406 }
407
408 /**
409 * 後払い決済有効判定
410 *
411 * @return boolean
412 */
413 public function is_activate_atodene() {
414 $acting_opts = $this->get_acting_settings();
415 if ( ( isset( $acting_opts['activate'] ) && 'on' === $acting_opts['activate'] ) &&
416 ( isset( $acting_opts['atodene_activate'] ) && 'on' === $acting_opts['atodene_activate'] ) ) {
417 $res = true;
418 } else {
419 $res = false;
420 }
421 return $res;
422 }
423
424 /**
425 * Apple Pay 有効判定
426 *
427 * @return boolean
428 */
429 public function is_activate_applepay() {
430 $acting_opts = $this->get_acting_settings();
431 if ( ( isset( $acting_opts['activate'] ) && 'on' === $acting_opts['activate'] ) &&
432 ( isset( $acting_opts['applepay_activate'] ) && 'on' === $acting_opts['applepay_activate'] ) ) {
433 $res = true;
434 } else {
435 $res = false;
436 }
437 return $res;
438 }
439
440 /**
441 * 銀聯有効判定
442 *
443 * @return boolean
444 */
445 public function is_activate_unionpay() {
446 $acting_opts = $this->get_acting_settings();
447 if ( ( isset( $acting_opts['activate'] ) && 'on' === $acting_opts['activate'] ) &&
448 ( isset( $acting_opts['unionpay_activate'] ) && 'on' === $acting_opts['unionpay_activate'] ) ) {
449 $res = true;
450 } else {
451 $res = false;
452 }
453 return $res;
454 }
455
456 /**
457 * クレジット決済設定画面タブ
458 * usces_action_settlement_tab_title
459 */
460 public function settlement_tab_title() {
461 $settlement_selected = get_option( 'usces_settlement_selected' );
462 if ( in_array( $this->paymod_id, (array) $settlement_selected, true ) ) {
463 echo '<li><a href="#uscestabs_' . esc_html( $this->paymod_id ) . '">' . esc_html( $this->acting_name ) . '</a></li>';
464 }
465 }
466
467 /**
468 * 管理画面送信メール
469 * usces_filter_order_confirm_mail_payment
470 *
471 * @param string $msg_payment Payment information message.
472 * @param int $order_id Order number.
473 * @param array $payment Payment data.
474 * @param array $cart Cart data.
475 * @param array $data Order data.
476 * @return string
477 */
478 public function order_confirm_mail_payment( $msg_payment, $order_id, $payment, $cart, $data ) {
479 global $usces;
480
481 if ( $this->acting_flg_card === $payment['settlement'] ) {
482 $acting_opts = $this->get_acting_settings();
483 if ( 1 !== (int) $acting_opts['howtopay'] ) {
484 $acting_data = usces_unserialize( $usces->get_order_meta_value( $this->acting_flg_card, $order_id ) );
485 if ( isset( $acting_data['PayType'] ) ) {
486 $paytype = '';
487 switch ( $acting_data['PayType'] ) {
488 case '01':
489 $paytype = __( '(', 'usces' ) . __( 'One time payment', 'usces' ) . __( ')', 'usces' );
490 break;
491 case '02':
492 case '03':
493 case '05':
494 case '06':
495 case '10':
496 case '12':
497 case '15':
498 case '18':
499 case '20':
500 case '24':
501 $times = (int) $acting_data['PayType'];
502 $paytype = __( '(', 'usces' ) . $times . __( '-time payment', 'usces' ) . __( ')', 'usces' );
503 break;
504 case '80':
505 $paytype = __( '(', 'usces' ) . __( 'Bonus lump-sum payment', 'usces' ) . __( ')', 'usces' );
506 break;
507 case '88':
508 $paytype = __( '(', 'usces' ) . __( 'Libor Funding pay', 'usces' ) . __( ')', 'usces' );
509 break;
510 }
511 if ( ! empty( $paytype ) ) {
512 if ( usces_is_html_mail() ) {
513 $msg_payment = '<tr><td colspan="2" style="padding: 0 0 25px 0;">';
514 $msg_payment .= $payment['name'] . $paytype;
515 $msg_payment .= '</td></tr>';
516 } else {
517 $msg_payment = __( '** Payment method **', 'usces' ) . "\r\n";
518 $msg_payment .= usces_mail_line( 1, $data['order_email'] );
519 $msg_payment .= $payment['name'] . $paytype;
520 $msg_payment .= "\r\n\r\n";
521 }
522 }
523 }
524 }
525 } elseif ( $this->acting_flg_conv === $payment['settlement'] && ( 'orderConfirmMail' === filter_input( INPUT_POST, 'mode' ) || 'changeConfirmMail' === filter_input( INPUT_POST, 'mode' ) ) ) {
526 $acting_opts = $this->get_acting_settings();
527 $url = $usces->get_order_meta_value( $this->paymod_id . '_conv_url', $order_id );
528 if ( usces_is_html_mail() ) {
529 $msg_payment = '<tr><td colspan="2" style="padding: 0 0 25px 0;">' . $payment['name'] . usces_payment_detail_confirm( $data ) . '<br><br>';
530 $msg_payment .= sprintf( __( 'Payment is valid for %s days from the date of order.', 'usces' ), $acting_opts['conv_limit'] ) . '<br>';
531 $msg_payment .= __( 'If payment has not yet been completed, please payment procedure from the following URL.', 'usces' ) . '<br><br>';
532 $msg_payment .= '<a href="' . esc_url( $url ) . '">' . esc_url( $url ) . '</a><br>';
533 $msg_payment .= '</td></tr>';
534 } else {
535 $msg_payment .= sprintf( __( 'Payment is valid for %s days from the date of order.', 'usces' ), $acting_opts['conv_limit'] ) . "\r\n";
536 $msg_payment .= __( 'If payment has not yet been completed, please payment procedure from the following URL.', 'usces' ) . "\r\n\r\n";
537 $msg_payment .= __( '[Payment URL]', 'usces' ) . "\r\n";
538 $msg_payment .= $url . "\r\n";
539 }
540 }
541 return $msg_payment;
542 }
543
544 /**
545 * ポイント即時付与
546 * usces_filter_is_complete_settlement
547 *
548 * @param boolean $complete Complete the payment.
549 * @param string $payment_name Payment name.
550 * @param string $status Payment status.
551 * @return boolean
552 */
553 public function is_complete_settlement( $complete, $payment_name, $status ) {
554 $payment = usces_get_payments_by_name( $payment_name );
555 if ( $this->acting_flg_card === $payment['settlement'] || $this->acting_flg_unionpay === $payment['settlement'] ) {
556 $complete = true;
557 }
558 return $complete;
559 }
560
561 /**
562 * 受注データ復旧処理
563 * usces_action_revival_order_data
564 *
565 * @param int $order_id Order number.
566 * @param string $log_key Link key.
567 * @param string $acting_flg Payment type.
568 */
569 public function revival_orderdata( $order_id, $log_key, $acting_flg ) {
570 global $usces;
571
572 if ( ! in_array( $acting_flg, $this->pay_method, true ) ) {
573 return;
574 }
575
576 $usces->set_order_meta_value( 'trans_id', $log_key, $order_id );
577 $usces->set_order_meta_value( 'wc_trans_id', $log_key, $order_id );
578
579 $order_data = $usces->get_order_data( $order_id, 'direct' );
580 $order_meta = array();
581 $order_meta['acting'] = substr( $acting_flg, 7 );
582 $order_meta['MerchantFree1'] = $log_key;
583 $total_full_price = $order_data['order_item_total_price'] - $order_data['order_usedpoint'] + $order_data['order_discount'] + $order_data['order_shipping_charge'] + $order_data['order_cod_fee'] + $order_data['order_tax'];
584 if ( $total_full_price < 0 ) {
585 $total_full_price = 0;
586 }
587 $order_meta['Amount'] = $total_full_price;
588 if ( $this->acting_flg_conv === $acting_flg ) {
589 $acting_opts = $this->get_acting_settings();
590 $paylimit = date_i18n( 'Ymd', strtotime( $order_data['order_date'] ) + ( 86400 * $acting_opts['conv_limit'] ) ) . '2359';
591 $order_meta['PayLimit'] = $paylimit;
592 }
593 $usces->set_order_meta_value( $acting_flg, usces_serialize( $order_meta ), $order_id );
594
595 if ( $this->acting_flg_conv === $acting_flg ) {
596 $usces->set_order_meta_value( $log_key, $acting_flg, $order_id );
597 }
598 }
599
600 /**
601 * 受注編集画面に表示する決済�
602 報のキー
603 * usces_filter_settle_info_field_keys
604 *
605 * @param array $keys Settlement information keys.
606 * @param array $fields Settlement information fields.
607 * @return array
608 */
609 public function settlement_info_field_keys( $keys, $fields ) {
610 if ( isset( $fields['acting'] ) && isset( $fields['MerchantFree1'] ) ) {
611 switch ( $fields['acting'] ) {
612 /* カード決済 */
613 case $this->acting_card:
614 $keys = array( 'acting', 'TransactionId', 'MerchantFree1', 'ResponseCd', 'PayType', 'KessaiNumber', 'NyukinDate', 'SecureResultCode', 'Agreement' );
615 break;
616 /* コンビニ決済 */
617 case $this->acting_conv:
618 $keys = array( 'acting', 'TransactionId', 'MerchantFree1', 'ResponseCd', 'KessaiNumber', 'NyukinDate', 'CvsCd', 'PayLimit' );
619 break;
620 /* 銀聯 */
621 case $this->acting_unionpay:
622 $keys = array( 'acting', 'TransactionId', 'MerchantFree1', 'ResponseCd', 'KessaiNumber' );
623 break;
624 }
625 }
626 return $keys;
627 }
628
629 /**
630 * 受注編集画面に表示する決済�
631 報の値整形
632 * usces_filter_settle_info_field_value
633 *
634 * @param string $value Settlement information value.
635 * @param string $key Settlement information key.
636 * @param string $acting Acting type.
637 * @return string
638 */
639 public function settlement_info_field_value( $value, $key, $acting ) {
640 if ( $this->acting_card !== $acting && $this->acting_conv !== $acting ) {
641 return $value;
642 }
643
644 switch ( $key ) {
645 case 'CvsCd':
646 $value = $this->get_cvs_name( $value );
647 break;
648
649 case 'PayType':
650 switch ( $value ) {
651 case '01':
652 $value = __( 'One time payment', 'usces' );
653 break;
654 case '02':
655 case '03':
656 case '05':
657 case '06':
658 case '10':
659 case '12':
660 case '15':
661 case '18':
662 case '20':
663 case '24':
664 $times = (int) $value;
665 $value = $times . __( '-time payment', 'usces' );
666 break;
667 case '80':
668 $value = __( 'Bonus lump-sum payment', 'usces' );
669 break;
670 case '88':
671 $value = __( 'Libor Funding pay', 'usces' );
672 break;
673 }
674 }
675 return $value;
676 }
677
678 /**
679 * 会員データ編集画面 クイック決済�
680
681 * usces_action_admin_member_info
682 *
683 * @param array $data Member data.
684 * @param array $member_metas Member meta data.
685 * @param array $usces_member_history Member's history order data.
686 */
687 public function admin_member_info( $data, $member_metas, $usces_member_history ) {
688 if ( 0 < count( $member_metas ) ) :
689 $member_id = $data['ID'];
690 $kaiin_id = $this->get_quick_kaiin_id( $member_id );
691 $kaiin_pass = $this->get_quick_pass( $member_id );
692 if ( ! empty( $kaiin_id ) && ! empty( $kaiin_pass ) ) :
693 /* e-SCOTT 会員�
694 �会 */
695 $response_member = $this->escott_member_reference( $member_id );
696 if ( 'OK' === $response_member['ResponseCd'] ) :
697 $cardlast4 = substr( $response_member['CardNo'], -4 );
698 $expyy = substr( date_i18n( 'Y', current_time( 'timestamp' ) ), 0, 2 ) . substr( $response_member['CardExp'], 0, 2 );
699 $expmm = substr( $response_member['CardExp'], 2, 2 );
700 ?>
701 <tr>
702 <td class="label"><?php esc_html_e( 'Lower 4 digits', 'usces' ); ?></td>
703 <td><div class="rod_left shortm"><?php echo esc_html( $cardlast4 ); ?></div></td>
704 </tr>
705 <tr>
706 <td class="label"><?php esc_html_e( 'Expiration date', 'usces' ); ?></td>
707 <td><div class="rod_left shortm"><?php echo esc_html( $expyy . '/' . $expmm ); ?></div></td>
708 </tr>
709 <tr>
710 <td class="label"><?php esc_html_e( 'Quick payment', 'usces' ); ?></td>
711 <td><div class="rod_left shortm"><?php esc_html_e( 'Registered', 'usces' ); ?></div></td>
712 </tr>
713 <?php
714 if ( ! usces_have_member_continue_order( $data['ID'] ) && ! usces_have_member_regular_order( $data['ID'] ) ) :
715 ?>
716 <tr>
717 <td class="label"><input type="checkbox" name="escott_quickpay" id="escott-quickpay-release" value="release"></td>
718 <td><label for="escott-quickpay-release"><?php esc_html_e( 'Release quick payment', 'usces' ); ?></label></td>
719 </tr>
720 <?php
721 endif;
722 else :
723 ?>
724 </tr>
725 <tr>
726 <td class="label"><?php esc_html_e( 'Quick payment', 'usces' ); ?></td>
727 <td><div class="rod_left shortm"><?php esc_html_e( 'Unregistered', 'usces' ); ?></div></td>
728 </tr>
729 <tr>
730 <td class="label"><input type="checkbox" name="escott_quickpay" id="escott-quickpay-release" value="forced_release"></td>
731 <td><label for="escott-quickpay-release"><?php esc_html_e( 'Release unregistered quick payment', 'usces' ); ?></label></td>
732 </tr>
733 <?php
734 endif;
735 endif;
736 endif;
737 }
738
739 /**
740 * 会員データ編集画面 カード�
741 報登録解除
742 * usces_action_post_update_memberdata
743 *
744 * @param int $member_id Member ID.
745 * @param boolean $res Result.
746 */
747 public function admin_update_memberdata( $member_id, $res ) {
748 if ( ! $this->is_activate_card() || false === $res ) {
749 return;
750 }
751
752 $escott_quickpay = filter_input( INPUT_POST, 'escott_quickpay' );
753 if ( 'release' === $escott_quickpay || 'forced_release' === $escott_quickpay ) {
754 $forced_release = ( 'forced_release' === $escott_quickpay ) ? true : false;
755 $this->escott_member_delete( $member_id, $forced_release );
756 }
757 }
758
759 /**
760 * 支払方法説明
761 * usces_filter_payment_detail
762 *
763 * @param string $str Payment method description.
764 * @param array $usces_entries Entry data.
765 * @return string
766 */
767 public function payment_detail( $str, $usces_entries ) {
768 $payment = usces_get_payments_by_name( $usces_entries['order']['payment_name'] );
769 if ( isset( $payment['settlement'] ) && $this->acting_flg_card === $payment['settlement'] ) {
770 $acting_opts = $this->get_acting_settings();
771 if ( 1 !== (int) $acting_opts['howtopay'] ) {
772 if ( isset( $_POST['paytype'] ) && ! empty( $_POST['paytype'] ) ) {
773 $paytype = filter_input( INPUT_POST, 'paytype' );
774 } else {
775 $paytype = ( isset( $usces_entries['order']['paytype'] ) ) ? $usces_entries['order']['paytype'] : '';
776 }
777 switch ( $paytype ) {
778 case '01':
779 $str = __( '(', 'usces' ) . __( 'One time payment', 'usces' ) . __( ')', 'usces' );
780 break;
781 case '02':
782 case '03':
783 case '05':
784 case '06':
785 case '10':
786 case '12':
787 case '15':
788 case '18':
789 case '20':
790 case '24':
791 $times = (int) $paytype;
792 $str = __( '(', 'usces' ) . $times . __( '-time payment', 'usces' ) . __( ')', 'usces' );
793 break;
794 case '80':
795 $str = __( '(', 'usces' ) . __( 'Bonus lump-sum payment', 'usces' ) . __( ')', 'usces' );
796 break;
797 case '88':
798 $str = __( '(', 'usces' ) . __( 'Libor Funding pay', 'usces' ) . __( ')', 'usces' );
799 break;
800 default:
801 $str = __( '(', 'usces' ) . __( 'One time payment', 'usces' ) . __( ')', 'usces' );
802 }
803 }
804 } elseif ( isset( $payment['settlement'] ) && $this->acting_flg_conv === $payment['settlement'] ) {
805 $acting_opts = $this->get_acting_settings();
806 $payment_detail = __( '(', 'usces' ) . sprintf( __( 'Payment is valid for %s days from the date of order.', 'usces' ), $acting_opts['conv_limit'] ) . __( ')', 'usces' );
807 $str = apply_filters( 'usces_filter_escott_payment_limit_conv', $payment_detail, $acting_opts['conv_limit'] );
808 }
809 return $str;
810 }
811
812 /**
813 * 支払方法 JavaScript 用決済名追加
814 * usces_filter_payments_str
815 *
816 * @param string $payments_str Payments.
817 * @param array $payment Selected payment.
818 * @return string
819 */
820 public function payments_str( $payments_str, $payment ) {
821 if ( $this->acting_flg_card === $payment['settlement'] ) {
822 if ( $this->is_activate_card() ) {
823 $payments_str .= "'" . $payment['name'] . "': '" . $this->paymod_id . "', ";
824 }
825 }
826 return $payments_str;
827 }
828
829 /**
830 * 支払方法 JavaScript 用決済追加
831 * usces_filter_payments_arr
832 *
833 * @param array $payments_arr Payments.
834 * @param array $payment Selected payment.
835 * @return array
836 */
837 public function payments_arr( $payments_arr, $payment ) {
838 if ( $this->acting_flg_card === $payment['settlement'] ) {
839 if ( $this->is_activate_card() ) {
840 $payments_arr[] = $this->paymod_id;
841 }
842 }
843 return $payments_arr;
844 }
845
846 /**
847 * �
848 容確認ページ [注文する] ボタン
849 * usces_filter_confirm_inform
850 *
851 * @param string $html Purchase post form.
852 * @param array $payments Payment method info.
853 * @param string $acting_flg Payment type.
854 * @param string $rand Welcart transaction key.
855 * @param string $purchase_disabled Disable purchase button.
856 * @return string
857 */
858 public function confirm_inform( $html, $payments, $acting_flg, $rand, $purchase_disabled ) {
859 global $usces;
860
861 if ( ! in_array( $acting_flg, $this->pay_method, true ) ) {
862 return $html;
863 }
864
865 $usces_entries = $usces->cart->get_entry();
866 if ( ! $usces_entries['order']['total_full_price'] ) {
867 return $html;
868 }
869
870 if ( $this->acting_flg_card === $acting_flg ) {
871 $acting_opts = $this->get_acting_settings();
872 if ( 'on' === $acting_opts['card_activate'] ) {
873 $cardno = filter_input( INPUT_POST, 'cardno', FILTER_DEFAULT );
874 $expyy = filter_input( INPUT_POST, 'expyy', FILTER_DEFAULT );
875 $expmm = filter_input( INPUT_POST, 'expmm', FILTER_DEFAULT );
876 $cardlast4 = filter_input( INPUT_POST, 'cardlast4', FILTER_DEFAULT );
877 $quick_member = filter_input( INPUT_POST, 'quick_member', FILTER_DEFAULT );
878 $html = '<form id="purchase_form" action="' . USCES_CART_URL . '" method="post" onKeyDown="if(event.keyCode == 13){return false;}">
879 <input type="hidden" name="cardno" value="' . esc_attr( trim( $cardno ) ) . '">
880 <input type="hidden" name="cardlast4" value="' . esc_attr( trim( $cardlast4 ) ) . '">';
881 if ( 'on' === $acting_opts['seccd'] ) {
882 $seccd = filter_input( INPUT_POST, 'seccd', FILTER_DEFAULT );
883 $html .= '
884 <input type="hidden" name="seccd" value="' . esc_attr( trim( $seccd ) ) . '">';
885 }
886 $html .= '
887 <input type="hidden" name="expyy" value="' . esc_attr( trim( $expyy ) ) . '">
888 <input type="hidden" name="expmm" value="' . esc_attr( trim( $expmm ) ) . '">
889 <input type="hidden" name="paytype" value="' . esc_attr( $usces_entries['order']['paytype'] ) . '">
890 <input type="hidden" name="rand" value="' . $rand . '">
891 <input type="hidden" name="quick_member" value="' . esc_attr( $quick_member ) . '">
892 <div class="send">
893 ' . apply_filters( 'usces_filter_confirm_before_backbutton', null, $payments, $acting_flg, $rand ) . '
894 <input name="backDelivery" type="submit" id="back_button" class="back_to_delivery_button" value="' . __( 'Back', 'usces' ) . '"' . apply_filters( 'usces_filter_confirm_prebutton', null ) . ' />
895 <input name="purchase" type="submit" id="purchase_button" class="checkout_button" value="' . apply_filters( 'usces_filter_confirm_checkout_button_value', __( 'Checkout', 'usces' ) ) . '"' . apply_filters( 'usces_filter_confirm_nextbutton', null ) . $purchase_disabled . ' />
896 </div>
897 <input type="hidden" name="_nonce" value="' . wp_create_nonce( $acting_flg ) . '">';
898 $card_change = filter_input( INPUT_POST, 'card_change', FILTER_DEFAULT );
899 if ( '1' === $card_change ) {
900 $html .= '
901 <input type="hidden" name="card_change" value="1">';
902 }
903 } elseif ( 'link' === $acting_opts['card_activate'] ) {
904 $quick_member = filter_input( INPUT_POST, 'quick_member', FILTER_DEFAULT );
905 $html = '<form id="purchase_form" action="' . USCES_CART_URL . '" method="post" onKeyDown="if(event.keyCode == 13){return false;}">
906 <input type="hidden" name="rand" value="' . $rand . '">
907 <input type="hidden" name="quick_member" value="' . esc_attr( $quick_member ) . '">
908 <div class="send">
909 ' . apply_filters( 'usces_filter_confirm_before_backbutton', null, $payments, $acting_flg, $rand ) . '
910 <input name="backDelivery" type="submit" id="back_button" class="back_to_delivery_button" value="' . __( 'Back', 'usces' ) . '"' . apply_filters( 'usces_filter_confirm_prebutton', null ) . ' />
911 <input name="purchase" type="submit" id="purchase_button" class="checkout_button" value="' . apply_filters( 'usces_filter_confirm_checkout_button_value', __( 'Checkout', 'usces' ) ) . '"' . apply_filters( 'usces_filter_confirm_nextbutton', null ) . $purchase_disabled . ' />
912 </div>
913 <input type="hidden" name="_nonce" value="' . wp_create_nonce( $acting_flg ) . '">';
914 } elseif ( 'token' === $acting_opts['card_activate'] ) {
915 $token = filter_input( INPUT_POST, 'token', FILTER_DEFAULT );
916 $paytype = filter_input( INPUT_POST, 'paytype', FILTER_DEFAULT );
917 $quick_member = filter_input( INPUT_POST, 'quick_member', FILTER_DEFAULT );
918 $billingname = filter_input( INPUT_POST, 'billingname', FILTER_DEFAULT );
919 $html = '<form id="purchase_form" action="' . USCES_CART_URL . '" method="post" onKeyDown="if(event.keyCode == 13){return false;}">
920 <input type="hidden" name="token" value="' . esc_attr( trim( $token ) ) . '">
921 <input type="hidden" name="paytype" value="' . esc_attr( trim( $paytype ) ) . '">
922 <input type="hidden" name="rand" value="' . $rand . '">
923 <input type="hidden" name="quick_member" value="' . esc_attr( $quick_member ) . '">
924 <input type="hidden" name="billingname" value="' . esc_attr( $billingname ) . '">
925 <input type="hidden" name="billingemail" value="' . esc_attr( $usces_entries['customer']['mailaddress1'] ) . '">
926 <div class="send">
927 ' . apply_filters( 'usces_filter_confirm_before_backbutton', null, $payments, $acting_flg, $rand ) . '
928 <input name="backDelivery" type="submit" id="back_button" class="back_to_delivery_button" value="' . __( 'Back', 'usces' ) . '"' . apply_filters( 'usces_filter_confirm_prebutton', null ) . ' />
929 <input name="purchase" type="submit" id="purchase_button" class="checkout_button" value="' . apply_filters( 'usces_filter_confirm_checkout_button_value', __( 'Checkout', 'usces' ) ) . '"' . apply_filters( 'usces_filter_confirm_nextbutton', null ) . $purchase_disabled . ' />
930 </div>
931 <input type="hidden" name="_nonce" value="' . wp_create_nonce( $acting_flg ) . '">';
932 $card_change = filter_input( INPUT_POST, 'card_change', FILTER_DEFAULT );
933 if ( '1' === $card_change ) {
934 $html .= '
935 <input type="hidden" name="card_change" value="1">';
936 }
937 }
938 } elseif ( $this->acting_flg_conv === $acting_flg ) {
939 $html = '<form id="purchase_form" action="' . USCES_CART_URL . '" method="post" onKeyDown="if(event.keyCode == 13){return false;}">
940 <input type="hidden" name="rand" value="' . $rand . '">
941 <div class="send">
942 ' . apply_filters( 'usces_filter_confirm_before_backbutton', null, $payments, $acting_flg, $rand ) . '
943 <input name="backDelivery" type="submit" id="back_button" class="back_to_delivery_button" value="' . __( 'Back', 'usces' ) . '"' . apply_filters( 'usces_filter_confirm_prebutton', null ) . ' />
944 <input name="purchase" type="submit" id="purchase_button" class="checkout_button" value="' . apply_filters( 'usces_filter_confirm_checkout_button_value', __( 'Checkout', 'usces' ) ) . '"' . apply_filters( 'usces_filter_confirm_nextbutton', null ) . $purchase_disabled . ' />
945 </div>
946 <input type="hidden" name="_nonce" value="' . wp_create_nonce( $acting_flg ) . '">';
947 }
948 return $html;
949 }
950
951 /**
952 * �
953 容確認ページ ポイントフォーム
954 * usces_action_confirm_page_point_inform
955 */
956 public function e_point_inform() {
957 $html = $this->point_inform( '' );
958 wel_esc_script_e( $html );
959 }
960
961 /**
962 * �
963 容確認ページ ポイントフォーム
964 * usces_filter_confirm_point_inform
965 *
966 * @param string $html Input point form.
967 * @return string
968 */
969 public function point_inform( $html ) {
970 global $usces;
971
972 $usces_entries = $usces->cart->get_entry();
973 $payment = usces_get_payments_by_name( $usces_entries['order']['payment_name'] );
974 if ( $this->acting_flg_card !== $payment['settlement'] ) {
975 return $html;
976 }
977
978 $acting_opts = $this->get_acting_settings();
979 if ( 'on' === $acting_opts['card_activate'] ) {
980 $html .= '
981 <input type="hidden" name="cardno" value="' . esc_attr( filter_input( INPUT_POST, 'cardno', FILTER_DEFAULT ) ) . '">
982 <input type="hidden" name="cardlast4" value="' . esc_attr( filter_input( INPUT_POST, 'cardlast4', FILTER_DEFAULT ) ) . '">';
983 if ( 'on' === $acting_opts['seccd'] ) {
984 $html .= '
985 <input type="hidden" name="seccd" value="' . esc_attr( filter_input( INPUT_POST, 'seccd', FILTER_DEFAULT ) ) . '">';
986 }
987 $html .= '
988 <input type="hidden" name="expyy" value="' . esc_attr( filter_input( INPUT_POST, 'expyy', FILTER_DEFAULT ) ) . '">
989 <input type="hidden" name="expmm" value="' . esc_attr( filter_input( INPUT_POST, 'expmm', FILTER_DEFAULT ) ) . '">
990 <input type="hidden" name="offer[paytype]" value="' . esc_attr( $usces_entries['order']['paytype'] ) . '">
991 <input type="hidden" name="quick_member" value="' . esc_attr( filter_input( INPUT_POST, 'quick_member', FILTER_DEFAULT ) ) . '">';
992
993 } elseif ( 'token' === $acting_opts['card_activate'] ) {
994 $html .= '
995 <input type="hidden" name="token" value="' . esc_attr( filter_input( INPUT_POST, 'token' ) ) . '">
996 <input type="hidden" name="paytype" value="' . esc_attr( filter_input( INPUT_POST, 'paytype', FILTER_DEFAULT ) ) . '">
997 <input type="hidden" name="quick_member" value="' . esc_attr( filter_input( INPUT_POST, 'quick_member', FILTER_DEFAULT ) ) . '">
998 <input type="hidden" name="billingname" value="' . esc_attr( filter_input( INPUT_POST, 'billingname', FILTER_DEFAULT ) ) . '">';
999 }
1000 return $html;
1001 }
1002
1003 /**
1004 * 3Dセキュアリターン
1005 * 3Dからのリダイレクトを受けて、もう一度purchaseにリダイレクト
1006 * init
1007 */
1008 public function done_3dsecure() {
1009 $acting_opts = $this->get_acting_settings();
1010 if ( 'on' !== $acting_opts['sec3d_activate'] || 'link' === $acting_opts['card_activate'] ) {
1011 return;
1012 }
1013
1014 /* フラグが立っている時のみ通過 */
1015 if ( ! filter_input( INPUT_POST, 'EncryptValue', FILTER_DEFAULT, FILTER_NULL_ON_FAILURE ) ) {
1016 return;
1017 }
1018
1019 $algo = 'AES-128-CBC';
1020 $key = $acting_opts['key_aes'];
1021 $iv = $acting_opts['key_iv'];
1022 $encrypt_value = base64_decode( filter_input( INPUT_POST, 'EncryptValue' ) );
1023 $query = openssl_decrypt( $encrypt_value, $algo, $key, OPENSSL_RAW_DATA, $iv );
1024 parse_str( $query, $results );
1025 if ( isset( $results['ResponseCd'] ) && isset( $results['SecureResultCode'] ) && ( isset( $results['OperateId'] ) && ( '3Secure' === $results['OperateId'] || '4MemAdd' === $results['OperateId'] || '4MemChg' === $results['OperateId'] ) ) ) {
1026 } else {
1027 return;
1028 }
1029
1030 $usces_page = ( isset( $results['MerchantFree2'] ) ) ? $results['MerchantFree2'] : '';
1031 if ( 'member_register_settlement' === $usces_page || 'member_update_settlement' === $usces_page ) {
1032
1033 /* 3Dセキュア認証結果(1)(8)(9)はエラー */
1034 if ( 1 === (int) $results['SecureResultCode'] || 8 === (int) $results['SecureResultCode'] || 9 === (int) $results['SecureResultCode'] ) {
1035 $responsecd = explode( '|', $results['ResponseCd'] );
1036 foreach ( (array) $responsecd as $cd ) {
1037 $results[ $cd ] = $this->response_message( $cd );
1038 }
1039 wp_redirect(
1040 add_query_arg(
1041 array(
1042 'usces_page' => $usces_page,
1043 're-enter' => 1,
1044 'ResponseCd' => 'NG',
1045 ),
1046 USCES_MEMBER_URL
1047 )
1048 );
1049 exit();
1050 }
1051
1052 $member_settlement_url = add_query_arg(
1053 array(
1054 'usces_page' => $usces_page,
1055 ),
1056 USCES_MEMBER_URL
1057 );
1058
1059 $post3d = $this->get_post_data( $results['MerchantFree1'] );
1060 if ( $post3d ) {
1061 $this->delete_post_data( $results['MerchantFree1'] );
1062 ?>
1063 <!DOCTYPE html>
1064 <html lang="ja">
1065 <head>
1066 <title></title>
1067 </head>
1068 <body onload="javascript:document.forms['redirectForm'].submit();">
1069 <form action="<?php echo esc_url( $member_settlement_url ); ?>" method="post" id="redirectForm">
1070 <?php
1071 /* POSTを復帰 */
1072 foreach ( (array) $post3d as $key => $value ) {
1073 echo '<input type="hidden" name="' . esc_attr( $key ) . '" value="' . esc_attr( $value ) . '" />' . "\n";
1074 }
1075
1076 /* 3Dセキュアのresを送る */
1077 if ( isset( $results['SecureResultCode'] ) ) {
1078 echo '<input type="hidden" name="SecureResultCode" value="' . $results['SecureResultCode'] . '" />' . "\n";
1079 }
1080 if ( isset( $results['ResponseCd'] ) ) {
1081 echo '<input type="hidden" name="ResponseCd" value="' . $results['ResponseCd'] . '" />' . "\n";
1082 }
1083 ?>
1084 <input type="hidden" name="done3d_member" value="1" />
1085 <div class="wait_message" style="text-align: center; margin-top: 100px;"><?php esc_html_e( 'Hold on for a while, please.', 'usces' ); ?></div>
1086 </form>
1087 </body>
1088 </html>
1089 <?php
1090 } else {
1091 wp_redirect(
1092 add_query_arg(
1093 array(
1094 'usces_page' => $usces_page,
1095 're-enter' => 1,
1096 'ResponseCd' => 'NG',
1097 ),
1098 USCES_MEMBER_URL
1099 )
1100 );
1101 }
1102 } else {
1103 /* 3Dセキュア認証結果(1)(8)(9)はエラー */
1104 if ( 1 === (int) $results['SecureResultCode'] || 8 === (int) $results['SecureResultCode'] || 9 === (int) $results['SecureResultCode'] ) {
1105 $responsecd = explode( '|', $results['ResponseCd'] );
1106 foreach ( (array) $responsecd as $cd ) {
1107 $results[ $cd ] = $this->response_message( $cd );
1108 }
1109 $log = array(
1110 'acting' => $this->acting_card,
1111 'key' => $results['MerchantFree1'],
1112 'result' => $results['ResponseCd'],
1113 'data' => $results,
1114 );
1115 usces_save_order_acting_error( $log );
1116 wp_redirect(
1117 add_query_arg(
1118 array(
1119 'MerchantFree2' => $results['MerchantFree2'],
1120 'ResponseCd' => 'NG',
1121 'acting' => $this->acting_card,
1122 'acting_return' => 0,
1123 'result' => 0,
1124 ),
1125 USCES_CART_URL
1126 )
1127 );
1128 exit();
1129 }
1130
1131 $post3d = $this->get_post_data( $results['MerchantFree1'] );
1132 if ( $post3d ) {
1133 $this->delete_post_data( $results['MerchantFree1'] );
1134 ?>
1135 <!DOCTYPE html>
1136 <html lang="ja">
1137 <head>
1138 <title></title>
1139 </head>
1140 <body onload="javascript:document.forms['redirectForm'].submit();">
1141 <form action="<?php echo esc_url( USCES_CART_URL ); ?>" method="post" id="redirectForm">
1142 <?php
1143 /* POSTを復帰 */
1144 foreach ( (array) $post3d as $key => $value ) {
1145 echo '<input type="hidden" name="' . esc_attr( $key ) . '" value="' . esc_attr( $value ) . '" />' . "\n";
1146 }
1147
1148 /* 3Dセキュアのresを送る */
1149 if ( isset( $results['EncodeXId3D'] ) ) {
1150 echo '<input type="hidden" name="EncodeXId3D" value="' . $results['EncodeXId3D'] . '" />' . "\n";
1151 }
1152 if ( isset( $results['MessageVersionNo3D'] ) ) {
1153 echo '<input type="hidden" name="MessageVersionNo3D" value="' . $results['MessageVersionNo3D'] . '" />' . "\n";
1154 }
1155 if ( isset( $results['TransactionStatus3D'] ) ) {
1156 echo '<input type="hidden" name="TransactionStatus3D" value="' . $results['TransactionStatus3D'] . '" />' . "\n";
1157 }
1158 if ( isset( $results['CAVVAlgorithm3D'] ) ) {
1159 echo '<input type="hidden" name="CAVVAlgorithm3D" value="' . $results['CAVVAlgorithm3D'] . '" />' . "\n";
1160 }
1161 if ( isset( $results['ECI3D'] ) ) {
1162 echo '<input type="hidden" name="ECI3D" value="' . $results['ECI3D'] . '" />' . "\n";
1163 }
1164 if ( isset( $results['CAVV3D'] ) ) {
1165 echo '<input type="hidden" name="CAVV3D" value="' . $results['CAVV3D'] . '" />' . "\n";
1166 }
1167 if ( isset( $results['SecureResultCode'] ) ) {
1168 echo '<input type="hidden" name="SecureResultCode" value="' . $results['SecureResultCode'] . '" />' . "\n";
1169 }
1170 if ( isset( $results['DSTransactionId'] ) ) {
1171 echo '<input type="hidden" name="DSTransactionId" value="' . $results['DSTransactionId'] . '" />' . "\n";
1172 }
1173 if ( isset( $results['ThreeDSServerTransactionId'] ) ) {
1174 echo '<input type="hidden" name="ThreeDSServerTransactionId" value="' . $results['ThreeDSServerTransactionId'] . '" />' . "\n";
1175 }
1176 ?>
1177 <input type="hidden" name="purchase" value="" />
1178 <input type="hidden" name="done3d" value="1" />
1179 <div class="wait_message" style="text-align: center; margin-top: 100px;"><?php esc_html_e( 'Hold on for a while, please.', 'usces' ); ?></div>
1180 </form>
1181 </body>
1182 </html>
1183 <?php
1184 } else {
1185 $log = array(
1186 'acting' => $this->acting_card . '(3ds_process)',
1187 'key' => $results['MerchantFree1'],
1188 'result' => 'SESSION ERROR',
1189 'data' => $results,
1190 );
1191 usces_save_order_acting_error( $log );
1192 wp_redirect(
1193 add_query_arg(
1194 array(
1195 'MerchantFree2' => $results['MerchantFree2'],
1196 'ResponseCd' => 'NG',
1197 'acting' => $this->acting_card,
1198 'acting_return' => 0,
1199 'result' => 0,
1200 ),
1201 USCES_CART_URL
1202 )
1203 );
1204 }
1205 }
1206 exit();
1207 }
1208
1209 /**
1210 * 3Dセキュア認証画面へリダイレクト
1211 *
1212 * @param array $params Parameters.
1213 * @param array $post_data Post data.
1214 * @param int $member_id Member ID.
1215 */
1216 public function certification_3dsecure( $params, $post_data, $member_id ) {
1217 $this->save_post_data( $post_data['rand'], $post_data );
1218 $params['OperateId'] = '3Secure';
1219 $params['ProcNo'] = usces_rand( 7 ); /* 適当な数値7桁 */
1220 $params['RedirectUrl'] = USCES_CART_URL;
1221
1222 /* クイックの時はトークンを�
1223 �れない */
1224 $acting_opts = $this->get_acting_settings();
1225 $token = ( isset( $post_data['token'] ) ) ? trim( $post_data['token'] ) : '';
1226 if ( ! empty( $token ) ) {
1227 $params['Token'] = $token;
1228 $params['BillingFullName'] = ( isset( $post_data['billingname'] ) ) ? trim( $post_data['billingname'] ) : '';
1229 $params['BillingEmail'] = ( isset( $post_data['billingemail'] ) ) ? trim( $post_data['billingemail'] ) : '';
1230 } elseif ( ! empty( $member_id ) && 'on' === $acting_opts['quickpay'] ) {
1231 $response_member = $this->escott_member_reference( $member_id );
1232 if ( 'OK' === $response_member['ResponseCd'] ) {
1233 $params['KaiinId'] = $response_member['KaiinId'];
1234 $params['KaiinPass'] = $response_member['KaiinPass'];
1235 }
1236 }
1237 $query = http_build_query( $params );
1238
1239 $send_url = $acting_opts['send_url_3dsecure'];
1240 $algo = 'AES-128-CBC';
1241 $key = $acting_opts['key_aes'];
1242 $iv = $acting_opts['key_iv'];
1243 $encrypt_value = openssl_encrypt( $query, $algo, $key, OPENSSL_RAW_DATA, $iv );
1244 $encrypt_value = base64_encode( $encrypt_value );
1245 ?>
1246 <!DOCTYPE html>
1247 <html lang="ja">
1248 <head>
1249 <title></title>
1250 </head>
1251 <body onload="javascript:document.forms['redirectForm'].submit();">
1252 <form action="<?php echo esc_url( $send_url ); ?>" method="post" id="redirectForm">
1253 <input type="hidden" name="MerchantId" value="<?php echo esc_attr( $params['MerchantId'] ); ?>" />
1254 <input type="hidden" name="EncryptValue" value="<?php echo esc_attr( $encrypt_value ); ?>" />
1255 </form>
1256 </body>
1257 </html>
1258 <?php
1259 exit;
1260 }
1261
1262 /**
1263 * 3Dセキュア認証画面へリダイレクト
1264 *
1265 * @param array $params Parameters.
1266 * @param array $post_data Post data.
1267 * @param int $member_id Member ID.
1268 * @param string $usces_page Page mode.
1269 */
1270 public function certification_3dsecure_member( $params, $post_data, $member_id, $usces_page ) {
1271 global $usces;
1272
1273 $this->save_post_data( $post_data['rand'], $post_data );
1274 $member_settlement_url = add_query_arg(
1275 array(
1276 'usces_page' => $usces_page,
1277 ),
1278 USCES_MEMBER_URL
1279 );
1280
1281 $params['MerchantFree2'] = $usces_page;
1282 if ( 'member_register_settlement' === $usces_page ) {
1283 $kaiin_id = $this->make_kaiin_id( $member_id );
1284 $kaiin_pass = $this->make_kaiin_pass();
1285 $usces->set_member_meta_value( $this->quick_key_pre . '_member_id', $kaiin_id, $member_id );
1286 $usces->set_member_meta_value( $this->quick_key_pre . '_member_passwd', $kaiin_pass, $member_id );
1287 $params['OperateId'] = '4MemAdd';
1288 $params['KaiinId'] = $kaiin_id;
1289 $params['KaiinPass'] = $kaiin_pass;
1290 } else {
1291 $kaiin_id = $this->get_quick_kaiin_id( $member_id );
1292 $kaiin_pass = $this->get_quick_pass( $member_id );
1293 $params['OperateId'] = '4MemChg';
1294 $params['KaiinId'] = $kaiin_id;
1295 $params['KaiinPass'] = $kaiin_pass;
1296 }
1297 $params['ProcNo'] = usces_rand( 7 ); /* 適当な数値7桁 */
1298 $params['RedirectUrl'] = $member_settlement_url;
1299 $params['BillingFullName'] = ( isset( $post_data['billingname'] ) ) ? trim( $post_data['billingname'] ) : '';
1300 $params['BillingEmail'] = ( isset( $post_data['billingemail'] ) ) ? trim( $post_data['billingemail'] ) : '';
1301
1302 $query = http_build_query( $params );
1303
1304 $acting_opts = $this->get_acting_settings();
1305 $send_url = $acting_opts['send_url_3dsecure'];
1306 $algo = 'AES-128-CBC';
1307 $key = $acting_opts['key_aes'];
1308 $iv = $acting_opts['key_iv'];
1309 $encrypt_value = openssl_encrypt( $query, $algo, $key, OPENSSL_RAW_DATA, $iv );
1310 $encrypt_value = base64_encode( $encrypt_value );
1311 ?>
1312 <!DOCTYPE html>
1313 <html lang="ja">
1314 <head>
1315 <title></title>
1316 </head>
1317 <body onload="javascript:document.forms['redirectForm'].submit();">
1318 <form action="<?php echo esc_url( $send_url ); ?>" method="post" id="redirectForm">
1319 <input type="hidden" name="MerchantId" value="<?php echo esc_attr( $params['MerchantId'] ); ?>" />
1320 <input type="hidden" name="EncryptValue" value="<?php echo esc_attr( $encrypt_value ); ?>" />
1321 </form>
1322 </body>
1323 </html>
1324 <?php
1325 exit();
1326 }
1327
1328 /**
1329 * セッション復帰処理
1330 * usces_pre_purchase
1331 */
1332 public function pre_purchase() {
1333 $acting_opts = $this->get_acting_settings();
1334 if ( 'on' === $acting_opts['sec3d_activate'] && filter_input( INPUT_POST, 'done3d', FILTER_DEFAULT, FILTER_NULL_ON_FAILURE ) && filter_input( INPUT_POST, 'rand', FILTER_DEFAULT, FILTER_NULL_ON_FAILURE ) ) {
1335 usces_restore_order_acting_data( filter_input( INPUT_POST, 'rand', FILTER_DEFAULT ) );
1336 }
1337 }
1338
1339 /**
1340 * 決済処理
1341 * usces_action_acting_processing
1342 *
1343 * @param string $acting_flg Payment type.
1344 * @param array $post_query Post data.
1345 */
1346 public function acting_processing( $acting_flg, $post_query ) {
1347 global $usces;
1348
1349 if ( ! in_array( $acting_flg, $this->pay_method, true ) ) {
1350 return;
1351 }
1352
1353 $acting_opts = $this->get_acting_settings();
1354 parse_str( $post_query, $post_data );
1355 $usces_entries = $usces->cart->get_entry();
1356 $cart = $usces->cart->get_cart();
1357
1358 if ( ! $usces_entries || ! $cart ) {
1359 if ( 'on' === $acting_opts['sec3d_activate'] && isset( $post_data['done3d'] ) ) {
1360 usces_restore_order_acting_data( $post_data['rand'] );
1361 $usces_entries = $usces->cart->get_entry();
1362 $cart = $usces->cart->get_cart();
1363 if ( ! $usces_entries || ! $cart ) {
1364 $log = array(
1365 'acting' => $this->acting_card . '(3ds_process)',
1366 'key' => $post_data['rand'],
1367 'result' => 'SESSION RESULT ERROR',
1368 'data' => $post_data,
1369 );
1370 usces_save_order_acting_error( $log );
1371 wp_redirect(
1372 add_query_arg(
1373 array(
1374 'MerchantFree2' => $acting_flg,
1375 'ResponseCd' => 'NG',
1376 'acting' => $this->acting_card,
1377 'acting_return' => 0,
1378 'result' => 0,
1379 ),
1380 USCES_CART_URL
1381 )
1382 );
1383 }
1384 } else {
1385 $log = array(
1386 'acting' => $this->acting_card,
1387 'key' => $post_data['rand'],
1388 'result' => 'SESSION ERROR',
1389 'data' => $post_data,
1390 );
1391 usces_save_order_acting_error( $log );
1392 wp_redirect(
1393 add_query_arg(
1394 array(
1395 'MerchantFree2' => $acting_flg,
1396 'ResponseCd' => 'NG',
1397 'acting' => 'acting_' . $acting_flg,
1398 'acting_return' => 0,
1399 'result' => 0,
1400 ),
1401 USCES_CART_URL
1402 )
1403 );
1404 }
1405 }
1406
1407 if ( ! wp_verify_nonce( $_REQUEST['_nonce'], $acting_flg ) ) {
1408 wp_redirect( USCES_CART_URL );
1409 }
1410
1411 $transaction_date = $this->get_transaction_date();
1412 $rand = $post_data['rand'];
1413 $member = $usces->get_member();
1414
1415 if ( $this->acting_flg_card === $acting_flg ) {
1416 if ( 'on' === $acting_opts['card_activate'] || 'token' === $acting_opts['card_activate'] ) {
1417
1418 $param_list = array();
1419 $params = array();
1420
1421 /* �
1422 �通部 */
1423 $param_list['MerchantId'] = $acting_opts['merchant_id'];
1424 $param_list['MerchantPass'] = $acting_opts['merchant_pass'];
1425 $param_list['TransactionDate'] = $transaction_date;
1426 $param_list['MerchantFree1'] = $rand;
1427 $param_list['MerchantFree2'] = $acting_flg;
1428 $param_list['MerchantFree3'] = $this->merchantfree3;
1429 $param_list['TenantId'] = $acting_opts['tenant_id'];
1430 $param_list['Amount'] = $usces_entries['order']['total_full_price'];
1431
1432 $token = ( isset( $post_data['token'] ) ) ? trim( $post_data['token'] ) : '';
1433 $quick_member = ( isset( $post_data['quick_member'] ) ) ? $post_data['quick_member'] : '';
1434
1435 /* 3Dセキュア認証の結果を受ける */
1436 if ( 'on' === $acting_opts['sec3d_activate'] && isset( $post_data['done3d'] ) ) {
1437 $param_list['Token'] = $token;
1438 if ( isset( $post_data['EncodeXId3D'] ) ) {
1439 $param_list['EncodeXId3D'] = $post_data['EncodeXId3D'];
1440 }
1441 if ( isset( $post_data['MessageVersionNo3D'] ) ) {
1442 $param_list['MessageVersionNo3D'] = $post_data['MessageVersionNo3D'];
1443 }
1444 if ( isset( $post_data['TransactionStatus3D'] ) ) {
1445 $param_list['TransactionStatus3D'] = $post_data['TransactionStatus3D'];
1446 }
1447 if ( isset( $post_data['CAVVAlgorithm3D'] ) ) {
1448 $param_list['CAVVAlgorithm3D'] = $post_data['CAVVAlgorithm3D'];
1449 }
1450 if ( isset( $post_data['ECI3D'] ) ) {
1451 $param_list['ECI3D'] = $post_data['ECI3D'];
1452 }
1453 if ( isset( $post_data['CAVV3D'] ) ) {
1454 $param_list['CAVV3D'] = $post_data['CAVV3D'];
1455 }
1456 if ( isset( $post_data['SecureResultCode'] ) ) {
1457 $param_list['SecureResultCode'] = $post_data['SecureResultCode'];
1458 }
1459 if ( isset( $post_data['DSTransactionId'] ) ) {
1460 $param_list['DSTransactionId'] = $post_data['DSTransactionId'];
1461 }
1462 if ( isset( $post_data['ThreeDSServerTransactionId'] ) ) {
1463 $param_list['ThreeDSServerTransactionId'] = $post_data['ThreeDSServerTransactionId'];
1464 }
1465 } else {
1466 /* Duplication control */
1467 $this->duplication_control( $acting_flg, $rand );
1468
1469 if ( isset( $post_data['paytype'] ) && '01' !== $post_data['paytype'] ) {
1470 $_SESSION['usces_entry']['order']['paytype'] = $post_data['paytype'];
1471 }
1472 usces_save_order_acting_data( $rand );
1473
1474 if ( ! empty( $token ) ) {
1475 /* e-SCOTT トークンステータス参�
1476 � */
1477 $param_list['Token'] = $token;
1478 $param_list['OperateId'] = '1TokenSearch';
1479 $params['param_list'] = $param_list;
1480 $params['send_url'] = $acting_opts['send_url_token'];
1481 $response_token = $this->connection( $params );
1482 if ( 'OK' !== $response_token['ResponseCd'] || 'OK' !== $response_token['TokenResponseCd'] ) {
1483 $tokenresponsecd = '';
1484 if ( isset( $response_token['TokenResponseCd'] ) ) {
1485 $responsecd = explode( '|', $response_token['ResponseCd'] . '|' . $response_token['TokenResponseCd'] );
1486 } else {
1487 $responsecd = explode( '|', $response_token['ResponseCd'] );
1488 }
1489 foreach ( (array) $responsecd as $cd ) {
1490 if ( 'OK' !== $cd ) {
1491 $response_token[ $cd ] = $this->response_message( $cd );
1492 $tokenresponsecd .= $cd . '|';
1493 }
1494 }
1495 $tokenresponsecd = rtrim( $tokenresponsecd, '|' );
1496 $logdata = array_merge( $param_list, $response_token );
1497 $log = array(
1498 'acting' => $this->acting_card . '(token_process)',
1499 'key' => $rand,
1500 'result' => $tokenresponsecd,
1501 'data' => $logdata,
1502 );
1503 usces_save_order_acting_error( $log );
1504 wp_redirect(
1505 add_query_arg(
1506 array(
1507 'MerchantFree2' => $response_token['MerchantFree2'],
1508 'ResponseCd' => 'NG',
1509 'acting' => $this->acting_card,
1510 'acting_return' => 0,
1511 'result' => 0,
1512 ),
1513 USCES_CART_URL
1514 )
1515 );
1516 exit();
1517 }
1518 }
1519
1520 /* 3Dセキュア認証画面へリダイレクト */
1521 if ( 'on' === $acting_opts['sec3d_activate'] ) {
1522 $this->certification_3dsecure( $param_list, $post_data, $member['ID'] );
1523 }
1524 }
1525
1526 /* クイック会員登録 */
1527 $quick_member = ( isset( $post_data['quick_member'] ) ) ? $post_data['quick_member'] : '';
1528 if ( ! empty( $member['ID'] ) && 'on' === $acting_opts['quickpay'] && 'add' === $quick_member ) {
1529 $response_member = $this->escott_member_process( $param_list );
1530 if ( 'OK' === $response_member['ResponseCd'] ) {
1531 $param_list['KaiinId'] = $response_member['KaiinId'];
1532 $param_list['KaiinPass'] = $response_member['KaiinPass'];
1533 } else {
1534 $responsecd = explode( '|', $response_member['ResponseCd'] );
1535 foreach ( (array) $responsecd as $cd ) {
1536 $response_member[ $cd ] = $this->response_message( $cd );
1537 }
1538 $logdata = array_merge( $param_list, $response_member );
1539 $log = array(
1540 'acting' => $this->acting_card . '(member_process)',
1541 'key' => $rand,
1542 'result' => $response_member['ResponseCd'],
1543 'data' => $logdata,
1544 );
1545 usces_save_order_acting_error( $log );
1546 wp_redirect(
1547 add_query_arg(
1548 array(
1549 'MerchantFree2' => $response_member['MerchantFree2'],
1550 'ResponseCd' => 'NG',
1551 'acting' => $this->acting_card,
1552 'acting_return' => 0,
1553 'result' => 0,
1554 ),
1555 USCES_CART_URL
1556 )
1557 );
1558 exit();
1559 }
1560 if ( true === $response_member['use_token'] ) {
1561 $param_list['Token'] = ''; /* トークンクリア */
1562 }
1563 if ( usces_have_continue_charge() ) {
1564 $chargingday = $usces->getItemChargingDay( $cart[0]['post_id'] );
1565 if ( 99 === (int) $chargingday ) { /* 受注日課金 */
1566 $operateid = $acting_opts['operateid'];
1567 } else {
1568 $operateid = '1Auth';
1569 }
1570 $param_list['PayType'] = '01';
1571 } else {
1572 $operateid = $acting_opts['operateid'];
1573 $param_list['PayType'] = $post_data['paytype'];
1574 }
1575 } else {
1576 $operateid = $acting_opts['operateid'];
1577 $param_list['PayType'] = ( ! empty( $post_data['paytype'] ) ) ? $post_data['paytype'] : '01';
1578 }
1579
1580 $usces->error_message = $usces->zaiko_check();
1581 if ( '' !== $usces->error_message || 0 === $usces->cart->num_row() ) {
1582 wp_redirect( USCES_CART_URL );
1583 exit();
1584 }
1585
1586 $param_list['OperateId'] = apply_filters( 'usces_filter_escott_operateid', $operateid, $cart, $usces_entries['order']['total_full_price'] );
1587 $params['param_list'] = $param_list;
1588 $params['send_url'] = $acting_opts['send_url'];
1589
1590 /* e-SCOTT 決済 */
1591 $response_data = $this->connection( $params );
1592 $response_data['acting'] = $this->acting_card;
1593 $response_data['PayType'] = $param_list['PayType'];
1594 if ( 'on' === $acting_opts['sec3d_activate'] && isset( $post_data['SecureResultCode'] ) ) {
1595 $response_data['SecureResultCode'] = $post_data['SecureResultCode'];
1596 }
1597 if ( 'OK' === $response_data['ResponseCd'] ) {
1598 $res = $usces->order_processing( $response_data );
1599 if ( 'ordercompletion' === $res ) {
1600 wp_redirect(
1601 add_query_arg(
1602 array(
1603 'acting' => $this->acting_card,
1604 'acting_return' => 1,
1605 'result' => 1,
1606 '_nonce' => wp_create_nonce( $this->acting_flg_card ),
1607 ),
1608 USCES_CART_URL
1609 )
1610 );
1611 } else {
1612 $logdata = array_merge( $usces_entries['order'], $response_data );
1613 $log = array(
1614 'acting' => $this->acting_card,
1615 'key' => $rand,
1616 'result' => 'ORDER DATA REGISTERED ERROR',
1617 'data' => $logdata,
1618 );
1619 usces_save_order_acting_error( $log );
1620 wp_redirect(
1621 add_query_arg(
1622 array(
1623 'acting' => $this->acting_card,
1624 'acting_return' => 0,
1625 'result' => 0,
1626 ),
1627 USCES_CART_URL
1628 )
1629 );
1630 }
1631 } else {
1632 $responsecd = explode( '|', $response_data['ResponseCd'] );
1633 foreach ( (array) $responsecd as $cd ) {
1634 $response_data[ $cd ] = $this->response_message( $cd );
1635 }
1636 $logdata = array_merge( $params, $response_data );
1637 $log = array(
1638 'acting' => $this->acting_card,
1639 'key' => $rand,
1640 'result' => $response_data['ResponseCd'],
1641 'data' => $logdata,
1642 );
1643 usces_save_order_acting_error( $log );
1644 wp_redirect(
1645 add_query_arg(
1646 array(
1647 'MerchantFree2' => $response_data['MerchantFree2'],
1648 'ResponseCd' => 'NG',
1649 'acting' => $this->acting_card,
1650 'acting_return' => 0,
1651 'result' => 0,
1652 ),
1653 USCES_CART_URL
1654 )
1655 );
1656 }
1657 exit();
1658 }
1659 } elseif ( $this->acting_flg_conv === $acting_flg ) {
1660 /* Duplication control */
1661 $this->duplication_control( $acting_flg, $rand );
1662
1663 usces_save_order_acting_data( $rand );
1664
1665 $param_list = array();
1666 $params = array();
1667
1668 $item_name = $usces->getItemName( $cart[0]['post_id'] );
1669 if ( 1 < count( $cart ) ) {
1670 if ( 16 < mb_strlen( $item_name . __( ' etc.', 'usces' ), 'UTF-8' ) ) {
1671 $item_name = mb_substr( $item_name, 0, 12, 'UTF-8' ) . __( ' etc.', 'usces' );
1672 }
1673 } else {
1674 if ( 16 < mb_strlen( $item_name, 'UTF-8' ) ) {
1675 $item_name = mb_substr( $item_name, 0, 13, 'UTF-8' ) . __( '...', 'usces' );
1676 }
1677 }
1678 // ShouhinName は�
1679 �角文字のみ許容されるため、半角英数・半角カナ・半角スペースを�
1680 �角へ統一する.
1681 $item_name = mb_convert_kana( $item_name, 'ASK', 'UTF-8' );
1682 $paylimit = date_i18n( 'Ymd', current_time( 'timestamp' ) + ( 86400 * $acting_opts['conv_limit'] ) ) . '2359';
1683
1684 /* �
1685 �通部 */
1686 $param_list['MerchantId'] = $acting_opts['merchant_id'];
1687 $param_list['MerchantPass'] = $acting_opts['merchant_pass'];
1688 $param_list['TransactionDate'] = $transaction_date;
1689 $param_list['MerchantFree1'] = $rand;
1690 $param_list['MerchantFree2'] = $acting_flg;
1691 $param_list['MerchantFree3'] = $this->merchantfree3;
1692 $param_list['TenantId'] = $acting_opts['tenant_id'];
1693 $param_list['Amount'] = $usces_entries['order']['total_full_price'];
1694 $param_list['OperateId'] = '2Add';
1695 $param_list['PayLimit'] = $paylimit;
1696 $param_list['NameKanji'] = $usces_entries['customer']['name1'] . $usces_entries['customer']['name2'];
1697 $param_list['NameKana'] = ( ! empty( $usces_entries['customer']['name3'] ) ) ? $usces_entries['customer']['name3'] . $usces_entries['customer']['name4'] : $param_list['NameKanji'];
1698 $param_list['TelNo'] = $usces_entries['customer']['tel'];
1699 $param_list['ShouhinName'] = $item_name;
1700 $param_list['Comment'] = apply_filters( 'usces_filter_escott_thankyou_comment', __( 'Thank you for using.', 'usces' ) );
1701 $param_list['ReturnURL'] = home_url( '/' );
1702 $params['send_url'] = $acting_opts['send_url_conv'];
1703 $params['param_list'] = $param_list;
1704 /* e-SCOTT オンライン収納代行データ登録 */
1705 $response_data = $this->connection( $params );
1706 $response_data['acting'] = $this->acting_conv;
1707 $response_data['PayLimit'] = $paylimit;
1708 $response_data['Amount'] = $param_list['Amount'];
1709
1710 if ( 'OK' === $response_data['ResponseCd'] ) {
1711 $free_area = trim( $response_data['FreeArea'] );
1712 $url = add_query_arg(
1713 array(
1714 'code' => $free_area,
1715 'rkbn' => 1,
1716 ),
1717 $acting_opts['redirect_url_conv']
1718 );
1719 $res = $usces->order_processing( $response_data );
1720 if ( 'ordercompletion' === $res ) {
1721 // if ( isset( $response_data['MerchantFree1'] ) ) {
1722 // usces_ordered_acting_data( $response_data['MerchantFree1'] );
1723 // }
1724 $usces->cart->clear_cart();
1725 wp_redirect( $url );
1726 exit();
1727 } else {
1728 $logdata = array_merge( $usces_entries['order'], $response_data );
1729 $log = array(
1730 'acting' => $this->acting_conv,
1731 'key' => $rand,
1732 'result' => 'ORDER DATA REGISTERED ERROR',
1733 'data' => $logdata,
1734 );
1735 usces_save_order_acting_error( $log );
1736 wp_redirect(
1737 add_query_arg(
1738 array(
1739 'acting' => $this->acting_conv,
1740 'acting_return' => 0,
1741 'result' => 0,
1742 ),
1743 USCES_CART_URL
1744 )
1745 );
1746 }
1747 } else {
1748 $responsecd = explode( '|', $response_data['ResponseCd'] );
1749 foreach ( (array) $responsecd as $cd ) {
1750 $response_data[ $cd ] = $this->response_message( $cd );
1751 }
1752 $logdata = array_merge( $params, $response_data );
1753 $log = array(
1754 'acting' => $this->acting_conv,
1755 'key' => $rand,
1756 'result' => $response_data['ResponseCd'],
1757 'data' => $logdata,
1758 );
1759 usces_save_order_acting_error( $log );
1760 wp_redirect(
1761 add_query_arg(
1762 array(
1763 'MerchantFree2' => $response_data['MerchantFree2'],
1764 'ResponseCd' => $response_data['ResponseCd'],
1765 'acting' => $this->acting_conv,
1766 'acting_return' => 0,
1767 'result' => 0,
1768 ),
1769 USCES_CART_URL
1770 )
1771 );
1772 }
1773 exit();
1774 }
1775 }
1776
1777 /**
1778 * 決済完了ページ制御
1779 * usces_filter_check_acting_return_results
1780 *
1781 * @param array $results Result data.
1782 * @return array
1783 */
1784 public function acting_return( $results ) {
1785 $acting_flg = ( isset( $results['acting'] ) ) ? 'acting_' . $results['acting'] : '';
1786 if ( ! in_array( $acting_flg, $this->pay_method, true ) ) {
1787 return $results;
1788 }
1789
1790 if ( isset( $results['acting_return'] ) && 1 !== (int) $results['acting_return'] ) {
1791 return $results;
1792 }
1793
1794 $results['reg_order'] = false;
1795
1796 usces_log( '[' . $this->acting_name . '] results : ' . print_r( $results, true ), 'acting_transaction.log' );
1797 if ( ! isset( $_REQUEST['_nonce'] ) || ! wp_verify_nonce( $_REQUEST['_nonce'], $acting_flg ) ) {
1798 wp_redirect( home_url() );
1799 exit();
1800 }
1801
1802 return $results;
1803 }
1804
1805 /**
1806 * 重複オーダー禁止処理
1807 * usces_filter_check_acting_return_duplicate
1808 *
1809 * @param string $trans_id Transaction ID.
1810 * @param array $results Result data.
1811 * @return string
1812 */
1813 public function check_acting_return_duplicate( $trans_id, $results ) {
1814 global $usces;
1815
1816 $entry = $usces->cart->get_entry();
1817 if ( ! $entry['order']['total_full_price'] ) {
1818 return 'not_credit';
1819 } elseif ( isset( $results['MerchantFree1'] ) && isset( $results['acting'] ) && ( $this->acting_card === $results['acting'] || $this->acting_conv === $results['acting'] ) ) {
1820 $_REQUEST['absolute_trans_id'] = $results['MerchantFree1'];
1821 return $results['MerchantFree1'];
1822 } else {
1823 $_REQUEST['absolute_trans_id'] = $trans_id;
1824 return $trans_id;
1825 }
1826 }
1827
1828 /**
1829 * 受注データ登録
1830 * Called by usces_reg_orderdata() and usces_new_orderdata().
1831 * usces_action_reg_orderdata
1832 *
1833 * @param array $args Compact array( $cart, $entry, $order_id, $member_id, $payments, $charging_type, $results ).
1834 */
1835 public function register_orderdata( $args ) {
1836 global $usces;
1837 extract( $args );
1838
1839 $acting_flg = $payments['settlement'];
1840 if ( ! in_array( $acting_flg, $this->pay_method, true ) ) {
1841 return;
1842 }
1843
1844 if ( ! $entry['order']['total_full_price'] ) {
1845 return;
1846 }
1847
1848 if ( isset( $results['MerchantFree1'] ) ) {
1849 $usces->set_order_meta_value( 'trans_id', $results['MerchantFree1'], $order_id );
1850 $usces->set_order_meta_value( 'wc_trans_id', $results['MerchantFree1'], $order_id );
1851 if ( ! isset( $results['acting'] ) ) {
1852 $results['acting'] = substr( $acting_flg, 7 );
1853 }
1854 if ( $this->acting_flg_card === $acting_flg ) {
1855 $acting_opts = $this->get_acting_settings();
1856 if ( ( 'on' === $acting_opts['sec3d_activate'] && isset( $results['SecureResultCode'] ) ) || 'link' === $acting_opts['card_activate'] ) {
1857 $results['Agreement'] = '1';
1858 }
1859 }
1860 $usces->set_order_meta_value( $acting_flg, usces_serialize( $results ), $order_id );
1861 }
1862
1863 if ( $this->acting_flg_conv === $acting_flg ) {
1864 $usces->set_order_meta_value( $results['MerchantFree1'], $acting_flg, $order_id );
1865 }
1866 }
1867
1868 /**
1869 * 受注データ登録後処理
1870 * usces_post_reg_orderdata
1871 *
1872 * @param string $order_id Order Number.
1873 * @param array $results Results.
1874 */
1875 public function post_register_orderdata( $order_id, $results ) {
1876 global $usces;
1877
1878 if ( isset( $results['acting'] ) && $this->acting_conv === $results['acting'] ) {
1879 $acting_opts = $this->get_acting_settings();
1880 $free_area = trim( $results['FreeArea'] );
1881 $url = add_query_arg(
1882 array(
1883 'code' => $free_area,
1884 'rkbn' => 2,
1885 ),
1886 $acting_opts['redirect_url_conv']
1887 );
1888 $usces->set_order_meta_value( $this->paymod_id . '_conv_url', $url, $order_id );
1889 }
1890 }
1891
1892 /**
1893 * 決済エラーメッセージ
1894 * usces_filter_get_error_settlement
1895 *
1896 * @param string $html Payment error message.
1897 * @return string
1898 */
1899 public function error_page_message( $html ) {
1900 $acting_flg = ( isset( $_REQUEST['MerchantFree2'] ) ) ? wp_unslash( $_REQUEST['MerchantFree2'] ) : '';
1901 if ( $this->acting_flg_card === $acting_flg ) {
1902 if ( isset( $_REQUEST['MerchantFree1'] ) && usces_get_order_id_by_trans_id( wp_unslash( $_REQUEST['MerchantFree1'] ) ) ) {
1903 $html .= '<div class="error_page_mesage">
1904 <p>' . __( 'Your order has already we complete.', 'usces' ) . '</p>
1905 <p>' . __( 'Please do not re-display this page.', 'usces' ) . '</p>
1906 </div>';
1907 } else {
1908 $responsecd = explode( '|', wp_unslash( $_REQUEST['ResponseCd'] ) );
1909 $html .= '<div class="error_page_mesage">';
1910 $html .= '<p>' . __( 'Credit card information is not appropriate.', 'usces' ) . '</p>';
1911 if ( 1 === count( (array) $responsecd ) && 'NG' === $responsecd[0] ) {
1912 $back_url = add_query_arg(
1913 array(
1914 'backDelivery' => $this->acting_card,
1915 're-enter' => 1,
1916 ),
1917 USCES_CART_URL
1918 );
1919 $html .= '
1920 <p class="return_settlement"><a href="' . $back_url . '">' . __( 'Card number re-enter', 'usces' ) . '</a></p>
1921 </div>';
1922 }
1923 }
1924 } elseif ( $this->acting_flg_conv === $acting_flg ) {
1925 $error_message = array();
1926 $responsecd = explode( '|', wp_unslash( $_REQUEST['ResponseCd'] ) );
1927 foreach ( (array) $responsecd as $cd ) {
1928 $error_message[] = $this->error_message( $cd );
1929 }
1930 $error_message = array_unique( $error_message );
1931 if ( 0 < count( $error_message ) ) {
1932 $html .= '<div class="error_page_mesage">
1933 <p>' . __( 'Error code', 'usces' ) . ' : ' . wp_unslash( $_REQUEST['ResponseCd'] ) . '</p>';
1934 foreach ( $error_message as $message ) {
1935 $html .= '<p>' . $message . '</p>';
1936 }
1937 }
1938 $html .= '</div>';
1939 }
1940 return $html;
1941 }
1942
1943 /**
1944 * オンライン収納代行決済用サンキューメール
1945 * usces_filter_send_order_mail_payment
1946 *
1947 * @param string $msg_payment Payment method message.
1948 * @param int $order_id Order number.
1949 * @param array $payment Payment data.
1950 * @param array $cart Cart data.
1951 * @param array $entry Entry data.
1952 * @param array $data Order data.
1953 * @return string
1954 */
1955 public function order_mail_payment( $msg_payment, $order_id, $payment, $cart, $entry, $data ) {
1956 global $usces;
1957
1958 if ( $this->acting_flg_conv !== $payment['settlement'] ) {
1959 return $msg_payment;
1960 }
1961
1962 $acting_opts = $this->get_acting_settings();
1963 $url = $usces->get_order_meta_value( $this->paymod_id . '_conv_url', $order_id );
1964 if ( ! empty( $url ) ) {
1965 if ( usces_is_html_mail() ) {
1966 $msg_conv = '<tr><td colspan="2" style="padding: 0 0 25px 0;">' . $payment['name'] . usces_payment_detail( $entry ) . '<br><br>';
1967 $msg_conv .= sprintf( __( 'Payment is valid for %s days from the date of order.', 'usces' ), $acting_opts['conv_limit'] ) . '<br>';
1968 $msg_conv .= __( 'If payment has not yet been completed, please payment procedure from the following URL.', 'usces' ) . '<br><br>';
1969 $msg_conv .= '<a href="' . $url . '">' . $url . '</a><br>';
1970 $msg_conv .= '</td></tr>';
1971 } else {
1972 $msg_conv = sprintf( __( 'Payment is valid for %s days from the date of order.', 'usces' ), $acting_opts['conv_limit'] ) . "\r\n";
1973 $msg_conv .= __( 'If payment has not yet been completed, please payment procedure from the following URL.', 'usces' ) . "\r\n\r\n";
1974 $msg_conv .= __( '[Payment URL]', 'usces' ) . "\r\n";
1975 $msg_conv .= $url . "\r\n";
1976 }
1977 $msg_payment .= apply_filters( 'usces_filter_escott_send_order_mail_payment_conv', $msg_conv, $url, $acting_opts['conv_limit'] );
1978 }
1979 return $msg_payment;
1980 }
1981
1982 /**
1983 * 管理画面メッセージ表示
1984 * admin_notices
1985 */
1986 public function display_admin_notices() {
1987 $acting_opts = $this->get_acting_settings();
1988 if ( 'on' === $acting_opts['card_activate'] ) {
1989 if ( empty( $acting_opts['token_code'] ) ) {
1990 echo '<div class="update-nag">' . esc_html( $this->acting_name ) . sprintf( __( "Please enter the <a href=\"admin.php?page=usces_settlement#uscestabs_%s\">'Token auth code'</a>.", 'usces' ), esc_html( $this->paymod_id ) ) . '</div>';
1991 }
1992 }
1993 }
1994
1995 /**
1996 * Front scripts.
1997 * wp_print_footer_scripts
1998 */
1999 public function footer_scripts() {
2000 global $usces;
2001
2002 if ( ! $this->is_validity_acting( 'card' ) ) {
2003 return;
2004 }
2005
2006 /* 発送・支払方法ページ */
2007 if ( 'delivery' === $usces->page ) :
2008 $acting_opts = $this->get_acting_settings();
2009 /* 埋込み型 */
2010 if ( isset( $acting_opts['card_activate'] ) && 'on' === $acting_opts['card_activate'] ) :
2011 ?>
2012 <script type="text/javascript">
2013 (function($) {
2014 $("#cardno").change( function(e) {
2015 var first_c = $(this).val().substr(0,1);
2016 var second_c = $(this).val().substr(1,1);
2017 if( '4' == first_c || '5' == first_c || ( '3' == first_c && '5' == second_c ) ) {
2018 $("#paytype_default").prop("disabled","disabled").css("display","none");
2019 $("#paytype4535").prop("disabled",false).css("display","inline");
2020 $("#paytype37").prop("disabled","disabled").css("display","none");
2021 $("#paytype36").prop("disabled","disabled").css("display","none");
2022 } else if( '3' == first_c && '6' == second_c ) {
2023 $("#paytype_default").prop("disabled","disabled").css("display","none");
2024 $("#paytype4535").prop("disabled","disabled").css("display","none");
2025 $("#paytype37").prop("disabled","disabled").css("display","none");
2026 $("#paytype36").prop("disabled",false).css("display","inline");
2027 } else if( '3' == first_c && '7' == second_c ) {
2028 $("#paytype_default").prop("disabled","disabled").css("display","none");
2029 $("#paytype4535").prop("disabled","disabled").css("display","none");
2030 $("#paytype37").prop("disabled",false).css("display","inline");
2031 $("#paytype36").prop("disabled","disabled").css("display","none");
2032 } else {
2033 $("#paytype_default").prop("disabled",false).css("display","inline");
2034 $("#paytype4535").prop("disabled","disabled").css("display","none");
2035 $("#paytype37").prop("disabled","disabled").css("display","none");
2036 $("#paytype36").prop("disabled","disabled").css("display","none");
2037 }
2038 });
2039 $("#cardno").trigger("change");
2040 <?php
2041 if ( isset( $_REQUEST['backDelivery'] ) && $this->acting_card === substr( wp_unslash( $_REQUEST['backDelivery'] ), 0, 12 ) ) :
2042 $payment_method = usces_get_system_option( 'usces_payment_method', 'settlement' );
2043 $id = $payment_method[ $this->acting_flg_card ]['sort'];
2044 ?>
2045 $("#payment_name_<?php echo esc_attr( $id ); ?>").prop("checked",true);
2046 <?php
2047 endif;
2048 ?>
2049 })(jQuery);
2050 </script>
2051 <?php
2052 /* トークン決済 */
2053 elseif ( isset( $acting_opts['card_activate'] ) && 'token' === $acting_opts['card_activate'] ) :
2054 wp_enqueue_style( 'jquery-ui-style' );
2055 wp_enqueue_script( 'jquery-ui-dialog' );
2056 wp_enqueue_style( 'jquery-ui-dialog-min-css', includes_url() . 'css/jquery-ui-dialog.min.css' );
2057 wp_register_script( 'usces_cart_escott', USCES_FRONT_PLUGIN_URL . '/js/cart_escott.js', array( 'jquery' ), USCES_VERSION, true );
2058 $escott_params = array();
2059 $escott_params['sec3d_activate'] = $acting_opts['sec3d_activate'];
2060 $escott_params['message']['agreement'] = $this->consent_message();
2061 $escott_params['message']['agree'] = __( 'Agree', 'usces' );
2062 $escott_params['message']['disagree'] = __( 'Disagree', 'usces' );
2063 wp_localize_script( 'usces_cart_escott', 'escott_params', $escott_params );
2064 wp_enqueue_script( 'usces_cart_escott' );
2065 endif;
2066
2067 /* マイページ */
2068 elseif ( $usces->is_member_page( $_SERVER['REQUEST_URI'] ) ) :
2069 $member = $usces->get_member();
2070 $kaiin_id = $this->get_quick_kaiin_id( $member['ID'] );
2071 if ( ! empty( $kaiin_id ) ) :
2072 ?>
2073 <script type="text/javascript">
2074 jQuery(document).ready( function($) {
2075 $("input[name='deletemember']").css("display","none");
2076 });
2077 </script>
2078 <?php
2079 endif;
2080 endif;
2081 }
2082
2083 /**
2084 * カード�
2085 報�
2086 �力チェック
2087 * usces_filter_delivery_check
2088 *
2089 * @param string $mes Validation check message.
2090 * @return string
2091 */
2092 public function delivery_check( $mes ) {
2093 global $usces;
2094
2095 if ( ! isset( $_POST['offer']['payment_name'] ) ) {
2096 return $mes;
2097 }
2098
2099 if ( ! empty( $mes ) ) {
2100 return $mes;
2101 }
2102
2103 $payment = usces_get_payments_by_name( wp_unslash( $_POST['offer']['payment_name'] ) );
2104 if ( $this->acting_flg_card === $payment['settlement'] ) {
2105 $acting_opts = $this->get_acting_settings();
2106 if ( isset( $acting_opts['card_activate'] ) && 'on' === $acting_opts['card_activate'] ) {
2107 if ( 'on' === $acting_opts['seccd'] ) {
2108 if ( filter_input( INPUT_POST, 'acting', FILTER_DEFAULT ) === $this->paymod_id &&
2109 ! filter_input( INPUT_POST, 'cardno', FILTER_DEFAULT, FILTER_NULL_ON_FAILURE ) ||
2110 ! filter_input( INPUT_POST, 'seccd', FILTER_DEFAULT, FILTER_NULL_ON_FAILURE ) ||
2111 ! filter_input( INPUT_POST, 'expyy', FILTER_DEFAULT, FILTER_NULL_ON_FAILURE ) ||
2112 ! filter_input( INPUT_POST, 'expmm', FILTER_DEFAULT, FILTER_NULL_ON_FAILURE ) ) {
2113 $mes .= __( 'Please enter the card information correctly.', 'usces' ) . '<br />';
2114 }
2115 } else {
2116 if ( filter_input( INPUT_POST, 'acting', FILTER_DEFAULT ) === $this->paymod_id &&
2117 ! filter_input( INPUT_POST, 'cardno', FILTER_DEFAULT, FILTER_NULL_ON_FAILURE ) ||
2118 ! filter_input( INPUT_POST, 'expyy', FILTER_DEFAULT, FILTER_NULL_ON_FAILURE ) ||
2119 ! filter_input( INPUT_POST, 'expmm', FILTER_DEFAULT, FILTER_NULL_ON_FAILURE ) ) {
2120 $mes .= __( 'Please enter the card information correctly.', 'usces' ) . '<br />';
2121 }
2122 }
2123 } elseif ( isset( $acting_opts['card_activate'] ) && 'token' === $acting_opts['card_activate'] ) {
2124 if ( ! filter_input( INPUT_POST, 'token', FILTER_DEFAULT, FILTER_NULL_ON_FAILURE ) ) {
2125 if ( $usces->is_member_logged_in() && 'on' === $acting_opts['quickpay'] ) {
2126 $quick_member = filter_input( INPUT_POST, 'quick_member', FILTER_DEFAULT );
2127 if ( 'add' !== $quick_member ) {
2128 if ( ! wel_check_credit_security() ) {
2129 $mes .= __( 'Update has been locked. Please contact the store administrator.', 'usces' ) . '<br />';
2130 } else {
2131 $mes .= __( 'Please enter the card information correctly.', 'usces' ) . '<br />';
2132 }
2133 }
2134 } else {
2135 $mes .= __( 'Please enter the card information correctly.', 'usces' ) . '<br />';
2136 }
2137 } else {
2138 if ( ! wel_check_credit_security() ) {
2139 $mes .= __( 'Update has been locked. Please contact the store administrator.', 'usces' ) . '<br />';
2140 }
2141 }
2142 }
2143 }
2144 return $mes;
2145 }
2146
2147 /**
2148 * 支払方法ページ用�
2149 �力フォーム
2150 * usces_filter_delivery_secure_form
2151 *
2152 * @param string $html Payment form.
2153 * @param array $payment Payment data.
2154 * @return string
2155 */
2156 public function delivery_secure_form( $html, $payment ) {
2157 global $usces;
2158
2159 if ( $usces->is_cart_page( $_SERVER['REQUEST_URI'] ) && 'delivery' === $usces->page ) {
2160 $acting_opts = $this->get_acting_settings();
2161 if ( isset( $acting_opts['card_activate'] ) && 'token' === $acting_opts['card_activate'] ) {
2162 $html .= '
2163 <input type="hidden" name="acting" value="' . $this->paymod_id . '" />
2164 <input type="hidden" name="confirm" value="confirm" />
2165 <input type="hidden" name="token" id="token" value="" />
2166 <input type="hidden" name="billingname" id="billingname" value="" />
2167 <input type="hidden" name="paytype" value="" />
2168 <input type="hidden" name="quick_member" value="" />
2169 <input type="hidden" name="card_change" value="" />';
2170 }
2171 }
2172 return $html;
2173 }
2174
2175 /**
2176 * 支払方法ページ用�
2177 �力フォーム
2178 * usces_filter_delivery_secure_form_loop
2179 *
2180 * @param string $nouse Empty.
2181 * @param array $payment Payment data.
2182 * @return string
2183 */
2184 public function delivery_secure_form_loop( $nouse, $payment ) {
2185 global $usces;
2186
2187 $html = '';
2188 if ( $this->acting_flg_card === $payment['settlement'] ) {
2189 $acting_opts = $this->get_acting_settings();
2190 if ( ( ! isset( $acting_opts['activate'] ) || 'on' !== $acting_opts['activate'] ) ||
2191 ( ! isset( $acting_opts['card_activate'] ) || 'on' !== $acting_opts['card_activate'] ) ||
2192 'activate' !== $payment['use'] ) {
2193 return $html;
2194 }
2195
2196 $back_delivery = ( isset( $_REQUEST['backDelivery'] ) && substr( wp_unslash( $_REQUEST['backDelivery'] ), 0, 12 ) === $this->acting_card ) ? true : false;
2197 $card_change = ( isset( $_REQUEST['card_change'] ) ) ? true : false;
2198 if ( $card_change ) {
2199 if ( 'on' === $acting_opts['seccd'] ) {
2200 if ( filter_input( INPUT_POST, 'acting', FILTER_DEFAULT ) === $this->paymod_id &&
2201 ! filter_input( INPUT_POST, 'cardno', FILTER_DEFAULT, FILTER_NULL_ON_FAILURE ) ||
2202 ! filter_input( INPUT_POST, 'seccd', FILTER_DEFAULT, FILTER_NULL_ON_FAILURE ) ||
2203 ! filter_input( INPUT_POST, 'expyy', FILTER_DEFAULT, FILTER_NULL_ON_FAILURE ) ||
2204 ! filter_input( INPUT_POST, 'expmm', FILTER_DEFAULT, FILTER_NULL_ON_FAILURE ) ) {
2205 $back_delivery = true;
2206 }
2207 } else {
2208 if ( filter_input( INPUT_POST, 'acting', FILTER_DEFAULT ) === $this->paymod_id &&
2209 ! filter_input( INPUT_POST, 'cardno', FILTER_DEFAULT, FILTER_NULL_ON_FAILURE ) ||
2210 ! filter_input( INPUT_POST, 'expyy', FILTER_DEFAULT, FILTER_NULL_ON_FAILURE ) ||
2211 ! filter_input( INPUT_POST, 'expmm', FILTER_DEFAULT, FILTER_NULL_ON_FAILURE ) ) {
2212 $back_delivery = true;
2213 }
2214 }
2215 }
2216
2217 $cardno = filter_input( INPUT_POST, 'cardno', FILTER_DEFAULT );
2218 $expyy = filter_input( INPUT_POST, 'expyy', FILTER_DEFAULT );
2219 $expmm = filter_input( INPUT_POST, 'expmm', FILTER_DEFAULT );
2220 $paytype = ( isset( $usces_entries['order']['paytype'] ) ) ? esc_html( $usces_entries['order']['paytype'] ) : '01';
2221
2222 $html .= '<input type="hidden" name="acting" value="' . $this->paymod_id . '">';
2223 $html .= '
2224 <table class="customer_form" id="' . $this->paymod_id . '">';
2225
2226 if ( usces_is_login() ) {
2227 $member = $usces->get_member();
2228 $kaiin_id = $this->get_quick_kaiin_id( $member['ID'] );
2229 $kaiin_pass = $this->get_quick_pass( $member['ID'] );
2230 }
2231
2232 $response_member = array(
2233 'ResponseCd' => '',
2234 );
2235
2236 if ( 'on' === $acting_opts['quickpay'] && ! empty( $kaiin_id ) && ! empty( $kaiin_pass ) && ! $card_change ) {
2237 /* e-SCOTT 会員�
2238 �会 */
2239 $response_member = $this->escott_member_reference( $member['ID'], $kaiin_id, $kaiin_pass );
2240 }
2241 if ( 'OK' === $response_member['ResponseCd'] && ! $back_delivery ) {
2242 $cardlast4 = substr( $response_member['CardNo'], -4 );
2243 $expyy = substr( date_i18n( 'Y', current_time( 'timestamp' ) ), 0, 2 ) . substr( $response_member['CardExp'], 0, 2 );
2244 $expmm = substr( $response_member['CardExp'], 2, 2 );
2245 $card_change_url = add_query_arg(
2246 array(
2247 'backDelivery' => $this->acting_card,
2248 'card_change' => 1,
2249 ),
2250 USCES_CART_URL
2251 );
2252 $html .= '
2253 <input name="cardno" type="hidden" value="8888888888888888" />
2254 <input name="cardlast4" type="hidden" value="' . $cardlast4 . '" />
2255 <input name="expyy" type="hidden" value="' . $expyy . '" />
2256 <input name="expmm" type="hidden" value="' . $expmm . '" />
2257 <input name="quick_member" type="hidden" value="add">
2258 <tr>
2259 <th scope="row">' . __( 'The last four digits of your card number', 'usces' ) . '</th>
2260 <td colspan="2"><p>' . $cardlast4 . ' (<a href="' . $card_change_url . '">' . __( 'Change of card information, click here', 'usces' ) . '</a>)</p></td>
2261 </tr>';
2262 } else {
2263 $cardno_attention = apply_filters( 'usces_filter_cardno_attention', __( '(Single-byte numbers only)', 'usces' ) . '<div class="attention">' . __( '* Please do not enter symbols or letters other than numbers such as space (blank), hyphen (-) between numbers.', 'usces' ) . '</div>' );
2264 $change = ( $card_change ) ? '<input type="hidden" name="card_change" value="1">' : '';
2265 $quickpay = '';
2266 if ( usces_is_login() && 'on' === $acting_opts['quickpay'] ) {
2267 if ( usces_have_regular_order() || usces_have_continue_charge() ) {
2268 $quickpay = '<input type="hidden" name="quick_member" value="add">';
2269 } elseif ( 'on' !== $acting_opts['chooseable_quickpay'] ) {
2270 $quickpay = '<input type="hidden" name="quick_member" value="add">';
2271 } else {
2272 $quickpay = '<p class="escott_quick_member"><label type="add"><input type="checkbox" name="quick_member" value="add"><span>' . __( 'Register and purchase a credit card', 'usces' ) . '</span></label></p>';
2273 }
2274 } else {
2275 $quickpay = '<input type="hidden" name="quick_member" value="no">';
2276 }
2277 $html .= '
2278 <tr>
2279 <th scope="row">' . __( 'card number', 'usces' ) . '</th>
2280 <td colspan="2"><input name="cardno" id="cardno" type="tel" value="' . $cardno . '" />' . $cardno_attention . $change . $quickpay . '</td>
2281 </tr>';
2282 if ( 'on' === $acting_opts['seccd'] ) {
2283 $seccd = filter_input( INPUT_POST, 'seccd', FILTER_DEFAULT );
2284 $seccd_attention = apply_filters( 'usces_filter_seccd_attention', __( '(Single-byte numbers only)', 'usces' ) );
2285 $html .= '
2286 <tr>
2287 <th scope="row">' . __( 'security code', 'usces' ) . '</th>
2288 <td colspan="2"><input name="seccd" type="tel" value="' . $seccd . '" />' . $seccd_attention . '</td>
2289 </tr>';
2290 }
2291 $html .= '
2292 <tr>
2293 <th scope="row">' . __( 'Card expiration', 'usces' ) . '</th>
2294 <td colspan="2">
2295 <select name="expmm">
2296 <option value="">--</option>';
2297 for ( $i = 1; $i <= 12; $i++ ) {
2298 $html .= '
2299 <option value="' . sprintf( '%02d', $i ) . '"' . selected( $i, (int) $expmm, false ) . '>' . sprintf( '%2d', $i ) . '</option>';
2300 }
2301 $html .= '
2302 </select>' . __( 'month', 'usces' ) . '&nbsp;
2303 <select name="expyy">
2304 <option value="">----</option>';
2305 for ( $i = 0; $i < 15; $i++ ) {
2306 $year = date_i18n( 'Y' ) + $i;
2307 $html .= '
2308 <option value="' . $year . '"' . selected( $year, $expyy, false ) . '>' . $year . '</option>';
2309 }
2310 $html .= '
2311 </select>' . __( 'year', 'usces' ) . '
2312 </td>
2313 </tr>';
2314
2315 $cardname_attention = apply_filters( 'usces_filter_cardname_attention', __( '(Alphabetic characters only)', 'usces' ) . '<div class="attention">' . __( '* Use a space to separate the first and last name, and enter all characters in uppercase.', 'usces' ) . '</div>' );
2316 $html .= '
2317 <tr>
2318 <th scope="row">' . __( 'Card name', 'usces' ) . '</th>
2319 <td colspan="2"><input name="billingname" type="text" value="" />' . $cardname_attention . '</td>
2320 </tr>';
2321 }
2322
2323 $html_paytype = '';
2324 if ( ( usces_have_regular_order() || usces_have_continue_charge() ) && usces_is_login() ) {
2325 $html_paytype .= '<input type="hidden" name="offer[paytype]" value="01" />';
2326 } else {
2327 if ( 1 === (int) $acting_opts['howtopay'] ) {
2328 $html_paytype .= '<input type="hidden" name="offer[paytype]" value="01" />';
2329 } elseif ( 2 <= (int) $acting_opts['howtopay'] ) {
2330 $cardfirst4 = ( 'OK' === $response_member['ResponseCd'] && ! $back_delivery ) ? '<input type="hidden" id="cardno" value="' . substr( $response_member['CardNo'], 0, 4 ) . '" />' : ''; /* �
2331 �頭4桁 */
2332 $html_paytype .= '
2333 <tr>
2334 <th scope="row">' . __( 'Number of payments', 'usces' ) . '</th>
2335 <td colspan="2">' . $cardfirst4 . '<div class="paytype">';
2336 $html_paytype .= '
2337 <select name="offer[paytype]" id="paytype_default" >
2338 <option value="01"' . selected( $paytype, '01', false ) . '>' . __( 'One time payment', 'usces' ) . '</option>
2339 </select>';
2340 $html_paytype .= '
2341 <select name="offer[paytype]" id="paytype4535" style="display:none;" disabled="disabled" >
2342 <option value="01"' . selected( $paytype, '01', false ) . '>1' . __( '-time payment', 'usces' ) . '</option>
2343 <option value="02"' . selected( $paytype, '02', false ) . '>2' . __( '-time payment', 'usces' ) . '</option>
2344 <option value="03"' . selected( $paytype, '03', false ) . '>3' . __( '-time payment', 'usces' ) . '</option>
2345 <option value="05"' . selected( $paytype, '05', false ) . '>5' . __( '-time payment', 'usces' ) . '</option>
2346 <option value="06"' . selected( $paytype, '06', false ) . '>6' . __( '-time payment', 'usces' ) . '</option>
2347 <option value="10"' . selected( $paytype, '10', false ) . '>10' . __( '-time payment', 'usces' ) . '</option>
2348 <option value="12"' . selected( $paytype, '12', false ) . '>12' . __( '-time payment', 'usces' ) . '</option>
2349 <option value="15"' . selected( $paytype, '15', false ) . '>15' . __( '-time payment', 'usces' ) . '</option>
2350 <option value="18"' . selected( $paytype, '18', false ) . '>18' . __( '-time payment', 'usces' ) . '</option>
2351 <option value="20"' . selected( $paytype, '20', false ) . '>20' . __( '-time payment', 'usces' ) . '</option>
2352 <option value="24"' . selected( $paytype, '24', false ) . '>24' . __( '-time payment', 'usces' ) . '</option>
2353 <option value="88"' . selected( $paytype, '88', false ) . ' >' . __( 'Libor Funding pay', 'usces' ) . '</option>';
2354 if ( 3 === (int) $acting_opts['howtopay'] ) {
2355 $html_paytype .= '
2356 <option value="80"' . selected( $paytype, '80', false ) . '>' . __( 'Bonus lump-sum payment', 'usces' ) . '</option>';
2357 }
2358 $html_paytype .= '
2359 </select>';
2360 $html_paytype .= '
2361 <select name="offer[paytype]" id="paytype37" style="display:none;" disabled="disabled" >
2362 <option value="01"' . selected( $paytype, '01', false ) . '>1' . __( '-time payment', 'usces' ) . '</option>
2363 <option value="03"' . selected( $paytype, '03', false ) . '>3' . __( '-time payment', 'usces' ) . '</option>
2364 <option value="05"' . selected( $paytype, '05', false ) . '>5' . __( '-time payment', 'usces' ) . '</option>
2365 <option value="06"' . selected( $paytype, '06', false ) . '>6' . __( '-time payment', 'usces' ) . '</option>
2366 <option value="10"' . selected( $paytype, '10', false ) . '>10' . __( '-time payment', 'usces' ) . '</option>
2367 <option value="12"' . selected( $paytype, '12', false ) . '>12' . __( '-time payment', 'usces' ) . '</option>
2368 <option value="15"' . selected( $paytype, '15', false ) . '>15' . __( '-time payment', 'usces' ) . '</option>
2369 <option value="18"' . selected( $paytype, '18', false ) . '>18' . __( '-time payment', 'usces' ) . '</option>
2370 <option value="20"' . selected( $paytype, '20', false ) . '>20' . __( '-time payment', 'usces' ) . '</option>
2371 <option value="24"' . selected( $paytype, '24', false ) . '>24' . __( '-time payment', 'usces' ) . '</option>';
2372 if ( 3 === (int) $acting_opts['howtopay'] ) {
2373 $html_paytype .= '
2374 <option value="80"' . selected( $paytype, '80', false ) . '>' . __( 'Bonus lump-sum payment', 'usces' ) . '</option>';
2375 }
2376 $html_paytype .= '
2377 </select>';
2378 $html_paytype .= '
2379 <select name="offer[paytype]" id="paytype36" style="display:none;" disabled="disabled" >
2380 <option value="01"' . selected( $paytype, '01', false ) . '>' . __( 'One time payment', 'usces' ) . '</option>
2381 <option value="88"' . selected( $paytype, '88', false ) . '>' . __( 'Libor Funding pay', 'usces' ) . '</option>';
2382 if ( 3 === (int) $acting_opts['howtopay'] ) {
2383 $html_paytype .= '
2384 <option value="80"' . selected( $paytype, '80', false ) . '>' . __( 'Bonus lump-sum payment', 'usces' ) . '</option>';
2385 }
2386 $html_paytype .= '
2387 </select>';
2388 $html_paytype .= '</div>
2389 </td>
2390 </tr>';
2391 }
2392 }
2393 $html .= apply_filters( 'usces_filter_escott_secure_form_paytype', $html_paytype );
2394 $html .= '
2395 </table><table>';
2396 }
2397 return $html;
2398 }
2399
2400 /**
2401 * 会員データ削除チェック
2402 * usces_filter_delete_member_check
2403 *
2404 * @param boolean $del Removable|unavailable.
2405 * @param int $member_id Member ID.
2406 * @return boolean
2407 */
2408 public function delete_member_check( $del, $member_id ) {
2409 $kaiin_id = $this->get_quick_kaiin_id( $member_id );
2410 if ( ! empty( $kaiin_id ) ) {
2411 $del = false;
2412 }
2413 return $del;
2414 }
2415
2416 /**
2417 * Front styles.
2418 * wp_print_styles
2419 */
2420 public function print_styles() {
2421 global $usces;
2422
2423 /* 発送・支払方法ページ */
2424 if ( ! is_admin() && 'delivery' === $usces->page && $this->is_validity_acting( 'card' ) ) :
2425 $acting_opts = $this->get_acting_settings();
2426 if ( isset( $acting_opts['card_activate'] ) && ( 'token' === $acting_opts['card_activate'] || 'link' === $acting_opts['card_activate'] ) ) :
2427 ?>
2428 <style type="text/css">
2429 #escott-dialog {
2430 left: 50% !important;
2431 transform: translateY(-50%) translateX(-50%);
2432 -webkit- transform: translateY(-50%) translateX(-50%);
2433 width: 90% !important;
2434 max-width: 700px;
2435 }
2436 #escott-agree-dialog {
2437 height: auto !important;
2438 }
2439 .escott_agreement_message {
2440 width: 100%;
2441 height: 200px;
2442 }
2443 </style>
2444 <?php
2445 endif;
2446 endif;
2447 }
2448
2449 /**
2450 * Scripts.
2451 * wp_enqueue_scripts
2452 */
2453 public function enqueue_scripts() {
2454 global $usces;
2455
2456 /* 発送・支払方法ページ */
2457 if ( ! is_admin() && 'delivery' === $usces->page && $this->is_validity_acting( 'card' ) ) :
2458 $acting_opts = $this->get_acting_settings();
2459 if ( isset( $acting_opts['card_activate'] ) && 'token' === $acting_opts['card_activate'] ) :
2460 ?>
2461 <script type="text/javascript" src="<?php echo esc_attr( $acting_opts['api_token'] ); ?>?k_TokenNinsyoCode=<?php echo esc_attr( $acting_opts['token_code'] ); ?>" callBackFunc="setToken" class="spsvToken"></script>
2462 <?php
2463 endif;
2464 endif;
2465 }
2466
2467 /**
2468 * Set uscesL10n.
2469 * usces_filter_uscesL10n
2470 *
2471 * @param string $l10n uscesL10n.
2472 * @param int $post_id Post ID.
2473 * @return string
2474 */
2475 public function set_uscesL10n( $l10n, $post_id ) {
2476 global $usces;
2477
2478 if ( $usces->is_cart_page( $_SERVER['REQUEST_URI'] ) && 'delivery' === $usces->page ) {
2479 $acting_opts = $this->get_acting_settings();
2480 if ( isset( $acting_opts['card_activate'] ) && 'token' === $acting_opts['card_activate'] ) {
2481 $front_ajaxurl = trailingslashit( USCES_SSL_URL ) . 'index.php';
2482 $l10n .= "'front_ajaxurl': '" . $front_ajaxurl . "',\n";
2483 $payment_method = usces_get_system_option( 'usces_payment_method', 'sort' );
2484 $payment_method = apply_filters( 'usces_fiter_the_payment_method', $payment_method, '' );
2485 foreach ( (array) $payment_method as $id => $payment ) {
2486 if ( $payment['settlement'] === $this->acting_flg_card ) {
2487 $l10n .= "'escott_token_payment_id': '" . $id . "',\n";
2488 break;
2489 }
2490 }
2491 $l10n .= "'escott_token_dialog_title': '" . __( 'Credit card information', 'usces' ) . "',\n";
2492 $l10n .= "'escott_token_btn_next': '" . __( 'Next', 'usces' ) . "',\n";
2493 $l10n .= "'escott_token_btn_cancel': '" . __( 'Cancel', 'usces' ) . "',\n";
2494 $l10n .= "'escott_token_error_message': '" . __( 'Credit card information is not appropriate.', 'usces' ) . "',\n";
2495 }
2496 }
2497 return $l10n;
2498 }
2499
2500 /**
2501 * Front ajax.
2502 * usces_front_ajax
2503 */
2504 public function front_ajax() {
2505 global $usces;
2506
2507 $usces_ajax_action = filter_input( INPUT_POST, 'usces_ajax_action', FILTER_DEFAULT );
2508 switch ( $usces_ajax_action ) {
2509 case 'escott_token_dialog':
2510 if ( ! wp_verify_nonce( filter_input( INPUT_POST, 'wc_nonce', FILTER_DEFAULT ), 'wc_delivery_secure_nonce' ) ) {
2511 wp_redirect( USCES_CART_URL );
2512 }
2513
2514 $data = array();
2515 $acting_opts = $this->get_acting_settings();
2516 $card_change = ( isset( $_POST['card_change'] ) ) ? true : false;
2517
2518 $html = '';
2519 $html .= '
2520 <table class="customer_form settlement_form" id="' . $this->paymod_id . '">';
2521
2522 if ( usces_is_login() ) {
2523 $member = $usces->get_member();
2524 $kaiin_id = $this->get_quick_kaiin_id( $member['ID'] );
2525 $kaiin_pass = $this->get_quick_pass( $member['ID'] );
2526 }
2527
2528 $response_member = array(
2529 'ResponseCd' => '',
2530 );
2531
2532 if ( 'on' === $acting_opts['quickpay'] && ! empty( $kaiin_id ) && ! empty( $kaiin_pass ) && ! $card_change ) {
2533 /* e-SCOTT 会員�
2534 �会 */
2535 $response_member = $this->escott_member_reference( $member['ID'], $kaiin_id, $kaiin_pass );
2536 }
2537
2538 if ( 'OK' === $response_member['ResponseCd'] ) {
2539 $cardlast4 = substr( $response_member['CardNo'], -4 );
2540 $html .= '
2541 <tr>
2542 <th scope="row">' . __( 'The last four digits of your card number', 'usces' ) . '</th>
2543 <td colspan="2"><p>' . $cardlast4 . ' (<a href="#" id="escott_card_change">' . __( 'Change of card information, click here', 'usces' ) . '</a>)</p></td>
2544 </tr>';
2545
2546 } else {
2547 $cardno_attention = apply_filters( 'usces_filter_cardno_attention', __( '(Single-byte numbers only)', 'usces' ) . '<div class="attention">' . __( '* Please do not enter symbols or letters other than numbers such as space (blank), hyphen (-) between numbers.', 'usces' ) . '</div>' );
2548 $change = ( $card_change ) ? '<input type="hidden" id="card_change" value="1">' : '';
2549 $quickpay = '';
2550 if ( usces_is_login() && 'on' === $acting_opts['quickpay'] ) {
2551 if ( usces_have_regular_order() || usces_have_continue_charge() ) {
2552 $quickpay = '<input type="hidden" id="quick_member" value="add">';
2553 } elseif ( 'on' !== $acting_opts['chooseable_quickpay'] ) {
2554 $quickpay = '<input type="hidden" id="quick_member" value="add">';
2555 } else {
2556 $quickpay = '<p class="escott_quick_member"><label type="add"><input type="checkbox" id="quick_member" value="add"><span>' . __( 'Register and purchase a credit card', 'usces' ) . '</span></label></p>';
2557 }
2558 } else {
2559 $quickpay = '<input type="hidden" id="quick_member" value="no">';
2560 }
2561 $html .= '
2562 <tr>
2563 <th scope="row">' . __( 'card number', 'usces' ) . '</th>
2564 <td colspan="2"><input id="cardno" type="tel" value="" />' . $cardno_attention . $change . $quickpay . '</td>
2565 </tr>';
2566 if ( 'on' === $acting_opts['seccd'] ) {
2567 $seccd_attention = apply_filters( 'usces_filter_seccd_attention', __( '(Single-byte numbers only)', 'usces' ) );
2568 $html .= '
2569 <tr>
2570 <th scope="row">' . __( 'security code', 'usces' ) . '</th>
2571 <td colspan="2"><input id="seccd" type="tel" value="" class="small-text" />' . $seccd_attention . '</td>
2572 </tr>';
2573 }
2574 $html .= '
2575 <tr>
2576 <th scope="row">' . __( 'Card expiration', 'usces' ) . '</th>
2577 <td colspan="2">
2578 <select id="expmm">
2579 <option value="">--</option>';
2580 for ( $i = 1; $i <= 12; $i++ ) {
2581 $html .= '
2582 <option value="' . sprintf( '%02d', $i ) . '">' . sprintf( '%2d', $i ) . '</option>';
2583 }
2584 $html .= '
2585 </select>' . __( 'month', 'usces' ) . '&nbsp;
2586 <select id="expyy">
2587 <option value="">----</option>';
2588 for ( $i = 0; $i < 15; $i++ ) {
2589 $year = date_i18n( 'Y' ) + $i;
2590 $html .= '
2591 <option value="' . $year . '">' . $year . '</option>';
2592 }
2593 $html .= '
2594 </select>' . __( 'year', 'usces' ) . '
2595 </td>
2596 </tr>';
2597
2598 $cardname_attention = apply_filters( 'usces_filter_cardname_attention', __( '(Alphabetic characters only)', 'usces' ) . '<div class="attention">' . __( '* Use a space to separate the first and last name, and enter all characters in uppercase.', 'usces' ) . '</div>' );
2599 $html .= '
2600 <tr>
2601 <th scope="row">' . __( 'Card name', 'usces' ) . '</th>
2602 <td colspan="2"><input id="cardname" type="text" value="" />' . $cardname_attention . '</td>
2603 </tr>';
2604 }
2605
2606 $html_paytype = '';
2607 if ( ( usces_have_regular_order() || usces_have_continue_charge() ) && usces_is_login() ) {
2608 $html_paytype .= '<input type="hidden" id="paytype" value="01" />';
2609
2610 } else {
2611 if ( 1 === (int) $acting_opts['howtopay'] ) {
2612 $html_paytype .= '<input type="hidden" id="paytype" value="01" />';
2613
2614 } elseif ( 2 <= $acting_opts['howtopay'] ) {
2615 $cardfirst4 = ( 'OK' === $response_member['ResponseCd'] ) ? '<input type="hidden" id="cardno" value="' . substr( $response_member['CardNo'], 0, 4 ) . '" />' : ''; /* �
2616 �頭4桁 */
2617 $html_paytype .= '
2618 <tr>
2619 <th scope="row">' . __( 'Number of payments', 'usces' ) . '</th>
2620 <td colspan="2">' . $cardfirst4 . '<div class="paytype">';
2621
2622 $html_paytype .= '
2623 <select id="paytype_default" >
2624 <option value="01">' . __( 'One time payment', 'usces' ) . '</option>
2625 </select>';
2626
2627 $html_paytype .= '
2628 <select id="paytype4535" style="display:none;" disabled="disabled" >
2629 <option value="01">1' . __( '-time payment', 'usces' ) . '</option>
2630 <option value="02">2' . __( '-time payment', 'usces' ) . '</option>
2631 <option value="03">3' . __( '-time payment', 'usces' ) . '</option>
2632 <option value="05">5' . __( '-time payment', 'usces' ) . '</option>
2633 <option value="06">6' . __( '-time payment', 'usces' ) . '</option>
2634 <option value="10">10' . __( '-time payment', 'usces' ) . '</option>
2635 <option value="12">12' . __( '-time payment', 'usces' ) . '</option>
2636 <option value="15">15' . __( '-time payment', 'usces' ) . '</option>
2637 <option value="18">18' . __( '-time payment', 'usces' ) . '</option>
2638 <option value="20">20' . __( '-time payment', 'usces' ) . '</option>
2639 <option value="24">24' . __( '-time payment', 'usces' ) . '</option>
2640 <option value="88">' . __( 'Libor Funding pay', 'usces' ) . '</option>';
2641 if ( 3 === (int) $acting_opts['howtopay'] ) {
2642 $html_paytype .= '
2643 <option value="80">' . __( 'Bonus lump-sum payment', 'usces' ) . '</option>';
2644 }
2645 $html_paytype .= '
2646 </select>';
2647
2648 $html_paytype .= '
2649 <select id="paytype37" style="display:none;" disabled="disabled" >
2650 <option value="01">1' . __( '-time payment', 'usces' ) . '</option>
2651 <option value="03">3' . __( '-time payment', 'usces' ) . '</option>
2652 <option value="05">5' . __( '-time payment', 'usces' ) . '</option>
2653 <option value="06">6' . __( '-time payment', 'usces' ) . '</option>
2654 <option value="10">10' . __( '-time payment', 'usces' ) . '</option>
2655 <option value="12">12' . __( '-time payment', 'usces' ) . '</option>
2656 <option value="15">15' . __( '-time payment', 'usces' ) . '</option>
2657 <option value="18">18' . __( '-time payment', 'usces' ) . '</option>
2658 <option value="20">20' . __( '-time payment', 'usces' ) . '</option>
2659 <option value="24">24' . __( '-time payment', 'usces' ) . '</option>';
2660 if ( 3 === (int) $acting_opts['howtopay'] ) {
2661 $html_paytype .= '
2662 <option value="80">' . __( 'Bonus lump-sum payment', 'usces' ) . '</option>';
2663 }
2664 $html_paytype .= '
2665 </select>';
2666
2667 $html_paytype .= '
2668 <select id="paytype36" style="display:none;" disabled="disabled" >
2669 <option value="01">' . __( 'One time payment', 'usces' ) . '</option>
2670 <option value="88">' . __( 'Libor Funding pay', 'usces' ) . '</option>';
2671 if ( 3 === (int) $acting_opts['howtopay'] ) {
2672 $html_paytype .= '
2673 <option value="80">' . __( 'Bonus lump-sum payment', 'usces' ) . '</option>';
2674 }
2675 $html_paytype .= '
2676 </select>';
2677
2678 $html_paytype .= '</div>
2679 </td>
2680 </tr>';
2681 }
2682 }
2683 $html .= apply_filters( 'usces_filter_escott_secure_form_paytype_token', $html_paytype );
2684 $html .= '
2685 </table>';
2686 $quick = ( 'OK' === $response_member['ResponseCd'] ) ? 'quick' : '';
2687 $data['status'] = 'OK';
2688 $data['result'] = $html;
2689 $data['member'] = $quick;
2690 wp_send_json( $data );
2691 break;
2692
2693 case 'escott_set_token':
2694 if ( ! wp_verify_nonce( filter_input( INPUT_POST, 'wc_nonce', FILTER_DEFAULT ), 'wc_delivery_secure_nonce' ) ) {
2695 wp_redirect( USCES_CART_URL );
2696 }
2697
2698 $data = array();
2699 $data['status'] = 'OK';
2700 $data['result'] = '';
2701 wp_send_json( $data );
2702 break;
2703 }
2704 }
2705
2706 /**
2707 * 手数料ラベル
2708 * usces_filter_cod_label
2709 *
2710 * @param string $label Fee label.
2711 * @return string
2712 */
2713 public function set_fee_label( $label ) {
2714 global $usces;
2715
2716 if ( is_admin() ) {
2717 $order_id = ( isset( $_REQUEST['order_id'] ) ) ? wp_unslash( $_REQUEST['order_id'] ) : '';
2718 if ( ! empty( $order_id ) ) {
2719 $order_data = $usces->get_order_data( $order_id, 'direct' );
2720 if ( ! empty( $order_data['order_payment_name'] ) ) {
2721 $payment = usces_get_payments_by_name( $order_data['order_payment_name'] );
2722 if ( $this->acting_flg_conv === $payment['settlement'] || $this->acting_flg_atodene === $payment['settlement'] ) {
2723 $label = $payment['name'] . __( 'Fee', 'usces' );
2724 }
2725 }
2726 }
2727 } else {
2728 $usces_entries = $usces->cart->get_entry();
2729 $payment = usces_get_payments_by_name( $usces_entries['order']['payment_name'] );
2730 if ( $this->acting_flg_conv === $payment['settlement'] || $this->acting_flg_atodene === $payment['settlement'] ) {
2731 $label = $payment['name'] . __( 'Fee', 'usces' );
2732 }
2733 }
2734 return $label;
2735 }
2736
2737 /**
2738 * 手数料ラベル
2739 * usces_filter_member_history_cod_label
2740 *
2741 * @param string $label Fee label.
2742 * @param int $order_id Order number.
2743 * @return string
2744 */
2745 public function set_member_history_fee_label( $label, $order_id ) {
2746 global $usces;
2747
2748 $order_data = $usces->get_order_data( $order_id, 'direct' );
2749 $payment = usces_get_payments_by_name( $order_data['order_payment_name'] );
2750 if ( $this->acting_flg_conv === $payment['settlement'] || $this->acting_flg_atodene === $payment['settlement'] ) {
2751 $label = $payment['name'] . __( 'Fee', 'usces' );
2752 }
2753 return $label;
2754 }
2755
2756 /**
2757 * 支払方法
2758 * usces_fiter_the_payment_method
2759 *
2760 * @param array $payments Payments.
2761 * @return array
2762 */
2763 public function payment_method( $payments ) {
2764 $conv_exclusion = false;
2765
2766 if ( usces_have_regular_order() ) {
2767 $conv_exclusion = true;
2768
2769 } elseif ( usces_have_continue_charge() ) {
2770 $conv_exclusion = true;
2771 }
2772
2773 if ( $conv_exclusion ) {
2774 foreach ( $payments as $key => $payment ) {
2775 if ( $this->acting_flg_conv === $payment['settlement'] ) {
2776 unset( $payments[ $key ] );
2777 }
2778 }
2779 }
2780
2781 return $payments;
2782 }
2783
2784 /**
2785 * 決済手数料
2786 * usces_filter_set_cart_fees_cod
2787 *
2788 * @param float $cod_fee COD fee.
2789 * @param array $usces_entries Entry data.
2790 * @param float $total_items_price Total amount of items.
2791 * @param int $use_point Use point.
2792 * @param float $discount Discount.
2793 * @param float $shipping_charge Shipping charge.
2794 * @param float $amount_by_cod COD.
2795 * @return float
2796 */
2797 public function add_fee( $cod_fee, $usces_entries, $total_items_price, $use_point, $discount, $shipping_charge, $amount_by_cod ) {
2798 global $usces;
2799
2800 $payment = usces_get_payments_by_name( $usces_entries['order']['payment_name'] );
2801 if ( $this->acting_flg_conv !== $payment['settlement'] && $this->acting_flg_atodene !== $payment['settlement'] ) {
2802 return $cod_fee;
2803 }
2804
2805 $acting_opts = $this->get_acting_settings();
2806 $acting = explode( '_', $payment['settlement'] );
2807 $fee = 0;
2808 if ( ! empty( $acting_opts[ $acting[2] . '_fee_type' ] ) ) {
2809 if ( 'fix' === $acting_opts[ $acting[2] . '_fee_type' ] ) {
2810 $fee = (int) $acting_opts[ $acting[2] . '_fee' ];
2811 } else {
2812 $materials = array(
2813 'total_items_price' => $total_items_price,
2814 'discount' => $discount,
2815 'shipping_charge' => $shipping_charge,
2816 'cod_fee' => $cod_fee,
2817 'use_point' => $use_point,
2818 );
2819 $amount_by_fee = $total_items_price - $use_point + $discount;
2820 if ( 'all' === usces_is_fee_subject() ) {
2821 $amount_by_fee += $shipping_charge;
2822 }
2823 $price = $amount_by_fee + $usces->getTax( $amount_by_fee, $materials );
2824 if ( $price <= (int) $acting_opts[ $acting[2] . '_fee_first_amount' ] ) {
2825 $fee = $acting_opts[ $acting[2] . '_fee_first_fee' ];
2826 } elseif ( isset( $acting_opts[ $acting[2] . '_fee_amounts' ] ) && ! empty( $acting_opts[ $acting[2] . '_fee_amounts' ] ) ) {
2827 $last = count( $acting_opts[ $acting[2] . '_fee_amounts' ] ) - 1;
2828 if ( $price > $acting_opts[ $acting[2] . '_fee_amounts' ][ $last ] ) {
2829 $fee = $acting_opts[ $acting[2] . '_fee_end_fee' ];
2830 } else {
2831 foreach ( $acting_opts[ $acting[2] . '_fee_amounts' ] as $key => $value ) {
2832 if ( $price <= $value ) {
2833 $fee = $acting_opts[ $acting[2] . '_fee_fees' ][ $key ];
2834 break;
2835 }
2836 }
2837 }
2838 } else {
2839 $fee = $acting_opts[ $acting[2] . '_fee_end_fee' ];
2840 }
2841 }
2842 }
2843 return $cod_fee + $fee;
2844 }
2845
2846 /**
2847 * 決済手数料チェック
2848 * usces_filter_delivery_check usces_filter_point_check_last
2849 *
2850 * @param string $mes Message.
2851 * @return string
2852 */
2853 public function check_fee_limit( $mes ) {
2854 global $usces;
2855
2856 $member = $usces->get_member();
2857 $usces->set_cart_fees( $member, array() );
2858 $usces_entries = $usces->cart->get_entry();
2859 $payment = usces_get_payments_by_name( $usces_entries['order']['payment_name'] );
2860 if ( $this->acting_flg_conv !== $payment['settlement'] && $this->acting_flg_atodene !== $payment['settlement'] ) {
2861 return $mes;
2862 }
2863
2864 if ( 2 === (int) $usces_entries['delivery']['delivery_flag'] ) {
2865 $mes .= sprintf( __( "If you specify multiple shipping address, you cannot use '%s' payment method.", 'usces' ), $usces_entries['order']['payment_name'] );
2866 return $mes;
2867 }
2868
2869 $acting_opts = $this->get_acting_settings();
2870 $fee_limit_amount = 0;
2871 switch ( $payment['settlement'] ) {
2872 case $this->acting_flg_conv:
2873 if ( ! empty( $acting_opts['conv_fee_limit_amount'] ) ) {
2874 $fee_limit_amount = (int) $acting_opts['conv_fee_limit_amount'];
2875 }
2876 break;
2877
2878 case $this->acting_flg_atodene:
2879 if ( ! empty( $acting_opts['atodene_fee_limit_amount'] ) ) {
2880 $fee_limit_amount = (int) $acting_opts['atodene_fee_limit_amount'];
2881 }
2882 break;
2883 }
2884
2885 if ( 0 < $fee_limit_amount && $usces_entries['order']['total_full_price'] > $fee_limit_amount ) {
2886 $mes .= sprintf( __( 'It exceeds the maximum amount of "%1$s" (total amount %2$s).', 'usces' ), $usces_entries['order']['payment_name'], usces_crform( $fee_limit_amount, true, false, 'return', true ) );
2887 }
2888
2889 return $mes;
2890 }
2891
2892 /**
2893 * �
2894 �金通知の送信�
2895 �IPを検証する
2896 *
2897 * 許可IP以外からのリクエストはエラーログを残して処理を終了する
2898 * �
2899 �金状�
2900 �を変更するサーバー間通知でのみ呼び出すこと
2901 * ブラウザ戻りを伴う結果戻り(acting_return)では呼び出さない
2902 *
2903 * @param array $data Notification data.
2904 * @return void
2905 */
2906 protected function acting_notice_ip_guard( $data ) {
2907 $acting_opts = $this->get_acting_settings();
2908 $allowed_ips = ( isset( $acting_opts['ope'] ) && 'public' === $acting_opts['ope'] ) ? self::ACTING_NOTICE_IPADDRS_PUBLIC : self::ACTING_NOTICE_IPADDRS_TEST;
2909 $remote_addr = ( isset( $_SERVER['REMOTE_ADDR'] ) ) ? wp_unslash( $_SERVER['REMOTE_ADDR'] ) : '';
2910 if ( usces_acting_notice_ip_allowed( $remote_addr, $allowed_ips ) ) {
2911 return;
2912 }
2913 $log = array(
2914 'acting' => $this->acting_conv,
2915 'key' => ( isset( $data['MerchantFree1'] ) ) ? $data['MerchantFree1'] : '',
2916 'result' => 'IP ADDRESS NOT ALLOWED: ' . $remote_addr,
2917 'data' => $data,
2918 );
2919 usces_save_order_acting_error( $log );
2920 usces_log( '[' . $this->acting_name . '] conv notice denied ip : ' . $remote_addr, 'acting_transaction.log' );
2921 header( 'HTTP/1.0 200 OK' );
2922 die();
2923 }
2924
2925 /**
2926 * 決済オプション取得
2927 *
2928 * @return array
2929 */
2930 protected function get_acting_settings() {
2931 global $usces;
2932
2933 $acting_settings = ( isset( $usces->options['acting_settings'][ $this->paymod_id ] ) ) ? $usces->options['acting_settings'][ $this->paymod_id ] : array();
2934 $acting_settings['key_aes'] = ( empty( $acting_settings['card_key_aes'] ) ) ? 'HgmhZ94rN799CD3F' : $acting_settings['card_key_aes'];
2935 $acting_settings['key_iv'] = ( empty( $acting_settings['card_key_iv'] ) ) ? 'gNqc4zwhNLCSC5cv' : $acting_settings['card_key_iv'];
2936 return $acting_settings;
2937 }
2938
2939 /**
2940 * 処理日付生成
2941 *
2942 * @return string 'YYYYMMDD'
2943 */
2944 protected function get_transaction_date() {
2945 $transaction_date = date_i18n( 'Ymd', current_time( 'timestamp' ) );
2946 return $transaction_date;
2947 }
2948
2949 /**
2950 * e-SCOTT 会員ID取得
2951 *
2952 * @param int $member_id Member ID.
2953 * @param string $type Module type.
2954 * @return string
2955 */
2956 public function get_quick_kaiin_id( $member_id, $type = '' ) {
2957 global $usces;
2958
2959 if ( empty( $member_id ) ) {
2960 return false;
2961 }
2962
2963 if ( '' === $type ) {
2964 $escott_member_id = $usces->get_member_meta_value( $this->quick_key_pre . '_member_id', $member_id );
2965 } else {
2966 $escott_member_id = $usces->get_member_meta_value( $this->quick_key_pre . '_' . $type . '_member_id', $member_id );
2967 }
2968 return $escott_member_id;
2969 }
2970
2971 /**
2972 * e-SCOTT 会員パスワード取得
2973 *
2974 * @param int $member_id Member ID.
2975 * @param string $type Module type.
2976 * @return string
2977 */
2978 public function get_quick_pass( $member_id, $type = '' ) {
2979 global $usces;
2980
2981 if ( empty( $member_id ) ) {
2982 return false;
2983 }
2984
2985 if ( '' === $type ) {
2986 $escott_member_passwd = $usces->get_member_meta_value( $this->quick_key_pre . '_member_passwd', $member_id );
2987 } else {
2988 $escott_member_passwd = $usces->get_member_meta_value( $this->quick_key_pre . '_' . $type . '_member_passwd', $member_id );
2989 }
2990 return $escott_member_passwd;
2991 }
2992
2993 /**
2994 * e-SCOTT 会員ID生成
2995 *
2996 * @param int $member_id Member ID.
2997 * @return string
2998 */
2999 public function make_kaiin_id( $member_id ) {
3000 $digit = 11 - strlen( $member_id );
3001 $num = str_repeat( '9', $digit );
3002 $id = sprintf( '%0' . $digit . 'd', mt_rand( 1, (int) $num ) );
3003 return 'w' . $member_id . 'i' . $id;
3004 }
3005
3006 /**
3007 * e-SCOTT 会員パスワード生成
3008 *
3009 * @return string
3010 */
3011 public function make_kaiin_pass() {
3012 $passwd = sprintf( '%012d', mt_rand() );
3013 return $passwd;
3014 }
3015
3016 /**
3017 * e-SCOTT 会員�
3018 報登録・更新
3019 *
3020 * @param array $param_list Parameters.
3021 * @return array
3022 */
3023 public function escott_member_process( $param_list = array() ) {
3024 global $usces;
3025
3026 $member = $usces->get_member();
3027 $acting_opts = $this->get_acting_settings();
3028 $params = array();
3029 $params['send_url'] = $acting_opts['send_url_member'];
3030 $params['param_list'] = $param_list;
3031
3032 $response_member = array( 'ResponseCd' => '' );
3033 $kaiin_id = $this->get_quick_kaiin_id( $member['ID'] );
3034 $kaiin_pass = $this->get_quick_pass( $member['ID'] );
3035
3036 if ( empty( $kaiin_id ) || empty( $kaiin_pass ) ) {
3037 $kaiin_id = $this->make_kaiin_id( $member['ID'] );
3038 $kaiin_pass = $this->make_kaiin_pass();
3039 $params['param_list']['OperateId'] = '4MemAdd';
3040 $params['param_list']['KaiinId'] = $kaiin_id;
3041 $params['param_list']['KaiinPass'] = $kaiin_pass;
3042 if ( ! isset( $param_list['Token'] ) && isset( $_POST['cardno'] ) && isset( $_POST['expyy'] ) && isset( $_POST['expmm'] ) ) {
3043 $params['param_list']['CardNo'] = trim( filter_input( INPUT_POST, 'cardno', FILTER_DEFAULT ) );
3044 $params['param_list']['CardExp'] = substr( filter_input( INPUT_POST, 'expyy', FILTER_DEFAULT ), 2 ) . filter_input( INPUT_POST, 'expmm', FILTER_DEFAULT );
3045 if ( 'on' === $acting_opts['seccd'] && isset( $_POST['seccd'] ) ) {
3046 $params['param_list']['SecCd'] = trim( filter_input( INPUT_POST, 'seccd', FILTER_DEFAULT ) );
3047 }
3048 }
3049 /* e-SCOTT 新規会員登録 */
3050 $response_member = $this->connection( $params );
3051 if ( 'OK' === $response_member['ResponseCd'] ) {
3052 $usces->set_member_meta_value( $this->quick_key_pre . '_member_id', $kaiin_id, $member['ID'] );
3053 $usces->set_member_meta_value( $this->quick_key_pre . '_member_passwd', $kaiin_pass, $member['ID'] );
3054 $response_member['KaiinId'] = $kaiin_id;
3055 $response_member['KaiinPass'] = $kaiin_pass;
3056 $response_member['use_token'] = true;
3057 }
3058 } else {
3059 $params['param_list']['OperateId'] = '4MemRefM';
3060 $params['param_list']['KaiinId'] = $kaiin_id;
3061 $params['param_list']['KaiinPass'] = $kaiin_pass;
3062 /* e-SCOTT 会員�
3063 �会 */
3064 $response_member = $this->connection( $params );
3065 if ( 'OK' === $response_member['ResponseCd'] ) {
3066 $card_change = filter_input( INPUT_POST, 'card_change', FILTER_DEFAULT );
3067 if ( '1' === $card_change ) {
3068 $params['param_list']['OperateId'] = '4MemChg';
3069 $cardno = filter_input( INPUT_POST, 'cardno', FILTER_DEFAULT );
3070 if ( ! isset( $param_list['Token'] ) && '8888888888888888' !== $cardno && isset( $_POST['expyy'] ) && isset( $_POST['expmm'] ) ) {
3071 $params['param_list']['CardNo'] = trim( $cardno );
3072 $params['param_list']['CardExp'] = substr( filter_input( INPUT_POST, 'expyy', FILTER_DEFAULT ), 2 ) . filter_input( INPUT_POST, 'expmm', FILTER_DEFAULT );
3073 if ( 'on' === $acting_opts['seccd'] && isset( $_POST['seccd'] ) ) {
3074 $params['param_list']['SecCd'] = trim( filter_input( INPUT_POST, 'seccd', FILTER_DEFAULT ) );
3075 }
3076 }
3077 /* e-SCOTT 会員更新 */
3078 $response_member = $this->connection( $params );
3079 $response_member['KaiinId'] = $kaiin_id;
3080 $response_member['KaiinPass'] = $kaiin_pass;
3081 $response_member['use_token'] = true;
3082 } else {
3083 $response_member['KaiinId'] = $kaiin_id;
3084 $response_member['KaiinPass'] = $kaiin_pass;
3085 $response_member['use_token'] = false;
3086 }
3087 }
3088 }
3089 return $response_member;
3090 }
3091
3092 /**
3093 * e-SCOTT 会員�
3094 報登録
3095 *
3096 * @param int $member_id Member ID.
3097 * @return array
3098 */
3099 public function escott_member_register( $member_id ) {
3100 global $usces;
3101
3102 $response_member = array( 'ResponseCd' => '' );
3103 $acting_opts = $this->get_acting_settings();
3104 $transaction_date = $this->get_transaction_date();
3105 $param_list = array();
3106 $params = array();
3107
3108 $post_data = wp_unslash( $_POST );
3109
3110 /* �
3111 �通部 */
3112 $param_list['MerchantId'] = $acting_opts['merchant_id'];
3113 $param_list['MerchantPass'] = $acting_opts['merchant_pass'];
3114 $param_list['TransactionDate'] = $transaction_date;
3115 $param_list['MerchantFree3'] = $this->merchantfree3;
3116 $param_list['TenantId'] = $acting_opts['tenant_id'];
3117 if ( 'on' === $acting_opts['sec3d_activate'] && isset( $post_data['rand'] ) ) {
3118 $param_list['MerchantFree1'] = $post_data['rand'];
3119 }
3120
3121 if ( 'on' === $acting_opts['sec3d_activate'] && isset( $post_data['done3d_member'] ) ) {
3122 if ( isset( $post_data['SecureResultCode'] ) && isset( $post_data['ResponseCd'] ) && 'OK' === $post_data['ResponseCd'] ) {
3123 $response_member = $this->escott_member_reference( $member_id );
3124 if ( 'OK' !== $response_member['ResponseCd'] ) {
3125 $usces->del_member_meta( $this->quick_key_pre . '_member_id', $member_id );
3126 $usces->del_member_meta( $this->quick_key_pre . '_member_passwd', $member_id );
3127 }
3128 } else {
3129 $usces->del_member_meta( $this->quick_key_pre . '_member_id', $member_id );
3130 $usces->del_member_meta( $this->quick_key_pre . '_member_passwd', $member_id );
3131 }
3132 } else {
3133 $token = filter_input( INPUT_POST, 'token' );
3134 if ( ! empty( $token ) ) {
3135 $param_list['Token'] = $token;
3136 $param_list['OperateId'] = '1TokenSearch';
3137 $params['send_url'] = $acting_opts['send_url_token'];
3138 $params['param_list'] = $param_list;
3139 /* e-SCOTT トークンステータス参�
3140 � */
3141 $response_token = $this->connection( $params );
3142 if ( 'OK' !== $response_token['ResponseCd'] || 'OK' !== $response_token['TokenResponseCd'] ) {
3143 $tokenresponsecd = '';
3144 if ( isset( $response_token['TokenResponseCd'] ) ) {
3145 $responsecd = explode( '|', $response_token['ResponseCd'] . '|' . $response_token['TokenResponseCd'] );
3146 } else {
3147 $responsecd = explode( '|', $response_token['ResponseCd'] );
3148 }
3149 foreach ( (array) $responsecd as $cd ) {
3150 if ( 'OK' !== $cd ) {
3151 $response_token[ $cd ] = $this->response_message( $cd );
3152 $tokenresponsecd .= $cd . '|';
3153 }
3154 }
3155 $response_token['ResponseCd'] = rtrim( $tokenresponsecd, '|' );
3156 return $response_token;
3157 }
3158 unset( $params['param_list'] );
3159 }
3160
3161 /* 3Dセキュア認証画面へリダイレクト */
3162 if ( 'on' === $acting_opts['sec3d_activate'] ) {
3163 $this->certification_3dsecure_member( $param_list, $post_data, $member_id, 'member_register_settlement' );
3164 }
3165 }
3166
3167 if ( 'on' !== $acting_opts['sec3d_activate'] ) {
3168 if ( isset( $param_list['MerchantFree2'] ) ) {
3169 unset( $param_list['MerchantFree2'] );
3170 }
3171
3172 $kaiin_id = $this->make_kaiin_id( $member_id );
3173 $kaiin_pass = $this->make_kaiin_pass();
3174
3175 $params['send_url'] = $acting_opts['send_url_member'];
3176 $params['param_list'] = array_merge(
3177 $param_list,
3178 array(
3179 'OperateId' => '4MemAdd',
3180 'KaiinId' => $kaiin_id,
3181 'KaiinPass' => $kaiin_pass,
3182 )
3183 );
3184
3185 /* e-SCOTT 新規会員登録 */
3186 $response_member = $this->connection( $params );
3187 if ( 'OK' === $response_member['ResponseCd'] ) {
3188 $usces->set_member_meta_value( $this->quick_key_pre . '_member_id', $kaiin_id, $member_id );
3189 $usces->set_member_meta_value( $this->quick_key_pre . '_member_passwd', $kaiin_pass, $member_id );
3190 $response_member['KaiinId'] = $kaiin_id;
3191 $response_member['KaiinPass'] = $kaiin_pass;
3192 }
3193 }
3194 return $response_member;
3195 }
3196
3197 /**
3198 * e-SCOTT 会員�
3199 報更新
3200 *
3201 * @param int $member_id Member ID.
3202 * @return array
3203 */
3204 public function escott_member_update( $member_id ) {
3205 global $usces;
3206
3207 $response_member = array( 'ResponseCd' => '' );
3208 $acting_opts = $this->get_acting_settings();
3209 $kaiin_id = $this->get_quick_kaiin_id( $member_id );
3210 $kaiin_pass = $this->get_quick_pass( $member_id );
3211
3212 $post_data = wp_unslash( $_POST );
3213
3214 if ( 'on' === $acting_opts['sec3d_activate'] && isset( $post_data['done3d_member'] ) ) {
3215 if ( isset( $post_data['SecureResultCode'] ) && isset( $post_data['ResponseCd'] ) && 'OK' === $post_data['ResponseCd'] ) {
3216 $response_member = $this->escott_member_reference( $member_id );
3217 } else {
3218 usces_log( '[' . $this->acting_name . '] 4MemChg NG : ' . print_r( $post_data, true ), 'acting_transaction.log' );
3219 }
3220 } else {
3221 if ( $kaiin_id && $kaiin_pass ) {
3222 $acting_opts = $this->get_acting_settings();
3223 $transaction_date = $this->get_transaction_date();
3224 $param_list = array();
3225 $params = array();
3226
3227 /* �
3228 �通部 */
3229 $param_list['MerchantId'] = $acting_opts['merchant_id'];
3230 $param_list['MerchantPass'] = $acting_opts['merchant_pass'];
3231 $param_list['TransactionDate'] = $transaction_date;
3232 $param_list['MerchantFree3'] = $this->merchantfree3;
3233 $param_list['TenantId'] = $acting_opts['tenant_id'];
3234 if ( 'on' === $acting_opts['sec3d_activate'] && isset( $post_data['rand'] ) ) {
3235 $param_list['MerchantFree1'] = $post_data['rand'];
3236 }
3237
3238 $token = filter_input( INPUT_POST, 'token', FILTER_DEFAULT );
3239 if ( ! empty( $token ) ) {
3240 $param_list['Token'] = $token;
3241 } else {
3242 if ( ! empty( $_POST['cardno'] ) ) {
3243 $param_list['CardNo'] = trim( filter_input( INPUT_POST, 'cardno', FILTER_DEFAULT ) );
3244 }
3245 if ( 'on' === $acting_opts['seccd'] && ! empty( $_POST['seccd'] ) ) {
3246 $param_list['SecCd'] = trim( filter_input( INPUT_POST, 'seccd', FILTER_DEFAULT ) );
3247 }
3248 if ( ! empty( $_POST['expyy'] ) && ! empty( $_POST['expmm'] ) ) {
3249 $param_list['CardExp'] = substr( filter_input( INPUT_POST, 'expyy', FILTER_DEFAULT ), 2 ) . filter_input( INPUT_POST, 'expmm', FILTER_DEFAULT );
3250 }
3251 }
3252
3253 /* 3Dセキュア認証画面へリダイレクト */
3254 if ( 'on' === $acting_opts['sec3d_activate'] ) {
3255 $this->certification_3dsecure_member( $param_list, $post_data, $member_id, 'member_update_settlement' );
3256 }
3257 }
3258 }
3259
3260 if ( 'on' !== $acting_opts['sec3d_activate'] ) {
3261 if ( $kaiin_id && $kaiin_pass ) {
3262 if ( isset( $param_list['MerchantFree2'] ) ) {
3263 unset( $param_list['MerchantFree2'] );
3264 }
3265 $params['send_url'] = $acting_opts['send_url_member'];
3266 $params['param_list'] = array_merge(
3267 $param_list,
3268 array(
3269 'OperateId' => '4MemChg',
3270 'KaiinId' => $kaiin_id,
3271 'KaiinPass' => $kaiin_pass,
3272 )
3273 );
3274 /* e-SCOTT 会員更新 */
3275 $response_member = $this->connection( $params );
3276 if ( 'OK' !== $response_member['ResponseCd'] ) {
3277 usces_log( '[' . $this->acting_name . '] 4MemChg NG : ' . print_r( $response_member, true ), 'acting_transaction.log' );
3278 }
3279 }
3280 }
3281 return $response_member;
3282 }
3283
3284 /**
3285 * e-SCOTT 会員�
3286 報削除
3287 *
3288 * @param int $member_id Member ID.
3289 * @param bool $forced Forced deletion.
3290 * @return array
3291 */
3292 public function escott_member_delete( $member_id, $forced = false ) {
3293 global $usces;
3294
3295 $response_member = array( 'ResponseCd' => '' );
3296 $kaiin_id = $this->get_quick_kaiin_id( $member_id );
3297 $kaiin_pass = $this->get_quick_pass( $member_id );
3298
3299 if ( $kaiin_id && $kaiin_pass ) {
3300
3301 if ( $forced ) { /* 強制削除 */
3302 $usces->del_member_meta( $this->quick_key_pre . '_member_id', $member_id );
3303 $usces->del_member_meta( $this->quick_key_pre . '_member_passwd', $member_id );
3304
3305 } else {
3306 $acting_opts = $this->get_acting_settings();
3307 $transaction_date = $this->get_transaction_date();
3308 $param_list = array();
3309 $params = array();
3310
3311 /* �
3312 �通部 */
3313 $param_list['MerchantId'] = $acting_opts['merchant_id'];
3314 $param_list['MerchantPass'] = $acting_opts['merchant_pass'];
3315 $param_list['TransactionDate'] = $transaction_date;
3316 $param_list['MerchantFree3'] = $this->merchantfree3;
3317 $param_list['TenantId'] = $acting_opts['tenant_id'];
3318 $params['send_url'] = $acting_opts['send_url_member'];
3319 $params['param_list'] = array_merge(
3320 $param_list,
3321 array(
3322 'OperateId' => '4MemInval',
3323 'KaiinId' => $kaiin_id,
3324 'KaiinPass' => $kaiin_pass,
3325 )
3326 );
3327 /* e-SCOTT 会員無効 */
3328 $response_member = $this->connection( $params );
3329 if ( 'OK' === $response_member['ResponseCd'] ) {
3330 $params['param_list'] = array_merge(
3331 $param_list,
3332 array(
3333 'OperateId' => '4MemDel',
3334 'KaiinId' => $kaiin_id,
3335 'KaiinPass' => $kaiin_pass,
3336 )
3337 );
3338 /* e-SCOTT 会員削除 */
3339 $response_member = array(
3340 'ResponseCd' => '',
3341 );
3342 $response_member = $this->connection( $params );
3343 if ( 'OK' === $response_member['ResponseCd'] ) {
3344 $usces->del_member_meta( $this->quick_key_pre . '_member_id', $member_id );
3345 $usces->del_member_meta( $this->quick_key_pre . '_member_passwd', $member_id );
3346 } else {
3347 usces_log( '[' . $this->acting_name . '] 4MemDel NG : ' . print_r( $response_member, true ), 'acting_transaction.log' );
3348 }
3349 } else {
3350 usces_log( '[' . $this->acting_name . '] 4MemInval NG : ' . print_r( $response_member, true ), 'acting_transaction.log' );
3351 }
3352 }
3353 }
3354 return $response_member;
3355 }
3356
3357 /**
3358 * e-SCOTT 会員�
3359 報�
3360 �会
3361 *
3362 * @param int $member_id Member ID.
3363 * @param string $kaiin_id KaiinId.
3364 * @param string $kaiin_pass KaiinPass.
3365 * @return array
3366 */
3367 public function escott_member_reference( $member_id, $kaiin_id = '', $kaiin_pass = '' ) {
3368 $response_member = array( 'ResponseCd' => '' );
3369 if ( empty( $kaiin_id ) ) {
3370 $kaiin_id = $this->get_quick_kaiin_id( $member_id );
3371 }
3372 if ( empty( $kaiin_pass ) ) {
3373 $kaiin_pass = $this->get_quick_pass( $member_id );
3374 }
3375
3376 if ( $kaiin_id && $kaiin_pass ) {
3377 $acting_opts = $this->get_acting_settings();
3378 $transaction_date = $this->get_transaction_date();
3379 $param_list = array();
3380 $params = array();
3381
3382 /* �
3383 �通部 */
3384 $param_list['MerchantId'] = $acting_opts['merchant_id'];
3385 $param_list['MerchantPass'] = $acting_opts['merchant_pass'];
3386 $param_list['TransactionDate'] = $transaction_date;
3387 $param_list['MerchantFree3'] = $this->merchantfree3;
3388 $param_list['TenantId'] = $acting_opts['tenant_id'];
3389 $params['send_url'] = $acting_opts['send_url_member'];
3390 $params['param_list'] = array_merge(
3391 $param_list,
3392 array(
3393 'OperateId' => '4MemRefM',
3394 'KaiinId' => $kaiin_id,
3395 'KaiinPass' => $kaiin_pass,
3396 )
3397 );
3398 /* e-SCOTT 会員�
3399 �会 */
3400 $response_member = $this->connection( $params );
3401 if ( 'OK' === $response_member['ResponseCd'] ) {
3402 $response_member['KaiinId'] = $kaiin_id;
3403 $response_member['KaiinPass'] = $kaiin_pass;
3404 }
3405 }
3406 return $response_member;
3407 }
3408
3409 /**
3410 * e-SCOTT トークン検索
3411 *
3412 * @param string $token Token.
3413 * @return array
3414 */
3415 public function escott_token_search( $token ) {
3416 $acting_opts = $this->get_acting_settings();
3417 $transaction_date = $this->get_transaction_date();
3418 $param_list = array();
3419 $params = array();
3420
3421 /* �
3422 �通部 */
3423 $param_list['MerchantId'] = $acting_opts['merchant_id'];
3424 $param_list['MerchantPass'] = $acting_opts['merchant_pass'];
3425 $param_list['TransactionDate'] = $transaction_date;
3426 $param_list['MerchantFree3'] = $this->merchantfree3;
3427 $param_list['TenantId'] = $acting_opts['tenant_id'];
3428 $params['send_url'] = $acting_opts['send_url_token'];
3429 $params['param_list'] = array_merge(
3430 $param_list,
3431 array(
3432 'OperateId' => '1TokenSearch',
3433 'Token' => $token,
3434 )
3435 );
3436
3437 /* e-SCOTT トークンステータス参�
3438 � */
3439 $response_token = $this->connection( $params );
3440 if ( 'OK' !== $response_token['ResponseCd'] || 'OK' !== $response_token['TokenResponseCd'] ) {
3441 $tokenresponsecd = '';
3442 if ( isset( $response_token['TokenResponseCd'] ) ) {
3443 $responsecd = explode( '|', $response_token['ResponseCd'] . '|' . $response_token['TokenResponseCd'] );
3444 } else {
3445 $responsecd = explode( '|', $response_token['ResponseCd'] );
3446 }
3447 foreach ( (array) $responsecd as $cd ) {
3448 if ( 'OK' !== $cd ) {
3449 $response_token[ $cd ] = $this->response_message( $cd );
3450 $tokenresponsecd .= $cd . '|';
3451 }
3452 }
3453 $tokenresponsecd = rtrim( $tokenresponsecd, '|' );
3454 }
3455 return $response_token;
3456 }
3457
3458 /**
3459 * 処理区分名称
3460 *
3461 * @param string $operateid OperateId.
3462 * @return string
3463 */
3464 public function get_operate_name( $operateid ) {
3465 $operate_name = '';
3466 switch ( $operateid ) {
3467 case '1Check': /* カードチェック */
3468 $operate_name = __( 'Card check', 'usces' );
3469 break;
3470 case '1Auth': /* 与信 */
3471 $operate_name = __( 'Credit', 'usces' );
3472 break;
3473 case '1Capture': /* 売上計上 */
3474 $operate_name = __( 'Sales recorded', 'usces' );
3475 break;
3476 case '1Gathering': /* 与信売上計上 */
3477 case '11Gathering':
3478 $operate_name = __( 'Credit sales', 'usces' );
3479 break;
3480 case '1Change': /* 利用額変更 */
3481 $operate_name = __( 'Change spending amount', 'usces' );
3482 break;
3483 case '1Delete': /* 取消 */
3484 case '11Delete':
3485 $operate_name = __( 'Unregister', 'usces' );
3486 break;
3487 case '1Search': /* 取引参�
3488 � */
3489 case '11Search':
3490 $operate_name = __( 'Transaction reference', 'usces' );
3491 break;
3492 case '1ReAuth': /* 再オーソリ */
3493 $operate_name = __( 'Re-authorization', 'usces' );
3494 break;
3495 case '2Add': /* 登録 */
3496 $operate_name = __( 'Register' );
3497 break;
3498 case '2Chg': /* 変更 */
3499 $operate_name = __( 'Change' );
3500 break;
3501 case '2Del': /* 削除 */
3502 $operate_name = __( 'Unregister', 'usces' );
3503 break;
3504 case '4MemAdd': /* 会員新規 */
3505 $operate_name = __( 'New member', 'usces' );
3506 break;
3507 case '4MemChg': /* 会員更新 */
3508 $operate_name = __( 'Update member', 'usces' );
3509 break;
3510 case '4MemInval': /* 会員無効 */
3511 $operate_name = __( 'Invalid member', 'usces' );
3512 break;
3513 case '4MemRef': /* 会員参�
3514 � */
3515 case '4MemRefM': /* 会員参�
3516 �(マスキング) */
3517 case '4MemRefMulti': /* 会員参�
3518 �(同一カード番号返戻) */
3519 case '4MemRefToken': /* トークン会員参�
3520 � */
3521 $operate_name = __( 'Member reference', 'usces' );
3522 break;
3523 case '4MemUnInval': /* 会員無効解除 */
3524 $operate_name = __( 'Cancellation of member', 'usces' );
3525 break;
3526 case '4MemDel': /* 会員削除 */
3527 $operate_name = __( 'Delete member', 'usces' );
3528 break;
3529 case '5Auth': /* 外貨与信 */
3530 $operate_name = __( 'Foreign currency credit', 'usces' );
3531 break;
3532 case '5Gathering': /* 外貨与信売上確定 */
3533 $operate_name = __( 'Foreign currency credit sales confirmed', 'usces' );
3534 break;
3535 case '5Capture': /* 外貨売上確定 */
3536 $operate_name = __( 'Foreign currency sales fixed', 'usces' );
3537 break;
3538 case '5Delete': /* 外貨取消 */
3539 $operate_name = __( 'Foreign currency cancellation', 'usces' );
3540 break;
3541 case '5OpeUnInval': /* 外貨取引保留解除 */
3542 $operate_name = __( 'Withdrawal of foreign currency transactions', 'usces' );
3543 break;
3544 case 'receipted': /* �
3545 �金 */
3546 $operate_name = __( 'Payment', 'usces' );
3547 break;
3548 case 'expiration': /* 期限切れ */
3549 $operate_name = __( 'Expired', 'usces' );
3550 break;
3551 }
3552 return $operate_name;
3553 }
3554
3555 /**
3556 * 収納機関名称
3557 *
3558 * @param string $cvs_cd CvsCd.
3559 * @return string
3560 */
3561 protected function get_cvs_name( $cvs_cd ) {
3562 $cvs_name = '';
3563 switch ( trim( $cvs_cd ) ) {
3564 case 'LSN':
3565 $cvs_name = 'ローソン';
3566 break;
3567 case 'FAM':
3568 $cvs_name = 'ファミリーマート';
3569 break;
3570 case 'SAK':
3571 $cvs_name = 'サンクス';
3572 break;
3573 case 'CCK':
3574 $cvs_name = 'サークルK';
3575 break;
3576 case 'ATM':
3577 $cvs_name = 'Pay-easy(ATM)';
3578 break;
3579 case 'ONL':
3580 $cvs_name = 'Pay-easy(オンライン)';
3581 break;
3582 case 'LNK':
3583 $cvs_name = 'Pay-easy(�
3584 報リンク)';
3585 break;
3586 case 'SEV':
3587 $cvs_name = 'セブンイレブン';
3588 break;
3589 case 'MNS':
3590 $cvs_name = 'ミニストップ';
3591 break;
3592 case 'DAY':
3593 $cvs_name = 'デイリーヤマザキ';
3594 break;
3595 case 'EBK':
3596 $cvs_name = '楽天銀行';
3597 break;
3598 case 'JNB':
3599 $cvs_name = 'ジャパンネット銀行';
3600 break;
3601 case 'EDY':
3602 $cvs_name = 'Edy';
3603 break;
3604 case 'SUI':
3605 $cvs_name = 'Suica';
3606 break;
3607 case 'FFF':
3608 $cvs_name = 'スリーエフ';
3609 break;
3610 case 'JIB':
3611 $cvs_name = 'じぶん銀行';
3612 break;
3613 case 'SNB':
3614 $cvs_name = '住信SBIネット銀行';
3615 break;
3616 case 'SCM':
3617 $cvs_name = 'セイコーマート';
3618 break;
3619 case 'JPM':
3620 $cvs_name = 'JCBプレモ';
3621 break;
3622 }
3623 return $cvs_name;
3624 }
3625
3626 /**
3627 * 手数料名称
3628 *
3629 * @param string $fee_type Fee type.
3630 * @return string
3631 */
3632 protected function get_fee_name( $fee_type ) {
3633 $fee_name = '';
3634 if ( 'fix' === $fee_type ) {
3635 $fee_name = __( 'Fixation', 'usces' );
3636 } elseif ( 'change' === $fee_type ) {
3637 $fee_name = __( 'Variable', 'usces' );
3638 }
3639 return $fee_name;
3640 }
3641
3642 /**
3643 * エラーコード対応メッセージ
3644 *
3645 * @param string $code Error code.
3646 * @return string
3647 */
3648 public function response_message( $code ) {
3649 switch ( $code ) {
3650 case 'K01': /* 当該 OperateId の設定値を網�
3651 しておりません。(送信�
3652 目不足、または�
3653 目エラー)設定値をご確認の上、再処理行ってください。(オンライン取引電文精査エラー) */
3654 $message = __( 'Online trading message scrutiny error', 'usces' );
3655 break;
3656 case 'K02': /* 形式エラーです。 設定値をご確認の上、再処理を行ってください。(�
3657 目「MerchantId」精査エラー) */
3658 $message = __( '\'MerchantId\' scrutiny error', 'usces' );
3659 break;
3660 case 'K03': /* 形式エラーです。 設定値をご確認の上、再処理を行ってください。(�
3661 目「MerchantPass」精査エラー) */
3662 $message = __( '\'MerchantPass\' scrutiny error', 'usces' );
3663 break;
3664 case 'K04': /* 形式エラーです。 設定値をご確認の上、再処理を行ってください。(�
3665 目「TenantId」精査エラー) */
3666 $message = __( '\'TenantId\' scrutiny error', 'usces' );
3667 break;
3668 case 'K05': /* 形式エラーです。 設定値をご確認の上、再処理を行ってください。(�
3669 目「TransactionDate」精査エラー) */
3670 $message = __( '\'TransactionDate\' scrutiny error', 'usces' );
3671 break;
3672 case 'K06': /* 形式エラーです。 設定値をご確認の上、再処理を行ってください。(�
3673 目「OperateId」精査エラー) */
3674 $message = __( '\'OperateId\' scrutiny error', 'usces' );
3675 break;
3676 case 'K07': /* 形式エラーです。 設定値をご確認の上、再処理を行ってください。(�
3677 目「MerchantFree1」精査エラー) */
3678 $message = __( '\'MerchantFree1\' scrutiny error', 'usces' );
3679 break;
3680 case 'K08': /* 形式エラーです。 設定値をご確認の上、再処理を行ってください。(�
3681 目「MerchantFree2」精査エラー) */
3682 $message = __( '\'MerchantFree2\' scrutiny error', 'usces' );
3683 break;
3684 case 'K09': /* 形式エラーです。 設定値をご確認の上、再処理を行ってください。(�
3685 目「MerchantFree3」精査エラー) */
3686 $message = __( '\'MerchantFree3\' scrutiny error', 'usces' );
3687 break;
3688 case 'K10': /* 形式エラーです。 設定値をご確認の上、再処理を行ってください。(�
3689 目「ProcessId」精査エラー) */
3690 $message = __( '\'ProcessId\' scrutiny error', 'usces' );
3691 break;
3692 case 'K11': /* 形式エラーです。 設定値をご確認の上、再処理を行ってください。(�
3693 目「ProcessPass」精査エラー) */
3694 $message = __( '\'ProcessPass\' scrutiny error', 'usces' );
3695 break;
3696 case 'K12': /* Master 電文で発行された「ProcessId」または「ProcessPass」では無いことを意味します。設定値をご確認の上、再処理行ってください。(�
3697 目「ProcessId」または「ProcessPass」不整合エラー) */
3698 $message = __( '\'ProcessId\' or \'ProcessPass\' inconsistency error', 'usces' );
3699 break;
3700 case 'K14': /* 要求された Process 電文の「OperateId」が要求対象外です。例:「1Delete:取消」に対して再度「1Delete:取消」を送信したなど。(OperateId のステータス遷移不整合) */
3701 $message = __( 'Transition inconsistency of OperateId status', 'usces' );
3702 break;
3703 case 'K15': /* 返戻対象となる会員の数が、最大件(30 件)を�
3704 えました。(会員参�
3705 �(同一カード番号返戻)時の返戻対象会員数エラー) */
3706 $message = __( 'Error of the numbers of members subject to return on membership reference (same card number return)', 'usces' );
3707 break;
3708 case 'K20': /* 形式エラーです。 設定値をご確認の上、再処理を行ってください。(�
3709 目「CardNo」精査エラー) */
3710 $message = __( '\'CardNo\' scrutiny error', 'usces' );
3711 break;
3712 case 'K21': /* 形式エラーです。 設定値をご確認の上、再処理を行ってください。(�
3713 目「CardExp」精査エラー) */
3714 $message = __( '\'CardExp\' scrutiny error', 'usces' );
3715 break;
3716 case 'K22': /* 形式エラーです。 設定値をご確認の上、再処理を行ってください。(�
3717 目「PayType」精査エラー) */
3718 $message = __( '\'PayType\' scrutiny error', 'usces' );
3719 break;
3720 case 'K23': /* 半角数字ではないこと、または、利用額変更で�
3721 �取引と金額が同一となっていることを意味します。 8桁以下(0 以外)の半角数字であること、利用額変更で�
3722 �取引と金額が同一でないことをご確認の上、再処理を行ってください。(�
3723 目「Amount」精査エラー) */
3724 $message = __( '\'Amount\' scrutiny error', 'usces' );
3725 break;
3726 case 'K24': /* 形式エラーです。 設定値をご確認の上、再処理を行ってください。(�
3727 目「SecCd」精査エラー) */
3728 $message = __( '\'SecCd\' scrutiny error', 'usces' );
3729 break;
3730 case 'K28': /* オンライン収納で「半角数字ハイフン≦13桁では無い」設定値を確認の上、再処理を行ってください。(�
3731 目「TelNo」精査エラー) */
3732 $message = __( '\'TelNo\' scrutiny error', 'usces' );
3733 break;
3734 case 'K30': /* 形式エラーです。設定値をご確認の上、再処理を行ってください。(�
3735 目「MessageVersionNo3D」精査エラー) */
3736 $message = __( '\'MessageVersionNo3D\' scrutiny error', 'usces' );
3737 break;
3738 case 'K31': /* 形式エラーです。設定値をご確認の上、再処理を行ってください。(�
3739 目「TransactionId3D」精査エラー) */
3740 $message = __( '\'TransactionId3D\' scrutiny error', 'usces' );
3741 break;
3742 case 'K32': /* 形式エラーです。設定値をご確認の上、再処理を行ってください。(�
3743 目「EncordXId3D」精査エラー) */
3744 $message = __( '\'EncordXId3D\' scrutiny error', 'usces' );
3745 break;
3746 case 'K33': /* 形式エラーです。設定値をご確認の上、再処理を行ってください。(�
3747 目「TransactionStatus3D」精査エラー) */
3748 $message = __( '\'TransactionStatus3D\' scrutiny error', 'usces' );
3749 break;
3750 case 'K34': /* 形式エラーです。設定値をご確認の上、再処理を行ってください。(�
3751 目「CAVVAlgorithm3D」精査エラー) */
3752 $message = __( '\'CAVVAlgorithm3D\' scrutiny error', 'usces' );
3753 break;
3754 case 'K35': /* 形式エラーです。設定値をご確認の上、再処理を行ってください。(�
3755 目「CAVV3D」精査エラー) */
3756 $message = __( '\'CAVV3D\' scrutiny error', 'usces' );
3757 break;
3758 case 'K36': /* 形式エラーです。設定値をご確認の上、再処理を行ってください。(�
3759 目「ECI3D」精査エラー) */
3760 $message = __( '\'ECI3D\' scrutiny error', 'usces' );
3761 break;
3762 case 'K37': /* 形式エラーです。設定値をご確認の上、再処理を行ってください。(�
3763 目「PANCard3D」精査エラー) */
3764 $message = __( '\'PANCard3D\' scrutiny error', 'usces' );
3765 break;
3766 case 'K39': /* YYYMMDD形式では無い、または未来日付あることを意味します。設定値をご確認の上、再処理を行ってください。(�
3767 目「SalesDate」精査エラー) */
3768 $message = __( '\'SalesDate\' scrutiny error', 'usces' );
3769 break;
3770 case 'K40': /* 取引は OK 判定でしたが McSecCd が「1」アンマッチです。(セキュリティコードアンマッチ検証 NG) */
3771 $message = __( 'Security code error', 'usces' );
3772 break;
3773 case 'K45': /* 形式エラーです。 設定値をご確認の上、再処理を行ってください。(�
3774 目「KaiinId」精査エラー) */
3775 $message = __( '\'KaiinId\' scrutiny error', 'usces' );
3776 break;
3777 case 'K46': /* 形式エラーです。 設定値をご確認の上、再処理を行ってください。(�
3778 目「KaiinPass」精査エラー) */
3779 $message = __( '\'KaiinPass\' scrutiny error', 'usces' );
3780 break;
3781 case 'K47': /* 形式エラーです。 設定値をご確認の上、再処理を行ってください。(�
3782 目「NewKaiinPass」精査エラー) */
3783 $message = __( '\'NewKaiinPass\' scrutiny error', 'usces' );
3784 break;
3785 case 'K48': /* 形式エラーです。 設定値をご確認の上、再処理を行ってください。(�
3786 目「EnableCheckUseKbn」精査エラー) */
3787 $message = __( '\'EnableCheckUseKbn\' scrutiny error', 'usces' );
3788 break;
3789 case 'K50': /* 形式エラーです。 設定値をご確認の上、再処理を行ってください。(�
3790 目「PayLimit」精査エラー) */
3791 $message = __( '\'PayLimit\' scrutiny error', 'usces' );
3792 break;
3793 case 'K51': /* 形式エラーです。 設定値をご確認の上、再処理を行ってください。(�
3794 目「NameKanji」精査エラー) */
3795 $message = __( '\'NameKanji\' scrutiny error', 'usces' );
3796 break;
3797 case 'K52': /* 形式エラーです。 設定値をご確認の上、再処理を行ってください。(�
3798 目「NameKana」精査エラー) */
3799 $message = __( '\'NameKana\' scrutiny error', 'usces' );
3800 break;
3801 case 'K53': /* 形式エラーです。 設定値をご確認の上、再処理を行ってください。(�
3802 目「ShouhinName」精査エラー) */
3803 $message = __( '\'ShouhinName\' scrutiny error', 'usces' );
3804 break;
3805 case 'K54': /* 形式エラーです。 設定値をご確認の上、再処理を行ってください。(�
3806 目「フリーエリア:Free1~7」精査エラー) */
3807 $message = __( '\'Free1 to 7\' scrutiny error', 'usces' );
3808 break;
3809 case 'K55': /* 形式エラーです。 設定値をご確認の上、再処理を行ってください。(�
3810 目「Comment」精査エラー) */
3811 $message = __( '\'Comment\' scrutiny error', 'usces' );
3812 break;
3813 case 'K60': /* 形式エラーです。 設定値をご確認の上、再処理を行ってください。(�
3814 目「戻り�
3815 � URL:ReturnURL」精査エラー) */
3816 $message = __( '\'Return URL: ReturnURL\' scrutiny error', 'usces' );
3817 break;
3818 case 'K68': /* 会員登録機能が未設定となっております。(会員の登録機能は利用できません) */
3819 $message = __( 'Member registration function is unavailabe.', 'usces' );
3820 break;
3821 case 'K69': /* この会員ID はすでに使用されています。(会員ID の重複エラー) */
3822 $message = __( 'Duplicate error of member ID', 'usces' );
3823 break;
3824 case 'K70': /* 会員削除電文に対して会員が無効状�
3825 �ではありません。(会員が無効状�
3826 �ではありません) */
3827 $message = __( 'Member is not in invalid state.', 'usces' );
3828 break;
3829 case 'K71': /* 会員ID・パスワードが一致しません。(会員ID の認証エラー) */
3830 $message = __( 'Member ID authentication error', 'usces' );
3831 break;
3832 case 'K73': /* 会員無効解除電文に対して会員が既に有効となっています。(会員が既に有効となっています) */
3833 $message = __( 'The member is already active.', 'usces' );
3834 break;
3835 case 'K74': /* 会員認証に連続して失敗し、ロックアウトされました。(会員認証に連続して失敗し、ロックアウトされました) */
3836 $message = __( 'Member authentication failed consecutively and was locked out.', 'usces' );
3837 break;
3838 case 'K75': /* 会員は有効ではありません。 */
3839 $message = __( 'The member is not valid.', 'usces' );
3840 break;
3841 case 'K79': /* 現在は Login 無効または会員無効状�
3842 �です。(会員判定エラー(Login 無効または会員無効)) */
3843 $message = __( 'Member determination error (Login invalid or Member invalid)', 'usces' );
3844 break;
3845 case 'K80': /* Master 電文は会員ID が設定されています。Process 電文も会員ID を設定してください。(会員ID 設定不一致(設定が�
3846 要)) */
3847 $message = __( 'Mismatch of Member ID setting (required the setting)', 'usces' );
3848 break;
3849 case 'K81': /* Master 電文は会員 ID が未設定です。Process 電文の会員ID も未設定としてください。(会員ID 設定不一致(設定が�
3850 要)) */
3851 $message = __( 'Mismatch of Member ID setting (required the setting)', 'usces' );
3852 break;
3853 case 'K82': /* カード番号が適切ではありません。(カード番号の�
3854 �力�
3855 容不正) */
3856 $message = __( 'Invalid input contents of card number', 'usces' );
3857 break;
3858 case 'K83': /* カード有効期限が適切ではありません。(カード有効期限の�
3859 �力�
3860 容不正) */
3861 $message = __( 'Invalid input contents of card expiration', 'usces' );
3862 break;
3863 case 'K84': /* 会員ID が適切ではありません。(会員ID の�
3864 �力�
3865 容不正) */
3866 $message = __( 'Invalid input contents of member ID', 'usces' );
3867 break;
3868 case 'K85': /* 会員パスワードが適切ではありません。(会員パスワードの�
3869 �力�
3870 容不正) */
3871 $message = __( 'Invalid input contents of member password', 'usces' );
3872 break;
3873 case 'K86': /* 形式エラーです。 設定値をご確認の上、再処理を行ってください。(�
3874 目「処理番号:ProcNo」精査エラー) */
3875 $message = __( '\'Processing number: ProcNo\' scrutiny error', 'usces' );
3876 break;
3877 case 'K87': /* 形式エラーです。 設定値をご確認の上、再処理を行ってください。(�
3878 目「POST用URL:PostUrl」精査エラー) */
3879 $message = __( '\'POST URL: PostUrl\' scrutiny error', 'usces' );
3880 break;
3881 case 'K88': /* 取引の対象が複数件存在します。弊社までお問い合わせください。(�
3882 �取引重複エラー) */
3883 $message = __( 'Original deal duplication error', 'usces' );
3884 break;
3885 case 'K89': /* この処理番号は既に使用されています。(処理番号の重複エラー) */
3886 $message = __( 'Duplicate error of processing number', 'usces' );
3887 break;
3888 case 'K96': /* 障害報が通知されている場合は、回復報を�
3889 って再処理を行ってください。その他は、弊社までお問い合わせください。(本システム通信障害発生(タイムアウト)) */
3890 $message = __( 'Communication failure occurred in the system (timeout)', 'usces' );
3891 break;
3892 case 'K98': /* 障害報が通知されている場合は、回復報を�
3893 って再処理を行ってください。その他は、弊社までお問い合わせください。(本システム�
3894 部で軽度障害が発生) */
3895 $message = __( 'Minor failure occurred in the system inside', 'usces' );
3896 break;
3897 case 'K99': /* 弊社までお問い合わせください。(その他例外エラー) */
3898 $message = __( 'Other exception error', 'usces' );
3899 break;
3900 case 'KA1': /* 形式エラーです。設定値を確認の上、再処理を行ってください。(�
3901 目「通貨コード:CurrencyId」精査エラー) */
3902 $message = __( '\'Currency code: CurrencyId\' scrutiny error', 'usces' );
3903 break;
3904 case 'KBX': /* 重複した電文を受信しました。利用�
3905 によりブラウザバックや二重押下が行われた可能性があります。(二重取引エラー) */
3906 $message = __( 'Double transaction error', 'usces' );
3907 break;
3908 case 'KBY': /* �
3909 �取引が完了していません。取引状�
3910 �をご確認ください。(処理未完了エラー) */
3911 $message = __( 'Processing incomplete error', 'usces' );
3912 break;
3913 case 'KBZ': /* 取引対象が取得できません。設定値をご確認の上、再処理を行ってください。(�
3914 �取引なしエラー) */
3915 $message = __( 'No original transaction error', 'usces' );
3916 break;
3917 case 'KG8': /* マーチャント ID、マーチャントパスワード認証に連続して失敗し、ロックアウトされました。(事業�
3918 認証に連続して失敗し、ロックアウトされました) */
3919 $message = __( 'Failed operator authentication consecutively and was locked out.', 'usces' );
3920 break;
3921 case 'KGH': /* 会員参�
3922 �の利用は制限されています。(会員参�
3923 �電文利用設定エラー) */
3924 $message = __( 'Member reference message usage setting error', 'usces' );
3925 break;
3926 case 'KH0': /* 取引が銀聯側でどのような状�
3927 �か不明。(レスポンス不明) */
3928 $message = __( 'Unknown response', 'usces' );
3929 break;
3930 case 'KH4': /* 形式エラーです。設定値を確認の上、再処理を行ってください。(�
3931 目「PageLanguage」精査エラー) */
3932 $message = __( '\'PageLanguage\' scrutiny error', 'usces' );
3933 break;
3934 case 'KHS': /* 形式エラーです。設定値を確認の上、再処理を行ってください。(�
3935 目「SuccessURL」精査エラー) */
3936 $message = __( '\'SuccessURL\' scrutiny error', 'usces' );
3937 break;
3938 case 'KHT': /* 形式エラーです。設定値を確認の上、再処理を行ってください。(�
3939 目「ErrorURL」精査エラー) */
3940 $message = __( '\'ErrorURL\' scrutiny error', 'usces' );
3941 break;
3942 case 'KHU': /* 形式エラーです。設定値を確認の上、再処理を行ってください。(�
3943 目「StatusNoticeURL」精査エラー) */
3944 $message = __( '\'StatusNoticeURL\' scrutiny error', 'usces' );
3945 break;
3946 case 'KHV': /* 対象の取引について、再処理実施有無を確認していいただき、�
3947 要に応じて再処理を行ってください。(自動取消実施済、再処理を行ってください) */
3948 $message = __( 'Auto-cancel has been executed, please try again.', 'usces' );
3949 break;
3950 case 'KHX': /* 形式エラーです。設定値を確認の上、再処理を行ってください。(�
3951 目「Token」精査エラー) */
3952 $message = __( '\'Token\' scrutiny error', 'usces' );
3953 break;
3954 case 'KHZ': /* 利用可能なトークンがありません。(利用可能トークンなしエラー) */
3955 $message = __( 'No token available error', 'usces' );
3956 break;
3957 case 'KI0': /* 取引がエンドユーザにより中止されました。(与信売上計上中止(詳細不明)) */
3958 $message = __( 'Credit sales canceled (details unknown)', 'usces' );
3959 break;
3960 case 'KI1': /* 形式エラーです。設定値を確認の上、再処理を行ってください。(�
3961 目「k_TokenNinsyoCode」精査エラー) */
3962 $message = __( '\'k_TokenNinsyoCode\' scrutiny error', 'usces' );
3963 break;
3964 case 'KI2': /* すでに利用されたトークンです。(使用済みトークンエラー) */
3965 $message = __( 'Used token error', 'usces' );
3966 break;
3967 case 'KI3': /* トークンの有効期限が切れています。(トークン有効期限切れエラー) */
3968 $message = __( 'Token expiration error', 'usces' );
3969 break;
3970 case 'KI4': /* 形式エラーです。設定値を確認の上、再処理を行ってください。(�
3971 目「端末�
3972 報」精査エラー) */
3973 $message = __( '\'Terminal information\' scrutiny error', 'usces' );
3974 break;
3975 case 'KI5': /* 同一カード番号の連続�
3976 �力によりロックされています。 */
3977 $message = __( 'It is locked by continuous input of the same card number.', 'usces' );
3978 break;
3979 case 'KI6': /* 同一端末からの連続�
3980 �力により端末がロックされています。 */
3981 $message = __( 'The terminal is locked by continuous input from the same terminal.', 'usces' );
3982 break;
3983 case 'KI8': /* 取引の対象が複数件存在します。 */
3984 $message = __( 'There are two or more transaction targets.', 'usces' );
3985 break;
3986 case 'KIE': /* ApplePay 決済データの値が Null または桁数、データ型不正となっております。(�
3987 目「signature」精査エラー) */
3988 $message = __( '\'signature\' scrutiny error', 'usces' );
3989 break;
3990 case 'KIF': /* Apple Pay 暗号化済み決済データについて signature エラー、オブジェクト識別子が含まれていません。 */
3991 $message = __( 'signature Error, object identifier isn\'t included.', 'usces' );
3992 break;
3993 case 'KIH': /* Apple Pay 暗号化済み決済データについて signature エラー、署名時間が許容時間を�
3994 えています。 */
3995 $message = __( 'signature Error, signature time exceeds the allowable time.', 'usces' );
3996 break;
3997 case 'KIJ': /* トークンとプロセスID が設定されています、いずれかを設定ください。(トークン決済、ApplePay 取引許可エラー) */
3998 $message = __( 'Token payment, ApplePay transaction authorization error', 'usces' );
3999 break;
4000 case 'KIK': /* �
4001 �取引が ApplePay 取引ではありません。ApplePay 会員登録・会員更新時にクレジットカード決済のプロセス ID で更新した場合に発生いたします。(Apple Pay 会員�
4002 �取引不整合エラー) */
4003 $message = __( 'Apple Pay membership transaction mismatch error', 'usces' );
4004 break;
4005 case 'KIL': /* �
4006 �取引が通常取引ではありません。クレジットカード決済の会員登録・会員更新時に Apple Pay 決済のプロセス ID で更新した場合、または、Apple Pay 会員に対して、会員更新時にカード番号、カード有効期限を設定して更新した場合に発生いたします。(通常会員�
4007 �取引不整合エラー) */
4008 $message = __( 'Normal member transaction mismatch error', 'usces' );
4009 break;
4010 case 'KIW': /* 形式エラー。設定値を確認の上、再処理を行ってください。(�
4011 目「KaiinIdAutoRiyoFlg」精査エラー) */
4012 $message = __( '\'KaiinIdAutoRiyoFlg\' scrutiny error', 'usces' );
4013 break;
4014 case 'C01': /* 貴社送信�
4015 容が仕様に沿っているかご確認の上、弊社までお問い合わせください。(弊社設定関連エラー) */
4016 $message = __( 'Error related to e-SCOTT setting', 'usces' );
4017 break;
4018 case 'C02': /* 障害報が通知されている場合は、回復報を�
4019 って再処理を行ってください。その他は、弊社までお問い合わせください。(e-SCOTT システムエラー) */
4020 $message = __( 'e-SCOTT system error', 'usces' );
4021 break;
4022 case 'C03': /* 障害報が通知されている場合は、回復報を�
4023 って再処理を行ってください。その他は、弊社までお問い合わせください。(e-SCOTT 通信エラー) */
4024 $message = __( 'e-SCOTT communication error', 'usces' );
4025 break;
4026 case 'C10': /* ご契約のある支払回数(区分)をセットし再処理行ってください。(支払区分エラー) */
4027 $message = __( 'Payment indicator error', 'usces' );
4028 break;
4029 case 'C11': /* ボーナス払いご利用対象外期間のため、支払区分を変更して再処理を行ってください。(ボーナス期間外エラー) */
4030 $message = __( 'Bonus overtime period error', 'usces' );
4031 break;
4032 case 'C12': /* ご契約のある分割回数(区分)をセットし再処理行ってください。(分割回数エラー) */
4033 $message = __( 'Number of installments error', 'usces' );
4034 break;
4035 case 'C13': /* カード有効期限の年月�
4036 �力間違え。または、有効期限切れカードです。(有効期限切れエラー) */
4037 $message = __( 'Expired error', 'usces' );
4038 break;
4039 case 'C14': /* 取消処理が既に行われております。管理画面で処理状況をご確認ください。(取消済みエラー) */
4040 $message = __( 'Canceled error', 'usces' );
4041 break;
4042 case 'C15': /* ボーナス払いの下限金額未満によるエラーのため、支払方法を変更して再処理を行ってください。(ボーナス金額下限エラー) */
4043 $message = __( 'Bonus amount lower limit error', 'usces' );
4044 break;
4045 case 'C16': /* 該当のカード会員番号は存在しない。(カード番号エラー) */
4046 $message = __( 'Card number error', 'usces' );
4047 break;
4048 case 'C17': /* ご契約範囲外のカード番号。もしくは存在しないカード番号体系。(カード番号体系エラー) */
4049 $message = __( 'Card number system error', 'usces' );
4050 break;
4051 case 'C18': /* オーソリ除外となるカード番号。本エラーを発生するには個別に設定が�
4052 要になります。弊社までお問い合わせください。(オーソリ除外対象のカード番号体系エラー) */
4053 $message = __( 'Card number system error subject to authorization exclusion', 'usces' );
4054 break;
4055 case 'C70': /* 貴社送信�
4056 容が仕様に沿っているかご確認の上、弊社までお問い合わせください。(弊社設定�
4057 報エラー) */
4058 $message = __( 'Our company setting information error', 'usces' );
4059 break;
4060 case 'C71': /* 貴社送信�
4061 容が仕様に沿っているかご確認の上、弊社までお問い合わせください。(弊社設定�
4062 報エラー) */
4063 $message = __( 'Our company setting information error', 'usces' );
4064 break;
4065 case 'C80': /* カード会社システムの停止を意味します。(カード会社センター閉局) */
4066 $message = __( 'Credit card company center closed', 'usces' );
4067 break;
4068 case 'C98': /* 貴社送信�
4069 容が仕様に沿っているかご確認の上、弊社までお問い合わせください。(その他例外エラー) */
4070 $message = __( 'Other exception error', 'usces' );
4071 break;
4072 case 'C99': /* 貴社送信�
4073 容が仕様に沿っているかご確認の上、弊社までお問い合わせください。(その他例外エラー) */
4074 $message = __( 'Other exception error', 'usces' );
4075 break;
4076 case 'G12': /* クレジットカードが使用不可能です。(カード使用不可) */
4077 $message = __( 'Card unavailable', 'usces' );
4078 break;
4079 case 'G22': /* 支払永�
4080 禁止を意味します。(支払永�
4081 禁止) */
4082 $message = __( 'Prohibit payment permanently', 'usces' );
4083 break;
4084 case 'G30': /* 取引の判断保留を意味します。(取引判定保留) */
4085 $message = __( 'Transaction decision pending', 'usces' );
4086 break;
4087 case 'G42': /* 暗証番号が正しくありません。※デビットカードの場合、発生する場合があります。(暗証番号エラー) */
4088 $message = __( 'PIN error', 'usces' );
4089 break;
4090 case 'G44': /* �
4091 �力されたセキュリティコードが正しくありません。(セキュリティコード誤り) */
4092 $message = __( 'Security code error', 'usces' );
4093 break;
4094 case 'G45': /* セキュリティコードが�
4095 �力されていません。(セキュリティコード�
4096 �力無) */
4097 $message = __( 'Security code input is none', 'usces' );
4098 break;
4099 case 'G54': /* 1日利用回数または金額オーバーです。(利用回数エラー) */
4100 $message = __( 'Error of the number of available use', 'usces' );
4101 break;
4102 case 'G55': /* 1日利用限度額オーバーです。(限度額オーバー) */
4103 $message = __( 'Over limit amount', 'usces' );
4104 break;
4105 case 'G56': /* クレジットカードが無効です。(無効カード) */
4106 $message = __( 'Invalid card', 'usces' );
4107 break;
4108 case 'G60': /* 事�
4109 カードが�
4110 �力されたことを意味します。(事�
4111 カード) */
4112 $message = __( 'Accident card', 'usces' );
4113 break;
4114 case 'G61': /* 無効カードが�
4115 �力されたことを意味します。(無効カード) */
4116 $message = __( 'Invalid card', 'usces' );
4117 break;
4118 case 'G65': /* カード番号の�
4119 �力が誤っていることを意味します。(カード番号エラー) */
4120 $message = __( 'Card number error', 'usces' );
4121 break;
4122 case 'G68': /* 金額の�
4123 �力が誤っていることを意味します。(金額エラー) */
4124 $message = __( 'Amount error', 'usces' );
4125 break;
4126 case 'G72': /* ボーナス金額の�
4127 �力が誤っていることを意味します。(ボーナス額エラー) */
4128 $message = __( 'Bonus amount error', 'usces' );
4129 break;
4130 case 'G74': /* 分割回数の�
4131 �力が誤っていることを意味します。(分割回数エラー) */
4132 $message = __( 'Number of installments error', 'usces' );
4133 break;
4134 case 'G75': /* 分割払いの下限金額を回ってること意味します。(分割金額エラー) */
4135 $message = __( 'Amount of installments error', 'usces' );
4136 break;
4137 case 'G78': /* 支払方法の�
4138 �力が誤っていることを意味します。(支払区分エラー) */
4139 $message = __( 'Payment indicator error', 'usces' );
4140 break;
4141 case 'G83': /* 有効期限の�
4142 �力が誤っていることを意味します。(有効期限エラー) */
4143 $message = __( 'Expiration date error', 'usces' );
4144 break;
4145 case 'G84': /* 承認番号の�
4146 �力が誤っていることを意味します。(承認番号エラー) */
4147 $message = __( 'Authorization number error', 'usces' );
4148 break;
4149 case 'G85': /* CAFIS 代行中にエラーが発生したことを意味します。(CAFIS 代行エラー) */
4150 $message = __( 'CAFIS substitution error', 'usces' );
4151 break;
4152 case 'G92': /* カード会社側で任意にエラーとしたい場合に発生します。(カード会社任意エラー) */
4153 $message = __( 'Card company arbitrary error', 'usces' );
4154 break;
4155 case 'G94': /* サイクル通番が規定以上または数字でないことを意味します。(サイクル通番エラー) */
4156 $message = __( 'Cycle sequence number error', 'usces' );
4157 break;
4158 case 'G95': /* カード会社の当該運用業務が終了していることを意味します。(当該業務オンライン終了) */
4159 $message = __( 'The business online termination', 'usces' );
4160 break;
4161 case 'G96': /* 取扱不可のクレジットカードが�
4162 �力されたことを意味します。(事�
4163 カードデータエラー) */
4164 $message = __( 'Accident card data error', 'usces' );
4165 break;
4166 case 'G97': /* 当該要求が拒否され、取扱不能を意味します。(当該要求拒否) */
4167 $message = __( 'The request rejection', 'usces' );
4168 break;
4169 case 'G98': /* 接続されたクレジットカード会社の対象業務ではないことを意味します。(当該自社対象業務エラー) */
4170 $message = __( 'The company-specific task error', 'usces' );
4171 break;
4172 case 'G99': /* 接続要求自社受付拒否を意味します。(接続要求自社受付拒否) */
4173 $message = __( 'Connection request refused acceptance of company', 'usces' );
4174 break;
4175 case 'P51': /* カード�
4176 報登録応答(SSNP010 キャンセル)を返した場合を示します。 */
4177 $message = __( 'The end user canceled on the card information registration screen (SSNP010).', 'usces' );
4178 break;
4179 case 'P52': /* カード�
4180 報登録応答(SSNP020 キャンセル)を返した場合を示します。 */
4181 $message = __( 'The end user canceled on the card information registration confirmation screen (SSNP020).', 'usces' );
4182 break;
4183 case 'P53': /* カード�
4184 報登録応答(エラー)を返した場合を示します。(本システムへの送信・応答ボディ無、応答処理フラグ異常) */
4185 $message = __( 'An error occurred during card information registration processing.', 'usces' );
4186 break;
4187 case 'P54': /* 認証アシスト�
4188 目の規定回数以上アンマッチが発生したケースなどを示します。 */
4189 $message = __( 'A retry-limit-exceeded error occurred during card information registration processing.', 'usces' );
4190 break;
4191 case 'P55': /* カード�
4192 報変更応答(SSNP030 キャンセル)を返した場合を示します。 */
4193 $message = __( 'The end user canceled on the card information change screen (SSNP030).', 'usces' );
4194 break;
4195 case 'P56': /* カード�
4196 報変更応答(SSNP040 キャンセル)を返した場合を示します。 */
4197 $message = __( 'The end user canceled on the card information change confirmation screen (SSNP040).', 'usces' );
4198 break;
4199 case 'P57': /* カード�
4200 報変更応答(エラー)を返した場合を示します。(本システムへの送信・応答ボディ無、応答処理フラグ異常) */
4201 $message = __( 'An error occurred during card information change processing.', 'usces' );
4202 break;
4203 case 'P58': /* 認証アシスト�
4204 目の規定回数以上アンマッチが発生したケースなどを示します。 */
4205 $message = __( 'A retry-limit-exceeded error occurred during card information change processing.', 'usces' );
4206 break;
4207 case 'P60': /* 会員�
4208 報参�
4209 �応答(エラー)を返した場合を示します。(本システムへの送信・応答ボディ無、応答処理フラグ異常) */
4210 $message = __( 'An error occurred during member information reference processing.', 'usces' );
4211 break;
4212 case 'P62': /* 与信応答(会員制)(SSNP080 キャンセル)を返した場合を示します。 */
4213 $message = __( 'The end user canceled on the member purchase authentication assist screen (SSNP080).', 'usces' );
4214 break;
4215 case 'P63': /* 与信応答(会員制)(SSNP090 キャンセル)を返した場合を示します。 */
4216 $message = __( 'The end user canceled on the member purchase card information confirmation screen (SSNP090).', 'usces' );
4217 break;
4218 case 'P64': /* 与信応答(会員制)(SSNP100 キャンセル)を返した場合を示します。 */
4219 $message = __( 'The end user canceled on the member purchase card information input screen (SSNP100).', 'usces' );
4220 break;
4221 case 'P65': /* 与信応答(会員制)(SSNP110 キャンセル)を返した場合を示します。 */
4222 $message = __( 'The end user canceled on the member purchase card information confirmation screen (SSNP110).', 'usces' );
4223 break;
4224 case 'P66': /* 与信応答(会員購�
4225 �)にてエラーが発生したこと示します。 */
4226 $message = __( 'An error occurred during authorization processing (member purchase).', 'usces' );
4227 break;
4228 case 'P67': /* 与信応答(会員購�
4229 �にて「他のカードで購�
4230 �」を使用)でエラーが発生したことを示します。 */
4231 $message = __( 'An error occurred during authorization processing (member purchase using "Purchase with another card").', 'usces' );
4232 break;
4233 case 'P68': /* 認証アシスト�
4234 目の規定回数以上アンマッチが発生したケースなどを示します。 */
4235 $message = __( 'A retry-limit-exceeded error occurred during authorization processing (member).', 'usces' );
4236 break;
4237 case 'P69': /* 与信応答(非会員制)(SSNP120 キャンセル)を返した場合を示します。 */
4238 $message = __( 'The end user canceled on the non-member purchase card information input screen (SSNP120).', 'usces' );
4239 break;
4240 case 'P70': /* 与信応答(非会員制)(SSNP130 キャンセル)を返した場合を示します。 */
4241 $message = __( 'The end user canceled on the non-member purchase card information confirmation screen (SSNP130).', 'usces' );
4242 break;
4243 case 'P71': /* 与信応答(非会員)(エラー)を返した場合を示します。(本システムへの送信・応答ボディ無、応答サービス区分異常) */
4244 $message = __( 'An error occurred during authorization processing (non-member).', 'usces' );
4245 break;
4246 case 'P72': /* 認証アシスト�
4247 目の規定回数以上アンマッチが発生したケースなどを示します。 */
4248 $message = __( 'A retry-limit-exceeded error occurred during authorization processing (non-member).', 'usces' );
4249 break;
4250 case 'P74': /* セッションのタイムアウトエラーの発生を示します。 */
4251 $message = __( 'A session timeout occurred.', 'usces' );
4252 break;
4253 case 'R01': /* 再処理を行ってください。(システムが起動していないか、または一時的にダウンしています。しばらくしてからもう一度試してください。) */
4254 $message = __( 'The system is not booting or is temporarily down. Please try again later.', 'usces' );
4255 break;
4256 case 'R02': /* 設定値をご確認の上、再処理を行ってください。(メッセージ形式のエラー) */
4257 $message = __( 'Message format error', 'usces' );
4258 break;
4259 case 'R03': /* 弊社までお問い合わせください。(署名エラーを確認してください。) */
4260 $message = __( 'Check for signature error.', 'usces' );
4261 break;
4262 case 'R04': /* メッセージ取引キー要素がありません。 */
4263 $message = __( 'Missing message transaction key element.', 'usces' );
4264 break;
4265 case 'R05': /* 取引不成立。他の銀聯決済カードを使用してください。 */
4266 $message = __( 'Transaction unsuccessful. Please use another UnionPay card.', 'usces' );
4267 break;
4268 case 'R06': /* 弊社までお問い合わせください。(加盟店の状�
4269 �が正しくありません。) */
4270 $message = __( 'Incorrect merchant status.', 'usces' );
4271 break;
4272 case 'R07': /* この取引の権利はありません。 */
4273 $message = __( 'You are not entitled to this transaction.', 'usces' );
4274 break;
4275 case 'R08': /* 取引額が限度額を�
4276 過しています。 */
4277 $message = __( 'Transaction amount exceeds the limit.', 'usces' );
4278 break;
4279 case 'R09': /* �
4280 �取引が存在していないか、または状�
4281 �が正しくありません。 */
4282 $message = __( 'Original transaction does not exist or is in an incorrect state.', 'usces' );
4283 break;
4284 case 'R10': /* �
4285 �取引�
4286 報と一致しません。 */
4287 $message = __( 'Not match with original transaction information.', 'usces' );
4288 break;
4289 case 'R11': /* �
4290 �会の回数が限度を�
4291 えるか、オペレーションの頻度が過剰です。 */
4292 $message = __( 'The number of queries exceeds the limit or the frequency of operations is excessive.', 'usces' );
4293 break;
4294 case 'R12': /* 銀聯リスク制限 */
4295 $message = __( 'UnionPay risk limit', 'usces' );
4296 break;
4297 case 'R13': /* エンドユーザの操作が許容時間�
4298 に完了しませんでした。(取引の受付時間外です。) */
4299 $message = __( 'Out of transaction available hours.', 'usces' );
4300 break;
4301 case 'R14': /* 残高からの差し引きはできますが、決済時間を過ぎています。 */
4302 $message = __( 'You can deduct from your balance, but the payment available time has passed.', 'usces' );
4303 break;
4304 case 'R15': /* �
4305 �力したカード番号が無効です。再度確認のうえ�
4306 �力してください。 */
4307 $message = __( 'The card number is invalid. Please check and input again.', 'usces' );
4308 break;
4309 case 'R16': /* 取引不成立。発行会社はこの加盟店に対応していません。別の銀行カードに変更してください。 */
4310 $message = __( 'Transaction unsuccessful. The issuing company does not support this merchant. Please change to a different bank card.', 'usces' );
4311 break;
4312 case 'R17': /* カードの状�
4313 �が正しくありません。 */
4314 $message = __( 'Incorrect card status', 'usces' );
4315 break;
4316 case 'R18': /* カードの残高不足 */
4317 $message = __( 'Insufficient card balance', 'usces' );
4318 break;
4319 case 'R19': /* �
4320 �力した PIN、有効期限または CVN2 のエラー、取引不成立。 */
4321 $message = __( 'Eroor of PIN or expiration date or CVN2, transaction failed.', 'usces' );
4322 break;
4323 case 'R20': /* �
4324 �力したカード保有�
4325 ID �
4326 報または携帯電話番号が正しくない、検証不成立。 */
4327 $message = __( 'The entered cardholder ID information or mobile phone number is incorrect, verification failed.', 'usces' );
4328 break;
4329 case 'R21': /* PIN �
4330 �力回数の限度を�
4331 えています。 */
4332 $message = __( 'The number of input limit of PIN exceeded.', 'usces' );
4333 break;
4334 case 'R22': /* あなたの銀行カードは現在この取引には対応していません。 */
4335 $message = __( 'Your bank card is currently unavailable this transaction.', 'usces' );
4336 break;
4337 case 'R23': /* 試行時間の限度�
4338 過、取引不成立。 */
4339 $message = __( 'Trial time limit exceeded, transaction failed.', 'usces' );
4340 break;
4341 case 'R24': /* 取引はリダイレクトされました。カード保有�
4342
4343 �力画面になるまでお�
4344 ちください。 */
4345 $message = __( 'The transaction has been redirected. Please wait until the cardholder entry screen appears.', 'usces' );
4346 break;
4347 case 'R25': /* 動的パスワードまたは SMS 認証コードの確認ができません。 */
4348 $message = __( 'The dynamic password or SMS authentication code cannot be verified.', 'usces' );
4349 break;
4350 case 'R26': /* 銀行窓口またはオンライン銀行で銀聯決済サービスにサインアップしていません。 */
4351 $message = __( 'You have not signed up for UnionPay payment service at a bank counter or online bank.', 'usces' );
4352 break;
4353 case 'R27': /* 決済カードの有効期限が過ぎています。 */
4354 $message = __( 'Payment card has expired.', 'usces' );
4355 break;
4356 case 'R28': /* 有効化には暗号検証が�
4357 要です。 */
4358 $message = __( 'Validation require an encryption verification.', 'usces' );
4359 break;
4360 case 'R29': /* この銀行カードは認証済の支払いに有効化されていません。 */
4361 $message = __( 'This bank card is not activated for verified payments.', 'usces' );
4362 break;
4363 case 'R30': /* 発行会社の取引権が制限されています。発行会社にお問い合わせください。 */
4364 $message = __( 'An issuing company\'s trading rights are restricted. Please contact the issuing company.', 'usces' );
4365 break;
4366 case 'R31': /* 銀行カードは有効ですが、発行会社が SMS認証に対応していません。 */
4367 $message = __( 'The bank card is valid, but the issuing company does not support SMS authentication.', 'usces' );
4368 break;
4369 case 'R32': /* ファイルが存在しません。 */
4370 $message = __( 'File doesn\'t exist.', 'usces' );
4371 break;
4372 case 'R33': /* 一般的エラー */
4373 $message = __( 'General error', 'usces' );
4374 break;
4375 case 'R34': /* 弊社までお問い合わせください。 */
4376 $message = __( 'Please contact SLN.', 'usces' );
4377 break;
4378 case 'R35': /* 弊社までお問い合わせください。 */
4379 $message = __( 'Please contact SLN.', 'usces' );
4380 break;
4381 case 'R36': /* この取引はありませんでした。 */
4382 $message = __( 'This transaction doesn\'t exist.', 'usces' );
4383 break;
4384 case 'R37': /* 取引不成立。詳細は発行会社に問い合わせてください。 */
4385 $message = __( 'Transaction failed. Please contact the issuing company for details.', 'usces' );
4386 break;
4387 case 'U01': /* エンドユーザーの 3D セキュアパスワードが未設定です。 */
4388 $message = __( 'The end user\'s 3D secure password is not set.', 'usces' );
4389 break;
4390 case 'U02': /* 3D セキュア未対応カード発行会社です。 */
4391 $message = __( 'This card company doesn\'t conpliant with 3D Secure.', 'usces' );
4392 break;
4393 case 'U03': /* ブランドサーバー、または、イシュアサーバーに障害が発生し認証できませんでした。 */
4394 $message = __( 'The brand server or issuer server failed and could not be authenticated.', 'usces' );
4395 break;
4396 case 'U04': /* 3D セキュア認証ができませんでした。各カード会社の基準により 3D セキュア認証画面を表示せずに NGとなる場合がございます。 */
4397 $message = __( '3D secure authentication couldn\'t be executed. Depending on the standards of card companies, it may be NG without displaying the 3D secure authentication screen.', 'usces' );
4398 break;
4399 case 'U05': /* 認証システムで改ざんをチェックし 3D セキュア認証ができませんでした。 */
4400 $message = __( 'The authentication system checked for tampering and 3D secure authentication failed.', 'usces' );
4401 break;
4402 case 'U06': /* エンドユーザーの操作でタイムアウト(40 分以上経過)が発生しました。 */
4403 $message = __( 'A timeout (over 40 minutes) occurred by end-user operation.', 'usces' );
4404 break;
4405 case 'U07': /* 認証システムにて電文処理中に同じ電文を受信しました。 */
4406 $message = __( 'The same message was received during message processing in the authentication system.', 'usces' );
4407 break;
4408 case 'U08': /* セッション�
4409 報が削除された後に重複した電文を受信しました。 */
4410 $message = __( 'A duplicate message was received after the session information was deleted.', 'usces' );
4411 break;
4412 case 'U09': /* 3D セキュア未対応ブランドです。 */
4413 $message = __( 'This brand doesn\'t conpliant with 3D Secure.', 'usces' );
4414 break;
4415 case 'U10': /* ブランドのサーバーが停止、または接続不可により 3D セキュア認証ができませんでした。 */
4416 $message = __( 'The 3D secure authentication couldn\'t be executed because the branded server stopped or failed connection.', 'usces' );
4417 break;
4418 case 'U11': /* 弊社までお問い合わせください。(認証システム精査エラー) */
4419 $message = __( 'Authentication system scrutiny error', 'usces' );
4420 break;
4421 case 'U12': /* 弊社までお問い合わせください。(加盟店認証エラー) */
4422 $message = __( 'Merchant authentication error', 'usces' );
4423 break;
4424 case 'U13': /* 弊社までお問い合わせください。(認証システム�
4425 目エラー) */
4426 $message = __( 'Authentication system item error', 'usces' );
4427 break;
4428 case 'U14': /* 計画停止案�
4429 が通知されている場合は、計画停止終了を�
4430 って再処理を行ってください。その他は、弊社までお問い合わせください。(メンテナンスによるシステムエラー) */
4431 $message = __( 'If a planned stoppage guidance has been notified, wait for the planned stoppage to end and reprocess.', 'usces' );
4432 break;
4433 case 'U15': /* アテンプトです。 */
4434 $message = __( 'Atempt.', 'usces' );
4435 break;
4436 case 'U95': /* 一時的に処理できませんでした。リトライしてください。(システムエラー) */
4437 $message = __( 'Failed the process temporarily. Please retry.', 'usces' );
4438 break;
4439 case 'U96': /* 障害報が通知されている場合は、回復報を�
4440 って再処理を行ってください。その他は弊社までお問い合せください。(タイムアウト) */
4441 $message = __( 'If a failure report has been notified, wait for the recovery report and reprocess.', 'usces' );
4442 break;
4443 case 'U99': /* 弊社までお問い合せください。(想定外エラー) */
4444 $message = __( 'Unexpected error', 'usces' );
4445 break;
4446 case 'W01': /* 弊社までお問い合わせください。(オンライン収納代行サービス設定エラー) */
4447 $message = __( 'Online Payment Collection Agency Service setting error', 'usces' );
4448 break;
4449 case 'W02': /* 弊社までお問い合わせください。(設定値エラー) */
4450 $message = __( 'Setting value error', 'usces' );
4451 break;
4452 case 'W03': /* 弊社までお問い合わせください。(オンライン収納代行サービス�
4453 部エラー(Web系)) */
4454 $message = __( 'Online Payment Collection Agency Service internal error (Web type)', 'usces' );
4455 break;
4456 case 'W04': /* 弊社までお問い合わせください。(システム設定エラー) */
4457 $message = __( 'System setting error', 'usces' );
4458 break;
4459 case 'W05': /* 送信�
4460 容をご確認の上、再処理を行ってください。エラーが解消しない場合は、弊社までお問い合わせください。(�
4461 目設定エラー) */
4462 $message = __( 'Item setting error', 'usces' );
4463 break;
4464 case 'W06': /* 弊社までお問い合わせください。(オンライン収納代行サービス�
4465 部エラー(DB系)) */
4466 $message = __( 'Online Payment Collection Agency Service internal error (DB type)', 'usces' );
4467 break;
4468 case 'W99': /* 弊社までお問い合わせください。(その他例外エラー) */
4469 $message = __( 'Other exception error', 'usces' );
4470 break;
4471 case 'W99': /* 弊社までお問い合わせください。(その他例外エラー) */
4472 $message = __( 'Other exception error', 'usces' );
4473 break;
4474 default:
4475 $message = $code;
4476 }
4477 return $message;
4478 }
4479
4480 /**
4481 * エラーコード対応メッセージ
4482 *
4483 * @param string $code Error code.
4484 * @return string
4485 */
4486 protected function error_message( $code ) {
4487 switch ( $code ) {
4488 case 'K01': /* オンライン取引電文精査エラー */
4489 case 'K02': /* �
4490 目「MerchantId」精査エラー */
4491 case 'K03': /* �
4492 目「MerchantPass」精査エラー */
4493 case 'K04': /* �
4494 目「TenantId」精査エラー */
4495 case 'K05': /* �
4496 目「TransactionDate」精査エラー */
4497 case 'K06': /* �
4498 目「OperateId」精査エラー */
4499 case 'K07': /* �
4500 目「MerchantFree1」精査エラー */
4501 case 'K08': /* �
4502 目「MerchantFree2」精査エラー */
4503 case 'K09': /* �
4504 目「MerchantFree3」精査エラー */
4505 case 'K10': /* �
4506 目「ProcessId」精査エラー */
4507 case 'K11': /* �
4508 目「ProcessPass」精査エラー */
4509 case 'K12': /* �
4510 目「ProcessId」または「ProcessPass」不整合エラー */
4511 case 'K14': /* OperateId のステータス遷移不整合 */
4512 case 'K15': /* 会員参�
4513 �(同一カード番号返戻)時の返戻対象会員数エラー */
4514 case 'K22': /* �
4515 目「PayType」精査エラー */
4516 case 'K23': /* �
4517 目「Amount」精査エラー */
4518 case 'K39': /* �
4519 目「SalesDate」精査エラー */
4520 case 'K50': /* �
4521 目「PayLimit」精査エラー */
4522 case 'K53': /* �
4523 目「ShouhinName」精査エラー */
4524 case 'K54': /* �
4525 目「フリーエリア:Free1~7」精査エラー */
4526 case 'K55': /* �
4527 目「Comment」精査エラー */
4528 case 'K60': /* �
4529 目「戻り�
4530 � URL:ReturnURL」精査エラー */
4531 case 'K68': /* 会員の登録機能は利用できません */
4532 case 'K69': /* 会員ID の重複エラー */
4533 case 'K70': /* 会員が無効状�
4534 �ではありません */
4535 case 'K71': /* 会員ID の認証エラー */
4536 case 'K73': /* 会員が既に有効となっています */
4537 case 'K74': /* 会員認証に連続して失敗し、ロックアウトされました */
4538 case 'K75': /* 会員は有効ではありません */
4539 case 'K79': /* 会員判定エラー(Login 無効または会員無効) */
4540 case 'K80': /* 会員ID 設定不一致(設定が�
4541 要) */
4542 case 'K81': /* 会員ID 設定不一致(設定が不要) */
4543 case 'K84': /* 会員ID の�
4544 �力�
4545 容不正 */
4546 case 'K85': /* 会員パスワードの�
4547 �力�
4548 容不正 */
4549 case 'K86': /* �
4550 目「処理番号:ProcNo」精査エラー */
4551 case 'K87': /* �
4552 目「POST用URL:PostUrl」精査エラー */
4553 case 'K88': /* �
4554 �取引重複エラー */
4555 case 'K89': /* 処理番号の重複エラー */
4556 case 'K96': /* 本システム通信障害発生(タイムアウト) */
4557 case 'K98': /* 本システム�
4558 部で軽度障害が発生 */
4559 case 'K99': /* その他例外エラー */
4560 case 'KA1': /* �
4561 目「通貨コード:CurrencyId」精査エラー */
4562 case 'KBX': /* 二重取引エラー */
4563 case 'KBY': /* 処理未完了エラー */
4564 case 'KBZ': /* �
4565 �取引なしエラー */
4566 case 'KG8': /* 事業�
4567 認証に連続して失敗し、ロックアウトされました */
4568 case 'KGH': /* 会員参�
4569 �電文利用設定エラー */
4570 case 'KH0': /* レスポンス不明 */
4571 case 'KH4': /* �
4572 目「PageLanguage」精査エラー */
4573 case 'KHS': /* �
4574 目「SuccessURL」精査エラー */
4575 case 'KHT': /* �
4576 目「ErrorURL」精査エラー */
4577 case 'KHU': /* �
4578 目「StatusNoticeURL」精査エラー */
4579 case 'KHV': /* 自動取消実施済、再処理を行ってください */
4580 case 'KHX': /* �
4581 目「Token」精査エラー */
4582 case 'KHZ': /* 利用可能なトークンがありません */
4583 case 'KI0': /* 与信売上計上中止(詳細不明) */
4584 case 'KI1': /* �
4585 目「k_TokenNinsyoCode」精査エラー */
4586 case 'KI2': /* 使用済みトークンエラー */
4587 case 'KI3': /* トークン有効期限切れエラー */
4588 case 'KI4': /* �
4589 目「端末�
4590 報」精査エラー */
4591 case 'KI5': /* 同一カード番号の連続�
4592 �力によりロックされています。 */
4593 case 'KI6': /* 同一端末からの連続�
4594 �力により端末がロックされています。 */
4595 case 'KI8': /* 取引の対象が複数件存在します */
4596 case 'KIE': /* �
4597 目「signature」精査エラー */
4598 case 'KIF': /* signature エラー、オブジェクト識別子が含まれていません。 */
4599 case 'KIH': /* signature エラー、署名時間が許容時間を�
4600 えています。 */
4601 case 'KIJ': /* トークン決済、ApplePay 取引許可エラー */
4602 case 'KIK': /* Apple Pay 会員�
4603 �取引不整合エラー */
4604 case 'KIL': /* 通常会員�
4605 �取引不整合エラー */
4606 case 'KIW': /* �
4607 目「KaiinIdAutoRiyoFlg」精査エラー */
4608 case 'C01': /* 弊社設定関連エラー */
4609 case 'C02': /* e-SCOTT システムエラー */
4610 case 'C03': /* e-SCOTT 通信エラー */
4611 case 'C10': /* 支払区分エラー */
4612 case 'C11': /* ボーナス期間外エラー */
4613 case 'C12': /* 分割回数エラー */
4614 case 'C14': /* 取消済みエラー */
4615 case 'C18': /* オーソリ除外対象のカード番号体系エラー */
4616 case 'C70': /* 弊社設定�
4617 報エラー */
4618 case 'C71': /* 弊社設定�
4619 報エラー */
4620 case 'C80': /* カード会社センター閉局 */
4621 case 'C98': /* その他例外エラー */
4622 case 'C99': /* その他例外エラー */
4623 case 'G74': /* 分割回数エラー */
4624 case 'G78': /* 支払区分エラー */
4625 case 'G85': /* CAFIS 代行エラー */
4626 case 'G92': /* カード会社任意エラー */
4627 case 'G94': /* サイクル通番エラー */
4628 case 'G95': /* 当該業務オンライン終了 */
4629 case 'G98': /* 当該自社対象業務エラー */
4630 case 'G99': /* 接続要求自社受付拒否 */
4631 case 'R01': /* システムが起動していないか、または一時的にダウンしています。しばらくしてからもう一度試してください。 */
4632 case 'R02': /* メッセージ形式のエラー。 */
4633 case 'R03': /* 署名エラーを確認してください。 */
4634 case 'R04': /* メッセージ取引キー要素がありません。 */
4635 case 'R05': /* 取引不成立。他の銀聯決済カードを使用してください。 */
4636 case 'R06': /* 加盟店の状�
4637 �が正しくありません。 */
4638 case 'R07': /* この取引の権利はありません。 */
4639 case 'R08': /* 取引額が限度額を�
4640 過しています。 */
4641 case 'R09': /* �
4642 �取引が存在していないか、または状�
4643 �が正しくありません。 */
4644 case 'R10': /* �
4645 �取引�
4646 報と一致しません。 */
4647 case 'R11': /* �
4648 �会の回数が限度を�
4649 えるか、オペレーションの頻度が過剰です。 */
4650 case 'R12': /* 銀聯リスク制限 */
4651 case 'R13': /* 取引の受付時間外です。 */
4652 case 'R14': /* 残高からの差し引きはできますが、決済時間を過ぎています。 */
4653 case 'R15': /* �
4654 �力したカード番号が無効です。再度確認のうえ�
4655 �力してください。 */
4656 case 'R16': /* 取引不成立。発行会社はこの加盟店に対応していません。別の銀行カードに変更してください。 */
4657 case 'R17': /* カードの状�
4658 �が正しくありません。 */
4659 case 'R18': /* カードの残高不足。 */
4660 case 'R19': /* �
4661 �力した PIN、有効期限または CVN2 のエラー、取引不成立。 */
4662 case 'R20': /* �
4663 �力したカード保有�
4664 ID�
4665 報または携帯電話番号が正しくない、検証不成立。 */
4666 case 'R21': /* PIN �
4667 �力回数の限度を�
4668 えています。 */
4669 case 'R22': /* あなたの銀行カードは現在この取引には対応していません。 */
4670 case 'R23': /* 試行時間の限度�
4671 過、取引不成立。 */
4672 case 'R24': /* 取引はリダイレクトされました。カード保有�
4673
4674 �力画面になるまでお�
4675 ちください。 */
4676 case 'R25': /* 動的パスワードまたは SMS 認証コードの確認ができません。 */
4677 case 'R26': /* 銀行窓口またはオンライン銀行で銀聯決済サービスにサインアップしていません。 */
4678 case 'R27': /* 決済カードの有効期限が過ぎています。 */
4679 case 'R28': /* 有効化には暗号検証が�
4680 要です。 */
4681 case 'R29': /* この銀行カードは認証済の支払いに有効化されていません。 */
4682 case 'R30': /* 発行会社の取引権が制限されています。発行会社にお問い合わせください。 */
4683 case 'R31': /* 銀行カードは有効ですが、発行会社が SMS認証に対応していません。 */
4684 case 'R32': /* ファイルが存在しません。 */
4685 case 'R33': /* 一般的エラー */
4686 case 'R34': /* SLN にお問い合わせください。 */
4687 case 'R35': /* SLN にお問い合わせください。 */
4688 case 'R36': /* この取引はありませんでした。 */
4689 case 'R37': /* 取引不成立。詳細は発行会社に問い合わせてください。 */
4690 case 'W01': /* オンライン収納代行サービス設定エラー */
4691 case 'W02': /* 設定値エラー */
4692 case 'W03': /* オンライン収納代行サービス�
4693 部エラー(Web系) */
4694 case 'W04': /* システム設定エラー */
4695 case 'W05': /* �
4696 目設定エラー */
4697 case 'W06': /* オンライン収納代行サービス�
4698 部エラー(DB系) */
4699 case 'W99': /* その他例外エラー */
4700 $message = __( 'Sorry, please contact the administrator from the inquiry form.', 'usces' ); /* 恐れ�
4701 �りますが、お問い合わせフォームより管理�
4702 にお問い合わせください。 */
4703 break;
4704 case 'K20': /* �
4705 目「CardNo」精査エラー */
4706 case 'K82': /* カード番号の�
4707 �力�
4708 容不正 */
4709 case 'C16': /* カード番号エラー */
4710 case 'C17': /* カード番号体系エラー */
4711 case 'G65': /* カード番号エラー */
4712 $message = __( 'Credit card number is not appropriate.', 'usces' ); /* 指定のカード番号が適切ではありません。*/
4713 break;
4714 case 'K21': /* �
4715 目「CardExp」精査エラー */
4716 case 'K83': /* カード有効期限の�
4717 �力�
4718 容不正 */
4719 case 'C13': /* 有効期限切れエラー */
4720 case 'G83': /* 有効期限エラー */
4721 $message = __( 'Card expiration date is not appropriate.', 'usces' ); /* カード有効期限が適切ではありません。*/
4722 break;
4723 case 'K24': /* �
4724 目「SecCd」精査エラー */
4725 case 'G44': /* セキュリティコード誤り */
4726 case 'G45': /* セキュリティコード�
4727 �力無 */
4728 $message = __( 'Security code is not appropriate.', 'usces' ); /* セキュリティコードが適切ではありません。*/
4729 break;
4730 case 'K40': /* セキュリティコードアンマッチ検証 NG */
4731 case 'K45': /* �
4732 目「KaiinId」精査エラー */
4733 case 'K46': /* �
4734 目「KaiinPass」精査エラー */
4735 case 'K47': /* �
4736 目「NewKaiinPass」精査エラー */
4737 case 'K48': /* �
4738 目「EnableCheckUseKbn」精査エラー */
4739 case 'KHX': /* �
4740 目「Token」精査エラー */
4741 case 'G42': /* 暗証番号エラー */
4742 case 'G84': /* 承認番号エラー */
4743 $message = __( 'Credit card information is not appropriate.', 'usces' ); /* カード�
4744 報が適切ではありません。*/
4745 break;
4746 case 'C15': /* ボーナス金額下限エラー */
4747 $message = __( 'Please change the payment method and error due to less than the minimum amount of bonus payment.', 'usces' ); /* ボーナス払いの下限金額未満によるエラーのため、支払方法を変更して再処理を行ってください。*/
4748 break;
4749 case 'G12': /* カード使用不可 */
4750 case 'G22': /* 支払永�
4751 禁止 */
4752 case 'G30': /* 取引判定保留 */
4753 case 'G56': /* 無効カード */
4754 case 'G60': /* 事�
4755 カード */
4756 case 'G61': /* 無効カード */
4757 case 'G96': /* 事�
4758 カードデータエラー */
4759 case 'G97': /* 当該要求拒否 */
4760 $message = __( 'Credit card is unusable.', 'usces' ); /* クレジットカードが使用不可能です。*/
4761 break;
4762 case 'G54': /* 利用回数エラー */
4763 $message = __( 'It is over 1 day usage or over amount.', 'usces' ); /* 1日利用回数または金額オーバーです。*/
4764 break;
4765 case 'G55': /* 限度額オーバー */
4766 $message = __( 'It is over limit for 1 day use.', 'usces' ); /* 1日利用限度額オーバーです。*/
4767 break;
4768 case 'G68': /* 金額エラー */
4769 case 'G72': /* ボーナス額エラー */
4770 $message = __( 'Amount is not appropriate.', 'usces' ); /* 金額が適切ではありません。*/
4771 break;
4772 case 'G75': /* 分割金額エラー */
4773 $message = __( 'It is lower than the lower limit of installment payment.', 'usces' ); /* 分割払いの下限金額を下回っています。*/
4774 break;
4775 case 'K28': /* �
4776 目「TelNo」精査エラー */
4777 $message = __( 'Customer telephone number is not appropriate.', 'usces' ); /* お客様電話番号が適切ではありません。*/
4778 break;
4779 case 'K51': /* �
4780 目「NameKanji」精査エラー */
4781 $message = __( 'Customer name is not entered properly.', 'usces' ); /* お客様氏名が適切に�
4782 �力されていません。*/
4783 break;
4784 case 'K52': /* �
4785 目「NameKana」精査エラー */
4786 $message = __( 'Customer kana name is not entered properly.', 'usces' ); /* お客様氏名カナが適切に�
4787 �力されていません。*/
4788 break;
4789 case 'K30': /* �
4790 目「MessageVersionNo3D」精査エラー */
4791 case 'K31': /* �
4792 目「TransactionId3D」精査エラー */
4793 case 'K32': /* �
4794 目「EncordXId3D」精査エラー */
4795 case 'K33': /* �
4796 目「TransactionStatus3D」精査エラー */
4797 case 'K34': /* �
4798 目「CAVVAlgorithm3D」精査エラー */
4799 case 'K35': /* �
4800 目「CAVV3D」精査エラー */
4801 case 'K36': /* �
4802 目「ECI3D」精査エラー */
4803 case 'K37': /* �
4804 目「PANCard3D」精査エラー */
4805 case 'U01': /* イシュアまたは会員が未参加(旧:カード発行会社での ID 登録なし) */
4806 case 'U02': /* 3D セキュア未対応カード発行会社 */
4807 case 'U03': /* ネットワーク等でのエラー発生 */
4808 case 'U04': /* 3D セキュア本人認証 NG */
4809 case 'U05': /* 3D セキュア改ざんチェック NG */
4810 case 'U06': /* セッションの有効期限切れ */
4811 case 'U07': /* 重複した受付 */
4812 case 'U08': /* 退避したセッション�
4813 報が削除されていた */
4814 case 'U09': /* 3D セキュア対象外ブランド */
4815 case 'U10': /* ブランドサーバーが停止、または接続不可 */
4816 case 'U11': /* 認証システム精査エラー */
4817 case 'U12': /* 加盟店認証エラー */
4818 case 'U13': /* 認証システム�
4819 目エラー */
4820 case 'U14': /* メンテナンスによるシステムエラー */
4821 case 'U15': /* アテンプト */
4822 case 'U95': /* システムエラー */
4823 case 'U96': /* タイムアウト */
4824 case 'U99': /* 想定外エラー */
4825 $message = __( '3D secure authentication failed.', 'usces' ); /* 3D セキュア認証ができませんでした。 */
4826 break;
4827 default:
4828 $message = __( 'Sorry, please contact the administrator from the inquiry form.', 'usces' ); /* 恐れ�
4829 �りますが、お問い合わせフォームより管理�
4830 にお問い合わせください。 */
4831 }
4832 return $message;
4833 }
4834
4835 /**
4836 * 重複送信不可
4837 *
4838 * @param string $acting_flg Payment type.
4839 * @param string $rand Welcart transaction key.
4840 */
4841 public function duplication_control( $acting_flg, $rand ) {
4842 global $wpdb;
4843
4844 if ( ! usces_check_trans_id( $rand ) ) {
4845 exit();
4846 }
4847 usces_save_trans_id( $rand, $acting_flg );
4848
4849 $key = 'wc_trans_id';
4850 $query = $wpdb->prepare( "SELECT `order_id` FROM {$wpdb->prefix}usces_order_meta WHERE `meta_value` = %d AND `meta_key` = %s", $rand, $key );
4851 $order_id = $wpdb->get_var( $query );
4852 if ( ! $order_id ) {
4853 return;
4854 }
4855
4856 if ( $this->acting_flg_card === $acting_flg ) {
4857 wp_redirect(
4858 add_query_arg(
4859 array(
4860 'acting' => $this->acting_card,
4861 'acting_return' => 1,
4862 'result' => 1,
4863 '_nonce' => wp_create_nonce( $this->acting_flg_card ),
4864 ),
4865 USCES_CART_URL
4866 )
4867 );
4868 exit();
4869 }
4870 }
4871
4872 /**
4873 * ソケット通信接続
4874 *
4875 * @param array $params Parameters.
4876 * @return array
4877 */
4878 public function connection( $params ) {
4879 $gc = new SLNConnection();
4880 $gc->set_connection_url( $params['send_url'] );
4881 $gc->set_connection_timeout( 60 );
4882 $response_value = $gc->send_request( $params['param_list'] );
4883
4884 if ( ! empty( $response_value ) ) {
4885 $response = explode( "\r\n\r\n", $response_value );
4886 parse_str( $response[1], $response_data );
4887 if ( ! array_key_exists( 'ResponseCd', $response_data ) ) {
4888 $response_data['ResponseCd'] = 'NG';
4889 }
4890 } else {
4891 $response_data['ResponseCd'] = 'NG';
4892 }
4893 return $response_data;
4894 }
4895
4896 /**
4897 * Save session data.
4898 *
4899 * @param string $key Key.
4900 * @param array $post_data Post data.
4901 * @return boolean
4902 */
4903 private function save_post_data( $key, $post_data ) {
4904 global $wpdb;
4905
4906 $query = $wpdb->prepare( "INSERT INTO {$wpdb->prefix}usces_log ( `datetime`, `log`, `log_type`, `log_key` ) VALUES ( %s, %s, %s, %s )",
4907 current_time( 'mysql' ),
4908 usces_serialize( $post_data ),
4909 'acting_post_data',
4910 $key
4911 );
4912 $res = $wpdb->query( $query );
4913 return $res;
4914 }
4915
4916 /**
4917 * Get session data.
4918 *
4919 * @param string $key Key.
4920 * @return array
4921 */
4922 private function get_post_data( $key ) {
4923 global $wpdb;
4924
4925 $query = $wpdb->prepare( "SELECT `log` FROM {$wpdb->prefix}usces_log WHERE `log_type` = %s AND `log_key` = %s", 'acting_post_data', $key );
4926 $data = $wpdb->get_var( $query );
4927 return usces_unserialize( $data );
4928 }
4929
4930 /**
4931 * Delete session data.
4932 *
4933 * @param string $key Key.
4934 */
4935 private function delete_post_data( $key ) {
4936 global $wpdb;
4937
4938 $query = $wpdb->prepare( "DELETE FROM {$wpdb->prefix}usces_log WHERE `log_type` = %s AND `log_key` = %s", 'acting_post_data', $key );
4939 $wpdb->query( $query );
4940 }
4941
4942 /**
4943 * Consent to Obtain Personal Information Messsage.
4944 */
4945 protected function consent_message() {
4946 $consent_message = __( '* Cautions on Use of Credit Cards', 'usces' ) . "\n"
4947 . __( 'In order to prevent unauthorized use of your credit card through theft of information such as your credit card number, we use "EMV 3D Secure," an identity authentication service recommended by international brands.', 'usces' ) . "\n"
4948 . __( 'In order to use EMV 3D Secure, it is necessary to send information about you to the card issuer.', 'usces' ) . "\n"
4949 . __( 'Please read "* Provision of Personal Information to Third Parties" below and enter your card information only if you agree to the terms of the agreement.', 'usces' ) . "\n"
4950 . __( '* Provision of Personal Information to Third Parties', 'usces' ) . "\n"
4951 . __( 'The following personal information, etc. collected from customers will be provided to the issuer of the card being used by the customer for the purpose of detecting and preventing fraudulent use by the card issuer.', 'usces' ) . "\n"
4952 . __( '"Full name", "e-mail address", "Membership information held by the business", "IP address", "device information", "Information on the Internet usage environment", and "Billing address".', 'usces' ) . "\n"
4953 . __( 'If the issuer of the card you are using is located in a foreign country, these information may be transferred to the country to which such issuer belongs.', 'usces' ) . "\n"
4954 . __( 'If you are a minor, you are required to obtain the consent of a person with parental authority or a guardian before using the Service.', 'usces' ) . "\n"
4955 . __( '* Agreement to provide personal information to a third party', 'usces' ) . "\n"
4956 . __( 'If you agree to the above "* Provision of Personal Information to Third Parties", please click "Agree" and proceed to enter your credit card information.', 'usces' ) . "\n"
4957 . __( '* Safety Control Measures', 'usces' ) . "\n"
4958 . __( 'We may provide all or part of the information obtained from our customers to subcontractors in the United States.', 'usces' ) . "\n"
4959 . __( 'We will confirm that the subcontractor takes necessary and appropriate measures for the safe management of the information before storing it.', 'usces' ) . "\n"
4960 . __( 'For an overview of the legal system regarding the protection of personal information in the relevant country, please check here.', 'usces' ) . "\n"
4961 . 'https://www.ppc.go.jp/personalinfo/legal/kaiseihogohou/#gaikoku';
4962 return $consent_message;
4963 }
4964 }
4965
4966 if ( ! class_exists( 'SLNConnection' ) ) {
4967 /**
4968 * クラス定義 : SLNConnection
4969 */
4970 class SLNConnection {
4971 /* プロパティ定義 */
4972
4973 /**
4974 * 接続�
4975 �URLアドレス
4976 *
4977 * @var string
4978 */
4979 private $connection_url;
4980
4981 /**
4982 * 通信タイムアウト
4983 *
4984 * @var int
4985 */
4986 private $connection_timeout;
4987
4988 /* メソッド定義 */
4989
4990 /**
4991 * コンストラクタ
4992 */
4993 public function __construct() {
4994 /* プロパティ初期化 */
4995 $this->connection_url = '';
4996 $this->connection_timeout = 600;
4997 }
4998
4999 /**
5000 * 接続�
5001 �URLアドレスの設定
5002 *
5003 * @param string $connection_url 接続�
5004 �URLアドレス.
5005 */
5006 public function set_connection_url( $connection_url = '' ) {
5007 $this->connection_url = $connection_url;
5008 }
5009
5010 /**
5011 * 接続�
5012 �URLアドレスの取得
5013 *
5014 * @return string 接続�
5015 �URLアドレス
5016 */
5017 public function get_connection_url() {
5018 return $this->connection_url;
5019 }
5020
5021 /**
5022 * 通信タイムアウト時間(s)の設定
5023 *
5024 * @param int $connection_timeout 通信タイムアウト時間(s).
5025 */
5026 public function set_connection_timeout( $connection_timeout = 0 ) {
5027 $this->connection_timeout = $connection_timeout;
5028 }
5029
5030 /**
5031 * 通信タイムアウト時間(s)の取得
5032 *
5033 * @return int 通信タイムアウト時間(s)
5034 */
5035 public function get_connection_timeout() {
5036 return $this->connection_timeout;
5037 }
5038
5039 /**
5040 * リクエスト送信クラス
5041 *
5042 * @param array $param_list リクエストパラメータ(要求電文)�
5043 �列.
5044 * @return array レスポンスパラメータ(応答電文)�
5045 �列
5046 */
5047 public function send_request( &$param_list = array() ) {
5048 $r_value = array();
5049
5050 /* パラメータチェック */
5051 if ( empty( $param_list ) === false ) {
5052 /* 送信�
5053 ��
5054 報の準備 */
5055 $url = parse_url( $this->connection_url );
5056
5057 /* HTTPデータ生成 */
5058 $http_data = http_build_query( $param_list );
5059
5060 /* HTTPヘッダ生成 */
5061 $http_header = 'POST ' . $url['path'] . ' HTTP/1.1' . "\r\n" .
5062 'Host: ' . $url['host'] . "\r\n" .
5063 'User-Agent: SLN_PAYMENT_CLIENT_PG_PHP_VERSION_1_0' . "\r\n" .
5064 'Content-Type: application/x-www-form-urlencoded' . "\r\n" .
5065 'Content-Length: ' . strlen( $http_data ) . "\r\n" .
5066 'Connection: close';
5067
5068 /* POSTデータ生成 */
5069 $http_post = $http_header . "\r\n\r\n" . $http_data;
5070
5071 /* 送信処理 */
5072 $errno = 0;
5073 $errstr = '';
5074 $hm = array();
5075 $context = stream_context_create(
5076 array(
5077 'ssl' => array(
5078 'capture_peer_cert' => true,
5079 'capture_peer_cert_chain' => true,
5080 'disable_compression' => true,
5081 ),
5082 )
5083 );
5084
5085 /* ソケット通信接続 */
5086 $fp = @stream_socket_client( 'tlsv1.2://' . $url['host'] . ':443', $errno, $errstr, $this->connection_timeout, STREAM_CLIENT_CONNECT, $context );
5087 if ( false === $fp ) {
5088 usces_log( 'e-SCOTT send error : ' . __( 'TLS 1.2 connection failed.', 'usces' ), 'acting_transaction.log' ); /* TLS1.2接続に失敗しました */
5089 return $r_value;
5090 }
5091
5092 if ( false !== $fp ) {
5093 /* 接続後タイムアウト設定 */
5094 $result = socket_set_timeout( $fp, $this->connection_timeout );
5095 if ( true === $result ) {
5096 /* データ送信 */
5097 fwrite( $fp, $http_post );
5098 /* 応答受信 */
5099 $response_data = '';
5100 while ( ! feof( $fp ) ) {
5101 $response_data .= @fgets( $fp, 4096 );
5102 }
5103
5104 /* ソケット通信�
5105 報を取得 */
5106 $hm = stream_get_meta_data( $fp );
5107 /* ソケット通信切断 */
5108 $result = fclose( $fp );
5109 if ( true === $result ) {
5110 if ( true !== $hm['timed_out'] ) {
5111 /* レスポンスデータ生成 */
5112 $r_value = $response_data;
5113 } else {
5114 /* エラー:タイムアウト発生 */
5115 usces_log( 'e-SCOTT send error : ' . __( 'Timeout occurred during communication.', 'usces' ), 'acting_transaction.log' ); /* 通信中にタイムアウトが発生しました */
5116 }
5117 } else {
5118 /* エラー:ソケット通信切断失敗 */
5119 usces_log( 'e-SCOTT send error : ' . __( 'Failed to disconnect from SLN.', 'usces' ), 'acting_transaction.log' ); /* SLNとの切断に失敗しました */
5120 }
5121 } else {
5122 /* エラー:タイムアウト設定失敗 */
5123 usces_log( 'e-SCOTT send error : ' . __( 'Timeout setting failed.', 'usces' ), 'acting_transaction.log' ); /* タイムアウト設定に失敗しました */
5124 }
5125 }
5126 } else {
5127 /* エラー:パラメータ不整合 */
5128 usces_log( 'e-SCOTT send error : ' . __( 'Invalid request parameter specification.', 'usces' ), 'acting_transaction.log' ); /* リクエストパラメータの指定が正しくありません */
5129 }
5130 return $r_value;
5131 }
5132
5133 /**
5134 * UnionPay(銀聯)接続
5135 *
5136 * @param string $url Request URL.
5137 * @param array $param_list Parameters.
5138 */
5139 public function send_request_unionpay( $url, &$param_list = array() ) {
5140 if ( false === empty( $param_list ) ) {
5141 $headers = array(
5142 'Content-Type' => 'application/x-www-form-urlencoded;charset=UTF-8',
5143 );
5144 $args = array(
5145 'headers' => $headers,
5146 'body' => $param_list,
5147 );
5148
5149 $response = wp_remote_post( $url, $args );
5150 $response_body = wp_remote_retrieve_body( $response );
5151 echo $response_body; // no escape.
5152
5153 } else {
5154 /* エラー:パラメータ不整合 */
5155 usces_log( 'e-SCOTT send error : ' . __( 'Invalid request parameter specification.', 'usces' ), 'acting_transaction.log' ); /* リクエストパラメータの指定が正しくありません */
5156 }
5157 }
5158 }
5159 }
5160