Authored by 郝肖肖

更改ERP、订单状态接口替换成pcpayNotify

... ... @@ -220,21 +220,29 @@ class PayData
}
/**
* 更新订单状态-未付款更新已付款状态
* @param type int $orderCode 订单号
* @param type int $paymentCode 支付方式
* @param type int $totalFee 金额
* 支付成功后--更新订单状态
* @param type string $orderCode 订单号
* @param type int $payment 支付方式
* @param type double $amount 金额(单位:元)
* @param type string $bankName 银行名称
* @param type string $bankCode 银行代码
* @param type string $tradeNo 交易流水号
* @param type string $bankBillNo 银行流水号
* @return type []
*/
public static function pcpayNotify($orderCode, $paymentCode, $totalFee)
public static function pcpayNotify($orderCode, $payment, $amount, $bankName = '', $bankCode = '', $tradeNo = '', $bankBillNo = '')
{
$param = Yohobuy::param();
$param['client_type'] = 'web';
$param['private_key'] = Yohobuy::$privateKeyList['web'];
$param['method'] = 'web.SpaceOrders.pcpayNotify';
$param['orderCode'] = $orderCode;
$param['paymentCode'] = $paymentCode;
$param['totalFee'] = $totalFee;
$param['order_code'] = $orderCode;
$param['payment'] = $payment;
$param['bank_name'] = $bankName;
$param['bank_code'] = $bankCode;
$param['amount'] = $amount;
$param['trade_no'] = $tradeNo;
$param['bank_bill_no'] = $bankBillNo;
$param['client_secret'] = Sign::getSign($param);
... ...
... ... @@ -177,12 +177,11 @@ class Service extends PayAbstract
ksort($arrResponse);
reset($arrResponse);
$sign = '';
foreach ($arrResponse AS $key=>$val)
{
if ($key != 'sign' && $key != 'sign_type' && $key != 'code')
{
$sign .= "$key=$val&";
foreach ($arrResponse AS $key => $val) {
if ($key === 'sign' || $key === 'sign_type' || $key === 'code' || $val === '') {
continue;
}
$sign .= "$key=$val&";
}
$sign = substr($sign, 0, -1) . $this->config->alipay_key;
... ...
... ... @@ -203,9 +203,10 @@ class Service extends PayAbstract
reset($arrResponse);
$sign = '';
foreach ($arrResponse AS $key => $val) {
if ($key != 'sign' && $key != 'sign_type' && $key != 'code') {
$sign .= "$key=$val&";
if ($key === 'sign' || $key === 'sign_type' || $key === 'code' || $val === '') {
continue;
}
$sign .= "$key=$val&";
}
$sign = substr($sign, 0, -1) . $this->config->alipay_key;
... ...
... ... @@ -170,12 +170,11 @@ class Service extends PayAbstract
ksort($arrResponse);
reset($arrResponse);
$sign = '';
foreach ($arrResponse AS $key=>$val)
{
if ($key != 'sign' && $key != 'sign_type' && $key != 'code')
{
$sign .= "$key=$val&";
foreach ($arrResponse AS $key => $val) {
if ($key === 'sign' || $key === 'sign_type' || $key === 'code' || $val === '') {
continue;
}
$sign .= "$key=$val&";
}
$sign = substr($sign, 0, -1) . $this->config->alipay_key;
... ...
... ... @@ -54,15 +54,6 @@ class PayNotifyCallBack extends WxPayNotify
$tradeNo = $result['out_trade_no'];
$bankBillNo = $result['bank_type'];
$this->log->LogInfo('===[' . $orderCode . ']===');
$this->log->LogInfo('==[' . $orderCode . ']=开始调用ERP提交订单状态接口,接口方法为web.SpaceOrders.submitOrderStatus===');
$this->log->LogInfo('==[' . $orderCode . ']=请求参数为orderCode=' . $orderCode . '===');
// ERP提交订单状态
$erpReturn = PayData::submitOrderStatus($orderCode, $payment, $bankName, $bankCode, $amount, $orderCode, $tradeNo, $bankBillNo);
$this->log->LogInfo('==[' . $orderCode . ']=结束调用ERP提交订单状态接口,返回结果为===');
$this->log->LogInfo(var_export($erpReturn, true));
$this->log->LogInfo('==[' . $orderCode . ']=开始调用获取订单详情方式接口,接口方法为app.SpaceOrders.detail===');
$orderInfo = OrderData::getOrderDetail('', $orderCode);
$this->log->LogInfo('==[' . $orderCode . ']=结束调用获取订单详情方式接口,返回结果为===');
... ... @@ -73,11 +64,8 @@ class PayNotifyCallBack extends WxPayNotify
return false;
}
$this->log->LogInfo('==[' . $orderCode . ']=开始调用更新订单状态接口,接口方法为web.SpaceOrders.updatePaymentStatus===');
$this->log->LogInfo('==[' . $orderCode . ']=请求参数为orderId=' . $orderInfo['data']['order_id'] . 'uid=' . $this->_uid . '===');
// 更新订单的状态
$updateOrderStatus = PayData::updateOrderStatus($orderInfo['data']['order_id'], $this->_uid, $payment, 'Y', $bankCode);
$this->log->LogInfo('==[' . $orderCode . ']=结束调用更新订单状态接口,返回结果为===');
//更新订单状态
$updateOrderStatus = PayData::pcpayNotify($orderCode, $payment, $amount, $bankName, $bankCode, $tradeNo, $bankBillNo);
$this->log->LogInfo(var_export($updateOrderStatus, true));
$this->log->LogInfo('==[' . $orderCode . ']=微信扫码订单支付成功===');
... ...
... ... @@ -152,20 +152,10 @@ class PayModel
$log = new PhpLog(self::ORDER_STATUS_LOG, 'PRC', self::LOG_LEVEL);
$log->LogInfo('===[' . $orderCode . ']===');
// ERP提交订单状态
$log->LogInfo('===开始调用ERP提交订单状态接口,接口方法为web.SpaceOrders.submitOrderStatus===');
$log->LogInfo('===请求参数为orderCode=' . $orderCode . '===');
$erpReturn = PayData::submitOrderStatus($orderCode, 0, '', '', 0, '', '', '');
$log->LogInfo('===结束调用ERP提交订单状态接口,返回结果为===');
$log->LogInfo(var_export($erpReturn, true));
// 更新订单的状态
$log->LogInfo('===开始调用更新订单状态接口,接口方法为web.SpaceOrders.updatePaymentStatus===');
$log->LogInfo('===请求参数为orderId=' . $order['order_id'] . 'uid=' . $uid . '===');
$updateOrderStatus = PayData::updateOrderStatus($order['order_id'], $uid, 0, 'Y', '');
$log->LogInfo('===结束调用更新订单状态接口,返回结果为===');
//无需付款-更新订单状态
$updateOrderStatus = PayData::pcpayNotify($orderCode, 0, 0);
$log->LogInfo('===无需付款---结束调用更新订单状态接口,返回结果为===');
$log->LogInfo(var_export($updateOrderStatus, true));
$result['notNeedPay'] = true;
break;
}
... ... @@ -580,18 +570,8 @@ class PayModel
// 初始化日志
$log = new PhpLog(self::ORDER_STATUS_LOG, 'PRC', self::LOG_LEVEL);
$log->LogInfo('===[' . $orderCode . ']===');
$log->LogInfo('==[' . $orderCode . ']=开始调用ERP提交订单状态接口,接口方法为web.SpaceOrders.submitOrderStatus===');
$log->LogInfo('==[' . $orderCode . ']=请求参数为orderCode=' . $orderCode . '===');
// ERP提交订单状态
$erpReturn = PayData::submitOrderStatus($orderCode, $payment, $bankName, $bankCode, $amount, $payOrderCode, $tradeNo, $bankBillNo);
$log->LogInfo('==[' . $orderCode . ']=结束调用ERP提交订单状态接口,返回结果为===');
$log->LogInfo(var_export($erpReturn, true));
$log->LogInfo('==[' . $orderCode . ']=开始调用更新订单状态接口,接口方法为web.SpaceOrders.updatePaymentStatus===');
$log->LogInfo('==[' . $orderCode . ']=请求参数为orderId=' . $orderData['order_id'] . 'uid=' . $uid . '===');
// 更新订单的状态
$updateOrderStatus = PayData::updateOrderStatus($orderData['order_id'], $uid, $payment, 'Y', $bankCode);
//更新订单状态
$updateOrderStatus = PayData::pcpayNotify($orderCode, $payment, $amount, $bankName, $bankCode, $tradeNo, $bankBillNo);
$log->LogInfo('==[' . $orderCode . ']=结束调用更新订单状态接口,返回结果为===');
$log->LogInfo(var_export($updateOrderStatus, true));
$log->LogInfo('==[' . $orderCode . ']=订单支付成功,请等待发货===');
... ...
... ... @@ -223,7 +223,10 @@ class NoticeController extends WebAction
$payment = PayModel::getPaymentById(1);
$payService = PayFactory::factory($payment);
$rspParams = $payService->parseResponse($_GET); //财付通是以get方式回复的。
$this->payResultProc($rspParams, 1);
$dealResult = $this->payResultProc($rspParams, 1);
$dealResult['payData'] = array('payWay' => '财付通');
$this->commonShowResult($dealResult);
}
/**
... ...
... ... @@ -184,7 +184,7 @@ routes.coupons.route.action = Index
; 商品支付方式选择
routes.paytypechoose.type = "rewrite"
routes.paytypechoose.match = "/shopping/pay"
routes.paytypechoose.match = "/shopping/pay$"
routes.paytypechoose.route.module = Shopping
routes.paytypechoose.route.controller = Pay
routes.paytypechoose.route.action = Index
... ...