acting_name = 'DSK';
$this->acting_formal_name = 'DSK 電算システム';
$this->acting_card = 'dsk_card';
$this->acting_conv = 'dsk_conv';
$this->acting_payeasy = 'dsk_payeasy';
$this->acting_wallet = 'dsk_wallet';
$this->acting_mobile = 'dsk_mobile';
$this->acting_flg_card = 'acting_dsk_card';
$this->acting_flg_conv = 'acting_dsk_conv';
$this->acting_flg_payeasy = 'acting_dsk_payeasy';
$this->acting_flg_wallet = 'acting_dsk_wallet';
$this->acting_flg_mobile = 'acting_dsk_mobile';
$this->pay_method = array(
'acting_dsk_card',
'acting_dsk_conv',
'acting_dsk_payeasy',
);
parent::__construct( 'dsk' );
$this->initialize_data();
}
/**
* Return an instance of this class.
*/
public static function get_instance() {
if ( is_null( self::$instance ) ) {
self::$instance = new self();
}
return self::$instance;
}
/**
* Initialize
*/
public function initialize_data() {
$options = get_option( 'usces', array() );
$options['acting_settings']['dsk']['merchant_id'] = ( isset( $options['acting_settings']['dsk']['merchant_id'] ) ) ? $options['acting_settings']['dsk']['merchant_id'] : '';
$options['acting_settings']['dsk']['service_id'] = ( isset( $options['acting_settings']['dsk']['service_id'] ) ) ? $options['acting_settings']['dsk']['service_id'] : '';
$options['acting_settings']['dsk']['hash_key'] = ( isset( $options['acting_settings']['dsk']['hash_key'] ) ) ? $options['acting_settings']['dsk']['hash_key'] : '';
$options['acting_settings']['dsk']['ope'] = ( isset( $options['acting_settings']['dsk']['ope'] ) ) ? $options['acting_settings']['dsk']['ope'] : '';
$options['acting_settings']['dsk']['card_activate'] = ( isset( $options['acting_settings']['dsk']['card_activate'] ) ) ? $options['acting_settings']['dsk']['card_activate'] : 'off';
$options['acting_settings']['dsk']['3d_secure'] = ( isset( $options['acting_settings']['dsk']['3d_secure'] ) ) ? $options['acting_settings']['dsk']['3d_secure'] : 'off';
$options['acting_settings']['dsk']['conv_activate'] = ( isset( $options['acting_settings']['dsk']['conv_activate'] ) ) ? $options['acting_settings']['dsk']['conv_activate'] : 'off';
$options['acting_settings']['dsk']['conv_limit'] = ( isset( $options['acting_settings']['dsk']['conv_limit'] ) ) ? $options['acting_settings']['dsk']['conv_limit'] : '';
$options['acting_settings']['dsk']['payeasy_activate'] = ( isset( $options['acting_settings']['dsk']['payeasy_activate'] ) ) ? $options['acting_settings']['dsk']['payeasy_activate'] : 'off';
$options['acting_settings']['dsk']['wallet_activate'] = 'off';
$options['acting_settings']['dsk']['mobile_activate'] = 'off';
update_option( 'usces', $options );
$available_settlement = get_option( 'usces_available_settlement', array() );
if ( ! in_array( 'dsk', $available_settlement ) ) {
$available_settlement['dsk'] = $this->acting_formal_name;
update_option( 'usces_available_settlement', $available_settlement );
}
$noreceipt_status = get_option( 'usces_noreceipt_status', array() );
if ( ! in_array( 'acting_dsk_conv', $noreceipt_status ) || ! in_array( 'acting_dsk_payeasy', $noreceipt_status ) ) {
$noreceipt_status[] = 'acting_dsk_conv';
$noreceipt_status[] = 'acting_dsk_payeasy';
update_option( 'usces_noreceipt_status', $noreceipt_status );
}
$this->unavailable_method = array( 'acting_sbps_card', 'acting_sbps_conv', 'acting_sbps_payeasy', 'acting_sbps_wallet', 'acting_sbps_mobile' );
}
/**
* Admin script.
* admin_print_footer_scripts
*/
public function admin_scripts() {
$admin_page = ( isset( $_GET['page'] ) ) ? wp_unslash( $_GET['page'] ) : '';
switch ( $admin_page ) :
case 'usces_settlement':
$settlement_selected = get_option( 'usces_settlement_selected', array() );
if ( in_array( $this->paymod_id, (array) $settlement_selected ) ) :
$acting_opts = $this->get_acting_settings();
?>
error_mes = '';
$options = get_option( 'usces', array() );
$payment_method = usces_get_system_option( 'usces_payment_method', 'settlement' );
$post_data = wp_unslash( $_POST );
unset( $options['acting_settings']['dsk'] );
$options['acting_settings']['dsk']['merchant_id'] = ( isset( $post_data['merchant_id'] ) ) ? trim( $post_data['merchant_id'] ) : '';
$options['acting_settings']['dsk']['service_id'] = ( isset( $post_data['service_id'] ) ) ? trim( $post_data['service_id'] ) : '';
$options['acting_settings']['dsk']['hash_key'] = ( isset( $post_data['hash_key'] ) ) ? trim( $post_data['hash_key'] ) : '';
$options['acting_settings']['dsk']['ope'] = ( isset( $post_data['ope'] ) ) ? $post_data['ope'] : '';
$options['acting_settings']['dsk']['card_activate'] = ( isset( $post_data['card_activate'] ) ) ? $post_data['card_activate'] : 'off';
$options['acting_settings']['dsk']['3d_secure'] = ( isset( $post_data['3d_secure'] ) ) ? $post_data['3d_secure'] : 'off';
$options['acting_settings']['dsk']['conv_activate'] = ( isset( $post_data['conv_activate'] ) ) ? $post_data['conv_activate'] : 'off';
$options['acting_settings']['dsk']['conv_limit'] = ( isset( $post_data['conv_limit'] ) ) ? $post_data['conv_limit'] : '';
$options['acting_settings']['dsk']['payeasy_activate'] = ( isset( $post_data['payeasy_activate'] ) ) ? $post_data['payeasy_activate'] : 'off';
$options['acting_settings']['dsk']['wallet_activate'] = 'off';
$options['acting_settings']['dsk']['mobile_activate'] = 'off';
if ( 'on' === $options['acting_settings']['dsk']['card_activate'] || 'on' === $options['acting_settings']['dsk']['conv_activate'] || 'on' === $options['acting_settings']['dsk']['payeasy_activate'] ) {
$unavailable_activate = false;
foreach ( $payment_method as $settlement => $payment ) {
if ( in_array( $settlement, $this->unavailable_method ) && 'activate' === $payment['use'] ) {
$unavailable_activate = true;
break;
}
}
if ( $unavailable_activate ) {
$this->error_mes .= __( '* Settlement that can not be used together is activated.', 'usces' ) . '
';
} else {
if ( WCUtils::is_blank( $post_data['merchant_id'] ) ) {
$this->error_mes .= '※マーチャントID を入力してください
';
}
if ( WCUtils::is_blank( $post_data['service_id'] ) ) {
$this->error_mes .= '※サービスID を入力してください
';
}
if ( WCUtils::is_blank( $post_data['hash_key'] ) ) {
$this->error_mes .= '※ハッシュキーを入力してください
';
}
}
}
if ( '' === $this->error_mes ) {
$usces->action_status = 'success';
$usces->action_message = __( 'Options are updated.', 'usces' );
if ( 'on' === $options['acting_settings']['dsk']['card_activate'] || 'on' === $options['acting_settings']['dsk']['conv_activate'] || 'on' === $options['acting_settings']['dsk']['payeasy_activate'] ) {
$options['acting_settings']['dsk']['activate'] = 'on';
$options['acting_settings']['dsk']['send_url'] = 'https://fep.sps-system.com/f01/FepBuyInfoReceive.do';
$options['acting_settings']['dsk']['send_url_check'] = 'https://stbfep.sps-system.com/Extra/BuyRequestAction.do';
$options['acting_settings']['dsk']['send_url_test'] = 'https://stbfep.sps-system.com/f01/FepBuyInfoReceive.do';
$options['acting_settings']['dsk']['token_url'] = '';
$options['acting_settings']['dsk']['token_url_test'] = '';
$options['acting_settings']['dsk']['api_url'] = '';
$options['acting_settings']['dsk']['api_url_test'] = '';
$options['acting_settings']['dsk']['cust_url'] = '';
$options['acting_settings']['dsk']['cust_url_test'] = '';
$toactive = array();
if ( 'on' === $options['acting_settings']['dsk']['card_activate'] ) {
$usces->payment_structure[ $this->acting_flg_card ] = 'カード決済(DSK)';
foreach ( $payment_method as $settlement => $payment ) {
if ( $this->acting_flg_card === $settlement && 'deactivate' === $payment['use'] ) {
$toactive[] = $payment['name'];
}
}
} else {
unset( $usces->payment_structure[ $this->acting_flg_card ] );
}
if ( 'on' === $options['acting_settings']['dsk']['conv_activate'] ) {
$usces->payment_structure[ $this->acting_flg_conv ] = 'コンビニ決済(DSK)';
foreach ( $payment_method as $settlement => $payment ) {
if ( $this->acting_flg_conv === $settlement && 'deactivate' === $payment['use'] ) {
$toactive[] = $payment['name'];
}
}
} else {
unset( $usces->payment_structure[ $this->acting_flg_conv ] );
}
if ( 'on' === $options['acting_settings']['dsk']['payeasy_activate'] ) {
$usces->payment_structure[ $this->acting_flg_payeasy ] = 'ペイジー決済(DSK)';
foreach ( $payment_method as $settlement => $payment ) {
if ( $this->acting_flg_payeasy === $settlement && 'deactivate' === $payment['use'] ) {
$toactive[] = $payment['name'];
}
}
} else {
unset( $usces->payment_structure[ $this->acting_flg_payeasy ] );
}
usces_admin_orderlist_show_wc_trans_id();
if ( 0 < count( $toactive ) ) {
$usces->action_message .= __( 'Please update the payment method to "Activate". General Setting > Payment Methods', 'usces' );
}
} else {
$options['acting_settings']['dsk']['activate'] = 'off';
unset( $usces->payment_structure[ $this->acting_flg_card ] );
unset( $usces->payment_structure[ $this->acting_flg_conv ] );
unset( $usces->payment_structure[ $this->acting_flg_payeasy ] );
}
$deactivate = array();
foreach ( $payment_method as $settlement => $payment ) {
if ( ! array_key_exists( $settlement, $usces->payment_structure ) ) {
if ( 'deactivate' !== $payment['use'] ) {
$payment['use'] = 'deactivate';
$deactivate[] = $payment['name'];
usces_update_system_option( 'usces_payment_method', $payment['id'], $payment );
}
}
}
if ( 0 < count( $deactivate ) ) {
$deactivate_message = sprintf( __( '"Deactivate" %s of payment method.', 'usces' ), implode( ',', $deactivate ) );
$usces->action_message .= $deactivate_message;
}
} else {
$usces->action_status = 'error';
$usces->action_message = __( 'Data have deficiency.', 'usces' );
$options['acting_settings']['dsk']['activate'] = 'off';
unset( $usces->payment_structure[ $this->acting_flg_card ] );
unset( $usces->payment_structure[ $this->acting_flg_conv ] );
unset( $usces->payment_structure[ $this->acting_flg_payeasy ] );
$deactivate = array();
foreach ( $payment_method as $settlement => $payment ) {
if ( in_array( $settlement, $this->pay_method ) ) {
if ( 'deactivate' !== $payment['use'] ) {
$payment['use'] = 'deactivate';
$deactivate[] = $payment['name'];
usces_update_system_option( 'usces_payment_method', $payment['id'], $payment );
}
}
}
if ( 0 < count( $deactivate ) ) {
$deactivate_message = sprintf( __( '"Deactivate" %s of payment method.', 'usces' ), implode( ',', $deactivate ) );
$usces->action_message .= $deactivate_message . __( 'Please complete the setup and update the payment method to "Activate".', 'usces' );
}
}
ksort( $usces->payment_structure );
update_option( 'usces', $options );
update_option( 'usces_payment_structure', $usces->payment_structure );
}
/**
* クレジット決済設定画面フォーム
* usces_action_settlement_tab_body
*/
public function settlement_tab_body() {
$settlement_selected = get_option( 'usces_settlement_selected', array() );
if ( in_array( 'dsk', (array) $settlement_selected ) ) :
$acting_opts = $this->get_acting_settings();
$merchant_id = isset( $acting_opts['merchant_id'] ) ? $acting_opts['merchant_id'] : '';
$service_id = isset( $acting_opts['service_id'] ) ? $acting_opts['service_id'] : '';
$hash_key = isset( $acting_opts['hash_key'] ) ? $acting_opts['hash_key'] : '';
?>
DSK 株式会社電算システム
DSK の詳細はこちら 》この決済は「外部リンク型」の決済システムです。
「外部リンク型」とは、決済会社のページへ遷移してカード情報を入力する決済システムです。
尚、本番環境では、正規SSL証明書のみでのSSL通信となりますのでご注意ください。