| 1 |
<?php |
| 2 |
/** |
| 3 |
* Settlement Class. |
| 4 |
* e-SCOTT Smart |
| 5 |
* |
| 6 |
* @package Welcart |
| 7 |
* @author Welcart Inc. |
| 8 |
* @version 1.2.0 |
| 9 |
* @since 1.4.14 |
| 10 |
*/ |
| 11 |
class ESCOTT_SETTLEMENT extends ESCOTT_MAIN { |
| 12 |
/** |
| 13 |
* Instance of this class. |
| 14 |
* |
| 15 |
* @var object |
| 16 |
*/ |
| 17 |
protected static $instance = null; |
| 18 |
|
| 19 |
/** |
| 20 |
* Construct. |
| 21 |
*/ |
| 22 |
public function __construct() { |
| 23 |
$this->acting_name = 'e-SCOTT'; |
| 24 |
$this->acting_formal_name = 'e-SCOTT Smart'; |
| 25 |
|
| 26 |
$this->acting_card = 'escott_card'; |
| 27 |
$this->acting_conv = 'escott_conv'; |
| 28 |
$this->acting_atodene = ''; |
| 29 |
|
| 30 |
$this->acting_flg_card = 'acting_escott_card'; |
| 31 |
$this->acting_flg_conv = 'acting_escott_conv'; |
| 32 |
$this->acting_flg_atodene = ''; |
| 33 |
|
| 34 |
$this->pay_method = array( |
| 35 |
'acting_escott_card', |
| 36 |
'acting_escott_conv', |
| 37 |
); |
| 38 |
$this->merchantfree3 = 'wc1collne'; |
| 39 |
$this->quick_key_pre = 'escott'; |
| 40 |
|
| 41 |
parent::__construct( 'escott' ); |
| 42 |
|
| 43 |
$this->initialize_data(); |
| 44 |
} |
| 45 |
|
| 46 |
/** |
| 47 |
* Return an instance of this class. |
| 48 |
*/ |
| 49 |
public static function get_instance() { |
| 50 |
if ( is_null( self::$instance ) ) { |
| 51 |
self::$instance = new self(); |
| 52 |
} |
| 53 |
return self::$instance; |
| 54 |
} |
| 55 |
|
| 56 |
/** |
| 57 |
* Initialize. |
| 58 |
*/ |
| 59 |
public function initialize_data() { |
| 60 |
$options = get_option( 'usces', array() ); |
| 61 |
$options['acting_settings']['escott']['merchant_id'] = ( isset( $options['acting_settings']['escott']['merchant_id'] ) ) ? $options['acting_settings']['escott']['merchant_id'] : ''; |
| 62 |
$options['acting_settings']['escott']['merchant_pass'] = ( isset( $options['acting_settings']['escott']['merchant_pass'] ) ) ? $options['acting_settings']['escott']['merchant_pass'] : ''; |
| 63 |
$options['acting_settings']['escott']['tenant_id'] = ( isset( $options['acting_settings']['escott']['tenant_id'] ) ) ? $options['acting_settings']['escott']['tenant_id'] : '0001'; |
| 64 |
$options['acting_settings']['escott']['ope'] = ( isset( $options['acting_settings']['escott']['ope'] ) ) ? $options['acting_settings']['escott']['ope'] : 'test'; |
| 65 |
$options['acting_settings']['escott']['card_activate'] = ( isset( $options['acting_settings']['escott']['card_activate'] ) ) ? $options['acting_settings']['escott']['card_activate'] : 'off'; |
| 66 |
$options['acting_settings']['escott']['card_key_aes'] = ( isset( $options['acting_settings']['escott']['card_key_aes'] ) ) ? $options['acting_settings']['escott']['card_key_aes'] : ''; |
| 67 |
$options['acting_settings']['escott']['card_key_iv'] = ( isset( $options['acting_settings']['escott']['card_key_iv'] ) ) ? $options['acting_settings']['escott']['card_key_iv'] : ''; |
| 68 |
$options['acting_settings']['escott']['seccd'] = ( isset( $options['acting_settings']['escott']['seccd'] ) ) ? $options['acting_settings']['escott']['seccd'] : 'on'; |
| 69 |
$options['acting_settings']['escott']['sec3d_activate'] = ( isset( $options['acting_settings']['escott']['sec3d_activate'] ) ) ? $options['acting_settings']['escott']['sec3d_activate'] : 'off'; |
| 70 |
$options['acting_settings']['escott']['token_code'] = ( isset( $options['acting_settings']['escott']['token_code'] ) ) ? $options['acting_settings']['escott']['token_code'] : ''; |
| 71 |
$options['acting_settings']['escott']['quickpay'] = ( isset( $options['acting_settings']['escott']['quickpay'] ) ) ? $options['acting_settings']['escott']['quickpay'] : 'off'; |
| 72 |
$options['acting_settings']['escott']['chooseable_quickpay'] = ( isset( $options['acting_settings']['escott']['chooseable_quickpay'] ) ) ? $options['acting_settings']['escott']['chooseable_quickpay'] : 'on'; |
| 73 |
$options['acting_settings']['escott']['operateid'] = ( isset( $options['acting_settings']['escott']['operateid'] ) ) ? $options['acting_settings']['escott']['operateid'] : '1Gathering'; |
| 74 |
$options['acting_settings']['escott']['howtopay'] = ( isset( $options['acting_settings']['escott']['howtopay'] ) ) ? $options['acting_settings']['escott']['howtopay'] : '1'; |
| 75 |
$options['acting_settings']['escott']['conv_activate'] = ( isset( $options['acting_settings']['escott']['conv_activate'] ) ) ? $options['acting_settings']['escott']['conv_activate'] : 'off'; |
| 76 |
$options['acting_settings']['escott']['conv_limit'] = ( ! empty( $options['acting_settings']['escott']['conv_limit'] ) ) ? $options['acting_settings']['escott']['conv_limit'] : '7'; |
| 77 |
$options['acting_settings']['escott']['conv_fee_type'] = ( isset( $options['acting_settings']['escott']['conv_fee_type'] ) ) ? $options['acting_settings']['escott']['conv_fee_type'] : ''; |
| 78 |
$options['acting_settings']['escott']['conv_fee'] = ( isset( $options['acting_settings']['escott']['conv_fee'] ) ) ? $options['acting_settings']['escott']['conv_fee'] : ''; |
| 79 |
$options['acting_settings']['escott']['conv_fee_limit_amount'] = ( isset( $options['acting_settings']['escott']['conv_fee_limit_amount'] ) ) ? $options['acting_settings']['escott']['conv_fee_limit_amount'] : ''; |
| 80 |
$options['acting_settings']['escott']['conv_fee_first_amount'] = ( isset( $options['acting_settings']['escott']['conv_fee_first_amount'] ) ) ? $options['acting_settings']['escott']['conv_fee_first_amount'] : ''; |
| 81 |
$options['acting_settings']['escott']['conv_fee_first_fee'] = ( isset( $options['acting_settings']['escott']['conv_fee_first_fee'] ) ) ? $options['acting_settings']['escott']['conv_fee_first_fee'] : ''; |
| 82 |
$options['acting_settings']['escott']['conv_fee_amounts'] = ( isset( $options['acting_settings']['escott']['conv_fee_amounts'] ) ) ? $options['acting_settings']['escott']['conv_fee_amounts'] : array(); |
| 83 |
$options['acting_settings']['escott']['conv_fee_fees'] = ( isset( $options['acting_settings']['escott']['conv_fee_fees'] ) ) ? $options['acting_settings']['escott']['conv_fee_fees'] : array(); |
| 84 |
$options['acting_settings']['escott']['conv_fee_end_fee'] = ( isset( $options['acting_settings']['escott']['conv_fee_end_fee'] ) ) ? $options['acting_settings']['escott']['conv_fee_end_fee'] : ''; |
| 85 |
$options['acting_settings']['escott']['atodene_activate'] = 'off'; |
| 86 |
$options['acting_settings']['escott']['activate'] = ( isset( $options['acting_settings']['escott']['activate'] ) ) ? $options['acting_settings']['escott']['activate'] : 'off'; |
| 87 |
update_option( 'usces', $options ); |
| 88 |
|
| 89 |
$available_settlement = get_option( 'usces_available_settlement', array() ); |
| 90 |
if ( ! in_array( 'escott', $available_settlement, true ) ) { |
| 91 |
$available_settlement['escott'] = 'e-SCOTT Smart'; |
| 92 |
update_option( 'usces_available_settlement', $available_settlement ); |
| 93 |
} |
| 94 |
|
| 95 |
$noreceipt_status = get_option( 'usces_noreceipt_status', array() ); |
| 96 |
if ( ! in_array( 'acting_escott_conv', $noreceipt_status, true ) ) { |
| 97 |
$noreceipt_status[] = 'acting_escott_conv'; |
| 98 |
update_option( 'usces_noreceipt_status', $noreceipt_status ); |
| 99 |
} |
| 100 |
|
| 101 |
$this->unavailable_method = array( 'acting_welcart_card', 'acting_zeus_card', 'acting_zeus_conv', 'acting_sbps_card' ); |
| 102 |
} |
| 103 |
|
| 104 |
/** |
| 105 |
* Admin scripts. |
| 106 |
* admin_print_footer_scripts |
| 107 |
*/ |
| 108 |
public function admin_scripts() { |
| 109 |
$admin_page = filter_input( INPUT_GET, 'page', FILTER_DEFAULT ); |
| 110 |
switch ( $admin_page ) : |
| 111 |
case 'usces_settlement': |
| 112 |
$settlement_selected = get_option( 'usces_settlement_selected', array() ); |
| 113 |
if ( in_array( $this->paymod_id, $settlement_selected, true ) ) : |
| 114 |
$acting_opts = $this->get_acting_settings(); |
| 115 |
?> |
| 116 |
<script type="text/javascript"> |
| 117 |
jQuery(document).ready( function($) { |
| 118 |
var card_activate = "<?php echo esc_attr( $acting_opts['card_activate'] ); ?>"; |
| 119 |
var conv_activate = "<?php echo esc_attr( $acting_opts['conv_activate'] ); ?>"; |
| 120 |
|
| 121 |
if( "on" == card_activate || "token" == card_activate ) { |
| 122 |
$(".card_escott").css("display",""); |
| 123 |
$(".card_howtopay_escott").css("display",""); |
| 124 |
var sec3d_activate = "<?php echo esc_attr( $acting_opts['sec3d_activate'] ); ?>"; |
| 125 |
if( "on" == sec3d_activate ) { |
| 126 |
$(".card_sec3d_escott").css("display",""); |
| 127 |
} else { |
| 128 |
$(".card_sec3d_escott").css("display","none"); |
| 129 |
} |
| 130 |
var quickpay_escott = "<?php echo esc_attr( $acting_opts['quickpay'] ); ?>"; |
| 131 |
if( "on" == quickpay_escott ) { |
| 132 |
$(".card_chooseable_quickpay_escott").css("display",""); |
| 133 |
} else { |
| 134 |
$(".card_chooseable_quickpay_escott").css("display","none"); |
| 135 |
} |
| 136 |
} else { |
| 137 |
$(".card_escott").css("display","none"); |
| 138 |
$(".card_howtopay_escott").css("display","none"); |
| 139 |
$(".card_chooseable_quickpay_escott").css("display","none"); |
| 140 |
} |
| 141 |
|
| 142 |
if( "on" == conv_activate ) { |
| 143 |
$(".conv_escott").css("display",""); |
| 144 |
} else { |
| 145 |
$(".conv_escott").css("display","none"); |
| 146 |
} |
| 147 |
|
| 148 |
$(document).on( "change", ".card_activate_escott", function() { |
| 149 |
if( "on" == $(this).val() || "token" == $(this).val() ) { |
| 150 |
$(".card_escott").css("display",""); |
| 151 |
$(".card_howtopay_escott").css("display",""); |
| 152 |
if( "on" == $("input[name='sec3d_activate']:checked").val() ) { |
| 153 |
$(".card_sec3d_escott").css("display",""); |
| 154 |
} else { |
| 155 |
$(".card_sec3d_escott").css("display","none"); |
| 156 |
} |
| 157 |
if( "on" == $("input[name='quickpay']:checked").val() ) { |
| 158 |
$(".card_chooseable_quickpay_escott").css("display",""); |
| 159 |
} else { |
| 160 |
$(".card_chooseable_quickpay_escott").css("display","none"); |
| 161 |
} |
| 162 |
} else { |
| 163 |
$(".card_escott").css("display","none"); |
| 164 |
$(".card_howtopay_escott").css("display","none"); |
| 165 |
$(".card_chooseable_quickpay_escott").css("display","none"); |
| 166 |
} |
| 167 |
}); |
| 168 |
|
| 169 |
$(document).on( "change", ".sec3d_activate_escott", function() { |
| 170 |
if( "on" == $(this).val() ) { |
| 171 |
$(".card_sec3d_escott").css("display",""); |
| 172 |
} else { |
| 173 |
$(".card_sec3d_escott").css("display","none"); |
| 174 |
} |
| 175 |
}); |
| 176 |
|
| 177 |
$(document).on( "change", ".quickpay_escott", function() { |
| 178 |
if( "on" == $(this).val() ) { |
| 179 |
$(".card_chooseable_quickpay_escott").css("display",""); |
| 180 |
} else { |
| 181 |
$(".card_chooseable_quickpay_escott").css("display","none"); |
| 182 |
} |
| 183 |
}); |
| 184 |
|
| 185 |
$(document).on( "change", ".conv_activate_escott", function() { |
| 186 |
if( "on" == $(this).val() ) { |
| 187 |
$(".conv_escott").css("display",""); |
| 188 |
} else { |
| 189 |
$(".conv_escott").css("display","none"); |
| 190 |
} |
| 191 |
}); |
| 192 |
|
| 193 |
adminSettlementEScott = { |
| 194 |
openFee : function(mode) { |
| 195 |
$("#fee_change_field").html(""); |
| 196 |
$("#fee_fix").val($("#"+mode+"_fee").val()); |
| 197 |
$("#fee_limit_amount_fix").val($("#"+mode+"_fee_limit_amount_fix").val()); |
| 198 |
$("#fee_first_amount").val($("#"+mode+"_fee_first_amount").val()); |
| 199 |
$("#fee_first_fee").val($("#"+mode+"_fee_first_fee").val()); |
| 200 |
$("#fee_limit_amount_change").val($("#"+mode+"_fee_limit_amount_change").val()); |
| 201 |
var fee_amounts = new Array(); |
| 202 |
var fee_fees = new Array(); |
| 203 |
if( 0 < $("#"+mode+"_fee_amounts").val().length ) { |
| 204 |
fee_amounts = $("#"+mode+"_fee_amounts").val().split("|"); |
| 205 |
} |
| 206 |
if( 0 < $("#"+mode+"_fee_fees").val().length ) { |
| 207 |
fee_fees = $("#"+mode+"_fee_fees").val().split("|"); |
| 208 |
} |
| 209 |
if( 0 < fee_amounts.length ) { |
| 210 |
var amount = parseInt($("#fee_first_amount").val()) + 1; |
| 211 |
for( var i = 0; i < fee_amounts.length; i++ ) { |
| 212 |
html = '<tr id="row_'+i+'"><td class="cod_f"><span id="amount_'+i+'">'+amount+'</span></td><td class="cod_m"><?php esc_html_e( ' - ', 'usces' ); ?></td><td class="cod_e"><input name="fee_amounts['+i+']" type="text" class="short_str num" value="'+fee_amounts[i]+'" /></td><td class="cod_cod"><input name="fee_fees['+i+']" type="text" class="short_str num" value="'+fee_fees[i]+'" /></td></tr>'; |
| 213 |
$("#fee_change_field").append(html); |
| 214 |
amount = parseInt(fee_amounts[i]) + 1; |
| 215 |
} |
| 216 |
$("#end_amount").html(amount); |
| 217 |
} else { |
| 218 |
$("#end_amount").html(parseInt($("#"+mode+"_fee_first_amount").val()) + 1); |
| 219 |
} |
| 220 |
$("#fee_end_fee").val($("#"+mode+"_fee_end_fee").val()); |
| 221 |
|
| 222 |
var fee_type = $("#"+mode+"_fee_type").val(); |
| 223 |
if( "change" == fee_type ) { |
| 224 |
$("#fee_type_change").prop("checked",true); |
| 225 |
$("#escott_fee_fix_table").css("display","none"); |
| 226 |
$("#escott_fee_change_table").css("display",""); |
| 227 |
} else { |
| 228 |
$("#fee_type_fix").prop("checked",true); |
| 229 |
$("#escott_fee_fix_table").css("display",""); |
| 230 |
$("#escott_fee_change_table").css("display","none"); |
| 231 |
} |
| 232 |
}, |
| 233 |
|
| 234 |
updateFee : function(mode) { |
| 235 |
var fee_type = $("input[name='fee_type']:checked").val(); |
| 236 |
$("#"+mode+"_fee_type").val(fee_type); |
| 237 |
$("#"+mode+"_fee").val($("#fee_fix").val()); |
| 238 |
$("#"+mode+"_fee_limit_amount_"+fee_type).val($("#fee_limit_amount_"+fee_type).val()); |
| 239 |
$("#"+mode+"_fee_first_amount").val($("#fee_first_amount").val()); |
| 240 |
$("#"+mode+"_fee_first_fee").val($("#fee_first_fee").val()); |
| 241 |
var fee_amounts = ""; |
| 242 |
var fee_fees = ""; |
| 243 |
var sp = ""; |
| 244 |
var fee_amounts_length = $("input[name^='fee_amounts']").length; |
| 245 |
for( var i = 0; i < fee_amounts_length; i++ ) { |
| 246 |
fee_amounts += sp+$("input[name='fee_amounts\["+i+"\]']").val(); |
| 247 |
fee_fees += sp+$("input[name='fee_fees\["+i+"\]']").val(); |
| 248 |
sp = "|"; |
| 249 |
} |
| 250 |
$("#"+mode+"_fee_amounts").val(fee_amounts); |
| 251 |
$("#"+mode+"_fee_fees").val(fee_fees); |
| 252 |
$("#"+mode+"_fee_end_fee").val($("#fee_end_fee").val()); |
| 253 |
}, |
| 254 |
|
| 255 |
setFeeType : function(mode,closed) { |
| 256 |
var fee_type = $("input[name='fee_type']:checked").val(); |
| 257 |
if( "change" == fee_type ) { |
| 258 |
$("#"+mode+"_fee_type_field").html("<?php esc_attr_e( 'Variable', 'usces' ); ?>"); |
| 259 |
if( !closed ) { |
| 260 |
$("#escott_fee_fix_table").css("display","none"); |
| 261 |
$("#escott_fee_change_table").css("display",""); |
| 262 |
} |
| 263 |
} else if( "fix" == fee_type ) { |
| 264 |
$("#"+mode+"_fee_type_field").html("<?php esc_attr_e( 'Fixation', 'usces' ); ?>"); |
| 265 |
if( !closed ) { |
| 266 |
$("#escott_fee_fix_table").css("display",""); |
| 267 |
$("#escott_fee_change_table").css("display","none"); |
| 268 |
} |
| 269 |
} |
| 270 |
} |
| 271 |
}; |
| 272 |
|
| 273 |
$("#escott_fee_dialog").dialog({ |
| 274 |
autoOpen: false, |
| 275 |
height: 500, |
| 276 |
width: 450, |
| 277 |
modal: true, |
| 278 |
open: function() { |
| 279 |
adminSettlementEScott.openFee($("#escott_fee_mode").val()); |
| 280 |
}, |
| 281 |
buttons: { |
| 282 |
"<?php esc_attr_e( 'Settings' ); ?>": function() { |
| 283 |
adminSettlementEScott.updateFee($("#escott_fee_mode").val()); |
| 284 |
}, |
| 285 |
"<?php esc_attr_e( 'Close' ); ?>": function() { |
| 286 |
$(this).dialog('close'); |
| 287 |
} |
| 288 |
}, |
| 289 |
close: function() { |
| 290 |
adminSettlementEScott.setFeeType($("#escott_fee_mode").val(),true); |
| 291 |
} |
| 292 |
}); |
| 293 |
|
| 294 |
$(document).on( "click", "#conv_fee_setting", function() { |
| 295 |
$("#escott_fee_mode").val("conv"); |
| 296 |
$("#escott_fee_dialog").dialog("option","title","<?php esc_attr_e( 'Online storage agency settlement fee setting', 'usces' ); ?>"); |
| 297 |
$("#escott_fee_dialog").dialog("open"); |
| 298 |
}); |
| 299 |
|
| 300 |
$(document).on( "click", ".fee_type", function() { |
| 301 |
if( "change" == $(this).val() ) { |
| 302 |
$("#escott_fee_fix_table").css("display","none"); |
| 303 |
$("#escott_fee_change_table").css("display",""); |
| 304 |
} else { |
| 305 |
$("#escott_fee_fix_table").css("display",""); |
| 306 |
$("#escott_fee_change_table").css("display","none"); |
| 307 |
} |
| 308 |
}); |
| 309 |
|
| 310 |
$(document).on( "change", "input[name='fee_first_amount']", function() { |
| 311 |
var rows = $("input[name^='fee_amounts']"); |
| 312 |
var first_amount = $("input[name='fee_first_amount']"); |
| 313 |
if( 0 == rows.length && $(first_amount).val() != '' ) { |
| 314 |
$("#end_amount").html(parseInt($(first_amount).val()) + 1); |
| 315 |
} else if( 0 < rows.length && $(first_amount).val() != '' ) { |
| 316 |
$('#amount_0').html(parseInt($(first_amount).val()) + 1); |
| 317 |
} |
| 318 |
}); |
| 319 |
|
| 320 |
$(document).on( "change", "#fee_limit_amount_change", function() { |
| 321 |
if( "change" == $("input[name='fee_type']:checked").val() ) { |
| 322 |
var amount = parseInt($("#end_amount").html()); |
| 323 |
var limit = parseInt($("#fee_limit_amount_change").val()); |
| 324 |
if( amount >= limit ) { |
| 325 |
alert("<?php esc_attr_e( 'A value of the amount of upper limit is incorrect.', 'usces' ); ?>"+amount+' : '+limit); |
| 326 |
} |
| 327 |
} |
| 328 |
}); |
| 329 |
|
| 330 |
$(document).on( "change", "input[name^='fee_amounts']", function() { |
| 331 |
var rows = $("input[name^='fee_amounts']"); |
| 332 |
var cnt = $(rows).length; |
| 333 |
var end_amount = $("#end_amount"); |
| 334 |
var id = $(rows).index(this); |
| 335 |
if( id >= cnt - 1 ) { |
| 336 |
$(end_amount).html(parseInt($(rows).eq(id).val()) + 1); |
| 337 |
} else if( id < cnt - 1 ) { |
| 338 |
$("#amount_"+(id + 1)).html(parseInt($(rows).eq(id).val()) + 1); |
| 339 |
} |
| 340 |
}); |
| 341 |
|
| 342 |
$(document).on( "click", "#fee_add_row", function() { |
| 343 |
var rows = $("input[name^='fee_amounts']"); |
| 344 |
$(rows).unbind("change"); |
| 345 |
var first_amount = $("input[name='fee_first_amount']"); |
| 346 |
var first_fee = $("input[name='fee_first_fee']"); |
| 347 |
var end_amount = $("#end_amount"); |
| 348 |
var enf_fee = $("input[name='fee_end_fee']"); |
| 349 |
if( 0 == rows.length ) { |
| 350 |
amount = ( $(first_amount).val() == '' ) ? '' : parseInt($(first_amount).val()) + 1; |
| 351 |
} else if( 0 < rows.length ) { |
| 352 |
amount = ( $(rows).eq(rows.length-1).val() == '' ) ? '' : parseInt($(rows).eq(rows.length - 1).val()) + 1; |
| 353 |
} |
| 354 |
html = '<tr id="row_'+rows.length+'"><td class="cod_f"><span id="amount_'+rows.length+'">'+amount+'</span></td><td class="cod_m"><?php esc_html_e( ' - ', 'usces' ); ?></td><td class="cod_e"><input name="fee_amounts['+rows.length+']" type="text" class="short_str num" /></td><td class="cod_cod"><input name="fee_fees['+rows.length+']" type="text" class="short_str num" /></td></tr>'; |
| 355 |
$("#fee_change_field").append(html); |
| 356 |
rows = $("input[name^='fee_amounts']"); |
| 357 |
$(rows).bind( "change", function() { |
| 358 |
var cnt = $(rows).length - 1; |
| 359 |
var id = $(rows).index(this); |
| 360 |
if( id >= cnt ) { |
| 361 |
$(end_amount).html(parseInt($(rows).eq(id).val()) + 1); |
| 362 |
} else if( id < cnt ) { |
| 363 |
$("#amount_"+(id + 1)).html(parseInt($(rows).eq(id).val()) + 1); |
| 364 |
} |
| 365 |
}); |
| 366 |
}); |
| 367 |
|
| 368 |
$(document).on( "click", "#fee_del_row", function() { |
| 369 |
var rows = $("input[name^='fee_amounts']"); |
| 370 |
var first_amount = $("input[name='fee_first_amount']"); |
| 371 |
var end_amount = $("#end_amount"); |
| 372 |
var del_id = rows.length - 1; |
| 373 |
if( 0 < rows.length ) { |
| 374 |
$("#row_"+del_id).remove(); |
| 375 |
} |
| 376 |
rows = $("input[name^='fee_amounts']"); |
| 377 |
if( 0 == rows.length && $(first_amount).val() != "" ) { |
| 378 |
$(end_amount).html(parseInt($(first_amount).val()) + 1); |
| 379 |
} else if( 0 < rows.length && $(rows).eq(rows.length - 1).val() != "" ) { |
| 380 |
$(end_amount).html(parseInt($(rows).eq(rows.length - 1).val()) + 1); |
| 381 |
} |
| 382 |
}); |
| 383 |
|
| 384 |
adminSettlementEScott.setFeeType("conv",false); |
| 385 |
}); |
| 386 |
</script> |
| 387 |
<?php |
| 388 |
endif; |
| 389 |
break; |
| 390 |
endswitch; |
| 391 |
} |
| 392 |
|
| 393 |
/** |
| 394 |
* 決済オプション登録・更新 |
| 395 |
* usces_action_admin_settlement_update |
| 396 |
*/ |
| 397 |
public function settlement_update() { |
| 398 |
global $usces; |
| 399 |
|
| 400 |
if ( filter_input( INPUT_POST, 'acting', FILTER_DEFAULT ) !== $this->paymod_id ) { |
| 401 |
return; |
| 402 |
} |
| 403 |
|
| 404 |
$this->error_mes = ''; |
| 405 |
$options = get_option( 'usces', array() ); |
| 406 |
$payment_method = usces_get_system_option( 'usces_payment_method', 'settlement' ); |
| 407 |
$post_data = wp_unslash( $_POST ); |
| 408 |
|
| 409 |
unset( $options['acting_settings']['escott'] ); |
| 410 |
$options['acting_settings']['escott']['merchant_id'] = ( isset( $post_data['merchant_id'] ) ) ? trim( $post_data['merchant_id'] ) : ''; |
| 411 |
$options['acting_settings']['escott']['merchant_pass'] = ( isset( $post_data['merchant_pass'] ) ) ? trim( $post_data['merchant_pass'] ) : ''; |
| 412 |
$options['acting_settings']['escott']['tenant_id'] = ( isset( $post_data['tenant_id'] ) ) ? trim( $post_data['tenant_id'] ) : ''; |
| 413 |
$options['acting_settings']['escott']['ope'] = ( isset( $post_data['ope'] ) ) ? $post_data['ope'] : ''; |
| 414 |
$options['acting_settings']['escott']['card_activate'] = ( isset( $post_data['card_activate'] ) ) ? $post_data['card_activate'] : 'off'; |
| 415 |
$options['acting_settings']['escott']['card_key_aes'] = ( isset( $post_data['card_key_aes'] ) ) ? $post_data['card_key_aes'] : ''; |
| 416 |
$options['acting_settings']['escott']['card_key_iv'] = ( isset( $post_data['card_key_iv'] ) ) ? $post_data['card_key_iv'] : ''; |
| 417 |
$options['acting_settings']['escott']['seccd'] = ( isset( $post_data['seccd'] ) ) ? $post_data['seccd'] : 'on'; |
| 418 |
$options['acting_settings']['escott']['sec3d_activate'] = ( isset( $post_data['sec3d_activate'] ) ) ? $post_data['sec3d_activate'] : 'off'; |
| 419 |
$options['acting_settings']['escott']['token_code'] = ( isset( $post_data['token_code'] ) ) ? trim( $post_data['token_code'] ) : ''; |
| 420 |
$options['acting_settings']['escott']['quickpay'] = ( isset( $post_data['quickpay'] ) ) ? $post_data['quickpay'] : ''; |
| 421 |
$options['acting_settings']['escott']['chooseable_quickpay'] = ( isset( $post_data['chooseable_quickpay'] ) ) ? $post_data['chooseable_quickpay'] : 'on'; |
| 422 |
$options['acting_settings']['escott']['operateid'] = ( isset( $post_data['operateid'] ) ) ? $post_data['operateid'] : '1Gathering'; |
| 423 |
$options['acting_settings']['escott']['howtopay'] = ( isset( $post_data['howtopay'] ) ) ? $post_data['howtopay'] : ''; |
| 424 |
$options['acting_settings']['escott']['conv_activate'] = ( isset( $post_data['conv_activate'] ) ) ? $post_data['conv_activate'] : 'off'; |
| 425 |
$options['acting_settings']['escott']['conv_limit'] = ( ! empty( $post_data['conv_limit'] ) ) ? $post_data['conv_limit'] : '7'; |
| 426 |
$options['acting_settings']['escott']['conv_fee_type'] = ( isset( $post_data['conv_fee_type'] ) ) ? $post_data['conv_fee_type'] : ''; |
| 427 |
$options['acting_settings']['escott']['conv_fee'] = ( isset( $post_data['conv_fee'] ) ) ? $post_data['conv_fee'] : ''; |
| 428 |
$options['acting_settings']['escott']['conv_fee_limit_amount'] = ( isset( $post_data[ 'conv_fee_limit_amount_' . $options['acting_settings']['escott']['conv_fee_type'] ] ) ) ? $post_data[ 'conv_fee_limit_amount_' . $options['acting_settings']['escott']['conv_fee_type'] ] : ''; |
| 429 |
$options['acting_settings']['escott']['conv_fee_first_amount'] = ( isset( $post_data['conv_fee_first_amount'] ) ) ? $post_data['conv_fee_first_amount'] : ''; |
| 430 |
$options['acting_settings']['escott']['conv_fee_first_fee'] = ( isset( $post_data['conv_fee_first_fee'] ) ) ? $post_data['conv_fee_first_fee'] : ''; |
| 431 |
$options['acting_settings']['escott']['conv_fee_amounts'] = ( isset( $post_data['conv_fee_amounts'] ) ) ? explode( '|', $post_data['conv_fee_amounts'] ) : array(); |
| 432 |
$options['acting_settings']['escott']['conv_fee_fees'] = ( isset( $post_data['conv_fee_fees'] ) ) ? explode( '|', $post_data['conv_fee_fees'] ) : array(); |
| 433 |
$options['acting_settings']['escott']['conv_fee_end_fee'] = ( isset( $post_data['conv_fee_end_fee'] ) ) ? $post_data['conv_fee_end_fee'] : ''; |
| 434 |
|
| 435 |
if ( 'on' === $options['acting_settings']['escott']['card_activate'] || 'on' === $options['acting_settings']['escott']['conv_activate'] ) { |
| 436 |
$unavailable_activate = false; |
| 437 |
foreach ( $payment_method as $settlement => $payment ) { |
| 438 |
if ( in_array( $settlement, $this->unavailable_method, true ) && 'activate' === $payment['use'] ) { |
| 439 |
$unavailable_activate = true; |
| 440 |
break; |
| 441 |
} |
| 442 |
} |
| 443 |
if ( $unavailable_activate ) { |
| 444 |
$this->error_mes .= __( '* Settlement that can not be used together is activated.', 'usces' ) . '<br />'; |
| 445 |
} else { |
| 446 |
if ( WCUtils::is_blank( $post_data['merchant_id'] ) ) { |
| 447 |
$this->error_mes .= __( '* Please enter the Merchant ID.', 'usces' ) . '<br />'; |
| 448 |
} |
| 449 |
if ( WCUtils::is_blank( $post_data['merchant_pass'] ) ) { |
| 450 |
$this->error_mes .= __( '* Please enter the Merchant Password.', 'usces' ) . '<br />'; |
| 451 |
} |
| 452 |
if ( WCUtils::is_blank( $post_data['tenant_id'] ) ) { |
| 453 |
$this->error_mes .= __( '* Please enter the Tenant ID.', 'usces' ) . '<br />'; |
| 454 |
} |
| 455 |
if ( WCUtils::is_blank( $post_data['ope'] ) ) { |
| 456 |
$this->error_mes .= __( '* Please select the operating environment.', 'usces' ) . '<br />'; |
| 457 |
} |
| 458 |
if ( WCUtils::is_blank( $post_data['operateid'] ) ) { |
| 459 |
$this->error_mes .= __( '* Please select the processing classification.', 'usces' ) . '<br />'; |
| 460 |
} |
| 461 |
if ( 'on' === $options['acting_settings']['escott']['card_activate'] ) { |
| 462 |
if ( WCUtils::is_blank( $post_data['token_code'] ) ) { |
| 463 |
$this->error_mes .= __( '* Please enter the Token auth code.', 'usces' ) . '<br />'; |
| 464 |
} |
| 465 |
} |
| 466 |
} |
| 467 |
} |
| 468 |
|
| 469 |
if ( '' === $this->error_mes ) { |
| 470 |
$usces->action_status = 'success'; |
| 471 |
$usces->action_message = __( 'Options are updated.', 'usces' ); |
| 472 |
if ( 'on' === $options['acting_settings']['escott']['card_activate'] || 'on' === $options['acting_settings']['escott']['conv_activate'] ) { |
| 473 |
$options['acting_settings']['escott']['activate'] = 'on'; |
| 474 |
if ( 'public' === $options['acting_settings']['escott']['ope'] ) { |
| 475 |
$options['acting_settings']['escott']['send_url'] = 'https://www.e-scott.jp/online/aut/OAUT002.do'; |
| 476 |
$options['acting_settings']['escott']['send_url_member'] = 'https://www.e-scott.jp/online/crp/OCRP005.do'; |
| 477 |
$options['acting_settings']['escott']['send_url_conv'] = 'https://www.e-scott.jp/online/cnv/OCNV005.do'; |
| 478 |
$options['acting_settings']['escott']['redirect_url_conv'] = 'https://link.kessai.info/JLP/JLPcon'; |
| 479 |
$options['acting_settings']['escott']['api_token'] = 'https://www.e-scott.jp/euser/stn/CdGetJavaScript.do'; |
| 480 |
$options['acting_settings']['escott']['send_url_token'] = 'https://www.e-scott.jp/online/atn/OATN005.do'; |
| 481 |
$options['acting_settings']['escott']['send_url_3dsecure'] = 'https://www.e-scott.jp/online/tds/OTDS010.do'; |
| 482 |
} else { |
| 483 |
$options['acting_settings']['escott']['send_url'] = 'https://www.test.e-scott.jp/online/aut/OAUT002.do'; |
| 484 |
$options['acting_settings']['escott']['send_url_member'] = 'https://www.test.e-scott.jp/online/crp/OCRP005.do'; |
| 485 |
$options['acting_settings']['escott']['send_url_conv'] = 'https://www.test.e-scott.jp/online/cnv/OCNV005.do'; |
| 486 |
$options['acting_settings']['escott']['redirect_url_conv'] = 'https://link.kessai.info/JLPCT/JLPcon'; |
| 487 |
$options['acting_settings']['escott']['api_token'] = 'https://www.test.e-scott.jp/euser/stn/CdGetJavaScript.do'; |
| 488 |
$options['acting_settings']['escott']['send_url_token'] = 'https://www.test.e-scott.jp/online/atn/OATN005.do'; |
| 489 |
$options['acting_settings']['escott']['send_url_3dsecure'] = 'https://www.test.e-scott.jp/online/tds/OTDS010.do'; |
| 490 |
$options['acting_settings']['escott']['tenant_id'] = '0001'; |
| 491 |
} |
| 492 |
$toactive = array(); |
| 493 |
if ( 'on' === $options['acting_settings']['escott']['card_activate'] ) { |
| 494 |
if ( ! empty( $options['acting_settings']['escott']['token_code'] ) ) { |
| 495 |
$options['acting_settings']['escott']['card_activate'] = 'token'; |
| 496 |
} |
| 497 |
} |
| 498 |
if ( 'on' === $options['acting_settings']['escott']['card_activate'] || 'token' === $options['acting_settings']['escott']['card_activate'] ) { |
| 499 |
$usces->payment_structure['acting_escott_card'] = __( 'Credit card transaction (e-SCOTT)', 'usces' ); |
| 500 |
foreach ( $payment_method as $settlement => $payment ) { |
| 501 |
if ( 'acting_escott_card' === $settlement && 'deactivate' === $payment['use'] ) { |
| 502 |
$toactive[] = $payment['name']; |
| 503 |
} |
| 504 |
} |
| 505 |
} else { |
| 506 |
unset( $usces->payment_structure['acting_escott_card'] ); |
| 507 |
} |
| 508 |
if ( 'on' === $options['acting_settings']['escott']['conv_activate'] ) { |
| 509 |
$usces->payment_structure['acting_escott_conv'] = __( 'Online storage agency (e-SCOTT)', 'usces' ); |
| 510 |
foreach ( $payment_method as $settlement => $payment ) { |
| 511 |
if ( 'acting_escott_conv' === $settlement && 'deactivate' === $payment['use'] ) { |
| 512 |
$toactive[] = $payment['name']; |
| 513 |
} |
| 514 |
} |
| 515 |
} else { |
| 516 |
unset( $usces->payment_structure['acting_escott_conv'] ); |
| 517 |
} |
| 518 |
usces_admin_orderlist_show_wc_trans_id(); |
| 519 |
if ( 0 < count( $toactive ) ) { |
| 520 |
$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' ); |
| 521 |
} |
| 522 |
} else { |
| 523 |
$options['acting_settings']['escott']['activate'] = 'off'; |
| 524 |
unset( $usces->payment_structure['acting_escott_card'] ); |
| 525 |
unset( $usces->payment_structure['acting_escott_conv'] ); |
| 526 |
} |
| 527 |
$deactivate = array(); |
| 528 |
foreach ( $payment_method as $settlement => $payment ) { |
| 529 |
if ( ! array_key_exists( $settlement, $usces->payment_structure ) ) { |
| 530 |
if ( 'deactivate' !== $payment['use'] ) { |
| 531 |
$payment['use'] = 'deactivate'; |
| 532 |
$deactivate[] = $payment['name']; |
| 533 |
usces_update_system_option( 'usces_payment_method', $payment['id'], $payment ); |
| 534 |
} |
| 535 |
} |
| 536 |
} |
| 537 |
if ( 0 < count( $deactivate ) ) { |
| 538 |
$deactivate_message = sprintf( __( '"Deactivate" %s of payment method.', 'usces' ), implode( ',', $deactivate ) ); |
| 539 |
$usces->action_message .= $deactivate_message; |
| 540 |
} |
| 541 |
} else { |
| 542 |
$usces->action_status = 'error'; |
| 543 |
$usces->action_message = __( 'Data have deficiency.', 'usces' ); |
| 544 |
$options['acting_settings']['escott']['activate'] = 'off'; |
| 545 |
unset( $usces->payment_structure['acting_escott_card'] ); |
| 546 |
unset( $usces->payment_structure['acting_escott_conv'] ); |
| 547 |
$deactivate = array(); |
| 548 |
foreach ( $payment_method as $settlement => $payment ) { |
| 549 |
if ( in_array( $settlement, $this->pay_method, true ) ) { |
| 550 |
if ( 'deactivate' !== $payment['use'] ) { |
| 551 |
$payment['use'] = 'deactivate'; |
| 552 |
$deactivate[] = $payment['name']; |
| 553 |
usces_update_system_option( 'usces_payment_method', $payment['id'], $payment ); |
| 554 |
} |
| 555 |
} |
| 556 |
} |
| 557 |
if ( 0 < count( $deactivate ) ) { |
| 558 |
$deactivate_message = sprintf( __( '"Deactivate" %s of payment method.', 'usces' ), implode( ',', $deactivate ) ); |
| 559 |
$usces->action_message .= $deactivate_message . __( 'Please complete the setup and update the payment method to "Activate".', 'usces' ); |
| 560 |
} |
| 561 |
} |
| 562 |
ksort( $usces->payment_structure ); |
| 563 |
update_option( 'usces', $options ); |
| 564 |
update_option( 'usces_payment_structure', $usces->payment_structure ); |
| 565 |
} |
| 566 |
|
| 567 |
/** |
| 568 |
* クレジット決済設定画面フォーム |
| 569 |
* usces_action_settlement_tab_body |
| 570 |
*/ |
| 571 |
public function settlement_tab_body() { |
| 572 |
|
| 573 |
$acting_opts = $this->get_acting_settings(); |
| 574 |
$settlement_selected = get_option( 'usces_settlement_selected', array() ); |
| 575 |
if ( in_array( $this->paymod_id, $settlement_selected, true ) ) : |
| 576 |
$ope = ( isset( $acting_opts['ope'] ) && 'public' === $acting_opts['ope'] ) ? 'public' : 'test'; |
| 577 |
$card_activate = ( isset( $acting_opts['card_activate'] ) && ( 'on' === $acting_opts['card_activate'] || 'token' === $acting_opts['card_activate'] ) ) ? 'on' : 'off'; |
| 578 |
$sec3d_activate = ( isset( $acting_opts['sec3d_activate'] ) && 'on' === $acting_opts['sec3d_activate'] ) ? 'on' : 'off'; |
| 579 |
$seccd = ( isset( $acting_opts['seccd'] ) && 'on' === $acting_opts['seccd'] ) ? 'on' : 'off'; |
| 580 |
$quickpay = ( isset( $acting_opts['quickpay'] ) && 'on' === $acting_opts['quickpay'] ) ? 'on' : 'off'; |
| 581 |
$chooseable_quickpay = ( isset( $acting_opts['chooseable_quickpay'] ) && 'on' === $acting_opts['chooseable_quickpay'] ) ? 'on' : 'off'; |
| 582 |
$operateid = ( isset( $acting_opts['operateid'] ) ) ? $acting_opts['operateid'] : '1Gathering'; |
| 583 |
$howtopay = ( isset( $acting_opts['howtopay'] ) ) ? $acting_opts['howtopay'] : '1'; |
| 584 |
$conv_activate = ( isset( $acting_opts['conv_activate'] ) && 'on' === $acting_opts['conv_activate'] ) ? 'on' : 'off'; |
| 585 |
?> |
| 586 |
<div id="uscestabs_escott"> |
| 587 |
<div class="settlement_service"><span class="service_title"><?php esc_html_e( $this->acting_formal_name, 'usces' ); ?></span></div> |
| 588 |
<?php |
| 589 |
if ( filter_input( INPUT_POST, 'acting', FILTER_DEFAULT ) === $this->paymod_id ) : |
| 590 |
if ( '' !== $this->error_mes ) : |
| 591 |
?> |
| 592 |
<div class="error_message"><?php wel_esc_script_e( $this->error_mes ); ?></div> |
| 593 |
<?php |
| 594 |
elseif ( isset( $acting_opts['activate'] ) && 'on' === $acting_opts['activate'] ) : |
| 595 |
?> |
| 596 |
<div class="message"><?php esc_html_e( 'Test thoroughly before use.', 'usces' ); ?></div> |
| 597 |
<?php |
| 598 |
endif; |
| 599 |
endif; |
| 600 |
?> |
| 601 |
<form action="" method="post" name="escott_form" id="escott_form"> |
| 602 |
<table class="settle_table"> |
| 603 |
<tr> |
| 604 |
<th><a class="explanation-label" id="label_ex_merchant_id_escott"><?php esc_html_e( 'Merchant ID', 'usces' ); /* マーチャントID */ ?></a></th> |
| 605 |
<td><input name="merchant_id" type="text" id="merchant_id_escott" value="<?php echo esc_attr( $acting_opts['merchant_id'] ); ?>" class="regular-text" /></td> |
| 606 |
</tr> |
| 607 |
<tr id="ex_merchant_id_escott" class="explanation"><td colspan="2"><?php esc_html_e( 'Merchant ID (single-byte numbers only) issued from e-SCOTT.', 'usces' ); ?></td></tr> |
| 608 |
<tr> |
| 609 |
<th><a class="explanation-label" id="label_ex_merchant_pass_escott"><?php esc_html_e( 'Merchant Password', 'usces' ); /* マーチャントパスワード */ ?></a></th> |
| 610 |
<td><input name="merchant_pass" type="text" id="merchant_pass_escott" value="<?php echo esc_attr( $acting_opts['merchant_pass'] ); ?>" class="regular-text" /></td> |
| 611 |
</tr> |
| 612 |
<tr id="ex_merchant_pass_escott" class="explanation"><td colspan="2"><?php esc_html_e( 'Merchant Password (single-byte alphanumeric characters only) issued from e-SCOTT.', 'usces' ); ?></td></tr> |
| 613 |
<tr> |
| 614 |
<th><a class="explanation-label" id="label_ex_tenant_id_escott"><?php esc_html_e( 'Tenant ID', 'usces' ); /* 店舗コード */ ?></a></th> |
| 615 |
<td><input name="tenant_id" type="text" id="tenant_id_escott" value="<?php echo esc_attr( $acting_opts['tenant_id'] ); ?>" class="regular-text" /></td> |
| 616 |
</tr> |
| 617 |
<tr id="ex_tenant_id_escott" class="explanation"><td colspan="2"><?php echo wp_kses_post( __( 'Tenant ID issued from e-SCOTT.<br />If you have only one shop to contract, enter 0001.', 'usces' ) ); ?></td></tr> |
| 618 |
<tr> |
| 619 |
<th><a class="explanation-label" id="label_ex_ope_escott"><?php esc_html_e( 'Operation Environment', 'usces' ); /* 動作環境 */ ?></a></th> |
| 620 |
<td><label><input name="ope" type="radio" id="ope_escott_1" value="test"<?php checked( $ope, 'test' ); ?> /><span><?php esc_html_e( 'Testing environment', 'usces' ); ?></span></label><br /> |
| 621 |
<label><input name="ope" type="radio" id="ope_escott_2" value="public"<?php checked( $ope, 'public' ); ?> /><span><?php esc_html_e( 'Production environment', 'usces' ); ?></span></label> |
| 622 |
</td> |
| 623 |
</tr> |
| 624 |
<tr id="ex_ope_escott" class="explanation"><td colspan="2"><?php esc_html_e( 'Switch the operating environment.', 'usces' ); ?></td></tr> |
| 625 |
</table> |
| 626 |
<table class="settle_table"> |
| 627 |
<tr> |
| 628 |
<th><?php esc_html_e( 'Credit card settlement', 'usces' ); /* クレジットカード決済 */ ?></th> |
| 629 |
<td><label><input name="card_activate" type="radio" class="card_activate_escott" id="card_activate_escott_1" value="on"<?php checked( $card_activate, 'on' ); ?> /><span><?php esc_html_e( 'Use', 'usces' ); ?></span></label><br /> |
| 630 |
<label><input name="card_activate" type="radio" class="card_activate_escott" id="card_activate_escott_0" value="off"<?php checked( $card_activate, 'off' ); ?> /><span><?php esc_html_e( 'Do not Use', 'usces' ); ?></span></label> |
| 631 |
</td> |
| 632 |
</tr> |
| 633 |
<tr class="card_escott"> |
| 634 |
<th><a class="explanation-label" id="label_ex_sec3d_activate"><?php esc_html_e( '3D Secure', 'usces' ); /* 3Dセキュア */ ?></a></th> |
| 635 |
<td><label><input name="sec3d_activate" type="radio" class="sec3d_activate_escott" id="sec3d_activate_1" value="on"<?php checked( $sec3d_activate, 'on' ); ?> /><span><?php esc_html_e( 'Use', 'usces' ); ?></span></label><br /> |
| 636 |
<label><input name="sec3d_activate" type="radio" class="sec3d_activate_escott" id="sec3d_activate_0" value="off"<?php checked( $sec3d_activate, 'off' ); ?> /><span><?php esc_html_e( 'Do not Use', 'usces' ); ?></span></label> |
| 637 |
</td> |
| 638 |
</tr> |
| 639 |
<tr id="ex_sec3d_activate" class="explanation card_escott"><td colspan="2"><?php esc_html_e( '3D secure authentication at the time of payment. If you want to use it, you need to apply to SP.LINKS Inc.', 'usces' ); ?></td></tr> |
| 640 |
<tr class="card_escott card_sec3d_escott"> |
| 641 |
<th><a class="explanation-label" id="label_ex_card_key_aes_escott"><?php esc_html_e( 'Encryption Key', 'usces' ); /* 暗号化キー */ ?></a></th> |
| 642 |
<td><input name="card_key_aes" type="text" id="card_key_aes_escott" value="<?php echo esc_attr( $acting_opts['card_key_aes'] ); ?>" class="regular-text" /></td> |
| 643 |
</tr> |
| 644 |
<tr id="ex_card_key_aes_escott" class="explanation card_escott card_sec3d_escott"><td colspan="2"><?php esc_html_e( 'Encryption key (single-byte alphanumeric characters only) issued by e-SCOTT.', 'usces' ); ?><?php esc_html_e( 'If you want to use 3D Secure Authentication, please apply to SP.LINKS Inc.', 'usces' ); ?></td></tr> |
| 645 |
<tr class="card_escott card_sec3d_escott"> |
| 646 |
<th><a class="explanation-label" id="label_ex_card_key_iv_escott"><?php esc_html_e( 'Initialization Vector', 'usces' ); /* 初期化ベクトル */ ?></a></th> |
| 647 |
<td><input name="card_key_iv" type="text" id="card_key_iv_escott" value="<?php echo esc_attr( $acting_opts['card_key_iv'] ); ?>" class="regular-text" /></td> |
| 648 |
</tr> |
| 649 |
<tr id="ex_card_key_iv_escott" class="explanation card_escott card_sec3d_escott"><td colspan="2"><?php esc_html_e( 'Initialization vector (single-byte alphanumeric characters only) issued by e-SCOTT.', 'usces' ); ?><?php esc_html_e( 'If you want to use 3D Secure Authentication, please apply to SP.LINKS Inc.', 'usces' ); ?></td></tr> |
| 650 |
<tr class="card_escott"> |
| 651 |
<th><a class="explanation-label" id="label_ex_token_code_escott"><?php esc_html_e( 'Token auth code', 'usces' ); /* トークン決済認証コード */ ?></a></th> |
| 652 |
<td><input name="token_code" type="text" id="token_code_escott" value="<?php echo esc_attr( $acting_opts['token_code'] ); ?>" class="regular-text" maxlength="32" /></td> |
| 653 |
</tr> |
| 654 |
<tr id="ex_token_code_escott" class="explanation card_escott"><td colspan="2"><?php esc_html_e( 'Token auth code (single-byte alphanumeric characters only) issued from e-SCOTT.', 'usces' ); ?></td></tr> |
| 655 |
<tr class="card_escott"> |
| 656 |
<th><a class="explanation-label" id="label_ex_seccd_escott"><?php echo wp_kses_post( __( 'Security code <br /> (authentication assist)', 'usces' ) ); /* セキュリティコード */ ?></a></th> |
| 657 |
<td><label><input name="seccd" type="radio" id="seccd_escott_1" value="on"<?php checked( $seccd, 'on' ); ?> /><span><?php esc_html_e( 'Use', 'usces' ); ?></span></label><br /> |
| 658 |
<label><input name="seccd" type="radio" id="seccd_escott_0" value="off"<?php checked( $seccd, 'off' ); ?> /><span><?php esc_html_e( 'Do not Use', 'usces' ); ?></span></label> |
| 659 |
</td> |
| 660 |
</tr> |
| 661 |
<tr id="ex_seccd_escott" class="explanation card_escott"><td colspan="2"><?php esc_html_e( "Use 'Security code' of authentication assist matching. If you decide not to use, please also set 'Do not verify matching' on the e-SCOTT management screen.", 'usces' ); ?></td></tr> |
| 662 |
<tr class="card_escott"> |
| 663 |
<th><a class="explanation-label" id="label_ex_quickpay_escott"><?php esc_html_e( 'Quick payment', 'usces' ); /* クイック決済 */ ?></a></th> |
| 664 |
<td><label><input name="quickpay" type="radio" class="quickpay_escott" id="quickpay_escott_1" value="on"<?php checked( $quickpay, 'on' ); ?> /><span><?php esc_html_e( 'Use', 'usces' ); ?></span></label><br /> |
| 665 |
<label><input name="quickpay" type="radio" class="quickpay_escott" id="quickpay_escott_0" value="off"<?php checked( $quickpay, 'off' ); ?> /><span><?php esc_html_e( 'Do not Use', 'usces' ); ?></span></label> |
| 666 |
</td> |
| 667 |
</tr> |
| 668 |
<tr id="ex_quickpay_escott" class="explanation card_escott"><td colspan="2"><?php esc_html_e( 'Members can pay with saved card. Card number will be registered in e-SCOTT Smart system.', 'usces' ); ?></td></tr> |
| 669 |
<tr class="card_chooseable_quickpay_escott"> |
| 670 |
<th><a class="explanation-label" id="label_ex_chooseable_quickpay_escott"><?php esc_html_e( 'Register credit card', 'usces' ); /* クレジットカードの登録 */ ?></a></th> |
| 671 |
<td><label><input name="chooseable_quickpay" type="radio" class="chooseable_quickpay_escott" id="chooseable_quickpay_escott_1" value="on"<?php checked( $chooseable_quickpay, 'on' ); ?> /><span><?php esc_html_e( 'Member chooses', 'usces' ); ?></span></label><br /> |
| 672 |
<label><input name="chooseable_quickpay" type="radio" class="chooseable_quickpay_escott" id="chooseable_quickpay_escott_0" value="off"<?php checked( $chooseable_quickpay, 'off' ); ?> /><span><?php esc_html_e( 'Always register', 'usces' ); ?></span></label> |
| 673 |
</td> |
| 674 |
</tr> |
| 675 |
<tr id="ex_chooseable_quickpay_escott" class="explanation card_chooseable_quickpay_escott"><td colspan="2"><?php esc_html_e( "In case of 'Always register', 'Register and purchase credit card' will not be displayed when purchasing with credit card.", 'usces' ); ?></td></tr> |
| 676 |
<tr class="card_escott"> |
| 677 |
<th><a class="explanation-label" id="label_ex_operateid_escott"><?php esc_html_e( 'Processing classification', 'usces' ); /* 処理区分 */ ?></a></th> |
| 678 |
<td><label><input name="operateid" type="radio" id="operateid_escott_1" value="1Auth"<?php checked( $operateid, '1Auth' ); ?> /><span><?php esc_html_e( 'Credit', 'usces' ); /* 与信 */ ?></span></label><br /> |
| 679 |
<label><input name="operateid" type="radio" id="operateid_escott_2" value="1Gathering"<?php checked( $operateid, '1Gathering' ); ?> /><span><?php esc_html_e( 'Credit sales', 'usces' ); /* 与信売上計上 */ ?></span></label> |
| 680 |
</td> |
| 681 |
</tr> |
| 682 |
<tr id="ex_operateid_escott" class="explanation card_escott"><td colspan="2"><?php esc_html_e( "In case of 'Credit' setting, it need to change to 'Sales recorded' manually in later. In case of 'Credit sales recorded' setting, sales will be recorded at the time of purchase.", 'usces' ); ?></td></tr> |
| 683 |
<tr class="card_howtopay_escott"> |
| 684 |
<th><?php esc_html_e( 'Number of payments', 'usces' ); /* 支払回数 */ ?></th> |
| 685 |
<td><label><input name="howtopay" type="radio" id="howtopay_escott_1" value="1"<?php checked( $howtopay, '1' ); ?> /><span><?php esc_html_e( 'Lump-sum payment only', 'usces' ); /* 一括払いのみ */ ?></span></label><br /> |
| 686 |
<label><input name="howtopay" type="radio" id="howtopay_escott_2" value="2"<?php checked( $howtopay, '2' ); ?> /><span><?php esc_html_e( 'Activate installment payment', 'usces' ); /* 分割払いを有効にする */ ?></span></label><br /> |
| 687 |
<label><input name="howtopay" type="radio" id="howtopay_escott_3" value="3"<?php checked( $howtopay, '3' ); ?> /><span><?php esc_html_e( 'Activate installment payments and bonus payments', 'usces' ); /* 分割払いとボーナス払いを有効にする */ ?></span></label> |
| 688 |
</td> |
| 689 |
</tr> |
| 690 |
</table> |
| 691 |
<table class="settle_table"> |
| 692 |
<tr> |
| 693 |
<th><?php esc_html_e( 'Online storage agency', 'usces' ); /* オンライン収納代行 */ ?></th> |
| 694 |
<td><label><input name="conv_activate" type="radio" class="conv_activate_escott" id="conv_activate_escott_1" value="on"<?php checked( $conv_activate, 'on' ); ?> /><span><?php esc_html_e( 'Use', 'usces' ); ?></span></label><br /> |
| 695 |
<label><input name="conv_activate" type="radio" class="conv_activate_escott" id="conv_activate_escott_0" value="off"<?php checked( $conv_activate, 'off' ); ?> /><span><?php esc_html_e( 'Do not Use', 'usces' ); ?></span></label> |
| 696 |
</td> |
| 697 |
</tr> |
| 698 |
<tr class="conv_escott"> |
| 699 |
<th><?php esc_html_e( 'Payment due days', 'usces' ); /* 支払期限日数 */ ?></th> |
| 700 |
<td><input name="conv_limit" type="text" id="conv_limit" value="<?php echo esc_attr( $acting_opts['conv_limit'] ); ?>" class="small-text" /><?php esc_html_e( 'days', 'usces' ); ?></td> |
| 701 |
</tr> |
| 702 |
<tr class="conv_escott"> |
| 703 |
<th><a class="explanation-label" id="label_ex_conv_fee_escott"><?php esc_html_e( 'Fee', 'usces' ); /* 手数料 */ ?></a></th> |
| 704 |
<td><span id="conv_fee_type_field" class="fee_type_field"><?php echo esc_html( $this->get_fee_name( $acting_opts['conv_fee_type'] ) ); ?></span><input type="button" class="button" value="<?php esc_attr_e( 'Detailed setting', 'usces' ); ?>" id="conv_fee_setting" /></td> |
| 705 |
</tr> |
| 706 |
<tr id="ex_conv_fee_escott" class="explanation conv_escott"><td colspan="2"><?php esc_html_e( 'Set the online storage agency commission and settlement upper limit. Leave it blank if you do not need it.', 'usces' ); ?></td></tr> |
| 707 |
</table> |
| 708 |
<input type="hidden" name="acting" value="escott" /> |
| 709 |
<input type="hidden" name="conv_fee_type" id="conv_fee_type" value="<?php echo esc_attr( $acting_opts['conv_fee_type'] ); ?>" /> |
| 710 |
<input type="hidden" name="conv_fee" id="conv_fee" value="<?php echo esc_attr( $acting_opts['conv_fee'] ); ?>" /> |
| 711 |
<input type="hidden" name="conv_fee_limit_amount_fix" id="conv_fee_limit_amount_fix" value="<?php echo esc_attr( $acting_opts['conv_fee_limit_amount'] ); ?>" /> |
| 712 |
<input type="hidden" name="conv_fee_first_amount" id="conv_fee_first_amount" value="<?php echo esc_attr( $acting_opts['conv_fee_first_amount'] ); ?>" /> |
| 713 |
<input type="hidden" name="conv_fee_first_fee" id="conv_fee_first_fee" value="<?php echo esc_attr( $acting_opts['conv_fee_first_fee'] ); ?>" /> |
| 714 |
<input type="hidden" name="conv_fee_limit_amount_change" id="conv_fee_limit_amount_change" value="<?php echo esc_attr( $acting_opts['conv_fee_limit_amount'] ); ?>" /> |
| 715 |
<input type="hidden" name="conv_fee_amounts" id="conv_fee_amounts" value="<?php echo esc_attr( implode( '|', $acting_opts['conv_fee_amounts'] ) ); ?>" /> |
| 716 |
<input type="hidden" name="conv_fee_fees" id="conv_fee_fees" value="<?php echo esc_attr( implode( '|', $acting_opts['conv_fee_fees'] ) ); ?>" /> |
| 717 |
<input type="hidden" name="conv_fee_end_fee" id="conv_fee_end_fee" value="<?php echo esc_attr( $acting_opts['conv_fee_end_fee'] ); ?>" /> |
| 718 |
<input name="usces_option_update" type="submit" class="button button-primary" value="<?php esc_attr_e( 'Update e-SCOTT settings', 'usces' ); ?>" /> |
| 719 |
<?php wp_nonce_field( 'admin_settlement', 'wc_nonce' ); ?> |
| 720 |
</form> |
| 721 |
<div class="settle_exp"> |
| 722 |
<p><strong><?php esc_html_e( $this->acting_formal_name, 'usces' ); ?></strong></p> |
| 723 |
<a href="<?php echo esc_url( $this->acting_company_url ); ?>" target="_blank"><?php esc_html_e( 'Details of e-SCOTT Smart is here >>', 'usces' ); ?></a> |
| 724 |
<p> </p> |
| 725 |
<p><?php esc_html_e( "This settlement is an 'Non-passage type' settlement system.", 'usces' ); ?><br /> |
| 726 |
<?php esc_html_e( "'Non-passage type' is a settlement system that completes with shop site only, without transitioning to the page of the settlement company.", 'usces' ); ?><br /> |
| 727 |
<?php esc_html_e( 'Stylish with unified design is possible. However, because we will handle the card number, dedicated SSL is required.', 'usces' ); ?></p> |
| 728 |
<p><?php esc_html_e( 'In both types, the entered card number will be sent to the e-SCOTT Smart system, so it will not be saved in Welcart.', 'usces' ); ?></p> |
| 729 |
<p><?php esc_html_e( 'In addition, in the production environment, it is SSL communication with only an authorized SSL certificate, so it is necessary to be careful.', 'usces' ); ?></p> |
| 730 |
<p><?php esc_html_e( 'The Welcart member account used in the test environment may not be available in the production environment.', 'usces' ); ?><br /> |
| 731 |
<?php esc_html_e( 'Please make another member registration in the test environment and production environment, or delete the member used in the test environment once and register again in the production environment.', 'usces' ); ?></p> |
| 732 |
<p><strong><?php esc_html_e( '[About 3D Secure]', 'usces' ); ?></strong><br /> |
| 733 |
<?php esc_html_e( 'If you do not use 3D Secure (do not check the "Use" box), the merchant is responsible for payment due to fraudulent use of the credit card.', 'usces' ); ?><br /> |
| 734 |
<?php esc_html_e( 'Even if we have already paid the merchant an amount equivalent to the sales proceeds, the merchant must return the amount to us upon request for a chargeback (return of sales proceeds) from the credit card company.', 'usces' ); ?><br /> |
| 735 |
<?php esc_html_e( 'Please note that chargebacks may occur even if you select "Use". Please understand this in advance.', 'usces' ); ?><br /> |
| 736 |
<?php esc_html_e( 'If you have applied for the EMV 3D Secure service, please be sure to select "Use".', 'usces' ); ?></p> |
| 737 |
<p><strong><?php esc_html_e( '[Note on chargebacks]', 'usces' ); ?></strong><br /> |
| 738 |
<?php esc_html_e( '* Even if sales approval has been obtained (when the authorization result is OK), chargebacks will still be incurred.', 'usces' ); ?><br /> |
| 739 |
<?php esc_html_e( '* If chargebacks occur, there is no compensation or reimbursement by us or the credit card companies. The merchant is responsible for all charges.', 'usces' ); ?><br /> |
| 740 |
<?php esc_html_e( "* Chargebacks will be incurred regardless of whether the merchant's intentional or negligent conduct is involved.", 'usces' ); ?><br /> |
| 741 |
<?php esc_html_e( 'Please be sure to confirm the following before starting to use the service.', 'usces' ); ?><br /> |
| 742 |
<a href="https://www.splinks.co.jp/yougo/chargeback.html" target="_blank"><?php esc_html_e( 'About chargebacks', 'usces' ); ?></a></p> |
| 743 |
</div> |
| 744 |
</div><!--uscestabs_escott--> |
| 745 |
|
| 746 |
<div id="escott_fee_dialog" class="cod_dialog"> |
| 747 |
<fieldset> |
| 748 |
<table id="escott_fee_type_table" class="cod_type_table"> |
| 749 |
<tr> |
| 750 |
<th><?php esc_html_e( 'Type of the fee', 'usces' ); ?></th> |
| 751 |
<td class="radio"><input name="fee_type" type="radio" id="fee_type_fix" class="fee_type" value="fix" /></td><td><label for="fee_type_fix"><?php esc_html_e( 'Fixation', 'usces' ); ?></label></td> |
| 752 |
<td class="radio"><input name="fee_type" type="radio" id="fee_type_change" class="fee_type" value="change" /></td><td><label for="fee_type_change"><?php esc_html_e( 'Variable', 'usces' ); ?></label></td> |
| 753 |
</tr> |
| 754 |
</table> |
| 755 |
<table id="escott_fee_fix_table" class="cod_fix_table"> |
| 756 |
<tr> |
| 757 |
<th><?php esc_html_e( 'Fee', 'usces' ); ?></th> |
| 758 |
<td><input name="fee" type="text" id="fee_fix" class="short_str num" /><?php usces_crcode(); ?></td> |
| 759 |
</tr> |
| 760 |
<tr> |
| 761 |
<th><?php esc_html_e( 'Upper limit', 'usces' ); ?></th> |
| 762 |
<td><input name="fee_limit_amount_fix" type="text" id="fee_limit_amount_fix" class="short_str num" /><?php usces_crcode(); ?></td> |
| 763 |
</tr> |
| 764 |
</table> |
| 765 |
<div id="escott_fee_change_table" class="cod_change_table"> |
| 766 |
<input type="button" class="button" id="fee_add_row" value="<?php esc_attr_e( 'Add row', 'usces' ); ?>" /> |
| 767 |
<input type="button" class="button" id="fee_del_row" value="<?php esc_attr_e( 'Delete row', 'usces' ); ?>" /> |
| 768 |
<table> |
| 769 |
<thead> |
| 770 |
<tr> |
| 771 |
<th colspan="3"><?php esc_html_e( 'A purchase amount', 'usces' ); ?>(<?php usces_crcode(); ?>)</th> |
| 772 |
<th><?php esc_html_e( 'Fee', 'usces' ); ?>(<?php usces_crcode(); ?>)</th> |
| 773 |
</tr> |
| 774 |
<tr> |
| 775 |
<td class="cod_f">0</td> |
| 776 |
<td class="cod_m"><?php esc_html_e( ' - ', 'usces' ); ?></td> |
| 777 |
<td class="cod_e"><input name="fee_first_amount" id="fee_first_amount" type="text" class="short_str num" /></td> |
| 778 |
<td class="cod_cod"><input name="fee_first_fee" id="fee_first_fee" type="text" class="short_str num" /></td> |
| 779 |
</tr> |
| 780 |
</thead> |
| 781 |
<tbody id="fee_change_field"></tbody> |
| 782 |
<tfoot> |
| 783 |
<tr> |
| 784 |
<td class="cod_f"><span id="end_amount"></span></td> |
| 785 |
<td class="cod_m"><?php esc_html_e( ' - ', 'usces' ); ?></td> |
| 786 |
<td class="cod_e"><input name="fee_limit_amount_change" type="text" id="fee_limit_amount_change" class="short_str num" /></td> |
| 787 |
<td class="cod_cod"><input name="fee_end_fee" type="text" id="fee_end_fee" class="short_str num" /></td> |
| 788 |
</tr> |
| 789 |
</tfoot> |
| 790 |
</table> |
| 791 |
</div> |
| 792 |
</fieldset> |
| 793 |
<input type="hidden" id="escott_fee_mode"> |
| 794 |
</div><!--escott_fee_dialog--> |
| 795 |
<?php |
| 796 |
endif; |
| 797 |
} |
| 798 |
|
| 799 |
/** |
| 800 |
* � |
| 801 |
�金通知処理 |
| 802 |
* usces_after_cart_instant |
| 803 |
*/ |
| 804 |
public function acting_transaction() { |
| 805 |
global $usces; |
| 806 |
|
| 807 |
if ( isset( $_REQUEST['MerchantFree1'] ) && isset( $_REQUEST['MerchantId'] ) && isset( $_REQUEST['TransactionId'] ) && isset( $_REQUEST['RecvNum'] ) && isset( $_REQUEST['NyukinDate'] ) && |
| 808 |
( isset( $_REQUEST['MerchantFree2'] ) && $this->acting_flg_conv === wp_unslash( $_REQUEST['MerchantFree2'] ) ) ) { |
| 809 |
$this->acting_notice_ip_guard( wp_unslash( $_REQUEST ) ); |
| 810 |
$acting_opts = $this->get_acting_settings(); |
| 811 |
if ( $acting_opts['merchant_id'] === wp_unslash( $_REQUEST['MerchantId'] ) ) { |
| 812 |
$response_data = wp_unslash( $_REQUEST ); |
| 813 |
$order_id = usces_get_order_id_by_trans_id( $response_data['MerchantFree1'] ); |
| 814 |
if ( ! empty( $order_id ) ) { |
| 815 |
|
| 816 |
/* オーダーステータス変更 */ |
| 817 |
usces_change_order_receipt( $order_id, 'receipted' ); |
| 818 |
/* ポイント付与 */ |
| 819 |
usces_action_acting_getpoint( $order_id ); |
| 820 |
|
| 821 |
$response_data['OperateId'] = 'receipted'; |
| 822 |
$order_meta = usces_unserialize( $usces->get_order_meta_value( $response_data['MerchantFree2'], $order_id ) ); |
| 823 |
$meta_value = array_merge( $order_meta, $response_data ); |
| 824 |
$usces->set_order_meta_value( $response_data['MerchantFree2'], usces_serialize( $meta_value ), $order_id ); |
| 825 |
usces_log( '[' . $this->acting_name . '] conv receipted : ' . print_r( $response_data, true ), 'acting_transaction.log' ); |
| 826 |
} else { |
| 827 |
usces_log( '[' . $this->acting_name . '] conv receipted order_id error : '.print_r( $response_data, true ), 'acting_transaction.log' ); |
| 828 |
} |
| 829 |
} |
| 830 |
header( "HTTP/1.0 200 OK" ); |
| 831 |
die(); |
| 832 |
} |
| 833 |
} |
| 834 |
|
| 835 |
/** |
| 836 |
* 受注編集画面に表示する決済� |
| 837 |
報の値整形 |
| 838 |
* usces_filter_settle_info_field_value |
| 839 |
* |
| 840 |
* @param string $value Value. |
| 841 |
* @param string $key Key. |
| 842 |
* @param string $acting Acting type. |
| 843 |
* @return string |
| 844 |
*/ |
| 845 |
public function settlement_info_field_value( $value, $key, $acting ) { |
| 846 |
if ( 'escott_card' !== $acting && 'escott_conv' !== $acting ) { |
| 847 |
return $value; |
| 848 |
} |
| 849 |
|
| 850 |
switch ( $key ) { |
| 851 |
case 'acting': |
| 852 |
switch ( $value ) { |
| 853 |
case 'escott_card': |
| 854 |
$value = __( 'e-SCOTT - Credit card transaction', 'usces' ); |
| 855 |
break; |
| 856 |
case 'escott_conv': |
| 857 |
$value = __( 'e-SCOTT - Online storage agency', 'usces' ); |
| 858 |
break; |
| 859 |
} |
| 860 |
break; |
| 861 |
} |
| 862 |
|
| 863 |
$value = parent::settlement_info_field_value( $value, $key, $acting ); |
| 864 |
|
| 865 |
return $value; |
| 866 |
} |
| 867 |
} |
| 868 |
|