Вышел Модуль интеграций 2.0 для MedusaЧитать анонс
DIAN logo

DIAN

Электронные счета для налоговой службы Колумбии DIAN (Facturación Electrónica, Anexo Técnico 1.9, Resolución 000165) в Medusa v2. XML UBL 2.1, CUFE/CUDE (SHA-384), подпись XAdES-EPES, SOAP-сервисы DIAN и подключаемые провайдеры Siigo, Alegra, Dataico и FacturaTech.

npm install @vicacha-devs/medusa-plugin-dian
Категория
ERP
Создано
Vicacha-devs
Версия
0.1.1
Ежемесячные загрузки
Загрузка данных
Последнее обновление

Colombian DIAN Electronic Invoicing (Facturación Electrónica DIAN — Anexo Técnico 1.9 & Resolución 000165) plugin for Medusa v2.

Supports both Native "Software Propio" transmission (UBL 2.1 XML, SHA-384 CUFE/CUDE, XAdES-EPES digital signature, DIAN SOAP Web Services, and RADIAN events) and Pluggable Colombian Proveedores Tecnológicos / ERPs (, , , ).

Medusa compatibility: Required core plugin: — acts as the Colombia ( / ) fiscal driver () for .


Contents


Key Features

  1. Hybrid Transmission Engine:
    • Native "Software Propio" (): Generates compliant UBL 2.1 XML (, , , ), computes CUFE / CUDE (), signs XML with XAdES-EPES (PKCS#12 /), and communicates with DIAN Web Services (, , , , ).
    • Pluggable Provider Adapter (): Built-in adapters for Siigo, Alegra, Dataico, and FacturaTech.
  2. Complete DIAN Document Suite:
    • Factura Electrónica de Venta ( Nacional, Exportación, Contingencia) with CUFE.
    • Nota Crédito Electrónica () & Nota Débito Electrónica () with CUDE and mandatory to the original invoice CUFE.
    • Documento Equivalente Electrónico POS ( — Tiquete POS Electrónico, Resolución 000165) with CUDE and 80mm/58mm thermal QR representation.
    • RADIAN Events (, , , , ) for title-value (Título Valor) lifecycle tracking.
  3. Colombian Tax & Modulo-11 Engine:
    • DIAN Modulo-11 check digit () with prime weights .
    • Automatic separation of taxes (, , ) and Colombian withholdings (Retenciones: , , ).
    • Formulario 1876 numbering resolution validation (expiry date, range exhaustion, and low-folio alerts).

  1. Named Electronic Invoice Requires a Registered Client:
    • Any buyer requesting a named Electronic Invoice ( or non- identification) must be a registered Medusa () with both a valid email () and phone ().
    • Anonymous buyers automatically default to Consumidor Final (, , ).
  2. Legal Client () Requires :
    • Registering or invoicing a Legal Client (Persona Jurídica / NIT + Modulo-11 DV) strictly requires ( module) and a valid .
  3. PDF Generation (Representación Gráfica) Requires :
    • Generating the Representación Gráfica PDF (A4 Invoice, Credit/Debit Note, or 80mm/58mm POS Receipt with DIAN QR code, CUFE/CUDE, Resolution 1876 text, NIT+DV, and Retenciones) strictly delegates to ( module).

Installation & Configuration

Register in :

Run database migrations:

npx medusa db:migrate

Architecture


Data Models ( Module)

ModelDescription
Emisor (Obligado a Facturar Electrónicamente — OFE) NIT, DV, Software ID/PIN, Clave Técnica, Ambiente ( Producción / Habilitación), XAdES certificate, and provider credentials.
Formulario 1876 authorization numbers, prefix (, , , , ), range ( – ), , and validity dates.
Emitted electronic documents (, , , , , ), , status (, , , ), UBL XML, XML, PDF URL, and RADIAN status.
Buyer fiscal identity (, , , , , , , ).

Workflows

Workflow IDDescription
Emits an Electronic Invoice ( / / ) with atomic folio reservation and rollback compensation
Emits a Nota Crédito () referencing the original invoice's CUFE
Emits a Nota Débito () referencing the original invoice's CUFE
Emits a Documento Equivalente POS ( — Resolución 000165)
Emits a RADIAN event (–) on a validated invoice
Validates NIT Modulo-11 DV and B2B Legal Client link before upserting a fiscal profile

REST API

Admin Routes ()

MethodPathDescription
/ Retrieve or update Emisor OFE configuration (redacts secrets on )
/ List or create Formulario 1876 numbering resolutions
Synchronize active resolutions from DIAN SOAP service
/ Update or delete a numbering resolution
/ List electronic documents (with KPI summary) or emit a new Invoice / POS document
Retrieve document details
Emit a Nota Crédito () against a validated invoice
Emit a Nota Débito () against a validated invoice
Register a RADIAN event (–)
Retry transmission of a rejected/contingency document
Download signed UBL 2.1 XML or
Generate/download Representación Gráfica PDF via
Download DIAN-compliant ( containing + )
/ List or upsert Customer & B2B Legal Client fiscal profiles

Store Routes ()

MethodPathDescription
Computes Modulo-11 DV and optionally queries DIAN
/ Read or attach Colombian fiscal profile data to a checkout cart
Retrieve validated electronic documents (, , ) for an order

Admin UI & Widgets

  • (): Overview KPI cards () + Electronic Documents table ().
  • (): Formulario 1876 Numbering Resolutions () + DIAN SOAP sync.
  • (): Client & B2B Legal Client fiscal profiles ().
  • (): Emisor OFE configuration () + Tax & Retenciones automation ().
  • Widget (): Order-level DIAN emission, Credit Note modal, and XML/PDF/ZIP downloads ().

Development & Testing


License

MIT © Vicacha Devs