GescomOrderBundle 2.1.0
dotnet add package GescomOrderBundle --version 2.1.0
NuGet\Install-Package GescomOrderBundle -Version 2.1.0
<PackageReference Include="GescomOrderBundle" Version="2.1.0" />
<PackageVersion Include="GescomOrderBundle" Version="2.1.0" />
<PackageReference Include="GescomOrderBundle" />
paket add GescomOrderBundle --version 2.1.0
#r "nuget: GescomOrderBundle, 2.1.0"
#:package GescomOrderBundle@2.1.0
#addin nuget:?package=GescomOrderBundle&version=2.1.0
#tool nuget:?package=GescomOrderBundle&version=2.1.0
GescomOrderBundle
A NuGet package for generating Gescom orders from external systems using dependency inversion.
Features
- Generate Gescom-compatible order DTOs from external order data
- Support for different order types (Order, Quote, Rejection)
- Handle discounts, combos, and special pricing
- Configurable settings for different business rules
- No external dependencies - Uses interfaces for complete decoupling
Installation
dotnet add package GescomOrderBundle
Architecture
This package uses Dependency Inversion Principle to avoid direct dependencies on external packages. Instead of depending on Axum.Common or AxumConnectorCommon, it defines its own interfaces that consumers must implement.
Key Interfaces
IOrder- Represents an orderIOrderItem- Represents an order itemIClient- Represents a clientIPriceList- Represents a price listIArticle- Represents an article/productISeller- Represents a seller/vendorIDateTimeExtensions- Date formatting utilities
Usage
Step 1: Implement Adapters
Create adapters that implement the package interfaces for your existing models:
using GescomOrderBundle.Abstractions;
public class OrderAdapter : IOrder
{
private readonly YourOrderClass _order;
public OrderAdapter(YourOrderClass order)
{
_order = order;
}
public string OriginOrderId => _order.OriginOrderId;
public string OriginSystemCode => _order.OriginSystemCode;
public string ClientId => _order.ClientId;
public string? SellerId => _order.SellerId;
public string? PaymentMethod => _order.PaymentMethod;
public DateTime OrderDate => _order.OrderDate;
public DateTime? DeliveryDate => _order.DeliveryDate;
public string? Observations => _order.Observations;
public int AxumOperationTypeCode => _order.AxumOperationTypeCode;
public IEnumerable<IOrderItem> OrderItems =>
_order.OrderItems.Select(item => new OrderItemAdapter(item));
}
Step 2: Generate Gescom Order
using GescomOrderBundle;
using GescomOrderBundle.Implementations;
using Newtonsoft.Json.Linq;
// Prepare settings
var settings = JObject.Parse(@"{
'CodigoEmpresaPresupuestos': 'EMP001',
'EnviaEmpresaVenta': 'true',
'EnviaDeposito': 'true',
'EnviaEnBultos': 'false',
'DepositosCarService': 'DEP001,DEP002',
'OpcionEnvioPedidoListaP': 'true'
}");
// Create adapters for your objects
IOrder orderAdapter = new OrderAdapter(yourOrder);
IClient? clientAdapter = yourClient != null ? new ClientAdapter(yourClient) : null;
ISeller? sellerAdapter = yourSeller != null ? new SellerAdapter(yourSeller) : null;
// Convert lists
var priceListAdapters = yourPriceLists.Select(pl => new PriceListAdapter(pl)).ToList();
// Convert articles dictionary
var articleAdapters = new Dictionary<string, IArticle>();
foreach (var kvp in yourArticles)
{
articleAdapters[kvp.Key] = new ArticleAdapter(kvp.Value);
}
// Use the generator
var gescomPedido = GescomOrderGenerator.GenerateGescomPedido(
order: orderAdapter,
settings: settings,
cliente: clientAdapter,
priceLists: priceListAdapters,
articles: articleAdapters,
vendedor: sellerAdapter,
dateTimeExtensions: new DefaultDateTimeExtensions(),
organizationCode: "ORG001",
miNegocioSourceOriginSystemCode: "1167",
miNegocioOriginSystemCode: "MiNegocio",
raiseException: false
);
// Serialize and send to Gescom
string json = Newtonsoft.Json.JsonConvert.SerializeObject(gescomPedido);
Complete Examples
See the Examples folder for complete implementation examples:
AdapterExample.cs- Sample adapter implementations for all interfacesUsageExample.cs- Complete usage example with all steps
Settings Configuration
The settings JObject must contain:
CodigoEmpresaPresupuestos(string): Company code for quotesEnviaEmpresaVenta(bool as string): Whether to send sales companyEnviaDeposito(bool as string): Whether to send depositEnviaEnBultos(bool as string): Whether to send in bundlesDepositosCarService(string): Comma-separated list of CarService depositsOpcionEnvioPedidoListaP(bool as string): Whether to send price list in order
Migration from Direct Dependencies
If you were previously using this package with direct dependencies on Axum.Common and AxumConnectorCommon:
- Remove direct package references to
Axum.CommonandAxumConnectorCommonfrom GescomOrderBundle - Implement adapters as shown in the examples to wrap your existing models
- Pass adapted objects to the generator instead of the original ones
- Use IDateTimeExtensions for date formatting (DefaultDateTimeExtensions is provided)
Benefits of This Approach
- No forced dependencies: Consumers only need to install GescomOrderBundle
- Clean architecture: Proper separation of concerns with dependency inversion
- Flexibility: Change your internal models without affecting the bundle
- Testability: Easy to mock interfaces for unit testing
- Maintainability: Updates to external packages don't break the bundle
Exceptions
The generator can throw the following exceptions:
ArticleNotFoundException: When an article is not found andraiseExceptionis truePriceListNotFoundForArticleException: When a price list is not found for an articlePriceListNotFoundForClientException: When a price list is not found for a client
Requirements
- .NET 8.0 or higher
- Newtonsoft.Json 13.0.3 or higher
License
MIT
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. 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. |
| .NET Core | netcoreapp3.1 is compatible. |
| .NET Framework | net451 is compatible. net452 was computed. net46 was computed. net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
-
.NETCoreApp 3.1
- Newtonsoft.Json (>= 13.0.3)
-
.NETFramework 4.5.1
- Newtonsoft.Json (>= 13.0.3)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.