Esempio n. 1
0
    public function NotifyProcess($data, &$msg)
    {
        Log::DEBUG("call back :" . json_encode($data));
        $notfiyOutput = array();
        if (!array_key_exists("transaction_id", $data)) {
            $msg = "输入参数不正确";
            return false;
        }
        //查询订单,判断订单真实性
        if (!$this->Queryorder($data["transaction_id"])) {
            $msg = "订单查询失败";
            return false;
        }
        return true;
    }
}
Log::DEBUG("begin notify");
$notify = new PayNotifyCallBack();
$notify->Handle(false);
$result = $notify->GetReturn_code();
Log::DEBUG("query-test:" . "============test================" . $result . '|' . $this->order_id);
if ($result == "SUCCESS") {
    header("location:http://www.yujiaqu.com/paySuccess.php");
    exit;
} else {
    header("location:http://www.yujiaqu.com/paySuccess.php");
    exit;
}
?>

Esempio n. 2
0
 public function callback()
 {
     $log = $this->config->get('wxpay_log');
     if ($log) {
         $this->log->write('WxPay :: One: ');
     }
     $this->load->library('wxpayexception');
     if ($log) {
         $this->log->write('WxPay :: Two: ');
     }
     $this->load->library('wxpayconfig');
     if ($log) {
         $this->log->write('WxPay :: Three: ');
     }
     $this->load->library('wxpaydata');
     if ($log) {
         $this->log->write('WxPay :: Four: ');
     }
     $this->load->library('wxpaynotify');
     if ($log) {
         $this->log->write('WxPay :: Five: ');
     }
     $this->load->library('wxpayapi');
     if ($log) {
         $this->log->write('WxPay :: Six: ');
     }
     $this->load->library('wxpaynotifycallback');
     if ($log) {
         $this->log->write('WxPay :: Seven: ');
     }
     $notify = new PayNotifyCallBack();
     if ($log) {
         $this->log->write('WxPay :: Eight: ');
     }
     $notify->Handle(false);
     $getxml = $GLOBALS['HTTP_RAW_POST_DATA'];
     libxml_disable_entity_loader(true);
     $result = json_decode(json_encode(simplexml_load_string($getxml, 'SimpleXMLElement', LIBXML_NOCDATA)), true);
     if ($notify->GetReturn_code() == "SUCCESS") {
         if ($result["return_code"] == "FAIL") {
             $this->log->write("WxPay ::【通信出错】:\n" . $getxml . "\n");
         } elseif ($result["result_code"] == "FAIL") {
             $this->log->write("WxPay ::【业务出错】:\n" . $getxml . "\n");
         } else {
             $order_id = $result['out_trade_no'];
             if ($log) {
                 $this->log->write('WxPay :: Order ID: ' . $order_id);
             }
             $this->load->model('checkout/order');
             $order_info = $this->model_checkout_order->getOrder($order_id);
             if ($order_info) {
                 if ($log) {
                     $this->log->write('WxPay :: 1: ');
                 }
                 $order_status_id = $this->config->get('wxpay_trade_success_status_id');
                 if (!$order_info['order_status_id']) {
                     $this->model_checkout_order->addOrderHistory($order_id, $order_status_id, '', true);
                     $this->log->write('WxPay :: 2: ');
                 } else {
                     $this->model_checkout_order->addOrderHistory($order_id, $order_status_id, '', true);
                     $this->log->write('WxPay :: 3: ');
                 }
                 //清除sesssion,避免客户返回不到成功页面而无法清除原有的购物车等信息
                 $this->cart->clear();
                 unset($this->session->data['shipping_method']);
                 unset($this->session->data['shipping_methods']);
                 unset($this->session->data['payment_method']);
                 unset($this->session->data['payment_methods']);
                 unset($this->session->data['guest']);
                 unset($this->session->data['comment']);
                 unset($this->session->data['order_id']);
                 unset($this->session->data['coupon']);
                 unset($this->session->data['reward']);
                 unset($this->session->data['voucher']);
                 unset($this->session->data['vouchers']);
                 unset($this->session->data['totals']);
                 if (isset($this->session->data['cs_shipfrom'])) {
                     unset($this->session->data['cs_shipfrom']);
                 }
                 if (isset($this->sesssion->data['personal_card'])) {
                     unset($this->sesssion->data['personal_card']);
                 }
             } else {
                 if ($log) {
                     $this->log->write('WxPay :: Seven: ');
                 }
             }
         }
     } else {
         $this->log->write('WxPay :: Nine: ' . $result);
     }
 }
