/// <summary> /// Sisteme e-fatura gönderir /// </summary> /// <returns>Sisteme gönderilen faturanın bilgileri </returns> public SendUBLResponseType[] FaturaGonder(TextModel m, ArrayList sslList, BaseInvoiceUBL fatura) { var createdUBL = fatura.BaseUBL; // Fatura UBL i oluşturulur UBLBaseSerializer serializer = new InvoiceSerializer(); // UBL XML e dönüştürülür var strFatura = serializer.GetXmlAsString(createdUBL); // XML byte tipinden string tipine dönüştürülür byte[] zipliFile = ZipUtility.CompressFile(Encoding.UTF8.GetBytes(strFatura), createdUBL.UUID.Value); // XML ziplenir ServicePointManager.SecurityProtocol = TlsSetting.TlsSet(sslList); // TLS/SSL ayarları WebServisAdresDegistir(); using (new OperationContextScope(WsClient.InnerChannel)) { if (WebOperationContext.Current != null) { WebOperationContext.Current.OutgoingRequest.Headers.Add(HttpRequestHeader.Authorization, Authorization.GetAuthorization(m.Kullanici, m.Sifre)); } var req = new sendUBLRequest { VKN_TCKN = m.VknTckn, //tckn veya vkn SenderIdentifier = m.GbEtiketi, //gönderici birim etiketi ReceiverIdentifier = m.PkEtiketi, //alıcı posta kutusu DocType = "INVOICE", //gönderilen döküman tipi. zarf, fatura vs. DocData = zipliFile //içinde xml dosyası olan zip lenen dosya. }; return(WsClient.sendUBL(req)); } }
public async Task Execute() { if (Invoice == null) { throw new ArgumentNullException("Invoice boş olamaz!"); } var result = new ServiceResponse() { Hatali = false, }; _serviceProxy = IngHelper.CreateServiceProxy( ServiceInfo.ServiceUrl, ServiceInfo.UserName, ServiceInfo.Password); var request = new sendUBLRequest() { DocData = Serialization.SerializeToBytes(this.Invoice), SenderIdentifier = this.ServiceInfo.SupplierPB, ReceiverIdentifier = this.ServiceInfo.CustomerPB, DocType = "INVOICE", VKN_TCKN = Invoice.AccountingSupplierParty.Party.PartyIdentification[0].ID.Value, }; SendUBLResponseType[] response = _serviceProxy.sendUBL(request); result.Sonuc = response.Length > 0 ? "İşlem başarıyla tamamlandı" : "İşlem tamamlandı!"; result.Data = new { IntegratorResponse = response }; this.Result = Task.FromResult(result); }