arolariu.Backend.Domain.Invoices.DDD.Entities.Merchants
arolariu.Backend.Domain.Invoices
arolariu.Backend.Domain.Invoices.DDD.Entities.Merchants Namespace
Classes
Merchant Class
Represents a merchant (vendor / store) referenced by one or more invoices within the invoicing bounded context.
public sealed class Merchant : arolariu.Backend.Common.DDD.Contracts.NamedEntity<System.Guid>
Inheritance System.Object 🡒 arolariu.Backend.Common.DDD.Contracts.BaseEntity<System.Guid> 🡒 arolariu.Backend.Common.DDD.Contracts.NamedEntity<System.Guid> 🡒 Merchant
Remarks
Encapsulates classification (Category), location/contact data (Address), hierarchical grouping (ParentCompanyId)
and reverse references from invoices (ReferencedInvoices) for analytic aggregation.
Identity: Assigned at creation time (random GUID). Future optimization may migrate to Version 7 GUID for chronological sorting.
Relationships: Not an aggregate root for invoices (invoices own the relationship by storing MerchantReference). This type acts
as a referenced entity; deleting a merchant should not cascade to invoices without explicit orchestration logic.
Thread-safety: Not thread-safe — treat instances as single-thread scoped.
Soft Delete: Not currently implementing soft-delete flags at this level; deletion semantics handled at persistence/broker layer if added.
Properties
Merchant.AdditionalMetadata Property
Extensible key/value metadata (lightweight tagging / enrichment layer).
public System.Collections.Generic.IDictionary<string,string> AdditionalMetadata { get; init; }
Property Value
System.Collections.Generic.IDictionary<System.String,System.String>
Remarks
Key namespaces SHOULD use a dotted convention (e.g. ai.confidence, user.note, integration.source).
Values are stored as strings for portability; upstream systems must handle serialization of complex types.
Write Semantics: Last writer wins per key; no historical versioning.
Merchant.Address Property
Structured contact / address information.
public arolariu.Backend.Common.DDD.ValueObjects.ContactInformation Address { get; set; }
Property Value
arolariu.Backend.Common.DDD.ValueObjects.ContactInformation
Remarks
Represents a value object snapshot. Entire object is typically replaced on update; no deep merge semantics currently.
Merchant.Category Property
Domain classification used for analytics, grouping and enrichment heuristics.
public arolariu.Backend.Domain.Invoices.DDD.Entities.Merchants.MerchantCategory Category { get; set; }
Property Value
Remarks
Defaults to OTHER when unclassified. Downstream enrichment processes SHOULD minimize long-term usage of OTHER.
Merchant.id Property
Immutable merchant identity.
public override System.Guid id { get; init; }
Property Value
Remarks
Generated via System.Guid.NewGuid; no ordering guarantees. Consider Version 7 GUID if chronological sorting becomes a requirement.
Merchant.ParentCompanyId Property
Optional linkage to a parent company (hierarchical reporting / consolidation).
public System.Guid ParentCompanyId { get; set; }
Property Value
Remarks
Guid.Empty indicates no parent company assigned.
Merchant.ReferencedInvoices Property
Reverse references to invoices that currently point to this merchant.
public System.Collections.Generic.ICollection<System.Guid> ReferencedInvoices { get; init; }
Property Value
System.Collections.Generic.ICollection<System.Guid>
Remarks
Maintained for read-optimization / analytics. Contents are not automatically pruned on invoice deletion; reconciliation job may be required.
Order reflects insertion order; duplicates are not automatically filtered (caller MUST prevent duplicate insertion).
Methods
Merchant.Default() Method
Create a default instance of Merchant.
internal static arolariu.Backend.Domain.Invoices.DDD.Entities.Merchants.Merchant Default();
Returns
Enums
MerchantCategory Enum
The invoice merchant category enum represents the available categories for an invoice merchant. This enum is used to categorize the invoice merchants. The categories are used to generate the invoice statistics.
public enum MerchantCategory
Fields
NOT_DEFINED 0
Not defined = the merchant category was not defined.
LOCAL_SHOP 100
Local shop = the merchant is a local shop.
SUPERMARKET 200
Supermarket = the merchant is a supermarket.
HYPERMARKET 300
Hypermarket = the merchant is a hypermarket.
ONLINE_SHOP 400
Online shop = the merchant is an online shop.
OTHER 9999
Other = the merchant is not defined.