GescomOrderBundle 2.1.0

dotnet add package GescomOrderBundle --version 2.1.0
                    
NuGet\Install-Package GescomOrderBundle -Version 2.1.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="GescomOrderBundle" Version="2.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="GescomOrderBundle" Version="2.1.0" />
                    
Directory.Packages.props
<PackageReference Include="GescomOrderBundle" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add GescomOrderBundle --version 2.1.0
                    
#r "nuget: GescomOrderBundle, 2.1.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package GescomOrderBundle@2.1.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=GescomOrderBundle&version=2.1.0
                    
Install as a Cake Addin
#tool nuget:?package=GescomOrderBundle&version=2.1.0
                    
Install as a Cake Tool

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 order
  • IOrderItem - Represents an order item
  • IClient - Represents a client
  • IPriceList - Represents a price list
  • IArticle - Represents an article/product
  • ISeller - Represents a seller/vendor
  • IDateTimeExtensions - 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 interfaces
  • UsageExample.cs - Complete usage example with all steps

Settings Configuration

The settings JObject must contain:

  • CodigoEmpresaPresupuestos (string): Company code for quotes
  • EnviaEmpresaVenta (bool as string): Whether to send sales company
  • EnviaDeposito (bool as string): Whether to send deposit
  • EnviaEnBultos (bool as string): Whether to send in bundles
  • DepositosCarService (string): Comma-separated list of CarService deposits
  • OpcionEnvioPedidoListaP (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:

  1. Remove direct package references to Axum.Common and AxumConnectorCommon from GescomOrderBundle
  2. Implement adapters as shown in the examples to wrap your existing models
  3. Pass adapted objects to the generator instead of the original ones
  4. 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 and raiseException is true
  • PriceListNotFoundForArticleException: When a price list is not found for an article
  • PriceListNotFoundForClientException: 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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
2.1.0 152 10/13/2025
2.0.0 258 9/24/2025