Exemple #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));
            }
        }
Exemple #2
0
        /// <summary>
        /// Sisteme e-Arşiv fatura gönderir
        /// </summary>
        /// <returns>Sisteme gönderilen e-Arşiv faturanın bilgileri ve binary PDF datası</returns>
        public sendInvoiceResponseType EArsivGonder(TextModel m, BaseInvoiceUBL arsiv, ArrayList sslList)
        {
            var createdUBL = arsiv.BaseUBL;                                                                       // e-Arşiv 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
            string hash      = GetHashInfo(zipliFile);                                                            // zipli dosyanın hash bilgisi alınır

            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 sendInvoiceRequest
                {
                    sendInvoiceRequestType = new SendInvoiceRequestType
                    {
                        senderID            = m.VknTckn,             //gönderici VKN-TCKN
                        receiverID          = "2222222222",          //alıcı VKN-TCKN
                        fileName            = createdUBL.UUID.Value, //dosya ismi
                        binaryData          = zipliFile,             //gönderilecek fatura
                        docType             = "XML",                 //dosya tipi
                        hash                = hash,                  //dosyanın hash bilgisi
                        customizationParams = new[]
                        {
                            new CustomizationParam
                            {
                                paramName  = "BRANCH", //parametre ismi
                                paramValue = m.Sube    //şube adı opsiyoneldir. Gönderilmez ise varsayılan olarak "default" şube setlenir.
                            }
                        }
                    }
                };

                return(WsClient.sendInvoice(req.sendInvoiceRequestType));
            }
        }