forked from DEFRA/ffc-customer-registry-api
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #96 from DEFRA/fix/set-LOG_LEVEL+test-scripts
Fix/set log level+test scripts
- Loading branch information
Showing
7 changed files
with
116 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# Generate token | ||
token_request=$(curl --location "https://login.microsoftonline.com/${apim_tenant_id}/oauth2/v2.0/token" \ | ||
--header 'content-type: application/x-www-form-urlencoded' \ | ||
--data-urlencode 'grant_type=client_credentials' \ | ||
--data-urlencode "scope=${apim_scope}" \ | ||
-u "${apim_client_id}:${apim_client_secret}") | ||
|
||
token=$(jq -r '.access_token' <<< "${token_request}") | ||
echo "Token: ${token}" | ||
|
||
|
||
curl --location "https://${apim_url}/person/search" \ | ||
--header "email: ${user_email}" \ | ||
--header 'Content-Type: application/json' \ | ||
--data '{ | ||
"offset": 0, | ||
"limit": 20, | ||
"searchFieldType": "CUSTOMER_REFERENCE", | ||
"primarySearchPhrase": "1103020285", | ||
"secondarySearchPhrase": null | ||
}' \ | ||
--header "Authorization: Bearer ${token}" \ | ||
--header "Ocp-Apim-Subscription-Key: ${apim_subscription_key}" | ||
|
||
curl --location "https://${apim_url}/organisation/search" \ | ||
--header "email: ${user_email}" \ | ||
--header 'Content-Type: application/json' \ | ||
--data '{"offset":0,"limit": 20, "searchFieldType":"SBI","primarySearchPhrase":"106327021"}' \ | ||
--header "Authorization: Bearer ${token}" \ | ||
--header "Ocp-Apim-Subscription-Key: ${apim_subscription_key}" | ||
|
||
curl --location "https://${apim_url}/authorisation/organisation/${org_id}" \ | ||
--header "email: ${user_email}" \ | ||
--header "Authorization: Bearer ${token}" \ | ||
--header "Ocp-Apim-Subscription-Key: ${apim_subscription_key}" | ||
|
||
curl --location "https://${apim_url}/organisation/person/${person_id}/summary?search=" \ | ||
--header "email: ${user_email}" \ | ||
--header "Authorization: Bearer ${token}" \ | ||
--header "Ocp-Apim-Subscription-Key: ${apim_subscription_key}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# Generate token | ||
token_request=$(curl --location "https://login.microsoftonline.com/${dal_tenant_id}/oauth2/v2.0/token" \ | ||
--header 'content-type: application/x-www-form-urlencoded' \ | ||
--data-urlencode 'grant_type=client_credentials' \ | ||
--data-urlencode "scope=${dal_scope}" \ | ||
-u "${dal_client_id}:${dal_client_secret}") | ||
|
||
token=$(jq -r '.access_token' <<< "${token_request}") | ||
echo "Token: ${token}" | ||
|
||
|
||
# Authenticate questions | ||
curl --location "${dal_url}" \ | ||
--header 'Content-Type: application/json' \ | ||
--header "Authorization: Bearer ${token}" \ | ||
--data '{"query":"query Customer ($crn: ID!) {\n customer(crn: $crn) {\n crn\n authenticationQuestions(entraIdUserObjectId: \"e99e8cec-6b83-4de8-b9d1-cccfeeb82dbc\") {\n isFound\n updatedAt\n memorableDate\n memorableEvent\n memorablePlace\n }\n }\n}","variables":{"crn":"1103020285"}}' | ||
|
||
# Customer businesses | ||
curl --location "${dal_url}" \ | ||
--header "Email: ${user_email}" \ | ||
--header 'Content-Type: application/json' \ | ||
--header "Authorization: Bearer ${token}" \ | ||
--data '{"query":"query Customer ($crn: ID!) {\n customer(crn: $crn) {\n personId\n crn\n businesses {\n sbi\n name\n }\n }\n}","variables":{"crn":"1103020285"}}' | ||
|
||
# Customer permissions | ||
curl --location "${dal_url}" \ | ||
--header "Email: ${user_email}" \ | ||
--header 'Content-Type: application/json' \ | ||
--header "Authorization: Bearer ${token}" \ | ||
--data '{"query":"query Customer ($crn: ID!, $sbi: ID!) {\n customer(crn: $crn) {\n crn\n business(sbi: $sbi) {\n role\n permissionGroups {\n level\n id\n }\n }\n }\n}","variables":{"crn":"1103020285","sbi":"106833558"}}' | ||
|
||
# Business customers | ||
curl --location 'https://fcp-data-access-layer-api.tst1.adp.defra.gov.uk/graphql' \ | ||
--header "Email: ${user_email}" \ | ||
--header 'Content-Type: application/json' \ | ||
--header "Authorization: Bearer ${token}" \ | ||
--data '{"query":"query BusinessCustomers ($sbi: ID!) {\n business(sbi: $sbi) {\n customers {\n firstName\n lastName\n crn\n }\n }\n}","variables":{"sbi":"107591843"}}' | ||
|
||
# Business customer permissions | ||
curl --location "${dal_url}" \ | ||
--header "Email: ${user_email}" \ | ||
--header 'Content-Type: application/json' \ | ||
--header "Authorization: Bearer ${token}" \ | ||
--data '{"query":"query BusinessCustomer ($sbi: ID!, $crn: ID!) {\n business(sbi: $sbi) {\n customer(crn: $crn) {\n role\n permissionGroups {\n level\n id\n }\n }\n }\n}","variables":{"sbi":"107591843","crn":"1100071369"}}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
curl --location "https://${gateway_url}:8444/extapi/person/search" \ | ||
--header "email: ${user_email}" \ | ||
--header 'Content-Type: application/json' \ | ||
--data '{ | ||
"offset": 0, | ||
"limit": 20, | ||
"searchFieldType": "CUSTOMER_REFERENCE", | ||
"primarySearchPhrase": "1103020285", | ||
"secondarySearchPhrase": null | ||
}' \ | ||
--cert ${cert_location} --key ${key_location} | ||
|
||
curl --location "https://${gateway_url}:8444/extapi/organisation/search" \ | ||
--header "email: ${user_email}" \ | ||
--header 'Content-Type: application/json' \ | ||
--data '{"offset":0,"limit": 20, "searchFieldType":"SBI","primarySearchPhrase":"106327021"}' \ | ||
--cert ${cert_location} --key ${key_location} | ||
|
||
curl --location "https://${gateway_url}:8444/extapi/authorisation/organisation/${org_id}" \ | ||
--header "email: ${user_email}" \ | ||
--cert ${cert_location} --key ${key_location} | ||
|
||
curl --location "https://${gateway_url}:8444/extapi/organisation/person/${person_id}/summary?search=" \ | ||
--header "email: ${user_email}" \ | ||
--cert ${cert_location} --key ${key_location} |