Beispiel #1
0
        /// <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));
            }
        }
Beispiel #2
0
        /// <summary>
        /// Sisteme uygulama yanıtı gönderir
        /// </summary>
        /// <returns>Sisteme gönderilen uygulama yanıtının bilgileri</returns>
        public SendUBLResponseType[] UygulamaYanitiGonder(TextModel m, string gelenFaturaID, ArrayList sslList)
        {
            ApplicationResponseUBL applicationResponse = new ApplicationResponseUBL();
            var createdUBL = applicationResponse.CreateApplicationResponse(m.VknTckn, gelenFaturaID, m.IssueDate);        // Uygulama yanıtı UBL i oluşturulur
            UBLBaseSerializer serializer = new InvoiceSerializer();                                                       // UBL  XML e dönüştürülür
            var strUygulamaYaniti        = serializer.GetXmlAsString(createdUBL);                                         // XML  byte tipinden string tipine dönüştürülür

            byte[] zipliFile = ZipUtility.CompressFile(Encoding.UTF8.GetBytes(strUygulamaYaniti), 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
                {
                    SenderIdentifier   = m.PkEtiketi, //uygulama yanıtı gönderici birim etiketi
                    ReceiverIdentifier = m.GbEtiketi, //uygulama yanıtı alıcı posta kutusu
                    VKN_TCKN           = m.VknTckn,   // tckn veya vkn
                    DocType            = "APP_RESP",  //gönderilen döküman tipi
                    DocData            = zipliFile    //gönderilen uygulama yanıtının ziplenmiş byte datası
                };

                return(WsClient.sendUBL(req));
            }
        }
Beispiel #3
0
        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);
        }