[![Build Status](https://travis-ci.com/LabShare/request-tracking-api.svg?token=zsifsALL6Np5avzzjVp1&branch=master)](https://travis-ci.com/LabShare/request-tracking-api)
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)

# Request Tracking Api


The purpose of this projects is to manage apis for request tracking.


## Prerequisites
1. Node.js (v8.11.2) - https://nodejs.org/en/download/
2. `npm install -g lsc`
3. Makes sure your `config.json` has a billing object with a `key` of `facilityID` and a value of the enviorment you will work in such as `myrtb-ci`
    - The facilityID's can be `myrtb-ci`, `myrtb-qa`, and `myrtb`

Example config.json:
```
{
    "storage": {
      "proxy": "auto"
    },
  "session": {
  "facilityPath":"/"
  },
    "facility": {
      "ServiceUrl": "https://example.exam.nih.gov/v3",
  "facilityPath": "/",
      "spfacility": {
        "User": "aws\\ExampleUser",
        "Password": "Password12345",
        "Strategy": "hybrid",
        "CustomStrategyPrefix": "i:0ǵ.t",
        "Site": "https://myrtb-ci-default.aws.labshare.org",
        "CustomStrategyName": "labshare"
      },
      "FacilityDB": "@labshare/spfacility",
      "Facilities": {
        "Type": "file",
        "Settings": {
          "Path": "./facilities.json"
        }
      }
    },
    "shell": {
      "LoadServices": true,
      "Auth": {
        "Url": "https://a.labshare.org/_api"
      }
    },
    "billing": {
      "facilityID": "myrtb-ci"
    }
  }
```

## Running

To run the project, simply run the following command from the root of the repository:

```bash
$ lsc start services
```

## Billing Api

Every endpoint other than the `/billing` endpoint needs this request body.
```
{
	"chargeList": String,
	"section":[{
		"sectionName":String,
		"listNames": [String]
	}],
	"endDate": String,
	"status": String
}
```
Example:
```
{
	"chargeList": "RTB-Charges-FY18",
	"section":[{
	 "sectionName":"myrtb-ci-bis",
	 "listNames": ["Reservations","PosterPrinter"]
	},{
	 "sectionName":"myrtb-ci-fcs",
	 "listNames": ["charges","reservations","flowjo billing"]
	}],
	"endDate": "10/31/2019",
	"status": "readytobill"
}
```
*Note* if `section` is an empty array it will run though all billing sections and lists.