feat(payment): finish Zibll key contract and wire checkout gateways
Drop dual-read payment runtime fallbacks, align PHP schema to Vue keys, read gateway credentials only from aksrt_settings with enable toggles, expose configured adapters at checkout, fix credits pay signatures, and apply order expiry settings. Wire orphan order/card-pass/withdrawal schema pages; delete unused Payment* wrappers.
This commit is contained in:
@@ -20,6 +20,10 @@ class AKSRT_WechatPay_Gateway implements AKSRT_Payment_Gateway_Interface {
|
||||
}
|
||||
|
||||
public function is_configured(): bool {
|
||||
if (class_exists('AKSRT_Settings_Payment_Runtime')
|
||||
&& !AKSRT_Settings_Payment_Runtime::is_gateway_enabled('wechatpay')) {
|
||||
return false;
|
||||
}
|
||||
$config = $this->get_config();
|
||||
return !empty($config['mch_id']) && !empty($config['key']);
|
||||
}
|
||||
@@ -206,24 +210,19 @@ class AKSRT_WechatPay_Gateway implements AKSRT_Payment_Gateway_Interface {
|
||||
}
|
||||
|
||||
private function get_config(): array {
|
||||
// 优先从统一设置读取(schema 保存的 key)
|
||||
if (class_exists('AKSRT_Settings')) {
|
||||
$all = AKSRT_Settings::get_all();
|
||||
if (!empty($all['wechat_merchantid'])) {
|
||||
return [
|
||||
'mch_id' => $all['wechat_merchantid'] ?? '',
|
||||
'key' => $all['wechat_jsapi'] ?? '',
|
||||
'appid' => $all['wechat_appid'] ?? '',
|
||||
'appsecret' => $all['wechat_appsecret'] ?? '',
|
||||
'cert_path' => $all['wechat_cert_path'] ?? '',
|
||||
'key_path' => $all['wechat_key_path'] ?? '',
|
||||
'payment_type' => $all['wechat_payment_type'] ?? 'native',
|
||||
];
|
||||
}
|
||||
if (!class_exists('AKSRT_Settings')) {
|
||||
return [];
|
||||
}
|
||||
// 回退到独立 option
|
||||
$settings = get_option('aksrt_payment_wechatpay', []);
|
||||
return is_array($settings) ? $settings : [];
|
||||
$all = AKSRT_Settings::get_all();
|
||||
return [
|
||||
'mch_id' => (string) ($all['wechat_merchantid'] ?? ''),
|
||||
'key' => (string) ($all['wechat_jsapi'] ?? ''),
|
||||
'appid' => (string) ($all['wechat_appid'] ?? ''),
|
||||
'appsecret' => (string) ($all['wechat_appsecret'] ?? ''),
|
||||
'cert_path' => (string) ($all['wechat_cert_path'] ?? ''),
|
||||
'key_path' => (string) ($all['wechat_key_path'] ?? ''),
|
||||
'payment_type' => (string) ($all['wechat_payment_type'] ?? 'native'),
|
||||
];
|
||||
}
|
||||
|
||||
private function create_sdk(array $config): \Yurun\PaySDK\Weixin\SDK {
|
||||
|
||||
Reference in New Issue
Block a user