-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Created ChedPPPhsiDecision finder along with tests * Fixed broken tests * updated check code * added in ChedPP integration tests * commented out test for the moment * added missing files * added chepp decision finder for HMI, along with tests * fixed up some test data * fixed missing file * changed to expression * fixed merge issue * merge conflict * reordered decisions codes * fixed failing tests * fixed merge issue * reorder the decision codes * PR feedback --------- Co-authored-by: Thomas Anderson <[email protected]>
- Loading branch information
Showing
35 changed files
with
1,194 additions
and
32 deletions.
There are no files selected for viewing
41 changes: 41 additions & 0 deletions
41
Btms.Backend.IntegrationTests/DecisionTests/ChedPP/ChedPpHmiTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
using FluentAssertions; | ||
using TestDataGenerator.Scenarios.SpecificFiles; | ||
using TestGenerator.IntegrationTesting.Backend; | ||
using TestGenerator.IntegrationTesting.Backend.Extensions; | ||
using Xunit; | ||
using Xunit.Abstractions; | ||
|
||
namespace Btms.Backend.IntegrationTests.DecisionTests.ChedPP; | ||
|
||
|
||
[Trait("Category", "Integration")] | ||
public class ChedPpHmiTests(ITestOutputHelper output) : MultipleScenarioGeneratorBaseTest(output) | ||
{ | ||
[Theory] | ||
[InlineData(typeof(ChedPpHmiDecisionTestsScenarioGenerator), "24GBD447SAPD7NTAR9", "C03")] | ||
|
||
[InlineData(typeof(ChedPpHmiDecisionTestsScenarioGenerator), "24GBD69TMXZ2TYCAR9", "N02")] | ||
[InlineData(typeof(ChedPpHmiDecisionTestsScenarioGenerator), "24GBD69TMXZ2TYCAR8", "H01")] | ||
[InlineData(typeof(ChedPpHmiDecisionTestsScenarioGenerator), "24GBD69TMXZ2TYCAR7", "H02")] | ||
public void DecisionShouldHaveCorrectDecisionCodeForSingleNotification(Type generatorType, string mrn, string decisionCode) | ||
{ | ||
base.TestOutputHelper.WriteLine("Generator : {0}, Decision Code : {1}", generatorType!.FullName, decisionCode); | ||
EnsureEnvironmentInitialised(generatorType); | ||
|
||
var movement = Client | ||
.GetMovementByMrn(mrn); | ||
|
||
var lastDecision = movement.Decisions.OrderByDescending(x => x.ServiceHeader?.ServiceCalled).First(); | ||
|
||
|
||
foreach (var item in lastDecision.Items!) | ||
{ | ||
foreach (var itemCheck in item.Checks!) | ||
{ | ||
itemCheck.DecisionCode.Should().Be(decisionCode); | ||
} | ||
} | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 11 additions & 18 deletions
29
Btms.Business/Services/Decisions/Finders/ChedPPDecisionFinder.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,24 @@ | ||
using Btms.Business.Extensions; | ||
using Btms.Model.Ipaffs; | ||
|
||
namespace Btms.Business.Services.Decisions.Finders; | ||
|
||
// ReSharper disable once InconsistentNaming | ||
public class ChedPpPhsiDecisionFinder : IDecisionFinder | ||
public class ChedPPDecisionFinder : IDecisionFinder | ||
{ | ||
public const string CheckCode = "H219"; | ||
public bool CanFindDecision(ImportNotification notification, string? checkCode) => | ||
notification.ImportNotificationType == ImportNotificationTypeEnum.Chedpp && checkCode == CheckCode; | ||
notification.ImportNotificationType == ImportNotificationTypeEnum.Chedpp && checkCode?.GetChedTypeFromCheckCode() == ImportNotificationTypeEnum.Chedpp; | ||
|
||
public DecisionFinderResult FindDecision(ImportNotification notification, string? checkCode) | ||
{ | ||
switch (notification.Status) | ||
return notification.Status switch | ||
{ | ||
case ImportNotificationStatusEnum.Draft: | ||
break; | ||
case ImportNotificationStatusEnum.Submitted: | ||
case ImportNotificationStatusEnum.InProgress: | ||
return new DecisionFinderResult(DecisionCode.H02, checkCode); | ||
case ImportNotificationStatusEnum.Validated: | ||
return new DecisionFinderResult(DecisionCode.C03, checkCode); | ||
case ImportNotificationStatusEnum.Rejected: | ||
return new DecisionFinderResult(DecisionCode.N02, checkCode); | ||
case ImportNotificationStatusEnum.PartiallyRejected: | ||
return new DecisionFinderResult(DecisionCode.H01, checkCode); | ||
} | ||
|
||
return new DecisionFinderResult(DecisionCode.E99, checkCode); | ||
ImportNotificationStatusEnum.Submitted or ImportNotificationStatusEnum.InProgress => | ||
new DecisionFinderResult(DecisionCode.H02, checkCode), | ||
ImportNotificationStatusEnum.Validated => new DecisionFinderResult(DecisionCode.C03, checkCode), | ||
ImportNotificationStatusEnum.Rejected => new DecisionFinderResult(DecisionCode.N02, checkCode), | ||
ImportNotificationStatusEnum.PartiallyRejected => new DecisionFinderResult(DecisionCode.H01, checkCode), | ||
_ => new DecisionFinderResult(DecisionCode.E99, checkCode) | ||
}; | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
...ecisionTests/ALVS/2024/12/01/24GBD447SAPD7NTAR9-96e1dbc0-76bb-4ba4-97bd-60712d07b190.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"serviceHeader":{"sourceSystem":"CDS","destinationSystem":"ALVS","correlationId":"1306651","serviceCallTimestamp":1733068760000},"header":{"entryReference":"24GBD447SAPD7NTAR9","entryVersionNumber":2,"previousVersionNumber":1,"declarationUCR":"4GB460344665000-SIJ2411010147","declarationPartNumber":null,"declarationType":"S","arrivalDateTime":null,"submitterTURN":"GB460344665000","declarantId":"GB460344665000","declarantName":"GB460344665000","dispatchCountryCode":"PE","goodsLocationCode":"LGPLGPLGP","masterUCR":"LGP1C7LL600100"},"items":[{"itemNumber":1,"customsProcedureCode":"4000000","taricCommodityCode":"0806101090","goodsDescription":"FRESH GRAPES","consigneeId":"GB263389184000","consigneeName":"GB263389184000","itemNetMass":17712,"itemSupplementaryUnits":0,"itemThirdQuantity":null,"itemOriginCountryCode":"PE","documents":[{"documentCode":"N002","documentReference":"GBCHD2024.5167633","documentStatus":"AG","documentControl":"P","documentQuantity":null},{"documentCode":"N851","documentReference":"GBCHD2024.5167633","documentStatus":"AG","documentControl":"P","documentQuantity":null}],"checks":[{"checkCode":"H218","departmentCode":"HMI"},{"checkCode":"H219","departmentCode":"PHSI"}]}]} |
63 changes: 63 additions & 0 deletions
63
...ecisionTests/ALVS/2024/12/05/24GBD69TMXZ2TYCA97-a56c8617-0720-46ce-bc97-12d3f38c3ffb.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
{ | ||
"serviceHeader": { | ||
"sourceSystem": "CDS", | ||
"destinationSystem": "ALVS", | ||
"correlationId": "1319088", | ||
"serviceCallTimestamp": 1733395701000 | ||
}, | ||
"header": { | ||
"entryReference": "24GBD69TMXZ2TYCAR9", | ||
"entryVersionNumber": 3, | ||
"previousVersionNumber": 2, | ||
"declarationUCR": "4GB361840501000-0160-25", | ||
"declarationPartNumber": null, | ||
"declarationType": "S", | ||
"arrivalDateTime": null, | ||
"submitterTURN": "GB378038429000", | ||
"declarantId": "GB378038429000", | ||
"declarantName": "GB378038429000", | ||
"dispatchCountryCode": "MA", | ||
"goodsLocationCode": "DEUDEUDEU", | ||
"masterUCR": null | ||
}, | ||
"items": [ | ||
{ | ||
"itemNumber": 1, | ||
"customsProcedureCode": "4000000", | ||
"taricCommodityCode": "0810100000", | ||
"goodsDescription": "STRAWBERRIES", | ||
"consigneeId": "GB651900746000", | ||
"consigneeName": "GB651900746000", | ||
"itemNetMass": 771.8, | ||
"itemSupplementaryUnits": 0, | ||
"itemThirdQuantity": null, | ||
"itemOriginCountryCode": "MA", | ||
"documents": [ | ||
{ | ||
"documentCode": "N002", | ||
"documentReference": "GBCHD2024.5202739", | ||
"documentStatus": "AE", | ||
"documentControl": "P", | ||
"documentQuantity": null | ||
}, | ||
{ | ||
"documentCode": "N851", | ||
"documentReference": "GBCHD2024.5202739", | ||
"documentStatus": "AE", | ||
"documentControl": "P", | ||
"documentQuantity": null | ||
} | ||
], | ||
"checks": [ | ||
{ | ||
"checkCode": "H218", | ||
"departmentCode": "HMI" | ||
}, | ||
{ | ||
"checkCode": "H219", | ||
"departmentCode": "PHSI" | ||
} | ||
] | ||
} | ||
] | ||
} |
1 change: 1 addition & 0 deletions
1
...ecisionTests/ALVS/2024/12/05/24GBD69TMXZ2TYCAR7-0a9acaa6-c5ed-495d-b9a2-64b10ea214aa.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"serviceHeader":{"sourceSystem":"CDS","destinationSystem":"ALVS","correlationId":"1319121","serviceCallTimestamp":1733396353000},"header":{"entryReference":"24GBD69TMXZ2TYCAR7","entryVersionNumber":4,"previousVersionNumber":3,"declarationUCR":"4GB361840501000-0160-25","declarationPartNumber":null,"declarationType":"S","arrivalDateTime":null,"submitterTURN":"GB378038429000","declarantId":"GB378038429000","declarantName":"GB378038429000","dispatchCountryCode":"MA","goodsLocationCode":"DEUDEUDEU","masterUCR":null},"items":[{"itemNumber":1,"customsProcedureCode":"4000000","taricCommodityCode":"0810100000","goodsDescription":"STRAWBERRIES","consigneeId":"GB651900746000","consigneeName":"GB651900746000","itemNetMass":771.8,"itemSupplementaryUnits":0,"itemThirdQuantity":null,"itemOriginCountryCode":"MA","documents":[{"documentCode":"N002","documentReference":"GBCHD2024.5202737","documentStatus":"AE","documentControl":"P","documentQuantity":null},{"documentCode":"N851","documentReference":"GBCHD2024.5202737","documentStatus":"AE","documentControl":"P","documentQuantity":null}],"checks":[{"checkCode":"H218","departmentCode":"HMI"},{"checkCode":"H219","departmentCode":"PHSI"}]}]} |
1 change: 1 addition & 0 deletions
1
...ecisionTests/ALVS/2024/12/05/24GBD69TMXZ2TYCAR7-a56c8617-0720-46ce-bc97-12d3f38c3ffb.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"serviceHeader":{"sourceSystem":"CDS","destinationSystem":"ALVS","correlationId":"1319088","serviceCallTimestamp":1733395701000},"header":{"entryReference":"24GBD69TMXZ2TYCAR7","entryVersionNumber":3,"previousVersionNumber":2,"declarationUCR":"4GB361840501000-0160-25","declarationPartNumber":null,"declarationType":"S","arrivalDateTime":null,"submitterTURN":"GB378038429000","declarantId":"GB378038429000","declarantName":"GB378038429000","dispatchCountryCode":"MA","goodsLocationCode":"DEUDEUDEU","masterUCR":null},"items":[{"itemNumber":1,"customsProcedureCode":"4000000","taricCommodityCode":"0810100000","goodsDescription":"STRAWBERRIES","consigneeId":"GB651900746000","consigneeName":"GB651900746000","itemNetMass":771.8,"itemSupplementaryUnits":0,"itemThirdQuantity":null,"itemOriginCountryCode":"MA","documents":[{"documentCode":"N002","documentReference":"GBCHD2024.5202737","documentStatus":"AE","documentControl":"P","documentQuantity":null},{"documentCode":"N851","documentReference":"GBCHD2024.5202737","documentStatus":"AE","documentControl":"P","documentQuantity":null}],"checks":[{"checkCode":"H218","departmentCode":"HMI"},{"checkCode":"H219","departmentCode":"PHSI"}]}]} |
63 changes: 63 additions & 0 deletions
63
...ecisionTests/ALVS/2024/12/05/24GBD69TMXZ2TYCAR8-0a9acaa6-c5ed-495d-b9a2-64b10ea214aa.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
{ | ||
"serviceHeader": { | ||
"sourceSystem": "CDS", | ||
"destinationSystem": "ALVS", | ||
"correlationId": "1319121", | ||
"serviceCallTimestamp": 1733396353000 | ||
}, | ||
"header": { | ||
"entryReference": "24GBD69TMXZ2TYCAR8", | ||
"entryVersionNumber": 4, | ||
"previousVersionNumber": 3, | ||
"declarationUCR": "4GB361840501000-0160-25", | ||
"declarationPartNumber": null, | ||
"declarationType": "S", | ||
"arrivalDateTime": null, | ||
"submitterTURN": "GB378038429000", | ||
"declarantId": "GB378038429000", | ||
"declarantName": "GB378038429000", | ||
"dispatchCountryCode": "MA", | ||
"goodsLocationCode": "DEUDEUDEU", | ||
"masterUCR": null | ||
}, | ||
"items": [ | ||
{ | ||
"itemNumber": 1, | ||
"customsProcedureCode": "4000000", | ||
"taricCommodityCode": "0810100000", | ||
"goodsDescription": "STRAWBERRIES", | ||
"consigneeId": "GB651900746000", | ||
"consigneeName": "GB651900746000", | ||
"itemNetMass": 771.8, | ||
"itemSupplementaryUnits": 0, | ||
"itemThirdQuantity": null, | ||
"itemOriginCountryCode": "MA", | ||
"documents": [ | ||
{ | ||
"documentCode": "N002", | ||
"documentReference": "GBCHD2024.5202738", | ||
"documentStatus": "AE", | ||
"documentControl": "P", | ||
"documentQuantity": null | ||
}, | ||
{ | ||
"documentCode": "N851", | ||
"documentReference": "GBCHD2024.5202738", | ||
"documentStatus": "AE", | ||
"documentControl": "P", | ||
"documentQuantity": null | ||
} | ||
], | ||
"checks": [ | ||
{ | ||
"checkCode": "H218", | ||
"departmentCode": "HMI" | ||
}, | ||
{ | ||
"checkCode": "H219", | ||
"departmentCode": "PHSI" | ||
} | ||
] | ||
} | ||
] | ||
} |
63 changes: 63 additions & 0 deletions
63
...ecisionTests/ALVS/2024/12/05/24GBD69TMXZ2TYCAR8-a56c8617-0720-46ce-bc97-12d3f38c3ffb.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
{ | ||
"serviceHeader": { | ||
"sourceSystem": "CDS", | ||
"destinationSystem": "ALVS", | ||
"correlationId": "1319088", | ||
"serviceCallTimestamp": 1733395701000 | ||
}, | ||
"header": { | ||
"entryReference": "24GBD69TMXZ2TYCAR8", | ||
"entryVersionNumber": 3, | ||
"previousVersionNumber": 2, | ||
"declarationUCR": "4GB361840501000-0160-25", | ||
"declarationPartNumber": null, | ||
"declarationType": "S", | ||
"arrivalDateTime": null, | ||
"submitterTURN": "GB378038429000", | ||
"declarantId": "GB378038429000", | ||
"declarantName": "GB378038429000", | ||
"dispatchCountryCode": "MA", | ||
"goodsLocationCode": "DEUDEUDEU", | ||
"masterUCR": null | ||
}, | ||
"items": [ | ||
{ | ||
"itemNumber": 1, | ||
"customsProcedureCode": "4000000", | ||
"taricCommodityCode": "0810100000", | ||
"goodsDescription": "STRAWBERRIES", | ||
"consigneeId": "GB651900746000", | ||
"consigneeName": "GB651900746000", | ||
"itemNetMass": 771.8, | ||
"itemSupplementaryUnits": 0, | ||
"itemThirdQuantity": null, | ||
"itemOriginCountryCode": "MA", | ||
"documents": [ | ||
{ | ||
"documentCode": "N002", | ||
"documentReference": "GBCHD2024.5202738", | ||
"documentStatus": "AE", | ||
"documentControl": "P", | ||
"documentQuantity": null | ||
}, | ||
{ | ||
"documentCode": "N851", | ||
"documentReference": "GBCHD2024.5202738", | ||
"documentStatus": "AE", | ||
"documentControl": "P", | ||
"documentQuantity": null | ||
} | ||
], | ||
"checks": [ | ||
{ | ||
"checkCode": "H218", | ||
"departmentCode": "HMI" | ||
}, | ||
{ | ||
"checkCode": "H219", | ||
"departmentCode": "PHSI" | ||
} | ||
] | ||
} | ||
] | ||
} |
Oops, something went wrong.