PluginProbe
Welcart e-Commerce / 2.11.31
Welcart e-Commerce v2.11.31
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.11.31, at classes/paymentESCOTT.main.class.php

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