{
	"info": {
		"_postman_id": "03a31df2-4772-4970-971e-7ab28084aa48",
		"name": "Adyen Terminal API",
		"description": "## Overview\n\nThe Adyen Terminal API lets you make payments, issue refunds, collect shopper information, and perform other shopper-terminal interactions using a payment terminal supplied by Adyen.\n\nThis API reference provides information on available operations and how to use them. To learn more about the terminal API, visit [terminal API documentation](https://docs.adyen.com/point-of-sale/design-your-integration/terminal-api/). To know about In-Person payments, visit [In-Person payments documentation.](https://docs.adyen.com/point-of-sale/)\n\nThe collection consists of only operations using terminal API. For other operations like capture a payment, pay with token in case of recurring payments, authorisation adjustments, use [Adyen's checkout API](https://www.postman.com/adyendev/workspace/adyen-apis/collection/25716737-46ad970e-dc9e-4246-bac2-769c6083e7b5) collection. For operations like create stores, manage terminal fleet, use [Adyen's management API collection](https://www.postman.com/adyendev/workspace/adyen-apis/collection/25716737-00d5d4da-fec7-4c1a-a63f-76fcd6c1532d).\n\n## How to use it\n\n**Fork** the \"Adyen Terminal API env\" environment and configure the variables: Base URL, API key etc..\n\n> VERY IMPORTANT: fork it in a PRIVATE workspace. Keep your credentials, tokens and sensitive data private. \n  \n\nFill the variables values before sending any request.\n\n`baseUrl`: The endpoint you are using to process payments. [More info](https://docs.adyen.com/point-of-sale/design-your-integration/terminal-api#cloud).\n\n`X-API-Key`: The API Key of the web service user you want to use to process the payment. You get this API key from [Adyen's Customer Area](https://docs.adyen.com/point-of-sale/design-your-integration/terminal-api#api-key). This key is needed only for cloud terminal API.\n\n`poiId`: The terminal ID of the tarminal that is going to be use for payments. e.g. V400m-321987654\n\n`saleId`: Your unique ID for the POS system component to send this request from.e.g. **TestPOS**\n\n`currency`: The currency you want to process the payment.e.g. **EUR**\n\n**Fork** the Adyen Terminal API collection",
		"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
		"_exporter_id": "19718139"
	},
	"item": [
		{
			"name": "Payments",
			"item": [
				{
					"name": "Payment request",
					"event": [
						{
							"listen": "prerequest",
							"script": {
								"exec": [
									""
								],
								"type": "text/javascript"
							}
						},
						{
							"listen": "test",
							"script": {
								"exec": [
									""
								],
								"type": "text/javascript"
							}
						}
					],
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Content-Type",
								"name": "Content-Type",
								"value": "application/json",
								"type": "text"
							}
						],
						"body": {
							"mode": "raw",
							"raw": "{\n    \"SaleToPOIRequest\": {\n        \"MessageHeader\": {\n            \"ProtocolVersion\": \"3.0\",\n            \"MessageClass\": \"Service\",\n            \"MessageCategory\": \"Payment\",\n            \"MessageType\": \"Request\",\n            \"SaleID\": \"{{saleId}}\",\n            \"ServiceID\": \"{{serviceId}}\",\n            \"POIID\": \"{{poiId}}\"\n        },\n        \"PaymentRequest\": {\n            \"SaleData\": {\n                \"SaleTransactionID\": {\n                    \"TransactionID\":\"{{$timestamp}}\",\n                    \"TimeStamp\":\"{{$isoTimestamp}}\"\n                },\n                \"SaleToAcquirerData\": \"tenderOption=ReceiptHandler&applicationInfo.merchantApplication.name=NAME_OF_POS_APPLICATION&applicationInfo.merchantApplication.version=2.13.05&applicationInfo.externalPlatform.name=COMPANY_NAME_OR_PLATFORM_NAME&applicationInfo.externalPlatform.version=1.3&applicationInfo.externalPlatform.integrator=COMPANY_THAT_BUILT_INTEGRATION_OR_POS_APP&applicationInfo.merchantDevice.os=OS_OF_DEVICE_THAT_RUNS_POS_APPLICATION&applicationInfo.merchantDevice.osVersion=16.3&metadata.someMetaDataKey1=YOUR_VALUE&metadata.someMetaDataKey2=YOUR_VALUE\",\n                \"OperatorID\": \"Sara\",\n                \"ShiftNumber\": \"2\"\n            },\n            \"PaymentTransaction\": {\n                \"AmountsReq\": {\n                    \"Currency\": \"{{currency}}\",\n                    \"RequestedAmount\": 30\n                }\n            }\n        }\n    }\n}",
							"options": {
								"raw": {
									"language": "json"
								}
							}
						},
						"url": {
							"raw": "{{baseUrl}}",
							"host": [
								"{{baseUrl}}"
							]
						}
					},
					"response": []
				},
				{
					"name": "Payment request with Cashback",
					"event": [
						{
							"listen": "prerequest",
							"script": {
								"exec": [
									""
								],
								"type": "text/javascript"
							}
						},
						{
							"listen": "test",
							"script": {
								"exec": [
									""
								],
								"type": "text/javascript"
							}
						}
					],
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Content-Type",
								"name": "Content-Type",
								"value": "application/json",
								"type": "text"
							}
						],
						"body": {
							"mode": "raw",
							"raw": "{\n    \"SaleToPOIRequest\": {\n        \"MessageHeader\": {\n            \"ProtocolVersion\": \"3.0\",\n            \"MessageClass\": \"Service\",\n            \"MessageCategory\": \"Payment\",\n            \"MessageType\": \"Request\",\n            \"SaleID\": \"{{saleId}}\",\n            \"ServiceID\": \"{{serviceId}}\",\n            \"POIID\": \"{{poiId}}\"\n        },\n        \"PaymentRequest\": {\n            \"SaleData\": {\n                \"SaleTransactionID\": {\n                    \"TransactionID\":\"{{$timestamp}}\",\n                    \"TimeStamp\":\"{{$isoTimestamp}}\"\n                },\n                \"SaleToAcquirerData\": \"tenderOption=ReceiptHandler&applicationInfo.merchantApplication.name=NAME_OF_POS_APPLICATION&applicationInfo.merchantApplication.version=2.13.05&applicationInfo.externalPlatform.name=COMPANY_NAME_OR_PLATFORM_NAME&applicationInfo.externalPlatform.version=1.3&applicationInfo.externalPlatform.integrator=COMPANY_THAT_BUILT_INTEGRATION_OR_POS_APP&applicationInfo.merchantDevice.os=OS_OF_DEVICE_THAT_RUNS_POS_APPLICATION&applicationInfo.merchantDevice.osVersion=16.3&metadata.someMetaDataKey1=YOUR_VALUE&metadata.someMetaDataKey2=YOUR_VALUE\",\n                \"OperatorID\": \"Sara\",\n                \"ShiftNumber\": \"2\"\n            },\n            \"PaymentTransaction\": {\n                \"AmountsReq\": {\n                    \"Currency\": \"{{currency}}\",\n                    \"RequestedAmount\": 20.00,\n                    \"CashBackAmount\": 2.00\n                }\n            }\n        }\n    }\n}",
							"options": {
								"raw": {
									"language": "json"
								}
							}
						},
						"url": {
							"raw": "{{baseUrl}}",
							"host": [
								"{{baseUrl}}"
							]
						}
					},
					"response": []
				},
				{
					"name": "Platform Payment request",
					"event": [
						{
							"listen": "prerequest",
							"script": {
								"exec": [
									""
								],
								"type": "text/javascript"
							}
						},
						{
							"listen": "test",
							"script": {
								"exec": [
									""
								],
								"type": "text/javascript"
							}
						}
					],
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Content-Type",
								"name": "Content-Type",
								"value": "application/json",
								"type": "text"
							}
						],
						"body": {
							"mode": "raw",
							"raw": "{\n    \"SaleToPOIRequest\": {\n        \"MessageHeader\": {\n            \"ProtocolVersion\": \"3.0\",\n            \"MessageClass\": \"Service\",\n            \"MessageCategory\": \"Payment\",\n            \"MessageType\": \"Request\",\n            \"SaleID\": \"{{saleId}}\",\n            \"ServiceID\": \"{{serviceId}}\",\n            \"POIID\": \"{{poiId}}\"\n        },\n        \"PaymentRequest\": {\n            \"SaleData\": {\n                \"SaleTransactionID\": {\n                    \"TransactionID\":\"{{$timestamp}}\",\n                    \"TimeStamp\":\"{{$isoTimestamp}}\"\n                },\n                \"SaleToAcquirerData\": \"tenderOption=ReceiptHandler&applicationInfo.merchantApplication.name=NAME_OF_POS_APPLICATION&applicationInfo.merchantApplication.version=2.13.05&applicationInfo.externalPlatform.name=COMPANY_NAME_OR_PLATFORM_NAME&applicationInfo.externalPlatform.version=1.3&applicationInfo.externalPlatform.integrator=COMPANY_THAT_BUILT_INTEGRATION_OR_POS_APP&applicationInfo.merchantDevice.os=OS_OF_DEVICE_THAT_RUNS_POS_APPLICATION&applicationInfo.merchantDevice.osVersion=16.3&metadata.someMetaDataKey1=YOUR_VALUE&metadata.someMetaDataKey2=YOUR_VALUE&split.api=1&split.nrOfItems=2&split.totalAmount=62000&split.currencyCode=EUR&split.item1.amount=60000&split.item1.type=BalanceAccount&split.item1.account=BA00000000000000000000001&split.item1.reference=TestPayment&split.item1.description=TestDescription&split.item2.amount=2000&split.item2.type=Commission&split.item2.reference=TestCommission\",\n                \"OperatorID\": \"Sara\",\n                \"ShiftNumber\": \"2\"\n            },\n            \"PaymentTransaction\": {\n                \"AmountsReq\": {\n                    \"Currency\": \"{{currency}}\",\n                    \"RequestedAmount\": 20.00\n                }\n            }\n        }\n    }\n}",
							"options": {
								"raw": {
									"language": "json"
								}
							}
						},
						"url": {
							"raw": "{{baseUrl}}",
							"host": [
								"{{baseUrl}}"
							]
						}
					},
					"response": []
				},
				{
					"name": "Payment request Tokenisation",
					"event": [
						{
							"listen": "test",
							"script": {
								"exec": [
									"var responseJson = JSON.parse(responseBody);",
									"if (typeof responseJson.SaleToPOIRequest === 'undefined') {",
									"    //Transaction result",
									"    console.log(\"Result: \" + responseJson.SaleToPOIResponse.PaymentResponse.Response.Result);",
									"    //Get additional response",
									"    var additionalResponseString = responseJson.SaleToPOIResponse.PaymentResponse.Response.AdditionalResponse;",
									"    var additionalResponseJsonString = '{\"' + additionalResponseString.replace(/&/g, '\", \"').replace(/=/g, '\": \"') + '\"}';",
									"    var additionalResponseJson = JSON.parse(additionalResponseJsonString);",
									"    console.log(\"Result: \" + responseJson.SaleToPOIResponse.PaymentResponse.Response.Result);",
									"    //Get receipt info",
									"    ",
									"",
									"    //If the result is \"Success\", we save some info",
									"    if (responseJson.SaleToPOIResponse.PaymentResponse.Response.Result == \"Success\") {",
									"",
									"        //recurring detail reference",
									"        ",
									"",
									"        var token = additionalResponseJson[\"recurring.recurringDetailReference\"];",
									"        console.log(\"token \" + token);",
									"        pm.globals.set(\"token\", token);",
									"",
									"        //shopper reference",
									"        var shopperReference = additionalResponseJson[\"recurring.shopperReference\"];",
									"        console.log(\"shopperReference \" + shopperReference);",
									"        pm.globals.set(\"shopperReference\", shopperReference);",
									"    } else {",
									"        console.log(\"Error condition: \" + responseJson.SaleToPOIResponse.PaymentResponse.Response.ErrorCondition);",
									"    }",
									"} else {",
									"    //In case of error we get the error message",
									"    console.log(decodeURIComponent(responseJson.SaleToPOIRequest.EventNotification.EventDetails));",
									"",
									"}",
									"",
									"",
									"",
									""
								],
								"type": "text/javascript"
							}
						},
						{
							"listen": "prerequest",
							"script": {
								"exec": [
									""
								],
								"type": "text/javascript"
							}
						}
					],
					"request": {
						"method": "POST",
						"header": [],
						"body": {
							"mode": "raw",
							"raw": "{\n    \"SaleToPOIRequest\": {\n        \"MessageHeader\": {\n            \"ProtocolVersion\": \"3.0\",\n            \"MessageClass\": \"Service\",\n            \"MessageCategory\": \"Payment\",\n            \"MessageType\": \"Request\",\n            \"SaleID\": \"{{saleId}}\",\n            \"ServiceID\": \"{{serviceId}}\",\n            \"POIID\": \"{{poiId}}\"\n        },\n        \"PaymentRequest\": {\n            \"SaleData\": {\n                \"SaleTransactionID\": {\n                    \"TransactionID\":\"{{$timestamp}}\",\n                    \"TimeStamp\":\"{{$isoTimestamp}}\" \n                },\n                \"SaleToAcquirerData\": \"tenderOption=ReceiptHandler&applicationInfo.merchantApplication.name=NAME_OF_POS_APPLICATION&applicationInfo.merchantApplication.version=2.13.05&applicationInfo.externalPlatform.name=COMPANY_NAME_OR_PLATFORM_NAME&applicationInfo.externalPlatform.version=1.3&applicationInfo.externalPlatform.integrator=COMPANY_THAT_BUILT_INTEGRATION_OR_POS_APP&applicationInfo.merchantDevice.os=OS_OF_DEVICE_THAT_RUNS_POS_APPLICATION&applicationInfo.merchantDevice.osVersion=16.3&metadata.someMetaDataKey1=YOUR_VALUE&metadata.someMetaDataKey2=YOUR_VALUE&shopperEmail=S.Hopper@example.com&shopperReference=YOUR_UNIQUE_SHOPPER_ID&recurringProcessingModel=Subscription\",\n                \"TokenRequestedType\": \"Customer\",\n                \"OperatorID\": \"Sara\",\n                \"ShiftNumber\": \"2\"\n            },\n            \"PaymentTransaction\": {\n                \"AmountsReq\": {\n                    \"Currency\": \"{{currency}}\",\n                    \"RequestedAmount\": 2\n                }\n            }\n        }\n    }\n}",
							"options": {
								"raw": {
									"language": "json"
								}
							}
						},
						"url": {
							"raw": "{{baseUrl}}",
							"host": [
								"{{baseUrl}}"
							]
						}
					},
					"response": []
				},
				{
					"name": "MOTO payment",
					"event": [
						{
							"listen": "prerequest",
							"script": {
								"exec": [
									""
								],
								"type": "text/javascript"
							}
						},
						{
							"listen": "test",
							"script": {
								"exec": [
									""
								],
								"type": "text/javascript"
							}
						}
					],
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Content-Type",
								"name": "Content-Type",
								"value": "application/json",
								"type": "text"
							}
						],
						"body": {
							"mode": "raw",
							"raw": "{\n    \"SaleToPOIRequest\": {\n        \"MessageHeader\": {\n            \"ProtocolVersion\": \"3.0\",\n            \"MessageClass\": \"Service\",\n            \"MessageCategory\": \"Payment\",\n            \"MessageType\": \"Request\",\n            \"SaleID\": \"{{saleId}}\",\n            \"ServiceID\": \"{{serviceId}}\",\n            \"POIID\": \"{{poiId}}\"\n        },\n        \"PaymentRequest\": {\n            \"SaleData\": {\n                \"SaleTransactionID\": {\n                    \"TransactionID\":\"{{$timestamp}}\",\n                    \"TimeStamp\":\"{{$isoTimestamp}}\"\n                },\n                \"SaleToAcquirerData\": \"tenderOption=ReceiptHandler&applicationInfo.merchantApplication.name=NAME_OF_POS_APPLICATION&applicationInfo.merchantApplication.version=2.13.05&applicationInfo.externalPlatform.name=COMPANY_NAME_OR_PLATFORM_NAME&applicationInfo.externalPlatform.version=1.3&applicationInfo.externalPlatform.integrator=COMPANY_THAT_BUILT_INTEGRATION_OR_POS_APP&applicationInfo.merchantDevice.os=OS_OF_DEVICE_THAT_RUNS_POS_APPLICATION&applicationInfo.merchantDevice.osVersion=16.3&metadata.someMetaDataKey1=YOUR_VALUE&metadata.someMetaDataKey2=YOUR_VALUE\",\n                \"OperatorID\": \"Sara\",\n                \"ShiftNumber\": \"2\"\n            },\n            \"PaymentTransaction\": {\n                \"AmountsReq\": {\n                    \"Currency\": \"{{currency}}\",\n                    \"RequestedAmount\": 700\n                }\n            }\n        }\n    }\n}",
							"options": {
								"raw": {
									"language": "json"
								}
							}
						},
						"url": {
							"raw": "{{baseUrl}}",
							"host": [
								"{{baseUrl}}"
							]
						}
					},
					"response": []
				},
				{
					"name": "MKE payment",
					"event": [
						{
							"listen": "prerequest",
							"script": {
								"exec": [
									""
								],
								"type": "text/javascript"
							}
						},
						{
							"listen": "test",
							"script": {
								"exec": [
									""
								],
								"type": "text/javascript"
							}
						}
					],
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Content-Type",
								"name": "Content-Type",
								"value": "application/json",
								"type": "text"
							}
						],
						"body": {
							"mode": "raw",
							"raw": "{\n    \"SaleToPOIRequest\": {\n        \"MessageHeader\": {\n            \"ProtocolVersion\": \"3.0\",\n            \"MessageClass\": \"Service\",\n            \"MessageCategory\": \"Payment\",\n            \"MessageType\": \"Request\",\n            \"SaleID\": \"{{saleId}}\",\n            \"ServiceID\": \"{{serviceId}}\",\n            \"POIID\": \"{{poiId}}\"\n        },\n        \"PaymentRequest\": {\n            \"SaleData\": {\n                \"SaleTransactionID\": {\n                    \"TransactionID\":\"{{$timestamp}}\",\n                    \"TimeStamp\":\"{{$isoTimestamp}}\"\n                },\n                \"SaleToAcquirerData\": \"tenderOption=ReceiptHandler&applicationInfo.merchantApplication.name=NAME_OF_POS_APPLICATION&applicationInfo.merchantApplication.version=2.13.05&applicationInfo.externalPlatform.name=COMPANY_NAME_OR_PLATFORM_NAME&applicationInfo.externalPlatform.version=1.3&applicationInfo.externalPlatform.integrator=COMPANY_THAT_BUILT_INTEGRATION_OR_POS_APP&applicationInfo.merchantDevice.os=OS_OF_DEVICE_THAT_RUNS_POS_APPLICATION&applicationInfo.merchantDevice.osVersion=16.3&metadata.someMetaDataKey1=YOUR_VALUE&metadata.someMetaDataKey2=YOUR_VALUE\",\n                \"OperatorID\": \"Sara\",\n                \"ShiftNumber\": \"2\"\n            },\n            \"PaymentTransaction\": {\n                \"AmountsReq\": {\n                    \"Currency\": \"{{currency}}\",\n                    \"RequestedAmount\": 700\n                },\n                \"TransactionConditions\": {\n                    \"ForceEntryMode\": [\n                        \"Keyed\"\n                    ]\n                }\n            }\n        }\n    }\n}",
							"options": {
								"raw": {
									"language": "json"
								}
							}
						},
						"url": {
							"raw": "{{baseUrl}}",
							"host": [
								"{{baseUrl}}"
							]
						}
					},
					"response": []
				}
			],
			"event": [
				{
					"listen": "prerequest",
					"script": {
						"type": "text/javascript",
						"exec": [
							"pm.globals.set(\"inProcessSaleId\", pm.environment.get(\"saleId\"));",
							"pm.globals.set(\"inProcessServiceId\", pm.globals.get(\"serviceId\"));",
							"pm.globals.set(\"inProcessMessageCategory\", \"Payment\");"
						]
					}
				},
				{
					"listen": "test",
					"script": {
						"type": "text/javascript",
						"exec": [
							"var responseJson = JSON.parse(responseBody);",
							"if (typeof responseJson.SaleToPOIRequest === 'undefined') {",
							"    //Transaction result",
							"    console.log(\"Result: \" + responseJson.SaleToPOIResponse.PaymentResponse.Response.Result);",
							"    //Get additional response",
							"    var additionalResponseString = responseJson.SaleToPOIResponse.PaymentResponse.Response.AdditionalResponse;",
							"    console.log(\"Result: \" + responseJson.SaleToPOIResponse.PaymentResponse.Response.Result);",
							"    //Get receipt info",
							"    if (typeof responseJson.SaleToPOIResponse.PaymentResponse.Response.ErrorCondition === 'undefined') {",
							"        var receiptInfo = responseJson.SaleToPOIResponse.PaymentResponse.PaymentReceipt;",
							"        receiptInfo.forEach(receipt);",
							"    }",
							"",
							"    //If the result is \"Success\", we save some info",
							"    if (responseJson.SaleToPOIResponse.PaymentResponse.Response.Result == \"Success\") {",
							"        //We save the time stamp",
							"        var paymentTimeStamp = responseJson.SaleToPOIResponse.PaymentResponse.POIData.POITransactionID.TimeStamp;",
							"        pm.globals.set(\"paymentTimeStamp\", paymentTimeStamp);",
							"",
							"        //Transaction ID (tender reference + psp reference)",
							"        var paymentTransactionID = responseJson.SaleToPOIResponse.PaymentResponse.POIData.POITransactionID.TransactionID;",
							"        pm.globals.set(\"paymentTransactionId\", paymentTransactionID);",
							"",
							"        //PSP reference",
							"        var pspReference = paymentTransactionID.split(\".\")[1];",
							"        pm.globals.set(\"pspReference\", pspReference);",
							"        console.log(\"PSP reference: \" + pspReference);",
							"",
							"        //Original POIID",
							"        var originalPOIID = responseJson.SaleToPOIResponse.MessageHeader.POIID;",
							"        pm.globals.set(\"originalPOIID\", originalPOIID);",
							"    } else {",
							"        console.log(\"Error condition: \" + responseJson.SaleToPOIResponse.PaymentResponse.Response.ErrorCondition);",
							"    }",
							"} else {",
							"    //In case of error we get the error message",
							"    console.log(decodeURIComponent(responseJson.SaleToPOIRequest.EventNotification.EventDetails));",
							"",
							"}",
							"",
							"//Parse receipt info",
							"function receipt(item, index, arr) {",
							"    var document = item.DocumentQualifier;",
							"    var receipts = {};",
							"    receipts[document] = {};",
							"",
							"    for (i = 0; i < item.OutputContent.OutputText.length; i++) {",
							"        var text = item.OutputContent.OutputText[i].Text.split('&');",
							"        var key = \"\";",
							"        var value = \"\";",
							"",
							"        for (j = 0; j < text.length; j++) {",
							"            var pair = text[j].split('=');",
							"",
							"            if (pair[0] == \"key\") {",
							"                key = pair[1];",
							"            }",
							"",
							"            if (pair[0] == \"value\") {",
							"                value = pair[1];",
							"            }",
							"        }",
							"        receipts[document][key] = decodeURIComponent(value);",
							"    }",
							"    console.log(receipts);",
							"}"
						]
					}
				}
			]
		},
		{
			"name": "Refund",
			"item": [
				{
					"name": "Referenced refund - Full",
					"event": [
						{
							"listen": "prerequest",
							"script": {
								"exec": [
									""
								],
								"type": "text/javascript"
							}
						},
						{
							"listen": "test",
							"script": {
								"exec": [
									"var responseJson = JSON.parse(responseBody);",
									"",
									"//Check if transaction was processed",
									"if (typeof responseJson.SaleToPOIRequest === 'undefined') {",
									"    //Transaction result",
									"    console.log(\"Result: \" + responseJson.SaleToPOIResponse.ReversalResponse.Response.Result);",
									"",
									"    //Get additional response",
									"    var additionalResponseString = responseJson.SaleToPOIResponse.ReversalResponse.Response.AdditionalResponse;",
									"",
									"    //Get receipt info",
									"    if (typeof responseJson.SaleToPOIResponse.ReversalResponse.Response.ErrorCondition === 'undefined') {",
									"        var receiptInfo = responseJson.SaleToPOIResponse.ReversalResponse.PaymentReceipt;",
									"        receiptInfo.forEach(receipt);",
									"    }",
									"",
									"    //If the result is \"Success\"",
									"    if (responseJson.SaleToPOIResponse.ReversalResponse.Response.Result == \"Success\") {",
									"",
									"        //PSP reference",
									"        var pspReference = responseJson.SaleToPOIResponse.ReversalResponse.POIData.POITransactionID.TransactionID;",
									"        console.log(\"PSP reference: \" + pspReference);",
									"",
									"    } else {",
									"        console.log(\"Error condition: \" + responseJson.SaleToPOIResponse.ReversalResponse.Response.ErrorCondition);",
									"    }",
									"} else {",
									"    //In case of error we get the error message",
									"    console.log(decodeURIComponent(responseJson.SaleToPOIRequest.EventNotification.EventDetails));",
									"}",
									"",
									"//Parse receipt info",
									"function receipt(item, index, arr) {",
									"    var document = item.DocumentQualifier;",
									"    var receipts = {};",
									"    receipts[document] = {};",
									"",
									"    for (i = 0; i < item.OutputContent.OutputText.length; i++) {",
									"        var text = item.OutputContent.OutputText[i].Text.split('&');",
									"        var key = \"\";",
									"        var value = \"\";",
									"",
									"        for (j = 0; j < text.length; j++) {",
									"            var pair = text[j].split('=');",
									"",
									"            if (pair[0] == \"key\") {",
									"                key = pair[1];",
									"            }",
									"",
									"            if (pair[0] == \"value\") {",
									"                value = pair[1];",
									"            }",
									"        }",
									"",
									"        receipts[document][key] = decodeURIComponent(value);",
									"    }",
									"",
									"    console.log(receipts);",
									"}"
								],
								"type": "text/javascript"
							}
						}
					],
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Content-Type",
								"name": "Content-Type",
								"type": "text",
								"value": "application/json"
							}
						],
						"body": {
							"mode": "raw",
							"raw": "{\n    \"SaleToPOIRequest\": {\n        \"MessageHeader\": {\n            \"ProtocolVersion\": \"3.0\",\n            \"MessageClass\": \"Service\",\n            \"MessageCategory\": \"Reversal\",\n            \"MessageType\": \"Request\",\n            \"SaleID\": \"{{saleId}}\",\n            \"ServiceID\": \"{{serviceId}}\",\n            \"POIID\": \"{{poiId}}\"\n        },\n        \"ReversalRequest\": {\n            \"OriginalPOITransaction\": {\n                \"POITransactionID\": {\n                    \"TransactionID\": \"{{paymentTransactionId}}\",\n                    \"TimeStamp\": \"{{paymentTimeStamp}}\"\n                },\n                \"POIID\": \"{{originalPOIID}}\"\n            },\n            \"SaleData\": {\n                \"SaleToAcquirerData\": \"tenderOption=ReceiptHandler&applicationInfo.merchantApplication.name=NAME_OF_POS_APPLICATION&applicationInfo.merchantApplication.version=2.13.05&applicationInfo.externalPlatform.name=COMPANY_NAME_OR_PLATFORM_NAME&applicationInfo.externalPlatform.version=1.3&applicationInfo.externalPlatform.integrator=COMPANY_THAT_BUILT_INTEGRATION_OR_POS_APP&applicationInfo.merchantDevice.os=OS_OF_DEVICE_THAT_RUNS_POS_APPLICATION&applicationInfo.merchantDevice.osVersion=16.3&metadata.someMetaDataKey1=YOUR_VALUE&metadata.someMetaDataKey2=YOUR_VALUE\",\n                \"SaleTransactionID\": {\n                    \"TransactionID\":\"{{$timestamp}}\",\n                    \"TimeStamp\":\"{{$isoTimestamp}}\"\n                },\n                \"OperatorID\": \"Sara\",\n                \"ShiftNumber\": \"2\"\n            },\n            \"ReversalReason\": \"MerchantCancel\"\n        }\n    }\n}",
							"options": {
								"raw": {
									"language": "json"
								}
							}
						},
						"url": {
							"raw": "{{baseUrl}}",
							"host": [
								"{{baseUrl}}"
							]
						}
					},
					"response": []
				},
				{
					"name": "Referenced refund - Partial",
					"event": [
						{
							"listen": "prerequest",
							"script": {
								"exec": [
									""
								],
								"type": "text/javascript"
							}
						},
						{
							"listen": "test",
							"script": {
								"exec": [
									"var responseJson = JSON.parse(responseBody);",
									"",
									"//Check if transaction was processed",
									"if (typeof responseJson.SaleToPOIRequest === 'undefined') {",
									"    //Transaction result",
									"    console.log(\"Result: \" + responseJson.SaleToPOIResponse.ReversalResponse.Response.Result);",
									"",
									"    //Get additional response",
									"    var additionalResponseString = responseJson.SaleToPOIResponse.ReversalResponse.Response.AdditionalResponse;",
									"",
									"    //Get receipt info",
									"    if (typeof responseJson.SaleToPOIResponse.ReversalResponse.Response.ErrorCondition === 'undefined') {",
									"        var receiptInfo = responseJson.SaleToPOIResponse.ReversalResponse.PaymentReceipt;",
									"        receiptInfo.forEach(receipt);",
									"    }",
									"",
									"    //If the result is \"Success\"",
									"    if (responseJson.SaleToPOIResponse.ReversalResponse.Response.Result == \"Success\") {",
									"",
									"        //PSP reference",
									"        var pspReference = responseJson.SaleToPOIResponse.ReversalResponse.POIData.POITransactionID.TransactionID;",
									"        console.log(\"PSP reference: \" + pspReference);",
									"",
									"    } else {",
									"        console.log(\"Error condition: \" + responseJson.SaleToPOIResponse.ReversalResponse.Response.ErrorCondition);",
									"    }",
									"} else {",
									"    //In case of error we get the error message",
									"    console.log(decodeURIComponent(responseJson.SaleToPOIRequest.EventNotification.EventDetails));",
									"}",
									"",
									"//Parse receipt info",
									"function receipt(item, index, arr) {",
									"    var document = item.DocumentQualifier;",
									"    var receipts = {};",
									"    receipts[document] = {};",
									"",
									"    for (i = 0; i < item.OutputContent.OutputText.length; i++) {",
									"        var text = item.OutputContent.OutputText[i].Text.split('&');",
									"        var key = \"\";",
									"        var value = \"\";",
									"",
									"        for (j = 0; j < text.length; j++) {",
									"            var pair = text[j].split('=');",
									"",
									"            if (pair[0] == \"key\") {",
									"                key = pair[1];",
									"            }",
									"",
									"            if (pair[0] == \"value\") {",
									"                value = pair[1];",
									"            }",
									"        }",
									"",
									"        receipts[document][key] = decodeURIComponent(value);",
									"    }",
									"",
									"    console.log(receipts);",
									"}"
								],
								"type": "text/javascript"
							}
						}
					],
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Content-Type",
								"name": "Content-Type",
								"type": "text",
								"value": "application/json"
							}
						],
						"body": {
							"mode": "raw",
							"raw": "{\n    \"SaleToPOIRequest\": {\n        \"MessageHeader\": {\n            \"ProtocolVersion\": \"3.0\",\n            \"MessageClass\": \"Service\",\n            \"MessageCategory\": \"Reversal\",\n            \"MessageType\": \"Request\",\n            \"SaleID\": \"{{saleId}}\",\n            \"ServiceID\": \"{{serviceId}}\",\n            \"POIID\": \"{{poiId}}\"\n        },\n        \"ReversalRequest\": {\n            \"OriginalPOITransaction\": {\n                \"POITransactionID\": {\n                    \"TransactionID\": \"{{paymentTransactionId}}\",\n                    \"TimeStamp\": \"{{paymentTimeStamp}}\"\n                },\n                \"POIID\": \"{{originalPOIID}}\"\n            },\n            \"SaleData\": {\n                \"SaleToAcquirerData\": \"tenderOption=ReceiptHandler&applicationInfo.merchantApplication.name=NAME_OF_POS_APPLICATION&applicationInfo.merchantApplication.version=2.13.05&applicationInfo.externalPlatform.name=COMPANY_NAME_OR_PLATFORM_NAME&applicationInfo.externalPlatform.version=1.3&applicationInfo.externalPlatform.integrator=COMPANY_THAT_BUILT_INTEGRATION_OR_POS_APP&applicationInfo.merchantDevice.os=OS_OF_DEVICE_THAT_RUNS_POS_APPLICATION&applicationInfo.merchantDevice.osVersion=16.3&metadata.someMetaDataKey1=YOUR_VALUE&metadata.someMetaDataKey2=YOUR_VALUE&currency={{currency}}\",\n                \"SaleTransactionID\": {\n                    \"TransactionID\": \"{{$timestamp}}\",\n                    \"TimeStamp\": \"{{$isoTimestamp}}\"\n                },\n                \"OperatorID\": \"Sara\",\n                \"ShiftNumber\": \"2\"\n            },\n            \"ReversalReason\": \"MerchantCancel\",\n            \"ReversedAmount\": 3.00\n        }\n    }\n}",
							"options": {
								"raw": {
									"language": "json"
								}
							}
						},
						"url": {
							"raw": "{{baseUrl}}",
							"host": [
								"{{baseUrl}}"
							]
						}
					},
					"response": []
				},
				{
					"name": "Unreferenced refund",
					"event": [
						{
							"listen": "prerequest",
							"script": {
								"exec": [
									"pm.globals.set(\"inProcessSaleId\", pm.environment.get(\"saleId\"));",
									"pm.globals.set(\"inProcessServiceId\", pm.globals.get(\"serviceId\"));",
									"pm.globals.set(\"inProcessMessageCategory\", \"Payment\");",
									""
								],
								"type": "text/javascript"
							}
						},
						{
							"listen": "test",
							"script": {
								"exec": [
									"var responseJson = JSON.parse(responseBody);",
									"",
									"//Check if transaction was processed",
									"if (typeof responseJson.SaleToPOIRequest === 'undefined') {",
									"    //Transaction result",
									"    console.log(\"Result: \" + responseJson.SaleToPOIResponse.PaymentResponse.Response.Result);",
									"",
									"    //Get additional response",
									"    var additionalResponseString = responseJson.SaleToPOIResponse.PaymentResponse.Response.AdditionalResponse;",
									"",
									"    //Get receipt info",
									"    if (typeof responseJson.SaleToPOIResponse.PaymentResponse.Response.ErrorCondition === 'undefined') {",
									"        var receiptInfo = responseJson.SaleToPOIResponse.PaymentResponse.PaymentReceipt;",
									"        receiptInfo.forEach(receipt);",
									"    }",
									"",
									"    //If the result is \"Success\", we save some info",
									"    if (responseJson.SaleToPOIResponse.PaymentResponse.Response.Result == \"Success\") {",
									"        //We save the time stamp",
									"        var paymentTimeStamp = responseJson.SaleToPOIResponse.PaymentResponse.POIData.POITransactionID.TimeStamp;",
									"        pm.globals.set(\"paymentTimeStamp\", paymentTimeStamp);",
									"",
									"        //Transaction ID (tender reference + psp reference)",
									"        var paymentTransactionID = responseJson.SaleToPOIResponse.PaymentResponse.POIData.POITransactionID.TransactionID;",
									"        pm.globals.set(\"paymentTransactionId\", paymentTransactionID);",
									"",
									"        //PSP reference",
									"        var pspReference = paymentTransactionID.split(\".\")[1];",
									"        pm.globals.set(\"pspReference\", pspReference);",
									"        console.log(\"PSP reference: \" + pspReference);",
									"",
									"        //Original POIID",
									"        var originalPOIID = responseJson.SaleToPOIResponse.MessageHeader.POIID;",
									"        pm.globals.set(\"originalPOIID\", originalPOIID);",
									"    } else {",
									"        console.log(\"Error condition: \" + responseJson.SaleToPOIResponse.PaymentResponse.Response.ErrorCondition);",
									"    }",
									"} else {",
									"    //In case of error we get the error message",
									"    console.log(decodeURIComponent(responseJson.SaleToPOIRequest.EventNotification.EventDetails));",
									"}",
									"",
									"//Parse receipt info",
									"function receipt(item, index, arr) {",
									"    var document = item.DocumentQualifier;",
									"    var receipts = {};",
									"    receipts[document] = {};",
									"",
									"    for (i = 0; i < item.OutputContent.OutputText.length; i++) {",
									"        var text = item.OutputContent.OutputText[i].Text.split('&');",
									"        var key = \"\";",
									"        var value = \"\";",
									"",
									"        for (j = 0; j < text.length; j++) {",
									"            var pair = text[j].split('=');",
									"",
									"            if (pair[0] == \"key\") {",
									"                key = pair[1];",
									"            }",
									"",
									"            if (pair[0] == \"value\") {",
									"                value = pair[1];",
									"            }",
									"        }",
									"",
									"        receipts[document][key] = decodeURIComponent(value);",
									"    }",
									"",
									"    console.log(receipts);",
									"}",
									"",
									""
								],
								"type": "text/javascript"
							}
						}
					],
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Content-Type",
								"name": "Content-Type",
								"value": "application/json",
								"type": "text"
							}
						],
						"body": {
							"mode": "raw",
							"raw": "{\n    \"SaleToPOIRequest\": {\n        \"MessageHeader\": {\n            \"ProtocolVersion\": \"3.0\",\n            \"MessageClass\": \"Service\",\n            \"MessageCategory\": \"Payment\",\n            \"MessageType\": \"Request\",\n            \"SaleID\": \"{{saleId}}\",\n            \"ServiceID\": \"{{serviceId}}\",\n            \"POIID\": \"{{poiId}}\"\n        },\n        \"PaymentRequest\": {\n            \"SaleData\": {\n                \"SaleTransactionID\": {\n                    \"TransactionID\":\"{{$timestamp}}\",\n                    \"TimeStamp\":\"{{$isoTimestamp}}\"\n                },\n                \"SaleToAcquirerData\": \"tenderOption=ReceiptHandler&applicationInfo.merchantApplication.name=NAME_OF_POS_APPLICATION&applicationInfo.merchantApplication.version=2.13.05&applicationInfo.externalPlatform.name=COMPANY_NAME_OR_PLATFORM_NAME&applicationInfo.externalPlatform.version=1.3&applicationInfo.externalPlatform.integrator=COMPANY_THAT_BUILT_INTEGRATION_OR_POS_APP&applicationInfo.merchantDevice.os=OS_OF_DEVICE_THAT_RUNS_POS_APPLICATION&applicationInfo.merchantDevice.osVersion=16.3&metadata.someMetaDataKey1=YOUR_VALUE&metadata.someMetaDataKey2=YOUR_VALUE\",\n                \"OperatorID\": \"Sara\",\n                \"ShiftNumber\": \"2\"\n            },\n            \"PaymentTransaction\": {\n                \"AmountsReq\": {\n                    \"Currency\": \"EUR\",\n                    \"RequestedAmount\": 1.50\n                }\n            },\n            \"PaymentData\": {\n                \"PaymentType\": \"Refund\"\n            }\n        }\n    }\n}",
							"options": {
								"raw": {
									"language": "json"
								}
							}
						},
						"url": {
							"raw": "{{baseUrl}}",
							"host": [
								"{{baseUrl}}"
							]
						}
					},
					"response": []
				}
			]
		},
		{
			"name": "Status and Abort",
			"item": [
				{
					"name": "Abort in-process payment",
					"event": [
						{
							"listen": "prerequest",
							"script": {
								"exec": [
									""
								],
								"type": "text/javascript"
							}
						},
						{
							"listen": "test",
							"script": {
								"exec": [
									""
								],
								"type": "text/javascript"
							}
						}
					],
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Content-Type",
								"name": "Content-Type",
								"type": "text",
								"value": "application/json"
							}
						],
						"body": {
							"mode": "raw",
							"raw": "{\n    \"SaleToPOIRequest\": {\n        \"MessageHeader\": {\n            \"ProtocolVersion\": \"3.0\",\n            \"MessageClass\": \"Service\",\n            \"MessageCategory\": \"Abort\",\n            \"MessageType\": \"Request\",\n            \"SaleID\": \"{{saleId}}\",\n            \"ServiceID\": \"{{serviceId}}\",\n            \"POIID\": \"{{poiId}}\"\n        },\n        \"AbortRequest\": {\n            \"AbortReason\": \"MerchantAbort\",\n            \"MessageReference\": {\n                \"MessageCategory\": \"{{inProcessMessageCategory}}\",\n                \"SaleID\": \"{{inProcessSaleId}}\",\n                \"ServiceID\": \"{{inProcessServiceId}}\"\n            }\n        }\n    }\n}",
							"options": {
								"raw": {
									"language": "json"
								}
							}
						},
						"url": {
							"raw": "{{baseUrl}}",
							"host": [
								"{{baseUrl}}"
							]
						}
					},
					"response": []
				},
				{
					"name": "Verify transaction status",
					"event": [
						{
							"listen": "prerequest",
							"script": {
								"exec": [
									""
								],
								"type": "text/javascript"
							}
						},
						{
							"listen": "test",
							"script": {
								"exec": [
									""
								],
								"type": "text/javascript"
							}
						}
					],
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Content-Type",
								"name": "Content-Type",
								"type": "text",
								"value": "application/json"
							}
						],
						"body": {
							"mode": "raw",
							"raw": "{\n    \"SaleToPOIRequest\": {\n        \"MessageHeader\": {\n            \"ProtocolVersion\": \"3.0\",\n            \"MessageClass\": \"Service\",\n            \"MessageCategory\": \"TransactionStatus\",\n            \"MessageType\": \"Request\",\n            \"SaleID\": \"{{saleId}}\",\n            \"ServiceID\": \"{{serviceId}}\",\n            \"POIID\": \"{{poiId}}\"\n        },\n        \"TransactionStatusRequest\": {\n            \"ReceiptReprintFlag\": true,\n            \"DocumentQualifier\": [\n            \"CashierReceipt\",\n            \"CustomerReceipt\"\n            ],\n            \"MessageReference\": {\n                \"SaleID\": \"{{inProcessSaleId}}\",\n                \"ServiceID\": \"{{inProcessServiceId}}\",\n                \"MessageCategory\": \"{{inProcessMessageCategory}}\"\n            }\n\t    }\n    }\n}",
							"options": {
								"raw": {
									"language": "json"
								}
							}
						},
						"url": {
							"raw": "{{baseUrl}}",
							"host": [
								"{{baseUrl}}"
							]
						}
					},
					"response": []
				}
			]
		},
		{
			"name": "Preauth",
			"item": [
				{
					"name": "Payment preauth request",
					"event": [
						{
							"listen": "prerequest",
							"script": {
								"exec": [
									""
								],
								"type": "text/javascript"
							}
						},
						{
							"listen": "test",
							"script": {
								"exec": [
									"var responseJson = JSON.parse(responseBody);",
									"",
									"//Check if transaction was processed",
									"if (typeof responseJson.SaleToPOIRequest === 'undefined') {",
									"    //Transaction result",
									"    console.log(\"Result: \" + responseJson.SaleToPOIResponse.PaymentResponse.Response.Result);",
									"",
									"    //Get additional response",
									"    var additionalResponseString = responseJson.SaleToPOIResponse.PaymentResponse.Response.AdditionalResponse;",
									"    var additionalResponseJsonString = '{\"' + additionalResponseString.replace(/&/g, '\", \"').replace(/=/g, '\": \"') + '\"}';",
									"    var additionalResponseJson = JSON.parse(additionalResponseJsonString);",
									"",
									"    //Get receipt info",
									"    if (typeof responseJson.SaleToPOIResponse.PaymentResponse.Response.ErrorCondition === 'undefined') {",
									"        var receiptInfo = responseJson.SaleToPOIResponse.PaymentResponse.PaymentReceipt;",
									"        receiptInfo.forEach(receipt);",
									"    }",
									"",
									"    //If the result is \"Success\", we save some info",
									"    if (responseJson.SaleToPOIResponse.PaymentResponse.Response.Result == \"Success\") {",
									"        //We save the time stamp",
									"        var paymentTimeStamp = responseJson.SaleToPOIResponse.PaymentResponse.POIData.POITransactionID.TimeStamp;",
									"        pm.globals.set(\"paymentTimeStamp\", paymentTimeStamp);",
									"",
									"        //Transaction ID (tender reference + psp reference)",
									"        var paymentTransactionID = responseJson.SaleToPOIResponse.PaymentResponse.POIData.POITransactionID.TransactionID;",
									"        pm.globals.set(\"paymentTransactionId\", paymentTransactionID);",
									"",
									"        //PSP reference",
									"        var pspReference = paymentTransactionID.split(\".\")[1];",
									"        pm.globals.set(\"pspReference\", pspReference);",
									"        console.log(\"PSP reference: \" + pspReference);",
									"",
									"        //Original POIID",
									"        var originalPOIID = responseJson.SaleToPOIResponse.MessageHeader.POIID;",
									"        pm.globals.set(\"originalPOIID\", originalPOIID);",
									"",
									"        //Save shopper reference",
									"        var shopperReference = additionalResponseJson.shopperReference;",
									"        pm.globals.set(\"shopperReference\", shopperReference);",
									"        console.log(\"Shopper reference: \" + shopperReference);",
									"",
									"        // Save adjust authorisation data",
									"        var adjustAuthorisationData = additionalResponseJson.adjustAuthorisationData;",
									"        pm.globals.set(\"adjustAuthorisationData\", adjustAuthorisationData);",
									"",
									"    } else {",
									"        console.log(\"Error condition: \" + responseJson.SaleToPOIResponse.PaymentResponse.Response.ErrorCondition);",
									"    }",
									"} else {",
									"    //In case of error we get the error message",
									"    console.log(decodeURIComponent(responseJson.SaleToPOIRequest.EventNotification.EventDetails));",
									"}",
									"",
									"//Parse receipt info",
									"function receipt(item, index, arr) {",
									"    var document = item.DocumentQualifier;",
									"    var receipts = {};",
									"    receipts[document] = {};",
									"",
									"    for (i = 0; i < item.OutputContent.OutputText.length; i++) {",
									"        var text = item.OutputContent.OutputText[i].Text.split('&');",
									"        var key = \"\";",
									"        var value = \"\";",
									"",
									"        for (j = 0; j < text.length; j++) {",
									"            var pair = text[j].split('=');",
									"",
									"            if (pair[0] == \"key\") {",
									"                key = pair[1];",
									"            }",
									"",
									"            if (pair[0] == \"value\") {",
									"                value = pair[1];",
									"            }",
									"        }",
									"",
									"        receipts[document][key] = decodeURIComponent(value);",
									"    }",
									"",
									"    console.log(receipts);",
									"}"
								],
								"type": "text/javascript"
							}
						}
					],
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Content-Type",
								"name": "Content-Type",
								"value": "application/json",
								"type": "text"
							}
						],
						"body": {
							"mode": "raw",
							"raw": "{\n    \"SaleToPOIRequest\": {\n        \"MessageHeader\": {\n            \"ProtocolVersion\": \"3.0\",\n            \"MessageClass\": \"Service\",\n            \"MessageCategory\": \"Payment\",\n            \"MessageType\": \"Request\",\n            \"SaleID\": \"{{saleId}}\",\n            \"ServiceID\": \"{{serviceId}}\",\n            \"POIID\": \"{{poiId}}\"\n        },\n        \"PaymentRequest\": {\n            \"SaleData\": {\n                \"SaleTransactionID\": {\n                    \"TransactionID\":\"{{$timestamp}}\",\n                    \"TimeStamp\":\"{{$isoTimestamp}}\"\n                },\n                \"SaleToAcquirerData\": \"tenderOption=ReceiptHandler&applicationInfo.merchantApplication.name=NAME_OF_POS_APPLICATION&applicationInfo.merchantApplication.version=2.13.05&applicationInfo.externalPlatform.name=COMPANY_NAME_OR_PLATFORM_NAME&applicationInfo.externalPlatform.version=1.3&applicationInfo.externalPlatform.integrator=COMPANY_THAT_BUILT_INTEGRATION_OR_POS_APP&applicationInfo.merchantDevice.os=OS_OF_DEVICE_THAT_RUNS_POS_APPLICATION&applicationInfo.merchantDevice.osVersion=16.3&metadata.someMetaDataKey1=YOUR_VALUE&metadata.someMetaDataKey2=YOUR_VALUE&authorisationType=PreAuth\"\n            },\n            \"PaymentTransaction\": {\n                \"AmountsReq\": {\n                    \"Currency\": \"{{currency}}\",\n                    \"RequestedAmount\": 160.00\n                }\n            }\n        }\n    }\n}",
							"options": {
								"raw": {
									"language": "json"
								}
							}
						},
						"url": {
							"raw": "{{baseUrl}}",
							"host": [
								"{{baseUrl}}"
							]
						}
					},
					"response": []
				}
			],
			"event": [
				{
					"listen": "prerequest",
					"script": {
						"type": "text/javascript",
						"exec": [
							"pm.globals.set(\"inProcessSaleId\", pm.environment.get(\"saleId\"));",
							"pm.globals.set(\"inProcessServiceId\", pm.globals.get(\"serviceId\"));",
							"pm.globals.set(\"inProcessMessageCategory\", \"Payment\");"
						]
					}
				},
				{
					"listen": "test",
					"script": {
						"type": "text/javascript",
						"exec": [
							""
						]
					}
				}
			]
		},
		{
			"name": "Reconcile",
			"item": [
				{
					"name": "Login",
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Content-Type",
								"name": "Content-Type",
								"value": "application/json",
								"type": "text"
							}
						],
						"body": {
							"mode": "raw",
							"raw": "{\n    \"SaleToPOIRequest\": {\n        \"MessageHeader\": {\n            \"ProtocolVersion\": \"3.0\",\n            \"MessageClass\": \"Service\",\n            \"MessageCategory\": \"Login\",\n            \"MessageType\": \"Request\",\n            \"ServiceID\": \"{{serviceId}}\",\n            \"SaleID\": \"{{saleId}}\",\n            \"POIID\": \"{{poiId}}\"\n        },\n        \"LoginRequest\": {\n            \"DateTime\": \"{{$isoTimestamp}}\",\n            \"SaleSoftware\": {\n                \"ManufacturerID\": \"Adyen\",\n                \"ApplicationName\": \"TestScripts\",\n                \"SoftwareVersion\": \"1.0\",\n                \"CertificationCode\": \"\"\n            },\n            \"OperatorLanguage\": \"en\",\n            \"SaleTerminalData\": {\n                \"TotalsGroupID\": \"GrupoA\"\n            }\n        }\n    }\n}",
							"options": {
								"raw": {
									"language": "json"
								}
							}
						},
						"url": {
							"raw": "{{baseUrl}}",
							"host": [
								"{{baseUrl}}"
							]
						}
					},
					"response": []
				},
				{
					"name": "Logout",
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Content-Type",
								"name": "Content-Type",
								"value": "application/json",
								"type": "text"
							}
						],
						"body": {
							"mode": "raw",
							"raw": "{\n    \"SaleToPOIRequest\": {\n        \"MessageHeader\": {\n            \"ProtocolVersion\": \"3.0\",\n            \"MessageClass\": \"Service\",\n            \"MessageCategory\": \"Logout\",\n            \"MessageType\": \"Request\",\n            \"ServiceID\": \"{{serviceId}}\",\n            \"SaleID\": \"{{saleId}}\",\n            \"POIID\": \"{{poiId}}\"\n        },\n        \"LogoutRequest\": {}\n    }\n}",
							"options": {
								"raw": {
									"language": "json"
								}
							}
						},
						"url": {
							"raw": "{{baseUrl}}",
							"host": [
								"{{baseUrl}}"
							]
						}
					},
					"response": []
				},
				{
					"name": "Get totals",
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Content-Type",
								"name": "Content-Type",
								"value": "application/json",
								"type": "text"
							}
						],
						"body": {
							"mode": "raw",
							"raw": "{\n    \"SaleToPOIRequest\": {\n        \"MessageHeader\": {\n            \"ProtocolVersion\": \"3.0\",\n            \"MessageClass\": \"Service\",\n            \"MessageCategory\": \"GetTotals\",\n            \"MessageType\": \"Request\",\n            \"ServiceID\": \"{{serviceId}}\",\n            \"SaleID\": \"{{saleId}}\",\n            \"POIID\": \"{{poiId}}\"\n        },\n        \"GetTotalsRequest\": {\n            \"TotalFilter\": {\n                \"TotalsGroupID\": \"GrupoA\"\n            },\n            \"TotalDetails\": [\n                \"ShiftNumber\",\n                \"TotalsGroupID\",\n                \"OperatorID\"\n            ]\n        }\n    }\n}",
							"options": {
								"raw": {
									"language": "json"
								}
							}
						},
						"url": {
							"raw": "{{baseUrl}}",
							"host": [
								"{{baseUrl}}"
							]
						}
					},
					"response": []
				},
				{
					"name": "Reconcile",
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Content-Type",
								"name": "Content-Type",
								"value": "application/json",
								"type": "text"
							}
						],
						"body": {
							"mode": "raw",
							"raw": "{\n    \"SaleToPOIRequest\": {\n        \"MessageHeader\": {\n            \"ProtocolVersion\": \"3.0\",\n            \"MessageClass\": \"Service\",\n            \"MessageCategory\": \"Reconciliation\",\n            \"MessageType\": \"Request\",\n            \"ServiceID\": \"{{serviceId}}\",\n            \"SaleID\": \"{{saleId}}\",\n            \"POIID\": \"{{poiId}}\"\n        },\n        \"ReconciliationRequest\": {\n            \"ReconciliationType\": \"SaleReconciliation\"\n        }\n    }\n}",
							"options": {
								"raw": {
									"language": "json"
								}
							}
						},
						"url": {
							"raw": "{{baseUrl}}",
							"host": [
								"{{baseUrl}}"
							]
						}
					},
					"response": []
				},
				{
					"name": "Recall reconciliation",
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Content-Type",
								"name": "Content-Type",
								"value": "application/json",
								"type": "text"
							}
						],
						"body": {
							"mode": "raw",
							"raw": "{\n    \"SaleToPOIRequest\": {\n        \"MessageHeader\": {\n            \"ProtocolVersion\": \"3.0\",\n            \"MessageClass\": \"Service\",\n            \"MessageCategory\": \"Reconciliation\",\n            \"MessageType\": \"Request\",\n            \"ServiceID\": \"{{serviceId}}\",\n            \"SaleID\": \"{{saleId}}\",\n            \"POIID\": \"{{poiId}}\"\n        },\n        \"ReconciliationRequest\": {\n            \"ReconciliationType\": \"PreviousReconciliation\",\n            \"POIReconciliationID\": \"1003\"\n        }\n    }\n}",
							"options": {
								"raw": {
									"language": "json"
								}
							}
						},
						"url": {
							"raw": "{{baseUrl}}",
							"host": [
								"{{baseUrl}}"
							]
						}
					},
					"response": []
				}
			]
		},
		{
			"name": "Get Input",
			"item": [
				{
					"name": "Confirmation",
					"event": [
						{
							"listen": "prerequest",
							"script": {
								"exec": [
									""
								],
								"type": "text/javascript"
							}
						}
					],
					"request": {
						"method": "POST",
						"header": [],
						"body": {
							"mode": "raw",
							"raw": "{\n    \"SaleToPOIRequest\": {\n        \"MessageHeader\": {\n            \"ProtocolVersion\": \"3.0\",\n            \"MessageClass\": \"Device\",\n            \"MessageCategory\": \"Input\",\n            \"MessageType\": \"Request\",\n            \"SaleID\": \"{{saleId}}\",\n            \"ServiceID\": \"{{serviceId}}\",\n            \"POIID\": \"{{poiId}}\"\n        },\n        \"InputRequest\": {\n            \"DisplayOutput\": {\n                \"Device\": \"CustomerDisplay\",\n                \"InfoQualify\": \"Display\",\n                \"OutputContent\": {\n                    \"OutputFormat\": \"Text\",\n                    \"PredefinedContent\": {\n                        \"ReferenceID\": \"GetConfirmation\"\n                    },\n                    \"OutputText\": [\n                        {\n                            \"Text\": \"Terms & Conditions\"\n                        },\n                        {\n                            \"Text\": \"Do you accept our Terms and Conditions? \\n The full text is available on our website.\"\n                        },\n                        {\n                            \"Text\": \"Decline\"\n                        },\n                        {\n                            \"Text\": \"Agree\"\n                        }\n                    ]\n                }\n            },\n            \"InputData\": {\n                \"Device\": \"CustomerInput\",\n                \"InfoQualify\": \"Input\",\n                \"InputCommand\": \"GetConfirmation\",\n                \"MaxInputTime\": 30\n            }\n        }\n    }\n}",
							"options": {
								"raw": {
									"language": "json"
								}
							}
						},
						"url": {
							"raw": "{{baseUrl}}",
							"host": [
								"{{baseUrl}}"
							]
						}
					},
					"response": []
				},
				{
					"name": "Signature",
					"event": [
						{
							"listen": "prerequest",
							"script": {
								"exec": [
									""
								],
								"type": "text/javascript"
							}
						}
					],
					"request": {
						"method": "POST",
						"header": [],
						"body": {
							"mode": "raw",
							"raw": "{\n    \"SaleToPOIRequest\": {\n        \"MessageHeader\": {\n            \"ProtocolVersion\": \"3.0\",\n            \"MessageClass\": \"Device\",\n            \"MessageCategory\": \"Input\",\n            \"MessageType\": \"Request\",\n            \"SaleID\": \"{{saleId}}\",\n            \"ServiceID\": \"{{serviceId}}\",\n            \"POIID\": \"{{poiId}}\"\n        },\n        \"InputRequest\": {\n            \"DisplayOutput\": {\n                \"Device\": \"CustomerDisplay\",\n                \"InfoQualify\": \"Display\",\n                \"OutputContent\": {\n                    \"OutputFormat\": \"Text\",\n                    \"PredefinedContent\": {\n                        \"ReferenceID\": \"GetSignature\"\n                    },\n                    \"OutputText\": [\n                        {\n                            \"Text\": \"Please sign\"\n                        },\n                        {\n                            \"Text\": \"\"\n                        }\n                    ]\n                }\n            },\n            \"InputData\": {\n                \"Device\": \"CustomerInput\",\n                \"InfoQualify\": \"Input\",\n                \"InputCommand\": \"GetConfirmation\",\n                \"MaxInputTime\": 30\n            }\n        }\n    }\n}",
							"options": {
								"raw": {
									"language": "json"
								}
							}
						},
						"url": {
							"raw": "{{baseUrl}}",
							"host": [
								"{{baseUrl}}"
							]
						}
					},
					"response": []
				},
				{
					"name": "Multiple choice - single answer",
					"event": [
						{
							"listen": "prerequest",
							"script": {
								"exec": [
									""
								],
								"type": "text/javascript"
							}
						}
					],
					"request": {
						"method": "POST",
						"header": [],
						"body": {
							"mode": "raw",
							"raw": "{\n    \"SaleToPOIRequest\": {\n        \"MessageHeader\": {\n            \"ProtocolVersion\": \"3.0\",\n            \"MessageClass\": \"Device\",\n            \"MessageCategory\": \"Input\",\n            \"MessageType\": \"Request\",\n            \"SaleID\": \"{{saleId}}\",\n            \"ServiceID\": \"{{serviceId}}\",\n            \"POIID\": \"{{poiId}}\"\n        },\n        \"InputRequest\": {\n            \"DisplayOutput\": {\n                \"Device\": \"CustomerDisplay\",\n                \"InfoQualify\": \"Display\",\n                \"OutputContent\": {\n                    \"OutputFormat\": \"Text\",\n                    \"PredefinedContent\": {\n                        \"ReferenceID\": \"MenuButtons\"\n                    },\n                    \"OutputText\": [\n                        {\n                            \"Text\": \"How was your visit?\"\n                        },\n                        {\n                            \"Text\": \"Please tap one of the options below:\"\n                        }\n                    ]\n                },\n                \"MenuEntry\": [\n                    {\n                        \"OutputFormat\": \"Text\",\n                        \"OutputText\": [\n                            {\n                                \"Text\": \"Excellent\"\n                            }\n                        ]\n                    },\n                    {\n                        \"OutputFormat\": \"Text\",\n                        \"OutputText\": [\n                            {\n                                \"Text\": \"Good\"\n                            }\n                        ]\n                    },\n                    {\n                        \"OutputFormat\": \"Text\",\n                        \"OutputText\": [\n                            {\n                                \"Text\": \"Not so good\"\n                            }\n                        ]\n                    },\n                    {\n                        \"OutputFormat\": \"Text\",\n                        \"OutputText\": [\n                            {\n                                \"Text\": \"Bad\"\n                            }\n                        ]\n                    }\n                ]\n            },\n            \"InputData\": {\n                \"Device\": \"CustomerInput\",\n                \"InfoQualify\": \"Input\",\n                \"InputCommand\": \"GetMenuEntry\",\n                \"MaxInputTime\": 120\n            }\n        }\n    }\n}",
							"options": {
								"raw": {
									"language": "json"
								}
							}
						},
						"url": {
							"raw": "{{baseUrl}}",
							"host": [
								"{{baseUrl}}"
							]
						}
					},
					"response": []
				},
				{
					"name": "Multiple choice - multiple answers",
					"event": [
						{
							"listen": "prerequest",
							"script": {
								"exec": [
									""
								],
								"type": "text/javascript"
							}
						}
					],
					"request": {
						"method": "POST",
						"header": [],
						"body": {
							"mode": "raw",
							"raw": "{\n    \"SaleToPOIRequest\": {\n        \"MessageHeader\": {\n            \"ProtocolVersion\": \"3.0\",\n            \"MessageClass\": \"Device\",\n            \"MessageCategory\": \"Input\",\n            \"MessageType\": \"Request\",\n            \"SaleID\": \"{{saleId}}\",\n            \"ServiceID\": \"{{serviceId}}\",\n            \"POIID\": \"{{poiId}}\"\n        },\n        \"InputRequest\": {\n            \"DisplayOutput\": {\n                \"Device\": \"CustomerDisplay\",\n                \"InfoQualify\": \"Display\",\n                \"OutputContent\": {\n                    \"OutputFormat\": \"Text\",\n                    \"PredefinedContent\": {\n                        \"ReferenceID\": \"MenuButtons\"\n                    },\n                    \"OutputText\": [\n                        {\n                            \"Text\": \"Subscribe to the following channels?\"\n                        }\n                    ]\n                },\n                \"MenuEntry\": [\n                    {\n                        \"OutputFormat\": \"Text\",\n                        \"OutputText\": [\n                            {\n                                \"Text\": \"Email\"\n                            }\n                        ]\n                    },\n                    {\n                        \"OutputFormat\": \"Text\",\n                        \"OutputText\": [\n                            {\n                                \"Text\": \"SMS\"\n                            }\n                        ]\n                    },\n                    {\n                        \"OutputFormat\": \"Text\",\n                        \"OutputText\": [\n                            {\n                                \"Text\": \"Post\"\n                            }\n                        ]\n                    }\n                ]\n            },\n            \"InputData\": {\n                \"Device\": \"CustomerInput\",\n                \"InfoQualify\": \"Input\",\n                \"InputCommand\": \"GetMenuEntry\",\n                \"MaxInputTime\": 60,\n                \"MinLength\": 0,\n                \"MaxLength\": 3\n            }\n        }\n    }\n}",
							"options": {
								"raw": {
									"language": "json"
								}
							}
						},
						"url": {
							"raw": "{{baseUrl}}",
							"host": [
								"{{baseUrl}}"
							]
						}
					},
					"response": []
				},
				{
					"name": "Digit",
					"event": [
						{
							"listen": "prerequest",
							"script": {
								"exec": [
									""
								],
								"type": "text/javascript"
							}
						}
					],
					"request": {
						"method": "POST",
						"header": [],
						"body": {
							"mode": "raw",
							"raw": "{\n    \"SaleToPOIRequest\": {\n        \"MessageHeader\": {\n            \"ProtocolVersion\": \"3.0\",\n            \"MessageClass\": \"Device\",\n            \"MessageCategory\": \"Input\",\n            \"MessageType\": \"Request\",\n            \"SaleID\": \"{{saleId}}\",\n            \"ServiceID\": \"{{serviceId}}\",\n            \"POIID\": \"{{poiId}}\"\n        },\n        \"InputRequest\": {\n            \"DisplayOutput\": {\n                \"Device\": \"CustomerDisplay\",\n                \"InfoQualify\": \"Display\",\n                \"OutputContent\": {\n                    \"OutputFormat\": \"Text\",\n                    \"PredefinedContent\": {\n                        \"ReferenceID\": \"GetDigit\"\n                    },\n                    \"OutputText\": [\n                        {\n                            \"Text\": \"Enter your zip code:\"\n                        }\n                    ]\n                }\n            },\n            \"InputData\": {\n                \"Device\": \"CustomerInput\",\n                \"InfoQualify\": \"Input\",\n                \"InputCommand\": \"DigitString\",\n                \"MaxInputTime\": 30,\n                \"DefaultInputString\": \"e.g. 10003\"\n            }\n        }\n    }\n}",
							"options": {
								"raw": {
									"language": "json"
								}
							}
						},
						"url": {
							"raw": "{{baseUrl}}",
							"host": [
								"{{baseUrl}}"
							]
						}
					},
					"response": []
				},
				{
					"name": "Amount",
					"event": [
						{
							"listen": "prerequest",
							"script": {
								"exec": [
									""
								],
								"type": "text/javascript"
							}
						}
					],
					"request": {
						"method": "POST",
						"header": [],
						"body": {
							"mode": "raw",
							"raw": "{\n    \"SaleToPOIRequest\": {\n        \"MessageHeader\": {\n            \"ProtocolVersion\": \"3.0\",\n            \"MessageClass\": \"Device\",\n            \"MessageCategory\": \"Input\",\n            \"MessageType\": \"Request\",\n            \"SaleID\": \"{{saleId}}\",\n            \"ServiceID\": \"{{serviceId}}\",\n            \"POIID\": \"{{poiId}}\"\n        },\n        \"InputRequest\": {\n            \"DisplayOutput\": {\n                \"Device\": \"CustomerDisplay\",\n                \"InfoQualify\": \"Display\",\n                \"OutputContent\": {\n                    \"OutputFormat\": \"Text\",\n                    \"PredefinedContent\": {\n                        \"ReferenceID\": \"GetAmount\"\n                    },\n                    \"OutputText\": [\n                        {\n                            \"Text\": \"Enter Amount:\"\n                        }\n                    ]\n                }\n            },\n            \"InputData\": {\n                \"Device\": \"CustomerInput\",\n                \"InfoQualify\": \"Input\",\n                \"InputCommand\": \"DecimalString\",\n                \"MaxInputTime\": 30,\n                \"DefaultInputString\": \"0.00\"\n            }\n        }\n    }\n}",
							"options": {
								"raw": {
									"language": "json"
								}
							}
						},
						"url": {
							"raw": "{{baseUrl}}",
							"host": [
								"{{baseUrl}}"
							]
						}
					},
					"response": []
				},
				{
					"name": "Phone number",
					"event": [
						{
							"listen": "prerequest",
							"script": {
								"exec": [
									""
								],
								"type": "text/javascript"
							}
						}
					],
					"request": {
						"method": "POST",
						"header": [],
						"body": {
							"mode": "raw",
							"raw": "{\n    \"SaleToPOIRequest\": {\n        \"MessageHeader\": {\n            \"ProtocolVersion\": \"3.0\",\n            \"MessageClass\": \"Device\",\n            \"MessageCategory\": \"Input\",\n            \"MessageType\": \"Request\",\n            \"SaleID\": \"{{saleId}}\",\n            \"ServiceID\": \"{{serviceId}}\",\n            \"POIID\": \"{{poiId}}\"\n        },\n        \"InputRequest\": {\n            \"DisplayOutput\": {\n                \"Device\": \"CustomerDisplay\",\n                \"InfoQualify\": \"Display\",\n                \"OutputContent\": {\n                    \"OutputFormat\": \"Text\",\n                    \"PredefinedContent\": {\n                        \"ReferenceID\": \"GetPhoneNumber\"\n                    },\n                    \"OutputText\": [\n                        {\n                            \"Text\": \"Enter your phone number:\"\n                        }\n                    ]\n                }\n            },\n            \"InputData\": {\n                \"Device\": \"CustomerInput\",\n                \"InfoQualify\": \"Input\",\n                \"InputCommand\": \"DigitString\",\n                \"MaxInputTime\": 40,\n                \"DefaultInputString\": \"0612345678\"\n            }\n        }\n    }\n}",
							"options": {
								"raw": {
									"language": "json"
								}
							}
						},
						"url": {
							"raw": "{{baseUrl}}",
							"host": [
								"{{baseUrl}}"
							]
						}
					},
					"response": []
				},
				{
					"name": "Rating",
					"event": [
						{
							"listen": "prerequest",
							"script": {
								"exec": [
									""
								],
								"type": "text/javascript"
							}
						}
					],
					"request": {
						"method": "POST",
						"header": [],
						"body": {
							"mode": "raw",
							"raw": "{\n    \"SaleToPOIRequest\": {\n        \"MessageHeader\": {\n            \"ProtocolVersion\": \"3.0\",\n            \"MessageClass\": \"Device\",\n            \"MessageCategory\": \"Input\",\n            \"MessageType\": \"Request\",\n            \"SaleID\": \"{{saleId}}\",\n            \"ServiceID\": \"{{serviceId}}\",\n            \"POIID\": \"{{poiId}}\"\n        },\n        \"InputRequest\": {\n            \"DisplayOutput\": {\n                \"Device\": \"CustomerDisplay\",\n                \"InfoQualify\": \"Display\",\n                \"OutputContent\": {\n                    \"OutputFormat\": \"Text\",\n                    \"PredefinedContent\": {\n                        \"ReferenceID\": \"GetRating\"\n                    },\n                    \"OutputText\": [\n                        {\n                            \"Text\": \"How was your experience with us?\"\n                        },\n                        {\n                            \"Text\": \"Poor: 0-3 \\n OK: 4-6 \\n Great: 7-9\"\n                        }\n                    ]\n                }\n            },\n            \"InputData\": {\n                \"Device\": \"CustomerInput\",\n                \"InfoQualify\": \"Input\",\n                \"InputCommand\": \"DigitString\",\n                \"MaxInputTime\": 30\n            }\n        }\n    }\n}",
							"options": {
								"raw": {
									"language": "json"
								}
							}
						},
						"url": {
							"raw": "{{baseUrl}}",
							"host": [
								"{{baseUrl}}"
							]
						}
					},
					"response": []
				},
				{
					"name": "Rating - single key",
					"event": [
						{
							"listen": "prerequest",
							"script": {
								"exec": [
									""
								],
								"type": "text/javascript"
							}
						}
					],
					"request": {
						"method": "POST",
						"header": [],
						"body": {
							"mode": "raw",
							"raw": "{\n    \"SaleToPOIRequest\": {\n        \"MessageHeader\": {\n            \"ProtocolVersion\": \"3.0\",\n            \"MessageClass\": \"Device\",\n            \"MessageCategory\": \"Input\",\n            \"MessageType\": \"Request\",\n            \"SaleID\": \"{{saleId}}\",\n            \"ServiceID\": \"{{serviceId}}\",\n            \"POIID\": \"{{poiId}}\"\n        },\n        \"InputRequest\": {\n            \"DisplayOutput\": {\n                \"Device\": \"CustomerDisplay\",\n                \"InfoQualify\": \"Display\",\n                \"OutputContent\": {\n                    \"OutputFormat\": \"Text\",\n                    \"PredefinedContent\": {\n                        \"ReferenceID\": \"GetOneKeyRating\"\n                    },\n                    \"OutputText\": [\n                        {\n                            \"Text\": \"From 0 to 9 how was your experience with us?\"\n                        },\n                        {\n                            \"Text\": \"Poor: 0-3 \\n OK: 4-6 \\n Great: 7-9\"\n                        }\n                    ]\n                }\n            },\n            \"InputData\": {\n                \"Device\": \"CustomerInput\",\n                \"InfoQualify\": \"Input\",\n                \"InputCommand\": \"DigitString\",\n                \"MaxInputTime\": 30\n            }\n        }\n    }\n}",
							"options": {
								"raw": {
									"language": "json"
								}
							}
						},
						"url": {
							"raw": "{{baseUrl}}",
							"host": [
								"{{baseUrl}}"
							]
						}
					},
					"response": []
				},
				{
					"name": "Text",
					"event": [
						{
							"listen": "prerequest",
							"script": {
								"exec": [
									""
								],
								"type": "text/javascript"
							}
						}
					],
					"request": {
						"method": "POST",
						"header": [],
						"body": {
							"mode": "raw",
							"raw": "{\n    \"SaleToPOIRequest\": {\n        \"MessageHeader\": {\n            \"ProtocolVersion\": \"3.0\",\n            \"MessageClass\": \"Device\",\n            \"MessageCategory\": \"Input\",\n            \"MessageType\": \"Request\",\n            \"SaleID\": \"{{saleId}}\",\n            \"ServiceID\": \"{{serviceId}}\",\n            \"POIID\": \"{{poiId}}\"\n        },\n        \"InputRequest\": {\n            \"DisplayOutput\": {\n                \"Device\": \"CustomerDisplay\",\n                \"InfoQualify\": \"Display\",\n                \"OutputContent\": {\n                    \"OutputFormat\": \"Text\",\n                    \"PredefinedContent\": {\n                        \"ReferenceID\": \"GetText\"\n                    },\n                    \"OutputText\": [\n                        {\n                            \"Text\": \"Your email address:\"\n                        }\n                    ]\n                }\n            },\n            \"InputData\": {\n                \"Device\": \"CustomerInput\",\n                \"InfoQualify\": \"Input\",\n                \"InputCommand\": \"TextString\",\n                \"MaxInputTime\": 120,\n                \"DefaultInputString\": \"name@domain.com\"\n            }\n        }\n    }\n}",
							"options": {
								"raw": {
									"language": "json"
								}
							}
						},
						"url": {
							"raw": "{{baseUrl}}",
							"host": [
								"{{baseUrl}}"
							]
						}
					},
					"response": []
				}
			],
			"event": [
				{
					"listen": "prerequest",
					"script": {
						"type": "text/javascript",
						"exec": [
							"pm.globals.set(\"inProcessSaleId\", pm.environment.get(\"saleId\"));",
							"pm.globals.set(\"inProcessServiceId\", pm.globals.get(\"serviceId\"));",
							"pm.globals.set(\"inProcessMessageCategory\", \"Input\");"
						]
					}
				},
				{
					"listen": "test",
					"script": {
						"type": "text/javascript",
						"exec": [
							""
						]
					}
				}
			]
		},
		{
			"name": "Cancel Input",
			"item": [
				{
					"name": "Cancel collecting input",
					"request": {
						"method": "POST",
						"header": [],
						"body": {
							"mode": "raw",
							"raw": "{\n    \"SaleToPOIRequest\": {\n        \"MessageHeader\": {\n            \"ProtocolVersion\": \"3.0\",\n            \"MessageClass\": \"Service\",\n            \"MessageCategory\": \"Abort\",\n            \"MessageType\": \"Request\",\n            \"SaleID\": \"{{saleId}}\",\n            \"ServiceID\": \"{{serviceId}}\",\n            \"POIID\": \"{{poiId}}\"\n        },\n        \"AbortRequest\": {\n            \"AbortReason\": \"MerchantAbort\",\n            \"MessageReference\": {\n                \"MessageCategory\": \"{{inProcessMessageCategory}}\",\n                \"SaleID\": \"{{inProcessSaleId}}\",\n                \"ServiceID\": \"{{inProcessServiceId}}\"\n            }\n        }\n    }\n}",
							"options": {
								"raw": {
									"language": "json"
								}
							}
						},
						"url": {
							"raw": "{{baseUrl}}",
							"host": [
								"{{baseUrl}}"
							]
						}
					},
					"response": []
				}
			]
		},
		{
			"name": "Pay at table / Split",
			"item": [
				{
					"name": "GetTable",
					"event": [
						{
							"listen": "prerequest",
							"script": {
								"exec": [
									"pm.globals.set(\"inProcessSaleId\", pm.environment.get(\"saleId\"));",
									"pm.globals.set(\"inProcessServiceId\", pm.globals.get(\"serviceId\"));",
									"pm.globals.set(\"inProcessMessageCategory\", \"Input\");"
								],
								"type": "text/javascript"
							}
						},
						{
							"listen": "test",
							"script": {
								"exec": [
									"var responseJson = JSON.parse(responseBody);",
									"",
									"//Check if request was processed",
									"if (typeof responseJson.SaleToPOIRequest === 'undefined') {",
									"    if (responseJson.SaleToPOIResponse.InputResponse.InputResult.Response.Result === \"Success\") {",
									"        pm.globals.set(\"table\", responseJson.SaleToPOIResponse.InputResponse.InputResult.Input.DigitInput);",
									"",
									"        postman.setNextRequest(\"ConfirmAmount\");",
									"    }",
									"}"
								],
								"type": "text/javascript"
							}
						}
					],
					"request": {
						"method": "POST",
						"header": [],
						"body": {
							"mode": "raw",
							"raw": "{\n    \"SaleToPOIRequest\": {\n        \"MessageHeader\": {\n            \"ProtocolVersion\": \"3.0\",\n            \"MessageClass\": \"Device\",\n            \"MessageCategory\": \"Input\",\n            \"MessageType\": \"Request\",\n            \"SaleID\": \"{{saleId}}\",\n            \"ServiceID\": \"{{serviceId}}\",\n            \"POIID\": \"{{poiId}}\"\n        },\n        \"InputRequest\": {\n            \"DisplayOutput\": {\n                \"Device\": \"CustomerDisplay\",\n                \"InfoQualify\": \"Display\",\n                \"OutputContent\": {\n                    \"OutputFormat\": \"Text\",\n                    \"PredefinedContent\": {\n                        \"ReferenceID\": \"GetDigit\"\n                    },\n                    \"OutputText\": [\n                        {\n                            \"Text\": \"Enter the table number:\"\n                        }\n                    ]\n                }\n            },\n            \"InputData\": {\n                \"Device\": \"CustomerInput\",\n                \"InfoQualify\": \"Input\",\n                \"InputCommand\": \"DigitString\",\n                \"MaxInputTime\": 30,\n                \"DefaultInputString\": \"e.g. 12\"\n            }\n        }\n    }\n}",
							"options": {
								"raw": {
									"language": "json"
								}
							}
						},
						"url": {
							"raw": "{{baseUrl}}",
							"host": [
								"{{baseUrl}}"
							]
						}
					},
					"response": []
				},
				{
					"name": "ConfirmAmount",
					"event": [
						{
							"listen": "prerequest",
							"script": {
								"exec": [
									"const table = pm.globals.get(\"table\");",
									"",
									"var amount = \"\";",
									"",
									"switch (table%10) {",
									"    case 1: amount = \"58.00\";",
									"    break;",
									"    ",
									"    case 2: amount = \"116.50\";",
									"    break;",
									"    ",
									"    case 3: amount = \"72.23\";",
									"    break;",
									"    ",
									"    case 4: amount = \"42.99\";",
									"    break;",
									"    ",
									"    case 5: amount = \"229.00\";",
									"    break;",
									"    ",
									"    case 6: amount = \"628.00\";",
									"    break;",
									"    ",
									"    case 7: amount = \"50.99\";",
									"    break;",
									"    ",
									"    case 8: amount = \"107.00\";",
									"    break;",
									"    ",
									"    case 9: amount = \"72.00\";",
									"    break;",
									"    ",
									"    default: amount = \"120.00\";",
									"}",
									"",
									"pm.globals.set(\"originalAmount\", amount);"
								],
								"type": "text/javascript"
							}
						},
						{
							"listen": "test",
							"script": {
								"exec": [
									"var responseJson = JSON.parse(responseBody);",
									"",
									"if (typeof responseJson.SaleToPOIRequest === 'undefined') {",
									"    if (responseJson.SaleToPOIResponse.InputResponse.InputResult.Input.ConfirmedFlag) {",
									"        postman.setNextRequest(\"AskSplit\");",
									"    } else {",
									"        ",
									"    }",
									"}"
								],
								"type": "text/javascript"
							}
						}
					],
					"request": {
						"method": "POST",
						"header": [],
						"body": {
							"mode": "raw",
							"raw": "{\n    \"SaleToPOIRequest\":{\n        \"MessageHeader\":{\n            \"ProtocolVersion\":\"3.0\",\n            \"MessageClass\":\"Device\",\n            \"MessageCategory\":\"Input\",\n            \"MessageType\":\"Request\",\n            \"ServiceID\":\"{{serviceId}}\",\n            \"SaleID\":\"{{saleId}}\",\n            \"POIID\":\"{{poiId}}\"\n        },\n        \"InputRequest\":{\n            \"DisplayOutput\":{\n                \"Device\":\"CustomerDisplay\",\n                \"InfoQualify\":\"Display\",\n                \"OutputContent\":{\n                    \"OutputFormat\":\"Text\",\n                    \"PredefinedContent\":{\n                        \"ReferenceID\":\"GetConfirmation\"\n                    },\n                    \"OutputText\":[\n                        {\n                            \"Text\":\"Amount to be charged\"\n                        },\n                        {\n                            \"Text\":\"Is the amount to be collected € {{originalAmount}}?\"\n                        },\n                        {\n                            \"Text\":\"No\"\n                        },\n                        {\n                            \"Text\":\"Yes\"\n                        }\n                    ]\n                }\n            },\n            \"InputData\":{\n                \"Device\":\"CustomerInput\",\n                \"InfoQualify\":\"Input\",\n                \"InputCommand\":\"GetConfirmation\",\n                \"MaxInputTime\":30\n            }\n        }\n    }\n}\n",
							"options": {
								"raw": {
									"language": "json"
								}
							}
						},
						"url": {
							"raw": "{{baseUrl}}",
							"host": [
								"{{baseUrl}}"
							]
						}
					},
					"response": []
				},
				{
					"name": "AskSplit",
					"event": [
						{
							"listen": "prerequest",
							"script": {
								"exec": [
									""
								],
								"type": "text/javascript"
							}
						},
						{
							"listen": "test",
							"script": {
								"exec": [
									"var responseJson = JSON.parse(responseBody);",
									"",
									"if (typeof responseJson.SaleToPOIRequest === 'undefined') {",
									"    if (responseJson.SaleToPOIResponse.InputResponse.InputResult.Input.ConfirmedFlag) {",
									"        pm.globals.set(\"requestedAmount\", pm.globals.get(\"originalAmount\"));",
									"        pm.globals.set(\"paidAmount\", 0);",
									"",
									"        var d = new Date();",
									"        pm.globals.set(\"splitTransactionId\", \"Split_\".concat(d.getTime().toString())); //Custom merchant reference",
									"        pm.globals.set(\"splitCounter\", 0);",
									"        postman.setNextRequest(\"SplitPayment\");",
									"    } else {",
									"        postman.setNextRequest(\"NoSplitPaymentMethod\");",
									"    }",
									"}"
								],
								"type": "text/javascript"
							}
						}
					],
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Content-Type",
								"name": "Content-Type",
								"value": "application/json",
								"type": "text"
							}
						],
						"body": {
							"mode": "raw",
							"raw": "{\n     \"SaleToPOIRequest\": {\n       \"MessageHeader\": {\n         \"ProtocolVersion\": \"3.0\",\n         \"MessageClass\": \"Device\",\n         \"MessageCategory\": \"Input\",\n         \"MessageType\": \"Request\",\n         \"ServiceID\": \"{{serviceId}}\",\n         \"SaleID\": \"{{saleId}}\",\n         \"POIID\": \"{{poiId}}\"\n       },\n       \"InputRequest\": {\n         \"DisplayOutput\": {\n           \"Device\": \"CustomerDisplay\",\n           \"InfoQualify\": \"Display\",\n           \"OutputContent\": {\n             \"OutputFormat\": \"Text\",\n             \"PredefinedContent\": {\n               \"ReferenceID\": \"GetConfirmation\"\n             },\n             \"OutputText\": [\n               {\"Text\": \"€ {{originalAmount}}\"},\n               {\"Text\": \"Do you want to split the bill?\"},\n               {\"Text\": \"No\"},\n               {\"Text\": \"Yes\"}\n             ]\n           }\n         },\n         \"InputData\": {\n           \"Device\": \"CustomerInput\",\n           \"InfoQualify\": \"Input\",\n           \"InputCommand\": \"GetConfirmation\",\n           \"MaxInputTime\": 60\n         }\n       }\n     }\n   }",
							"options": {
								"raw": {
									"language": "json"
								}
							}
						},
						"url": {
							"raw": "{{baseUrl}}",
							"host": [
								"{{baseUrl}}"
							],
							"query": [
								{
									"key": "",
									"value": "",
									"disabled": true
								}
							]
						}
					},
					"response": []
				},
				{
					"name": "NoSplitPaymentMethod",
					"event": [
						{
							"listen": "prerequest",
							"script": {
								"exec": [
									"const referenceId = pm.globals.get(\"referenceId\");",
									"",
									"var amount = \"\";",
									"",
									"switch (referenceId%10) {",
									"    case 1: amount = \"58.00\";",
									"    break;",
									"    ",
									"    case 2: amount = \"116.50\";",
									"    break;",
									"    ",
									"    case 3: amount = \"72.23\";",
									"    break;",
									"    ",
									"    case 4: amount = \"42.99\";",
									"    break;",
									"    ",
									"    case 5: amount = \"229.00\";",
									"    break;",
									"    ",
									"    case 6: amount = \"628.00\";",
									"    break;",
									"    ",
									"    case 7: amount = \"50.99\";",
									"    break;",
									"    ",
									"    case 8: amount = \"107.00\";",
									"    break;",
									"    ",
									"    case 9: amount = \"72.00\";",
									"    break;",
									"    ",
									"    default: amount = \"120.00\";",
									"}",
									"",
									"pm.globals.set(\"originalAmount\", amount);"
								],
								"type": "text/javascript"
							}
						},
						{
							"listen": "test",
							"script": {
								"exec": [
									"var responseJson = JSON.parse(responseBody);",
									"",
									"if (typeof responseJson.SaleToPOIRequest === 'undefined') {",
									"    if (responseJson.SaleToPOIResponse.InputResponse.InputResult.Input.ConfirmedFlag) {",
									"        postman.setNextRequest(\"NoSplitCashPaymentConfirmation\");",
									"    } else {",
									"        postman.setNextRequest(\"NoSplitCardPayment\");",
									"    }",
									"}"
								],
								"type": "text/javascript"
							}
						}
					],
					"request": {
						"method": "POST",
						"header": [],
						"body": {
							"mode": "raw",
							"raw": "{\n    \"SaleToPOIRequest\":{\n        \"MessageHeader\":{\n            \"ProtocolVersion\":\"3.0\",\n            \"MessageClass\":\"Device\",\n            \"MessageCategory\":\"Input\",\n            \"MessageType\":\"Request\",\n            \"ServiceID\":\"{{serviceId}}\",\n            \"SaleID\":\"{{saleId}}\",\n            \"POIID\":\"{{poiId}}\"\n        },\n        \"InputRequest\":{\n            \"DisplayOutput\":{\n                \"Device\":\"CustomerDisplay\",\n                \"InfoQualify\":\"Display\",\n                \"OutputContent\":{\n                    \"OutputFormat\":\"Text\",\n                    \"PredefinedContent\":{\n                        \"ReferenceID\":\"GetConfirmation\"\n                    },\n                    \"OutputText\":[\n                        {\n                            \"Text\":\"Payment method\"\n                        },\n                        {\n                            \"Text\":\"Do you want to pay by card or cash?\"\n                        },\n                        {\n                            \"Text\":\"Card\"\n                        },\n                        {\n                            \"Text\":\"Cash\"\n                        }\n                    ]\n                }\n            },\n            \"InputData\":{\n                \"Device\":\"CustomerInput\",\n                \"InfoQualify\":\"Input\",\n                \"InputCommand\":\"GetConfirmation\",\n                \"MaxInputTime\":30\n            }\n        }\n    }\n}\n",
							"options": {
								"raw": {
									"language": "json"
								}
							}
						},
						"url": {
							"raw": "{{baseUrl}}",
							"host": [
								"{{baseUrl}}"
							]
						}
					},
					"response": []
				},
				{
					"name": "NoSplitCashPaymentConfirmation",
					"event": [
						{
							"listen": "test",
							"script": {
								"exec": [
									"var responseJson = JSON.parse(responseBody);",
									"",
									"if (typeof responseJson.SaleToPOIRequest === 'undefined') {",
									"    if (responseJson.SaleToPOIResponse.InputResponse.InputResult.Input.ConfirmedFlag) {",
									"        postman.setNextRequest(\"NoSplitCashPayment\");",
									"    } else {",
									"        postman.setNextRequest(\"NoSplitPaymentMethod\");",
									"    }",
									"}"
								],
								"type": "text/javascript"
							}
						}
					],
					"request": {
						"method": "POST",
						"header": [],
						"body": {
							"mode": "raw",
							"raw": "{\n     \"SaleToPOIRequest\": {\n       \"MessageHeader\": {\n         \"ProtocolVersion\": \"3.0\",\n         \"MessageClass\": \"Device\",\n         \"MessageCategory\": \"Input\",\n         \"MessageType\": \"Request\",\n         \"ServiceID\": \"{{serviceId}}\",\n         \"SaleID\": \"{{saleId}}\",\n         \"POIID\": \"{{poiId}}\"\n       },\n       \"InputRequest\": {\n         \"DisplayOutput\": {\n           \"Device\": \"CustomerDisplay\",\n           \"InfoQualify\": \"Display\",\n           \"OutputContent\": {\n             \"OutputFormat\": \"Text\",\n             \"PredefinedContent\": {\n               \"ReferenceID\": \"GetConfirmation\"\n             },\n             \"OutputText\": [\n               {\"Text\": \"Cash payment\"},\n               {\"Text\": \"Has the payment been made in cash?\"},\n               {\"Text\": \"No\"},\n               {\"Text\": \"Yes\"}\n             ]\n           }\n         },\n         \"InputData\": {\n           \"Device\": \"CustomerInput\",\n           \"InfoQualify\": \"Input\",\n           \"InputCommand\": \"GetConfirmation\",\n           \"MaxInputTime\": 60\n         }\n       }\n     }\n   }",
							"options": {
								"raw": {
									"language": "json"
								}
							}
						},
						"url": {
							"raw": "{{baseUrl}}",
							"host": [
								"{{baseUrl}}"
							]
						}
					},
					"response": []
				},
				{
					"name": "NoSplitCardPayment",
					"event": [
						{
							"listen": "prerequest",
							"script": {
								"exec": [
									"pm.globals.set(\"inProcessSaleId\", pm.environment.get(\"saleId\"));",
									"pm.globals.set(\"inProcessServiceId\", pm.globals.get(\"serviceId\"));",
									"pm.globals.set(\"inProcessMessageCategory\", \"Payment\");",
									""
								],
								"type": "text/javascript"
							}
						},
						{
							"listen": "test",
							"script": {
								"exec": [
									"var responseJson = JSON.parse(responseBody);",
									"",
									"//Check if transaction was processed",
									"if (typeof responseJson.SaleToPOIRequest === 'undefined') {",
									"    //Transaction result",
									"    console.log(\"Result: \" + responseJson.SaleToPOIResponse.PaymentResponse.Response.Result);",
									"",
									"    //Get additional response",
									"    var additionalResponseString = responseJson.SaleToPOIResponse.PaymentResponse.Response.AdditionalResponse;",
									"    ",
									"",
									"    //Get receipt info",
									"    if (typeof responseJson.SaleToPOIResponse.PaymentResponse.Response.ErrorCondition === 'undefined') {",
									"        var receiptInfo = responseJson.SaleToPOIResponse.PaymentResponse.PaymentReceipt;",
									"        receiptInfo.forEach(receipt);",
									"    }",
									"",
									"    //If the result is \"Success\", we save some info",
									"    if (responseJson.SaleToPOIResponse.PaymentResponse.Response.Result == \"Success\") {",
									"        //We save the time stamp",
									"        var paymentTimeStamp = responseJson.SaleToPOIResponse.PaymentResponse.POIData.POITransactionID.TimeStamp;",
									"        pm.globals.set(\"paymentTimeStamp\", paymentTimeStamp);",
									"",
									"        //Transaction ID (tender reference + psp reference)",
									"        var paymentTransactionID = responseJson.SaleToPOIResponse.PaymentResponse.POIData.POITransactionID.TransactionID;",
									"        pm.globals.set(\"paymentTransactionId\", paymentTransactionID);",
									"",
									"        //PSP reference",
									"        var pspReference = paymentTransactionID.split(\".\")[1];",
									"        pm.globals.set(\"pspReference\", pspReference);",
									"        console.log(\"PSP reference: \" + pspReference);",
									"",
									"        //Original POIID",
									"        var originalPOIID = responseJson.SaleToPOIResponse.MessageHeader.POIID;",
									"        pm.globals.set(\"originalPOIID\", originalPOIID);",
									"        postman.setNextRequest(\"IdleScreen\");",
									"    } else {",
									"        console.log(\"Error condition: \" + responseJson.SaleToPOIResponse.PaymentResponse.Response.ErrorCondition);",
									"        postman.setNextRequest(\"NoSplitPaymentMethod\");",
									"    }",
									"} else {",
									"    //In case of error we get the error message",
									"    console.log(decodeURIComponent(responseJson.SaleToPOIRequest.EventNotification.EventDetails));",
									"}",
									"",
									"//Parse receipt info",
									"function receipt(item, index, arr) {",
									"    var document = item.DocumentQualifier;",
									"    var receipts = {};",
									"    receipts[document] = {};",
									"",
									"    for (i = 0; i < item.OutputContent.OutputText.length; i++) {",
									"        var text = item.OutputContent.OutputText[i].Text.split('&');",
									"        var key = \"\";",
									"        var value = \"\";",
									"",
									"        for (j = 0; j < text.length; j++) {",
									"            var pair = text[j].split('=');",
									"",
									"            if (pair[0] == \"key\") {",
									"                key = pair[1];",
									"            }",
									"",
									"            if (pair[0] == \"value\") {",
									"                value = pair[1];",
									"            }",
									"        }",
									"",
									"        receipts[document][key] = decodeURIComponent(value);",
									"    }",
									"",
									"    console.log(receipts);",
									"}",
									"",
									""
								],
								"type": "text/javascript"
							}
						}
					],
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Content-Type",
								"name": "Content-Type",
								"value": "application/json",
								"type": "text"
							}
						],
						"body": {
							"mode": "raw",
							"raw": "{\n    \"SaleToPOIRequest\": {\n        \"MessageHeader\": {\n            \"ProtocolVersion\": \"3.0\",\n            \"MessageClass\": \"Service\",\n            \"MessageCategory\": \"Payment\",\n            \"MessageType\": \"Request\",\n            \"SaleID\": \"{{saleId}}\",\n            \"ServiceID\": \"{{serviceId}}\",\n            \"POIID\": \"{{poiId}}\"\n        },\n        \"PaymentRequest\": {\n            \"SaleData\": {\n                \"SaleTransactionID\": {\n                    \"TransactionID\":\"{{$timestamp}}\",\n                    \"TimeStamp\":\"{{$isoTimestamp}}\"\n                },\n                \"SaleToAcquirerData\": \"tenderOption=ReceiptHandler&applicationInfo.merchantApplication.name=NAME_OF_POS_APPLICATION&applicationInfo.merchantApplication.version=2.13.05&applicationInfo.externalPlatform.name=COMPANY_NAME_OR_PLATFORM_NAME&applicationInfo.externalPlatform.version=1.3&applicationInfo.externalPlatform.integrator=COMPANY_THAT_BUILT_INTEGRATION_OR_POS_APP&applicationInfo.merchantDevice.os=OS_OF_DEVICE_THAT_RUNS_POS_APPLICATION&applicationInfo.merchantDevice.osVersion=16.3&metadata.someMetaDataKey1=YOUR_VALUE&metadata.someMetaDataKey2=YOUR_VALUE\",\n                \"OperatorID\": \"Sara\",\n                \"ShiftNumber\": \"2\"\n            },\n            \"PaymentTransaction\": {\n                \"AmountsReq\": {\n                    \"Currency\": \"{{currency}}\",\n                    \"RequestedAmount\": {{originalAmount}}\n                }\n            }\n        }\n    }\n}",
							"options": {
								"raw": {
									"language": "json"
								}
							}
						},
						"url": {
							"raw": "{{baseUrl}}",
							"host": [
								"{{baseUrl}}"
							]
						}
					},
					"response": []
				},
				{
					"name": "SplitPayment",
					"event": [
						{
							"listen": "prerequest",
							"script": {
								"exec": [
									"pm.globals.set(\"inProcessSaleId\", pm.environment.get(\"saleId\"));",
									"pm.globals.set(\"inProcessServiceId\", pm.globals.get(\"serviceId\"));",
									"pm.globals.set(\"inProcessMessageCategory\", \"Payment\");",
									"",
									"const splitTransactionId = pm.globals.get(\"splitTransactionId\");",
									"",
									"var splitCounter = pm.globals.get(\"splitCounter\");",
									"splitCounter++;",
									"console.log(\"Split: \" + splitCounter);",
									"pm.globals.set(\"splitCounter\", splitCounter);"
								],
								"type": "text/javascript"
							}
						},
						{
							"listen": "test",
							"script": {
								"exec": [
									"var responseJson = JSON.parse(responseBody);",
									"",
									"//Check if transaction was processed",
									"if (typeof responseJson.SaleToPOIRequest === 'undefined') {",
									"    //Transaction result",
									"    console.log(\"Result: \" + responseJson.SaleToPOIResponse.PaymentResponse.Response.Result);",
									"",
									"    //Get additional response",
									"    if (typeof responseJson.SaleToPOIResponse.PaymentResponse.Response.AdditionalResponse !== 'undefined') {",
									"        var additionalResponseString = responseJson.SaleToPOIResponse.PaymentResponse.Response.AdditionalResponse;",
									"    }",
									"    ",
									"    //Get receipt info",
									"    if (typeof responseJson.SaleToPOIResponse.PaymentResponse.PaymentReceipt !== 'undefined') {",
									"        var receiptInfo = responseJson.SaleToPOIResponse.PaymentResponse.PaymentReceipt;",
									"        receiptInfo.forEach(receipt);",
									"    }",
									"",
									"    //If the result is \"Success\", we save some info",
									"    if (responseJson.SaleToPOIResponse.PaymentResponse.Response.Result == \"Success\") {",
									"        if (responseJson.SaleToPOIResponse.PaymentResponse.PaymentResult.PaymentInstrumentData.PaymentInstrumentType == \"Cash\") {",
									"            const authorizedAmount = responseJson.SaleToPOIResponse.PaymentResponse.PaymentResult.AmountsResp.AuthorizedAmount;",
									"            const partialCashAmount = Math.round(authorizedAmount * 100);",
									"            pm.globals.set(\"partialCashAmount\", partialCashAmount);",
									"            pm.globals.set(\"lastPayment\", true);",
									"            postman.setNextRequest(\"SplitCashPayment\");",
									"        } else {",
									"            //We save the time stamp",
									"            var paymentTimeStamp = responseJson.SaleToPOIResponse.PaymentResponse.POIData.POITransactionID.TimeStamp;",
									"            pm.globals.set(\"paymentTimeStamp\", paymentTimeStamp);",
									"",
									"            //Transaction ID (tender reference + psp reference)",
									"            var paymentTransactionID = responseJson.SaleToPOIResponse.PaymentResponse.POIData.POITransactionID.TransactionID;",
									"            pm.globals.set(\"paymentTransactionId\", paymentTransactionID);",
									"",
									"            //PSP reference",
									"            var pspReference = paymentTransactionID.split(\".\")[1];",
									"            pm.globals.set(\"pspReference\", pspReference);",
									"            console.log(\"PSP reference: \" + pspReference);",
									"",
									"            //Original POIID",
									"            var originalPOIID = responseJson.SaleToPOIResponse.MessageHeader.POIID;",
									"            pm.globals.set(\"originalPOIID\", originalPOIID);",
									"            postman.setNextRequest(\"IdleScreen\");",
									"        }",
									"",
									"    } else if (responseJson.SaleToPOIResponse.PaymentResponse.Response.Result == \"Partial\") {",
									"        const requestedAmount = pm.globals.get(\"requestedAmount\");",
									"        const authorizedAmount = responseJson.SaleToPOIResponse.PaymentResponse.PaymentResult.AmountsResp.AuthorizedAmount;",
									"        const newRequestedAmount = requestedAmount - authorizedAmount;",
									"",
									"        console.log(\"Requested amount: \" + requestedAmount);",
									"        console.log(\"Authorized amount: \" + authorizedAmount);",
									"        console.log(\"Remaining: \" + newRequestedAmount);",
									"",
									"        pm.globals.set(\"requestedAmount\", newRequestedAmount);",
									"",
									"        const paidAmount = pm.globals.get(\"paidAmount\");",
									"        const newPaidAmount = paidAmount + authorizedAmount;",
									"        ",
									"        pm.globals.set(\"paidAmount\", newPaidAmount);",
									"",
									"        if (responseJson.SaleToPOIResponse.PaymentResponse.PaymentResult.PaymentInstrumentData.PaymentInstrumentType == \"Cash\") {",
									"            const partialCashAmount = Math.round(authorizedAmount * 100);",
									"            pm.globals.set(\"partialCashAmount\", partialCashAmount);",
									"            pm.globals.set(\"lastPayment\", false);",
									"            postman.setNextRequest(\"SplitCashPayment\");",
									"        } else {",
									"            //We save the time stamp",
									"            var paymentTimeStamp = responseJson.SaleToPOIResponse.PaymentResponse.POIData.POITransactionID.TimeStamp;",
									"            pm.globals.set(\"paymentTimeStamp\", paymentTimeStamp);",
									"",
									"            //Transaction ID (tender reference + psp reference)",
									"            var paymentTransactionID = responseJson.SaleToPOIResponse.PaymentResponse.POIData.POITransactionID.TransactionID;",
									"            pm.globals.set(\"paymentTransactionId\", paymentTransactionID);",
									"",
									"            //PSP reference",
									"            var pspReference = paymentTransactionID.split(\".\")[1];",
									"            pm.globals.set(\"pspReference\", pspReference);",
									"            console.log(\"PSP reference: \" + pspReference);",
									"",
									"            //Original POIID",
									"            var originalPOIID = responseJson.SaleToPOIResponse.MessageHeader.POIID;",
									"            pm.globals.set(\"originalPOIID\", originalPOIID);",
									"            postman.setNextRequest(\"SplitPayment\");",
									"        }",
									"    } else {",
									"        console.log(\"Error condition: \" + responseJson.SaleToPOIResponse.PaymentResponse.Response.ErrorCondition);",
									"        postman.setNextRequest(\"SplitPayment\");",
									"    }",
									"} else {",
									"    //In case of error we get the error message",
									"    console.log(decodeURIComponent(responseJson.SaleToPOIRequest.EventNotification.EventDetails));",
									"}",
									"",
									"//Parse receipt info",
									"function receipt(item, index, arr) {",
									"    var document = item.DocumentQualifier;",
									"    var receipts = {};",
									"    receipts[document] = {};",
									"",
									"    for (i = 0; i < item.OutputContent.OutputText.length; i++) {",
									"        var text = item.OutputContent.OutputText[i].Text.split('&');",
									"        var key = \"\";",
									"        var value = \"\";",
									"",
									"        for (j = 0; j < text.length; j++) {",
									"            var pair = text[j].split('=');",
									"",
									"            if (pair[0] == \"key\") {",
									"                key = pair[1];",
									"            }",
									"",
									"            if (pair[0] == \"value\") {",
									"                value = pair[1];",
									"            }",
									"        }",
									"",
									"        receipts[document][key] = decodeURIComponent(value);",
									"    }",
									"",
									"    console.log(receipts);",
									"}",
									"",
									""
								],
								"type": "text/javascript"
							}
						}
					],
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Content-Type",
								"name": "Content-Type",
								"value": "application/json",
								"type": "text"
							}
						],
						"body": {
							"mode": "raw",
							"raw": "{\n    \"SaleToPOIRequest\": {\n        \"MessageHeader\": {\n            \"ProtocolVersion\": \"3.0\",\n            \"MessageClass\": \"Service\",\n            \"MessageCategory\": \"Payment\",\n            \"MessageType\": \"Request\",\n            \"SaleID\": \"{{saleId}}\",\n            \"ServiceID\": \"{{serviceId}}\",\n            \"POIID\": \"{{poiId}}\"\n        },\n        \"PaymentRequest\": {\n            \"SaleData\": {\n                \"SaleTransactionID\": {\n                    \"TransactionID\": \"{{splitTransactionId}}\",\n                    \"TimeStamp\": \"{{$isoTimestamp}}\"\n                },\n                \"SaleToAcquirerData\": \"tenderOption=ReceiptHandler&applicationInfo.merchantApplication.name=NAME_OF_POS_APPLICATION&applicationInfo.merchantApplication.version=2.13.05&applicationInfo.externalPlatform.name=COMPANY_NAME_OR_PLATFORM_NAME&applicationInfo.externalPlatform.version=1.3&applicationInfo.externalPlatform.integrator=COMPANY_THAT_BUILT_INTEGRATION_OR_POS_APP&applicationInfo.merchantDevice.os=OS_OF_DEVICE_THAT_RUNS_POS_APPLICATION&applicationInfo.merchantDevice.osVersion=16.3&metadata.someMetaDataKey1=YOUR_VALUE&metadata.someMetaDataKey2=YOUR_VALUE\",\n                \"OperatorID\": \"Sara\",\n                \"ShiftNumber\": \"2\"\n            },\n            \"PaymentTransaction\": {\n                \"AmountsReq\": {\n                    \"Currency\": \"{{currency}}\",\n                    \"RequestedAmount\": {{requestedAmount}},\n                    \"PaidAmount\": {{paidAmount}}\n                }\n            },\n            \"PaymentData\": {\n                \"PaymentType\": \"Normal\",\n                \"SplitPaymentFlag\": true\n            }\n        }\n    }\n}",
							"options": {
								"raw": {
									"language": "json"
								}
							}
						},
						"url": {
							"raw": "{{baseUrl}}",
							"host": [
								"{{baseUrl}}"
							]
						}
					},
					"response": []
				},
				{
					"name": "IdleScreen",
					"request": {
						"method": "POST",
						"header": [],
						"body": {
							"mode": "raw",
							"raw": "{\n    \"SaleToPOIRequest\": {\n        \"MessageHeader\": {\n            \"ProtocolVersion\": \"3.0\",\n            \"MessageClass\": \"Device\",\n            \"MessageCategory\": \"Display\",\n            \"MessageType\": \"Request\",\n            \"SaleID\": \"{{saleId}}\",\n            \"ServiceID\": \"{{serviceId}}\",\n            \"POIID\": \"{{poiId}}\"\n        },\n        \"DisplayRequest\": {\n            \"DisplayOutput\": [\n                {\n                    \"Device\": \"CustomerDisplay\",\n                    \"InfoQualify\": \"Display\",\n                    \"OutputContent\": {\n                        \"OutputFormat\": \"MessageRef\",\n                        \"PredefinedContent\": {\n                            \"ReferenceID\": \"Idle\"\n                        }\n                    }\n                }\n            ]\n        }\n    }\n}",
							"options": {
								"raw": {
									"language": "json"
								}
							}
						},
						"url": {
							"raw": "{{baseUrl}}",
							"host": [
								"{{baseUrl}}"
							]
						}
					},
					"response": []
				}
			],
			"description": "Run all the requests inside this folder."
		},
		{
			"name": "Tag",
			"item": [
				{
					"name": "Payment request Tokenisation",
					"event": [
						{
							"listen": "prerequest",
							"script": {
								"exec": [
									"pm.globals.set(\"inProcessSaleId\", pm.environment.get(\"saleId\"));",
									"pm.globals.set(\"inProcessServiceId\", pm.globals.get(\"serviceId\"));",
									"pm.globals.set(\"inProcessMessageCategory\", \"Payment\");",
									""
								],
								"type": "text/javascript"
							}
						},
						{
							"listen": "test",
							"script": {
								"exec": [
									"var responseJson = JSON.parse(responseBody);",
									"",
									"//Check if transaction was processed",
									"if (typeof responseJson.SaleToPOIRequest === 'undefined') {",
									"    //Transaction result",
									"    console.log(\"Result: \" + responseJson.SaleToPOIResponse.PaymentResponse.Response.Result);",
									"",
									"    //Get additional response",
									"    var additionalResponseString = responseJson.SaleToPOIResponse.PaymentResponse.Response.AdditionalResponse;",
									"    var additionalResponseJsonString = '{\"' + additionalResponseString.replace(/&/g, '\", \"').replace(/=/g, '\": \"') + '\"}';",
									"    var additionalResponseJson = JSON.parse(additionalResponseJsonString);",
									"",
									"    //Get receipt info",
									"    if (typeof responseJson.SaleToPOIResponse.PaymentResponse.Response.ErrorCondition === 'undefined') {",
									"        var receiptInfo = responseJson.SaleToPOIResponse.PaymentResponse.PaymentReceipt;",
									"        receiptInfo.forEach(receipt);",
									"    }",
									"",
									"    //If the result is \"Success\", we save some info",
									"    if (responseJson.SaleToPOIResponse.PaymentResponse.Response.Result == \"Success\") {",
									"        //We save the time stamp",
									"        var paymentTimeStamp = responseJson.SaleToPOIResponse.PaymentResponse.POIData.POITransactionID.TimeStamp;",
									"        pm.globals.set(\"paymentTimeStamp\", paymentTimeStamp);",
									"",
									"        //Transaction ID (tender reference + psp reference)",
									"        var paymentTransactionID = responseJson.SaleToPOIResponse.PaymentResponse.POIData.POITransactionID.TransactionID;",
									"        pm.globals.set(\"paymentTransactionId\", paymentTransactionID);",
									"",
									"        //PSP reference",
									"        var pspReference = paymentTransactionID.split(\".\")[1];",
									"        pm.globals.set(\"pspReference\", pspReference);",
									"        console.log(\"PSP reference: \" + pspReference);",
									"",
									"        //Original POIID",
									"        var originalPOIID = responseJson.SaleToPOIResponse.MessageHeader.POIID;",
									"        pm.globals.set(\"originalPOIID\", originalPOIID);",
									"",
									"        //Save token",
									"        var token = additionalResponseJson[\"recurring.recurringDetailReference\"];",
									"        pm.globals.set(\"token\", token);",
									"        console.log(\"Token: \" + token);",
									"",
									"        //Save shopper reference",
									"        var shopperReference = additionalResponseJson.shopperReference;",
									"        pm.globals.set(\"shopperReference\", shopperReference);",
									"        console.log(\"Shopper reference: \" + shopperReference);",
									"    } else {",
									"        console.log(\"Error condition: \" + responseJson.SaleToPOIResponse.PaymentResponse.Response.ErrorCondition);",
									"    }",
									"} else {",
									"    //In case of error we get the error message",
									"    console.log(decodeURIComponent(responseJson.SaleToPOIRequest.EventNotification.EventDetails));",
									"}",
									"",
									"//Parse receipt info",
									"function receipt(item, index, arr) {",
									"    var document = item.DocumentQualifier;",
									"    var receipts = {};",
									"    receipts[document] = {};",
									"",
									"    for (i = 0; i < item.OutputContent.OutputText.length; i++) {",
									"        var text = item.OutputContent.OutputText[i].Text.split('&');",
									"        var key = \"\";",
									"        var value = \"\";",
									"",
									"        for (j = 0; j < text.length; j++) {",
									"            var pair = text[j].split('=');",
									"",
									"            if (pair[0] == \"key\") {",
									"                key = pair[1];",
									"            }",
									"",
									"            if (pair[0] == \"value\") {",
									"                value = pair[1];",
									"            }",
									"        }",
									"",
									"        receipts[document][key] = decodeURIComponent(value);",
									"    }",
									"",
									"    console.log(receipts);",
									"}"
								],
								"type": "text/javascript"
							}
						}
					],
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Content-Type",
								"name": "Content-Type",
								"value": "application/json",
								"type": "text"
							}
						],
						"body": {
							"mode": "raw",
							"raw": "{\n    \"SaleToPOIRequest\": {\n        \"MessageHeader\": {\n            \"ProtocolVersion\": \"3.0\",\n            \"MessageClass\": \"Service\",\n            \"MessageCategory\": \"Payment\",\n            \"MessageType\": \"Request\",\n            \"SaleID\": \"{{saleId}}\",\n            \"ServiceID\": \"{{serviceId}}\",\n            \"POIID\": \"{{poiId}}\"\n        },\n        \"PaymentRequest\": {\n            \"SaleData\": {\n                \"SaleTransactionID\": {\n                    \"TransactionID\":\"{{$timestamp}}\",\n                    \"TimeStamp\":\"{{$isoTimestamp}}\"\n                },\n                \"SaleToAcquirerData\": \"tenderOption=ReceiptHandler&applicationInfo.merchantApplication.name=NAME_OF_POS_APPLICATION&applicationInfo.merchantApplication.version=2.13.05&applicationInfo.externalPlatform.name=COMPANY_NAME_OR_PLATFORM_NAME&applicationInfo.externalPlatform.version=1.3&applicationInfo.externalPlatform.integrator=COMPANY_THAT_BUILT_INTEGRATION_OR_POS_APP&applicationInfo.merchantDevice.os=OS_OF_DEVICE_THAT_RUNS_POS_APPLICATION&applicationInfo.merchantDevice.osVersion=16.3&metadata.someMetaDataKey1=YOUR_VALUE&metadata.someMetaDataKey2=YOUR_VALUE&shopperEmail=S.Hopper@example.com&shopperReference=testingShopper_005&recurringProcessingModel=Subscription&recurringContract=RECURRING\",\n                \"TokenRequestedType\": \"Customer\"\n            },\n            \"PaymentTransaction\": {\n                \"AmountsReq\": {\n                    \"Currency\": \"{{currency}}\",\n                    \"RequestedAmount\": 1.00\n                }\n            }\n        }\n    }\n}",
							"options": {
								"raw": {
									"language": "json"
								}
							}
						},
						"url": {
							"raw": "{{baseUrl}}",
							"host": [
								"{{baseUrl}}"
							]
						}
					},
					"response": []
				},
				{
					"name": "Tag writing",
					"event": [
						{
							"listen": "prerequest",
							"script": {
								"exec": [
									"function asciiToHex(str) {",
									"    var arr1 = [];",
									"",
									"    for (var n = 0, l = str.length; n < 48; n++) {",
									"        if (n < l) {",
									"            var hex = Number(str.charCodeAt(n)).toString(16);",
									"            arr1.push(hex);",
									"        } else {",
									"            arr1.push('00');",
									"        }",
									"    }",
									"    return arr1.join('');",
									"",
									"}",
									"",
									"",
									"pm.globals.set(\"inProcessSaleId\", pm.environment.get(\"saleId\"));",
									"pm.globals.set(\"inProcessServiceId\", pm.globals.get(\"serviceId\"));",
									"pm.globals.set(\"inProcessMessageCategory\", \"CardAcquisition\");",
									"",
									"var token = pm.globals.get(\"token\");",
									"var shopperReference = pm.globals.get(\"shopperReference\");",
									"",
									"var tokenHex = asciiToHex(token);",
									"",
									"var shopperReferenceHex = asciiToHex(shopperReference);",
									"",
									"var saleData = {",
									"    \"Operation\": [",
									"        {",
									"            \"Type\": \"NFCWrite\",",
									"             \"Variant\": \"MifareClassic\",",
									"             \"NFCData\": [{\"sector\": 1, \"data\":tokenHex},",
									"                         {\"sector\": 2, \"data\":shopperReferenceHex, \"keyType\":\"b\"}]",
									"",
									"        }",
									"    ]",
									"};",
									"",
									"",
									"var saleDataString = JSON.stringify(saleData);",
									"",
									"var saleToPoiData = btoa(saleDataString);",
									"",
									"pm.globals.set(\"saleToPoiData\", saleToPoiData);"
								],
								"type": "text/javascript"
							}
						},
						{
							"listen": "test",
							"script": {
								"exec": [
									"var responseJson = JSON.parse(responseBody);",
									"",
									"if (responseJson.SaleToPOIResponse.CardAcquisitionResponse.Response.Result == \"Success\") {",
									"    pm.globals.set(\"poiTimeStamp\", responseJson.SaleToPOIResponse.CardAcquisitionResponse.POIData.POITransactionID.TimeStamp);",
									"    pm.globals.set(\"poiTransactionId\", responseJson.SaleToPOIResponse.CardAcquisitionResponse.POIData.POITransactionID.TransactionID);",
									"}",
									"",
									"var additionalResponseString = responseJson.SaleToPOIResponse.CardAcquisitionResponse.Response.AdditionalResponse;",
									"",
									"console.log(additionalResponseString);"
								],
								"type": "text/javascript"
							}
						}
					],
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Content-Type",
								"name": "Content-Type",
								"value": "application/json",
								"type": "text"
							}
						],
						"body": {
							"mode": "raw",
							"raw": "{\n    \"SaleToPOIRequest\": {\n        \"MessageHeader\": {\n            \"ProtocolVersion\": \"3.0\",\n            \"MessageClass\": \"Service\",\n            \"MessageCategory\": \"CardAcquisition\",\n            \"MessageType\": \"Request\",\n            \"SaleID\": \"{{saleId}}\",\n            \"ServiceID\": \"{{serviceId}}\",\n            \"POIID\": \"{{poiId}}\"\n        },\n        \"CardAcquisitionRequest\": {\n            \"SaleData\": {\n                \"SaleTransactionID\": {\n                    \"TransactionID\":\"{{$timestamp}}\",\n                    \"TimeStamp\":\"{{$isoTimestamp}}\"\n                },\n                \"SaleToPOIData\": \"{{saleToPoiData}}\"\n            },\n            \"CardAcquisitionTransaction\": {\n            }\n        }\n    }\n}",
							"options": {
								"raw": {
									"language": "json"
								}
							}
						},
						"url": {
							"raw": "{{baseUrl}}",
							"host": [
								"{{baseUrl}}"
							]
						}
					},
					"response": []
				},
				{
					"name": "End tag writing",
					"event": [
						{
							"listen": "test",
							"script": {
								"exec": [
									""
								],
								"type": "text/javascript"
							}
						}
					],
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Content-Type",
								"name": "Content-Type",
								"value": "application/json",
								"type": "text"
							}
						],
						"body": {
							"mode": "raw",
							"raw": "{\n    \"SaleToPOIRequest\": {\n        \"MessageHeader\": {\n            \"ProtocolVersion\": \"3.0\",\n            \"MessageClass\": \"Service\",\n            \"MessageCategory\": \"EnableService\",\n            \"MessageType\": \"Request\",\n            \"ServiceID\": \"{{serviceId}}\",\n            \"SaleID\": \"{{saleId}}\",\n            \"POIID\": \"{{poiId}}\"\n        },\n        \"EnableServiceRequest\": {\n            \"TransactionAction\": \"AbortTransaction\",\n            \"DisplayOutput\": {\n                \"Device\": \"CustomerDisplay\",\n                \"InfoQualify\": \"Display\",\n                \"OutputContent\": {\n                    \"PredefinedContent\": {\n                        \"ReferenceID\": \"AcceptedAnimated\"\n                    },\n                    \"OutputFormat\": \"Text\",\n                    \"OutputText\": [\n                        {\n                            \"Text\": \"Tag created\"\n                        },\n                        {\n                            \"Text\": \"The tag was succesfully generated\"\n                        }\n                    ]\n                }\n            }\n        }\n    }\n}",
							"options": {
								"raw": {
									"language": "json"
								}
							}
						},
						"url": {
							"raw": "{{baseUrl}}",
							"host": [
								"{{baseUrl}}"
							]
						}
					},
					"response": []
				},
				{
					"name": "Card acquisition request",
					"event": [
						{
							"listen": "prerequest",
							"script": {
								"exec": [
									"pm.globals.set(\"inProcessSaleId\", pm.environment.get(\"saleId\"));",
									"pm.globals.set(\"inProcessServiceId\", pm.globals.get(\"serviceId\"));",
									"pm.globals.set(\"inProcessMessageCategory\", \"CardAcquisition\");",
									"",
									"var saleData = {",
									"    \"Operation\": [",
									"        {",
									"            \"Type\": \"NFCRead\",",
									"             \"Variant\": \"MifareClassic\",",
									"             \"NFCData\": [{\"sector\": 1, \"keyType\":\"a\"}, {\"sector\": 2, \"keyType\":\"b\"}, {\"sector\": 12}]",
									"        }",
									"    ]",
									"};",
									"",
									"var saleDataString = JSON.stringify(saleData);",
									"",
									"var saleToPoiData = btoa(saleDataString);",
									"",
									"pm.globals.set(\"saleToPoiData\", saleToPoiData);"
								],
								"type": "text/javascript"
							}
						},
						{
							"listen": "test",
							"script": {
								"exec": [
									"function hexToAscii(str) {",
									"    var hex = str1.toString();",
									"    var str = '';",
									"\tfor (var n = 0; n < hex.length; n += 2) {",
									"        str += String.fromCharCode(parseInt(hex.substr(n, 2), 16));",
									"    }",
									"",
									"    return str;",
									"}",
									"",
									"var responseJson = JSON.parse(responseBody);",
									"",
									"var additionalResponseString = responseJson.SaleToPOIResponse.CardAcquisitionResponse.Response.AdditionalResponse;",
									"",
									"if (responseJson.SaleToPOIResponse.CardAcquisitionResponse.Response.Result == \"Success\") {",
									"    pm.globals.set(\"poiTimeStamp\", responseJson.SaleToPOIResponse.CardAcquisitionResponse.POIData.POITransactionID.TimeStamp);",
									"    pm.globals.set(\"poiTransactionId\", responseJson.SaleToPOIResponse.CardAcquisitionResponse.POIData.POITransactionID.TransactionID);",
									"",
									"    var tagToken = additionalResponseString[\"NFC.data.S01\"];",
									"    var tagshopperReference = additionalResponseString[\"NFC.data.S02\"];",
									"",
									"    pm.globals.set(\"tagToken\", tagToken);",
									"    pm.globals.set(\"tagShopperReference\", tagshopperReference);",
									"}",
									""
								],
								"type": "text/javascript"
							}
						}
					],
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Content-Type",
								"name": "Content-Type",
								"value": "application/json",
								"type": "text"
							}
						],
						"body": {
							"mode": "raw",
							"raw": "{\n    \"SaleToPOIRequest\": {\n        \"MessageHeader\": {\n            \"ProtocolVersion\": \"3.0\",\n            \"MessageClass\": \"Service\",\n            \"MessageCategory\": \"CardAcquisition\",\n            \"MessageType\": \"Request\",\n            \"SaleID\": \"{{saleId}}\",\n            \"ServiceID\": \"{{serviceId}}\",\n            \"POIID\": \"{{poiId}}\"\n        },\n        \"CardAcquisitionRequest\": {\n            \"SaleData\": {\n                \"SaleTransactionID\": {\n                    \"TransactionID\":\"{{$timestamp}}\",\n                    \"TimeStamp\":\"{{$isoTimestamp}}\"\n                },\n                \"TokenRequestedType\": \"Customer\",\n                \"SaleToPOIData\": \"{{saleToPoiData}}\"\n            },\n            \"CardAcquisitionTransaction\": {\n                \"TotalAmount\": 10.00\n            }\n        }\n    }\n}",
							"options": {
								"raw": {
									"language": "json"
								}
							}
						},
						"url": {
							"raw": "{{baseUrl}}",
							"host": [
								"{{baseUrl}}"
							]
						}
					},
					"response": []
				},
				{
					"name": "Payment approved",
					"event": [
						{
							"listen": "test",
							"script": {
								"exec": [
									"var responseJson = JSON.parse(responseBody);",
									"",
									"var additionalResponseString =  responseJson.SaleToPOIResponse.EnableServiceResponse.Response.AdditionalResponse;",
									"",
									"console.log(additionalResponseString);"
								],
								"type": "text/javascript"
							}
						}
					],
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Content-Type",
								"name": "Content-Type",
								"value": "application/json",
								"type": "text"
							}
						],
						"body": {
							"mode": "raw",
							"raw": "{\n    \"SaleToPOIRequest\": {\n        \"MessageHeader\": {\n            \"ProtocolVersion\": \"3.0\",\n            \"MessageClass\": \"Service\",\n            \"MessageCategory\": \"EnableService\",\n            \"MessageType\": \"Request\",\n            \"ServiceID\": \"{{serviceId}}\",\n            \"SaleID\": \"{{saleId}}\",\n            \"POIID\": \"{{poiId}}\"\n        },\n        \"EnableServiceRequest\": {\n            \"TransactionAction\": \"AbortTransaction\",\n            \"DisplayOutput\": {\n                \"Device\": \"CustomerDisplay\",\n                \"InfoQualify\": \"Display\",\n                \"OutputContent\": {\n                    \"PredefinedContent\": {\n                        \"ReferenceID\": \"AcceptedAnimated\"\n                    },\n                    \"OutputFormat\": \"Text\",\n                    \"OutputText\": [\n                        {\n                            \"Text\": \"Approved\"\n                        },\n                        {\n                            \"Text\": \"Payment processed succesfully\"\n                        }\n                    ]\n                }\n            }\n        }\n    }\n}",
							"options": {
								"raw": {
									"language": "json"
								}
							}
						},
						"url": {
							"raw": "{{baseUrl}}",
							"host": [
								"{{baseUrl}}"
							]
						}
					},
					"response": []
				},
				{
					"name": "Identify tag",
					"event": [
						{
							"listen": "prerequest",
							"script": {
								"exec": [
									"const saleData = {",
									"   \"Operation\":[",
									"      {",
									"         \"Type\":\"NFCReadUID\"",
									"      }",
									"   ]",
									"};",
									"",
									"pm.globals.set(\"saleToPoiData\", btoa(JSON.stringify(saleData)));"
								],
								"type": "text/javascript"
							}
						}
					],
					"request": {
						"method": "POST",
						"header": [],
						"body": {
							"mode": "raw",
							"raw": "{\n    \"SaleToPOIRequest\": {\n        \"MessageHeader\": {\n            \"ProtocolVersion\": \"3.0\",\n            \"MessageClass\": \"Service\",\n            \"MessageCategory\": \"CardAcquisition\",\n            \"MessageType\": \"Request\",\n            \"SaleID\": \"{{saleId}}\",\n            \"ServiceID\": \"{{serviceId}}\",\n            \"POIID\": \"{{poiId}}\"\n        },\n        \"CardAcquisitionRequest\": {\n            \"SaleData\": {\n                \"SaleTransactionID\": {\n                    \"TransactionID\":\"{{$timestamp}}\",\n                    \"TimeStamp\":\"{{$isoTimestamp}}\"\n                },\n                \"SaleToPOIData\": \"{{saleToPoiData}}\"\n            },\n            \"CardAcquisitionTransaction\": {\n            }\n        }\n    }\n}",
							"options": {
								"raw": {
									"language": "json"
								}
							}
						},
						"url": {
							"raw": "{{baseUrl}}",
							"host": [
								"{{baseUrl}}"
							]
						}
					},
					"response": []
				}
			]
		},
		{
			"name": "Shopper engagement",
			"item": [
				{
					"name": "Card acquisition request",
					"event": [
						{
							"listen": "prerequest",
							"script": {
								"exec": [
									"pm.globals.set(\"inProcessSaleId\", pm.environment.get(\"saleId\"));",
									"pm.globals.set(\"inProcessServiceId\", pm.globals.get(\"serviceId\"));",
									"pm.globals.set(\"inProcessMessageCategory\", \"CardAcquisition\");",
									""
								],
								"type": "text/javascript"
							}
						},
						{
							"listen": "test",
							"script": {
								"exec": [
									"var responseJson = JSON.parse(responseBody);",
									"",
									"if (responseJson.SaleToPOIResponse.CardAcquisitionResponse.Response.Result == \"Success\") {",
									"    pm.globals.set(\"poiTimeStamp\", responseJson.SaleToPOIResponse.CardAcquisitionResponse.POIData.POITransactionID.TimeStamp);",
									"    pm.globals.set(\"poiTransactionId\", responseJson.SaleToPOIResponse.CardAcquisitionResponse.POIData.POITransactionID.TransactionID);",
									"}",
									"",
									"var additionalResponseString = responseJson.SaleToPOIResponse.CardAcquisitionResponse.Response.AdditionalResponse;",
									"",
									"console.log(additionalResponseString);"
								],
								"type": "text/javascript"
							}
						}
					],
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Content-Type",
								"name": "Content-Type",
								"value": "application/json",
								"type": "text"
							}
						],
						"body": {
							"mode": "raw",
							"raw": "{\n    \"SaleToPOIRequest\": {\n        \"MessageHeader\": {\n            \"ProtocolVersion\": \"3.0\",\n            \"MessageClass\": \"Service\",\n            \"MessageCategory\": \"CardAcquisition\",\n            \"MessageType\": \"Request\",\n            \"SaleID\": \"{{saleId}}\",\n            \"ServiceID\": \"{{serviceId}}\",\n            \"POIID\": \"{{poiId}}\"\n        },\n        \"CardAcquisitionRequest\": {\n            \"SaleData\": {\n                \"SaleTransactionID\": {\n                    \"TransactionID\":\"{{$timestamp}}\",\n                    \"TimeStamp\":\"{{$isoTimestamp}}\"\n                },\n                \"TokenRequestedType\": \"Customer\",\n                \"SaleToAcquirerData\": \"tenderOption=ReceiptHandler&applicationInfo.merchantApplication.name=NAME_OF_POS_APPLICATION&applicationInfo.merchantApplication.version=2.13.05&applicationInfo.externalPlatform.name=COMPANY_NAME_OR_PLATFORM_NAME&applicationInfo.externalPlatform.version=1.3&applicationInfo.externalPlatform.integrator=COMPANY_THAT_BUILT_INTEGRATION_OR_POS_APP&applicationInfo.merchantDevice.os=OS_OF_DEVICE_THAT_RUNS_POS_APPLICATION&applicationInfo.merchantDevice.osVersion=16.3&metadata.someMetaDataKey1=YOUR_VALUE&metadata.someMetaDataKey2=YOUR_VALUE\"\n                \n            },\n            \"CardAcquisitionTransaction\": {\n                \"TotalAmount\": 110.00\n            }\n        }\n    }\n}",
							"options": {
								"raw": {
									"language": "json"
								}
							}
						},
						"url": {
							"raw": "{{baseUrl}}",
							"host": [
								"{{baseUrl}}"
							]
						}
					},
					"response": []
				},
				{
					"name": "Card acquisition payment request",
					"event": [
						{
							"listen": "prerequest",
							"script": {
								"exec": [
									""
								],
								"type": "text/javascript"
							}
						},
						{
							"listen": "test",
							"script": {
								"exec": [
									"var responseJson = JSON.parse(responseBody);",
									"",
									"//Check if transaction was processed",
									"if (typeof responseJson.SaleToPOIRequest === 'undefined') {",
									"    //Transaction result",
									"    console.log(\"Result: \" + responseJson.SaleToPOIResponse.PaymentResponse.Response.Result);",
									"",
									"    //Get additional response",
									"    var additionalResponseString = responseJson.SaleToPOIResponse.PaymentResponse.Response.AdditionalResponse;",
									"",
									"    //Get receipt info",
									"    if (typeof responseJson.SaleToPOIResponse.PaymentResponse.Response.ErrorCondition === 'undefined') {",
									"        var receiptInfo = responseJson.SaleToPOIResponse.PaymentResponse.PaymentReceipt;",
									"        receiptInfo.forEach(receipt);",
									"    }",
									"",
									"    //If the result is \"Success\", we save some info",
									"    if (responseJson.SaleToPOIResponse.PaymentResponse.Response.Result == \"Success\") {",
									"        //We save the time stamp",
									"        var paymentTimeStamp = responseJson.SaleToPOIResponse.PaymentResponse.POIData.POITransactionID.TimeStamp;",
									"        pm.globals.set(\"paymentTimeStamp\", paymentTimeStamp);",
									"",
									"        //Transaction ID (tender reference + psp reference)",
									"        var paymentTransactionID = responseJson.SaleToPOIResponse.PaymentResponse.POIData.POITransactionID.TransactionID;",
									"        pm.globals.set(\"paymentTransactionId\", paymentTransactionID);",
									"",
									"        //PSP reference",
									"        var pspReference = paymentTransactionID.split(\".\")[1];",
									"        pm.globals.set(\"pspReference\", pspReference);",
									"        console.log(\"PSP reference: \" + pspReference);",
									"",
									"        //Original POIID",
									"        var originalPOIID = responseJson.SaleToPOIResponse.MessageHeader.POIID;",
									"        pm.globals.set(\"originalPOIID\", originalPOIID);",
									"    } else {",
									"        console.log(\"Error condition: \" + responseJson.SaleToPOIResponse.PaymentResponse.Response.ErrorCondition);",
									"    }",
									"} else {",
									"    //In case of error we get the error message",
									"    console.log(decodeURIComponent(responseJson.SaleToPOIRequest.EventNotification.EventDetails));",
									"}",
									"",
									"//Parse receipt info",
									"function receipt(item, index, arr) {",
									"    var document = item.DocumentQualifier;",
									"    var receipts = {};",
									"    receipts[document] = {};",
									"",
									"    for (i = 0; i < item.OutputContent.OutputText.length; i++) {",
									"        var text = item.OutputContent.OutputText[i].Text.split('&');",
									"        var key = \"\";",
									"        var value = \"\";",
									"",
									"        for (j = 0; j < text.length; j++) {",
									"            var pair = text[j].split('=');",
									"",
									"            if (pair[0] == \"key\") {",
									"                key = pair[1];",
									"            }",
									"",
									"            if (pair[0] == \"value\") {",
									"                value = pair[1];",
									"            }",
									"        }",
									"",
									"        receipts[document][key] = decodeURIComponent(value);",
									"    }",
									"",
									"    console.log(receipts);",
									"}",
									"",
									""
								],
								"type": "text/javascript"
							}
						}
					],
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Content-Type",
								"name": "Content-Type",
								"value": "application/json",
								"type": "text"
							}
						],
						"body": {
							"mode": "raw",
							"raw": "{\n    \"SaleToPOIRequest\": {\n        \"MessageHeader\": {\n            \"ProtocolVersion\": \"3.0\",\n            \"MessageClass\": \"Service\",\n            \"MessageCategory\": \"Payment\",\n            \"MessageType\": \"Request\",\n            \"SaleID\": \"{{saleId}}\",\n            \"ServiceID\": \"{{serviceId}}\",\n            \"POIID\": \"{{poiId}}\"\n        },\n        \"PaymentRequest\": {\n            \"SaleData\": {\n                \"SaleTransactionID\": {\n                    \"TransactionID\":\"{{$timestamp}}\",\n                    \"TimeStamp\":\"{{$isoTimestamp}}\"\n                },\n                \"TokenRequestedType\": \"Customer\",\n                \"SaleToAcquirerData\": \"tenderOption=ReceiptHandler&applicationInfo.merchantApplication.name=NAME_OF_POS_APPLICATION&applicationInfo.merchantApplication.version=2.13.05&applicationInfo.externalPlatform.name=COMPANY_NAME_OR_PLATFORM_NAME&applicationInfo.externalPlatform.version=1.3&applicationInfo.externalPlatform.integrator=COMPANY_THAT_BUILT_INTEGRATION_OR_POS_APP&applicationInfo.merchantDevice.os=OS_OF_DEVICE_THAT_RUNS_POS_APPLICATION&applicationInfo.merchantDevice.osVersion=16.3&metadata.someMetaDataKey1=YOUR_VALUE&metadata.someMetaDataKey2=YOUR_VALUE&shopperEmail=S.Hopper@example.com&shopperReference=YOUR_UNIQUE_SHOPPER_ID&recurringProcessingModel=Subscription\"\n            },\n            \"PaymentTransaction\": {\n                \"AmountsReq\": {\n                    \"Currency\": \"{{currency}}\",\n                    \"RequestedAmount\": 110.00\n                }\n            },\n            \"PaymentData\": {\n                \"CardAcquisitionReference\": {\n                    \"TransactionID\": \"{{poiTransactionId}}\",\n                    \"TimeStamp\": \"{{poiTimeStamp}}\"\n                }\n            }\n        }\n    }\n}",
							"options": {
								"raw": {
									"language": "json"
								}
							}
						},
						"url": {
							"raw": "{{baseUrl}}",
							"host": [
								"{{baseUrl}}"
							]
						}
					},
					"response": []
				},
				{
					"name": "Cancel card acquisition",
					"event": [
						{
							"listen": "test",
							"script": {
								"exec": [
									""
								],
								"type": "text/javascript"
							}
						}
					],
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Content-Type",
								"name": "Content-Type",
								"value": "application/json",
								"type": "text"
							}
						],
						"body": {
							"mode": "raw",
							"raw": "{\n    \"SaleToPOIRequest\": {\n        \"MessageHeader\": {\n            \"ProtocolVersion\": \"3.0\",\n            \"MessageClass\": \"Service\",\n            \"MessageCategory\": \"EnableService\",\n            \"MessageType\": \"Request\",\n            \"ServiceID\": \"{{serviceId}}\",\n            \"SaleID\": \"{{saleId}}\",\n            \"POIID\": \"{{poiId}}\"\n        },\n        \"EnableServiceRequest\": {\n            \"TransactionAction\": \"AbortTransaction\",\n            \"DisplayOutput\": {\n                \"Device\": \"CustomerDisplay\",\n                \"InfoQualify\": \"Display\",\n                \"OutputContent\": {\n                    \"PredefinedContent\": {\n                        \"ReferenceID\": \"DeclinedAnimated\"\n                    },\n                    \"OutputFormat\": \"Text\",\n                    \"OutputText\": [\n                        {\n                            \"Text\": \"Cancelled!\"\n                        },\n                        {\n                            \"Text\": \"The request was cancelled\"\n                        }\n                    ]\n                }\n            }\n        }\n    }\n}",
							"options": {
								"raw": {
									"language": "json"
								}
							}
						},
						"url": {
							"raw": "{{baseUrl}}",
							"host": [
								"{{baseUrl}}"
							]
						}
					},
					"response": []
				}
			]
		},
		{
			"name": "Barcode/QR code scanning",
			"item": [
				{
					"name": "Scan",
					"event": [
						{
							"listen": "prerequest",
							"script": {
								"exec": [
									"const id = \"Scan_\".concat(Math.floor(Math.random() * 10000));",
									"",
									"pm.globals.set(\"sessionId\", id);",
									"",
									"const si = {",
									"    \"Session\": {",
									"        \"Id\": id,",
									"        \"Type\": \"Once\"",
									"    },",
									"    \"Operation\": [",
									"        {",
									"            \"Type\": \"ScanBarcode\",",
									"            \"TimeoutMs\": 15000",
									"        }",
									"    ]",
									"};",
									"",
									"let siString = JSON.stringify(si);",
									"",
									"let serverIdentification = btoa(siString);",
									"",
									"pm.globals.set(\"serverIdentification\", serverIdentification);"
								],
								"type": "text/javascript"
							}
						},
						{
							"listen": "test",
							"script": {
								"exec": [
									"var responseJson = JSON.parse(responseBody);",
									"",
									"if (typeof responseJson.SaleToPOIRequest === 'undefined') {",
									"    let additionalResponseString = responseJson.SaleToPOIResponse.AdminResponse.Response.AdditionalResponse;",
									"    console.log(additionalResponseString);",
									"} else {",
									"    console.log(responseJson.SaleToPOIRequest.EventNotification.EventDetails);",
									"}"
								],
								"type": "text/javascript"
							}
						}
					],
					"request": {
						"method": "POST",
						"header": [],
						"body": {
							"mode": "raw",
							"raw": "{\n    \"SaleToPOIRequest\": {\n        \"MessageHeader\": {\n            \"ProtocolVersion\": \"3.0\",\n            \"MessageClass\": \"Service\",\n            \"MessageCategory\": \"Admin\",\n            \"MessageType\": \"Request\",\n            \"ServiceID\": \"{{serviceId}}\",\n            \"SaleID\": \"{{saleId}}\",\n            \"POIID\": \"{{poiId}}\"\n        },\n        \"AdminRequest\": {\n            \"ServiceIdentification\": \"{{serverIdentification}}\"\n        }\n    }\n}",
							"options": {
								"raw": {
									"language": "json"
								}
							}
						},
						"url": {
							"raw": "{{baseUrl}}",
							"host": [
								"{{baseUrl}}"
							]
						}
					},
					"response": []
				},
				{
					"name": "Cancel scanning",
					"event": [
						{
							"listen": "prerequest",
							"script": {
								"exec": [
									"const id = pm.globals.get(\"sessionId\");",
									"",
									"const si = {",
									"    \"Session\": {",
									"        \"Id\": id,",
									"        \"Type\": \"End\"",
									"    }",
									"};",
									"",
									"let siString = JSON.stringify(si);",
									"",
									"let serverIdentification = btoa(siString);",
									"",
									"pm.globals.set(\"serverIdentification\", serverIdentification);"
								],
								"type": "text/javascript"
							}
						},
						{
							"listen": "test",
							"script": {
								"exec": [
									"var responseJson = JSON.parse(responseBody);",
									"",
									"if (typeof responseJson.SaleToPOIRequest === 'undefined') {",
									"    let result = responseJson.SaleToPOIResponse.AdminResponse.Response.Result;",
									"",
									"    let additionalResponseString = responseJson.SaleToPOIResponse.AdminResponse.Response.AdditionalResponse;",
									"    console.log(additionalResponseString);",
									"",
									"} else {",
									"    console.log(responseJson.SaleToPOIRequest.EventNotification.EventDetails);",
									"}"
								],
								"type": "text/javascript"
							}
						}
					],
					"request": {
						"method": "POST",
						"header": [],
						"body": {
							"mode": "raw",
							"raw": "{\n    \"SaleToPOIRequest\": {\n        \"MessageHeader\": {\n            \"ProtocolVersion\": \"3.0\",\n            \"MessageClass\": \"Service\",\n            \"MessageCategory\": \"Admin\",\n            \"MessageType\": \"Request\",\n            \"ServiceID\": \"{{serviceId}}\",\n            \"SaleID\": \"{{saleId}}\",\n            \"POIID\": \"{{poiId}}\"\n        },\n        \"AdminRequest\": {\n            \"ServiceIdentification\": \"{{serverIdentification}}\"\n        }\n    }\n}",
							"options": {
								"raw": {
									"language": "json"
								}
							}
						},
						"url": {
							"raw": "{{baseUrl}}",
							"host": [
								"{{baseUrl}}"
							]
						}
					},
					"response": []
				}
			]
		},
		{
			"name": "Session",
			"item": [
				{
					"name": "Start session",
					"event": [
						{
							"listen": "prerequest",
							"script": {
								"exec": [
									"const id = \"Session_\".concat(Math.floor(Math.random() * 10000));",
									"",
									"pm.globals.set(\"sessionId\", id);",
									"",
									"const si = {",
									"    \"Session\": {",
									"        \"Id\": id,",
									"        \"Type\": \"Begin\"",
									"    },",
									"    \"Operation\": [",
									"        {",
									"            \"Type\": \"InputRequest\",",
									"            \"Variant\": \"WaitingScreen\",",
									"            \"UserInterfaceData\": {",
									"                \"WaitingScreenTimeoutMs\": 15000",
									"            }",
									"        },",
									"        {",
									"            \"Type\": \"DisplayRequest\",",
									"            \"Variant\": \"WaitingScreen\",",
									"            \"UserInterfaceData\": {",
									"                \"WaitingScreenTimeoutMs\": 10000",
									"            }",
									"        }",
									"    ]",
									"};",
									"",
									"let siString = JSON.stringify(si);",
									"",
									"let serverIdentification = btoa(siString);",
									"",
									"pm.globals.set(\"serverIdentification\", serverIdentification);"
								],
								"type": "text/javascript"
							}
						},
						{
							"listen": "test",
							"script": {
								"exec": [
									"var responseJson = JSON.parse(responseBody);",
									"",
									"if (typeof responseJson.SaleToPOIRequest === 'undefined') {",
									"",
									"} else {",
									"    console.log(responseJson.SaleToPOIRequest.EventNotification.EventDetails);",
									"}"
								],
								"type": "text/javascript"
							}
						}
					],
					"request": {
						"method": "POST",
						"header": [],
						"body": {
							"mode": "raw",
							"raw": "{\n    \"SaleToPOIRequest\": {\n        \"MessageHeader\": {\n            \"ProtocolVersion\": \"3.0\",\n            \"MessageClass\": \"Service\",\n            \"MessageCategory\": \"Admin\",\n            \"MessageType\": \"Request\",\n            \"ServiceID\": \"{{serviceId}}\",\n            \"SaleID\": \"{{saleId}}\",\n            \"POIID\": \"{{poiId}}\"\n        },\n        \"AdminRequest\": {\n            \"ServiceIdentification\": \"{{serverIdentification}}\"\n        }\n    }\n}",
							"options": {
								"raw": {
									"language": "json"
								}
							}
						},
						"url": {
							"raw": "{{baseUrl}}",
							"host": [
								"{{baseUrl}}"
							]
						}
					},
					"response": []
				},
				{
					"name": "End session",
					"event": [
						{
							"listen": "prerequest",
							"script": {
								"exec": [
									"const id = pm.globals.get(\"sessionId\");",
									"",
									"const si = {",
									"    \"Session\": {",
									"        \"Id\": id,",
									"        \"Type\": \"End\"",
									"    }",
									"};",
									"",
									"let siString = JSON.stringify(si);",
									"",
									"let serverIdentification = btoa(siString);",
									"",
									"pm.globals.set(\"serverIdentification\", serverIdentification);"
								],
								"type": "text/javascript"
							}
						}
					],
					"request": {
						"method": "POST",
						"header": [],
						"body": {
							"mode": "raw",
							"raw": "{\n    \"SaleToPOIRequest\": {\n        \"MessageHeader\": {\n            \"ProtocolVersion\": \"3.0\",\n            \"MessageClass\": \"Service\",\n            \"MessageCategory\": \"Admin\",\n            \"MessageType\": \"Request\",\n            \"ServiceID\": \"{{serviceId}}\",\n            \"SaleID\": \"{{saleId}}\",\n            \"POIID\": \"{{poiId}}\"\n        },\n        \"AdminRequest\": {\n            \"ServiceIdentification\": \"{{serverIdentification}}\"\n        }\n    }\n}",
							"options": {
								"raw": {
									"language": "json"
								}
							}
						},
						"url": {
							"raw": "{{baseUrl}}",
							"host": [
								"{{baseUrl}}"
							]
						}
					},
					"response": []
				}
			]
		},
		{
			"name": "Print",
			"item": [
				{
					"name": "Long ticket",
					"item": [
						{
							"name": "Logo",
							"event": [
								{
									"listen": "prerequest",
									"script": {
										"exec": [
											"const pngData = \"data:image/png;base64,[encoded data, 114460 characters]\";",
											"",
											"var xhtmlData = \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?> \\n<img src=\\\"\" + pngData + \"\\\"/>\";",
											"",
											"var xhtml = btoa(xhtmlData);",
											"",
											"pm.globals.set(\"xhtml\", xhtml);"
										],
										"type": "text/javascript"
									}
								},
								{
									"listen": "test",
									"script": {
										"exec": [
											"var responseJson = JSON.parse(responseBody);",
											"",
											"if (responseJson.SaleToPOIResponse.PrintResponse.Response.Result == \"Failure\") {",
											"    var additionalResponseString = responseJson.SaleToPOIResponse.PrintResponse.Response.AdditionalResponse;",
											"",
											"    console.log(additionalResponseString);",
											"}",
											"",
											"",
											""
										],
										"type": "text/javascript"
									}
								}
							],
							"request": {
								"method": "POST",
								"header": [
									{
										"key": "Content-Type",
										"name": "Content-Type",
										"type": "text",
										"value": "application/json"
									}
								],
								"body": {
									"mode": "raw",
									"raw": "{\n    \"SaleToPOIRequest\": {\n        \"MessageHeader\": {\n            \"ProtocolVersion\": \"3.0\",\n            \"MessageClass\": \"Device\",\n            \"MessageCategory\": \"Print\",\n            \"MessageType\": \"Request\",\n            \"ServiceID\": \"{{serviceId}}\",\n            \"SaleID\": \"{{saleId}}\",\n            \"POIID\": \"{{poiId}}\"\n        },\n        \"PrintRequest\": {\n            \"PrintOutput\": {\n                \"DocumentQualifier\": \"Document\",\n                \"ResponseMode\": \"PrintEnd\",\n                \"OutputContent\": {\n                    \"OutputFormat\": \"XHTML\",\n                    \"OutputXHTML\": \"{{xhtml}}\"\n                }\n            }\n        }\n    }\n}",
									"options": {
										"raw": {
											"language": "json"
										}
									}
								},
								"url": {
									"raw": "{{baseUrl}}",
									"host": [
										"{{baseUrl}}"
									]
								}
							},
							"response": []
						},
						{
							"name": "Content Castles",
							"event": [
								{
									"listen": "prerequest",
									"script": {
										"exec": [
											"// Date",
											"const d = new Date(Date.now());",
											"const date = d.toLocaleString();",
											"",
											"const weekday = [\"Sunday\",\"Monday\",\"Tuesday\",\"Wednesday\",\"Thursday\",\"Friday\",\"Saturday\"];",
											"let day = weekday[d.getDay()];",
											"",
											"pm.globals.set(\"date\", date);",
											"pm.globals.set(\"day\", day);",
											"",
											"",
											"//Items to print",
											"/*",
											"Tax group:",
											"1 = 0%",
											"2 = 5%",
											"3 = 10%",
											"4 = 21%",
											"",
											"*/",
											"",
											"// Purchased items",
											"const items = [",
											"    {",
											"        \"item\": \"Taco de pastor\",",
											"        \"count\": 14,",
											"        \"unitPrice\": 1.20,",
											"        \"taxGroup\": 3",
											"    },",
											"    {",
											"        \"item\": \"Taco de cohinita\",",
											"        \"count\": 6,",
											"        \"unitPrice\": 1.20,",
											"        \"taxGroup\": 3",
											"    },",
											"    {",
											"        \"item\": \"Taco de arrachera\",",
											"        \"count\": 5,",
											"        \"unitPrice\": 2.00,",
											"        \"taxGroup\": 3",
											"    },",
											"    {",
											"        \"item\": \"Quesadilla de champiñones\",",
											"        \"count\": 5,",
											"        \"unitPrice\": 2.50,",
											"        \"taxGroup\": 3",
											"    },",
											"    {",
											"        \"item\": \"Quesadilla de flor de calabaza\",",
											"        \"count\": 6,",
											"        \"unitPrice\": 3.00,",
											"        \"taxGroup\": 3",
											"    },",
											"    {",
											"        \"item\": \"Taco gobernador\",",
											"        \"count\": 5,",
											"        \"unitPrice\": 2.30,",
											"        \"taxGroup\": 3",
											"    },",
											"    {",
											"        \"item\": \"Taco de suadero\",",
											"        \"count\": 6,",
											"        \"unitPrice\": 1.00,",
											"        \"taxGroup\": 3",
											"    },",
											"    {",
											"        \"item\": \"Dark Side burrito\",",
											"        \"count\": 3,",
											"        \"unitPrice\": 12.00,",
											"        \"taxGroup\": 3",
											"    },",
											"    {",
											"        \"item\": \"Cerveza Indio\",",
											"        \"count\": 2,",
											"        \"unitPrice\": 3.00,",
											"        \"taxGroup\": 4",
											"    },",
											"    {",
											"        \"item\": \"Cerveza Bohemia\",",
											"        \"count\": 4,",
											"        \"unitPrice\": 4.00,",
											"        \"taxGroup\": 4",
											"    },",
											"    {",
											"        \"item\": \"Agua de jamaica\",",
											"        \"count\": 1,",
											"        \"unitPrice\": 2.00,",
											"        \"taxGroup\": 3",
											"    },",
											"    {",
											"        \"item\": \"Piña\",",
											"        \"count\": 1,",
											"        \"unitPrice\": 1.00,",
											"        \"taxGroup\": 2",
											"    }",
											"];",
											"",
											"// taxes",
											"var taxTable = [",
											"    {",
											"        \"tax\": 0.00,",
											"        \"taxes\": 0.00,",
											"        \"subtotal\": 0.00",
											"    },",
											"    {",
											"        \"tax\": 0.05,",
											"        \"taxes\": 0.00,",
											"        \"subtotal\": 0.00",
											"    },",
											"    {",
											"        \"tax\": 0.10,",
											"        \"taxes\": 0.00,",
											"        \"subtotal\": 0.00",
											"    },",
											"    {",
											"        \"tax\": 0.21,",
											"        \"taxes\": 0.00,",
											"        \"subtotal\": 0.00",
											"    }",
											"];",
											"",
											"",
											"var itemsTable = \"\";",
											"",
											"var sum = 0.00",
											"",
											"// build items table",
											"items.forEach(table);",
											"",
											"// save items table as  variable",
											"pm.globals.set(\"itemsTable\", itemsTable);",
											"",
											"// tax table",
											"",
											"var printTaxes = \"\";",
											"taxTable.forEach(taxes);",
											"",
											"// save taxes table as  variable",
											"pm.globals.set(\"taxesTable\", printTaxes);",
											"",
											"",
											"pm.globals.set(\"total\", sum.toFixed(2));",
											"",
											"",
											"// Build items table",
											"function table(item) {",
											"    // item total",
											"    let total = item.count * item.unitPrice;",
											"    let totalString = total.toFixed(2);",
											"",
											"    // add item total to purchase total",
											"    sum += total;",
											"",
											"    var firstSpace = \"\";",
											"",
											"    // if item is a 2-digit number, add one space to keep numbers aligned to the right",
											"    if (item.count < 10) {",
											"        firstSpace = \" \";",
											"    } else {",
											"        firstSpace = \"\";",
											"    };",
											"",
											"    // In the centre column will be the names of the items purchased",
											"    // If name is longer than 20 characters, name will be divided in different rows",
											"    let textLength = item.item.length;",
											"",
											"    // if 20 or less characters",
											"    if (textLength <= 20) {",
											"        let text = firstSpace + item.count + \" \" + item.item;",
											"",
											"        let product = {",
											"            \"CharacterStyle\": \"Normal\",",
											"            \"Alignment\": \"Left\",",
											"            \"EndOfLineFlag\": false,",
											"            \"Text\": text",
											"        };",
											"",
											"        let price = {",
											"            \"CharacterStyle\": \"Normal\",",
											"            \"Alignment\": \"Right\",",
											"            \"EndOfLineFlag\": true,",
											"            \"Text\": totalString + \" €\"",
											"        };",
											"",
											"        itemsTable = itemsTable + JSON.stringify(product) + \",\" + JSON.stringify(price) + \",\";",
											"",
											"    } else {",
											"        // if longer than 20 characters",
											"        var productText = item.item;",
											"",
											"        var textLines = [];",
											"        var textSection = \"\";",
											"",
											"        do {",
											"            textSection = productText.slice(0, 20);",
											"",
											"            // if there's a space in the name, we divide in the space before character 20th",
											"            if (textSection.lastIndexOf(\" \") >= 0) {",
											"                textLines.push(textSection.slice(0, textSection.lastIndexOf(\" \")));",
											"                productText = productText.slice(textSection.lastIndexOf(\" \") + 1);",
											"            } else {",
											"                // if there are no spaces before character 20, we split the word at character 20",
											"                textLines.push(textSection.slice(0, 19));",
											"                productText = productText.slice(19);",
											"                console.log(productText);",
											"            }",
											"",
											"        } while (productText.length > 20) // do it until last divison is less than 20 characters",
											"",
											"        // add the last division to the product array",
											"        if (productText.length != 0) {",
											"            textLines.push(productText);",
											"        }",
											"",
											"        // product first line with number of items and total amount for that item",
											"        let firstLine = firstSpace + item.count + \" \" + textLines[0];",
											"",
											"        var product = {",
											"            \"CharacterStyle\": \"Normal\",",
											"            \"Alignment\": \"Left\",",
											"            \"EndOfLineFlag\": false,",
											"            \"Text\": firstLine",
											"        };",
											"",
											"        var price = {",
											"            \"CharacterStyle\": \"Normal\",",
											"            \"Alignment\": \"Right\",",
											"            \"EndOfLineFlag\": true,",
											"            \"Text\": totalString + \" €\"",
											"        };",
											"",
											"        itemsTable = itemsTable + JSON.stringify(product) + \",\" + JSON.stringify(price) + \",\";",
											"",
											"        // for the rest of lines in the product array, we add them bellow",
											"        for (i = 1; i < textLines.length; i++) {",
											"            product = {",
											"                \"CharacterStyle\": \"Normal\",",
											"                \"Alignment\": \"Left\",",
											"                \"EndOfLineFlag\": false,",
											"                \"Text\": \"   \" + textLines[i]",
											"            };",
											"",
											"            itemsTable = itemsTable + JSON.stringify(product) + \",\";",
											"        }",
											"    }",
											"",
											"    //taxes",
											"    let taxIndex = item.taxGroup - 1;",
											"",
											"    let subtotal = total / (taxTable[taxIndex].tax + 1);",
											"    let taxes = subtotal * taxTable[taxIndex].tax;",
											"",
											"    taxTable[taxIndex].taxes += taxes;",
											"    taxTable[taxIndex].subtotal += subtotal; ",
											"}",
											"",
											"function taxes(t) {",
											"",
											"    if (t.subtotal != 0) {",
											"        let s = \"\";",
											"        if (t.tax == 0.00 || t.tax == 0.05) {",
											"            s = \" \";",
											"        }",
											"",
											"        let s2 = \"\";",
											"        for (var i = 14 - t.subtotal.toFixed(2).length; i > 0; i--) {",
											"            s2 = s2 + \" \";",
											"        }",
											"",
											"        let taxBase = {",
											"                \"CharacterStyle\": \"Normal\",",
											"                \"Alignment\": \"Left\",",
											"                \"EndOfLineFlag\": false,",
											"                \"Text\": s + (t.tax * 100).toFixed(2) + \"%\" + s2 + t.subtotal.toFixed(2)",
											"            };",
											"",
											"        let taxAmount = {",
											"            \"CharacterStyle\": \"Normal\",",
											"            \"Alignment\": \"Right\",",
											"            \"EndOfLineFlag\": true,",
											"            \"Text\": t.taxes.toFixed(2)",
											"        };",
											"",
											"        printTaxes = printTaxes  + JSON.stringify(taxBase) + \",\" + JSON.stringify(taxAmount) + \",\";",
											"    }",
											"}",
											""
										],
										"type": "text/javascript"
									}
								},
								{
									"listen": "test",
									"script": {
										"exec": [
											"var responseJson = JSON.parse(responseBody);",
											"",
											"//Check if transaction was processed",
											"if (typeof responseJson.SaleToPOIRequest === 'undefined') {",
											"",
											"} else {",
											"    console.log(atob(responseJson.SaleToPOIRequest.EventNotification.RejectedMessage))",
											"}"
										],
										"type": "text/javascript"
									}
								}
							],
							"request": {
								"method": "POST",
								"header": [],
								"body": {
									"mode": "raw",
									"raw": "{\n    \"SaleToPOIRequest\": {\n        \"MessageHeader\": {\n            \"ProtocolVersion\": \"3.0\",\n            \"MessageClass\": \"Device\",\n            \"MessageCategory\": \"Print\",\n            \"MessageType\": \"Request\",\n            \"ServiceID\": \"{{serviceId}}\",\n            \"SaleID\": \"{{saleId}}\",\n            \"POIID\": \"{{poiId}}\"\n        },\n        \"PrintRequest\": {\n            \"PrintOutput\": {\n                \"DocumentQualifier\": \"Document\",\n                \"ResponseMode\": \"PrintEnd\",\n                \"OutputContent\": {\n                    \"OutputFormat\": \"Text\",\n                    \"OutputText\": [\n                        {\n                            \"CharacterStyle\": \"Bold\",\n                            \"Alignment\": \"Centred\",\n                            \"EndOfLineFlag\": true,\n                            \"Text\": \"BIG TACOS\"\n                        },\n                        {\n                            \"CharacterStyle\": \"Normal\",\n                            \"Alignment\": \"Centred\",\n                            \"EndOfLineFlag\": true,\n                            \"Text\": \"Calle Serrano 37\"\n                        },\n                        {\n                            \"CharacterStyle\": \"Normal\",\n                            \"Alignment\": \"Centred\",\n                            \"EndOfLineFlag\": true,\n                            \"Text\": \"5ta planta\"\n                        },\n                        {\n                            \"CharacterStyle\": \"Normal\",\n                            \"Alignment\": \"Centred\",\n                            \"EndOfLineFlag\": true,\n                            \"Text\": \"Madrid, 28001, Madrid\"\n                        },\n                        {\n                            \"Alignment\": \"Centred\",\n                            \"EndOfLineFlag\": true,\n                            \"Text\": \"\"\n                        },\n                        {\n                            \"CharacterStyle\": \"Normal\",\n                            \"Alignment\": \"Centred\",\n                            \"EndOfLineFlag\": true,\n                            \"Text\": \"================================\"\n                        },\n                        {\n                            \"CharacterStyle\": \"Normal\",\n                            \"Alignment\": \"Centred\",\n                            \"EndOfLineFlag\": true,\n                            \"Text\": \"RECEIPT\"\n                        },\n                        {\n                            \"CharacterStyle\": \"Normal\",\n                            \"Alignment\": \"Centred\",\n                            \"EndOfLineFlag\": true,\n                            \"Text\": \"--------------------------------\"\n                        },\n                        {\n                            \"CharacterStyle\": \"Bold\",\n                            \"Alignment\": \"Centred\",\n                            \"EndOfLineFlag\": true,\n                            \"Text\": \"Order: 66\"\n                        },\n                        {\n                            \"CharacterStyle\": \"Normal\",\n                            \"Alignment\": \"Centred\",\n                            \"EndOfLineFlag\": true,\n                            \"Text\": \"--------------------------------\"\n                        },\n                        {\n                            \"CharacterStyle\": \"Normal\",\n                            \"Alignment\": \"Left\",\n                            \"EndOfLineFlag\": false,\n                            \"Text\": \"{{date}}\"\n                        },\n                        {\n                            \"CharacterStyle\": \"Normal\",\n                            \"Alignment\": \"Right\",\n                            \"EndOfLineFlag\": true,\n                            \"Text\": \"{{day}}\"\n                        },\n                        {\n                            \"CharacterStyle\": \"Normal\",\n                            \"Alignment\": \"Centred\",\n                            \"EndOfLineFlag\": true,\n                            \"Text\": \"================================\"\n                        },\n                        {\n                            \"CharacterStyle\": \"Normal\",\n                            \"Alignment\": \"Left\",\n                            \"EndOfLineFlag\": false,\n                            \"Text\": \" #  Product\"\n                        },\n                        {\n                            \"CharacterStyle\": \"Normal\",\n                            \"Alignment\": \"Right\",\n                            \"EndOfLineFlag\": true,\n                            \"Text\": \"Amount\"\n                        },\n                        {\n                            \"CharacterStyle\": \"Normal\",\n                            \"Alignment\": \"Centred\",\n                            \"EndOfLineFlag\": true,\n                            \"Text\": \"--------------------------------\"\n                        },\n                        {{itemsTable}}\n                        {\n                            \"CharacterStyle\": \"Normal\",\n                            \"Alignment\": \"Centred\",\n                            \"EndOfLineFlag\": true,\n                            \"Text\": \"--------------------------------\"\n                        },\n                        {\n                            \"CharacterStyle\": \"Normal\",\n                            \"Alignment\": \"Left\",\n                            \"EndOfLineFlag\": false,\n                            \"Text\": \"Tax%       Base\"\n                        },\n                        {\n                            \"CharacterStyle\": \"Normal\",\n                            \"Alignment\": \"Right\",\n                            \"EndOfLineFlag\": true,\n                            \"Text\": \"Tax\"\n                        },\n                        {{taxesTable}}\n                        {\n                            \"CharacterStyle\": \"Normal\",\n                            \"Alignment\": \"Centred\",\n                            \"EndOfLineFlag\": true,\n                            \"Text\": \"--------------------------------\"\n                        },\n                        {\n                            \"CharacterStyle\": \"Bold\",\n                            \"Alignment\": \"Left\",\n                            \"EndOfLineFlag\": false,\n                            \"Text\": \"Total (including tax):\"\n                        },\n                        {\n                            \"CharacterStyle\": \"Bold\",\n                            \"Alignment\": \"Right\",\n                            \"EndOfLineFlag\": true,\n                            \"Text\": \"{{total}} €\"\n                        },\n                        {\n                            \"CharacterStyle\": \"Normal\",\n                            \"Alignment\": \"Centred\",\n                            \"EndOfLineFlag\": true,\n                            \"Text\": \"================================\"\n                        }\n                    ]\n                }\n            }\n        }\n    }\n}",
									"options": {
										"raw": {
											"language": "json"
										}
									}
								},
								"url": {
									"raw": "{{baseUrl}}",
									"host": [
										"{{baseUrl}}"
									]
								}
							},
							"response": []
						},
						{
							"name": "Content Verifone",
							"event": [
								{
									"listen": "prerequest",
									"script": {
										"exec": [
											"// Date",
											"const d = new Date(Date.now());",
											"const date = d.toLocaleString();",
											"",
											"const weekday = [\"Sunday\",\"Monday\",\"Tuesday\",\"Wednesday\",\"Thursday\",\"Friday\",\"Saturday\"];",
											"let day = weekday[d.getDay()];",
											"",
											"pm.globals.set(\"date\", date);",
											"pm.globals.set(\"day\", day);",
											"",
											"",
											"//Items to print",
											"/*",
											"Tax group:",
											"1 = 0%",
											"2 = 5%",
											"3 = 10%",
											"4 = 21%",
											"",
											"*/",
											"",
											"// Purchased items",
											"const items = [",
											"    {",
											"        \"item\": \"Taco de pastor\",",
											"        \"count\": 14,",
											"        \"unitPrice\": 1.20,",
											"        \"taxGroup\": 3",
											"    },",
											"    {",
											"        \"item\": \"Taco de cochinita\",",
											"        \"count\": 6,",
											"        \"unitPrice\": 1.20,",
											"        \"taxGroup\": 3",
											"    },",
											"    {",
											"        \"item\": \"Taco de arrachera\",",
											"        \"count\": 5,",
											"        \"unitPrice\": 2.00,",
											"        \"taxGroup\": 3",
											"    },",
											"    {",
											"        \"item\": \"Quesadilla de champiñones\",",
											"        \"count\": 5,",
											"        \"unitPrice\": 2.50,",
											"        \"taxGroup\": 3",
											"    },",
											"    {",
											"        \"item\": \"Quesadilla de flor de calabaza\",",
											"        \"count\": 6,",
											"        \"unitPrice\": 3.00,",
											"        \"taxGroup\": 3",
											"    },",
											"    {",
											"        \"item\": \"Taco gobernador\",",
											"        \"count\": 5,",
											"        \"unitPrice\": 2.30,",
											"        \"taxGroup\": 3",
											"    },",
											"    {",
											"        \"item\": \"Taco de suadero\",",
											"        \"count\": 6,",
											"        \"unitPrice\": 1.00,",
											"        \"taxGroup\": 3",
											"    },",
											"    {",
											"        \"item\": \"Dark Side burrito\",",
											"        \"count\": 3,",
											"        \"unitPrice\": 12.00,",
											"        \"taxGroup\": 3",
											"    },",
											"    {",
											"        \"item\": \"Cerveza Indio\",",
											"        \"count\": 2,",
											"        \"unitPrice\": 3.00,",
											"        \"taxGroup\": 4",
											"    },",
											"    {",
											"        \"item\": \"Cerveza Bohemia\",",
											"        \"count\": 4,",
											"        \"unitPrice\": 4.00,",
											"        \"taxGroup\": 4",
											"    },",
											"    {",
											"        \"item\": \"Agua de jamaica\",",
											"        \"count\": 1,",
											"        \"unitPrice\": 2.00,",
											"        \"taxGroup\": 3",
											"    },",
											"    {",
											"        \"item\": \"Piña\",",
											"        \"count\": 1,",
											"        \"unitPrice\": 1.00,",
											"        \"taxGroup\": 2",
											"    }",
											"];",
											"",
											"// taxes",
											"var taxTable = [",
											"    {",
											"        \"tax\": 0.00,",
											"        \"taxes\": 0.00,",
											"        \"subtotal\": 0.00",
											"    },",
											"    {",
											"        \"tax\": 0.05,",
											"        \"taxes\": 0.00,",
											"        \"subtotal\": 0.00",
											"    },",
											"    {",
											"        \"tax\": 0.10,",
											"        \"taxes\": 0.00,",
											"        \"subtotal\": 0.00",
											"    },",
											"    {",
											"        \"tax\": 0.21,",
											"        \"taxes\": 0.00,",
											"        \"subtotal\": 0.00",
											"    }",
											"];",
											"",
											"",
											"var itemsTable = \"\";",
											"",
											"var sum = 0.00",
											"",
											"// build items table",
											"items.forEach(table);",
											"",
											"// save items table as collection variable",
											"pm.globals.set(\"itemsTable\", itemsTable);",
											"",
											"// tax table",
											"",
											"var printTaxes = \"\";",
											"taxTable.forEach(taxes);",
											"",
											"// save taxes table as collection variable",
											"pm.globals.set(\"taxesTable\", printTaxes);",
											"",
											"",
											"pm.globals.set(\"total\", sum.toFixed(2));",
											"",
											"",
											"// Build items table",
											"function table(item) {",
											"    // item total",
											"    let total = item.count * item.unitPrice;",
											"    let totalString = total.toFixed(2);",
											"",
											"    // add item total to purchase total",
											"    sum += total;",
											"",
											"    var firstSpace = \"\";",
											"",
											"    // if item is a 2-digit number, add one space to keep numbers aligned to the right",
											"    if (item.count < 10) {",
											"        firstSpace = \"&nbsp;&nbsp;\";",
											"    } else {",
											"        firstSpace = \"\";",
											"    }",
											"",
											"    // In the centre column will be the names of the items purchased",
											"    // If name is longer than 20 characters, name will be divided in different rows",
											"    let textLength = item.item.length;",
											"",
											"    // if 20 or less characters",
											"    if (textLength <= 20) {",
											"        let text = firstSpace + item.count + \"&nbsp;&nbsp;&nbsp;&nbsp;\" + item.item;",
											"",
											"        let product = {",
											"            \"CharacterStyle\": \"Normal\",",
											"            \"Alignment\": \"Left\",",
											"            \"EndOfLineFlag\": false,",
											"            \"Text\": text",
											"        };",
											"",
											"        let price = {",
											"            \"CharacterStyle\": \"Normal\",",
											"            \"Alignment\": \"Right\",",
											"            \"EndOfLineFlag\": true,",
											"            \"Text\": totalString + \" €\"",
											"        };",
											"",
											"        itemsTable = itemsTable + JSON.stringify(product) + \",\" + JSON.stringify(price) + \",\";",
											"",
											"    } else {",
											"        // if longer than 20 characters",
											"        var productText = item.item;",
											"",
											"        var textLines = [];",
											"        var textSection = \"\";",
											"",
											"        do {",
											"            textSection = productText.slice(0, 20);",
											"",
											"            // if there's a space in the name, we divide in the space before character 20th",
											"            if (textSection.lastIndexOf(\" \") >= 0) {",
											"                textLines.push(textSection.slice(0, textSection.lastIndexOf(\" \")));",
											"                productText = productText.slice(textSection.lastIndexOf(\" \") + 1);",
											"            } else {",
											"                // if there are no spaces before character 20, we split the word at character 20",
											"                textLines.push(textSection.slice(0, 19));",
											"                productText = productText.slice(19);",
											"                console.log(productText);",
											"            }",
											"",
											"        } while (productText.length > 20) // do it until last divison is less than 20 characters",
											"",
											"        // add the last division to the product array",
											"        if (productText.length != 0) {",
											"            textLines.push(productText);",
											"        }",
											"",
											"        // product first line with number of items and total amount for that item",
											"        let firstLine = firstSpace + item.count + \"&nbsp;&nbsp;&nbsp;&nbsp;\" + textLines[0];",
											"",
											"        var product = {",
											"            \"CharacterStyle\": \"Normal\",",
											"            \"Alignment\": \"Left\",",
											"            \"EndOfLineFlag\": false,",
											"            \"Text\": firstLine",
											"        };",
											"",
											"        var price = {",
											"            \"CharacterStyle\": \"Normal\",",
											"            \"Alignment\": \"Right\",",
											"            \"EndOfLineFlag\": true,",
											"            \"Text\": totalString + \" €\"",
											"        };",
											"",
											"        itemsTable = itemsTable + JSON.stringify(product) + \",\" + JSON.stringify(price) + \",\";",
											"",
											"        // for the rest of lines in the product array, we add them bellow",
											"        for (i = 1; i < textLines.length; i++) {",
											"            product = {",
											"                \"CharacterStyle\": \"Normal\",",
											"                \"Alignment\": \"Left\",",
											"                \"EndOfLineFlag\": false,",
											"                \"Text\": \"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\" + textLines[i]",
											"            };",
											"",
											"            itemsTable = itemsTable + JSON.stringify(product) + \",\";",
											"        }",
											"    }",
											"",
											"    //taxes",
											"    let taxIndex = item.taxGroup - 1;",
											"",
											"    let subtotal = total / (taxTable[taxIndex].tax + 1);",
											"    let taxes = subtotal * taxTable[taxIndex].tax;",
											"",
											"    taxTable[taxIndex].taxes += taxes;",
											"    taxTable[taxIndex].subtotal += subtotal; ",
											"}",
											"",
											"function taxes(t) {",
											"",
											"    if (t.subtotal != 0) {",
											"        let s = \"\";",
											"        if (t.tax == 0.00 || t.tax == 0.05) {",
											"            s = \"&nbsp;&nbsp;\";",
											"        }",
											"",
											"        let s2 = \"\";",
											"        for (var i = 14 - t.subtotal.toFixed(2).length; i > 0; i--) {",
											"            s2 = s2 + \"&nbsp;&nbsp;\";",
											"        }",
											"",
											"        let taxBase = {",
											"                \"CharacterStyle\": \"Normal\",",
											"                \"Alignment\": \"Left\",",
											"                \"EndOfLineFlag\": false,",
											"                \"Text\": s + (t.tax * 100).toFixed(2) + \"%\" + s2 + t.subtotal.toFixed(2)",
											"            };",
											"",
											"        let taxAmount = {",
											"            \"CharacterStyle\": \"Normal\",",
											"            \"Alignment\": \"Right\",",
											"            \"EndOfLineFlag\": true,",
											"            \"Text\": t.taxes.toFixed(2)",
											"        };",
											"",
											"        printTaxes = printTaxes  + JSON.stringify(taxBase) + \",\" + JSON.stringify(taxAmount) + \",\";",
											"    }",
											"}",
											""
										],
										"type": "text/javascript"
									}
								},
								{
									"listen": "test",
									"script": {
										"exec": [
											"var responseJson = JSON.parse(responseBody);",
											"",
											"//Check if transaction was processed",
											"if (typeof responseJson.SaleToPOIRequest === 'undefined') {",
											"",
											"} else {",
											"    console.log(atob(responseJson.SaleToPOIRequest.EventNotification.RejectedMessage))",
											"}"
										],
										"type": "text/javascript"
									}
								}
							],
							"request": {
								"method": "POST",
								"header": [],
								"body": {
									"mode": "raw",
									"raw": "{\n    \"SaleToPOIRequest\": {\n        \"MessageHeader\": {\n            \"ProtocolVersion\": \"3.0\",\n            \"MessageClass\": \"Device\",\n            \"MessageCategory\": \"Print\",\n            \"MessageType\": \"Request\",\n            \"ServiceID\": \"{{serviceID}}\",\n            \"SaleID\": \"{{saleId}}\",\n            \"POIID\": \"{{poiId}}\"\n        },\n        \"PrintRequest\": {\n            \"PrintOutput\": {\n                \"DocumentQualifier\": \"Document\",\n                \"ResponseMode\": \"PrintEnd\",\n                \"OutputContent\": {\n                    \"OutputFormat\": \"Text\",\n                    \"OutputText\": [\n                        {\n                            \"CharacterStyle\": \"Bold\",\n                            \"Alignment\": \"Centred\",\n                            \"EndOfLineFlag\": true,\n                            \"Text\": \"BIG TACOS\"\n                        },\n                        {\n                            \"CharacterStyle\": \"Normal\",\n                            \"Alignment\": \"Centred\",\n                            \"EndOfLineFlag\": true,\n                            \"Text\": \"Calle Serrano 37\"\n                        },\n                        {\n                            \"CharacterStyle\": \"Normal\",\n                            \"Alignment\": \"Centred\",\n                            \"EndOfLineFlag\": true,\n                            \"Text\": \"5ta planta\"\n                        },\n                        {\n                            \"CharacterStyle\": \"Normal\",\n                            \"Alignment\": \"Centred\",\n                            \"EndOfLineFlag\": true,\n                            \"Text\": \"Madrid, 28001, Madrid\"\n                        },\n                        {\n                            \"Alignment\": \"Centred\",\n                            \"EndOfLineFlag\": true,\n                            \"Text\": \"\"\n                        },\n                        {\n                            \"CharacterStyle\": \"Normal\",\n                            \"Alignment\": \"Centred\",\n                            \"EndOfLineFlag\": true,\n                            \"Text\": \"==================================\"\n                        },\n                        {\n                            \"CharacterStyle\": \"Normal\",\n                            \"Alignment\": \"Centred\",\n                            \"EndOfLineFlag\": true,\n                            \"Text\": \"RECEIPT\"\n                        },\n                        {\n                            \"CharacterStyle\": \"Normal\",\n                            \"Alignment\": \"Centred\",\n                            \"EndOfLineFlag\": true,\n                            \"Text\": \"-----------------------------------------------------\"\n                        },\n                        {\n                            \"CharacterStyle\": \"Bold\",\n                            \"Alignment\": \"Centred\",\n                            \"EndOfLineFlag\": true,\n                            \"Text\": \"Order: 66\"\n                        },\n                        {\n                            \"CharacterStyle\": \"Normal\",\n                            \"Alignment\": \"Centred\",\n                            \"EndOfLineFlag\": true,\n                            \"Text\": \"-----------------------------------------------------\"\n                        },\n                        {\n                            \"CharacterStyle\": \"Normal\",\n                            \"Alignment\": \"Left\",\n                            \"EndOfLineFlag\": false,\n                            \"Text\": \"{{date}}\"\n                        },\n                        {\n                            \"CharacterStyle\": \"Normal\",\n                            \"Alignment\": \"Right\",\n                            \"EndOfLineFlag\": true,\n                            \"Text\": \"{{day}}\"\n                        },\n                        {\n                            \"CharacterStyle\": \"Normal\",\n                            \"Alignment\": \"Centred\",\n                            \"EndOfLineFlag\": true,\n                            \"Text\": \"==================================\"\n                        },\n                        {\n                            \"CharacterStyle\": \"Normal\",\n                            \"Alignment\": \"Left\",\n                            \"EndOfLineFlag\": false,\n                            \"Text\": \"&nbsp;&nbsp;#&nbsp;&nbsp;&nbsp;&nbsp;Product\"\n                        },\n                        {\n                            \"CharacterStyle\": \"Normal\",\n                            \"Alignment\": \"Right\",\n                            \"EndOfLineFlag\": true,\n                            \"Text\": \"Amount\"\n                        },\n                        {\n                            \"CharacterStyle\": \"Normal\",\n                            \"Alignment\": \"Centred\",\n                            \"EndOfLineFlag\": true,\n                            \"Text\": \"-----------------------------------------------------\"\n                        },\n                        {{itemsTable}}\n                        {\n                            \"CharacterStyle\": \"Normal\",\n                            \"Alignment\": \"Centred\",\n                            \"EndOfLineFlag\": true,\n                            \"Text\": \"-----------------------------------------------------\"\n                        },\n                        {\n                            \"CharacterStyle\": \"Normal\",\n                            \"Alignment\": \"Left\",\n                            \"EndOfLineFlag\": false,\n                            \"Text\": \"Tax%&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Base:\"\n                        },\n                        {\n                            \"CharacterStyle\": \"Normal\",\n                            \"Alignment\": \"Right\",\n                            \"EndOfLineFlag\": true,\n                            \"Text\": \"Tax\"\n                        },\n                        {{taxesTable}}\n                        {\n                            \"CharacterStyle\": \"Normal\",\n                            \"Alignment\": \"Centred\",\n                            \"EndOfLineFlag\": true,\n                            \"Text\": \"-----------------------------------------------------\"\n                        },\n                        {\n                            \"CharacterStyle\": \"Bold\",\n                            \"Alignment\": \"Left\",\n                            \"EndOfLineFlag\": false,\n                            \"Text\": \"Total (including tax):\"\n                        },\n                        {\n                            \"CharacterStyle\": \"Bold\",\n                            \"Alignment\": \"Right\",\n                            \"EndOfLineFlag\": true,\n                            \"Text\": \"{{total}} €\"\n                        },\n                        {\n                            \"CharacterStyle\": \"Normal\",\n                            \"Alignment\": \"Centred\",\n                            \"EndOfLineFlag\": true,\n                            \"Text\": \"==================================\"\n                        }\n                    ]\n                }\n            }\n        }\n    }\n}",
									"options": {
										"raw": {
											"language": "json"
										}
									}
								},
								"url": {
									"raw": "{{baseUrl}}",
									"host": [
										"{{baseUrl}}"
									]
								}
							},
							"response": []
						},
						{
							"name": "QR code",
							"request": {
								"method": "POST",
								"header": [],
								"body": {
									"mode": "raw",
									"raw": "{\n    \"SaleToPOIRequest\": {\n        \"MessageHeader\": {\n            \"ProtocolVersion\": \"3.0\",\n            \"MessageClass\": \"Device\",\n            \"MessageCategory\": \"Print\",\n            \"MessageType\": \"Request\",\n            \"ServiceID\": \"{{serviceId}}\",\n            \"SaleID\": \"{{saleId}}\",\n            \"POIID\": \"{{poiId}}\"\n        },\n        \"PrintRequest\": {\n            \"PrintOutput\": {\n                \"DocumentQualifier\": \"CustomerReceipt\",\n                \"ResponseMode\": \"PrintEnd\",\n                \"OutputContent\": {\n                    \"OutputFormat\": \"BarCode\",\n                    \"OutputBarcode\": {\n                        \"BarcodeType\": \"QRCode\",\n                        \"BarcodeValue\": \"https://docs.adyen.com/point-of-sale\"\n                    }\n                }\n            }\n        }\n    }\n}",
									"options": {
										"raw": {
											"language": "json"
										}
									}
								},
								"url": {
									"raw": "{{baseUrl}}",
									"host": [
										"{{baseUrl}}"
									]
								}
							},
							"response": []
						},
						{
							"name": "Footer Castles",
							"event": [
								{
									"listen": "prerequest",
									"script": {
										"exec": [
											""
										],
										"type": "text/javascript"
									}
								},
								{
									"listen": "test",
									"script": {
										"exec": [
											"var responseJson = JSON.parse(responseBody);",
											"",
											"//Check if transaction was processed",
											"if (typeof responseJson.SaleToPOIRequest === 'undefined') {",
											"",
											"} else {",
											"    console.log(atob(responseJson.SaleToPOIRequest.EventNotification.RejectedMessage))",
											"}"
										],
										"type": "text/javascript"
									}
								}
							],
							"request": {
								"method": "POST",
								"header": [],
								"body": {
									"mode": "raw",
									"raw": "{\n    \"SaleToPOIRequest\": {\n        \"MessageHeader\": {\n            \"ProtocolVersion\": \"3.0\",\n            \"MessageClass\": \"Device\",\n            \"MessageCategory\": \"Print\",\n            \"MessageType\": \"Request\",\n            \"ServiceID\": \"{{serviceId}}\",\n            \"SaleID\": \"{{saleId}}\",\n            \"POIID\": \"{{poiId}}\"\n        },\n        \"PrintRequest\": {\n            \"PrintOutput\": {\n                \"DocumentQualifier\": \"Document\",\n                \"ResponseMode\": \"PrintEnd\",\n                \"OutputContent\": {\n                    \"OutputFormat\": \"Text\",\n                    \"OutputText\": [\n                        {\n                            \"CharacterStyle\": \"Normal\",\n                            \"Alignment\": \"Centred\",\n                            \"EndOfLineFlag\": true,\n                            \"Text\": \"+34 664 123 456\"\n                        },\n                        {\n                            \"CharacterStyle\": \"Normal\",\n                            \"Alignment\": \"Centred\",\n                            \"EndOfLineFlag\": true,\n                            \"Text\": \"support@adyen.com\"\n                        },\n                        {\n                            \"CharacterStyle\": \"Normal\",\n                            \"Alignment\": \"Centred\",\n                            \"EndOfLineFlag\": true,\n                            \"Text\": \"================================\"\n                        },\n                        {\n                            \"CharacterStyle\": \"Normal\",\n                            \"Alignment\": \"Centred\",\n                            \"EndOfLineFlag\": true,\n                            \"Text\": \"\"\n                        },\n                        {\n                            \"CharacterStyle\": \"Bold\",\n                            \"Alignment\": \"Centred\",\n                            \"EndOfLineFlag\": true,\n                            \"Text\": \"THANK YOU!\"\n                        },\n                        {\n                            \"CharacterStyle\": \"Normal\",\n                            \"Alignment\": \"Centred\",\n                            \"EndOfLineFlag\": true,\n                            \"Text\": \"\"\n                        },\n                        {\n                            \"CharacterStyle\": \"Normal\",\n                            \"Alignment\": \"Centred\",\n                            \"EndOfLineFlag\": true,\n                            \"Text\": \"================================\"\n                        }\n                    ]\n                }\n            }\n        }\n    }\n}",
									"options": {
										"raw": {
											"language": "json"
										}
									}
								},
								"url": {
									"raw": "{{baseUrl}}",
									"host": [
										"{{baseUrl}}"
									]
								}
							},
							"response": []
						},
						{
							"name": "Footer Verifone",
							"event": [
								{
									"listen": "prerequest",
									"script": {
										"exec": [
											""
										],
										"type": "text/javascript"
									}
								},
								{
									"listen": "test",
									"script": {
										"exec": [
											"var responseJson = JSON.parse(responseBody);",
											"",
											"//Check if transaction was processed",
											"if (typeof responseJson.SaleToPOIRequest === 'undefined') {",
											"",
											"} else {",
											"    console.log(atob(responseJson.SaleToPOIRequest.EventNotification.RejectedMessage))",
											"}"
										],
										"type": "text/javascript"
									}
								}
							],
							"request": {
								"method": "POST",
								"header": [],
								"body": {
									"mode": "raw",
									"raw": "{\n    \"SaleToPOIRequest\": {\n        \"MessageHeader\": {\n            \"ProtocolVersion\": \"3.0\",\n            \"MessageClass\": \"Device\",\n            \"MessageCategory\": \"Print\",\n            \"MessageType\": \"Request\",\n            \"ServiceID\": \"{{serviceID}}\",\n            \"SaleID\": \"{{saleId}}\",\n            \"POIID\": \"{{poiId}}\"\n        },\n        \"PrintRequest\": {\n            \"PrintOutput\": {\n                \"DocumentQualifier\": \"Document\",\n                \"ResponseMode\": \"PrintEnd\",\n                \"OutputContent\": {\n                    \"OutputFormat\": \"Text\",\n                    \"OutputText\": [\n                        {\n                            \"CharacterStyle\": \"Normal\",\n                            \"Alignment\": \"Centred\",\n                            \"EndOfLineFlag\": true,\n                            \"Text\": \"+34 664 123 456\"\n                        },\n                        {\n                            \"CharacterStyle\": \"Normal\",\n                            \"Alignment\": \"Centred\",\n                            \"EndOfLineFlag\": true,\n                            \"Text\": \"support@adyen.com\"\n                        },\n                        {\n                            \"CharacterStyle\": \"Normal\",\n                            \"Alignment\": \"Centred\",\n                            \"EndOfLineFlag\": true,\n                            \"Text\": \"==================================\"\n                        },\n                        {\n                            \"CharacterStyle\": \"Normal\",\n                            \"Alignment\": \"Centred\",\n                            \"EndOfLineFlag\": true,\n                            \"Text\": \"\"\n                        },\n                        {\n                            \"CharacterStyle\": \"Bold\",\n                            \"Alignment\": \"Centred\",\n                            \"EndOfLineFlag\": true,\n                            \"Text\": \"THANK YOU!\"\n                        },\n                        {\n                            \"CharacterStyle\": \"Normal\",\n                            \"Alignment\": \"Centred\",\n                            \"EndOfLineFlag\": true,\n                            \"Text\": \"\"\n                        },\n                        {\n                            \"CharacterStyle\": \"Normal\",\n                            \"Alignment\": \"Centred\",\n                            \"EndOfLineFlag\": true,\n                            \"Text\": \"==================================\"\n                        }\n                    ]\n                }\n            }\n        }\n    }\n}",
									"options": {
										"raw": {
											"language": "json"
										}
									}
								},
								"url": {
									"raw": "{{baseUrl}}",
									"host": [
										"{{baseUrl}}"
									]
								}
							},
							"response": []
						}
					],
					"description": "You can run the requests so the receipt can be printed."
				},
				{
					"name": "Print Document",
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Content-Type",
								"name": "Content-Type",
								"value": "application/json",
								"type": "text"
							}
						],
						"body": {
							"mode": "raw",
							"raw": "{\n    \"SaleToPOIRequest\": {\n        \"MessageHeader\": {\n            \"ProtocolVersion\": \"3.0\",\n            \"MessageClass\": \"Device\",\n            \"MessageCategory\": \"Print\",\n            \"MessageType\": \"Request\",\n            \"SaleID\": \"{{saleId}}\",\n            \"ServiceID\": \"{{serviceID}}\",\n            \"POIID\": \"{{poiId}}\"\n        },\n        \"PrintRequest\": {\n            \"PrintOutput\": {\n                \"DocumentQualifier\": \"Document\",\n                \"ResponseMode\": \"PrintEnd\",\n                \"OutputContent\": {\n                    \"OutputFormat\": \"Text\",\n                    \"OutputText\": [\n                        {\n                            \"CharacterStyle\": \"Bold\",\n                            \"Alignment\": \"Centred\",\n                            \"EndOfLineFlag\": true,\n                            \"Text\": \"Merchant\"\n                        },\n                        {\n                            \"CharacterStyle\": \"Normal\",\n                            \"Alignment\": \"Centred\",\n                            \"EndOfLineFlag\": true,\n                            \"Text\": \"Términos y condiciones\"\n                        },\n                        {\n                            \"Alignment\": \"Centred\",\n                            \"EndOfLineFlag\": true,\n                            \"Text\": \"\"\n                        },\n                        {\n                            \"Alignment\": \"Left\",\n                            \"EndOfLineFlag\": true,\n                            \"Text\": \"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec ornare arcu enim, at congue leo efficitur id. Vivamus nibh lorem, luctus sed aliquet vitae, dictum ac libero. Fusce sit amet magna augue. Curabitur interdum erat sapien, ac scelerisque nisl aliquam eget. Cras pellentesque est a dolor pellentesque porta. Nulla sit amet lacus velit. Suspendisse sit amet lorem enim. Nunc in sapien sem. Maecenas purus magna, euismod sed mi at, feugiat ultrices risus. Nam sed elit massa. Nulla at nulla hendrerit, mattis metus eget, mattis enim. Aenean ac egestas arcu. Duis posuere vitae ex ac egestas.\"\n                        },\n                        {\n                            \"Alignment\": \"Centred\",\n                            \"EndOfLineFlag\": true,\n                            \"Text\": \"\"\n                        },\n                        {\n                            \"Alignment\": \"Left\",\n                            \"EndOfLineFlag\": true,\n                            \"Text\": \"Nullam sed neque porttitor, aliquet mauris sit amet, pulvinar ante. Proin at diam dolor. Donec tristique sit amet sem vitae efficitur. Sed eu mollis elit. Nullam vestibulum tortor eget magna blandit, eget scelerisque justo aliquam. Ut dapibus, metus eu pretium vulputate, leo ipsum hendrerit eros, vitae vehicula neque arcu ac urna. Nullam quis auctor est. Duis dapibus elit at erat malesuada, nec imperdiet risus finibus. Morbi congue tellus vel euismod ultrices. Nulla facilisi. Suspendisse potenti. Nunc convallis libero lectus, vitae auctor mauris ullamcorper nec. Fusce tempor at velit vitae sollicitudin. Fusce efficitur facilisis mattis. Phasellus vel lacus mollis, pretium ex nec, porta enim.\"\n                        },\n                        {\n                            \"Alignment\": \"Left\",\n                            \"EndOfLineFlag\": true,\n                            \"Text\": \"\"\n                        },\n                        {\n                            \"CharacterStyle\": \"Bold\",\n                            \"Alignment\": \"Left\",\n                            \"EndOfLineFlag\": true,\n                            \"Text\": \"Términos y condiciones enviados a: email@adyen.com\"\n                        },\n                        {\n                            \"Alignment\": \"Centred\",\n                            \"EndOfLineFlag\": true,\n                            \"Text\": \"\"\n                        },\n                        {\n                            \"CharacterStyle\": \"Bold\",\n                            \"Alignment\": \"Centred\",\n                            \"EndOfLineFlag\": true,\n                            \"Text\": \"Gracias\"\n                        }\n                    ]\n                }\n            }\n        }\n    }\n}",
							"options": {
								"raw": {
									"language": "json"
								}
							}
						},
						"url": {
							"raw": "{{baseUrl}}",
							"host": [
								"{{baseUrl}}"
							]
						}
					},
					"response": []
				},
				{
					"name": "Print QR code",
					"request": {
						"method": "POST",
						"header": [],
						"body": {
							"mode": "raw",
							"raw": "{\n    \"SaleToPOIRequest\": {\n        \"MessageHeader\": {\n            \"ProtocolVersion\": \"3.0\",\n            \"MessageClass\": \"Device\",\n            \"MessageCategory\": \"Print\",\n            \"MessageType\": \"Request\",\n            \"SaleID\": \"{{saleId}}\",\n            \"ServiceID\": \"{{serviceID}}\",\n            \"POIID\": \"{{poiId}}\"\n        },\n        \"PrintRequest\": {\n            \"PrintOutput\": {\n                \"DocumentQualifier\": \"CustomerReceipt\",\n                \"ResponseMode\": \"PrintEnd\",\n                \"OutputContent\": {\n                    \"OutputFormat\":\"BarCode\",\n                    \"OutputBarcode\": {\n                        \"BarcodeType\": \"QRCode\",\n                        \"BarcodeValue\": \"https://docs.adyen.com/point-of-sale\"\n                    }\n                }\n            }\n        }\n    }\n}\n",
							"options": {
								"raw": {
									"language": "json"
								}
							}
						},
						"url": {
							"raw": "{{baseUrl}}",
							"host": [
								"{{baseUrl}}"
							]
						}
					},
					"response": []
				},
				{
					"name": "Print Image",
					"event": [
						{
							"listen": "prerequest",
							"script": {
								"exec": [
									"const pngData = \"data:image/png;base64,[encoded data, 12352 characters]\";",
									"",
									"var xhtmlData = \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?> \\n<img src=\\\"\" + pngData + \"\\\"/>\";",
									"",
									"var xhtml = btoa(xhtmlData);",
									"",
									"pm.globals.set(\"xhtml\", xhtml);"
								],
								"type": "text/javascript"
							}
						},
						{
							"listen": "test",
							"script": {
								"exec": [
									"var responseJson = JSON.parse(responseBody);",
									"",
									"if (responseJson.SaleToPOIResponse.PrintResponse.Response.Result == \"Failure\") {",
									"    var additionalResponseString = responseJson.SaleToPOIResponse.PrintResponse.Response.AdditionalResponse;",
									"",
									"    console.log(additionalResponse);",
									"}",
									"",
									"",
									""
								],
								"type": "text/javascript"
							}
						}
					],
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Content-Type",
								"name": "Content-Type",
								"type": "text",
								"value": "application/json"
							}
						],
						"body": {
							"mode": "raw",
							"raw": "{\n    \"SaleToPOIRequest\": {\n        \"MessageHeader\": {\n            \"ProtocolVersion\": \"3.0\",\n            \"MessageClass\": \"Device\",\n            \"MessageCategory\": \"Print\",\n            \"MessageType\": \"Request\",\n            \"ServiceID\": \"{{serviceID}}\",\n            \"SaleID\": \"{{saleId}}\",\n            \"POIID\": \"{{poiId}}\"\n        },\n        \"PrintRequest\": {\n            \"PrintOutput\": {\n                \"DocumentQualifier\": \"Document\",\n                \"ResponseMode\": \"PrintEnd\",\n                \"OutputContent\": {\n                    \"OutputFormat\": \"XHTML\",\n                    \"OutputXHTML\": \"{{xhtml}}\"\n                }\n            }\n        }\n    }\n}",
							"options": {
								"raw": {
									"language": "json"
								}
							}
						},
						"url": {
							"raw": "{{baseUrl}}",
							"host": [
								"{{baseUrl}}"
							]
						}
					},
					"response": []
				}
			]
		},
		{
			"name": "Instalments",
			"item": [
				{
					"name": "Mexico",
					"item": [
						{
							"name": "Card acquisition request",
							"event": [
								{
									"listen": "prerequest",
									"script": {
										"exec": [
											"pm.globals.set(\"inProcessSaleId\", pm.environment.get(\"saleId\"));",
											"pm.globals.set(\"inProcessServiceId\", pm.globals.get(\"serviceId\"));",
											"pm.globals.set(\"inProcessMessageCategory\", \"CardAcquisition\");",
											""
										],
										"type": "text/javascript"
									}
								},
								{
									"listen": "test",
									"script": {
										"exec": [
											"let responseJson = JSON.parse(responseBody);",
											"",
											"let additionalResponseString = responseJson.SaleToPOIResponse.CardAcquisitionResponse.Response.AdditionalResponse;",
											"var additionalResponseJsonString = '{\"' + additionalResponseString.replace(/&/g, '\", \"').replace(/=/g, '\": \"') + '\"}';",
											"var additionalResponseJson = JSON.parse(additionalResponseJsonString);",
											"console.log(additionalResponseString);",
											"",
											"if (responseJson.SaleToPOIResponse.CardAcquisitionResponse.Response.Result == \"Success\") {",
											"    pm.globals.set(\"poiTimeStamp\", responseJson.SaleToPOIResponse.CardAcquisitionResponse.POIData.POITransactionID.TimeStamp);",
											"    pm.globals.set(\"poiTransactionId\", responseJson.SaleToPOIResponse.CardAcquisitionResponse.POIData.POITransactionID.TransactionID);",
											"    var issuerCountry = \"\";",
											"    if (additionalResponseJson[\"issuerCountry\"] === \"unknown\") {",
											"        issuerCountry = additionalResponseJson[\"shopperCountry\"];",
											"    } else {",
											"        issuerCountry = additionalResponseJson[\"issuerCountry\"];",
											"    }",
											"    ",
											"    let fundingSource = additionalResponseJson[\"fundingSource\"];",
											"    let amount = Number(additionalResponseJson[\"posOriginalAmountValue\"])/100;",
											"",
											"    amount = amount.toFixed(2);",
											"",
											"    pm.globals.set(\"amount\", amount);",
											"",
											"    let currency = pm.environment.get(\"currency\");",
											"",
											"    console.log(\"Country: \" + issuerCountry);",
											"    console.log(\"Funding source: \" + fundingSource);",
											"    console.log(\"Amount: \" + amount);",
											"    console.log(\"Currency: \" + currency);",
											"",
											"    if ((issuerCountry === \"MX\") && (fundingSource === \"CREDIT\") && (amount >= 300) && (currency === \"MXN\")) {",
											"        // propose installments",
											"        postman.setNextRequest(\"Ask for instalments\");",
											"    } else {",
											"        // process as a regular payment",
											"        postman.setNextRequest(\"Card acquisition payment without instalments\");",
											"    }",
											"}",
											"",
											""
										],
										"type": "text/javascript"
									}
								}
							],
							"request": {
								"method": "POST",
								"header": [
									{
										"key": "Content-Type",
										"name": "Content-Type",
										"value": "application/json",
										"type": "text"
									}
								],
								"body": {
									"mode": "raw",
									"raw": "{\n    \"SaleToPOIRequest\": {\n        \"MessageHeader\": {\n            \"ProtocolVersion\": \"3.0\",\n            \"MessageClass\": \"Service\",\n            \"MessageCategory\": \"CardAcquisition\",\n            \"MessageType\": \"Request\",\n            \"SaleID\": \"{{saleId}}\",\n            \"ServiceID\": \"{{serviceId}}\",\n            \"POIID\": \"{{poiId}}\"\n        },\n        \"CardAcquisitionRequest\": {\n            \"SaleData\": {\n                \"SaleTransactionID\": {\n                    \"TransactionID\": \"{{$timestamp}}\",\n                    \"TimeStamp\": \"{{$isoTimestamp}}\"\n                },\n                \"SaleToAcquirerData\": \"tenderOption=ReceiptHandler&applicationInfo.merchantApplication.name=NAME_OF_POS_APPLICATION&applicationInfo.merchantApplication.version=2.13.05&applicationInfo.externalPlatform.name=COMPANY_NAME_OR_PLATFORM_NAME&applicationInfo.externalPlatform.version=1.3&applicationInfo.externalPlatform.integrator=COMPANY_THAT_BUILT_INTEGRATION_OR_POS_APP&applicationInfo.merchantDevice.os=OS_OF_DEVICE_THAT_RUNS_POS_APPLICATION&applicationInfo.merchantDevice.osVersion=16.3&metadata.someMetaDataKey1=YOUR_VALUE&metadata.someMetaDataKey2=YOUR_VALUE\",\n                \"TokenRequestedType\": \"Customer\"\n            },\n            \"CardAcquisitionTransaction\": {\n                \"TotalAmount\": 600.00\n            }\n        }\n    }\n}",
									"options": {
										"raw": {
											"language": "json"
										}
									}
								},
								"url": {
									"raw": "{{baseUrl}}",
									"host": [
										"{{baseUrl}}"
									]
								}
							},
							"response": []
						},
						{
							"name": "Ask for instalments",
							"event": [
								{
									"listen": "prerequest",
									"script": {
										"exec": [
											""
										],
										"type": "text/javascript"
									}
								},
								{
									"listen": "test",
									"script": {
										"exec": [
											"let responseJson = JSON.parse(responseBody);",
											"",
											"if (typeof responseJson.SaleToPOIRequest === 'undefined') {",
											"",
											"    if (responseJson.SaleToPOIResponse.InputResponse.InputResult.Response.Result === \"Success\") {",
											"        ",
											"        let menuEntryNumber = responseJson.SaleToPOIResponse.InputResponse.InputResult.Input.MenuEntryNumber;",
											"",
											"        if (menuEntryNumber.indexOf(1) == 1) {",
											"            // Ask for number of installments",
											"            console.log(\"Installments without interest\");",
											"            postman.setNextRequest(\"Propose instalments\");",
											"        } else {",
											"            // Pay without instalments",
											"            console.log(\"Cash\");",
											"            postman.setNextRequest(\"Card acquisition payment without instalments\");",
											"        }",
											"    } else {",
											"        // Pay without instalments",
											"        console.log(\"Cash\");",
											"        postman.setNextRequest(\"Card acquisition payment without instalments\");",
											"    }",
											"} else {",
											"    console.log(responseJson.SaleToPOIRequest.EventNotification.EventDetails);",
											"}"
										],
										"type": "text/javascript"
									}
								}
							],
							"request": {
								"method": "POST",
								"header": [],
								"body": {
									"mode": "raw",
									"raw": "{\n    \"SaleToPOIRequest\": {\n        \"MessageHeader\": {\n            \"ProtocolVersion\": \"3.0\",\n            \"MessageClass\": \"Device\",\n            \"MessageCategory\": \"Input\",\n            \"MessageType\": \"Request\",\n            \"SaleID\": \"{{saleId}}\",\n            \"ServiceID\": \"{{serviceId}}\",\n            \"POIID\": \"{{poiId}}\"\n        },\n        \"InputRequest\": {\n            \"DisplayOutput\": {\n                \"Device\": \"CustomerDisplay\",\n                \"InfoQualify\": \"Display\",\n                \"OutputContent\": {\n                    \"OutputFormat\": \"Text\",\n                    \"PredefinedContent\": {\n                        \"ReferenceID\": \"MenuButtons\"\n                    },\n                    \"OutputText\": [\n                        {\n                            \"Text\": \"${{amount}}\"\n                        },\n                        {\n                            \"Text\": \"Payment in cash or in months without interest?\"\n                        }\n                    ]\n                },\n                \"MenuEntry\": [\n                    {\n                        \"OutputFormat\":\"Text\",\n                        \"OutputText\":[\n                            {\n                                \"Text\":\"Cash\"\n                            }\n                        ]\n                    },\n                    {\n                        \"OutputFormat\":\"Text\",\n                        \"OutputText\":[\n                            {\n                                \"Text\":\"Installments without interest\"\n                            }\n                        ]\n                    }\n                ]\n            },\n            \"InputData\": {\n                \"Device\": \"CustomerInput\",\n                \"InfoQualify\": \"Input\",\n                \"InputCommand\": \"GetMenuEntry\",\n                \"MaxInputTime\": 30\n            }\n        }\n    }\n}",
									"options": {
										"raw": {
											"language": "json"
										}
									}
								},
								"url": {
									"raw": "{{baseUrl}}",
									"host": [
										"{{baseUrl}}"
									]
								}
							},
							"response": []
						},
						{
							"name": "Propose instalments",
							"event": [
								{
									"listen": "prerequest",
									"script": {
										"exec": [
											""
										],
										"type": "text/javascript"
									}
								},
								{
									"listen": "test",
									"script": {
										"exec": [
											"let responseJson = JSON.parse(responseBody);",
											"",
											"if (typeof responseJson.SaleToPOIRequest === 'undefined') {",
											"",
											"    if (responseJson.SaleToPOIResponse.InputResponse.InputResult.Response.Result === \"Success\") {",
											"        ",
											"        let menuEntryNumber = responseJson.SaleToPOIResponse.InputResponse.InputResult.Input.MenuEntryNumber;",
											"",
											"        pm.globals.set(\"instalments\", (menuEntryNumber.indexOf(1) + 1) * 3);",
											"        postman.setNextRequest(\"Card acquisition payment with instalments\");",
											"    } else {",
											"        postman.setNextRequest(\"Card acquisition payment without instalments\");",
											"    }",
											"} else {",
											"    console.log(responseJson.SaleToPOIRequest.EventNotification.EventDetails);",
											"}",
											"",
											"",
											""
										],
										"type": "text/javascript"
									}
								}
							],
							"request": {
								"method": "POST",
								"header": [],
								"body": {
									"mode": "raw",
									"raw": "{\n    \"SaleToPOIRequest\": {\n        \"MessageHeader\": {\n            \"ProtocolVersion\": \"3.0\",\n            \"MessageClass\": \"Device\",\n            \"MessageCategory\": \"Input\",\n            \"MessageType\": \"Request\",\n            \"SaleID\": \"{{saleId}}\",\n            \"ServiceID\": \"{{serviceId}}\",\n            \"POIID\": \"{{poiId}}\"\n        },\n        \"InputRequest\": {\n            \"DisplayOutput\": {\n                \"Device\": \"CustomerDisplay\",\n                \"InfoQualify\": \"Display\",\n                \"OutputContent\": {\n                    \"OutputFormat\": \"Text\",\n                    \"PredefinedContent\": {\n                        \"ReferenceID\": \"MenuButtons\"\n                    },\n                    \"OutputText\": [\n                        {\n                            \"Text\": \"${{amount}}\"\n                        },\n                        {\n                            \"Text\": \"Do you want to pay monthly without interest?\"\n                        }\n                    ]\n                },\n                \"MenuEntry\": [{\n                    \"OutputFormat\": \"Text\",\n                    \"OutputText\": [\n                        {\n                            \"Text\": \"3\"\n                        }\n                    ]\n                },\n                {\n                    \"OutputFormat\": \"Text\",\n                    \"OutputText\": [\n                        {\n                            \"Text\": \"6\"\n                        }\n                    ]\n                }]\n            },\n            \"InputData\": {\n                \"Device\": \"CustomerInput\",\n                \"InfoQualify\": \"Input\",\n                \"InputCommand\": \"GetMenuEntry\",\n                \"MaxInputTime\": 120\n            }\n        }\n    }\n}",
									"options": {
										"raw": {
											"language": "json"
										}
									}
								},
								"url": {
									"raw": "{{baseUrl}}",
									"host": [
										"{{baseUrl}}"
									]
								}
							},
							"response": []
						},
						{
							"name": "Card acquisition payment with instalments",
							"event": [
								{
									"listen": "prerequest",
									"script": {
										"exec": [
											"pm.globals.set(\"inProcessSaleId\", pm.environment.get(\"saleId\"));",
											"pm.globals.set(\"inProcessServiceId\", pm.globals.get(\"serviceId\"));",
											"pm.globals.set(\"inProcessMessageCategory\", \"Payment\");"
										],
										"type": "text/javascript"
									}
								},
								{
									"listen": "test",
									"script": {
										"exec": [
											"var responseJson = JSON.parse(responseBody);",
											"",
											"//Check if transaction was processed",
											"if (typeof responseJson.SaleToPOIRequest === 'undefined') {",
											"    //Transaction result",
											"    console.log(\"Result: \" + responseJson.SaleToPOIResponse.PaymentResponse.Response.Result);",
											"",
											"    //Get additional response",
											"    var additionalResponseString = responseJson.SaleToPOIResponse.PaymentResponse.Response.AdditionalResponse;",
											"    console.log(additionalResponseString);",
											"",
											"    //Get receipt info",
											"    if (typeof responseJson.SaleToPOIResponse.PaymentResponse.Response.ErrorCondition === 'undefined') {",
											"        var receiptInfo = responseJson.SaleToPOIResponse.PaymentResponse.PaymentReceipt;",
											"        receiptInfo.forEach(receipt);",
											"    }",
											"",
											"    //If the result is \"Success\", we save some info",
											"    if (responseJson.SaleToPOIResponse.PaymentResponse.Response.Result == \"Success\") {",
											"        //We save the time stamp",
											"        var paymentTimeStamp = responseJson.SaleToPOIResponse.PaymentResponse.POIData.POITransactionID.TimeStamp;",
											"        pm.globals.set(\"paymentTimeStamp\", paymentTimeStamp);",
											"",
											"        //Transaction ID (tender reference + psp reference)",
											"        var paymentTransactionID = responseJson.SaleToPOIResponse.PaymentResponse.POIData.POITransactionID.TransactionID;",
											"        pm.globals.set(\"paymentTransactionId\", paymentTransactionID);",
											"",
											"        //PSP reference",
											"        var pspReference = paymentTransactionID.split(\".\")[1];",
											"        pm.globals.set(\"pspReference\", pspReference);",
											"        console.log(\"PSP reference: \" + pspReference);",
											"",
											"        //Original POIID",
											"        var originalPOIID = responseJson.SaleToPOIResponse.MessageHeader.POIID;",
											"        pm.globals.set(\"originalPOIID\", originalPOIID);",
											"",
											"        postman.setNextRequest(\"IdleScreen\");",
											"    } else {",
											"        console.log(\"Error condition: \" + responseJson.SaleToPOIResponse.PaymentResponse.Response.ErrorCondition);",
											"    }",
											"} else {",
											"    //In case of error we get the error message",
											"    console.log(decodeURIComponent(responseJson.SaleToPOIRequest.EventNotification.EventDetails));",
											"}",
											"",
											"//Parse receipt info",
											"function receipt(item, index, arr) {",
											"    var document = item.DocumentQualifier;",
											"    var receipts = {};",
											"    receipts[document] = {};",
											"",
											"    for (i = 0; i < item.OutputContent.OutputText.length; i++) {",
											"        var text = item.OutputContent.OutputText[i].Text.split('&');",
											"        var key = \"\";",
											"        var value = \"\";",
											"",
											"        for (j = 0; j < text.length; j++) {",
											"            var pair = text[j].split('=');",
											"",
											"            if (pair[0] == \"key\") {",
											"                key = pair[1];",
											"            }",
											"",
											"            if (pair[0] == \"value\") {",
											"                value = pair[1];",
											"            }",
											"        }",
											"",
											"        receipts[document][key] = decodeURIComponent(value);",
											"    }",
											"",
											"    console.log(receipts);",
											"}",
											"",
											""
										],
										"type": "text/javascript"
									}
								}
							],
							"request": {
								"method": "POST",
								"header": [
									{
										"key": "Content-Type",
										"name": "Content-Type",
										"value": "application/json",
										"type": "text"
									}
								],
								"body": {
									"mode": "raw",
									"raw": "{\n    \"SaleToPOIRequest\": {\n        \"MessageHeader\": {\n            \"ProtocolVersion\": \"3.0\",\n            \"MessageClass\": \"Service\",\n            \"MessageCategory\": \"Payment\",\n            \"MessageType\": \"Request\",\n            \"SaleID\": \"{{saleId}}\",\n            \"ServiceID\": \"{{serviceId}}\",\n            \"POIID\": \"{{poiId}}\"\n        },\n        \"PaymentRequest\": {\n            \"SaleData\": {\n                \"SaleTransactionID\": {\n                    \"TransactionID\":\"{{$timestamp}}\",\n                    \"TimeStamp\":\"{{$isoTimestamp}}\"\n                },\n                \"SaleToAcquirerData\": \"tenderOption=ReceiptHandler&applicationInfo.merchantApplication.name=NAME_OF_POS_APPLICATION&applicationInfo.merchantApplication.version=2.13.05&applicationInfo.externalPlatform.name=COMPANY_NAME_OR_PLATFORM_NAME&applicationInfo.externalPlatform.version=1.3&applicationInfo.externalPlatform.integrator=COMPANY_THAT_BUILT_INTEGRATION_OR_POS_APP&applicationInfo.merchantDevice.os=OS_OF_DEVICE_THAT_RUNS_POS_APPLICATION&applicationInfo.merchantDevice.osVersion=16.3&metadata.someMetaDataKey1=YOUR_VALUE&metadata.someMetaDataKey2=YOUR_VALUE\"\n            },\n            \"PaymentTransaction\": {\n                \"AmountsReq\": {\n                    \"Currency\": \"{{currency}}\",\n                    \"RequestedAmount\": {{amount}}\n                }\n            },\n            \"PaymentData\": {\n                \"CardAcquisitionReference\": {\n                    \"TransactionID\": \"{{poiTransactionId}}\",\n                    \"TimeStamp\": \"{{poiTimeStamp}}\"\n                },\n                \"PaymentType\": \"Instalment\",\n                \"Instalment\": {\n                    \"TotalNbOfPayments\": {{instalments}}\n                }\n            }\n        }\n    }\n}",
									"options": {
										"raw": {
											"language": "json"
										}
									}
								},
								"url": {
									"raw": "{{baseUrl}}",
									"host": [
										"{{baseUrl}}"
									]
								}
							},
							"response": []
						},
						{
							"name": "Card acquisition payment without instalments",
							"event": [
								{
									"listen": "prerequest",
									"script": {
										"exec": [
											"pm.globals.set(\"inProcessSaleId\", pm.environment.get(\"saleId\"));",
											"pm.globals.set(\"inProcessServiceId\", pm.globals.get(\"serviceId\"));",
											"pm.globals.set(\"inProcessMessageCategory\", \"Payment\");"
										],
										"type": "text/javascript"
									}
								},
								{
									"listen": "test",
									"script": {
										"exec": [
											"var responseJson = JSON.parse(responseBody);",
											"",
											"//Check if transaction was processed",
											"if (typeof responseJson.SaleToPOIRequest === 'undefined') {",
											"    //Transaction result",
											"    console.log(\"Result: \" + responseJson.SaleToPOIResponse.PaymentResponse.Response.Result);",
											"",
											"    //Get additional response",
											"    var additionalResponseString = responseJson.SaleToPOIResponse.PaymentResponse.Response.AdditionalResponse;",
											"    console.log(additionalResponseString);",
											"",
											"    //Get receipt info",
											"    if (typeof responseJson.SaleToPOIResponse.PaymentResponse.Response.ErrorCondition === 'undefined') {",
											"        var receiptInfo = responseJson.SaleToPOIResponse.PaymentResponse.PaymentReceipt;",
											"        receiptInfo.forEach(receipt);",
											"    }",
											"",
											"    //If the result is \"Success\", we save some info",
											"    if (responseJson.SaleToPOIResponse.PaymentResponse.Response.Result == \"Success\") {",
											"        //We save the time stamp",
											"        var paymentTimeStamp = responseJson.SaleToPOIResponse.PaymentResponse.POIData.POITransactionID.TimeStamp;",
											"        pm.globals.set(\"paymentTimeStamp\", paymentTimeStamp);",
											"",
											"        //Transaction ID (tender reference + psp reference)",
											"        var paymentTransactionID = responseJson.SaleToPOIResponse.PaymentResponse.POIData.POITransactionID.TransactionID;",
											"        pm.globals.set(\"paymentTransactionId\", paymentTransactionID);",
											"",
											"        //PSP reference",
											"        var pspReference = paymentTransactionID.split(\".\")[1];",
											"        pm.globals.set(\"pspReference\", pspReference);",
											"        console.log(\"PSP reference: \" + pspReference);",
											"",
											"        //Original POIID",
											"        var originalPOIID = responseJson.SaleToPOIResponse.MessageHeader.POIID;",
											"        pm.globals.set(\"originalPOIID\", originalPOIID);",
											"",
											"        postman.setNextRequest(\"IdleScreen\");",
											"    } else {",
											"        console.log(\"Error condition: \" + responseJson.SaleToPOIResponse.PaymentResponse.Response.ErrorCondition);",
											"    }",
											"} else {",
											"    //In case of error we get the error message",
											"    console.log(decodeURIComponent(responseJson.SaleToPOIRequest.EventNotification.EventDetails));",
											"}",
											"",
											"//Parse receipt info",
											"function receipt(item, index, arr) {",
											"    var document = item.DocumentQualifier;",
											"    var receipts = {};",
											"    receipts[document] = {};",
											"",
											"    for (i = 0; i < item.OutputContent.OutputText.length; i++) {",
											"        var text = item.OutputContent.OutputText[i].Text.split('&');",
											"        var key = \"\";",
											"        var value = \"\";",
											"",
											"        for (j = 0; j < text.length; j++) {",
											"            var pair = text[j].split('=');",
											"",
											"            if (pair[0] == \"key\") {",
											"                key = pair[1];",
											"            }",
											"",
											"            if (pair[0] == \"value\") {",
											"                value = pair[1];",
											"            }",
											"        }",
											"",
											"        receipts[document][key] = decodeURIComponent(value);",
											"    }",
											"",
											"    console.log(receipts);",
											"}",
											"",
											""
										],
										"type": "text/javascript"
									}
								}
							],
							"request": {
								"method": "POST",
								"header": [
									{
										"key": "Content-Type",
										"name": "Content-Type",
										"value": "application/json",
										"type": "text"
									}
								],
								"body": {
									"mode": "raw",
									"raw": "{\n    \"SaleToPOIRequest\": {\n        \"MessageHeader\": {\n            \"ProtocolVersion\": \"3.0\",\n            \"MessageClass\": \"Service\",\n            \"MessageCategory\": \"Payment\",\n            \"MessageType\": \"Request\",\n            \"SaleID\": \"{{saleId}}\",\n            \"ServiceID\": \"{{serviceId}}\",\n            \"POIID\": \"{{poiId}}\"\n        },\n        \"PaymentRequest\": {\n            \"SaleData\": {\n                \"SaleTransactionID\": {\n                    \"TransactionID\":\"{{$timestamp}}\",\n                    \"TimeStamp\":\"{{$isoTimestamp}}\"\n                },\n                \"SaleToAcquirerData\": \"tenderOption=ReceiptHandler&applicationInfo.merchantApplication.name=NAME_OF_POS_APPLICATION&applicationInfo.merchantApplication.version=2.13.05&applicationInfo.externalPlatform.name=COMPANY_NAME_OR_PLATFORM_NAME&applicationInfo.externalPlatform.version=1.3&applicationInfo.externalPlatform.integrator=COMPANY_THAT_BUILT_INTEGRATION_OR_POS_APP&applicationInfo.merchantDevice.os=OS_OF_DEVICE_THAT_RUNS_POS_APPLICATION&applicationInfo.merchantDevice.osVersion=16.3&metadata.someMetaDataKey1=YOUR_VALUE&metadata.someMetaDataKey2=YOUR_VALUE\"\n            },\n            \"PaymentTransaction\": {\n                \"AmountsReq\": {\n                    \"Currency\": \"{{currency}}\",\n                    \"RequestedAmount\": {{amount}}\n                }\n            },\n            \"PaymentData\": {\n                \"CardAcquisitionReference\": {\n                    \"TransactionID\": \"{{poiTransactionId}}\",\n                    \"TimeStamp\": \"{{poiTimeStamp}}\"\n                }\n            }\n        }\n    }\n}",
									"options": {
										"raw": {
											"language": "json"
										}
									}
								},
								"url": {
									"raw": "{{baseUrl}}",
									"host": [
										"{{baseUrl}}"
									]
								}
							},
							"response": []
						},
						{
							"name": "IdleScreen",
							"request": {
								"method": "POST",
								"header": [],
								"body": {
									"mode": "raw",
									"raw": "{\n    \"SaleToPOIRequest\": {\n        \"MessageHeader\": {\n            \"ProtocolVersion\": \"3.0\",\n            \"MessageClass\": \"Device\",\n            \"MessageCategory\": \"Display\",\n            \"MessageType\": \"Request\",\n            \"SaleID\": \"{{saleId}}\",\n            \"ServiceID\": \"{{serviceId}}\",\n            \"POIID\": \"{{poiId}}\"\n        },\n        \"DisplayRequest\": {\n            \"DisplayOutput\": [\n                {\n                    \"Device\": \"CustomerDisplay\",\n                    \"InfoQualify\": \"Display\",\n                    \"OutputContent\": {\n                        \"OutputFormat\": \"MessageRef\",\n                        \"PredefinedContent\": {\n                            \"ReferenceID\": \"Idle\"\n                        }\n                    }\n                }\n            ]\n        }\n    }\n}",
									"options": {
										"raw": {
											"language": "json"
										}
									}
								},
								"url": {
									"raw": "{{baseUrl}}",
									"host": [
										"{{baseUrl}}"
									]
								}
							},
							"response": []
						}
					],
					"description": "Run the requests inside this folder.\n\nTerminal will first ask to tap or insert the card. Then, if the card was issued in Mexico, is a credit card, and the amount is over 300 MXN, the terminal will ask if you want to pay in instalments (Meses sin intereses) or one-off (contado)."
				},
				{
					"name": "Brazil",
					"item": [
						{
							"name": "Card acquisition request",
							"event": [
								{
									"listen": "prerequest",
									"script": {
										"exec": [
											"pm.globals.set(\"inProcessSaleId\", pm.environment.get(\"saleId\"));",
											"pm.globals.set(\"inProcessServiceId\", pm.globals.get(\"serviceId\"));",
											"pm.globals.set(\"inProcessMessageCategory\", \"CardAcquisition\");",
											""
										],
										"type": "text/javascript"
									}
								},
								{
									"listen": "test",
									"script": {
										"exec": [
											"let responseJson = JSON.parse(responseBody);",
											"",
											"let additionalResponseString = responseJson.SaleToPOIResponse.CardAcquisitionResponse.Response.AdditionalResponse;",
											"var additionalResponseJsonString = '{\"' + additionalResponseString.replace(/&/g, '\", \"').replace(/=/g, '\": \"') + '\"}';",
											"var additionalResponseJson = JSON.parse(additionalResponseJsonString);",
											"console.log(additionalResponseString);",
											"",
											"if (responseJson.SaleToPOIResponse.CardAcquisitionResponse.Response.Result == \"Success\") {",
											"    pm.globals.set(\"poiTimeStamp\", responseJson.SaleToPOIResponse.CardAcquisitionResponse.POIData.POITransactionID.TimeStamp);",
											"    pm.globals.set(\"poiTransactionId\", responseJson.SaleToPOIResponse.CardAcquisitionResponse.POIData.POITransactionID.TransactionID);",
											"",
											"    var issuerCountry = \"\";",
											"    if (additionalResponseJson[\"issuerCountry\"] === \"unknown\") {",
											"        issuerCountry = additionalResponseJson[\"shopperCountry\"];",
											"    } else {",
											"        issuerCountry = additionalResponseJson[\"issuerCountry\"];",
											"    }",
											"    ",
											"    let fundingSource = additionalResponseJson[\"fundingSource\"];",
											"    let amount = Number(additionalResponseJson[\"posOriginalAmountValue\"])/100;",
											"",
											"    amount = amount.toFixed(2);",
											"",
											"    pm.globals.set(\"amount\", amount);",
											"",
											"    let currency = pm.environment.get(\"currency\");",
											"",
											"    console.log(\"Country: \" + issuerCountry);",
											"    console.log(\"Funding source: \" + fundingSource);",
											"    console.log(\"Amount: \" + amount);",
											"    console.log(\"Currency: \" + currency);",
											"",
											"    // If Brazilian card, ask if debit or credit.",
											"    if (issuerCountry === \"BR\" && currency === \"BRL\") {",
											"        // Ask if credit or debit",
											"        postman.setNextRequest(\"Debit or credit\");",
											"    } else {",
											"        // process as a regular payment",
											"        postman.setNextRequest(\"Card acquisition payment without instalments\");",
											"    }",
											"}",
											"",
											""
										],
										"type": "text/javascript"
									}
								}
							],
							"request": {
								"method": "POST",
								"header": [
									{
										"key": "Content-Type",
										"name": "Content-Type",
										"value": "application/json",
										"type": "text"
									}
								],
								"body": {
									"mode": "raw",
									"raw": "{\n    \"SaleToPOIRequest\": {\n        \"MessageHeader\": {\n            \"ProtocolVersion\": \"3.0\",\n            \"MessageClass\": \"Service\",\n            \"MessageCategory\": \"CardAcquisition\",\n            \"MessageType\": \"Request\",\n            \"SaleID\": \"{{saleId}}\",\n            \"ServiceID\": \"{{serviceId}}\",\n            \"POIID\": \"{{poiId}}\"\n        },\n        \"CardAcquisitionRequest\": {\n            \"SaleData\": {\n                \"SaleTransactionID\": {\n                    \"TransactionID\":\"{{$timestamp}}\",\n                    \"TimeStamp\":\"{{$isoTimestamp}}\"\n                },\n                \"TokenRequestedType\": \"Customer\"\n            },\n            \"CardAcquisitionTransaction\": {\n                \"TotalAmount\": 400\n            }\n        }\n    }\n}",
									"options": {
										"raw": {
											"language": "json"
										}
									}
								},
								"url": {
									"raw": "{{baseUrl}}",
									"host": [
										"{{baseUrl}}"
									]
								}
							},
							"response": []
						},
						{
							"name": "Debit or credit",
							"event": [
								{
									"listen": "prerequest",
									"script": {
										"exec": [
											""
										],
										"type": "text/javascript"
									}
								},
								{
									"listen": "test",
									"script": {
										"exec": [
											"let responseJson = JSON.parse(responseBody);",
											"",
											"if (typeof responseJson.SaleToPOIRequest === 'undefined') {",
											"",
											"    if (responseJson.SaleToPOIResponse.InputResponse.InputResult.Response.Result === \"Success\") {",
											"        ",
											"        let menuEntryNumber = responseJson.SaleToPOIResponse.InputResponse.InputResult.Input.MenuEntryNumber;",
											"",
											"        if (menuEntryNumber.indexOf(1) == 0) {",
											"            // Propose instalments",
											"            console.log(\"Credit\");",
											"            postman.setNextRequest(\"Ask for instalments\");",
											"        } else {",
											"            // Debit payment",
											"            console.log(\"Debit\");",
											"            postman.setNextRequest(\"Debit payment\");",
											"        }",
											"    } else {",
											"        // Debit payment",
											"        console.log(\"Debit\");",
											"        postman.setNextRequest(\"Debit payment\");",
											"    }",
											"} else {",
											"    console.log(responseJson.SaleToPOIRequest.EventNotification.EventDetails);",
											"}"
										],
										"type": "text/javascript"
									}
								}
							],
							"request": {
								"method": "POST",
								"header": [],
								"body": {
									"mode": "raw",
									"raw": "{\n    \"SaleToPOIRequest\": {\n        \"MessageHeader\": {\n            \"ProtocolVersion\": \"3.0\",\n            \"MessageClass\": \"Device\",\n            \"MessageCategory\": \"Input\",\n            \"MessageType\": \"Request\",\n            \"SaleID\": \"{{saleId}}\",\n            \"ServiceID\": \"{{serviceId}}\",\n            \"POIID\": \"{{poiId}}\"\n        },\n        \"InputRequest\": {\n            \"DisplayOutput\": {\n                \"Device\": \"CustomerDisplay\",\n                \"InfoQualify\": \"Display\",\n                \"OutputContent\": {\n                    \"OutputFormat\": \"Text\",\n                    \"PredefinedContent\": {\n                        \"ReferenceID\": \"MenuButtons\"\n                    },\n                    \"OutputText\": [\n                        {\n                            \"Text\": \"R$ {{amount}}\"\n                        },\n                        {\n                            \"Text\": \"Credit or debit?\"\n                        }\n                    ]\n                },\n                \"MenuEntry\": [\n                    {\n                        \"OutputFormat\":\"Text\",\n                        \"OutputText\":[\n                            {\n                                \"Text\":\"Credit\"\n                            }\n                        ]\n                    },\n                    {\n                        \"OutputFormat\":\"Text\",\n                        \"OutputText\":[\n                            {\n                                \"Text\":\"Debit\"\n                            }\n                        ]\n                    }\n                ]\n            },\n            \"InputData\": {\n                \"Device\": \"CustomerInput\",\n                \"InfoQualify\": \"Input\",\n                \"InputCommand\": \"GetMenuEntry\",\n                \"MaxInputTime\": 30\n            }\n        }\n    }\n}",
									"options": {
										"raw": {
											"language": "json"
										}
									}
								},
								"url": {
									"raw": "{{baseUrl}}",
									"host": [
										"{{baseUrl}}"
									]
								}
							},
							"response": []
						},
						{
							"name": "Ask for instalments",
							"event": [
								{
									"listen": "prerequest",
									"script": {
										"exec": [
											""
										],
										"type": "text/javascript"
									}
								},
								{
									"listen": "test",
									"script": {
										"exec": [
											"let responseJson = JSON.parse(responseBody);",
											"",
											"if (typeof responseJson.SaleToPOIRequest === 'undefined') {",
											"",
											"    if (responseJson.SaleToPOIResponse.InputResponse.InputResult.Response.Result === \"Success\") {",
											"        ",
											"        let menuEntryNumber = responseJson.SaleToPOIResponse.InputResponse.InputResult.Input.MenuEntryNumber;",
											"",
											"        if (menuEntryNumber.indexOf(1) == 1) {",
											"            // Ask for number of installments",
											"            console.log(\"Installments\");",
											"            postman.setNextRequest(\"Number of instalments\");",
											"        } else {",
											"            // Pay with credit without instalments",
											"            console.log(\"Full amount\");",
											"            postman.setNextRequest(\"Credit payment with instalments\");",
											"        }",
											"    } else {",
											"        // Pay with credit without instalments",
											"        console.log(\"Full amount\");",
											"        postman.setNextRequest(\"Credit payment with instalments\");",
											"    }",
											"} else {",
											"    console.log(responseJson.SaleToPOIRequest.EventNotification.EventDetails);",
											"}"
										],
										"type": "text/javascript"
									}
								}
							],
							"request": {
								"method": "POST",
								"header": [],
								"body": {
									"mode": "raw",
									"raw": "{\n    \"SaleToPOIRequest\": {\n        \"MessageHeader\": {\n            \"ProtocolVersion\": \"3.0\",\n            \"MessageClass\": \"Device\",\n            \"MessageCategory\": \"Input\",\n            \"MessageType\": \"Request\",\n            \"SaleID\": \"{{saleId}}\",\n            \"ServiceID\": \"{{serviceId}}\",\n            \"POIID\": \"{{poiId}}\"\n        },\n        \"InputRequest\": {\n            \"DisplayOutput\": {\n                \"Device\": \"CustomerDisplay\",\n                \"InfoQualify\": \"Display\",\n                \"OutputContent\": {\n                    \"OutputFormat\": \"Text\",\n                    \"PredefinedContent\": {\n                        \"ReferenceID\": \"MenuButtons\"\n                    },\n                    \"OutputText\": [\n                        {\n                            \"Text\": \"R$ {{amount}}\"\n                        },\n                        {\n                            \"Text\": \"Do you want to pay full amount or in installments?\"\n                        }\n                    ]\n                },\n                \"MenuEntry\": [\n                    {\n                        \"OutputFormat\":\"Text\",\n                        \"OutputText\":[\n                            {\n                                \"Text\":\"Full amount\"\n                            }\n                        ]\n                    },\n                    {\n                        \"OutputFormat\":\"Text\",\n                        \"OutputText\":[\n                            {\n                                \"Text\":\"Installments\"\n                            }\n                        ]\n                    }\n                ]\n            },\n            \"InputData\": {\n                \"Device\": \"CustomerInput\",\n                \"InfoQualify\": \"Input\",\n                \"InputCommand\": \"GetMenuEntry\",\n                \"MaxInputTime\": 30\n            }\n        }\n    }\n}",
									"options": {
										"raw": {
											"language": "json"
										}
									}
								},
								"url": {
									"raw": "{{baseUrl}}",
									"host": [
										"{{baseUrl}}"
									]
								}
							},
							"response": []
						},
						{
							"name": "Number of instalments",
							"event": [
								{
									"listen": "prerequest",
									"script": {
										"exec": [
											""
										],
										"type": "text/javascript"
									}
								},
								{
									"listen": "test",
									"script": {
										"exec": [
											"let responseJson = JSON.parse(responseBody);",
											"",
											"if (typeof responseJson.SaleToPOIRequest === 'undefined') {",
											"",
											"    if (responseJson.SaleToPOIResponse.InputResponse.InputResult.Response.Result === \"Success\") {",
											"        ",
											"        let menuEntryNumber = responseJson.SaleToPOIResponse.InputResponse.InputResult.Input.MenuEntryNumber;",
											"",
											"        if (menuEntryNumber.indexOf(1) > 0) {",
											"            pm.globals.set(\"instalments\", menuEntryNumber.indexOf(1) + 2);",
											"            postman.setNextRequest(\"Credit payment with instalments\");",
											"        } else {",
											"            postman.setNextRequest(\"Credit payment without instalments\");",
											"        }",
											"    } else {",
											"        console.log(atob(responseJson.SaleToPOIResponse.InputResponse.InputResult.Response.AdditionalResponse));",
											"        postman.setNextRequest(\"Credit payment without instalments\");",
											"    }",
											"} else {",
											"    console.log(responseJson.SaleToPOIRequest.EventNotification.EventDetails);",
											"}",
											"",
											"",
											""
										],
										"type": "text/javascript"
									}
								}
							],
							"request": {
								"method": "POST",
								"header": [],
								"body": {
									"mode": "raw",
									"raw": "{\n    \"SaleToPOIRequest\": {\n        \"MessageHeader\": {\n            \"ProtocolVersion\": \"3.0\",\n            \"MessageClass\": \"Device\",\n            \"MessageCategory\": \"Input\",\n            \"MessageType\": \"Request\",\n            \"SaleID\": \"{{saleId}}\",\n            \"ServiceID\": \"{{serviceId}}\",\n            \"POIID\": \"{{poiId}}\"\n        },\n        \"InputRequest\": {\n            \"DisplayOutput\": {\n                \"Device\": \"CustomerDisplay\",\n                \"InfoQualify\": \"Display\",\n                \"OutputContent\": {\n                    \"OutputFormat\": \"Text\",\n                    \"PredefinedContent\": {\n                        \"ReferenceID\": \"MenuButtons\"\n                    },\n                    \"OutputText\": [\n                        {\n                            \"Text\": \"R$ {{amount}}\"\n                        },\n                        {\n                            \"Text\": \"Number of installments?\"\n                        }\n                    ]\n                },\n                \"MenuEntry\": [\n                    {\n                        \"OutputFormat\": \"Text\",\n                        \"OutputText\": [\n                            {\n                                \"Text\": \"2\"\n                            }\n                        ]\n                    },\n                    {\n                        \"OutputFormat\": \"Text\",\n                        \"OutputText\": [\n                            {\n                                \"Text\": \"4\"\n                            }\n                        ]\n                    }\n                ]\n            },\n            \"InputData\": {\n                \"Device\": \"CustomerInput\",\n                \"InfoQualify\": \"Input\",\n                \"InputCommand\": \"GetMenuEntry\",\n                \"MaxInputTime\": 120\n            }\n        }\n    }\n}",
									"options": {
										"raw": {
											"language": "json"
										}
									}
								},
								"url": {
									"raw": "{{baseUrl}}",
									"host": [
										"{{baseUrl}}"
									]
								}
							},
							"response": []
						},
						{
							"name": "Credit payment with instalments",
							"event": [
								{
									"listen": "prerequest",
									"script": {
										"exec": [
											"pm.globals.set(\"inProcessSaleId\", pm.environment.get(\"saleId\"));",
											"pm.globals.set(\"inProcessServiceId\", pm.globals.get(\"serviceId\"));",
											"pm.globals.set(\"inProcessMessageCategory\", \"Payment\");",
											"",
											""
										],
										"type": "text/javascript"
									}
								},
								{
									"listen": "test",
									"script": {
										"exec": [
											"var responseJson = JSON.parse(responseBody);",
											"",
											"//Check if transaction was processed",
											"if (typeof responseJson.SaleToPOIRequest === 'undefined') {",
											"    //Transaction result",
											"    console.log(\"Result: \" + responseJson.SaleToPOIResponse.PaymentResponse.Response.Result);",
											"",
											"    //Get additional response",
											"    var additionalResponseString = responseJson.SaleToPOIResponse.PaymentResponse.Response.AdditionalResponse;",
											"    console.log(additionalResponseString);",
											"",
											"    //Get receipt info",
											"    if (typeof responseJson.SaleToPOIResponse.PaymentResponse.Response.ErrorCondition === 'undefined') {",
											"        var receiptInfo = responseJson.SaleToPOIResponse.PaymentResponse.PaymentReceipt;",
											"        receiptInfo.forEach(receipt);",
											"    }",
											"",
											"    //If the result is \"Success\", we save some info",
											"    if (responseJson.SaleToPOIResponse.PaymentResponse.Response.Result == \"Success\") {",
											"        //We save the time stamp",
											"        var paymentTimeStamp = responseJson.SaleToPOIResponse.PaymentResponse.POIData.POITransactionID.TimeStamp;",
											"        pm.globals.set(\"paymentTimeStamp\", paymentTimeStamp);",
											"",
											"        //Transaction ID (tender reference + psp reference)",
											"        var paymentTransactionID = responseJson.SaleToPOIResponse.PaymentResponse.POIData.POITransactionID.TransactionID;",
											"        pm.globals.set(\"paymentTransactionId\", paymentTransactionID);",
											"",
											"        //PSP reference",
											"        var pspReference = paymentTransactionID.split(\".\")[1];",
											"        pm.globals.set(\"pspReference\", pspReference);",
											"        console.log(\"PSP reference: \" + pspReference);",
											"",
											"        //Original POIID",
											"        var originalPOIID = responseJson.SaleToPOIResponse.MessageHeader.POIID;",
											"        pm.globals.set(\"originalPOIID\", originalPOIID);",
											"",
											"        postman.setNextRequest(\"IdleScreen\");",
											"    } else {",
											"        console.log(\"Error condition: \" + responseJson.SaleToPOIResponse.PaymentResponse.Response.ErrorCondition);",
											"    }",
											"} else {",
											"    //In case of error we get the error message",
											"    console.log(decodeURIComponent(responseJson.SaleToPOIRequest.EventNotification.EventDetails));",
											"}",
											"",
											"//Parse receipt info",
											"function receipt(item, index, arr) {",
											"    var document = item.DocumentQualifier;",
											"    var receipts = {};",
											"    receipts[document] = {};",
											"",
											"    for (i = 0; i < item.OutputContent.OutputText.length; i++) {",
											"        var text = item.OutputContent.OutputText[i].Text.split('&');",
											"        var key = \"\";",
											"        var value = \"\";",
											"",
											"        for (j = 0; j < text.length; j++) {",
											"            var pair = text[j].split('=');",
											"",
											"            if (pair[0] == \"key\") {",
											"                key = pair[1];",
											"            }",
											"",
											"            if (pair[0] == \"value\") {",
											"                value = pair[1];",
											"            }",
											"        }",
											"",
											"        receipts[document][key] = decodeURIComponent(value);",
											"    }",
											"",
											"    console.log(receipts);",
											"}",
											"",
											""
										],
										"type": "text/javascript"
									}
								}
							],
							"request": {
								"method": "POST",
								"header": [
									{
										"key": "Content-Type",
										"name": "Content-Type",
										"value": "application/json",
										"type": "text"
									}
								],
								"body": {
									"mode": "raw",
									"raw": "{\n    \"SaleToPOIRequest\": {\n        \"MessageHeader\": {\n            \"ProtocolVersion\": \"3.0\",\n            \"MessageClass\": \"Service\",\n            \"MessageCategory\": \"Payment\",\n            \"MessageType\": \"Request\",\n            \"SaleID\": \"{{saleId}}\",\n            \"ServiceID\": \"{{serviceId}}\",\n            \"POIID\": \"{{poiId}}\"\n        },\n        \"PaymentRequest\": {\n            \"SaleData\": {\n                \"SaleTransactionID\": {\n                    \"TransactionID\":\"{{$timestamp}}\",\n                    \"TimeStamp\":\"{{$isoTimestamp}}\"\n                },\n                \"SaleToAcquirerData\": \"tenderOption=ReceiptHandler&applicationInfo.merchantApplication.name=NAME_OF_POS_APPLICATION&applicationInfo.merchantApplication.version=2.13.05&applicationInfo.externalPlatform.name=COMPANY_NAME_OR_PLATFORM_NAME&applicationInfo.externalPlatform.version=1.3&applicationInfo.externalPlatform.integrator=COMPANY_THAT_BUILT_INTEGRATION_OR_POS_APP&applicationInfo.merchantDevice.os=OS_OF_DEVICE_THAT_RUNS_POS_APPLICATION&applicationInfo.merchantDevice.osVersion=16.3&metadata.someMetaDataKey1=YOUR_VALUE&metadata.someMetaDataKey2=YOUR_VALUE\",\n                \"OperatorID\": \"Sara\",\n                \"ShiftNumber\": \"2\"\n            },\n            \"PaymentTransaction\": {\n                \"AmountsReq\": {\n                    \"Currency\": \"{{currency}}\",\n                    \"RequestedAmount\": {{amount}}\n                },\n                \"TransactionConditions\": {\n                    \"DebitPreferredFlag\": false\n                }\n            },\n            \"PaymentData\": {\n                \"CardAcquisitionReference\": {\n                    \"TransactionID\": \"{{poiTransactionId}}\",\n                    \"TimeStamp\": \"{{poiTimeStamp}}\"\n                },\n                \"PaymentType\": \"Instalment\",\n                \"Instalment\": {\n                    \"InstalmentType\": \"EqualInstalments\",\n                    \"SequenceNumber\": 1,\n                    \"Period\": 1,\n                    \"PeriodUnit\": \"Monthly\",\n                    \"TotalNbOfPayments\": {{instalments}}\n                }\n            }\n        }\n    }\n}",
									"options": {
										"raw": {
											"language": "json"
										}
									}
								},
								"url": {
									"raw": "{{baseUrl}}",
									"host": [
										"{{baseUrl}}"
									]
								}
							},
							"response": []
						},
						{
							"name": "Credit payment without instalments",
							"event": [
								{
									"listen": "prerequest",
									"script": {
										"exec": [
											"pm.globals.set(\"inProcessSaleId\", pm.environment.get(\"saleId\"));",
											"pm.globals.set(\"inProcessServiceId\", pm.globals.get(\"serviceId\"));",
											"pm.globals.set(\"inProcessMessageCategory\", \"Payment\");",
											"",
											""
										],
										"type": "text/javascript"
									}
								},
								{
									"listen": "test",
									"script": {
										"exec": [
											"var responseJson = JSON.parse(responseBody);",
											"",
											"//Check if transaction was processed",
											"if (typeof responseJson.SaleToPOIRequest === 'undefined') {",
											"    //Transaction result",
											"    console.log(\"Result: \" + responseJson.SaleToPOIResponse.PaymentResponse.Response.Result);",
											"",
											"    //Get additional response",
											"    var additionalResponseString = responseJson.SaleToPOIResponse.PaymentResponse.Response.AdditionalResponse;",
											"    console.log(additionalResponseString);",
											"",
											"    //Get receipt info",
											"    if (typeof responseJson.SaleToPOIResponse.PaymentResponse.Response.ErrorCondition === 'undefined') {",
											"        var receiptInfo = responseJson.SaleToPOIResponse.PaymentResponse.PaymentReceipt;",
											"        receiptInfo.forEach(receipt);",
											"    }",
											"",
											"    //If the result is \"Success\", we save some info",
											"    if (responseJson.SaleToPOIResponse.PaymentResponse.Response.Result == \"Success\") {",
											"        //We save the time stamp",
											"        var paymentTimeStamp = responseJson.SaleToPOIResponse.PaymentResponse.POIData.POITransactionID.TimeStamp;",
											"        pm.globals.set(\"paymentTimeStamp\", paymentTimeStamp);",
											"",
											"        //Transaction ID (tender reference + psp reference)",
											"        var paymentTransactionID = responseJson.SaleToPOIResponse.PaymentResponse.POIData.POITransactionID.TransactionID;",
											"        pm.globals.set(\"paymentTransactionId\", paymentTransactionID);",
											"",
											"        //PSP reference",
											"        var pspReference = paymentTransactionID.split(\".\")[1];",
											"        pm.globals.set(\"pspReference\", pspReference);",
											"        console.log(\"PSP reference: \" + pspReference);",
											"",
											"        //Original POIID",
											"        var originalPOIID = responseJson.SaleToPOIResponse.MessageHeader.POIID;",
											"        pm.globals.set(\"originalPOIID\", originalPOIID);",
											"",
											"        postman.setNextRequest(\"IdleScreen\");",
											"    } else {",
											"        console.log(\"Error condition: \" + responseJson.SaleToPOIResponse.PaymentResponse.Response.ErrorCondition);",
											"    }",
											"} else {",
											"    //In case of error we get the error message",
											"    console.log(decodeURIComponent(responseJson.SaleToPOIRequest.EventNotification.EventDetails));",
											"}",
											"",
											"//Parse receipt info",
											"function receipt(item, index, arr) {",
											"    var document = item.DocumentQualifier;",
											"    var receipts = {};",
											"    receipts[document] = {};",
											"",
											"    for (i = 0; i < item.OutputContent.OutputText.length; i++) {",
											"        var text = item.OutputContent.OutputText[i].Text.split('&');",
											"        var key = \"\";",
											"        var value = \"\";",
											"",
											"        for (j = 0; j < text.length; j++) {",
											"            var pair = text[j].split('=');",
											"",
											"            if (pair[0] == \"key\") {",
											"                key = pair[1];",
											"            }",
											"",
											"            if (pair[0] == \"value\") {",
											"                value = pair[1];",
											"            }",
											"        }",
											"",
											"        receipts[document][key] = decodeURIComponent(value);",
											"    }",
											"",
											"    console.log(receipts);",
											"}",
											"",
											""
										],
										"type": "text/javascript"
									}
								}
							],
							"request": {
								"method": "POST",
								"header": [
									{
										"key": "Content-Type",
										"name": "Content-Type",
										"value": "application/json",
										"type": "text"
									}
								],
								"body": {
									"mode": "raw",
									"raw": "{\n    \"SaleToPOIRequest\": {\n        \"MessageHeader\": {\n            \"ProtocolVersion\": \"3.0\",\n            \"MessageClass\": \"Service\",\n            \"MessageCategory\": \"Payment\",\n            \"MessageType\": \"Request\",\n            \"SaleID\": \"{{saleId}}\",\n            \"ServiceID\": \"{{serviceId}}\",\n            \"POIID\": \"{{poiId}}\"\n        },\n        \"PaymentRequest\": {\n            \"SaleData\": {\n                \"SaleTransactionID\": {\n                    \"TransactionID\":\"{{$timestamp}}\",\n                    \"TimeStamp\":\"{{$isoTimestamp}}\"\n                },\n                \"SaleToAcquirerData\": \"tenderOption=ReceiptHandler&applicationInfo.merchantApplication.name=NAME_OF_POS_APPLICATION&applicationInfo.merchantApplication.version=2.13.05&applicationInfo.externalPlatform.name=COMPANY_NAME_OR_PLATFORM_NAME&applicationInfo.externalPlatform.version=1.3&applicationInfo.externalPlatform.integrator=COMPANY_THAT_BUILT_INTEGRATION_OR_POS_APP&applicationInfo.merchantDevice.os=OS_OF_DEVICE_THAT_RUNS_POS_APPLICATION&applicationInfo.merchantDevice.osVersion=16.3&metadata.someMetaDataKey1=YOUR_VALUE&metadata.someMetaDataKey2=YOUR_VALUE\",\n                \"OperatorID\": \"Sara\",\n                \"ShiftNumber\": \"2\"\n            },\n            \"PaymentTransaction\": {\n                \"AmountsReq\": {\n                    \"Currency\": \"{{currency}}\",\n                    \"RequestedAmount\": {{amount}}\n                },\n                \"TransactionConditions\": {\n                    \"DebitPreferredFlag\": false\n                }\n            },\n            \"PaymentData\": {\n                \"CardAcquisitionReference\": {\n                    \"TransactionID\": \"{{poiTransactionId}}\",\n                    \"TimeStamp\": \"{{poiTimeStamp}}\"\n                }\n            }\n        }\n    }\n}",
									"options": {
										"raw": {
											"language": "json"
										}
									}
								},
								"url": {
									"raw": "{{baseUrl}}",
									"host": [
										"{{baseUrl}}"
									]
								}
							},
							"response": []
						},
						{
							"name": "Debit payment",
							"event": [
								{
									"listen": "prerequest",
									"script": {
										"exec": [
											"pm.globals.set(\"inProcessSaleId\", pm.environment.get(\"saleId\"));",
											"pm.globals.set(\"inProcessServiceId\", pm.globals.get(\"serviceId\"));",
											"pm.globals.set(\"inProcessMessageCategory\", \"Payment\");",
											"",
											""
										],
										"type": "text/javascript"
									}
								},
								{
									"listen": "test",
									"script": {
										"exec": [
											"var responseJson = JSON.parse(responseBody);",
											"",
											"//Check if transaction was processed",
											"if (typeof responseJson.SaleToPOIRequest === 'undefined') {",
											"    //Transaction result",
											"    console.log(\"Result: \" + responseJson.SaleToPOIResponse.PaymentResponse.Response.Result);",
											"",
											"    //Get additional response",
											"    var additionalResponseString = responseJson.SaleToPOIResponse.PaymentResponse.Response.AdditionalResponse;",
											"    console.log(additionalResponseString);",
											"",
											"    //Get receipt info",
											"    if (typeof responseJson.SaleToPOIResponse.PaymentResponse.Response.ErrorCondition === 'undefined') {",
											"        var receiptInfo = responseJson.SaleToPOIResponse.PaymentResponse.PaymentReceipt;",
											"        receiptInfo.forEach(receipt);",
											"    }",
											"",
											"    //If the result is \"Success\", we save some info",
											"    if (responseJson.SaleToPOIResponse.PaymentResponse.Response.Result == \"Success\") {",
											"        //We save the time stamp",
											"        var paymentTimeStamp = responseJson.SaleToPOIResponse.PaymentResponse.POIData.POITransactionID.TimeStamp;",
											"        pm.globals.set(\"paymentTimeStamp\", paymentTimeStamp);",
											"",
											"        //Transaction ID (tender reference + psp reference)",
											"        var paymentTransactionID = responseJson.SaleToPOIResponse.PaymentResponse.POIData.POITransactionID.TransactionID;",
											"        pm.globals.set(\"paymentTransactionId\", paymentTransactionID);",
											"",
											"        //PSP reference",
											"        var pspReference = paymentTransactionID.split(\".\")[1];",
											"        pm.globals.set(\"pspReference\", pspReference);",
											"        console.log(\"PSP reference: \" + pspReference);",
											"",
											"        //Original POIID",
											"        var originalPOIID = responseJson.SaleToPOIResponse.MessageHeader.POIID;",
											"        pm.globals.set(\"originalPOIID\", originalPOIID);",
											"",
											"        postman.setNextRequest(\"IdleScreen\");",
											"    } else {",
											"        console.log(\"Error condition: \" + responseJson.SaleToPOIResponse.PaymentResponse.Response.ErrorCondition);",
											"    }",
											"} else {",
											"    //In case of error we get the error message",
											"    console.log(decodeURIComponent(responseJson.SaleToPOIRequest.EventNotification.EventDetails));",
											"}",
											"",
											"//Parse receipt info",
											"function receipt(item, index, arr) {",
											"    var document = item.DocumentQualifier;",
											"    var receipts = {};",
											"    receipts[document] = {};",
											"",
											"    for (i = 0; i < item.OutputContent.OutputText.length; i++) {",
											"        var text = item.OutputContent.OutputText[i].Text.split('&');",
											"        var key = \"\";",
											"        var value = \"\";",
											"",
											"        for (j = 0; j < text.length; j++) {",
											"            var pair = text[j].split('=');",
											"",
											"            if (pair[0] == \"key\") {",
											"                key = pair[1];",
											"            }",
											"",
											"            if (pair[0] == \"value\") {",
											"                value = pair[1];",
											"            }",
											"        }",
											"",
											"        receipts[document][key] = decodeURIComponent(value);",
											"    }",
											"",
											"    console.log(receipts);",
											"}",
											"",
											""
										],
										"type": "text/javascript"
									}
								}
							],
							"request": {
								"method": "POST",
								"header": [
									{
										"key": "Content-Type",
										"name": "Content-Type",
										"value": "application/json",
										"type": "text"
									}
								],
								"body": {
									"mode": "raw",
									"raw": "{\n    \"SaleToPOIRequest\": {\n        \"MessageHeader\": {\n            \"ProtocolVersion\": \"3.0\",\n            \"MessageClass\": \"Service\",\n            \"MessageCategory\": \"Payment\",\n            \"MessageType\": \"Request\",\n            \"SaleID\": \"{{saleId}}\",\n            \"ServiceID\": \"{{serviceId}}\",\n            \"POIID\": \"{{poiId}}\"\n        },\n        \"PaymentRequest\": {\n            \"SaleData\": {\n                \"SaleTransactionID\": {\n                    \"TransactionID\":\"{{$timestamp}}\",\n                    \"TimeStamp\":\"{{$isoTimestamp}}\"\n                },\n                \"SaleToAcquirerData\": \"tenderOption=ReceiptHandler&applicationInfo.merchantApplication.name=NAME_OF_POS_APPLICATION&applicationInfo.merchantApplication.version=2.13.05&applicationInfo.externalPlatform.name=COMPANY_NAME_OR_PLATFORM_NAME&applicationInfo.externalPlatform.version=1.3&applicationInfo.externalPlatform.integrator=COMPANY_THAT_BUILT_INTEGRATION_OR_POS_APP&applicationInfo.merchantDevice.os=OS_OF_DEVICE_THAT_RUNS_POS_APPLICATION&applicationInfo.merchantDevice.osVersion=16.3&metadata.someMetaDataKey1=YOUR_VALUE&metadata.someMetaDataKey2=YOUR_VALUE\",\n                \"OperatorID\": \"Sara\",\n                \"ShiftNumber\": \"2\"\n            },\n            \"PaymentTransaction\": {\n                \"AmountsReq\": {\n                    \"Currency\": \"{{currency}}\",\n                    \"RequestedAmount\": {{amount}}\n                },\n                \"TransactionConditions\": {\n                    \"DebitPreferredFlag\": true\n                }\n            },\n            \"PaymentData\": {\n                \"CardAcquisitionReference\": {\n                    \"TransactionID\": \"{{poiTransactionId}}\",\n                    \"TimeStamp\": \"{{poiTimeStamp}}\"\n                }\n            }\n        }\n    }\n}",
									"options": {
										"raw": {
											"language": "json"
										}
									}
								},
								"url": {
									"raw": "{{baseUrl}}",
									"host": [
										"{{baseUrl}}"
									]
								}
							},
							"response": []
						},
						{
							"name": "Card acquisition payment without instalments",
							"event": [
								{
									"listen": "prerequest",
									"script": {
										"exec": [
											""
										],
										"type": "text/javascript"
									}
								},
								{
									"listen": "test",
									"script": {
										"exec": [
											"var responseJson = JSON.parse(responseBody);",
											"",
											"//Check if transaction was processed",
											"if (typeof responseJson.SaleToPOIRequest === 'undefined') {",
											"    //Transaction result",
											"    console.log(\"Result: \" + responseJson.SaleToPOIResponse.PaymentResponse.Response.Result);",
											"",
											"    //Get additional response",
											"    var additionalResponseString = responseJson.SaleToPOIResponse.PaymentResponse.Response.AdditionalResponse;",
											"    console.log(additionalResponseString);",
											"",
											"    //Get receipt info",
											"    if (typeof responseJson.SaleToPOIResponse.PaymentResponse.Response.ErrorCondition === 'undefined') {",
											"        var receiptInfo = responseJson.SaleToPOIResponse.PaymentResponse.PaymentReceipt;",
											"        receiptInfo.forEach(receipt);",
											"    }",
											"",
											"    //If the result is \"Success\", we save some info",
											"    if (responseJson.SaleToPOIResponse.PaymentResponse.Response.Result == \"Success\") {",
											"        //We save the time stamp",
											"        var paymentTimeStamp = responseJson.SaleToPOIResponse.PaymentResponse.POIData.POITransactionID.TimeStamp;",
											"        pm.globals.set(\"paymentTimeStamp\", paymentTimeStamp);",
											"",
											"        //Transaction ID (tender reference + psp reference)",
											"        var paymentTransactionID = responseJson.SaleToPOIResponse.PaymentResponse.POIData.POITransactionID.TransactionID;",
											"        pm.globals.set(\"paymentTransactionId\", paymentTransactionID);",
											"",
											"        //PSP reference",
											"        var pspReference = paymentTransactionID.split(\".\")[1];",
											"        pm.globals.set(\"pspReference\", pspReference);",
											"        console.log(\"PSP reference: \" + pspReference);",
											"",
											"        //Original POIID",
											"        var originalPOIID = responseJson.SaleToPOIResponse.MessageHeader.POIID;",
											"        pm.globals.set(\"originalPOIID\", originalPOIID);",
											"",
											"        postman.setNextRequest(\"IdleScreen\");",
											"    } else {",
											"        console.log(\"Error condition: \" + responseJson.SaleToPOIResponse.PaymentResponse.Response.ErrorCondition);",
											"    }",
											"} else {",
											"    //In case of error we get the error message",
											"    console.log(decodeURIComponent(responseJson.SaleToPOIRequest.EventNotification.EventDetails));",
											"}",
											"",
											"//Parse receipt info",
											"function receipt(item, index, arr) {",
											"    var document = item.DocumentQualifier;",
											"    var receipts = {};",
											"    receipts[document] = {};",
											"",
											"    for (i = 0; i < item.OutputContent.OutputText.length; i++) {",
											"        var text = item.OutputContent.OutputText[i].Text.split('&');",
											"        var key = \"\";",
											"        var value = \"\";",
											"",
											"        for (j = 0; j < text.length; j++) {",
											"            var pair = text[j].split('=');",
											"",
											"            if (pair[0] == \"key\") {",
											"                key = pair[1];",
											"            }",
											"",
											"            if (pair[0] == \"value\") {",
											"                value = pair[1];",
											"            }",
											"        }",
											"",
											"        receipts[document][key] = decodeURIComponent(value);",
											"    }",
											"",
											"    console.log(receipts);",
											"}",
											"",
											""
										],
										"type": "text/javascript"
									}
								}
							],
							"request": {
								"method": "POST",
								"header": [
									{
										"key": "Content-Type",
										"name": "Content-Type",
										"value": "application/json",
										"type": "text"
									}
								],
								"body": {
									"mode": "raw",
									"raw": "{\n    \"SaleToPOIRequest\": {\n        \"MessageHeader\": {\n            \"ProtocolVersion\": \"3.0\",\n            \"MessageClass\": \"Service\",\n            \"MessageCategory\": \"Payment\",\n            \"MessageType\": \"Request\",\n            \"SaleID\": \"{{saleId}}\",\n            \"ServiceID\": \"{{serviceId}}\",\n            \"POIID\": \"{{poiId}}\"\n        },\n        \"PaymentRequest\": {\n            \"SaleData\": {\n                \"SaleTransactionID\": {\n                    \"TransactionID\":\"{{$timestamp}}\",\n                    \"TimeStamp\":\"{{$isoTimestamp}}\"\n                },\n                \"SaleToAcquirerData\": \"tenderOption=ReceiptHandler&applicationInfo.merchantApplication.name=NAME_OF_POS_APPLICATION&applicationInfo.merchantApplication.version=2.13.05&applicationInfo.externalPlatform.name=COMPANY_NAME_OR_PLATFORM_NAME&applicationInfo.externalPlatform.version=1.3&applicationInfo.externalPlatform.integrator=COMPANY_THAT_BUILT_INTEGRATION_OR_POS_APP&applicationInfo.merchantDevice.os=OS_OF_DEVICE_THAT_RUNS_POS_APPLICATION&applicationInfo.merchantDevice.osVersion=16.3&metadata.someMetaDataKey1=YOUR_VALUE&metadata.someMetaDataKey2=YOUR_VALUE\"\n            },\n            \"PaymentTransaction\": {\n                \"AmountsReq\": {\n                    \"Currency\": \"{{currency}}\",\n                    \"RequestedAmount\": {{amount}}\n                }\n            },\n            \"PaymentData\": {\n                \"CardAcquisitionReference\": {\n                    \"TransactionID\": \"{{poiTransactionId}}\",\n                    \"TimeStamp\": \"{{poiTimeStamp}}\"\n                }\n            }\n        }\n    }\n}",
									"options": {
										"raw": {
											"language": "json"
										}
									}
								},
								"url": {
									"raw": "{{baseUrl}}",
									"host": [
										"{{baseUrl}}"
									]
								}
							},
							"response": []
						},
						{
							"name": "IdleScreen",
							"request": {
								"method": "POST",
								"header": [],
								"body": {
									"mode": "raw",
									"raw": "{\n    \"SaleToPOIRequest\": {\n        \"MessageHeader\": {\n            \"ProtocolVersion\": \"3.0\",\n            \"MessageClass\": \"Device\",\n            \"MessageCategory\": \"Display\",\n            \"MessageType\": \"Request\",\n            \"SaleID\": \"{{saleId}}\",\n            \"ServiceID\": \"{{serviceId}}\",\n            \"POIID\": \"{{poiId}}\"\n        },\n        \"DisplayRequest\": {\n            \"DisplayOutput\": [\n                {\n                    \"Device\": \"CustomerDisplay\",\n                    \"InfoQualify\": \"Display\",\n                    \"OutputContent\": {\n                        \"OutputFormat\": \"MessageRef\",\n                        \"PredefinedContent\": {\n                            \"ReferenceID\": \"Idle\"\n                        }\n                    }\n                }\n            ]\n        }\n    }\n}",
									"options": {
										"raw": {
											"language": "json"
										}
									}
								},
								"url": {
									"raw": "{{baseUrl}}",
									"host": [
										"{{baseUrl}}"
									]
								}
							},
							"response": []
						}
					],
					"description": "Run the requests inside this folder to see the instalments flow.\n\nFor Brazil, the terminal will do first a card acquisition to check if the card was issued in Brazil. If the card was issued in Brazil, then the terminal will ask if you want to process the payment as credi or debit. If credit is selected, terminal will ask if you want to pay in instalments (parcelado) or one-off (á vista)."
				}
			]
		},
		{
			"name": "Tipping",
			"item": [
				{
					"name": "On POS",
					"item": [
						{
							"name": "Payment with tip",
							"event": [
								{
									"listen": "prerequest",
									"script": {
										"exec": [
											""
										],
										"type": "text/javascript"
									}
								},
								{
									"listen": "test",
									"script": {
										"exec": [
											"var responseJson = JSON.parse(responseBody);",
											"",
											"//Check if transaction was processed",
											"if (typeof responseJson.SaleToPOIRequest === 'undefined') {",
											"    //Transaction result",
											"    console.log(\"Result: \" + responseJson.SaleToPOIResponse.PaymentResponse.Response.Result);",
											"",
											"    //Get additional response",
											"    var additionalResponseString = atob(responseJson.SaleToPOIResponse.PaymentResponse.Response.AdditionalResponse);",
											"    var additionalResponse = JSON.parse(additionalResponseString);",
											"    console.log(additionalResponse);",
											"",
											"    //Get receipt info",
											"    if (typeof responseJson.SaleToPOIResponse.PaymentResponse.Response.ErrorCondition === 'undefined') {",
											"        var receiptInfo = responseJson.SaleToPOIResponse.PaymentResponse.PaymentReceipt;",
											"        receiptInfo.forEach(receipt);",
											"    }",
											"",
											"    //If the result is \"Success\", we save some info",
											"    if (responseJson.SaleToPOIResponse.PaymentResponse.Response.Result == \"Success\") {",
											"        //We save the time stamp",
											"        var paymentTimeStamp = responseJson.SaleToPOIResponse.PaymentResponse.POIData.POITransactionID.TimeStamp;",
											"        pm.globals.set(\"paymentTimeStamp\", paymentTimeStamp);",
											"",
											"        //Transaction ID (tender reference + psp reference)",
											"        var paymentTransactionID = responseJson.SaleToPOIResponse.PaymentResponse.POIData.POITransactionID.TransactionID;",
											"        pm.globals.set(\"paymentTransactionId\", paymentTransactionID);",
											"",
											"        //PSP reference",
											"        var pspReference = paymentTransactionID.split(\".\")[1];",
											"        pm.globals.set(\"pspReference\", pspReference);",
											"        console.log(\"PSP reference: \" + pspReference);",
											"",
											"        //Original POIID",
											"        var originalPOIID = responseJson.SaleToPOIResponse.MessageHeader.POIID;",
											"        pm.globals.set(\"originalPOIID\", originalPOIID);",
											"    } else {",
											"        console.log(\"Error condition: \" + responseJson.SaleToPOIResponse.PaymentResponse.Response.ErrorCondition);",
											"    }",
											"} else {",
											"    //In case of error we get the error message",
											"    console.log(decodeURIComponent(responseJson.SaleToPOIRequest.EventNotification.EventDetails));",
											"}",
											"",
											"//Parse receipt info",
											"function receipt(item, index, arr) {",
											"    var document = item.DocumentQualifier;",
											"    var receipts = {};",
											"    receipts[document] = {};",
											"",
											"    for (i = 0; i < item.OutputContent.OutputText.length; i++) {",
											"        var text = item.OutputContent.OutputText[i].Text.split('&');",
											"        var key = \"\";",
											"        var value = \"\";",
											"",
											"        for (j = 0; j < text.length; j++) {",
											"            var pair = text[j].split('=');",
											"",
											"            if (pair[0] == \"key\") {",
											"                key = pair[1];",
											"            }",
											"",
											"            if (pair[0] == \"value\") {",
											"                value = pair[1];",
											"            }",
											"        }",
											"",
											"        receipts[document][key] = decodeURIComponent(value);",
											"    }",
											"",
											"    console.log(receipts);",
											"}",
											"",
											""
										],
										"type": "text/javascript"
									}
								}
							],
							"request": {
								"method": "POST",
								"header": [
									{
										"key": "Content-Type",
										"name": "Content-Type",
										"value": "application/json",
										"type": "text"
									}
								],
								"body": {
									"mode": "raw",
									"raw": "{\n    \"SaleToPOIRequest\": {\n        \"MessageHeader\": {\n            \"ProtocolVersion\": \"3.0\",\n            \"MessageClass\": \"Service\",\n            \"MessageCategory\": \"Payment\",\n            \"MessageType\": \"Request\",\n            \"SaleID\": \"{{saleId}}\",\n            \"ServiceID\": \"{{serviceId}}\",\n            \"POIID\": \"{{poiId}}\"\n        },\n        \"PaymentRequest\": {\n            \"SaleData\": {\n                \"SaleTransactionID\": {\n                    \"TransactionID\":\"{{$timestamp}}\",\n                    \"TimeStamp\":\"{{$isoTimestamp}}\"\n                },\n                \"SaleToAcquirerData\": \"tenderOption=ReceiptHandler&applicationInfo.merchantApplication.name=NAME_OF_POS_APPLICATION&applicationInfo.merchantApplication.version=2.13.05&applicationInfo.externalPlatform.name=COMPANY_NAME_OR_PLATFORM_NAME&applicationInfo.externalPlatform.version=1.3&applicationInfo.externalPlatform.integrator=COMPANY_THAT_BUILT_INTEGRATION_OR_POS_APP&applicationInfo.merchantDevice.os=OS_OF_DEVICE_THAT_RUNS_POS_APPLICATION&applicationInfo.merchantDevice.osVersion=16.3&metadata.someMetaDataKey1=YOUR_VALUE&metadata.someMetaDataKey2=YOUR_VALUE\",\n                \"OperatorID\": \"Sara\",\n                \"ShiftNumber\": \"2\"\n            },\n            \"PaymentTransaction\": {\n                \"AmountsReq\": {\n                    \"Currency\": \"{{currency}}\",\n                    \"RequestedAmount\": 50.00,\n                    \"TipAmount\": 5.00\n                }\n            }\n        }\n    }\n}",
									"options": {
										"raw": {
											"language": "json"
										}
									}
								},
								"url": {
									"raw": "{{baseUrl}}",
									"host": [
										"{{baseUrl}}"
									]
								}
							},
							"response": []
						}
					]
				},
				{
					"name": "On terminal",
					"item": [
						{
							"name": "Payment with tip",
							"event": [
								{
									"listen": "prerequest",
									"script": {
										"exec": [
											""
										],
										"type": "text/javascript"
									}
								},
								{
									"listen": "test",
									"script": {
										"exec": [
											"var responseJson = JSON.parse(responseBody);",
											"",
											"//Check if transaction was processed",
											"if (typeof responseJson.SaleToPOIRequest === 'undefined') {",
											"    //Transaction result",
											"    console.log(\"Result: \" + responseJson.SaleToPOIResponse.PaymentResponse.Response.Result);",
											"",
											"    //Get additional response",
											"    var additionalResponseString = responseJson.SaleToPOIResponse.PaymentResponse.Response.AdditionalResponse;",
											"    console.log(additionalResponseString);",
											"",
											"    //Get receipt info",
											"    if (typeof responseJson.SaleToPOIResponse.PaymentResponse.Response.ErrorCondition === 'undefined') {",
											"        var receiptInfo = responseJson.SaleToPOIResponse.PaymentResponse.PaymentReceipt;",
											"        receiptInfo.forEach(receipt);",
											"    }",
											"",
											"    //If the result is \"Success\", we save some info",
											"    if (responseJson.SaleToPOIResponse.PaymentResponse.Response.Result == \"Success\") {",
											"        //We save the time stamp",
											"        var paymentTimeStamp = responseJson.SaleToPOIResponse.PaymentResponse.POIData.POITransactionID.TimeStamp;",
											"        pm.globals.set(\"paymentTimeStamp\", paymentTimeStamp);",
											"",
											"        //Transaction ID (tender reference + psp reference)",
											"        var paymentTransactionID = responseJson.SaleToPOIResponse.PaymentResponse.POIData.POITransactionID.TransactionID;",
											"        pm.globals.set(\"paymentTransactionId\", paymentTransactionID);",
											"",
											"        //PSP reference",
											"        var pspReference = paymentTransactionID.split(\".\")[1];",
											"        pm.globals.set(\"pspReference\", pspReference);",
											"        console.log(\"PSP reference: \" + pspReference);",
											"",
											"        //Original POIID",
											"        var originalPOIID = responseJson.SaleToPOIResponse.MessageHeader.POIID;",
											"        pm.globals.set(\"originalPOIID\", originalPOIID);",
											"    } else {",
											"        console.log(\"Error condition: \" + responseJson.SaleToPOIResponse.PaymentResponse.Response.ErrorCondition);",
											"    }",
											"} else {",
											"    //In case of error we get the error message",
											"    console.log(decodeURIComponent(responseJson.SaleToPOIRequest.EventNotification.EventDetails));",
											"}",
											"",
											"//Parse receipt info",
											"function receipt(item, index, arr) {",
											"    var document = item.DocumentQualifier;",
											"    var receipts = {};",
											"    receipts[document] = {};",
											"",
											"    for (i = 0; i < item.OutputContent.OutputText.length; i++) {",
											"        var text = item.OutputContent.OutputText[i].Text.split('&');",
											"        var key = \"\";",
											"        var value = \"\";",
											"",
											"        for (j = 0; j < text.length; j++) {",
											"            var pair = text[j].split('=');",
											"",
											"            if (pair[0] == \"key\") {",
											"                key = pair[1];",
											"            }",
											"",
											"            if (pair[0] == \"value\") {",
											"                value = pair[1];",
											"            }",
											"        }",
											"",
											"        receipts[document][key] = decodeURIComponent(value);",
											"    }",
											"",
											"    console.log(receipts);",
											"}",
											"",
											""
										],
										"type": "text/javascript"
									}
								}
							],
							"request": {
								"method": "POST",
								"header": [
									{
										"key": "Content-Type",
										"name": "Content-Type",
										"value": "application/json",
										"type": "text"
									}
								],
								"body": {
									"mode": "raw",
									"raw": "{\n    \"SaleToPOIRequest\": {\n        \"MessageHeader\": {\n            \"ProtocolVersion\": \"3.0\",\n            \"MessageClass\": \"Service\",\n            \"MessageCategory\": \"Payment\",\n            \"MessageType\": \"Request\",\n            \"SaleID\": \"{{saleId}}\",\n            \"ServiceID\": \"{{serviceId}}\",\n            \"POIID\": \"{{poiId}}\"\n        },\n        \"PaymentRequest\": {\n            \"SaleData\": {\n                \"SaleTransactionID\": {\n                    \"TransactionID\":\"{{$timestamp}}\",\n                    \"TimeStamp\":\"{{$isoTimestamp}}\"\n                },\n                \"SaleToAcquirerData\": \"tenderOption=ReceiptHandler&applicationInfo.merchantApplication.name=NAME_OF_POS_APPLICATION&applicationInfo.merchantApplication.version=2.13.05&applicationInfo.externalPlatform.name=COMPANY_NAME_OR_PLATFORM_NAME&applicationInfo.externalPlatform.version=1.3&applicationInfo.externalPlatform.integrator=COMPANY_THAT_BUILT_INTEGRATION_OR_POS_APP&applicationInfo.merchantDevice.os=OS_OF_DEVICE_THAT_RUNS_POS_APPLICATION&applicationInfo.merchantDevice.osVersion=16.3&metadata.someMetaDataKey1=YOUR_VALUE&metadata.someMetaDataKey2=YOUR_VALUE\",\n                \"OperatorID\": \"Sara\",\n                \"ShiftNumber\": \"2\"\n            },\n            \"PaymentTransaction\": {\n                \"AmountsReq\": {\n                    \"Currency\": \"{{currency}}\",\n                    \"RequestedAmount\": 20\n                }\n            }\n        }\n    }\n}",
									"options": {
										"raw": {
											"language": "json"
										}
									}
								},
								"url": {
									"raw": "{{baseUrl}}",
									"host": [
										"{{baseUrl}}"
									]
								}
							},
							"response": []
						}
					]
				},
				{
					"name": "On receipt",
					"item": [
						{
							"name": "Payment preauth request",
							"event": [
								{
									"listen": "prerequest",
									"script": {
										"exec": [
											""
										],
										"type": "text/javascript"
									}
								},
								{
									"listen": "test",
									"script": {
										"exec": [
											"var responseJson = JSON.parse(responseBody);",
											"",
											"//Check if transaction was processed",
											"if (typeof responseJson.SaleToPOIRequest === 'undefined') {",
											"    //Transaction result",
											"    console.log(\"Result: \" + responseJson.SaleToPOIResponse.PaymentResponse.Response.Result);",
											"",
											"    //Get additional response",
											"    var additionalResponseString = responseJson.SaleToPOIResponse.PaymentResponse.Response.AdditionalResponse;",
											"    var additionalResponseJsonString = '{\"' + additionalResponseString.replace(/&/g, '\", \"').replace(/=/g, '\": \"') + '\"}';",
											"    var additionalResponseJson = JSON.parse(additionalResponseJsonString);",
											"    console.log(additionalResponseString);",
											"",
											"    //Get receipt info",
											"    if (typeof responseJson.SaleToPOIResponse.PaymentResponse.Response.ErrorCondition === 'undefined') {",
											"        var receiptInfo = responseJson.SaleToPOIResponse.PaymentResponse.PaymentReceipt;",
											"        receiptInfo.forEach(receipt);",
											"    }",
											"",
											"    //If the result is \"Success\", we save some info",
											"    if (responseJson.SaleToPOIResponse.PaymentResponse.Response.Result == \"Success\") {",
											"        //We save the time stamp",
											"        var paymentTimeStamp = responseJson.SaleToPOIResponse.PaymentResponse.POIData.POITransactionID.TimeStamp;",
											"        pm.globals.set(\"paymentTimeStamp\", paymentTimeStamp);",
											"",
											"        //Transaction ID (tender reference + psp reference)",
											"        var paymentTransactionID = responseJson.SaleToPOIResponse.PaymentResponse.POIData.POITransactionID.TransactionID;",
											"        pm.globals.set(\"paymentTransactionId\", paymentTransactionID);",
											"",
											"        //PSP reference",
											"        var pspReference = paymentTransactionID.split(\".\")[1];",
											"        pm.globals.set(\"pspReference\", pspReference);",
											"        console.log(\"PSP reference: \" + pspReference);",
											"",
											"        //Original POIID",
											"        var originalPOIID = responseJson.SaleToPOIResponse.MessageHeader.POIID;",
											"        pm.globals.set(\"originalPOIID\", originalPOIID);",
											"",
											"        //Save shopper reference",
											"        var shopperReference = additionalResponseJson[\"shopperReference\"];",
											"        pm.globals.set(\"shopperReference\", shopperReference);",
											"        console.log(\"Shopper reference: \" + shopperReference);",
											"",
											"        // Save adjust authorisation data",
											"        var adjustAuthorisationData = additionalResponseJson[\"adjustAuthorisationData\"];",
											"        pm.globals.set(\"adjustAuthorisationData\", adjustAuthorisationData);",
											"",
											"    } else {",
											"        console.log(\"Error condition: \" + responseJson.SaleToPOIResponse.PaymentResponse.Response.ErrorCondition);",
											"    }",
											"} else {",
											"    //In case of error we get the error message",
											"    console.log(decodeURIComponent(responseJson.SaleToPOIRequest.EventNotification.EventDetails));",
											"}",
											"",
											"//Parse receipt info",
											"function receipt(item, index, arr) {",
											"    var document = item.DocumentQualifier;",
											"    var receipts = {};",
											"    receipts[document] = {};",
											"",
											"    for (i = 0; i < item.OutputContent.OutputText.length; i++) {",
											"        var text = item.OutputContent.OutputText[i].Text.split('&');",
											"        var key = \"\";",
											"        var value = \"\";",
											"",
											"        for (j = 0; j < text.length; j++) {",
											"            var pair = text[j].split('=');",
											"",
											"            if (pair[0] == \"key\") {",
											"                key = pair[1];",
											"            }",
											"",
											"            if (pair[0] == \"value\") {",
											"                value = pair[1];",
											"            }",
											"        }",
											"",
											"        receipts[document][key] = decodeURIComponent(value);",
											"    }",
											"",
											"    console.log(receipts);",
											"}"
										],
										"type": "text/javascript"
									}
								}
							],
							"request": {
								"method": "POST",
								"header": [
									{
										"key": "Content-Type",
										"name": "Content-Type",
										"value": "application/json",
										"type": "text"
									}
								],
								"body": {
									"mode": "raw",
									"raw": "{\n    \"SaleToPOIRequest\": {\n        \"MessageHeader\": {\n            \"ProtocolVersion\": \"3.0\",\n            \"MessageClass\": \"Service\",\n            \"MessageCategory\": \"Payment\",\n            \"MessageType\": \"Request\",\n            \"SaleID\": \"{{saleId}}\",\n            \"ServiceID\": \"{{serviceId}}\",\n            \"POIID\": \"{{poiId}}\"\n        },\n        \"PaymentRequest\": {\n            \"SaleData\": {\n                \"SaleTransactionID\": {\n                    \"TransactionID\":\"{{$timestamp}}\",\n                    \"TimeStamp\":\"{{$isoTimestamp}}\"\n                },\n                \"SaleToAcquirerData\": \"tenderOption=ReceiptHandler&applicationInfo.merchantApplication.name=NAME_OF_POS_APPLICATION&applicationInfo.merchantApplication.version=2.13.05&applicationInfo.externalPlatform.name=COMPANY_NAME_OR_PLATFORM_NAME&applicationInfo.externalPlatform.version=1.3&applicationInfo.externalPlatform.integrator=COMPANY_THAT_BUILT_INTEGRATION_OR_POS_APP&applicationInfo.merchantDevice.os=OS_OF_DEVICE_THAT_RUNS_POS_APPLICATION&applicationInfo.merchantDevice.osVersion=16.3&metadata.someMetaDataKey1=YOUR_VALUE&metadata.someMetaDataKey2=YOUR_VALUE&authorisationType=PreAuth\"\n            },\n            \"PaymentTransaction\": {\n                \"AmountsReq\": {\n                    \"Currency\": \"{{currency}}\",\n                    \"RequestedAmount\": 160.00\n                }\n            }\n        }\n    }\n}",
									"options": {
										"raw": {
											"language": "json"
										}
									}
								},
								"url": {
									"raw": "{{baseUrl}}",
									"host": [
										"{{baseUrl}}"
									]
								}
							},
							"response": []
						}
					]
				}
			],
			"event": [
				{
					"listen": "prerequest",
					"script": {
						"type": "text/javascript",
						"exec": [
							"pm.globals.set(\"inProcessSaleId\", pm.environment.get(\"saleId\"));",
							"pm.globals.set(\"inProcessServiceId\", pm.globals.get(\"serviceId\"));",
							"pm.globals.set(\"inProcessMessageCategory\", \"Payment\");",
							"",
							""
						]
					}
				},
				{
					"listen": "test",
					"script": {
						"type": "text/javascript",
						"exec": [
							""
						]
					}
				}
			]
		},
		{
			"name": "Gift cards",
			"item": [
				{
					"name": "Activate",
					"event": [
						{
							"listen": "prerequest",
							"script": {
								"exec": [
									""
								],
								"type": "text/javascript"
							}
						}
					],
					"request": {
						"method": "POST",
						"header": [],
						"body": {
							"mode": "raw",
							"raw": "{\n    \"SaleToPOIRequest\": {\n        \"MessageHeader\": {\n            \"MessageType\": \"Request\",\n            \"MessageClass\": \"Service\",\n            \"MessageCategory\": \"StoredValue\",\n            \"ProtocolVersion\": \"3.0\",\n            \"SaleID\": \"{{saleId}}\",\n            \"ServiceID\": \"{{serviceId}}\",\n            \"POIID\": \"{{poiId}}\"\n        },\n        \"StoredValueRequest\": {\n            \"SaleData\": {\n                \"SaleTransactionID\": {\n                    \"TransactionID\":\"{{$timestamp}}\",\n                    \"TimeStamp\":\"{{$isoTimestamp}}\"\n                },\n                \"SaleToAcquirerData\": \"tenderOption=ReceiptHandler&applicationInfo.merchantApplication.name=NAME_OF_POS_APPLICATION&applicationInfo.merchantApplication.version=2.13.05&applicationInfo.externalPlatform.name=COMPANY_NAME_OR_PLATFORM_NAME&applicationInfo.externalPlatform.version=1.3&applicationInfo.externalPlatform.integrator=COMPANY_THAT_BUILT_INTEGRATION_OR_POS_APP&applicationInfo.merchantDevice.os=OS_OF_DEVICE_THAT_RUNS_POS_APPLICATION&applicationInfo.merchantDevice.osVersion=16.3&metadata.someMetaDataKey1=YOUR_VALUE&metadata.someMetaDataKey2=YOUR_VALUE\"\n            },\n            \"StoredValueData\": [\n                {\n                    \"StoredValueTransactionType\": \"Activate\",\n                    \"StoredValueAccountID\": {\n                        \"StoredValueAccountType\": \"GiftCard\",\n                        \"StoredValueProvider\": \"givex\",\n                        \"IdentificationType\": \"PAN\",\n                        \"EntryMode\": [\n                            \"MagStripe\"\n                        ],\n                        \"StoredValueID\": \"\"\n                    },\n                    \"ItemAmount\": 10.00,\n                    \"Currency\": \"{{currency}}\"\n                }\n            ]\n        }\n    }\n}",
							"options": {
								"raw": {
									"language": "json"
								}
							}
						},
						"url": {
							"raw": "{{baseUrl}}",
							"host": [
								"{{baseUrl}}"
							]
						}
					},
					"response": []
				},
				{
					"name": "Payment",
					"event": [
						{
							"listen": "prerequest",
							"script": {
								"exec": [
									""
								],
								"type": "text/javascript"
							}
						},
						{
							"listen": "test",
							"script": {
								"exec": [
									"var responseJson = JSON.parse(responseBody);",
									"",
									"//Check if transaction was processed",
									"if (typeof responseJson.SaleToPOIRequest === 'undefined') {",
									"    //Transaction result",
									"    console.log(\"Result: \" + responseJson.SaleToPOIResponse.PaymentResponse.Response.Result);",
									"",
									"    //Get additional response",
									"    var additionalResponseString = atob(responseJson.SaleToPOIResponse.PaymentResponse.Response.AdditionalResponse);",
									"    var additionalResponse = JSON.parse(additionalResponseString);",
									"    console.log(additionalResponse);",
									"",
									"    //Get receipt info",
									"    if (typeof responseJson.SaleToPOIResponse.PaymentResponse.Response.ErrorCondition === 'undefined') {",
									"        var receiptInfo = responseJson.SaleToPOIResponse.PaymentResponse.PaymentReceipt;",
									"        receiptInfo.forEach(receipt);",
									"    }",
									"",
									"    //If the result is \"Success\", we save some info",
									"    if (responseJson.SaleToPOIResponse.PaymentResponse.Response.Result == \"Success\") {",
									"        //We save the time stamp",
									"        var paymentTimeStamp = responseJson.SaleToPOIResponse.PaymentResponse.POIData.POITransactionID.TimeStamp;",
									"        pm.globals.set(\"paymentTimeStamp\", paymentTimeStamp);",
									"",
									"        //Transaction ID (tender reference + psp reference)",
									"        var paymentTransactionID = responseJson.SaleToPOIResponse.PaymentResponse.POIData.POITransactionID.TransactionID;",
									"        pm.globals.set(\"paymentTransactionId\", paymentTransactionID);",
									"",
									"        //PSP reference",
									"        var pspReference = paymentTransactionID.split(\".\")[1];",
									"        pm.globals.set(\"pspReference\", pspReference);",
									"        console.log(\"PSP reference: \" + pspReference);",
									"",
									"        //Original POIID",
									"        var originalPOIID = responseJson.SaleToPOIResponse.MessageHeader.POIID;",
									"        pm.globals.set(\"originalPOIID\", originalPOIID);",
									"    } else {",
									"        console.log(\"Error condition: \" + responseJson.SaleToPOIResponse.PaymentResponse.Response.ErrorCondition);",
									"    }",
									"} else {",
									"    //In case of error we get the error message",
									"    console.log(decodeURIComponent(responseJson.SaleToPOIRequest.EventNotification.EventDetails));",
									"}",
									"",
									"//Parse receipt info",
									"function receipt(item, index, arr) {",
									"    var document = item.DocumentQualifier;",
									"    var receipts = {};",
									"    receipts[document] = {};",
									"",
									"    for (i = 0; i < item.OutputContent.OutputText.length; i++) {",
									"        var text = item.OutputContent.OutputText[i].Text.split('&');",
									"        var key = \"\";",
									"        var value = \"\";",
									"",
									"        for (j = 0; j < text.length; j++) {",
									"            var pair = text[j].split('=');",
									"",
									"            if (pair[0] == \"key\") {",
									"                key = pair[1];",
									"            }",
									"",
									"            if (pair[0] == \"value\") {",
									"                value = pair[1];",
									"            }",
									"        }",
									"",
									"        receipts[document][key] = decodeURIComponent(value);",
									"    }",
									"",
									"    console.log(receipts);",
									"}",
									"",
									""
								],
								"type": "text/javascript"
							}
						}
					],
					"request": {
						"method": "POST",
						"header": [],
						"body": {
							"mode": "raw",
							"raw": "{\n    \"SaleToPOIRequest\": {\n        \"MessageHeader\": {\n            \"ProtocolVersion\": \"3.0\",\n            \"MessageClass\": \"Service\",\n            \"MessageCategory\": \"Payment\",\n            \"MessageType\": \"Request\",\n            \"SaleID\": \"{{saleId}}\",\n            \"ServiceID\": \"{{serviceId}}\",\n            \"POIID\": \"{{poiId}}\"\n        },\n        \"PaymentRequest\": {\n            \"SaleData\": {\n                \"SaleTransactionID\": {\n                    \"TransactionID\":\"{{$timestamp}}\",\n                    \"TimeStamp\":\"{{$isoTimestamp}}\"\n                },\n                \"SaleReferenceID\": \"{{$timestamp}}}\",\n                \"SaleToAcquirerData\": \"tenderOption=ReceiptHandler&applicationInfo.merchantApplication.name=NAME_OF_POS_APPLICATION&applicationInfo.merchantApplication.version=2.13.05&applicationInfo.externalPlatform.name=COMPANY_NAME_OR_PLATFORM_NAME&applicationInfo.externalPlatform.version=1.3&applicationInfo.externalPlatform.integrator=COMPANY_THAT_BUILT_INTEGRATION_OR_POS_APP&applicationInfo.merchantDevice.os=OS_OF_DEVICE_THAT_RUNS_POS_APPLICATION&applicationInfo.merchantDevice.osVersion=16.3&metadata.someMetaDataKey1=YOUR_VALUE&metadata.someMetaDataKey2=YOUR_VALUE\"\n            },\n            \"PaymentTransaction\": {\n                \"AmountsReq\": {\n                    \"Currency\": \"{{currency}}\",\n                    \"RequestedAmount\": 25.99\n                }\n            },\n            \"PaymentData\": {\n                \"PaymentInstrumentData\": {\n                    \"PaymentInstrumentType\": \"StoredValue\",\n                    \"StoredValueAccountID\": {\n                        \"StoredValueAccountType\": \"GiftCard\",\n                        \"StoredValueProvider\": \"givex\",\n                        \"IdentificationType\": \"PAN\",\n                        \"EntryMode\": [\n                            \"MagStripe\"\n                        ],\n                        \"StoredValueID\": \"\"\n                    }\n                }\n            }\n        }\n    }\n}",
							"options": {
								"raw": {
									"language": "json"
								}
							}
						},
						"url": {
							"raw": "{{baseUrl}}",
							"host": [
								"{{baseUrl}}"
							]
						}
					},
					"response": []
				},
				{
					"name": "Check balance",
					"event": [
						{
							"listen": "prerequest",
							"script": {
								"exec": [
									""
								],
								"type": "text/javascript"
							}
						},
						{
							"listen": "test",
							"script": {
								"exec": [
									""
								],
								"type": "text/javascript"
							}
						}
					],
					"request": {
						"method": "POST",
						"header": [],
						"body": {
							"mode": "raw",
							"raw": "{\n    \"SaleToPOIRequest\": {\n        \"MessageHeader\": {\n            \"ProtocolVersion\": \"3.0\",\n            \"MessageClass\": \"Service\",\n            \"MessageCategory\": \"BalanceInquiry\",\n            \"MessageType\": \"Request\",\n            \"SaleID\": \"{{saleId}}\",\n            \"ServiceID\": \"{{serviceId}}\",\n            \"POIID\": \"{{poiId}}\"\n        },\n        \"BalanceInquiryRequest\": {\n            \"PaymentAccountReq\": {\n                \"PaymentInstrumentData\": {\n                    \"PaymentInstrumentType\": \"StoredValue\",\n                    \"StoredValueAccountID\": {\n                        \"StoredValueAccountType\": \"GiftCard\",\n                        \"StoredValueProvider\": \"givex\",\n                        \"IdentificationType\": \"PAN\",\n                        \"EntryMode\": [\n                            \"MagStripe\"\n                        ],\n                        \"StoredValueID\": \"\"\n                    }\n                }\n            }\n        }\n    }\n}",
							"options": {
								"raw": {
									"language": "json"
								}
							}
						},
						"url": {
							"raw": "{{baseUrl}}",
							"host": [
								"{{baseUrl}}"
							]
						}
					},
					"response": []
				},
				{
					"name": "Load funds",
					"event": [
						{
							"listen": "prerequest",
							"script": {
								"exec": [
									""
								],
								"type": "text/javascript"
							}
						},
						{
							"listen": "test",
							"script": {
								"exec": [
									"var responseJson = JSON.parse(responseBody);",
									"",
									"if (responseJson.SaleToPOIResponse.StoredValueResponse.Response.Result == \"Success\") {",
									"    pm.globals.set(\"poiTimeStamp\", responseJson.SaleToPOIResponse.StoredValueResponse.POIData.POITransactionID.TimeStamp);",
									"    pm.globals.set(\"poiTransactionId\", responseJson.SaleToPOIResponse.StoredValueResponse.POIData.POITransactionID.TransactionID);",
									"}",
									""
								],
								"type": "text/javascript"
							}
						}
					],
					"request": {
						"method": "POST",
						"header": [],
						"body": {
							"mode": "raw",
							"raw": "{\n    \"SaleToPOIRequest\":{\n        \"MessageHeader\":{\n            \"ProtocolVersion\":\"3.0\",\n            \"MessageClass\":\"Service\",\n            \"MessageCategory\":\"StoredValue\",\n            \"MessageType\":\"Request\",\n            \"SaleID\": \"{{saleId}}\",\n            \"ServiceID\": \"{{serviceId}}\",\n            \"POIID\": \"{{poiId}}\"\n        },\n        \"StoredValueRequest\":{\n            \"SaleData\":{\n                \"SaleTransactionID\":{\n                    \"TransactionID\":\"{{$timestamp}}\",\n                    \"TimeStamp\":\"{{$isoTimestamp}}\"\n                },\n                \"SaleToAcquirerData\":\"\"\n            },\n            \"StoredValueData\":[\n                {\n                    \"StoredValueTransactionType\":\"Load\",\n                    \"StoredValueAccountID\":{\n                        \"StoredValueAccountType\":\"GiftCard\",\n                        \"StoredValueProvider\":\"givex\",\n                        \"IdentificationType\":\"PAN\",\n                        \"EntryMode\":[\n                            \"MagStripe\"\n                        ],\n                        \"StoredValueID\":\"\"\n                    },\n                    \"ItemAmount\":15.00,\n                    \"Currency\":\"{{currency}}\"\n                }\n            ]\n        }\n    }\n}\n",
							"options": {
								"raw": {
									"language": "json"
								}
							}
						},
						"url": {
							"raw": "{{baseUrl}}",
							"host": [
								"{{baseUrl}}"
							]
						}
					},
					"response": []
				},
				{
					"name": "Undo load funds",
					"event": [
						{
							"listen": "prerequest",
							"script": {
								"exec": [
									""
								],
								"type": "text/javascript"
							}
						},
						{
							"listen": "test",
							"script": {
								"exec": [
									""
								],
								"type": "text/javascript"
							}
						}
					],
					"request": {
						"method": "POST",
						"header": [],
						"body": {
							"mode": "raw",
							"raw": "{\n    \"SaleToPOIRequest\": {\n        \"MessageHeader\": {\n            \"ProtocolVersion\": \"3.0\",\n            \"MessageClass\": \"Service\",\n            \"MessageCategory\": \"StoredValue\",\n            \"MessageType\": \"Request\",\n            \"SaleID\": \"{{saleId}}\",\n            \"ServiceID\": \"{{serviceId}}\",\n            \"POIID\": \"{{poiId}}\"\n        },\n        \"StoredValueRequest\": {\n            \"SaleData\": {\n                \"SaleTransactionID\": {\n                    \"TransactionID\":\"{{$timestamp}}\",\n                    \"TimeStamp\":\"{{$isoTimestamp}}\"\n                }\n            },\n            \"StoredValueData\": [\n                {\n                    \"StoredValueTransactionType\": \"Reverse\",\n                    \"OriginalPOITransaction\": {\n                        \"POITransactionID\": {\n                            \"TransactionID\": \"{{poiTransactionId}}\",\n                            \"TimeStamp\": \"{{poiTimeStamp}}\"\n                        }\n                    }\n                }\n            ]\n        }\n    }\n}",
							"options": {
								"raw": {
									"language": "json"
								}
							}
						},
						"url": {
							"raw": "{{baseUrl}}",
							"host": [
								"{{baseUrl}}"
							]
						}
					},
					"response": []
				},
				{
					"name": "Refund",
					"event": [
						{
							"listen": "prerequest",
							"script": {
								"exec": [
									""
								],
								"type": "text/javascript"
							}
						},
						{
							"listen": "test",
							"script": {
								"exec": [
									""
								],
								"type": "text/javascript"
							}
						}
					],
					"request": {
						"method": "POST",
						"header": [],
						"body": {
							"mode": "raw",
							"raw": "{\n    \"SaleToPOIRequest\": {\n        \"MessageHeader\": {\n            \"ProtocolVersion\": \"3.0\",\n            \"MessageClass\": \"Service\",\n            \"MessageCategory\": \"Payment\",\n            \"MessageType\": \"Request\",\n            \"SaleID\": \"{{saleId}}\",\n            \"ServiceID\": \"{{serviceId}}\",\n            \"POIID\": \"{{poiId}}\"\n        },\n        \"PaymentRequest\": {\n            \"SaleData\": {\n                \"SaleTransactionID\": {\n                    \"TransactionID\":\"{{$timestamp}}\",\n                    \"TimeStamp\":\"{{$isoTimestamp}}\"\n                },\n                \"SaleReferenceID\": \"{{$timestamp}}\"\n            },\n            \"PaymentTransaction\": {\n                \"AmountsReq\": {\n                    \"Currency\": \"{{currency}}\",\n                    \"RequestedAmount\": 30\n                }\n            },\n            \"PaymentData\": {\n                \"PaymentType\": \"Refund\",\n                \"PaymentInstrumentData\": {\n                    \"PaymentInstrumentType\": \"StoredValue\",\n                    \"StoredValueAccountID\": {\n                        \"StoredValueAccountType\": \"GiftCard\",\n                        \"StoredValueProvider\": \"givex\",\n                        \"IdentificationType\": \"PAN\",\n                        \"EntryMode\": [\n                            \"MagStripe\"\n                        ],\n                        \"StoredValueID\": \"\"\n                    }\n                }\n            }\n        }\n    }\n}",
							"options": {
								"raw": {
									"language": "json"
								}
							}
						},
						"url": {
							"raw": "{{baseUrl}}",
							"host": [
								"{{baseUrl}}"
							]
						}
					},
					"response": []
				}
			],
			"event": [
				{
					"listen": "prerequest",
					"script": {
						"type": "text/javascript",
						"exec": [
							"pm.globals.set(\"inProcessSaleId\", pm.environment.get(\"saleId\"));",
							"pm.globals.set(\"inProcessServiceId\", pm.globals.get(\"serviceId\"));",
							"pm.globals.set(\"inProcessMessageCategory\", \"Payment\");"
						]
					}
				},
				{
					"listen": "test",
					"script": {
						"type": "text/javascript",
						"exec": [
							""
						]
					}
				}
			]
		}
	],
	"auth": {
		"type": "apikey",
		"apikey": [
			{
				"key": "value",
				"value": "{{X-API-Key}}",
				"type": "string"
			},
			{
				"key": "key",
				"value": "X-API-Key",
				"type": "string"
			}
		]
	},
	"event": [
		{
			"listen": "prerequest",
			"script": {
				"type": "text/javascript",
				"exec": [
					"pm.globals.set(\"serviceId\", \"POS\" + Math.floor(Math.random() * 10000000)); "
				]
			}
		},
		{
			"listen": "test",
			"script": {
				"type": "text/javascript",
				"exec": [
					""
				]
			}
		}
	]
}