diff --git a/class-wc-huayi-score.php b/class-wc-huayi-score.php index 84607d3..22d2c70 100644 --- a/class-wc-huayi-score.php +++ b/class-wc-huayi-score.php @@ -144,6 +144,11 @@ class WC_Huayi_Score extends WC_Payment_Gateway { if ($balanceResult['data']['score'] >= $order->order_total ) {//积分够扣 $payResult = $huayiScoreSdk->pay($huayi_uid,$order->order_total,'订单号:'.$order_id);//执行扣款 + if (!$payResult) { + wc_add_notice( __('结算失败:', 'huayi_score') . $huayiScoreSdk->getError(), 'error' ); + return; + } + //支付成功 if ( $payResult['data']['pay_status'] == 'success' ) {//TODO TEST @@ -163,8 +168,7 @@ class WC_Huayi_Score extends WC_Payment_Gateway { 'redirect' => $this->get_return_url( $order ) ); } else { //支付失败 - $error_message = '支付接口出错 - ' . $payResult; - wc_add_notice( __('结算失败:', 'huayi_score') . $error_message, 'error' ); + wc_add_notice( __('结算失败:', 'huayi_score') . $payResult, 'error' ); return; } } else { //积分不足