Closed ahmetaksoy1985 closed 1 year ago
aynı hatayı bende alıyrum. son bir haftadır.
Çözdüm. Benim repodan kullanabilirsiniz. https://github.com/ahmetaksoy1985/e-arsiv-fatura-dotnet https://github.com/BFYDigital/e-arsiv-fatura-dotnet/issues/7#issuecomment-1518416695
hala token alamıyor
Benim repodan indirip kullanırsanız çalışıyor. Ne hata alıyorsunuz? https://github.com/ahmetaksoy1985/e-arsiv-fatura-dotnet
Benim repodan indirip kullanırsanız çalışıyor. Ne hata alıyorsunuz? https://github.com/ahmetaksoy1985/e-arsiv-fatura-dotnet
Ahmet Bey, iyi akşamlar öncelikle ilginiz için teşekkür ederim. Ben sizin projeden kurdum referanslarımı ancak yine token alamadım. Özellikle client.DefaultRequestHeaders.Add("user-agent", "Prod");
satırını kontrol ettim ancak yine de token vermedi
Xunit.Sdk.NotNullException: 'Assert.NotNull() Failure
Ben console uygulamasından kütüphaneyi kullandım çalıştı. Unit test yazıyorsunuz galiba. XUnit’le ilgili ne olduğunu tam anlayamadım. Denemem lazım. Ayrıca ben kendim özel olarak yazdığım kodlarda da aynı sorunu yaşamıştım. Önce RestClient ile geçici olarak çözdüm. Daha sonra sorunun HttpClient.DefaultRequestHeaders’a user-agent eklenmemesinden olduğunu anladım. Kendi kodlarımı da düzelttim. Hepsi çalışıyor. “Test” yazan kısmı "Prod" olarak değiştirmenize gerek yok. Sadece user-agent gönderilsin diye o şekilde girdim. Önemli olan user-agent gönderilmesi. Başka user-agent da girebilirsiniz. Sonuç olarak Timeout hatası almıyorsunuz.
Aslında Ahmet Bey token aldığını farkettim bir şekilde şu ekran görüntüsündende anlaşılacağı gibi asenkron Login fonksiyonu nesneden Tokeni geri değer döndürmüyor sanırım neden bilmiyorum ekran görüntüsüne bir göz atabilme şansınız var mı?
Ben console uygulamasından kütüphaneyi kullandım çalıştı. Unit test yazıyorsunuz galiba. XUnit’le ilgili ne olduğunu tam anlayamadım. Denemem lazım. Ayrıca ben kendim özel olarak yazdığım kodlarda da aynı sorunu yaşamıştım. Önce RestClient ile geçici olarak çözdüm. Daha sonra sorunun HttpClient.DefaultRequestHeaders’a user-agent eklenmemesinden olduğunu anladım. Kendi kodlarımı da düzelttim. Hepsi çalışıyor. “Test” yazan kısmı "Prod" olarak değiştirmenize gerek yok. Sadece user-agent gönderilsin diye o şekilde girdim. Önemli olan user-agent gönderilmesi. Başka user-agent da girebilirsiniz. Sonuç olarak Timeout hatası almıyorsunuz.
faturaService.GetToken().Wait();
Çalışmıştı bende. GetToken, Login komutunu çağırıyor. Token aldıktan sonra başka komutları da çalıştırmıştım. CreateDraftInvoice yapmamıştım sadece Test sunucusuna giriş yapılamadığı için. Şu an deneyemiyorum maalesef. Birkaç gün sonra ancak deneme fırsatım olacak.
Geç oldu kusura bakmayın. Konsol uygulamasından e-arsiv-fatura-dotnet projesini referans olarak tanımladıktan sonra aşağıdaki kodlarla token alıp userdata görüntüleyebiliyorum. Login fonksiyonu token geri döndürmese diğer fonksiyonlar çalışmaz zaten.
https://github.com/ahmetaksoy1985/e-arsiv-fatura-dotnet
`// See https://aka.ms/new-console-template for more information using BFY.Fatura; using BFY.Fatura.Configuration;
var configuration = FaturaServiceConfigurationFactory.Create(); configuration.ServiceType = ServiceType.Prod; configuration.Username = "Kullanıcı Adı"; configuration.Password = "Parola";
FaturaService faturaService = new(configuration);
faturaService.GetToken().Wait();
var userdata = faturaService.GetUserData().GetAwaiter().GetResult();`
@ahmetaksoy1985 Ahmet Bey merhaba birşey soracaktım size ben anca projeye geri dönebildim, bu defa charset problemiyle karşılaştım. Örneğin fatura nesnesi oluştururken name alanına "Orçun" girdiğimde "Orçun" olarak faturaya taşınıyor
configuration.Language = "tr";
olarak ayarlı olsa da sorun nereden kaynaklanıyor bulamadım.
Rica etsem bir göz atabilir misiniz https://github.com/Orcunary/BFY.Fatura/tree/master/faturaOlustur
Düzeltebildiniz mi? HttpServices.cs dosyasını değiştirmişsiniz. Ben aktif olarak kullanmıyorum kodları. Benim kendi yazdığım kodlar vardı onları kullanıyorum. Bugün deneyip dönerim size.
HttpServices.cs Dosyasını düzelttim ama sonuç alamadım maalesef :( Sizi de böyle uğraştırıyorum yardımlarınız için tekrar teşekkürler hocam. Birde e-posta adresinizi alabilir miyim? iletmek istediğim bir konu varda...
Tamam. Ben düzeltirim bugün. Benim daha önceden kendi yazdığım kodlar çalışıyor. Aktif olarak kullanıyorum. Bu kodları tam anlamıyla test etme şansım olmamıştı.
Düzelttim. Json Türkçe karakter olmadan Post etmek gerekiyor. System.Text.Json ile yazmıştım kendi kodlarımı. Otomatik olarak Türkçe karakterleri escapeliyor. Newtonsoft ise Türkçe karakterleri de içeriyor. Bu repo Newtonsoft kullanıyor diye ona uygun olarak kullandım.
string serialized = JsonConvert.SerializeObject(data, Formatting.Indented, new JsonSerializerSettings() { StringEscapeHandling = StringEscapeHandling.EscapeNonAscii });
Mail adresim gmail.
HttpServices.cs Dosyasını düzelttim ama sonuç alamadım maalesef :( Sizi de böyle uğraştırıyorum yardımlarınız için tekrar teşekkürler hocam. Birde e-posta adresinizi alabilir miyim? iletmek istediğim bir konu varda...
@ahmetaksoy1985 çok teşekkürler ederim yardımlarınız için 🙏 epostam ulaştı mı size Ahmet Bey
Ulaştı. Çok teşekkür ederim.
GetRecipientDataByTaxIDOrTRID düzelttim.
https://github.com/ahmetaksoy1985/e-arsiv-fatura-dotnet
`var configuration = FaturaServiceConfigurationFactory.Create(); configuration.ServiceType = ServiceType.Prod; configuration.Username = ""; configuration.Password = ""; FaturaService faturaService = new(configuration); long taxId = long.Parse(""); await faturaService.GetToken();
var response = await faturaService.GetRecipientDataByTaxIDOrTRID(taxId);
if(response is GIBResponseModel
Ahmet Bey özür dilerim çok başınızı ağrıttım RecipientModel i güncelledim ama yapamadım bu kod yine hata verdi; neyi yanlış yaptım acaba?
var configuration = FaturaServiceConfigurationFactory.Create();
configuration.ServiceType = ServiceType.Prod;
configuration.Username = "------";
configuration.Password = "------";
FaturaService faturaService = new(configuration);
long taxId = long.Parse(vergikimlik.Text);
await faturaService.GetToken();
GIBResponseModel<List<RecipientModel>> response = await
faturaService.GetRecipientDataByTaxIDOrTRID(taxId);
List<RecipientModel> recipients = response.data;
foreach (RecipientModel recipient in recipients)
{
adi.Text = recipient.adi;
soyadi.Text = recipient.soyadi;
unvan.Text = recipient.unvan;
vergidairesi.Text = recipient.vergiDairesi;
}
Orçun DİYARBAKIRLI
ahmetaksoy1985 @.***>, 4 Haz 2023 Paz, 19:07 tarihinde şunu yazdı:
GetRecipientDataByTaxIDOrTRID düzelttim.
https://github.com/ahmetaksoy1985/e-arsiv-fatura-dotnet
`var configuration = FaturaServiceConfigurationFactory.Create(); configuration.ServiceType = ServiceType.Prod; configuration.Username = ""; configuration.Password = ""; FaturaService faturaService = new(configuration); long taxId = long.Parse(""); await faturaService.GetToken();
var response = await faturaService.GetRecipientDataByTaxIDOrTRID(taxId);
if(response is GIBResponseModel) { RecipientModel recipient = response.data; var unvan = recipient.unvan; var adi = recipient.adi; var soyadi = recipient.soyadi; var vergiDairesi = recipient.vergiDairesi; } `
— Reply to this email directly, view it on GitHub https://github.com/BFYDigital/e-arsiv-fatura-dotnet/issues/8#issuecomment-1575624469, or unsubscribe https://github.com/notifications/unsubscribe-auth/A2JOTDGNCX6YDZ2DCG6Y6U3XJSXF3ANCNFSM6AAAAAAXAVUP4Q . You are receiving this because you commented.Message ID: @.***>
Sizin kodlar çalışmaz. List olmayacak. O yüzden foreach de olmayacak. Benim kodları kullanın. Üstte gönderdim.
var configuration = FaturaServiceConfigurationFactory.Create();
configuration.ServiceType = ServiceType.Prod;
configuration.Username = "-----";
configuration.Password = "----";
FaturaService faturaService = new(configuration);
long taxId = long.Parse(vergikimlik.Text);
await faturaService.GetToken();
var response = await
faturaService.GetRecipientDataByTaxIDOrTRID(taxId); if (response is GIBResponseModel) { RecipientModel recipient = response.data; var unvan = recipient.unvan; var adi = recipient.adi; var soyadi = recipient.soyadi; var vergiDairesi = recipient.vergiDairesi; }
Ahmet Bey :( bu kodları derleyemedim ama hata verdi https://github.com/Orcunary/BFY.Fatura/blob/master/faturaOlustur/Form1.cs button2_Click olayına bakabilir misiniz?
Önem Derecesi Kod Açıklama Proje Dosya Çizgi Gizleme Durumu
Hata CS0305 Genel tür 'GIBResponseModel
Orçun DİYARBAKIRLI
ahmetaksoy1985 @.***>, 4 Haz 2023 Paz, 20:23 tarihinde şunu yazdı:
Sizin kodlar çalışmaz. List olmayacak. O yüzden foreach de olmayacak. Benim kodları kullanın. Üstte gönderdim.
— Reply to this email directly, view it on GitHub https://github.com/BFYDigital/e-arsiv-fatura-dotnet/issues/8#issuecomment-1575646666, or unsubscribe https://github.com/notifications/unsubscribe-auth/A2JOTDBFSVA3J65LAGQJLTLXJS777ANCNFSM6AAAAAAXAVUP4Q . You are receiving this because you commented.Message ID: @.***>
Bir de var response = faturaService.CreateInvoiceAndGetHTML(nesne, false);
using (var client = new WebClient())
{
client.DownloadFile(faturaService.GetDownloadURL(response.Result.data, false), "a.html"); }
bu doğru bir kullanım olur mu ? Orçun DİYARBAKIRLI
Orçun Diyarbakırlı @.***>, 4 Haz 2023 Paz, 20:55 tarihinde şunu yazdı:
var configuration = FaturaServiceConfigurationFactory.Create(); configuration.ServiceType = ServiceType.Prod; configuration.Username = "-----"; configuration.Password = "----"; FaturaService faturaService = new(configuration); long taxId = long.Parse(vergikimlik.Text); await faturaService.GetToken(); var response = await
faturaService.GetRecipientDataByTaxIDOrTRID(taxId); if (response is GIBResponseModel) { RecipientModel recipient = response.data; var unvan = recipient.unvan; var adi = recipient.adi; var soyadi = recipient.soyadi; var vergiDairesi = recipient.vergiDairesi; }
Ahmet Bey :( bu kodları derleyemedim ama hata verdi https://github.com/Orcunary/BFY.Fatura/blob/master/faturaOlustur/Form1.cs button2_Click olayına bakabilir misiniz?
Önem Derecesi Kod Açıklama Proje Dosya Çizgi Gizleme Durumu Hata CS0305 Genel tür 'GIBResponseModel
' kullanmak için 1 türü bağımsız değişkenler gerekir Orçun DİYARBAKIRLI
ahmetaksoy1985 @.***>, 4 Haz 2023 Paz, 20:23 tarihinde şunu yazdı:
Sizin kodlar çalışmaz. List olmayacak. O yüzden foreach de olmayacak. Benim kodları kullanın. Üstte gönderdim.
— Reply to this email directly, view it on GitHub https://github.com/BFYDigital/e-arsiv-fatura-dotnet/issues/8#issuecomment-1575646666, or unsubscribe https://github.com/notifications/unsubscribe-auth/A2JOTDBFSVA3J65LAGQJLTLXJS777ANCNFSM6AAAAAAXAVUP4Q . You are receiving this because you commented.Message ID: @.***>
Aşağıdaki gibi olacaktı. Düzeltmeyi unutmuşum. Konsol uygulamasında denemiştim.
`if(response is GIBResponseModel) {
RecipientModel recipient = response.data; unvan.Text = recipient.unvan; adi.Text = recipient.adi; soyadi.Text = recipient.soyadi; vergidairesi.Text = recipient.vergiDairesi; } `
if(response is GIBResponseModel) GIBResponseModel yine t değişkeni istiyor derlemiyor
Orçun DİYARBAKIRLI
ahmetaksoy1985 @.***>, 4 Haz 2023 Paz, 21:02 tarihinde şunu yazdı:
Aşağıdaki gibi olacaktı. Düzeltmeyi unutmuşum. Konsol uygulamasında denemiştim.
if(response is GIBResponseModel) { RecipientModel recipient = response.data; unvan.Text = recipient.unvan; adi.Text = recipient.adi; soyadi.Text = recipient.soyadi; vergidairesi.Text = recipient.vergiDairesi; }
— Reply to this email directly, view it on GitHub https://github.com/BFYDigital/e-arsiv-fatura-dotnet/issues/8#issuecomment-1575658233, or unsubscribe https://github.com/notifications/unsubscribe-auth/A2JOTDG4LLHK4G72AOIOTZDXJTESPANCNFSM6AAAAAAXAVUP4Q . You are receiving this because you commented.Message ID: @.***>
Bir de var response = faturaService.CreateInvoiceAndGetHTML(nesne, false); using (var client = new WebClient()) { client.DownloadFile(faturaService.GetDownloadURL(response.Result.data, false), "a.html"); } bu doğru bir kullanım olur mu ? Orçun DİYARBAKIRLI Orçun Diyarbakırlı @.***>, 4 Haz 2023 Paz, 20:55 tarihinde şunu yazdı: …
Webclient sınıfı deprecated. Ben size kendi yazdığım kodları gönderirim.
if(response is GIBResponseModel) GIBResponseModel yine t değişkeni istiyor derlemiyor Orçun DİYARBAKIRLI ahmetaksoy1985 @.***>, 4 Haz 2023 Paz, 21:02 tarihinde şunu yazdı: …
Kodları güncelledim. Tekrar aldınız mı? Kodlar çalışıyor. Ben konsol uygulamasında denedim.
Birkaç gün beklerseniz sizin kodları düzenlerim. Çok güzel olur.
Tamam Ahmet bey,beklerim tabi çok teşekkür ederim.
4 Haz 2023 Pzr 22:24 tarihinde ahmetaksoy1985 @.***> şunu yazdı:
Birkaç gün beklerseniz sizin kodları düzenlerim. Çok güzel olur.
— Reply to this email directly, view it on GitHub https://github.com/BFYDigital/e-arsiv-fatura-dotnet/issues/8#issuecomment-1575682700, or unsubscribe https://github.com/notifications/unsubscribe-auth/A2JOTDDCWEGQLKGWCVUV2HDXJTOIRANCNFSM6AAAAAAXAVUP4Q . You are receiving this because you commented.Message ID: @.***>
Bir de var response = faturaService.CreateInvoiceAndGetHTML(nesne, false); using (var client = new WebClient()) { client.DownloadFile(faturaService.GetDownloadURL(response.Result.data, false), "a.html"); } bu doğru bir kullanım olur mu ? Orçun DİYARBAKIRLI Orçun Diyarbakırlı @.***>, 4 Haz 2023 Paz, 20:55 tarihinde şunu yazdı: …
Şöyle bir fonksiyon yazmışım.
faturaService.GetDownloadURL(response.Result.data, false)`
Üstten gelen stringi uri olarak girip outputFolderPath kısmına da klasörü belirtirseniz. Zip dosyasını da açıp indirir.
public static async Task DownloadExtractZipFileAsync(string uri, string outputFolderPath) { if (!Uri.TryCreate(uri, UriKind.Absolute, out _)) throw new InvalidOperationException("URI is invalid."); byte[] fileBytes = await httpClient.GetByteArrayAsync(uri); using (MemoryStream ms = new MemoryStream(fileBytes)) using (var zip = new ZipArchive(ms, ZipArchiveMode.Read)) { zip.ExtractToDirectory(outputFolderPath, true); } }
Orçun Bey çok teşekkürler ederim helvalar için. Bayıldım. Ellerinize sağlık.
Düzelttim. Prod olarak giriş yaparsanız firma bilgilerini çekiyor. SMS onaylama ve faturayı görüntüleme kısmını yapacağım. Login kısmını her click olayı yerine 1 kere yaparsanız daha iyi olur. Onun içinde ayrı Login Form'u yapmayı düşünüyorum. Tek bir form içinde olsun derseniz en üste login için button koyabiliriz. Bir de üstteki combobox’ları tam olarak nasıl kullanmak istiyorsunuz. Ben sql ile firma bilgilerini çekip combobox ile listeliyorum.
Ahmet Bey afiyet olsun :) Çok teşekkür ederim hocam bende henüz deneme fırsatı bulamadım login için bende o tarz bir form düşünmüştüm doğrusu. Combobox larda insanların ünvanları ve kullanıcı şifre bilgileri yer alacak, aynı form üzerinden comboxta seçili ünvan için yanş birden fazla ünvan ve şifre bilgisi ile fatura kesilebilecek.
Şimdi anladım Orçun Bey 2 tane Combobox olmasını. Şöyle yapabiliriz. Login formunda kullanıcı bilgisi ve şifre girilirken otomatik login seçeneği seçilirse direk fatura kesme formu açılır her başlatmada. Logout buttonuna basınca tekrar login formu açılır. Login olduğunuzda ise firma bilgisini siteden çekip gösteririz.
The request was canceled due to the configured HttpClient.Timeout of 100 seconds elapsing.