Uploaded image for project: 'mod-orders'
  1. mod-orders
  2. MODORDERS-345

Fund distribution totals must add upto 100%

    XMLWordPrintable

Details

    • ACQ Sprint 85
    • 2
    • Thunderjet

    Description

      Overview
      Currently using the API we can specify Fund distributions that don't add up to the total.
      example:

      curl -X POST \
        https://folio-snapshot-okapi.aws.indexdata.com:443/orders/composite-orders \
        -d '{
          "approved": true,
          "manualPo": false,
          "notes": [],
          "orderType": "One-Time",
          "renewal": {
              "manualRenewal": false
          },
          "totalEstimatedPrice": 29.99,
          "totalItems": 1,
          "vendor": "d0fb5aa0-cdf1-11e8-a8d5-f2801f1b9fd1",
          "workflowStatus": "Open",
          "compositePoLines": [
              {
                  "checkinItems": false,
                  "acquisitionMethod": "Purchase At Vendor System",
                  "alerts": [],
                  "claims": [
                      {
                          "claimed": true,
                          "grace": 45
                      }
                  ],
                  "collection": false,
                  "contributors": [
                      {
                          "contributor": "GALE, CENGAGE LEARNING",
                          "contributorNameTypeId": "2b94c631-fca9-4892-a730-03ee529ffe2a"
                      }
                  ],
                  "cost": {
                      "listUnitPriceElectronic": 29.99,
                      "currency": "USD",
                      "discountType": "percentage",
                      "quantityElectronic": 1,
                      "poLineEstimatedPrice": 29.99
                  },
                  "details": {
                      "receivingNote": "Let Bob know",
                      "productIds": [
                          {
                              "productId": "9781410352224",
                              "productIdType": "8261054f-be78-422d-bd51-4ed9f33c3422"
                          }
                      ]
                  },
                  "eresource": {
                      "activated": false,
                      "activationDue": 3,
                      "createInventory": "Instance, Holding",
                      "trial": false,
                      "expectedActivation": "2019-12-06T15:24:31.870+0000",
                      "materialType": "1a54b431-2e4f-452d-9cae-9cee66c9a892"
                  },
                  "fundDistribution": [
                      {
                          "code": "GIFTS-OT",
                          "fundId": "d6f7c1ba-a237-465e-94ed-f37e91bc64bd",
                          "distributionType": "percentage",
                          "value": 100
                      },
                      {
                          "code": "AFRICAHIST",
                          "fundId": "7fbd5d84-62d1-44c6-9c45-6cb173998bbd",
                          "distributionType": "percentage",
                          "value": 100
                      }
                  ],
                  "locations": [
                      {
                          "locationId": "758258bc-ecc1-41b8-abca-f7b610822ffd",
                          "quantity": 1,
                          "quantityElectronic": 1
                      }
                  ],
                  "orderFormat": "Electronic Resource",
                  "paymentStatus": "Awaiting Payment",
                  "publisher": "GALE, CENGAGE LEARNING",
                  "receiptStatus": "Receipt Not Required",
                  "reportingCodes": [],
                  "requester": "Bob Barker",
                  "rush": false,
                  "source": "API",
                  "title": "STUDY GUIDE FOR PHILIP K. DICK'\''S \"MARTIAN TIME-SLIP\";.",
                  "vendorDetail": {
                      "instructions": "N/A",
                      "noteFromVendor": "EBS3U",
                      "refNumber": "99974828472",
                      "refNumberType": "Supplier'\''s unique order line reference number",
                      "vendorAccount": "891025"
                  }
              }
          ],
          "acqUnitIds": []
      }'
      

      2. verify the transactions created for the order:

      curl -X GET \
        'https://folio-snapshot-okapi.aws.indexdata.com:443/finance/transactions?query=encumbrance.sourcePurchaseOrderId=5578b229-19ee-4b74-84dc-aac084725fa0' \
      

      RESPONSE:

      {
        "transactions": [
          {
            "id": "ff35954d-e26e-4d57-b987-7f4adb49b2d9",
            "amount": 29.99,
            "currency": "USD",
            "encumbrance": {
              "amountAwaitingPayment": 0.0,
              "amountExpended": 0.0,
              "initialAmountEncumbered": 29.99,
              "status": "Unreleased",
              "orderType": "One-Time",
              "subscription": false,
              "reEncumber": false,
              "sourcePurchaseOrderId": "5578b229-19ee-4b74-84dc-aac084725fa0",
              "sourcePoLineId": "dee5bfce-aaa0-437d-a93c-597a659e6159"
            },
            "fiscalYearId": "684b5dc5-92f6-4db7-b996-b549d88f5e4e",
            "fromFundId": "d6f7c1ba-a237-465e-94ed-f37e91bc64bd",
            "source": "User",
            "transactionType": "Encumbrance",
            "metadata": {
              "createdDate": "2019-12-03T18:47:23.850+0000",
              "createdByUserId": "3521a2a7-5b67-5844-8e36-34483d5ba9f2",
              "updatedDate": "2019-12-03T18:47:23.850+0000",
              "updatedByUserId": "3521a2a7-5b67-5844-8e36-34483d5ba9f2"
            }
          },
          {
            "id": "faff4dd9-5c83-4cc3-9b2e-8e57dce44fc2",
            "amount": 29.99,
            "currency": "USD",
            "encumbrance": {
              "amountAwaitingPayment": 0.0,
              "amountExpended": 0.0,
              "initialAmountEncumbered": 29.99,
              "status": "Unreleased",
              "orderType": "One-Time",
              "subscription": false,
              "reEncumber": false,
              "sourcePurchaseOrderId": "5578b229-19ee-4b74-84dc-aac084725fa0",
              "sourcePoLineId": "dee5bfce-aaa0-437d-a93c-597a659e6159"
            },
            "fiscalYearId": "684b5dc5-92f6-4db7-b996-b549d88f5e4e",
            "fromFundId": "7fbd5d84-62d1-44c6-9c45-6cb173998bbd",
            "source": "User",
            "transactionType": "Encumbrance",
            "metadata": {
              "createdDate": "2019-12-03T18:47:23.866+0000",
              "createdByUserId": "3521a2a7-5b67-5844-8e36-34483d5ba9f2",
              "updatedDate": "2019-12-03T18:47:23.866+0000",
              "updatedByUserId": "3521a2a7-5b67-5844-8e36-34483d5ba9f2"
            }
          }
        ],
        "totalRecords": 2
      }
      

      Acceptance Criteria

      • Before opening an order, If Fund distributions are specified, they must add upto 100% of total
      • unit tests are updated
      • API tests are updated

      TestRail: Results

        Attachments

          Issue Links

            Activity

              People

                yauheni_kuzmianok Yauheni Kuzmianok
                KVupp Kruthi Vuppala
                Craig McNally Craig McNally
                Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved:

                  TestRail: Runs

                    TestRail: Cases