Onex b2b2c微信扫码支付不能改变订单状态

/ 0评 / 2

文件位置自己找,下面提供Onex b2b2c微信扫码支付不能改变订单状态处理办法:

by-阿彪

@经纪人:  875358601@qq.com @DateTime:  2016-12-13 22:11:20

ps: 针对于版本:商派ONex 多用户在线商城 V3.0.35,后续shopex官网将提供相关补丁包进行处理


function nodifyPay($data){
$payments = new ectools_payment_plugin_wxqrpay($this->app);
$ret = $payments->callback($data);
logger::info("支付返回信息转换之后记录:".var_export($ret,1));
// 支付结束,回调服务.
if (!isset($ret['status']) || $ret['status'] == '') $ret['status'] = 'failed';

$objPayments = app::get('ectools')->model('payments');
$sdf = $objPayments->getRow('*',array('payment_id'=>$ret['payment_id']));
if ($sdf)
{
$sdf['account'] = $ret['account'];
$sdf['bank'] = $ret['bank'];
$sdf['pay_account'] = $ret['pay_account'];
$sdf['currency'] = $ret['currency'];
$sdf['trade_no'] = $ret['trade_no'];
$sdf['payed_time'] = $ret['t_payed'];
$sdf['pay_app_id'] = $ret['pay_app_id'];
$ret['pay_type'] = $sdf['pay_type'];
$sdf['memo'] = $ret['memo'];
$sdf['money'] = $ret['money'];
$sdf['cur_money'] = $ret['cur_money'] ? $ret['cur_money'] : $sdf['cur_money'];
}

switch ($ret['status'])
{
case 'succ':
case 'progress':
if ($sdf && $sdf['status'] != 'succ')
{
$isUpdatedPay = payment::update($ret, $msg);
if($isUpdatedPay)
{
$params['payment_id'] = $sdf['payment_id'];
$params['fields'] = 'status,payment_id,pay_type,user_id,cur_money';
try
{
$paymentBill = app::get('ectools')->rpcCall('payment.bill.get',$params);
}
catch(Exception $e)
{
throw $e;
}

try
{
if($sdf['pay_type'] == 'recharge')
{
logger::info("支付过程中,被处理的预存款充值数据: \n".var_export($sdf,1));
if($ret['status'] == "succ" || $ret['status'] == "progress")
{
app::get('ectools')->rpcCall('user.deposit.recharge', ['user_id'=>$sdf['user_id'], 'fee'=>$sdf['cur_money'], 'memo'=>"预存款充值,用户名:{$sdf['user_name']};支付单号:{$sdf['payment_id']}"]);
}
}
else
{
logger::info("支付过程中,被处理的订单数据: \n".var_export($paymentBill,1));
if($paymentBill['status'] == "succ" || $paymentBill['status'] == "progress")
{
foreach($paymentBill['trade'] as $value)
{
app::get('ectools')->rpcCall('trade.pay.finish',array('tid'=>$value['tid'],'payment'=>$value['payment']));
}
}
}
}
catch(\Exception $e)
{
logger::info("支付过程中,处理订单出错后:$e->getMessage() \n".var_export($paymentBill,1)."\n----end----\n");
throw $e;
}
}

//支付成功给支付网关显示支付信息
if(method_exists($payments, 'ret_result')){
if($ret['pay_app_id'] == "teegonali" || $ret['pay_app_id'] == "teegonwxpay"){
$payments->ret_result($ret['money']);
}else{
$payments->ret_result($ret['payment_id']);
}
}
}
break;
case 'REFUND_SUCCESS':
// 退款成功操作
if ($sdf)
{
unset($sdf['payment_id']);
$obj_refund = app::get('ectools')->model('refund');
$sdf['refund_id'] = $obj_refund->gen_id();
$ret['status'] = 'succ';
if ($obj_refund->insert($sdf))
{
//处理单据的支付状态
$obj_refund_finish = kernel::service("order.refund_finish");
$obj_refund_finish->order_refund_finish($sdf, $ret['status'], 'font',$msg);
}
}
break;
case 'PAY_PDT_SUCC':
$ret['status'] = 'succ';
// 无需更新状态.
break;
case 'failed':
case 'error':
case 'cancel':
case 'invalid':
case 'timeout':
$is_updated = false;
$isUpdatedPay = payment::update($ret, $msg);
break;
}

// Redirect page.
if ($sdf['return_url'])
{
//header('Location: '.kernel::removeIndex(request::root()).$sdf['return_url']);
$sdf['return_url'] = unserialize($sdf['return_url']);
header('Location: '.url::action($sdf['return_url'][0],$sdf['return_url'][1]));
}
}

发表评论

您的电子邮箱地址不会被公开。 必填项已用*标注