クラス
SettlementSettings
ソース ソース
ファイル: src/Admin/SettlementSettings.php
class SettlementSettings extends Factory
{
/**
* Override method
*
* Filters the documentation url
*
* @author Evan D Shaw <evandanielshaw@gmail.com>
* @param string $url
* @return string
*/
protected function filterDocumentationUrl($url) {
$url = 'https://pay.line.me';
return $url;
}
/**
* Filters the settlement acting_settings option array with LINE Pay config options
*
* @author Evan D Shaw <evandanielshaw@gmail.com>
* @param array $acting_opts
* @return array
*/
protected function filterActingOptions($acting_opts) {
$acting_opts['channel_id'] = isset($acting_opts['channel_id']) ? $acting_opts['channel_id'] : '';
$acting_opts['channel_secret_key'] = isset($acting_opts['channel_secret_key']) ? $acting_opts['channel_secret_key'] : '';
return $acting_opts;
}
/**
* LINE Pay config options
*
* @author Evan D Shaw <evandanielshaw@gmail.com>
* @param array $acting_opts
* @return void
*/
protected function settlementModuleFields($acting_opts) {
?>
<tr>
<th>
<a class="explanation-label" id="label_ex_channel_id_linepay">
<?php echo esc_html__('Channel ID', 'wcex_linepay'); ?>
</a>
</th>
<td colspan="6">
<input
name="channel_id"
type="text"
id="channel_id_linepay"
value="<?php echo esc_attr($acting_opts['channel_id']); ?>"
size="20"
/>
</td>
</tr>
<tr id="ex_channel_id_linepay" class="explanation">
<td colspan="2">
<?php echo esc_html__('The Channel ID issued by LINE.', 'wcex_linepay'); ?>
</td>
</tr>
<tr>
<th>
<a class="explanation-label" id="label_ex_channel_secret_key_linepay">
<?php echo esc_html__('Channel Secret Key', 'wcex_linepay'); ?>
</a>
</th>
<td colspan="6">
<input
name="channel_secret_key"
type="text"
id="channel_secret_key_linepay"
value="<?php echo esc_attr($acting_opts['channel_secret_key']); ?>"
size="20"
/>
</td>
</tr>
<tr id="ex_channel_secret_key_linepay" class="explanation">
<td colspan="2">
<?php echo esc_html__('Channel Secret Key issued by LINE.', 'wcex_linepay'); ?>
</td>
</tr>
<?php
}
/**
* Filter options with POST
*
* @author Evan D Shaw <evandanielshaw@gmail.com>
* @param array $options
* @return array
*/
protected function filterUpdateOptionsProcessing($options) {
$options['channel_id'] = isset($_POST['channel_id']) ? $_POST['channel_id'] : '';
$options['channel_secret_key'] = isset($_POST['channel_secret_key']) ? $_POST['channel_secret_key'] : '';
return $options;
}
/**
* Filter error message after form validation
*
* @author Evan D Shaw <evandanielshaw@gmail.com>
* @param string $error_message
* @return string
*/
protected function validateFormPost($error_message) {
if (\WCUtils::is_blank($_POST['channel_id'])) {
$error_message .= '※' . __('Please enter the Channel ID.', 'wcex_linepay') . '<br />';
}
if (\WCUtils::is_blank($_POST['channel_secret_key'])) {
$error_message .= '※' . __('Please enter the Channel Secret Key.', 'wcex_linepay') . '<br />';
}
return $error_message;
}
}
- filterActingOptions — Filters the settlement acting_settings option array with LINE Pay config options
- filterDocumentationUrl — Override method
- filterUpdateOptionsProcessing — Filter options with POST
- settlementModuleFields — LINE Pay config options
- validateFormPost — Filter error message after form validation