Uploaded image for project: 'mod-feesfines'
  1. mod-feesfines
  2. MODFEE-82

Create check-refund endpoint

    XMLWordPrintable

Details

    • Story
    • Status: Closed (View Workflow)
    • TBD
    • Resolution: Done
    • None
    • 15.9.0
    • EPAM-Veg Sprint 95, EPAM-Veg Sprint 96
    • 2
    • Vega

    Description

      This story is part of the fees/fines refactoring feature. Design doc: https://wiki.folio.org/pages/viewpage.action?pageId=36576978

      Currently, calculations for fee/fine actions are happening on FE without any checks on the BE side.

      Instead, when a value is entered in the amount field, an additional call to the new "check" endpoint needs to be made prior to the action in order to check if this value is valid and if the action is allowed.

      New endpoint to be added to the mod-feesfines module:

      POST /accounts/{accountId}/check-refund
      

      Request body

      {
        "amount": "1.0"
      }
      

      Reponse

      • In case of success:
        Status code: 200
        Response body:
        {
          "accountId": "e74d50c9-0c69-4f80-9e1b-a819719fc0c9"
          "amount": "1.0",
          "allowed": true,
          "remainingAmount": "9.0"
        }
        
      • In case if the amount is too high:
        Status code: 422
        Response body:
        {
          "accountId": "e74d50c9-0c69-4f80-9e1b-a819719fc0c9"
          "amount": "1.0",
          "allowed": false,
          "errorMessage": "Refund amount exceeds the selected amount"
        }
        
      • In case of invalid amount value (e.g. negative or not parsable):
        Status code: 422
        Response body:
        {
          "accountId": "e74d50c9-0c69-4f80-9e1b-a819719fc0c9"
          "amount": "abcdefg",
          "allowed": false,
          "errorMessage": "Invalid amount entered"
        }
        

      TestRail: Results

        Attachments

          1. screenshot-1.png
            screenshot-1.png
            39 kB
          2. screenshot-2.png
            screenshot-2.png
            42 kB
          3. screenshot-3.png
            screenshot-3.png
            42 kB
          4. screenshot-4.png
            screenshot-4.png
            41 kB

          Issue Links

            Activity

              People

                roman-barannyk Roman Barannyk
                oleksandrkurash Alexander Kurash
                Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved:

                  TestRail: Runs

                    TestRail: Cases