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

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

1,104 lines 43.9 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 * Epsilon
5 *
6 * @package Welcart
7 * @author Welcart Inc.
8 */
9
10 /**
11 * Epsilon
12 */
13 class EPSILON_SETTLEMENT {
14
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 string
61 */
62 protected $error_mes;
63
64 /**
65 * Construct.
66 */
67 public function __construct() {
68 $this->paymod_id = 'epsilon';
69 $this->pay_method = array(
70 'acting_epsilon_card',
71 'acting_epsilon_conv',
72 'acting_epsilon_paypay',
73 );
74 $this->acting_name = 'イプシロン';
75 $this->acting_formal_name = 'イプシロン';
76 $this->acting_company_url = 'https://www.epsilon.jp/';
77
78 $this->initialize_data();
79
80 if ( is_admin() ) {
81 add_action( 'admin_print_footer_scripts', array( $this, 'admin_scripts' ) );
82 add_action( 'usces_action_admin_settlement_update', array( $this, 'settlement_update' ) );
83 add_action( 'usces_action_settlement_tab_title', array( $this, 'settlement_tab_title' ) );
84 add_action( 'usces_action_settlement_tab_body', array( $this, 'settlement_tab_body' ) );
85 }
86
87 if ( $this->is_validity_acting() ) {
88 add_action( 'usces_after_cart_instant', array( $this, 'acting_transaction' ) );
89 add_filter( 'usces_filter_is_complete_settlement', array( $this, 'is_complete_settlement' ), 10, 3 );
90
91 if ( $this->is_activate_card() || $this->is_activate_conv() || $this->is_activate_paypay() ) {
92 add_action( 'usces_action_reg_orderdata', array( $this, 'register_order_data' ) );
93 if ( is_admin() ) {
94 add_filter( 'usces_filter_settle_info_field_keys', array( $this, 'settlement_info_field_keys' ), 10, 2 );
95 add_filter( 'usces_filter_settle_info_field_value', array( $this, 'settlement_info_field_value' ), 10, 3 );
96 add_action( 'usces_action_revival_order_data', array( $this, 'revival_order_data' ), 10, 3 );
97 } else {
98 add_filter( 'usces_filter_confirm_inform', array( $this, 'confirm_inform' ), 10, 5 );
99 add_action( 'usces_action_acting_processing', array( $this, 'acting_processing' ), 10, 2 );
100 add_filter( 'usces_filter_completion_settlement_message', array( $this, 'completion_settlement_message' ), 10, 2 );
101 }
102 }
103
104 if ( $this->is_validity_acting( 'card' ) ) {
105 if ( is_admin() ) {
106 add_action( 'usces_action_admin_member_info', array( $this, 'admin_member_info' ), 10, 3 );
107 add_action( 'usces_action_post_update_memberdata', array( $this, 'admin_update_memberdata' ), 10, 2 );
108 }
109 }
110
111 if ( $this->is_validity_acting( 'conv' ) ) {
112 add_filter( 'usces_filter_payment_detail', array( $this, 'payment_detail' ), 10, 2 );
113 add_filter( 'usces_filter_noreceipt_status', array( $this, 'noreceipt_status' ) );
114 }
115 }
116 }
117
118 /**
119 * Return an instance of this class.
120 */
121 public static function get_instance() {
122 if ( is_null( self::$instance ) ) {
123 self::$instance = new self();
124 }
125 return self::$instance;
126 }
127
128 /**
129 * Initialize.
130 */
131 public function initialize_data() {
132 $options = get_option( 'usces', array() );
133 $options['acting_settings']['epsilon']['contract_code'] = ( isset( $options['acting_settings']['epsilon']['contract_code'] ) ) ? $options['acting_settings']['epsilon']['contract_code'] : '';
134 $options['acting_settings']['epsilon']['ope'] = ( isset( $options['acting_settings']['epsilon']['ope'] ) ) ? $options['acting_settings']['epsilon']['ope'] : '';
135 $options['acting_settings']['epsilon']['card_activate'] = ( isset( $options['acting_settings']['epsilon']['card_activate'] ) ) ? $options['acting_settings']['epsilon']['card_activate'] : '';
136 $options['acting_settings']['epsilon']['multi_currency'] = ( isset( $options['acting_settings']['epsilon']['multi_currency'] ) ) ? $options['acting_settings']['epsilon']['multi_currency'] : '';
137 $options['acting_settings']['epsilon']['3dsecure'] = ( isset( $options['acting_settings']['epsilon']['3dsecure'] ) ) ? $options['acting_settings']['epsilon']['3dsecure'] : '';
138 $options['acting_settings']['epsilon']['process_code'] = ( isset( $options['acting_settings']['epsilon']['process_code'] ) ) ? $options['acting_settings']['epsilon']['process_code'] : '';
139 $options['acting_settings']['epsilon']['conv_activate'] = ( isset( $options['acting_settings']['epsilon']['conv_activate'] ) ) ? $options['acting_settings']['epsilon']['conv_activate'] : '';
140 $options['acting_settings']['epsilon']['conv_limit'] = ( isset( $options['acting_settings']['epsilon']['conv_limit'] ) ) ? $options['acting_settings']['epsilon']['conv_limit'] : '';
141 $options['acting_settings']['epsilon']['paypay_activate'] = ( isset( $options['acting_settings']['epsilon']['paypay_activate'] ) ) ? $options['acting_settings']['epsilon']['paypay_activate'] : '';
142 update_option( 'usces', $options );
143
144 $available_settlement = get_option( 'usces_available_settlement', array() );
145 if ( ! in_array( 'epsilon', $available_settlement, true ) ) {
146 $available_settlement['epsilon'] = $this->acting_name;
147 update_option( 'usces_available_settlement', $available_settlement );
148 }
149 }
150
151 /**
152 * 決済有効判定
153 * 支払方法で使用している場合に true
154 *
155 * @param string $type Module type.
156 * @return boolean
157 */
158 public function is_validity_acting( $type = '' ) {
159 $acting_opts = $this->get_acting_settings();
160 if ( empty( $acting_opts ) ) {
161 return false;
162 }
163
164 $payment_method = usces_get_system_option( 'usces_payment_method', 'sort' );
165 $method = false;
166
167 switch ( $type ) {
168 case 'card':
169 foreach ( $payment_method as $payment ) {
170 if ( 'acting_epsilon_card' === $payment['settlement'] && 'activate' === $payment['use'] ) {
171 $method = true;
172 break;
173 }
174 }
175 if ( $method && $this->is_activate_card() ) {
176 return true;
177 } else {
178 return false;
179 }
180 break;
181
182 case 'conv':
183 foreach ( $payment_method as $payment ) {
184 if ( 'acting_epsilon_conv' === $payment['settlement'] && 'activate' === $payment['use'] ) {
185 $method = true;
186 break;
187 }
188 }
189 if ( $method && $this->is_activate_conv() ) {
190 return true;
191 } else {
192 return false;
193 }
194 break;
195
196 case 'paypay':
197 foreach ( $payment_method as $payment ) {
198 if ( 'acting_epsilon_paypay' === $payment['settlement'] && 'activate' === $payment['use'] ) {
199 $method = true;
200 break;
201 }
202 }
203 if ( $method && $this->is_activate_paypay() ) {
204 return true;
205 } else {
206 return false;
207 }
208 break;
209
210 default:
211 if ( isset( $acting_opts['activate'] ) && 'on' === $acting_opts['activate'] ) {
212 return true;
213 } else {
214 return false;
215 }
216 }
217 }
218
219 /**
220 * クレジットカード決済有効判定
221 *
222 * @return boolean
223 */
224 public function is_activate_card() {
225 $acting_opts = $this->get_acting_settings();
226 if ( ( isset( $acting_opts['activate'] ) && 'on' === $acting_opts['activate'] ) &&
227 ( isset( $acting_opts['card_activate'] ) && ( 'on' === $acting_opts['card_activate'] ) ) ) {
228 $res = true;
229 } else {
230 $res = false;
231 }
232 return $res;
233 }
234
235 /**
236 * コンビニ決済有効判定
237 *
238 * @return boolean
239 */
240 public function is_activate_conv() {
241 $acting_opts = $this->get_acting_settings();
242 if ( ( isset( $acting_opts['activate'] ) && 'on' === $acting_opts['activate'] ) &&
243 ( isset( $acting_opts['conv_activate'] ) && 'on' === $acting_opts['conv_activate'] ) ) {
244 $res = true;
245 } else {
246 $res = false;
247 }
248 return $res;
249 }
250
251 /**
252 * PayPay決済有効判定
253 *
254 * @return boolean
255 */
256 public function is_activate_paypay() {
257 $acting_opts = $this->get_acting_settings();
258 if ( ( isset( $acting_opts['activate'] ) && 'on' === $acting_opts['activate'] ) &&
259 ( isset( $acting_opts['paypay_activate'] ) && 'on' === $acting_opts['paypay_activate'] ) ) {
260 $res = true;
261 } else {
262 $res = false;
263 }
264 return $res;
265 }
266
267 /**
268 * 未�
269 �金ステータス
270 * usces_filter_noreceipt_status
271 *
272 * @param array $noreceipt_status Receive payment notification.
273 * @return array
274 */
275 public function noreceipt_status( $noreceipt_status ) {
276 if ( ! in_array( 'acting_epsilon_conv', $noreceipt_status, true ) ) {
277 $noreceipt_status[] = 'acting_epsilon_conv';
278 update_option( 'usces_noreceipt_status', $noreceipt_status );
279 }
280 return $noreceipt_status;
281 }
282
283 /**
284 * 管理画面スクリプト
285 * admin_print_footer_scripts
286 */
287 public function admin_scripts() {
288 $admin_page = filter_input( INPUT_GET, 'page', FILTER_DEFAULT );
289 switch ( $admin_page ) :
290 /* クレジット決済設定画面 */
291 case 'usces_settlement':
292 $settlement_selected = get_option( 'usces_settlement_selected', array() );
293 if ( in_array( 'epsilon', $settlement_selected, true ) ) :
294 ?>
295 <script type="text/javascript">
296 jQuery(document).ready( function($) {
297 const form_epsilon = $('form#epsilon_form');
298 function card_activate_epsilon() {
299 if( 'on' === form_epsilon.find("input[name='card_activate']:checked").val() ) {
300 $('.card_form_epsilon').css('display','');
301 } else {
302 $('.card_form_epsilon').css('display','none');
303 }
304 }
305 function conv_activate_epsilon() {
306 if( 'on' === form_epsilon.find("input[name='conv_activate']:checked").val() ) {
307 $(".conv_form_epsilon").css("display","");
308 } else {
309 $(".conv_form_epsilon").css("display","none");
310 }
311 }
312 card_activate_epsilon();
313 $("input[id^='card_activate_epsilon_']").click( function() {
314 card_activate_epsilon();
315 });
316 conv_activate_epsilon();
317 $("input[id^='conv_activate_epsilon_']").click( function() {
318 conv_activate_epsilon();
319 });
320 });
321 </script>
322 <?php
323 endif;
324 break;
325 endswitch;
326 }
327
328 /**
329 * 決済オプション登録・更新
330 * usces_action_admin_settlement_update
331 */
332 public function settlement_update() {
333 global $usces;
334
335 if ( 'epsilon' !== filter_input( INPUT_POST, 'acting', FILTER_DEFAULT ) ) {
336 return;
337 }
338
339 $this->error_mes = '';
340 $options = get_option( 'usces', array() );
341 $payment_method = usces_get_system_option( 'usces_payment_method', 'settlement' );
342 $post_data = wp_unslash( $_POST );
343
344 unset( $options['acting_settings']['epsilon'] );
345 $options['acting_settings']['epsilon']['contract_code'] = ( isset( $post_data['contract_code'] ) ) ? trim( $post_data['contract_code'] ) : '';
346 $options['acting_settings']['epsilon']['ope'] = ( isset( $post_data['ope'] ) ) ? $post_data['ope'] : '';
347 $options['acting_settings']['epsilon']['card_activate'] = ( isset( $post_data['card_activate'] ) ) ? $post_data['card_activate'] : '';
348 $options['acting_settings']['epsilon']['multi_currency'] = ( isset( $post_data['multi_currency'] ) ) ? $post_data['multi_currency'] : '';
349 $options['acting_settings']['epsilon']['3dsecure'] = ( isset( $post_data['3dsecure'] ) ) ? $post_data['3dsecure'] : '';
350 $options['acting_settings']['epsilon']['process_code'] = ( isset( $post_data['process_code'] ) ) ? $post_data['process_code'] : '';
351 $options['acting_settings']['epsilon']['conv_activate'] = ( isset( $post_data['conv_activate'] ) ) ? $post_data['conv_activate'] : '';
352 $options['acting_settings']['epsilon']['conv_limit'] = ( isset( $post_data['conv_limit'] ) ) ? wp_unslash( $post_data['conv_limit'] ) : '';
353 $options['acting_settings']['epsilon']['paypay_activate'] = ( isset( $post_data['paypay_activate'] ) ) ? $post_data['paypay_activate'] : '';
354
355 if ( 'on' === $options['acting_settings']['epsilon']['card_activate'] || 'on' === $options['acting_settings']['epsilon']['conv_activate'] || 'on' === $options['acting_settings']['epsilon']['paypay_activate'] ) {
356 if ( '' === $options['acting_settings']['epsilon']['contract_code'] ) {
357 $this->error_mes .= '※契約番号を�
358 �力してください<br />';
359 }
360 if ( '' === $options['acting_settings']['epsilon']['ope'] ) {
361 $this->error_mes .= '※稼働環境を選択してください<br />';
362 }
363 }
364
365 if ( '' === $this->error_mes ) {
366 $usces->action_status = 'success';
367 $usces->action_message = __( 'Options are updated.', 'usces' );
368 if ( 'on' === $options['acting_settings']['epsilon']['card_activate'] || 'on' === $options['acting_settings']['epsilon']['conv_activate'] || 'on' === $options['acting_settings']['epsilon']['paypay_activate'] ) {
369 $options['acting_settings']['epsilon']['activate'] = 'on';
370 if ( 'public' === $options['acting_settings']['epsilon']['ope'] ) {
371 $options['acting_settings']['epsilon']['send_url'] = 'https://secure.epsilon.jp/cgi-bin/order/receive_order3.cgi';
372 } elseif ( 'test' === $options['acting_settings']['epsilon']['ope'] ) {
373 $options['acting_settings']['epsilon']['send_url'] = 'https://beta.epsilon.jp/cgi-bin/order/receive_order3.cgi';
374 }
375 $toactive = array();
376 if ( 'on' === $options['acting_settings']['epsilon']['card_activate'] ) {
377 $usces->payment_structure['acting_epsilon_card'] = 'カード決済(イプシロン)';
378 foreach ( $payment_method as $settlement => $payment ) {
379 if ( 'acting_epsilon_card' === $settlement && 'activate' !== $payment['use'] ) {
380 $toactive[] = $payment['name'];
381 }
382 }
383 } else {
384 unset( $usces->payment_structure['acting_epsilon_card'] );
385 }
386 if ( 'on' === $options['acting_settings']['epsilon']['conv_activate'] ) {
387 $usces->payment_structure['acting_epsilon_conv'] = 'コンビニ決済(イプシロン)';
388 foreach ( $payment_method as $settlement => $payment ) {
389 if ( 'acting_epsilon_conv' === $settlement && 'activate' !== $payment['use'] ) {
390 $toactive[] = $payment['name'];
391 }
392 }
393 } else {
394 unset( $usces->payment_structure['acting_epsilon_conv'] );
395 }
396 if ( 'on' === $options['acting_settings']['epsilon']['paypay_activate'] ) {
397 $usces->payment_structure['acting_epsilon_paypay'] = 'PayPay決済(イプシロン)';
398 foreach ( $payment_method as $settlement => $payment ) {
399 if ( 'acting_epsilon_paypay' === $settlement && 'activate' !== $payment['use'] ) {
400 $toactive[] = $payment['name'];
401 }
402 }
403 } else {
404 unset( $usces->payment_structure['acting_epsilon_paypay'] );
405 }
406 usces_admin_orderlist_show_wc_trans_id();
407 if ( 0 < count( $toactive ) ) {
408 $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' );
409 }
410 } else {
411 $options['acting_settings']['epsilon']['activate'] = 'off';
412 unset( $usces->payment_structure['acting_epsilon_card'] );
413 unset( $usces->payment_structure['acting_epsilon_conv'] );
414 unset( $usces->payment_structure['acting_epsilon_paypay'] );
415 }
416 $deactivate = array();
417 foreach ( $payment_method as $settlement => $payment ) {
418 if ( ! array_key_exists( $settlement, $usces->payment_structure ) ) {
419 if ( 'deactivate' !== $payment['use'] ) {
420 $payment['use'] = 'deactivate';
421 $deactivate[] = $payment['name'];
422 usces_update_system_option( 'usces_payment_method', $payment['id'], $payment );
423 }
424 }
425 }
426 if ( 0 < count( $deactivate ) ) {
427 $deactivate_message = sprintf( __( '"Deactivate" %s of payment method.', 'usces' ), implode( ',', $deactivate ) );
428 $usces->action_message .= $deactivate_message;
429 }
430 } else {
431 $usces->action_status = 'error';
432 $usces->action_message = __( 'Data have deficiency.', 'usces' );
433 $options['acting_settings']['epsilon']['activate'] = 'off';
434 unset( $usces->payment_structure['acting_epsilon_card'] );
435 unset( $usces->payment_structure['acting_epsilon_conv'] );
436 unset( $usces->payment_structure['acting_epsilon_paypay'] );
437 $deactivate = array();
438 foreach ( $payment_method as $settlement => $payment ) {
439 if ( in_array( $settlement, $this->pay_method, true ) ) {
440 if ( 'deactivate' !== $payment['use'] ) {
441 $payment['use'] = 'deactivate';
442 $deactivate[] = $payment['name'];
443 usces_update_system_option( 'usces_payment_method', $payment['id'], $payment );
444 }
445 }
446 }
447 if ( 0 < count( $deactivate ) ) {
448 $deactivate_message = sprintf( __( '"Deactivate" %s of payment method.', 'usces' ), implode( ',', $deactivate ) );
449 $usces->action_message .= $deactivate_message . __( 'Please complete the setup and update the payment method to "Activate".', 'usces' );
450 }
451 }
452 ksort( $usces->payment_structure );
453 update_option( 'usces', $options );
454 update_option( 'usces_payment_structure', $usces->payment_structure );
455 }
456
457 /**
458 * クレジット決済設定画面タブ
459 * usces_action_settlement_tab_title
460 */
461 public function settlement_tab_title() {
462 $settlement_selected = get_option( 'usces_settlement_selected', array() );
463 if ( in_array( $this->paymod_id, $settlement_selected, true ) ) {
464 echo '<li><a href="#uscestabs_' . esc_html( $this->paymod_id ) . '">' . esc_html( $this->acting_name ) . '</a></li>';
465 }
466 }
467
468 /**
469 * クレジット決済設定画面フォーム
470 * usces_action_settlement_tab_body
471 */
472 public function settlement_tab_body() {
473 $settlement_selected = get_option( 'usces_settlement_selected', array() );
474 if ( in_array( $this->paymod_id, $settlement_selected, true ) ) :
475 $acting_opts = $this->get_acting_settings();
476 $contract_code = ( isset( $acting_opts['contract_code'] ) ) ? $acting_opts['contract_code'] : '';
477 $ope = ( isset( $acting_opts['ope'] ) && 'public' === $acting_opts['ope'] ) ? 'public' : 'test';
478 $card_activate = ( isset( $acting_opts['card_activate'] ) && 'on' === $acting_opts['card_activate'] ) ? 'on' : 'off';
479 $multi_currency = ( isset( $acting_opts['multi_currency'] ) && 'on' === $acting_opts['multi_currency'] ) ? 'on' : 'off';
480 $threedsecure = ( isset( $acting_opts['3dsecure'] ) && 'on' === $acting_opts['3dsecure'] ) ? 'on' : 'off';
481 $process_code = ( isset( $acting_opts['process_code'] ) && 'on' === $acting_opts['process_code'] ) ? 'on' : 'off';
482 $conv_activate = ( isset( $acting_opts['conv_activate'] ) && 'on' === $acting_opts['conv_activate'] ) ? 'on' : 'off';
483 $conv_limit = ( isset( $acting_opts['conv_limit'] ) ) ? $acting_opts['conv_limit'] : '';
484 $paypay_activate = ( isset( $acting_opts['paypay_activate'] ) && 'on' === $acting_opts['paypay_activate'] ) ? 'on' : 'off';
485 ?>
486 <div id="uscestabs_epsilon">
487 <div class="settlement_service"><span class="service_title"><?php echo esc_html( $this->acting_formal_name ); ?></span></div>
488 <?php
489 if ( 'epsilon' === filter_input( INPUT_POST, 'acting', FILTER_DEFAULT ) ) :
490 if ( '' !== $this->error_mes ) :
491 ?>
492 <div class="error_message"><?php wel_esc_script_e( $this->error_mes ); ?></div>
493 <?php
494 elseif ( isset( $acting_opts['activate'] ) && 'on' === $acting_opts['activate'] ) :
495 ?>
496 <div class="message"><?php esc_html_e( 'Test thoroughly before use.', 'usces' ); ?></div>
497 <?php
498 endif;
499 endif;
500 ?>
501 <form action="" method="post" name="epsilon_form" id="epsilon_form">
502 <table class="settle_table">
503 <tr>
504 <th><a class="explanation-label" id="label_ex_contract_code_epsilon">契約番号</a></th>
505 <td><input name="contract_code" type="text" id="contract_code_epsilon" value="<?php echo esc_attr( $contract_code ); ?>" class="regular-text" maxlength="8" /></td>
506 </tr>
507 <tr id="ex_contract_code_epsilon" class="explanation"><td colspan="2">契約時にイプシロンから発行される契約番号(半角数字8桁)</td></tr>
508 <tr>
509 <th><a class="explanation-label" id="label_ex_ope_epsilon"><?php esc_html_e( 'Operation Environment', 'usces' ); ?></a></th>
510 <td><label><input name="ope" type="radio" id="ope_epsilon_test" value="test"<?php checked( $ope, 'test' ); ?> /><span>テスト環境</span></label><br />
511 <label><input name="ope" type="radio" id="ope_epsilon_public" value="public"<?php checked( $ope, 'public' ); ?> /><span>本番環境</span></label>
512 </td>
513 </tr>
514 <tr id="ex_ope_epsilon" class="explanation"><td colspan="2">動作環境を切り替えます。</td></tr>
515 </table>
516 <table class="settle_table">
517 <tr>
518 <th>クレジットカード決済</th>
519 <td><label><input name="card_activate" type="radio" id="card_activate_epsilon_on" value="on"<?php checked( $card_activate, 'on' ); ?> /><span>利用する</span></label><br />
520 <label><input name="card_activate" type="radio" id="card_activate_epsilon_off" value="off"<?php checked( $card_activate, 'off' ); ?> /><span>利用しない</span></label>
521 </td>
522 </tr>
523 <tr class="card_form_epsilon">
524 <th><a class="explanation-label" id="label_ex_multi_currency_epsilon">多通貨決済</a></th>
525 <td><label><input name="multi_currency" type="radio" class="multi_currency_epsilon" id="multi_currency_epsilon_on" value="on"<?php checked( $multi_currency, 'on' ); ?> /><span>利用する</span></label><br />
526 <label><input name="multi_currency" type="radio" class="multi_currency_epsilon" id="multi_currency_epsilon_off" value="off"<?php checked( $multi_currency, 'off' ); ?> /><span>利用しない</span></label>
527 </td>
528 </tr>
529 <tr id="ex_multi_currency_epsilon" class="explanation card_form_epsilon"><td colspan="2">イプシロンとの契約時にクレジットカード決済(多通貨)の契約をした場合、「利用する」にしてください。</td></tr>
530 <tr class="card_form_epsilon">
531 <th><a class="explanation-label" id="label_ex_3dsecure_epsilon">3Dセキュア</a></th>
532 <td><label><input name="3dsecure" type="radio" class="3dsecure_epsilon" id="3dsecure_epsilon_on" value="on"<?php checked( $threedsecure, 'on' ); ?> /><span>利用する</span></label><br />
533 <label><input name="3dsecure" type="radio" class="3dsecure_epsilon" id="3dsecure_epsilon_off" value="off"<?php checked( $threedsecure, 'off' ); ?> /><span>利用しない</span></label>
534 </td>
535 </tr>
536 <tr id="ex_3dsecure_epsilon" class="explanation card_form_epsilon"><td colspan="2">イプシロンとの契約時に3Dセキュアの契約をした場合、「利用する」にしてください。<br />「多通貨決済」では�
537 須です。</td></tr>
538 <tr class="card_form_epsilon">
539 <th><a class="explanation-label" id="label_ex_process_code_epsilon">登録済み課金</th>
540 <td><label><input name="process_code" type="radio" class="process_code_epsilon" id="process_code_epsilon_on" value="on"<?php checked( $process_code, 'on' ); ?> /><span>利用する</span></label><br />
541 <label><input name="process_code" type="radio" class="process_code_epsilon" id="process_code_epsilon_off" value="off"<?php checked( $process_code, 'off' ); ?> /><span>利用しない</span></label>
542 </td>
543 </tr>
544 <tr id="ex_process_code_epsilon" class="explanation card_form_epsilon"><td colspan="2">Welcart の会員システムを利用している場合、1度クレジットカード決済を実施すると会員番号で紐付けてクレジットカード番号をイプシロンで保持し、2回目以降のクレジット決済において、クレジットカード番号の�
545 �力を不要にします。</td></tr>
546 </table>
547 <table class="settle_table">
548 <tr>
549 <th>コンビニ決済</th>
550 <td><label><input name="conv_activate" type="radio" id="conv_activate_epsilon_on" value="on"<?php checked( $conv_activate, 'on' ); ?> /><span>利用する</span></label><br />
551 <label><input name="conv_activate" type="radio" id="conv_activate_epsilon_off" value="off"<?php checked( $conv_activate, 'off' ); ?> /><span>利用しない</span></label>
552 </td>
553 </tr>
554 <tr class="conv_form_epsilon">
555 <th><a class="explanation-label" id="label_ex_conv_limit"><?php esc_html_e( 'Payment due days', 'usces' ); ?></a></th>
556 <td><select name="conv_limit">
557 <option value=""></option>
558 <?php for ( $d = 10; $d >= 3; $d-- ) : ?>
559 <option value="<?php echo esc_attr( $d ); ?>"<?php selected( $conv_limit, $d ); ?>><?php echo esc_html( $d ); ?>日間</option>
560 <?php endfor; ?>
561 </select>
562 </td>
563 </tr>
564 <tr id="ex_conv_limit" class="explanation conv_form_epsilon"><td colspan="2">設定する場合はイプシロン管理画面の「コンビニ支払期限」と合わせる�
565 要があります。ここでの設定はあくまで�
566 容確認ページでの支払時期を表示するものとなります。</td></tr>
567 </table>
568 <table class="settle_table">
569 <tr>
570 <th>PayPay決済</th>
571 <td><label><input name="paypay_activate" type="radio" id="paypay_activate_epsilon_on" value="on"<?php checked( $paypay_activate, 'on' ); ?> /><span>利用する</span></label><br />
572 <label><input name="paypay_activate" type="radio" id="paypay_activate_epsilon_off" value="off"<?php checked( $paypay_activate, 'off' ); ?> /><span>利用しない</span></label>
573 </td>
574 </tr>
575 </table>
576 <input name="acting" type="hidden" value="epsilon" />
577 <input name="usces_option_update" type="submit" class="button button-primary" value="<?php echo esc_attr( $this->acting_name ); ?>の設定を更新する" />
578 <?php wp_nonce_field( 'admin_settlement', 'wc_nonce' ); ?>
579 </form>
580 <div class="settle_exp">
581 <p><strong><?php echo esc_html( $this->acting_formal_name ); ?></strong></p>
582 <a href="<?php echo esc_url( $this->acting_company_url ); ?>" target="_blank"><?php echo esc_html( $this->acting_name ); ?>の詳細はこちら </a>
583 <p> </p>
584 <p>この決済は「外部リンク型」の決済システムです。</p>
585 <p>「外部リンク型」とは、決済会社のページへ遷移してカード�
586 報を�
587 �力する決済システムです。</p>
588 </div>
589 </div><!--uscestabs_epsilon-->
590 <?php
591 endif;
592 }
593
594 /**
595 * 結果通知処理
596 * usces_after_cart_instant
597 */
598 public function acting_transaction() {
599 global $wpdb;
600
601 if ( ! isset( $_GET['acting_return'] ) && isset( $_GET['trans_code'] ) && isset( $_GET['user_id'] ) && isset( $_GET['result'] ) && isset( $_GET['order_number'] ) ) {
602 wp_redirect(
603 add_query_arg(
604 array(
605 'acting' => 'epsilon',
606 'acting_return' => '1',
607 'trans_code' => filter_input( INPUT_GET, 'trans_code', FILTER_DEFAULT ),
608 'user_id' => filter_input( INPUT_GET, 'user_id', FILTER_DEFAULT ),
609 'result' => filter_input( INPUT_GET, 'result', FILTER_DEFAULT ),
610 'order_number' => filter_input( INPUT_GET, 'order_number', FILTER_DEFAULT ),
611 ),
612 USCES_CART_URL
613 )
614 );
615 exit;
616
617 } elseif ( isset( $_POST['trans_code'] ) && isset( $_POST['user_id'] ) && isset( $_POST['order_number'] ) ) {
618 $post_data = array();
619 foreach ( $_POST as $key => $value ) {
620 $post_data[ $key ] = mb_convert_encoding( wp_unslash( $value ), 'UTF-8', 'SJIS' );
621 }
622
623 if ( '1' === $post_data['paid'] ) {
624 $order_id = $this->get_order_id( $post_data['order_number'] );
625 if ( ! $order_id ) {
626 $log = array(
627 'acting' => 'epsilon_conv',
628 'key' => $post_data['order_number'],
629 'result' => 'ORDER DATA UPDATE ERROR1',
630 'data' => $post_data,
631 );
632 usces_save_order_acting_error( $log );
633 // usces_log( 'Epsilon conv error1 : ' . print_r( $post_data, true ), 'acting_transaction.log' );
634 exit( '0 999 ERROR1' );
635 }
636
637 $res = usces_change_order_receipt( $order_id, 'receipted' );
638 if ( false === $res ) {
639 $log = array(
640 'acting' => 'epsilon_conv',
641 'key' => $post_data['order_number'],
642 'result' => 'ORDER DATA UPDATE ERROR2',
643 'data' => $post_data,
644 );
645 usces_save_order_acting_error( $log );
646 // usces_log( 'Epsilon conv error2 : ' . print_r( $data, true ), 'acting_transaction.log' );
647 exit( '0 999 ERROR2' );
648 }
649
650 $mquery = $wpdb->prepare( "UPDATE {$wpdb->prefix}usces_order_meta SET `meta_value` = %s WHERE `meta_key` = %s AND `order_id` = %d", serialize( $post_data ), 'acting_epsilon_conv', $order_id );
651 $res = $wpdb->query( $mquery );
652 if ( ! $res ) {
653 $log = array(
654 'acting' => 'epsilon_conv',
655 'key' => $post_data['order_number'],
656 'result' => 'ORDER DATA UPDATE ERROR3',
657 'data' => $post_data,
658 );
659 usces_save_order_acting_error( $log );
660 // usces_log( 'Epsilon conv error3 : ' . print_r( $post_data, true ), 'acting_transaction.log' );
661 exit( '0 999 ERROR3' );
662 }
663
664 usces_action_acting_getpoint( $order_id );
665
666 // usces_log( 'Epsilon conv transaction : ' . $post_data['settlement_id'], 'acting_transaction.log' );
667 exit( '1' );
668 }
669 }
670 }
671
672 /**
673 * 受注ID 取得
674 *
675 * @param string $order_number Order number.
676 * @return int
677 */
678 protected function get_order_id( $order_number ) {
679 global $wpdb;
680
681 $query = $wpdb->prepare( "SELECT `order_id` FROM {$wpdb->prefix}usces_order_meta WHERE `meta_key` = %s AND `meta_value` = %s", 'settlement_id', $order_number );
682 $order_id = $wpdb->get_var( $query );
683 return $order_id;
684 }
685
686 /**
687 * ポイント即時付与
688 * usces_filter_is_complete_settlement
689 *
690 * @param boolean $complete Complete the payment.
691 * @param string $payment_name Payment name.
692 * @param string $status Payment status.
693 * @return boolean
694 */
695 public function is_complete_settlement( $complete, $payment_name, $status ) {
696 $payments = usces_get_system_option( 'usces_payment_method', 'name' );
697 if ( isset( $payments[ $payment_name ]['settlement'] ) && ( 'acting_epsilon_card' === $payments[ $payment_name ]['settlement'] || 'acting_epsilon_paypay' === $payments[ $payment_name ]['settlement'] ) ) {
698 $complete = true;
699 }
700 return $complete;
701 }
702
703 /**
704 * 受注データ登録
705 * Called by usces_reg_orderdata() and usces_new_orderdata().
706 * usces_action_reg_orderdata
707 *
708 * @param array $args Compact array( $cart, $entry, $order_id, $member_id, $payments, $charging_type, $results ).
709 */
710 public function register_order_data( $args ) {
711 global $usces;
712 extract( $args ); // phpcs:ignore
713
714 if ( ! $entry['order']['total_full_price'] ) {
715 return;
716 }
717
718 if ( isset( $_GET['acting'] ) && isset( $_GET['acting_return'] ) && isset( $_GET['trans_code'] ) && 'epsilon' === filter_input( INPUT_GET, 'acting', FILTER_DEFAULT ) ) {
719 $acting_flg = ( isset( $payments['settlement'] ) ) ? $payments['settlement'] : '';
720 $order_number = filter_input( INPUT_GET, 'order_number', FILTER_DEFAULT );
721 $usces->set_order_meta_value( 'settlement_id', $order_number, $order_id );
722 $usces->set_order_meta_value( 'wc_trans_id', $order_number, $order_id );
723 if ( isset( $results['reg_order'] ) ) {
724 unset( $results['0'] );
725 unset( $results['reg_order'] );
726 }
727 $results['trans_code'] = filter_input( INPUT_GET, 'trans_code', FILTER_DEFAULT );
728 if ( 'acting_epsilon_card' === $acting_flg ) {
729 $user_id = filter_input( INPUT_GET, 'user_id', FILTER_DEFAULT, FILTER_NULL_ON_FAILURE );
730 $acting_opts = $this->get_acting_settings();
731 if ( 'on' === $acting_opts['process_code'] && $user_id ) {
732 $usces->del_member_meta( 'epsilon_process_code_release', $user_id );
733 $results['user_id'] = $user_id;
734 }
735 }
736 $usces->set_order_meta_value( $acting_flg, usces_serialize( $results ), $order_id );
737 }
738 }
739
740 /**
741 * 受注編集画面に表示する決済�
742 報のキー
743 * usces_filter_settle_info_field_keys
744 *
745 * @param array $keys Settlement information keys.
746 * @param array $fields Settlement information fields.
747 * @return array
748 */
749 public function settlement_info_field_keys( $keys, $fields ) {
750 array_push( $keys, 'trans_code', 'conveni_name', 'conveni_date' );
751 return $keys;
752 }
753
754 /**
755 * 受注編集画面に表示する決済�
756 報の値整形
757 * usces_filter_settle_info_field_value
758 *
759 * @param string $value Settlement information value.
760 * @param string $key Settlement information key.
761 * @param string $acting Acting type.
762 * @return string
763 */
764 public function settlement_info_field_value( $value, $key, $acting ) {
765 return $value;
766 }
767
768 /**
769 * 受注データ復旧処理
770 * usces_action_revival_order_data
771 *
772 * @param int $order_id Order number.
773 * @param string $log_key Link key.
774 * @param string $acting_flg Payment type.
775 */
776 public function revival_order_data( $order_id, $log_key, $acting_flg ) {
777 global $usces;
778 if ( in_array( $acting_flg, $this->pay_method, true ) ) {
779 $usces->set_order_meta_value( 'settlement_id', $log_key, $order_id );
780 }
781 }
782
783 /**
784 * 支払方法説明
785 * usces_filter_payment_detail
786 *
787 * @param string $str Payment method description.
788 * @param array $entry Entry data.
789 * @return string
790 */
791 public function payment_detail( $str, $entry ) {
792 $payment = usces_get_payments_by_name( $entry['order']['payment_name'] );
793 if ( isset( $payment['settlement'] ) && 'acting_epsilon_conv' === $payment['settlement'] ) {
794 $acting_opts = $this->get_acting_settings();
795 if ( ! empty( $acting_opts['conv_limit'] ) ) {
796 $payment_detail = __( '(', 'usces' ) . sprintf( __( 'Payment is valid for %s days from the date of order.', 'usces' ), $acting_opts['conv_limit'] ) . __( ')', 'usces' );
797 $str = apply_filters( 'usces_filter_epsilon_payment_limit_conv', $payment_detail, $acting_opts['conv_limit'] );
798 }
799 }
800 return $str;
801 }
802
803 /**
804 * �
805 容確認ページ [注文する] ボタン
806 * usces_filter_confirm_inform
807 *
808 * @param string $form Purchase post form.
809 * @param array $payments Payment data.
810 * @param string $acting_flg Payment type.
811 * @param string $rand Welcart transaction key.
812 * @param string $purchase_disabled Disable purchase button.
813 * @return string
814 */
815 public function confirm_inform( $form, $payments, $acting_flg, $rand, $purchase_disabled ) {
816 if ( in_array( $acting_flg, $this->pay_method, true ) ) {
817 $form = '<form id="purchase_form" action="' . USCES_CART_URL . '" method="post" onKeyDown="if(event.keyCode == 13){return false;}">
818 <div class="send">
819 ' . apply_filters( 'usces_filter_confirm_before_backbutton', null, $payments, $acting_flg, $rand ) . '
820 <input name="backDelivery" type="submit" id="back_button" class="back_to_delivery_button" value="' . __( 'Back', 'usces' ) . '"' . apply_filters( 'usces_filter_confirm_prebutton', null ) . ' />
821 <input name="purchase" type="submit" id="purchase_button" class="checkout_button" value="' . apply_filters( 'usces_filter_confirm_checkout_button_value', __( 'Checkout', 'usces' ) ) . '"' . $purchase_disabled . ' /></div>
822 <input type="hidden" name="rand" value="' . esc_attr( $rand ) . '">
823 <input type="hidden" name="_nonce" value="' . wp_create_nonce( $acting_flg ) . '">';
824 }
825 return $form;
826 }
827
828 /**
829 * 決済処理
830 * usces_action_acting_processing
831 *
832 * @param string $acting_flg Payment type.
833 * @param array $post_query Post data.
834 */
835 public function acting_processing( $acting_flg, $post_query ) {
836 if ( ! in_array( $acting_flg, $this->pay_method, true ) ) {
837 return;
838 }
839
840 if ( ! wp_verify_nonce( $_REQUEST['_nonce'], $acting_flg ) ) {
841 wp_redirect( USCES_CART_URL );
842 }
843
844 global $usces;
845 $entry = $usces->cart->get_entry();
846 $cart = $usces->cart->get_cart();
847 if ( ! $entry || ! $cart ) {
848 wp_redirect( USCES_CART_URL );
849 }
850
851 $delim = apply_filters( 'usces_filter_delim', $usces->delim );
852 $acting = substr( $acting_flg, 7 );
853 $acting_opts = $this->get_acting_settings();
854 $rand = wp_unslash( $_REQUEST['rand'] );
855 usces_save_order_acting_data( $rand );
856 $user_name = mb_strimwidth( $entry['customer']['name1'] . $entry['customer']['name2'], 0, 64, '', 'UTF-8' );
857 $item_code = mb_convert_kana( $usces->getItemCode( $cart[0]['post_id'] ), 'a', 'UTF-8' );
858 $item_name = $usces->getItemName( $cart[0]['post_id'] );
859 if ( 1 < count( $cart ) ) {
860 $item_name .= ' ' . __( 'Others', 'usces' );
861 }
862 if ( 32 < mb_strlen( $item_name, 'UTF-8' ) ) {
863 $item_name = mb_strimwidth( $item_name, 0, 28, '...', 'UTF-8' );
864 }
865
866 switch ( $acting_flg ) {
867 case 'acting_epsilon_card': /* クレジットカード決済 */
868 if ( 'on' === $acting_opts['multi_currency'] ) {
869 $st_code = '10000-0000-00000-00001-00000-00000-00000';
870 $currency_id = $usces->get_currency_code();
871 $user_id = '-';
872 $process_code = '1';
873 } else {
874 $st_code = '10000-0000-00000-00000-00000-00000-00000';
875 $currency_id = '';
876 if ( 'on' === $acting_opts['process_code'] ) {
877 $member = $usces->get_member();
878 if ( ! empty( $member['ID'] ) ) {
879 $release = $usces->get_member_meta_value( 'epsilon_process_code_release', $member['ID'] );
880 $user_id = $member['ID'];
881 $process_code = ( empty( $release ) ) ? '2' : '4';
882 } else {
883 $user_id = '-';
884 $process_code = '1';
885 }
886 } else {
887 $user_id = '-';
888 $process_code = '1';
889 }
890 }
891 $threedsecure = ( 'on' === $acting_opts['3dsecure'] ) ? '21' : '';
892 break;
893 case 'acting_epsilon_conv': /* コンビニ決済 */
894 $st_code = '00100-0000-00000-00000-00000-00000-00000';
895 $user_id = '-';
896 $currency_id = '';
897 $process_code = '1';
898 break;
899 case 'acting_epsilon_paypay': /* PayPay決済 */
900 $st_code = '00000-0000-00000-00000-00000-10000-00000';
901 $user_id = '-';
902 $currency_id = '';
903 $process_code = '1';
904 break;
905 }
906
907 $send_data = array(
908 'version' => '2',
909 'contract_code' => $acting_opts['contract_code'],
910 'user_id' => $user_id,
911 'user_name' => $user_name,
912 'user_mail_add' => $entry['customer']['mailaddress1'],
913 'item_code' => $item_code,
914 'item_name' => $item_name,
915 'order_number' => $rand,
916 'st_code' => $st_code,
917 'mission_code' => '1',
918 'item_price' => $entry['order']['total_full_price'],
919 'process_code' => $process_code,
920 'memo1' => '',
921 'memo2' => 'wc1collne',
922 'xml' => '1',
923 'character_code' => 'UTF8',
924 'currency_id' => $currency_id,
925 );
926 if ( 'acting_epsilon_conv' === $acting_flg ) {
927 $send_data['user_tel'] = str_replace( '-', '', mb_convert_kana( $entry['customer']['tel'], 'a', 'UTF-8' ) );
928 $send_data['user_name_kana'] = $entry['customer']['name3'] . $entry['customer']['name4'];
929 }
930 if ( ! empty( $threedsecure ) ) {
931 $send_data['tds_flag'] = $threedsecure;
932 }
933 $vars = http_build_query( $send_data );
934 $host = parse_url( USCES_CART_URL );
935 $interface = parse_url( $acting_opts['send_url'] );
936
937 $request = 'POST ' . $acting_opts['send_url'] . " HTTP/1.1\r\n";
938 $request .= 'Host: ' . $host['host'] . "\r\n";
939 $request .= "User-Agent: PHP Script\r\n";
940 $request .= "Content-Type: application/x-www-form-urlencoded\r\n";
941 $request .= 'Content-Length: ' . strlen( $vars ) . "\r\n";
942 $request .= "Connection: close\r\n\r\n";
943 $request .= $vars;
944
945 $fp = @stream_socket_client( 'tlsv1.2://' . $interface['host'] . ':443', $errno, $errstr, 30 );
946 if ( ! $fp ) {
947 // usces_log( 'Epsilon : TLS(v1.2) Socket Error', 'acting_transaction.log' );
948 $log = array(
949 'acting' => $acting,
950 'key' => $rand,
951 'result' => 'SSL/TLS ERROR (' . $errno . ')',
952 'data' => array( $errstr ),
953 );
954 usces_save_order_acting_error( $log );
955 wp_redirect(
956 add_query_arg(
957 array(
958 'acting' => 'epsilon',
959 'acting_return' => '0',
960 ),
961 USCES_CART_URL
962 )
963 );
964 exit;
965 }
966
967 fwrite( $fp, $request );
968 while ( ! feof( $fp ) ) {
969 $scr = fgets( $fp, 1024 );
970 preg_match_all( '/<result\s(.*)\s\/>/', $scr, $match, PREG_SET_ORDER );
971 if ( ! empty( $match[0][1] ) ) {
972 list( $key, $value ) = explode( '=', $match[0][1] );
973 $datas[ $key ] = urldecode( trim( $value, '"' ) );
974 }
975 }
976 fclose( $fp );
977 if ( 1 === (int) $datas['result'] ) {
978 wp_redirect( $datas['redirect'] );
979 } else {
980 // usces_log( 'Epsilon : Certification Error' . print_r( $datas, true ), 'acting_transaction.log' );
981 $err_code = ( isset( $datas['err_code'] ) ) ? urlencode( $datas['err_code'] ) : '';
982 $err_detail = ( isset( $datas['err_detail'] ) ) ? urlencode( $datas['err_detail'] ) : '';
983 $log = array(
984 'acting' => $acting,
985 'key' => $rand,
986 'result' => $err_code,
987 'data' => $datas,
988 );
989 usces_save_order_acting_error( $log );
990 wp_redirect(
991 add_query_arg(
992 array(
993 'acting' => 'epsilon',
994 'acting_return' => '0',
995 ),
996 USCES_CART_URL
997 )
998 );
999 }
1000 exit;
1001 }
1002
1003 /**
1004 * 購�
1005 �完了メッセージ
1006 * usces_filter_completion_settlement_message
1007 *
1008 * @param string $form Purchase complete message.
1009 * @param array $entry Entry data.
1010 * @return string
1011 */
1012 public function completion_settlement_message( $form, $entry ) {
1013 if ( isset( $_GET['acting'] ) && 'epsilon' === filter_input( INPUT_GET, 'acting', FILTER_DEFAULT ) ) {
1014 $payments = usces_get_payments_by_name( $entry['order']['payment_name'] );
1015 if ( isset( $payments['settlement'] ) && 'acting_epsilon_conv' === $payments['settlement'] ) {
1016 $form .= '<div id="status_table"><h5>イプシロン・コンビニ決済</h5>
1017 <p>「お支払いのご案�
1018 」は、' . esc_html( $entry['customer']['mailaddress1'] ) . ' 宛にメールさせていただいております。</p>
1019 </div>' . "\n";
1020 }
1021 }
1022 return $form;
1023 }
1024
1025 /**
1026 * 会員データ編集画面 カード�
1027 報登録�
1028
1029 * usces_action_admin_member_info
1030 *
1031 * @param array $member Member data.
1032 * @param array $member_metas Member meta data.
1033 * @param array $member_history Member's history order data.
1034 */
1035 public function admin_member_info( $member, $member_metas, $member_history ) {
1036 if ( ! $this->is_activate_card() ) {
1037 return;
1038 }
1039
1040 $acting_opts = $this->get_acting_settings();
1041 if ( 'on' !== $acting_opts['process_code'] ) {
1042 return;
1043 }
1044
1045 global $usces;
1046
1047 $epsilon_card = false;
1048 foreach ( $member_history as $history ) {
1049 $payments = usces_get_payments_by_name( $history['payment_name'] );
1050 $settlement = ( 'acting' === $payments['settlement'] ) ? $payments['module'] : $payments['settlement'];
1051 if ( 'acting_epsilon_card' === $settlement ) {
1052 $epsilon_card = true;
1053 break;
1054 }
1055 }
1056
1057 if ( 0 < count( $member_history ) && $epsilon_card ) :
1058 ?>
1059 <tr>
1060 <td class="label"><input type="checkbox" name="epsilon_process_code_release" id="epsilon_process_code_release" value="release"></td>
1061 <td><label for="epsilon_process_code_release">登録済み課金を解除する</label></td>
1062 </tr>
1063 <?php
1064 endif;
1065 }
1066
1067 /**
1068 * 会員データ編集画面 カード�
1069 報登録解除
1070 * usces_action_post_update_memberdata
1071 *
1072 * @param int $member_id Member ID.
1073 * @param boolean $res Result.
1074 */
1075 public function admin_update_memberdata( $member_id, $res ) {
1076 if ( ! $this->is_activate_card() || false === $res ) {
1077 return;
1078 }
1079
1080 global $usces;
1081
1082 $acting_opts = $this->get_acting_settings();
1083 if ( 'on' === $acting_opts['process_code'] ) {
1084 if ( filter_input( INPUT_POST, 'epsilon_process_code_release', FILTER_DEFAULT, FILTER_NULL_ON_FAILURE ) ) {
1085 $usces->set_member_meta_value( 'epsilon_process_code_release', 'release', $member_id );
1086 } else {
1087 $usces->del_member_meta( 'epsilon_process_code_release', $member_id );
1088 }
1089 }
1090 }
1091
1092 /**
1093 * 決済オプション取得
1094 *
1095 * @return array
1096 */
1097 protected function get_acting_settings() {
1098 global $usces;
1099
1100 $acting_settings = ( isset( $usces->options['acting_settings'][ $this->paymod_id ] ) ) ? $usces->options['acting_settings'][ $this->paymod_id ] : array();
1101 return $acting_settings;
1102 }
1103 }
1104