init: import production code mss.nahaichuan.com (exclude Runtime/Uploads/backups/logs)
这个提交包含在:
@@ -0,0 +1,104 @@
|
||||
<?php
|
||||
|
||||
namespace Common\Business;
|
||||
|
||||
use Common\Model\RetailBillOrderModel;
|
||||
//[1.8.68]
|
||||
/**
|
||||
* 支付退款成功回调类
|
||||
* Class PaymentRefund
|
||||
* [
|
||||
* 第三方退款成功回调 paymentRefund
|
||||
* 微信退款的代金券信息 wxRefund
|
||||
* 第三方退款成功回调的参数验证 paymentRefundVerify
|
||||
* ]
|
||||
* @package Common\Business
|
||||
*/
|
||||
class PaymentRefund
|
||||
{
|
||||
/**
|
||||
* 第三方退款成功回调(暂只支持微信代金券处理)
|
||||
* @param $param
|
||||
* {
|
||||
* old_pay_order_id 原支付订单id
|
||||
* merchant_id
|
||||
* refund_info 退款信息
|
||||
* type 1线上 2线下
|
||||
* }
|
||||
* @return mixed
|
||||
* [
|
||||
* pay_coupon_id_str 代金券id
|
||||
* pay_coupon_fee 代金券优惠总金额 单位元
|
||||
* cash_fee 微信的现金金额 指客户实际付款或退款金额
|
||||
* ]
|
||||
*/
|
||||
public function paymentRefund($param)
|
||||
{
|
||||
//参数验证
|
||||
$verifyResult = $this->paymentRefundVerify($param);
|
||||
if ($verifyResult['status'] != 1) {
|
||||
return $verifyResult;
|
||||
}
|
||||
$result = $this->wxRefund($param);
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 微信退款的代金券信息
|
||||
* @param $param
|
||||
* {
|
||||
* old_pay_order_id 原支付订单id
|
||||
* merchant_id
|
||||
* refund_info 退款信息
|
||||
* type 1线上 2线下
|
||||
* }
|
||||
* @return mixed
|
||||
*/
|
||||
public function wxRefund($param)
|
||||
{
|
||||
$merchant_id = $param['merchant_id'];
|
||||
$type = $param['type'];
|
||||
$refund_info = $param['refund_info'];
|
||||
$old_pay_order_id = $param['old_pay_order_id'];
|
||||
switch ($type) {
|
||||
case 1:
|
||||
case 2:
|
||||
//线下
|
||||
$PayCouponClass = new PayCoupon();
|
||||
$result = $PayCouponClass->couponVerification_v1(json_encode([
|
||||
'merchant_id' => $merchant_id,
|
||||
'pay_info' => $refund_info,
|
||||
'coupon_way' => 2, //退款
|
||||
'old_pay_order_id'=>$old_pay_order_id
|
||||
]));
|
||||
break;
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 第三方退款成功回调
|
||||
* @param $param
|
||||
* {
|
||||
* merchant_id
|
||||
* refund_info 退款信息
|
||||
* }
|
||||
* @return mixed
|
||||
*/
|
||||
public function paymentRefundVerify(&$param)
|
||||
{
|
||||
$param = json_decode($param, true);
|
||||
if (!is_array($param)) {
|
||||
return callBack(statusCode()['error'], '退款详情有误');
|
||||
}
|
||||
if (empty($param['merchant_id'])) {
|
||||
return callBack(statusCode()['error'], '身份验证失败');
|
||||
}
|
||||
if (empty($param['refund_info'])) {
|
||||
return callBack(statusCode()['error'], '退款信息有误');
|
||||
}
|
||||
return callBack(statusCode()['success'], '验证通过');
|
||||
}
|
||||
}
|
||||
在新工单中引用
屏蔽一个用户