fix: payment

This commit is contained in:
tokumeikoi
2021-04-28 18:29:28 +09:00
parent 3bfa2180e6
commit 0333d62e6f
3 changed files with 9 additions and 7 deletions

View File

@ -15,6 +15,8 @@ class PaymentService
if ($id) $payment = Payment::find($id)->toArray();
$this->config = [];
if (isset($payment) && $payment['config']) $this->config = json_decode($payment['config'], true);
$this->config['id'] = $id;
$this->config['enable'] = $payment['enable'];
$this->payment = new $this->class($this->config);
}
@ -27,8 +29,8 @@ class PaymentService
public function pay($order)
{
return $this->payment->pay([
'notify_url' => url('/api/v1/guest/payment/notify/' . $this->method),
'return_url' => config('v2board.app_url', env('APP_URL')) . '/#/order',
'notify_url' => url("/api/v1/guest/payment/notify/{$this->method}/{$this->config['id']}"),
'return_url' => config('v2board.app_url', env('APP_URL')) . '/#/order/' . $order['trade_no'],
'trade_no' => $order['trade_no'],
'total_amount' => $order['total_amount'],
'user_id' => $order['user_id'],