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

5,088 lines 207.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Settlement Class.
4 * e-SCOTT Smart
5 *
6 * @package Welcart
7 * @author Welcart Inc.
8 * @version 1.2.0
9 * @since 1.9.0
10 */
11
12 /**
13 * e-SCOTT Smart Main Class.
14 */
15 class ESCOTT_MAIN {
16 /**
17 * 決済代行会社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 = mb_convert_kana( $usces->getItemName( $cart[0]['post_id'] ), 'ASK', 'UTF-8' );
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 $paylimit = date_i18n( 'Ymd', current_time( 'timestamp' ) + ( 86400 * $acting_opts['conv_limit'] ) ) . '2359';
1644
1645 /* �
1646 �通部 */
1647 $param_list['MerchantId'] = $acting_opts['merchant_id'];
1648 $param_list['MerchantPass'] = $acting_opts['merchant_pass'];
1649 $param_list['TransactionDate'] = $transaction_date;
1650 $param_list['MerchantFree1'] = $rand;
1651 $param_list['MerchantFree2'] = $acting_flg;
1652 $param_list['MerchantFree3'] = $this->merchantfree3;
1653 $param_list['TenantId'] = $acting_opts['tenant_id'];
1654 $param_list['Amount'] = $usces_entries['order']['total_full_price'];
1655 $param_list['OperateId'] = '2Add';
1656 $param_list['PayLimit'] = $paylimit;
1657 $param_list['NameKanji'] = $usces_entries['customer']['name1'] . $usces_entries['customer']['name2'];
1658 $param_list['NameKana'] = ( ! empty( $usces_entries['customer']['name3'] ) ) ? $usces_entries['customer']['name3'] . $usces_entries['customer']['name4'] : $param_list['NameKanji'];
1659 $param_list['TelNo'] = $usces_entries['customer']['tel'];
1660 $param_list['ShouhinName'] = $item_name;
1661 $param_list['Comment'] = apply_filters( 'usces_filter_escott_thankyou_comment', __( 'Thank you for using.', 'usces' ) );
1662 $param_list['ReturnURL'] = home_url( '/' );
1663 $params['send_url'] = $acting_opts['send_url_conv'];
1664 $params['param_list'] = $param_list;
1665 /* e-SCOTT オンライン収納代行データ登録 */
1666 $response_data = $this->connection( $params );
1667 $response_data['acting'] = $this->acting_conv;
1668 $response_data['PayLimit'] = $paylimit;
1669 $response_data['Amount'] = $param_list['Amount'];
1670
1671 if ( 'OK' === $response_data['ResponseCd'] ) {
1672 $free_area = trim( $response_data['FreeArea'] );
1673 $url = add_query_arg(
1674 array(
1675 'code' => $free_area,
1676 'rkbn' => 1,
1677 ),
1678 $acting_opts['redirect_url_conv']
1679 );
1680 $res = $usces->order_processing( $response_data );
1681 if ( 'ordercompletion' === $res ) {
1682 // if ( isset( $response_data['MerchantFree1'] ) ) {
1683 // usces_ordered_acting_data( $response_data['MerchantFree1'] );
1684 // }
1685 $usces->cart->clear_cart();
1686 wp_redirect( $url );
1687 exit();
1688 } else {
1689 $logdata = array_merge( $usces_entries['order'], $response_data );
1690 $log = array(
1691 'acting' => $this->acting_conv,
1692 'key' => $rand,
1693 'result' => 'ORDER DATA REGISTERED ERROR',
1694 'data' => $logdata,
1695 );
1696 usces_save_order_acting_error( $log );
1697 wp_redirect(
1698 add_query_arg(
1699 array(
1700 'acting' => $this->acting_conv,
1701 'acting_return' => 0,
1702 'result' => 0,
1703 ),
1704 USCES_CART_URL
1705 )
1706 );
1707 }
1708 } else {
1709 $responsecd = explode( '|', $response_data['ResponseCd'] );
1710 foreach ( (array) $responsecd as $cd ) {
1711 $response_data[ $cd ] = $this->response_message( $cd );
1712 }
1713 $logdata = array_merge( $params, $response_data );
1714 $log = array(
1715 'acting' => $this->acting_conv,
1716 'key' => $rand,
1717 'result' => $response_data['ResponseCd'],
1718 'data' => $logdata,
1719 );
1720 usces_save_order_acting_error( $log );
1721 wp_redirect(
1722 add_query_arg(
1723 array(
1724 'MerchantFree2' => $response_data['MerchantFree2'],
1725 'ResponseCd' => $response_data['ResponseCd'],
1726 'acting' => $this->acting_conv,
1727 'acting_return' => 0,
1728 'result' => 0,
1729 ),
1730 USCES_CART_URL
1731 )
1732 );
1733 }
1734 exit();
1735 }
1736 }
1737
1738 /**
1739 * 決済完了ページ制御
1740 * usces_filter_check_acting_return_results
1741 *
1742 * @param array $results Result data.
1743 * @return array
1744 */
1745 public function acting_return( $results ) {
1746 $acting_flg = ( isset( $results['acting'] ) ) ? 'acting_' . $results['acting'] : '';
1747 if ( ! in_array( $acting_flg, $this->pay_method, true ) ) {
1748 return $results;
1749 }
1750
1751 if ( isset( $results['acting_return'] ) && 1 !== (int) $results['acting_return'] ) {
1752 return $results;
1753 }
1754
1755 $results['reg_order'] = false;
1756
1757 usces_log( '[' . $this->acting_name . '] results : ' . print_r( $results, true ), 'acting_transaction.log' );
1758 if ( ! isset( $_REQUEST['_nonce'] ) || ! wp_verify_nonce( $_REQUEST['_nonce'], $acting_flg ) ) {
1759 wp_redirect( home_url() );
1760 exit();
1761 }
1762
1763 return $results;
1764 }
1765
1766 /**
1767 * 重複オーダー禁止処理
1768 * usces_filter_check_acting_return_duplicate
1769 *
1770 * @param string $trans_id Transaction ID.
1771 * @param array $results Result data.
1772 * @return string
1773 */
1774 public function check_acting_return_duplicate( $trans_id, $results ) {
1775 global $usces;
1776
1777 $entry = $usces->cart->get_entry();
1778 if ( ! $entry['order']['total_full_price'] ) {
1779 return 'not_credit';
1780 } elseif ( isset( $results['MerchantFree1'] ) && isset( $results['acting'] ) && ( $this->acting_card === $results['acting'] || $this->acting_conv === $results['acting'] ) ) {
1781 $_REQUEST['absolute_trans_id'] = $results['MerchantFree1'];
1782 return $results['MerchantFree1'];
1783 } else {
1784 $_REQUEST['absolute_trans_id'] = $trans_id;
1785 return $trans_id;
1786 }
1787 }
1788
1789 /**
1790 * 受注データ登録
1791 * Called by usces_reg_orderdata() and usces_new_orderdata().
1792 * usces_action_reg_orderdata
1793 *
1794 * @param array $args Compact array( $cart, $entry, $order_id, $member_id, $payments, $charging_type, $results ).
1795 */
1796 public function register_orderdata( $args ) {
1797 global $usces;
1798 extract( $args );
1799
1800 $acting_flg = $payments['settlement'];
1801 if ( ! in_array( $acting_flg, $this->pay_method, true ) ) {
1802 return;
1803 }
1804
1805 if ( ! $entry['order']['total_full_price'] ) {
1806 return;
1807 }
1808
1809 if ( isset( $results['MerchantFree1'] ) ) {
1810 $usces->set_order_meta_value( 'trans_id', $results['MerchantFree1'], $order_id );
1811 $usces->set_order_meta_value( 'wc_trans_id', $results['MerchantFree1'], $order_id );
1812 if ( ! isset( $results['acting'] ) ) {
1813 $results['acting'] = substr( $acting_flg, 7 );
1814 }
1815 if ( $this->acting_flg_card === $acting_flg ) {
1816 $acting_opts = $this->get_acting_settings();
1817 if ( ( 'on' === $acting_opts['sec3d_activate'] && isset( $results['SecureResultCode'] ) ) || 'link' === $acting_opts['card_activate'] ) {
1818 $results['Agreement'] = '1';
1819 }
1820 }
1821 $usces->set_order_meta_value( $acting_flg, usces_serialize( $results ), $order_id );
1822 }
1823
1824 if ( $this->acting_flg_conv === $acting_flg ) {
1825 $usces->set_order_meta_value( $results['MerchantFree1'], $acting_flg, $order_id );
1826 }
1827 }
1828
1829 /**
1830 * 受注データ登録後処理
1831 * usces_post_reg_orderdata
1832 *
1833 * @param string $order_id Order Number.
1834 * @param array $results Results.
1835 */
1836 public function post_register_orderdata( $order_id, $results ) {
1837 global $usces;
1838
1839 if ( isset( $results['acting'] ) && $this->acting_conv === $results['acting'] ) {
1840 $acting_opts = $this->get_acting_settings();
1841 $free_area = trim( $results['FreeArea'] );
1842 $url = add_query_arg(
1843 array(
1844 'code' => $free_area,
1845 'rkbn' => 2,
1846 ),
1847 $acting_opts['redirect_url_conv']
1848 );
1849 $usces->set_order_meta_value( $this->paymod_id . '_conv_url', $url, $order_id );
1850 }
1851 }
1852
1853 /**
1854 * 決済エラーメッセージ
1855 * usces_filter_get_error_settlement
1856 *
1857 * @param string $html Payment error message.
1858 * @return string
1859 */
1860 public function error_page_message( $html ) {
1861 $acting_flg = ( isset( $_REQUEST['MerchantFree2'] ) ) ? wp_unslash( $_REQUEST['MerchantFree2'] ) : '';
1862 if ( $this->acting_flg_card === $acting_flg ) {
1863 if ( isset( $_REQUEST['MerchantFree1'] ) && usces_get_order_id_by_trans_id( wp_unslash( $_REQUEST['MerchantFree1'] ) ) ) {
1864 $html .= '<div class="error_page_mesage">
1865 <p>' . __( 'Your order has already we complete.', 'usces' ) . '</p>
1866 <p>' . __( 'Please do not re-display this page.', 'usces' ) . '</p>
1867 </div>';
1868 } else {
1869 $responsecd = explode( '|', wp_unslash( $_REQUEST['ResponseCd'] ) );
1870 $html .= '<div class="error_page_mesage">';
1871 $html .= '<p>' . __( 'Credit card information is not appropriate.', 'usces' ) . '</p>';
1872 if ( 1 === count( (array) $responsecd ) && 'NG' === $responsecd[0] ) {
1873 $back_url = add_query_arg(
1874 array(
1875 'backDelivery' => $this->acting_card,
1876 're-enter' => 1,
1877 ),
1878 USCES_CART_URL
1879 );
1880 $html .= '
1881 <p class="return_settlement"><a href="' . $back_url . '">' . __( 'Card number re-enter', 'usces' ) . '</a></p>
1882 </div>';
1883 }
1884 }
1885 } elseif ( $this->acting_flg_conv === $acting_flg ) {
1886 $error_message = array();
1887 $responsecd = explode( '|', wp_unslash( $_REQUEST['ResponseCd'] ) );
1888 foreach ( (array) $responsecd as $cd ) {
1889 $error_message[] = $this->error_message( $cd );
1890 }
1891 $error_message = array_unique( $error_message );
1892 if ( 0 < count( $error_message ) ) {
1893 $html .= '<div class="error_page_mesage">
1894 <p>' . __( 'Error code', 'usces' ) . ' : ' . wp_unslash( $_REQUEST['ResponseCd'] ) . '</p>';
1895 foreach ( $error_message as $message ) {
1896 $html .= '<p>' . $message . '</p>';
1897 }
1898 }
1899 $html .= '</div>';
1900 }
1901 return $html;
1902 }
1903
1904 /**
1905 * オンライン収納代行決済用サンキューメール
1906 * usces_filter_send_order_mail_payment
1907 *
1908 * @param string $msg_payment Payment method message.
1909 * @param int $order_id Order number.
1910 * @param array $payment Payment data.
1911 * @param array $cart Cart data.
1912 * @param array $entry Entry data.
1913 * @param array $data Order data.
1914 * @return string
1915 */
1916 public function order_mail_payment( $msg_payment, $order_id, $payment, $cart, $entry, $data ) {
1917 global $usces;
1918
1919 if ( $this->acting_flg_conv !== $payment['settlement'] ) {
1920 return $msg_payment;
1921 }
1922
1923 $acting_opts = $this->get_acting_settings();
1924 $url = $usces->get_order_meta_value( $this->paymod_id . '_conv_url', $order_id );
1925 if ( ! empty( $url ) ) {
1926 if ( usces_is_html_mail() ) {
1927 $msg_conv = '<tr><td colspan="2" style="padding: 0 0 25px 0;">' . $payment['name'] . usces_payment_detail( $entry ) . '<br><br>';
1928 $msg_conv .= sprintf( __( 'Payment is valid for %s days from the date of order.', 'usces' ), $acting_opts['conv_limit'] ) . '<br>';
1929 $msg_conv .= __( 'If payment has not yet been completed, please payment procedure from the following URL.', 'usces' ) . '<br><br>';
1930 $msg_conv .= '<a href="' . $url . '">' . $url . '</a><br>';
1931 $msg_conv .= '</td></tr>';
1932 } else {
1933 $msg_conv = sprintf( __( 'Payment is valid for %s days from the date of order.', 'usces' ), $acting_opts['conv_limit'] ) . "\r\n";
1934 $msg_conv .= __( 'If payment has not yet been completed, please payment procedure from the following URL.', 'usces' ) . "\r\n\r\n";
1935 $msg_conv .= __( '[Payment URL]', 'usces' ) . "\r\n";
1936 $msg_conv .= $url . "\r\n";
1937 }
1938 $msg_payment .= apply_filters( 'usces_filter_escott_send_order_mail_payment_conv', $msg_conv, $url, $acting_opts['conv_limit'] );
1939 }
1940 return $msg_payment;
1941 }
1942
1943 /**
1944 * 管理画面メッセージ表示
1945 * admin_notices
1946 */
1947 public function display_admin_notices() {
1948 $acting_opts = $this->get_acting_settings();
1949 if ( 'on' === $acting_opts['card_activate'] ) {
1950 if ( empty( $acting_opts['token_code'] ) ) {
1951 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>';
1952 }
1953 }
1954 }
1955
1956 /**
1957 * Front scripts.
1958 * wp_print_footer_scripts
1959 */
1960 public function footer_scripts() {
1961 global $usces;
1962
1963 if ( ! $this->is_validity_acting( 'card' ) ) {
1964 return;
1965 }
1966
1967 /* 発送・支払方法ページ */
1968 if ( 'delivery' === $usces->page ) :
1969 $acting_opts = $this->get_acting_settings();
1970 /* 埋込み型 */
1971 if ( isset( $acting_opts['card_activate'] ) && 'on' === $acting_opts['card_activate'] ) :
1972 ?>
1973 <script type="text/javascript">
1974 (function($) {
1975 $("#cardno").change( function(e) {
1976 var first_c = $(this).val().substr(0,1);
1977 var second_c = $(this).val().substr(1,1);
1978 if( '4' == first_c || '5' == first_c || ( '3' == first_c && '5' == second_c ) ) {
1979 $("#paytype_default").prop("disabled","disabled").css("display","none");
1980 $("#paytype4535").prop("disabled",false).css("display","inline");
1981 $("#paytype37").prop("disabled","disabled").css("display","none");
1982 $("#paytype36").prop("disabled","disabled").css("display","none");
1983 } else if( '3' == first_c && '6' == second_c ) {
1984 $("#paytype_default").prop("disabled","disabled").css("display","none");
1985 $("#paytype4535").prop("disabled","disabled").css("display","none");
1986 $("#paytype37").prop("disabled","disabled").css("display","none");
1987 $("#paytype36").prop("disabled",false).css("display","inline");
1988 } else if( '3' == first_c && '7' == second_c ) {
1989 $("#paytype_default").prop("disabled","disabled").css("display","none");
1990 $("#paytype4535").prop("disabled","disabled").css("display","none");
1991 $("#paytype37").prop("disabled",false).css("display","inline");
1992 $("#paytype36").prop("disabled","disabled").css("display","none");
1993 } else {
1994 $("#paytype_default").prop("disabled",false).css("display","inline");
1995 $("#paytype4535").prop("disabled","disabled").css("display","none");
1996 $("#paytype37").prop("disabled","disabled").css("display","none");
1997 $("#paytype36").prop("disabled","disabled").css("display","none");
1998 }
1999 });
2000 $("#cardno").trigger("change");
2001 <?php
2002 if ( isset( $_REQUEST['backDelivery'] ) && $this->acting_card === substr( wp_unslash( $_REQUEST['backDelivery'] ), 0, 12 ) ) :
2003 $payment_method = usces_get_system_option( 'usces_payment_method', 'settlement' );
2004 $id = $payment_method[ $this->acting_flg_card ]['sort'];
2005 ?>
2006 $("#payment_name_<?php echo esc_attr( $id ); ?>").prop("checked",true);
2007 <?php
2008 endif;
2009 ?>
2010 })(jQuery);
2011 </script>
2012 <?php
2013 /* トークン決済 */
2014 elseif ( isset( $acting_opts['card_activate'] ) && 'token' === $acting_opts['card_activate'] ) :
2015 wp_enqueue_style( 'jquery-ui-style' );
2016 wp_enqueue_script( 'jquery-ui-dialog' );
2017 wp_enqueue_style( 'jquery-ui-dialog-min-css', includes_url() . 'css/jquery-ui-dialog.min.css' );
2018 wp_register_script( 'usces_cart_escott', USCES_FRONT_PLUGIN_URL . '/js/cart_escott.js', array( 'jquery' ), USCES_VERSION, true );
2019 $escott_params = array();
2020 $escott_params['sec3d_activate'] = $acting_opts['sec3d_activate'];
2021 $escott_params['message']['agreement'] = $this->consent_message();
2022 $escott_params['message']['agree'] = __( 'Agree', 'usces' );
2023 $escott_params['message']['disagree'] = __( 'Disagree', 'usces' );
2024 wp_localize_script( 'usces_cart_escott', 'escott_params', $escott_params );
2025 wp_enqueue_script( 'usces_cart_escott' );
2026 endif;
2027
2028 /* マイページ */
2029 elseif ( $usces->is_member_page( $_SERVER['REQUEST_URI'] ) ) :
2030 $member = $usces->get_member();
2031 $kaiin_id = $this->get_quick_kaiin_id( $member['ID'] );
2032 if ( ! empty( $kaiin_id ) ) :
2033 ?>
2034 <script type="text/javascript">
2035 jQuery(document).ready( function($) {
2036 $("input[name='deletemember']").css("display","none");
2037 });
2038 </script>
2039 <?php
2040 endif;
2041 endif;
2042 }
2043
2044 /**
2045 * カード�
2046 報�
2047 �力チェック
2048 * usces_filter_delivery_check
2049 *
2050 * @param string $mes Validation check message.
2051 * @return string
2052 */
2053 public function delivery_check( $mes ) {
2054 global $usces;
2055
2056 if ( ! isset( $_POST['offer']['payment_name'] ) ) {
2057 return $mes;
2058 }
2059
2060 if ( ! empty( $mes ) ) {
2061 return $mes;
2062 }
2063
2064 $payment = usces_get_payments_by_name( wp_unslash( $_POST['offer']['payment_name'] ) );
2065 if ( $this->acting_flg_card === $payment['settlement'] ) {
2066 $acting_opts = $this->get_acting_settings();
2067 if ( isset( $acting_opts['card_activate'] ) && 'on' === $acting_opts['card_activate'] ) {
2068 if ( 'on' === $acting_opts['seccd'] ) {
2069 if ( filter_input( INPUT_POST, 'acting', FILTER_DEFAULT ) === $this->paymod_id &&
2070 ! filter_input( INPUT_POST, 'cardno', FILTER_DEFAULT, FILTER_NULL_ON_FAILURE ) ||
2071 ! filter_input( INPUT_POST, 'seccd', FILTER_DEFAULT, FILTER_NULL_ON_FAILURE ) ||
2072 ! filter_input( INPUT_POST, 'expyy', FILTER_DEFAULT, FILTER_NULL_ON_FAILURE ) ||
2073 ! filter_input( INPUT_POST, 'expmm', FILTER_DEFAULT, FILTER_NULL_ON_FAILURE ) ) {
2074 $mes .= __( 'Please enter the card information correctly.', 'usces' ) . '<br />';
2075 }
2076 } else {
2077 if ( filter_input( INPUT_POST, 'acting', FILTER_DEFAULT ) === $this->paymod_id &&
2078 ! filter_input( INPUT_POST, 'cardno', FILTER_DEFAULT, FILTER_NULL_ON_FAILURE ) ||
2079 ! filter_input( INPUT_POST, 'expyy', FILTER_DEFAULT, FILTER_NULL_ON_FAILURE ) ||
2080 ! filter_input( INPUT_POST, 'expmm', FILTER_DEFAULT, FILTER_NULL_ON_FAILURE ) ) {
2081 $mes .= __( 'Please enter the card information correctly.', 'usces' ) . '<br />';
2082 }
2083 }
2084 } elseif ( isset( $acting_opts['card_activate'] ) && 'token' === $acting_opts['card_activate'] ) {
2085 if ( ! filter_input( INPUT_POST, 'token', FILTER_DEFAULT, FILTER_NULL_ON_FAILURE ) ) {
2086 if ( $usces->is_member_logged_in() && 'on' === $acting_opts['quickpay'] ) {
2087 $quick_member = filter_input( INPUT_POST, 'quick_member', FILTER_DEFAULT );
2088 if ( 'add' !== $quick_member ) {
2089 if ( ! wel_check_credit_security() ) {
2090 $mes .= __( 'Update has been locked. Please contact the store administrator.', 'usces' ) . '<br />';
2091 } else {
2092 $mes .= __( 'Please enter the card information correctly.', 'usces' ) . '<br />';
2093 }
2094 }
2095 } else {
2096 $mes .= __( 'Please enter the card information correctly.', 'usces' ) . '<br />';
2097 }
2098 } else {
2099 if ( ! wel_check_credit_security() ) {
2100 $mes .= __( 'Update has been locked. Please contact the store administrator.', 'usces' ) . '<br />';
2101 }
2102 }
2103 }
2104 }
2105 return $mes;
2106 }
2107
2108 /**
2109 * 支払方法ページ用�
2110 �力フォーム
2111 * usces_filter_delivery_secure_form
2112 *
2113 * @param string $html Payment form.
2114 * @param array $payment Payment data.
2115 * @return string
2116 */
2117 public function delivery_secure_form( $html, $payment ) {
2118 global $usces;
2119
2120 if ( $usces->is_cart_page( $_SERVER['REQUEST_URI'] ) && 'delivery' === $usces->page ) {
2121 $acting_opts = $this->get_acting_settings();
2122 if ( isset( $acting_opts['card_activate'] ) && 'token' === $acting_opts['card_activate'] ) {
2123 $html .= '
2124 <input type="hidden" name="acting" value="' . $this->paymod_id . '" />
2125 <input type="hidden" name="confirm" value="confirm" />
2126 <input type="hidden" name="token" id="token" value="" />
2127 <input type="hidden" name="billingname" id="billingname" value="" />
2128 <input type="hidden" name="paytype" value="" />
2129 <input type="hidden" name="quick_member" value="" />
2130 <input type="hidden" name="card_change" value="" />';
2131 }
2132 }
2133 return $html;
2134 }
2135
2136 /**
2137 * 支払方法ページ用�
2138 �力フォーム
2139 * usces_filter_delivery_secure_form_loop
2140 *
2141 * @param string $nouse Empty.
2142 * @param array $payment Payment data.
2143 * @return string
2144 */
2145 public function delivery_secure_form_loop( $nouse, $payment ) {
2146 global $usces;
2147
2148 $html = '';
2149 if ( $this->acting_flg_card === $payment['settlement'] ) {
2150 $acting_opts = $this->get_acting_settings();
2151 if ( ( ! isset( $acting_opts['activate'] ) || 'on' !== $acting_opts['activate'] ) ||
2152 ( ! isset( $acting_opts['card_activate'] ) || 'on' !== $acting_opts['card_activate'] ) ||
2153 'activate' !== $payment['use'] ) {
2154 return $html;
2155 }
2156
2157 $back_delivery = ( isset( $_REQUEST['backDelivery'] ) && substr( wp_unslash( $_REQUEST['backDelivery'] ), 0, 12 ) === $this->acting_card ) ? true : false;
2158 $card_change = ( isset( $_REQUEST['card_change'] ) ) ? true : false;
2159 if ( $card_change ) {
2160 if ( 'on' === $acting_opts['seccd'] ) {
2161 if ( filter_input( INPUT_POST, 'acting', FILTER_DEFAULT ) === $this->paymod_id &&
2162 ! filter_input( INPUT_POST, 'cardno', FILTER_DEFAULT, FILTER_NULL_ON_FAILURE ) ||
2163 ! filter_input( INPUT_POST, 'seccd', FILTER_DEFAULT, FILTER_NULL_ON_FAILURE ) ||
2164 ! filter_input( INPUT_POST, 'expyy', FILTER_DEFAULT, FILTER_NULL_ON_FAILURE ) ||
2165 ! filter_input( INPUT_POST, 'expmm', FILTER_DEFAULT, FILTER_NULL_ON_FAILURE ) ) {
2166 $back_delivery = true;
2167 }
2168 } else {
2169 if ( filter_input( INPUT_POST, 'acting', FILTER_DEFAULT ) === $this->paymod_id &&
2170 ! filter_input( INPUT_POST, 'cardno', FILTER_DEFAULT, FILTER_NULL_ON_FAILURE ) ||
2171 ! filter_input( INPUT_POST, 'expyy', FILTER_DEFAULT, FILTER_NULL_ON_FAILURE ) ||
2172 ! filter_input( INPUT_POST, 'expmm', FILTER_DEFAULT, FILTER_NULL_ON_FAILURE ) ) {
2173 $back_delivery = true;
2174 }
2175 }
2176 }
2177
2178 $cardno = filter_input( INPUT_POST, 'cardno', FILTER_DEFAULT );
2179 $expyy = filter_input( INPUT_POST, 'expyy', FILTER_DEFAULT );
2180 $expmm = filter_input( INPUT_POST, 'expmm', FILTER_DEFAULT );
2181 $paytype = ( isset( $usces_entries['order']['paytype'] ) ) ? esc_html( $usces_entries['order']['paytype'] ) : '01';
2182
2183 $html .= '<input type="hidden" name="acting" value="' . $this->paymod_id . '">';
2184 $html .= '
2185 <table class="customer_form" id="' . $this->paymod_id . '">';
2186
2187 if ( usces_is_login() ) {
2188 $member = $usces->get_member();
2189 $kaiin_id = $this->get_quick_kaiin_id( $member['ID'] );
2190 $kaiin_pass = $this->get_quick_pass( $member['ID'] );
2191 }
2192
2193 $response_member = array(
2194 'ResponseCd' => '',
2195 );
2196
2197 if ( 'on' === $acting_opts['quickpay'] && ! empty( $kaiin_id ) && ! empty( $kaiin_pass ) && ! $card_change ) {
2198 /* e-SCOTT 会員�
2199 �会 */
2200 $response_member = $this->escott_member_reference( $member['ID'], $kaiin_id, $kaiin_pass );
2201 }
2202 if ( 'OK' === $response_member['ResponseCd'] && ! $back_delivery ) {
2203 $cardlast4 = substr( $response_member['CardNo'], -4 );
2204 $expyy = substr( date_i18n( 'Y', current_time( 'timestamp' ) ), 0, 2 ) . substr( $response_member['CardExp'], 0, 2 );
2205 $expmm = substr( $response_member['CardExp'], 2, 2 );
2206 $card_change_url = add_query_arg(
2207 array(
2208 'backDelivery' => $this->acting_card,
2209 'card_change' => 1,
2210 ),
2211 USCES_CART_URL
2212 );
2213 $html .= '
2214 <input name="cardno" type="hidden" value="8888888888888888" />
2215 <input name="cardlast4" type="hidden" value="' . $cardlast4 . '" />
2216 <input name="expyy" type="hidden" value="' . $expyy . '" />
2217 <input name="expmm" type="hidden" value="' . $expmm . '" />
2218 <input name="quick_member" type="hidden" value="add">
2219 <tr>
2220 <th scope="row">' . __( 'The last four digits of your card number', 'usces' ) . '</th>
2221 <td colspan="2"><p>' . $cardlast4 . ' (<a href="' . $card_change_url . '">' . __( 'Change of card information, click here', 'usces' ) . '</a>)</p></td>
2222 </tr>';
2223 } else {
2224 $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>' );
2225 $change = ( $card_change ) ? '<input type="hidden" name="card_change" value="1">' : '';
2226 $quickpay = '';
2227 if ( usces_is_login() && 'on' === $acting_opts['quickpay'] ) {
2228 if ( usces_have_regular_order() || usces_have_continue_charge() ) {
2229 $quickpay = '<input type="hidden" name="quick_member" value="add">';
2230 } elseif ( 'on' !== $acting_opts['chooseable_quickpay'] ) {
2231 $quickpay = '<input type="hidden" name="quick_member" value="add">';
2232 } else {
2233 $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>';
2234 }
2235 } else {
2236 $quickpay = '<input type="hidden" name="quick_member" value="no">';
2237 }
2238 $html .= '
2239 <tr>
2240 <th scope="row">' . __( 'card number', 'usces' ) . '</th>
2241 <td colspan="2"><input name="cardno" id="cardno" type="tel" value="' . $cardno . '" />' . $cardno_attention . $change . $quickpay . '</td>
2242 </tr>';
2243 if ( 'on' === $acting_opts['seccd'] ) {
2244 $seccd = filter_input( INPUT_POST, 'seccd', FILTER_DEFAULT );
2245 $seccd_attention = apply_filters( 'usces_filter_seccd_attention', __( '(Single-byte numbers only)', 'usces' ) );
2246 $html .= '
2247 <tr>
2248 <th scope="row">' . __( 'security code', 'usces' ) . '</th>
2249 <td colspan="2"><input name="seccd" type="tel" value="' . $seccd . '" />' . $seccd_attention . '</td>
2250 </tr>';
2251 }
2252 $html .= '
2253 <tr>
2254 <th scope="row">' . __( 'Card expiration', 'usces' ) . '</th>
2255 <td colspan="2">
2256 <select name="expmm">
2257 <option value="">--</option>';
2258 for ( $i = 1; $i <= 12; $i++ ) {
2259 $html .= '
2260 <option value="' . sprintf( '%02d', $i ) . '"' . selected( $i, (int) $expmm, false ) . '>' . sprintf( '%2d', $i ) . '</option>';
2261 }
2262 $html .= '
2263 </select>' . __( 'month', 'usces' ) . '&nbsp;
2264 <select name="expyy">
2265 <option value="">----</option>';
2266 for ( $i = 0; $i < 15; $i++ ) {
2267 $year = date_i18n( 'Y' ) + $i;
2268 $html .= '
2269 <option value="' . $year . '"' . selected( $year, $expyy, false ) . '>' . $year . '</option>';
2270 }
2271 $html .= '
2272 </select>' . __( 'year', 'usces' ) . '
2273 </td>
2274 </tr>';
2275
2276 $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>' );
2277 $html .= '
2278 <tr>
2279 <th scope="row">' . __( 'Card name', 'usces' ) . '</th>
2280 <td colspan="2"><input name="billingname" type="text" value="" />' . $cardname_attention . '</td>
2281 </tr>';
2282 }
2283
2284 $html_paytype = '';
2285 if ( ( usces_have_regular_order() || usces_have_continue_charge() ) && usces_is_login() ) {
2286 $html_paytype .= '<input type="hidden" name="offer[paytype]" value="01" />';
2287 } else {
2288 if ( 1 === (int) $acting_opts['howtopay'] ) {
2289 $html_paytype .= '<input type="hidden" name="offer[paytype]" value="01" />';
2290 } elseif ( 2 <= (int) $acting_opts['howtopay'] ) {
2291 $cardfirst4 = ( 'OK' === $response_member['ResponseCd'] && ! $back_delivery ) ? '<input type="hidden" id="cardno" value="' . substr( $response_member['CardNo'], 0, 4 ) . '" />' : ''; /* �
2292 �頭4桁 */
2293 $html_paytype .= '
2294 <tr>
2295 <th scope="row">' . __( 'Number of payments', 'usces' ) . '</th>
2296 <td colspan="2">' . $cardfirst4 . '<div class="paytype">';
2297 $html_paytype .= '
2298 <select name="offer[paytype]" id="paytype_default" >
2299 <option value="01"' . selected( $paytype, '01', false ) . '>' . __( 'One time payment', 'usces' ) . '</option>
2300 </select>';
2301 $html_paytype .= '
2302 <select name="offer[paytype]" id="paytype4535" style="display:none;" disabled="disabled" >
2303 <option value="01"' . selected( $paytype, '01', false ) . '>1' . __( '-time payment', 'usces' ) . '</option>
2304 <option value="02"' . selected( $paytype, '02', false ) . '>2' . __( '-time payment', 'usces' ) . '</option>
2305 <option value="03"' . selected( $paytype, '03', false ) . '>3' . __( '-time payment', 'usces' ) . '</option>
2306 <option value="05"' . selected( $paytype, '05', false ) . '>5' . __( '-time payment', 'usces' ) . '</option>
2307 <option value="06"' . selected( $paytype, '06', false ) . '>6' . __( '-time payment', 'usces' ) . '</option>
2308 <option value="10"' . selected( $paytype, '10', false ) . '>10' . __( '-time payment', 'usces' ) . '</option>
2309 <option value="12"' . selected( $paytype, '12', false ) . '>12' . __( '-time payment', 'usces' ) . '</option>
2310 <option value="15"' . selected( $paytype, '15', false ) . '>15' . __( '-time payment', 'usces' ) . '</option>
2311 <option value="18"' . selected( $paytype, '18', false ) . '>18' . __( '-time payment', 'usces' ) . '</option>
2312 <option value="20"' . selected( $paytype, '20', false ) . '>20' . __( '-time payment', 'usces' ) . '</option>
2313 <option value="24"' . selected( $paytype, '24', false ) . '>24' . __( '-time payment', 'usces' ) . '</option>
2314 <option value="88"' . selected( $paytype, '88', false ) . ' >' . __( 'Libor Funding pay', 'usces' ) . '</option>';
2315 if ( 3 === (int) $acting_opts['howtopay'] ) {
2316 $html_paytype .= '
2317 <option value="80"' . selected( $paytype, '80', false ) . '>' . __( 'Bonus lump-sum payment', 'usces' ) . '</option>';
2318 }
2319 $html_paytype .= '
2320 </select>';
2321 $html_paytype .= '
2322 <select name="offer[paytype]" id="paytype37" style="display:none;" disabled="disabled" >
2323 <option value="01"' . selected( $paytype, '01', false ) . '>1' . __( '-time payment', 'usces' ) . '</option>
2324 <option value="03"' . selected( $paytype, '03', false ) . '>3' . __( '-time payment', 'usces' ) . '</option>
2325 <option value="05"' . selected( $paytype, '05', false ) . '>5' . __( '-time payment', 'usces' ) . '</option>
2326 <option value="06"' . selected( $paytype, '06', false ) . '>6' . __( '-time payment', 'usces' ) . '</option>
2327 <option value="10"' . selected( $paytype, '10', false ) . '>10' . __( '-time payment', 'usces' ) . '</option>
2328 <option value="12"' . selected( $paytype, '12', false ) . '>12' . __( '-time payment', 'usces' ) . '</option>
2329 <option value="15"' . selected( $paytype, '15', false ) . '>15' . __( '-time payment', 'usces' ) . '</option>
2330 <option value="18"' . selected( $paytype, '18', false ) . '>18' . __( '-time payment', 'usces' ) . '</option>
2331 <option value="20"' . selected( $paytype, '20', false ) . '>20' . __( '-time payment', 'usces' ) . '</option>
2332 <option value="24"' . selected( $paytype, '24', false ) . '>24' . __( '-time payment', 'usces' ) . '</option>';
2333 if ( 3 === (int) $acting_opts['howtopay'] ) {
2334 $html_paytype .= '
2335 <option value="80"' . selected( $paytype, '80', false ) . '>' . __( 'Bonus lump-sum payment', 'usces' ) . '</option>';
2336 }
2337 $html_paytype .= '
2338 </select>';
2339 $html_paytype .= '
2340 <select name="offer[paytype]" id="paytype36" style="display:none;" disabled="disabled" >
2341 <option value="01"' . selected( $paytype, '01', false ) . '>' . __( 'One time payment', 'usces' ) . '</option>
2342 <option value="88"' . selected( $paytype, '88', false ) . '>' . __( 'Libor Funding pay', 'usces' ) . '</option>';
2343 if ( 3 === (int) $acting_opts['howtopay'] ) {
2344 $html_paytype .= '
2345 <option value="80"' . selected( $paytype, '80', false ) . '>' . __( 'Bonus lump-sum payment', 'usces' ) . '</option>';
2346 }
2347 $html_paytype .= '
2348 </select>';
2349 $html_paytype .= '</div>
2350 </td>
2351 </tr>';
2352 }
2353 }
2354 $html .= apply_filters( 'usces_filter_escott_secure_form_paytype', $html_paytype );
2355 $html .= '
2356 </table><table>';
2357 }
2358 return $html;
2359 }
2360
2361 /**
2362 * 会員データ削除チェック
2363 * usces_filter_delete_member_check
2364 *
2365 * @param boolean $del Removable|unavailable.
2366 * @param int $member_id Member ID.
2367 * @return boolean
2368 */
2369 public function delete_member_check( $del, $member_id ) {
2370 $kaiin_id = $this->get_quick_kaiin_id( $member_id );
2371 if ( ! empty( $kaiin_id ) ) {
2372 $del = false;
2373 }
2374 return $del;
2375 }
2376
2377 /**
2378 * Front styles.
2379 * wp_print_styles
2380 */
2381 public function print_styles() {
2382 global $usces;
2383
2384 /* 発送・支払方法ページ */
2385 if ( ! is_admin() && 'delivery' === $usces->page && $this->is_validity_acting( 'card' ) ) :
2386 $acting_opts = $this->get_acting_settings();
2387 if ( isset( $acting_opts['card_activate'] ) && ( 'token' === $acting_opts['card_activate'] || 'link' === $acting_opts['card_activate'] ) ) :
2388 ?>
2389 <style type="text/css">
2390 #escott-dialog {
2391 left: 50% !important;
2392 transform: translateY(-50%) translateX(-50%);
2393 -webkit- transform: translateY(-50%) translateX(-50%);
2394 width: 90% !important;
2395 max-width: 700px;
2396 }
2397 #escott-agree-dialog {
2398 height: auto !important;
2399 }
2400 .escott_agreement_message {
2401 width: 100%;
2402 height: 200px;
2403 }
2404 </style>
2405 <?php
2406 endif;
2407 endif;
2408 }
2409
2410 /**
2411 * Scripts.
2412 * wp_enqueue_scripts
2413 */
2414 public function enqueue_scripts() {
2415 global $usces;
2416
2417 /* 発送・支払方法ページ */
2418 if ( ! is_admin() && 'delivery' === $usces->page && $this->is_validity_acting( 'card' ) ) :
2419 $acting_opts = $this->get_acting_settings();
2420 if ( isset( $acting_opts['card_activate'] ) && 'token' === $acting_opts['card_activate'] ) :
2421 ?>
2422 <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>
2423 <?php
2424 endif;
2425 endif;
2426 }
2427
2428 /**
2429 * Set uscesL10n.
2430 * usces_filter_uscesL10n
2431 *
2432 * @param string $l10n uscesL10n.
2433 * @param int $post_id Post ID.
2434 * @return string
2435 */
2436 public function set_uscesL10n( $l10n, $post_id ) {
2437 global $usces;
2438
2439 if ( $usces->is_cart_page( $_SERVER['REQUEST_URI'] ) && 'delivery' === $usces->page ) {
2440 $acting_opts = $this->get_acting_settings();
2441 if ( isset( $acting_opts['card_activate'] ) && 'token' === $acting_opts['card_activate'] ) {
2442 $front_ajaxurl = trailingslashit( USCES_SSL_URL ) . 'index.php';
2443 $l10n .= "'front_ajaxurl': '" . $front_ajaxurl . "',\n";
2444 $payment_method = usces_get_system_option( 'usces_payment_method', 'sort' );
2445 $payment_method = apply_filters( 'usces_fiter_the_payment_method', $payment_method, '' );
2446 foreach ( (array) $payment_method as $id => $payment ) {
2447 if ( $payment['settlement'] === $this->acting_flg_card ) {
2448 $l10n .= "'escott_token_payment_id': '" . $id . "',\n";
2449 break;
2450 }
2451 }
2452 $l10n .= "'escott_token_dialog_title': '" . __( 'Credit card information', 'usces' ) . "',\n";
2453 $l10n .= "'escott_token_btn_next': '" . __( 'Next', 'usces' ) . "',\n";
2454 $l10n .= "'escott_token_btn_cancel': '" . __( 'Cancel', 'usces' ) . "',\n";
2455 $l10n .= "'escott_token_error_message': '" . __( 'Credit card information is not appropriate.', 'usces' ) . "',\n";
2456 }
2457 }
2458 return $l10n;
2459 }
2460
2461 /**
2462 * Front ajax.
2463 * usces_front_ajax
2464 */
2465 public function front_ajax() {
2466 global $usces;
2467
2468 $usces_ajax_action = filter_input( INPUT_POST, 'usces_ajax_action', FILTER_DEFAULT );
2469 switch ( $usces_ajax_action ) {
2470 case 'escott_token_dialog':
2471 if ( ! wp_verify_nonce( filter_input( INPUT_POST, 'wc_nonce', FILTER_DEFAULT ), 'wc_delivery_secure_nonce' ) ) {
2472 wp_redirect( USCES_CART_URL );
2473 }
2474
2475 $data = array();
2476 $acting_opts = $this->get_acting_settings();
2477 $card_change = ( isset( $_POST['card_change'] ) ) ? true : false;
2478
2479 $html = '';
2480 $html .= '
2481 <table class="customer_form settlement_form" id="' . $this->paymod_id . '">';
2482
2483 if ( usces_is_login() ) {
2484 $member = $usces->get_member();
2485 $kaiin_id = $this->get_quick_kaiin_id( $member['ID'] );
2486 $kaiin_pass = $this->get_quick_pass( $member['ID'] );
2487 }
2488
2489 $response_member = array(
2490 'ResponseCd' => '',
2491 );
2492
2493 if ( 'on' === $acting_opts['quickpay'] && ! empty( $kaiin_id ) && ! empty( $kaiin_pass ) && ! $card_change ) {
2494 /* e-SCOTT 会員�
2495 �会 */
2496 $response_member = $this->escott_member_reference( $member['ID'], $kaiin_id, $kaiin_pass );
2497 }
2498
2499 if ( 'OK' === $response_member['ResponseCd'] ) {
2500 $cardlast4 = substr( $response_member['CardNo'], -4 );
2501 $html .= '
2502 <tr>
2503 <th scope="row">' . __( 'The last four digits of your card number', 'usces' ) . '</th>
2504 <td colspan="2"><p>' . $cardlast4 . ' (<a href="#" id="escott_card_change">' . __( 'Change of card information, click here', 'usces' ) . '</a>)</p></td>
2505 </tr>';
2506
2507 } else {
2508 $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>' );
2509 $change = ( $card_change ) ? '<input type="hidden" id="card_change" value="1">' : '';
2510 $quickpay = '';
2511 if ( usces_is_login() && 'on' === $acting_opts['quickpay'] ) {
2512 if ( usces_have_regular_order() || usces_have_continue_charge() ) {
2513 $quickpay = '<input type="hidden" id="quick_member" value="add">';
2514 } elseif ( 'on' !== $acting_opts['chooseable_quickpay'] ) {
2515 $quickpay = '<input type="hidden" id="quick_member" value="add">';
2516 } else {
2517 $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>';
2518 }
2519 } else {
2520 $quickpay = '<input type="hidden" id="quick_member" value="no">';
2521 }
2522 $html .= '
2523 <tr>
2524 <th scope="row">' . __( 'card number', 'usces' ) . '</th>
2525 <td colspan="2"><input id="cardno" type="tel" value="" />' . $cardno_attention . $change . $quickpay . '</td>
2526 </tr>';
2527 if ( 'on' === $acting_opts['seccd'] ) {
2528 $seccd_attention = apply_filters( 'usces_filter_seccd_attention', __( '(Single-byte numbers only)', 'usces' ) );
2529 $html .= '
2530 <tr>
2531 <th scope="row">' . __( 'security code', 'usces' ) . '</th>
2532 <td colspan="2"><input id="seccd" type="tel" value="" class="small-text" />' . $seccd_attention . '</td>
2533 </tr>';
2534 }
2535 $html .= '
2536 <tr>
2537 <th scope="row">' . __( 'Card expiration', 'usces' ) . '</th>
2538 <td colspan="2">
2539 <select id="expmm">
2540 <option value="">--</option>';
2541 for ( $i = 1; $i <= 12; $i++ ) {
2542 $html .= '
2543 <option value="' . sprintf( '%02d', $i ) . '">' . sprintf( '%2d', $i ) . '</option>';
2544 }
2545 $html .= '
2546 </select>' . __( 'month', 'usces' ) . '&nbsp;
2547 <select id="expyy">
2548 <option value="">----</option>';
2549 for ( $i = 0; $i < 15; $i++ ) {
2550 $year = date_i18n( 'Y' ) + $i;
2551 $html .= '
2552 <option value="' . $year . '">' . $year . '</option>';
2553 }
2554 $html .= '
2555 </select>' . __( 'year', 'usces' ) . '
2556 </td>
2557 </tr>';
2558
2559 $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>' );
2560 $html .= '
2561 <tr>
2562 <th scope="row">' . __( 'Card name', 'usces' ) . '</th>
2563 <td colspan="2"><input id="cardname" type="text" value="" />' . $cardname_attention . '</td>
2564 </tr>';
2565 }
2566
2567 $html_paytype = '';
2568 if ( ( usces_have_regular_order() || usces_have_continue_charge() ) && usces_is_login() ) {
2569 $html_paytype .= '<input type="hidden" id="paytype" value="01" />';
2570
2571 } else {
2572 if ( 1 === (int) $acting_opts['howtopay'] ) {
2573 $html_paytype .= '<input type="hidden" id="paytype" value="01" />';
2574
2575 } elseif ( 2 <= $acting_opts['howtopay'] ) {
2576 $cardfirst4 = ( 'OK' === $response_member['ResponseCd'] ) ? '<input type="hidden" id="cardno" value="' . substr( $response_member['CardNo'], 0, 4 ) . '" />' : ''; /* �
2577 �頭4桁 */
2578 $html_paytype .= '
2579 <tr>
2580 <th scope="row">' . __( 'Number of payments', 'usces' ) . '</th>
2581 <td colspan="2">' . $cardfirst4 . '<div class="paytype">';
2582
2583 $html_paytype .= '
2584 <select id="paytype_default" >
2585 <option value="01">' . __( 'One time payment', 'usces' ) . '</option>
2586 </select>';
2587
2588 $html_paytype .= '
2589 <select id="paytype4535" style="display:none;" disabled="disabled" >
2590 <option value="01">1' . __( '-time payment', 'usces' ) . '</option>
2591 <option value="02">2' . __( '-time payment', 'usces' ) . '</option>
2592 <option value="03">3' . __( '-time payment', 'usces' ) . '</option>
2593 <option value="05">5' . __( '-time payment', 'usces' ) . '</option>
2594 <option value="06">6' . __( '-time payment', 'usces' ) . '</option>
2595 <option value="10">10' . __( '-time payment', 'usces' ) . '</option>
2596 <option value="12">12' . __( '-time payment', 'usces' ) . '</option>
2597 <option value="15">15' . __( '-time payment', 'usces' ) . '</option>
2598 <option value="18">18' . __( '-time payment', 'usces' ) . '</option>
2599 <option value="20">20' . __( '-time payment', 'usces' ) . '</option>
2600 <option value="24">24' . __( '-time payment', 'usces' ) . '</option>
2601 <option value="88">' . __( 'Libor Funding pay', 'usces' ) . '</option>';
2602 if ( 3 === (int) $acting_opts['howtopay'] ) {
2603 $html_paytype .= '
2604 <option value="80">' . __( 'Bonus lump-sum payment', 'usces' ) . '</option>';
2605 }
2606 $html_paytype .= '
2607 </select>';
2608
2609 $html_paytype .= '
2610 <select id="paytype37" style="display:none;" disabled="disabled" >
2611 <option value="01">1' . __( '-time payment', 'usces' ) . '</option>
2612 <option value="03">3' . __( '-time payment', 'usces' ) . '</option>
2613 <option value="05">5' . __( '-time payment', 'usces' ) . '</option>
2614 <option value="06">6' . __( '-time payment', 'usces' ) . '</option>
2615 <option value="10">10' . __( '-time payment', 'usces' ) . '</option>
2616 <option value="12">12' . __( '-time payment', 'usces' ) . '</option>
2617 <option value="15">15' . __( '-time payment', 'usces' ) . '</option>
2618 <option value="18">18' . __( '-time payment', 'usces' ) . '</option>
2619 <option value="20">20' . __( '-time payment', 'usces' ) . '</option>
2620 <option value="24">24' . __( '-time payment', 'usces' ) . '</option>';
2621 if ( 3 === (int) $acting_opts['howtopay'] ) {
2622 $html_paytype .= '
2623 <option value="80">' . __( 'Bonus lump-sum payment', 'usces' ) . '</option>';
2624 }
2625 $html_paytype .= '
2626 </select>';
2627
2628 $html_paytype .= '
2629 <select id="paytype36" style="display:none;" disabled="disabled" >
2630 <option value="01">' . __( 'One time payment', 'usces' ) . '</option>
2631 <option value="88">' . __( 'Libor Funding pay', 'usces' ) . '</option>';
2632 if ( 3 === (int) $acting_opts['howtopay'] ) {
2633 $html_paytype .= '
2634 <option value="80">' . __( 'Bonus lump-sum payment', 'usces' ) . '</option>';
2635 }
2636 $html_paytype .= '
2637 </select>';
2638
2639 $html_paytype .= '</div>
2640 </td>
2641 </tr>';
2642 }
2643 }
2644 $html .= apply_filters( 'usces_filter_escott_secure_form_paytype_token', $html_paytype );
2645 $html .= '
2646 </table>';
2647 $quick = ( 'OK' === $response_member['ResponseCd'] ) ? 'quick' : '';
2648 $data['status'] = 'OK';
2649 $data['result'] = $html;
2650 $data['member'] = $quick;
2651 wp_send_json( $data );
2652 break;
2653
2654 case 'escott_set_token':
2655 if ( ! wp_verify_nonce( filter_input( INPUT_POST, 'wc_nonce', FILTER_DEFAULT ), 'wc_delivery_secure_nonce' ) ) {
2656 wp_redirect( USCES_CART_URL );
2657 }
2658
2659 $data = array();
2660 $data['status'] = 'OK';
2661 $data['result'] = '';
2662 wp_send_json( $data );
2663 break;
2664 }
2665 }
2666
2667 /**
2668 * 手数料ラベル
2669 * usces_filter_cod_label
2670 *
2671 * @param string $label Fee label.
2672 * @return string
2673 */
2674 public function set_fee_label( $label ) {
2675 global $usces;
2676
2677 if ( is_admin() ) {
2678 $order_id = ( isset( $_REQUEST['order_id'] ) ) ? wp_unslash( $_REQUEST['order_id'] ) : '';
2679 if ( ! empty( $order_id ) ) {
2680 $order_data = $usces->get_order_data( $order_id, 'direct' );
2681 if ( ! empty( $order_data['order_payment_name'] ) ) {
2682 $payment = usces_get_payments_by_name( $order_data['order_payment_name'] );
2683 if ( $this->acting_flg_conv === $payment['settlement'] || $this->acting_flg_atodene === $payment['settlement'] ) {
2684 $label = $payment['name'] . __( 'Fee', 'usces' );
2685 }
2686 }
2687 }
2688 } else {
2689 $usces_entries = $usces->cart->get_entry();
2690 $payment = usces_get_payments_by_name( $usces_entries['order']['payment_name'] );
2691 if ( $this->acting_flg_conv === $payment['settlement'] || $this->acting_flg_atodene === $payment['settlement'] ) {
2692 $label = $payment['name'] . __( 'Fee', 'usces' );
2693 }
2694 }
2695 return $label;
2696 }
2697
2698 /**
2699 * 手数料ラベル
2700 * usces_filter_member_history_cod_label
2701 *
2702 * @param string $label Fee label.
2703 * @param int $order_id Order number.
2704 * @return string
2705 */
2706 public function set_member_history_fee_label( $label, $order_id ) {
2707 global $usces;
2708
2709 $order_data = $usces->get_order_data( $order_id, 'direct' );
2710 $payment = usces_get_payments_by_name( $order_data['order_payment_name'] );
2711 if ( $this->acting_flg_conv === $payment['settlement'] || $this->acting_flg_atodene === $payment['settlement'] ) {
2712 $label = $payment['name'] . __( 'Fee', 'usces' );
2713 }
2714 return $label;
2715 }
2716
2717 /**
2718 * 支払方法
2719 * usces_fiter_the_payment_method
2720 *
2721 * @param array $payments Payments.
2722 * @return array
2723 */
2724 public function payment_method( $payments ) {
2725 $conv_exclusion = false;
2726
2727 if ( usces_have_regular_order() ) {
2728 $conv_exclusion = true;
2729
2730 } elseif ( usces_have_continue_charge() ) {
2731 $conv_exclusion = true;
2732 }
2733
2734 if ( $conv_exclusion ) {
2735 foreach ( $payments as $key => $payment ) {
2736 if ( $this->acting_flg_conv === $payment['settlement'] ) {
2737 unset( $payments[ $key ] );
2738 }
2739 }
2740 }
2741
2742 return $payments;
2743 }
2744
2745 /**
2746 * 決済手数料
2747 * usces_filter_set_cart_fees_cod
2748 *
2749 * @param float $cod_fee COD fee.
2750 * @param array $usces_entries Entry data.
2751 * @param float $total_items_price Total amount of items.
2752 * @param int $use_point Use point.
2753 * @param float $discount Discount.
2754 * @param float $shipping_charge Shipping charge.
2755 * @param float $amount_by_cod COD.
2756 * @return float
2757 */
2758 public function add_fee( $cod_fee, $usces_entries, $total_items_price, $use_point, $discount, $shipping_charge, $amount_by_cod ) {
2759 global $usces;
2760
2761 $payment = usces_get_payments_by_name( $usces_entries['order']['payment_name'] );
2762 if ( $this->acting_flg_conv !== $payment['settlement'] && $this->acting_flg_atodene !== $payment['settlement'] ) {
2763 return $cod_fee;
2764 }
2765
2766 $acting_opts = $this->get_acting_settings();
2767 $acting = explode( '_', $payment['settlement'] );
2768 $fee = 0;
2769 if ( ! empty( $acting_opts[ $acting[2] . '_fee_type' ] ) ) {
2770 if ( 'fix' === $acting_opts[ $acting[2] . '_fee_type' ] ) {
2771 $fee = (int) $acting_opts[ $acting[2] . '_fee' ];
2772 } else {
2773 $materials = array(
2774 'total_items_price' => $total_items_price,
2775 'discount' => $discount,
2776 'shipping_charge' => $shipping_charge,
2777 'cod_fee' => $cod_fee,
2778 'use_point' => $use_point,
2779 );
2780 $amount_by_fee = $total_items_price - $use_point + $discount;
2781 if ( 'all' === usces_is_fee_subject() ) {
2782 $amount_by_fee += $shipping_charge;
2783 }
2784 $price = $amount_by_fee + $usces->getTax( $amount_by_fee, $materials );
2785 if ( $price <= (int) $acting_opts[ $acting[2] . '_fee_first_amount' ] ) {
2786 $fee = $acting_opts[ $acting[2] . '_fee_first_fee' ];
2787 } elseif ( isset( $acting_opts[ $acting[2] . '_fee_amounts' ] ) && ! empty( $acting_opts[ $acting[2] . '_fee_amounts' ] ) ) {
2788 $last = count( $acting_opts[ $acting[2] . '_fee_amounts' ] ) - 1;
2789 if ( $price > $acting_opts[ $acting[2] . '_fee_amounts' ][ $last ] ) {
2790 $fee = $acting_opts[ $acting[2] . '_fee_end_fee' ];
2791 } else {
2792 foreach ( $acting_opts[ $acting[2] . '_fee_amounts' ] as $key => $value ) {
2793 if ( $price <= $value ) {
2794 $fee = $acting_opts[ $acting[2] . '_fee_fees' ][ $key ];
2795 break;
2796 }
2797 }
2798 }
2799 } else {
2800 $fee = $acting_opts[ $acting[2] . '_fee_end_fee' ];
2801 }
2802 }
2803 }
2804 return $cod_fee + $fee;
2805 }
2806
2807 /**
2808 * 決済手数料チェック
2809 * usces_filter_delivery_check usces_filter_point_check_last
2810 *
2811 * @param string $mes Message.
2812 * @return string
2813 */
2814 public function check_fee_limit( $mes ) {
2815 global $usces;
2816
2817 $member = $usces->get_member();
2818 $usces->set_cart_fees( $member, array() );
2819 $usces_entries = $usces->cart->get_entry();
2820 $payment = usces_get_payments_by_name( $usces_entries['order']['payment_name'] );
2821 if ( $this->acting_flg_conv !== $payment['settlement'] && $this->acting_flg_atodene !== $payment['settlement'] ) {
2822 return $mes;
2823 }
2824
2825 if ( 2 === (int) $usces_entries['delivery']['delivery_flag'] ) {
2826 $mes .= sprintf( __( "If you specify multiple shipping address, you cannot use '%s' payment method.", 'usces' ), $usces_entries['order']['payment_name'] );
2827 return $mes;
2828 }
2829
2830 $acting_opts = $this->get_acting_settings();
2831 $fee_limit_amount = 0;
2832 switch ( $payment['settlement'] ) {
2833 case $this->acting_flg_conv:
2834 if ( ! empty( $acting_opts['conv_fee_limit_amount'] ) ) {
2835 $fee_limit_amount = (int) $acting_opts['conv_fee_limit_amount'];
2836 }
2837 break;
2838
2839 case $this->acting_flg_atodene:
2840 if ( ! empty( $acting_opts['atodene_fee_limit_amount'] ) ) {
2841 $fee_limit_amount = (int) $acting_opts['atodene_fee_limit_amount'];
2842 }
2843 break;
2844 }
2845
2846 if ( 0 < $fee_limit_amount && $usces_entries['order']['total_full_price'] > $fee_limit_amount ) {
2847 $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 ) );
2848 }
2849
2850 return $mes;
2851 }
2852
2853 /**
2854 * 決済オプション取得
2855 *
2856 * @return array
2857 */
2858 protected function get_acting_settings() {
2859 global $usces;
2860
2861 $acting_settings = ( isset( $usces->options['acting_settings'][ $this->paymod_id ] ) ) ? $usces->options['acting_settings'][ $this->paymod_id ] : array();
2862 $acting_settings['key_aes'] = ( empty( $acting_settings['card_key_aes'] ) ) ? 'HgmhZ94rN799CD3F' : $acting_settings['card_key_aes'];
2863 $acting_settings['key_iv'] = ( empty( $acting_settings['card_key_iv'] ) ) ? 'gNqc4zwhNLCSC5cv' : $acting_settings['card_key_iv'];
2864 return $acting_settings;
2865 }
2866
2867 /**
2868 * 処理日付生成
2869 *
2870 * @return string 'YYYYMMDD'
2871 */
2872 protected function get_transaction_date() {
2873 $transaction_date = date_i18n( 'Ymd', current_time( 'timestamp' ) );
2874 return $transaction_date;
2875 }
2876
2877 /**
2878 * e-SCOTT 会員ID取得
2879 *
2880 * @param int $member_id Member ID.
2881 * @param string $type Module type.
2882 * @return string
2883 */
2884 public function get_quick_kaiin_id( $member_id, $type = '' ) {
2885 global $usces;
2886
2887 if ( empty( $member_id ) ) {
2888 return false;
2889 }
2890
2891 if ( '' === $type ) {
2892 $escott_member_id = $usces->get_member_meta_value( $this->quick_key_pre . '_member_id', $member_id );
2893 } else {
2894 $escott_member_id = $usces->get_member_meta_value( $this->quick_key_pre . '_' . $type . '_member_id', $member_id );
2895 }
2896 return $escott_member_id;
2897 }
2898
2899 /**
2900 * e-SCOTT 会員パスワード取得
2901 *
2902 * @param int $member_id Member ID.
2903 * @param string $type Module type.
2904 * @return string
2905 */
2906 public function get_quick_pass( $member_id, $type = '' ) {
2907 global $usces;
2908
2909 if ( empty( $member_id ) ) {
2910 return false;
2911 }
2912
2913 if ( '' === $type ) {
2914 $escott_member_passwd = $usces->get_member_meta_value( $this->quick_key_pre . '_member_passwd', $member_id );
2915 } else {
2916 $escott_member_passwd = $usces->get_member_meta_value( $this->quick_key_pre . '_' . $type . '_member_passwd', $member_id );
2917 }
2918 return $escott_member_passwd;
2919 }
2920
2921 /**
2922 * e-SCOTT 会員ID生成
2923 *
2924 * @param int $member_id Member ID.
2925 * @return string
2926 */
2927 public function make_kaiin_id( $member_id ) {
2928 $digit = 11 - strlen( $member_id );
2929 $num = str_repeat( '9', $digit );
2930 $id = sprintf( '%0' . $digit . 'd', mt_rand( 1, (int) $num ) );
2931 return 'w' . $member_id . 'i' . $id;
2932 }
2933
2934 /**
2935 * e-SCOTT 会員パスワード生成
2936 *
2937 * @return string
2938 */
2939 public function make_kaiin_pass() {
2940 $passwd = sprintf( '%012d', mt_rand() );
2941 return $passwd;
2942 }
2943
2944 /**
2945 * e-SCOTT 会員�
2946 報登録・更新
2947 *
2948 * @param array $param_list Parameters.
2949 * @return array
2950 */
2951 public function escott_member_process( $param_list = array() ) {
2952 global $usces;
2953
2954 $member = $usces->get_member();
2955 $acting_opts = $this->get_acting_settings();
2956 $params = array();
2957 $params['send_url'] = $acting_opts['send_url_member'];
2958 $params['param_list'] = $param_list;
2959
2960 $response_member = array( 'ResponseCd' => '' );
2961 $kaiin_id = $this->get_quick_kaiin_id( $member['ID'] );
2962 $kaiin_pass = $this->get_quick_pass( $member['ID'] );
2963
2964 if ( empty( $kaiin_id ) || empty( $kaiin_pass ) ) {
2965 $kaiin_id = $this->make_kaiin_id( $member['ID'] );
2966 $kaiin_pass = $this->make_kaiin_pass();
2967 $params['param_list']['OperateId'] = '4MemAdd';
2968 $params['param_list']['KaiinId'] = $kaiin_id;
2969 $params['param_list']['KaiinPass'] = $kaiin_pass;
2970 if ( ! isset( $param_list['Token'] ) && isset( $_POST['cardno'] ) && isset( $_POST['expyy'] ) && isset( $_POST['expmm'] ) ) {
2971 $params['param_list']['CardNo'] = trim( filter_input( INPUT_POST, 'cardno', FILTER_DEFAULT ) );
2972 $params['param_list']['CardExp'] = substr( filter_input( INPUT_POST, 'expyy', FILTER_DEFAULT ), 2 ) . filter_input( INPUT_POST, 'expmm', FILTER_DEFAULT );
2973 if ( 'on' === $acting_opts['seccd'] && isset( $_POST['seccd'] ) ) {
2974 $params['param_list']['SecCd'] = trim( filter_input( INPUT_POST, 'seccd', FILTER_DEFAULT ) );
2975 }
2976 }
2977 /* e-SCOTT 新規会員登録 */
2978 $response_member = $this->connection( $params );
2979 if ( 'OK' === $response_member['ResponseCd'] ) {
2980 $usces->set_member_meta_value( $this->quick_key_pre . '_member_id', $kaiin_id, $member['ID'] );
2981 $usces->set_member_meta_value( $this->quick_key_pre . '_member_passwd', $kaiin_pass, $member['ID'] );
2982 $response_member['KaiinId'] = $kaiin_id;
2983 $response_member['KaiinPass'] = $kaiin_pass;
2984 $response_member['use_token'] = true;
2985 }
2986 } else {
2987 $params['param_list']['OperateId'] = '4MemRefM';
2988 $params['param_list']['KaiinId'] = $kaiin_id;
2989 $params['param_list']['KaiinPass'] = $kaiin_pass;
2990 /* e-SCOTT 会員�
2991 �会 */
2992 $response_member = $this->connection( $params );
2993 if ( 'OK' === $response_member['ResponseCd'] ) {
2994 $card_change = filter_input( INPUT_POST, 'card_change', FILTER_DEFAULT );
2995 if ( '1' === $card_change ) {
2996 $params['param_list']['OperateId'] = '4MemChg';
2997 $cardno = filter_input( INPUT_POST, 'cardno', FILTER_DEFAULT );
2998 if ( ! isset( $param_list['Token'] ) && '8888888888888888' !== $cardno && isset( $_POST['expyy'] ) && isset( $_POST['expmm'] ) ) {
2999 $params['param_list']['CardNo'] = trim( $cardno );
3000 $params['param_list']['CardExp'] = substr( filter_input( INPUT_POST, 'expyy', FILTER_DEFAULT ), 2 ) . filter_input( INPUT_POST, 'expmm', FILTER_DEFAULT );
3001 if ( 'on' === $acting_opts['seccd'] && isset( $_POST['seccd'] ) ) {
3002 $params['param_list']['SecCd'] = trim( filter_input( INPUT_POST, 'seccd', FILTER_DEFAULT ) );
3003 }
3004 }
3005 /* e-SCOTT 会員更新 */
3006 $response_member = $this->connection( $params );
3007 $response_member['KaiinId'] = $kaiin_id;
3008 $response_member['KaiinPass'] = $kaiin_pass;
3009 $response_member['use_token'] = true;
3010 } else {
3011 $response_member['KaiinId'] = $kaiin_id;
3012 $response_member['KaiinPass'] = $kaiin_pass;
3013 $response_member['use_token'] = false;
3014 }
3015 }
3016 }
3017 return $response_member;
3018 }
3019
3020 /**
3021 * e-SCOTT 会員�
3022 報登録
3023 *
3024 * @param int $member_id Member ID.
3025 * @return array
3026 */
3027 public function escott_member_register( $member_id ) {
3028 global $usces;
3029
3030 $response_member = array( 'ResponseCd' => '' );
3031 $acting_opts = $this->get_acting_settings();
3032 $transaction_date = $this->get_transaction_date();
3033 $param_list = array();
3034 $params = array();
3035
3036 $post_data = wp_unslash( $_POST );
3037
3038 /* �
3039 �通部 */
3040 $param_list['MerchantId'] = $acting_opts['merchant_id'];
3041 $param_list['MerchantPass'] = $acting_opts['merchant_pass'];
3042 $param_list['TransactionDate'] = $transaction_date;
3043 $param_list['MerchantFree3'] = $this->merchantfree3;
3044 $param_list['TenantId'] = $acting_opts['tenant_id'];
3045 if ( 'on' === $acting_opts['sec3d_activate'] && isset( $post_data['rand'] ) ) {
3046 $param_list['MerchantFree1'] = $post_data['rand'];
3047 }
3048
3049 if ( 'on' === $acting_opts['sec3d_activate'] && isset( $post_data['done3d_member'] ) ) {
3050 if ( isset( $post_data['SecureResultCode'] ) && isset( $post_data['ResponseCd'] ) && 'OK' === $post_data['ResponseCd'] ) {
3051 $response_member = $this->escott_member_reference( $member_id );
3052 if ( 'OK' !== $response_member['ResponseCd'] ) {
3053 $usces->del_member_meta( $this->quick_key_pre . '_member_id', $member_id );
3054 $usces->del_member_meta( $this->quick_key_pre . '_member_passwd', $member_id );
3055 }
3056 } else {
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 $token = filter_input( INPUT_POST, 'token' );
3062 if ( ! empty( $token ) ) {
3063 $param_list['Token'] = $token;
3064 $param_list['OperateId'] = '1TokenSearch';
3065 $params['send_url'] = $acting_opts['send_url_token'];
3066 $params['param_list'] = $param_list;
3067 /* e-SCOTT トークンステータス参�
3068 � */
3069 $response_token = $this->connection( $params );
3070 if ( 'OK' !== $response_token['ResponseCd'] || 'OK' !== $response_token['TokenResponseCd'] ) {
3071 $tokenresponsecd = '';
3072 if ( isset( $response_token['TokenResponseCd'] ) ) {
3073 $responsecd = explode( '|', $response_token['ResponseCd'] . '|' . $response_token['TokenResponseCd'] );
3074 } else {
3075 $responsecd = explode( '|', $response_token['ResponseCd'] );
3076 }
3077 foreach ( (array) $responsecd as $cd ) {
3078 if ( 'OK' !== $cd ) {
3079 $response_token[ $cd ] = $this->response_message( $cd );
3080 $tokenresponsecd .= $cd . '|';
3081 }
3082 }
3083 $response_token['ResponseCd'] = rtrim( $tokenresponsecd, '|' );
3084 return $response_token;
3085 }
3086 unset( $params['param_list'] );
3087 }
3088
3089 /* 3Dセキュア認証画面へリダイレクト */
3090 if ( 'on' === $acting_opts['sec3d_activate'] ) {
3091 $this->certification_3dsecure_member( $param_list, $post_data, $member_id, 'member_register_settlement' );
3092 }
3093 }
3094
3095 if ( 'on' !== $acting_opts['sec3d_activate'] ) {
3096 if ( isset( $param_list['MerchantFree2'] ) ) {
3097 unset( $param_list['MerchantFree2'] );
3098 }
3099
3100 $kaiin_id = $this->make_kaiin_id( $member_id );
3101 $kaiin_pass = $this->make_kaiin_pass();
3102
3103 $params['send_url'] = $acting_opts['send_url_member'];
3104 $params['param_list'] = array_merge(
3105 $param_list,
3106 array(
3107 'OperateId' => '4MemAdd',
3108 'KaiinId' => $kaiin_id,
3109 'KaiinPass' => $kaiin_pass,
3110 )
3111 );
3112
3113 /* e-SCOTT 新規会員登録 */
3114 $response_member = $this->connection( $params );
3115 if ( 'OK' === $response_member['ResponseCd'] ) {
3116 $usces->set_member_meta_value( $this->quick_key_pre . '_member_id', $kaiin_id, $member_id );
3117 $usces->set_member_meta_value( $this->quick_key_pre . '_member_passwd', $kaiin_pass, $member_id );
3118 $response_member['KaiinId'] = $kaiin_id;
3119 $response_member['KaiinPass'] = $kaiin_pass;
3120 }
3121 }
3122 return $response_member;
3123 }
3124
3125 /**
3126 * e-SCOTT 会員�
3127 報更新
3128 *
3129 * @param int $member_id Member ID.
3130 * @return array
3131 */
3132 public function escott_member_update( $member_id ) {
3133 global $usces;
3134
3135 $response_member = array( 'ResponseCd' => '' );
3136 $acting_opts = $this->get_acting_settings();
3137 $kaiin_id = $this->get_quick_kaiin_id( $member_id );
3138 $kaiin_pass = $this->get_quick_pass( $member_id );
3139
3140 $post_data = wp_unslash( $_POST );
3141
3142 if ( 'on' === $acting_opts['sec3d_activate'] && isset( $post_data['done3d_member'] ) ) {
3143 if ( isset( $post_data['SecureResultCode'] ) && isset( $post_data['ResponseCd'] ) && 'OK' === $post_data['ResponseCd'] ) {
3144 $response_member = $this->escott_member_reference( $member_id );
3145 } else {
3146 usces_log( '[' . $this->acting_name . '] 4MemChg NG : ' . print_r( $post_data, true ), 'acting_transaction.log' );
3147 }
3148 } else {
3149 if ( $kaiin_id && $kaiin_pass ) {
3150 $acting_opts = $this->get_acting_settings();
3151 $transaction_date = $this->get_transaction_date();
3152 $param_list = array();
3153 $params = array();
3154
3155 /* �
3156 �通部 */
3157 $param_list['MerchantId'] = $acting_opts['merchant_id'];
3158 $param_list['MerchantPass'] = $acting_opts['merchant_pass'];
3159 $param_list['TransactionDate'] = $transaction_date;
3160 $param_list['MerchantFree3'] = $this->merchantfree3;
3161 $param_list['TenantId'] = $acting_opts['tenant_id'];
3162 if ( 'on' === $acting_opts['sec3d_activate'] && isset( $post_data['rand'] ) ) {
3163 $param_list['MerchantFree1'] = $post_data['rand'];
3164 }
3165
3166 $token = filter_input( INPUT_POST, 'token', FILTER_DEFAULT );
3167 if ( ! empty( $token ) ) {
3168 $param_list['Token'] = $token;
3169 } else {
3170 if ( ! empty( $_POST['cardno'] ) ) {
3171 $param_list['CardNo'] = trim( filter_input( INPUT_POST, 'cardno', FILTER_DEFAULT ) );
3172 }
3173 if ( 'on' === $acting_opts['seccd'] && ! empty( $_POST['seccd'] ) ) {
3174 $param_list['SecCd'] = trim( filter_input( INPUT_POST, 'seccd', FILTER_DEFAULT ) );
3175 }
3176 if ( ! empty( $_POST['expyy'] ) && ! empty( $_POST['expmm'] ) ) {
3177 $param_list['CardExp'] = substr( filter_input( INPUT_POST, 'expyy', FILTER_DEFAULT ), 2 ) . filter_input( INPUT_POST, 'expmm', FILTER_DEFAULT );
3178 }
3179 }
3180
3181 /* 3Dセキュア認証画面へリダイレクト */
3182 if ( 'on' === $acting_opts['sec3d_activate'] ) {
3183 $this->certification_3dsecure_member( $param_list, $post_data, $member_id, 'member_update_settlement' );
3184 }
3185 }
3186 }
3187
3188 if ( 'on' !== $acting_opts['sec3d_activate'] ) {
3189 if ( $kaiin_id && $kaiin_pass ) {
3190 if ( isset( $param_list['MerchantFree2'] ) ) {
3191 unset( $param_list['MerchantFree2'] );
3192 }
3193 $params['send_url'] = $acting_opts['send_url_member'];
3194 $params['param_list'] = array_merge(
3195 $param_list,
3196 array(
3197 'OperateId' => '4MemChg',
3198 'KaiinId' => $kaiin_id,
3199 'KaiinPass' => $kaiin_pass,
3200 )
3201 );
3202 /* e-SCOTT 会員更新 */
3203 $response_member = $this->connection( $params );
3204 if ( 'OK' !== $response_member['ResponseCd'] ) {
3205 usces_log( '[' . $this->acting_name . '] 4MemChg NG : ' . print_r( $response_member, true ), 'acting_transaction.log' );
3206 }
3207 }
3208 }
3209 return $response_member;
3210 }
3211
3212 /**
3213 * e-SCOTT 会員�
3214 報削除
3215 *
3216 * @param int $member_id Member ID.
3217 * @param bool $forced Forced deletion.
3218 * @return array
3219 */
3220 public function escott_member_delete( $member_id, $forced = false ) {
3221 global $usces;
3222
3223 $response_member = array( 'ResponseCd' => '' );
3224 $kaiin_id = $this->get_quick_kaiin_id( $member_id );
3225 $kaiin_pass = $this->get_quick_pass( $member_id );
3226
3227 if ( $kaiin_id && $kaiin_pass ) {
3228
3229 if ( $forced ) { /* 強制削除 */
3230 $usces->del_member_meta( $this->quick_key_pre . '_member_id', $member_id );
3231 $usces->del_member_meta( $this->quick_key_pre . '_member_passwd', $member_id );
3232
3233 } else {
3234 $acting_opts = $this->get_acting_settings();
3235 $transaction_date = $this->get_transaction_date();
3236 $param_list = array();
3237 $params = array();
3238
3239 /* �
3240 �通部 */
3241 $param_list['MerchantId'] = $acting_opts['merchant_id'];
3242 $param_list['MerchantPass'] = $acting_opts['merchant_pass'];
3243 $param_list['TransactionDate'] = $transaction_date;
3244 $param_list['MerchantFree3'] = $this->merchantfree3;
3245 $param_list['TenantId'] = $acting_opts['tenant_id'];
3246 $params['send_url'] = $acting_opts['send_url_member'];
3247 $params['param_list'] = array_merge(
3248 $param_list,
3249 array(
3250 'OperateId' => '4MemInval',
3251 'KaiinId' => $kaiin_id,
3252 'KaiinPass' => $kaiin_pass,
3253 )
3254 );
3255 /* e-SCOTT 会員無効 */
3256 $response_member = $this->connection( $params );
3257 if ( 'OK' === $response_member['ResponseCd'] ) {
3258 $params['param_list'] = array_merge(
3259 $param_list,
3260 array(
3261 'OperateId' => '4MemDel',
3262 'KaiinId' => $kaiin_id,
3263 'KaiinPass' => $kaiin_pass,
3264 )
3265 );
3266 /* e-SCOTT 会員削除 */
3267 $response_member = array(
3268 'ResponseCd' => '',
3269 );
3270 $response_member = $this->connection( $params );
3271 if ( 'OK' === $response_member['ResponseCd'] ) {
3272 $usces->del_member_meta( $this->quick_key_pre . '_member_id', $member_id );
3273 $usces->del_member_meta( $this->quick_key_pre . '_member_passwd', $member_id );
3274 } else {
3275 usces_log( '[' . $this->acting_name . '] 4MemDel NG : ' . print_r( $response_member, true ), 'acting_transaction.log' );
3276 }
3277 } else {
3278 usces_log( '[' . $this->acting_name . '] 4MemInval NG : ' . print_r( $response_member, true ), 'acting_transaction.log' );
3279 }
3280 }
3281 }
3282 return $response_member;
3283 }
3284
3285 /**
3286 * e-SCOTT 会員�
3287 報�
3288 �会
3289 *
3290 * @param int $member_id Member ID.
3291 * @param string $kaiin_id KaiinId.
3292 * @param string $kaiin_pass KaiinPass.
3293 * @return array
3294 */
3295 public function escott_member_reference( $member_id, $kaiin_id = '', $kaiin_pass = '' ) {
3296 $response_member = array( 'ResponseCd' => '' );
3297 if ( empty( $kaiin_id ) ) {
3298 $kaiin_id = $this->get_quick_kaiin_id( $member_id );
3299 }
3300 if ( empty( $kaiin_pass ) ) {
3301 $kaiin_pass = $this->get_quick_pass( $member_id );
3302 }
3303
3304 if ( $kaiin_id && $kaiin_pass ) {
3305 $acting_opts = $this->get_acting_settings();
3306 $transaction_date = $this->get_transaction_date();
3307 $param_list = array();
3308 $params = array();
3309
3310 /* �
3311 �通部 */
3312 $param_list['MerchantId'] = $acting_opts['merchant_id'];
3313 $param_list['MerchantPass'] = $acting_opts['merchant_pass'];
3314 $param_list['TransactionDate'] = $transaction_date;
3315 $param_list['MerchantFree3'] = $this->merchantfree3;
3316 $param_list['TenantId'] = $acting_opts['tenant_id'];
3317 $params['send_url'] = $acting_opts['send_url_member'];
3318 $params['param_list'] = array_merge(
3319 $param_list,
3320 array(
3321 'OperateId' => '4MemRefM',
3322 'KaiinId' => $kaiin_id,
3323 'KaiinPass' => $kaiin_pass,
3324 )
3325 );
3326 /* e-SCOTT 会員�
3327 �会 */
3328 $response_member = $this->connection( $params );
3329 if ( 'OK' === $response_member['ResponseCd'] ) {
3330 $response_member['KaiinId'] = $kaiin_id;
3331 $response_member['KaiinPass'] = $kaiin_pass;
3332 }
3333 }
3334 return $response_member;
3335 }
3336
3337 /**
3338 * e-SCOTT トークン検索
3339 *
3340 * @param string $token Token.
3341 * @return array
3342 */
3343 public function escott_token_search( $token ) {
3344 $acting_opts = $this->get_acting_settings();
3345 $transaction_date = $this->get_transaction_date();
3346 $param_list = array();
3347 $params = array();
3348
3349 /* �
3350 �通部 */
3351 $param_list['MerchantId'] = $acting_opts['merchant_id'];
3352 $param_list['MerchantPass'] = $acting_opts['merchant_pass'];
3353 $param_list['TransactionDate'] = $transaction_date;
3354 $param_list['MerchantFree3'] = $this->merchantfree3;
3355 $param_list['TenantId'] = $acting_opts['tenant_id'];
3356 $params['send_url'] = $acting_opts['send_url_token'];
3357 $params['param_list'] = array_merge(
3358 $param_list,
3359 array(
3360 'OperateId' => '1TokenSearch',
3361 'Token' => $token,
3362 )
3363 );
3364
3365 /* e-SCOTT トークンステータス参�
3366 � */
3367 $response_token = $this->connection( $params );
3368 if ( 'OK' !== $response_token['ResponseCd'] || 'OK' !== $response_token['TokenResponseCd'] ) {
3369 $tokenresponsecd = '';
3370 if ( isset( $response_token['TokenResponseCd'] ) ) {
3371 $responsecd = explode( '|', $response_token['ResponseCd'] . '|' . $response_token['TokenResponseCd'] );
3372 } else {
3373 $responsecd = explode( '|', $response_token['ResponseCd'] );
3374 }
3375 foreach ( (array) $responsecd as $cd ) {
3376 if ( 'OK' !== $cd ) {
3377 $response_token[ $cd ] = $this->response_message( $cd );
3378 $tokenresponsecd .= $cd . '|';
3379 }
3380 }
3381 $tokenresponsecd = rtrim( $tokenresponsecd, '|' );
3382 }
3383 return $response_token;
3384 }
3385
3386 /**
3387 * 処理区分名称
3388 *
3389 * @param string $operateid OperateId.
3390 * @return string
3391 */
3392 public function get_operate_name( $operateid ) {
3393 $operate_name = '';
3394 switch ( $operateid ) {
3395 case '1Check': /* カードチェック */
3396 $operate_name = __( 'Card check', 'usces' );
3397 break;
3398 case '1Auth': /* 与信 */
3399 $operate_name = __( 'Credit', 'usces' );
3400 break;
3401 case '1Capture': /* 売上計上 */
3402 $operate_name = __( 'Sales recorded', 'usces' );
3403 break;
3404 case '1Gathering': /* 与信売上計上 */
3405 case '11Gathering':
3406 $operate_name = __( 'Credit sales', 'usces' );
3407 break;
3408 case '1Change': /* 利用額変更 */
3409 $operate_name = __( 'Change spending amount', 'usces' );
3410 break;
3411 case '1Delete': /* 取消 */
3412 case '11Delete':
3413 $operate_name = __( 'Unregister', 'usces' );
3414 break;
3415 case '1Search': /* 取引参�
3416 � */
3417 case '11Search':
3418 $operate_name = __( 'Transaction reference', 'usces' );
3419 break;
3420 case '1ReAuth': /* 再オーソリ */
3421 $operate_name = __( 'Re-authorization', 'usces' );
3422 break;
3423 case '2Add': /* 登録 */
3424 $operate_name = __( 'Register' );
3425 break;
3426 case '2Chg': /* 変更 */
3427 $operate_name = __( 'Change' );
3428 break;
3429 case '2Del': /* 削除 */
3430 $operate_name = __( 'Unregister', 'usces' );
3431 break;
3432 case '4MemAdd': /* 会員新規 */
3433 $operate_name = __( 'New member', 'usces' );
3434 break;
3435 case '4MemChg': /* 会員更新 */
3436 $operate_name = __( 'Update member', 'usces' );
3437 break;
3438 case '4MemInval': /* 会員無効 */
3439 $operate_name = __( 'Invalid member', 'usces' );
3440 break;
3441 case '4MemRef': /* 会員参�
3442 � */
3443 case '4MemRefM': /* 会員参�
3444 �(マスキング) */
3445 case '4MemRefMulti': /* 会員参�
3446 �(同一カード番号返戻) */
3447 case '4MemRefToken': /* トークン会員参�
3448 � */
3449 $operate_name = __( 'Member reference', 'usces' );
3450 break;
3451 case '4MemUnInval': /* 会員無効解除 */
3452 $operate_name = __( 'Cancellation of member', 'usces' );
3453 break;
3454 case '4MemDel': /* 会員削除 */
3455 $operate_name = __( 'Delete member', 'usces' );
3456 break;
3457 case '5Auth': /* 外貨与信 */
3458 $operate_name = __( 'Foreign currency credit', 'usces' );
3459 break;
3460 case '5Gathering': /* 外貨与信売上確定 */
3461 $operate_name = __( 'Foreign currency credit sales confirmed', 'usces' );
3462 break;
3463 case '5Capture': /* 外貨売上確定 */
3464 $operate_name = __( 'Foreign currency sales fixed', 'usces' );
3465 break;
3466 case '5Delete': /* 外貨取消 */
3467 $operate_name = __( 'Foreign currency cancellation', 'usces' );
3468 break;
3469 case '5OpeUnInval': /* 外貨取引保留解除 */
3470 $operate_name = __( 'Withdrawal of foreign currency transactions', 'usces' );
3471 break;
3472 case 'receipted': /* �
3473 �金 */
3474 $operate_name = __( 'Payment', 'usces' );
3475 break;
3476 case 'expiration': /* 期限切れ */
3477 $operate_name = __( 'Expired', 'usces' );
3478 break;
3479 }
3480 return $operate_name;
3481 }
3482
3483 /**
3484 * 収納機関名称
3485 *
3486 * @param string $cvs_cd CvsCd.
3487 * @return string
3488 */
3489 protected function get_cvs_name( $cvs_cd ) {
3490 $cvs_name = '';
3491 switch ( trim( $cvs_cd ) ) {
3492 case 'LSN':
3493 $cvs_name = 'ローソン';
3494 break;
3495 case 'FAM':
3496 $cvs_name = 'ファミリーマート';
3497 break;
3498 case 'SAK':
3499 $cvs_name = 'サンクス';
3500 break;
3501 case 'CCK':
3502 $cvs_name = 'サークルK';
3503 break;
3504 case 'ATM':
3505 $cvs_name = 'Pay-easy(ATM)';
3506 break;
3507 case 'ONL':
3508 $cvs_name = 'Pay-easy(オンライン)';
3509 break;
3510 case 'LNK':
3511 $cvs_name = 'Pay-easy(�
3512 報リンク)';
3513 break;
3514 case 'SEV':
3515 $cvs_name = 'セブンイレブン';
3516 break;
3517 case 'MNS':
3518 $cvs_name = 'ミニストップ';
3519 break;
3520 case 'DAY':
3521 $cvs_name = 'デイリーヤマザキ';
3522 break;
3523 case 'EBK':
3524 $cvs_name = '楽天銀行';
3525 break;
3526 case 'JNB':
3527 $cvs_name = 'ジャパンネット銀行';
3528 break;
3529 case 'EDY':
3530 $cvs_name = 'Edy';
3531 break;
3532 case 'SUI':
3533 $cvs_name = 'Suica';
3534 break;
3535 case 'FFF':
3536 $cvs_name = 'スリーエフ';
3537 break;
3538 case 'JIB':
3539 $cvs_name = 'じぶん銀行';
3540 break;
3541 case 'SNB':
3542 $cvs_name = '住信SBIネット銀行';
3543 break;
3544 case 'SCM':
3545 $cvs_name = 'セイコーマート';
3546 break;
3547 case 'JPM':
3548 $cvs_name = 'JCBプレモ';
3549 break;
3550 }
3551 return $cvs_name;
3552 }
3553
3554 /**
3555 * 手数料名称
3556 *
3557 * @param string $fee_type Fee type.
3558 * @return string
3559 */
3560 protected function get_fee_name( $fee_type ) {
3561 $fee_name = '';
3562 if ( 'fix' === $fee_type ) {
3563 $fee_name = __( 'Fixation', 'usces' );
3564 } elseif ( 'change' === $fee_type ) {
3565 $fee_name = __( 'Variable', 'usces' );
3566 }
3567 return $fee_name;
3568 }
3569
3570 /**
3571 * エラーコード対応メッセージ
3572 *
3573 * @param string $code Error code.
3574 * @return string
3575 */
3576 public function response_message( $code ) {
3577 switch ( $code ) {
3578 case 'K01': /* 当該 OperateId の設定値を網�
3579 しておりません。(送信�
3580 目不足、または�
3581 目エラー)設定値をご確認の上、再処理行ってください。(オンライン取引電文精査エラー) */
3582 $message = __( 'Online trading message scrutiny error', 'usces' );
3583 break;
3584 case 'K02': /* 形式エラーです。 設定値をご確認の上、再処理を行ってください。(�
3585 目「MerchantId」精査エラー) */
3586 $message = __( '\'MerchantId\' scrutiny error', 'usces' );
3587 break;
3588 case 'K03': /* 形式エラーです。 設定値をご確認の上、再処理を行ってください。(�
3589 目「MerchantPass」精査エラー) */
3590 $message = __( '\'MerchantPass\' scrutiny error', 'usces' );
3591 break;
3592 case 'K04': /* 形式エラーです。 設定値をご確認の上、再処理を行ってください。(�
3593 目「TenantId」精査エラー) */
3594 $message = __( '\'TenantId\' scrutiny error', 'usces' );
3595 break;
3596 case 'K05': /* 形式エラーです。 設定値をご確認の上、再処理を行ってください。(�
3597 目「TransactionDate」精査エラー) */
3598 $message = __( '\'TransactionDate\' scrutiny error', 'usces' );
3599 break;
3600 case 'K06': /* 形式エラーです。 設定値をご確認の上、再処理を行ってください。(�
3601 目「OperateId」精査エラー) */
3602 $message = __( '\'OperateId\' scrutiny error', 'usces' );
3603 break;
3604 case 'K07': /* 形式エラーです。 設定値をご確認の上、再処理を行ってください。(�
3605 目「MerchantFree1」精査エラー) */
3606 $message = __( '\'MerchantFree1\' scrutiny error', 'usces' );
3607 break;
3608 case 'K08': /* 形式エラーです。 設定値をご確認の上、再処理を行ってください。(�
3609 目「MerchantFree2」精査エラー) */
3610 $message = __( '\'MerchantFree2\' scrutiny error', 'usces' );
3611 break;
3612 case 'K09': /* 形式エラーです。 設定値をご確認の上、再処理を行ってください。(�
3613 目「MerchantFree3」精査エラー) */
3614 $message = __( '\'MerchantFree3\' scrutiny error', 'usces' );
3615 break;
3616 case 'K10': /* 形式エラーです。 設定値をご確認の上、再処理を行ってください。(�
3617 目「ProcessId」精査エラー) */
3618 $message = __( '\'ProcessId\' scrutiny error', 'usces' );
3619 break;
3620 case 'K11': /* 形式エラーです。 設定値をご確認の上、再処理を行ってください。(�
3621 目「ProcessPass」精査エラー) */
3622 $message = __( '\'ProcessPass\' scrutiny error', 'usces' );
3623 break;
3624 case 'K12': /* Master 電文で発行された「ProcessId」または「ProcessPass」では無いことを意味します。設定値をご確認の上、再処理行ってください。(�
3625 目「ProcessId」または「ProcessPass」不整合エラー) */
3626 $message = __( '\'ProcessId\' or \'ProcessPass\' inconsistency error', 'usces' );
3627 break;
3628 case 'K14': /* 要求された Process 電文の「OperateId」が要求対象外です。例:「1Delete:取消」に対して再度「1Delete:取消」を送信したなど。(OperateId のステータス遷移不整合) */
3629 $message = __( 'Transition inconsistency of OperateId status', 'usces' );
3630 break;
3631 case 'K15': /* 返戻対象となる会員の数が、最大件(30 件)を�
3632 えました。(会員参�
3633 �(同一カード番号返戻)時の返戻対象会員数エラー) */
3634 $message = __( 'Error of the numbers of members subject to return on membership reference (same card number return)', 'usces' );
3635 break;
3636 case 'K20': /* 形式エラーです。 設定値をご確認の上、再処理を行ってください。(�
3637 目「CardNo」精査エラー) */
3638 $message = __( '\'CardNo\' scrutiny error', 'usces' );
3639 break;
3640 case 'K21': /* 形式エラーです。 設定値をご確認の上、再処理を行ってください。(�
3641 目「CardExp」精査エラー) */
3642 $message = __( '\'CardExp\' scrutiny error', 'usces' );
3643 break;
3644 case 'K22': /* 形式エラーです。 設定値をご確認の上、再処理を行ってください。(�
3645 目「PayType」精査エラー) */
3646 $message = __( '\'PayType\' scrutiny error', 'usces' );
3647 break;
3648 case 'K23': /* 半角数字ではないこと、または、利用額変更で�
3649 �取引と金額が同一となっていることを意味します。 8桁以下(0 以外)の半角数字であること、利用額変更で�
3650 �取引と金額が同一でないことをご確認の上、再処理を行ってください。(�
3651 目「Amount」精査エラー) */
3652 $message = __( '\'Amount\' scrutiny error', 'usces' );
3653 break;
3654 case 'K24': /* 形式エラーです。 設定値をご確認の上、再処理を行ってください。(�
3655 目「SecCd」精査エラー) */
3656 $message = __( '\'SecCd\' scrutiny error', 'usces' );
3657 break;
3658 case 'K28': /* オンライン収納で「半角数字ハイフン≦13桁では無い」設定値を確認の上、再処理を行ってください。(�
3659 目「TelNo」精査エラー) */
3660 $message = __( '\'TelNo\' scrutiny error', 'usces' );
3661 break;
3662 case 'K30': /* 形式エラーです。設定値をご確認の上、再処理を行ってください。(�
3663 目「MessageVersionNo3D」精査エラー) */
3664 $message = __( '\'MessageVersionNo3D\' scrutiny error', 'usces' );
3665 break;
3666 case 'K31': /* 形式エラーです。設定値をご確認の上、再処理を行ってください。(�
3667 目「TransactionId3D」精査エラー) */
3668 $message = __( '\'TransactionId3D\' scrutiny error', 'usces' );
3669 break;
3670 case 'K32': /* 形式エラーです。設定値をご確認の上、再処理を行ってください。(�
3671 目「EncordXId3D」精査エラー) */
3672 $message = __( '\'EncordXId3D\' scrutiny error', 'usces' );
3673 break;
3674 case 'K33': /* 形式エラーです。設定値をご確認の上、再処理を行ってください。(�
3675 目「TransactionStatus3D」精査エラー) */
3676 $message = __( '\'TransactionStatus3D\' scrutiny error', 'usces' );
3677 break;
3678 case 'K34': /* 形式エラーです。設定値をご確認の上、再処理を行ってください。(�
3679 目「CAVVAlgorithm3D」精査エラー) */
3680 $message = __( '\'CAVVAlgorithm3D\' scrutiny error', 'usces' );
3681 break;
3682 case 'K35': /* 形式エラーです。設定値をご確認の上、再処理を行ってください。(�
3683 目「CAVV3D」精査エラー) */
3684 $message = __( '\'CAVV3D\' scrutiny error', 'usces' );
3685 break;
3686 case 'K36': /* 形式エラーです。設定値をご確認の上、再処理を行ってください。(�
3687 目「ECI3D」精査エラー) */
3688 $message = __( '\'ECI3D\' scrutiny error', 'usces' );
3689 break;
3690 case 'K37': /* 形式エラーです。設定値をご確認の上、再処理を行ってください。(�
3691 目「PANCard3D」精査エラー) */
3692 $message = __( '\'PANCard3D\' scrutiny error', 'usces' );
3693 break;
3694 case 'K39': /* YYYMMDD形式では無い、または未来日付あることを意味します。設定値をご確認の上、再処理を行ってください。(�
3695 目「SalesDate」精査エラー) */
3696 $message = __( '\'SalesDate\' scrutiny error', 'usces' );
3697 break;
3698 case 'K40': /* 取引は OK 判定でしたが McSecCd が「1」アンマッチです。(セキュリティコードアンマッチ検証 NG) */
3699 $message = __( 'Security code error', 'usces' );
3700 break;
3701 case 'K45': /* 形式エラーです。 設定値をご確認の上、再処理を行ってください。(�
3702 目「KaiinId」精査エラー) */
3703 $message = __( '\'KaiinId\' scrutiny error', 'usces' );
3704 break;
3705 case 'K46': /* 形式エラーです。 設定値をご確認の上、再処理を行ってください。(�
3706 目「KaiinPass」精査エラー) */
3707 $message = __( '\'KaiinPass\' scrutiny error', 'usces' );
3708 break;
3709 case 'K47': /* 形式エラーです。 設定値をご確認の上、再処理を行ってください。(�
3710 目「NewKaiinPass」精査エラー) */
3711 $message = __( '\'NewKaiinPass\' scrutiny error', 'usces' );
3712 break;
3713 case 'K48': /* 形式エラーです。 設定値をご確認の上、再処理を行ってください。(�
3714 目「EnableCheckUseKbn」精査エラー) */
3715 $message = __( '\'EnableCheckUseKbn\' scrutiny error', 'usces' );
3716 break;
3717 case 'K50': /* 形式エラーです。 設定値をご確認の上、再処理を行ってください。(�
3718 目「PayLimit」精査エラー) */
3719 $message = __( '\'PayLimit\' scrutiny error', 'usces' );
3720 break;
3721 case 'K51': /* 形式エラーです。 設定値をご確認の上、再処理を行ってください。(�
3722 目「NameKanji」精査エラー) */
3723 $message = __( '\'NameKanji\' scrutiny error', 'usces' );
3724 break;
3725 case 'K52': /* 形式エラーです。 設定値をご確認の上、再処理を行ってください。(�
3726 目「NameKana」精査エラー) */
3727 $message = __( '\'NameKana\' scrutiny error', 'usces' );
3728 break;
3729 case 'K53': /* 形式エラーです。 設定値をご確認の上、再処理を行ってください。(�
3730 目「ShouhinName」精査エラー) */
3731 $message = __( '\'ShouhinName\' scrutiny error', 'usces' );
3732 break;
3733 case 'K54': /* 形式エラーです。 設定値をご確認の上、再処理を行ってください。(�
3734 目「フリーエリア:Free1~7」精査エラー) */
3735 $message = __( '\'Free1 to 7\' scrutiny error', 'usces' );
3736 break;
3737 case 'K55': /* 形式エラーです。 設定値をご確認の上、再処理を行ってください。(�
3738 目「Comment」精査エラー) */
3739 $message = __( '\'Comment\' scrutiny error', 'usces' );
3740 break;
3741 case 'K60': /* 形式エラーです。 設定値をご確認の上、再処理を行ってください。(�
3742 目「戻り�
3743 � URL:ReturnURL」精査エラー) */
3744 $message = __( '\'Return URL: ReturnURL\' scrutiny error', 'usces' );
3745 break;
3746 case 'K68': /* 会員登録機能が未設定となっております。(会員の登録機能は利用できません) */
3747 $message = __( 'Member registration function is unavailabe.', 'usces' );
3748 break;
3749 case 'K69': /* この会員ID はすでに使用されています。(会員ID の重複エラー) */
3750 $message = __( 'Duplicate error of member ID', 'usces' );
3751 break;
3752 case 'K70': /* 会員削除電文に対して会員が無効状�
3753 �ではありません。(会員が無効状�
3754 �ではありません) */
3755 $message = __( 'Member is not in invalid state.', 'usces' );
3756 break;
3757 case 'K71': /* 会員ID・パスワードが一致しません。(会員ID の認証エラー) */
3758 $message = __( 'Member ID authentication error', 'usces' );
3759 break;
3760 case 'K73': /* 会員無効解除電文に対して会員が既に有効となっています。(会員が既に有効となっています) */
3761 $message = __( 'The member is already active.', 'usces' );
3762 break;
3763 case 'K74': /* 会員認証に連続して失敗し、ロックアウトされました。(会員認証に連続して失敗し、ロックアウトされました) */
3764 $message = __( 'Member authentication failed consecutively and was locked out.', 'usces' );
3765 break;
3766 case 'K75': /* 会員は有効ではありません。 */
3767 $message = __( 'The member is not valid.', 'usces' );
3768 break;
3769 case 'K79': /* 現在は Login 無効または会員無効状�
3770 �です。(会員判定エラー(Login 無効または会員無効)) */
3771 $message = __( 'Member determination error (Login invalid or Member invalid)', 'usces' );
3772 break;
3773 case 'K80': /* Master 電文は会員ID が設定されています。Process 電文も会員ID を設定してください。(会員ID 設定不一致(設定が�
3774 要)) */
3775 $message = __( 'Mismatch of Member ID setting (required the setting)', 'usces' );
3776 break;
3777 case 'K81': /* Master 電文は会員 ID が未設定です。Process 電文の会員ID も未設定としてください。(会員ID 設定不一致(設定が�
3778 要)) */
3779 $message = __( 'Mismatch of Member ID setting (required the setting)', 'usces' );
3780 break;
3781 case 'K82': /* カード番号が適切ではありません。(カード番号の�
3782 �力�
3783 容不正) */
3784 $message = __( 'Invalid input contents of card number', 'usces' );
3785 break;
3786 case 'K83': /* カード有効期限が適切ではありません。(カード有効期限の�
3787 �力�
3788 容不正) */
3789 $message = __( 'Invalid input contents of card expiration', 'usces' );
3790 break;
3791 case 'K84': /* 会員ID が適切ではありません。(会員ID の�
3792 �力�
3793 容不正) */
3794 $message = __( 'Invalid input contents of member ID', 'usces' );
3795 break;
3796 case 'K85': /* 会員パスワードが適切ではありません。(会員パスワードの�
3797 �力�
3798 容不正) */
3799 $message = __( 'Invalid input contents of member password', 'usces' );
3800 break;
3801 case 'K86': /* 形式エラーです。 設定値をご確認の上、再処理を行ってください。(�
3802 目「処理番号:ProcNo」精査エラー) */
3803 $message = __( '\'Processing number: ProcNo\' scrutiny error', 'usces' );
3804 break;
3805 case 'K87': /* 形式エラーです。 設定値をご確認の上、再処理を行ってください。(�
3806 目「POST用URL:PostUrl」精査エラー) */
3807 $message = __( '\'POST URL: PostUrl\' scrutiny error', 'usces' );
3808 break;
3809 case 'K88': /* 取引の対象が複数件存在します。弊社までお問い合わせください。(�
3810 �取引重複エラー) */
3811 $message = __( 'Original deal duplication error', 'usces' );
3812 break;
3813 case 'K89': /* この処理番号は既に使用されています。(処理番号の重複エラー) */
3814 $message = __( 'Duplicate error of processing number', 'usces' );
3815 break;
3816 case 'K96': /* 障害報が通知されている場合は、回復報を�
3817 って再処理を行ってください。その他は、弊社までお問い合わせください。(本システム通信障害発生(タイムアウト)) */
3818 $message = __( 'Communication failure occurred in the system (timeout)', 'usces' );
3819 break;
3820 case 'K98': /* 障害報が通知されている場合は、回復報を�
3821 って再処理を行ってください。その他は、弊社までお問い合わせください。(本システム�
3822 部で軽度障害が発生) */
3823 $message = __( 'Minor failure occurred in the system inside', 'usces' );
3824 break;
3825 case 'K99': /* 弊社までお問い合わせください。(その他例外エラー) */
3826 $message = __( 'Other exception error', 'usces' );
3827 break;
3828 case 'KA1': /* 形式エラーです。設定値を確認の上、再処理を行ってください。(�
3829 目「通貨コード:CurrencyId」精査エラー) */
3830 $message = __( '\'Currency code: CurrencyId\' scrutiny error', 'usces' );
3831 break;
3832 case 'KBX': /* 重複した電文を受信しました。利用�
3833 によりブラウザバックや二重押下が行われた可能性があります。(二重取引エラー) */
3834 $message = __( 'Double transaction error', 'usces' );
3835 break;
3836 case 'KBY': /* �
3837 �取引が完了していません。取引状�
3838 �をご確認ください。(処理未完了エラー) */
3839 $message = __( 'Processing incomplete error', 'usces' );
3840 break;
3841 case 'KBZ': /* 取引対象が取得できません。設定値をご確認の上、再処理を行ってください。(�
3842 �取引なしエラー) */
3843 $message = __( 'No original transaction error', 'usces' );
3844 break;
3845 case 'KG8': /* マーチャント ID、マーチャントパスワード認証に連続して失敗し、ロックアウトされました。(事業�
3846 認証に連続して失敗し、ロックアウトされました) */
3847 $message = __( 'Failed operator authentication consecutively and was locked out.', 'usces' );
3848 break;
3849 case 'KGH': /* 会員参�
3850 �の利用は制限されています。(会員参�
3851 �電文利用設定エラー) */
3852 $message = __( 'Member reference message usage setting error', 'usces' );
3853 break;
3854 case 'KH0': /* 取引が銀聯側でどのような状�
3855 �か不明。(レスポンス不明) */
3856 $message = __( 'Unknown response', 'usces' );
3857 break;
3858 case 'KH4': /* 形式エラーです。設定値を確認の上、再処理を行ってください。(�
3859 目「PageLanguage」精査エラー) */
3860 $message = __( '\'PageLanguage\' scrutiny error', 'usces' );
3861 break;
3862 case 'KHS': /* 形式エラーです。設定値を確認の上、再処理を行ってください。(�
3863 目「SuccessURL」精査エラー) */
3864 $message = __( '\'SuccessURL\' scrutiny error', 'usces' );
3865 break;
3866 case 'KHT': /* 形式エラーです。設定値を確認の上、再処理を行ってください。(�
3867 目「ErrorURL」精査エラー) */
3868 $message = __( '\'ErrorURL\' scrutiny error', 'usces' );
3869 break;
3870 case 'KHU': /* 形式エラーです。設定値を確認の上、再処理を行ってください。(�
3871 目「StatusNoticeURL」精査エラー) */
3872 $message = __( '\'StatusNoticeURL\' scrutiny error', 'usces' );
3873 break;
3874 case 'KHV': /* 対象の取引について、再処理実施有無を確認していいただき、�
3875 要に応じて再処理を行ってください。(自動取消実施済、再処理を行ってください) */
3876 $message = __( 'Auto-cancel has been executed, please try again.', 'usces' );
3877 break;
3878 case 'KHX': /* 形式エラーです。設定値を確認の上、再処理を行ってください。(�
3879 目「Token」精査エラー) */
3880 $message = __( '\'Token\' scrutiny error', 'usces' );
3881 break;
3882 case 'KHZ': /* 利用可能なトークンがありません。(利用可能トークンなしエラー) */
3883 $message = __( 'No token available error', 'usces' );
3884 break;
3885 case 'KI0': /* 取引がエンドユーザにより中止されました。(与信売上計上中止(詳細不明)) */
3886 $message = __( 'Credit sales canceled (details unknown)', 'usces' );
3887 break;
3888 case 'KI1': /* 形式エラーです。設定値を確認の上、再処理を行ってください。(�
3889 目「k_TokenNinsyoCode」精査エラー) */
3890 $message = __( '\'k_TokenNinsyoCode\' scrutiny error', 'usces' );
3891 break;
3892 case 'KI2': /* すでに利用されたトークンです。(使用済みトークンエラー) */
3893 $message = __( 'Used token error', 'usces' );
3894 break;
3895 case 'KI3': /* トークンの有効期限が切れています。(トークン有効期限切れエラー) */
3896 $message = __( 'Token expiration error', 'usces' );
3897 break;
3898 case 'KI4': /* 形式エラーです。設定値を確認の上、再処理を行ってください。(�
3899 目「端末�
3900 報」精査エラー) */
3901 $message = __( '\'Terminal information\' scrutiny error', 'usces' );
3902 break;
3903 case 'KI5': /* 同一カード番号の連続�
3904 �力によりロックされています。 */
3905 $message = __( 'It is locked by continuous input of the same card number.', 'usces' );
3906 break;
3907 case 'KI6': /* 同一端末からの連続�
3908 �力により端末がロックされています。 */
3909 $message = __( 'The terminal is locked by continuous input from the same terminal.', 'usces' );
3910 break;
3911 case 'KI8': /* 取引の対象が複数件存在します。 */
3912 $message = __( 'There are two or more transaction targets.', 'usces' );
3913 break;
3914 case 'KIE': /* ApplePay 決済データの値が Null または桁数、データ型不正となっております。(�
3915 目「signature」精査エラー) */
3916 $message = __( '\'signature\' scrutiny error', 'usces' );
3917 break;
3918 case 'KIF': /* Apple Pay 暗号化済み決済データについて signature エラー、オブジェクト識別子が含まれていません。 */
3919 $message = __( 'signature Error, object identifier isn\'t included.', 'usces' );
3920 break;
3921 case 'KIH': /* Apple Pay 暗号化済み決済データについて signature エラー、署名時間が許容時間を�
3922 えています。 */
3923 $message = __( 'signature Error, signature time exceeds the allowable time.', 'usces' );
3924 break;
3925 case 'KIJ': /* トークンとプロセスID が設定されています、いずれかを設定ください。(トークン決済、ApplePay 取引許可エラー) */
3926 $message = __( 'Token payment, ApplePay transaction authorization error', 'usces' );
3927 break;
3928 case 'KIK': /* �
3929 �取引が ApplePay 取引ではありません。ApplePay 会員登録・会員更新時にクレジットカード決済のプロセス ID で更新した場合に発生いたします。(Apple Pay 会員�
3930 �取引不整合エラー) */
3931 $message = __( 'Apple Pay membership transaction mismatch error', 'usces' );
3932 break;
3933 case 'KIL': /* �
3934 �取引が通常取引ではありません。クレジットカード決済の会員登録・会員更新時に Apple Pay 決済のプロセス ID で更新した場合、または、Apple Pay 会員に対して、会員更新時にカード番号、カード有効期限を設定して更新した場合に発生いたします。(通常会員�
3935 �取引不整合エラー) */
3936 $message = __( 'Normal member transaction mismatch error', 'usces' );
3937 break;
3938 case 'KIW': /* 形式エラー。設定値を確認の上、再処理を行ってください。(�
3939 目「KaiinIdAutoRiyoFlg」精査エラー) */
3940 $message = __( '\'KaiinIdAutoRiyoFlg\' scrutiny error', 'usces' );
3941 break;
3942 case 'C01': /* 貴社送信�
3943 容が仕様に沿っているかご確認の上、弊社までお問い合わせください。(弊社設定関連エラー) */
3944 $message = __( 'Error related to e-SCOTT setting', 'usces' );
3945 break;
3946 case 'C02': /* 障害報が通知されている場合は、回復報を�
3947 って再処理を行ってください。その他は、弊社までお問い合わせください。(e-SCOTT システムエラー) */
3948 $message = __( 'e-SCOTT system error', 'usces' );
3949 break;
3950 case 'C03': /* 障害報が通知されている場合は、回復報を�
3951 って再処理を行ってください。その他は、弊社までお問い合わせください。(e-SCOTT 通信エラー) */
3952 $message = __( 'e-SCOTT communication error', 'usces' );
3953 break;
3954 case 'C10': /* ご契約のある支払回数(区分)をセットし再処理行ってください。(支払区分エラー) */
3955 $message = __( 'Payment indicator error', 'usces' );
3956 break;
3957 case 'C11': /* ボーナス払いご利用対象外期間のため、支払区分を変更して再処理を行ってください。(ボーナス期間外エラー) */
3958 $message = __( 'Bonus overtime period error', 'usces' );
3959 break;
3960 case 'C12': /* ご契約のある分割回数(区分)をセットし再処理行ってください。(分割回数エラー) */
3961 $message = __( 'Number of installments error', 'usces' );
3962 break;
3963 case 'C13': /* カード有効期限の年月�
3964 �力間違え。または、有効期限切れカードです。(有効期限切れエラー) */
3965 $message = __( 'Expired error', 'usces' );
3966 break;
3967 case 'C14': /* 取消処理が既に行われております。管理画面で処理状況をご確認ください。(取消済みエラー) */
3968 $message = __( 'Canceled error', 'usces' );
3969 break;
3970 case 'C15': /* ボーナス払いの下限金額未満によるエラーのため、支払方法を変更して再処理を行ってください。(ボーナス金額下限エラー) */
3971 $message = __( 'Bonus amount lower limit error', 'usces' );
3972 break;
3973 case 'C16': /* 該当のカード会員番号は存在しない。(カード番号エラー) */
3974 $message = __( 'Card number error', 'usces' );
3975 break;
3976 case 'C17': /* ご契約範囲外のカード番号。もしくは存在しないカード番号体系。(カード番号体系エラー) */
3977 $message = __( 'Card number system error', 'usces' );
3978 break;
3979 case 'C18': /* オーソリ除外となるカード番号。本エラーを発生するには個別に設定が�
3980 要になります。弊社までお問い合わせください。(オーソリ除外対象のカード番号体系エラー) */
3981 $message = __( 'Card number system error subject to authorization exclusion', 'usces' );
3982 break;
3983 case 'C70': /* 貴社送信�
3984 容が仕様に沿っているかご確認の上、弊社までお問い合わせください。(弊社設定�
3985 報エラー) */
3986 $message = __( 'Our company setting information error', 'usces' );
3987 break;
3988 case 'C71': /* 貴社送信�
3989 容が仕様に沿っているかご確認の上、弊社までお問い合わせください。(弊社設定�
3990 報エラー) */
3991 $message = __( 'Our company setting information error', 'usces' );
3992 break;
3993 case 'C80': /* カード会社システムの停止を意味します。(カード会社センター閉局) */
3994 $message = __( 'Credit card company center closed', 'usces' );
3995 break;
3996 case 'C98': /* 貴社送信�
3997 容が仕様に沿っているかご確認の上、弊社までお問い合わせください。(その他例外エラー) */
3998 $message = __( 'Other exception error', 'usces' );
3999 break;
4000 case 'C99': /* 貴社送信�
4001 容が仕様に沿っているかご確認の上、弊社までお問い合わせください。(その他例外エラー) */
4002 $message = __( 'Other exception error', 'usces' );
4003 break;
4004 case 'G12': /* クレジットカードが使用不可能です。(カード使用不可) */
4005 $message = __( 'Card unavailable', 'usces' );
4006 break;
4007 case 'G22': /* 支払永�
4008 禁止を意味します。(支払永�
4009 禁止) */
4010 $message = __( 'Prohibit payment permanently', 'usces' );
4011 break;
4012 case 'G30': /* 取引の判断保留を意味します。(取引判定保留) */
4013 $message = __( 'Transaction decision pending', 'usces' );
4014 break;
4015 case 'G42': /* 暗証番号が正しくありません。※デビットカードの場合、発生する場合があります。(暗証番号エラー) */
4016 $message = __( 'PIN error', 'usces' );
4017 break;
4018 case 'G44': /* �
4019 �力されたセキュリティコードが正しくありません。(セキュリティコード誤り) */
4020 $message = __( 'Security code error', 'usces' );
4021 break;
4022 case 'G45': /* セキュリティコードが�
4023 �力されていません。(セキュリティコード�
4024 �力無) */
4025 $message = __( 'Security code input is none', 'usces' );
4026 break;
4027 case 'G54': /* 1日利用回数または金額オーバーです。(利用回数エラー) */
4028 $message = __( 'Error of the number of available use', 'usces' );
4029 break;
4030 case 'G55': /* 1日利用限度額オーバーです。(限度額オーバー) */
4031 $message = __( 'Over limit amount', 'usces' );
4032 break;
4033 case 'G56': /* クレジットカードが無効です。(無効カード) */
4034 $message = __( 'Invalid card', 'usces' );
4035 break;
4036 case 'G60': /* 事�
4037 カードが�
4038 �力されたことを意味します。(事�
4039 カード) */
4040 $message = __( 'Accident card', 'usces' );
4041 break;
4042 case 'G61': /* 無効カードが�
4043 �力されたことを意味します。(無効カード) */
4044 $message = __( 'Invalid card', 'usces' );
4045 break;
4046 case 'G65': /* カード番号の�
4047 �力が誤っていることを意味します。(カード番号エラー) */
4048 $message = __( 'Card number error', 'usces' );
4049 break;
4050 case 'G68': /* 金額の�
4051 �力が誤っていることを意味します。(金額エラー) */
4052 $message = __( 'Amount error', 'usces' );
4053 break;
4054 case 'G72': /* ボーナス金額の�
4055 �力が誤っていることを意味します。(ボーナス額エラー) */
4056 $message = __( 'Bonus amount error', 'usces' );
4057 break;
4058 case 'G74': /* 分割回数の�
4059 �力が誤っていることを意味します。(分割回数エラー) */
4060 $message = __( 'Number of installments error', 'usces' );
4061 break;
4062 case 'G75': /* 分割払いの下限金額を回ってること意味します。(分割金額エラー) */
4063 $message = __( 'Amount of installments error', 'usces' );
4064 break;
4065 case 'G78': /* 支払方法の�
4066 �力が誤っていることを意味します。(支払区分エラー) */
4067 $message = __( 'Payment indicator error', 'usces' );
4068 break;
4069 case 'G83': /* 有効期限の�
4070 �力が誤っていることを意味します。(有効期限エラー) */
4071 $message = __( 'Expiration date error', 'usces' );
4072 break;
4073 case 'G84': /* 承認番号の�
4074 �力が誤っていることを意味します。(承認番号エラー) */
4075 $message = __( 'Authorization number error', 'usces' );
4076 break;
4077 case 'G85': /* CAFIS 代行中にエラーが発生したことを意味します。(CAFIS 代行エラー) */
4078 $message = __( 'CAFIS substitution error', 'usces' );
4079 break;
4080 case 'G92': /* カード会社側で任意にエラーとしたい場合に発生します。(カード会社任意エラー) */
4081 $message = __( 'Card company arbitrary error', 'usces' );
4082 break;
4083 case 'G94': /* サイクル通番が規定以上または数字でないことを意味します。(サイクル通番エラー) */
4084 $message = __( 'Cycle sequence number error', 'usces' );
4085 break;
4086 case 'G95': /* カード会社の当該運用業務が終了していることを意味します。(当該業務オンライン終了) */
4087 $message = __( 'The business online termination', 'usces' );
4088 break;
4089 case 'G96': /* 取扱不可のクレジットカードが�
4090 �力されたことを意味します。(事�
4091 カードデータエラー) */
4092 $message = __( 'Accident card data error', 'usces' );
4093 break;
4094 case 'G97': /* 当該要求が拒否され、取扱不能を意味します。(当該要求拒否) */
4095 $message = __( 'The request rejection', 'usces' );
4096 break;
4097 case 'G98': /* 接続されたクレジットカード会社の対象業務ではないことを意味します。(当該自社対象業務エラー) */
4098 $message = __( 'The company-specific task error', 'usces' );
4099 break;
4100 case 'G99': /* 接続要求自社受付拒否を意味します。(接続要求自社受付拒否) */
4101 $message = __( 'Connection request refused acceptance of company', 'usces' );
4102 break;
4103 case 'P51': /* カード�
4104 報登録応答(SSNP010 キャンセル)を返した場合を示します。 */
4105 $message = __( 'The end user canceled on the card information registration screen (SSNP010).', 'usces' );
4106 break;
4107 case 'P52': /* カード�
4108 報登録応答(SSNP020 キャンセル)を返した場合を示します。 */
4109 $message = __( 'The end user canceled on the card information registration confirmation screen (SSNP020).', 'usces' );
4110 break;
4111 case 'P53': /* カード�
4112 報登録応答(エラー)を返した場合を示します。(本システムへの送信・応答ボディ無、応答処理フラグ異常) */
4113 $message = __( 'An error occurred during card information registration processing.', 'usces' );
4114 break;
4115 case 'P54': /* 認証アシスト�
4116 目の規定回数以上アンマッチが発生したケースなどを示します。 */
4117 $message = __( 'A retry-limit-exceeded error occurred during card information registration processing.', 'usces' );
4118 break;
4119 case 'P55': /* カード�
4120 報変更応答(SSNP030 キャンセル)を返した場合を示します。 */
4121 $message = __( 'The end user canceled on the card information change screen (SSNP030).', 'usces' );
4122 break;
4123 case 'P56': /* カード�
4124 報変更応答(SSNP040 キャンセル)を返した場合を示します。 */
4125 $message = __( 'The end user canceled on the card information change confirmation screen (SSNP040).', 'usces' );
4126 break;
4127 case 'P57': /* カード�
4128 報変更応答(エラー)を返した場合を示します。(本システムへの送信・応答ボディ無、応答処理フラグ異常) */
4129 $message = __( 'An error occurred during card information change processing.', 'usces' );
4130 break;
4131 case 'P58': /* 認証アシスト�
4132 目の規定回数以上アンマッチが発生したケースなどを示します。 */
4133 $message = __( 'A retry-limit-exceeded error occurred during card information change processing.', 'usces' );
4134 break;
4135 case 'P60': /* 会員�
4136 報参�
4137 �応答(エラー)を返した場合を示します。(本システムへの送信・応答ボディ無、応答処理フラグ異常) */
4138 $message = __( 'An error occurred during member information reference processing.', 'usces' );
4139 break;
4140 case 'P62': /* 与信応答(会員制)(SSNP080 キャンセル)を返した場合を示します。 */
4141 $message = __( 'The end user canceled on the member purchase authentication assist screen (SSNP080).', 'usces' );
4142 break;
4143 case 'P63': /* 与信応答(会員制)(SSNP090 キャンセル)を返した場合を示します。 */
4144 $message = __( 'The end user canceled on the member purchase card information confirmation screen (SSNP090).', 'usces' );
4145 break;
4146 case 'P64': /* 与信応答(会員制)(SSNP100 キャンセル)を返した場合を示します。 */
4147 $message = __( 'The end user canceled on the member purchase card information input screen (SSNP100).', 'usces' );
4148 break;
4149 case 'P65': /* 与信応答(会員制)(SSNP110 キャンセル)を返した場合を示します。 */
4150 $message = __( 'The end user canceled on the member purchase card information confirmation screen (SSNP110).', 'usces' );
4151 break;
4152 case 'P66': /* 与信応答(会員購�
4153 �)にてエラーが発生したこと示します。 */
4154 $message = __( 'An error occurred during authorization processing (member purchase).', 'usces' );
4155 break;
4156 case 'P67': /* 与信応答(会員購�
4157 �にて「他のカードで購�
4158 �」を使用)でエラーが発生したことを示します。 */
4159 $message = __( 'An error occurred during authorization processing (member purchase using "Purchase with another card").', 'usces' );
4160 break;
4161 case 'P68': /* 認証アシスト�
4162 目の規定回数以上アンマッチが発生したケースなどを示します。 */
4163 $message = __( 'A retry-limit-exceeded error occurred during authorization processing (member).', 'usces' );
4164 break;
4165 case 'P69': /* 与信応答(非会員制)(SSNP120 キャンセル)を返した場合を示します。 */
4166 $message = __( 'The end user canceled on the non-member purchase card information input screen (SSNP120).', 'usces' );
4167 break;
4168 case 'P70': /* 与信応答(非会員制)(SSNP130 キャンセル)を返した場合を示します。 */
4169 $message = __( 'The end user canceled on the non-member purchase card information confirmation screen (SSNP130).', 'usces' );
4170 break;
4171 case 'P71': /* 与信応答(非会員)(エラー)を返した場合を示します。(本システムへの送信・応答ボディ無、応答サービス区分異常) */
4172 $message = __( 'An error occurred during authorization processing (non-member).', 'usces' );
4173 break;
4174 case 'P72': /* 認証アシスト�
4175 目の規定回数以上アンマッチが発生したケースなどを示します。 */
4176 $message = __( 'A retry-limit-exceeded error occurred during authorization processing (non-member).', 'usces' );
4177 break;
4178 case 'P74': /* セッションのタイムアウトエラーの発生を示します。 */
4179 $message = __( 'A session timeout occurred.', 'usces' );
4180 break;
4181 case 'R01': /* 再処理を行ってください。(システムが起動していないか、または一時的にダウンしています。しばらくしてからもう一度試してください。) */
4182 $message = __( 'The system is not booting or is temporarily down. Please try again later.', 'usces' );
4183 break;
4184 case 'R02': /* 設定値をご確認の上、再処理を行ってください。(メッセージ形式のエラー) */
4185 $message = __( 'Message format error', 'usces' );
4186 break;
4187 case 'R03': /* 弊社までお問い合わせください。(署名エラーを確認してください。) */
4188 $message = __( 'Check for signature error.', 'usces' );
4189 break;
4190 case 'R04': /* メッセージ取引キー要素がありません。 */
4191 $message = __( 'Missing message transaction key element.', 'usces' );
4192 break;
4193 case 'R05': /* 取引不成立。他の銀聯決済カードを使用してください。 */
4194 $message = __( 'Transaction unsuccessful. Please use another UnionPay card.', 'usces' );
4195 break;
4196 case 'R06': /* 弊社までお問い合わせください。(加盟店の状�
4197 �が正しくありません。) */
4198 $message = __( 'Incorrect merchant status.', 'usces' );
4199 break;
4200 case 'R07': /* この取引の権利はありません。 */
4201 $message = __( 'You are not entitled to this transaction.', 'usces' );
4202 break;
4203 case 'R08': /* 取引額が限度額を�
4204 過しています。 */
4205 $message = __( 'Transaction amount exceeds the limit.', 'usces' );
4206 break;
4207 case 'R09': /* �
4208 �取引が存在していないか、または状�
4209 �が正しくありません。 */
4210 $message = __( 'Original transaction does not exist or is in an incorrect state.', 'usces' );
4211 break;
4212 case 'R10': /* �
4213 �取引�
4214 報と一致しません。 */
4215 $message = __( 'Not match with original transaction information.', 'usces' );
4216 break;
4217 case 'R11': /* �
4218 �会の回数が限度を�
4219 えるか、オペレーションの頻度が過剰です。 */
4220 $message = __( 'The number of queries exceeds the limit or the frequency of operations is excessive.', 'usces' );
4221 break;
4222 case 'R12': /* 銀聯リスク制限 */
4223 $message = __( 'UnionPay risk limit', 'usces' );
4224 break;
4225 case 'R13': /* エンドユーザの操作が許容時間�
4226 に完了しませんでした。(取引の受付時間外です。) */
4227 $message = __( 'Out of transaction available hours.', 'usces' );
4228 break;
4229 case 'R14': /* 残高からの差し引きはできますが、決済時間を過ぎています。 */
4230 $message = __( 'You can deduct from your balance, but the payment available time has passed.', 'usces' );
4231 break;
4232 case 'R15': /* �
4233 �力したカード番号が無効です。再度確認のうえ�
4234 �力してください。 */
4235 $message = __( 'The card number is invalid. Please check and input again.', 'usces' );
4236 break;
4237 case 'R16': /* 取引不成立。発行会社はこの加盟店に対応していません。別の銀行カードに変更してください。 */
4238 $message = __( 'Transaction unsuccessful. The issuing company does not support this merchant. Please change to a different bank card.', 'usces' );
4239 break;
4240 case 'R17': /* カードの状�
4241 �が正しくありません。 */
4242 $message = __( 'Incorrect card status', 'usces' );
4243 break;
4244 case 'R18': /* カードの残高不足 */
4245 $message = __( 'Insufficient card balance', 'usces' );
4246 break;
4247 case 'R19': /* �
4248 �力した PIN、有効期限または CVN2 のエラー、取引不成立。 */
4249 $message = __( 'Eroor of PIN or expiration date or CVN2, transaction failed.', 'usces' );
4250 break;
4251 case 'R20': /* �
4252 �力したカード保有�
4253 ID �
4254 報または携帯電話番号が正しくない、検証不成立。 */
4255 $message = __( 'The entered cardholder ID information or mobile phone number is incorrect, verification failed.', 'usces' );
4256 break;
4257 case 'R21': /* PIN �
4258 �力回数の限度を�
4259 えています。 */
4260 $message = __( 'The number of input limit of PIN exceeded.', 'usces' );
4261 break;
4262 case 'R22': /* あなたの銀行カードは現在この取引には対応していません。 */
4263 $message = __( 'Your bank card is currently unavailable this transaction.', 'usces' );
4264 break;
4265 case 'R23': /* 試行時間の限度�
4266 過、取引不成立。 */
4267 $message = __( 'Trial time limit exceeded, transaction failed.', 'usces' );
4268 break;
4269 case 'R24': /* 取引はリダイレクトされました。カード保有�
4270
4271 �力画面になるまでお�
4272 ちください。 */
4273 $message = __( 'The transaction has been redirected. Please wait until the cardholder entry screen appears.', 'usces' );
4274 break;
4275 case 'R25': /* 動的パスワードまたは SMS 認証コードの確認ができません。 */
4276 $message = __( 'The dynamic password or SMS authentication code cannot be verified.', 'usces' );
4277 break;
4278 case 'R26': /* 銀行窓口またはオンライン銀行で銀聯決済サービスにサインアップしていません。 */
4279 $message = __( 'You have not signed up for UnionPay payment service at a bank counter or online bank.', 'usces' );
4280 break;
4281 case 'R27': /* 決済カードの有効期限が過ぎています。 */
4282 $message = __( 'Payment card has expired.', 'usces' );
4283 break;
4284 case 'R28': /* 有効化には暗号検証が�
4285 要です。 */
4286 $message = __( 'Validation require an encryption verification.', 'usces' );
4287 break;
4288 case 'R29': /* この銀行カードは認証済の支払いに有効化されていません。 */
4289 $message = __( 'This bank card is not activated for verified payments.', 'usces' );
4290 break;
4291 case 'R30': /* 発行会社の取引権が制限されています。発行会社にお問い合わせください。 */
4292 $message = __( 'An issuing company\'s trading rights are restricted. Please contact the issuing company.', 'usces' );
4293 break;
4294 case 'R31': /* 銀行カードは有効ですが、発行会社が SMS認証に対応していません。 */
4295 $message = __( 'The bank card is valid, but the issuing company does not support SMS authentication.', 'usces' );
4296 break;
4297 case 'R32': /* ファイルが存在しません。 */
4298 $message = __( 'File doesn\'t exist.', 'usces' );
4299 break;
4300 case 'R33': /* 一般的エラー */
4301 $message = __( 'General error', 'usces' );
4302 break;
4303 case 'R34': /* 弊社までお問い合わせください。 */
4304 $message = __( 'Please contact SLN.', 'usces' );
4305 break;
4306 case 'R35': /* 弊社までお問い合わせください。 */
4307 $message = __( 'Please contact SLN.', 'usces' );
4308 break;
4309 case 'R36': /* この取引はありませんでした。 */
4310 $message = __( 'This transaction doesn\'t exist.', 'usces' );
4311 break;
4312 case 'R37': /* 取引不成立。詳細は発行会社に問い合わせてください。 */
4313 $message = __( 'Transaction failed. Please contact the issuing company for details.', 'usces' );
4314 break;
4315 case 'U01': /* エンドユーザーの 3D セキュアパスワードが未設定です。 */
4316 $message = __( 'The end user\'s 3D secure password is not set.', 'usces' );
4317 break;
4318 case 'U02': /* 3D セキュア未対応カード発行会社です。 */
4319 $message = __( 'This card company doesn\'t conpliant with 3D Secure.', 'usces' );
4320 break;
4321 case 'U03': /* ブランドサーバー、または、イシュアサーバーに障害が発生し認証できませんでした。 */
4322 $message = __( 'The brand server or issuer server failed and could not be authenticated.', 'usces' );
4323 break;
4324 case 'U04': /* 3D セキュア認証ができませんでした。各カード会社の基準により 3D セキュア認証画面を表示せずに NGとなる場合がございます。 */
4325 $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' );
4326 break;
4327 case 'U05': /* 認証システムで改ざんをチェックし 3D セキュア認証ができませんでした。 */
4328 $message = __( 'The authentication system checked for tampering and 3D secure authentication failed.', 'usces' );
4329 break;
4330 case 'U06': /* エンドユーザーの操作でタイムアウト(40 分以上経過)が発生しました。 */
4331 $message = __( 'A timeout (over 40 minutes) occurred by end-user operation.', 'usces' );
4332 break;
4333 case 'U07': /* 認証システムにて電文処理中に同じ電文を受信しました。 */
4334 $message = __( 'The same message was received during message processing in the authentication system.', 'usces' );
4335 break;
4336 case 'U08': /* セッション�
4337 報が削除された後に重複した電文を受信しました。 */
4338 $message = __( 'A duplicate message was received after the session information was deleted.', 'usces' );
4339 break;
4340 case 'U09': /* 3D セキュア未対応ブランドです。 */
4341 $message = __( 'This brand doesn\'t conpliant with 3D Secure.', 'usces' );
4342 break;
4343 case 'U10': /* ブランドのサーバーが停止、または接続不可により 3D セキュア認証ができませんでした。 */
4344 $message = __( 'The 3D secure authentication couldn\'t be executed because the branded server stopped or failed connection.', 'usces' );
4345 break;
4346 case 'U11': /* 弊社までお問い合わせください。(認証システム精査エラー) */
4347 $message = __( 'Authentication system scrutiny error', 'usces' );
4348 break;
4349 case 'U12': /* 弊社までお問い合わせください。(加盟店認証エラー) */
4350 $message = __( 'Merchant authentication error', 'usces' );
4351 break;
4352 case 'U13': /* 弊社までお問い合わせください。(認証システム�
4353 目エラー) */
4354 $message = __( 'Authentication system item error', 'usces' );
4355 break;
4356 case 'U14': /* 計画停止案�
4357 が通知されている場合は、計画停止終了を�
4358 って再処理を行ってください。その他は、弊社までお問い合わせください。(メンテナンスによるシステムエラー) */
4359 $message = __( 'If a planned stoppage guidance has been notified, wait for the planned stoppage to end and reprocess.', 'usces' );
4360 break;
4361 case 'U15': /* アテンプトです。 */
4362 $message = __( 'Atempt.', 'usces' );
4363 break;
4364 case 'U95': /* 一時的に処理できませんでした。リトライしてください。(システムエラー) */
4365 $message = __( 'Failed the process temporarily. Please retry.', 'usces' );
4366 break;
4367 case 'U96': /* 障害報が通知されている場合は、回復報を�
4368 って再処理を行ってください。その他は弊社までお問い合せください。(タイムアウト) */
4369 $message = __( 'If a failure report has been notified, wait for the recovery report and reprocess.', 'usces' );
4370 break;
4371 case 'U99': /* 弊社までお問い合せください。(想定外エラー) */
4372 $message = __( 'Unexpected error', 'usces' );
4373 break;
4374 case 'W01': /* 弊社までお問い合わせください。(オンライン収納代行サービス設定エラー) */
4375 $message = __( 'Online Payment Collection Agency Service setting error', 'usces' );
4376 break;
4377 case 'W02': /* 弊社までお問い合わせください。(設定値エラー) */
4378 $message = __( 'Setting value error', 'usces' );
4379 break;
4380 case 'W03': /* 弊社までお問い合わせください。(オンライン収納代行サービス�
4381 部エラー(Web系)) */
4382 $message = __( 'Online Payment Collection Agency Service internal error (Web type)', 'usces' );
4383 break;
4384 case 'W04': /* 弊社までお問い合わせください。(システム設定エラー) */
4385 $message = __( 'System setting error', 'usces' );
4386 break;
4387 case 'W05': /* 送信�
4388 容をご確認の上、再処理を行ってください。エラーが解消しない場合は、弊社までお問い合わせください。(�
4389 目設定エラー) */
4390 $message = __( 'Item setting error', 'usces' );
4391 break;
4392 case 'W06': /* 弊社までお問い合わせください。(オンライン収納代行サービス�
4393 部エラー(DB系)) */
4394 $message = __( 'Online Payment Collection Agency Service internal error (DB type)', 'usces' );
4395 break;
4396 case 'W99': /* 弊社までお問い合わせください。(その他例外エラー) */
4397 $message = __( 'Other exception error', 'usces' );
4398 break;
4399 case 'W99': /* 弊社までお問い合わせください。(その他例外エラー) */
4400 $message = __( 'Other exception error', 'usces' );
4401 break;
4402 default:
4403 $message = $code;
4404 }
4405 return $message;
4406 }
4407
4408 /**
4409 * エラーコード対応メッセージ
4410 *
4411 * @param string $code Error code.
4412 * @return string
4413 */
4414 protected function error_message( $code ) {
4415 switch ( $code ) {
4416 case 'K01': /* オンライン取引電文精査エラー */
4417 case 'K02': /* �
4418 目「MerchantId」精査エラー */
4419 case 'K03': /* �
4420 目「MerchantPass」精査エラー */
4421 case 'K04': /* �
4422 目「TenantId」精査エラー */
4423 case 'K05': /* �
4424 目「TransactionDate」精査エラー */
4425 case 'K06': /* �
4426 目「OperateId」精査エラー */
4427 case 'K07': /* �
4428 目「MerchantFree1」精査エラー */
4429 case 'K08': /* �
4430 目「MerchantFree2」精査エラー */
4431 case 'K09': /* �
4432 目「MerchantFree3」精査エラー */
4433 case 'K10': /* �
4434 目「ProcessId」精査エラー */
4435 case 'K11': /* �
4436 目「ProcessPass」精査エラー */
4437 case 'K12': /* �
4438 目「ProcessId」または「ProcessPass」不整合エラー */
4439 case 'K14': /* OperateId のステータス遷移不整合 */
4440 case 'K15': /* 会員参�
4441 �(同一カード番号返戻)時の返戻対象会員数エラー */
4442 case 'K22': /* �
4443 目「PayType」精査エラー */
4444 case 'K23': /* �
4445 目「Amount」精査エラー */
4446 case 'K39': /* �
4447 目「SalesDate」精査エラー */
4448 case 'K50': /* �
4449 目「PayLimit」精査エラー */
4450 case 'K53': /* �
4451 目「ShouhinName」精査エラー */
4452 case 'K54': /* �
4453 目「フリーエリア:Free1~7」精査エラー */
4454 case 'K55': /* �
4455 目「Comment」精査エラー */
4456 case 'K60': /* �
4457 目「戻り�
4458 � URL:ReturnURL」精査エラー */
4459 case 'K68': /* 会員の登録機能は利用できません */
4460 case 'K69': /* 会員ID の重複エラー */
4461 case 'K70': /* 会員が無効状�
4462 �ではありません */
4463 case 'K71': /* 会員ID の認証エラー */
4464 case 'K73': /* 会員が既に有効となっています */
4465 case 'K74': /* 会員認証に連続して失敗し、ロックアウトされました */
4466 case 'K75': /* 会員は有効ではありません */
4467 case 'K79': /* 会員判定エラー(Login 無効または会員無効) */
4468 case 'K80': /* 会員ID 設定不一致(設定が�
4469 要) */
4470 case 'K81': /* 会員ID 設定不一致(設定が不要) */
4471 case 'K84': /* 会員ID の�
4472 �力�
4473 容不正 */
4474 case 'K85': /* 会員パスワードの�
4475 �力�
4476 容不正 */
4477 case 'K86': /* �
4478 目「処理番号:ProcNo」精査エラー */
4479 case 'K87': /* �
4480 目「POST用URL:PostUrl」精査エラー */
4481 case 'K88': /* �
4482 �取引重複エラー */
4483 case 'K89': /* 処理番号の重複エラー */
4484 case 'K96': /* 本システム通信障害発生(タイムアウト) */
4485 case 'K98': /* 本システム�
4486 部で軽度障害が発生 */
4487 case 'K99': /* その他例外エラー */
4488 case 'KA1': /* �
4489 目「通貨コード:CurrencyId」精査エラー */
4490 case 'KBX': /* 二重取引エラー */
4491 case 'KBY': /* 処理未完了エラー */
4492 case 'KBZ': /* �
4493 �取引なしエラー */
4494 case 'KG8': /* 事業�
4495 認証に連続して失敗し、ロックアウトされました */
4496 case 'KGH': /* 会員参�
4497 �電文利用設定エラー */
4498 case 'KH0': /* レスポンス不明 */
4499 case 'KH4': /* �
4500 目「PageLanguage」精査エラー */
4501 case 'KHS': /* �
4502 目「SuccessURL」精査エラー */
4503 case 'KHT': /* �
4504 目「ErrorURL」精査エラー */
4505 case 'KHU': /* �
4506 目「StatusNoticeURL」精査エラー */
4507 case 'KHV': /* 自動取消実施済、再処理を行ってください */
4508 case 'KHX': /* �
4509 目「Token」精査エラー */
4510 case 'KHZ': /* 利用可能なトークンがありません */
4511 case 'KI0': /* 与信売上計上中止(詳細不明) */
4512 case 'KI1': /* �
4513 目「k_TokenNinsyoCode」精査エラー */
4514 case 'KI2': /* 使用済みトークンエラー */
4515 case 'KI3': /* トークン有効期限切れエラー */
4516 case 'KI4': /* �
4517 目「端末�
4518 報」精査エラー */
4519 case 'KI5': /* 同一カード番号の連続�
4520 �力によりロックされています。 */
4521 case 'KI6': /* 同一端末からの連続�
4522 �力により端末がロックされています。 */
4523 case 'KI8': /* 取引の対象が複数件存在します */
4524 case 'KIE': /* �
4525 目「signature」精査エラー */
4526 case 'KIF': /* signature エラー、オブジェクト識別子が含まれていません。 */
4527 case 'KIH': /* signature エラー、署名時間が許容時間を�
4528 えています。 */
4529 case 'KIJ': /* トークン決済、ApplePay 取引許可エラー */
4530 case 'KIK': /* Apple Pay 会員�
4531 �取引不整合エラー */
4532 case 'KIL': /* 通常会員�
4533 �取引不整合エラー */
4534 case 'KIW': /* �
4535 目「KaiinIdAutoRiyoFlg」精査エラー */
4536 case 'C01': /* 弊社設定関連エラー */
4537 case 'C02': /* e-SCOTT システムエラー */
4538 case 'C03': /* e-SCOTT 通信エラー */
4539 case 'C10': /* 支払区分エラー */
4540 case 'C11': /* ボーナス期間外エラー */
4541 case 'C12': /* 分割回数エラー */
4542 case 'C14': /* 取消済みエラー */
4543 case 'C18': /* オーソリ除外対象のカード番号体系エラー */
4544 case 'C70': /* 弊社設定�
4545 報エラー */
4546 case 'C71': /* 弊社設定�
4547 報エラー */
4548 case 'C80': /* カード会社センター閉局 */
4549 case 'C98': /* その他例外エラー */
4550 case 'C99': /* その他例外エラー */
4551 case 'G74': /* 分割回数エラー */
4552 case 'G78': /* 支払区分エラー */
4553 case 'G85': /* CAFIS 代行エラー */
4554 case 'G92': /* カード会社任意エラー */
4555 case 'G94': /* サイクル通番エラー */
4556 case 'G95': /* 当該業務オンライン終了 */
4557 case 'G98': /* 当該自社対象業務エラー */
4558 case 'G99': /* 接続要求自社受付拒否 */
4559 case 'R01': /* システムが起動していないか、または一時的にダウンしています。しばらくしてからもう一度試してください。 */
4560 case 'R02': /* メッセージ形式のエラー。 */
4561 case 'R03': /* 署名エラーを確認してください。 */
4562 case 'R04': /* メッセージ取引キー要素がありません。 */
4563 case 'R05': /* 取引不成立。他の銀聯決済カードを使用してください。 */
4564 case 'R06': /* 加盟店の状�
4565 �が正しくありません。 */
4566 case 'R07': /* この取引の権利はありません。 */
4567 case 'R08': /* 取引額が限度額を�
4568 過しています。 */
4569 case 'R09': /* �
4570 �取引が存在していないか、または状�
4571 �が正しくありません。 */
4572 case 'R10': /* �
4573 �取引�
4574 報と一致しません。 */
4575 case 'R11': /* �
4576 �会の回数が限度を�
4577 えるか、オペレーションの頻度が過剰です。 */
4578 case 'R12': /* 銀聯リスク制限 */
4579 case 'R13': /* 取引の受付時間外です。 */
4580 case 'R14': /* 残高からの差し引きはできますが、決済時間を過ぎています。 */
4581 case 'R15': /* �
4582 �力したカード番号が無効です。再度確認のうえ�
4583 �力してください。 */
4584 case 'R16': /* 取引不成立。発行会社はこの加盟店に対応していません。別の銀行カードに変更してください。 */
4585 case 'R17': /* カードの状�
4586 �が正しくありません。 */
4587 case 'R18': /* カードの残高不足。 */
4588 case 'R19': /* �
4589 �力した PIN、有効期限または CVN2 のエラー、取引不成立。 */
4590 case 'R20': /* �
4591 �力したカード保有�
4592 ID�
4593 報または携帯電話番号が正しくない、検証不成立。 */
4594 case 'R21': /* PIN �
4595 �力回数の限度を�
4596 えています。 */
4597 case 'R22': /* あなたの銀行カードは現在この取引には対応していません。 */
4598 case 'R23': /* 試行時間の限度�
4599 過、取引不成立。 */
4600 case 'R24': /* 取引はリダイレクトされました。カード保有�
4601
4602 �力画面になるまでお�
4603 ちください。 */
4604 case 'R25': /* 動的パスワードまたは SMS 認証コードの確認ができません。 */
4605 case 'R26': /* 銀行窓口またはオンライン銀行で銀聯決済サービスにサインアップしていません。 */
4606 case 'R27': /* 決済カードの有効期限が過ぎています。 */
4607 case 'R28': /* 有効化には暗号検証が�
4608 要です。 */
4609 case 'R29': /* この銀行カードは認証済の支払いに有効化されていません。 */
4610 case 'R30': /* 発行会社の取引権が制限されています。発行会社にお問い合わせください。 */
4611 case 'R31': /* 銀行カードは有効ですが、発行会社が SMS認証に対応していません。 */
4612 case 'R32': /* ファイルが存在しません。 */
4613 case 'R33': /* 一般的エラー */
4614 case 'R34': /* SLN にお問い合わせください。 */
4615 case 'R35': /* SLN にお問い合わせください。 */
4616 case 'R36': /* この取引はありませんでした。 */
4617 case 'R37': /* 取引不成立。詳細は発行会社に問い合わせてください。 */
4618 case 'W01': /* オンライン収納代行サービス設定エラー */
4619 case 'W02': /* 設定値エラー */
4620 case 'W03': /* オンライン収納代行サービス�
4621 部エラー(Web系) */
4622 case 'W04': /* システム設定エラー */
4623 case 'W05': /* �
4624 目設定エラー */
4625 case 'W06': /* オンライン収納代行サービス�
4626 部エラー(DB系) */
4627 case 'W99': /* その他例外エラー */
4628 $message = __( 'Sorry, please contact the administrator from the inquiry form.', 'usces' ); /* 恐れ�
4629 �りますが、お問い合わせフォームより管理�
4630 にお問い合わせください。 */
4631 break;
4632 case 'K20': /* �
4633 目「CardNo」精査エラー */
4634 case 'K82': /* カード番号の�
4635 �力�
4636 容不正 */
4637 case 'C16': /* カード番号エラー */
4638 case 'C17': /* カード番号体系エラー */
4639 case 'G65': /* カード番号エラー */
4640 $message = __( 'Credit card number is not appropriate.', 'usces' ); /* 指定のカード番号が適切ではありません。*/
4641 break;
4642 case 'K21': /* �
4643 目「CardExp」精査エラー */
4644 case 'K83': /* カード有効期限の�
4645 �力�
4646 容不正 */
4647 case 'C13': /* 有効期限切れエラー */
4648 case 'G83': /* 有効期限エラー */
4649 $message = __( 'Card expiration date is not appropriate.', 'usces' ); /* カード有効期限が適切ではありません。*/
4650 break;
4651 case 'K24': /* �
4652 目「SecCd」精査エラー */
4653 case 'G44': /* セキュリティコード誤り */
4654 case 'G45': /* セキュリティコード�
4655 �力無 */
4656 $message = __( 'Security code is not appropriate.', 'usces' ); /* セキュリティコードが適切ではありません。*/
4657 break;
4658 case 'K40': /* セキュリティコードアンマッチ検証 NG */
4659 case 'K45': /* �
4660 目「KaiinId」精査エラー */
4661 case 'K46': /* �
4662 目「KaiinPass」精査エラー */
4663 case 'K47': /* �
4664 目「NewKaiinPass」精査エラー */
4665 case 'K48': /* �
4666 目「EnableCheckUseKbn」精査エラー */
4667 case 'KHX': /* �
4668 目「Token」精査エラー */
4669 case 'G42': /* 暗証番号エラー */
4670 case 'G84': /* 承認番号エラー */
4671 $message = __( 'Credit card information is not appropriate.', 'usces' ); /* カード�
4672 報が適切ではありません。*/
4673 break;
4674 case 'C15': /* ボーナス金額下限エラー */
4675 $message = __( 'Please change the payment method and error due to less than the minimum amount of bonus payment.', 'usces' ); /* ボーナス払いの下限金額未満によるエラーのため、支払方法を変更して再処理を行ってください。*/
4676 break;
4677 case 'G12': /* カード使用不可 */
4678 case 'G22': /* 支払永�
4679 禁止 */
4680 case 'G30': /* 取引判定保留 */
4681 case 'G56': /* 無効カード */
4682 case 'G60': /* 事�
4683 カード */
4684 case 'G61': /* 無効カード */
4685 case 'G96': /* 事�
4686 カードデータエラー */
4687 case 'G97': /* 当該要求拒否 */
4688 $message = __( 'Credit card is unusable.', 'usces' ); /* クレジットカードが使用不可能です。*/
4689 break;
4690 case 'G54': /* 利用回数エラー */
4691 $message = __( 'It is over 1 day usage or over amount.', 'usces' ); /* 1日利用回数または金額オーバーです。*/
4692 break;
4693 case 'G55': /* 限度額オーバー */
4694 $message = __( 'It is over limit for 1 day use.', 'usces' ); /* 1日利用限度額オーバーです。*/
4695 break;
4696 case 'G68': /* 金額エラー */
4697 case 'G72': /* ボーナス額エラー */
4698 $message = __( 'Amount is not appropriate.', 'usces' ); /* 金額が適切ではありません。*/
4699 break;
4700 case 'G75': /* 分割金額エラー */
4701 $message = __( 'It is lower than the lower limit of installment payment.', 'usces' ); /* 分割払いの下限金額を下回っています。*/
4702 break;
4703 case 'K28': /* �
4704 目「TelNo」精査エラー */
4705 $message = __( 'Customer telephone number is not appropriate.', 'usces' ); /* お客様電話番号が適切ではありません。*/
4706 break;
4707 case 'K51': /* �
4708 目「NameKanji」精査エラー */
4709 $message = __( 'Customer name is not entered properly.', 'usces' ); /* お客様氏名が適切に�
4710 �力されていません。*/
4711 break;
4712 case 'K52': /* �
4713 目「NameKana」精査エラー */
4714 $message = __( 'Customer kana name is not entered properly.', 'usces' ); /* お客様氏名カナが適切に�
4715 �力されていません。*/
4716 break;
4717 case 'K30': /* �
4718 目「MessageVersionNo3D」精査エラー */
4719 case 'K31': /* �
4720 目「TransactionId3D」精査エラー */
4721 case 'K32': /* �
4722 目「EncordXId3D」精査エラー */
4723 case 'K33': /* �
4724 目「TransactionStatus3D」精査エラー */
4725 case 'K34': /* �
4726 目「CAVVAlgorithm3D」精査エラー */
4727 case 'K35': /* �
4728 目「CAVV3D」精査エラー */
4729 case 'K36': /* �
4730 目「ECI3D」精査エラー */
4731 case 'K37': /* �
4732 目「PANCard3D」精査エラー */
4733 case 'U01': /* イシュアまたは会員が未参加(旧:カード発行会社での ID 登録なし) */
4734 case 'U02': /* 3D セキュア未対応カード発行会社 */
4735 case 'U03': /* ネットワーク等でのエラー発生 */
4736 case 'U04': /* 3D セキュア本人認証 NG */
4737 case 'U05': /* 3D セキュア改ざんチェック NG */
4738 case 'U06': /* セッションの有効期限切れ */
4739 case 'U07': /* 重複した受付 */
4740 case 'U08': /* 退避したセッション�
4741 報が削除されていた */
4742 case 'U09': /* 3D セキュア対象外ブランド */
4743 case 'U10': /* ブランドサーバーが停止、または接続不可 */
4744 case 'U11': /* 認証システム精査エラー */
4745 case 'U12': /* 加盟店認証エラー */
4746 case 'U13': /* 認証システム�
4747 目エラー */
4748 case 'U14': /* メンテナンスによるシステムエラー */
4749 case 'U15': /* アテンプト */
4750 case 'U95': /* システムエラー */
4751 case 'U96': /* タイムアウト */
4752 case 'U99': /* 想定外エラー */
4753 $message = __( '3D secure authentication failed.', 'usces' ); /* 3D セキュア認証ができませんでした。 */
4754 break;
4755 default:
4756 $message = __( 'Sorry, please contact the administrator from the inquiry form.', 'usces' ); /* 恐れ�
4757 �りますが、お問い合わせフォームより管理�
4758 にお問い合わせください。 */
4759 }
4760 return $message;
4761 }
4762
4763 /**
4764 * 重複送信不可
4765 *
4766 * @param string $acting_flg Payment type.
4767 * @param string $rand Welcart transaction key.
4768 */
4769 public function duplication_control( $acting_flg, $rand ) {
4770 global $wpdb;
4771
4772 if ( ! usces_check_trans_id( $rand ) ) {
4773 exit();
4774 }
4775 usces_save_trans_id( $rand, $acting_flg );
4776
4777 $key = 'wc_trans_id';
4778 $query = $wpdb->prepare( "SELECT `order_id` FROM {$wpdb->prefix}usces_order_meta WHERE `meta_value` = %d AND `meta_key` = %s", $rand, $key );
4779 $order_id = $wpdb->get_var( $query );
4780 if ( ! $order_id ) {
4781 return;
4782 }
4783
4784 if ( $this->acting_flg_card === $acting_flg ) {
4785 wp_redirect(
4786 add_query_arg(
4787 array(
4788 'acting' => $this->acting_card,
4789 'acting_return' => 1,
4790 'result' => 1,
4791 '_nonce' => wp_create_nonce( $this->acting_flg_card ),
4792 ),
4793 USCES_CART_URL
4794 )
4795 );
4796 exit();
4797 }
4798 }
4799
4800 /**
4801 * ソケット通信接続
4802 *
4803 * @param array $params Parameters.
4804 * @return array
4805 */
4806 public function connection( $params ) {
4807 $gc = new SLNConnection();
4808 $gc->set_connection_url( $params['send_url'] );
4809 $gc->set_connection_timeout( 60 );
4810 $response_value = $gc->send_request( $params['param_list'] );
4811
4812 if ( ! empty( $response_value ) ) {
4813 $response = explode( "\r\n\r\n", $response_value );
4814 parse_str( $response[1], $response_data );
4815 if ( ! array_key_exists( 'ResponseCd', $response_data ) ) {
4816 $response_data['ResponseCd'] = 'NG';
4817 }
4818 } else {
4819 $response_data['ResponseCd'] = 'NG';
4820 }
4821 return $response_data;
4822 }
4823
4824 /**
4825 * Save session data.
4826 *
4827 * @param string $key Key.
4828 * @param array $post_data Post data.
4829 * @return boolean
4830 */
4831 private function save_post_data( $key, $post_data ) {
4832 global $wpdb;
4833
4834 $query = $wpdb->prepare( "INSERT INTO {$wpdb->prefix}usces_log ( `datetime`, `log`, `log_type`, `log_key` ) VALUES ( %s, %s, %s, %s )",
4835 current_time( 'mysql' ),
4836 usces_serialize( $post_data ),
4837 'acting_post_data',
4838 $key
4839 );
4840 $res = $wpdb->query( $query );
4841 return $res;
4842 }
4843
4844 /**
4845 * Get session data.
4846 *
4847 * @param string $key Key.
4848 * @return array
4849 */
4850 private function get_post_data( $key ) {
4851 global $wpdb;
4852
4853 $query = $wpdb->prepare( "SELECT `log` FROM {$wpdb->prefix}usces_log WHERE `log_type` = %s AND `log_key` = %s", 'acting_post_data', $key );
4854 $data = $wpdb->get_var( $query );
4855 return usces_unserialize( $data );
4856 }
4857
4858 /**
4859 * Delete session data.
4860 *
4861 * @param string $key Key.
4862 */
4863 private function delete_post_data( $key ) {
4864 global $wpdb;
4865
4866 $query = $wpdb->prepare( "DELETE FROM {$wpdb->prefix}usces_log WHERE `log_type` = %s AND `log_key` = %s", 'acting_post_data', $key );
4867 $wpdb->query( $query );
4868 }
4869
4870 /**
4871 * Consent to Obtain Personal Information Messsage.
4872 */
4873 protected function consent_message() {
4874 $consent_message = __( '* Cautions on Use of Credit Cards', 'usces' ) . "\n"
4875 . __( '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"
4876 . __( 'In order to use EMV 3D Secure, it is necessary to send information about you to the card issuer.', 'usces' ) . "\n"
4877 . __( '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"
4878 . __( '* Provision of Personal Information to Third Parties', 'usces' ) . "\n"
4879 . __( '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"
4880 . __( '"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"
4881 . __( '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"
4882 . __( '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"
4883 . __( '* Agreement to provide personal information to a third party', 'usces' ) . "\n"
4884 . __( '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"
4885 . __( '* Safety Control Measures', 'usces' ) . "\n"
4886 . __( 'We may provide all or part of the information obtained from our customers to subcontractors in the United States.', 'usces' ) . "\n"
4887 . __( 'We will confirm that the subcontractor takes necessary and appropriate measures for the safe management of the information before storing it.', 'usces' ) . "\n"
4888 . __( 'For an overview of the legal system regarding the protection of personal information in the relevant country, please check here.', 'usces' ) . "\n"
4889 . 'https://www.ppc.go.jp/personalinfo/legal/kaiseihogohou/#gaikoku';
4890 return $consent_message;
4891 }
4892 }
4893
4894 if ( ! class_exists( 'SLNConnection' ) ) {
4895 /**
4896 * クラス定義 : SLNConnection
4897 */
4898 class SLNConnection {
4899 /* プロパティ定義 */
4900
4901 /**
4902 * 接続�
4903 �URLアドレス
4904 *
4905 * @var string
4906 */
4907 private $connection_url;
4908
4909 /**
4910 * 通信タイムアウト
4911 *
4912 * @var int
4913 */
4914 private $connection_timeout;
4915
4916 /* メソッド定義 */
4917
4918 /**
4919 * コンストラクタ
4920 */
4921 public function __construct() {
4922 /* プロパティ初期化 */
4923 $this->connection_url = '';
4924 $this->connection_timeout = 600;
4925 }
4926
4927 /**
4928 * 接続�
4929 �URLアドレスの設定
4930 *
4931 * @param string $connection_url 接続�
4932 �URLアドレス.
4933 */
4934 public function set_connection_url( $connection_url = '' ) {
4935 $this->connection_url = $connection_url;
4936 }
4937
4938 /**
4939 * 接続�
4940 �URLアドレスの取得
4941 *
4942 * @return string 接続�
4943 �URLアドレス
4944 */
4945 public function get_connection_url() {
4946 return $this->connection_url;
4947 }
4948
4949 /**
4950 * 通信タイムアウト時間(s)の設定
4951 *
4952 * @param int $connection_timeout 通信タイムアウト時間(s).
4953 */
4954 public function set_connection_timeout( $connection_timeout = 0 ) {
4955 $this->connection_timeout = $connection_timeout;
4956 }
4957
4958 /**
4959 * 通信タイムアウト時間(s)の取得
4960 *
4961 * @return int 通信タイムアウト時間(s)
4962 */
4963 public function get_connection_timeout() {
4964 return $this->connection_timeout;
4965 }
4966
4967 /**
4968 * リクエスト送信クラス
4969 *
4970 * @param array $param_list リクエストパラメータ(要求電文)�
4971 �列.
4972 * @return array レスポンスパラメータ(応答電文)�
4973 �列
4974 */
4975 public function send_request( &$param_list = array() ) {
4976 $r_value = array();
4977
4978 /* パラメータチェック */
4979 if ( empty( $param_list ) === false ) {
4980 /* 送信�
4981 ��
4982 報の準備 */
4983 $url = parse_url( $this->connection_url );
4984
4985 /* HTTPデータ生成 */
4986 $http_data = http_build_query( $param_list );
4987
4988 /* HTTPヘッダ生成 */
4989 $http_header = 'POST ' . $url['path'] . ' HTTP/1.1' . "\r\n" .
4990 'Host: ' . $url['host'] . "\r\n" .
4991 'User-Agent: SLN_PAYMENT_CLIENT_PG_PHP_VERSION_1_0' . "\r\n" .
4992 'Content-Type: application/x-www-form-urlencoded' . "\r\n" .
4993 'Content-Length: ' . strlen( $http_data ) . "\r\n" .
4994 'Connection: close';
4995
4996 /* POSTデータ生成 */
4997 $http_post = $http_header . "\r\n\r\n" . $http_data;
4998
4999 /* 送信処理 */
5000 $errno = 0;
5001 $errstr = '';
5002 $hm = array();
5003 $context = stream_context_create(
5004 array(
5005 'ssl' => array(
5006 'capture_peer_cert' => true,
5007 'capture_peer_cert_chain' => true,
5008 'disable_compression' => true,
5009 ),
5010 )
5011 );
5012
5013 /* ソケット通信接続 */
5014 $fp = @stream_socket_client( 'tlsv1.2://' . $url['host'] . ':443', $errno, $errstr, $this->connection_timeout, STREAM_CLIENT_CONNECT, $context );
5015 if ( false === $fp ) {
5016 usces_log( 'e-SCOTT send error : ' . __( 'TLS 1.2 connection failed.', 'usces' ), 'acting_transaction.log' ); /* TLS1.2接続に失敗しました */
5017 return $r_value;
5018 }
5019
5020 if ( false !== $fp ) {
5021 /* 接続後タイムアウト設定 */
5022 $result = socket_set_timeout( $fp, $this->connection_timeout );
5023 if ( true === $result ) {
5024 /* データ送信 */
5025 fwrite( $fp, $http_post );
5026 /* 応答受信 */
5027 $response_data = '';
5028 while ( ! feof( $fp ) ) {
5029 $response_data .= @fgets( $fp, 4096 );
5030 }
5031
5032 /* ソケット通信�
5033 報を取得 */
5034 $hm = stream_get_meta_data( $fp );
5035 /* ソケット通信切断 */
5036 $result = fclose( $fp );
5037 if ( true === $result ) {
5038 if ( true !== $hm['timed_out'] ) {
5039 /* レスポンスデータ生成 */
5040 $r_value = $response_data;
5041 } else {
5042 /* エラー:タイムアウト発生 */
5043 usces_log( 'e-SCOTT send error : ' . __( 'Timeout occurred during communication.', 'usces' ), 'acting_transaction.log' ); /* 通信中にタイムアウトが発生しました */
5044 }
5045 } else {
5046 /* エラー:ソケット通信切断失敗 */
5047 usces_log( 'e-SCOTT send error : ' . __( 'Failed to disconnect from SLN.', 'usces' ), 'acting_transaction.log' ); /* SLNとの切断に失敗しました */
5048 }
5049 } else {
5050 /* エラー:タイムアウト設定失敗 */
5051 usces_log( 'e-SCOTT send error : ' . __( 'Timeout setting failed.', 'usces' ), 'acting_transaction.log' ); /* タイムアウト設定に失敗しました */
5052 }
5053 }
5054 } else {
5055 /* エラー:パラメータ不整合 */
5056 usces_log( 'e-SCOTT send error : ' . __( 'Invalid request parameter specification.', 'usces' ), 'acting_transaction.log' ); /* リクエストパラメータの指定が正しくありません */
5057 }
5058 return $r_value;
5059 }
5060
5061 /**
5062 * UnionPay(銀聯)接続
5063 *
5064 * @param string $url Request URL.
5065 * @param array $param_list Parameters.
5066 */
5067 public function send_request_unionpay( $url, &$param_list = array() ) {
5068 if ( false === empty( $param_list ) ) {
5069 $headers = array(
5070 'Content-Type' => 'application/x-www-form-urlencoded;charset=UTF-8',
5071 );
5072 $args = array(
5073 'headers' => $headers,
5074 'body' => $param_list,
5075 );
5076
5077 $response = wp_remote_post( $url, $args );
5078 $response_body = wp_remote_retrieve_body( $response );
5079 echo $response_body; // no escape.
5080
5081 } else {
5082 /* エラー:パラメータ不整合 */
5083 usces_log( 'e-SCOTT send error : ' . __( 'Invalid request parameter specification.', 'usces' ), 'acting_transaction.log' ); /* リクエストパラメータの指定が正しくありません */
5084 }
5085 }
5086 }
5087 }
5088