|
|
@@ -565,24 +565,56 @@ class OrderController extends BaseController
|
|
|
util::fail('没有微信信息');
|
|
|
}
|
|
|
$capitalType = dict::getDict('capitalType', 'xhOrder', 'id');
|
|
|
- //流水类型、优惠卷、微信支付(h5还是小程序支付)类型 带到回调
|
|
|
-// $attach = 'capitalType=' . $capitalType . '&couponId=' . $couponId . '&wxPayType=' . $wxPayType;
|
|
|
-
|
|
|
-// $input->SetBody($name);
|
|
|
-// $input->SetOut_trade_no($orderSn);
|
|
|
-// $input->SetTotal_fee($totalFee * 100);
|
|
|
-// $input->SetTime_start(date("YmdHis", $now));
|
|
|
-// $input->SetAttach($attach);
|
|
|
-// //设置订单有效期5分钟
|
|
|
-// $input->SetTime_expire(date("YmdHis", $expireTime));
|
|
|
-// $input->SetNotify_url(Yii::$app->params['mallHost'] . '/notice/wx-callback/');
|
|
|
-// $sjExtend = WxOpenClass::getMallWxInfo();
|
|
|
-// $input->SetOpenid($openId);
|
|
|
-// $sjExtend['wxAppId'] = $sjExtend['miniAppId'];
|
|
|
-// $newParams['orderId'] = $orderId;
|
|
|
-// $newParams['orderSn'] = $orderSn;
|
|
|
-// $newParams['totalPrice'] = $actPrice;
|
|
|
-// util::success($newParams);
|
|
|
+
|
|
|
+ $sjExtend = WxOpenClass::getMallWxInfo();
|
|
|
+ $shop = $this->shop;
|
|
|
+ $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);
|
|
|
+ $notifyUrl = Yii::$app->params['mallHost'] . "/notice/pay-callback";
|
|
|
+ $wxParams = [
|
|
|
+ 'orderSn' => $orderSn,
|
|
|
+ 'amount' => $totalFee,
|
|
|
+ 'capitalType' => $capitalType,
|
|
|
+ 'notifyUrl' => $notifyUrl,
|
|
|
+ 'wxAppId' => $sjExtend['miniAppId'],
|
|
|
+ 'openId' => $openId,
|
|
|
+ 'subject' => $name,
|
|
|
+ 'couponId' => $couponId,
|
|
|
+ ];
|
|
|
+ $response = $laResource->driveWxPay($wxParams);
|
|
|
+ if (isset($response['code']) == false || $response['code'] != 'BBS00000') {
|
|
|
+ $errMsg = $response['msg'] ?? '';
|
|
|
+ noticeUtil::push($errMsg, '15280215347');
|
|
|
+ util::fail('支付失败');
|
|
|
+ }
|
|
|
+
|
|
|
+ $newParams = isset($response['resp_data']['acc_resp_fields']) ? $response['resp_data']['acc_resp_fields'] : [];
|
|
|
+ $appId = $newParams['app_id'] ?? '';
|
|
|
+ $nonceStr = $newParams['nonce_str'] ?? '';
|
|
|
+ $paySign = $newParams['pay_sign'] ?? '';
|
|
|
+ $package = $newParams['package'] ?? '';
|
|
|
+ $signType = $newParams['sign_type'] ?? '';
|
|
|
+ $timeStamp = $newParams['time_stamp'] ?? '';
|
|
|
+ $new = [
|
|
|
+ 'id' => $orderId,
|
|
|
+ 'appId' => $appId,
|
|
|
+ 'nonceStr' => $nonceStr,
|
|
|
+ 'paySign' => $paySign,
|
|
|
+ 'package' => $package,
|
|
|
+ 'signType' => $signType,
|
|
|
+ 'timeStamp' => $timeStamp,
|
|
|
+ 'orderSn' => $orderSn,
|
|
|
+ ];
|
|
|
+ util::success($new);
|
|
|
|
|
|
} elseif ($payWay == 1) {
|
|
|
//Yii::$app->params['mallHost'] . "/notice/ali-callback"
|