Sozer.Logo.Rest
1.0.794
dotnet add package Sozer.Logo.Rest --version 1.0.794
NuGet\Install-Package Sozer.Logo.Rest -Version 1.0.794
<PackageReference Include="Sozer.Logo.Rest" Version="1.0.794" />
<PackageVersion Include="Sozer.Logo.Rest" Version="1.0.794" />
<PackageReference Include="Sozer.Logo.Rest" />
paket add Sozer.Logo.Rest --version 1.0.794
#r "nuget: Sozer.Logo.Rest, 1.0.794"
#:package Sozer.Logo.Rest@1.0.794
#addin nuget:?package=Sozer.Logo.Rest&version=1.0.794
#tool nuget:?package=Sozer.Logo.Rest&version=1.0.794
Sözer Logo Rest
<a name="tr"></a>
🇹🇷 Türkçe
Sözer Logo Rest, Logo Yazılım ürünleriyle entegrasyon sağlamak için geliştirilmiş bir .NET kütüphanesidir. Bu paket, Cari Hesap, Cari Sevkiyat Adresi, Satış Siparişi ve Satınalma Siparişi gibi verileri Logo sistemine kolayca entegre etmenize olanak tanır.
En son güncellemeyle birlikte kütüphane, gönderme işlemi sırasında herhangi bir hata oluştuğunda fırlatılan özel bir PostException ile geliştirilmiş hata işleme özelliğini içermektedir.
📦 Kurulum
Sözer Logo Rest'i NuGet üzerinden projelerinize ekleyebilirsiniz:
dotnet add package Sozer.Logo.Rest
veya Visual Studio NuGet Paket Yöneticisi'nden ekleyin:
- Tools > NuGet Package Manager > Manage NuGet Packages for Solution...
- Browse sekmesinde
Sozer Logo Restaratın ve projeye ekleyin.
🚀 Kullanım
Paketin kullanımı basittir. Genel işlemler için bir LogoClient içerir.
1. Bağlantı Kurulumu
ELogoClient oturum açma işlemleri için appsettings.json dosyasına aşağıdaki gibi bilgileri vermeniz gerekiyor
{
"ELogoService": {
"username": "Kullanıcı_adi",
"password": "parola"
},
"LogoRestAPI": {
"Url": "Logo/Rest/API/Url",
"Client": "Logo Rest API Authorization Token"
}
}
appsettings.json'daki bilgilerin okunabilmesi için Configuration'ı pakete vermeniz gerekiyor
var builder = WebApplication.CreateBuilder(args);
IWebHostEnvironment env = builder.Environment;
builder.Configuration.SetBasePath(env.ContentRootPath).AddJsonFile("appsettings.json", optional: false).AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true);
builder.Services.AddSozerLogoRestPackage("<lisans anahtarı buraya>", builder.Configuration);
// Hata Handling ve lisans kontrolü için şart
var app = builder.Build();
app.ConfigureExceptionHandlingMiddleware();
Sözer Bilgisayar adresinden lisans anahtarınız için kayıt olabilirsiniz
2. TaxPayerCode Doğrulaması ile Cari Hesap Ekleme veya Güncelleme
Bir hesap eklerken, TaxPayerCode alanı sağlanmışsa:
- TaxPayerCode Gelir İdaresi Başkanlığı (GİB) hizmeti aracılığıyla doğrulanır.
- Eğer geçerliyse:
TaxPayerCode10 karakter uzunluğundaysa, hesap kurumsal bir varlık olarak değerlendirilir.- Aksi takdirde, bireysel bir tüzel kişilik olarak değerlendirilir.
- Hizmetten gelen yanıt,
PostLabelveSenderLabelgibi belirli alanları günceller.
[Route("api/[controller]/[action]")]
[ApiController]
public class AccountsRpController(LogoClient logoClient) : ControllerBase
{
private readonly LogoClient logoClient = logoClient;
[HttpPost]
[ProducesResponseType(StatusCodes.Status200OK, Type = typeof(bool))]
[ProducesResponseType(StatusCodes.Status400BadRequest, Type = typeof(ExceptionModel))]
public async Task<IActionResult> Post(CancellationToken cancellationToken) => Ok(await logoClient.PostAccountsRPs(new LogoAuth
{
Username = "kullanıcıAdı",
Password = "şifre",
FirmNo = 0, // firmaNumarası
PeriodNr = null // dönemNumarası
}, [ new AccountsRP()
{
Code = "Cari Hesap Kodu",
TaxPayerCode = "1234567890" // Hesap türünü doğrular ve belirler
} ], cancellationToken));
}
3. Cari Hesap Sevkiyat Adresi Ekleme Ve Güncelleme
Yeni INTERNAL_REFERENCE alanı ile eğer alan null değilse sistem veriyi, verilen alanlarla günceller. INTERNAL_REFERENCE null ise yeni bir kayıt oluşturulur.
[Route("api/[controller]/[action]")]
[ApiController]
public class ArpShipLicsController(LogoClient logoClient) : ControllerBase
{
private readonly LogoClient logoClient = logoClient;
[HttpPost]
[ProducesResponseType(StatusCodes.Status200OK, Type = typeof(bool))]
[ProducesResponseType(StatusCodes.Status400BadRequest, Type = typeof(ExceptionModel))]
public async Task<IActionResult> Post(CancellationToken cancellationToken) => Ok(await logoClient.PostArpShipLics(new LogoAuth
{
Username = "kullanıcıAdı",
Password = "şifre",
FirmNo = 0, // firmaNumarası
PeriodNr = null // dönemNumarası
}, [ArpShipLic() {
ArpCode = "Cari Hesap Kodu",
Code = "Sevkiyat Adresi Kodu"
}], cancellationToken));
}
4. Satış Siparişi Ekleme Ve Güncelleme
Yeni INTERNAL_REFERENCE alanı ile eğer alan null değilse sistem veriyi, verilen alanlarla günceller. INTERNAL_REFERENCE null ise yeni bir kayıt oluşturulur.
[Route("api/[controller]/[action]")]
[ApiController]
public class OrdersController(LogoClient logoClient) : ControllerBase
{
private readonly LogoClient logoClient = logoClient;
[HttpPost]
[ProducesResponseType(StatusCodes.Status200OK, Type = typeof(bool))]
[ProducesResponseType(StatusCodes.Status400BadRequest, Type = typeof(ExceptionModel))]
public async Task<IActionResult> Post(CancellationToken cancellationToken) => Ok(await logoClient.PostOrders(new LogoAuth
{
Username = "kullanıcıAdı",
Password = "şifre",
FirmNo = 0, // firmaNumarası
PeriodNr = null // dönemNumarası
}, [
new Order() {
Number = "Satış Siparişi Numarası"
}
], cancellationToken));
}
5. Satınalma Siparişi Ekleme Ve Güncelleme
Yeni INTERNAL_REFERENCE alanı ile eğer alan null değilse sistem veriyi, verilen alanlarla günceller. INTERNAL_REFERENCE null ise yeni bir kayıt oluşturulur.
[Route("api/[controller]/[action]")]
[ApiController]
public class PurchOrdersController(LogoClient logoClient) : ControllerBase
{
private readonly LogoClient logoClient = logoClient;
[HttpPost]
[ProducesResponseType(StatusCodes.Status200OK, Type = typeof(bool))]
[ProducesResponseType(StatusCodes.Status400BadRequest, Type = typeof(ExceptionModel))]
public async Task<IActionResult> Post(CancellationToken cancellationToken) => Ok(await logoClient.PostPurchOrders(new LogoAuth
{
Username = "kullanıcıAdı",
Password = "şifre",
FirmNo = 0, // firmaNumarası
PeriodNr = null // dönemNumarası
}, [new PurchOrder() {
Number = "Satınalma Siparişi Numarası"
}], cancellationToken));
}
6. Malzeme Ekleme Ve Güncelleme
Yeni INTERNAL_REFERENCE alanı ile eğer alan null değilse sistem veriyi, verilen alanlarla günceller. INTERNAL_REFERENCE null ise yeni bir kayıt oluşturulur.
[Route("api/[controller]/[action]")]
[ApiController]
public class MaterialsController(LogoClient logoClient) : ControllerBase
{
private readonly LogoClient logoClient = logoClient;
[HttpPost]
[ProducesResponseType(StatusCodes.Status200OK, Type = typeof(bool))]
[ProducesResponseType(StatusCodes.Status400BadRequest, Type = typeof(ExceptionModel))]
public async Task<IActionResult> Post(CancellationToken cancellationToken) => Ok(await logoClient.PostMaterials(new LogoAuth
{
Username = "kullanıcıAdı",
Password = "şifre",
FirmNo = 0, // firmaNumarası
PeriodNr = null // dönemNumarası
}, [new Material() {
Code = "Malzeme Kodu"
}], cancellationToken));
}
7. Satış Faturaları Ekleme Ve Güncelleme
Yeni INTERNAL_REFERENCE alanı ile eğer alan null değilse sistem veriyi, verilen alanlarla günceller. INTERNAL_REFERENCE null ise yeni bir kayıt oluşturulur.
[Route("api/[controller]/[action]")]
[ApiController]
public class SalesInvoiceController(LogoClient logoClient) : ControllerBase
{
private readonly LogoClient logoClient = logoClient;
[HttpPost]
[ProducesResponseType(StatusCodes.Status200OK, Type = typeof(IList<PostResult>))]
[ProducesResponseType(StatusCodes.Status400BadRequest, Type = typeof(ExceptionModel))]
public async Task<IActionResult> Post(CancellationToken cancellationToken) => Ok(await logoClient.PostSalesInvoices(new LogoAuth
{
Username = "kullanıcıAdı",
Password = "şifre",
FirmNo = 0, // firmaNumarası
PeriodNr = null // dönemNumarası
}, [new SalesInvoice() {
Type = 3,
DocTrackNr = "Dokuman Izleme Numarasi",
DocNumber = "Belge No",
AuxilCode = "Ozel Kod",
AuthCode = "1",
Arp_Code = "1341911",
PostFlags = 247
}], cancellationToken));
}
}
8. Malzeme Fişleri Ekleme Ve Güncelleme
Yeni INTERNAL_REFERENCE alanı ile eğer alan null değilse sistem veriyi, verilen alanlarla günceller. INTERNAL_REFERENCE null ise yeni bir kayıt oluşturulur.
[Route("api/[controller]/[action]")]
[ApiController]
public class MaterialSlipsController(LogoClient logoClient) : ControllerBase
{
private readonly LogoClient logoClient = logoClient;
[HttpPost]
[ProducesResponseType(StatusCodes.Status200OK, Type = typeof(IList<PostResult>))]
[ProducesResponseType(StatusCodes.Status400BadRequest, Type = typeof(ExceptionModel))]
public async Task<IActionResult> Post(CancellationToken cancellationToken) => Ok(await logoClient.PostMaterialSlips(new LogoAuth
{
Username = "kullanıcıAdı",
Password = "şifre",
FirmNo = 0, // firmaNumarası
PeriodNr = null // dönemNumarası
}, [new() {
Group = 3,
Type = 12,
Date = "29.09.2025",
CurrselTotals = 1,
Transactions = [new() {
ItemCode = "Malzeme Kodu",
Quantity = 5, // Miktar
UnitCode = "Birim Kodu",
UnitConv1 = 1,
UnitConv2 = 1
}]
}], cancellationToken));
}
9. PostException ile Hata İşleme
Gönderme işlemi sırasında, herhangi bir hata meydana gelirse, özel bir PostException atılır. Bu istisna, öğe numarası ve hata mesajı da dahil olmak üzere başarısız gönderiler hakkında ayrıntılı bilgi içerir.
Örnek:
try
{
IList<PostResult> results = await logoClient.PostAccountsRPs(new LogoAuth
{
Username = "kullanıcıAdı",
Password = "şifre",
FirmNo = 0, // firmaNumarası
PeriodNr = null // dönemNumarası
}, new List<Account>
{
new()
{
InternalReference = null,
Title = "Invalid Account",
TaxPayerCode = "INVALID"
}
});
}
catch (PostException ex)
{
Console.WriteLine("An error occurred during the posting process:");
Console.WriteLine(ex.Message);
}
Bir Hata Sırasında Ne Olur:
- Doğrulama: Herhangi bir
PostResultbaşarısızlık gösterirse (IsSuccess == false), birPostExceptiontetiklenir. - Hata Detayları: İstisna mesajı şunları içerir:
- Öğe numarası (
Number). - Varlık adı (örneğin, “Cari Hesap”).
- Hata mesajı.
- Öğe numarası (
Örnek Hata Mesajı:
Hata Mesajı: 1 numaralı AccountsRP Hata: DBError(8) - Kayıt veritabanına aktarılamadı. 23000 : Cannot insert duplicate key row in object 'dbo.LG_999_CLCARD' with unique index 'I999_CLCARD_I13'. The duplicate key value is (1, 0, 1).\n"
10. OrderBilling ile Sipariş Faturalarını Faturalamak
Sipariş fişlerini faturalamak için kullanılan method'dur. Eğer işlem başarıyla gerçekleşmezse, dönüş nesnesinde error özelliği doldurulur.
[Route("api/[controller]/[action]")]
[ApiController]
public class UnityApplicationController(LogoClient logoClient) : ControllerBase
{
private readonly LogoClient logoClient = logoClient;
[HttpPost]
[ProducesResponseType(StatusCodes.Status200OK, Type = typeof(OrderBillingResponse))]
[ProducesResponseType(StatusCodes.Status400BadRequest, Type = typeof(ExceptionModel))]
public async Task<IActionResult> OrderBilling(CancellationToken cancellationToken) => Ok(await logoClient.OrderBilling(new LogoAuth
{
Username = "kullanıcıAdı",
Password = "şifre",
FirmNo = 0, // firmaNumarası
PeriodNr = null // dönemNumarası
}, [new() {
OrderRef = 3229, // Faturalaştıracağınız siparişin Logical Reference'ı
Date = "02.10.2025", // Tarih gün.ay.yıl formatında olmalıdır
FicheType = 3, // Fatura Türü
DocumentCode = "Belge No",
SpecialCode = "Özel Kod",
AuthCode = "Yetki Kodu",
Description1 = "Açıklama 1",
Description2 = "Açıklama 2",
Description3 = "Açıklama 3",
Description4 = "Açıklama 4",
CheckUserRight = true, // Kullanıcı Yetkisi Kontrol Edilsin Mi?
SqlTransaction = true, // Sql Transaction
EInvoice = false, // Sipariş E-faturaya dönüştürülecek Mi?
VatExceptReason = "Vergi Muaf Nedeni"
}, new() {
OrderRef = 3230,
Date = "02.10.2025",
FicheType = 3,
DocumentCode = "SP00000000000003"
}, new() {
OrderRef = 2142,
Date = "02.10.2025",
FicheType = 3,
DocumentCode = "SP00000000000001"
},], cancellationToken));
11. Satış İrsaliyesi Ekleme Ve Güncelleme
Yeni INTERNAL_REFERENCE alanı ile eğer alan null değilse sistem veriyi, verilen alanlarla günceller. INTERNAL_REFERENCE null ise yeni bir kayıt oluşturulur.
[Route("api/[controller]/[action]")]
[ApiController]
public class SalesDispatchesController(LogoClient logoClient, XmlService xmlService) : ControllerBase
{
private readonly LogoClient logoClient = logoClient;
private readonly XmlService xmlService = xmlService;
[HttpPost]
[ProducesResponseType(StatusCodes.Status200OK, Type = typeof(IList<PostResult>))]
[ProducesResponseType(StatusCodes.Status400BadRequest, Type = typeof(ExceptionModel))]
public async Task<IActionResult> Post(CancellationToken cancellationToken) => Ok(await logoClient.PostSalesDispatches(new LogoAuth
{
Username = "kullanıcıAdı",
Password = "şifre",
FirmNo = 0, // firmaNumarası
PeriodNr = null // dönemNumarası
}, [new() {
Type = 9,
Number = "~",
Date = "23.10.2025",
Time = 202052408,
ArpCode = "5000534",
Notes1 = "",
SourceWh = 0,
CreatedBy = 0,
RcRate = 0,
CurrselTotals = 1,
Salesmancode = "",
ShippingAgent = "",
Deductionpart1 = 0,
Deductionpart2 = 0,
Edespatch = 1,
ShipDate = "23.10.2025",
ShipTime = 202052408,
DocDate = "23.10.2025",
DocTime = 202052408,
Transactions =
{
new()
{
Type = 0,
Price = 0,
MasterCode = "DKPN12188",
Sourceindex = 0,
Quantity = 5,
RcXrate = 0,
UnitCode = "ADET",
UnitConv1 = 5,
UnitConv2 = 5,
VatRate = 20,
EdtCurr = 53,
OrderReference = "3001",
Sldetails =
{
new()
{
SourceMtReference = 380,
SourceSltReference = 1,
SourceQuantity = 1,
IOCODE = 4,
SourceWh = 0,
SlType = 1,
SlCode = "123456",
MuQuantity = 1,
UnitCode = "ADET",
Quantity = 1,
UnitConv1 = 1,
UnitConv2 = 1
}
}
}
}
}], cancellationToken));
12. Cari Hesap Fişi Ekleme Ve Güncelleme
Yeni INTERNAL_REFERENCE alanı ile eğer alan null değilse sistem veriyi, verilen alanlarla günceller. INTERNAL_REFERENCE null ise yeni bir kayıt oluşturulur.
[Route("api/[controller]/[action]")]
[ApiController]
public class ArpVouchersController(LogoClient logoClient) : ControllerBase
{
private readonly LogoClient logoClient = logoClient;
[HttpPost]
[ProducesResponseType(StatusCodes.Status200OK, Type = typeof(IList<PostResult>))]
[ProducesResponseType(StatusCodes.Status400BadRequest, Type = typeof(ExceptionModel))]
public async Task<IActionResult> Post(CancellationToken cancellationToken) => Ok(await logoClient.PostArpVoucher(new LogoAuth
{
Username = "kullanıcıAdı",
Password = "şifre",
FirmNo = 0, // firmaNumarası
PeriodNr = null // dönemNumarası
}, [new() {
Number = "Numara",
Date = "26.01.2026",
Type = 70, // Tip
Notes1 = "Açıklama",
CurrselTotals = 1,
DataReference = 1,
Arp_Code = "Cari Hesap Kodu",
ProjectCode = "Proje Kodu",
AffectRisk = 0,
SalesmanCode = "Satış Elemanı Kodu"
}], cancellationToken));
}
13. Ürün Reçetesi Ekleme Ve Güncelleme
Yeni INTERNAL_REFERENCE alanı ile eğer alan null değilse sistem veriyi, verilen alanlarla günceller. INTERNAL_REFERENCE null ise yeni bir kayıt oluşturulur.
[Route("api/[controller]/[action]")]
[ApiController]
public class BomsController(LogoClient logoClient) : ControllerBase
{
private readonly LogoClient logoClient = logoClient;
[HttpPost]
[ProducesResponseType(StatusCodes.Status200OK, Type = typeof(IList<PostResult>))]
[ProducesResponseType(StatusCodes.Status400BadRequest, Type = typeof(ExceptionModel))]
public async Task<IActionResult> Post(CancellationToken cancellationToken) => Ok(await logoClient.PostBom(new LogoAuth
{
Username = "kullanıcıAdı",
Password = "şifre",
FirmNo = 0, // firmaNumarası
PeriodNr = null // dönemNumarası
}, [new() {
Code = "Test3",
Type = 1,
RevCode = "REVIZYON - KODU",
RevRecordStatus = 1,
RevDate = "28.01.2026",
RevDataReference = 1,
Lines = [new() {
LineType = 4,
Uinfo1 = 1,
Uinfo2 = 1,
Amount = 1,
Scalable = 1,
InvenNo = -1,
Engineering = 1,
Production = 1,
Cost = 1,
CostRate = 1,
Formula = "1",
EffectOpTime = 1,
ItemCode = "EKMEK",
ItemName = "Ekmek",
UnitSetCode = "05",
UnitCode = "ADET",
BomType = 1,
OpCode = "ROTASIZ",
OpName = "ROTASIZ"
}, new() {
LineType = 0,
Uinfo1 = 1,
Uinfo2 = 1,
Amount = 1,
Scalable = 1,
InvenNo = -1,
Engineering = 1,
Production = 1,
Cost = 1,
Formula = "P1",
ItemCode = "SU",
ItemName = "Su",
UnitSetCode = "05",
UnitCode = "ADET",
BomType = 1,
OpCode = "ROTASIZ",
OpName = "ROTASIZ",
DefCostType = 5
}],
MpCode = "EKMEK",
MpName = "Ekmek",
RoutCode = "URETIM ROTASI KODU",
RoutName = "Uretim Rotasi Aciklamasi"
}], cancellationToken));
}
🔄 Satır (Lines) Güncelleme Davranışı
Aşağıdaki nesneler için güncelleme (Update) işlemi sırasında:
- Ürün Reçetesi
- Malzeme
- Malzeme Fişi
- Satış Siparişi
- Satın Alma Siparişi
- Satış İrsaliyesi
- Satış Faturası
Eğer güncellenecek kaydın satırları (Lines) mevcutsa, güncelleme sırasında bu kayıt tamamen silinir ve gönderilen kayıt ile baştan oluşturulur.
⚠ Önemli Uyarı
Bu nedenle güncelleme yaparken, eğer veri satır içeriyorsa:
- Kullanıcı tüm satırları yeniden göndermelidir.
- Her bir satır için tüm alanlar eksiksiz bir şekilde doldurulmalıdır.
- Aksi halde, gönderilmeyen alanlar veya satırlarlar silinmiş kabul edilir ve kayıtta yer almaz.
Bu yaklaşım, Logo tarafındaki satır senkronizasyonunu garanti altına almak için tercih edilmiştir.
📑 API Özellikleri
| Özellik | Açıklama |
|---|---|
| Cari Hesap | TaxPayerCode doğrulaması ile bir hesap oluşturma ve güncelleme. |
| Cari Sevkiyat Adresi | Müşteri sevkiyat adresi ekleme ve güncelleme işlemi. |
| Satış Siparişi | Satış siparişi oluşturma ve güncelleme işlemi. |
| Satınalma Siparişi | Satın alma siparişi ekleme ve güncelleme işlemi. |
| Malzeme | Malzeme ekleme ve güncelleme işlemi. |
| Satış Faturası | Satış Faturası ekleme ve güncelleme işlemi. |
| Malzeme Fişleri | Malzeme Fişleri ekleme ve güncelleme işlemi. |
| Hata İşleme | Ayrıntılı hata raporlaması için özel PostException. |
| Fatura İptali | Fatura referansı ile Fatura İptali. |
| OrderBilling ile Sipariş Faturalarını Faturalamak | Sipariş fişlerini faturalar. |
| Satış İrsaliyeleri | Satış İrsaliyeleri ekleme ve güncelleme işlemi. |
| Cari Hesap Fişi | Cari Hesap Fişi ekleme ve güncelleme işlemi. |
| Ürün Reçetesi | Ürün Reçetesi ekleme ve güncelleme işlemi. |
🛠️ Geliştirme
- Programlama Dili: C#
- Platform: .NET 6+
📄 Lisans
Bu proje MIT Lisansı altında lisanslanmıştır. Daha fazla bilgi için LICENSE dosyasına bakabilirsiniz.
📫 İletişim
Bu projeyle ilgili herhangi bir sorunuz veya geri bildiriminiz varsa, lütfen bana ulaşın:
Hakkıcan Bülüç
- LinkedIn: Hakkıcan Bülüç
- GitHub: Hakkıcan Bülüç
<a name="en"></a>
🇺🇸 English
Sözer Logo Rest is a .NET library developed for integration with Logo Software products. This package allows you to easily integrate data such as Current Account, Current Shipping Address, Sales Order, and Purchase Order into the Logo system.
With the latest update, the library includes improved error handling with a custom PostException, which is thrown if any errors occur during the posting process.
📦 Installation
You can add the Sözer Logo Rest to your projects via NuGet:
dotnet add package Sozer.Logo.Rest
or add it through Visual Studio NuGet Package Manager:
- Tools > NuGet Package Manager > Manage NuGet Packages for Solution...
- Search for
Sozer Logo Restin the Browse tab and add it to your project.
🚀 Usage
The package is straightforward to use. It includes a LogoClient for general operations.
1. Connection Setup
You need to provide the following information in the appsettings.json file for ELogoClient login procedures:
{
"ELogoService": {
"username": "Kullanıcı_adi",
"password": "parola"
},
"LogoRestAPI": {
"Url": "Logo/Rest/API/Url",
"Client": "Logo Rest API Authorization Token"
}
}
You need to include Configuration in the package to be able to read the information in appsettings.json.
var builder = WebApplication.CreateBuilder(args);
IWebHostEnvironment env = builder.Environment;
builder.Configuration.SetBasePath(env.ContentRootPath).AddJsonFile("appsettings.json", optional: false).AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true);
builder.Services.AddSozerLogoRestPackage("<license key here>", builder.Configuration);
// Error handling and license verification requirements
var app = builder.Build();
app.ConfigureExceptionHandlingMiddleware();
You can register for your license key at Sözer Bilgisayar
2. Adding or Updating an Account with TaxPayerCode Validation
When adding an account, if the TaxPayerCode field is provided:
- The TaxPayerCode is validated through the Revenue Administration (GIB) service.
- If valid:
- If
TaxPayerCodeis 10 characters long, the account is treated as a corporate entity. - Otherwise, it is treated as an individual entity.
- If
- The response from the service updates specific fields such as
PostLabelandSenderLabel.
[Route("api/[controller]/[action]")]
[ApiController]
public class AccountsRpController(LogoClient logoClient) : ControllerBase
{
private readonly LogoClient logoClient = logoClient;
[HttpPost]
[ProducesResponseType(StatusCodes.Status200OK, Type = typeof(bool))]
[ProducesResponseType(StatusCodes.Status400BadRequest, Type = typeof(ExceptionModel))]
public async Task<IActionResult> Post(CancellationToken cancellationToken) => Ok(await logoClient.PostAccountsRPs(new LogoAuth
{
Username = "username",
Password = "password",
FirmNo = 0, // firmNumber
PeriodNr = null // periodNumber
}, [ new AccountsRP()
{
Code = "Current Account Code",
TaxPayerCode = "1234567890", // Validates and determines account type
} ], cancellationToken));
}
3. Adding And Updating Account Shipping Addresses
With the new INTERNAL_REFERENCE field, if the field is not null, the system updates the data with the given fields. If INTERNAL_REFERENCE is null, a new record is created.
[Route("api/[controller]/[action]")]
[ApiController]
public class ArpShipLicsController(LogoClient logoClient) : ControllerBase
{
private readonly LogoClient logoClient = logoClient;
[HttpPost]
[ProducesResponseType(StatusCodes.Status200OK, Type = typeof(bool))]
[ProducesResponseType(StatusCodes.Status400BadRequest, Type = typeof(ExceptionModel))]
public async Task<IActionResult> Post(CancellationToken cancellationToken) => Ok(await logoClient.PostArpShipLics(new LogoAuth
{
Username = "username",
Password = "password",
FirmNo = 0, // firmNumber
PeriodNr = null // periodNumber
}, [new ArpShipLic() {
ArpCode = "Current Account Code",
Code = "Shipping Address Code"
}], cancellationToken));
}
4. Adding And Updating Sales Orders
With the new INTERNAL_REFERENCE field, if the field is not null, the system updates the data with the given fields. If INTERNAL_REFERENCE is null, a new record is created.
[Route("api/[controller]/[action]")]
[ApiController]
public class OrdersController(LogoClient logoClient) : ControllerBase
{
private readonly LogoClient logoClient = logoClient;
[HttpPost]
[ProducesResponseType(StatusCodes.Status200OK, Type = typeof(bool))]
[ProducesResponseType(StatusCodes.Status400BadRequest, Type = typeof(ExceptionModel))]
public async Task<IActionResult> Post(CancellationToken cancellationToken) => Ok(await logoClient.PostOrders(new LogoAuth
{
Username = "username",
Password = "password",
FirmNo = 0, // firmNumber
PeriodNr = null // periodNumber
}, [
new Order() {
Number = "Sales Order Number"
}
], cancellationToken));
}
5. Adding And Updating Purchase Order
With the new INTERNAL_REFERENCE field, if the field is not null, the system updates the data with the given fields. If INTERNAL_REFERENCE is null, a new record is created.
[Route("api/[controller]/[action]")]
[ApiController]
public class PurchOrdersController(LogoClient logoClient) : ControllerBase
{
private readonly LogoClient logoClient = logoClient;
[HttpPost]
[ProducesResponseType(StatusCodes.Status200OK, Type = typeof(bool))]
[ProducesResponseType(StatusCodes.Status400BadRequest, Type = typeof(ExceptionModel))]
public async Task<IActionResult> Post(CancellationToken cancellationToken) => Ok(await logoClient.PostPurchOrders(new LogoAuth
{
Username = "username",
Password = "password",
FirmNo = 0, // firmNumber
PeriodNr = null // periodNumber
}, [new PurchOrder() {
Number = "Purchase Order Number"
}], cancellationToken));
}
6. Adding And Updating Material
With the new INTERNAL_REFERENCE field, if the field is not null, the system updates the data with the given fields. If INTERNAL_REFERENCE is null, a new record is created.
[Route("api/[controller]/[action]")]
[ApiController]
public class MaterialsController(LogoClient logoClient) : ControllerBase
{
private readonly LogoClient logoClient = logoClient;
[HttpPost]
[ProducesResponseType(StatusCodes.Status200OK, Type = typeof(bool))]
[ProducesResponseType(StatusCodes.Status400BadRequest, Type = typeof(ExceptionModel))]
public async Task<IActionResult> Post(CancellationToken cancellationToken) => Ok(await logoClient.PostMaterials(new LogoAuth
{
Username = "username",
Password = "password",
FirmNo = 0, // firmNumber
PeriodNr = null // periodNumber
}, [new Material() {
Code = "Material Code"
}], cancellationToken));
}
7. Adding And Updating Sales Invoice
With the new INTERNAL_REFERENCE field, if the field is not null, the system updates the data with the given fields. If INTERNAL_REFERENCE is null, a new record is created.
[Route("api/[controller]/[action]")]
[ApiController]
public class SalesInvoiceController(LogoClient logoClient) : ControllerBase
{
private readonly LogoClient logoClient = logoClient;
[HttpPost]
[ProducesResponseType(StatusCodes.Status200OK, Type = typeof(IList<PostResult>))]
[ProducesResponseType(StatusCodes.Status400BadRequest, Type = typeof(ExceptionModel))]
public async Task<IActionResult> Post(CancellationToken cancellationToken) => Ok(await logoClient.PostSalesInvoices(new LogoAuth
{
Username = "username",
Password = "password",
FirmNo = 0, // firmNumber
PeriodNr = null // periodNumber
}, [new SalesInvoice() {
Type = 3,
}], cancellationToken));
}
}
8. Adding and Updating Material Slips
With the new INTERNAL_REFERENCE field, if the field is not null, the system updates the data with the given fields. If INTERNAL_REFERENCE is null, a new record is created.
[Route("api/[controller]/[action]")]
[ApiController]
public class MaterialSlipsController(LogoClient logoClient) : ControllerBase
{
private readonly LogoClient logoClient = logoClient;
[HttpPost]
[ProducesResponseType(StatusCodes.Status200OK, Type = typeof(IList<PostResult>))]
[ProducesResponseType(StatusCodes.Status400BadRequest, Type = typeof(ExceptionModel))]
public async Task<IActionResult> Post(CancellationToken cancellationToken) => Ok(await logoClient.PostMaterialSlips(new LogoAuth
{
Username = "username",
Password = "password",
FirmNo = 0, // firmNumber
PeriodNr = null // periodNumber
}, [new() {
Group = 3,
Type = 12,
Date = "29.09.2025",
CurrselTotals = 1,
Transactions = new() {
Transaction = [new() {
ItemCode = "Item Code",
Quantity = 5,
UnitCode = "Unit Code",
UnitConv1 = 1,
UnitConv2 = 1
}]
}
}], cancellationToken));
}
9. Error Handling with PostException
During the posting process, if any errors occur, a custom PostException is thrown. This exception contains detailed information about the failed posts, including the item number and the error message.
Example:
try
{
IList<PostResult> results = await logoClient.PostAccountsRPs(new LogoAuth
{
Username = "username",
Password = "password",
FirmNo = 0, // firmNumber
PeriodNr = null // periodNumber
}, new List<Account>
{
new()
{
InternalReference = null,
Title = "Invalid Account",
TaxPayerCode = "INVALID"
}
});
}
catch (PostException ex)
{
Console.WriteLine("An error occurred during the posting process:");
Console.WriteLine(ex.Message);
}
What Happens During an Error:
- Validation: If any
PostResultindicates failure (IsSuccess == false), aPostExceptionis triggered. - Error Details: The exception message includes:
- The item number (
Number). - The entity name (e.g., "Account").
- The error message.
- The item number (
Example Error Message:
Hata Mesajı: 1 numaralı AccountsRP Hata: DBError(8) - Kayıt veritabanına aktarılamadı. 23000 : Cannot insert duplicate key row in object 'dbo.LG_999_CLCARD' with unique index 'I999_CLCARD_I13'. The duplicate key value is (1, 0, 1).\n"
10. Billing Orders with OrderBilling
This method is used to invoice order slips. If the operation does not succeed, the error property is filled in the return object.
[Route("api/[controller]/[action]")]
[ApiController]
public class UnityApplicationController(LogoClient logoClient) : ControllerBase
{
private readonly LogoClient logoClient = logoClient;
[HttpPost]
[ProducesResponseType(StatusCodes.Status200OK, Type = typeof(OrderBillingResponse))]
[ProducesResponseType(StatusCodes.Status400BadRequest, Type = typeof(ExceptionModel))]
public async Task<IActionResult> OrderBilling(CancellationToken cancellationToken) => Ok(await logoClient.OrderBilling(new LogoAuth
{
Username = "username",
Password = "password",
FirmNo = 0, // firmNumber
PeriodNr = null // periodNumber
}, [new() {
OrderRef = 3229, // The Logical Reference of the order you will invoice
Date = "02.10.2025", // The date must be in the day.month.year format.
FicheType = 3, // Invoice Type
DocumentCode = "Document No.",
SpecialCode = "Special Code",
AuthCode = "Authorization Code",
Description1 = "Description 1",
Description2 = "Description 2",
Description3 = "Description 3",
Description4 = "Description 4",
CheckUserRight = true, // Should User Permissions Be Checked?
SqlTransaction = true, // Sql Transaction
EInvoice = false, // Will the order be converted to an e-invoice?
VatExceptReason = "Vat Except Reason"
}, new() {
OrderRef = 3230,
Date = "02.10.2025",
FicheType = 3,
DocumentCode = "SP00000000000003"
}, new() {
OrderRef = 2142,
Date = "02.10.2025",
FicheType = 3,
DocumentCode = "SP00000000000001"
},], cancellationToken));
11. Adding and Updating Sales Invoices
With the new INTERNAL_REFERENCE field, if the field is not null, the system updates the data with the given fields. If INTERNAL_REFERENCE is null, a new record is created.
[Route("api/[controller]/[action]")]
[ApiController]
public class SalesDispatchesController(LogoClient logoClient, XmlService xmlService) : ControllerBase
{
private readonly LogoClient logoClient = logoClient;
private readonly XmlService xmlService = xmlService;
[HttpPost]
[ProducesResponseType(StatusCodes.Status200OK, Type = typeof(IList<PostResult>))]
[ProducesResponseType(StatusCodes.Status400BadRequest, Type = typeof(ExceptionModel))]
public async Task<IActionResult> Post(CancellationToken cancellationToken) => Ok(await logoClient.PostSalesDispatches(new LogoAuth
{
Username = "username",
Password = "password",
FirmNo = 0, // firmNumber
PeriodNr = null // periodNumber
}, [new() {
Type = 9,
Number = "~",
Date = "23.10.2025",
Time = 202052408,
ArpCode = "5000534",
Notes1 = "",
SourceWh = 0,
CreatedBy = 0,
RcRate = 0,
CurrselTotals = 1,
Salesmancode = "",
ShippingAgent = "",
Deductionpart1 = 0,
Deductionpart2 = 0,
Edespatch = 1,
ShipDate = "23.10.2025",
ShipTime = 202052408,
DocDate = "23.10.2025",
DocTime = 202052408,
Transactions =
{
new()
{
Type = 0,
Price = 0,
MasterCode = "DKPN12188",
Sourceindex = 0,
Quantity = 5,
RcXrate = 0,
UnitCode = "ADET",
UnitConv1 = 5,
UnitConv2 = 5,
VatRate = 20,
EdtCurr = 53,
OrderReference = "3001",
Sldetails =
{
new()
{
SourceMtReference = 380,
SourceSltReference = 1,
SourceQuantity = 1,
IOCODE = 4,
SourceWh = 0,
SlType = 1,
SlCode = "123456",
MuQuantity = 1,
UnitCode = "ADET",
Quantity = 1,
UnitConv1 = 1,
UnitConv2 = 1
}
}
}
}
}], cancellationToken));
}
12. Adding And Updating Arp Voucher
With the new INTERNAL_REFERENCE field, if the field is not null, the system updates the data with the given fields. If INTERNAL_REFERENCE is null, a new record is created.
[Route("api/[controller]/[action]")]
[ApiController]
public class ArpVouchersController(LogoClient logoClient) : ControllerBase
{
private readonly LogoClient logoClient = logoClient;
[HttpPost]
[ProducesResponseType(StatusCodes.Status200OK, Type = typeof(IList<PostResult>))]
[ProducesResponseType(StatusCodes.Status400BadRequest, Type = typeof(ExceptionModel))]
public async Task<IActionResult> Post(CancellationToken cancellationToken) => Ok(await logoClient.PostArpVoucher(new LogoAuth
{
Username = "username",
Password = "password",
FirmNo = 0, // firmNumber
PeriodNr = null // periodNumber
}, [new() {
Number = "Number",
Date = "26.01.2026",
Type = 70, // Type
Notes1 = "Description",
CurrselTotals = 1,
DataReference = 1,
Arp_Code = "Current Account Code",
ProjectCode = "Project Code",
AffectRisk = 0,
SalesmanCode = "Sales Representative Code"
}], cancellationToken));
}
13. Adding And Updating Bom
With the new INTERNAL_REFERENCE field, if the field is not null, the system updates the data with the given fields. If INTERNAL_REFERENCE is null, a new record is created.
[Route("api/[controller]/[action]")]
[ApiController]
public class BomsController(LogoClient logoClient) : ControllerBase
{
private readonly LogoClient logoClient = logoClient;
[HttpPost]
[ProducesResponseType(StatusCodes.Status200OK, Type = typeof(IList<PostResult>))]
[ProducesResponseType(StatusCodes.Status400BadRequest, Type = typeof(ExceptionModel))]
public async Task<IActionResult> Post(CancellationToken cancellationToken) => Ok(await logoClient.PostBom(new LogoAuth
{
Username = "username",
Password = "password",
FirmNo = 0, // firmNumber
PeriodNr = null // periodNumber
}, [new() {
Code = "Test3",
Type = 1,
RevCode = "REVISION - CODE",
RevRecordStatus = 1,
RevDate = "28.01.2026",
RevDataReference = 1,
Lines = [new() {
LineType = 4,
Uinfo1 = 1,
Uinfo2 = 1,
Amount = 1,
Scalable = 1,
InvenNo = -1,
Engineering = 1,
Production = 1,
Cost = 1,
CostRate = 1,
Formula = "1",
EffectOpTime = 1,
ItemCode = "Main material code",
ItemName = "Primary material name",
UnitSetCode = "05",
UnitCode = "Unit Code",
BomType = 1,
OpCode = "Operation Code",
OpName = "Operation Description"
}, new() {
LineType = 0,
Uinfo1 = 1,
Uinfo2 = 1,
Amount = 1,
Scalable = 1,
InvenNo = -1,
Engineering = 1,
Production = 1,
Cost = 1,
Formula = "P1",
ItemCode = "Input material code",
ItemName = "Input material name",
UnitSetCode = "05",
UnitCode = "Unit Code",
BomType = 1,
OpCode = "Operation Code",
OpName = "Operation Description",
DefCostType = 5
}],
MpCode = "Main product code",
MpName = "Main product name",
RoutCode = "PRODUCTION ROUTE CODE",
RoutName = "PRODUCTION ROUTE Description"
}], cancellationToken));
}
🔄 Line Update Behavior
During the update process for the following objects:
- Bom
- Material
- MaterialSlip
- Order
- PurchOrder
- SalesDispatche
- SalesInvoice
If the record to be updated has lines, during the update this record is completely deleted and recreated from scratch with the submitted record.
⚠ Important Warning
Therefore, when updating, if the data contains lines:
- The user must resend all lines.
- All fields must be filled in completely for each line.
- Otherwise, any fields or lines that are not sent will be considered deleted and will not appear in the record.
This approach has been chosen to ensure line synchronization on the Logo side.
📑 API Features
| Feature | Description |
|---|---|
| Current Account | Create and update an account with TaxPayerCode validation. |
| Shipping Address | Add and update customer shipping addresses. |
| Sales Order | Create and update sales orders. |
| Purchase Order | Add and update purchase orders. |
| Material | Add and update materials. |
| Sales Invoice | Add and update sales invoices. |
| Material Slips | Add and update material slips. |
| Error Handling | Custom PostException for detailed error reporting. |
| OrderBilling: Billing Order Invoices | Invoices for order slips. |
| Sales Invoices | Adding and updating sales invoices. |
| Arp Vouchers | Adding and Updating arp vouchers. |
| Bom | Adding and Updating boms. |
🛠️ Development
- Programming Language: C#
- Platform: .NET 6+
📄 License
This project is licensed under the MIT License. For more information, please see the LICENSE file.
📫 Contact
If you have any questions or feedback about this project, please reach out to me:
Hakkıcan Bülüç
- LinkedIn: Hakkıcan Bülüç
- GitHub: Hakkıcan Bülüç
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net9.0
- AutoMapper (>= 13.0.1)
- MediatR (>= 12.4.1)
- Microsoft.AspNetCore.Http.Abstractions (>= 2.1.1)
- Microsoft.Extensions.Configuration.Abstractions (>= 9.0.10)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 9.0.10)
- Microsoft.Extensions.Http (>= 8.0.0)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 9.0.10)
- SendGrid (>= 9.29.3)
- System.ServiceModel.Http (>= 8.1.2)
- System.ServiceModel.NetTcp (>= 8.1.2)
- System.ServiceModel.Primitives (>= 8.1.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.794 | 90 | 2/18/2026 |
| 1.0.793 | 82 | 2/18/2026 |
| 1.0.792 | 91 | 2/17/2026 |
| 1.0.791 | 82 | 2/17/2026 |
| 1.0.81 | 80 | 3/2/2026 |
| 1.0.79 | 87 | 2/17/2026 |
| 1.0.78 | 87 | 2/17/2026 |
| 1.0.77 | 93 | 2/17/2026 |
| 1.0.76 | 87 | 2/17/2026 |
| 1.0.75 | 86 | 2/17/2026 |
| 1.0.74 | 88 | 2/17/2026 |
| 1.0.73 | 91 | 2/17/2026 |
| 1.0.72 | 84 | 2/17/2026 |
| 1.0.71 | 87 | 2/17/2026 |
| 1.0.8 | 91 | 2/20/2026 |
| 1.0.7 | 98 | 2/16/2026 |
| 1.0.6 | 86 | 2/16/2026 |
| 1.0.5 | 87 | 2/16/2026 |
| 1.0.4 | 91 | 2/16/2026 |
| 1.0.3 | 90 | 2/16/2026 |
Date alanları Logo Rest API için formatlanıyor