642: Authorize a requisition

Test Case #:642

 

Test Case Name: Authorize a requisition

System: OpenLMIS

Subsystem: requisition

Test case designed by: Lucyna Kwidzinska

Design Date:04.08.2016

Short description

Possibility to authorize a requisition created at facility (before sending it on for approval at a higher level), So that I can delegate responsibility for creating the requisition while still having a final review before the requisition is submitted.


Verify that:

  • user (which user is determined by the supervisory node up) can view the submitted requisition
  • mechanism to 'approve' the submitted requsition
  • requisition status changes to 'authorized'
  • if approved, authorization is sent for approval
  • Behavior functions as in current OpenLMIS 2.0 system, where after a requisition is saved, it moves to "need authorization" state.

                                                                                                                                                   

Pre – conditions:

                                                                                                                                                                                                                                                       

 

 

Step

Action

Expected system response

Comment

1

   Create FacilityType.   

URL: http://localhost:8080/api/facilityTypes/?access_token=f760ccf3-aff0-429c-b6d9-033f975e31b1

Method: POST

Example body:

{

"code": "typecode01",

"name": "namecode01",

"displayOrder": "12"

}

                                                 

2

Create geographicLevel.

Method: POST,

URL: http://localhost:8080/api/geographicLevels/?access_token=f760ccf3-aff0-429c-b6d9-033f975e31b1

Example body:

{

"code": "levelcode01",

"name": "levelname01",

"levelNumber": "32"

}

 

3

 Create geographicZone.

Method: POST

URL: http://localhost:8080/api/geographicZones/?access_token=f760ccf3-aff0-429c-b6d9-033f975e31b1

Example body:

{

"code": "zonecode01",

"name": "zonename01",

"level": "http://localhost:8080/api/geographicLevels/a2476611-aebf-4380-8da5-7abbeb61e506"

}

 

4

 Create Facility.

Method: POST

URL: http://localhost:8080/api/facilities/?access_token=f760ccf3-aff0-429c-b6d9-033f975e31b1

 

Example body:

{

"code": "facilitycode01",

"name": "facilityname01",

"geographicZone": "http://localhost:8080/api/geographicZones/997164ca-276f-4acf-aace-7704b9f5c3c0",

"type":"http://localhost:8080/api/facilityTypes/dd54504e-cd0d-41b3-b16b-cf8a94793973",

"enabled": "true",

"active": "true"

}

 

5

 Create Program.

Method: POST

URL: http://localhost:8080/api/programs/?access_token=f760ccf3-aff0-429c-b6d9-033f975e31b1

Example body:

{

"code": "programcode01",

"name": "programname01",

"periodsSkippable": "true"

}

 

6

 Create Schedule.

Method: POST

URL: http://localhost:8080/api/schedules/?access_token=f760ccf3-aff0-429c-b6d9-033f975e31b1

Example body:

{

"code": "schedulecode01",

"name": "schedulename01"

}

status: 201 created is returned,

id: "http://localhost:8080/api/schedules/97c91bd4-8021-4c17-92fe-a9eb183a4900"

 

 

7

 Create Period.

Method: POST

URL: http://localhost:8080/api/periods/?access_token=f760ccf3-aff0-429c-b6d9-033f975e31b1

Example body:

{

"processingSchedule": {

"id": "97c91bd4-8021-4c17-92fe-a9eb183a4900",

"code": "schedulecode01",

"name": "schedulename01"

},

"name": "periodname01",

"startDate": "2016-08-05",

"endDate": "2016-08-08"

}

 

8

   Create ProductCategory.  

Method: POST,

URL: http://localhost:8080/api/productCategories/?access_token=f760ccf3-aff0-429c-b6d9-033f975e31b1

Example body:

{

"code": "codecategory01",

"name": "namecategory01",

"displayOrder": "7"

}

 

9

Create Product.

Method: POST,

URL:

http://localhost:8080/api/products/?access_token=f760ccf3-aff0-429c-b6d9-033f975e31b1

Example body:

{

"code": "productcode1",

"primaryName": "name1",

"dispensingUnit": "unit1",

"dosesPerDispensingUnit": "1",

"packSize": "1",

"packRoundingThreshold": "1",

"roundToZero": "true",

"active": "true",

"fullSupply": "true",

"tracer": "true",

"productCategory":"http://localhost:8080/api/productCategories/613ae329-49df-4740-a246-b432c43c0374"

}

 
10

