Skip to content

Repository files navigation

EfaturaDotnet

English | Türkçe

NuGet License: MIT

Modern .NET library for Turkish e-Invoice (e-Fatura / e-Arsiv) integration.

EfaturaDotnet is a clean, cross-platform, dependency-free library for creating, serializing, and submitting Turkish e-Invoices through GIB integrators like Uyumsoft. Built for .NET 8+, with async/await and CancellationToken support throughout.

Features

  • UBL-TR 1.2.1 XML serialization — System.Xml.Linq-based, no external deps
  • Integrator abstractionIIntegrator interface for pluggable backends (Uyumsoft, direct GIB)
  • Full invoice model — ETTN, VAT calculation, party tax info, line items, e-Arsiv support
  • Builder pattern — Configure via EfaturaClient.Create(options => { ... })
  • Async all the way down — Every operation supports CancellationToken

Installation

dotnet add package EfaturaDotnet

Quick Start

using EfaturaDotnet;
using EfaturaDotnet.Models;

var client = EfaturaClient.Create(options =>
{
    options.ApiKey = "your-api-key";
    options.BaseUrl = new Uri("https://api.uyumsoft.com.tr");
});

var invoice = new Invoice(
    invoiceNumber: "FTR2024000001",
    type: InvoiceType.Satis,
    issueDate: DateTime.UtcNow,
    currency: Currency.TRY,
    seller: new Party(
        name: "ABC Tedarik A.S.",
        taxInfo: new TaxInfo("1234567890", "Beylikduzu VD"),
        streetAddress: "Org. San. Bol. No:42",
        city: "Istanbul",
        district: "Beylikduzu",
        postalCode: "34500"),
    buyer: new Party(
        name: "XYZ Musteri Ltd.",
        taxInfo: new TaxInfo("0987654321", "Kadikoy VD"),
        streetAddress: "Bagdat Cad. No:100",
        city: "Istanbul",
        district: "Kadikoy",
        postalCode: "34700"),
    lines: new[]
    {
        new InvoiceLine(1, "Urun A", 10m, "ADET", 150m, 20),
        new InvoiceLine(2, "Urun B", 5m, "ADET", 160m, 10),
    })
{
    Note = "Teslim suresi 3 is gunudur.",
};

var result = await client.CreateInvoiceAsync(invoice);
Console.WriteLine($"ETTN: {result.Ettn}, Total: {invoice.GrandTotal} TL");
// => ETTN: 7b9c2a3d-..., Total: 2680.00 TL

await client.SendInvoiceAsync(result.Ettn!);

Architecture

EfaturaClient     → builder pattern, delegates to IIntegrator
  ├─ IIntegrator  → abstraction for GIB integrators
  │   ├─ UyumsoftIntegrator
  │   └─ GibIntegrator
  ├─ UblTrSerializer → Invoice → UBL-TR 1.2.1 XML
  └─ Models (Invoice, Party, InvoiceLine, ...)

Supported Integrators

Integrator Status
Uyumsoft Stub (HTTP structure ready)
GIB Direct Stub (HTTP structure ready)

Contributions for other integrators (Logo, ParaSoft, etc.) are welcome.

Development

dotnet build
dotnet test

Requirements

  • .NET 8.0 SDK or later

Project Structure

src/EfaturaDotnet/
├── EfaturaClient.cs          # Main entry point
├── EfaturaClientOptions.cs   # Configuration
├── Models/
│   ├── Invoice.cs            # Core invoice model
│   ├── InvoiceLine.cs        # Line items with VAT calc
│   ├── Party.cs              # Buyer/seller info
│   ├── TaxInfo.cs            # VKN, TCKN, tax office
│   ├── InvoiceType.cs        # Invoice type enum
│   ├── InvoiceFilter.cs      # List filter
│   ├── Currency.cs           # ISO 4217 codes
│   └── EArchiveInvoice.cs    # e-Arsiv extension
├── Integrators/
│   ├── IIntegrator.cs        # Integrator interface
│   ├── IntegratorBase.cs     # Base HTTP client
│   ├── UyumsoftIntegrator.cs
│   └── GibIntegrator.cs
├── Serialization/
│   ├── UblTrSerializer.cs    # UBL-TR XML generator
│   └── UblTrConstants.cs     # UBL-TR 1.2.1 constants
└── Exceptions/
    ├── EfaturaException.cs
    └── IntegratorException.cs

Related Projects

License

MIT © vaur94

About

Modern, zero-dependency .NET 8 library for Turkish e-Invoice (e-Fatura / e-Arşiv) integration with UBL-TR 1.2.1 XML serialization

Topics

Resources

Contributing

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages