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

@ -26,6 +26,7 @@ class PaymentService
$this->config['enable'] = $payment['enable'];
$this->config['id'] = $payment['id'];
$this->config['uuid'] = $payment['uuid'];
$this->config['notify_domain'] = $payment['notify_domain'];
};
$this->payment = new $this->class($this->config);
if (isset($this->payment->customResult)) $this->customResult = $this->payment->customResult;
@ -39,8 +40,15 @@ class PaymentService
public function pay($order)
{
// custom notify domain name
$notifyUrl = url("/api/v1/guest/payment/notify/{$this->method}/{$this->config['uuid']}");
if ($this->config['notify_domain']) {
$parseUrl = parse_url($notifyUrl);
$notifyUrl = $this->config['notify_domain'] . $parseUrl['path'];
}
return $this->payment->pay([
'notify_url' => url("/api/v1/guest/payment/notify/{$this->method}/{$this->config['uuid']}"),
'notify_url' => $notifyUrl,
'return_url' => config('v2board.app_url', env('APP_URL')) . '/#/order/' . $order['trade_no'],
'trade_no' => $order['trade_no'],
'total_amount' => $order['total_amount'],