Skip to content

Commit

Permalink
test(acbc): adding us AC BC postman collection
Browse files Browse the repository at this point in the history
  • Loading branch information
TruptiShrimant committed Apr 19, 2024
1 parent db79275 commit 5ee3c40
Show file tree
Hide file tree
Showing 3 changed files with 236 additions and 255 deletions.
182 changes: 55 additions & 127 deletions accounts/AccountCheck.postman_collection.json
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
{
"info": {
"_postman_id": "af3fd27c-507a-46f6-af33-5bd0e5c0659c",
"_postman_id": "4fc84752-32f2-419c-a4d0-58c79b11936f",
"name": "AccountCheck",
"description": "Welcome to Tink’s Postman collection for Account Check.\n\nFor detailed information on how to use Account Check, visit the [Account Check Integration Guide](https://docs.tink.com/resources/account-check/account-check-integration-guide).\n\nThe documentation in this Postman collection shows how you get your Tink variables and enter them in Postman to be able to use this collection.\n\nMake sure that you have created your Tink Console account. This is where you find your API credentials, for example `client_id` and `client_secret`, and create and manage your apps. If you haven't created a Console account and an app, go to [Set up your Tink Console account](https://docs.tink.com/resources/landing/set-up-your-tink-account) and follow the instructions to set up an account and create your first app.\n\nIn Postman, click on collection name, which should have three dots next to it. Click on Edit Collection, in the pop up there is a variable tab. This tab contains different variables.\n\nTo begin, enter your variables in the **CURRENT VALUE** column:\n\n1. Enter the `client_id` and `client_secret` values from your Console app.\n2. Enter the `id_hint` value to be displayed in the Tink URL. The `id_hint` value is presented to the end user in Tink Link. This is to be able to verify the identity of the actual user they are interacting with and to prevent URL spoofing attacks.\n3. Enter [locale](https://docs.tink.com/resources/account-check/account-check-sdk-reference#locales) and [market](https://docs.tink.com/resources/account-check/account-check-sdk-reference#markets). The default values are `en_US` for locale and `SE` for market. These values will later be used to create a user and to generate a Tink URL.\n4. Enter the `external_user_id` value that will be assigned to your user upon creation.\n5. To change the default redirect page value, change the `redirect_url` value.\n6. `state` is optional and is returned to you when the end user returns to your redirect_uri. Use this parameter to track the end user after they’ve left your app and entered the Tink flow.\n\nMake sure that you enter your `client_id` and `client_secret` in the **INITIAL VALUE** column and the **CURRENT VALUE**.\n\nBefore you can fetch data, you must create and authenticate the user.\n\nTo create and authenticate the user, select the **Generate the Reports** folder and:\n\n1. Select and send the **Generate Authorization Code** request. A code is generated. This code is used to generate your Tink URL.\n2. When the process has completed, select **Visualize** in the **Body** part of Postman. You’ll see a **Tink URL**, ready to use. Select the entire URL and copy it to your clipboard.\n3. Paste the link in your browser and complete the flow by authenticating your user.\n4. Copy `account_verification_report_id` parameter from browser url and update `report_id` variable.\n\nMake sure that all of your variables are entered into the **CURRENT VALUE** column. Select **Save** (or Ctrl+S).\n\nAfter you have authenticated your user, now get account check report:\n1. Select and send the **Get Token to Retrive Account Verification Report** request to generate the access token.\n2. Select and send the **Get the Account Check report as JSON** request to retrieve created account check report.\n\nNote: when you first download this postman collection, in Setting Up Continuous Access > Step 2. Create User, you need to ensure that the \"Body\" is set to \"JSON\". So within this POST command, navigate to the \"Body\" tab and ensure you see \"JSON\" and not \"Text\" for the type. Typically, postman will pre-set this as Text.\nIf you want to use external user then, go to \"Body\" and add external user id there.\n\nWhen you've entered all your variables except for `access_token`, run the **POST** commands to exchange your `code` for an `access_token`. The value for `access_token` is automatically entered into your list of variables.\n\nConfirm that your `access_token` has been added to your list of collection variables. Use your `access_token` any number of times to run the **GET** commands to fetch a report.",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
"_exporter_id": "32498815"
},
"item": [
{
"name": "Setting up Continuous Access",
"item": [
{
"name": "1. Authorize app",
"name": "1.1 Authorize app",
"event": [
{
"listen": "test",
"script": {
"exec": [
"var jsonData = JSON.parse(responseBody);",
"pm.collectionVariables.set(\"access_token\", jsonData.access_token);"
"pm.environment.set(\"accessToken\", jsonData.access_token);"
],
"type": "text/javascript"
}
Expand Down Expand Up @@ -48,40 +48,35 @@
},
{
"key": "scope",
"value": "user:create,authorization:grant",
"value": "user:create,authorization:grant,link-session:write,user:read,credentials:read",
"type": "default"
}
]
},
"url": {
"raw": "https://api.us.tink.com/api/v1/oauth/token",
"protocol": "https",
"raw": "{{base}}api/v1/oauth/token",
"host": [
"api",
"us",
"tink",
"com"
"{{base}}api"
],
"path": [
"api",
"v1",
"oauth",
"token"
]
},
"description": "Welcome to Tink’s Postman collection for Account Check.\n\nFor detailed information on how to use Account Check, visit [Fetch your first Account Check report](https://docs.tink.com/resources/account-check/verify-your-first-account).\n\nThe documentation in this Postman collection shows how you get your Tink variables and enter them in Postman to be able to use this collection.\n\nMake sure that you have created your Tink Console account. This is where you find your API credentials, for example `client_id` and `client_secret`, and create and manage your apps. If you haven't created a Console account and an app, go to [Set up your Tink Console account](https://docs.tink.com/resources/landing/set-up-your-tink-account) and follow the instructions to set up an account and create your first app.\n\nIn Postman, go to the **Variables** tab, which should be the one with a green dot next to it. This tab contains four variables. The rest of this documentation shows how to retrieve these values.\n\nMake sure that you enter all of your variables in the **CURRENT VALUE** column.\n\nEnter the `client_id` and `client_secret` values from your Console app.\n\nTo get the `report_id` value, you must build a Tink Link URL. To do this, open Console and go to **Account Check** > **Tink Link**, and create your own Tink Link. These steps are required for providing consent to a financial institution, so that Tink can connect and retrieve account data. At the bottom of the page, select **Preview** and follow all steps on the Tink Link page that opens in a new window. At the end of a successful authorization flow, the **Account Check successful** page displays your `account_verification_report_id`. Copy this code, go to Postman, and paste it into the variables field for `report_id`.\n\nMake sure that all of your variables are entered into the **CURRENT VALUE** column. Select **Save** (or Ctrl+S).\n\nWhen you've entered all your variables except for `access_token`, run the **POST** command to exchange your `code` for an `access_token`. The value for `access_token` is automatically entered into your list of variables.\n\nConfirm that your `access_token` has been added to your list of variables. Use your `access_token` any number of times to run the **GET** commands to fetch a report."
"description": ""
},
"response": []
},
{
"name": "2. Create User",
"name": "1.2 Create User",
"event": [
{
"listen": "test",
"script": {
"exec": [
"var jsonData = JSON.parse(responseBody);",
"pm.collectionVariables.set(\"user_id\", jsonData.user_id);"
"pm.environment.set(\"userId\", jsonData.user_id);"
],
"type": "text/javascript"
}
Expand All @@ -95,7 +90,12 @@
"header": [
{
"key": "Authorization",
"value": "Bearer {{access_token}}",
"value": "Bearer {{accessToken}}",
"type": "text"
},
{
"key": "Content-Type",
"value": "application/json",
"type": "text"
}
],
Expand All @@ -109,16 +109,11 @@
}
},
"url": {
"raw": "https://api.us.tink.com/api/v1/user/create",
"protocol": "https",
"raw": "{{base}}api/v1/user/create",
"host": [
"api",
"us",
"tink",
"com"
"{{base}}api"
],
"path": [
"api",
"v1",
"user",
"create"
Expand All @@ -134,35 +129,37 @@
"name": "Generate the Reports",
"item": [
{
"name": "1. Generate Authorization Code",
"name": "2.1 Generate Authorization Code",
"event": [
{
"listen": "test",
"script": {
"exec": [
"let jsonResponse = JSON.parse(responseBody);",
"",
"let clientId = pm.collectionVariables.get(\"client_id\");",
"let tinkLinkmarket = pm.collectionVariables.get(\"market\")",
"let tinkLinklocale = pm.collectionVariables.get(\"locale\")",
"let redirectUri = pm.collectionVariables.get(\"redirect_url\");",
"let clientId = pm.environment.get(\"client_id\");",
"let tinkLinkmarket = pm.environment.get(\"market\")",
"let tinkLinklocale = pm.environment.get(\"locale\")",
"let redirectUri = pm.environment.get(\"redirect_uri\");",
"let tinkLinkURL = pm.environment.get(\"tink_link_url\");",
"",
"//Set code in variables",
"let code = jsonResponse[\"code\"];",
"pm.collectionVariables.set(\"code\", code);",
"pm.environment.set(\"code\", code);",
"",
"//Encode redirect URI",
"let redirectUriEncoded = encodeURIComponent(redirectUri);",
"",
"//Compose TinkLink URI",
"let tinkLink = \"https://link.us.tink.com/1.0/account-check/connect?client_id=YOUR_CLIENT_ID&state=OPTIONAL&redirect_uri=REDIRECT_URL&authorization_code=USER_AUTHORIZATION_CODE&market=MARKET\"",
"let tinkLink = \"tink_link_url/1.0/account-check/create-report?client_id=YOUR_CLIENT_ID&redirect_uri=REDIRECT_URL&authorization_code=USER_AUTHORIZATION_CODE&market=MARKET&locale=LOCALE\"",
"tinkLink = tinkLink.replace(\"YOUR_CLIENT_ID\", clientId);",
"tinkLink = tinkLink.replace(\"USER_AUTHORIZATION_CODE\", code);",
"tinkLink = tinkLink.replace(\"REDIRECT_URL\", redirectUriEncoded);",
"tinkLink = tinkLink.replace(\"MARKET\", tinkLinkmarket);",
"tinkLink = tinkLink.replace(\"LOCALE\", tinkLinklocale);",
"tinkLink = tinkLink.replace(\"tink_link_url\",tinkLinkURL);",
"",
"pm.collectionVariables.set(\"tink_link\", tinkLink);",
"pm.environment.set(\"tink_link\", tinkLink);",
"",
"//Set html template for Postman Visualize",
"let postmanVisualise = `",
Expand Down Expand Up @@ -212,7 +209,7 @@
"header": [
{
"key": "Authorization",
"value": "Bearer {{access_token}}",
"value": "Bearer {{accessToken}}",
"type": "text"
}
],
Expand All @@ -227,41 +224,29 @@
},
{
"key": "user_id",
"value": "{{user_id}}",
"value": "{{userId}}",
"description": "You can use the user_id or the external_user_id ",
"type": "text"
},
{
"key": "id_hint",
"value": "End user name/username",
"description": "The id_hint is a value that will be presented to the end-user in Tink Link, to be able to verify the identity of the actual user they are interacting with and prevent URL spoofing attacks. It can be any arbitrary string value that is recognizable to the end-user, such as the user’s full name or email.",
"value": "null",
"description": "The id_hint is a value that has main applicability in the EU, we recommend to set it to null.",
"type": "text"
},
{
"key": "scope",
"value": "authorization:read,authorization:grant,credentials:refresh,credentials:read,credentials:write,providers:read,user:read,accounts:read",
"value": "authorization:read,authorization:grant,credentials:read,providers:read,user:read,credentials:refresh,credentials:write,link-session:read",
"type": "text"
},
{
"key": "external_user_id",
"value": "{{external_user_id}}",
"description": "You can use the user_id or the external_user_id ",
"type": "text",
"disabled": true
}
]
},
"url": {
"raw": "https://api.us.tink.com/api/v1/oauth/authorization-grant/delegate",
"protocol": "https",
"raw": "{{base}}api/v1/oauth/authorization-grant/delegate",
"host": [
"api",
"us",
"tink",
"com"
"{{base}}api"
],
"path": [
"api",
"v1",
"oauth",
"authorization-grant",
Expand All @@ -272,14 +257,14 @@
"response": []
},
{
"name": "2. Get Token to Retrieve Account Verification Report",
"name": "2.2 Get Token to Retrieve Account Verification Report",
"event": [
{
"listen": "test",
"script": {
"exec": [
"var jsonData = JSON.parse(responseBody);",
"pm.collectionVariables.set(\"access_token\", jsonData.access_token);"
"pm.environment.set(\"accessToken\", jsonData.access_token);"
],
"type": "text/javascript"
}
Expand Down Expand Up @@ -316,16 +301,11 @@
]
},
"url": {
"raw": "https://api.us.tink.com/api/v1/oauth/token",
"protocol": "https",
"raw": "{{base}}api/v1/oauth/token",
"host": [
"api",
"us",
"tink",
"com"
"{{base}}api"
],
"path": [
"api",
"v1",
"oauth",
"token"
Expand All @@ -335,13 +315,15 @@
"response": []
},
{
"name": "3. Get the Account Check report as JSON",
"name": "2.3. Get the Account Check report as JSON",
"event": [
{
"listen": "test",
"script": {
"exec": [
""
"let body = pm.response.json();",
"let value = body.userDataByProvider[0].accounts[0].id;",
"pm.environment.set(\"accountId\", value);"
],
"type": "text/javascript"
}
Expand All @@ -352,24 +334,26 @@
"header": [
{
"key": "Authorization",
"value": "Bearer {{access_token}}",
"value": "Bearer {{accessToken}}",
"type": "text"
}
],
"url": {
"raw": "https://api.us.tink.com/api/v1/account-verification-reports/{{report_id}}",
"protocol": "https",
"raw": "{{base}}api/v1/account-verification-reports/{{reportId}}",
"host": [
"api",
"us",
"tink",
"com"
"{{base}}api"
],
"path": [
"api",
"v1",
"account-verification-reports",
"{{report_id}}"
"{{reportId}}"
],
"query": [
{
"key": "",
"value": null,
"disabled": true
}
]
}
},
Expand Down Expand Up @@ -399,61 +383,5 @@
]
}
}
],
"variable": [
{
"key": "state_id",
"value": "{{state_id}}",
"disabled": true
},
{
"key": "external_user_id",
"value": "external_user_id",
"disabled": true
},
{
"key": "client_id",
"value": "{{client_id}}"
},
{
"key": "client_secret",
"value": "{{client_secret}}"
},
{
"key": "report_id",
"value": "{{report_id}}"
},
{
"key": "access_token",
"value": "{{access_token}}"
},
{
"key": "user_id",
"value": "{{user_id}}"
},
{
"key": "locale",
"value": "en_US"
},
{
"key": "market",
"value": "US"
},
{
"key": "code",
"value": "{{code}}"
},
{
"key": "tink_link",
"value": "https://link.us.tink.com/1.0/account-check/connect?client_id={{client_id}}&state=OPTIONAL&redirect_uri=https%3A%2F%2Fconsole.us.tink.com%2Fcallback&authorization_code={{code}}&market=US"
},
{
"key": "id_hint",
"value": "{{id_hint}}"
},
{
"key": "redirect_url",
"value": "https://console.us.tink.com/callback"
}
]
}
Loading

0 comments on commit 5ee3c40

Please sign in to comment.