@@ -142,15 +142,10 @@ class WC_Huayi_Score extends WC_Payment_Gateway {
|
||||
return;
|
||||
}
|
||||
|
||||
//debug
|
||||
wc_add_notice( __('查询成功:', 'huayi_score') . $balanceResult, 'error' );
|
||||
return;
|
||||
//debug
|
||||
|
||||
if ($balanceResult >= $order->order_total ) {//积分够扣
|
||||
$payResult = $huayiScoreSdk->pay($huayi_uid,$order->order_total,'订单号:'.$order_id);//执行扣款 TODO
|
||||
if ($balanceResult['data']['score'] >= $order->order_total ) {//积分够扣
|
||||
$payResult = $huayiScoreSdk->pay($huayi_uid,$order->order_total,'订单号:'.$order_id);//执行扣款
|
||||
//支付成功
|
||||
if ( $payResult['uid'] > 0 ) {//TODO 修正状态判断
|
||||
if ( $payResult['data']['pay_status'] == 'success' ) {//TODO TEST
|
||||
|
||||
//更新订单状态
|
||||
//$order->update_status( 'on-hold', __( '等待积分支付', 'huayi_score' ) );//需要支付回调的接口才需要
|
||||
@@ -197,10 +192,10 @@ class WC_Huayi_Score extends WC_Payment_Gateway {
|
||||
$huayi_uid = get_user_meta( $order->get_user_id() , 'huayi_uid',true );
|
||||
|
||||
if ( $huayi_uid > 0 ) {
|
||||
$huayiScoreSdk = new HuayiScoreSdk(array('apiurl'=>'1','token'=>'1'));
|
||||
$huayiScoreSdk = new HuayiScoreSdk(array('apiurl'=>$this->apiurl,'token'=>$this->token));
|
||||
$result = $huayiScoreSdk->refund($huayi_uid,$amount,'退款订单号:'.$order_id.'.退款原因:'.$reason);//执行退款
|
||||
|
||||
if ( $result['uid'] > 0 ) {//TODO 修正状态判断
|
||||
if ( $result['data']['refund_status'] == 'success' ) {//TODO TEST
|
||||
$order->add_order_note( sprintf( __( '退款时间: %s - 退款会员ID: %s', 'huayi_score' ), date("Y-m-d H:i:s"),$result['uid'] ) );
|
||||
return true;
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user