forked from r-kuzyk/edi_parser
-
Notifications
You must be signed in to change notification settings - Fork 0
/
edi_document.py
24 lines (19 loc) · 869 Bytes
/
edi_document.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
from data_elements.body import Body
from data_elements.envelop import Interchange, FunctionalGroup, TransactionSet
class EdiDocument:
"""
An EDI X12 Document
"""
def __init__(self):
self.interchange = Interchange()
self.functional_group = FunctionalGroup()
self.transaction_set = TransactionSet()
self.body = Body()
def to_dict(self):
return {'Parsed data': [self.interchange.header.to_dict(),
self.functional_group.header.to_dict(),
self.transaction_set.header.to_dict(),
self.body.to_dict(),
self.transaction_set.trailer.to_dict(),
self.functional_group.trailer.to_dict(),
self.interchange.trailer.to_dict()]}