{
	"info": {
		"_postman_id": "859bc3ba-d8f7-4e07-8a65-3a7f597751a2",
		"name": "Fintecture API (Doc)",
		"description": "## Introduction\n\nAt Fintecture we understand the importance of providing developers with the necessary tools to streamline their work. In this regard, we have created this Postman collection that aims to simplify the process of taking in charge our APIs.\n\nOur Postman collection includes a comprehensive set of API endpoints with sample requests. This allows developers to easily test and integrate our APIs into their applications without having to worry about the details of the implementation.\n\nFurthermore, our Postman collection is regularly updated to ensure that it reflects the latest changes and improvements to our APIs. This helps developers to stay up-to-date with the latest developments and ensures that their applications are always using the latest and most robust API endpoints.\n\n## 1\\. Variables\n\nAll of the variables are stored directly at root level (Fintecture API)\n\n## 2\\. Arborescence\n\nOur arboresence follows the one of our [documentation](https://doc.fintecture.com/docs/api-overview) and stronly relies upon it so please follow it in parallel.\n\n### 2.1. Authentication\n\nSimple requests to help you take over the auth.\n\n### 2.2. Integrate payments\n\nSamples for integrating our payment solutions.\n\n### 2.3. Integrate bank accounts\n\nSamples for integrating our bank account's integration solutions.\n\n## 3\\. Support\n\nWe are here to best serve your needs, so please [contact us](mailto:support-api@fintecture.com) to request a specific feature, to report a bug or just a general enquiry.",
		"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
		"_exporter_id": "513061"
	},
	"item": [
		{
			"name": "Authentication",
			"item": [
				{
					"name": "Request a PIS access token",
					"item": [
						{
							"name": "Request a PIS access token",
							"event": [
								{
									"listen": "prerequest",
									"script": {
										"exec": [
											"// Request a PIS access token",
											"const grant_type = \"client_credentials\";",
											"const scope = \"PIS\";",
											"",
											"// Register a client application and get its credentials",
											"const app_id = pm.collectionVariables.get(\"app_id\"); // mandatory",
											"const app_secret = pm.collectionVariables.get(\"app_secret\"); // mandatory",
											"",
											"// Encode your credentials using Base64",
											"let keys = app_id + \":\" + app_secret;",
											"let encodedKeys = CryptoJS.enc.Base64.stringify(CryptoJS.enc.Utf8.parse(keys));",
											"",
											"// Set Postman variables",
											"pm.collectionVariables.set(\"base64_token\", encodedKeys);",
											"pm.collectionVariables.set(\"grant_type\", grant_type);",
											"pm.collectionVariables.set(\"scope\", scope);",
											"",
											""
										],
										"type": "text/javascript",
										"packages": {}
									}
								},
								{
									"listen": "test",
									"script": {
										"exec": [
											"// Extract access_token & expires_in from provided response body",
											"const res = pm.response.json();",
											"",
											"const access_token = res.access_token;",
											"const expires_in = res.expires_in;",
											"",
											"// Set Postman variable",
											"pm.collectionVariables.set(\"access_token\", access_token);"
										],
										"type": "text/javascript",
										"packages": {}
									}
								}
							],
							"request": {
								"method": "POST",
								"header": [
									{
										"key": "Authorization",
										"value": "Basic {{base64_token}}",
										"type": "default"
									},
									{
										"key": "Accept",
										"value": "application/json",
										"type": "default"
									},
									{
										"key": "Content-Type",
										"value": "application/x-www-form-urlencoded",
										"type": "default"
									}
								],
								"body": {
									"mode": "urlencoded",
									"urlencoded": [
										{
											"key": "grant_type",
											"value": "client_credentials",
											"type": "default"
										},
										{
											"key": "scope",
											"value": "pis",
											"type": "default"
										},
										{
											"key": "app_id",
											"value": "{{app_id}}",
											"type": "default"
										}
									]
								},
								"url": {
									"raw": "{{API_BASE_URL}}/oauth/accesstoken",
									"host": [
										"{{API_BASE_URL}}"
									],
									"path": [
										"oauth",
										"accesstoken"
									]
								}
							},
							"response": []
						}
					],
					"description": "[https://doc.fintecture.com/docs/api-request-a-pis-access-token](https://doc.fintecture.com/docs/api-request-a-pis-access-token)"
				},
				{
					"name": "Request an AIS access token",
					"item": [
						{
							"name": "Request the AIS Connect URL",
							"event": [
								{
									"listen": "prerequest",
									"script": {
										"exec": [
											"// Get collection variables",
											"const psu_type = pm.collectionVariables.get(\"psu_type\");",
											"const country_code = pm.collectionVariables.get(\"country_code\");",
											"const language = pm.collectionVariables.get(\"language\");",
											"const provider = pm.collectionVariables.get(\"provider\");",
											"",
											"const redirect_uri = pm.collectionVariables.get(\"redirect_uri\");",
											"const state = pm.collectionVariables.get(\"state\");",
											"const scope = undefined;",
											"",
											"// Fill headers",
											"const headers = {",
											"    'x-request_id': require('uuid').v4(),",
											"    'x-psu_type': psu_type ? psu_type : undefined,",
											"    \"x-country_code\": country_code ? country_code : undefined,",
											"    'x-language': language ? language : undefined,",
											"    'x-provider': provider ? provider : undefined",
											"}",
											"Object.entries(headers).forEach(([key, value]) => {",
											"    if(!pm.request.headers.get(key) && value) ",
											"        pm.request.headers.add({key, value});",
											"});",
											"",
											"// Fill query parameters",
											"const query_params = {",
											"    'redirect_uri': redirect_uri ?  redirect_uri : undefined, // mandatory",
											"    'state': state ?  state : undefined,  // mandatory",
											"    'scope': scope ?  scope : undefined  // mandatory",
											"}",
											"Object.entries(query_params).forEach(([key, value]) => {",
											"    if(value) ",
											"        pm.request.url.query.add(key + \"=\" + value);",
											"});"
										],
										"type": "text/javascript"
									}
								},
								{
									"listen": "test",
									"script": {
										"exec": [
											"const res = pm.response.json();",
											"",
											"const connect_url = res.meta.url;",
											"",
											"pm.collectionVariables.set(\"connect_url\", connect_url);"
										],
										"type": "text/javascript"
									}
								}
							],
							"request": {
								"method": "GET",
								"header": [
									{
										"key": "app_id",
										"value": "{{app_id}}",
										"type": "text"
									},
									{
										"key": "Accept",
										"value": "application/json",
										"type": "text"
									}
								],
								"url": {
									"raw": "{{API_BASE_URL}}/ais/v2/connect",
									"host": [
										"{{API_BASE_URL}}"
									],
									"path": [
										"ais",
										"v2",
										"connect"
									]
								},
								"description": "NOT DESCRIBED"
							},
							"response": []
						},
						{
							"name": "Redirect the user",
							"event": [
								{
									"listen": "test",
									"script": {
										"exec": [
											"// On redirection extract the code received",
											"const fintecture_redirect_url = pm.response.headers.get('location');",
											"",
											"const query_params = fintecture_redirect_url?.split('?');",
											"const bank_code = query_params ? query_params[1].split('&').find(e => e.indexOf('code=') !== -1)?.replace('code=','') : undefined;",
											"const customer_id =  query_params ? query_params[1].split('&').find(e => e.indexOf('customer_id=') !== -1)?.replace('customer_id=','') : undefined;",
											"",
											"// Set Postman variables",
											"pm.collectionVariables.set(\"bank_code\", bank_code);",
											"pm.collectionVariables.set(\"customer_id\", customer_id);",
											""
										],
										"type": "text/javascript"
									}
								}
							],
							"protocolProfileBehavior": {
								"followRedirects": true
							},
							"request": {
								"method": "GET",
								"header": [
									{
										"key": "referer",
										"value": "{{location}}",
										"type": "default",
										"disabled": true
									}
								],
								"url": {
									"raw": "{{connect_url}}",
									"host": [
										"{{connect_url}}"
									]
								}
							},
							"response": []
						},
						{
							"name": "Exchange the code for an access token",
							"event": [
								{
									"listen": "prerequest",
									"script": {
										"exec": [
											"// Request a PIS access token",
											"const grant_type = \"client_credentials\";",
											"const scope = \"AIS\";",
											"",
											"// Retrieve app_id and app_secret from variables",
											"const app_id = pm.collectionVariables.get(\"app_id\");",
											"const app_secret = pm.collectionVariables.get(\"app_secret\");",
											"",
											"// Encode your credentials using Base64",
											"let keys = app_id + \":\" + app_secret;",
											"let encodedKeys = CryptoJS.enc.Base64.stringify(CryptoJS.enc.Utf8.parse(keys));",
											"",
											"// Set Postman variables",
											"pm.collectionVariables.set(\"base64_token\", encodedKeys);",
											"pm.collectionVariables.set(\"grant_type\", grant_type);",
											"pm.collectionVariables.set(\"scope\", scope);",
											""
										],
										"type": "text/javascript",
										"packages": {}
									}
								},
								{
									"listen": "test",
									"script": {
										"exec": [
											"// Extract access_token, expires_in & refresh_token from provided response body",
											"const res = pm.response.json();",
											"",
											"const access_token = res.access_token;",
											"const expires_in = res.expires_in;",
											"const refresh_token = res.refresh_token;",
											"",
											"pm.collectionVariables.set(\"access_token\", access_token);"
										],
										"type": "text/javascript",
										"packages": {}
									}
								}
							],
							"request": {
								"method": "POST",
								"header": [
									{
										"key": "Authorization",
										"value": "Basic {{base64_token}}",
										"type": "default"
									},
									{
										"key": "Accept",
										"value": "application/json",
										"type": "default"
									},
									{
										"key": "Content-Type",
										"value": "application/x-www-form-urlencoded",
										"type": "default"
									}
								],
								"body": {
									"mode": "urlencoded",
									"urlencoded": [
										{
											"key": "grant_type",
											"value": "authorization_code",
											"type": "default"
										},
										{
											"key": "code",
											"value": "{{bank_code}}",
											"type": "default"
										},
										{
											"key": "scope",
											"value": "ais",
											"type": "default"
										}
									]
								},
								"url": {
									"raw": "{{API_BASE_URL}}/oauth/accesstoken",
									"host": [
										"{{API_BASE_URL}}"
									],
									"path": [
										"oauth",
										"accesstoken"
									]
								}
							},
							"response": []
						}
					],
					"description": "[https://doc.fintecture.com/docs/api-request-an-ais-token](https://doc.fintecture.com/docs/api-request-an-ais-token)",
					"event": [
						{
							"listen": "prerequest",
							"script": {
								"type": "text/javascript",
								"exec": [
									""
								]
							}
						},
						{
							"listen": "test",
							"script": {
								"type": "text/javascript",
								"exec": [
									""
								]
							}
						}
					]
				},
				{
					"name": "HTTP Signature",
					"item": [
						{
							"name": "Load ForgeJS library",
							"event": [
								{
									"listen": "test",
									"script": {
										"exec": [
											"// Extract lib and load it in a global variable",
											"const res = pm.response;",
											"pm.globals.set(\"forgeJS\", res.text());",
											"eval (res);"
										],
										"type": "text/javascript"
									}
								}
							],
							"request": {
								"method": "GET",
								"header": [],
								"url": {
									"raw": "https://raw.githubusercontent.com/loveiset/RSAForPostman/master/forge.js",
									"protocol": "https",
									"host": [
										"raw",
										"githubusercontent",
										"com"
									],
									"path": [
										"loveiset",
										"RSAForPostman",
										"master",
										"forge.js"
									]
								}
							},
							"response": []
						},
						{
							"name": "Every request to be signed",
							"event": [
								{
									"listen": "prerequest",
									"script": {
										"exec": [
											"",
											"/****************** ",
											" Signing algorithm",
											"*******************/",
											"// Load ForgeJS for signing",
											"eval(pm.globals.get(\"forgeJS\"));",
											"",
											"// Get information on the current request",
											"const host = pm.request.url.getHost().toLowerCase();",
											"const path = pm.request.getPath;",
											"const method = pm.request.method.toLowerCase();",
											"const contentType = pm.request.headers.get('Content-Type');",
											"",
											"// Build the message digest (in case of POST/PUT/PATCH)",
											"let digest;",
											"let sent_headers;",
											"if (method === \"post\" || method === \"put\" || method === \"patch\") {",
											"    digest = calculateDigest(contentType, pm.collectionVariables.get(\"payload\"));",
											"    sent_headers = 'date digest x-request-id'  ",
											"}",
											"else",
											"    sent_headers = 'date x-request-id'  ",
											"",
											"// Create the signing parameters",
											"let headers = {",
											"  //  '(request-target)': method + ' ' + path,",
											"    'date': new Date().toGMTString(),",
											"    \"digest\": digest,",
											"    'x-request-id': require('uuid').v4()",
											"}",
											"",
											"// Build the signing string",
											"let normalizedString = Object.entries(headers).map(([key, value]) => `${key}: ${value}`).join('\\n');",
											"",
											"// Encrypt the signing string",
											"const privateKey = pm.collectionVariables.get(\"private_key\"); // mandatory",
											"const encryptedSignature = encryptSignature(privateKey, normalizedString);",
											"",
											"// Create the signature string",
											"const keyId = pm.collectionVariables.get(\"key_id\"); ",
											"const signature = `keyId=\"${keyId}\",algorithm=\"rsa-sha256\",headers=\"${sent_headers}\",signature=\"${encryptedSignature}\"`;",
											"",
											"// Update current request's headers",
											"headers.signature = signature;",
											"Object.entries(headers).forEach(([key, value]) => {",
											"    if(!pm.request.headers.get(key)) ",
											"        pm.request.headers.add({key, value});",
											"});",
											"",
											"/****************** ",
											" Signing functions ",
											"*******************/",
											"// Digest Calculation",
											"function resolveRequestBody(contentType, body) {",
											"",
											"  if (contentType === \"application/x-www-form-urlencoded\") {",
											"  } else if(contentType === 'application/json') {",
											"",
											"        if (body)",
											"            return JSON.stringify(JSON.parse(body));",
											"        else",
											"            return JSON.stringify({});",
											"  }",
											"}",
											"",
											"function calculateDigest(contentType, body) {",
											"  const requestData = resolveRequestBody(contentType, body);",
											"",
											"  const calculatedDigest = 'SHA-256=' + CryptoJS.enc.Base64.stringify(CryptoJS.SHA256(requestData));",
											"  return calculatedDigest;",
											"}",
											"",
											"function encryptSignature(privateKey, normalizedString) {",
											"  const messageDigest = forge.md.sha256.create();",
											"  messageDigest.update(normalizedString, \"utf8\");",
											"  return forge.util.encode64(formatPrivateKey(privateKey).sign(messageDigest));",
											"}",
											"",
											"function formatPrivateKey(privateKey) {",
											"  const formatedPrivKey = forge.pki.privateKeyFromPem(privateKey.replace(/\\\\n/g, '\\n'));",
											"  return formatedPrivKey;",
											"}",
											"",
											""
										],
										"type": "text/javascript"
									}
								}
							],
							"request": {
								"method": "OPTIONS",
								"header": [],
								"url": {
									"raw": ""
								}
							},
							"response": []
						}
					],
					"description": "[https://doc.fintecture.com/docs/api-http-signature](https://doc.fintecture.com/docs/api-http-signature)",
					"event": [
						{
							"listen": "prerequest",
							"script": {
								"type": "text/javascript",
								"exec": [
									""
								]
							}
						},
						{
							"listen": "test",
							"script": {
								"type": "text/javascript",
								"exec": [
									""
								]
							}
						}
					]
				}
			]
		},
		{
			"name": "Integrate payments",
			"item": [
				{
					"name": "Initiate an Immediate Payment",
					"item": [
						{
							"name": "Request a PIS access token",
							"event": [
								{
									"listen": "prerequest",
									"script": {
										"exec": [
											"// Request a PIS access token",
											"const grant_type = \"client_credentials\";",
											"const scope = \"PIS\";",
											"",
											"// Register a client application and get its credentials",
											"const app_id = pm.collectionVariables.get(\"app_id\"); // mandatory",
											"const app_secret = pm.collectionVariables.get(\"app_secret\"); // mandatory",
											"",
											"// Encode your credentials using Base64",
											"let keys = app_id + \":\" + app_secret;",
											"let encodedKeys = CryptoJS.enc.Base64.stringify(CryptoJS.enc.Utf8.parse(keys));",
											"",
											"// Set Postman variables",
											"pm.collectionVariables.set(\"base64_token\", encodedKeys);",
											"pm.collectionVariables.set(\"grant_type\", grant_type);",
											"pm.collectionVariables.set(\"scope\", scope);",
											"",
											"",
											""
										],
										"type": "text/javascript",
										"packages": {}
									}
								},
								{
									"listen": "test",
									"script": {
										"exec": [
											"// Extract access_token & expires_in from provided response body",
											"const res = pm.response.json();",
											"",
											"const access_token = res.access_token;",
											"const expires_in = res.expires_in;",
											"",
											"// Set Postman variable",
											"pm.collectionVariables.set(\"access_token\", access_token);"
										],
										"type": "text/javascript",
										"packages": {}
									}
								}
							],
							"request": {
								"method": "POST",
								"header": [
									{
										"key": "Authorization",
										"value": "Basic {{base64_token}}",
										"type": "default"
									},
									{
										"key": "Accept",
										"value": "application/json",
										"type": "default"
									},
									{
										"key": "Content-Type",
										"value": "application/x-www-form-urlencoded",
										"type": "default"
									}
								],
								"body": {
									"mode": "urlencoded",
									"urlencoded": [
										{
											"key": "grant_type",
											"value": "client_credentials",
											"type": "default"
										},
										{
											"key": "scope",
											"value": "pis",
											"type": "default"
										},
										{
											"key": "app_id",
											"value": "{{app_id}}",
											"type": "default"
										}
									]
								},
								"url": {
									"raw": "{{API_BASE_URL}}/oauth/accesstoken",
									"host": [
										"{{API_BASE_URL}}"
									],
									"path": [
										"oauth",
										"accesstoken"
									]
								}
							},
							"response": []
						},
						{
							"name": "Create the connect URL",
							"event": [
								{
									"listen": "test",
									"script": {
										"exec": [
											"// Extract session_id & url from provided response body",
											"const res = pm.response.json();",
											"",
											"const session_id = res.meta.session_id;",
											"const connect_url = res.meta.url;",
											"",
											"// Set Postman variables",
											"pm.collectionVariables.set(\"session_id\", session_id);",
											"pm.collectionVariables.set(\"connect_url\", connect_url);"
										],
										"type": "text/javascript",
										"packages": {}
									}
								},
								{
									"listen": "prerequest",
									"script": {
										"exec": [
											"// Get collection variables",
											"const psu_type = pm.collectionVariables.get(\"psu_type\");",
											"const country_code = pm.collectionVariables.get(\"country_code\");",
											"const language = pm.collectionVariables.get(\"language\");",
											"const provider = pm.collectionVariables.get(\"provider\");",
											"",
											"const redirect_uri = pm.collectionVariables.get(\"redirect_uri\");",
											"if (!redirect_uri)",
											"    throw new Error(\"redirect_uri is missing\");",
											"",
											"const origin_uri = pm.collectionVariables.get(\"origin_uri\");",
											"const state = pm.collectionVariables.get(\"state\");",
											"if (!state)",
											"    throw new Error(\"state is missing\");",
											"",
											"// Fill headers",
											"const headers = {",
											"    'x-request_id': require('uuid').v4(),",
											"    'x-psu_type': psu_type ? psu_type : undefined,",
											"    \"x-country_code\": country_code ? country_code : undefined,",
											"    'x-language': language ? language : undefined,",
											"    'x-provider': provider ? provider : undefined",
											"}",
											"Object.entries(headers).forEach(([key, value]) => {",
											"    if(!pm.request.headers.get(key) && value) ",
											"        pm.request.headers.add({key, value});",
											"});",
											"",
											"// Fill query parameters",
											"const query_params = {",
											"    'redirect_uri': redirect_uri, // mandatory",
											"    'origin_uri': origin_uri ?  origin_uri : undefined ,",
											"    'state': state // mandatory",
											"}",
											"",
											"Object.entries(query_params).forEach(([key, value]) => {",
											"    if(value) ",
											"        pm.request.url.query.add(key + \"=\" + value);",
											"});",
											"",
											"// Fill payload",
											"const b2c_mode = true;",
											"",
											"const b2c_body =  {",
											"    \"meta\": {",
											"        \"psu_name\": \"Julien Lefebre\",",
											"        \"psu_email\": \"julien.lefebre@gmail.com\",",
											"        \"psu_address\": {",
											"            \"number\": \"2\",",
											"            \"street\": \"rue Marie Stuart\",",
											"            \"zip\": \"75002\",",
											"            \"city\": \"PARIS\",",
											"            \"country\": \"FR\"",
											"        }",
											"    },",
											"    \"data\": {",
											"        \"type\": \"payments\",",
											"        \"attributes\": {",
											"            \"amount\": \"273\",",
											"            \"currency\": \"EUR\",",
											"            \"communication\": \"B34970692\"",
											"        }",
											"    }",
											"};",
											"",
											"const b2b_body = {",
											"     \"meta\": {",
											"          \"psu_name\": \"Julien Lefebre\",",
											"          \"psu_email\": \"julien.lefebre@my-business-sarl.com\",",
											"          \"psu_company\": \"My Business SARL\",",
											"          \"psu_incorporation\": \"123456789\",",
											"          \"psu_address\": {",
											"               \"number\": \"2\",",
											"               \"street\": \"rue Marie Stuart\",",
											"               \"zip\": \"75002\",",
											"               \"city\": \"PARIS\",",
											"               \"country\": \"FR\"",
											"          }",
											"     },",
											"     \"data\": {",
											"          \"type\": \"payments\",",
											"          \"attributes\": {",
											"               \"amount\": \"273\",",
											"               \"currency\": \"EUR\",",
											"               \"communication\": \"B34970692\"",
											"          }",
											"     }",
											"};",
											"",
											"const payload = b2c_mode ? JSON.stringify(b2c_body) : JSON.stringify(b2b_body);",
											"",
											"pm.collectionVariables.set(\"payload\", payload);",
											"",
											"// Signature handling",
											"const req = pm.request;",
											"const sign = utils.signRequest(req);",
											"",
											"pm.collectionVariables.set(\"date\", sign.date);",
											"pm.collectionVariables.set(\"digest\", sign.digest);",
											"pm.collectionVariables.set(\"signature\", sign.signatureHeader);",
											"pm.collectionVariables.set(\"xRequestId\", sign.xRequestId);"
										],
										"type": "text/javascript",
										"packages": {}
									}
								}
							],
							"request": {
								"auth": {
									"type": "bearer",
									"bearer": [
										{
											"key": "token",
											"value": "{{access_token}}",
											"type": "string"
										}
									]
								},
								"method": "POST",
								"header": [
									{
										"key": "Accept",
										"value": "application/json",
										"type": "text"
									},
									{
										"key": "Content-Type",
										"value": "application/json",
										"type": "text"
									},
									{
										"key": "x-request-id",
										"value": "{{xRequestId}}",
										"type": "text"
									},
									{
										"key": "date",
										"value": "{{date}}",
										"type": "text"
									},
									{
										"key": "signature",
										"value": "{{signature}}",
										"type": "text",
										"disabled": true
									},
									{
										"key": "digest",
										"value": "{{digest}}",
										"type": "text",
										"disabled": true
									}
								],
								"body": {
									"mode": "raw",
									"raw": "{{payload}}",
									"options": {
										"raw": {
											"language": "json"
										}
									}
								},
								"url": {
									"raw": "{{API_BASE_URL}}/pis/v2/connect",
									"host": [
										"{{API_BASE_URL}}"
									],
									"path": [
										"pis",
										"v2",
										"connect"
									]
								}
							},
							"response": []
						},
						{
							"name": "Redirect the payer",
							"event": [
								{
									"listen": "test",
									"script": {
										"exec": [
											""
										],
										"type": "text/javascript"
									}
								}
							],
							"protocolProfileBehavior": {
								"followRedirects": true,
								"disableUrlEncoding": false
							},
							"request": {
								"method": "GET",
								"header": [],
								"url": {
									"raw": "{{connect_url}}",
									"host": [
										"{{connect_url}}"
									]
								}
							},
							"response": []
						},
						{
							"name": "Verify the payment on callback",
							"event": [
								{
									"listen": "test",
									"script": {
										"exec": [
											""
										],
										"type": "text/javascript",
										"packages": {}
									}
								},
								{
									"listen": "prerequest",
									"script": {
										"exec": [
											"// Signature handling",
											"const req = pm.request;",
											"const sign = utils.signRequest(req);",
											"",
											"pm.collectionVariables.set(\"date\", sign.date);",
											"pm.collectionVariables.set(\"signature\", sign.signatureHeader);",
											"pm.collectionVariables.set(\"xRequestId\", sign.xRequestId);"
										],
										"type": "text/javascript",
										"packages": {}
									}
								}
							],
							"request": {
								"method": "GET",
								"header": [
									{
										"key": "Accept",
										"value": "application/json",
										"type": "text"
									},
									{
										"key": "Content-Type",
										"value": "application/json",
										"type": "text"
									},
									{
										"key": "Authorization",
										"value": "Bearer {{access_token}}",
										"type": "text"
									},
									{
										"key": "x-request-id",
										"value": "{{xRequestId}}",
										"type": "text"
									},
									{
										"key": "date",
										"value": "{{date}}",
										"type": "text"
									},
									{
										"key": "signature",
										"value": "{{signature}}",
										"type": "text"
									}
								],
								"url": {
									"raw": "{{API_BASE_URL}}/pis/v2/payments/{{session_id}}?with_beneficiary={{with_beneficiary}}&with_virtualbeneficiary={{with_virtualbeneficiary}}",
									"host": [
										"{{API_BASE_URL}}"
									],
									"path": [
										"pis",
										"v2",
										"payments",
										"{{session_id}}"
									],
									"query": [
										{
											"key": "with_beneficiary",
											"value": "{{with_beneficiary}}"
										},
										{
											"key": "with_virtualbeneficiary",
											"value": "{{with_virtualbeneficiary}}"
										}
									]
								}
							},
							"response": []
						}
					],
					"description": "[https://doc.fintecture.com/docs/api-initiate-an-immediate-payment<br><br>](https://doc.fintecture.com/docs/api-initiate-an-immediate-payment)Note: Sent payload for connect URL can be found in the Pre-Request script",
					"event": [
						{
							"listen": "prerequest",
							"script": {
								"type": "text/javascript",
								"exec": [
									""
								]
							}
						},
						{
							"listen": "test",
							"script": {
								"type": "text/javascript",
								"exec": [
									""
								]
							}
						}
					]
				},
				{
					"name": "Initiate a Request To Pay",
					"item": [
						{
							"name": "Request a PIS access token",
							"event": [
								{
									"listen": "prerequest",
									"script": {
										"exec": [
											"// Request a PIS access token",
											"const grant_type = \"client_credentials\";",
											"const scope = \"PIS\";",
											"",
											"// Register a client application and get its credentials",
											"const app_id = pm.collectionVariables.get(\"app_id\"); // mandatory",
											"const app_secret = pm.collectionVariables.get(\"app_secret\"); // mandatory",
											"",
											"// Encode your credentials using Base64",
											"let keys = app_id + \":\" + app_secret;",
											"let encodedKeys = CryptoJS.enc.Base64.stringify(CryptoJS.enc.Utf8.parse(keys));",
											"",
											"// Set Postman variables",
											"pm.collectionVariables.set(\"base64_token\", encodedKeys);",
											"pm.collectionVariables.set(\"grant_type\", grant_type);",
											"pm.collectionVariables.set(\"scope\", scope);",
											"",
											""
										],
										"type": "text/javascript",
										"packages": {}
									}
								},
								{
									"listen": "test",
									"script": {
										"exec": [
											"// Extract access_token & expires_in from provided response body",
											"const res = pm.response.json();",
											"",
											"const access_token = res.access_token;",
											"const expires_in = res.expires_in;",
											"",
											"// Set Postman variable",
											"pm.collectionVariables.set(\"access_token\", access_token);"
										],
										"type": "text/javascript",
										"packages": {}
									}
								}
							],
							"request": {
								"method": "POST",
								"header": [
									{
										"key": "Authorization",
										"value": "Basic {{base64_token}}",
										"type": "default"
									},
									{
										"key": "Accept",
										"value": "application/json",
										"type": "default"
									},
									{
										"key": "Content-Type",
										"value": "application/x-www-form-urlencoded",
										"type": "default"
									}
								],
								"body": {
									"mode": "urlencoded",
									"urlencoded": [
										{
											"key": "grant_type",
											"value": "client_credentials",
											"type": "default"
										},
										{
											"key": "scope",
											"value": "pis",
											"type": "default"
										},
										{
											"key": "app_id",
											"value": "{{app_id}}",
											"type": "default"
										}
									]
								},
								"url": {
									"raw": "{{API_BASE_URL}}/oauth/accesstoken",
									"host": [
										"{{API_BASE_URL}}"
									],
									"path": [
										"oauth",
										"accesstoken"
									]
								}
							},
							"response": []
						},
						{
							"name": "Initiate a Request To Pay",
							"event": [
								{
									"listen": "test",
									"script": {
										"exec": [
											"// Extract session_id & url from provided response body",
											"const res = pm.response.json();",
											"",
											"const session_id = res.meta.session_id;",
											"",
											"// Set Postman variables",
											"pm.collectionVariables.set(\"session_id\", session_id);"
										],
										"type": "text/javascript",
										"packages": {}
									}
								},
								{
									"listen": "prerequest",
									"script": {
										"exec": [
											"// Get collection variables",
											"const psu_type = pm.collectionVariables.get(\"psu_type\");",
											"const country_code = pm.collectionVariables.get(\"country_code\");",
											"const language = pm.collectionVariables.get(\"language\");",
											"const provider = pm.collectionVariables.get(\"provider\");",
											"",
											"const redirect_uri = pm.collectionVariables.get(\"redirect_uri\");",
											"if (!redirect_uri)",
											"    throw new Error(\"redirect_uri is missing\");",
											"const with_virtualbeneficiary = pm.collectionVariables.get(\"with_virtualbeneficiary\");",
											"const state = pm.collectionVariables.get(\"state\");",
											"if (!state)",
											"    throw new Error(\"state is missing\");",
											"",
											"// Fill headers",
											"const headers = {",
											"    'x-request_id': require('uuid').v4(),",
											"    'x-psu_type': psu_type ? psu_type : undefined,",
											"    \"x-country_code\": country_code ? country_code : undefined,",
											"    'x-language': language ? language : undefined, // mandatory",
											"    'x-provider': provider ? provider : undefined",
											"}",
											"Object.entries(headers).forEach(([key, value]) => {",
											"    if(!pm.request.headers.get(key) && value) ",
											"        pm.request.headers.add({key, value});",
											"});",
											"",
											"// Fill query parameters",
											"const query_params = {",
											"    'redirect_uri': redirect_uri,",
											"    'with_virtualbeneficiary': with_virtualbeneficiary ?  with_virtualbeneficiary : undefined ,",
											"    'state': state  // mandatory",
											"}",
											"Object.entries(query_params).forEach(([key, value]) => {",
											"    if(value) ",
											"        pm.request.url.query.add(key + \"=\" + value);",
											"});",
											"",
											"// Fill payload",
											"const b2c_mode = true;",
											"",
											"const b2c_body =  {",
											"     \"meta\": {",
											"          \"psu_name\": \"Julien Lefebre\",",
											"          \"psu_email\": \"julien.lefebre@gmail.com\",",
											"          \"psu_address\": {",
											"               \"number\": \"2\",",
											"               \"street\": \"rue Marie Stuart\",",
											"               \"zip\": \"75002\",",
											"               \"city\": \"PARIS\",",
											"               \"country\": \"FR\"",
											"          }",
											"     },",
											"     \"data\": {",
											"          \"type\": \"payments\",",
											"          \"attributes\": {",
											"               \"amount\": \"273\",",
											"               \"currency\": \"EUR\",",
											"               \"communication\": \"B34970692\"",
											"          }",
											"     }",
											"};",
											"",
											"const payload = JSON.stringify(b2c_body);",
											"",
											"pm.collectionVariables.set(\"payload\", payload);",
											"",
											"// Signature handling",
											"const req = pm.request;",
											"const sign = utils.signRequest(req);",
											"",
											"pm.collectionVariables.set(\"date\", sign.date);",
											"pm.collectionVariables.set(\"digest\", sign.digest);",
											"pm.collectionVariables.set(\"signature\", sign.signatureHeader);",
											"pm.collectionVariables.set(\"xRequestId\", sign.xRequestId);"
										],
										"type": "text/javascript",
										"packages": {}
									}
								}
							],
							"request": {
								"method": "POST",
								"header": [
									{
										"key": "Accept",
										"value": "application/json",
										"type": "text"
									},
									{
										"key": "Content-Type",
										"value": "application/json",
										"type": "text"
									},
									{
										"key": "authorization",
										"value": "Bearer {{access_token}}",
										"type": "text"
									},
									{
										"key": "x-request-id",
										"value": "{{xRequestId}}",
										"type": "text"
									},
									{
										"key": "date",
										"value": "{{date}}",
										"type": "text"
									},
									{
										"key": "signature",
										"value": "{{signature}}",
										"type": "text"
									},
									{
										"key": "digest",
										"value": "{{digest}}",
										"type": "text"
									}
								],
								"body": {
									"mode": "raw",
									"raw": "{{payload}}",
									"options": {
										"raw": {
											"language": "json"
										}
									}
								},
								"url": {
									"raw": "{{API_BASE_URL}}/pis/v2/request-to-pay",
									"host": [
										"{{API_BASE_URL}}"
									],
									"path": [
										"pis",
										"v2",
										"request-to-pay"
									]
								}
							},
							"response": []
						},
						{
							"name": "Check the payment's status",
							"event": [
								{
									"listen": "test",
									"script": {
										"exec": [
											""
										],
										"type": "text/javascript",
										"packages": {}
									}
								},
								{
									"listen": "prerequest",
									"script": {
										"exec": [
											"// Signature handling",
											"const req = pm.request;",
											"const sign = utils.signRequest(req);",
											"",
											"pm.collectionVariables.set(\"date\", sign.date);",
											"pm.collectionVariables.set(\"signature\", sign.signatureHeader);",
											"pm.collectionVariables.set(\"xRequestId\", sign.xRequestId);"
										],
										"type": "text/javascript",
										"packages": {}
									}
								}
							],
							"request": {
								"method": "GET",
								"header": [
									{
										"key": "Accept",
										"value": "application/json",
										"type": "text"
									},
									{
										"key": "Content-Type",
										"value": "application/json",
										"type": "default"
									},
									{
										"key": "Authorization",
										"value": "Bearer {{access_token}}",
										"type": "text"
									},
									{
										"key": "date",
										"value": "{{date}}",
										"type": "text"
									},
									{
										"key": "signature",
										"value": "{{signature}}",
										"type": "text"
									},
									{
										"key": "x-request-id",
										"value": "{{xRequestId}}",
										"type": "text"
									}
								],
								"url": {
									"raw": "{{API_BASE_URL}}/pis/v2/payments/{{session_id}}?with_beneficiary={{with_beneficiary}}&with_virtualbeneficiary={{with_virtualbeneficiary}}",
									"host": [
										"{{API_BASE_URL}}"
									],
									"path": [
										"pis",
										"v2",
										"payments",
										"{{session_id}}"
									],
									"query": [
										{
											"key": "with_beneficiary",
											"value": "{{with_beneficiary}}"
										},
										{
											"key": "with_virtualbeneficiary",
											"value": "{{with_virtualbeneficiary}}"
										}
									]
								}
							},
							"response": []
						}
					],
					"description": "[https://doc.fintecture.com/docs/api-initiate-a-request-to-pay](https://doc.fintecture.com/docs/api-initiate-a-request-to-pay)\n\nNote: Sent payload for Request To Pay can be found in the Pre-Request script"
				},
				{
					"name": "Initiate a Buy Now Pay Later payment",
					"item": [
						{
							"name": "Request a PIS access token",
							"event": [
								{
									"listen": "prerequest",
									"script": {
										"exec": [
											"// Request a PIS access token",
											"const grant_type = \"client_credentials\";",
											"const scope = \"PIS\";",
											"",
											"// Register a client application and get its credentials",
											"const app_id = pm.collectionVariables.get(\"app_id\"); // mandatory",
											"const app_secret = pm.collectionVariables.get(\"app_secret\"); // mandatory",
											"",
											"// Encode your credentials using Base64",
											"let keys = app_id + \":\" + app_secret;",
											"let encodedKeys = CryptoJS.enc.Base64.stringify(CryptoJS.enc.Utf8.parse(keys));",
											"",
											"// Set Postman variables",
											"pm.collectionVariables.set(\"base64_token\", encodedKeys);",
											"pm.collectionVariables.set(\"grant_type\", grant_type);",
											"pm.collectionVariables.set(\"scope\", scope);",
											"",
											"",
											""
										],
										"type": "text/javascript",
										"packages": {}
									}
								},
								{
									"listen": "test",
									"script": {
										"exec": [
											"// Extract access_token & expires_in from provided response body",
											"const res = pm.response.json();",
											"",
											"const access_token = res.access_token;",
											"const expires_in = res.expires_in;",
											"",
											"// Set Postman variable",
											"pm.collectionVariables.set(\"access_token\", access_token);"
										],
										"type": "text/javascript",
										"packages": {}
									}
								}
							],
							"request": {
								"method": "POST",
								"header": [
									{
										"key": "Authorization",
										"value": "Basic {{base64_token}}",
										"type": "default"
									},
									{
										"key": "Accept",
										"value": "application/json",
										"type": "default"
									},
									{
										"key": "Content-Type",
										"value": "application/x-www-form-urlencoded",
										"type": "default"
									}
								],
								"body": {
									"mode": "urlencoded",
									"urlencoded": [
										{
											"key": "grant_type",
											"value": "client_credentials",
											"type": "default"
										},
										{
											"key": "scope",
											"value": "pis",
											"type": "default"
										},
										{
											"key": "app_id",
											"value": "{{app_id}}",
											"type": "default"
										}
									]
								},
								"url": {
									"raw": "{{API_BASE_URL}}/oauth/accesstoken",
									"host": [
										"{{API_BASE_URL}}"
									],
									"path": [
										"oauth",
										"accesstoken"
									]
								}
							},
							"response": []
						},
						{
							"name": "Build the BNPL connect URL",
							"event": [
								{
									"listen": "test",
									"script": {
										"exec": [
											"// Extract session_id & url from provided response body",
											"const res = pm.response.json();",
											"",
											"const session_id = res.meta.session_id;",
											"",
											"// Set Postman variables",
											"pm.collectionVariables.set(\"session_id\", session_id);"
										],
										"type": "text/javascript",
										"packages": {}
									}
								},
								{
									"listen": "prerequest",
									"script": {
										"exec": [
											"// Get collection variables",
											"const psu_type = pm.collectionVariables.get(\"psu_type\");",
											"const country_code = pm.collectionVariables.get(\"country_code\");",
											"const language = pm.collectionVariables.get(\"language\");",
											"const provider = pm.collectionVariables.get(\"provider\");",
											"",
											"const redirect_uri = pm.collectionVariables.get(\"redirect_uri\");",
											"const origin_uri = pm.collectionVariables.get(\"origin_uri\");",
											"const state = pm.collectionVariables.get(\"state\");",
											"if (!state)",
											"    throw new Error(\"state is missing\");",
											"",
											"// Fill headers",
											"const headers = {",
											"    'x-request_id': require('uuid').v4(),",
											"    'x-psu_type': psu_type ? psu_type : undefined,",
											"    \"x-country_code\": country_code ? country_code : undefined,",
											"    'x-language': language ? language : undefined,",
											"    'x-provider': provider ? provider : undefined",
											"}",
											"Object.entries(headers).forEach(([key, value]) => {",
											"    if(!pm.request.headers.get(key) && value) ",
											"        pm.request.headers.add({key, value});",
											"});",
											"",
											"// Fill query parameters",
											"const query_params = {",
											"    'redirect_uri': redirect_uri ?  redirect_uri : undefined,",
											"    'origin_uri': origin_uri ?  origin_uri : undefined ,",
											"    'state': state // mandatory",
											"}",
											"",
											"Object.entries(query_params).forEach(([key, value]) => {",
											"    if(value) ",
											"        pm.request.url.query.add(key + \"=\" + value);",
											"});",
											"",
											"// Fill payload",
											"const b2b_body =  {",
											"     \"meta\": {",
											"          \"psu_name\": \"Julien Lefebre\",",
											"          \"psu_email\": \"julien.lefebre@my-business.com\",",
											"          \"psu_company\": \"My Business SARL\",",
											"          \"psu_incorporation\": \"524335262\",",
											"          \"type\": \"BuyNowPayLater\"",
											"     },",
											"     \"data\": {",
											"          \"type\": \"payments\",",
											"          \"attributes\": {",
											"               \"amount\": \"273\",",
											"               \"currency\": \"EUR\",",
											"               \"communication\": \"B34970692\"",
											"          }",
											"     }",
											"};",
											"",
											"const payload = JSON.stringify(b2b_body);",
											"",
											"pm.collectionVariables.set(\"payload\", payload);",
											"",
											"// Signature handling",
											"const req = pm.request;",
											"const sign = utils.signRequest(req);",
											"",
											"pm.collectionVariables.set(\"date\", sign.date);",
											"pm.collectionVariables.set(\"digest\", sign.digest);",
											"pm.collectionVariables.set(\"signature\", sign.signatureHeader);",
											"pm.collectionVariables.set(\"xRequestId\", sign.xRequestId);"
										],
										"type": "text/javascript",
										"packages": {}
									}
								}
							],
							"request": {
								"method": "POST",
								"header": [
									{
										"key": "Accept",
										"value": "application/json",
										"type": "text"
									},
									{
										"key": "Content-Type",
										"value": "application/json",
										"type": "text"
									},
									{
										"key": "authorization",
										"value": "Bearer {{access_token}}",
										"type": "text"
									},
									{
										"key": "x-request-id",
										"value": "{{xRequestId}}",
										"type": "text"
									},
									{
										"key": "date",
										"value": "{{date}}",
										"type": "text"
									},
									{
										"key": "signature",
										"value": "{{signature}}",
										"type": "text"
									},
									{
										"key": "digest",
										"value": "{{digest}}",
										"type": "text"
									}
								],
								"body": {
									"mode": "raw",
									"raw": "{{payload}}",
									"options": {
										"raw": {
											"language": "json"
										}
									}
								},
								"url": {
									"raw": "{{API_BASE_URL}}/pis/v2/connect",
									"host": [
										"{{API_BASE_URL}}"
									],
									"path": [
										"pis",
										"v2",
										"connect"
									]
								}
							},
							"response": []
						},
						{
							"name": "Redirect the payer",
							"event": [
								{
									"listen": "test",
									"script": {
										"exec": [
											""
										],
										"type": "text/javascript"
									}
								}
							],
							"protocolProfileBehavior": {
								"followRedirects": true,
								"disableUrlEncoding": false
							},
							"request": {
								"method": "GET",
								"header": [],
								"url": {
									"raw": "{{connect_url}}",
									"host": [
										"{{connect_url}}"
									]
								}
							},
							"response": []
						},
						{
							"name": "Verify the payment on callback",
							"event": [
								{
									"listen": "test",
									"script": {
										"exec": [
											""
										],
										"type": "text/javascript",
										"packages": {}
									}
								},
								{
									"listen": "prerequest",
									"script": {
										"exec": [
											"// Signature handling",
											"const req = pm.request;",
											"const sign = utils.signRequest(req);",
											"",
											"pm.collectionVariables.set(\"date\", sign.date);",
											"pm.collectionVariables.set(\"signature\", sign.signatureHeader);",
											"pm.collectionVariables.set(\"xRequestId\", sign.xRequestId);"
										],
										"type": "text/javascript",
										"packages": {}
									}
								}
							],
							"request": {
								"method": "GET",
								"header": [
									{
										"key": "Accept",
										"value": "application/json",
										"type": "text"
									},
									{
										"key": "Content-Type",
										"value": "application/json",
										"type": "text"
									},
									{
										"key": "Authorization",
										"value": "Bearer {{access_token}}",
										"type": "text"
									},
									{
										"key": "x-request-id",
										"value": "{{xRequestId}}",
										"type": "text"
									},
									{
										"key": "date",
										"value": "{{date}}",
										"type": "text"
									},
									{
										"key": "signature",
										"value": "{{signature}}",
										"type": "text"
									}
								],
								"url": {
									"raw": "{{API_BASE_URL}}/pis/v2/payments/{{session_id}}?with_beneficiary={{with_beneficiary}}&with_virtualbeneficiary={{with_virtualbeneficiary}}",
									"host": [
										"{{API_BASE_URL}}"
									],
									"path": [
										"pis",
										"v2",
										"payments",
										"{{session_id}}"
									],
									"query": [
										{
											"key": "with_beneficiary",
											"value": "{{with_beneficiary}}"
										},
										{
											"key": "with_virtualbeneficiary",
											"value": "{{with_virtualbeneficiary}}"
										}
									]
								}
							},
							"response": []
						}
					],
					"description": "[https://doc.fintecture.com/v2-b/docs/api-initiate-a-buy-now-pay-later<br><br>](https://doc.fintecture.com/v2-b/docs/api-initiate-a-buy-now-pay-later)Note: Sent payload for BNPL can be found in the Pre-Request script"
				},
				{
					"name": "Initiate a Smart transfer",
					"item": [
						{
							"name": "Request a PIS access token",
							"event": [
								{
									"listen": "prerequest",
									"script": {
										"exec": [
											"// Request a PIS access token",
											"const grant_type = \"client_credentials\";",
											"const scope = \"PIS\";",
											"",
											"// Register a client application and get its credentials",
											"const app_id = pm.collectionVariables.get(\"app_id\"); // mandatory",
											"const app_secret = pm.collectionVariables.get(\"app_secret\"); // mandatory",
											"",
											"// Encode your credentials using Base64",
											"let keys = app_id + \":\" + app_secret;",
											"let encodedKeys = CryptoJS.enc.Base64.stringify(CryptoJS.enc.Utf8.parse(keys));",
											"",
											"// Set Postman variables",
											"pm.collectionVariables.set(\"base64_token\", encodedKeys);",
											"pm.collectionVariables.set(\"grant_type\", grant_type);",
											"pm.collectionVariables.set(\"scope\", scope);",
											"",
											"",
											""
										],
										"type": "text/javascript",
										"packages": {}
									}
								},
								{
									"listen": "test",
									"script": {
										"exec": [
											"// Extract access_token & expires_in from provided response body",
											"const res = pm.response.json();",
											"",
											"const access_token = res.access_token;",
											"const expires_in = res.expires_in;",
											"",
											"// Set Postman variable",
											"pm.collectionVariables.set(\"access_token\", access_token);"
										],
										"type": "text/javascript",
										"packages": {}
									}
								}
							],
							"request": {
								"method": "POST",
								"header": [
									{
										"key": "Authorization",
										"value": "Basic {{base64_token}}",
										"type": "default"
									},
									{
										"key": "Accept",
										"value": "application/json",
										"type": "default"
									},
									{
										"key": "Content-Type",
										"value": "application/x-www-form-urlencoded",
										"type": "default"
									}
								],
								"body": {
									"mode": "urlencoded",
									"urlencoded": [
										{
											"key": "grant_type",
											"value": "client_credentials",
											"type": "default"
										},
										{
											"key": "scope",
											"value": "pis",
											"type": "default"
										},
										{
											"key": "app_id",
											"value": "{{app_id}}",
											"type": "default"
										}
									]
								},
								"url": {
									"raw": "{{API_BASE_URL}}/oauth/accesstoken",
									"host": [
										"{{API_BASE_URL}}"
									],
									"path": [
										"oauth",
										"accesstoken"
									]
								}
							},
							"response": []
						},
						{
							"name": "Create the connect URL",
							"event": [
								{
									"listen": "test",
									"script": {
										"exec": [
											"// Extract session_id & url from provided response body",
											"const res = pm.response.json();",
											"",
											"const session_id = res.meta.session_id;",
											"",
											"// Set Postman variables",
											"pm.collectionVariables.set(\"session_id\", session_id);"
										],
										"type": "text/javascript",
										"packages": {}
									}
								},
								{
									"listen": "prerequest",
									"script": {
										"exec": [
											"// Get collection variables",
											"const psu_type = pm.collectionVariables.get(\"psu_type\");",
											"const country_code = pm.collectionVariables.get(\"country_code\");",
											"const language = pm.collectionVariables.get(\"language\");",
											"const provider = pm.collectionVariables.get(\"provider\");",
											"",
											"const redirect_uri = pm.collectionVariables.get(\"redirect_uri\");",
											"if (!redirect_uri)",
											"    throw new Error(\"redirect_uri is missing\");",
											"const origin_uri = pm.collectionVariables.get(\"origin_uri\");",
											"const with_virtualbeneficiary = pm.collectionVariables.get(\"with_virtualbeneficiary\");",
											"const state = pm.collectionVariables.get(\"state\");",
											"if (!state)",
											"    throw new Error(\"state is missing\");",
											"",
											"// Fill headers",
											"const headers = {",
											"    'x-request_id': require('uuid').v4(),",
											"    'x-psu_type': psu_type ? psu_type : undefined,",
											"    \"x-country_code\": country_code ? country_code : undefined,",
											"    'x-language': language ? language : undefined,",
											"    'x-provider': provider ? provider : undefined",
											"}",
											"Object.entries(headers).forEach(([key, value]) => {",
											"    if(!pm.request.headers.get(key) && value) ",
											"        pm.request.headers.add({key, value});",
											"});",
											"",
											"// Fill query parameters",
											"const query_params = {",
											"    'redirect_uri': redirect_uri,",
											"    'origin_uri': origin_uri ?  origin_uri : undefined ,",
											"    'with_virtualbeneficiary': with_virtualbeneficiary ?  with_virtualbeneficiary : undefined ,",
											"    'state': state  // mandatory",
											"}",
											"Object.entries(query_params).forEach(([key, value]) => {",
											"    if(value) ",
											"        pm.request.url.query.add(key + \"=\" + value);",
											"});",
											"",
											"// Fill payload",
											"const b2c_mode = true;",
											"",
											"const b2c_body =  {",
											"    \"meta\": {",
											"        \"psu_name\": \"Julien Lefebre\",",
											"        \"psu_email\": \"julien.lefebre@gmail.com\",",
											"        \"psu_address\": {",
											"            \"number\": \"2\",",
											"            \"street\": \"rue Marie Stuart\",",
											"            \"zip\": \"75002\",",
											"            \"city\": \"PARIS\",",
											"            \"country\": \"FR\"",
											"        },",
											"        \"reconciliation\": {",
											"            \"level\": \"key\",",
											"            \"key\": \"my_key\"",
											"        }",
											"    },",
											"    \"data\": {",
											"        \"type\": \"payments\",",
											"        \"attributes\": {",
											"            \"amount\": \"273\",",
											"            \"currency\": \"EUR\",",
											"            \"communication\": \"B34970692\"",
											"        }",
											"    }",
											"};",
											"",
											"const b2b_body = {",
											"    \"meta\": {",
											"        \"psu_name\": \"Julien Lefebre\",",
											"        \"psu_email\": \"julien.lefebre@my-business-sarl.com\",",
											"        \"psu_company\": \"My Business SARL\",",
											"        \"psu_incorporation\": \"123456789\",",
											"        \"psu_address\": {",
											"            \"number\": \"2\",",
											"            \"street\": \"rue Marie Stuart\",",
											"            \"zip\": \"75002\",",
											"            \"city\": \"PARIS\",",
											"            \"country\": \"FR\"",
											"        },",
											"        \"reconciliation\": {",
											"            \"level\": \"key\",",
											"            \"key\": \"my_key\"",
											"        }",
											"    },",
											"    \"data\": {",
											"        \"type\": \"payments\",",
											"        \"attributes\": {",
											"            \"amount\": \"273\",",
											"            \"currency\": \"EUR\",",
											"            \"communication\": \"B34970692\"",
											"        }",
											"    }",
											"};",
											"",
											"const payload = b2c_mode ? JSON.stringify(b2c_body) : JSON.stringify(b2b_body);",
											"",
											"pm.collectionVariables.set(\"payload\", payload);",
											"",
											"// Signature handling",
											"const req = pm.request;",
											"const sign = utils.signRequest(req);",
											"",
											"pm.collectionVariables.set(\"date\", sign.date);",
											"pm.collectionVariables.set(\"digest\", sign.digest);",
											"pm.collectionVariables.set(\"signature\", sign.signatureHeader);",
											"pm.collectionVariables.set(\"xRequestId\", sign.xRequestId);"
										],
										"type": "text/javascript",
										"packages": {}
									}
								}
							],
							"request": {
								"method": "POST",
								"header": [
									{
										"key": "Accept",
										"value": "application/json",
										"type": "text"
									},
									{
										"key": "Content-Type",
										"value": "application/json",
										"type": "text"
									},
									{
										"key": "authorization",
										"value": "Bearer {{access_token}}",
										"type": "text"
									},
									{
										"key": "x-request-id",
										"value": "{{xRequestId}}",
										"type": "text"
									},
									{
										"key": "date",
										"value": "{{date}}",
										"type": "text"
									},
									{
										"key": "signature",
										"value": "{{signature}}",
										"type": "text"
									},
									{
										"key": "digest",
										"value": "{{digest}}",
										"type": "text"
									}
								],
								"body": {
									"mode": "raw",
									"raw": "{{payload}}",
									"options": {
										"raw": {
											"language": "json"
										}
									}
								},
								"url": {
									"raw": "{{API_BASE_URL}}/pis/v2/connect",
									"host": [
										"{{API_BASE_URL}}"
									],
									"path": [
										"pis",
										"v2",
										"connect"
									]
								}
							},
							"response": []
						},
						{
							"name": "Redirect the payer",
							"event": [
								{
									"listen": "test",
									"script": {
										"exec": [
											""
										],
										"type": "text/javascript"
									}
								}
							],
							"protocolProfileBehavior": {
								"followRedirects": true,
								"disableUrlEncoding": false
							},
							"request": {
								"method": "GET",
								"header": [],
								"url": {
									"raw": "{{connect_url}}",
									"host": [
										"{{connect_url}}"
									]
								}
							},
							"response": []
						},
						{
							"name": "Verify the payment on callback",
							"event": [
								{
									"listen": "test",
									"script": {
										"exec": [
											""
										],
										"type": "text/javascript",
										"packages": {}
									}
								},
								{
									"listen": "prerequest",
									"script": {
										"exec": [
											"// Signature handling",
											"const req = pm.request;",
											"const sign = utils.signRequest(req);",
											"",
											"pm.collectionVariables.set(\"date\", sign.date);",
											"pm.collectionVariables.set(\"signature\", sign.signatureHeader);",
											"pm.collectionVariables.set(\"xRequestId\", sign.xRequestId);"
										],
										"type": "text/javascript",
										"packages": {}
									}
								}
							],
							"request": {
								"method": "GET",
								"header": [
									{
										"key": "Accept",
										"value": "application/json",
										"type": "text"
									},
									{
										"key": "Content-Type",
										"value": "application/json",
										"type": "text"
									},
									{
										"key": "Authorization",
										"value": "Bearer {{access_token}}",
										"type": "text"
									},
									{
										"key": "x-request-id",
										"value": "{{xRequestId}}",
										"type": "text"
									},
									{
										"key": "date",
										"value": "{{date}}",
										"type": "text"
									},
									{
										"key": "signature",
										"value": "{{signature}}",
										"type": "text"
									}
								],
								"url": {
									"raw": "{{API_BASE_URL}}/pis/v2/payments/{{session_id}}?with_beneficiary={{with_beneficiary}}&with_virtualbeneficiary={{with_virtualbeneficiary}}",
									"host": [
										"{{API_BASE_URL}}"
									],
									"path": [
										"pis",
										"v2",
										"payments",
										"{{session_id}}"
									],
									"query": [
										{
											"key": "with_beneficiary",
											"value": "{{with_beneficiary}}"
										},
										{
											"key": "with_virtualbeneficiary",
											"value": "{{with_virtualbeneficiary}}"
										}
									]
								}
							},
							"response": []
						}
					],
					"description": "[https://doc.fintecture.com/docs/api-initiate-a-smart-transfer<br><br>](https://doc.fintecture.com/docs/api-initiate-a-smart-transfer)Note: Sent payload for Smart Transfer can be found in the Pre-Request script"
				},
				{
					"name": "Inititate an Immediate Refund",
					"item": [
						{
							"name": "Request a PIS access token",
							"event": [
								{
									"listen": "prerequest",
									"script": {
										"exec": [
											"// Request a PIS access token",
											"const grant_type = \"client_credentials\";",
											"const scope = \"PIS\";",
											"",
											"// Register a client application and get its credentials",
											"const app_id = pm.collectionVariables.get(\"app_id\"); // mandatory",
											"const app_secret = pm.collectionVariables.get(\"app_secret\"); // mandatory",
											"",
											"// Encode your credentials using Base64",
											"let keys = app_id + \":\" + app_secret;",
											"let encodedKeys = CryptoJS.enc.Base64.stringify(CryptoJS.enc.Utf8.parse(keys));",
											"",
											"// Set Postman variables",
											"pm.collectionVariables.set(\"base64_token\", encodedKeys);",
											"pm.collectionVariables.set(\"grant_type\", grant_type);",
											"pm.collectionVariables.set(\"scope\", scope);",
											"",
											""
										],
										"type": "text/javascript",
										"packages": {}
									}
								},
								{
									"listen": "test",
									"script": {
										"exec": [
											"// Extract access_token & expires_in from provided response body",
											"const res = pm.response.json();",
											"",
											"const access_token = res.access_token;",
											"const expires_in = res.expires_in;",
											"",
											"// Set Postman variable",
											"pm.collectionVariables.set(\"access_token\", access_token);"
										],
										"type": "text/javascript",
										"packages": {}
									}
								}
							],
							"request": {
								"method": "POST",
								"header": [
									{
										"key": "Authorization",
										"value": "Basic {{base64_token}}",
										"type": "default"
									},
									{
										"key": "Accept",
										"value": "application/json",
										"type": "default"
									},
									{
										"key": "Content-Type",
										"value": "application/x-www-form-urlencoded",
										"type": "default"
									}
								],
								"body": {
									"mode": "urlencoded",
									"urlencoded": [
										{
											"key": "grant_type",
											"value": "client_credentials",
											"type": "default"
										},
										{
											"key": "scope",
											"value": "pis",
											"type": "default"
										},
										{
											"key": "app_id",
											"value": "{{app_id}}",
											"type": "default"
										}
									]
								},
								"url": {
									"raw": "{{API_BASE_URL}}/oauth/accesstoken",
									"host": [
										"{{API_BASE_URL}}"
									],
									"path": [
										"oauth",
										"accesstoken"
									]
								}
							},
							"response": []
						},
						{
							"name": "Trigger the refund providing the session_id of the original payment",
							"event": [
								{
									"listen": "test",
									"script": {
										"exec": [
											""
										],
										"type": "text/javascript",
										"packages": {}
									}
								},
								{
									"listen": "prerequest",
									"script": {
										"exec": [
											"// Get collection variables",
											"const psu_type = pm.collectionVariables.get(\"psu_type\");",
											"const country_code = pm.collectionVariables.get(\"country_code\");",
											"const language = pm.collectionVariables.get(\"language\");",
											"const provider = pm.collectionVariables.get(\"provider\");",
											"",
											"const redirect_uri = pm.collectionVariables.get(\"redirect_uri\");",
											"if (!redirect_uri)",
											"    throw new Error(\"redirect_uri is missing\");",
											"const origin_uri = pm.collectionVariables.get(\"origin_uri\");",
											"const with_beneficiary = pm.collectionVariables.get(\"with_beneficiary\");",
											"const with_virtualbeneficiary = pm.collectionVariables.get(\"with_virtualbeneficiary\");",
											"const state = pm.collectionVariables.get(\"state\");",
											"if (!state)",
											"    throw new Error(\"state is missing\");",
											"",
											"// Fill headers",
											"const headers = {",
											"    'x-request_id': require('uuid').v4(),",
											"    'x-psu_type': psu_type ? psu_type : undefined,",
											"    \"x-country_code\": country_code ? country_code : undefined,",
											"    'x-language': language ? language : undefined,",
											"    'x-provider': provider ? provider : undefined",
											"}",
											"Object.entries(headers).forEach(([key, value]) => {",
											"    if(!pm.request.headers.get(key) && value) ",
											"        pm.request.headers.add({key, value});",
											"});",
											"",
											"// Fill query parameters",
											"const query_params = {",
											"    'redirect_uri': redirect_uri, // mandatory",
											"    'origin_uri': origin_uri ?  origin_uri : undefined ,",
											"    \"with_beneficiary\": with_beneficiary ?  with_beneficiary : undefined ,",
											"    'with_virtualbeneficiary': with_virtualbeneficiary ?  with_virtualbeneficiary : undefined ,",
											"    'state': state  // mandatory",
											"}",
											"Object.entries(query_params).forEach(([key, value]) => {",
											"    if(value) ",
											"        pm.request.url.query.add(key + \"=\" + value);",
											"});",
											"",
											"// Fill payload",
											"const body =  {",
											"    \"meta\": {",
											"        \"session_id\": \"e968987c1d004c51a3457bd14b36d503\"",
											"    },",
											"    \"data\": {",
											"        \"type\": \"payments\",",
											"        \"attributes\": {",
											"            \"amount\": \"273\",",
											"            \"currency\": \"EUR\",",
											"            \"communication\": \"B34970692\"",
											"        }",
											"    }",
											"};",
											"",
											"const payload = JSON.stringify(body);",
											"",
											"pm.collectionVariables.set(\"payload\", payload);",
											"",
											"// Signature handling",
											"const req = pm.request;",
											"const sign = utils.signRequest(req);",
											"",
											"pm.collectionVariables.set(\"date\", sign.date);",
											"pm.collectionVariables.set(\"digest\", sign.digest);",
											"pm.collectionVariables.set(\"signature\", sign.signatureHeader);",
											"pm.collectionVariables.set(\"xRequestId\", sign.xRequestId);"
										],
										"type": "text/javascript",
										"packages": {}
									}
								}
							],
							"request": {
								"method": "POST",
								"header": [
									{
										"key": "Accept",
										"value": "application/json",
										"type": "text"
									},
									{
										"key": "Content-Type",
										"value": "application/json",
										"type": "text"
									},
									{
										"key": "authorization",
										"value": "Bearer {{access_token}}",
										"type": "text"
									},
									{
										"key": "x-request-id",
										"value": "{{xRequestId}}",
										"type": "text"
									},
									{
										"key": "date",
										"value": "{{date}}",
										"type": "text"
									},
									{
										"key": "signature",
										"value": "{{signature}}",
										"type": "text"
									},
									{
										"key": "digest",
										"value": "{{digest}}",
										"type": "text"
									}
								],
								"body": {
									"mode": "raw",
									"raw": "{{payload}}",
									"options": {
										"raw": {
											"language": "json"
										}
									}
								},
								"url": {
									"raw": "{{API_BASE_URL}}/pis/v2/refund",
									"host": [
										"{{API_BASE_URL}}"
									],
									"path": [
										"pis",
										"v2",
										"refund"
									]
								}
							},
							"response": []
						},
						{
							"name": "Verify the payment on callback",
							"event": [
								{
									"listen": "test",
									"script": {
										"exec": [
											""
										],
										"type": "text/javascript",
										"packages": {}
									}
								},
								{
									"listen": "prerequest",
									"script": {
										"exec": [
											"// Signature handling",
											"const req = pm.request;",
											"const sign = utils.signRequest(req);",
											"",
											"pm.collectionVariables.set(\"date\", sign.date);",
											"pm.collectionVariables.set(\"signature\", sign.signatureHeader);",
											"pm.collectionVariables.set(\"xRequestId\", sign.xRequestId);"
										],
										"type": "text/javascript",
										"packages": {}
									}
								}
							],
							"request": {
								"method": "GET",
								"header": [
									{
										"key": "Accept",
										"value": "application/json",
										"type": "text"
									},
									{
										"key": "Content-Type",
										"value": "application/json",
										"type": "text"
									},
									{
										"key": "Authorization",
										"value": "Bearer {{access_token}}",
										"type": "text"
									},
									{
										"key": "x-request-id",
										"value": "{{xRequestId}}",
										"type": "text"
									},
									{
										"key": "date",
										"value": "{{date}}",
										"type": "text"
									},
									{
										"key": "signature",
										"value": "{{signature}}",
										"type": "text"
									}
								],
								"url": {
									"raw": "{{API_BASE_URL}}/pis/v2/payments/{{session_id}}?with_beneficiary={{with_beneficiary}}&with_virtualbeneficiary={{with_virtualbeneficiary}}",
									"host": [
										"{{API_BASE_URL}}"
									],
									"path": [
										"pis",
										"v2",
										"payments",
										"{{session_id}}"
									],
									"query": [
										{
											"key": "with_beneficiary",
											"value": "{{with_beneficiary}}"
										},
										{
											"key": "with_virtualbeneficiary",
											"value": "{{with_virtualbeneficiary}}"
										}
									]
								}
							},
							"response": []
						}
					],
					"description": "[https://doc.fintecture.com/docs/api-initiate-an-immediate-refund<br><br>](https://doc.fintecture.com/docs/api-initiate-an-immediate-refund)Note: Sent payload for Immediate refund can be found in the Pre-Request script"
				},
				{
					"name": "Inititate a Verified Payout",
					"item": [
						{
							"name": "Request a PIS access token",
							"event": [
								{
									"listen": "prerequest",
									"script": {
										"exec": [
											"// Request a PIS access token",
											"const grant_type = \"client_credentials\";",
											"const scope = \"PIS\";",
											"",
											"// Register a client application and get its credentials",
											"const app_id = pm.collectionVariables.get(\"app_id\"); // mandatory",
											"const app_secret = pm.collectionVariables.get(\"app_secret\"); // mandatory",
											"",
											"// Encode your credentials using Base64",
											"let keys = app_id + \":\" + app_secret;",
											"let encodedKeys = CryptoJS.enc.Base64.stringify(CryptoJS.enc.Utf8.parse(keys));",
											"",
											"// Set Postman variables",
											"pm.collectionVariables.set(\"base64_token\", encodedKeys);",
											"pm.collectionVariables.set(\"grant_type\", grant_type);",
											"pm.collectionVariables.set(\"scope\", scope);",
											"",
											""
										],
										"type": "text/javascript",
										"packages": {}
									}
								},
								{
									"listen": "test",
									"script": {
										"exec": [
											"// Extract access_token & expires_in from provided response body",
											"const res = pm.response.json();",
											"",
											"const access_token = res.access_token;",
											"const expires_in = res.expires_in;",
											"",
											"// Set Postman variable",
											"pm.collectionVariables.set(\"access_token\", access_token);"
										],
										"type": "text/javascript",
										"packages": {}
									}
								}
							],
							"request": {
								"method": "POST",
								"header": [
									{
										"key": "Authorization",
										"value": "Basic {{base64_token}}",
										"type": "default"
									},
									{
										"key": "Accept",
										"value": "application/json",
										"type": "default"
									},
									{
										"key": "Content-Type",
										"value": "application/x-www-form-urlencoded",
										"type": "default"
									}
								],
								"body": {
									"mode": "urlencoded",
									"urlencoded": [
										{
											"key": "grant_type",
											"value": "client_credentials",
											"type": "default"
										},
										{
											"key": "scope",
											"value": "pis",
											"type": "default"
										},
										{
											"key": "app_id",
											"value": "{{app_id}}",
											"type": "default"
										}
									]
								},
								"url": {
									"raw": "{{API_BASE_URL}}/oauth/accesstoken",
									"host": [
										"{{API_BASE_URL}}"
									],
									"path": [
										"oauth",
										"accesstoken"
									]
								}
							},
							"response": []
						},
						{
							"name": "Create a Request For Payout",
							"event": [
								{
									"listen": "test",
									"script": {
										"exec": [
											"// Extract session_id & url from provided response body",
											"const res = pm.response.json();",
											"",
											"const session_id = res.meta.session_id;",
											"",
											"// Set Postman variables",
											"pm.collectionVariables.set(\"session_id\", session_id);"
										],
										"type": "text/javascript",
										"packages": {}
									}
								},
								{
									"listen": "prerequest",
									"script": {
										"exec": [
											"// Get collection variables",
											"const redirect_uri = pm.collectionVariables.get(\"redirect_uri\");",
											"if (!redirect_uri)",
											"    throw new Error(\"redirect_uri is missing\");",
											"const with_beneficiary = pm.collectionVariables.get(\"with_beneficiary\");",
											"const state = pm.collectionVariables.get(\"state\");",
											"if (!state)",
											"    throw new Error(\"state is missing\");",
											"",
											"// Fill query parameters",
											"const query_params = {",
											"    'redirect_uri': redirect_uri, // mandatory",
											"    'state': state  // mandatory",
											"}",
											"",
											"Object.entries(query_params).forEach(([key, value]) => {",
											"    if(value) ",
											"        pm.request.url.query.add(key + \"=\" + value);",
											"});",
											"",
											"// Fill payload",
											"const body =  {",
											"\t\"meta\": {",
											"\t\t\"psu_name\": \"John Doe\",",
											"\t\t\"psu_email\": \"john@doe.com\",",
											"\t\t\"expiry\": 604800,",
											"\t\t\"method\": \"link\"",
											"\t},",
											"\t\"data\": {",
											"        \"type\": \"payments\",",
											"            \"attributes\": {",
											"                \"amount\": \"291\",",
											"                \"currency\": \"EUR\",",
											"                \"communication\": \"MyShop REFUND from Order 123\"",
											"            }",
											"        }",
											"}",
											"",
											"const payload = JSON.stringify(body);",
											"",
											"pm.collectionVariables.set(\"payload\", payload);",
											"",
											"// Signature handling",
											"const req = pm.request;",
											"const sign = utils.signRequest(req);",
											"",
											"pm.collectionVariables.set(\"date\", sign.date);",
											"pm.collectionVariables.set(\"digest\", sign.digest);",
											"pm.collectionVariables.set(\"signature\", sign.signatureHeader);",
											"pm.collectionVariables.set(\"xRequestId\", sign.xRequestId);"
										],
										"type": "text/javascript",
										"packages": {}
									}
								}
							],
							"request": {
								"method": "POST",
								"header": [
									{
										"key": "Accept",
										"value": "application/json",
										"type": "text"
									},
									{
										"key": "Content-Type",
										"value": "application/json",
										"type": "text"
									},
									{
										"key": "authorization",
										"value": "Bearer {{access_token}}",
										"type": "text"
									},
									{
										"key": "x-request-id",
										"value": "{{xRequestId}}",
										"type": "text"
									},
									{
										"key": "date",
										"value": "{{date}}",
										"type": "text"
									},
									{
										"key": "signature",
										"value": "{{signature}}",
										"type": "text"
									},
									{
										"key": "digest",
										"value": "{{digest}}",
										"type": "text"
									},
									{
										"key": "x-idempotency-key",
										"value": "{{xRequestId}}",
										"type": "text"
									}
								],
								"body": {
									"mode": "raw",
									"raw": "{{payload}}",
									"options": {
										"raw": {
											"language": "json"
										}
									}
								},
								"url": {
									"raw": "{{API_BASE_URL}}/pis/v2/request-for-payout",
									"host": [
										"{{API_BASE_URL}}"
									],
									"path": [
										"pis",
										"v2",
										"request-for-payout"
									]
								}
							},
							"response": []
						},
						{
							"name": "Fetch the Payment Status",
							"event": [
								{
									"listen": "test",
									"script": {
										"exec": [
											""
										],
										"type": "text/javascript",
										"packages": {}
									}
								},
								{
									"listen": "prerequest",
									"script": {
										"exec": [
											"// Signature handling",
											"/*const req = pm.request;",
											"const sign = utils.signRequest(req);",
											"",
											"pm.collectionVariables.set(\"date\", sign.date);",
											"pm.collectionVariables.set(\"signature\", sign.signatureHeader);",
											"pm.collectionVariables.set(\"xRequestId\", sign.xRequestId);*/"
										],
										"type": "text/javascript",
										"packages": {}
									}
								}
							],
							"request": {
								"method": "GET",
								"header": [
									{
										"key": "Accept",
										"value": "application/json",
										"type": "text"
									},
									{
										"key": "Content-Type",
										"value": "application/json",
										"type": "text"
									},
									{
										"key": "Authorization",
										"value": "Bearer {{access_token}}",
										"type": "text"
									},
									{
										"key": "x-request-id",
										"value": "{{xRequestId}}",
										"type": "text",
										"disabled": true
									},
									{
										"key": "date",
										"value": "{{date}}",
										"type": "text",
										"disabled": true
									},
									{
										"key": "signature",
										"value": "{{signature}}",
										"type": "text",
										"disabled": true
									}
								],
								"url": {
									"raw": "{{API_BASE_URL}}/pis/v2/payments/{{session_id}}?with_beneficiary={{with_beneficiary}}&with_virtualbeneficiary={{with_virtualbeneficiary}}",
									"host": [
										"{{API_BASE_URL}}"
									],
									"path": [
										"pis",
										"v2",
										"payments",
										"{{session_id}}"
									],
									"query": [
										{
											"key": "with_beneficiary",
											"value": "{{with_beneficiary}}"
										},
										{
											"key": "with_virtualbeneficiary",
											"value": "{{with_virtualbeneficiary}}"
										}
									]
								}
							},
							"response": []
						}
					],
					"description": "[https://doc.fintecture.com/docs/initiate-a-verified-payout<br><br>](https://doc.fintecture.com/docs/initiate-a-verified-payout)Note: Sent payload for Verified Payout can be found in the Pre-Request script"
				},
				{
					"name": "Inititate a Verified Payout (with Beneficiary)",
					"item": [
						{
							"name": "Request a PIS access token",
							"event": [
								{
									"listen": "prerequest",
									"script": {
										"exec": [
											"// Request a PIS access token",
											"const grant_type = \"client_credentials\";",
											"const scope = \"PIS\";",
											"",
											"// Register a client application and get its credentials",
											"const app_id = pm.collectionVariables.get(\"app_id\"); // mandatory",
											"const app_secret = pm.collectionVariables.get(\"app_secret\"); // mandatory",
											"",
											"// Encode your credentials using Base64",
											"let keys = app_id + \":\" + app_secret;",
											"let encodedKeys = CryptoJS.enc.Base64.stringify(CryptoJS.enc.Utf8.parse(keys));",
											"",
											"// Set Postman variables",
											"pm.collectionVariables.set(\"base64_token\", encodedKeys);",
											"pm.collectionVariables.set(\"grant_type\", grant_type);",
											"pm.collectionVariables.set(\"scope\", scope);",
											"",
											""
										],
										"type": "text/javascript",
										"packages": {}
									}
								},
								{
									"listen": "test",
									"script": {
										"exec": [
											"// Extract access_token & expires_in from provided response body",
											"const res = pm.response.json();",
											"",
											"const access_token = res.access_token;",
											"const expires_in = res.expires_in;",
											"",
											"// Set Postman variable",
											"pm.collectionVariables.set(\"access_token\", access_token);"
										],
										"type": "text/javascript",
										"packages": {}
									}
								}
							],
							"request": {
								"method": "POST",
								"header": [
									{
										"key": "Authorization",
										"value": "Basic {{base64_token}}",
										"type": "default"
									},
									{
										"key": "Accept",
										"value": "application/json",
										"type": "default"
									},
									{
										"key": "Content-Type",
										"value": "application/x-www-form-urlencoded",
										"type": "default"
									}
								],
								"body": {
									"mode": "urlencoded",
									"urlencoded": [
										{
											"key": "grant_type",
											"value": "client_credentials",
											"type": "default"
										},
										{
											"key": "scope",
											"value": "pis",
											"type": "default"
										},
										{
											"key": "app_id",
											"value": "{{app_id}}",
											"type": "default"
										}
									]
								},
								"url": {
									"raw": "{{API_BASE_URL}}/oauth/accesstoken",
									"host": [
										"{{API_BASE_URL}}"
									],
									"path": [
										"oauth",
										"accesstoken"
									]
								}
							},
							"response": []
						},
						{
							"name": "Create a Request For Payout",
							"event": [
								{
									"listen": "test",
									"script": {
										"exec": [
											"// Extract session_id & url from provided response body",
											"const res = pm.response.json();",
											"",
											"const session_id = res.meta.session_id;",
											"",
											"// Set Postman variables",
											"pm.collectionVariables.set(\"session_id\", session_id);"
										],
										"type": "text/javascript",
										"packages": {}
									}
								},
								{
									"listen": "prerequest",
									"script": {
										"exec": [
											"// Get collection variables",
											"const redirect_uri = pm.collectionVariables.get(\"redirect_uri\");",
											"if (!redirect_uri)",
											"    throw new Error(\"redirect_uri is missing\");",
											"const with_beneficiary = pm.collectionVariables.get(\"with_beneficiary\");",
											"const state = pm.collectionVariables.get(\"state\");",
											"if (!state)",
											"    throw new Error(\"state is missing\");",
											"",
											"// Fill query parameters",
											"const query_params = {",
											"    'redirect_uri': redirect_uri, // mandatory",
											"    'state': state  // mandatory",
											"}",
											"",
											"Object.entries(query_params).forEach(([key, value]) => {",
											"    if(value) ",
											"        pm.request.url.query.add(key + \"=\" + value);",
											"});",
											"",
											"// Fill payload",
											"const body =  {",
											"\t\"meta\": {",
											"\t\t\"psu_name\": \"John Doe\",",
											"\t\t\"psu_email\": \"john@doe.com\",",
											"\t\t\"expiry\": 604800,",
											"\t\t\"method\": \"link\"",
											"\t},",
											"\t\"data\": {",
											"        \"type\": \"payments\",",
											"            \"attributes\": {",
											"                \"amount\": \"291\",",
											"                \"currency\": \"EUR\",",
											"                \"communication\": \"MyShop REFUND from Order 123\",",
											"                \"beneficiary\": {",
											"                    \"name\": \"Jane Doe\",",
											"                    \"iban\": \"FR1420041010050500013M02606\",",
											"                    \"swift_bic\": \"CMCIFRPAXXX\"",
											"                }",
											"            }",
											"        }",
											"}",
											"",
											"const payload = JSON.stringify(body);",
											"pm.collectionVariables.set(\"payload\", payload);",
											"",
											"// Signature handling",
											"const req = pm.request;",
											"const sign = utils.signRequest(req);",
											"",
											"pm.collectionVariables.set(\"date\", sign.date);",
											"pm.collectionVariables.set(\"digest\", sign.digest);",
											"pm.collectionVariables.set(\"signature\", sign.signatureHeader);",
											"pm.collectionVariables.set(\"xRequestId\", sign.xRequestId);"
										],
										"type": "text/javascript",
										"packages": {}
									}
								}
							],
							"request": {
								"method": "POST",
								"header": [
									{
										"key": "Accept",
										"value": "application/json",
										"type": "text"
									},
									{
										"key": "Content-Type",
										"value": "application/json",
										"type": "text"
									},
									{
										"key": "authorization",
										"value": "Bearer {{access_token}}",
										"type": "text"
									},
									{
										"key": "x-request-id",
										"value": "{{xRequestId}}",
										"type": "text"
									},
									{
										"key": "date",
										"value": "{{date}}",
										"type": "text"
									},
									{
										"key": "signature",
										"value": "{{signature}}",
										"type": "text"
									},
									{
										"key": "digest",
										"value": "{{digest}}",
										"type": "text"
									},
									{
										"key": "x-idempotency-key",
										"value": "{{xRequestId}}",
										"type": "text"
									}
								],
								"body": {
									"mode": "raw",
									"raw": "{{payload}}",
									"options": {
										"raw": {
											"language": "json"
										}
									}
								},
								"url": {
									"raw": "{{API_BASE_URL}}/pis/v2/request-for-payout",
									"host": [
										"{{API_BASE_URL}}"
									],
									"path": [
										"pis",
										"v2",
										"request-for-payout"
									]
								}
							},
							"response": []
						},
						{
							"name": "Fetch the Payment Status",
							"event": [
								{
									"listen": "test",
									"script": {
										"exec": [
											""
										],
										"type": "text/javascript",
										"packages": {}
									}
								},
								{
									"listen": "prerequest",
									"script": {
										"exec": [
											"// Signature handling",
											"/*const req = pm.request;",
											"const sign = utils.signRequest(req);",
											"",
											"pm.collectionVariables.set(\"date\", sign.date);",
											"pm.collectionVariables.set(\"signature\", sign.signatureHeader);",
											"pm.collectionVariables.set(\"xRequestId\", sign.xRequestId);*/"
										],
										"type": "text/javascript",
										"packages": {}
									}
								}
							],
							"request": {
								"method": "GET",
								"header": [
									{
										"key": "Accept",
										"value": "application/json",
										"type": "text"
									},
									{
										"key": "Content-Type",
										"value": "application/json",
										"type": "text"
									},
									{
										"key": "Authorization",
										"value": "Bearer {{access_token}}",
										"type": "text"
									},
									{
										"key": "x-request-id",
										"value": "{{xRequestId}}",
										"type": "text",
										"disabled": true
									},
									{
										"key": "date",
										"value": "{{date}}",
										"type": "text",
										"disabled": true
									},
									{
										"key": "signature",
										"value": "{{signature}}",
										"type": "text",
										"disabled": true
									}
								],
								"url": {
									"raw": "{{API_BASE_URL}}/pis/v2/payments/{{session_id}}?with_beneficiary={{with_beneficiary}}&with_virtualbeneficiary={{with_virtualbeneficiary}}",
									"host": [
										"{{API_BASE_URL}}"
									],
									"path": [
										"pis",
										"v2",
										"payments",
										"{{session_id}}"
									],
									"query": [
										{
											"key": "with_beneficiary",
											"value": "{{with_beneficiary}}"
										},
										{
											"key": "with_virtualbeneficiary",
											"value": "{{with_virtualbeneficiary}}"
										}
									]
								}
							},
							"response": []
						}
					],
					"description": "[https://doc.fintecture.com/docs/initiate-a-verified-payout<br><br>](https://doc.fintecture.com/docs/initiate-a-verified-payout)Note: Sent payload for Verified Payout can be found in the Pre-Request script"
				},
				{
					"name": "Follow all payments",
					"item": [
						{
							"name": "Request a PIS access token",
							"event": [
								{
									"listen": "prerequest",
									"script": {
										"exec": [
											"// Request a PIS access token",
											"const grant_type = \"client_credentials\";",
											"const scope = \"PIS\";",
											"",
											"// Register a client application and get its credentials",
											"const app_id = pm.collectionVariables.get(\"app_id\"); // mandatory",
											"const app_secret = pm.collectionVariables.get(\"app_secret\"); // mandatory",
											"",
											"// Encode your credentials using Base64",
											"let keys = app_id + \":\" + app_secret;",
											"let encodedKeys = CryptoJS.enc.Base64.stringify(CryptoJS.enc.Utf8.parse(keys));",
											"",
											"// Set Postman variables",
											"pm.collectionVariables.set(\"base64_token\", encodedKeys);",
											"pm.collectionVariables.set(\"grant_type\", grant_type);",
											"pm.collectionVariables.set(\"scope\", scope);",
											"",
											"",
											""
										],
										"type": "text/javascript",
										"packages": {}
									}
								},
								{
									"listen": "test",
									"script": {
										"exec": [
											"// Extract access_token & expires_in from provided response body",
											"const res = pm.response.json();",
											"",
											"const access_token = res.access_token;",
											"const expires_in = res.expires_in;",
											"",
											"// Set Postman variable",
											"pm.collectionVariables.set(\"access_token\", access_token);"
										],
										"type": "text/javascript",
										"packages": {}
									}
								}
							],
							"request": {
								"method": "POST",
								"header": [
									{
										"key": "Authorization",
										"value": "Basic {{base64_token}}",
										"type": "default"
									},
									{
										"key": "Accept",
										"value": "application/json",
										"type": "default"
									},
									{
										"key": "Content-Type",
										"value": "application/x-www-form-urlencoded",
										"type": "default"
									}
								],
								"body": {
									"mode": "urlencoded",
									"urlencoded": [
										{
											"key": "grant_type",
											"value": "client_credentials",
											"type": "default"
										},
										{
											"key": "scope",
											"value": "pis",
											"type": "default"
										},
										{
											"key": "app_id",
											"value": "{{app_id}}",
											"type": "default"
										}
									]
								},
								"url": {
									"raw": "{{API_BASE_URL}}/oauth/accesstoken",
									"host": [
										"{{API_BASE_URL}}"
									],
									"path": [
										"oauth",
										"accesstoken"
									]
								}
							},
							"response": []
						},
						{
							"name": "Recover all payments",
							"event": [
								{
									"listen": "test",
									"script": {
										"exec": [
											""
										],
										"type": "text/javascript",
										"packages": {}
									}
								},
								{
									"listen": "prerequest",
									"script": {
										"exec": [
											"// Signature handling",
											"const req = pm.request;",
											"const sign = utils.signRequest(req);",
											"",
											"pm.collectionVariables.set(\"date\", sign.date);",
											"pm.collectionVariables.set(\"signature\", sign.signatureHeader);",
											"pm.collectionVariables.set(\"xRequestId\", sign.xRequestId);"
										],
										"type": "text/javascript",
										"packages": {}
									}
								}
							],
							"request": {
								"method": "GET",
								"header": [
									{
										"key": "Accept",
										"value": "application/json",
										"type": "text"
									},
									{
										"key": "Content-Type",
										"value": "application/json",
										"type": "text"
									},
									{
										"key": "Authorization",
										"value": "Bearer {{access_token}}",
										"type": "text"
									},
									{
										"key": "x-request-id",
										"value": "{{xRequestId}}",
										"type": "text"
									},
									{
										"key": "date",
										"value": "{{date}}",
										"type": "text"
									},
									{
										"key": "signature",
										"value": "{{signature}}",
										"type": "text"
									}
								],
								"url": {
									"raw": "{{API_BASE_URL}}/pis/v2/payments",
									"host": [
										"{{API_BASE_URL}}"
									],
									"path": [
										"pis",
										"v2",
										"payments"
									]
								}
							},
							"response": []
						}
					],
					"description": "[https://doc.fintecture.com/docs/api-follow-all-payments](https://doc.fintecture.com/docs/api-follow-all-payments)"
				},
				{
					"name": "Follow a payment",
					"item": [
						{
							"name": "Request a PIS access token",
							"event": [
								{
									"listen": "prerequest",
									"script": {
										"exec": [
											"// Request a PIS access token",
											"const grant_type = \"client_credentials\";",
											"const scope = \"PIS\";",
											"",
											"// Register a client application and get its credentials",
											"const app_id = pm.collectionVariables.get(\"app_id\"); // mandatory",
											"const app_secret = pm.collectionVariables.get(\"app_secret\"); // mandatory",
											"",
											"// Encode your credentials using Base64",
											"let keys = app_id + \":\" + app_secret;",
											"let encodedKeys = CryptoJS.enc.Base64.stringify(CryptoJS.enc.Utf8.parse(keys));",
											"",
											"// Set Postman variables",
											"pm.collectionVariables.set(\"base64_token\", encodedKeys);",
											"pm.collectionVariables.set(\"grant_type\", grant_type);",
											"pm.collectionVariables.set(\"scope\", scope);",
											"",
											"",
											""
										],
										"type": "text/javascript",
										"packages": {}
									}
								},
								{
									"listen": "test",
									"script": {
										"exec": [
											"// Extract access_token & expires_in from provided response body",
											"const res = pm.response.json();",
											"",
											"const access_token = res.access_token;",
											"const expires_in = res.expires_in;",
											"",
											"// Set Postman variable",
											"pm.collectionVariables.set(\"access_token\", access_token);"
										],
										"type": "text/javascript",
										"packages": {}
									}
								}
							],
							"request": {
								"method": "POST",
								"header": [
									{
										"key": "Authorization",
										"value": "Basic {{base64_token}}",
										"type": "default"
									},
									{
										"key": "Accept",
										"value": "application/json",
										"type": "default"
									},
									{
										"key": "Content-Type",
										"value": "application/x-www-form-urlencoded",
										"type": "default"
									}
								],
								"body": {
									"mode": "urlencoded",
									"urlencoded": [
										{
											"key": "grant_type",
											"value": "client_credentials",
											"type": "default"
										},
										{
											"key": "scope",
											"value": "pis",
											"type": "default"
										},
										{
											"key": "app_id",
											"value": "{{app_id}}",
											"type": "default"
										}
									]
								},
								"url": {
									"raw": "{{API_BASE_URL}}/oauth/accesstoken",
									"host": [
										"{{API_BASE_URL}}"
									],
									"path": [
										"oauth",
										"accesstoken"
									]
								}
							},
							"response": []
						},
						{
							"name": "Follow the desired payment",
							"event": [
								{
									"listen": "test",
									"script": {
										"exec": [
											"// Signature handling",
											"const req = pm.request;",
											"const sign = utils.signRequest(req);",
											"",
											"pm.collectionVariables.set(\"date\", sign.date);",
											"pm.collectionVariables.set(\"signature\", sign.signatureHeader);",
											"pm.collectionVariables.set(\"xRequestId\", sign.xRequestId);"
										],
										"type": "text/javascript",
										"packages": {}
									}
								},
								{
									"listen": "prerequest",
									"script": {
										"exec": [
											"// Get collection variables",
											"const with_beneficiary = pm.collectionVariables.get(\"with_beneficiary\");",
											"const with_virtualbeneficiary = pm.collectionVariables.get(\"with_virtualbeneficiary\");",
											"",
											"// Fill headers",
											"const headers = {",
											"    'x-request_id': require('uuid').v4()",
											"}",
											"Object.entries(headers).forEach(([key, value]) => {",
											"    if(!pm.request.headers.get(key) && value) ",
											"        pm.request.headers.add({key, value});",
											"});",
											"",
											"// Fill query parameters",
											"const query_params = {",
											"    \"with_beneficiary\": with_beneficiary ?  with_beneficiary : undefined ,",
											"    'with_virtualbeneficiary': with_virtualbeneficiary ?  with_virtualbeneficiary : undefined ",
											"}",
											"Object.entries(query_params).forEach(([key, value]) => {",
											"    if(value) ",
											"        pm.request.url.query.add(key + \"=\" + value);",
											"});",
											"",
											"// Fill path parameter",
											"const session_id = \"\" // mandatory",
											"",
											"pm.collectionVariables.set(\"session_id\", session_id);",
											""
										],
										"type": "text/javascript",
										"packages": {}
									}
								}
							],
							"request": {
								"method": "GET",
								"header": [
									{
										"key": "Accept",
										"value": "application/json",
										"type": "text"
									},
									{
										"key": "Content-Type",
										"value": "application/json",
										"type": "text"
									},
									{
										"key": "Authorization",
										"value": "Bearer {{access_token}}",
										"type": "text"
									},
									{
										"key": "x-request-id",
										"value": "{{xRequestId}}",
										"type": "text"
									},
									{
										"key": "date",
										"value": "{{date}}",
										"type": "text"
									},
									{
										"key": "signature",
										"value": "{{signature}}",
										"type": "text"
									}
								],
								"url": {
									"raw": "{{API_BASE_URL}}/pis/v2/payments/{{session_id}}",
									"host": [
										"{{API_BASE_URL}}"
									],
									"path": [
										"pis",
										"v2",
										"payments",
										"{{session_id}}"
									]
								}
							},
							"response": []
						}
					],
					"description": "[https://doc.fintecture.com/docs/api-follow-a-payment](https://doc.fintecture.com/docs/api-follow-a-payment)"
				},
				{
					"name": "Update a payment",
					"item": [
						{
							"name": "Request a PIS access token",
							"event": [
								{
									"listen": "prerequest",
									"script": {
										"exec": [
											"// Request a PIS access token",
											"const grant_type = \"client_credentials\";",
											"const scope = \"PIS\";",
											"",
											"// Register a client application and get its credentials",
											"const app_id = pm.collectionVariables.get(\"app_id\"); // mandatory",
											"const app_secret = pm.collectionVariables.get(\"app_secret\"); // mandatory",
											"",
											"// Encode your credentials using Base64",
											"let keys = app_id + \":\" + app_secret;",
											"let encodedKeys = CryptoJS.enc.Base64.stringify(CryptoJS.enc.Utf8.parse(keys));",
											"",
											"// Set Postman variables",
											"pm.collectionVariables.set(\"base64_token\", encodedKeys);",
											"pm.collectionVariables.set(\"grant_type\", grant_type);",
											"pm.collectionVariables.set(\"scope\", scope);",
											"",
											"",
											""
										],
										"type": "text/javascript",
										"packages": {}
									}
								},
								{
									"listen": "test",
									"script": {
										"exec": [
											"// Extract access_token & expires_in from provided response body",
											"const res = pm.response.json();",
											"",
											"const access_token = res.access_token;",
											"const expires_in = res.expires_in;",
											"",
											"// Set Postman variable",
											"pm.collectionVariables.set(\"access_token\", access_token);"
										],
										"type": "text/javascript",
										"packages": {}
									}
								}
							],
							"request": {
								"method": "POST",
								"header": [
									{
										"key": "Authorization",
										"value": "Basic {{base64_token}}",
										"type": "default"
									},
									{
										"key": "Accept",
										"value": "application/json",
										"type": "default"
									},
									{
										"key": "Content-Type",
										"value": "application/x-www-form-urlencoded",
										"type": "default"
									}
								],
								"body": {
									"mode": "urlencoded",
									"urlencoded": [
										{
											"key": "grant_type",
											"value": "client_credentials",
											"type": "default"
										},
										{
											"key": "scope",
											"value": "pis",
											"type": "default"
										},
										{
											"key": "app_id",
											"value": "{{app_id}}",
											"type": "default"
										}
									]
								},
								"url": {
									"raw": "{{API_BASE_URL}}/oauth/accesstoken",
									"host": [
										"{{API_BASE_URL}}"
									],
									"path": [
										"oauth",
										"accesstoken"
									]
								}
							},
							"response": []
						},
						{
							"name": "Update the desired payment",
							"event": [
								{
									"listen": "test",
									"script": {
										"exec": [
											""
										],
										"type": "text/javascript",
										"packages": {}
									}
								},
								{
									"listen": "prerequest",
									"script": {
										"exec": [
											"// Fill path parameter",
											"const session_id = \"\" // mandatory",
											"",
											"pm.collectionVariables.set(\"session_id\", session_id);",
											"",
											"// Fill payload",
											"const body =  {",
											"     \"meta\": {",
											"          \"status\": \"payment_cancelled\"",
											"     }",
											"};",
											"",
											"const payload = JSON.stringify(body);",
											"",
											"pm.collectionVariables.set(\"payload\", payload);",
											"",
											"// Signature handling",
											"const req = pm.request;",
											"const sign = utils.signRequest(req);",
											"",
											"pm.collectionVariables.set(\"date\", sign.date);",
											"pm.collectionVariables.set(\"digest\", sign.digest);",
											"pm.collectionVariables.set(\"signature\", sign.signatureHeader);",
											"pm.collectionVariables.set(\"xRequestId\", sign.xRequestId);"
										],
										"type": "text/javascript",
										"packages": {}
									}
								}
							],
							"request": {
								"method": "PATCH",
								"header": [
									{
										"key": "Accept",
										"value": "application/json",
										"type": "text"
									},
									{
										"key": "Authorization",
										"value": "Bearer {{access_token}}",
										"type": "text"
									},
									{
										"key": "x-request-id",
										"value": "{{xRequestId}}",
										"type": "text"
									},
									{
										"key": "date",
										"value": "{{date}}",
										"type": "text"
									},
									{
										"key": "signature",
										"value": "{{signature}}",
										"type": "text"
									},
									{
										"key": "digest",
										"value": "{{digest}}",
										"type": "text"
									}
								],
								"body": {
									"mode": "raw",
									"raw": "{{payload}}",
									"options": {
										"raw": {
											"language": "json"
										}
									}
								},
								"url": {
									"raw": "{{API_BASE_URL}}/pis/v2/payments/{{session_id}}",
									"host": [
										"{{API_BASE_URL}}"
									],
									"path": [
										"pis",
										"v2",
										"payments",
										"{{session_id}}"
									]
								}
							},
							"response": []
						}
					],
					"description": "[https://doc.fintecture.com/docs/api-update-a-payment](https://doc.fintecture.com/docs/api-update-a-payment)"
				}
			],
			"event": [
				{
					"listen": "prerequest",
					"script": {
						"type": "text/javascript",
						"exec": [
							""
						]
					}
				},
				{
					"listen": "test",
					"script": {
						"type": "text/javascript",
						"exec": [
							""
						]
					}
				}
			]
		},
		{
			"name": "Integrate bank accounts",
			"item": [
				{
					"name": "Recover all bank accounts",
					"item": [
						{
							"name": "Request the AIS Connect URL",
							"event": [
								{
									"listen": "prerequest",
									"script": {
										"exec": [
											"// Get collection variables",
											"const psu_type = pm.collectionVariables.get(\"psu_type\");",
											"const country_code = pm.collectionVariables.get(\"country_code\");",
											"const language = pm.collectionVariables.get(\"language\");",
											"const provider = pm.collectionVariables.get(\"provider\");",
											"",
											"const redirect_uri = pm.collectionVariables.get(\"redirect_uri\");",
											"const state = pm.collectionVariables.get(\"state\");",
											"const scope = undefined;",
											"",
											"// Fill headers",
											"const headers = {",
											"    'x-request_id': require('uuid').v4(),",
											"    'x-psu_type': psu_type ? psu_type : undefined,",
											"    \"x-country_code\": country_code ? country_code : undefined,",
											"    'x-language': language ? language : undefined,",
											"    'x-provider': provider ? provider : undefined",
											"}",
											"Object.entries(headers).forEach(([key, value]) => {",
											"    if(!pm.request.headers.get(key) && value) ",
											"        pm.request.headers.add({key, value});",
											"});",
											"",
											"// Fill query parameters",
											"const query_params = {",
											"    'redirect_uri': redirect_uri ?  redirect_uri : undefined, // mandatory",
											"    'state': state ?  state : undefined,  // mandatory",
											"    'scope': scope ?  scope : undefined  // mandatory",
											"}",
											"Object.entries(query_params).forEach(([key, value]) => {",
											"    if(value) ",
											"        pm.request.url.query.add(key + \"=\" + value);",
											"});"
										],
										"type": "text/javascript"
									}
								},
								{
									"listen": "test",
									"script": {
										"exec": [
											"const res = pm.response.json();",
											"",
											"const connect_url = res.meta.url;",
											"",
											"pm.collectionVariables.set(\"connect_url\", connect_url);"
										],
										"type": "text/javascript"
									}
								}
							],
							"request": {
								"method": "GET",
								"header": [
									{
										"key": "app_id",
										"value": "{{app_id}}",
										"type": "text"
									},
									{
										"key": "Accept",
										"value": "application/json",
										"type": "text"
									}
								],
								"url": {
									"raw": "{{API_BASE_URL}}/ais/v2/connect",
									"host": [
										"{{API_BASE_URL}}"
									],
									"path": [
										"ais",
										"v2",
										"connect"
									]
								},
								"description": "NOT DESCRIBED"
							},
							"response": []
						},
						{
							"name": "Redirect the user",
							"event": [
								{
									"listen": "test",
									"script": {
										"exec": [
											"// On redirection extract the code received",
											"const fintecture_redirect_url = pm.response.headers.get('location');",
											"",
											"const query_params = fintecture_redirect_url?.split('?');",
											"const bank_code = query_params ? query_params[1].split('&').find(e => e.indexOf('code=') !== -1)?.replace('code=','') : undefined;",
											"const customer_id =  query_params ? query_params[1].split('&').find(e => e.indexOf('customer_id=') !== -1)?.replace('customer_id=','') : undefined;",
											"",
											"// Set Postman variables",
											"pm.collectionVariables.set(\"bank_code\", bank_code);",
											"pm.collectionVariables.set(\"customer_id\", customer_id);",
											""
										],
										"type": "text/javascript"
									}
								}
							],
							"protocolProfileBehavior": {
								"followRedirects": true
							},
							"request": {
								"method": "GET",
								"header": [
									{
										"key": "referer",
										"value": "{{location}}",
										"type": "default",
										"disabled": true
									}
								],
								"url": {
									"raw": "{{connect_url}}",
									"host": [
										"{{connect_url}}"
									]
								}
							},
							"response": []
						},
						{
							"name": "Exchange the code for an access token",
							"event": [
								{
									"listen": "prerequest",
									"script": {
										"exec": [
											"// Request a PIS access token",
											"const grant_type = \"authorization_code\";",
											"const scope = \"AIS\";",
											"",
											"// Retrieve app_id and app_secret from variables",
											"const app_id = pm.collectionVariables.get(\"app_id\");",
											"const app_secret = pm.collectionVariables.get(\"app_secret\");",
											"",
											"// Encode your credentials using Base64",
											"let keys = app_id + \":\" + app_secret;",
											"let encodedKeys = CryptoJS.enc.Base64.stringify(CryptoJS.enc.Utf8.parse(keys));",
											"",
											"// Set Postman variables",
											"pm.collectionVariables.set(\"base64_token\", encodedKeys);",
											"pm.collectionVariables.set(\"grant_type\", grant_type);",
											"pm.collectionVariables.set(\"scope\", scope);",
											""
										],
										"type": "text/javascript"
									}
								},
								{
									"listen": "test",
									"script": {
										"exec": [
											"// Extract access_token, expires_in & refresh_token from provided response body",
											"const res = pm.response.json();",
											"",
											"const access_token = res.access_token;",
											"const expires_in = res.expires_in;",
											"const refresh_token = res.refresh_token;",
											"",
											"// Set Postman variable",
											"pm.collectionVariables.set(\"access_token\", access_token);"
										],
										"type": "text/javascript"
									}
								}
							],
							"request": {
								"method": "POST",
								"header": [
									{
										"key": "Authorization",
										"value": "Basic {{base64_token}}",
										"type": "default"
									},
									{
										"key": "Accept",
										"value": "application/json",
										"type": "default"
									},
									{
										"key": "Content-Type",
										"value": "application/x-www-form-urlencoded",
										"type": "default"
									}
								],
								"body": {
									"mode": "urlencoded",
									"urlencoded": [
										{
											"key": "grant_type",
											"value": "{{grant_type}}",
											"type": "default"
										},
										{
											"key": "code",
											"value": "c33052fd5ac38df3f574ded926a51c4a",
											"type": "default"
										},
										{
											"key": "scope",
											"value": "{{scope}}",
											"type": "default"
										}
									]
								},
								"url": {
									"raw": "{{API_BASE_URL}}/oauth/accesstoken",
									"host": [
										"{{API_BASE_URL}}"
									],
									"path": [
										"oauth",
										"accesstoken"
									]
								}
							},
							"response": []
						},
						{
							"name": "Recover all accounts",
							"event": [
								{
									"listen": "prerequest",
									"script": {
										"exec": [
											"// Fill path parameter",
											"const customer_id = \"\" // mandatory",
											"",
											"pm.collectionVariables.set(\"customer_id\", customer_id);"
										],
										"type": "text/javascript"
									}
								},
								{
									"listen": "test",
									"script": {
										"exec": [
											"let res = pm.response.json();",
											"",
											"let account_id = res.data[0].id;",
											"",
											"pm.collectionVariables.set(\"account_id\", account_id);"
										],
										"type": "text/javascript"
									}
								}
							],
							"request": {
								"method": "GET",
								"header": [
									{
										"key": "Authorization",
										"value": "Bearer {{access_token}}",
										"type": "default"
									},
									{
										"key": "Accept",
										"value": "application/json",
										"type": "default"
									},
									{
										"key": "app_id",
										"value": "{{app_id}}",
										"type": "default"
									}
								],
								"url": {
									"raw": "{{API_BASE_URL}}/ais/v1/customer/{{customer_id}}/accounts",
									"host": [
										"{{API_BASE_URL}}"
									],
									"path": [
										"ais",
										"v1",
										"customer",
										"{{customer_id}}",
										"accounts"
									]
								}
							},
							"response": []
						}
					],
					"description": "[https://doc.fintecture.com/docs/api-recover-bank-accounts](https://doc.fintecture.com/docs/api-recover-bank-accounts)"
				},
				{
					"name": "Consult bank account's details",
					"item": [
						{
							"name": "Request the AIS Connect URL",
							"event": [
								{
									"listen": "prerequest",
									"script": {
										"exec": [
											"// Get collection variables",
											"const psu_type = pm.collectionVariables.get(\"psu_type\");",
											"const country_code = pm.collectionVariables.get(\"country_code\");",
											"const language = pm.collectionVariables.get(\"language\");",
											"const provider = pm.collectionVariables.get(\"provider\");",
											"",
											"const redirect_uri = pm.collectionVariables.get(\"redirect_uri\");",
											"const state = pm.collectionVariables.get(\"state\");",
											"const scope = undefined;",
											"",
											"// Fill headers",
											"const headers = {",
											"    'x-request_id': require('uuid').v4(),",
											"    'x-psu_type': psu_type ? psu_type : undefined,",
											"    \"x-country_code\": country_code ? country_code : undefined,",
											"    'x-language': language ? language : undefined,",
											"    'x-provider': provider ? provider : undefined",
											"}",
											"Object.entries(headers).forEach(([key, value]) => {",
											"    if(!pm.request.headers.get(key) && value) ",
											"        pm.request.headers.add({key, value});",
											"});",
											"",
											"// Fill query parameters",
											"const query_params = {",
											"    'redirect_uri': redirect_uri ?  redirect_uri : undefined, // mandatory",
											"    'state': state ?  state : undefined,  // mandatory",
											"    'scope': scope ?  scope : undefined  // mandatory",
											"}",
											"Object.entries(query_params).forEach(([key, value]) => {",
											"    if(value) ",
											"        pm.request.url.query.add(key + \"=\" + value);",
											"});"
										],
										"type": "text/javascript"
									}
								},
								{
									"listen": "test",
									"script": {
										"exec": [
											"const res = pm.response.json();",
											"",
											"const connect_url = res.meta.url;",
											"",
											"pm.collectionVariables.set(\"connect_url\", connect_url);"
										],
										"type": "text/javascript"
									}
								}
							],
							"request": {
								"method": "GET",
								"header": [
									{
										"key": "app_id",
										"value": "{{app_id}}",
										"type": "text"
									},
									{
										"key": "Accept",
										"value": "application/json",
										"type": "text"
									}
								],
								"url": {
									"raw": "{{API_BASE_URL}}/ais/v2/connect",
									"host": [
										"{{API_BASE_URL}}"
									],
									"path": [
										"ais",
										"v2",
										"connect"
									]
								},
								"description": "NOT DESCRIBED"
							},
							"response": []
						},
						{
							"name": "Redirect the user",
							"event": [
								{
									"listen": "test",
									"script": {
										"exec": [
											"// On redirection extract the code received",
											"const fintecture_redirect_url = pm.response.headers.get('location');",
											"",
											"const query_params = fintecture_redirect_url?.split('?');",
											"const bank_code = query_params ? query_params[1].split('&').find(e => e.indexOf('code=') !== -1)?.replace('code=','') : undefined;",
											"const customer_id =  query_params ? query_params[1].split('&').find(e => e.indexOf('customer_id=') !== -1)?.replace('customer_id=','') : undefined;",
											"",
											"// Set Postman variables",
											"pm.collectionVariables.set(\"bank_code\", bank_code);",
											"pm.collectionVariables.set(\"customer_id\", customer_id);",
											""
										],
										"type": "text/javascript"
									}
								}
							],
							"protocolProfileBehavior": {
								"followRedirects": true
							},
							"request": {
								"method": "GET",
								"header": [
									{
										"key": "referer",
										"value": "{{location}}",
										"type": "default",
										"disabled": true
									}
								],
								"url": {
									"raw": "{{connect_url}}",
									"host": [
										"{{connect_url}}"
									]
								}
							},
							"response": []
						},
						{
							"name": "Exchange the code for an access token",
							"event": [
								{
									"listen": "prerequest",
									"script": {
										"exec": [
											"// Request a PIS access token",
											"const grant_type = \"authorization_code\";",
											"const scope = \"AIS\";",
											"",
											"// Retrieve app_id and app_secret from variables",
											"const app_id = pm.collectionVariables.get(\"app_id\");",
											"const app_secret = pm.collectionVariables.get(\"app_secret\");",
											"",
											"// Encode your credentials using Base64",
											"let keys = app_id + \":\" + app_secret;",
											"let encodedKeys = CryptoJS.enc.Base64.stringify(CryptoJS.enc.Utf8.parse(keys));",
											"",
											"// Set Postman variables",
											"pm.collectionVariables.set(\"base64_token\", encodedKeys);",
											"pm.collectionVariables.set(\"grant_type\", grant_type);",
											"pm.collectionVariables.set(\"scope\", scope);",
											""
										],
										"type": "text/javascript"
									}
								},
								{
									"listen": "test",
									"script": {
										"exec": [
											"// Extract access_token, expires_in & refresh_token from provided response body",
											"const res = pm.response.json();",
											"",
											"const access_token = res.access_token;",
											"const expires_in = res.expires_in;",
											"const refresh_token = res.refresh_token;",
											"",
											"// Set Postman variable",
											"pm.collectionVariables.set(\"access_token\", access_token);"
										],
										"type": "text/javascript"
									}
								}
							],
							"request": {
								"method": "POST",
								"header": [
									{
										"key": "Authorization",
										"value": "Basic {{base64_token}}",
										"type": "default"
									},
									{
										"key": "Accept",
										"value": "application/json",
										"type": "default"
									},
									{
										"key": "Content-Type",
										"value": "application/x-www-form-urlencoded",
										"type": "default"
									}
								],
								"body": {
									"mode": "urlencoded",
									"urlencoded": [
										{
											"key": "grant_type",
											"value": "{{grant_type}}",
											"type": "default"
										},
										{
											"key": "code",
											"value": "{{bank_code}}",
											"type": "default"
										},
										{
											"key": "scope",
											"value": "{{scope}}",
											"type": "default"
										}
									]
								},
								"url": {
									"raw": "{{API_BASE_URL}}/oauth/accesstoken",
									"host": [
										"{{API_BASE_URL}}"
									],
									"path": [
										"oauth",
										"accesstoken"
									]
								}
							},
							"response": []
						},
						{
							"name": "Consult account's details",
							"event": [
								{
									"listen": "prerequest",
									"script": {
										"exec": [
											"// Fill path parameters",
											"const customer_id = \"\" // mandatory",
											"const account_id = \"\" // mandatory",
											"",
											"pm.collectionVariables.set(\"customer_id\", customer_id);",
											"pm.collectionVariables.set(\"account_id\", account_id);"
										],
										"type": "text/javascript"
									}
								},
								{
									"listen": "test",
									"script": {
										"exec": [
											""
										],
										"type": "text/javascript"
									}
								}
							],
							"request": {
								"method": "GET",
								"header": [
									{
										"key": "Authorization",
										"value": "Bearer {{access_token}}",
										"type": "default"
									},
									{
										"key": "Accept",
										"value": "application/json",
										"type": "default"
									},
									{
										"key": "app_id",
										"value": "{{app_id}}",
										"type": "default"
									}
								],
								"url": {
									"raw": "{{API_BASE_URL}}/ais/v1/customer/{{customer_id}}/accounts/{{account_id}}",
									"host": [
										"{{API_BASE_URL}}"
									],
									"path": [
										"ais",
										"v1",
										"customer",
										"{{customer_id}}",
										"accounts",
										"{{account_id}}"
									]
								}
							},
							"response": []
						}
					],
					"description": "[https://doc.fintecture.com/docs/api-consult-bank-account](https://doc.fintecture.com/docs/api-consult-bank-account)"
				},
				{
					"name": "Recover bank account's holders",
					"item": [
						{
							"name": "Request the AIS Connect URL",
							"event": [
								{
									"listen": "prerequest",
									"script": {
										"exec": [
											"// Get collection variables",
											"const psu_type = pm.collectionVariables.get(\"psu_type\");",
											"const country_code = pm.collectionVariables.get(\"country_code\");",
											"const language = pm.collectionVariables.get(\"language\");",
											"const provider = pm.collectionVariables.get(\"provider\");",
											"",
											"const redirect_uri = pm.collectionVariables.get(\"redirect_uri\");",
											"const state = pm.collectionVariables.get(\"state\");",
											"const scope = undefined;",
											"",
											"// Fill headers",
											"const headers = {",
											"    'x-request_id': require('uuid').v4(),",
											"    'x-psu_type': psu_type ? psu_type : undefined,",
											"    \"x-country_code\": country_code ? country_code : undefined,",
											"    'x-language': language ? language : undefined,",
											"    'x-provider': provider ? provider : undefined",
											"}",
											"Object.entries(headers).forEach(([key, value]) => {",
											"    if(!pm.request.headers.get(key) && value) ",
											"        pm.request.headers.add({key, value});",
											"});",
											"",
											"// Fill query parameters",
											"const query_params = {",
											"    'redirect_uri': redirect_uri ?  redirect_uri : undefined, // mandatory",
											"    'state': state ?  state : undefined,  // mandatory",
											"    'scope': scope ?  scope : undefined  // mandatory",
											"}",
											"Object.entries(query_params).forEach(([key, value]) => {",
											"    if(value) ",
											"        pm.request.url.query.add(key + \"=\" + value);",
											"});"
										],
										"type": "text/javascript"
									}
								},
								{
									"listen": "test",
									"script": {
										"exec": [
											"const res = pm.response.json();",
											"",
											"const connect_url = res.meta.url;",
											"",
											"pm.collectionVariables.set(\"connect_url\", connect_url);"
										],
										"type": "text/javascript"
									}
								}
							],
							"request": {
								"method": "GET",
								"header": [
									{
										"key": "app_id",
										"value": "{{app_id}}",
										"type": "text"
									},
									{
										"key": "Accept",
										"value": "application/json",
										"type": "text"
									}
								],
								"url": {
									"raw": "{{API_BASE_URL}}/ais/v2/connect",
									"host": [
										"{{API_BASE_URL}}"
									],
									"path": [
										"ais",
										"v2",
										"connect"
									]
								},
								"description": "NOT DESCRIBED"
							},
							"response": []
						},
						{
							"name": "Redirect the user",
							"event": [
								{
									"listen": "test",
									"script": {
										"exec": [
											"// On redirection extract the code received",
											"const fintecture_redirect_url = pm.response.headers.get('location');",
											"",
											"const query_params = fintecture_redirect_url?.split('?');",
											"const bank_code = query_params ? query_params[1].split('&').find(e => e.indexOf('code=') !== -1)?.replace('code=','') : undefined;",
											"const customer_id =  query_params ? query_params[1].split('&').find(e => e.indexOf('customer_id=') !== -1)?.replace('customer_id=','') : undefined;",
											"",
											"// Set Postman variables",
											"pm.collectionVariables.set(\"bank_code\", bank_code);",
											"pm.collectionVariables.set(\"customer_id\", customer_id);",
											""
										],
										"type": "text/javascript"
									}
								}
							],
							"protocolProfileBehavior": {
								"followRedirects": true
							},
							"request": {
								"method": "GET",
								"header": [
									{
										"key": "referer",
										"value": "{{location}}",
										"type": "default",
										"disabled": true
									}
								],
								"url": {
									"raw": "{{connect_url}}",
									"host": [
										"{{connect_url}}"
									]
								}
							},
							"response": []
						},
						{
							"name": "Exchange the code for an access token",
							"event": [
								{
									"listen": "prerequest",
									"script": {
										"exec": [
											"// Request a PIS access token",
											"const grant_type = \"authorization_code\";",
											"const scope = \"AIS\";",
											"",
											"// Retrieve app_id and app_secret from variables",
											"const app_id = pm.collectionVariables.get(\"app_id\");",
											"const app_secret = pm.collectionVariables.get(\"app_secret\");",
											"",
											"// Encode your credentials using Base64",
											"let keys = app_id + \":\" + app_secret;",
											"let encodedKeys = CryptoJS.enc.Base64.stringify(CryptoJS.enc.Utf8.parse(keys));",
											"",
											"// Set Postman variables",
											"pm.collectionVariables.set(\"base64_token\", encodedKeys);",
											"pm.collectionVariables.set(\"grant_type\", grant_type);",
											"pm.collectionVariables.set(\"scope\", scope);",
											""
										],
										"type": "text/javascript"
									}
								},
								{
									"listen": "test",
									"script": {
										"exec": [
											"// Extract access_token, expires_in & refresh_token from provided response body",
											"const res = pm.response.json();",
											"",
											"const access_token = res.access_token;",
											"const expires_in = res.expires_in;",
											"const refresh_token = res.refresh_token;",
											"",
											"// Set Postman variable",
											"pm.collectionVariables.set(\"access_token\", access_token);"
										],
										"type": "text/javascript"
									}
								}
							],
							"request": {
								"method": "POST",
								"header": [
									{
										"key": "Authorization",
										"value": "Basic {{base64_token}}",
										"type": "default"
									},
									{
										"key": "Accept",
										"value": "application/json",
										"type": "default"
									},
									{
										"key": "Content-Type",
										"value": "application/x-www-form-urlencoded",
										"type": "default"
									}
								],
								"body": {
									"mode": "urlencoded",
									"urlencoded": [
										{
											"key": "grant_type",
											"value": "{{grant_type}}",
											"type": "default"
										},
										{
											"key": "code",
											"value": "{{bank_code}}",
											"type": "default"
										},
										{
											"key": "scope",
											"value": "{{scope}}",
											"type": "default"
										}
									]
								},
								"url": {
									"raw": "{{API_BASE_URL}}/oauth/accesstoken",
									"host": [
										"{{API_BASE_URL}}"
									],
									"path": [
										"oauth",
										"accesstoken"
									]
								}
							},
							"response": []
						},
						{
							"name": "Recover account's holders",
							"event": [
								{
									"listen": "prerequest",
									"script": {
										"exec": [
											"// Fill path parameter",
											"const customer_id = \"\" // mandatory",
											"",
											"pm.collectionVariables.set(\"customer_id\", customer_id);"
										],
										"type": "text/javascript"
									}
								},
								{
									"listen": "test",
									"script": {
										"exec": [
											""
										],
										"type": "text/javascript"
									}
								}
							],
							"request": {
								"method": "GET",
								"header": [
									{
										"key": "Authorization",
										"value": "Bearer {{access_token}}",
										"type": "default"
									},
									{
										"key": "Accept",
										"value": "application/json",
										"type": "default"
									},
									{
										"key": "app_id",
										"value": "{{app_id}}",
										"type": "default"
									}
								],
								"url": {
									"raw": "{{API_BASE_URL}}/ais/v1/customer/{{customer_id}}/accountholders",
									"host": [
										"{{API_BASE_URL}}"
									],
									"path": [
										"ais",
										"v1",
										"customer",
										"{{customer_id}}",
										"accountholders"
									]
								}
							},
							"response": []
						}
					],
					"description": "[https://doc.fintecture.com/docs/api-recover-bank-account-holders](https://doc.fintecture.com/docs/api-recover-bank-account-holders)"
				},
				{
					"name": "Recover bank account's transactions",
					"item": [
						{
							"name": "Request the AIS Connect URL",
							"event": [
								{
									"listen": "prerequest",
									"script": {
										"exec": [
											"// Get collection variables",
											"const psu_type = pm.collectionVariables.get(\"psu_type\");",
											"const country_code = pm.collectionVariables.get(\"country_code\");",
											"const language = pm.collectionVariables.get(\"language\");",
											"const provider = pm.collectionVariables.get(\"provider\");",
											"",
											"const redirect_uri = pm.collectionVariables.get(\"redirect_uri\");",
											"const state = pm.collectionVariables.get(\"state\");",
											"const scope = undefined;",
											"",
											"// Fill headers",
											"const headers = {",
											"    'x-request_id': require('uuid').v4(),",
											"    'x-psu_type': psu_type ? psu_type : undefined,",
											"    \"x-country_code\": country_code ? country_code : undefined,",
											"    'x-language': language ? language : undefined,",
											"    'x-provider': provider ? provider : undefined",
											"}",
											"Object.entries(headers).forEach(([key, value]) => {",
											"    if(!pm.request.headers.get(key) && value) ",
											"        pm.request.headers.add({key, value});",
											"});",
											"",
											"// Fill query parameters",
											"const query_params = {",
											"    'redirect_uri': redirect_uri ?  redirect_uri : undefined, // mandatory",
											"    'state': state ?  state : undefined,  // mandatory",
											"    'scope': scope ?  scope : undefined  // mandatory",
											"}",
											"Object.entries(query_params).forEach(([key, value]) => {",
											"    if(value) ",
											"        pm.request.url.query.add(key + \"=\" + value);",
											"});"
										],
										"type": "text/javascript"
									}
								},
								{
									"listen": "test",
									"script": {
										"exec": [
											"const res = pm.response.json();",
											"",
											"const connect_url = res.meta.url;",
											"",
											"pm.collectionVariables.set(\"connect_url\", connect_url);"
										],
										"type": "text/javascript"
									}
								}
							],
							"request": {
								"method": "GET",
								"header": [
									{
										"key": "app_id",
										"value": "{{app_id}}",
										"type": "text"
									},
									{
										"key": "Accept",
										"value": "application/json",
										"type": "text"
									}
								],
								"url": {
									"raw": "{{API_BASE_URL}}/ais/v2/connect",
									"host": [
										"{{API_BASE_URL}}"
									],
									"path": [
										"ais",
										"v2",
										"connect"
									]
								},
								"description": "NOT DESCRIBED"
							},
							"response": []
						},
						{
							"name": "Redirect the user",
							"event": [
								{
									"listen": "test",
									"script": {
										"exec": [
											"// On redirection extract the code received",
											"const fintecture_redirect_url = pm.response.headers.get('location');",
											"",
											"const query_params = fintecture_redirect_url?.split('?');",
											"const bank_code = query_params ? query_params[1].split('&').find(e => e.indexOf('code=') !== -1)?.replace('code=','') : undefined;",
											"const customer_id =  query_params ? query_params[1].split('&').find(e => e.indexOf('customer_id=') !== -1)?.replace('customer_id=','') : undefined;",
											"",
											"// Set Postman variables",
											"pm.collectionVariables.set(\"bank_code\", bank_code);",
											"pm.collectionVariables.set(\"customer_id\", customer_id);",
											""
										],
										"type": "text/javascript"
									}
								}
							],
							"protocolProfileBehavior": {
								"followRedirects": true
							},
							"request": {
								"method": "GET",
								"header": [
									{
										"key": "referer",
										"value": "{{location}}",
										"type": "default",
										"disabled": true
									}
								],
								"url": {
									"raw": "{{connect_url}}",
									"host": [
										"{{connect_url}}"
									]
								}
							},
							"response": []
						},
						{
							"name": "Exchange the code for an access token",
							"event": [
								{
									"listen": "prerequest",
									"script": {
										"exec": [
											"// Request a PIS access token",
											"const grant_type = \"authorization_code\";",
											"const scope = \"AIS\";",
											"",
											"// Retrieve app_id and app_secret from variables",
											"const app_id = pm.collectionVariables.get(\"app_id\");",
											"const app_secret = pm.collectionVariables.get(\"app_secret\");",
											"",
											"// Encode your credentials using Base64",
											"let keys = app_id + \":\" + app_secret;",
											"let encodedKeys = CryptoJS.enc.Base64.stringify(CryptoJS.enc.Utf8.parse(keys));",
											"",
											"// Set Postman variables",
											"pm.collectionVariables.set(\"base64_token\", encodedKeys);",
											"pm.collectionVariables.set(\"grant_type\", grant_type);",
											"pm.collectionVariables.set(\"scope\", scope);",
											""
										],
										"type": "text/javascript"
									}
								},
								{
									"listen": "test",
									"script": {
										"exec": [
											"// Extract access_token, expires_in & refresh_token from provided response body",
											"const res = pm.response.json();",
											"",
											"const access_token = res.access_token;",
											"const expires_in = res.expires_in;",
											"const refresh_token = res.refresh_token;",
											"",
											"// Set Postman variable",
											"pm.collectionVariables.set(\"access_token\", access_token);"
										],
										"type": "text/javascript"
									}
								}
							],
							"request": {
								"method": "POST",
								"header": [
									{
										"key": "Authorization",
										"value": "Basic {{base64_token}}",
										"type": "default"
									},
									{
										"key": "Accept",
										"value": "application/json",
										"type": "default"
									},
									{
										"key": "Content-Type",
										"value": "application/x-www-form-urlencoded",
										"type": "default"
									}
								],
								"body": {
									"mode": "urlencoded",
									"urlencoded": [
										{
											"key": "grant_type",
											"value": "{{grant_type}}",
											"type": "default"
										},
										{
											"key": "code",
											"value": "{{bank_code}}",
											"type": "default"
										},
										{
											"key": "scope",
											"value": "{{scope}}",
											"type": "default"
										}
									]
								},
								"url": {
									"raw": "{{API_BASE_URL}}/oauth/accesstoken",
									"host": [
										"{{API_BASE_URL}}"
									],
									"path": [
										"oauth",
										"accesstoken"
									]
								}
							},
							"response": []
						},
						{
							"name": "Recover account's transactions",
							"event": [
								{
									"listen": "prerequest",
									"script": {
										"exec": [
											"// Fill path parameters",
											"const customer_id = \"\" // mandatory",
											"const account_id = \"\" // mandatory",
											"",
											"pm.collectionVariables.set(\"customer_id\", customer_id);",
											"pm.collectionVariables.set(\"account_id\", account_id);"
										],
										"type": "text/javascript"
									}
								},
								{
									"listen": "test",
									"script": {
										"exec": [
											""
										],
										"type": "text/javascript"
									}
								}
							],
							"request": {
								"method": "GET",
								"header": [
									{
										"key": "Authorization",
										"value": "Bearer {{access_token}}",
										"type": "default"
									},
									{
										"key": "Accept",
										"value": "application/json",
										"type": "default"
									},
									{
										"key": "app_id",
										"value": "{{app_id}}",
										"type": "default"
									}
								],
								"url": {
									"raw": "{{API_BASE_URL}}/ais/v1/customer/{{customer_id}}/accounts/{{account_id}}/transactions",
									"host": [
										"{{API_BASE_URL}}"
									],
									"path": [
										"ais",
										"v1",
										"customer",
										"{{customer_id}}",
										"accounts",
										"{{account_id}}",
										"transactions"
									]
								}
							},
							"response": []
						}
					],
					"description": "[https://doc.fintecture.com/docs/api-recover-bank-account-transactions](https://doc.fintecture.com/docs/api-recover-bank-account-transactions)"
				}
			],
			"event": [
				{
					"listen": "prerequest",
					"script": {
						"type": "text/javascript",
						"exec": [
							""
						]
					}
				},
				{
					"listen": "test",
					"script": {
						"type": "text/javascript",
						"exec": [
							""
						]
					}
				}
			]
		}
	],
	"event": [
		{
			"listen": "prerequest",
			"script": {
				"type": "text/javascript",
				"exec": [
					"utils = {",
					"    signRequest: function (req) {",
					"",
					"        // Load ForgeJS for signing",
					"        eval(pm.globals.get(\"forgeJS\"));",
					"",
					"        // Get data for signature",
					"        const moment = require(\"moment\");        ",
					"        const uuid = require(\"uuid\");",
					"",
					"        const date = moment().utc().format(\"ddd, DD MMM YYYY HH:mm:ss\") + \" GMT\";",
					"        const xRequestId = uuid.v4();",
					"",
					"        const method = pm.request.method.toLowerCase();",
					"        const host = req.url.getHost().toLowerCase();",
					"        const path = req.url.getPath();",
					"        const contentType = req.headers.get('Content-Type');",
					"        const payload = pm.collectionVariables.get(\"payload\");",
					"",
					"        const appId = pm.collectionVariables.get(\"app_id\"); ",
					"        if (!appId)",
					"            throw new Error('app_id is missing');",
					"            ",
					"        const privateKey = pm.collectionVariables.get(\"private_key\");",
					"        if (!privateKey) ",
					"            throw new Error(\"private_key is missing\");",
					"",
					"        // Build the message digest (in case of POST/PUT/PATCH)",
					"        let digest;",
					"        let headers;",
					"        let normalizedString;    ",
					"",
					"        if (method === \"post\" || method === \"put\" || method === \"patch\") {",
					"            digest = utils.calculateDigest(contentType, payload);",
					"            headers = 'date digest x-request-id' ;",
					"            normalizedString = ",
					"                // `(request-target): ${method} ${path}\\n` +",
					"                `date: ${date}\\n` +",
					"                `digest: ${digest}\\n` +",
					"                `x-request-id: ${xRequestId}`;        ",
					"",
					"        }",
					"        else {",
					"            headers = 'date x-request-id' ;",
					"            normalizedString = ",
					"                // `(request-target): ${method} ${path}\\n` +",
					"                `date: ${date}\\n` +",
					"                `x-request-id: ${xRequestId}`;        ",
					"        }",
					"        console.log('normalizedString:'+normalizedString);",
					"",
					"        // Encrypt the signing string",
					"        const encryptedSignature = utils.signString(privateKey, normalizedString);",
					"",
					"        // Create the signature string",
					"        const signatureHeader = `keyId=\"${appId}\",algorithm=\"rsa-sha256\",headers=\"${headers}\",signature=\"${encryptedSignature}\"`;",
					"        console.log('signatureHeader:'+signatureHeader);",
					"",
					"         // Returning all new environment variables",
					"          const fintectureSignature = {",
					"            digest: digest,",
					"            date: date,",
					"            host: host,",
					"            signatureHeader: signatureHeader,",
					"            xRequestId: xRequestId",
					"        }",
					"    ",
					"        return fintectureSignature;",
					"    },",
					"",
					"    generateJwt: function (header, payload, jwtPrivateKey) {",
					"        var navigator = {};",
					"        var window = {};",
					"",
					"        eval(pm.globals.get(\"jsrsasign\"));",
					"",
					"        var sHeader = JSON.stringify(header);",
					"        var sPayload = JSON.stringify(payload);",
					"        ",
					"",
					"        var signedToken = KJUR.jws.JWS.sign(header.alg, sHeader, sPayload, jwtPrivateKey);",
					"",
					"        return signedToken;",
					"    },",
					"",
					"    calculateDigest: function(contentType, payload) {",
					"        const CryptoJS = require('crypto-js');    ",
					"",
					"        const requestData = utils.resolveRequestBody(contentType, payload);",
					"        console.log(\"Request data:\" + requestData);",
					"",
					"        const sha256digest = CryptoJS.SHA256(requestData);",
					"        const base64sha256 = CryptoJS.enc.Base64.stringify(sha256digest);",
					"        const calculatedDigest = 'SHA-256=' + base64sha256;",
					"    ",
					"        console.log(`Digest header: ${calculatedDigest}`);",
					"        return calculatedDigest;",
					"    },",
					"",
					"    getPrivateKey: function (eidasPrivateKey) {",
					"        eval(pm.globals.get(\"forgeJS\"));",
					"    ",
					"        if (!eidasPrivateKey.includes('PRIVATE KEY')) {",
					"            eidasPrivateKey = \"-----BEGIN RSA PRIVATE KEY-----\\n\" + eidasPrivateKey + \"\\n\" + \"-----END RSA PRIVATE KEY-----\";",
					"        }",
					"    ",
					"        return forge.pki.privateKeyFromPem(eidasPrivateKey);",
					"    },",
					"",
					"    resolveRequestBody: function(contentType, payload) {",
					"    ",
					"        if (contentType === \"application/x-www-form-urlencoded\") {",
					"            const data = Object.keys(payload)",
					"                .map(key => key + \"=\" + payload[key])",
					"                .join('&');",
					"            return utils.resolveVariables(data);",
					"        } else if (Object.entries(payload).length === 0 && payload.constructor === Object) {",
					"            return \"\";",
					"        }",
					"    ",
					"        return utils.resolveVariables(payload.toString());",
					"    },",
					"",
					"    resolveVariables: function(bodyWithVariables) {",
					"        return bodyWithVariables.replace(/{{(\\w*)}}/g, (str, key) => {",
					"            const value = pm.collectionVariables.get(key);",
					"            return value === null ? \"\" : value;",
					"        });",
					"    },",
					"",
					"    signString: function(jwtPrivateKey, stringToBeSigned) {",
					"        ",
					"        eval(pm.globals.get(\"forgeJS\"));",
					"    ",
					"        const messageDigest = forge.md.sha256.create();",
					"        messageDigest.update(stringToBeSigned, \"utf8\");",
					"        return forge.util.encode64(utils.getPrivateKey(jwtPrivateKey).sign(messageDigest));",
					"    }",
					"}"
				]
			}
		},
		{
			"listen": "test",
			"script": {
				"type": "text/javascript",
				"exec": [
					""
				]
			}
		}
	],
	"variable": [
		{
			"key": "API_BASE_URL",
			"value": "https://api.sandbox.fintecture.com",
			"type": "string"
		},
		{
			"key": "app_id",
			"value": "",
			"type": "string"
		},
		{
			"key": "app_secret",
			"value": "",
			"type": "string"
		},
		{
			"key": "redirect_uri",
			"value": ""
		},
		{
			"key": "private_key",
			"value": "",
			"type": "string"
		},
		{
			"key": "origin_uri",
			"value": ""
		},
		{
			"key": "state",
			"value": "123"
		},
		{
			"key": "country_code",
			"value": "FR"
		},
		{
			"key": "language",
			"value": "fr"
		},
		{
			"key": "psu_type",
			"value": ""
		},
		{
			"key": "provider",
			"value": ""
		},
		{
			"key": "with_beneficiary",
			"value": "false"
		},
		{
			"key": "with_virtualbeneficiary",
			"value": "false"
		},
		{
			"key": "base64_token",
			"value": ""
		},
		{
			"key": "access_token",
			"value": ""
		},
		{
			"key": "request_id",
			"value": ""
		},
		{
			"key": "payload",
			"value": ""
		},
		{
			"key": "session_id",
			"value": ""
		},
		{
			"key": "connect_url",
			"value": ""
		},
		{
			"key": "customer_id",
			"value": ""
		},
		{
			"key": "account_id",
			"value": ""
		},
		{
			"key": "grant_type",
			"value": ""
		},
		{
			"key": "scope",
			"value": ""
		},
		{
			"key": "date",
			"value": ""
		},
		{
			"key": "digest",
			"value": ""
		},
		{
			"key": "signature",
			"value": ""
		},
		{
			"key": "xRequestId",
			"value": ""
		}
	]
}