mlevent / fatura

GİB e-Arşiv Portal e-Fatura, e-SMM, e-Müstahsil Oluşturucu
https://mlevent.github.io/fatura
MIT License
86 stars 20 forks source link

Test Ortamında Fatura Oluşturma #58

Closed muglali20 closed 10 months ago

muglali20 commented 12 months ago

Merhaba; Bu Başarılı projeniz için öncelikle çok teşekkürler. Test Ortamında Fatura Oluşturma işlemı yapılabılıyor mu ? Denedım ancak Sistem hata vermektedir. $gib = (new Gib)->setTestCredentials()->login(); $ft_gonder=$gib->createDraft($invoice); print_r($ft_gonder); Şeklinde Yaptım Fatal error: Uncaught Mlevent\Fatura\Exceptions\ApiException: İstek başarısız oldu. in Şeklinde hata alıyorum

mlevent commented 12 months ago

catch blogunda getResponse() metoduyla donen cevabi kontrol eder misiniz.

muglali20 commented 12 months ago

`use Mlevent\Fatura\Enums\Currency; use Mlevent\Fatura\Enums\InvoiceType; use Mlevent\Fatura\Enums\Unit; use Mlevent\Fatura\Gib; use Mlevent\Fatura\Models\InvoiceModel; use Mlevent\Fatura\Models\InvoiceItemModel; require 'vendor/autoload.php'; // Fatura detayları $invoice = new InvoiceModel( tarih : '12/09/2023', // ☑️ Opsiyonel @string @default=(dd/mm/yyyy) saat : '23:50:48', // ☑️ Opsiyonel @string @default=(hh/mm/ss) paraBirimi : Currency::USD, // ☑️ Opsiyonel @Currency @default=Currency::TRY dovizKuru : 18.56, // ☑️ Opsiyonel @float @default=0 faturaTipi : InvoiceType::Satis, // ☑️ Opsiyonel @InvoiceType @default=InvoiceType::Satis vknTckn : '11111111111', // ✴️ Zorunlu @string vergiDairesi : '', // ✅ Opsiyonel @string aliciUnvan : '', // ✅ Opsiyonel @string aliciAdi : 'Mert', // ✴️ Zorunlu @string aliciSoyadi : 'Levent', // ✴️ Zorunlu @string mahalleSemtIlce : 'Nilüfer', // ✴️ Zorunlu @string sehir : 'Bursa', // ✴️ Zorunlu @string ulke : 'Türkiye', // ✴️ Zorunlu @string adres : '', // ✅ Opsiyonel @string siparisNumarasi : '', // ✅ Opsiyonel @string siparisTarihi : '', // ✅ Opsiyonel @string irsaliyeNumarasi : '', // ✅ Opsiyonel @string irsaliyeTarihi : '', // ✅ Opsiyonel @string fisNo : '', // ✅ Opsiyonel @string fisTarihi : '', // ✅ Opsiyonel @string fisSaati : '', // ✅ Opsiyonel @string fisTipi : '', // ✅ Opsiyonel @string zRaporNo : '', // ✅ Opsiyonel @string okcSeriNo : '', // ✅ Opsiyonel @string binaAdi : '', // ✅ Opsiyonel @string binaNo : '', // ✅ Opsiyonel @string kapiNo : '', // ✅ Opsiyonel @string kasabaKoy : '', // ✅ Opsiyonel @string postaKodu : '', // ✅ Opsiyonel @string tel : '', // ✅ Opsiyonel @string fax : '', // ✅ Opsiyonel @string eposta : '', // ✅ Opsiyonel @string not : '', // ✅ Opsiyonel @string ); // Ürün/Hizmetler $invoice->addItem( new InvoiceItemModel( malHizmet : 'Çimento', // ✴️ Zorunlu @string miktar : 3, // ✴️ Zorunlu @float birim : Unit::M3, // ☑️ Opsiyonel @Unit @default=Unit::Adet birimFiyat : 1259, // ✴️ Zorunlu @float kdvOrani : 18, // ✴️ Zorunlu @float iskontoOrani : 25, // ✅ Opsiyonel @float iskontoTipi : 'Arttırım', // ☑️ Opsiyonel @string @default=İskonto iskontoNedeni : '', // ✅ Opsiyonel @string ) );

$gib = (new Gib)->setTestCredentials()->login(); $ft_gonder=$gib->createDraft($invoice); print_r($ft_gonder); ` Tam olarak bu şeklde kullanıyorum diğer fonstonlarda sorun yok fatura detay olsun kullanıcıu bilgisi token vs. hersey sorunsuz ama fatura gınderımınde sorun oldu

mlevent commented 12 months ago

işlemleri try blogu icinde yapin. hata varsa catch icinde yakalanacaktir. asagidaki ornegi kullanip donen cevabi kontrol eder misiniz.

try {

$gib = (new Gib)->setTestCredentials()->login(); 

//$invoice = new InvoiceModel...

$ft_gonder=$gib->createDraft($invoice); 
print_r($ft_gonder);

} catch(FaturaException $e){

dd($e->getResponse(), false);

}

muglali20 commented 12 months ago

Tamam teşekkurler:;

$invoice->addItem( new InvoiceItemModel( malHizmet : 'Çimento', // ✴️ Zorunlu @string miktar : 3, // ✴️ Zorunlu @float birim : Unit::Adet, // ☑️ Opsiyonel @Unit @default=Unit::Adet birimFiyat : 1259, // ✴️ Zorunlu @float kdvOrani : 20, // ✴️ Zorunlu @float iskontoOrani : 0.00, // ✅ Opsiyonel @float iskontoTipi : 'İskonto', // ☑️ Opsiyonel @string @default=İskonto iskontoNedeni : '', // ✅ Opsiyonel @string ))->addTax(Tax::GVStopaj, 25);

Vergi Ekleme de

Fatal error: Uncaught Error: Call to undefined method Mlevent\Fatura\Models\InvoiceModel::addTax() in C:\xampp\htdocs\e-arsiv_v2\test.php:57 Stack trace: #0 {main} thrown in C:\xampp\htdocs\e-arsiv_v2\test.php on line 57

Bu şekilde hata oluyor neden olabılır use Mlevent\Fatura\Enums\Currency; use Mlevent\Fatura\Enums\InvoiceType; use Mlevent\Fatura\Enums\Unit; use Mlevent\Fatura\Gib; use Mlevent\Fatura\Models\InvoiceModel; use Mlevent\Fatura\Models\InvoiceItemModel; use Mlevent\Fatura\Enums\Tax; Şeklinde keleme yaptım vergi ekleme yapınca hat aoluyor onu silersen direk fatura oluşturuluyor 57.satır. ->addTax(Tax::GVStopaj, 25);

mlevent commented 12 months ago

examples klasörü içinde kullanım örnekleri mevcut. vergi ekleyecekseniz examples/createInvoiceWithExtras.php dosyasını inceleyebilirsiniz. hatta test için doğrudan bu dosyayı çalıştırın.

mlevent commented 12 months ago

Vergiyi belgeye eklediğiniz için bu hatayı alıyorsunuz. Verginin belgeye eklenen öğeye eklenmesi gerek. Dökümanı incelemek faydalı olacaktır.

muglali20 commented 11 months ago

Evet Haklısınız Şimdı oldu peki /examples/createInvoice.php Örneğinizde Bilgileri göndermek daha kolay ve anlaşılır bu örneğe göre fatura oluştmak istersek burada Ek vergi ve Ürünlerde birim cinsini nasıl ilave edebiliriz. örnek verebılır mısınız