ballerinax/edifact.d03a.retail Ballerina library

1.0.1

Overview

UN/EDIFACT D03A Retail group EDI parser: reads and writes the 23 messages covering product data, exchange reconciliation and inquiries, requests for quote and for document, pricing history, returns announcements and instructions, reservations, generic and statistical messages, and insurance policy administration and reinsurance messages.

UN/EDIFACT is the United Nations standard for electronic data interchange, used to exchange business documents such as orders, invoices and despatch advices between trading partners.

Key Features

  • Typed records for all 23 messages in the retail group, each in its own submodule, so a program only pulls in the records for the messages it handles.
  • Envelope-aware parsing and serialization: an interchange is read from UNB through UNZ, including the UNH/UNT message header and trailer.
  • Round-trips in both directions — EDI text to records, and records back to conformant EDI text with the UNT segment count recomputed.
  • Generated from the UN/EDIFACT D03A directory with the Ballerina EDI tool, so the records follow the published specification.

Quickstart

To use the edifact.d03a.retail package in your Ballerina application, modify the .bal file as follows:

Step 1: Import the module

Import the package and the submodules for the messages you handle.

Copy
import ballerina/io;
import ballerinax/edifact.d03a.retail;
import ballerinax/edifact.d03a.retail.mGENRAL;

Step 2: Read an EDI message

Convert an EDIFACT interchange into a Ballerina record.

Copy
public function main() returns error? {
    string ediText = check io:fileReadString("genral.edi");
    mGENRAL:EDI_GENRAL_GENRAL message =
        check retail:fromEdiString(ediText, retail:EDI_GENRAL).ensureType();
    io:println(message);
}

retail:getEDINames() returns every message name this package supports. interchangeFromEdiString gives access to the full UNB/UNZ interchange, and headersFromEdiString reads just the headers.

Step 3: Write an EDI message

Convert a Ballerina record back into an EDIFACT interchange.

Copy
string ediText = check retail:toEdiString(message, retail:EDI_GENRAL);

Use interchangeToEdiString to write the full interchange rather than the message body alone.

Step 4: Run the Ballerina application

Copy
bal run

Supported messages

MessageDescriptionModule
GENRALGeneral purposeedifact.d03a.retail.mGENRAL
GESMESGeneric statisticaledifact.d03a.retail.mGESMES
INFCONInfrastructure conditionedifact.d03a.retail.mINFCON
IPPOADInsurance policy administrationedifact.d03a.retail.mIPPOAD
IPPOMOMotor insurance policyedifact.d03a.retail.mIPPOMO
JAPRESJob application resultedifact.d03a.retail.mJAPRES
JINFDEJob information demandedifact.d03a.retail.mJINFDE
PRIHISPricing historyedifact.d03a.retail.mPRIHIS
PROCSTProject cost reportingedifact.d03a.retail.mPROCST
PRODATProduct dataedifact.d03a.retail.mPRODAT
PRODEXProduct exchange reconciliationedifact.d03a.retail.mPRODEX
PROINQProduct inquiryedifact.d03a.retail.mPROINQ
RDRMESRaw data reportingedifact.d03a.retail.mRDRMES
REBORDReinsurance bordereauedifact.d03a.retail.mREBORD
RECORDReinsurance core dataedifact.d03a.retail.mRECORD
REPREMReinsurance premiumedifact.d03a.retail.mREPREM
REQDOCRequest for documentedifact.d03a.retail.mREQDOC
REQOTERequest for quoteedifact.d03a.retail.mREQOTE
RESETTReinsurance settlementedifact.d03a.retail.mRESETT
RESMSGReservationedifact.d03a.retail.mRESMSG
RETACCReinsurance technical accountedifact.d03a.retail.mRETACC
RETANNAnnouncement for returnsedifact.d03a.retail.mRETANN
RETINSInstruction for returnsedifact.d03a.retail.mRETINS

Import

import ballerinax/edifact.d03a.retail;Copy

Other versions

Metadata

Released date: 4 days ago

Version: 1.0.1

License: Apache-2.0


Compatibility

Platform: any

Ballerina version: 2201.12.0

GraalVM compatible: Yes


Pull count

Total: 74

Current verison: 3


Weekly downloads


Source repository


Keywords

product

reinsurance

EDI

EDIFACT

D03A

Vendor/Other

Area/ERP & Business Operations

Type/Library

Name/EDIFACT D03A Retail


Contributors