📁 PHP Dosya Yöneticisi
/
/
home
/
demodesigncom
/
e-ticaretv11.demodesign.com.tr
/
system
/
library
/
eticdokargo
📝
mng.php
← Geri Dön
<?php /** Mng Kargo **/ class Mng implements EticdoKargoBase { public $order_key='e523f1b80e2a4cc53e821368073d86a6' ; public function hesap_test($data){ $user_name = $this->method[$data['method']]['user_name']; $user_pass = $this->method[$data['method']]['user_pass']; $service_url ="http://service.mngkargo.com.tr/musterikargosiparis/musterikargosiparis.asmx?WSDL"; $send = array('pMusteriSiparisNo'=>'1', 'pKullaniciAdi'=>$user_name, 'pSifre'=>$user_pass ); $response = $this->getSOAP($service_url, 'MusteriSiparisIptal', $send ); if(isset($response['MusteriSiparisIptalResult']) ){ if(isset($response['pWsError'])){ if(strpos($response['pWsError'], 'E00')===false){ $this->result['status'] = 1; } } else{ $this->result['status'] = 1; } } 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://service.mngkargo.com.tr/musterikargosiparis/musterikargosiparis.asmx?WSDL'; if(defined('ETİCDOKARGO_TEST')){ $user_name = '35615719'; $user_pass = '356TST2425XGHPRFTG'; $service_url = 'http://service.mngkargo.com.tr/tservis/musterikargosiparis.asmx?WSDL'; } $send = array( "pKullaniciAdi" => $user_name, "pSifre" => $user_pass, "pFlKapidaOdeme" => 0, "pChVergiNummngi" => "", "pChVergiDairesi" => "", "pChEmail" => "", "pChFax" => "", "pChTelIs" => "", "pChTelCep" => $data['tel'], "pChTelEv" => "", "pChSokak" => "", "pChCadde" => "", "pChMeydanBulvar" => "", "pChMahalle" => "", "pChSemt" => "", "pChAdres" => $data['address'], "pChIlce" => $data['city'], "pChIl" => $data['zone'], "pFlAdresFarkli" => "0", "pLuOdemeSekli" => "P", "pChSiparisNo" => $data['barcode'], "pAliciMusteriAdi" => html_entity_decode($data['name'], ENT_COMPAT, "UTF-8"), "pAliciMusteriBayiNo" => "", "pAliciMusteriMngNo" => "", "pKargoParcaList" => "1:1:1:URUN:1:;", "pFlGnSms" => 0, "pFlAlSms" => 0, "pChIcerik" => "Online Satış", "pChIrsaliyeNo" => $data['barcode'], "pPrKiymet" => 0, "pChBarkod" => $data['barcode'] ); if($data['method'] == 'codcash_normal' ) { $send["pFlKapidaOdeme"] = 1; $send["pLuOdemeSekli"] = "P"; $send["pPrKiymet"] = number_format((float)$data['total'],2,',','');//tahsilatlı teslimat } else if($data['method'] == 'codcc_normal') { $send["pFlKapidaOdeme"] = 1; $send["pLuOdemeSekli"] = "P"; $send["pPrKiymet"] = number_format((float)$data['total'],2,',','');//tahsilatlı teslimat } 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'] = 'mng'; $this->result['data']['kargo_barcode'] = $data['barcode']; $this->result['data']['kargo_talepno'] = ''; $this->result['data']['order_status_id'] = $data['order_status_id']; try{ $response = $this->getSOAP($service_url, 'SiparisGirisiDetayliV2', $send ); if(isset($response['SiparisGirisiDetayliV2Result'])){ if($response['SiparisGirisiDetayliV2Result']==1) { $this->result['status'] = 1; $this->result['message'] = $this->method[$data['method']]['method_name'].' Kargo Kaydı Açıldı'; $this->result['data']['kargo_talepno'] = ''; } else { $this->result['status'] = 0; $this->result['message'] = $response['SiparisGirisiDetayliV2Result']; } } else { $this->result['status'] = 0; $this->result['message'] = 'Geçersiz servis sonucu.'; } } 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']; $cargoKey = isset($data['barkodlar'])?current($data['barkodlar']):'1'; $service_url ="http://service.mngkargo.com.tr/musterikargosiparis/musterikargosiparis.asmx?WSDL"; $send = array('pMusteriSiparisNo'=>$cargoKey, 'pKullaniciAdi'=>$user_name, 'pSifre'=>$user_pass ); $response = $this->getSOAP($service_url, 'MusteriSiparisIptal', $send ); if(isset($response['MusteriSiparisIptalResult']) ){ if($response['MusteriSiparisIptalResult']){ $this->result['status'] = 1; $this->result['message'] = $cargoKey.' BArkodlu Gönderi İptal edildi.'; } else { $this->result['message'] = $response['pWsError']; } } 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']; $talep_no = $data['kargo_barcode']; error_reporting(0); @ini_set('display_errors', 0); try{ $service_url = 'http://service.mngkargo.com.tr/musterikargosiparis/musterikargosiparis.asmx?wsdl'; $send = array('pMusteriNo'=>$user_name, 'pSifre'=>$user_pass, 'pSiparisNo'=>$talep_no); $response = $this->getSOAP($service_url, 'KargoBilgileriByReferans', $send ); $xml = simplexml_load_string($response['KargoBilgileriByReferansResult']['any']); $json = json_encode($xml); $soap_result = json_decode($json,TRUE); if(isset($soap_result['NewDataSet']) && isset( $soap_result['NewDataSet']['Table1'])) { $detail = $soap_result['NewDataSet']['Table1']; if(isset($detail['KARGO_STATU'])) { $this->result['data']['kargo_sonuc'] = $detail['KARGO_STATU_ACIKLAMA']; $this->result['message'] = $detail['KARGO_STATU_ACIKLAMA']; //$kargo_link = ''; if(isset($detail['KARGO_TAKIP_URL'])) { $this->result['data']['kargo_url'] = $detail['KARGO_TAKIP_URL']; } } $this->result['status'] = 1; } else { $this->result['message'] = "#api Hatası: ".$response->ShippingDeliveryVO->outResult; } } 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_TEST')){ 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_TEST')){ 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_TEST')){ 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