update: mgate sdk custom notify domain

This commit is contained in:
tokumeikoi 2022-02-09 12:18:42 +08:00
parent 21a9074b3f
commit 659fa85b1d
2 changed files with 7 additions and 3 deletions

View File

@ -43,10 +43,14 @@ class MGate {
public function pay($order)
{
if ($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' => $order['notify_url'],
'notify_url' => $notifyUrl ?? $order['notify_url'],
'return_url' => $order['return_url']
];
$params['app_id'] = $this->config['mgate_app_id'];

View File

@ -119,8 +119,9 @@ class OrderService
$order = $this->order;
if ($user->invite_user_id && $order->total_amount > 0) {
$order->invite_user_id = $user->invite_user_id;
$inviter = User::find($user->invite_user_id);
$isCommission = false;
switch ((int)$user->commission_type) {
switch ((int)$inviter->commission_type) {
case 0:
$commissionFirstTime = (int)config('v2board.commission_first_time_enable', 1);
$isCommission = (!$commissionFirstTime || ($commissionFirstTime && !$this->haveValidOrder($user)));
@ -134,7 +135,6 @@ class OrderService
}
if ($isCommission) {
$inviter = User::find($user->invite_user_id);
if ($inviter && $inviter->commission_rate) {
$order->commission_balance = $order->total_amount * ($inviter->commission_rate / 100);
} else {