function CardCharging_() { if ($this->SessionID == null || $this->SessionID == "") { $login = new login(); $login->m_UserName = $this->m_UserName; $login->m_Pass = $this->m_Pass; $login->m_PartnerID = $this->m_PartnerID; $login->soapClient = $this->soapClient; //var_dump($login); $loginresponse = new loginResponse(); $loginresponse = $login->login_(); if ($loginresponse->m_Status == "1") { //print_r($loginresponse); //Nen luu lai bien SessionID de thuc hien cac ham charging tiep theo //Tranh viec moi giao dich charging lai login 1 lan nhu vay giao dich se rat cham. $this->SessionID = bin2hex($loginresponse->m_SessionID); } else { return; } } ///Bat dau thuc hien charging $Ojb = new CardChargingResponse(); $key = $this->Hextobyte($this->SessionID); //print_r($this-> m_SessionID); //print_r($this->m_MPIN); //$keytesst = base64_encode($key); //print_r($keytesst); $ObjTriptDes = new TriptDes($key); try { $strEncreped = $ObjTriptDes->encrypt($this->m_MPIN); //print_r ($strEncreped); //$decode = $ObjTriptDes->decrypt( $strEncreped); //print_r ($decode); $Mpin = $this->ByteToHex($strEncreped); $Card_DATA = $this->ByteToHex($ObjTriptDes->encrypt($this->m_Card_DATA)); //print_r($Card_DATA); } catch (Exception $ex) { echo "Co loi xay ra khi ma hoa mpin: " . $ex; } //$soapClient = new Soapclient("http://192.168.0.85:10001/CardChargingGW_0108/services/Services?wsdl"); try { //print_r($this); $result = $this->soapClient->cardCharging($this->m_TransID, $this->m_UserName, $this->m_PartnerID, $Mpin, $this->m_Target, $Card_DATA, md5($this->SessionID)); // goi ham login de lay session id du lieu tra ve la mot mang voi cac thong tin message, sessionid,status,transid //print_r($result); } catch (Exception $ex) { echo "Co loi xay ra khi thuc hien charging: " . $ex; } $Obj->m_Status = $result->status; $Obj->m_Message = $result->message; $Obj->m_TRANSID = $result->transid; $Obj->m_AMOUNT = $result->amount; $resAmount = $ObjTriptDes->decrypt($this->Hextobyte($result->responseamount)); $Obj->m_RESPONSEAMOUNT = $resAmount; //$result->responseamount; if ($Obj->m_Status == 3 || $Obj->m_Status == 7) { $this->SessionID = null; } // print_r($Obj); return $Obj; }