|
|
@@ -2,8 +2,11 @@
|
|
|
|
|
|
namespace bizHd\refund\classes;
|
|
|
|
|
|
+use common\components\noticeUtil;
|
|
|
+use common\components\orderSn;
|
|
|
use Yii;
|
|
|
use bizHd\base\classes\BaseClass;
|
|
|
+use common\components\lakala\Lakala;
|
|
|
|
|
|
class HdRefundClass extends BaseClass
|
|
|
{
|
|
|
@@ -16,6 +19,43 @@ class HdRefundClass extends BaseClass
|
|
|
const STATUS_UN_COMPLETE = 0; //退款处理中
|
|
|
const STATUS_COMPLETE = 1; //已完成
|
|
|
|
|
|
+ public static function onlyRefundAmount($shop, $order)
|
|
|
+ {
|
|
|
+ $refundSn = orderSn::getHdRefundSn();
|
|
|
+ $xsOrderSn = $order->orderSn ?? '';
|
|
|
+ $refundPrice = $order->actPrice ?? 0;
|
|
|
+ $refundFee = bcmul($refundPrice, 100);
|
|
|
+ $merchantPrivateKeyPath = Yii::getAlias("@vendor/lakala") . '/production/api_private_key.pem';
|
|
|
+ $lklCertificatePath = Yii::getAlias("@vendor/lakala") . '/production/lkl-apigw-v1.cer';
|
|
|
+ $params = [
|
|
|
+ 'appid' => 'OP00002119',
|
|
|
+ 'serial_no' => '018b08cfddbd',
|
|
|
+ 'merchant_no' => $shop->lklSjNo,
|
|
|
+ 'term_no' => $shop->lklScanTermNo,
|
|
|
+ 'merchantPrivateKeyPath' => $merchantPrivateKeyPath,
|
|
|
+ 'lklCertificatePath' => $lklCertificatePath,
|
|
|
+ ];
|
|
|
+ $laResource = new Lakala($params);
|
|
|
+ $refundReason = '';
|
|
|
+ $aliParams = [
|
|
|
+ 'refundSn' => $refundSn,
|
|
|
+ 'orderSn' => $xsOrderSn,
|
|
|
+ 'refundAmount' => $refundFee,
|
|
|
+ 'refundReason' => $refundReason,
|
|
|
+ ];
|
|
|
+ $response = $laResource->refund($aliParams);
|
|
|
+ if (!isset($response['code']) || $response['code'] != 'BBS00000') {
|
|
|
+ $errMsg = $response['msg'] ?? '';
|
|
|
+ return ['status' => 0, 'msg' => $errMsg];
|
|
|
+ } else {
|
|
|
+ $sjName = $shop->merchantName;
|
|
|
+ $shopName = $shop->shopName;
|
|
|
+ $name = $shopName == '首店' ? $sjName : $sjName . '-' . $shopName;
|
|
|
+ noticeUtil::push("零售订单取消,客户还付款成功,钱已经原路退回 {$xsOrderSn} {$name}", '15280215347');
|
|
|
+ return ['status' => 1, 'msg' => '退款成功'];
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
// 订单列表
|
|
|
public static function getOrderList($where)
|
|
|
{
|