Create Requisition with SUBMITTED status.

Method: POST,

URL:

http://localhost:8080/api/requisitions/?access_token=f760ccf3-aff0-429c-b6d9-033f975e31b1

Example body:

{

"facility": "http://localhost:8080/api/facilities/3952bb2f-b4b9-4695-9902-3e27c8bd7c0c",

"program": "http://localhost:8080/api/programs/3610f565-fc4e-4b6a-a4ed-17845fbd19da",

"processingPeriod": "http://localhost:8080/api/periods/539a0d88-19ae-4831-b552-61923034d5a4",

"status": "SUBMITTED"

}

 

11

Verify the possibility of AUTHORIZE the previously created requisition.

Endpoint: /requisitions/{id}/authorize/?access_token=token

METHOD: PUT

Example URL:

http://localhost:8080/api/requisitions/f716cc84-99b0-4e2a-be01-2e2011f53def/authorize/?access_token=f760ccf3-aff0-429c-b6d9-033f975e31b1

Example body:

{

"id": "f716cc84-99b0-4e2a-be01-2e2011f53def",

"createdDate": "2016-08-04T14:13:09.214",

"facility": {

"id": "3952bb2f-b4b9-4695-9902-3e27c8bd7c0c",

"code": "facilitycode01",

"name": "facilityname01",

"description": null,

"operator": null,

"goLiveDate": null,

"goDownDate": null,

"comment": null,

"openLmisAccessible": null,

 

"geographicZone": {

"id": "997164ca-276f-4acf-aace-7704b9f5c3c0",

"code": "zonecode01",

"name": "zonename01",

"cathmentPopulation": null,

"latitude": null,

"londitude": null,

"level":

{ "id": "a2476611-aebf-4380-8da5-7abbeb61e506", "code": "levelcode01", "name": "levelname01", "levelNumber": "32" }

 

},

"type":

{ "id": "dd54504e-cd0d-41b3-b16b-cf8a94793973", "code": "typecode01", "name": "namecode01", "displayOrder": "12", "description": null, "active": null }

 

,

"enabled": "true",

"active": "true"

},

"program":

{ "id": "3610f565-fc4e-4b6a-a4ed-17845fbd19da", "code": "programcode01", "name": "programname01", "periodsSkippable": "true", "description": null, "active": null, "showNonFullSupplyTab": null }

 

,

"processingPeriod":

{

"id": "539a0d88-19ae-4831-b552-61923034d5a4",

"processingSchedule":

{ "id": "97c91bd4-8021-4c17-92fe-a9eb183a4900", "code": "schedulecode01", "description": null, "modifiedDate": null, "name": "schedulename01" }

 

,

"name": "periodname01",

"description": null,

"startDate": "2016-08-05",

"endDate": "2016-08-08"

},

"status": "SUBMITTED",

"emergency": "true",

"remarks": "abc",

 

"requisitionLines": [{

"product": {

"id": "ad13d942-777d-4c02-825e-e8478bd1fb02",

"code": "productcode1",

"primaryName": "name1",

"dispensingUnit": "unit1",

"dosesPerDispensingUnit": "1",

"packSize": "1",

"packRoundingThreshold": "1",

"roundToZero": "true",

"active": "true",

"fullSupply": "true",

"tracer": "true",

"productCategory":

{ "id": "613ae329-49df-4740-a246-b432c43c0374", "code": "codecategory01", "name": "namecategory01", "displayOrder": "7" }

 

},

"requisition":

{ "id":"f716cc84-99b0-4e2a-be01-2e2011f53def" },

"stockInHand": "2",

"beginningBalance": "2",

"totalReceivedQuantity": "2",

"totalLossesAndAdjustments": "2",

"stockOnHand": "2",

"requestedQuantity": "2",

"totalConsumedQuantity": "2",

"requestedQuantityExplanation": "2"

}]

}

status: 200 OK is returned. The status of requisition should be changed to AUTHORIZED.

 

 
12

Verify the possibility of view the authorized requisition.

Method: GET

URL: http://localhost:8080/api/requisitions/idrequisition/?access_token=token

Example URL:

http://localhost:8080/api/requisitions/f716cc84-99b0-4e2a-be01-2e2011f53def/?access_token=f760ccf3-aff0-429c-b6d9-033f975e31b1

status: 200 OK is returned.

 

 

 

Post – conditions:

OpenLMIS: the global initiative for powerful LMIS software