📁 PHP Dosya Yöneticisi
/
/
home
/
demodesigncom
/
e-ticaretv11.demodesign.com.tr
/
system
/
library
/
eticdokargo
📝
aras.php
← Geri Dön
<?php /** Aras Kargo **/ class Aras implements EticdoKargoBase { public function hesap_test($data){ $user_name = $this->method[$data['method']]['user_name']; $user_pass = $this->method[$data['method']]['user_pass']; $cargoKeys = isset($data['barkodlar'])?$data['barkodlar']:array(); $service_url ="http://customerws.araskargo.com.tr/arascargoservice.asmx?WSDL"; $data['barkodlar'] = array('1'); $this->result = $this->kayit_iptal($data); if($this->result['status']==1){ $this->result['html'] .= '<ul>'; $this->result['html'] .= '<li><strong class="text-success">Başarılı</strong></li>'; $this->result['html'] .= '<li>Servis: '.$service_url.'</li>'; $this->result['html'] .= '<li>Kullanıcı Adı: '.$user_name.'</li>'; $this->result['html'] .= '<li>Şifre: '.$user_pass.'</li>'; $this->result['html'] .= '</ul>'; } else{ $this->result['html'] .= '<ul>'; $this->result['html'] .= '<li><strong class="text-danger">Başarısız</strong></li>'; $this->result['html'] .= '<li>Servis: '.$service_url.'</li>'; $this->result['html'] .= '<li>Kullanıcı Adı: '.$user_name.'</li>'; $this->result['html'] .= '<li>Şifre: '.$user_pass.'</li>'; $this->result['html'] .= '</ul>'; } return $this->result; } public function kayit_ac($data){ $user_name = $this->method[$data['method']]['user_name']; $user_pass = $this->method[$data['method']]['user_pass']; $service_url = 'http://customerws.araskargo.com.tr/arascargoservice.asmx?WSDL'; if(defined('ETİCDOKARGO_TEST')){ $user_name = 'neodyum'; $user_pass = 'nd2580'; $service_url = 'http://customerservicestest.araskargo.com.tr/arascargoservice/arascargoservice.asmx?WSDL'; } $order = array( "UserName" => $user_name, "Password" => $user_pass, "TradingWaybillNumber" => $data['barcode'], "InvoiceNumber" => $data['order_id'], "IntegrationCode" => $data['barcode'], "ReceiverName" => $data['name'], "ReceiverAddress" => $data['address'], "ReceiverCityName" => $data['zone'], "ReceiverTownName" => $data['city'], "ReceiverPhone1" => $data['tel'], "PayorTypeCode" => $data['paket'], "IsCod" => 0, //'Tahsilatlı (0=Hayır, 1=Evet) "PieceCount" => 1, "PieceDetails" => array( array("VolumetricWeight"=>"2", "Weight"=>"2", "BarcodeNumber"=>$data['barcode'], "ProductNumber"=>$data['order_id'], "Description"=>'Online Satış' ) ), "IsWorldWide" => 0,// (0=Yurtiçi, 1=Yurtdışı) ); if($data['method'] == 'codcash_normal' ) { $order['IsCod'] =1; $order['CodCollectionType'] = 0; //0-Nakit,1-Kredi Kartı $order['CodAmount'] =(float)$data['total']; } else if($data['method'] == 'codcc_normal') { $order['IsCod'] =1; $order['CodCollectionType'] = 1; //0-Nakit,1-Kredi Kartı $order['CodAmount'] =(float)$data['total']; } error_reporting(0); @ini_set('display_errors', 0); $this->result['status'] = 0; $this->result['message'] = 'İşlem Yapılamadı'; $this->result['data']['method'] = $data['method']; $this->result['data']['order_id'] = $data['order_id']; $this->result['data']['kargo_tarih'] = date('Y-m-d H:i:s'); $this->result['data']['kargo_firma'] = 'aras'; $this->result['data']['kargo_barcode'] = $data['barcode']; $this->result['data']['kargo_talepno'] = ''; $this->result['data']['order_status_id'] = $data['order_status_id']; try{ $send['orderInfo']['Order'] = array($order); $send['userName'] = $user_name; $send['password'] = $user_pass; $response = $this->getSOAP($service_url, 'setOrder', $send ); if(isset($response['SetOrderResult']) ) { if(isset($response['SetOrderResult']['OrderResultInfo'])){ if($response['SetOrderResult']['OrderResultInfo']['ResultCode']==0){ $this->result['status'] = 1; $this->result['message'] = $this->method[$data['method']]['method_name'].' Kargo Kaydı Açıldı'; $this->result['data']['kargo_url'] = ''; } else{ $this->result['status'] = 0; $this->result['message'] = $response['SetOrderResult']['OrderResultInfo']['ResultMessage']; } } else{ $this->result['status'] = 0; $this->result['message'] = '102'; } $this->result['data']['kargo_talepno'] = $response['ShippingOrderResultVO']['jobId']; } else { $this->result['status'] = 0; $this->result['message'] = '102'; } } catch(Exception $e) { $this->result['status'] = 0; $this->result['message'] = 'Kargo Servislerine Bağlanılamadı. Lütfen tekrar deneyiniz. <br>'.$e->getMessage(); } return $this->result; } public function kayit_iptal($data){ $this->result['status'] = 0; $user_name = $this->method[$data['method']]['user_name']; $user_pass = $this->method[$data['method']]['user_pass']; $integrationCode = isset($data['barkodlar'])?current($data['barkodlar']):''; $service_url ="http://customerws.araskargo.com.tr/arascargoservice.asmx?WSDL"; $send = array('integrationCode'=>$integrationCode, 'userName'=>$user_name, 'password'=>$user_pass ); $response = $this->getSOAP($service_url, 'CancelDispatch', $send ); if(isset($response['CancelDispatchResult']) && $response['CancelDispatchResult']['ResultCode']>=-1 ){ $this->result['status'] = 1; if(isset($response['CancelDispatchResult']['ResultMessage'])){ $this->result['message'] = $response['CancelDispatchResult']['ResultMessage']; } else{ $this->result['message'] = '#101'; } } return $this->result; } public function takip_linki_al($data){ } public function takip_kodu_al($data){ } public function kargo_durumu_al($data){ $this->result['status'] = 0; $this->result['data'] = $data; $user_name = $this->method[$data['method']]['user_name']; $user_pass = $this->method[$data['method']]['user_pass']; $takip_user = $this->takip_user; $takip_pass = $this->takip_pass; $user_code = $this->method[$data['method']]['user_code']; $IntegrationCode = $data['kargo_barcode']; error_reporting(0); @ini_set('display_errors', 0); try{ $service_url = 'http://customerservices.araskargo.com.tr/ArasCargoCustomerIntegrationService/ArasCargoIntegrationService.svc?wsdl'; $loginInfo = '<LoginInfo> <UserName>'.$takip_user.'</UserName> <Password>'.$takip_pass .'</Password> <CustomerCode>'.$user_code.'</CustomerCode> </LoginInfo>'; $queryInfo = "<QueryInfo> <QueryType>1</QueryType> <IntegrationCode>$IntegrationCode</IntegrationCode> </QueryInfo>"; $send = array('loginInfo'=>$loginInfo , 'queryInfo'=>$queryInfo); if(isset($_GET['debug'])) print_r($send); $response = $this->getSOAP($service_url, 'GetQueryXML', $send ); if(isset($_GET['debug'])) print_r($response); if(isset($response['GetQueryXMLResult'])) { $xml = simplexml_load_string($response['GetQueryXMLResult']); $xml = json_encode($xml); $xml = json_decode($xml, true); if( isset($xml['Cargo']) ){ if( !isset($xml['Cargo']['DURUMU'])){ $xml['Cargo'] = current($xml['Cargo']); } $this->result['data']['kargo_sonuc'] = $xml['Cargo']['DURUMU']; $kargo_takipno = isset($xml['Cargo']['KARGO_TAKIP_NO'])?$xml['Cargo']['KARGO_TAKIP_NO']:''; if($kargo_takipno) { $this->result['data']['kargo_url'] = 'http://kargotakip.araskargo.com.tr/mainpage.aspx?code='.$kargo_takipno; } } } $this->result['message'] = "Durumu: ".$this->result['data']['kargo_sonuc']; } catch(Exception $e) { $this->result['message'] = 'Kargo Servislerine Bağlanılamadı. Lütfen tekrar deneyiniz. <br>'.$e->getMessage(); } return $this->result; } private function getSOAP($service_url, $service_method, $send ){ $this->result['message'] = ''; if (!extension_loaded('soap')) { throw new Exception('SOAP requests is unavailable'); } try{ if(defined('ETİCDOKARGO_DEBUG')){ echo "<br>Servis Endpoint: $service_url<br>\r\n<pre>"; echo "<br>Request data:<br>\r\n<pre>"; print_r($send); } $client = new SoapClient($service_url, array('trace' => 1, 'exceptions' => 1)); $response = $client->$service_method( $send ); if(defined('ETİCDOKARGO_DEBUG')){ echo "<br>Response data:<br>\r\n<pre>"; print_r($response); } return json_decode(json_encode($response),1); } catch(Exception $e) { if(defined('ETİCDOKARGO_DEBUG')){ echo "<br>Exception data:<br>\r\n"; print_r($e->getMessage()); } $this->result['message'] = 'Kargo Servislerine Bağlanılamadı. Lütfen tekrar deneyiniz. <br>'.$e->getMessage(); } } } ?>
💾 Kaydet
İptal
📝 Yeniden Adlandır
İptal
Kaydet
🔐 Dosya İzinleri (chmod)
İzin Değeri:
Hızlı Seçim:
777
755
644
600
777
= Herkes okur/yazar/çalıştırır
755
= Sahip tam, diğerleri okur/çalıştırır
644
= Sahip okur/yazar, diğerleri okur
600
= Sadece sahip okur/yazar
İptal
Uygula