예제 #1
0
 public function login()
 {
     $para = array('action' => 'PPLOGIN', 'username' => 'username', 'password' => $this->encrypt('abcdefghijk'), 'iphone' => '18658170800', 'time' => NOW_TIME);
     include_once APP_PATH . '/BaoyiPay/BaoyiPay.php';
     $key = '62def3a609f535dbc4ba6ac0471942dc';
     $xml = to_xmlstring($para);
     $mac = hash('sha256', $xml . $key);
     $para = array('xml' => $xml, 'mac' => $mac);
     $url = 'http://test.dreammove.cn/test/callback.html';
     $curl = curl_init($url);
     curl_setopt($curl, CURLOPT_HEADER, 0);
     // 过滤HTTP头
     curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
     // 显示输出结果
     curl_setopt($curl, CURLOPT_POST, true);
     // post传输数据
     curl_setopt($curl, CURLOPT_POSTFIELDS, $para);
     // post传输数据
     $responseText = curl_exec($curl);
     curl_close($curl);
     echo $responseText;
 }
예제 #2
0
 public function querycard()
 {
     if (IS_POST) {
         $uid = is_login();
         $head = $this->inithead('QP0007');
         //6228480328608732074
         $cardNo = $_POST['cardNo'];
         $merorderid = $_POST['merOrderId'];
         $card_id = $this->encrypt($head['clientDate'], $cardNo);
         $body = array('cardNo' => $card_id);
         $message = array('head' => $head, 'body' => $body);
         include_once APP_PATH . '/BaoyiPay/BaoyiPay.php';
         $xml = to_xmlstring($message);
         $mac = md5($xml . $this->config['KEY']);
         $para = array('xml' => $xml, 'mac' => $mac);
         D('AccountLog')->record($head, $xml, $mac, 0);
         $text = getHttpResponsePost($this->config['PAY_URL'], $para);
         $para = md5Response($text, $this->config['KEY']);
         if (!$para) {
             $this->ajaxReturn(array('status' => 0, 'info' => '信息错误'));
             exit;
         }
         $data = xml2arr($para['xml']);
         $head = $data['head'];
         $body = $data['body'];
         D('AccountLog')->record($head, $para['xml'], $para['mac'], 1);
         if ($head['respCode'] == 'C000000000') {
             $info = M('ProductPay')->where(array('merorderid' => $merorderid))->find();
             // 验证订单是否允许使用信用卡
             if ($info['allow_creditcard'] == 0) {
                 if ($body['cardType'] == '0') {
                     $this->error('该订单不允许使用信用卡支付。');
                 }
             }
             $card = M('QuickcardList')->where(array('uid' => $uid, 'cardNo' => $cardNo))->find();
             $bankinfo = $data['body'];
             if (!$card) {
                 //所属银行编号
                 $bankNo = $body['bankNo'];
                 $bankNm = $body['bankNm'];
                 if ($info['allow_creditcard'] == 0) {
                     $is_quick = M('BankInfo')->where(array('is_quick' => 1, 'bank_code' => $bankNo))->find();
                     //不存在
                     if (!$is_quick) {
                         $this->error('快捷支付暂不支持' . $bankNm . '的借记卡。');
                     }
                 }
                 $storableCardNo = substr($cardNo, 0, 6) . substr($cardNo, strlen($cardNo) - 4);
                 $id = M('QuickcardList')->add(array('uid' => $uid, 'cardNo' => $cardNo, 'bankNo' => $bankinfo['bankNo'], 'cardType' => $bankinfo['cardType'], 'bankNm' => $bankinfo['bankNm'], 'storableCardNo' => $storableCardNo));
                 $this->success('查询成功!', U('addstep2', array('id' => $id, 'merorderid' => $merorderid)));
             } else {
                 if ($card['status'] == 1) {
                     $this->error('您已经绑定了该银行卡。');
                 } else {
                     $this->success('查询成功!', U('addstep2', array('id' => $card['id'], 'merorderid' => $merorderid)));
                     return;
                 }
             }
         } else {
             $this->error($head['respMsg']);
         }
     }
 }
예제 #3
0
 private function savecheck($name, $cardid)
 {
     $config = C('SAVE_CHECK');
     $clientDate = time_format(NOW_TIME, 'YmdHis');
     $head = array('version' => '01', 'msgType' => '0001', 'chanId' => '99', 'merchantNo' => $config['MERCHANTID'], 'clientDate' => time_format(NOW_TIME, 'YmdHis'), 'tranFlow' => $config['MERCHANTID'] . $clientDate . rand(10000, 999999), 'tranCode' => 'SC0002', 'respCode' => '', 'respMsg' => '');
     $body = array('idName' => $name, 'idNum' => $cardid);
     include_once APP_PATH . '/BaoyiPay/BaoyiPay.php';
     $xml = to_xmlstring(array('head' => $head, 'body' => $body));
     $mac = md5($xml . $config['MERKEY']);
     $this->checklog($xml . '&' . $mac, 1);
     $para = array('xml' => $xml, 'mac' => $mac);
     $text = getHttpResponsePost($config['URL'], $para);
     $this->checklog($text, 2);
     $para = md5Response($text, $config['MERKEY']);
     if (!$para) {
         //$this->ajaxReturn(array('status'=>0, 'info'=>'信息错误'));
         return array('status' => 0, 'info' => '信息错误');
     }
     $data = xml2arr($para['xml']);
     if ($data['head']['respCode'] == 'C000000000') {
         return array('status' => 1, 'info' => '');
     } else {
         return array('status' => 0, 'info' => $data['head']['respMsg']);
     }
 }