Skip to content

Commit

Permalink
Skip FV2410 and return FV2404 instead (#188)
Browse files Browse the repository at this point in the history
* Skip FV2410 and return FV2404 instead

* Fix tests

* update edifact format versions for FV504

* update comment
  • Loading branch information
JoschaMetze authored Oct 11, 2024
1 parent aeb4441 commit b14c0af
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
17 changes: 16 additions & 1 deletion EDILibrary/EdifactFormatVersion.cs
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ public EdifactFormatVersion GetFormatVersion(DateTimeOffset keydate)
}
if (keydate >= KeyDate2410)
{
return EdifactFormatVersion.FV2410;
return EdifactFormatVersion.FV2404; // there was no format change FV2410, so we map this to FV2404
}
if (keydate >= KeyDate2404)
{
Expand Down Expand Up @@ -520,6 +520,8 @@ public EdifactFormatVersion GetFormatVersion(EdifactFormat format, string versio
},
EdifactFormat.UTILMDS => version switch
{
"S2.1" => EdifactFormatVersion.FV2504,
"S2.0" => EdifactFormatVersion.FV2504,
"S1.1a" => EdifactFormatVersion.FV2404,
"S1.1" => EdifactFormatVersion.FV2310,
_ => GetCurrent(),
Expand All @@ -534,26 +536,30 @@ public EdifactFormatVersion GetFormatVersion(EdifactFormat format, string versio
},
EdifactFormat.PARTIN => version switch
{
"1.0e" => EdifactFormatVersion.FV2504,
"1.0d" => EdifactFormatVersion.FV2404,
"1.0c" => EdifactFormatVersion.FV2310,
"1.0a" => EdifactFormatVersion.FV2210,
_ => GetCurrent(),
},
EdifactFormat.IFTSTA => version switch
{
"2.0f" => EdifactFormatVersion.FV2504,
"2.0e" => EdifactFormatVersion.FV2310,
"2.0d" => EdifactFormatVersion.FV2210,
"2.0c" => EdifactFormatVersion.FV2110,
_ => GetCurrent(),
},
EdifactFormat.APERAK => version switch
{
"2.1i" => EdifactFormatVersion.FV2504,
"2.1h" => EdifactFormatVersion.FV2210,
"2.1f" => EdifactFormatVersion.FV2110,
_ => GetCurrent(),
},
EdifactFormat.COMDIS => version switch
{
"1.0e" => EdifactFormatVersion.FV2504,
"1.0d" => EdifactFormatVersion.FV2404,
"1.0c" => EdifactFormatVersion.FV2310,
"1.0b" => EdifactFormatVersion.FV2210,
Expand All @@ -574,6 +580,7 @@ public EdifactFormatVersion GetFormatVersion(EdifactFormat format, string versio
},
EdifactFormat.INVOIC => version switch
{
"2.8d" => EdifactFormatVersion.FV2504,
"2.8c" => EdifactFormatVersion.FV2404,
"2.8b" => EdifactFormatVersion.FV2310,
"2.8a" => EdifactFormatVersion.FV2304,
Expand All @@ -589,6 +596,8 @@ public EdifactFormatVersion GetFormatVersion(EdifactFormat format, string versio
},
EdifactFormat.ORDERS => version switch
{
"1.4a" => EdifactFormatVersion.FV2504,
"1.4" => EdifactFormatVersion.FV2504,
"1.3" => EdifactFormatVersion.FV2310,
"1.2b" => EdifactFormatVersion.FV2304,
"1.2a" => EdifactFormatVersion.FV2210,
Expand All @@ -597,6 +606,7 @@ public EdifactFormatVersion GetFormatVersion(EdifactFormat format, string versio
},
EdifactFormat.ORDRSP => version switch
{
"1.4" => EdifactFormatVersion.FV2504,
"1.3" => EdifactFormatVersion.FV2310,
"1.2b" => EdifactFormatVersion.FV2304,
"1.2a" => EdifactFormatVersion.FV2210,
Expand All @@ -605,6 +615,7 @@ public EdifactFormatVersion GetFormatVersion(EdifactFormat format, string versio
},
EdifactFormat.PRICAT => version switch
{
"2.0d" => EdifactFormatVersion.FV2504,
"2.0c" => EdifactFormatVersion.FV2310,
"2.0b" => EdifactFormatVersion.FV2304,
"2.0a" => EdifactFormatVersion.FV2210,
Expand All @@ -613,6 +624,7 @@ public EdifactFormatVersion GetFormatVersion(EdifactFormat format, string versio
},
EdifactFormat.QUOTES => version switch
{
"1.3a" => EdifactFormatVersion.FV2504,
"1.3" => EdifactFormatVersion.FV2310,
"1.2" => EdifactFormatVersion.FV2210,
"1.1b" => EdifactFormatVersion.FV2110,
Expand All @@ -629,13 +641,16 @@ public EdifactFormatVersion GetFormatVersion(EdifactFormat format, string versio
},
EdifactFormat.REQOTE => version switch
{
"1.3a" => EdifactFormatVersion.FV2504,
"1.3" => EdifactFormatVersion.FV2310,
"1.2" => EdifactFormatVersion.FV2210,
"1.1d" => EdifactFormatVersion.FV2110,
_ => GetCurrent(),
},
EdifactFormat.UTILTS => version switch
{
"1.1e" => EdifactFormatVersion.FV2504,
"1.1d" => EdifactFormatVersion.FV2504,
"1.1c" => EdifactFormatVersion.FV2404,
"1.1b" => EdifactFormatVersion.FV2310,
"1.1a" => EdifactFormatVersion.FV2210,
Expand Down
4 changes: 2 additions & 2 deletions EDILibraryTests/EdifactFormatVersionTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,8 @@ public void TestMockingVersionProvider()
[DataRow("2023-09-30T22:00:00+00:00", EdifactFormatVersion.FV2310)]
[DataRow("2024-03-31T22:00:00+00:00", EdifactFormatVersion.FV2310)]
[DataRow("2024-04-02T22:00:00+00:00", EdifactFormatVersion.FV2404)]
[DataRow("2024-09-30T22:00:00+00:00", EdifactFormatVersion.FV2410)]
[DataRow("2025-03-31T22:00:00+00:00", EdifactFormatVersion.FV2410)]
[DataRow("2024-09-30T22:00:00+00:00", EdifactFormatVersion.FV2404)]
[DataRow("2025-03-31T22:00:00+00:00", EdifactFormatVersion.FV2404)]
[DataRow("2025-04-03T22:00:00+00:00", EdifactFormatVersion.FV2504)]
public void TestFormatVersionProvider(
string dateTimeOffset,
Expand Down

0 comments on commit b14c0af

Please sign in to comment.