{
	"info": {
		"_postman_id": "7eeee3e4-f25a-4446-8074-9ee9c380df8d",
		"name": "HR Open Background Check Supplier",
		"description": "Parent collection to be _forked_ for HR Open Background Check Suppliers.",
		"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
		"_exporter_id": "41698182",
		"_collection_link": "https://jobvite.postman.co/workspace/JazzHR~274995f4-3bf8-4d46-9852-5205d905483b/collection/41698182-7eeee3e4-f25a-4446-8074-9ee9c380df8d?action=share&source=collection_link&creator=41698182"
	},
	"item": [
		{
			"name": "Verify",
			"event": [
				{
					"listen": "test",
					"script": {
						"exec": [
							""
						],
						"type": "text/javascript"
					}
				}
			],
			"request": {
				"method": "POST",
				"header": [],
				"url": {
					"raw": "{{jazzhr_base-uri}}{{jazzhr_verify-url}}",
					"host": [
						"{{jazzhr_base-uri}}{{jazzhr_verify-url}}"
					]
				},
				"description": "JazzHR will call this endpoint to verify the bearer token included in the Authorization header is valid within the Assessment Partner’s system."
			},
			"response": [
				{
					"name": "Verify",
					"originalRequest": {
						"method": "POST",
						"header": [],
						"url": {
							"raw": "{{jazzhr_base-uri}}{{jazzhr_verify-url}}",
							"host": [
								"{{jazzhr_base-uri}}{{jazzhr_verify-url}}"
							]
						}
					},
					"status": "No Content",
					"code": 204,
					"_postman_previewlanguage": "plain",
					"header": [
						{
							"key": "X-Powered-By",
							"value": "Express"
						},
						{
							"key": "Date",
							"value": "Fri, 17 Apr 2020 20:02:02 GMT"
						},
						{
							"key": "Connection",
							"value": "keep-alive"
						}
					],
					"cookie": [],
					"body": ""
				}
			]
		},
		{
			"name": "List Catalog",
			"event": [
				{
					"listen": "test",
					"script": {
						"exec": [
							"pm.test(\"Response includes a package catalog\", function () {",
							"    const packages = pm.response.json().packages;",
							"    ",
							"    pm.expect(packages).to.have.lengthOf.at.least(1);",
							"",
							"    for (let item of packages) {",
							"        pm.expect(item.packageName).to.be.a('string');",
							"        pm.expect(item.packageCode).to.be.a('string');",
							"        pm.expect(item.packagePrice).to.be.a('number');",
							"    }",
							"    ",
							"    pm.variables.set('testPackageCode', packages[0].packageCode);",
							"});",
							""
						],
						"type": "text/javascript"
					}
				}
			],
			"request": {
				"method": "GET",
				"header": [],
				"url": {
					"raw": "{{jazzhr_base-uri}}{{jazzhr_list-catalog-url}}",
					"host": [
						"{{jazzhr_base-uri}}{{jazzhr_list-catalog-url}}"
					]
				},
				"description": "JazzHR will call this endpoint to retrieve a list of packages available within the Partner’s assessment catalog."
			},
			"response": [
				{
					"name": "List Catalog",
					"originalRequest": {
						"method": "GET",
						"header": [],
						"url": {
							"raw": "{{jazzhr_base-uri}}{{jazzhr_list-catalog-url}}",
							"host": [
								"{{jazzhr_base-uri}}{{jazzhr_list-catalog-url}}"
							]
						}
					},
					"status": "OK",
					"code": 200,
					"_postman_previewlanguage": "json",
					"header": [
						{
							"key": "X-Powered-By",
							"value": "Express"
						},
						{
							"key": "Content-Type",
							"value": "application/json; charset=utf-8"
						},
						{
							"key": "Content-Length",
							"value": "878"
						},
						{
							"key": "ETag",
							"value": "W/\"36e-r4WyPImmPGTRaUExmA5G74fNOqE\""
						},
						{
							"key": "Date",
							"value": "Fri, 17 Apr 2020 20:02:21 GMT"
						},
						{
							"key": "Connection",
							"value": "keep-alive"
						}
					],
					"cookie": [],
					"body": "{\n    \"packages\": [\n        {\n            \"packageCode\": \"EXE-01\",\n            \"packageName\": \"Executive\",\n            \"packageCategory\": \"Custom\",\n            \"packageDescription\": \"Criminal package and includes credit check\",\n            \"packagePrice\": 150.25\n        },\n        {\n            \"packageCode\": \"AG-03\",\n            \"packageName\": \"Agent\",\n            \"packageCategory\": \"Custom\",\n            \"packageDescription\": \"Criminal package and includes license verification\",\n            \"packagePrice\": 125.99\n        },\n        {\n            \"packageCode\": \"DRI-AAA\",\n            \"packageName\": \"Driver\",\n            \"packageCategory\": \"Custom\",\n            \"packageDescription\": \"Criminal package and includes DOT Physical\",\n            \"packagePrice\": 100\n        },\n        {\n            \"packageCode\": \"CR-1\",\n            \"packageName\": \"Criminal Background\",\n            \"packageCategory\": \"Standard\",\n            \"packageDescription\": \"Package that includes federal and state criminal checks\",\n            \"packagePrice\": 75.89\n        },\n        {\n            \"packageCode\": \"FHIST-000\",\n            \"packageName\": \"Financial History\",\n            \"packageCategory\": \"Standard\",\n            \"packageDescription\": \"Package that includes credit and loan checks\",\n            \"packagePrice\": 95.99\n        }\n    ]\n}"
				}
			]
		},
		{
			"name": "Order Package",
			"event": [
				{
					"listen": "prerequest",
					"script": {
						"exec": [
							"const uuid = require('uuid');",
							"",
							"if (!pm.variables.has('testPackageCode')) {",
							"    pm.variables.set('testPackageCode', '1');",
							"}",
							"",
							"pm.variables.set('testOrderId', uuid.v4());",
							"pm.variables.set('testSubjectId', uuid.v4());",
							""
						],
						"type": "text/javascript"
					}
				},
				{
					"listen": "test",
					"script": {
						"exec": [
							"pm.test(\"Response includes a Location header\", function () {",
							"    pm.response.to.have.header(\"Location\");",
							"});",
							"",
							"pm.test(\"Response includes a valid status\", function () {",
							"    const status = pm.response.json().status;",
							"    ",
							"    pm.expect(status).to.not.be.empty;",
							"    pm.expect(status).to.be.a('string');",
							"    pm.expect(status).to.be.oneOf(['In Progress', 'Completed', 'Clear', 'Needs Attention', 'Cancelled', 'Pending Recruiter Confirmation', 'Sent to Candidate', 'Invite Expired']",
							");",
							"});",
							""
						],
						"type": "text/javascript"
					}
				}
			],
			"request": {
				"method": "POST",
				"header": [
					{
						"key": "Content-Type",
						"value": "application/json",
						"type": "text"
					}
				],
				"body": {
					"mode": "raw",
					"raw": "{\n  \"order\": {\n    \"documentId\": {\n      \"value\": \"{{jazzhr_testOrderId}}\"\n    },\n    \"packageCode\": \"{{jazzhr_testPackageCode}}\",\n    \"subjectId\": {\n      \"id\": {\n        \"value\": \"{{jazzhr_testSubjectId}}\"\n      }\n    }\n  },\n  \"subject\": {\n    \"documentId\": {\n      \"value\": \"{{jazzhr_testSubjectId}}\"\n    },\n    \"person\": {\n      \"names\": [\n        {\n          \"given\": \"Kenny\",\n          \"family\": \"JazzHR\",\n          \"formattedName\": \"Kenny JazzHR\"\n        }\n      ],\n      \"traits\": {\n        \"communication\": {\n          \"email\": [\n            {\n              \"address\": \"kenny.jazzhr@jazzhr.com\"\n            }\n          ]\n        }\n      }\n    }\n  }\n}"
				},
				"url": {
					"raw": "{{jazzhr_base-uri}}{{jazzhr_order-package-url}}",
					"host": [
						"{{jazzhr_base-uri}}{{jazzhr_order-package-url}}"
					]
				},
				"description": "JazzHR will send order requests to this endpoint for a particular candidate.\n\nThe `orderId` property included in the request body should be persisted within the Assessment Partner system and is used to retrieve results. This property is a standard 36 character UUID.\n\nThe `sendAssessmentResultsToURL` property included in the request body denotes the endpoint at which to notify JazzHR of order results upon assessment completion.\n\nThe response of this endpoint should include a URL to access the assessment. JazzHR will include this URL in an email to the candidate."
			},
			"response": [
				{
					"name": "Order Package",
					"originalRequest": {
						"method": "POST",
						"header": [
							{
								"key": "Content-Type",
								"value": "application/json",
								"name": "Content-Type",
								"type": "text"
							}
						],
						"body": {
							"mode": "raw",
							"raw": "{\n  \"order\": {\n    \"documentId\": {\n      \"value\": \"{{jazzhr_testOrderId}}\"\n    },\n    \"packageCode\": \"{{jazzhr_testPackageCode}}\",\n    \"subjectId\": {\n      \"id\": {\n        \"value\": \"{{jazzhr_testSubjectId}}\"\n      }\n    }\n  },\n  \"subject\": {\n    \"documentId\": {\n      \"value\": \"{{jazzhr_testSubjectId}}\"\n    },\n    \"person\": {\n      \"names\": [\n        {\n          \"given\": \"Kenny\",\n          \"family\": \"JazzHR\",\n          \"formattedName\": \"Kenny JazzHR\"\n        }\n      ],\n      \"traits\": {\n        \"communication\": {\n          \"email\": [\n            {\n              \"address\": \"kenny.jazzhr@jazzhr.com\"\n            }\n          ]\n        }\n      }\n    }\n  }\n}"
						},
						"url": {
							"raw": "{{jazzhr_base-uri}}{{jazzhr_order-package-url}}",
							"host": [
								"{{jazzhr_base-uri}}{{jazzhr_order-package-url}}"
							]
						}
					},
					"status": "Created",
					"code": 201,
					"_postman_previewlanguage": "json",
					"header": [
						{
							"key": "X-Powered-By",
							"value": "Express"
						},
						{
							"key": "Location",
							"value": "http://partnersystem.com/order/id-123-progress"
						},
						{
							"key": "Content-Type",
							"value": "application/json; charset=utf-8"
						},
						{
							"key": "Content-Length",
							"value": "43"
						},
						{
							"key": "ETag",
							"value": "W/\"2b-LRFeXEmsE2+RnrQTptEh06Sc7pU\""
						},
						{
							"key": "Date",
							"value": "Fri, 17 Apr 2020 20:02:51 GMT"
						},
						{
							"key": "Connection",
							"value": "keep-alive"
						}
					],
					"cookie": [],
					"body": "{\n    \"status\": \"Pending Recruiter Confirmation\"\n}"
				}
			]
		},
		{
			"name": "Retrieve Results",
			"event": [
				{
					"listen": "test",
					"script": {
						"exec": [
							"pm.test(\"Response includes a results url\", function () {",
							"    const resultsUrl = pm.response.json().resultsUrl.url;",
							"    ",
							"    pm.expect(resultsUrl).to.not.be.empty;",
							"    pm.expect(resultsUrl).to.be.a('string');",
							"});",
							"",
							"pm.test(\"Response includes a valid status\", function () {",
							"    const status = pm.response.json().status;",
							"    ",
							"    pm.expect(status).to.be.a('string');",
							"    pm.expect(status).to.be.oneOf(['In Progress', 'Completed', 'Clear', 'Needs Attention', 'Cancelled', 'Pending Recruiter Confirmation', 'Sent to Candidate', 'Invite Expired']",
							");",
							"});",
							"",
							"pm.test(\"Response includes a valid final price\", function () {",
							"    pm.expect(pm.response.json().finalPrice).to.satisfy(function(finalPrice) {",
							"        return (typeof finalPrice === 'number') || finalPrice === null;",
							"    });",
							"});"
						],
						"type": "text/javascript"
					}
				}
			],
			"request": {
				"method": "GET",
				"header": [],
				"url": {
					"raw": "{{jazzhr_base-uri}}{{jazzhr_retrieve-results-url}}?orderId={{jazzhr_testOrderId}}",
					"host": [
						"{{jazzhr_base-uri}}{{jazzhr_retrieve-results-url}}"
					],
					"query": [
						{
							"key": "orderId",
							"value": "{{jazzhr_testOrderId}}",
							"description": "`orderId` included in the order package request body"
						}
					]
				},
				"description": "JazzHR will call this endpoint to retrieve the results associated with the specified `orderId` query parameter."
			},
			"response": [
				{
					"name": "Retrieve Results",
					"originalRequest": {
						"method": "GET",
						"header": [],
						"url": {
							"raw": "{{jazzhr_base-uri}}{{jazzhr_retrieve-results-url}}?orderId={{jazzhr_testOrderId}}",
							"host": [
								"{{jazzhr_base-uri}}{{jazzhr_retrieve-results-url}}"
							],
							"query": [
								{
									"key": "orderId",
									"value": "{{jazzhr_testOrderId}}",
									"description": "`orderId` included in the order package request body"
								}
							]
						}
					},
					"status": "OK",
					"code": 200,
					"_postman_previewlanguage": "json",
					"header": [
						{
							"key": "X-Powered-By",
							"value": "Express"
						},
						{
							"key": "Content-Type",
							"value": "application/json; charset=utf-8"
						},
						{
							"key": "Content-Length",
							"value": "103"
						},
						{
							"key": "ETag",
							"value": "W/\"67-fPBiqIispDpFJnTTvPalwHW+BxM\""
						},
						{
							"key": "Date",
							"value": "Fri, 17 Apr 2020 20:03:15 GMT"
						},
						{
							"key": "Connection",
							"value": "keep-alive"
						}
					],
					"cookie": [],
					"body": "{\n    \"status\": \"Clear\",\n    \"resultsUrl\": {\n        \"url\": \"http://partnersystem.com/order/id-123-done\"\n    },\n    \"finalPrice\": 147.5\n}"
				}
			]
		}
	],
	"auth": {
		"type": "bearer",
		"bearer": [
			{
				"key": "token",
				"value": "{{jazzhr_api-token}}",
				"type": "string"
			}
		]
	},
	"event": [
		{
			"listen": "prerequest",
			"script": {
				"type": "text/javascript",
				"exec": [
					""
				]
			}
		},
		{
			"listen": "test",
			"script": {
				"type": "text/javascript",
				"exec": [
					"pm.test(\"Successful response code\", function () {",
					"    pm.response.to.be.success;",
					"});",
					"",
					"if (pm.response.code < 200 || pm.response.code >= 300) {",
					"    postman.setNextRequest(null); // short-circuit collection run if any request fails",
					"}"
				]
			}
		}
	],
	"variable": [
		{
			"key": "jazzhr_api-token",
			"value": ""
		},
		{
			"key": "jazzhr_base-uri",
			"value": ""
		},
		{
			"key": "jazzhr_verify-url",
			"value": ""
		},
		{
			"key": "jazzhr_list-catalog-url",
			"value": ""
		},
		{
			"key": "jazzhr_order-package-url",
			"value": ""
		},
		{
			"key": "jazzhr_retrieve-results-url",
			"value": ""
		},
		{
			"key": "jazzhr_partner-id",
			"value": ""
		}
	]
}