feat : wechatPay callback
This commit is contained in:
@@ -67,7 +67,7 @@ class RefundOrder extends Model
|
|||||||
])->sum('refund_money') ?? 0;
|
])->sum('refund_money') ?? 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getSuccessMoneyByOrderId(int $orderId, int $type): mixed
|
public function getSuccessMoneyByOrderId(int $orderId, int $type): float|int
|
||||||
{
|
{
|
||||||
return $this
|
return $this
|
||||||
->where('order_id', $orderId)
|
->where('order_id', $orderId)
|
||||||
|
|||||||
@@ -81,9 +81,9 @@ class RefundService
|
|||||||
public float $refundAmount;
|
public float $refundAmount;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var float
|
* @var float|int
|
||||||
*/
|
*/
|
||||||
protected float $isRefundMoney;
|
protected float|int $isRefundMoney;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return void
|
* @return void
|
||||||
@@ -199,9 +199,9 @@ class RefundService
|
|||||||
protected function checkRefundAmount(): void
|
protected function checkRefundAmount(): void
|
||||||
{
|
{
|
||||||
// 等于支付金额 减去 已退款金额 减去 本次退款金额 小于 0 就是错误的 大于等于 0 就是正确的
|
// 等于支付金额 减去 已退款金额 减去 本次退款金额 小于 0 就是错误的 大于等于 0 就是正确的
|
||||||
if ($this->orderInfo->actual_price - $this->isRefundMoney - $this->refundAmount < 0) throw new Exception('退款金额不能大于订单金额');
|
if ($this->payInfo->pay_money - $this->isRefundMoney - $this->refundAmount < 0) throw new Exception('退款金额不能大于订单金额');
|
||||||
|
|
||||||
$this->refundAmount = 0;
|
$this->refundAmount = min($this->payInfo->pay_money - $this->isRefundMoney, $this->refundAmount);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -107,6 +107,8 @@ class PlacePayService extends BaseService
|
|||||||
if ($this->orderInfo->actual_price <= 0) return $this->directPayment();
|
if ($this->orderInfo->actual_price <= 0) return $this->directPayment();
|
||||||
|
|
||||||
$this->checkPayOrder();
|
$this->checkPayOrder();
|
||||||
|
// 测试环境 0.01
|
||||||
|
if (!SystemUtil::checkProEnv() && $this->orderInfo->actual_price > 0) $this->orderInfo->actual_price = '0.01';
|
||||||
|
|
||||||
$this->setPayInfo();
|
$this->setPayInfo();
|
||||||
|
|
||||||
@@ -119,9 +121,6 @@ class PlacePayService extends BaseService
|
|||||||
$rechargeService->setConfig();
|
$rechargeService->setConfig();
|
||||||
$rechargeService->setNotify();
|
$rechargeService->setNotify();
|
||||||
|
|
||||||
// 测试环境 0.01
|
|
||||||
if (!SystemUtil::checkProEnv() && $this->orderInfo->actual_price > 0) $this->orderInfo->actual_price = '0.01';
|
|
||||||
|
|
||||||
$payData = $rechargeService->pay(
|
$payData = $rechargeService->pay(
|
||||||
(float)$this->orderInfo->actual_price,
|
(float)$this->orderInfo->actual_price,
|
||||||
// $this->request->input('body','订单支付'),
|
// $this->request->input('body','订单支付'),
|
||||||
|
|||||||
Reference in New Issue
Block a user