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 / paymentRemise.class.php

paymentRemise.class.php in Welcart e-Commerce 2.11.30, at classes/paymentRemise.class.php

1,347 lines 56.2 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 * ルミーズ
5 *
6 * @package Welcart
7 * @author Collne Inc.
8 * @version 1.0.0
9 */
10
11 /**
12 * ルミーズ決済モジュール
13 */
14 class REMISE_SETTLEMENT {
15 /**
16 * Instance of this class.
17 *
18 * @var object
19 */
20 protected static $instance = null;
21
22 /**
23 * 決済代行会社ID
24 *
25 * @var string
26 */
27 protected $paymod_id;
28
29 /**
30 * 決済種別
31 *
32 * @var string
33 */
34 protected $pay_method;
35
36 /**
37 * 決済代行会社略称
38 *
39 * @var string
40 */
41 protected $acting_name;
42
43 /**
44 * 決済代行会社正式名称
45 *
46 * @var string
47 */
48 protected $acting_formal_name;
49
50 /**
51 * 決済代行会社URL
52 *
53 * @var string
54 */
55 protected $acting_company_url;
56
57 /**
58 * マルチ決済にて選択した支払期間の名称リスト.
59 *
60 * @var array[]
61 */
62 public static $x_pay_csv_list = array(
63 'D001' => array(
64 'label' => 'セブン-イレブン',
65 ),
66 'D002' => array(
67 'label' => 'ローソン',
68 ),
69 'D005' => array(
70 'label' => 'ミニストップ',
71 ),
72 'D015' => array(
73 'label' => 'セイコーマート',
74 ),
75 'D405' => array(
76 'label' => 'ペイジー',
77 ),
78 'D010' => array(
79 'label' => 'デイリーヤマザキ',
80 ),
81 'D011' => array(
82 'label' => 'ヤマザキデイリーストア',
83 ),
84 'D030' => array(
85 'label' => 'ファミリーマート',
86 ),
87 'E201' => array(
88 'label' => 'PayPay',
89 ),
90 'E202' => array(
91 'label' => 'PayPay',
92 ),
93 'D401' => array(
94 'label' => '楽天Edy',
95 ),
96 'D404' => array(
97 'label' => '楽天銀行',
98 ),
99 'D406' => array(
100 'label' => 'PayPay銀行',
101 ),
102 'D403' => array(
103 'label' => 'モバイルSuica',
104 ),
105 'D451' => array(
106 'label' => 'ウェブマネー',
107 ),
108 'D452' => array(
109 'label' => 'ビットキャッシュ',
110 ),
111 'D453' => array(
112 'label' => 'JCBプレモカード',
113 ),
114 'P901' => array(
115 'label' => 'コンビニ払込票',
116 ),
117 'P902' => array(
118 'label' => 'コンビニ払込票',
119 ),
120 'P903' => array(
121 'label' => 'コンビニ払込票',
122 ),
123 'P904' => array(
124 'label' => 'コンビニ払込票',
125 ),
126 'P905' => array(
127 'label' => 'コンビニ払込票',
128 ),
129 'P906' => array(
130 'label' => 'コンビニ払込票',
131 ),
132 'C501' => array(
133 'label' => 'クレジットカード',
134 ),
135 'C502' => array(
136 'label' => 'クレジットカード',
137 ),
138 'C511' => array(
139 'label' => 'PayPal',
140 ),
141 'K801' => array(
142 'label' => '口座振替会員登録',
143 ),
144 'M601' => array(
145 'label' => 'd払い',
146 ),
147 'M602' => array(
148 'label' => 'd払い',
149 ),
150 'M603' => array(
151 'label' => 'd払い',
152 ),
153 'M611' => array(
154 'label' => 'auかんたん決済',
155 ),
156 'M612' => array(
157 'label' => 'auかんたん決済',
158 ),
159 'M613' => array(
160 'label' => 'auかんたん決済',
161 ),
162 'M621' => array(
163 'label' => 'ソフトバンクまとめて支払い',
164 ),
165 'M622' => array(
166 'label' => 'ソフトバンクまとめて支払い',
167 ),
168 'M623' => array(
169 'label' => 'ソフトバンクまとめて支払い',
170 ),
171 );
172
173 /**
174 * Construct.
175 */
176 public function __construct() {
177
178 $this->paymod_id = 'remise';
179 $this->pay_method = array(
180 'acting_remise_card',
181 'acting_remise_conv',
182 );
183 $this->acting_name = 'ルミーズ';
184 $this->acting_formal_name = 'ルミーズ';
185 $this->acting_company_url = 'https://www.remise.co.jp/';
186
187 $this->initialize_data();
188
189 if ( is_admin() ) {
190 add_action( 'admin_print_footer_scripts', array( $this, 'admin_scripts' ) );
191 add_action( 'usces_action_admin_settlement_update', array( $this, 'settlement_update' ) );
192 add_action( 'usces_action_settlement_tab_title', array( $this, 'settlement_tab_title' ) );
193 add_action( 'usces_action_settlement_tab_body', array( $this, 'settlement_tab_body' ) );
194
195 add_filter( 'usces_filter_settle_info_field_meta_keys', array( $this, 'settlement_info_field_meta_keys' ) );
196 add_filter( 'usces_filter_settle_info_field_keys', array( $this, 'settlement_info_field_keys' ), 10, 2 );
197 add_filter( 'usces_filter_settle_info_field_value', array( $this, 'settlement_info_field_value' ), 10, 3 );
198 }
199
200 if ( $this->is_activate_card() || $this->is_activate_conv() ) {
201 add_action( 'usces_action_reg_orderdata', array( $this, 'register_orderdata' ) );
202 add_filter( 'usces_filter_send_order_mail_payment', array( $this, 'order_mail_payment' ), 10, 6 );
203 }
204
205 if ( $this->is_validity_acting( 'card' ) ) {
206 add_filter( 'usces_filter_template_redirect', array( $this, 'member_update_settlement' ), 1 );
207 add_action( 'usces_action_member_submenu_list', array( $this, 'e_update_settlement' ) );
208 add_filter( 'usces_filter_member_submenu_list', array( $this, 'update_settlement' ), 10, 2 );
209 if ( is_admin() ) {
210 add_action( 'usces_action_admin_member_info', array( $this, 'member_settlement_info' ), 10, 3 );
211 add_action( 'usces_action_post_update_memberdata', array( $this, 'member_edit_post' ), 10, 2 );
212 }
213 }
214
215 if ( $this->is_validity_acting( 'conv' ) ) {
216 add_filter( 'usces_filter_payment_detail', array( $this, 'payment_detail' ), 10, 2 );
217 add_action( 'usces_filter_completion_settlement_message', array( $this, 'completion_settlement_message' ), 10, 2 );
218 }
219 add_filter( 'usces_filter_order_confirm_mail_payment', array( $this, 'order_confirm_mail_payment' ), 10, 5 );
220 add_filter( 'usces_filter_pdf_payment_name', array( $this, 'pdf_payment_name' ), 10, 2 );
221 }
222
223 /**
224 * Return an instance of this class.
225 */
226 public static function get_instance() {
227 if ( null == self::$instance ) {
228 self::$instance = new self();
229 }
230 return self::$instance;
231 }
232
233 /**
234 * Initialize.
235 */
236 public function initialize_data() {
237 $options = get_option( 'usces', array() );
238 if ( ! isset( $options['acting_settings'] ) || ! isset( $options['acting_settings']['remise'] ) ) {
239 $options['acting_settings']['remise']['SHOPCO'] = '';
240 $options['acting_settings']['remise']['HOSTID'] = '';
241 $options['acting_settings']['remise']['card_activate'] = 'off';
242 $options['acting_settings']['remise']['card_jb'] = '';
243 $options['acting_settings']['remise']['card_pc_ope'] = '';
244 $options['acting_settings']['remise']['payquick'] = '';
245 $options['acting_settings']['remise']['howpay'] = '';
246 $options['acting_settings']['remise']['continuation'] = '';
247 $options['acting_settings']['remise']['conv_activate'] = 'off';
248 $options['acting_settings']['remise']['conv_pc_ope'] = '';
249 $options['acting_settings']['remise']['S_PAYDATE'] = '';
250 $options['acting_settings']['remise']['send_url_mbl'] = '';
251 $options['acting_settings']['remise']['send_url_pc'] = '';
252 $options['acting_settings']['remise']['send_url_cvs_mbl'] = '';
253 $options['acting_settings']['remise']['send_url_cvs_pc'] = '';
254 $options['acting_settings']['remise']['show_x_pay_csv'] = 'off';
255 update_option( 'usces', $options );
256 }
257 }
258
259 /**
260 * 決済有効判定
261 * 支払方法で使用している場合に true
262 *
263 * @param string $type Module type.
264 * @return boolean
265 */
266 public function is_validity_acting( $type = '' ) {
267 $acting_opts = $this->get_acting_settings();
268 if ( empty( $acting_opts ) ) {
269 return false;
270 }
271
272 $payment_method = usces_get_system_option( 'usces_payment_method', 'sort' );
273 $method = false;
274
275 switch ( $type ) {
276 case 'card':
277 foreach ( $payment_method as $payment ) {
278 if ( 'acting_remise_card' === $payment['settlement'] && 'activate' === $payment['use'] ) {
279 $method = true;
280 break;
281 }
282 }
283 if ( $method && $this->is_activate_card() ) {
284 return true;
285 } else {
286 return false;
287 }
288 break;
289
290 case 'conv':
291 foreach ( $payment_method as $payment ) {
292 if ( 'acting_remise_conv' === $payment['settlement'] && 'activate' === $payment['use'] ) {
293 $method = true;
294 break;
295 }
296 }
297 if ( $method && $this->is_activate_conv() ) {
298 return true;
299 } else {
300 return false;
301 }
302 break;
303
304 default:
305 if ( 'on' === $acting_opts['activate'] ) {
306 return true;
307 } else {
308 return false;
309 }
310 }
311 }
312
313 /**
314 * クレジットカード決済有効判定
315 *
316 * @return boolean
317 */
318 public function is_activate_card() {
319 $acting_opts = $this->get_acting_settings();
320 if ( ( isset( $acting_opts['activate'] ) && 'on' === $acting_opts['activate'] ) &&
321 ( isset( $acting_opts['card_activate'] ) && ( 'on' === $acting_opts['card_activate'] ) ) ) {
322 $res = true;
323 } else {
324 $res = false;
325 }
326 return $res;
327 }
328
329 /**
330 * コンビニ・電子マネー決済有効判定
331 *
332 * @return boolean
333 */
334 public function is_activate_conv() {
335 $acting_opts = $this->get_acting_settings();
336 if ( ( isset( $acting_opts['activate'] ) && 'on' === $acting_opts['activate'] ) &&
337 ( isset( $acting_opts['conv_activate'] ) && 'on' === $acting_opts['conv_activate'] ) ) {
338 $res = true;
339 } else {
340 $res = false;
341 }
342 return $res;
343 }
344
345 /**
346 * 管理画面スクリプト
347 * admin_print_footer_scripts
348 */
349 public function admin_scripts() {
350 $admin_page = filter_input( INPUT_GET, 'page' );
351 switch ( $admin_page ) :
352 case 'usces_settlement':
353 $settlement_selected = get_option( 'usces_settlement_selected' );
354 if ( in_array( $this->paymod_id, (array) $settlement_selected, true ) ) :
355 ?>
356 <script type="text/javascript">
357 jQuery(document).ready( function($) {
358 const form_remise = $('form#remise_form');
359 function card_activate_remise() {
360 if( 'on' === form_remise.find("input[name='card_activate']:checked").val() ) {
361 $(".card_form_remise").css("display","");
362 } else {
363 $(".card_form_remise").css("display","none");
364 }
365 }
366 function conv_activate_remise() {
367 if( 'on' === form_remise.find("input[name='conv_activate']:checked").val() ) {
368 $(".conv_form_remise").css("display","");
369 } else {
370 $(".conv_form_remise").css("display","none");
371 }
372 }
373 card_activate_remise();
374 $("input[id^='card_activate_remise_']").click( function() {
375 card_activate_remise();
376 });
377 conv_activate_remise();
378 $("input[id^='conv_activate_remise_']").click( function() {
379 conv_activate_remise();
380 });
381 });
382 </script>
383 <?php
384 endif;
385 break;
386 endswitch;
387 }
388
389 /**
390 * 決済オプション登録・更新
391 * usces_action_admin_settlement_update
392 */
393 public function settlement_update() {
394 global $usces;
395
396 if ( filter_input( INPUT_POST, 'acting' ) !== $this->paymod_id ) {
397 return;
398 }
399
400 $this->error_mes = '';
401 $options = get_option( 'usces', array() );
402 $payment_method = usces_get_system_option( 'usces_payment_method', 'settlement' );
403 $post_data = wp_unslash( $_POST );
404
405 unset( $options['acting_settings']['remise'] );
406 $options['acting_settings']['remise']['plan'] = ( isset( $post_data['plan'] ) ) ? $post_data['plan'] : '';
407 $options['acting_settings']['remise']['SHOPCO'] = ( isset( $post_data['SHOPCO'] ) ) ? $post_data['SHOPCO'] : '';
408 $options['acting_settings']['remise']['HOSTID'] = ( isset( $post_data['HOSTID'] ) ) ? $post_data['HOSTID'] : '';
409 $options['acting_settings']['remise']['card_activate'] = ( isset( $post_data['card_activate'] ) ) ? $post_data['card_activate'] : '';
410 $options['acting_settings']['remise']['card_jb'] = ( isset( $post_data['card_jb'] ) ) ? $post_data['card_jb'] : '';
411 $options['acting_settings']['remise']['card_pc_ope'] = ( isset( $post_data['card_pc_ope'] ) ) ? $post_data['card_pc_ope'] : '';
412 $options['acting_settings']['remise']['payquick'] = ( isset( $post_data['payquick'] ) ) ? $post_data['payquick'] : '';
413 $options['acting_settings']['remise']['howpay'] = ( isset( $post_data['howpay'] ) ) ? $post_data['howpay'] : '';
414 $options['acting_settings']['remise']['continuation'] = ( isset( $post_data['continuation'] ) ) ? $post_data['continuation'] : '';
415 $options['acting_settings']['remise']['conv_activate'] = ( isset( $post_data['conv_activate'] ) ) ? $post_data['conv_activate'] : '';
416 $options['acting_settings']['remise']['conv_pc_ope'] = ( isset( $post_data['conv_pc_ope'] ) ) ? $post_data['conv_pc_ope'] : '';
417 $options['acting_settings']['remise']['S_PAYDATE'] = ( isset( $post_data['S_PAYDATE'] ) ) ? $post_data['S_PAYDATE'] : '';
418 $options['acting_settings']['remise']['send_url_mbl'] = ( isset( $post_data['send_url_mbl'] ) ) ? $post_data['send_url_mbl'] : '';
419 $options['acting_settings']['remise']['send_url_pc'] = ( isset( $post_data['send_url_pc'] ) ) ? $post_data['send_url_pc'] : '';
420 $options['acting_settings']['remise']['send_url_cvs_mbl'] = ( isset( $post_data['send_url_cvs_mbl'] ) ) ? $post_data['send_url_cvs_mbl'] : '';
421 $options['acting_settings']['remise']['send_url_cvs_pc'] = ( isset( $post_data['send_url_cvs_pc'] ) ) ? $post_data['send_url_cvs_pc'] : '';
422 $options['acting_settings']['remise']['show_x_pay_csv'] = ( isset( $post_data['show_x_pay_csv'] ) ) ? $post_data['show_x_pay_csv'] : '';
423
424 if ( 'on' === $options['acting_settings']['remise']['card_activate'] || 'on' === $options['acting_settings']['remise']['conv_activate'] ) {
425 // if ( isset( $post_data['plan_remise'] ) && WCUtils::is_zero( $post_data['plan_remise'] ) ) {
426 // $this->error_mes .= '※サービスプランを選択してください<br />';
427 // }
428 if ( WCUtils::is_blank( $post_data['SHOPCO'] ) ) {
429 $this->error_mes .= '※加盟店コードを�
430 �力してください<br />';
431 }
432 if ( WCUtils::is_blank( $post_data['HOSTID'] ) ) {
433 $this->error_mes .= '※ホスト番号を�
434 �力してください<br />';
435 }
436 if ( 'on' === $options['acting_settings']['remise']['card_activate'] ) {
437 if ( 'public' === $options['acting_settings']['remise']['card_pc_ope'] && WCUtils::is_blank( $post_data['send_url_pc'] ) ) {
438 $this->error_mes .= '※クレジットカード決済の本番URLを�
439 �力してください<br />';
440 }
441 }
442 if ( 'on' === $options['acting_settings']['remise']['conv_activate'] ) {
443 if ( WCUtils::is_blank( $post_data['S_PAYDATE'] ) ) {
444 $this->error_mes .= '※支払期限を�
445 �力してください<br />';
446 }
447 if ( 'public' === $options['acting_settings']['remise']['conv_pc_ope'] && WCUtils::is_blank( $post_data['send_url_cvs_pc'] ) ) {
448 $this->error_mes .= '※コンビニ・電子マネー決済の本番URLを�
449 �力してください<br />';
450 }
451 }
452 }
453
454 if ( '' === $this->error_mes ) {
455 $usces->action_status = 'success';
456 $usces->action_message = __( 'Options are updated.', 'usces' );
457 if ( 'on' === $options['acting_settings']['remise']['card_activate'] || 'on' === $options['acting_settings']['remise']['conv_activate'] ) {
458 $options['acting_settings']['remise']['activate'] = 'on';
459 $options['acting_settings']['remise']['REMARKS3'] = 'A0000875';
460 $toactive = array();
461 if ( 'on' === $options['acting_settings']['remise']['card_activate'] ) {
462 if ( 'test' === $options['acting_settings']['remise']['card_pc_ope'] ) {
463 $options['acting_settings']['remise']['send_url_pc_test'] = 'https://test.remise.jp/rpgw2/pc/card/paycard.aspx';
464 $options['acting_settings']['remise']['send_url_mbl_test'] = 'https://test.remise.jp/rpgw2/mbl/card/paycard.aspx';
465 }
466 $usces->payment_structure['acting_remise_card'] = 'カード決済(ルミーズ)';
467 foreach ( $payment_method as $settlement => $payment ) {
468 if ( 'acting_remise_card' === $settlement && 'activate' !== $payment['use'] ) {
469 $toactive[] = $payment['name'];
470 }
471 }
472 } else {
473 unset( $usces->payment_structure['acting_remise_card'] );
474 }
475 if ( 'on' === $options['acting_settings']['remise']['conv_activate'] ) {
476 if ( 'test' === $options['acting_settings']['remise']['conv_pc_ope'] ) {
477 $options['acting_settings']['remise']['send_url_cvs_pc_test'] = 'https://test.remise.jp/rpgw2/pc/cvs/paycvs.aspx';
478 $options['acting_settings']['remise']['send_url_cvs_mbl_test'] = 'https://test.remise.jp/rpgw2/mbl/cvs/paycvs.aspx';
479 }
480 $usces->payment_structure['acting_remise_conv'] = 'マルチ決済(ルミーズ)';
481 foreach ( $payment_method as $settlement => $payment ) {
482 if ( 'acting_remise_conv' === $settlement && 'activate' !== $payment['use'] ) {
483 $toactive[] = $payment['name'];
484 }
485 }
486 } else {
487 unset( $usces->payment_structure['acting_remise_conv'] );
488 }
489 usces_admin_orderlist_show_wc_trans_id();
490 if ( 0 < count( $toactive ) ) {
491 $usces->action_message .= __( 'Please update the payment method to "Activate". <a href="admin.php?page=usces_initial#payment_method_setting">General Setting > Payment Methods</a>', 'usces' );
492 }
493 } else {
494 $options['acting_settings']['remise']['activate'] = 'off';
495 unset( $usces->payment_structure['acting_remise_card'] );
496 unset( $usces->payment_structure['acting_remise_conv'] );
497 }
498 if ( 'on' !== $options['acting_settings']['remise']['card_activate'] || 'on' !== $options['acting_settings']['remise']['payquick'] || 'off' === $options['acting_settings']['remise']['activate'] ) {
499 usces_clear_quickcharge( 'remise_pcid' );
500 }
501 $deactivate = array();
502 foreach ( $payment_method as $settlement => $payment ) {
503 if ( ! array_key_exists( $settlement, $usces->payment_structure ) ) {
504 if ( 'deactivate' !== $payment['use'] ) {
505 $payment['use'] = 'deactivate';
506 $deactivate[] = $payment['name'];
507 usces_update_system_option( 'usces_payment_method', $payment['id'], $payment );
508 }
509 }
510 }
511 if ( 0 < count( $deactivate ) ) {
512 $deactivate_message = sprintf( __( '"Deactivate" %s of payment method.', 'usces' ), implode( ',', $deactivate ) );
513 $usces->action_message .= $deactivate_message;
514 }
515 } else {
516 $usces->action_status = 'error';
517 $usces->action_message = __( 'Data have deficiency.', 'usces' );
518 $options['acting_settings']['remise']['activate'] = 'off';
519 unset( $usces->payment_structure['acting_remise_card'] );
520 unset( $usces->payment_structure['acting_remise_conv'] );
521 $deactivate = array();
522 foreach ( $payment_method as $settlement => $payment ) {
523 if ( in_array( $settlement, $this->pay_method ) ) {
524 if ( 'deactivate' !== $payment['use'] ) {
525 $payment['use'] = 'deactivate';
526 $deactivate[] = $payment['name'];
527 usces_update_system_option( 'usces_payment_method', $payment['id'], $payment );
528 }
529 }
530 }
531 if ( 0 < count( $deactivate ) ) {
532 $deactivate_message = sprintf( __( '"Deactivate" %s of payment method.', 'usces' ), implode( ',', $deactivate ) );
533 $usces->action_message .= $deactivate_message . __( 'Please complete the setup and update the payment method to "Activate".', 'usces' );
534 }
535 }
536 ksort( $usces->payment_structure );
537 update_option( 'usces', $options );
538 update_option( 'usces_payment_structure', $usces->payment_structure );
539 }
540
541 /**
542 * クレジット決済設定画面タブ
543 * usces_action_settlement_tab_title
544 */
545 public function settlement_tab_title() {
546 $settlement_selected = get_option( 'usces_settlement_selected' );
547 if ( in_array( $this->paymod_id, (array) $settlement_selected, true ) ) {
548 echo '<li><a href="#uscestabs_' . esc_html( $this->paymod_id ) . '">' . esc_html( $this->acting_name ) . '</a></li>';
549 }
550 }
551
552 /**
553 * クレジット決済設定画面フォーム
554 * usces_action_settlement_tab_body
555 */
556 public function settlement_tab_body() {
557 global $usces;
558
559 $acting_opts = $this->get_acting_settings();
560 $settlement_selected = get_option( 'usces_settlement_selected' );
561 if ( in_array( $this->paymod_id, (array) $settlement_selected, true ) ) :
562 $plan = ( isset( $acting_opts['plan'] ) ) ? $acting_opts['plan'] : '0';
563 $shopco = ( isset( $acting_opts['SHOPCO'] ) ) ? $acting_opts['SHOPCO'] : '';
564 $hostid = ( isset( $acting_opts['HOSTID'] ) ) ? $acting_opts['HOSTID'] : '';
565 $card_activate = ( isset( $acting_opts['card_activate'] ) && 'on' === $acting_opts['card_activate'] ) ? 'on' : 'off';
566 $card_jb = ( isset( $acting_opts['card_jb'] ) ) ? $acting_opts['card_jb'] : 'AUTH';
567 $payquick = ( isset( $acting_opts['payquick'] ) && 'on' === $acting_opts['payquick'] ) ? 'on' : 'off';
568 $howpay = ( isset( $acting_opts['howpay'] ) && 'on' === $acting_opts['howpay'] ) ? 'on' : 'off';
569 $continuation = ( isset( $acting_opts['continuation'] ) && 'on' === $acting_opts['continuation'] ) ? 'on' : 'off';
570 $card_pc_ope = ( isset( $acting_opts['card_pc_ope'] ) && 'public' === $acting_opts['card_pc_ope'] ) ? 'public' : 'test';
571 $send_url_pc = ( isset( $acting_opts['send_url_pc'] ) ) ? $acting_opts['send_url_pc'] : '';
572 $conv_activate = ( isset( $acting_opts['conv_activate'] ) && 'on' === $acting_opts['conv_activate'] ) ? 'on' : 'off';
573 $s_paydate = ( isset( $acting_opts['S_PAYDATE'] ) ) ? $acting_opts['S_PAYDATE'] : '';
574 $conv_pc_ope = ( isset( $acting_opts['conv_pc_ope'] ) && 'public' === $acting_opts['conv_pc_ope'] ) ? 'public' : 'test';
575 $send_url_cvs_pc = ( isset( $acting_opts['send_url_cvs_pc'] ) ) ? $acting_opts['send_url_cvs_pc'] : '';
576 $show_x_pay_csv = ( isset( $acting_opts['show_x_pay_csv'] ) && 'on' === $acting_opts['show_x_pay_csv'] ) ? 'on' : 'off';
577 ?>
578 <div id="uscestabs_remise">
579 <div class="settlement_service"><span class="service_title"><?php echo esc_html( $this->acting_formal_name ); ?></span></div>
580 <?php
581 if ( filter_input( INPUT_POST, 'acting' ) === $this->paymod_id ) :
582 if ( '' !== $this->error_mes ) :
583 ?>
584 <div class="error_message"><?php echo wp_kses_post( $this->error_mes ); ?></div>
585 <?php
586 elseif ( isset( $acting_opts['activate'] ) && 'on' === $acting_opts['activate'] ) :
587 ?>
588 <div class="message"><?php esc_html_e( 'Test thoroughly before use.', 'usces' ); ?></div>
589 <?php
590 endif;
591 endif;
592 ?>
593 <form action="" method="post" name="remise_form" id="remise_form">
594 <table class="settle_table">
595 <!--<tr>
596 <th><a class="explanation-label" id="label_ex_plan_remise">契約プラン</a></th>
597 <td>
598 <select name="plan" id="plan_remise">
599 <option value="0"<?php selected( $plan, '0' ); ?>>-------------------------</option>
600 <option value="1"<?php selected( $plan, '1' ); ?>>スーパーバリュープラン</option>
601 <option value="2"<?php selected( $plan, '2' ); ?>>ライトプラン</option>
602 </select>
603 </td>
604 </tr>
605 <tr id="ex_plan_remise" class="explanation"><td colspan="2"><?php echo esc_html( $this->acting_name ); ?>と契約したサービスプランを選択してください。<br />契約を変更したい場合は<?php echo esc_html( $this->acting_name ); ?>へお問合せください。</td></tr>-->
606 <tr>
607 <th><a class="explanation-label" id="label_ex_SHOPCO_remise">加盟店コード</a></th>
608 <td><input name="SHOPCO" type="text" id="SHOPCO_remise" value="<?php echo esc_html( $shopco ); ?>" class="regular-text" maxlength="8" /></td>
609 </tr>
610 <tr id="ex_SHOPCO_remise" class="explanation"><td colspan="2">契約時に<?php echo esc_html( $this->acting_name ); ?>から発行される加盟店コード(半角英数)</td></tr>
611 <tr>
612 <th><a class="explanation-label" id="label_ex_HOSTID_remise">ホスト番号</a></th>
613 <td><input name="HOSTID" type="text" id="HOSTID_remise" value="<?php echo esc_html( $hostid ); ?>" class="regular-text" maxlength="8" /></td>
614 </tr>
615 <tr id="ex_HOSTID_remise" class="explanation"><td colspan="2">契約時に<?php echo esc_html( $this->acting_name ); ?>から割り当てられるホスト番号(半角数字)</td></tr>
616 </table>
617 <table class="settle_table">
618 <tr>
619 <th>クレジットカード決済</th>
620 <td><label><input name="card_activate" type="radio" id="card_activate_remise_1" value="on"<?php checked( $card_activate, 'on' ); ?> /><span>利用する</span></label><br />
621 <label><input name="card_activate" type="radio" id="card_activate_remise_2" value="off"<?php checked( $card_activate, 'off' ); ?> /><span>利用しない</span></label>
622 </td>
623 </tr>
624 <tr class="card_form_remise">
625 <th><a class="explanation-label" id="label_ex_card_jb_remise">ジョブコード</a></th>
626 <td><!--<label><input name="card_jb" type="radio" id="card_jb_remise_1" value="CHECK"<?php checked( $card_jb, 'CHECK' ); ?> /><span>有効性チェック</span></label><br />-->
627 <label><input name="card_jb" type="radio" id="card_jb_remise_2" value="AUTH"<?php checked( $card_jb, 'AUTH' ); ?> /><span>仮売上処理</span></label><br />
628 <label><input name="card_jb" type="radio" id="card_jb_remise_3" value="CAPTURE"<?php checked( $card_jb, 'CAPTURE' ); ?> /><span>売上処理</span></label>
629 </td>
630 </tr>
631 <tr id="ex_card_jb_remise" class="explanation card_form_remise"><td colspan="2">決済の種類を指定します。</td></tr>
632 <tr class="card_form_remise">
633 <th><a class="explanation-label" id="label_ex_payquick_remise">ペイクイック機能</a></th>
634 <td><label><input name="payquick" type="radio" id="payquick_remise_1" value="on"<?php checked( $payquick, 'on' ); ?> /><span>利用する</span></label><br />
635 <label><input name="payquick" type="radio" id="payquick_remise_2" value="off"<?php checked( $payquick, 'off' ); ?> /><span>利用しない</span></label>
636 </td>
637 </tr>
638 <tr id="ex_payquick_remise" class="explanation card_form_remise"><td colspan="2">Welcart の会員システムを利用している場合、会員に対して2回目以降の決済の際、クレジットカード番号、有効期限、名義人の�
639 �力が不要となります。<br />クレジットカード�
640 報はWelcart では保存せず、<?php echo esc_html( $this->acting_name ); ?>のデータベースにて安�
641 �に保管されます。</td></tr>
642 <tr class="card_form_remise">
643 <th><a class="explanation-label" id="label_ex_howpay_remise">お客様の支払方法</a></th>
644 <td><label><input name="howpay" type="radio" id="howpay_remise_1" value="on"<?php checked( $howpay, 'on' ); ?> /><span>分割払いに対応する</span></label><br />
645 <label><input name="howpay" type="radio" id="howpay_remise_2" value="off"<?php checked( $howpay, 'off' ); ?> /><span>一括払いのみ</span></label>
646 </td>
647 </tr>
648 <tr id="ex_howpay_remise" class="explanation card_form_remise"><td colspan="2">「一括払い」以外をご利用の場合は<?php echo esc_html( $this->acting_name ); ?>側の設定が�
649 要となります。前もって<?php echo esc_html( $this->acting_name ); ?>にお問合せください。<br >「スーパーバリュープラン」の場合は「一括払いのみ」を選択してください。</td></tr>
650 <?php if ( defined( 'WCEX_DLSELLER' ) ) : ?>
651 <tr class="card_form_remise">
652 <th><a class="explanation-label" id="label_ex_continuation_remise">自動継続課金</a></th>
653 <td><label><input name="continuation" type="radio" id="continuation_remise_1" value="on"<?php checked( $continuation, 'on' ); ?> /><span>利用する</span></label><br />
654 <label><input name="continuation" type="radio" id="continuation_remise_2" value="off"<?php checked( $continuation, 'off' ); ?> /><span>利用しない</span></label>
655 </td>
656 </tr>
657 <tr id="ex_continuation_remise" class="explanation card_form_remise"><td colspan="2">定期的に発生する月会費などの�
658 �わしい課金処理を完�
659 �に自動化することができる機能です。<br />詳しくは<?php echo esc_html( $this->acting_name ); ?>にお問合せください。</td></tr>
660 <?php endif; ?>
661 <tr class="card_form_remise">
662 <th><a class="explanation-label" id="label_ex_card_pc_ope_remise">稼働環境</a></th>
663 <td><label><input name="card_pc_ope" type="radio" id="card_pc_ope_remise_1" value="test"<?php checked( $card_pc_ope, 'test' ); ?> /><span>テスト環境</span></label><br />
664 <label><input name="card_pc_ope" type="radio" id="card_pc_ope_remise_2" value="public"<?php checked( $card_pc_ope, 'public' ); ?> /><span>本番環境</span></label>
665 </td>
666 </tr>
667 <tr id="ex_card_pc_ope_remise" class="explanation card_form_remise"><td colspan="2">動作環境を切り替えます。</td></tr>
668 <tr class="card_form_remise">
669 <th><a class="explanation-label" id="label_ex_send_url_pc_remise">本番URL(PC)</a></th>
670 <td><input name="send_url_pc" type="text" id="send_url_pc_remise" value="<?php echo esc_html( $send_url_pc ); ?>" class="regular-text" /></td>
671 </tr>
672 <tr id="ex_send_url_pc_remise" class="explanation card_form_remise"><td colspan="2">クレジットカード決済の本番環境(PC)で接続するURLを設定します。</td></tr>
673 <?php
674 if ( defined( 'WCEX_MOBILE' ) ) :
675 $send_url_mbl = ( isset( $acting_opts['send_url_mbl'] ) ) ? $acting_opts['send_url_mbl'] : '';
676 ?>
677 <tr class="card_form_remise">
678 <th><a class="explanation-label" id="label_ex_send_url_mbl_remise">本番URL(携帯)</a></th>
679 <td><input name="send_url_mbl" type="text" id="send_url_mbl_remise" value="<?php echo esc_html( $send_url_mbl ); ?>" class="regular-text" /></td>
680 </tr>
681 <tr id="ex_send_url_mbl_remise" class="explanation card_form_remise"><td colspan="2">クレジットカード決済の本番環境(携帯)で接続するURLを設定します。</td></tr>
682 <?php endif; ?>
683 </table>
684 <table class="settle_table">
685 <tr>
686 <th>マルチ決済</a></th>
687 <td><label><input name="conv_activate" type="radio" id="conv_activate_remise_1" value="on"<?php checked( $conv_activate, 'on' ); ?> /><span>利用する</span></label><br />
688 <label><input name="conv_activate" type="radio" id="conv_activate_remise_2" value="off"<?php checked( $conv_activate, 'off' ); ?> /><span>利用しない</span></label>
689 </td>
690 </tr>
691 <tr class="conv_form_remise">
692 <th><a class="explanation-label" id="label_ex_paydate_remise">支払期限</a></th>
693 <td><input name="S_PAYDATE" type="text" id="S_PAYDATE_remise" value="<?php echo esc_html( $s_paydate ); ?>" class="small-text" maxlength="3" /></td>
694 </tr>
695 <tr id="ex_paydate_remise" class="explanation conv_form_remise"><td colspan="2">日数を設定します。(半角数字)</td></tr>
696 <tr class="conv_form_remise">
697 <th><a class="explanation-label" id="label_ex_conv_pc_ope_remise">稼働環境</a></th>
698 <td><label><input name="conv_pc_ope" type="radio" id="conv_pc_ope_remise_1" value="test"<?php checked( $conv_pc_ope, 'test' ); ?> /><span>テスト環境</span></label><br />
699 <label><input name="conv_pc_ope" type="radio" id="conv_pc_ope_remise_2" value="public"<?php checked( $conv_pc_ope, 'public' ); ?> /><span>本番環境</span></label>
700 </td>
701 </tr>
702 <tr id="ex_conv_pc_ope_remise" class="explanation conv_form_remise"><td colspan="2">動作環境を切り替えます。</td></tr>
703 <tr class="conv_form_remise">
704 <th><a class="explanation-label" id="label_ex_send_url_cvs_pc_remise">本番URL(PC)</a></th>
705 <td><input name="send_url_cvs_pc" type="text" id="send_url_cvs_pc_remise" value="<?php echo esc_html( $send_url_cvs_pc ); ?>" class="regular-text" /></td>
706 </tr>
707 <tr id="ex_send_url_cvs_pc_remise" class="explanation conv_form_remise"><td colspan="2">マルチ決済の本番環境(PC)で接続するURLを設定します。</td></tr>
708 <?php
709 if ( defined( 'WCEX_MOBILE' ) ) :
710 $send_url_cvs_mbl = ( isset( $acting_opts['send_url_cvs_mbl'] ) ) ? $acting_opts['send_url_cvs_mbl'] : '';
711 ?>
712 <tr class="conv_form_remise">
713 <th><a class="explanation-label" id="label_ex_send_url_cvs_mbl_remise">本番URL(携帯)</a></th>
714 <td><input name="send_url_cvs_mbl" type="text" id="send_url_cvs_mbl_remise" value="<?php echo esc_html( $send_url_cvs_mbl ); ?>" class="regular-text" /></td>
715 </tr>
716 <tr id="ex_send_url_cvs_mbl_remise" class="explanation conv_form_remise"><td colspan="2">マルチ決済の本番環境(携帯)で接続するURLを設定します。</td></tr>
717 <?php endif; ?>
718 <tr class="conv_form_remise">
719 <th><a class="explanation-label" id="label_ex_show_x_pay_csv">マルチ決済支払�
720 �表示</a></th>
721 <td><label><input name="show_x_pay_csv" type="radio" id="show_x_pay_csv_remise_1" value="on"<?php checked( $show_x_pay_csv, 'on' ); ?> /><span>表示する</span></label><br />
722 <label><input name="show_x_pay_csv" type="radio" id="show_x_pay_csv_remise_2" value="off"<?php checked( $show_x_pay_csv, 'off' ); ?> /><span>表示しない</span></label>
723 </td>
724 </tr>
725 <tr id="ex_show_x_pay_csv" class="explanation conv_form_remise"><td colspan="2">マルチ決済で支払いを行った際に、メールおよびPDFに支払�
726 �を表示します。</td></tr>
727 </table>
728 <input name="acting" type="hidden" value="remise" />
729 <input name="usces_option_update" type="submit" class="button button-primary" value="<?php echo esc_attr( $this->acting_name ); ?>の設定を更新する" />
730 <?php wp_nonce_field( 'admin_settlement', 'wc_nonce' ); ?>
731 </form>
732 <div class="settle_exp">
733 <p><strong><?php esc_html_e( 'Remise Japanese Settlement', 'usces' ); ?></strong></p>
734 <a href="<?php echo esc_url( $this->acting_company_url ); ?>" target="_blank"><?php echo esc_html( $this->acting_name ); ?>の詳細はこちら </a>
735 <p> </p>
736 <p>この決済は「外部リンク型」の決済システムです。</p>
737 <p>「外部リンク型」とは、決済会社のページへは遷移してカード�
738 報を�
739 �力する決済システムです。</p>
740 <p>「自動継続課金」を利用するには「WCEX DL Seller」拡張プラグインのインストールが�
741 要です。</p>
742 </div>
743 </div><!--uscestabs_remise-->
744 <?php
745 endif;
746 }
747
748 /**
749 * 受注データから取得する決済�
750 報のキー
751 * usces_filter_settle_info_field_meta_keys
752 *
753 * @param array $keys Settlement information key.
754 * @return array
755 */
756 public function settlement_info_field_meta_keys( $keys ) {
757 $keys = array_merge( $keys, array( 'remise_x_pay_csv' ) );
758
759 return $keys;
760 }
761
762 /**
763 * 受注編集画面に表示する決済�
764 報のキー
765 * usces_filter_settle_info_field_keys
766 *
767 * @param array $keys Settlement information keys.
768 * @param array $fields Settlement information fields.
769 *
770 * @return array
771 */
772 public function settlement_info_field_keys( $keys, $fields ) {
773 if ( isset( $fields['remise_x_pay_csv'] ) && isset( self::$x_pay_csv_list[ $fields['remise_x_pay_csv'] ] ) ) {
774 $keys = array_merge( $keys, array( 'remise_x_pay_csv' ) );
775 }
776
777 return $keys;
778 }
779
780 /**
781 * 受注編集画面に表示する決済�
782 報の値整形
783 * usces_filter_settle_info_field_value
784 *
785 * @param string $value Value.
786 * @param string $key Key.
787 * @param string $acting Acting type.
788 *
789 * @return string
790 */
791 public function settlement_info_field_value( $value, $key, $acting ) {
792 if ( 'remise_x_pay_csv' === $key && isset( self::$x_pay_csv_list[ $value ] ) ) {
793 $value = $value . '' . self::$x_pay_csv_list[ $value ]['label'] . '';
794 }
795
796 return $value;
797 }
798
799 /**
800 * 受注データ登録
801 * Called by usces_reg_orderdata() and usces_new_orderdata().
802 * usces_action_reg_orderdata
803 *
804 * @param array $args Compact array( $cart, $entry, $order_id, $member_id, $payments, $charging_type, $results ).
805 */
806 public function register_orderdata( $args ) {
807 global $usces;
808 extract( $args );
809
810 $acting_flg = $payments['settlement'];
811 if ( ! in_array( $acting_flg, $this->pay_method ) ) {
812 return;
813 }
814
815 if ( ! $entry['order']['total_full_price'] ) {
816 return;
817 }
818
819 if ( isset( $_REQUEST['X-S_TORIHIKI_NO'] ) ) {
820 $usces->set_order_meta_value( 'settlement_id', wp_unslash( $_REQUEST['X-S_TORIHIKI_NO'] ), $order_id );
821 $usces->set_order_meta_value( 'wc_trans_id', wp_unslash( $_REQUEST['X-S_TORIHIKI_NO'] ), $order_id );
822 if ( isset( $_REQUEST['X-AC_MEMBERID'] ) ) {
823 $usces->set_order_meta_value( wp_unslash( $_REQUEST['X-AC_MEMBERID'] ), 'continuation', $order_id );
824 $usces->set_member_meta_value( 'continue_memberid_' . $order_id, wp_unslash( $_REQUEST['X-AC_MEMBERID'] ) );
825 }
826 if ( isset( $_REQUEST['X-PAY_CSV'] ) ) {
827 $usces->set_order_meta_value( 'remise_x_pay_csv', wp_unslash( $_REQUEST['X-PAY_CSV'] ), $order_id );
828 }
829 }
830 }
831
832 /**
833 * Add payment institution to Thank You Mail payment methods.
834 *
835 * @param string $msg_payment Payment method message.
836 * @param int $order_id Order number.
837 * @param array $payment Payment data.
838 * @param array $cart Cart data.
839 * @param array $entry Entry data.
840 * @param array $data Order data.
841 * @return string
842 */
843 public function order_mail_payment( $msg_payment, $order_id, $payment, $cart, $entry, $data ) {
844 global $usces;
845 if ( 'acting_remise_conv' !== $payment['settlement'] ) {
846 return $msg_payment;
847 }
848 $remise_x_pay_csv = $usces->get_order_meta_value( 'remise_x_pay_csv', $order_id );
849 if ( empty( $remise_x_pay_csv ) ) {
850 return $msg_payment;
851 }
852 $acting_opts = $this->get_acting_settings();
853 $show_x_pay_csv = ( isset( $acting_opts['show_x_pay_csv'] ) && 'on' === $acting_opts['show_x_pay_csv'] ) ? 'on' : 'off';
854 if ( 'off' === $show_x_pay_csv ) {
855 return $msg_payment;
856 }
857 if ( ! isset( self::$x_pay_csv_list[ $remise_x_pay_csv ] ) ) {
858 return $msg_payment;
859 }
860 $remise_x_pay_csv_text = '' . self::$x_pay_csv_list[ $remise_x_pay_csv ]['label'] . '';
861 if ( usces_is_html_mail() ) {
862 $msg_payment = '<tr><td colspan="2" style="padding: 0 0 25px 0;">' . $payment['name'] . $remise_x_pay_csv_text . usces_payment_detail( $entry ) . '</td></tr>';
863 } else {
864 $msg_payment = __( '** Payment method **', 'usces' ) . "\r\n";
865 $msg_payment .= usces_mail_line( 1, $entry['customer']['mailaddress1'] ); // ********************
866 $msg_payment .= $payment['name'] . $remise_x_pay_csv_text . usces_payment_detail( $entry ) . "\r\n\r\n";
867 }
868 return $msg_payment;
869 }
870
871 /**
872 * クレジットカード登録・変更ページ表示
873 * usces_filter_template_redirect
874 */
875 public function member_update_settlement() {
876 global $usces;
877
878 if ( $usces->is_member_page( $_SERVER['REQUEST_URI'] ) ) {
879 if ( ! usces_is_membersystem_state() || ! usces_is_login() ) {
880 return;
881 }
882
883 $acting_opts = $this->get_acting_settings();
884 if ( 'on' !== $acting_opts['payquick'] ) {
885 return;
886 }
887
888 if ( isset( $_REQUEST['usces_page'] ) && 'member_update_settlement' === wp_unslash( $_REQUEST['usces_page'] ) ) {
889 add_filter( 'usces_filter_states_form_js', array( $this, 'states_form_js' ) );
890 $usces->page = 'member_update_settlement';
891 $this->member_update_settlement_form();
892 exit();
893 }
894 }
895 return false;
896 }
897
898 /**
899 * クレジットカード登録・変更ページ表示
900 * usces_filter_states_form_js
901 *
902 * @param string $js Scripts.
903 * @return string
904 */
905 public function states_form_js( $js ) {
906 return '';
907 }
908
909 /**
910 * クレジットカード登録・変更ページリンク
911 * usces_action_member_submenu_list
912 */
913 public function e_update_settlement() {
914 global $usces;
915
916 $member = $usces->get_member();
917 $html = $this->update_settlement( '', $member );
918 echo $html; // no escape.
919 }
920
921 /**
922 * クレジットカード登録・変更ページリンク
923 * usces_filter_member_submenu_list
924 *
925 * @param string $html Submenu area of the member page.
926 * @param array $member Member information.
927 * @return string
928 */
929 public function update_settlement( $html, $member ) {
930 global $usces;
931
932 $acting_opts = $this->get_acting_settings();
933 if ( 'on' === $acting_opts['payquick'] ) {
934 $member = $usces->get_member();
935 $pcid = $usces->get_member_meta_value( 'remise_pcid', $member['ID'] );
936 if ( ! empty( $pcid ) ) {
937 $update_settlement_url = add_query_arg(
938 array(
939 'usces_page' => 'member_update_settlement',
940 're-enter' => 1,
941 ),
942 USCES_MEMBER_URL
943 );
944 $html .= '<li class="settlement-update gotoedit"><a href="' . $update_settlement_url . '">' . __( 'Change the credit card is here >>', 'usces' ) . '</a></li>';
945 }
946 }
947 return $html;
948 }
949
950 /**
951 * クレジットカード登録・変更ページ
952 */
953 public function member_update_settlement_form() {
954 global $usces;
955
956 $member = $usces->get_member();
957 $member_id = $member['ID'];
958 $update_settlement_url = add_query_arg(
959 array(
960 'usces_page' => 'member_update_settlement',
961 'settlement' => 1,
962 're-enter' => 1,
963 ),
964 USCES_MEMBER_URL
965 );
966 $acting_opts = $this->get_acting_settings();
967 $send_url = ( 'public' === $acting_opts['card_pc_ope'] ) ? $acting_opts['send_url_pc'] : $acting_opts['send_url_pc_test'];
968 $rand = '0000000' . $member_id;
969 $partofcard = $usces->get_member_meta_value( 'partofcard', $member_id );
970 $limitofcard = $usces->get_member_meta_value( 'limitofcard', $member_id );
971 $error_message = apply_filters( 'usces_filter_member_update_settlement_error_message', $usces->error_message );
972
973 ob_start();
974 get_header();
975 ?>
976 <div id="content" class="two-column">
977 <div class="catbox">
978 <?php
979 if ( have_posts() ) :
980 usces_remove_filter();
981 ?>
982 <div class="post" id="wc_<?php usces_page_name(); ?>">
983 <h1 class="member_page_title"><?php esc_html_e( 'Credit card update', 'usces' ); ?></h1>
984 <div class="entry">
985 <div id="memberpages">
986 <div class="whitebox">
987 <div id="memberinfo">
988 <div class="header_explanation">
989 <?php do_action( 'usces_action_member_update_settlement_page_header' ); ?>
990 </div>
991 <div class="error_message"><?php wel_esc_script_e( $error_message ); ?></div>
992 <div><?php echo __( 'Since the transition to the page of the settlement company by clicking the "Update", please fill out the information for the new card.<br />In addition, this process is intended to update the card information such as credit card expiration date, it is not in your contract renewal of service.<br />To check the current contract, please refer to the member page.', 'usces' ); ?><br /><br /></div>
993 <?php
994 if ( ! empty( $partofcard ) && ! empty( $limitofcard ) ) :
995 ?>
996 <table>
997 <tbody>
998 <tr>
999 <th scope="row"><?php esc_html_e( 'The last four digits of your card number', 'usces' ); ?></th><td><?php echo esc_html( $partofcard ); ?></div></td>
1000 <th scope="row"><?php esc_html_e( 'Expiration date', 'usces' ); ?></th><td><?php echo esc_html( $limitofcard ); ?></td>
1001 </tr>
1002 </tbody>
1003 </table>
1004 <?php
1005 endif;
1006 ?>
1007 <form id="member-card-info" action="<?php echo esc_url( $send_url ); ?>" method="post" onKeyDown="if(event.keyCode == 13){return false;}" accept-charset="Shift_JIS">
1008 <input type="hidden" name="SHOPCO" value="<?php echo esc_attr( $acting_opts['SHOPCO'] ); ?>" />
1009 <input type="hidden" name="HOSTID" value="<?php echo esc_attr( $acting_opts['HOSTID'] ); ?>" />
1010 <input type="hidden" name="REMARKS3" value="<?php echo esc_attr( $acting_opts['REMARKS3'] ); ?>" />
1011 <input type="hidden" name="S_TORIHIKI_NO" value="<?php echo esc_attr( $rand ); ?>" />
1012 <input type="hidden" name="JOB" value="CHECK" />
1013 <input type="hidden" name="MAIL" value="<?php echo esc_attr( $member['mailaddress1'] ); ?>" />
1014 <input type="hidden" name="ITEM" value="0000990" />
1015 <input type="hidden" name="RETURL" value="<?php echo esc_attr( $update_settlement_url ); ?>" />
1016 <input type="hidden" name="NG_RETURL" value="<?php echo esc_attr( $update_settlement_url ); ?>" />
1017 <input type="hidden" name="EXITURL" value="<?php echo esc_attr( $update_settlement_url ); ?>" />
1018 <input type="hidden" name="OPT" value="welcart_card_update" />
1019 <input type="hidden" name="PAYQUICK" value="1" />
1020 <input type="hidden" name="dummy" value="&#65533;" />
1021 <div class="send">
1022 <input type="submit" name="purchase" class="checkout_button" value="<?php esc_attr_e( 'Update processing', 'usces' ); ?>" onclick="document.charset='Shift_JIS';" />
1023 <input type="button" name="back" value="<?php esc_attr_e( 'Back to the member page.', 'usces' ); ?>" onclick="location.href='<?php echo esc_url( USCES_MEMBER_URL ); ?>'" />
1024 <input type="button" name="top" value="<?php esc_attr_e( 'Back to the top page.', 'usces' ); ?>" onclick="location.href='<?php echo esc_url( home_url() ); ?>'" />
1025 </div>
1026 </form>
1027 <div class="footer_explanation">
1028 <?php do_action( 'usces_action_member_update_settlement_page_footer' ); ?>
1029 </div>
1030 </div><!-- end of memberinfo -->
1031 </div><!-- end of whitebox -->
1032 </div><!-- end of memberpages -->
1033 </div><!-- end of entry -->
1034 </div><!-- end of post -->
1035 <?php else : ?>
1036 <p><?php esc_html_e( 'Sorry, no posts matched your criteria.', 'usces' ); ?></p>
1037 <?php endif; ?>
1038 </div><!-- end of catbox -->
1039 </div><!-- end of content -->
1040 <?php
1041 $sidebar = apply_filters( 'usces_filter_member_update_settlement_page_sidebar', 'cartmember' );
1042 if ( ! empty( $sidebar ) ) {
1043 get_sidebar( $sidebar );
1044 }
1045 get_footer();
1046 $html = ob_get_contents();
1047 ob_end_clean();
1048 echo $html; // no escape.
1049 }
1050
1051 /**
1052 * 会員データ編集画面
1053 * usces_action_admin_member_info
1054 *
1055 * @param array $member_data Member data.
1056 * @param array $member_meta_data Member meta data.
1057 * @param array $member_history Member history data.
1058 */
1059 public function member_settlement_info( $member_data, $member_meta_data, $member_history ) {
1060 if ( 0 < count( $member_meta_data ) ) :
1061 $cardinfo = array();
1062 foreach ( $member_meta_data as $value ) {
1063 if ( in_array( $value['meta_key'], array( 'remise_pcid', 'partofcard', 'limitofcard', 'remise_memid' ), true ) ) {
1064 $cardinfo[ $value['meta_key'] ] = $value['meta_value'];
1065 }
1066 }
1067 if ( 0 < count( $cardinfo ) ) :
1068 if ( array_key_exists( 'remise_pcid', $cardinfo ) ) :
1069 foreach ( $cardinfo as $key => $value ) :
1070 if ( 'remise_pcid' !== $key ) :
1071 if ( 'partofcard' === $key ) {
1072 $label = '下4桁';
1073 } elseif ( 'limitofcard' === $key ) {
1074 $label = '有効期限';
1075 } elseif ( 'remise_memid' === $key ) {
1076 $label = 'メンバーID';
1077 } else {
1078 $label = $key;
1079 }
1080 ?>
1081 <tr>
1082 <td class="label"><?php echo esc_html( $label ); ?></td>
1083 <td><div class="rod_left shortm"><?php echo esc_html( $value ); ?></div></td>
1084 </tr>
1085 <?php
1086 endif;
1087 endforeach;
1088 ?>
1089 <tr>
1090 <td class="label">ペイクイック</td>
1091 <td><div class="rod_left shortm">登録あり</div></td>
1092 </tr>
1093 <tr>
1094 <td class="label"><input type="checkbox" name="remise_pcid" id="remise_pcid" value="delete"></td>
1095 <td><label for="remise_pcid">ペイクイックを解除する</label></td>
1096 </tr>
1097 <?php
1098 endif;
1099 endif;
1100 endif;
1101 }
1102
1103 /**
1104 * 会員データ編集画面 カード�
1105 報登録解除
1106 * usces_action_post_update_memberdata
1107 *
1108 * @param int $member_id Member ID.
1109 * @param boolean $res Result.
1110 */
1111 public function member_edit_post( $member_id, $res ) {
1112 global $usces;
1113
1114 if ( ! $this->is_activate_card() || false === $res ) {
1115 return;
1116 }
1117
1118 if ( 'delete' === filter_input( INPUT_POST, 'remise_pcid' ) ) {
1119 $usces->del_member_meta( 'remise_pcid', $member_id );
1120 }
1121 }
1122
1123 /**
1124 * 支払方法説明
1125 * usces_filter_payment_detail
1126 *
1127 * @param string $str Payment method description.
1128 * @param array $entry Entry data.
1129 * @return string
1130 */
1131 public function payment_detail( $str, $entry ) {
1132 $payment = usces_get_payments_by_name( $entry['order']['payment_name'] );
1133 if ( isset( $payment['settlement'] ) && 'acting_remise_conv' === $payment['settlement'] ) {
1134 $acting_opts = $this->get_acting_settings();
1135 $payment_detail = __( '(', 'usces' ) . sprintf( __( 'Payment is valid for %s days from the date of order.', 'usces' ), $acting_opts['S_PAYDATE'] ) . __( ')', 'usces' );
1136 $str = apply_filters( 'usces_filter_remise_payment_limit_conv', $payment_detail, $acting_opts['S_PAYDATE'] );
1137 }
1138 return $str;
1139 }
1140
1141 /**
1142 * 購�
1143 �完了メッセージ
1144 * usces_filter_completion_settlement_message
1145 *
1146 * @param string $html Completion message.
1147 * @param array $entry Entry data.
1148 * @return string
1149 */
1150 public function completion_settlement_message( $html, $entry ) {
1151 global $usces;
1152
1153 if ( isset( $_REQUEST['acting'] ) && 'remise_conv' === wp_unslash( $_REQUEST['acting'] ) ) {
1154 $x_pay_csv = wp_unslash( $_REQUEST['X-PAY_CSV'] );
1155 $conv_name = usces_get_conv_name( $x_pay_csv );
1156 if ( empty( $conv_name ) ) {
1157 $conv_name = isset( self::$x_pay_csv_list[ $x_pay_csv ]['label'] ) ? self::$x_pay_csv_list[ $x_pay_csv ]['label'] : '';
1158 }
1159
1160 $html .= '<div id="status_table"><h5>ルミーズ・マルチ決済</h5>';
1161 $html .= '<table>';
1162 $html .= '<tr><th>ご請求番号</th><td>' . esc_html( wp_unslash( $_REQUEST['X-S_TORIHIKI_NO'] ) ) . '</td></tr>';
1163 $html .= '<tr><th>ご請求合計金額</th><td>' . esc_html( wp_unslash( $_REQUEST['X-TOTAL'] ) ) . '</td></tr>';
1164 $paydate = wp_unslash( $_REQUEST['X-PAYDATE'] );
1165 $html .= '<tr><th>お支払期限</th><td>' . esc_html( substr( $paydate, 0, 4 ) . '' . substr( $paydate, 4, 2 ) . '' . substr( $paydate, 6, 2 ) . '' ) . '(期限を過ぎますとお支払ができません)</td></tr>';
1166 $html .= '<tr><th>お支払�
1167 �</th><td>' . esc_html( $conv_name ) . '</td></tr>';
1168 $html .= $this->get_remise_conv_return( $x_pay_csv );
1169 $html .= '</table>';
1170 $html .= '<p>「お支払いのご案�
1171 」は、' . esc_html( $entry['customer']['mailaddress1'] ) . ' 宛にメールさせていただいております。</p>';
1172 $html .= '</div>';
1173 }
1174 return $html;
1175 }
1176
1177 /**
1178 * 管理画面送信メール
1179 * usces_filter_order_confirm_mail_payment
1180 *
1181 * @param string $msg_payment Default payment message.
1182 * @param int $order_id Order number.
1183 * @param array $payment Payment information.
1184 * @param array $cart Cart data.
1185 * @param array $data Order data.
1186 * @return string
1187 */
1188 public function order_confirm_mail_payment( $msg_payment, $order_id, $payment, $cart, $data ) {
1189 if ( 'acting_remise_conv' !== $payment['settlement'] ) {
1190 return $msg_payment;
1191 }
1192
1193 global $usces;
1194 $remise_x_pay_csv = $usces->get_order_meta_value( 'remise_x_pay_csv', $order_id );
1195 if ( empty( $remise_x_pay_csv ) ) {
1196 return $msg_payment;
1197 }
1198 $acting_opts = $this->get_acting_settings();
1199 $show_x_pay_csv = ( isset( $acting_opts['show_x_pay_csv'] ) && 'on' === $acting_opts['show_x_pay_csv'] ) ? 'on' : 'off';
1200 if ( 'off' === $show_x_pay_csv ) {
1201 return $msg_payment;
1202 }
1203 if ( ! isset( self::$x_pay_csv_list[ $remise_x_pay_csv ] ) ) {
1204 return $msg_payment;
1205 }
1206 $remise_x_pay_csv_text = '' . self::$x_pay_csv_list[ $remise_x_pay_csv ]['label'] . '';
1207
1208 if ( usces_is_html_mail() ) {
1209 $msg_payment = '<tr><td colspan="2" style="padding: 0 0 25px 0;">' . $payment['name'] . $remise_x_pay_csv_text . usces_payment_detail_confirm( $data ) . '</td></tr>';
1210 } else {
1211 $msg_payment = __( '** Payment method **', 'usces' ) . "\r\n";
1212 $msg_payment .= usces_mail_line( 1, $data['order_email'] ); // ********************
1213 $msg_payment .= $payment['name'] . $remise_x_pay_csv_text;
1214 $msg_payment .= "\r\n\r\n";
1215 }
1216
1217 return $msg_payment;
1218 }
1219
1220 /**
1221 * Add payment institution to PDF payment method.
1222 *
1223 * @param string $payment_name Payment Name..
1224 * @param mixed $data Order data.
1225 *
1226 * @return mixed|string
1227 */
1228 public function pdf_payment_name( $payment_name, $data ) {
1229 global $usces;
1230
1231 $acting_opts = $this->get_acting_settings();
1232 $show_x_pay_csv = ( isset( $acting_opts['show_x_pay_csv'] ) && 'on' === $acting_opts['show_x_pay_csv'] ) ? 'on' : 'off';
1233 if ( 'off' === $show_x_pay_csv ) {
1234 return $payment_name;
1235 }
1236
1237 $remise_x_pay_csv = $usces->get_order_meta_value( 'remise_x_pay_csv', $data->order['ID'] );
1238 if ( empty( $remise_x_pay_csv ) ) {
1239 return $payment_name;
1240 }
1241
1242 if ( ! isset( self::$x_pay_csv_list[ $remise_x_pay_csv ] ) ) {
1243 return $payment_name;
1244 }
1245 $remise_x_pay_csv_text = '' . self::$x_pay_csv_list[ $remise_x_pay_csv ]['label'] . '';
1246
1247 return $payment_name . $remise_x_pay_csv_text;
1248 }
1249
1250 /**
1251 * コンビニステータス
1252 *
1253 * @param string $code CVS code.
1254 * @return string
1255 */
1256 protected function get_remise_conv_return( $code ) {
1257 switch ( $code ) {
1258 case 'D001': /* セブンイレブン */
1259 $html = '<tr><th>払込番号</th><td>' . esc_html( wp_unslash( $_REQUEST['X-PAY_NO1'] ) ) . '</td></tr>';
1260 $html .= '<tr><th>払込票のURL</th><td><a href="' . esc_html( wp_unslash( $_REQUEST['X-PAY_NO2'] ) ) . '" target="_blank">' . esc_html( wp_unslash( $_REQUEST['X-PAY_NO2'] ) ) . '</a></td></tr>';
1261 break;
1262 case 'D002': /* ローソン */
1263 case 'D015': /* セイコーマート */
1264 case 'D405': /* ペイジー */
1265 $html = '<tr><th>受付番号</th><td>' . esc_html( wp_unslash( $_REQUEST['X-PAY_NO1'] ) ) . '</td></tr>';
1266 $html .= '<tr><th>支払方法案�
1267 URL</th><td><a href="' . esc_html( wp_unslash( $_REQUEST['X-PAY_NO2'] ) ) . '" target="_blank">' . esc_html( wp_unslash( $_REQUEST['X-PAY_NO2'] ) ) . '</a></td></tr>';
1268 break;
1269 case 'D003': /* サンクス */
1270 case 'D004': /* サークルK */
1271 case 'D005': /* ミニストップ */
1272 case 'D010': /* デイリーヤマザキ */
1273 case 'D011': /* ヤマザキデイリーストア */
1274 $html = '<tr><th>決済番号</th><td>' . esc_html( wp_unslash( $_REQUEST['X-PAY_NO1'] ) ) . '</td></tr>';
1275 $html .= '<tr><th>支払方法案�
1276 URL</th><td><a href="' . esc_html( wp_unslash( $_REQUEST['X-PAY_NO2'] ) ) . '" target="_blank">' . esc_html( wp_unslash( $_REQUEST['X-PAY_NO2'] ) ) . '</a></td></tr>';
1277 break;
1278 case 'D030': /* ファミリーマート */
1279 $html = '<tr><th>コード</th><td>' . esc_html( wp_unslash( $_REQUEST['X-PAY_NO1'] ) ) . '</td></tr>';
1280 $html .= '<tr><th>注文番号</th><td>' . esc_html( wp_unslash( $_REQUEST['X-PAY_NO2'] ) ) . '</td></tr>';
1281 break;
1282 case 'D401': /* CyberEdy */
1283 case 'D404': /* 楽天銀行 */
1284 case 'D406': /* ジャパネット銀行 */
1285 case 'D407': /* Suicaインターネットサービス */
1286 case 'D451': /* ウェブマネー */
1287 case 'D452': /* ビットキャッシュ */
1288 case 'D453': /* JCBプレモカード */
1289 $html = '<tr><th>受付番号</th><td>' . esc_html( wp_unslash( $_REQUEST['X-PAY_NO1'] ) ) . '</td></tr>';
1290 $html .= '<tr><th>支払手続URL</th><td><a href="' . esc_html( wp_unslash( $_REQUEST['X-PAY_NO2'] ) ) . '" target="_blank">' . esc_html( wp_unslash( $_REQUEST['X-PAY_NO2'] ) ) . '</a></td></tr>';
1291 break;
1292 case 'P901': /* コンビニ払込票 */
1293 case 'P902': /* コンビニ払込票(郵便振替対応) */
1294 $html = '<tr><th>受付番号</th><td>' . esc_html( wp_unslash( $_REQUEST['X-PAY_NO1'] ) ) . '</td></tr>';
1295 break;
1296 case 'E201':
1297 case 'E202':
1298 case 'M601':
1299 case 'M602':
1300 case 'M603':
1301 case 'M611':
1302 case 'M612':
1303 case 'M613':
1304 case 'M621':
1305 case 'M622':
1306 case 'M623':
1307 $html = '<tr><th>支払手続きURL</th><td><a href="' . esc_html( wp_unslash( $_REQUEST['X-PAY_NO2'] ) ) . '" target="_blank">' . esc_html( wp_unslash( $_REQUEST['X-PAY_NO2'] ) ) . '</a></td></tr>';
1308 break;
1309 default:
1310 $html = '';
1311 }
1312 return $html;
1313 }
1314
1315 /**
1316 * 決済オプション取得
1317 *
1318 * @return array
1319 */
1320 protected function get_acting_settings() {
1321 global $usces;
1322
1323 $acting_settings = ( isset( $usces->options['acting_settings'][ $this->paymod_id ] ) ) ? $usces->options['acting_settings'][ $this->paymod_id ] : array();
1324 return $acting_settings;
1325 }
1326
1327 /**
1328 * 契約中の自動継続課金�
1329
1330 *
1331 * @param int $member_id Member ID.
1332 * @return int
1333 */
1334 protected function have_member_continue_order( $member_id ) {
1335 global $wpdb;
1336
1337 $continue = 0;
1338 $continuation_table = $wpdb->prefix . 'usces_continuation';
1339 $query = $wpdb->prepare( "SELECT * FROM {$continuation_table} WHERE `con_member_id` = %d AND `con_status` = 'continuation' ORDER BY `con_price` DESC", $member_id );
1340 $continue_order = $wpdb->get_results( $query, ARRAY_A );
1341 if ( $continue_order && 0 < count( $continue_order ) ) {
1342 $continue = $continue_order[0]['con_order_id'];
1343 }
1344 return $continue;
1345 }
1346 }
1347