Energinet-DataHub / ARCHIVED-geh-charges

Apache License 2.0
7 stars 3 forks source link

Mandatory inputvalidation rules for BRS-031/032/033 #193

Open lasrinnil opened 3 years ago

lasrinnil commented 3 years ago

Description

The goal of this story is to produce events describing which rules failed during input validation. So we in the future can handle these events accordingly.

This story only focus on rules witch are applicable to all operations (Create / Update / Stop)

Test

All rule implementations must be covered by unit tests. All rejection events are expected to be tested on our T realm.

Rules

Rule number Rule description Notes
VR.223 All ChargeOperations must have a Id supplied
VR.404 Document type must be: RequestUpdateChargeInformation
VR.424 Document Business reason code must be: UpdateChargeInformation
VR.440 Charge Id must be filled
VR.441 Charge Id must not exceed 10 characters
VR.444 Operation type must not be Unknown Discussed during sprint planning, excluded from scope for now. We consider this covered by VR445. We will check if this rule is being used in current DataHub system to decide the rule's relevancy.
VR.445 Operation type must be 2 (add) / 3 (del) / 4 (change)
VR.448 Charge type must be set Discussed during sprint planning, excluded from scope for now. We consider this covered by VR449. We will check if this rule is being used in current DataHub system to decide the rule's relevancy.
VR.449 Charge type must be Subscription / Fee / Tariff
VR.531 StartDateTime must be supplied
VR.532 Charge Owner must be set

Acceptance criteria

Rule number Acceptance criteria
VR.223 If a ChargeOperation is missing an Id, a rejection event describing this must be found on the temporary post office service bus subscription.
VR.404 if Document type isn't RequestUpdateChargeInformation a rejection event describing this must be found on the temporary post office service bus subscription.
VR.424 if the Document's Business reason code isn't UpdateChargeInformation a rejection event describing this must be found on the temporary post office service bus subscription.
VR.440 if Charge Id is missing, a rejection event describing this must be found on the temporary post office service bus subscription.
VR.441 if Charge Id is over 10 characters a rejection event describing this must be found on the temporary post office service bus subscription.
VR.444 if Operation type is Unknown. a rejection event describing this must be found on the temporary post office service bus subscription.
VR.445 if Operation type differs from: 2 (add) / 3 (del) / 4 (change). a rejection event describing this must be found on the temporary post office service bus subscription.
VR.448 if Charge type is missing. a rejection event describing this must be found on the temporary post office service bus subscription.
VR.449 if Charge type isn't Subscription / Fee / Tariff. a rejection event describing this must be found on the temporary post office service bus subscription.
VR.531 if StartDateTime isn't supplied. a rejection event describing this must be found on the temporary post office service bus subscription.
VR.532 if Charge Owner isn't set. a rejection event describing this must be found on the temporary post office service bus subscription.
lasrinnil commented 3 years ago

Implementation

Test

lasrinnil commented 3 years ago

I have tested all AC's on S/U. In postman under my folder there are calls witch corresponds witch the AC's of this issue. Please feel free to use them to test with :)

image

Mech0z commented 3 years ago

VR445 is not working, if using 1 or 5 as OperationType then no error is detected

Mech0z commented 3 years ago

VR449 is same problem, but with anything other than 0 as ChargeType it parses