update: payment add custom notify domain name

This commit is contained in:
tokumeikoi
2022-02-23 16:07:18 +08:00
parent 2ceb910812
commit 4eb3e23ddc
6 changed files with 31 additions and 24 deletions

View File

@ -32,25 +32,16 @@ class MGate {
'label' => 'AppSecret',
'description' => '',
'type' => 'input',
],
'notify_domain' => [
'label' => '通知域名(选填)',
'description' => '用于接收来自网关的支付通知',
'type' => 'input'
]
];
}
public function pay($order)
{
if (isset($this->config['notify_domain'])) {
$parseUrl = parse_url($order['notify_url']);
$notifyUrl = "{$parseUrl['scheme']}://{$this->config['notify_domain']}{$parseUrl['path']}";
}
$params = [
'out_trade_no' => $order['trade_no'],
'total_amount' => $order['total_amount'],
'notify_url' => $notifyUrl ?? $order['notify_url'],
'notify_url' => $order['notify_url'],
'return_url' => $order['return_url']
];
$params['app_id'] = $this->config['mgate_app_id'];