Energinet-DataHub / ARCHIVED-geh-charges

Apache License 2.0
7 stars 3 forks source link

VR: Charge update and stop requests are rejected via new validation rule #937

Closed bemwen closed 2 years ago

bemwen commented 2 years ago

Synopsis Given that functionality for updating and stopping a charge is not available when we let external parties start testing, we've decided to implement a temporarily validation rule that rejects any update or stopping requests. This is considered the most 'clean' way of handling this to avoid giving external parties a false idea that their updates and stops were processed.

As it is not possible to tell whether a Charge CIM XML is a 'create' or 'update', we need to check if the charge exists in data storage in order to determine that.

Acceptance Criteria: AC 1 Update and stops are not supported, and will be handled by an added validation rule, with an error text reflecting this. AC 2: New validation rule to be added to general validation rule excel sheet AC 3: Overview of active validation rules to be added to github

Notes: Discussion notes from PI planning: Given a charge was created (with or without prices) When any prices are submitted afterwards This rule will reject it. (agreed, candidate for change after actor test start)

bemwen commented 2 years ago

AC1: Validation rule added, but without text so far, as we do not yet have that functionality. It will be added in #922 instead. AC2: Added to validation master as follows

image.png

AC3: Rule documentation added, https://github.com/Energinet-DataHub/geh-charges/blob/main/docs/business-processes/validations/change-of-charges-validations.md

prtandrup commented 2 years ago

Tested in U-002

:white_check_mark:

AC 1 Update and stops are not supported, 
and will be handled by an added validation rule, 
with an error text reflecting this.

Submitted a tariff update (existing tariff id: ChargeId03, owner: 8100000000023)

image.png

Temporarily stopped the ChargeRejectionDataAvailableNotifierEndpoint to be able to manually receive the command-rejection message:

{
  "PublishedTime": {
    "Seconds": 1639577570,
    "Nanos": 0
  },
  "Command": {
    "Document": {
      "Id": "DocId2021-12-15T14:12:20.940Z",
      "RequestDate": {
        "Seconds": 1639577558,
        "Nanos": 0
      },
      "Type": 2,
      "CreatedDateTime": {
        "Seconds": 1639577540,
        "Nanos": 0
      },
      "Sender": {
        "Id": "8100000000023",
        "BusinessProcessRole": 2
      },
      "Recipient": {
        "Id": "5790001330552",
        "BusinessProcessRole": 7
      },
      "IndustryClassification": 1,
      "BusinessReasonCode": 2
    },
    "ChargeOperation": {
      "Id": "OpId2021-12-15T14:12:20.940Z",
      "ChargeId": "ChargeId03",
      "Type": 3,
      "ChargeName": "Charge Tariff day Name",
      "ChargeDescription": "The charge description",
      "StartDateTime": {
        "Seconds": 1643670000,
        "Nanos": 0
      },
      "EndDateTime": {
        "Seconds": 253402300799,
        "Nanos": 0
      },
      "VatClassification": 1,
      "TransparentInvoicing": true,
      "TaxIndicator": false,
      "ChargeOwner": "8100000000023",
      "Resolution": 3,
      "Points": [
        {
          "Position": 1,
          "Price": 1.337,
          "Time": {
            "Seconds": 1643670000,
            "Nanos": 0
          }
        }
      ]
    }
  },
  "RejectReasons": [
    "UpdateNotYetSupported"
  ]
}

Note the
"RejectReasons": [ "UpdateNotYetSupported", which is caused by this new temporary validation rule.

AC 2: New validation rule to be added to general validation rule excel sheet :white_check_mark: verified. AC 3: Overview of active validation rules to be added to github :white_check_mark: verified, source.