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