Hankintailmoitukset / hilma-api

11 stars 0 forks source link

Custom validation - ValidateBT161NoticeResult #189

Closed eduardsmirnov closed 10 months ago

eduardsmirnov commented 10 months ago

We got a validation message for a notice of subtype 36 which was not caught by our internal validator. “Validation error\nBT-161-NoticeResult total amount is required when any lot has a winner."

Looking at the code of your validator https://github.com/Hankintailmoitukset/hilma-api/blob/master/validation/ENoticeValidator.cs it seems like you run validation for all award notices without any check if the field BT-161 exists on a notice or not.

Please fix me if I am wrong.

image

jadefrantila commented 10 months ago

Hi!

I believe the check whether BT-161 exists or has value greater than zero is done in line 515 https://github.com/Hankintailmoitukset/hilma-api/blob/master/validation/ENoticeValidator.cs#L515.

Please let me know if this was not the case you were referring to.

eduardsmirnov commented 10 months ago

// value is nullable int? // when value is null, would you step in or not? // null > 0 is false if (!(value > 0)) { // }

jadefrantila commented 10 months ago

When TotalAmount's Value is null, the if statement returns true and you step in. Does this answer your question?

eduardsmirnov commented 10 months ago

@arinurkkala When TotalAmount's Value is null, you step into the statement and return validation error about BT-161. BUT by TED SDK 1.7, BT-161 is forbidden in subtype 36 and TotalAmount's Value is expected to be null.

arinurkkala commented 10 months ago

Yup, you are right @eduardsmirnov. I will create a ticket to get this fixed.

JuhaHakli commented 10 months ago

@eduardsmirnov Hello. The fix to bt-161 validation for notices of type eF36 and eF37 should now be available in the test environment.

Juhisee commented 10 months ago

closed as resolved