inbound

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 19, 2026 License: Apache-2.0 Imports: 18 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package inbound is the HTTP entrance for partners: POST /edi/inbound.

Input: a raw X12 004010 interchange in the body, a partner bearer token and the headers Message-Id, AS2-From and AS2-To (an emulation of AS2 without MIME and signatures). Output: HTTP 200 with an MDN (a JSON receipt) when the interchange is stored or was already stored; HTTP 422 or 409 with an error MDN when it is refused; and, for faults before the receipt, the gateway's single error format (internal/rpcerr).

Order, all on the server: address bucket and token (edge.Gate) -> only kind "partner" of an active partner of a tenant that has an interchange id -> bucket per partner -> body size and headers -> AS2-From and AS2-To against the token and the tenant -> strict parse -> ISA05:ISA06 and ISA07:ISA08 against the same -> one transaction that stores the interchange and its documents (a repeat of the same interchange returns the first MDN, another body under the same ISA13 is refused) -> one audit row.

For every functional group of 850 or 810 of a new interchange the same transaction queues a 997 to the partner (wave 2-9c, flow P1): AK5 A for a set the parser accepted, R with the AK3 and AK4 of its errors for a set it refused. The relay sends it like any other document.

A 997 is stored like any set and also matched, in the same transaction, to the document the gateway sent (partner that sent it, AK102, AK202): that is how a document becomes delivered or an incident (invariant I6).

The MDN confirms transport, not content: a set rejected by the parser or by the role of the partner is stored as rejected and the MDN still says "processed".

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

type Handler struct {
	// contains filtered or unexported fields
}

Handler serves /edi/inbound.

func New

func New(gate *edge.Gate, st *store.Store, log *slog.Logger) *Handler

New builds the handler. The gate is the same one /mcp uses, so both entrances share the bucket per client address.

func (*Handler) ServeHTTP

func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request)

type MDN

type MDN struct {
	MessageID         string `json:"message_id"`
	OriginalMessageID string `json:"original_message_id"`
	MICSHA256         string `json:"mic_sha256"`
	Disposition       string `json:"disposition"`
}

MDN is the receipt for an interchange. Field order is fixed by the struct, so the same MDN always gives the same bytes.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL