feat : wechatPay callback
This commit is contained in:
@@ -34,16 +34,18 @@ trait CheckOrderCallBackTrait
|
||||
public function checkWxRefundCallBackOrder(): void
|
||||
{
|
||||
if (
|
||||
!isset($this->callbackData['return_code']) ||
|
||||
$this->callbackData['return_code']!= 'SUCCESS' ||
|
||||
!isset($this->callbackData['refund_status']) ||
|
||||
$this->callbackData['refund_status']!= 'SUCCESS' ||
|
||||
!isset($this->callbackData['out_trade_no']) ||
|
||||
empty($this->callbackData['out_trade_no']) ||
|
||||
!isset($this->callbackData['mch_id']) ||
|
||||
empty($this->callbackData['mch_id'])
|
||||
!isset($this->callbackData['out_refund_no']) ||
|
||||
empty($this->callbackData['out_refund_no']) ||
|
||||
!isset($this->callbackData['amount']['total']) ||
|
||||
$this->callbackData['amount']['total'] <= 0
|
||||
) {
|
||||
throw new ErrException('此订单回调异常');
|
||||
}
|
||||
|
||||
$this->orderNo = $this->callbackData['out_trade_no'];
|
||||
$this->orderNo = $this->callbackData['out_refund_no'];
|
||||
}
|
||||
}
|
||||
@@ -19,7 +19,7 @@ trait RefundOrderTrait
|
||||
*/
|
||||
protected function checkRefundOrder(): void
|
||||
{
|
||||
$this->refundInfo = $this->refundOrderModel->getInfoByOrderSnoAndType($this->orderNo,self::OrderType);
|
||||
$this->refundInfo = $this->refundOrderModel->getInfoByOrderSnoAndType($this->orderNo,self::PayType);
|
||||
$this->orderInfo = $this->orderModel->getInfoById($this->refundInfo->order_id);
|
||||
$this->payInfo = $this->payOrderModel->getInfoByOrderIdAndTypeAndRType($this->orderInfo->id,self::OrderType,self::PayType);
|
||||
|
||||
@@ -51,6 +51,7 @@ trait RefundOrderTrait
|
||||
$this->refundInfo->refund_time = date('Y-m-d H:i:s');
|
||||
$this->refundInfo->wx_transaction_id = $this->callbackData['transaction_id'];
|
||||
$this->refundInfo->notify_json = json_encode($this->callbackData);
|
||||
$this->refundInfo->remark = '退款成功';
|
||||
|
||||
if (!$this->refundInfo->save()) throw new Exception('更新退款订单失败');
|
||||
|
||||
@@ -72,7 +73,7 @@ trait RefundOrderTrait
|
||||
|
||||
if ($isRefundMoney <= 0) throw new Exception('订单退款金额错误');
|
||||
|
||||
if ($isRefundMoney == $this->orderInfo->actual_price) {
|
||||
if ($isRefundMoney == $this->payInfo->pay_money) {
|
||||
$this->orderInfo->status = OrderCode::FINISH_REFUND;
|
||||
$this->orderInfo->is_refund_all = 1;//todo 感觉可以删除这个值
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user