Esempio n. 3
0
 public function callback()
 {
     $log = $this->config->get('wxpay_log');
     if ($log) {
         $this->log->write('WxPay :: One: ');
     }
     //$this->load->library('wxpayexception');
     require_once DIR_SYSTEM . 'library/wxpay/wxpayexception.php';
     if ($log) {
         $this->log->write('WxPay :: Two: ');
     }
     define('WXPAY_APPID', trim($this->config->get('wxpay_appid')));
     define('WXPAY_MCHID', trim($this->config->get('wxpay_mchid')));
     define('WXPAY_KEY', trim($this->config->get('wxpay_key')));
     define('WXPAY_APPSECRET', trim($this->config->get('wxpay_appsecret')));
     define('WXPAY_SSLCERT_PATH', DIR_SYSTEM . 'helper/wxpay_key/apiclient_cert.pem');
     define('WXPAY_SSLKEY_PATH', DIR_SYSTEM . 'helper/wxpay_key/apiclient_key.pem');
     define('WXPAY_CURL_PROXY_HOST', "0.0.0.0");
     define('WXPAY_CURL_PROXY_PORT', 0);
     define('REPORT_LEVENL', 1);
     //$this->load->library('wxpayconfig');
     require_once DIR_SYSTEM . 'library/wxpay/wxpayconfig.php';
     if ($log) {
         $this->log->write('WxPay :: Three: ');
     }
     //$this->load->library('wxpaydata');
     require_once DIR_SYSTEM . 'library/wxpay/wxpaydata.php';
     if ($log) {
         $this->log->write('WxPay :: Four: ');
     }
     //$this->load->library('wxpaynotify');
     require_once DIR_SYSTEM . 'library/wxpay/wxpaynotify.php';
     if ($log) {
         $this->log->write('WxPay :: Five: ');
     }
     //$this->load->library('wxpayapi');
     require_once DIR_SYSTEM . 'library/wxpay/wxpayapi.php';
     if ($log) {
         $this->log->write('WxPay :: Six: ');
     }
     //$this->load->library('wxpaynotifycallback');
     require_once DIR_SYSTEM . 'library/wxpay/wxpaynotifycallback.php';
     if ($log) {
         $this->log->write('WxPay :: Seven: ');
     }
     $notify = new PayNotifyCallBack();
     if ($log) {
         $this->log->write('WxPay :: Eight: ');
     }
     $notify->Handle(false);
     $getxml = $GLOBALS['HTTP_RAW_POST_DATA'];
     //$getxml = file_get_contents('php://input');
     libxml_disable_entity_loader(true);
     $result = json_decode(json_encode(simplexml_load_string($getxml, 'SimpleXMLElement', LIBXML_NOCDATA)), true);
     if ($notify->GetReturn_code() == "SUCCESS") {
         if ($result["return_code"] == "FAIL") {
             $this->log->write("WxPay ::【通信出错】:\n" . $getxml . "\n");
         } elseif ($result["result_code"] == "FAIL") {
             $this->log->write("WxPay ::【业务出错】:\n" . $getxml . "\n");
         } else {
             $order_id = $result['out_trade_no'];
             if ($log) {
                 $this->log->write('WxPay :: Order ID: ' . $order_id);
             }
             $this->load->model('checkout/order');
             $order_info = $this->model_checkout_order->getOrder($order_id);
             if ($order_info) {
                 if ($log) {
                     $this->log->write('WxPay :: 1: ');
                 }
                 $order_status_id = $this->config->get('wxpay_trade_success_status_id');
                 if (!$order_info['order_status_id']) {
                     $this->model_checkout_order->addOrderHistory($order_id, $order_status_id, '', true);
                     if ($log) {
                         $this->log->write('WxPay :: 2: ');
                     }
                 } else {
                     $this->model_checkout_order->addOrderHistory($order_id, $order_status_id, '', true);
                     if ($log) {
                         $this->log->write('WxPay :: 3: ');
                     }
                 }
                 //清除sesssion,避免客户返回不到成功页面而无法清除原有的购物车等信息
                 $this->cart->clear();
                 unset($this->session->data['shipping_method']);
                 unset($this->session->data['shipping_methods']);
                 unset($this->session->data['payment_method']);
                 unset($this->session->data['payment_methods']);
                 unset($this->session->data['guest']);
                 unset($this->session->data['comment']);
                 unset($this->session->data['order_id']);
                 unset($this->session->data['coupon']);
                 unset($this->session->data['reward']);
                 unset($this->session->data['voucher']);
                 unset($this->session->data['vouchers']);
                 unset($this->session->data['totals']);
                 if (isset($this->session->data['cs_shipfrom'])) {
                     unset($this->session->data['cs_shipfrom']);
                 }
                 if (isset($this->sesssion->data['personal_card'])) {
                     unset($this->sesssion->data['personal_card']);
                 }
             } else {
                 if ($log) {
                     $this->log->write('WxPay :: Seven: ');
                 }
             }
         }
     } else {
         if ($log) {
             $this->log->write('WxPay :: Nine: ' . $result);
         }
     }
 }