From 155ae706a66eb6b80dfab08d198d2ed99fbcd66e Mon Sep 17 00:00:00 2001 From: x0l08og Date: Thu, 31 Oct 2024 12:45:45 -0400 Subject: [PATCH 1/5] Revert "Change ASN 856 parsing error messages (#153)" This reverts commit 694f2cd0e3341dd2d4eaf61467ef9f91881ddb4d. --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index b272462..5588a32 100644 --- a/pom.xml +++ b/pom.xml @@ -11,7 +11,7 @@ com.walmartlabs.x12 gozer gozer - 0.3.6-SNAPSHOT + 0.3.5-SNAPSHOT takari-jar From 754726e809a1ab3b6ffaf59126ea2feed5da0d66 Mon Sep 17 00:00:00 2001 From: x0l08og Date: Tue, 10 Dec 2024 15:21:09 -0500 Subject: [PATCH 2/5] per --- pom.xml | 2 +- .../common/segment/N1PartyIdentification.java | 24 ++++++ .../PERAdministrativeCommunication.java | 54 +++++++++++++ .../parser/N1PartyIdentificationParser.java | 4 + ...PERAdministrativeCommunicationsParser.java | 45 +++++++++++ .../N1PartyIdentificationParserTest.java | 19 +++++ ...dministrativeCommunicationsParserTest.java | 79 +++++++++++++++++++ ...56TransactionSetParserEntireTxSetTest.java | 18 ++++- .../X12StandardParserWithAsnSampleTest.java | 9 ++- ...12StandardParserWithGenericSampleTest.java | 2 +- src/test/resources/asn856/asn856.txt | 1 + 11 files changed, 252 insertions(+), 5 deletions(-) create mode 100644 src/main/java/com/walmartlabs/x12/common/segment/PERAdministrativeCommunication.java create mode 100644 src/main/java/com/walmartlabs/x12/common/segment/parser/PERAdministrativeCommunicationsParser.java create mode 100644 src/test/java/com/walmartlabs/x12/common/segment/parser/PERAdministrativeCommunicationsParserTest.java diff --git a/pom.xml b/pom.xml index 5588a32..b272462 100644 --- a/pom.xml +++ b/pom.xml @@ -11,7 +11,7 @@ com.walmartlabs.x12 gozer gozer - 0.3.5-SNAPSHOT + 0.3.6-SNAPSHOT takari-jar diff --git a/src/main/java/com/walmartlabs/x12/common/segment/N1PartyIdentification.java b/src/main/java/com/walmartlabs/x12/common/segment/N1PartyIdentification.java index f55f4e9..55a8474 100644 --- a/src/main/java/com/walmartlabs/x12/common/segment/N1PartyIdentification.java +++ b/src/main/java/com/walmartlabs/x12/common/segment/N1PartyIdentification.java @@ -54,6 +54,11 @@ public class N1PartyIdentification { */ private List refList; + /* + * PER + */ + private List perList; + /** * helper method to add REF * @@ -66,6 +71,18 @@ public void addReferenceInformation(REFReferenceInformation ref) { refList.add(ref); } + /** + * helper method to add PER + * + * @param per + */ + public void addAdministrativeCommunication(PERAdministrativeCommunication per) { + if (CollectionUtils.isEmpty(perList)) { + perList = new ArrayList<>(); + } + perList.add(per); + } + /** * helper method to add N3 * @@ -134,4 +151,11 @@ public void setRefList(List refList) { this.refList = refList; } + public List getPerList() { + return perList; + } + + public void setPerList(List perList) { + this.perList = perList; + } } diff --git a/src/main/java/com/walmartlabs/x12/common/segment/PERAdministrativeCommunication.java b/src/main/java/com/walmartlabs/x12/common/segment/PERAdministrativeCommunication.java new file mode 100644 index 0000000..cdf84ac --- /dev/null +++ b/src/main/java/com/walmartlabs/x12/common/segment/PERAdministrativeCommunication.java @@ -0,0 +1,54 @@ +package com.walmartlabs.x12.common.segment; + +/** + * Purpose: To identify a person or office to whom administrative communications should be directed + */ +public class PERAdministrativeCommunication { + + public static final String IDENTIFIER = "PER"; + + // PER01, Code identifying the major duty or responsibility of the person or group named + private String contactFunctionCode; + + // PER02, Free-form name + private String freeFormName; + + // PER03/05/07, Code identifying the type of communication number + private String communicationNumberQualifier; + + // PER04/06/08, Complete communications number including country or area code when applicable + private String communicationNumber; + + + public String getContactFunctionCode() { + return contactFunctionCode; + } + + public void setContactFunctionCode(String contactFunctionCode) { + this.contactFunctionCode = contactFunctionCode; + } + + public String getFreeFormName() { + return freeFormName; + } + + public void setFreeFormName(String freeFormName) { + this.freeFormName = freeFormName; + } + + public String getCommunicationNumberQualifier() { + return communicationNumberQualifier; + } + + public void setCommunicationNumberQualifier(String communicationNumberQualifier) { + this.communicationNumberQualifier = communicationNumberQualifier; + } + + public String getCommunicationNumber() { + return communicationNumber; + } + + public void setCommunicationNumber(String communicationNumber) { + this.communicationNumber = communicationNumber; + } +} diff --git a/src/main/java/com/walmartlabs/x12/common/segment/parser/N1PartyIdentificationParser.java b/src/main/java/com/walmartlabs/x12/common/segment/parser/N1PartyIdentificationParser.java index ea3534c..96f509a 100644 --- a/src/main/java/com/walmartlabs/x12/common/segment/parser/N1PartyIdentificationParser.java +++ b/src/main/java/com/walmartlabs/x12/common/segment/parser/N1PartyIdentificationParser.java @@ -21,6 +21,7 @@ import com.walmartlabs.x12.common.segment.N1PartyIdentification; import com.walmartlabs.x12.common.segment.N3PartyLocation; import com.walmartlabs.x12.common.segment.N4GeographicLocation; +import com.walmartlabs.x12.common.segment.PERAdministrativeCommunication; import com.walmartlabs.x12.common.segment.REFReferenceInformation; public final class N1PartyIdentificationParser { @@ -68,6 +69,9 @@ public static N1PartyIdentification handleN1Loop(X12Segment segment, SegmentIter case REFReferenceInformation.IDENTIFIER: n1.addReferenceInformation(REFReferenceInformationParser.parse(nextSegment)); break; + case PERAdministrativeCommunication.IDENTIFIER: + n1.setPerList(PERAdministrativeCommunicationsParser.parse(nextSegment)); + break; default: // assume any other identifier is a break out of the N1 loop // and let the other parser deal with it diff --git a/src/main/java/com/walmartlabs/x12/common/segment/parser/PERAdministrativeCommunicationsParser.java b/src/main/java/com/walmartlabs/x12/common/segment/parser/PERAdministrativeCommunicationsParser.java new file mode 100644 index 0000000..4d95761 --- /dev/null +++ b/src/main/java/com/walmartlabs/x12/common/segment/parser/PERAdministrativeCommunicationsParser.java @@ -0,0 +1,45 @@ +package com.walmartlabs.x12.common.segment.parser; + +import com.walmartlabs.x12.X12Segment; +import com.walmartlabs.x12.common.segment.PERAdministrativeCommunication; + +import java.util.ArrayList; +import java.util.List; + +public final class PERAdministrativeCommunicationsParser { + + /** + * parse the segment + * + * @param segment + * @return + */ + public static List parse(X12Segment segment) { + List perList = new ArrayList<>(); + + if (segment != null) { + String segmentIdentifier = segment.getIdentifier(); + if (PERAdministrativeCommunication.IDENTIFIER.equals(segmentIdentifier)) { + int size = segment.segmentSize(); + if (size > 2) { + String functionCode = segment.getElement(1); + String freeFormName = segment.getElement(2); + for (int i = 4; i < size; i += 2) { + PERAdministrativeCommunication per = new PERAdministrativeCommunication(); + per.setContactFunctionCode(functionCode); + per.setFreeFormName(freeFormName); + per.setCommunicationNumberQualifier(segment.getElement(i - 1)); + per.setCommunicationNumber(segment.getElement(i)); + + perList.add(per); + } + } + } + } + return perList; + } + + private PERAdministrativeCommunicationsParser() { + // you can't make me + } +} \ No newline at end of file diff --git a/src/test/java/com/walmartlabs/x12/common/segment/parser/N1PartyIdentificationParserTest.java b/src/test/java/com/walmartlabs/x12/common/segment/parser/N1PartyIdentificationParserTest.java index 2ca8592..dedc94a 100644 --- a/src/test/java/com/walmartlabs/x12/common/segment/parser/N1PartyIdentificationParserTest.java +++ b/src/test/java/com/walmartlabs/x12/common/segment/parser/N1PartyIdentificationParserTest.java @@ -21,6 +21,7 @@ import com.walmartlabs.x12.common.segment.N1PartyIdentification; import com.walmartlabs.x12.common.segment.N3PartyLocation; import com.walmartlabs.x12.common.segment.N4GeographicLocation; +import com.walmartlabs.x12.common.segment.PERAdministrativeCommunication; import org.junit.Test; import java.util.ArrayList; @@ -104,6 +105,22 @@ public void test_parse_handleN1Loop_one_loop_ends() { assertEquals("85193", n4.getPostalCode()); assertEquals(null, n4.getCountryCode()); + List perList = n1.getPerList(); + assertNotNull(perList); + assertEquals(2, perList.size()); + + PERAdministrativeCommunication perAdministrativeCommunication = perList.get(0); + assertEquals("PY", perAdministrativeCommunication.getContactFunctionCode()); + assertEquals("FSMA CONTACT", perAdministrativeCommunication.getFreeFormName()); + assertEquals("TE", perAdministrativeCommunication.getCommunicationNumberQualifier()); + assertEquals("+18884636332", perAdministrativeCommunication.getCommunicationNumber()); + + perAdministrativeCommunication = perList.get(1); + assertEquals("PY", perAdministrativeCommunication.getContactFunctionCode()); + assertEquals("FSMA CONTACT", perAdministrativeCommunication.getFreeFormName()); + assertEquals("EA", perAdministrativeCommunication.getCommunicationNumberQualifier()); + assertEquals("FoodSafetyPlanBuilder@fda.hhs.gov", perAdministrativeCommunication.getCommunicationNumber()); + assertFalse(iterator.hasNext()); } @@ -233,6 +250,8 @@ private List getN1LoopOne() { segments.add(segment); segment = new X12Segment("N4*CASA GRANDE*AZ*85193"); segments.add(segment); + segment = new X12Segment("PER*PY*FSMA CONTACT*TE*+18884636332*EA*FoodSafetyPlanBuilder@fda.hhs.gov"); + segments.add(segment); return segments; } diff --git a/src/test/java/com/walmartlabs/x12/common/segment/parser/PERAdministrativeCommunicationsParserTest.java b/src/test/java/com/walmartlabs/x12/common/segment/parser/PERAdministrativeCommunicationsParserTest.java new file mode 100644 index 0000000..49e9ead --- /dev/null +++ b/src/test/java/com/walmartlabs/x12/common/segment/parser/PERAdministrativeCommunicationsParserTest.java @@ -0,0 +1,79 @@ +package com.walmartlabs.x12.common.segment.parser; + +import com.walmartlabs.x12.X12Segment; +import com.walmartlabs.x12.common.segment.PERAdministrativeCommunication; +import org.junit.Test; + +import java.util.List; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + + +public class PERAdministrativeCommunicationsParserTest { + + @Test + public void test_parse_null_segment() { + X12Segment segment = null; + List perList = PERAdministrativeCommunicationsParser.parse(segment); + assertNotNull(perList); + assertEquals(0, perList.size()); + } + + @Test + public void test_parse_empty_segment() { + X12Segment segment = new X12Segment(""); + List perList = PERAdministrativeCommunicationsParser.parse(segment); + assertNotNull(perList); + assertEquals(0, perList.size()); + } + + @Test + public void test_parse_segment() { + X12Segment segment = new X12Segment("PER*PY*FSMA CONTACT*TE*+18884636332*EA*FoodSafetyPlanBuilder@fda.hhs.gov"); + List perList = PERAdministrativeCommunicationsParser.parse(segment); + assertNotNull(perList); + assertEquals(2, perList.size()); + + PERAdministrativeCommunication perAdministrativeCommunication = perList.get(0); + assertEquals("PY", perAdministrativeCommunication.getContactFunctionCode()); + assertEquals("FSMA CONTACT", perAdministrativeCommunication.getFreeFormName()); + assertEquals("TE", perAdministrativeCommunication.getCommunicationNumberQualifier()); + assertEquals("+18884636332", perAdministrativeCommunication.getCommunicationNumber()); + + perAdministrativeCommunication = perList.get(1); + assertEquals("PY", perAdministrativeCommunication.getContactFunctionCode()); + assertEquals("FSMA CONTACT", perAdministrativeCommunication.getFreeFormName()); + assertEquals("EA", perAdministrativeCommunication.getCommunicationNumberQualifier()); + assertEquals("FoodSafetyPlanBuilder@fda.hhs.gov", perAdministrativeCommunication.getCommunicationNumber()); + } + + @Test + public void test_parse_segment_ur() { + X12Segment segment = new X12Segment("PER*PY*FSMA CONTACT*UR*localhost:8080"); + List perList = PERAdministrativeCommunicationsParser.parse(segment); + assertNotNull(perList); + assertEquals(1, perList.size()); + + PERAdministrativeCommunication perAdministrativeCommunication = perList.get(0); + assertEquals("PY", perAdministrativeCommunication.getContactFunctionCode()); + assertEquals("FSMA CONTACT", perAdministrativeCommunication.getFreeFormName()); + assertEquals("UR", perAdministrativeCommunication.getCommunicationNumberQualifier()); + assertEquals("localhost:8080", perAdministrativeCommunication.getCommunicationNumber()); + } + + @Test + public void test_parse_segment_not_balanced() { + X12Segment segment = new X12Segment("PER*PY*FSMA CONTACT*TE*+18884636332*EA"); + List perList = PERAdministrativeCommunicationsParser.parse(segment); + assertNotNull(perList); + assertEquals(1, perList.size()); + + PERAdministrativeCommunication perAdministrativeCommunication = perList.get(0); + assertEquals("PY", perAdministrativeCommunication.getContactFunctionCode()); + assertEquals("FSMA CONTACT", perAdministrativeCommunication.getFreeFormName()); + assertEquals("TE", perAdministrativeCommunication.getCommunicationNumberQualifier()); + assertEquals("+18884636332", perAdministrativeCommunication.getCommunicationNumber()); + } + +} \ No newline at end of file diff --git a/src/test/java/com/walmartlabs/x12/standard/txset/asn856/DefaultAsn856TransactionSetParserEntireTxSetTest.java b/src/test/java/com/walmartlabs/x12/standard/txset/asn856/DefaultAsn856TransactionSetParserEntireTxSetTest.java index 184b555..0cb24eb 100644 --- a/src/test/java/com/walmartlabs/x12/standard/txset/asn856/DefaultAsn856TransactionSetParserEntireTxSetTest.java +++ b/src/test/java/com/walmartlabs/x12/standard/txset/asn856/DefaultAsn856TransactionSetParserEntireTxSetTest.java @@ -23,6 +23,7 @@ import com.walmartlabs.x12.common.segment.N1PartyIdentification; import com.walmartlabs.x12.common.segment.N3PartyLocation; import com.walmartlabs.x12.common.segment.N4GeographicLocation; +import com.walmartlabs.x12.common.segment.PERAdministrativeCommunication; import com.walmartlabs.x12.common.segment.PIDProductIdentification; import com.walmartlabs.x12.common.segment.REFReferenceInformation; import com.walmartlabs.x12.common.segment.TD1CarrierDetail; @@ -208,6 +209,20 @@ private void verifyTheShipment(AsnTransactionSet asnTx) { assertNotNull(n4); assertEquals("BEAVERTON", n4.getCityName()); + List perList = n1Two.getPerList(); + assertEquals(2, perList.size()); + PERAdministrativeCommunication perAdministrativeCommunication = perList.get(0); + assertEquals("PY", perAdministrativeCommunication.getContactFunctionCode()); + assertEquals("FSMA CONTACT", perAdministrativeCommunication.getFreeFormName()); + assertEquals("TE", perAdministrativeCommunication.getCommunicationNumberQualifier()); + assertEquals("+18884636332", perAdministrativeCommunication.getCommunicationNumber()); + + perAdministrativeCommunication = perList.get(1); + assertEquals("PY", perAdministrativeCommunication.getContactFunctionCode()); + assertEquals("FSMA CONTACT", perAdministrativeCommunication.getFreeFormName()); + assertEquals("EA", perAdministrativeCommunication.getCommunicationNumberQualifier()); + assertEquals("FoodSafetyPlanBuilder@fda.hhs.gov", perAdministrativeCommunication.getCommunicationNumber()); + // has 2 Orders List shipmentChildLoops = shipment.getParsedChildrenLoops(); assertNotNull(shipmentChildLoops); @@ -219,7 +234,7 @@ private void verifyTheShipment(AsnTransactionSet asnTx) { // X12Loop instance List shipmentSegments = shipment.getSegments(); assertNotNull(shipmentSegments); - assertEquals(15, shipmentSegments.size()); + assertEquals(16, shipmentSegments.size()); assertEquals("TD1*PLT94*1****G*31302*LB", shipmentSegments.get(0).toString()); assertEquals("N4*BEAVERTON*OR*97006", shipmentSegments.get(14).toString()); } @@ -589,6 +604,7 @@ private List getTransactionSetSegments() { txSegments.add(new X12Segment("N1*SF*RESER'S FINE FOODS, INC.*UL*0090266420000")); txSegments.add(new X12Segment("N3*15570 S.W. JENKINS ROAD")); txSegments.add(new X12Segment("N4*BEAVERTON*OR*97006")); + txSegments.add(new X12Segment("PER*PY*FSMA CONTACT*TE*+18884636332*EA*FoodSafetyPlanBuilder@fda.hhs.gov")); // // order 1 diff --git a/src/test/java/sample/standard/asn/X12StandardParserWithAsnSampleTest.java b/src/test/java/sample/standard/asn/X12StandardParserWithAsnSampleTest.java index 6187d95..99680c7 100644 --- a/src/test/java/sample/standard/asn/X12StandardParserWithAsnSampleTest.java +++ b/src/test/java/sample/standard/asn/X12StandardParserWithAsnSampleTest.java @@ -19,6 +19,7 @@ import com.walmartlabs.x12.X12Document; import com.walmartlabs.x12.X12Segment; import com.walmartlabs.x12.X12TransactionSet; +import com.walmartlabs.x12.common.segment.N1PartyIdentification; import com.walmartlabs.x12.common.segment.REFReferenceInformation; import com.walmartlabs.x12.standard.InterchangeControlEnvelope; import com.walmartlabs.x12.standard.StandardX12Document; @@ -125,7 +126,7 @@ public void test_generic_parse_asn856() { assertEquals(null, shipment.getParentHierarchicalId()); List shipmentSegments = shipment.getSegments(); - assertEquals(14, shipmentSegments.size()); + assertEquals(15, shipmentSegments.size()); List refList = shipment.getRefList(); @@ -135,7 +136,11 @@ public void test_generic_parse_asn856() { REFReferenceInformation ref = refList.get(1); assertEquals("CN", ref.getReferenceIdentificationQualifier()); assertEquals("5787970539", ref.getReferenceIdentification()); - + + // n1 of shipment + List n1 = shipment.getN1PartyIdentifications(); + assertEquals(3, n1.size()); + // children of shipment List childLoops = shipment.getParsedChildrenLoops(); assertNotNull(childLoops); diff --git a/src/test/java/sample/standard/generic/X12StandardParserWithGenericSampleTest.java b/src/test/java/sample/standard/generic/X12StandardParserWithGenericSampleTest.java index c117735..4ef32da 100644 --- a/src/test/java/sample/standard/generic/X12StandardParserWithGenericSampleTest.java +++ b/src/test/java/sample/standard/generic/X12StandardParserWithGenericSampleTest.java @@ -191,7 +191,7 @@ public void test_generic_parse_asn856() { assertEquals(null, topLoop.getParentHierarchicalId()); List topLoopSegments = topLoop.getSegments(); - assertEquals(14, topLoopSegments.size()); + assertEquals(15, topLoopSegments.size()); X12Segment segment = topLoopSegments.get(3); assertEquals("REF", segment.getIdentifier()); assertEquals("CN", segment.getElement(1)); diff --git a/src/test/resources/asn856/asn856.txt b/src/test/resources/asn856/asn856.txt index f679ede..e1295ba 100644 --- a/src/test/resources/asn856/asn856.txt +++ b/src/test/resources/asn856/asn856.txt @@ -17,6 +17,7 @@ N4*ATLANTA*GA*31139-0020**SN*9999 N1*SF*1 EDI SOURCE N3*31875 SOLON ROAD N4*SOLON*OH*44139 +PER*PY*FSMA CONTACT*TE*+18884636332*EA*FoodSafetyPlanBuilder@fda.hhs.gov HL*2*1*O PRF*99999817***20111205 HL*3*2*I From ab3d88919e7a9c3b9bd579b943b2f6daff132aa4 Mon Sep 17 00:00:00 2001 From: x0l08og Date: Wed, 11 Dec 2024 16:29:05 -0500 Subject: [PATCH 3/5] comment --- .../DefaultAsn856TransactionSetParser.java | 4 +++ .../x12/standard/txset/asn856/loop/Item.java | 25 +++++++++++++++++++ ...56TransactionSetParserEntireTxSetTest.java | 24 ++++++++++++++++++ 3 files changed, 53 insertions(+) diff --git a/src/main/java/com/walmartlabs/x12/standard/txset/asn856/DefaultAsn856TransactionSetParser.java b/src/main/java/com/walmartlabs/x12/standard/txset/asn856/DefaultAsn856TransactionSetParser.java index f068299..b363778 100644 --- a/src/main/java/com/walmartlabs/x12/standard/txset/asn856/DefaultAsn856TransactionSetParser.java +++ b/src/main/java/com/walmartlabs/x12/standard/txset/asn856/DefaultAsn856TransactionSetParser.java @@ -561,6 +561,10 @@ private void doItemSegments(X12Segment segment, SegmentIterator segmentIterator, DTMDateTimeReference dtm = DTMDateTimeReferenceParser.parse(segment); item.addDTMDateTimeReference(dtm); break; + case N1PartyIdentification.IDENTIFIER: + N1PartyIdentification n1 = N1PartyIdentificationParser.handleN1Loop(segment, segmentIterator); + item.addN1PartyIdentification(n1); + break; default: item.addUnparsedSegment(segment); break; diff --git a/src/main/java/com/walmartlabs/x12/standard/txset/asn856/loop/Item.java b/src/main/java/com/walmartlabs/x12/standard/txset/asn856/loop/Item.java index 99afaf7..a835e5c 100644 --- a/src/main/java/com/walmartlabs/x12/standard/txset/asn856/loop/Item.java +++ b/src/main/java/com/walmartlabs/x12/standard/txset/asn856/loop/Item.java @@ -18,6 +18,7 @@ import com.walmartlabs.x12.common.segment.DTMDateTimeReference; import com.walmartlabs.x12.common.segment.LINItemIdentification; +import com.walmartlabs.x12.common.segment.N1PartyIdentification; import com.walmartlabs.x12.common.segment.PIDProductIdentification; import com.walmartlabs.x12.common.segment.REFReferenceInformation; import com.walmartlabs.x12.standard.X12Loop; @@ -56,6 +57,10 @@ public class Item extends X12ParsedLoop { * DTM: Date/Time Reference */ private List dtmReferences; + /* + * N1: Party Identifiers + */ + private List n1PartyIdentifications; /** * returns true if the loop passed in is a Item loop @@ -150,4 +155,24 @@ public List getRefList() { public void setRefList(List refList) { this.refList = refList; } + + /** + * helper method to add N1 to list + * @param n1 + */ + public void addN1PartyIdentification(N1PartyIdentification n1) { + if (CollectionUtils.isEmpty(n1PartyIdentifications)) { + n1PartyIdentifications = new ArrayList<>(); + } + n1PartyIdentifications.add(n1); + } + + + public List getN1PartyIdentifications() { + return n1PartyIdentifications; + } + + public void setN1PartyIdentifications(List n1PartyIdentifications) { + this.n1PartyIdentifications = n1PartyIdentifications; + } } diff --git a/src/test/java/com/walmartlabs/x12/standard/txset/asn856/DefaultAsn856TransactionSetParserEntireTxSetTest.java b/src/test/java/com/walmartlabs/x12/standard/txset/asn856/DefaultAsn856TransactionSetParserEntireTxSetTest.java index 0cb24eb..ca4c788 100644 --- a/src/test/java/com/walmartlabs/x12/standard/txset/asn856/DefaultAsn856TransactionSetParserEntireTxSetTest.java +++ b/src/test/java/com/walmartlabs/x12/standard/txset/asn856/DefaultAsn856TransactionSetParserEntireTxSetTest.java @@ -572,6 +572,28 @@ private void verifyTheSecondOrder(Shipment shipment) { assertNotNull(lin); assertEquals("UP", lin.getProductIdQualifier()); assertEquals("039364133147", lin.getProductId()); + + List n1 = item.getN1PartyIdentifications(); + assertEquals(1, n1.size()); + + // + // shipping from + // + N1PartyIdentification n1One = item.getN1PartyIdentifications().get(0); + assertNotNull(n1One); + assertEquals("SF", n1One.getEntityIdentifierCode()); + assertEquals("RESER'S FINE FOODS, INC.", n1One.getName()); + assertEquals("UL", n1One.getIdentificationCodeQualifier()); + assertEquals("0090266420001", n1One.getIdentificationCode()); + + List perList = n1One.getPerList(); + assertEquals(1, perList.size()); + PERAdministrativeCommunication perAdministrativeCommunication = perList.get(0); + assertEquals("PY", perAdministrativeCommunication.getContactFunctionCode()); + assertEquals("FSMA CONTACT", perAdministrativeCommunication.getFreeFormName()); + assertEquals("UR", perAdministrativeCommunication.getCommunicationNumberQualifier()); + assertEquals("some-website", perAdministrativeCommunication.getCommunicationNumber()); + } private List getTransactionSetSegments() { @@ -666,6 +688,8 @@ private List getTransactionSetSegments() { txSegments.add(new X12Segment("HL*12*11*I")); txSegments.add(new X12Segment("LIN**UP*039364133147")); txSegments.add(new X12Segment("SN1**2*EA")); + txSegments.add(new X12Segment("N1*SF*RESER'S FINE FOODS, INC.*UL*0090266420001")); + txSegments.add(new X12Segment("PER*PY*FSMA CONTACT*UR*some-website")); txSegments.add(new X12Segment("SE*296*368090001")); From b0ba052c332fd22e7930730692c6afd984614e54 Mon Sep 17 00:00:00 2001 From: x0l08og Date: Mon, 16 Dec 2024 10:37:52 -0500 Subject: [PATCH 4/5] comment --- .../DefaultAsn856TransactionSetParserEntireTxSetTest.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/test/java/com/walmartlabs/x12/standard/txset/asn856/DefaultAsn856TransactionSetParserEntireTxSetTest.java b/src/test/java/com/walmartlabs/x12/standard/txset/asn856/DefaultAsn856TransactionSetParserEntireTxSetTest.java index ca4c788..899fc98 100644 --- a/src/test/java/com/walmartlabs/x12/standard/txset/asn856/DefaultAsn856TransactionSetParserEntireTxSetTest.java +++ b/src/test/java/com/walmartlabs/x12/standard/txset/asn856/DefaultAsn856TransactionSetParserEntireTxSetTest.java @@ -581,7 +581,7 @@ private void verifyTheSecondOrder(Shipment shipment) { // N1PartyIdentification n1One = item.getN1PartyIdentifications().get(0); assertNotNull(n1One); - assertEquals("SF", n1One.getEntityIdentifierCode()); + assertEquals("MP", n1One.getEntityIdentifierCode()); assertEquals("RESER'S FINE FOODS, INC.", n1One.getName()); assertEquals("UL", n1One.getIdentificationCodeQualifier()); assertEquals("0090266420001", n1One.getIdentificationCode()); @@ -688,7 +688,7 @@ private List getTransactionSetSegments() { txSegments.add(new X12Segment("HL*12*11*I")); txSegments.add(new X12Segment("LIN**UP*039364133147")); txSegments.add(new X12Segment("SN1**2*EA")); - txSegments.add(new X12Segment("N1*SF*RESER'S FINE FOODS, INC.*UL*0090266420001")); + txSegments.add(new X12Segment("N1*MP*RESER'S FINE FOODS, INC.*UL*0090266420001")); txSegments.add(new X12Segment("PER*PY*FSMA CONTACT*UR*some-website")); txSegments.add(new X12Segment("SE*296*368090001")); From 67a4cab4ae665994dbdf77a2d69c93d73965016d Mon Sep 17 00:00:00 2001 From: x0l08og Date: Mon, 16 Dec 2024 11:06:18 -0500 Subject: [PATCH 5/5] more test --- ...56TransactionSetParserEntireTxSetTest.java | 26 ++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/src/test/java/com/walmartlabs/x12/standard/txset/asn856/DefaultAsn856TransactionSetParserEntireTxSetTest.java b/src/test/java/com/walmartlabs/x12/standard/txset/asn856/DefaultAsn856TransactionSetParserEntireTxSetTest.java index 899fc98..5c21a11 100644 --- a/src/test/java/com/walmartlabs/x12/standard/txset/asn856/DefaultAsn856TransactionSetParserEntireTxSetTest.java +++ b/src/test/java/com/walmartlabs/x12/standard/txset/asn856/DefaultAsn856TransactionSetParserEntireTxSetTest.java @@ -574,10 +574,10 @@ private void verifyTheSecondOrder(Shipment shipment) { assertEquals("039364133147", lin.getProductId()); List n1 = item.getN1PartyIdentifications(); - assertEquals(1, n1.size()); + assertEquals(2, n1.size()); // - // shipping from + // Manufacturing Plant // N1PartyIdentification n1One = item.getN1PartyIdentifications().get(0); assertNotNull(n1One); @@ -594,6 +594,24 @@ private void verifyTheSecondOrder(Shipment shipment) { assertEquals("UR", perAdministrativeCommunication.getCommunicationNumberQualifier()); assertEquals("some-website", perAdministrativeCommunication.getCommunicationNumber()); + // + // Field + // + N1PartyIdentification n1Two = item.getN1PartyIdentifications().get(1); + assertNotNull(n1Two); + assertEquals("ZW", n1Two.getEntityIdentifierCode()); + assertEquals("2901 LETTUCE FIELD SW", n1Two.getName()); + + List n3List = n1Two.getN3List(); + assertNotNull(n3List); + assertEquals(1, n3List.size()); + + N3PartyLocation n3 = n3List.get(0); + assertNotNull(n3); + assertEquals("208 APPLE ST", n3.getAddressInfoOne()); + N4GeographicLocation n4 = n1Two.getN4(); + assertNotNull(n4); + assertEquals("COOLTOWN", n4.getCityName()); } private List getTransactionSetSegments() { @@ -690,7 +708,9 @@ private List getTransactionSetSegments() { txSegments.add(new X12Segment("SN1**2*EA")); txSegments.add(new X12Segment("N1*MP*RESER'S FINE FOODS, INC.*UL*0090266420001")); txSegments.add(new X12Segment("PER*PY*FSMA CONTACT*UR*some-website")); - + txSegments.add(new X12Segment("N1*ZW*2901 LETTUCE FIELD SW")); + txSegments.add(new X12Segment("N3*208 APPLE ST")); + txSegments.add(new X12Segment("N4*COOLTOWN*CA*90839")); txSegments.add(new X12Segment("SE*296*368090001")); return txSegments;