| 1 |
<?php |
| 2 |
/** |
| 3 |
* みずほファクター |
| 4 |
* |
| 5 |
* @class MIZUHO_SETTLEMENT |
| 6 |
* @author Collne Inc. |
| 7 |
* @version 1.0.0 |
| 8 |
* @since 1.9.20 |
| 9 |
*/ |
| 10 |
class MIZUHO_SETTLEMENT { |
| 11 |
/** |
| 12 |
* Instance of this class. |
| 13 |
* |
| 14 |
* @var object |
| 15 |
*/ |
| 16 |
protected static $instance = null; |
| 17 |
|
| 18 |
protected $paymod_id; // 決済代行会社ID. |
| 19 |
protected $pay_method; // 決済種別. |
| 20 |
protected $acting_name; // 決済代行会社略称. |
| 21 |
protected $acting_formal_name; // 決済代行会社正式名称. |
| 22 |
protected $acting_company_url; // 決済代行会社URL. |
| 23 |
|
| 24 |
/** |
| 25 |
* エラーメッセージ |
| 26 |
* |
| 27 |
* @var string |
| 28 |
*/ |
| 29 |
protected $error_mes; |
| 30 |
|
| 31 |
/** |
| 32 |
* Construct. |
| 33 |
*/ |
| 34 |
public function __construct() { |
| 35 |
|
| 36 |
$this->paymod_id = 'mizuho'; |
| 37 |
// $this->pay_method = array( |
| 38 |
// 'acting_mizuho_card', |
| 39 |
// 'acting_mizuho_conv1', |
| 40 |
// 'acting_mizuho_conv2', |
| 41 |
// ); |
| 42 |
$this->pay_method = array( |
| 43 |
'acting_mizuho_card', |
| 44 |
); |
| 45 |
$this->acting_name = 'みずほファクター'; |
| 46 |
$this->acting_formal_name = 'みずほファクター'; |
| 47 |
$this->acting_company_url = 'https://www.mizuho-factor.co.jp/'; |
| 48 |
|
| 49 |
$this->initialize_data(); |
| 50 |
|
| 51 |
if ( is_admin() ) { |
| 52 |
add_action( 'usces_action_admin_settlement_update', array( $this, 'settlement_update' ) ); |
| 53 |
add_action( 'usces_action_settlement_tab_title', array( $this, 'settlement_tab_title' ) ); |
| 54 |
add_action( 'usces_action_settlement_tab_body', array( $this, 'settlement_tab_body' ) ); |
| 55 |
} |
| 56 |
|
| 57 |
if ( $this->is_activate_card() ) { |
| 58 |
add_action( 'usces_action_reg_orderdata', array( $this, 'register_orderdata' ) ); |
| 59 |
} |
| 60 |
} |
| 61 |
|
| 62 |
/** |
| 63 |
* Return an instance of this class. |
| 64 |
*/ |
| 65 |
public static function get_instance() { |
| 66 |
if ( is_null( self::$instance ) ) { |
| 67 |
self::$instance = new self(); |
| 68 |
} |
| 69 |
return self::$instance; |
| 70 |
} |
| 71 |
|
| 72 |
/** |
| 73 |
* Initialize |
| 74 |
*/ |
| 75 |
public function initialize_data() { |
| 76 |
|
| 77 |
$options = get_option( 'usces', array() ); |
| 78 |
if ( ! isset( $options['acting_settings'] ) || ! isset( $options['acting_settings']['mizuho'] ) ) { |
| 79 |
$options['acting_settings']['mizuho']['shopid'] = ''; |
| 80 |
$options['acting_settings']['mizuho']['cshopid'] = ''; |
| 81 |
$options['acting_settings']['mizuho']['hash_pass'] = ''; |
| 82 |
$options['acting_settings']['mizuho']['ope'] = ''; |
| 83 |
$options['acting_settings']['mizuho']['send_url'] = ''; |
| 84 |
$options['acting_settings']['mizuho']['send_url_mbl'] = ''; |
| 85 |
$options['acting_settings']['mizuho']['card_activate'] = 'off'; |
| 86 |
$options['acting_settings']['mizuho']['conv1_activate'] = 'off'; |
| 87 |
$options['acting_settings']['mizuho']['conv2_activate'] = 'off'; |
| 88 |
update_option( 'usces', $options ); |
| 89 |
} |
| 90 |
} |
| 91 |
|
| 92 |
/** |
| 93 |
* 決済有効判定 |
| 94 |
* 引数が指定されたとき、支払方法で使用している場合に「有効」とする |
| 95 |
* |
| 96 |
* @param string $type Module type. |
| 97 |
* @return boolean |
| 98 |
*/ |
| 99 |
public function is_validity_acting( $type = '' ) { |
| 100 |
|
| 101 |
$acting_opts = $this->get_acting_settings(); |
| 102 |
if ( empty( $acting_opts ) ) { |
| 103 |
return false; |
| 104 |
} |
| 105 |
|
| 106 |
$payment_method = usces_get_system_option( 'usces_payment_method', 'sort' ); |
| 107 |
$method = false; |
| 108 |
|
| 109 |
switch ( $type ) { |
| 110 |
case 'card': |
| 111 |
foreach ( $payment_method as $payment ) { |
| 112 |
if ( 'acting_mizuho_card' == $payment['settlement'] && 'activate' == $payment['use'] ) { |
| 113 |
$method = true; |
| 114 |
break; |
| 115 |
} |
| 116 |
} |
| 117 |
if( $method && $this->is_activate_card() ) { |
| 118 |
return true; |
| 119 |
} else { |
| 120 |
return false; |
| 121 |
} |
| 122 |
break; |
| 123 |
|
| 124 |
case 'conv': |
| 125 |
foreach ( $payment_method as $payment ) { |
| 126 |
if ( 'acting_mizuho_conv1' == $payment['settlement'] && 'activate' == $payment['use'] ) { |
| 127 |
$method = true; |
| 128 |
break; |
| 129 |
} elseif ( 'acting_mizuho_conv2' == $payment['settlement'] && 'activate' == $payment['use'] ) { |
| 130 |
$method = true; |
| 131 |
break; |
| 132 |
} |
| 133 |
} |
| 134 |
if ( $method && $this->is_activate_conv1() ) { |
| 135 |
return true; |
| 136 |
} elseif ( $method && $this->is_activate_conv2() ) { |
| 137 |
return true; |
| 138 |
} else { |
| 139 |
return false; |
| 140 |
} |
| 141 |
break; |
| 142 |
|
| 143 |
default: |
| 144 |
if ( 'on' == $acting_opts['activate'] ) { |
| 145 |
return true; |
| 146 |
} else { |
| 147 |
return false; |
| 148 |
} |
| 149 |
} |
| 150 |
} |
| 151 |
|
| 152 |
/** |
| 153 |
* クレジットカード決済有効判定 |
| 154 |
* |
| 155 |
* @return boolean $res |
| 156 |
*/ |
| 157 |
public function is_activate_card() { |
| 158 |
|
| 159 |
$acting_opts = $this->get_acting_settings(); |
| 160 |
if ( ( isset( $acting_opts['activate'] ) && 'on' == $acting_opts['activate'] ) && |
| 161 |
( isset( $acting_opts['card_activate'] ) && ( 'on' == $acting_opts['card_activate'] ) ) ) { |
| 162 |
$res = true; |
| 163 |
} else { |
| 164 |
$res = false; |
| 165 |
} |
| 166 |
return $res; |
| 167 |
} |
| 168 |
|
| 169 |
/** |
| 170 |
* コンビニ・ウェルネット決済有効判定 |
| 171 |
* |
| 172 |
* @return boolean $res |
| 173 |
*/ |
| 174 |
public function is_activate_conv1() { |
| 175 |
|
| 176 |
$acting_opts = $this->get_acting_settings(); |
| 177 |
if ( ( isset( $acting_opts['activate'] ) && 'on' == $acting_opts['activate'] ) && |
| 178 |
( isset( $acting_opts['conv1_activate'] ) && 'on' == $acting_opts['conv1_activate'] ) ) { |
| 179 |
$res = true; |
| 180 |
} else { |
| 181 |
$res = false; |
| 182 |
} |
| 183 |
return $res; |
| 184 |
} |
| 185 |
|
| 186 |
/** |
| 187 |
* コンビニ・セブンイレブン決済有効判定 |
| 188 |
* |
| 189 |
* @return boolean $res |
| 190 |
*/ |
| 191 |
public function is_activate_conv2() { |
| 192 |
|
| 193 |
$acting_opts = $this->get_acting_settings(); |
| 194 |
if ( ( isset( $acting_opts['activate'] ) && 'on' == $acting_opts['activate'] ) && |
| 195 |
( isset( $acting_opts['conv2_activate'] ) && 'on' == $acting_opts['conv2_activate'] ) ) { |
| 196 |
$res = true; |
| 197 |
} else { |
| 198 |
$res = false; |
| 199 |
} |
| 200 |
return $res; |
| 201 |
} |
| 202 |
|
| 203 |
/** |
| 204 |
* 決済オプション登録・更新 |
| 205 |
* usces_action_admin_settlement_update |
| 206 |
*/ |
| 207 |
public function settlement_update() { |
| 208 |
global $usces; |
| 209 |
|
| 210 |
if ( $this->paymod_id != $_POST['acting'] ) { |
| 211 |
return; |
| 212 |
} |
| 213 |
|
| 214 |
$this->error_mes = ''; |
| 215 |
$options = get_option( 'usces', array() ); |
| 216 |
$payment_method = usces_get_system_option( 'usces_payment_method', 'settlement' ); |
| 217 |
|
| 218 |
unset( $options['acting_settings']['mizuho'] ); |
| 219 |
$options['acting_settings']['mizuho']['shopid'] = ( isset( $_POST['shopid'] ) ) ? trim( $_POST['shopid'] ) : ''; |
| 220 |
$options['acting_settings']['mizuho']['cshopid'] = ( isset( $_POST['cshopid'] ) ) ? trim( $_POST['cshopid'] ) : ''; |
| 221 |
$options['acting_settings']['mizuho']['hash_pass'] = ( isset( $_POST['hash_pass'] ) ) ? trim( $_POST['hash_pass'] ) : ''; |
| 222 |
$options['acting_settings']['mizuho']['ope'] = ( isset( $_POST['ope'] ) ) ? $_POST['ope'] : ''; |
| 223 |
$options['acting_settings']['mizuho']['send_url'] = ( isset( $_POST['send_url'] ) ) ? trim( $_POST['send_url'] ) : ''; |
| 224 |
$options['acting_settings']['mizuho']['send_url_mbl'] = ( isset( $_POST['send_url_mbl'] ) ) ? trim( $_POST['send_url_mbl'] ) : ''; |
| 225 |
$options['acting_settings']['mizuho']['card_activate'] = ( isset( $_POST['card_activate'] ) ) ? $_POST['card_activate'] : 'off'; |
| 226 |
$options['acting_settings']['mizuho']['conv1_activate'] = ( isset( $_POST['conv1_activate'] ) ) ? $_POST['conv1_activate'] : 'off'; |
| 227 |
$options['acting_settings']['mizuho']['conv2_activate'] = ( isset( $_POST['conv2_activate'] ) ) ? $_POST['conv2_activate'] : 'off'; |
| 228 |
|
| 229 |
if ( WCUtils::is_blank( $_POST['shopid'] ) ) { |
| 230 |
$this->error_mes .= '※加盟店コードを� |
| 231 |
�力してください<br />'; |
| 232 |
} |
| 233 |
if ( WCUtils::is_blank( $_POST['cshopid'] ) ) { |
| 234 |
$this->error_mes .= '※加盟店サブコードを� |
| 235 |
�力してください<br />'; |
| 236 |
} |
| 237 |
if ( WCUtils::is_blank( $_POST['hash_pass'] ) ) { |
| 238 |
$this->error_mes .= '※ハッシュ用パスワードを� |
| 239 |
�力してください<br />'; |
| 240 |
} |
| 241 |
if ( isset( $_POST['ope'] ) && 'public' == $_POST['ope'] && WCUtils::is_blank( $_POST['send_url'] ) ) { |
| 242 |
$this->error_mes .= '※本番URLを� |
| 243 |
�力してください<br />'; |
| 244 |
} |
| 245 |
if ( defined( 'WCEX_MOBILE' ) && isset( $_POST['ope'] ) && 'public' == $_POST['ope'] && WCUtils::is_blank( $_POST['send_url_mbl'] ) ) { |
| 246 |
$this->error_mes .= '※本番URL(携帯)を� |
| 247 |
�力してください<br />'; |
| 248 |
} |
| 249 |
|
| 250 |
if ( '' == $this->error_mes ) { |
| 251 |
$usces->action_status = 'success'; |
| 252 |
$usces->action_message = __( 'Options are updated.', 'usces' ); |
| 253 |
if ( 'on' == $options['acting_settings']['mizuho']['card_activate'] || 'on' == $options['acting_settings']['mizuho']['conv1_activate'] || 'on' == $options['acting_settings']['mizuho']['conv2_activate'] ) { |
| 254 |
$options['acting_settings']['mizuho']['activate'] = 'on'; |
| 255 |
$options['acting_settings']['mizuho']['send_url_test'] = 'https://tst.kessai-navi.jp/mltbank/MBWebFrontPayment'; |
| 256 |
if ( defined( 'WCEX_MOBILE' ) ) { |
| 257 |
$options['acting_settings']['mizuho']['send_url_mbl_test'] = 'https://tst.kessai-navi.jp/mltbank/iMBWebFrontPayment'; |
| 258 |
} |
| 259 |
$toactive = array(); |
| 260 |
if ( 'on' == $options['acting_settings']['mizuho']['card_activate'] ) { |
| 261 |
$usces->payment_structure['acting_mizuho_card'] = 'カード決済(' . $this->acting_name . ')'; |
| 262 |
foreach ( $payment_method as $settlement => $payment ) { |
| 263 |
if ( 'acting_mizuho_card' == $settlement && 'deactivate' == $payment['use'] ) { |
| 264 |
$toactive[] = $payment['name']; |
| 265 |
} |
| 266 |
} |
| 267 |
} else { |
| 268 |
unset( $usces->payment_structure['acting_mizuho_card'] ); |
| 269 |
} |
| 270 |
if ( 'on' == $options['acting_settings']['mizuho']['conv1_activate'] ) { |
| 271 |
$usces->payment_structure['acting_mizuho_conv1'] = 'コンビニ・ウェルネット決済(' . $this->acting_name . ')'; |
| 272 |
foreach ( $payment_method as $settlement => $payment ) { |
| 273 |
if ( 'acting_mizuho_conv1' == $settlement && 'deactivate' == $payment['use'] ) { |
| 274 |
$toactive[] = $payment['name']; |
| 275 |
} |
| 276 |
} |
| 277 |
} else { |
| 278 |
unset( $usces->payment_structure['acting_mizuho_conv1'] ); |
| 279 |
} |
| 280 |
if ( 'on' == $options['acting_settings']['mizuho']['conv2_activate'] ) { |
| 281 |
$usces->payment_structure['acting_mizuho_conv2'] = 'コンビニ・セブンイレブン決済(' . $this->acting_name . ')'; |
| 282 |
foreach ( $payment_method as $settlement => $payment ) { |
| 283 |
if ( 'acting_mizuho_conv2' == $settlement && 'deactivate' == $payment['use'] ) { |
| 284 |
$toactive[] = $payment['name']; |
| 285 |
} |
| 286 |
} |
| 287 |
} else { |
| 288 |
unset( $usces->payment_structure['acting_mizuho_conv2'] ); |
| 289 |
} |
| 290 |
usces_admin_orderlist_show_wc_trans_id(); |
| 291 |
if ( 0 < count( $toactive ) ) { |
| 292 |
$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' ); |
| 293 |
} |
| 294 |
} else { |
| 295 |
$options['acting_settings']['mizuho']['activate'] = 'off'; |
| 296 |
unset( $usces->payment_structure['acting_mizuho_card'] ); |
| 297 |
unset( $usces->payment_structure['acting_mizuho_conv1'] ); |
| 298 |
unset( $usces->payment_structure['acting_mizuho_conv2'] ); |
| 299 |
} |
| 300 |
$deactivate = array(); |
| 301 |
foreach ( $payment_method as $settlement => $payment ) { |
| 302 |
if ( ! array_key_exists( $settlement, $usces->payment_structure ) ) { |
| 303 |
if ( 'deactivate' != $payment['use'] ) { |
| 304 |
$payment['use'] = 'deactivate'; |
| 305 |
$deactivate[] = $payment['name']; |
| 306 |
usces_update_system_option( 'usces_payment_method', $payment['id'], $payment ); |
| 307 |
} |
| 308 |
} |
| 309 |
} |
| 310 |
if ( 0 < count( $deactivate ) ) { |
| 311 |
$deactivate_message = sprintf( __( "\"Deactivate\" %s of payment method.", 'usces' ), implode( ',', $deactivate ) ); |
| 312 |
$usces->action_message .= $deactivate_message; |
| 313 |
} |
| 314 |
} else { |
| 315 |
$usces->action_status = 'error'; |
| 316 |
$usces->action_message = __( 'Data have deficiency.', 'usces' ); |
| 317 |
$options['acting_settings']['mizuho']['activate'] = 'off'; |
| 318 |
unset( $usces->payment_structure['acting_mizuho_card'] ); |
| 319 |
unset( $usces->payment_structure['acting_mizuho_conv1'] ); |
| 320 |
unset( $usces->payment_structure['acting_mizuho_conv2'] ); |
| 321 |
$deactivate = array(); |
| 322 |
foreach ( $payment_method as $settlement => $payment ) { |
| 323 |
if ( in_array( $settlement, $this->pay_method ) ) { |
| 324 |
if ( 'deactivate' != $payment['use'] ) { |
| 325 |
$payment['use'] = 'deactivate'; |
| 326 |
$deactivate[] = $payment['name']; |
| 327 |
usces_update_system_option( 'usces_payment_method', $payment['id'], $payment ); |
| 328 |
} |
| 329 |
} |
| 330 |
} |
| 331 |
if ( 0 < count( $deactivate ) ) { |
| 332 |
$deactivate_message = sprintf( __( "\"Deactivate\" %s of payment method.", 'usces' ), implode( ',', $deactivate ) ); |
| 333 |
$usces->action_message .= $deactivate_message . __( "Please complete the setup and update the payment method to \"Activate\".", 'usces' ); |
| 334 |
} |
| 335 |
} |
| 336 |
ksort( $usces->payment_structure ); |
| 337 |
update_option( 'usces', $options ); |
| 338 |
update_option( 'usces_payment_structure', $usces->payment_structure ); |
| 339 |
} |
| 340 |
|
| 341 |
/** |
| 342 |
* クレジット決済設定画面タブ |
| 343 |
* usces_action_settlement_tab_title |
| 344 |
*/ |
| 345 |
public function settlement_tab_title() { |
| 346 |
|
| 347 |
$settlement_selected = get_option( 'usces_settlement_selected' ); |
| 348 |
if ( in_array( $this->paymod_id, (array) $settlement_selected ) ) { |
| 349 |
echo '<li><a href="#uscestabs_' . $this->paymod_id . '">' . $this->acting_name . '</a></li>'; |
| 350 |
} |
| 351 |
} |
| 352 |
|
| 353 |
/** |
| 354 |
* クレジット決済設定画面フォーム |
| 355 |
* usces_action_settlement_tab_body |
| 356 |
*/ |
| 357 |
public function settlement_tab_body() { |
| 358 |
global $usces; |
| 359 |
|
| 360 |
$acting_opts = $this->get_acting_settings(); |
| 361 |
$settlement_selected = get_option( 'usces_settlement_selected' ); |
| 362 |
if ( in_array( $this->paymod_id, (array) $settlement_selected ) ) : |
| 363 |
?> |
| 364 |
<div id="uscestabs_mizuho"> |
| 365 |
<div class="settlement_service"><span class="service_title"><?php echo esc_html( $this->acting_formal_name ); ?></span></div> |
| 366 |
<?php if ( isset( $_POST['acting'] ) && 'mizuho' == $_POST['acting'] ) : ?> |
| 367 |
<?php if ( '' != $this->error_mes ) : ?> |
| 368 |
<div class="error_message"><?php wel_esc_script_e( $this->error_mes ); ?></div> |
| 369 |
<?php elseif ( isset( $acting_opts['activate'] ) && 'on' == $acting_opts['activate'] ) : ?> |
| 370 |
<div class="message">十分にテストを行ってから運用してください。</div> |
| 371 |
<?php endif; ?> |
| 372 |
<?php endif; ?> |
| 373 |
<form action="" method="post" name="mizuho_form" id="mizuho_form"> |
| 374 |
<table class="settle_table"> |
| 375 |
<tr> |
| 376 |
<th><a class="explanation-label" id="label_ex_shopid_mizuho">加盟店コード</a></th> |
| 377 |
<td><input name="shopid" type="text" id="shopid" value="<?php echo esc_html( isset( $acting_opts['shopid'] ) ? $acting_opts['shopid'] : '' ); ?>" class="regular-text" maxlength="6" /></td> |
| 378 |
</tr> |
| 379 |
<tr id="ex_shopid_mizuho" class="explanation"><td colspan="2">契約時に<?php echo esc_html( $this->acting_name ); ?>から発行される加盟店コード(半角数字6桁)</td></tr> |
| 380 |
<tr> |
| 381 |
<th><a class="explanation-label" id="label_ex_cshopid_mizuho">加盟店サブコード</a></th> |
| 382 |
<td><input name="cshopid" type="text" id="cshopid" value="<?php echo esc_html( isset( $acting_opts['cshopid'] ) ? $acting_opts['cshopid'] : '' ); ?>" class="regular-text" maxlength="5" /></td> |
| 383 |
</tr> |
| 384 |
<tr id="ex_cshopid_mizuho" class="explanation"><td colspan="2">契約時に<?php echo esc_html( $this->acting_name ); ?>から発行される加盟店サブコード(半角数字5桁)</td></tr> |
| 385 |
<tr> |
| 386 |
<th><a class="explanation-label" id="label_ex_hash_pass_mizuho">ハッシュ用パスワード</a></th> |
| 387 |
<td><input name="hash_pass" type="text" id="hash_pass" value="<?php echo esc_html( isset( $acting_opts['hash_pass'] ) ? $acting_opts['hash_pass'] : '' ); ?>" class="regular-text" maxlength="20" /></td> |
| 388 |
</tr> |
| 389 |
<tr id="ex_hash_pass_mizuho" class="explanation"><td colspan="2">契約時に<?php echo esc_html( $this->acting_name ); ?>から発行されるハッシュ用パスワード(半角英数字)</td></tr> |
| 390 |
<tr> |
| 391 |
<th><a class="explanation-label" id="label_ex_ope_mizuho"><?php esc_html_e( 'Operation Environment', 'usces' ); ?></a></th> |
| 392 |
<td><label><input name="ope" type="radio" id="ope_mizuho_1" value="test"<?php if( isset( $acting_opts['ope'] ) && $acting_opts['ope'] == 'test' ) echo ' checked="checked"'; ?> /><span>テスト環境</span></label><br /> |
| 393 |
<label><input name="ope" type="radio" id="ope_mizuho_2" value="public"<?php if( isset( $acting_opts['ope'] ) && $acting_opts['ope'] == 'public' ) echo ' checked="checked"'; ?> /><span>本番環境</span></label> |
| 394 |
</td> |
| 395 |
</tr> |
| 396 |
<tr id="ex_ope_mizuho" class="explanation"><td colspan="2">動作環境を切り替えます。</td></tr> |
| 397 |
<tr> |
| 398 |
<th><a class="explanation-label" id="label_ex_send_url_mizuho">本番URL</a></th> |
| 399 |
<td><input name="send_url" type="text" id="send_url_mizuho" value="<?php echo esc_html( isset( $acting_opts['send_url'] ) ? $acting_opts['send_url'] : '' ); ?>" class="regular-text" /></td> |
| 400 |
</tr> |
| 401 |
<tr id="ex_send_url_mizuho" class="explanation"><td colspan="2">本番環境で接続するURLを設定します。決済インタフェース「接続� |
| 402 |
�URL(画面連携型)PC」に示されるURLを� |
| 403 |
�力してください。</td></tr> |
| 404 |
<?php if( defined( 'WCEX_MOBILE' ) ): ?> |
| 405 |
<tr> |
| 406 |
<th><a class="explanation-label" id="label_ex_send_url_mbl_mizuho">本番URL(携帯)</a></th> |
| 407 |
<td><input name="send_url_mbl" type="text" id="send_url_mbl_mizuho" value="<?php echo esc_html( isset( $acting_opts['send_url_mbl'] ) ? $acting_opts['send_url_mbl'] : '' ); ?>" class="regular-text" /></td> |
| 408 |
</tr> |
| 409 |
<tr id="ex_send_url_mbl_mizuho" class="explanation"><td colspan="2">本番環境で接続するURLを設定します。決済インタフェース「接続� |
| 410 |
�URL(画面連携型)MB」に示されるURLを� |
| 411 |
�力してください。</td></tr> |
| 412 |
<?php endif; ?> |
| 413 |
</table> |
| 414 |
<table class="settle_table"> |
| 415 |
<tr> |
| 416 |
<th>クレジットカード決済</th> |
| 417 |
<td><label><input name="card_activate" type="radio" id="card_activate_mizuho_1" value="on"<?php if( isset( $acting_opts['card_activate'] ) && $acting_opts['card_activate'] == 'on' ) echo ' checked="checked"'; ?> /><span>利用する</span></label><br /> |
| 418 |
<label><input name="card_activate" type="radio" id="card_activate_mizuho_2" value="off"<?php if( isset( $acting_opts['card_activate'] ) && $acting_opts['card_activate'] == 'off' ) echo ' checked="checked"'; ?> /><span>利用しない</span></label> |
| 419 |
</td> |
| 420 |
</tr> |
| 421 |
</table> |
| 422 |
<!--<table class="settle_table"> |
| 423 |
<tr> |
| 424 |
<th>コンビニ決済<br><a class="explanation-label" id="label_ex_conv1_activate">ウェルネット決済</a></th> |
| 425 |
<td><label><input name="conv1_activate" type="radio" id="conv1_activate_mizuho_1" value="on"<?php if( isset( $acting_opts['conv1_activate'] ) && $acting_opts['conv1_activate'] == 'on' ) echo ' checked="checked"'; ?> /><span>利用する</span></label><br /> |
| 426 |
<label><input name="conv1_activate" type="radio" id="conv1_activate_mizuho_2" value="off"<?php if( isset( $acting_opts['conv1_activate'] ) && $acting_opts['conv1_activate'] == 'off' ) echo ' checked="checked"'; ?> /><span>利用しない</span></label> |
| 427 |
</td> |
| 428 |
</tr> |
| 429 |
<tr id="ex_conv1_activate" class="explanation"><td colspan="2">ローソン、ファミリーマート、サークルK サンクス、ミニストップ、デイリーヤマザキ、スリーエフでのご利用が可能です。</td></tr> |
| 430 |
<tr> |
| 431 |
<th>コンビニ決済<br><a class="explanation-label" id="label_ex_conv2_activate">セブンイレブン決済</a></th> |
| 432 |
<td><label><input name="conv2_activate" type="radio" id="conv2_activate_mizuho_1" value="on"<?php if( isset( $acting_opts['conv2_activate'] ) && $acting_opts['conv2_activate'] == 'on' ) echo ' checked="checked"'; ?> /><span>利用する</span></label><br /> |
| 433 |
<label><input name="conv2_activate" type="radio" id="conv2_activate_mizuho_2" value="off"<?php if( isset( $acting_opts['conv2_activate'] ) && $acting_opts['conv2_activate'] == 'off' ) echo ' checked="checked"'; ?> /><span>利用しない</span></label> |
| 434 |
</td> |
| 435 |
</tr> |
| 436 |
<tr id="ex_conv2_activate" class="explanation"><td colspan="2">セブンイレブンでのご利用が可能です。</td></tr> |
| 437 |
</table>--> |
| 438 |
<input name="acting" type="hidden" value="mizuho" /> |
| 439 |
<input name="usces_option_update" type="submit" class="button button-primary" value="<?php echo esc_attr( $this->acting_name ); ?>の設定を更新する" /> |
| 440 |
<?php wp_nonce_field( 'admin_settlement', 'wc_nonce' ); ?> |
| 441 |
</form> |
| 442 |
<div class="settle_exp"> |
| 443 |
<p><strong><?php echo esc_html( $this->acting_formal_name ); ?></strong></p> |
| 444 |
<a href="<?php echo esc_url( $this->acting_company_url ); ?>" target="_blank"><?php echo esc_html( $this->acting_name ); ?>の詳細はこちら 》</a> |
| 445 |
<p> </p> |
| 446 |
<p>この決済は「外部リンク型」の決済システムです。</p> |
| 447 |
<p>「外部リンク型」とは、決済会社のページへ遷移してカード� |
| 448 |
報を� |
| 449 |
�力する決済システムです。</p> |
| 450 |
</div> |
| 451 |
</div><!--uscestabs_mizuho--> |
| 452 |
<?php |
| 453 |
endif; |
| 454 |
} |
| 455 |
|
| 456 |
/** |
| 457 |
* 受注データ登録 |
| 458 |
* Call from usces_reg_orderdata() and usces_new_orderdata(). |
| 459 |
* usces_action_reg_orderdata |
| 460 |
* |
| 461 |
* @param array $args ( $cart, $entry, $order_id, $member_id, $payments, $charging_type, $results ). |
| 462 |
*/ |
| 463 |
public function register_orderdata( $args ) { |
| 464 |
global $usces; |
| 465 |
extract( $args ); |
| 466 |
|
| 467 |
$acting_flg = $payments['settlement']; |
| 468 |
if ( ! in_array( $acting_flg, $this->pay_method ) ) { |
| 469 |
return; |
| 470 |
} |
| 471 |
|
| 472 |
if ( ! $entry['order']['total_full_price'] ) { |
| 473 |
return; |
| 474 |
} |
| 475 |
|
| 476 |
if ( isset( $_REQUEST['acting'] ) && 'mizuho_card' == $_REQUEST['acting'] ) { |
| 477 |
$data['stran'] = esc_sql( $_REQUEST['stran'] ); |
| 478 |
$data['mbtran'] = esc_sql( $_REQUEST['mbtran'] ); |
| 479 |
$usces->set_order_meta_value( 'acting_' . $_REQUEST['acting'], serialize( $data ), $order_id ); |
| 480 |
$usces->set_order_meta_value( 'wc_trans_id', $_REQUEST['stran'], $order_id ); |
| 481 |
|
| 482 |
} elseif ( isset( $_REQUEST['acting'] ) && 'mizuho_conv' == $_REQUEST['acting'] ) { |
| 483 |
$data['stran'] = esc_sql( $_REQUEST['stran'] ); |
| 484 |
$data['mbtran'] = esc_sql( $_REQUEST['mbtran'] ); |
| 485 |
$data['bktrans'] = esc_sql( $_REQUEST['bktrans'] ); |
| 486 |
$data['tranid'] = esc_sql( $_REQUEST['tranid'] ); |
| 487 |
$usces->set_order_meta_value( 'stran', $data['stran'], $order_id ); |
| 488 |
$usces->set_order_meta_value( 'acting_' . $_REQUEST['acting'], serialize( $data ), $order_id ); |
| 489 |
$usces->set_order_meta_value( 'wc_trans_id', $data['stran'], $order_id ); |
| 490 |
} |
| 491 |
} |
| 492 |
|
| 493 |
/** |
| 494 |
* 決済オプション取得 |
| 495 |
* |
| 496 |
* @return array $acting_settings |
| 497 |
*/ |
| 498 |
protected function get_acting_settings() { |
| 499 |
global $usces; |
| 500 |
|
| 501 |
$acting_settings = ( isset( $usces->options['acting_settings'][ $this->paymod_id ] ) ) ? $usces->options['acting_settings'][ $this->paymod_id ] : array(); |
| 502 |
return $acting_settings; |
| 503 |
} |
| 504 |
} |
| 505 |
|