{
  "info": {
    "_postman_id": "81b4cd54-a81a-48a2-bfd4-3af40bb4fa2f",
    "name": "Sage Active Public API V2 (2026 June)",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
    "_exporter_id": "7584205"
  },
  "item": [
    {
      "name": "Authenticate and choose your organization",
      "item": [
        {
          "name": "OAuth Authentication - manually fill {{accessToken}}",
          "request": {
            "auth": {
              "type": "oauth2",
              "oauth2": [
                {
                  "key": "scope",
                  "value": "{{scopes}}",
                  "type": "string"
                },
                {
                  "key": "authUrl",
                  "value": "{{authUrl}}?audience={{audience}}",
                  "type": "string"
                },
                {
                  "key": "tokenName",
                  "value": "Sage Active Public API",
                  "type": "string"
                },
                {
                  "key": "clientSecret",
                  "value": "{{clientSecret}}",
                  "type": "string"
                },
                {
                  "key": "clientId",
                  "value": "{{clientId}}",
                  "type": "string"
                },
                {
                  "key": "accessTokenUrl",
                  "value": "{{accessTokenUrl}}",
                  "type": "string"
                },
                {
                  "key": "redirect_uri",
                  "value": "{{callbackUrl}}",
                  "type": "string"
                },
                {
                  "key": "tokenType",
                  "value": "Bearer",
                  "type": "string"
                },
                {
                  "key": "accessToken",
                  "value": "{{accessToken}}",
                  "type": "string"
                },
                {
                  "key": "useBrowser",
                  "value": false,
                  "type": "boolean"
                },
                {
                  "key": "addTokenTo",
                  "value": "queryParams",
                  "type": "string"
                },
                {
                  "key": "grant_type",
                  "value": "authorization_code_with_pkce",
                  "type": "string"
                },
                {
                  "key": "state",
                  "value": "1234",
                  "type": "string"
                }
              ]
            },
            "method": "GET",
            "header": [],
            "url": {
              "raw": ""
            }
          },
          "response": []
        },
        {
          "name": "Q.organizations sorted by most recent, first record X-OrganizationId, LegislationCode automatically filled in",
          "event": [
            {
              "listen": "test",
              "script": {
                "exec": [
                  "pm.test(\"Variable creation\", function () {\r",
                  "    let jsd = pm.response.json();\r",
                  "    if (!jsd || !jsd.data || !jsd.data.organizations || !jsd.data.organizations.edges || jsd.data.organizations.edges.length === 0) {\r",
                  "        console.error(\"Unable to save environment variables due to missing data\");\r",
                  "        return;\r",
                  "    }\r",
                  "\r",
                  "    // Assuming the first organization's details are needed\r",
                  "    let firstOrganization = jsd.data.organizations.edges[0].node;\r",
                  "   \r",
                  "    pm.environment.set(\"socialName\", firstOrganization.socialName);\r",
                  "    console.log(\"'socialName' environment variable has been created: \" + pm.environment.get(\"socialName\"));\r",
                  "\r",
                  "    pm.environment.set(\"X-OrganizationId\", firstOrganization.id);\r",
                  "    console.log(\"'X-OrganizationId' environment variable has been created: \" + pm.environment.get(\"X-OrganizationId\"));\r",
                  "\r",
                  "    pm.environment.set(\"legislationCode\", firstOrganization.legislationCode);\r",
                  "    console.log(\"'legislationCode' environment variable has been created: \" + pm.environment.get(\"legislationCode\"));\r",
                  "});\r",
                  ""
                ],
                "type": "text/javascript",
                "packages": {},
                "requests": {}
              }
            }
          ],
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "x-api-key",
                "value": "{{subscriptionKey}}"
              }
            ],
            "body": {
              "mode": "graphql",
              "graphql": {
                "query": "query {\r\n    organizations(\r\n        where:{\r\n           status:{eq:READY}\r\n           onboardingCompleted:{eq:true}\r\n        }\r\n        order:{creationDate:DESC}\r\n    ) {\r\n        edges {\r\n            node {\r\n                socialName\r\n                id\r\n                legislationCode\r\n                creationDate\r\n            }\r\n       }\r\n        totalCount\r\n        pageInfo {\r\n            hasNextPage\r\n        }\r\n    }     \r\n}",
                "variables": ""
              }
            },
            "url": {
              "raw": "{{baseAddress}}/graphql",
              "host": [
                "{{baseAddress}}"
              ],
              "path": [
                "graphql"
              ]
            }
          },
          "response": []
        },
        {
          "name": "or Q.organizations find by name,  first record X-OrganizationId, LegislationCode automatically filled in",
          "event": [
            {
              "listen": "test",
              "script": {
                "exec": [
                  "pm.test(\"Variable creation\", function () {\r",
                  "    let jsd = pm.response.json();\r",
                  "    if (!jsd || !jsd.data || !jsd.data.organizations || !jsd.data.organizations.edges || jsd.data.organizations.edges.length === 0) {\r",
                  "        console.error(\"Unable to save environment variables due to missing data\");\r",
                  "        return;\r",
                  "    }\r",
                  "\r",
                  "    // Assuming the first organization's details are needed\r",
                  "    let firstOrganization = jsd.data.organizations.edges[0].node;\r",
                  "   \r",
                  "    pm.environment.set(\"X-OrganizationId\", firstOrganization.id);\r",
                  "    console.log(\"'X-OrganizationId' environment variable has been created: \" + pm.environment.get(\"X-OrganizationId\"));\r",
                  "\r",
                  "    pm.environment.set(\"legislationCode\", firstOrganization.legislationCode);\r",
                  "    console.log(\"'legislationCode' environment variable has been created: \" + pm.environment.get(\"legislationCode\"));\r",
                  "});\r",
                  ""
                ],
                "type": "text/javascript",
                "packages": {},
                "requests": {}
              }
            }
          ],
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "x-api-key",
                "value": "{{subscriptionKey}}"
              }
            ],
            "body": {
              "mode": "graphql",
              "graphql": {
                "query": "query ($name: String!) {\r\n    organizations (\r\n        first:1\r\n        where: {\r\n            socialName: { startsWith: $name }\r\n            status: { eq:READY}\r\n            onboardingCompleted: { eq: true }\r\n        }\r\n        order: { creationDate: DESC }\r\n    ) {\r\n        edges {\r\n            node {\r\n                socialName\r\n                id\r\n                legislationCode\r\n                creationDate\r\n            }\r\n        }\r\n    }\r\n}\r\n",
                "variables": "{\r\n  \"name\":\"{{socialName}}\"\r\n}"
              }
            },
            "url": {
              "raw": "{{baseAddress}}/graphql",
              "host": [
                "{{baseAddress}}"
              ],
              "path": [
                "graphql"
              ]
            }
          },
          "response": []
        }
      ],
      "description": "- First, you will authenticate using an Sage Active user.\n    \n- Then, you will request the list of organizations authorized for this user.\n    \n    - This can be either the list of organizations from the most recent to the oldest\n        \n    - or the list of organizations filtered by the beginning of a name you can specify.\n        \n\nAutomatically, the environment variables **X-OrganizationId**, and **LegislationCode** will be set with the values of the first organization returned.\n\nYou can also choose another organisation from the list and manually set these three variables by copying each of the three values and assigning them to their respective environment variables."
    },
    {
      "name": "Discover FILTERS, SORTING, PAGINATION Query Samples",
      "item": [
        {
          "name": "String, boolean, Enum Filter",
          "item": [
            {
              "name": "eq Q.journalTypes type = PURCHASE or code = different values",
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "X-OrganizationId",
                    "value": "{{X-OrganizationId}}"
                  },
                  {
                    "key": "x-api-key",
                    "value": "{{subscriptionKey}}"
                  }
                ],
                "body": {
                  "mode": "graphql",
                  "graphql": {
                    "query": "query {\r\n    journalTypes (\r\n        where: { \r\n            or: [\r\n             {type: {eq: PURCHASE_INVOICE}},\r\n             {code: {eq: \"VTE\"}},\r\n             {code: {eq: \"VNTS\"}},\r\n             {code: {eq: \"VKR\"}}\r\n            ]}\r\n    ){\r\n        edges {\r\n            node {\r\n               id\r\n               code\r\n               type\r\n               name\r\n            }\r\n        }\r\n        totalCount\r\n        pageInfo {\r\n            hasNextPage\r\n        }\r\n    }     \r\n}",
                    "variables": ""
                  }
                },
                "url": {
                  "raw": "{{baseAddress}}/graphql",
                  "host": [
                    "{{baseAddress}}"
                  ],
                  "path": [
                    "graphql"
                  ]
                }
              },
              "response": []
            },
            {
              "name": "eq Q.customers activated",
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "X-OrganizationId",
                    "value": "{{X-OrganizationId}}"
                  },
                  {
                    "key": "x-api-key",
                    "value": "{{subscriptionKey}}"
                  }
                ],
                "body": {
                  "mode": "graphql",
                  "graphql": {
                    "query": "query {\r\n    customers(\r\n        where: { \r\n            disabled: {eq:false}\r\n        }) {\r\n        edges {\r\n            node {\r\n                id\r\n                code\r\n                socialName\r\n                disabled\r\n                disabledDate                 \r\n            }\r\n        }\r\n        totalCount\r\n        pageInfo {\r\n            hasNextPage\r\n        }\r\n    }  \r\n}",
                    "variables": ""
                  }
                },
                "url": {
                  "raw": "{{baseAddress}}/graphql",
                  "host": [
                    "{{baseAddress}}"
                  ],
                  "path": [
                    "graphql"
                  ]
                }
              },
              "response": []
            },
            {
              "name": "neq Q.journalTypes type <> PURCHASE and code <> different values",
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "X-OrganizationId",
                    "value": "{{X-OrganizationId}}"
                  },
                  {
                    "key": "x-api-key",
                    "value": "{{subscriptionKey}}"
                  }
                ],
                "body": {
                  "mode": "graphql",
                  "graphql": {
                    "query": "query {\r\n    journalTypes (\r\n        where: { \r\n            and: [\r\n             {type: {neq: PURCHASE_INVOICE}},\r\n             {code: {neq: \"VTE\"}},\r\n             {code: {neq: \"VNTS\"}},\r\n             {code: {neq: \"VKR\"}},\r\n            ]}\r\n    ){\r\n        edges {\r\n            node {\r\n               id\r\n               code\r\n               type\r\n               name\r\n            }\r\n        }\r\n        totalCount\r\n        pageInfo {\r\n            hasNextPage\r\n        }\r\n    }     \r\n}",
                    "variables": ""
                  }
                },
                "url": {
                  "raw": "{{baseAddress}}/graphql",
                  "host": [
                    "{{baseAddress}}"
                  ],
                  "path": [
                    "graphql"
                  ]
                }
              },
              "response": []
            },
            {
              "name": "startsWith Q.accountingAccounts filtered by code starts with different values",
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "X-OrganizationId",
                    "value": "{{X-OrganizationId}}"
                  },
                  {
                    "key": "x-api-key",
                    "value": "{{subscriptionKey}}"
                  }
                ],
                "body": {
                  "mode": "graphql",
                  "graphql": {
                    "query": "query {\r\n    accountingAccounts (\r\n        order: [{ code: ASC }]\r\n        where: { \r\n            or: [\r\n             {code: {startsWith: \"601\"}},\r\n             {code: {startsWith: \"701\"}}\r\n             {code: {startsWith: \"450\"}}\r\n            ]}\r\n        first:50\r\n        ) {\r\n         \r\n        edges {\r\n            node {\r\n                code\r\n                name\r\n             }\r\n        }\r\n         \r\n        totalCount\r\n        pageInfo {\r\n            hasNextPage\r\n        }\r\n    }    \r\n}",
                    "variables": ""
                  }
                },
                "url": {
                  "raw": "{{baseAddress}}/graphql",
                  "host": [
                    "{{baseAddress}}"
                  ],
                  "path": [
                    "graphql"
                  ]
                }
              },
              "response": []
            },
            {
              "name": "nstartsWith Q.accountingAccounts filtered by code not start  with different values",
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "X-OrganizationId",
                    "value": "{{X-OrganizationId}}"
                  },
                  {
                    "key": "x-api-key",
                    "value": "{{subscriptionKey}}"
                  }
                ],
                "body": {
                  "mode": "graphql",
                  "graphql": {
                    "query": "query {\r\n    accountingAccounts (\r\n        order: [{ code: ASC }]\r\n        where: { \r\n            and: [\r\n             {code: {nstartsWith: \"601\"}},\r\n             {code: {nstartsWith: \"701\"}},\r\n             {code: {nstartsWith: \"450\"}}\r\n            ]}\r\n        first:50\r\n        ) {\r\n         \r\n        edges {\r\n            node {\r\n                code\r\n                name\r\n             }\r\n        }\r\n         \r\n        totalCount\r\n        pageInfo {\r\n            hasNextPage\r\n        }\r\n    }    \r\n}",
                    "variables": ""
                  }
                },
                "url": {
                  "raw": "{{baseAddress}}/graphql",
                  "host": [
                    "{{baseAddress}}"
                  ],
                  "path": [
                    "graphql"
                  ]
                }
              },
              "response": []
            },
            {
              "name": "endsWith Q.customers that have contacts with email ends with .fr, .es or .de",
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "X-OrganizationId",
                    "value": "{{X-OrganizationId}}"
                  },
                  {
                    "key": "x-api-key",
                    "value": "{{subscriptionKey}}"
                  }
                ],
                "body": {
                  "mode": "graphql",
                  "graphql": {
                    "query": "query {\r\n    customers(\r\n        first:100\r\n        where: { \r\n            contacts: {\r\n                some: { \r\n                    emails :{ \r\n                        some: { \r\n                            or: [\r\n                                { emailAddress: { endsWith: \".fr\" } },\r\n                                { emailAddress: { endsWith: \".es\" } },\r\n                                { emailAddress: { endsWith: \".de\" } }\r\n                            ]\r\n                        }\r\n                    }\r\n                }\r\n            }\r\n        }) {\r\n        edges {\r\n            node {\r\n                id\r\n                code\r\n                socialName\r\n                contacts {\r\n                    name\r\n                    surname\r\n                    emails  {\r\n                        emailAddress\r\n                    }\r\n                }              \r\n            }\r\n        }\r\n        totalCount\r\n        pageInfo {\r\n            hasNextPage\r\n        }\r\n    }  \r\n}\r\n",
                    "variables": ""
                  }
                },
                "url": {
                  "raw": "{{baseAddress}}/graphql",
                  "host": [
                    "{{baseAddress}}"
                  ],
                  "path": [
                    "graphql"
                  ]
                }
              },
              "response": []
            },
            {
              "name": "nendsWith Q.customers that have contacts with email not ends with .fr, .es and .de",
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "X-OrganizationId",
                    "value": "{{X-OrganizationId}}"
                  },
                  {
                    "key": "x-api-key",
                    "value": "{{subscriptionKey}}"
                  }
                ],
                "body": {
                  "mode": "graphql",
                  "graphql": {
                    "query": "query {\r\n    customers(\r\n        first:100\r\n        order: [{ code: ASC }]\r\n        where: { \r\n            contacts: {\r\n                none: { \r\n                    emails :{ \r\n                        none: { \r\n                              and: [\r\n                                { emailAddress: { nendsWith: \".fr\" } },\r\n                                { emailAddress: { nendsWith: \".es\" } },\r\n                                { emailAddress: { nendsWith: \".de\" } }\r\n                            ]\r\n                        }\r\n                    }\r\n                }\r\n            }\r\n        }) {\r\n        edges {\r\n            node {\r\n                id\r\n                code\r\n                socialName\r\n                contacts {\r\n                    emails  {\r\n                        emailAddress\r\n                    }\r\n                }              \r\n            }\r\n        }\r\n        totalCount\r\n        pageInfo {\r\n            hasNextPage\r\n        }\r\n    }  \r\n}",
                    "variables": ""
                  }
                },
                "url": {
                  "raw": "{{baseAddress}}/graphql",
                  "host": [
                    "{{baseAddress}}"
                  ],
                  "path": [
                    "graphql"
                  ]
                }
              },
              "response": []
            },
            {
              "name": "contains Q.accountingAccounts filtered by name containing 'immo' or 'inmo' or 'imma'",
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "X-OrganizationId",
                    "value": "{{X-OrganizationId}}"
                  },
                  {
                    "key": "x-api-key",
                    "value": "{{subscriptionKey}}"
                  }
                ],
                "body": {
                  "mode": "graphql",
                  "graphql": {
                    "query": "query {\r\n    accountingAccounts (\r\n        order: [{ code: ASC }]\r\n        where: { \r\n             or:[\r\n             {name: {contains: \"immo\"}},\r\n             {name: {contains: \"inmo\"}},\r\n             {name: {contains: \"imma\"}}\r\n             ]}\r\n        first:50\r\n        ) {\r\n         \r\n        edges {\r\n            node {\r\n                code\r\n                name\r\n             }\r\n        }\r\n         \r\n        totalCount\r\n        pageInfo {\r\n            hasNextPage\r\n        }\r\n    }    \r\n}",
                    "variables": ""
                  }
                },
                "url": {
                  "raw": "{{baseAddress}}/graphql",
                  "host": [
                    "{{baseAddress}}"
                  ],
                  "path": [
                    "graphql"
                  ]
                }
              },
              "response": []
            },
            {
              "name": "ncontains Q.accountingAccounts filtered by name not  containing 'immo' or 'inmo' or 'imma'",
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "X-OrganizationId",
                    "value": "{{X-OrganizationId}}"
                  },
                  {
                    "key": "x-api-key",
                    "value": "{{subscriptionKey}}"
                  }
                ],
                "body": {
                  "mode": "graphql",
                  "graphql": {
                    "query": "query {\r\n    accountingAccounts (\r\n        order: [{ code: ASC }]\r\n        where: { \r\n             or:[\r\n             {name: {ncontains: \"immo\"}},\r\n             {name: {ncontains: \"inmo\"}},\r\n             {name: {contains: \"imma\"}}\r\n             ]}\r\n        first:50\r\n        ) {\r\n         \r\n        edges {\r\n            node {\r\n                code\r\n                name\r\n             }\r\n        }\r\n         \r\n        totalCount\r\n        pageInfo {\r\n            hasNextPage\r\n        }\r\n    }    \r\n}",
                    "variables": ""
                  }
                },
                "url": {
                  "raw": "{{baseAddress}}/graphql",
                  "host": [
                    "{{baseAddress}}"
                  ],
                  "path": [
                    "graphql"
                  ]
                }
              },
              "response": []
            },
            {
              "name": "in Q.journalTypes type 'in' PURCHASE,SALES",
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "X-OrganizationId",
                    "value": "{{X-OrganizationId}}"
                  },
                  {
                    "key": "x-api-key",
                    "value": "{{subscriptionKey}}"
                  }
                ],
                "body": {
                  "mode": "graphql",
                  "graphql": {
                    "query": "query {\r\n    journalTypes (\r\n        where :{\r\n          type: { in: [PURCHASE_INVOICE, SALES_INVOICE]}\r\n        }\r\n    ){\r\n        edges {\r\n            node {\r\n               id\r\n               code\r\n               type\r\n               name\r\n            }\r\n        }\r\n        totalCount\r\n        pageInfo {\r\n            hasNextPage\r\n        }\r\n    }     \r\n}",
                    "variables": ""
                  }
                },
                "url": {
                  "raw": "{{baseAddress}}/graphql",
                  "host": [
                    "{{baseAddress}}"
                  ],
                  "path": [
                    "graphql"
                  ]
                }
              },
              "response": []
            },
            {
              "name": "nin Q.journalTypes type not 'in' PURCHASE,SALES",
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "X-OrganizationId",
                    "value": "{{X-OrganizationId}}"
                  },
                  {
                    "key": "x-api-key",
                    "value": "{{subscriptionKey}}"
                  }
                ],
                "body": {
                  "mode": "graphql",
                  "graphql": {
                    "query": "query {\r\n    journalTypes (\r\n        where :{\r\n          type: { nin: [PURCHASE_INVOICE, SALES_INVOICE]}\r\n        }\r\n    ){\r\n        edges {\r\n            node {\r\n               id\r\n               code\r\n               type\r\n               name\r\n            }\r\n        }\r\n        totalCount\r\n        pageInfo {\r\n            hasNextPage\r\n        }\r\n    }     \r\n}",
                    "variables": ""
                  }
                },
                "url": {
                  "raw": "{{baseAddress}}/graphql",
                  "host": [
                    "{{baseAddress}}"
                  ],
                  "path": [
                    "graphql"
                  ]
                }
              },
              "response": []
            }
          ]
        },
        {
          "name": "Comparable Filter",
          "item": [
            {
              "name": "eq Q.accountingAccounts 50 first, with Tax Code equal null, sort by code",
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "X-OrganizationId",
                    "value": "{{X-OrganizationId}}"
                  },
                  {
                    "key": "x-api-key",
                    "value": "{{subscriptionKey}}"
                  }
                ],
                "body": {
                  "mode": "graphql",
                  "graphql": {
                    "query": "query {\r\n    accountingAccounts (\r\n        order: [{ code: ASC }]\r\n        where: { taxTreatmentId: {  eq:null } }\r\n        first:50\r\n        ) {\r\n         \r\n        edges {\r\n            node {\r\n                code\r\n                name\r\n                taxTreatmentId\r\n             }\r\n            cursor\r\n        }\r\n         \r\n        totalCount\r\n        pageInfo {\r\n            endCursor\r\n            hasNextPage\r\n        }\r\n    }    \r\n}",
                    "variables": ""
                  }
                },
                "url": {
                  "raw": "{{baseAddress}}/graphql",
                  "host": [
                    "{{baseAddress}}"
                  ],
                  "path": [
                    "graphql"
                  ]
                }
              },
              "response": []
            },
            {
              "name": "eq Q.accountingEntries Suppliers date=2025-03-10",
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "X-OrganizationId",
                    "value": "{{X-OrganizationId}}"
                  },
                  {
                    "key": "x-api-key",
                    "value": "{{subscriptionKey}}"
                  }
                ],
                "body": {
                  "mode": "graphql",
                  "graphql": {
                    "query": "query {\r\n    accountingEntries (\r\n        where :{\r\n          date: { eq: \"2025-03-10\"}, \r\n          accountingEntryLines : {\r\n         \r\n                some: { \r\n                    accountingEntryThirdParty: { origin: { eq: SUPPLIER } }              \r\n                }\r\n          }\r\n        }\r\n        ){ \r\n        edges {\r\n            node {\r\n                id\r\n                date\r\n                number\r\n                description         \r\n                accountingEntryLines {\r\n                    debitAmount\r\n                    accountingEntryThirdParty{\r\n                        code\r\n                    }\r\n                }\r\n            }\r\n        }\r\n        totalCount\r\n        pageInfo {\r\n            hasNextPage\r\n        }\r\n    }     \r\n}",
                    "variables": ""
                  }
                },
                "url": {
                  "raw": "{{baseAddress}}/graphql",
                  "host": [
                    "{{baseAddress}}"
                  ],
                  "path": [
                    "graphql"
                  ]
                }
              },
              "response": []
            },
            {
              "name": "neq Q.accountingAccounts 50 first, with Tax Code not equal null, sort by code",
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "X-OrganizationId",
                    "value": "{{X-OrganizationId}}"
                  },
                  {
                    "key": "x-api-key",
                    "value": "{{subscriptionKey}}"
                  }
                ],
                "body": {
                  "mode": "graphql",
                  "graphql": {
                    "query": "query {\r\n    accountingAccounts (\r\n        order: [{ code: ASC }]\r\n        where: { taxTreatmentId: {  neq:null } }\r\n        first:50\r\n        ) {\r\n         \r\n        edges {\r\n            node {\r\n                code\r\n                name\r\n                taxTreatmentId\r\n             }\r\n            cursor\r\n        }\r\n         \r\n        totalCount\r\n        pageInfo {\r\n            endCursor\r\n            hasNextPage\r\n        }\r\n    }    \r\n}",
                    "variables": ""
                  }
                },
                "url": {
                  "raw": "{{baseAddress}}/graphql",
                  "host": [
                    "{{baseAddress}}"
                  ],
                  "path": [
                    "graphql"
                  ]
                }
              },
              "response": []
            },
            {
              "name": "in Q.accountingEntries with a debit line equal to 1000 or 500",
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "X-OrganizationId",
                    "value": "{{X-OrganizationId}}"
                  },
                  {
                    "key": "x-api-key",
                    "value": "{{subscriptionKey}}"
                  }
                ],
                "body": {
                  "mode": "graphql",
                  "graphql": {
                    "query": "query {\r\n    accountingEntries (\r\n        where :{\r\n          accountingEntryLines : { \r\n                some: { \r\n                  debitAmount: { in: [1000, 500]}\r\n                }\r\n          }\r\n        }\r\n        ){ \r\n        edges {\r\n            node {\r\n                id\r\n                journalTypeId\r\n                date\r\n                number                       \r\n                accountingEntryLines {\r\n                    description\r\n                    debitAmount\r\n                }\r\n            }\r\n        }\r\n        totalCount\r\n        pageInfo {\r\n            hasNextPage\r\n        }\r\n    }     \r\n}",
                    "variables": ""
                  }
                },
                "url": {
                  "raw": "{{baseAddress}}/graphql",
                  "host": [
                    "{{baseAddress}}"
                  ],
                  "path": [
                    "graphql"
                  ]
                }
              },
              "response": []
            },
            {
              "name": "nin Q.accountingEntries debit not equal to 1000 and 500",
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "X-OrganizationId",
                    "value": "{{X-OrganizationId}}"
                  },
                  {
                    "key": "x-api-key",
                    "value": "{{subscriptionKey}}"
                  }
                ],
                "body": {
                  "mode": "graphql",
                  "graphql": {
                    "query": "query {\r\n    accountingEntries (\r\n        where :{\r\n          accountingEntryLines : { \r\n                all: { \r\n                  debitAmount: { nin: [1000, 500]}\r\n                }\r\n          }\r\n        }\r\n        ){ \r\n        edges {\r\n            node {\r\n                id\r\n                date\r\n                number     \r\n                accountingEntryLines {\r\n                    description\r\n                    debitAmount\r\n                }\r\n            }\r\n        }\r\n        totalCount\r\n        pageInfo {\r\n            hasNextPage\r\n        }\r\n    }     \r\n}",
                    "variables": ""
                  }
                },
                "url": {
                  "raw": "{{baseAddress}}/graphql",
                  "host": [
                    "{{baseAddress}}"
                  ],
                  "path": [
                    "graphql"
                  ]
                }
              },
              "response": []
            },
            {
              "name": "gt, lt Q.accountingEntries customer debit >1000 & <2000",
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "X-OrganizationId",
                    "value": "{{X-OrganizationId}}"
                  },
                  {
                    "key": "x-api-key",
                    "value": "{{subscriptionKey}}"
                  }
                ],
                "body": {
                  "mode": "graphql",
                  "graphql": {
                    "query": "query {\r\n    accountingEntries (\r\n        where :{\r\n          accountingEntryLines : { \r\n                some: { \r\n                    and: [\r\n                        {debitAmount: { gt: 1000}},\r\n                        {debitAmount: { lt: 2000}},\r\n                        {accountingEntryThirdParty: { origin: { eq: CUSTOMER } } }\r\n                    ]                \r\n                }\r\n          }\r\n        }\r\n        ){ \r\n        edges {\r\n            node {\r\n                id\r\n                date\r\n                number         \r\n                accountingEntryLines {\r\n                    description\r\n                    debitAmount\r\n                    accountingEntryThirdParty{\r\n                        code\r\n                    }\r\n                }\r\n            }\r\n        }\r\n        totalCount\r\n        pageInfo {\r\n            hasNextPage\r\n        }\r\n    }     \r\n}",
                    "variables": ""
                  }
                },
                "url": {
                  "raw": "{{baseAddress}}/graphql",
                  "host": [
                    "{{baseAddress}}"
                  ],
                  "path": [
                    "graphql"
                  ]
                }
              },
              "response": []
            },
            {
              "name": "gte, lte Q.accountingEntries customer  debit >=1000 & <=2000",
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "X-OrganizationId",
                    "value": "{{X-OrganizationId}}"
                  },
                  {
                    "key": "x-api-key",
                    "value": "{{subscriptionKey}}"
                  }
                ],
                "body": {
                  "mode": "graphql",
                  "graphql": {
                    "query": "query {\r\n    accountingEntries (\r\n        where :{\r\n          accountingEntryLines : { \r\n                some: { \r\n                    and: [\r\n                        {debitAmount: { gte: 1000}},\r\n                        {debitAmount: { lte: 2000}},\r\n                        {accountingEntryThirdParty: { origin: { eq: CUSTOMER } } }\r\n                    ]                \r\n                }\r\n          }\r\n        }\r\n        ){ \r\n        edges {\r\n            node {\r\n                id\r\n                date\r\n                number     \r\n                accountingEntryLines {\r\n                    description\r\n                    debitAmount\r\n                    accountingEntryThirdParty{\r\n                        code\r\n                    }\r\n                }\r\n            }\r\n        }\r\n        totalCount\r\n        pageInfo {\r\n            hasNextPage\r\n        }\r\n    }     \r\n}",
                    "variables": ""
                  }
                },
                "url": {
                  "raw": "{{baseAddress}}/graphql",
                  "host": [
                    "{{baseAddress}}"
                  ],
                  "path": [
                    "graphql"
                  ]
                }
              },
              "response": []
            },
            {
              "name": "gte, lte Q.accountingEntries third date>=2025-03-01 & <=2025-03-31",
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "X-OrganizationId",
                    "value": "{{X-OrganizationId}}"
                  },
                  {
                    "key": "x-api-key",
                    "value": "{{subscriptionKey}}"
                  }
                ],
                "body": {
                  "mode": "graphql",
                  "graphql": {
                    "query": "query {\r\n    accountingEntries (\r\n        where :{\r\n          date: { gte: \"2025-03-01\", lte: \"2025-03-31\" }, \r\n          accountingEntryLines : {\r\n         \r\n                some: { \r\n                    accountingEntryThirdParty: { code: { neq: null } }              \r\n                }\r\n          }\r\n        }\r\n        ){ \r\n        edges {\r\n            node {\r\n                id\r\n                date\r\n                number                       \r\n                accountingEntryLines {\r\n                    description\r\n                    debitAmount\r\n                    accountingEntryThirdParty{\r\n                        origin\r\n                        code\r\n                    }\r\n                }\r\n            }\r\n        }\r\n        totalCount\r\n        pageInfo {\r\n            hasNextPage\r\n        }\r\n    }     \r\n}",
                    "variables": ""
                  }
                },
                "url": {
                  "raw": "{{baseAddress}}/graphql",
                  "host": [
                    "{{baseAddress}}"
                  ],
                  "path": [
                    "graphql"
                  ]
                }
              },
              "response": []
            }
          ]
        },
        {
          "name": "Sorting",
          "item": [
            {
              "name": "Q.accountingAccounts filtered by name containing 'immo' or 'inmo' ordering by Name asc",
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "X-OrganizationId",
                    "value": "{{X-OrganizationId}}"
                  },
                  {
                    "key": "x-api-key",
                    "value": "{{subscriptionKey}}"
                  }
                ],
                "body": {
                  "mode": "graphql",
                  "graphql": {
                    "query": "query {\r\n    accountingAccounts (\r\n        order: [{ name: ASC }]\r\n        where: { \r\n            or:[\r\n             {name: {contains: \"immo\"}},\r\n             {name: {contains: \"inmo\"}}\r\n             ]}\r\n        first:50\r\n        ) {\r\n         \r\n        edges {\r\n            node {\r\n                code\r\n                name\r\n             }\r\n        }\r\n         \r\n        totalCount\r\n        pageInfo {\r\n            hasNextPage\r\n        }\r\n    }    \r\n}",
                    "variables": ""
                  }
                },
                "url": {
                  "raw": "{{baseAddress}}/graphql",
                  "host": [
                    "{{baseAddress}}"
                  ],
                  "path": [
                    "graphql"
                  ]
                }
              },
              "response": []
            },
            {
              "name": "Q.users filter latsName or firstName  containswith a, j or b, ordering by lastName and firstName asc",
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "X-OrganizationId",
                    "value": "{{X-OrganizationId}}"
                  },
                  {
                    "key": "x-api-key",
                    "value": "{{subscriptionKey}}"
                  }
                ],
                "body": {
                  "mode": "graphql",
                  "graphql": {
                    "query": "{\r\n  users(\r\n    order: [\r\n      { lastName: ASC }\r\n      { firstName: ASC }\r\n    ]\r\n    where: {\r\n      or: [\r\n        { lastName: { contains: \"a\" } }\r\n        { firstName: { contains: \"a\" } }\r\n        { lastName: { contains: \"j\" } }\r\n        { firstName: { contains: \"j\" } }\r\n        { lastName: { contains: \"b\" } }\r\n        { firstName: { contains: \"b\" } }\r\n      ]\r\n    }\r\n  ) {\r\n    edges {\r\n      node {\r\n        id\r\n        lastName\r\n        firstName\r\n        fullName\r\n      }\r\n    }\r\n    totalCount\r\n    pageInfo {\r\n      hasNextPage\r\n    }\r\n  }\r\n}",
                    "variables": ""
                  }
                },
                "url": {
                  "raw": "{{baseAddress}}/graphql",
                  "host": [
                    "{{baseAddress}}"
                  ],
                  "path": [
                    "graphql"
                  ]
                }
              },
              "response": []
            },
            {
              "name": "Q.accountingEntries third date>=2025-03-01  <=2025-03-31 ordering by Date desc",
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "X-OrganizationId",
                    "value": "{{X-OrganizationId}}"
                  },
                  {
                    "key": "x-api-key",
                    "value": "{{subscriptionKey}}"
                  }
                ],
                "body": {
                  "mode": "graphql",
                  "graphql": {
                    "query": "query {\r\n    accountingEntries (\r\n        order: {date:DESC}\r\n        where :{\r\n          date: { gte: \"2025-03-01\", lte: \"2025-03-31\" }, \r\n          accountingEntryLines : {\r\n         \r\n                some: { \r\n                    accountingEntryThirdParty: { code: { neq: null } }              \r\n                }\r\n          }\r\n        }\r\n        ){ \r\n        edges {\r\n            node {\r\n                id\r\n                date\r\n                number                       \r\n                accountingEntryLines  {\r\n                    description\r\n                    debitAmount\r\n                    accountingEntryThirdParty{\r\n                        origin\r\n                        code\r\n                    }\r\n                }\r\n            }\r\n        }\r\n        totalCount\r\n        pageInfo {\r\n            hasNextPage\r\n        }\r\n    }     \r\n}",
                    "variables": ""
                  }
                },
                "url": {
                  "raw": "{{baseAddress}}/graphql",
                  "host": [
                    "{{baseAddress}}"
                  ],
                  "path": [
                    "graphql"
                  ]
                }
              },
              "response": []
            }
          ]
        },
        {
          "name": "Pagination",
          "item": [
            {
              "name": "Q.accountingAccounts pagination, first 5 {{endCursor / startCursor}} filled in",
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "exec": [
                      "pm.test(\"Variables creation\", function () {\r",
                      " \r",
                      "    let jsd = pm.response.json();\r",
                      "    pm.environment.set(\"endCursor\", jsd.data.accountingAccounts.pageInfo.endCursor);\r",
                      "    console.log(\"'endCursor' environment variable has been created : \" + pm.environment.get(\"endCursor\"));\r",
                      "    pm.environment.set(\"startCursor\", jsd.data.accountingAccounts.pageInfo.startCursor);\r",
                      "    console.log(\"'startCursor' environment variable has been created : \" + pm.environment.get(\"startCursor\"));\r",
                      "});\r",
                      ""
                    ],
                    "type": "text/javascript"
                  }
                }
              ],
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "X-OrganizationId",
                    "value": "{{X-OrganizationId}}"
                  },
                  {
                    "key": "x-api-key",
                    "value": "{{subscriptionKey}}"
                  }
                ],
                "body": {
                  "mode": "graphql",
                  "graphql": {
                    "query": "query {\r\n    accountingAccounts (\r\n        order:{code:ASC}\r\n        first: 5\r\n        ) {\r\n        edges {\r\n            node {\r\n                id\r\n                code\r\n                description\r\n            }\r\n            cursor\r\n        }\r\n        totalCount\r\n        pageInfo {\r\n            startCursor\r\n            endCursor\r\n            hasNextPage\r\n            hasPreviousPage\r\n        }\r\n    }     \r\n}",
                    "variables": ""
                  }
                },
                "url": {
                  "raw": "{{baseAddress}}/graphql",
                  "host": [
                    "{{baseAddress}}"
                  ],
                  "path": [
                    "graphql"
                  ]
                }
              },
              "response": []
            },
            {
              "name": "next 5 (try several \"Send\")",
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "exec": [
                      "pm.test(\"Variables creation\", function () {\r",
                      " \r",
                      "    let jsd = pm.response.json();\r",
                      "    pm.environment.set(\"endCursor\", jsd.data.accountingAccounts.pageInfo.endCursor);\r",
                      "    console.log(\"'endCursor' environment variable has been created : \" + pm.environment.get(\"endCursor\"));\r",
                      "    pm.environment.set(\"startCursor\", jsd.data.accountingAccounts.pageInfo.startCursor);\r",
                      "    console.log(\"'startCursor' environment variable has been created : \" + pm.environment.get(\"startCursor\"));\r",
                      "});\r",
                      ""
                    ],
                    "type": "text/javascript"
                  }
                }
              ],
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "X-OrganizationId",
                    "value": "{{X-OrganizationId}}"
                  },
                  {
                    "key": "x-api-key",
                    "value": "{{subscriptionKey}}"
                  }
                ],
                "body": {
                  "mode": "graphql",
                  "graphql": {
                    "query": "query ($endCursor:String!) {\r\n    accountingAccounts (\r\n        order:{code:ASC}\r\n        first: 5\r\n        after: $endCursor\r\n        ) {\r\n        edges {\r\n            node {\r\n                id\r\n                code\r\n                description\r\n            }\r\n            cursor\r\n        }\r\n        totalCount\r\n        pageInfo {\r\n            startCursor\r\n            endCursor\r\n            hasNextPage\r\n            hasPreviousPage\r\n        }\r\n    }     \r\n}",
                    "variables": "{\r\n    \"endCursor\":\"{{endCursor}}\"\r\n}"
                  }
                },
                "url": {
                  "raw": "{{baseAddress}}/graphql",
                  "host": [
                    "{{baseAddress}}"
                  ],
                  "path": [
                    "graphql"
                  ]
                }
              },
              "response": []
            },
            {
              "name": "previous 5 (try several \"Send\")",
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "exec": [
                      "pm.test(\"Variables creation\", function () {\r",
                      " \r",
                      "    let jsd = pm.response.json();\r",
                      "    pm.environment.set(\"endCursor\", jsd.data.accountingAccounts.pageInfo.endCursor);\r",
                      "    console.log(\"'endCursor' environment variable has been created : \" + pm.environment.get(\"endCursor\"));\r",
                      "    pm.environment.set(\"startCursor\", jsd.data.accountingAccounts.pageInfo.startCursor);\r",
                      "    console.log(\"'startCursor' environment variable has been created : \" + pm.environment.get(\"startCursor\"));\r",
                      "});\r",
                      ""
                    ],
                    "type": "text/javascript"
                  }
                }
              ],
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "X-OrganizationId",
                    "value": "{{X-OrganizationId}}"
                  },
                  {
                    "key": "x-api-key",
                    "value": "{{subscriptionKey}}"
                  }
                ],
                "body": {
                  "mode": "graphql",
                  "graphql": {
                    "query": "query ($startCursor:String!) {\r\n    accountingAccounts (\r\n        order:{code:ASC}\r\n        last: 5\r\n        before: $startCursor\r\n        ) {\r\n        edges {\r\n            node {\r\n                id\r\n                code\r\n                description\r\n            }\r\n            cursor\r\n        }\r\n        totalCount\r\n        pageInfo {\r\n            startCursor\r\n            endCursor\r\n            hasNextPage\r\n            hasPreviousPage\r\n        }\r\n    }     \r\n}",
                    "variables": "{\r\n    \"startCursor\":\"{{startCursor}}\"\r\n}"
                  }
                },
                "url": {
                  "raw": "{{baseAddress}}/graphql",
                  "host": [
                    "{{baseAddress}}"
                  ],
                  "path": [
                    "graphql"
                  ]
                }
              },
              "response": []
            }
          ]
        },
        {
          "name": "Fragment",
          "item": [
            {
              "name": "Q.users using fragment",
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "X-OrganizationId",
                    "value": "{{X-OrganizationId}}"
                  },
                  {
                    "key": "x-api-key",
                    "value": "{{subscriptionKey}}"
                  }
                ],
                "body": {
                  "mode": "graphql",
                  "graphql": {
                    "query": "query {\r\n    users  {\r\n        edges {\r\n            node {\r\n                ...UserProps\r\n            }\r\n        }\r\n        totalCount\r\n        pageInfo {\r\n            hasNextPage\r\n        }\r\n    }     \r\n}\r\n\r\nfragment UserProps on User {\r\n    id\r\n    fullName\r\n    authenticationEmail\r\n    applicationLanguageCode\r\n}",
                    "variables": ""
                  }
                },
                "url": {
                  "raw": "{{baseAddress}}/graphql",
                  "host": [
                    "{{baseAddress}}"
                  ],
                  "path": [
                    "graphql"
                  ]
                }
              },
              "response": []
            },
            {
              "name": "Q.customers using fragment that have contacts with email ends with .fr or .es",
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "X-OrganizationId",
                    "value": "{{X-OrganizationId}}"
                  },
                  {
                    "key": "x-api-key",
                    "value": "{{subscriptionKey}}"
                  }
                ],
                "body": {
                  "mode": "graphql",
                  "graphql": {
                    "query": "query {\r\n    customers(\r\n        first:100\r\n        where: { \r\n            contacts: {\r\n                some: { \r\n                    emails :{ \r\n                        some: { \r\n                            or:[\r\n                            {emailAddress: { endsWith: \".fr\" }},\r\n                            {emailAddress: { endsWith: \".es\" }},\r\n                            ]\r\n                        }\r\n                    }\r\n                }\r\n            }\r\n        }) {\r\n        edges {\r\n            node {\r\n                ...customerProp             \r\n            }\r\n        }\r\n        totalCount\r\n        pageInfo {\r\n            hasNextPage\r\n        }\r\n    }  \r\n}\r\n\r\nfragment customerProp on Customer{\r\n      id\r\n                code\r\n                socialName\r\n                contacts {\r\n                    name\r\n                    surname\r\n                    emails  {\r\n                        emailAddress\r\n                    }\r\n                }        \r\n}",
                    "variables": ""
                  }
                },
                "url": {
                  "raw": "{{baseAddress}}/graphql",
                  "host": [
                    "{{baseAddress}}"
                  ],
                  "path": [
                    "graphql"
                  ]
                }
              },
              "response": []
            }
          ]
        },
        {
          "name": "Multi queries",
          "item": [
            {
              "name": "Multi queries to get different values",
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "exec": [
                      ""
                    ],
                    "type": "text/javascript",
                    "packages": {}
                  }
                }
              ],
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "X-OrganizationId",
                    "value": "{{X-OrganizationId}}"
                  },
                  {
                    "key": "x-api-key",
                    "value": "{{subscriptionKey}}"
                  }
                ],
                "body": {
                  "mode": "graphql",
                  "graphql": {
                    "query": "query {\r\n    accountingExercises(\r\n        where: {status: {eq: OPEN}}\r\n        last:1\r\n        ) {\r\n        edges {\r\n            node {\r\n               startDate\r\n            }\r\n        }\r\n    },\r\n      journalTypes(\r\n         where: {type: {eq: SALES_INVOICE}}\r\n         first:1) {\r\n        edges {\r\n            node {\r\n               code\r\n               name\r\n               id\r\n            }\r\n        }\r\n    },\r\n       documentTypes (where : { code : { eq : \"01\" }}) {\r\n        edges {\r\n            node {\r\n                id\r\n                code\r\n                name\r\n                legislationCode\r\n            }\r\n        }\r\n    },\r\n        customers (\r\n        where: {\r\n            code: {eq:\"CARAT\"}\r\n            disabled: {eq: false}\r\n            }\r\n        first:1\r\n        ) {\r\n        edges {\r\n            node {\r\n                  id\r\n                  code\r\n                  socialName\r\n                  defaultAccountingAccountId\r\n            }\r\n        }\r\n        }\r\n}         \r\n\r\n\r\n",
                    "variables": ""
                  }
                },
                "url": {
                  "raw": "{{baseAddress}}/graphql",
                  "host": [
                    "{{baseAddress}}"
                  ],
                  "path": [
                    "graphql"
                  ]
                }
              },
              "response": []
            }
          ]
        },
        {
          "name": "Other filter examples",
          "item": [
            {
              "name": "Q.accountingEntries which have third parties",
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "X-OrganizationId",
                    "value": "{{X-OrganizationId}}"
                  },
                  {
                    "key": "x-api-key",
                    "value": "{{subscriptionKey}}"
                  }
                ],
                "body": {
                  "mode": "graphql",
                  "graphql": {
                    "query": "query {\r\n    accountingEntries (where: { accountingEntryLines : {  some: { accountingEntryThirdParty:  { code: { neq: null } } }}}) {\r\n        edges {\r\n            node {    \r\n                journalTypeId        \r\n                date\r\n                number         \r\n                accountingEntryLines  {    \r\n                    description               \r\n                    creditAmount\r\n                    debitAmount\r\n                    accountingEntryThirdParty {\r\n                        code\r\n                        socialName\r\n                        thirdPartyId\r\n                    }\r\n                    accountingEntryInvoice {\r\n                        documentDate\r\n                        externalInvoiceNumber\r\n                    }\r\n                }\r\n            }\r\n        }\r\n        totalCount\r\n        pageInfo {\r\n            hasNextPage\r\n        }\r\n    }     \r\n}",
                    "variables": ""
                  }
                },
                "url": {
                  "raw": "{{baseAddress}}/graphql",
                  "host": [
                    "{{baseAddress}}"
                  ],
                  "path": [
                    "graphql"
                  ]
                }
              },
              "response": []
            },
            {
              "name": "Q.accountingEntries Filter by Invoice number contains 'DCH'",
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "X-OrganizationId",
                    "value": "{{X-OrganizationId}}"
                  },
                  {
                    "key": "x-api-key",
                    "value": "{{subscriptionKey}}"
                  }
                ],
                "body": {
                  "mode": "graphql",
                  "graphql": {
                    "query": "query {\r\n    accountingEntries (\r\n        where: { \r\n            accountingEntryLines : { \r\n                some: { \r\n                    accountingEntryInvoice: { externalInvoiceNumber: { contains: \"DCH\" } } \r\n                    }\r\n                }\r\n            }) { \r\n        edges {\r\n            node {\r\n                id\r\n                date\r\n                number         \r\n                accountingEntryLines {\r\n                    description\r\n                    debitAmount\r\n                    creditAmount\r\n                    accountingEntryThirdParty{\r\n                        code\r\n                    }\r\n                     accountingEntryInvoice {\r\n                        externalInvoiceNumber\r\n                     }\r\n                }\r\n            }\r\n        }\r\n        totalCount\r\n        pageInfo {\r\n            hasNextPage\r\n        }\r\n    }     \r\n}",
                    "variables": ""
                  }
                },
                "url": {
                  "raw": "{{baseAddress}}/graphql",
                  "host": [
                    "{{baseAddress}}"
                  ],
                  "path": [
                    "graphql"
                  ]
                }
              },
              "response": []
            },
            {
              "name": "Q.customers that have at least a phone different than mobile",
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "X-OrganizationId",
                    "value": "{{X-OrganizationId}}"
                  },
                  {
                    "key": "x-api-key",
                    "value": "{{subscriptionKey}}"
                  }
                ],
                "body": {
                  "mode": "graphql",
                  "graphql": {
                    "query": "query {\r\n    customers(where: { contacts: { some: { phones: { some: { type: { neq: MOBILE }}}}}}) {\r\n        edges {\r\n            node {\r\n                id\r\n                code\r\n                socialName\r\n                contacts {\r\n                    name\r\n                    surname\r\n                    isDefault\r\n                    phones  {\r\n                        type\r\n                        number\r\n                    }\r\n                }              \r\n            }\r\n        }\r\n        totalCount\r\n        pageInfo {\r\n            hasNextPage\r\n        }\r\n    }  \r\n}",
                    "variables": ""
                  }
                },
                "url": {
                  "raw": "{{baseAddress}}/graphql",
                  "host": [
                    "{{baseAddress}}"
                  ],
                  "path": [
                    "graphql"
                  ]
                }
              },
              "response": []
            }
          ]
        }
      ]
    },
    {
      "name": "Discover DATA LOADER Query Samples",
      "item": [
        {
          "name": "Q.AccountingEntry - Journal entries for a journal and a month",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "X-OrganizationId",
                "value": "{{X-OrganizationId}}"
              },
              {
                "key": "x-api-key",
                "value": "{{subscriptionKey}}"
              }
            ],
            "body": {
              "mode": "graphql",
              "graphql": {
                "query": "## Thanks to the new logic of data loaders, it's possible to expose, filter, or sort fields in child subresources or parent subresources.\r\n## Here's a query to retrieve the journal entries for two journals for one month ordered by journal code and then by date.\r\n\r\nquery {\r\n    accountingEntries(\r\n        first:100\r\n        where: {\r\n            and: [\r\n                {\r\n                    or: [\r\n                        {journalType: {type:{eq: SALES_INVOICE}}},\r\n                        {journalType: {type:{eq:PURCHASE_INVOICE}}}\r\n                    ]\r\n                },\r\n                {date: {gte: \"2021-01-01\", lte: \"2025-01-31\"}}\r\n            ]\r\n        }\r\n          order: [{ journalType:{code: ASC }}, { date: ASC }]\r\n    ) {\r\n        edges {\r\n            node {\r\n                date\r\n                number \r\n                journalType{\r\n                    code\r\n                    name\r\n                }                       \r\n                accountingEntryLines {\r\n                    subAccount{\r\n                        code\r\n                        name\r\n                    }\r\n                    description\r\n                    debitAmount\r\n                    creditAmount\r\n                    order\r\n                    accountingEntryThirdParty {\r\n                        code\r\n                        socialName\r\n                    }\r\n                    accountingEntryInvoice {                 \r\n                        externalInvoiceNumber \r\n                        openItems{\r\n                            dueDate\r\n                            status\r\n                            paidAmountAccumulated\r\n                        }                 \r\n                    }\r\n                }\r\n            }\r\n        }\r\n        totalCount\r\n        pageInfo {\r\n            hasNextPage\r\n        }\r\n    }     \r\n}\r\n",
                "variables": ""
              }
            },
            "url": {
              "raw": "{{baseAddress}}/graphql",
              "host": [
                "{{baseAddress}}"
              ],
              "path": [
                "graphql"
              ]
            }
          },
          "response": []
        },
        {
          "name": "Q.AccountingEntry - Q.Third Party Ledger",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "X-OrganizationId",
                "value": "{{X-OrganizationId}}"
              },
              {
                "key": "x-api-key",
                "value": "{{subscriptionKey}}"
              }
            ],
            "body": {
              "mode": "graphql",
              "graphql": {
                "query": "\r\n## Thanks to the new logic of data loaders, it's possible to expose, filter, or sort fields in child subresources or parent subresources.\r\n## Here is a query to retrieve the Third-Party Ledger lines not lettered for a customer for a month.\r\n\r\nquery {\r\n    accountingEntryLines(\r\n        first:100\r\n        where: {\r\n        and: [\r\n           {accountingEntryPayment:{matchingLetter:{eq: null}}}\r\n           {accountingEntryThirdParty:  { socialName:{eq: \"Carat S.a.r.l\" }}}\r\n           {accountingEntry:{date: {gte: \"2021-01-01\", lte: \"2025-03-31\"}}}\r\n        ]\r\n      }\r\n       order: [{ accountingEntry:{date: ASC }}]\r\n    )\r\n\r\n     {\r\n        edges {\r\n            node {\r\n                accountingEntry{\r\n                    date\r\n                    number\r\n                    journalType{\r\n                        code\r\n                        name\r\n                    }\r\n                }\r\n                accountingEntryPayment{\r\n                    matching\r\n                }\r\n\r\n                description\r\n                debitAmount\r\n                creditAmount\r\n            }\r\n        }\r\n        totalCount\r\n        pageInfo {\r\n            hasNextPage\r\n        }\r\n    }     \r\n}\r\n",
                "variables": ""
              }
            },
            "url": {
              "raw": "{{baseAddress}}/graphql",
              "host": [
                "{{baseAddress}}"
              ],
              "path": [
                "graphql"
              ]
            }
          },
          "response": []
        },
        {
          "name": "Q.AccountingEntry - Q.General Ledger",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "X-OrganizationId",
                "value": "{{X-OrganizationId}}"
              },
              {
                "key": "x-api-key",
                "value": "{{subscriptionKey}}"
              }
            ],
            "body": {
              "mode": "graphql",
              "graphql": {
                "query": "\r\n## Thanks to the new logic of data loaders, it's possible to expose, filter, or sort fields in child subresources or parent subresources.\r\n## Here a query to retrieve the General ledger lines for a month\r\n\r\nquery {\r\n    accountingEntryLines(\r\n        first:100\r\n        where: {\r\n        and: [       \r\n           {accountingEntry:{date: {gte: \"2021-01-01\", lte: \"2025-01-31\"}}}\r\n        ]\r\n      }\r\n        order: [\r\n            {subAccount: {code: ASC}},\r\n            {accountingEntry: {date: ASC}}\r\n            {accountingEntry:{journalType:{code: ASC }}}\r\n        ]\r\n    )\r\n\r\n     {\r\n        edges {\r\n            node {\r\n                subAccount{\r\n                    code\r\n                    name\r\n                }\r\n                accountingEntry{\r\n                    date\r\n                    number\r\n                    journalType{\r\n                        code\r\n                        name\r\n                    }\r\n                }\r\n                accountingEntryThirdParty{\r\n                    code\r\n                }\r\n                description\r\n                debitAmount\r\n                creditAmount\r\n            }\r\n        }\r\n        totalCount\r\n        pageInfo {\r\n            hasNextPage\r\n        }\r\n    }     \r\n}\r\n",
                "variables": ""
              }
            },
            "url": {
              "raw": "{{baseAddress}}/graphql",
              "host": [
                "{{baseAddress}}"
              ],
              "path": [
                "graphql"
              ]
            }
          },
          "response": []
        },
        {
          "name": "Q.AccountingEntry - All Pending Customer Open Items by Due Date",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "X-OrganizationId",
                "value": "{{X-OrganizationId}}"
              },
              {
                "key": "x-api-key",
                "value": "{{subscriptionKey}}"
              }
            ],
            "body": {
              "mode": "graphql",
              "graphql": {
                "query": "query {\r\n    accountingEntryLines(\r\n        where: {\r\n          and: [\r\n            {accountingEntry: {date: {gte: \"2024-01-01\", lte: \"2027-12-31\"}}},\r\n            {accountingEntry: {journalType: {type: {eq: SALES_INVOICE}}}},\r\n            {accountingEntryThirdParty: {code: {neq: null}}}\r\n            {accountingEntryInvoice: {openItems: {some: {status: {in: [NOT_SPECIFIED, PARTIAL, ]}}}}}\r\n          ]\r\n        }\r\n        order: [\r\n            {accountingEntry: {journalType: {code: ASC}}}\r\n            {accountingEntry: {date: ASC}},\r\n        ]\r\n    ) {\r\n        edges {\r\n            node {\r\n                accountingEntryThirdParty{\r\n                    code\r\n                    socialName\r\n                }\r\n                accountingEntryInvoice{\r\n                    externalInvoiceNumber\r\n                    openItems{\r\n                        id\r\n                        status\r\n                        amount\r\n                        dueDate\r\n                        paidAmountAccumulated\r\n                        paymentMean{\r\n                            description\r\n                        }\r\n                    }\r\n                }\r\n            }\r\n        }\r\n        totalCount\r\n        pageInfo {\r\n            hasNextPage\r\n        }\r\n    }     \r\n}\r\n",
                "variables": ""
              }
            },
            "url": {
              "raw": "{{baseAddress}}/graphql",
              "host": [
                "{{baseAddress}}"
              ],
              "path": [
                "graphql"
              ]
            }
          },
          "response": []
        },
        {
          "name": "Q.AccountingEntry - Pending Open Items of a Specific Invoice by Due Date",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "X-OrganizationId",
                "value": "{{X-OrganizationId}}"
              },
              {
                "key": "x-api-key",
                "value": "{{subscriptionKey}}"
              }
            ],
            "body": {
              "mode": "graphql",
              "graphql": {
                "query": "query GetAccountingEntryLines($invoiceNumber: String!) {\r\n    accountingEntryLines(\r\n        where: {\r\n          and: [\r\n            {accountingEntry: {journalType: {type: {eq: SALES_INVOICE}}}},\r\n            \r\n            {accountingEntryInvoice: {externalInvoiceNumber: {contains: $invoiceNumber}}},\r\n            {accountingEntryInvoice: {openItems: {some: {status: {in: [NOT_SPECIFIED, PARTIAL]}}}}}\r\n          ]\r\n        }\r\n        order: [\r\n            {accountingEntry: {journalType: {code: ASC}}},\r\n            {accountingEntry: {date: ASC}},\r\n        ]\r\n    ) {\r\n        edges {\r\n            node {\r\n                accountingEntryThirdParty{\r\n                    code\r\n                    socialName\r\n                }\r\n                accountingEntryInvoice{\r\n                    externalInvoiceNumber\r\n                    openItems{\r\n                        id\r\n                        status\r\n                        amount\r\n                        dueDate\r\n                        paidAmountAccumulated\r\n                        paymentMean{\r\n                            description\r\n                        }\r\n                    }\r\n                }\r\n            }\r\n        }\r\n        totalCount\r\n        pageInfo {\r\n            hasNextPage\r\n        }\r\n    }     \r\n}\r\n",
                "variables": "{\r\n  \r\n  \"invoiceNumber\": \"000\"\r\n}\r\n"
              }
            },
            "url": {
              "raw": "{{baseAddress}}/graphql",
              "host": [
                "{{baseAddress}}"
              ],
              "path": [
                "graphql"
              ]
            }
          },
          "response": []
        },
        {
          "name": "Q.AccountingAccount - Accounts with taxCode \"C0011\"",
          "event": [
            {
              "listen": "test",
              "script": {
                "exec": [
                  "pm.test(\"Variables creation\", function () {\r",
                  "    let jsd = pm.response.json();\r",
                  "\r",
                  "    if (jsd.data == null || jsd.data.accountingAccounts.edges.length == 0)\r",
                  "        {console.error(\"Unable to save environment variable\");return;}\r",
                  "    pm.environment.set(\"currentId\", jsd.data.accountingAccounts.edges[0].node.id);\r",
                  "    console.log(\"'currentId' environment variable has been created : \" + pm.environment.get(\"currentId\"));\r",
                  "});"
                ],
                "type": "text/javascript",
                "packages": {},
                "requests": {}
              }
            },
            {
              "listen": "prerequest",
              "script": {
                "exec": [
                  ""
                ],
                "type": "text/javascript",
                "packages": {},
                "requests": {}
              }
            }
          ],
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "X-OrganizationId",
                "value": "{{X-OrganizationId}}"
              },
              {
                "key": "x-api-key",
                "value": "{{subscriptionKey}}"
              }
            ],
            "body": {
              "mode": "graphql",
              "graphql": {
                "query": "query {\r\n    accountingAccounts (\r\n        where :{ \r\n        taxTreatment:{taxCode:{eq:\"C0011\"}}\r\n        }\r\n    ) {\r\n        edges {\r\n            node {\r\n                id\r\n                accountLevel\r\n                accountType\r\n                code\r\n                subAccountType\r\n                description\r\n                taxTreatmentId\r\n                taxTreatment{\r\n                    taxCode\r\n                    description\r\n                }\r\n            }\r\n        }\r\n        totalCount\r\n        pageInfo {\r\n            hasNextPage\r\n        }\r\n    }     \r\n}",
                "variables": ""
              }
            },
            "url": {
              "raw": "{{baseAddress}}/graphql",
              "host": [
                "{{baseAddress}}"
              ],
              "path": [
                "graphql"
              ]
            }
          },
          "response": []
        },
        {
          "name": "Q.Customer - with Pricing Information",
          "event": [
            {
              "listen": "test",
              "script": {
                "exec": [
                  "pm.test(\"Variables creation\", function () {\r",
                  "    let jsd = pm.response.json();\r",
                  "\r",
                  "    if (jsd.data == null || jsd.data.customers.edges.length == 0)\r",
                  "        {console.error(\"Unable to save environment variable\");return;}\r",
                  "    pm.environment.set(\"currentId\", jsd.data.customers.edges[0].node.id);\r",
                  "    console.log(\"'currentId' environment variable has been created : \" + pm.environment.get(\"currentId\"));\r",
                  "});"
                ],
                "type": "text/javascript",
                "packages": {}
              }
            }
          ],
          "request": {
            "auth": {
              "type": "bearer",
              "bearer": [
                {
                  "key": "token",
                  "value": "{{accessToken}}",
                  "type": "string"
                }
              ]
            },
            "method": "POST",
            "header": [
              {
                "key": "X-OrganizationId",
                "value": "{{X-OrganizationId}}"
              },
              {
                "key": "x-api-key",
                "value": "{{subscriptionKey}}"
              }
            ],
            "body": {
              "mode": "graphql",
              "graphql": {
                "query": "query {\r\n  customers (\r\n    order : {code:ASC}\r\n  ) {\r\n    edges {\r\n      node {\r\n        id   \r\n        socialName\r\n        tradeName\r\n        code\r\n        addresses{\r\n            countryIsoCodeAlpha2\r\n        }\r\n        salesDiscountGroup{\r\n            code\r\n            name\r\n        } \r\n        salesTariff{\r\n            code\r\n            name\r\n        }  \r\n        defaultAccountingAccount{\r\n            code\r\n            name\r\n        }\r\n        businessArea{\r\n            name\r\n        }\r\n        documentType{\r\n             code\r\n        }\r\n\r\n      }\r\n    }\r\n  }   \r\n}\r\n",
                "variables": ""
              }
            },
            "url": {
              "raw": "{{baseAddress}}/graphql",
              "host": [
                "{{baseAddress}}"
              ],
              "path": [
                "graphql"
              ]
            }
          },
          "response": []
        },
        {
          "name": "Q.SalesQuote - Opened Quotes of a Customer Over a Period",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "X-OrganizationId",
                "value": "{{X-OrganizationId}}"
              },
              {
                "key": "x-api-key",
                "value": "{{subscriptionKey}}"
              }
            ],
            "body": {
              "mode": "graphql",
              "graphql": {
                "query": "query {\r\n  salesQuotes (\r\n    order: { documentDate: DESC },\r\n    where: {\r\n      and: [\r\n        { documentDate: { gte: \"2024-01-01\" } },\r\n        { documentDate: { lte: \"2027-04-30\" } },\r\n        { status: { eq: \"Closed\" } },\r\n        { customer: {code:{eq:\"CARAT\"}}}\r\n        ]\r\n    }\r\n  ) {\r\n    edges {\r\n      node {\r\n        id\r\n        socialName\r\n        operationalNumber\r\n        creationDate\r\n        customerId\r\n        customer {\r\n          id\r\n          code\r\n          vatNumber\r\n          salesDiscountGroupId\r\n          salesDiscountGroup{\r\n            code\r\n            name\r\n          }\r\n        }\r\n        documentDate\r\n        status\r\n        totalNet\r\n        discount\r\n        lines {\r\n          productCode\r\n          productName\r\n          totalQuantity\r\n          unitPrice\r\n          firstDiscount\r\n          totalNet\r\n          product {\r\n            id\r\n            salesUnitPrice\r\n            salesVatPercentage\r\n          }\r\n        }\r\n      }\r\n    }\r\n    totalCount\r\n    pageInfo {\r\n      hasNextPage\r\n    }\r\n  }\r\n}\r\n",
                "variables": ""
              }
            },
            "url": {
              "raw": "{{baseAddress}}/graphql",
              "host": [
                "{{baseAddress}}"
              ],
              "path": [
                "graphql"
              ]
            }
          },
          "response": []
        },
        {
          "name": "Q.SalesQuote -  Containing a Specific Product with a Min Qty",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "X-OrganizationId",
                "value": "{{X-OrganizationId}}"
              },
              {
                "key": "x-api-key",
                "value": "{{subscriptionKey}}"
              }
            ],
            "body": {
              "mode": "graphql",
              "graphql": {
                "query": "query {\r\n  salesQuotes (\r\n    order: { documentDate: DESC },\r\n    where: {\r\n      and: [\r\n        { documentDate: { gte: \"2024-01-01\" } },\r\n        { documentDate: { lte: \"2027-04-30\" } },\r\n        { lines: { some: { \r\n          and: [ \r\n            { productCode : {eq :\"CLMENWATCH\"}},\r\n            { unitPrice: {gte : 5}},\r\n          ]\r\n        }}}\r\n      ]\r\n    }\r\n  ) {\r\n    edges {\r\n      node {\r\n        id\r\n        socialName\r\n        operationalNumber\r\n        creationDate\r\n        customerId\r\n        customer {\r\n          id\r\n          code\r\n          vatNumber\r\n          salesDiscountGroupId\r\n          salesDiscountGroup{\r\n            code\r\n            name\r\n          }\r\n        }\r\n        documentDate\r\n        status\r\n        totalNet\r\n        discount\r\n        lines {\r\n          productCode\r\n          productName\r\n          totalQuantity\r\n          unitPrice\r\n          firstDiscount\r\n          totalNet\r\n          product {\r\n            id\r\n            salesUnitPrice\r\n            salesVatPercentage\r\n          }\r\n        }\r\n      }\r\n    }\r\n    totalCount\r\n    pageInfo {\r\n      hasNextPage\r\n    }\r\n  }\r\n}\r\n",
                "variables": ""
              }
            },
            "url": {
              "raw": "{{baseAddress}}/graphql",
              "host": [
                "{{baseAddress}}"
              ],
              "path": [
                "graphql"
              ]
            }
          },
          "response": []
        },
        {
          "name": "Q.SalesQuote - Historical Pricing of a Product in Quotes",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "X-OrganizationId",
                "value": "{{X-OrganizationId}}"
              },
              {
                "key": "x-api-key",
                "value": "{{subscriptionKey}}"
              }
            ],
            "body": {
              "mode": "graphql",
              "graphql": {
                "query": "query {\r\n  salesQuoteLines (\r\n    order: { salesQuote: { documentDate: DESC } },\r\n    where: {\r\n      and: [\r\n        { salesQuote: { documentDate: { gte: \"2024-01-01\" } } },\r\n        { salesQuote: { documentDate: { lte: \"2027-04-30\" } } },\r\n        { productCode : { eq: \"GLDRING\" } }\r\n      ]\r\n    }\r\n  ) {\r\n    edges {\r\n      node {\r\n        salesQuote {\r\n          socialName\r\n          vatNumber\r\n          operationalNumber\r\n          creationDate\r\n          customer {\r\n            code\r\n            tradeName\r\n          }\r\n          documentDate\r\n          status\r\n        }\r\n        productCode\r\n        productName\r\n        totalQuantity\r\n        unitPrice\r\n        firstDiscount\r\n        totalNet\r\n        product {\r\n          salesUnitPrice\r\n        }\r\n      }\r\n    }\r\n    totalCount\r\n    pageInfo {\r\n      hasNextPage\r\n    }\r\n  }\r\n}\r\n",
                "variables": ""
              }
            },
            "url": {
              "raw": "{{baseAddress}}/graphql",
              "host": [
                "{{baseAddress}}"
              ],
              "path": [
                "graphql"
              ]
            }
          },
          "response": []
        },
        {
          "name": "Q.SalesQuote - Top 10 Best-Selling of an Product by Quantity",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "X-OrganizationId",
                "value": "{{X-OrganizationId}}"
              },
              {
                "key": "x-api-key",
                "value": "{{subscriptionKey}}"
              }
            ],
            "body": {
              "mode": "graphql",
              "graphql": {
                "query": "query {\r\n  salesQuoteLines (\r\n    order: { totalQuantity: DESC },\r\n    where: {\r\n      and: [\r\n        { salesQuote: { documentDate: { gte: \"2024-01-01\" } } },\r\n        { salesQuote: { documentDate: { lte: \"2027-04-30\" } } }\r\n        { productCode : { eq: \"GLDRING\" } }\r\n      ]\r\n    },\r\n    first: 10\r\n  ) {\r\n    edges {\r\n      node {\r\n        salesQuote {\r\n          socialName\r\n          documentDate\r\n          customer {\r\n            code\r\n            tradeName\r\n          }\r\n          status\r\n        }\r\n        totalQuantity\r\n      }\r\n    }\r\n  }\r\n}\r\n",
                "variables": ""
              }
            },
            "url": {
              "raw": "{{baseAddress}}/graphql",
              "host": [
                "{{baseAddress}}"
              ],
              "path": [
                "graphql"
              ]
            }
          },
          "response": []
        },
        {
          "name": "Q.SalesInvoice - Credit Note and the associated original invoice",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "X-OrganizationId",
                "value": "{{X-OrganizationId}}"
              },
              {
                "key": "x-api-key",
                "value": "{{subscriptionKey}}"
              }
            ],
            "body": {
              "mode": "graphql",
              "graphql": {
                "query": "query {\r\n  salesInvoices (\r\n        first: 100\r\n        order: { operationalNumber: DESC }\r\n        where: {\r\n            and: [\r\n                { type: { eq:CREDIT_NOTE}}\r\n            ]\r\n        }\r\n    ) {\r\n        edges {\r\n            node {\r\n                type\r\n                id\r\n                socialName\r\n                operationalNumber\r\n                creationDate\r\n                customerId\r\n                socialName\r\n                documentDate\r\n                sourceSalesInvoice {\r\n                    id\r\n                    operationalNumber\r\n                    documentDate\r\n                    status\r\n                    salesOrderNumber\r\n                }\r\n                status\r\n                totalNet\r\n                discount\r\n                lines {\r\n                    productCode\r\n                    productId\r\n                    productName\r\n                    totalQuantity\r\n                    unitPrice\r\n                    firstDiscount\r\n                    totalNet\r\n                }\r\n            }\r\n        }\r\n        totalCount\r\n        pageInfo {\r\n            hasNextPage\r\n        }\r\n    }\r\n}\r\n",
                "variables": ""
              }
            },
            "url": {
              "raw": "{{baseAddress}}/graphql",
              "host": [
                "{{baseAddress}}"
              ],
              "path": [
                "graphql"
              ]
            }
          },
          "response": []
        },
        {
          "name": "Q.SalesInvoiceOpenItem - All Pending Customer Open Items by Due Date",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "X-OrganizationId",
                "value": "{{X-OrganizationId}}"
              },
              {
                "key": "x-api-key",
                "value": "{{subscriptionKey}}"
              }
            ],
            "body": {
              "mode": "graphql",
              "graphql": {
                "query": "query {\r\n  salesInvoiceOpenItems(\r\n    order: {dueDate:ASC}\r\n    where: {status:{in:[NOT_SPECIFIED,  PARTIAL]}}\r\n  ) {\r\n    edges {\r\n      node {\r\n        salesInvoice {\r\n          documentDate\r\n          operationalNumber\r\n          status\r\n          totalLiquid\r\n          customer {\r\n            id\r\n            code\r\n            socialName\r\n          }\r\n        }\r\n        id\r\n        status\r\n        amount\r\n        dueDate\r\n        paidAmountAccumulated\r\n        paymentMean {\r\n          description\r\n        }\r\n      }\r\n    }\r\n  }\r\n}\r\n",
                "variables": ""
              }
            },
            "url": {
              "raw": "{{baseAddress}}/graphql",
              "host": [
                "{{baseAddress}}"
              ],
              "path": [
                "graphql"
              ]
            }
          },
          "response": []
        },
        {
          "name": "Q.PurchaseInvoice - Invoices with Specific Reduced VAT Rate",
          "event": [
            {
              "listen": "prerequest",
              "script": {
                "exec": [
                  "let legislationCode = pm.environment.get(\"legislationCode\");\r",
                  "\r",
                  "if (legislationCode === 'FR') {\r",
                  "    pm.environment.set(\"reducedVATRate\", 5.5);\r",
                  "} else if (legislationCode === 'ES') {\r",
                  "    pm.environment.set(\"reducedVATRate\", 10);\r",
                  "} else if (legislationCode === 'DE') {\r",
                  "    pm.environment.set(\"reducedVATRate\", 7);\r",
                  "} else {\r",
                  "    console.error(\"Unexpected legislationCode value\");\r",
                  "    return;\r",
                  "}\r",
                  "\r",
                  "console.log(\"'reducedVATRate' environment variable has been set to: \" + pm.environment.get(\"reducedVATRate\"));\r",
                  ""
                ],
                "type": "text/javascript",
                "packages": {}
              }
            }
          ],
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "X-OrganizationId",
                "value": "{{X-OrganizationId}}"
              },
              {
                "key": "x-api-key",
                "value": "{{subscriptionKey}}"
              }
            ],
            "body": {
              "mode": "graphql",
              "graphql": {
                "query": "query ($reducedVATRate: Decimal!) {\r\n  purchaseInvoices (\r\n        first:100\r\n        where: {\r\n            vatLines: {\r\n                some: { tax: { percentage: { eq: $reducedVATRate } } }\r\n            }\r\n        }\r\n        order: { invoiceNumber: DESC }\r\n    )  {\r\n        edges {\r\n            node {\r\n                status\r\n                firstDueDate\r\n                operationDate\r\n                id\r\n                invoiceDate\r\n                invoiceNumber\r\n                creationDate\r\n                supplier{\r\n                    socialName\r\n                }\r\n                vatLines{\r\n                    tax{\r\n                        name\r\n                        percentage\r\n                    }\r\n                }\r\n            }\r\n        }\r\n        totalCount\r\n        pageInfo {\r\n         hasNextPage\r\n        }\r\n    }\r\n}",
                "variables": "{\r\n  \"reducedVATRate\": {{reducedVATRate}}\r\n}\r\n"
              }
            },
            "url": {
              "raw": "{{baseAddress}}/graphql",
              "host": [
                "{{baseAddress}}"
              ],
              "path": [
                "graphql"
              ]
            }
          },
          "response": []
        },
        {
          "name": "Q.PurchaseInvoice -  retrieve Unpaid Invoices",
          "event": [
            {
              "listen": "prerequest",
              "script": {
                "exec": [
                  "let legislationCode = pm.environment.get(\"legislationCode\");\r",
                  "\r",
                  "if (legislationCode === 'FR') {\r",
                  "    pm.environment.set(\"reducedVATRate\", 5.5);\r",
                  "} else if (legislationCode === 'ES') {\r",
                  "    pm.environment.set(\"reducedVATRate\", 4);\r",
                  "} else if (legislationCode === 'DE') {\r",
                  "    pm.environment.set(\"reducedVATRate\", 7);\r",
                  "} else {\r",
                  "    console.error(\"Unexpected legislationCode value\");\r",
                  "    return;\r",
                  "}\r",
                  "\r",
                  "console.log(\"'reducedVATRate' environment variable has been set to: \" + pm.environment.get(\"reducedVATRate\"));\r",
                  ""
                ],
                "type": "text/javascript",
                "packages": {},
                "requests": {}
              }
            }
          ],
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "X-OrganizationId",
                "value": "{{X-OrganizationId}}"
              },
              {
                "key": "x-api-key",
                "value": "{{subscriptionKey}}"
              }
            ],
            "body": {
              "mode": "graphql",
              "graphql": {
                "query": "query  {\r\n  purchaseInvoices (\r\n        first:100\r\n        where: {\r\n            status:{ nin: [\"Pending\",\"Paid\"]}\r\n            openItems: {\r\n                some:{ status: {in:[NOT_SPECIFIED, PARTIAL]}}\r\n            }\r\n        }\r\n        order: { invoiceNumber: DESC }\r\n    )  {\r\n        edges {\r\n            node {\r\n                status\r\n                operationDate\r\n                id\r\n                invoiceDate\r\n                invoiceNumber\r\n                supplier{\r\n                    socialName\r\n                }\r\n                openItems{\r\n                    status\r\n                    amount\r\n                    paidAmountAccumulated\r\n                    paymentMean{\r\n                        description\r\n                    }\r\n                }\r\n            }\r\n        }\r\n        totalCount\r\n        pageInfo {\r\n         hasNextPage\r\n        }\r\n    }\r\n}",
                "variables": ""
              }
            },
            "url": {
              "raw": "{{baseAddress}}/graphql",
              "host": [
                "{{baseAddress}}"
              ],
              "path": [
                "graphql"
              ]
            }
          },
          "response": []
        }
      ]
    },
    {
      "name": "Discover AGGREGATIONS",
      "item": [
        {
          "name": "Accounting Entry Lines by Account",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "X-OrganizationId",
                "value": "{{X-OrganizationId}}"
              },
              {
                "key": "x-api-key",
                "value": "{{subscriptionKey}}"
              }
            ],
            "body": {
              "mode": "graphql",
              "graphql": {
                "query": "#This query retrieves and aggregates accounting entry lines by sub-account and financial quarter, summing debit and credit amounts while filtering entries within a specified date range (2024-2025). If there are more than 500 results, pagination must be handled.\r\n\r\nquery {\r\n    accountingEntryLines(\r\n    first: 500\r\n    where: {\r\n        and: [\r\n        { accountingEntry: { date: { gte: \"2024-01-01\", lte: \"2025-12-31\" } } }\r\n        \r\n        ]\r\n    }\r\n    ) {\r\n    edges {\r\n        node {\r\n        debitAmount\r\n        creditAmount\r\n        subAccountId\r\n        accountingEntry {\r\n            date\r\n        }\r\n        }\r\n    }\r\n    aggregate(\r\n        aggregateFields: [\"debitAmount\", \"creditAmount\"],\r\n        groupFields: [\"subAccountId\", \"accountingEntry.date|Quarter\"]\r\n        \r\n    ) {\r\n        groupValues {value}\r\n        aggregates {value}\r\n    }\r\n    pageInfo {\r\n        endCursor\r\n        hasNextPage\r\n    }\r\n    }\r\n}\r\n    \r\n            ",
                "variables": ""
              }
            },
            "url": {
              "raw": "{{baseAddress}}/graphql",
              "host": [
                "{{baseAddress}}"
              ],
              "path": [
                "graphql"
              ]
            }
          },
          "response": []
        },
        {
          "name": "Sales Quote Lines by Product",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "X-OrganizationId",
                "value": "{{X-OrganizationId}}"
              },
              {
                "key": "x-api-key",
                "value": "{{subscriptionKey}}"
              }
            ],
            "body": {
              "mode": "graphql",
              "graphql": {
                "query": "#This query retrieves and aggregates sales quote line by product and financial quarter, summing total quantity and total net amount while filtering quotes within a specified date range (2024-2025) and ordering by total quantity in descending order.\r\n                            \r\nquery {\r\n    salesQuoteLines (\r\n    first: 3\r\n    where: {\r\n        and: [\r\n        { salesQuote: { documentDate: { gte: \"2024-01-01\" , lte: \"2025-12-31\" } } }\r\n        ]\r\n    },\r\n    ) {\r\n    edges {\r\n        node {\r\n        productId\r\n        salesQuote {\r\n            documentDate\r\n        }\r\n        totalQuantity\r\n        totalNet\r\n        }\r\n    }\r\n    aggregate(\r\n        aggregateFields: [\"totalQuantity\", \"totalNet\"],\r\n        groupFields: [\"productId\", \"salesQuote.documentDate|Quarter\"]\r\n        orderFields: [\"totalQuantity|DESC\"] \r\n    ) {\r\n        groupValues {value}\r\n        aggregates {value}\r\n    }\r\n    }\r\n}  ",
                "variables": ""
              }
            },
            "url": {
              "raw": "{{baseAddress}}/graphql",
              "host": [
                "{{baseAddress}}"
              ],
              "path": [
                "graphql"
              ]
            }
          },
          "response": []
        },
        {
          "name": "Sales Invoices by Customer",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "X-OrganizationId",
                "value": "{{X-OrganizationId}}"
              },
              {
                "key": "x-api-key",
                "value": "{{subscriptionKey}}"
              }
            ],
            "body": {
              "mode": "graphql",
              "graphql": {
                "query": "#This query retrieves and aggregates sales invoices by customer and financial quarter, summing total net, total liquid and total vat amounts while filtering invoices within a specified date range (2024-2025) and ordering by total net in descending order.\r\n                            \r\nquery {\r\n      salesInvoices (\r\n        first: 3\r\n        where: {\r\n          and: [\r\n          { documentDate: { gte: \"2024-01-01\" , lte: \"2025-12-31\" } } \r\n          \r\n          ]\r\n        },\r\n      ) {\r\n        edges {\r\n          node {\r\n            customerId\r\n            documentDate\r\n            totalNet\r\n            totalLiquid\r\n            totalVat\r\n          }\r\n        }\r\n      aggregate(\r\n            aggregateFields: [\"totalNet\", \"totalLiquid\",\"totalVat\"],\r\n            groupFields: [\"customerId\", \"documentDate|Quarter\"],\r\n            orderFields: [\"totalNet|DESC\"] \r\n        ) {\r\n           groupValues {value}\r\n           aggregates {value}\r\n        }\r\n      }\r\n    }",
                "variables": ""
              }
            },
            "url": {
              "raw": "{{baseAddress}}/graphql",
              "host": [
                "{{baseAddress}}"
              ],
              "path": [
                "graphql"
              ]
            }
          },
          "response": []
        },
        {
          "name": "Sales Invoices Payments by Customer",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "X-OrganizationId",
                "value": "{{X-OrganizationId}}"
              },
              {
                "key": "x-api-key",
                "value": "{{subscriptionKey}}"
              }
            ],
            "body": {
              "mode": "graphql",
              "graphql": {
                "query": "#This query retrieves and aggregates sales invoice open items by customer and month, summing amount and accumulated paid amount while filtering invoices within a specified due date range (2024-2025). If there are more than 500 results, pagination must be handled.\r\n                                                        \r\nquery {\r\n    salesInvoiceOpenItems (\r\n    first: 500\r\n    where: {\r\n        and: [\r\n        { dueDate: { gte: \"2024-01-01\" , lte: \"2025-12-31\" }  }\r\n        \r\n        ]\r\n    }\r\n    ) {\r\n    edges {\r\n        node {\r\n        salesInvoice{\r\n            customerId\r\n        }\r\n        dueDate\r\n        amount\r\n        paidAmountAccumulated\r\n        }\r\n    }\r\n    aggregate(\r\n        aggregateFields: [\"amount\", \"paidAmountAccumulated\"],\r\n        groupFields: [\"salesInvoice.customerId\",\"dueDate|Month\"]\r\n        \r\n    ) {\r\n        groupValues {value}\r\n        aggregates {value}\r\n    }\r\n    pageInfo {\r\n        endCursor\r\n        hasNextPage\r\n    }\r\n    }\r\n}\r\n      \r\n            ",
                "variables": ""
              }
            },
            "url": {
              "raw": "{{baseAddress}}/graphql",
              "host": [
                "{{baseAddress}}"
              ],
              "path": [
                "graphql"
              ]
            }
          },
          "response": []
        }
      ]
    },
    {
      "name": "Discover AGGREGATIONS KPIS",
      "item": [
        {
          "name": "Fiscal Year",
          "item": [
            {
              "name": "Q.current Fiscal Year",
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "exec": [
                      "// Récupérer la réponse JSON\r",
                      "let response = pm.response.json();\r",
                      "\r",
                      "if (response.data.accountingExercises.edges.length > 0) {\r",
                      "    let exercise = response.data.accountingExercises.edges[0].node;\r",
                      "    pm.environment.set(\"startDate\", exercise.startDate);\r",
                      "    pm.environment.set(\"endDate\", exercise.endDate);\r",
                      "}"
                    ],
                    "type": "text/javascript",
                    "packages": {},
                    "requests": {}
                  }
                },
                {
                  "listen": "prerequest",
                  "script": {
                    "exec": [
                      "const today = new Date().toISOString().split('T')[0];\r",
                      "pm.variables.set(\"today\", today);\r",
                      ""
                    ],
                    "type": "text/javascript",
                    "packages": {},
                    "requests": {}
                  }
                }
              ],
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "X-OrganizationId",
                    "value": "{{X-OrganizationId}}"
                  },
                  {
                    "key": "x-api-key",
                    "value": "{{subscriptionKey}}"
                  }
                ],
                "body": {
                  "mode": "graphql",
                  "graphql": {
                    "query": "# Retrieves the current fiscal (accounting) exercise based on the given $today date.  \r\n# It returns the startDate and endDate of the exercise, which can then be used  \r\n# to calculate KPIs over the current fiscal year.\r\n\r\nquery ($today: DateTime!) {\r\n  accountingExercises(\r\n    where: {\r\n      and: [\r\n        { status: { eq: OPEN } }\r\n        { startDate: { lte: $today } }\r\n        { endDate: { gte: $today } }\r\n      ]\r\n    }\r\n  ) {\r\n    edges {\r\n      node {\r\n        startDate\r\n        endDate\r\n      }\r\n    }\r\n  }\r\n}\r\n",
                    "variables": "{\r\n  \"today\": \"{{today}}\"\r\n}"
                  }
                },
                "url": {
                  "raw": "{{baseAddress}}/graphql",
                  "host": [
                    "{{baseAddress}}"
                  ],
                  "path": [
                    "graphql"
                  ]
                }
              },
              "response": []
            }
          ]
        },
        {
          "name": "Kpis (single value)",
          "item": [
            {
              "name": "Q.Kpi All posted sales invoices",
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "X-OrganizationId",
                    "value": "{{X-OrganizationId}}"
                  },
                  {
                    "key": "x-api-key",
                    "value": "{{subscriptionKey}}"
                  }
                ],
                "body": {
                  "mode": "graphql",
                  "graphql": {
                    "query": "# This query retrieves and aggregates posted sales invoices within two dates.  \r\n# By default, the startDate and endDate values are provided by the \"current Fiscal Year\" query.  \r\n# Invoices are filtered to include only validated invoices and by documentDate within the given range.\r\n\r\nquery ($startDate: DateTime!, $endDate: DateTime!) {\r\n  salesInvoices(\r\n    where: {\r\n      and: [\r\n        { status: { nin: [\"Pending\",\"Closed\"] } }\r\n        { documentDate: { gte: $startDate, lte: $endDate } }\r\n      ]\r\n    }\r\n  ) {\r\n    edges {\r\n      node {\r\n        totalLiquid\r\n      }\r\n    }\r\n    aggregate(\r\n      aggregateFields: [\"totalLiquid\"],\r\n    ) {\r\n      aggregates { value }\r\n    }\r\n  }\r\n}",
                    "variables": "{\r\n  \"startDate\": \"{{startDate}}\",\r\n  \"endDate\": \"{{endDate}}\"\r\n}\r\n"
                  }
                },
                "url": {
                  "raw": "{{baseAddress}}/graphql",
                  "host": [
                    "{{baseAddress}}"
                  ],
                  "path": [
                    "graphql"
                  ]
                }
              },
              "response": []
            },
            {
              "name": "Q.Kpi All posted purchase invoices",
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "X-OrganizationId",
                    "value": "{{X-OrganizationId}}"
                  },
                  {
                    "key": "x-api-key",
                    "value": "{{subscriptionKey}}"
                  }
                ],
                "body": {
                  "mode": "graphql",
                  "graphql": {
                    "query": "# This query retrieves and aggregates posted purchase invoices within two dates.  \r\n# By default the startDate and endDate values are provided by the \"current Fiscal Year\" query.  \r\n# Invoices are filtered to include only validated invoices and by operationDate within the given range.\r\n\r\nquery ($startDate: DateTime!, $endDate: DateTime!) {\r\n  purchaseInvoices(\r\n    where: {\r\n      and: [\r\n        { status: { eq: \"Posted\" } }\r\n        { operationDate: { gte: $startDate, lte: $endDate } }\r\n      ]\r\n    }\r\n  ) {\r\n    edges {\r\n      node {\r\n        totalLiquid\r\n      }\r\n    }\r\n    aggregate(\r\n      aggregateFields: [\"totalLiquid\"],\r\n    ) {\r\n      aggregates { value }\r\n    }\r\n  }\r\n}\r\n",
                    "variables": "{\r\n  \"startDate\": \"{{startDate}}\",\r\n  \"endDate\": \"{{endDate}}\"\r\n}\r\n"
                  }
                },
                "url": {
                  "raw": "{{baseAddress}}/graphql",
                  "host": [
                    "{{baseAddress}}"
                  ],
                  "path": [
                    "graphql"
                  ]
                }
              },
              "response": []
            },
            {
              "name": "Q.Kpi All pending quotes",
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "X-OrganizationId",
                    "value": "{{X-OrganizationId}}"
                  },
                  {
                    "key": "x-api-key",
                    "value": "{{subscriptionKey}}"
                  }
                ],
                "body": {
                  "mode": "graphql",
                  "graphql": {
                    "query": "\r\n# This query retrieves and aggregates pending salesQuotes.   \r\n# Quotes are filtered by status = \"Pending\" \r\n\r\nquery {\r\n  salesQuotes(\r\n    where: {\r\n      and: [\r\n        { status: { eq: \"Pending\" } }\r\n      ]\r\n    }\r\n  ) {\r\n    edges {\r\n      node {\r\n        totalLiquid\r\n      }\r\n    }\r\n    aggregate(\r\n      aggregateFields: [\"totalLiquid\"],\r\n    ) {\r\n      aggregates { value }\r\n    }\r\n  }\r\n}\r\n",
                    "variables": ""
                  }
                },
                "url": {
                  "raw": "{{baseAddress}}/graphql",
                  "host": [
                    "{{baseAddress}}"
                  ],
                  "path": [
                    "graphql"
                  ]
                }
              },
              "response": []
            },
            {
              "name": "Q.Kpi total number of active customers",
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "X-OrganizationId",
                    "value": "{{X-OrganizationId}}"
                  },
                  {
                    "key": "x-api-key",
                    "value": "{{subscriptionKey}}"
                  }
                ],
                "body": {
                  "mode": "graphql",
                  "graphql": {
                    "query": "# In this case we could simply request totalCount,  \r\n# but we use an aggregation on __count to keep the response format  \r\n# consistent with other KPI queries.\r\nquery {\r\n  customers(\r\n    where: {\r\n        disabled: { eq: false } \r\n    }\r\n  ) {\r\n    edges {\r\n      node {\r\n        disabled\r\n      }\r\n    }\r\n    aggregate(\r\n      aggregateFields: [\"__count\"],\r\n      groupFields: [\"disabled\"],\r\n    ) {\r\n      aggregates { value }\r\n    }\r\n  }\r\n}\r\n",
                    "variables": ""
                  }
                },
                "url": {
                  "raw": "{{baseAddress}}/graphql",
                  "host": [
                    "{{baseAddress}}"
                  ],
                  "path": [
                    "graphql"
                  ]
                }
              },
              "response": []
            },
            {
              "name": "Q.Kpi All quotes converted",
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "X-OrganizationId",
                    "value": "{{X-OrganizationId}}"
                  },
                  {
                    "key": "x-api-key",
                    "value": "{{subscriptionKey}}"
                  }
                ],
                "body": {
                  "mode": "graphql",
                  "graphql": {
                    "query": "# This query retrieves and aggregates converted salesQuotes within two dates.  \r\n# By default, the startDate and endDate values are provided by the \"current Fiscal Year\" query.  \r\n\r\nquery ($startDate: DateTime!, $endDate: DateTime!) {\r\n  relatedSalesDocuments(\r\n    where: {\r\n      documentDate: { gte: $startDate, lte: $endDate }\r\n      originDocumentType: { eq: QUOTE }\r\n    }\r\n  ) {\r\n    edges {\r\n      node {\r\n        originId\r\n        documentDate\r\n      }\r\n    }\r\n    aggregate(\r\n      aggregateFields: [\"originId|DISTINCTCOUNT\"]\r\n    ) {\r\n      aggregates {\r\n        value\r\n      }\r\n    }\r\n  }\r\n}\r\n",
                    "variables": "{\r\n  \"startDate\": \"{{startDate}}\",\r\n  \"endDate\": \"{{endDate}}\"\r\n}\r\n"
                  }
                },
                "url": {
                  "raw": "{{baseAddress}}/graphql",
                  "host": [
                    "{{baseAddress}}"
                  ],
                  "path": [
                    "graphql"
                  ]
                }
              },
              "response": []
            }
          ]
        },
        {
          "name": "Kpis multiple values",
          "item": [
            {
              "name": "Outsanding customer payments",
              "item": [
                {
                  "name": "Q.Kpi Outstanding customer payments Overdue",
                  "event": [
                    {
                      "listen": "test",
                      "script": {
                        "exec": [
                          ""
                        ],
                        "type": "text/javascript",
                        "packages": {},
                        "requests": {}
                      }
                    },
                    {
                      "listen": "prerequest",
                      "script": {
                        "exec": [
                          "// Get today's date in YYYY-MM-DD format\r",
                          "const today = new Date();\r",
                          "const todayDate = today.toISOString().split('T')[0];\r",
                          "pm.environment.set(\"today\", todayDate);\r",
                          "\r",
                          "// Define the minimum due date (fixed lower bound)\r",
                          "const minDueDate = \"1970-01-01\";\r",
                          "pm.environment.set(\"minDueDate\", minDueDate);\r",
                          "\r",
                          "// Define the maximum due date = yesterday (today - 1 day)\r",
                          "const yesterday = new Date(today);\r",
                          "yesterday.setDate(today.getDate() - 1);\r",
                          "const maxDueDate = yesterday.toISOString().split('T')[0];\r",
                          "pm.environment.set(\"maxDueDate\", maxDueDate);\r",
                          "\r",
                          "// Debug logs: always read back from environment\r",
                          "console.log(\"today:\", pm.environment.get(\"today\"));\r",
                          "console.log(\"minDueDate:\", pm.environment.get(\"minDueDate\"));\r",
                          "console.log(\"maxDueDate:\", pm.environment.get(\"maxDueDate\"));\r",
                          ""
                        ],
                        "type": "text/javascript",
                        "packages": {},
                        "requests": {}
                      }
                    }
                  ],
                  "request": {
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "\r\n# This query retrieves and aggregates posted sales invoices within a fiscal year.  \r\n# The date range is controlled by environment variables set in the pre-request script:  \r\n# - today: today's date (YYYY-MM-DD)  \r\n# - minDueDate: fixed lower bound (\"1970-01-01\")  \r\n# - maxDueDate: yesterday (today - 1 day)  \r\n# The KPI to display is calculated as:  \r\n# amount - paidAmountAccumulated (based on the query results). \r\n\r\nquery ($minDueDate: DateTime!, $maxDueDate: DateTime!) {\r\n  salesInvoiceOpenItems(\r\n    where: {\r\n         dueDate: { gte: $minDueDate, lte: $maxDueDate } \r\n    }\r\n  ) {\r\n    edges {\r\n      node {\r\n        dueDate\r\n        amount\r\n        paidAmountAccumulated\r\n      }\r\n    }\r\n    aggregate(\r\n      aggregateFields: [\"amount\",\"paidAmountAccumulated\"],\r\n    ) {\r\n      aggregates {name value }\r\n    }\r\n  }\r\n}\r\n",
                        "variables": "{\r\n  \"minDueDate\": \"{{minDueDate}}\",\r\n  \"maxDueDate\": \"{{maxDueDate}}\"\r\n}\r\n"
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                },
                {
                  "name": "Q.Kpi Outstanding customer payments within 7 days",
                  "event": [
                    {
                      "listen": "test",
                      "script": {
                        "exec": [
                          ""
                        ],
                        "type": "text/javascript",
                        "packages": {},
                        "requests": {}
                      }
                    },
                    {
                      "listen": "prerequest",
                      "script": {
                        "exec": [
                          "// Get today's date in YYYY-MM-DD format\r",
                          "const today = new Date();\r",
                          "const todayDate = today.toISOString().split('T')[0];\r",
                          "pm.environment.set(\"today\", todayDate);\r",
                          "\r",
                          "// Define the minimum due date = today\r",
                          "pm.environment.set(\"minDueDate\", todayDate);\r",
                          "\r",
                          "// Define the maximum due date = today + 7 days\r",
                          "const plus7 = new Date(today);\r",
                          "plus7.setDate(today.getDate() + 7);\r",
                          "const maxDueDate = plus7.toISOString().split('T')[0];\r",
                          "pm.environment.set(\"maxDueDate\", maxDueDate);\r",
                          "\r",
                          "// Debug logs: always read back from environment\r",
                          "console.log(\"today:\", pm.environment.get(\"today\"));\r",
                          "console.log(\"minDueDate:\", pm.environment.get(\"minDueDate\"));\r",
                          "console.log(\"maxDueDate:\", pm.environment.get(\"maxDueDate\"));\r",
                          ""
                        ],
                        "type": "text/javascript",
                        "packages": {},
                        "requests": {}
                      }
                    }
                  ],
                  "request": {
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "\r\n# This query retrieves and aggregates posted sales invoices within a fiscal year.  \r\n# The date range is controlled by environment variables set in the pre-request script:  \r\n# - today: today's date (YYYY-MM-DD)  \r\n# - minDueDate: today  \r\n# - maxDueDate: today + 7 days  \r\n# The KPI to display is calculated as:  \r\n# amount - paidAmountAccumulated (based on the query results). \r\n\r\nquery ($minDueDate: DateTime!, $maxDueDate: DateTime!) {\r\n  salesInvoiceOpenItems(\r\n    where: {\r\n         dueDate: { gte: $minDueDate, lte: $maxDueDate } \r\n    }\r\n  ) {\r\n    edges {\r\n      node {\r\n        dueDate\r\n        amount\r\n        paidAmountAccumulated\r\n      }\r\n    }\r\n    aggregate(\r\n      aggregateFields: [\"amount\",\"paidAmountAccumulated\"],\r\n    ) {\r\n      aggregates {name value }\r\n    }\r\n  }\r\n}\r\n",
                        "variables": "{\r\n  \"minDueDate\": \"{{minDueDate}}\",\r\n  \"maxDueDate\": \"{{maxDueDate}}\"\r\n}\r\n"
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                },
                {
                  "name": "Q.Kpi Outstanding customer payments after 7 days",
                  "event": [
                    {
                      "listen": "test",
                      "script": {
                        "exec": [
                          ""
                        ],
                        "type": "text/javascript",
                        "packages": {},
                        "requests": {}
                      }
                    },
                    {
                      "listen": "prerequest",
                      "script": {
                        "exec": [
                          "// Get today's date in YYYY-MM-DD format\r",
                          "const today = new Date();\r",
                          "const todayDate = today.toISOString().split('T')[0];\r",
                          "pm.environment.set(\"today\", todayDate);\r",
                          "\r",
                          "// Define the minimum due date = today + 8 days\r",
                          "const plus8 = new Date(today);\r",
                          "plus8.setDate(today.getDate() + 8);\r",
                          "const minDueDate = plus8.toISOString().split('T')[0];\r",
                          "pm.environment.set(\"minDueDate\", minDueDate);\r",
                          "\r",
                          "// Define the maximum due date = fixed upper bound (e.g., 2099-12-31)\r",
                          "const maxDueDate = \"2099-12-31\";\r",
                          "pm.environment.set(\"maxDueDate\", maxDueDate);\r",
                          "\r",
                          "// Debug logs: always read back from environment\r",
                          "console.log(\"today:\", pm.environment.get(\"today\"));\r",
                          "console.log(\"minDueDate:\", pm.environment.get(\"minDueDate\"));\r",
                          "console.log(\"maxDueDate:\", pm.environment.get(\"maxDueDate\"));\r",
                          ""
                        ],
                        "type": "text/javascript",
                        "packages": {},
                        "requests": {}
                      }
                    }
                  ],
                  "request": {
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "# This query retrieves and aggregates posted sales invoices within a fiscal year.  \r\n# The date range is controlled by environment variables set in the pre-request script:  \r\n# - today: today's date (YYYY-MM-DD)  \r\n# - minDueDate: today + 8 days  \r\n# - maxDueDate: fixed upper bound (e.g., \"2099-12-31\")  \r\n# The KPI to display is calculated as:  \r\n# amount - paidAmountAccumulated (based on the query results). \r\n\r\nquery ($minDueDate: DateTime!, $maxDueDate: DateTime!) {\r\n  salesInvoiceOpenItems(\r\n    where: {\r\n         dueDate: { gte: $minDueDate, lte: $maxDueDate } \r\n    }\r\n  ) {\r\n    edges {\r\n      node {\r\n        dueDate\r\n        amount\r\n        paidAmountAccumulated\r\n      }\r\n    }\r\n    aggregate(\r\n      aggregateFields: [\"amount\",\"paidAmountAccumulated\"],\r\n    ) {\r\n      aggregates {name value }\r\n    }\r\n  }\r\n}\r\n",
                        "variables": "{\r\n  \"minDueDate\": \"{{minDueDate}}\",\r\n  \"maxDueDate\": \"{{maxDueDate}}\"\r\n}\r\n"
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                }
              ]
            },
            {
              "name": "Outstanding supplier payments",
              "item": [
                {
                  "name": "Q.Kpi Outstanding supplier payments Overdue",
                  "event": [
                    {
                      "listen": "test",
                      "script": {
                        "exec": [
                          ""
                        ],
                        "type": "text/javascript",
                        "packages": {},
                        "requests": {}
                      }
                    },
                    {
                      "listen": "prerequest",
                      "script": {
                        "exec": [
                          "// Get today's date in YYYY-MM-DD format\r",
                          "const today = new Date();\r",
                          "const todayDate = today.toISOString().split('T')[0];\r",
                          "pm.environment.set(\"today\", todayDate);\r",
                          "\r",
                          "// Define the minimum due date (fixed lower bound)\r",
                          "const minDueDate = \"1970-01-01\";\r",
                          "pm.environment.set(\"minDueDate\", minDueDate);\r",
                          "\r",
                          "// Define the maximum due date = yesterday (today - 1 day)\r",
                          "const yesterday = new Date(today);\r",
                          "yesterday.setDate(today.getDate() - 1);\r",
                          "const maxDueDate = yesterday.toISOString().split('T')[0];\r",
                          "pm.environment.set(\"maxDueDate\", maxDueDate);\r",
                          "\r",
                          "// Debug logs: always read back from environment\r",
                          "console.log(\"today:\", pm.environment.get(\"today\"));\r",
                          "console.log(\"minDueDate:\", pm.environment.get(\"minDueDate\"));\r",
                          "console.log(\"maxDueDate:\", pm.environment.get(\"maxDueDate\"));\r",
                          ""
                        ],
                        "type": "text/javascript",
                        "packages": {},
                        "requests": {}
                      }
                    }
                  ],
                  "request": {
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "\r\n# This query retrieves and aggregates posted purchase invoices within a fiscal year.  \r\n# The date range is controlled by environment variables set in the pre-request script:  \r\n# - today: today's date (YYYY-MM-DD)  \r\n# - minDueDate: fixed lower bound (\"1970-01-01\")  \r\n# - maxDueDate: yesterday (today - 1 day)  \r\n# The KPI to display is calculated as:  \r\n# amount - paidAmountAccumulated (based on the query results). \r\n\r\nquery ($minDueDate: DateTime!, $maxDueDate: DateTime!) {\r\n purchaseInvoiceOpenItems(\r\n    where: {\r\n         dueDate: { gte: $minDueDate, lte: $maxDueDate } \r\n    }\r\n  ) {\r\n    edges {\r\n      node {\r\n        dueDate\r\n        amount\r\n        paidAmountAccumulated\r\n      }\r\n    }\r\n    aggregate(\r\n      aggregateFields: [\"amount\",\"paidAmountAccumulated\"],\r\n    ) {\r\n      aggregates {name value }\r\n    }\r\n  }\r\n}\r\n",
                        "variables": "{\r\n  \"minDueDate\": \"{{minDueDate}}\",\r\n  \"maxDueDate\": \"{{maxDueDate}}\"\r\n}\r\n"
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                },
                {
                  "name": "Q.Kpi Outstanding supplier payments within 7 days",
                  "event": [
                    {
                      "listen": "test",
                      "script": {
                        "exec": [
                          ""
                        ],
                        "type": "text/javascript",
                        "packages": {},
                        "requests": {}
                      }
                    },
                    {
                      "listen": "prerequest",
                      "script": {
                        "exec": [
                          "// Get today's date in YYYY-MM-DD format\r",
                          "const today = new Date();\r",
                          "const todayDate = today.toISOString().split('T')[0];\r",
                          "pm.environment.set(\"today\", todayDate);\r",
                          "\r",
                          "// Define the minimum due date = today\r",
                          "pm.environment.set(\"minDueDate\", todayDate);\r",
                          "\r",
                          "// Define the maximum due date = today + 7 days\r",
                          "const plus7 = new Date(today);\r",
                          "plus7.setDate(today.getDate() + 7);\r",
                          "const maxDueDate = plus7.toISOString().split('T')[0];\r",
                          "pm.environment.set(\"maxDueDate\", maxDueDate);\r",
                          "\r",
                          "// Debug logs: always read back from environment\r",
                          "console.log(\"today:\", pm.environment.get(\"today\"));\r",
                          "console.log(\"minDueDate:\", pm.environment.get(\"minDueDate\"));\r",
                          "console.log(\"maxDueDate:\", pm.environment.get(\"maxDueDate\"));\r",
                          ""
                        ],
                        "type": "text/javascript",
                        "packages": {},
                        "requests": {}
                      }
                    }
                  ],
                  "request": {
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "\r\n# This query retrieves and aggregates posted purchase invoices within a fiscal year.  \r\n# The date range is controlled by environment variables set in the pre-request script:  \r\n# - today: today's date (YYYY-MM-DD)  \r\n# - minDueDate: today  \r\n# - maxDueDate: today + 7 days  \r\n# The KPI to display is calculated as:  \r\n# amount - paidAmountAccumulated (based on the query results).  \r\n\r\nquery ($minDueDate: DateTime!, $maxDueDate: DateTime!) {\r\n  purchaseInvoiceOpenItems(\r\n    where: {\r\n         dueDate: { gte: $minDueDate, lte: $maxDueDate } \r\n    }\r\n  ) {\r\n    edges {\r\n      node {\r\n        dueDate\r\n        amount\r\n        paidAmountAccumulated\r\n      }\r\n    }\r\n    aggregate(\r\n      aggregateFields: [\"amount\",\"paidAmountAccumulated\"],\r\n    ) {\r\n      aggregates {name value }\r\n    }\r\n  }\r\n}\r\n",
                        "variables": "{\r\n  \"minDueDate\": \"{{minDueDate}}\",\r\n  \"maxDueDate\": \"{{maxDueDate}}\"\r\n}\r\n"
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                },
                {
                  "name": "Q.Kpi Outstanding supplier payments after 7 days",
                  "event": [
                    {
                      "listen": "test",
                      "script": {
                        "exec": [
                          ""
                        ],
                        "type": "text/javascript",
                        "packages": {},
                        "requests": {}
                      }
                    },
                    {
                      "listen": "prerequest",
                      "script": {
                        "exec": [
                          "// Get today's date in YYYY-MM-DD format\r",
                          "const today = new Date();\r",
                          "const todayDate = today.toISOString().split('T')[0];\r",
                          "pm.environment.set(\"today\", todayDate);\r",
                          "\r",
                          "// Define the minimum due date = today + 8 days\r",
                          "const plus8 = new Date(today);\r",
                          "plus8.setDate(today.getDate() + 8);\r",
                          "const minDueDate = plus8.toISOString().split('T')[0];\r",
                          "pm.environment.set(\"minDueDate\", minDueDate);\r",
                          "\r",
                          "// Define the maximum due date = fixed upper bound (e.g., 2099-12-31)\r",
                          "const maxDueDate = \"2099-12-31\";\r",
                          "pm.environment.set(\"maxDueDate\", maxDueDate);\r",
                          "\r",
                          "// Debug logs: always read back from environment\r",
                          "console.log(\"today:\", pm.environment.get(\"today\"));\r",
                          "console.log(\"minDueDate:\", pm.environment.get(\"minDueDate\"));\r",
                          "console.log(\"maxDueDate:\", pm.environment.get(\"maxDueDate\"));\r",
                          ""
                        ],
                        "type": "text/javascript",
                        "packages": {},
                        "requests": {}
                      }
                    }
                  ],
                  "request": {
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "# This query retrieves and aggregates posted purchase invoices within a fiscal year.  \r\n# The date range is controlled by environment variables set in the pre-request script:  \r\n# - today: today's date (YYYY-MM-DD)  \r\n# - minDueDate: today + 8 days  \r\n# - maxDueDate: fixed upper bound (e.g., \"2099-12-31\")  \r\n# The KPI to display is calculated as:  \r\n# amount - paidAmountAccumulated (based on the query results).  \r\n\r\n\r\nquery ($minDueDate: DateTime!, $maxDueDate: DateTime!) {\r\n  purchaseInvoiceOpenItems(\r\n    where: {\r\n         dueDate: { gte: $minDueDate, lte: $maxDueDate } \r\n    }\r\n  ) {\r\n    edges {\r\n      node {\r\n        dueDate\r\n        amount\r\n        paidAmountAccumulated\r\n      }\r\n    }\r\n    aggregate(\r\n      aggregateFields: [\"amount\",\"paidAmountAccumulated\"],\r\n    ) {\r\n      aggregates {name value }\r\n    }\r\n  }\r\n}\r\n",
                        "variables": "{\r\n  \"minDueDate\": \"{{minDueDate}}\",\r\n  \"maxDueDate\": \"{{maxDueDate}}\"\r\n}\r\n"
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                }
              ]
            },
            {
              "name": "Top 5 Customers + all others",
              "item": [
                {
                  "name": "Q.Kpi All Customers",
                  "request": {
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "# This query retrieves the total for all customers.  \r\n# By subtracting the total of the top 5 customers, you can obtain the value for the other customers.\r\n\r\nquery ($startDate: DateTime!, $endDate: DateTime!) {\r\n  salesInvoices(\r\n    where: {\r\n      and: [\r\n        { status: { nin: [\"Pending\",\"Closed\"] } }\r\n        { documentDate: { gte: $startDate, lte: $endDate } }\r\n      ]\r\n    }\r\n  ) {\r\n    edges {\r\n      node {\r\n        totalLiquid\r\n      }\r\n    }\r\n    aggregate(\r\n      aggregateFields: [\"totalLiquid\"],\r\n    ) {\r\n      aggregates { value }\r\n    }\r\n  }\r\n}",
                        "variables": "{\r\n  \"startDate\": \"{{startDate}}\",\r\n  \"endDate\": \"{{endDate}}\"\r\n}\r\n"
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                },
                {
                  "name": "Q.Kpi 1.Top 5 Customers get ids & turnover",
                  "event": [
                    {
                      "listen": "test",
                      "script": {
                        "exec": [
                          "// Parse the JSON response\r",
                          "let response = pm.response.json();\r",
                          "\r",
                          "// Extract the IDs\r",
                          "let ids = response.data.salesInvoices.aggregate.map(a => a.groupValues[0].value);\r",
                          "\r",
                          "// Store them directly as an array\r",
                          "pm.environment.set(\"customerIds\", JSON.stringify(ids));\r",
                          "\r",
                          "console.log(\"Customer Ids:\", ids);\r",
                          ""
                        ],
                        "type": "text/javascript",
                        "packages": {},
                        "requests": {}
                      }
                    },
                    {
                      "listen": "prerequest",
                      "script": {
                        "exec": [
                          ""
                        ],
                        "type": "text/javascript",
                        "packages": {},
                        "requests": {}
                      }
                    }
                  ],
                  "request": {
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "# This first query retrieves the top customerIds and their aggregated amounts.  \r\n# To display customer names, a second query on 'customers' must be executed  \r\n# using the ids returned here (stored in customerIds).  \r\n                     \r\nquery  ($startDate: DateTime!, $endDate: DateTime!) {\r\n    salesInvoices (\r\n    first: 5\r\n    where: {\r\n        status: { nin: [\"Pending\",\"Closed\"] } \r\n        documentDate: { gte: $startDate, lte: $endDate }\r\n    },\r\n    ) {\r\n    edges {\r\n        node {\r\n        customerId\r\n        totalLiquid\r\n        }\r\n    }\r\n    aggregate(\r\n        aggregateFields: [\"totalLiquid\"],\r\n        groupFields: [\"customerId\"],\r\n        orderFields: [\"totalLiquid|DESC\"] \r\n    ) {\r\n        groupValues {value}\r\n        aggregates {value}\r\n    }\r\n    }\r\n}\r\n\r\n    \r\n            \r\n",
                        "variables": "{\r\n  \"startDate\": \"{{startDate}}\",\r\n  \"endDate\": \"{{endDate}}\"\r\n}\r\n"
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                },
                {
                  "name": "Q.Kpi 2.Top 5 Customers get Names",
                  "event": [
                    {
                      "listen": "test",
                      "script": {
                        "exec": [
                          ""
                        ],
                        "type": "text/javascript",
                        "packages": {},
                        "requests": {}
                      }
                    }
                  ],
                  "request": {
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "# This second query resolves the customerIds returned by the first query  \r\n# into customer details such as code, socialName, and addresses.  \r\n\r\nquery ($customerIds: [UUID!]!) {\r\n  customers(\r\n    where: { id: { in: $customerIds } }\r\n  ) {\r\n    edges {\r\n      node {\r\n        id\r\n        socialName\r\n      }\r\n    }\r\n  }\r\n}\r\n\r\n",
                        "variables": "{\r\n    \"customerIds\":{{customerIds}}\r\n}"
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                }
              ]
            },
            {
              "name": "Top 5 Products + all others",
              "item": [
                {
                  "name": "Q.Kpi All Products",
                  "event": [
                    {
                      "listen": "test",
                      "script": {
                        "exec": [
                          "// Parse the JSON response\r",
                          "let response = pm.response.json();\r",
                          "\r",
                          "// Extract the IDs\r",
                          "let ids = response.data.salesInvoiceLines.aggregate.map(a => a.groupValues[0].value);\r",
                          "\r",
                          "// Store them directly as a JSON array\r",
                          "pm.environment.set(\"productIds\", JSON.stringify(ids));\r",
                          "\r",
                          "console.log(\"Product Ids:\", ids);\r",
                          ""
                        ],
                        "type": "text/javascript",
                        "packages": {},
                        "requests": {}
                      }
                    }
                  ],
                  "request": {
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "# This first query retrieves the top productIds and their aggregated amounts.  \r\n# To display product names, a second query on 'products' must be executed  \r\n# using the ids returned here (stored in productIds).  \r\n                     \r\nquery  ($startDate: DateTime!, $endDate: DateTime!) {\r\n    salesInvoiceLines  (\r\n    where: {\r\n        and:[\r\n            {product:{category: {neq:CONCEPT }}}\r\n            {salesInvoice: { status: { nin: [\"Pending\",\"Closed\"] } }}\r\n            {salesInvoice: { documentDate: { gte: $startDate, lte: $endDate }}}\r\n        ]\r\n    }\r\n    ) {\r\n    edges {\r\n        node {\r\n        totalLiquid\r\n        }\r\n    }\r\n    aggregate(\r\n        aggregateFields: [\"totalLiquid\"],\r\n    ) {\r\n        groupValues {value}\r\n        aggregates {value}\r\n    }\r\n    }\r\n}\r\n\r\n    \r\n            \r\n",
                        "variables": "{\r\n  \"startDate\": \"{{startDate}}\",\r\n  \"endDate\": \"{{endDate}}\"\r\n}\r\n"
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                },
                {
                  "name": "Q.Kpi 1.Top 5 Products get ids & turnover",
                  "event": [
                    {
                      "listen": "test",
                      "script": {
                        "exec": [
                          "// Parse the JSON response\r",
                          "let response = pm.response.json();\r",
                          "\r",
                          "// Extract the IDs\r",
                          "let ids = response.data.salesInvoiceLines.aggregate.map(a => a.groupValues[0].value);\r",
                          "\r",
                          "// Store them directly as a JSON array\r",
                          "pm.environment.set(\"productIds\", JSON.stringify(ids));\r",
                          "\r",
                          "console.log(\"Product Ids:\", ids);\r",
                          ""
                        ],
                        "type": "text/javascript",
                        "packages": {},
                        "requests": {}
                      }
                    }
                  ],
                  "request": {
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "# This first query retrieves the top productIds and their aggregated amounts.  \r\n# To display product names, a second query on 'products' must be executed  \r\n# using the ids returned here (stored in productIds).  \r\n                     \r\nquery  ($startDate: DateTime!, $endDate: DateTime!) {\r\n    salesInvoiceLines  (\r\n    first: 5\r\n    where: {\r\n        and:[\r\n            {product:{category: {neq:CONCEPT }}}\r\n            {salesInvoice: { status: { nin: [\"Pending\",\"Closed\"] } }}\r\n            {salesInvoice: { documentDate: { gte: $startDate, lte: $endDate }}}\r\n        ]\r\n    }\r\n    ) {\r\n    edges {\r\n        node {\r\n        productId\r\n        totalLiquid\r\n        }\r\n    }\r\n    aggregate(\r\n        aggregateFields: [\"totalLiquid\"],\r\n        groupFields: [\"productId\"],\r\n        orderFields: [\"totalLiquid|DESC\"] \r\n    ) {\r\n        groupValues {value}\r\n        aggregates {value}\r\n    }\r\n    }\r\n}\r\n\r\n    \r\n            \r\n",
                        "variables": "{\r\n  \"startDate\": \"{{startDate}}\",\r\n  \"endDate\": \"{{endDate}}\"\r\n}\r\n"
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                },
                {
                  "name": "Q.Kpi 2.Top 5 Products get Names",
                  "event": [
                    {
                      "listen": "test",
                      "script": {
                        "exec": [
                          ""
                        ],
                        "type": "text/javascript",
                        "packages": {},
                        "requests": {}
                      }
                    }
                  ],
                  "request": {
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "# This second query resolves the productIds returned by the first query  \r\n# into product details such as code, name  \r\n\r\nquery ($productIds: [UUID!]!) {\r\n  products(where: { id: { in: $productIds } }) {\r\n    edges {\r\n      node {\r\n        id\r\n        code\r\n        name\r\n      }\r\n    }\r\n  }\r\n}\r\n\r\n",
                        "variables": "{\r\n  \"productIds\": {{productIds}}\r\n}"
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                }
              ]
            },
            {
              "name": "Top 5 Pending Quotes",
              "item": [
                {
                  "name": "Q.Kpi 1.Top 5 Pending Quotes",
                  "event": [
                    {
                      "listen": "test",
                      "script": {
                        "exec": [
                          "// Parse the JSON response\r",
                          "let response = pm.response.json();\r",
                          "\r",
                          "// Extract the IDs\r",
                          "let ids = response.data.salesQuotes.aggregate.map(a => a.groupValues[0].value);\r",
                          "\r",
                          "// Store them directly as a JSON array\r",
                          "pm.environment.set(\"quoteIds\", JSON.stringify(ids));\r",
                          "\r",
                          "console.log(\"quote Ids:\", ids);\r",
                          ""
                        ],
                        "type": "text/javascript",
                        "packages": {},
                        "requests": {}
                      }
                    }
                  ],
                  "request": {
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "# This first query retrieves the top pending quotes and their aggregated amounts.  \r\n# To display names, a second query on 'salesQuotes' must be executed  \r\n# using the ids returned here (stored in quoteIds).  \r\n                     \r\nquery  ($startDate: DateTime!, $endDate: DateTime!) {\r\n    salesQuotes (\r\n    first: 5\r\n    where: {\r\n            status:{eq:\"Pending\"}\r\n            documentDate: { gte: $startDate, lte: $endDate } \r\n    },\r\n    ) {\r\n    edges {\r\n        node {\r\n        id\r\n        totalLiquid\r\n        }\r\n    }\r\n    aggregate(\r\n        aggregateFields: [\"totalLiquid\"],\r\n        groupFields: [\"id\"],\r\n        orderFields: [\"totalLiquid|DESC\"] \r\n    ) {\r\n        groupValues {value}\r\n        aggregates {value}\r\n    }\r\n    }\r\n}\r\n\r\n    \r\n            \r\n",
                        "variables": "{\r\n  \"startDate\": \"{{startDate}}\",\r\n  \"endDate\": \"{{endDate}}\"\r\n}\r\n"
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                },
                {
                  "name": "Q.Kpi 2.Top 5 Pending Quotes  get Names",
                  "event": [
                    {
                      "listen": "test",
                      "script": {
                        "exec": [
                          ""
                        ],
                        "type": "text/javascript",
                        "packages": {},
                        "requests": {}
                      }
                    }
                  ],
                  "request": {
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "# This second query resolves the quoteIds returned by the first query  \r\n# into product details such as code, name  \r\n\r\nquery ($quoteIds: [UUID!]!) {\r\n  salesQuotes (where: { id: { in: $quoteIds } }) {\r\n    edges {\r\n      node {\r\n        id\r\n        operationalNumber\r\n        socialName\r\n      }\r\n    }\r\n  }\r\n}\r\n\r\n",
                        "variables": "{\r\n  \"quoteIds\": {{quoteIds}}\r\n}"
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                }
              ]
            }
          ]
        },
        {
          "name": "KPIs (split by period)",
          "item": [
            {
              "name": "Q.Kpi sales invoices by Month",
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "X-OrganizationId",
                    "value": "{{X-OrganizationId}}"
                  },
                  {
                    "key": "x-api-key",
                    "value": "{{subscriptionKey}}"
                  }
                ],
                "body": {
                  "mode": "graphql",
                  "graphql": {
                    "query": "# This query retrieves and aggregates posted sales invoices within two dates.  \r\n# By default, the startDate and endDate values are provided by the \"current Fiscal Year\" query.  \r\n# The KPI breaks down the result by month, with each returned date representing the first day of the month.  \r\n\r\nquery ($startDate: DateTime!, $endDate: DateTime!) {\r\n  salesInvoices(\r\n    where: {\r\n      and: [\r\n        { status: { nin: [\"Pending\",\"Closed\"] } }\r\n        { documentDate: { gte: $startDate, lte: $endDate } }\r\n      ]\r\n    }\r\n  ) {\r\n    edges {\r\n      node {\r\n        documentDate\r\n        totalLiquid\r\n      }\r\n    }\r\n    aggregate(\r\n      aggregateFields: [\"totalLiquid\"],\r\n      groupFields:[\"documentDate|MONTH\"]\r\n    ) {\r\n      groupValues{ value }\r\n      aggregates { value }\r\n    }\r\n  }\r\n}\r\n",
                    "variables": "{\r\n  \"startDate\": \"{{startDate}}\",\r\n  \"endDate\": \"{{endDate}}\"\r\n}\r\n"
                  }
                },
                "url": {
                  "raw": "{{baseAddress}}/graphql",
                  "host": [
                    "{{baseAddress}}"
                  ],
                  "path": [
                    "graphql"
                  ]
                }
              },
              "response": []
            },
            {
              "name": "Q.Kpi sales invoices by Week",
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "X-OrganizationId",
                    "value": "{{X-OrganizationId}}"
                  },
                  {
                    "key": "x-api-key",
                    "value": "{{subscriptionKey}}"
                  }
                ],
                "body": {
                  "mode": "graphql",
                  "graphql": {
                    "query": "# This query retrieves and aggregates posted sales invoices within two dates.  \r\n# By default, the startDate and endDate values are provided by the \"current Fiscal Year\" query.  \r\n# The KPI breaks down the result by week, with each returned date representing the first day of the week.  \r\n\r\nquery ($startDate: DateTime!, $endDate: DateTime!) {\r\n  salesInvoices(\r\n    where: {\r\n      and: [\r\n        { status: { nin: [\"Pending\",\"Closed\"] } }\r\n        { documentDate: { gte: $startDate, lte: $endDate } }\r\n      ]\r\n    }\r\n  ) {\r\n    edges {\r\n      node {\r\n        documentDate\r\n        totalLiquid\r\n      }\r\n    }\r\n    aggregate(\r\n      aggregateFields: [\"totalLiquid\"],\r\n      groupFields:[\"documentDate|WEEK\"]\r\n    ) {\r\n      groupValues{ value }\r\n      aggregates { value }\r\n    }\r\n  }\r\n}\r\n",
                    "variables": "{\r\n  \"startDate\": \"{{startDate}}\",\r\n  \"endDate\": \"{{endDate}}\"\r\n}\r\n"
                  }
                },
                "url": {
                  "raw": "{{baseAddress}}/graphql",
                  "host": [
                    "{{baseAddress}}"
                  ],
                  "path": [
                    "graphql"
                  ]
                }
              },
              "response": []
            },
            {
              "name": "Q.Kpi  purchase invoices by Month",
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "X-OrganizationId",
                    "value": "{{X-OrganizationId}}"
                  },
                  {
                    "key": "x-api-key",
                    "value": "{{subscriptionKey}}"
                  }
                ],
                "body": {
                  "mode": "graphql",
                  "graphql": {
                    "query": "# This query retrieves and aggregates posted sales invoices within two dates.  \r\n# By default, the startDate and endDate values are provided by the \"current Fiscal Year\" query.  \r\n# The KPI breaks down the result by month, with each returned date representing the first day of the month.  \r\n\r\nquery ($startDate: DateTime!, $endDate: DateTime!) {\r\n  purchaseInvoices(\r\n    where: {\r\n      and: [\r\n        { status: { eq: \"Posted\" } }\r\n        { operationDate: { gte: $startDate, lte: $endDate } }\r\n      ]\r\n    }\r\n  ) {\r\n    edges {\r\n      node {\r\n        operationDate\r\n        totalLiquid\r\n      }\r\n    }\r\n    aggregate(\r\n      aggregateFields: [\"totalLiquid\"],\r\n      groupFields:[\"operationDate|MONTH\"]\r\n    ) {\r\n      groupValues{ value }\r\n      aggregates { value }\r\n    }\r\n  }\r\n}\r\n",
                    "variables": "{\r\n  \"startDate\": \"{{startDate}}\",\r\n  \"endDate\": \"{{endDate}}\"\r\n}\r\n"
                  }
                },
                "url": {
                  "raw": "{{baseAddress}}/graphql",
                  "host": [
                    "{{baseAddress}}"
                  ],
                  "path": [
                    "graphql"
                  ]
                }
              },
              "response": []
            },
            {
              "name": "Q.Kpi  purchase invoices by Week",
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "X-OrganizationId",
                    "value": "{{X-OrganizationId}}"
                  },
                  {
                    "key": "x-api-key",
                    "value": "{{subscriptionKey}}"
                  }
                ],
                "body": {
                  "mode": "graphql",
                  "graphql": {
                    "query": "# This query retrieves and aggregates posted sales invoices within two dates.  \r\n# By default, the startDate and endDate values are provided by the \"current Fiscal Year\" query.  \r\n# The KPI breaks down the result by week, with each returned date representing the first day of the week.  \r\n\r\nquery ($startDate: DateTime!, $endDate: DateTime!) {\r\n  purchaseInvoices(\r\n    where: {\r\n      and: [\r\n        { status: { eq: \"Posted\" } }\r\n        { operationDate: { gte: $startDate, lte: $endDate } }\r\n      ]\r\n    }\r\n  ) {\r\n    edges {\r\n      node {\r\n        operationDate\r\n        totalLiquid\r\n      }\r\n    }\r\n    aggregate(\r\n      aggregateFields: [\"totalLiquid\"],\r\n      groupFields:[\"operationDate|WEEK\"]\r\n    ) {\r\n      groupValues{ value }\r\n      aggregates { value }\r\n    }\r\n  }\r\n}\r\n",
                    "variables": "{\r\n  \"startDate\": \"{{startDate}}\",\r\n  \"endDate\": \"{{endDate}}\"\r\n}\r\n"
                  }
                },
                "url": {
                  "raw": "{{baseAddress}}/graphql",
                  "host": [
                    "{{baseAddress}}"
                  ],
                  "path": [
                    "graphql"
                  ]
                }
              },
              "response": []
            }
          ]
        }
      ]
    },
    {
      "name": "Discover MUTATIONS to create, update, delete",
      "item": [
        {
          "name": "M.create a customer, then update it, then delete it",
          "item": [
            {
              "name": "1 - M.createCustomer without code & contact - {{customerId}} filled in",
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "exec": [
                      "pm.test(\"Variables creation\", function () {\r",
                      "    let jsd = pm.response.json();\r",
                      "\r",
                      "    if (jsd.data == null)\r",
                      "        {console.error(\"Unable to save environment variable\");return;}\r",
                      "\r",
                      "    let result = jsd.data.createCustomer;\r",
                      "    pm.environment.set(\"customerId\", result.id);\r",
                      "    console.log(\"'customerId' environment variable has been created : \" + pm.environment.get(\"customerId\"));\r",
                      "});\r",
                      ""
                    ],
                    "type": "text/javascript",
                    "packages": {}
                  }
                },
                {
                  "listen": "prerequest",
                  "script": {
                    "exec": [
                      "let legislationCode = pm.environment.get(\"legislationCode\");\r",
                      "\r",
                      "if (legislationCode === 'FR') {\r",
                      "    pm.environment.set(\"identificationNumber\", \"323456789\");\r",
                      "    pm.environment.set(\"vatNumber\",\"FR33323456789\");\r",
                      "} else if (legislationCode === 'ES') {\r",
                      "    pm.environment.set(\"identificationNumber\", \"Z4660201S\");\r",
                      "    pm.environment.set(\"vatNumber\",\"ESZ4660201S\");\r",
                      "} else if (legislationCode === 'DE') {\r",
                      "    pm.environment.set(\"identificationNumber\", \"80715887835\");\r",
                      "    pm.environment.set(\"vatNumber\",\"DE807158878\");\r",
                      "} else {\r",
                      "    console.error(\"Unexpected legislationCode value\");\r",
                      "    return;\r",
                      "}\r",
                      "\r",
                      "console.log(\"'identificationNumber' & 'vatNumber' environment variables has been created with value: \" \r",
                      "    + pm.environment.get(\"identificationNumber\")+\" - \"+pm.environment.get(\"vatNumber\"));\r",
                      ""
                    ],
                    "type": "text/javascript",
                    "packages": {}
                  }
                }
              ],
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "X-OrganizationId",
                    "value": "{{X-OrganizationId}}"
                  },
                  {
                    "key": "x-api-key",
                    "value": "{{subscriptionKey}}"
                  }
                ],
                "body": {
                  "mode": "graphql",
                  "graphql": {
                    "query": "mutation ($values: CustomerCreateGLDtoInput!) {  \r\n  createCustomer (input: $values) {\r\n    id\r\n    code\r\n  }\r\n}\r\n",
                    "variables": "{\r\n  \"values\":{\r\n    \"documentId\":\"{{identificationNumber}}\",\r\n    \"vatNumber\":\"{{vatNumber}}\",\r\n    \"socialName\": \"Postman demo\",\r\n    \"tradeName\": \"POSTMANDEMO\",\r\n    \"addresses\": [{\r\n      \"firstLine\": \"123 Generic street\",\r\n      \"city\": \"Generic City\",\r\n      \"zipCode\": \"12345\",\r\n      \"countryIsoCodeAlpha2\":\"{{legislationCode}}\"\r\n    }]\r\n  }\r\n}"
                  }
                },
                "url": {
                  "raw": "{{baseAddress}}/graphql",
                  "host": [
                    "{{baseAddress}}"
                  ],
                  "path": [
                    "graphql"
                  ]
                }
              },
              "response": []
            },
            {
              "name": "2 - Q.customers filtered by Id",
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "exec": [
                      "pm.test(\"Variables creation\", function () {\r",
                      "    let jsd = pm.response.json();\r",
                      "\r",
                      "    if (jsd.data == null || jsd.data.customers.edges.length === 0)\r",
                      "        {console.error(\"Unable to save environment variable\");return;}\r",
                      "    let cust = jsd.data.customers.edges[0].node;\r",
                      "    if (cust.addresses && cust.addresses.length > 0)\r",
                      "    {\r",
                      "      pm.environment.set(\"custAddressId\", cust.addresses[0].id);\r",
                      "      console.log(\"'custAddressId' environment variable has been created : \" + pm.environment.get(\"custAddressId\"));\r",
                      "    }\r",
                      "});\r",
                      ""
                    ],
                    "type": "text/javascript"
                  }
                }
              ],
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "X-OrganizationId",
                    "value": "{{X-OrganizationId}}"
                  },
                  {
                    "key": "x-api-key",
                    "value": "{{subscriptionKey}}"
                  }
                ],
                "body": {
                  "mode": "graphql",
                  "graphql": {
                    "query": "query  ($id : UUID!) {\r\n    customers\r\n     (where : { id : { eq : $id }})  {\r\n        edges {\r\n            node {\r\n                    id   \r\n                socialName\r\n                tradeName\r\n                code\r\n                documentId\r\n                documentTypeId\r\n                countryAcronym\r\n                addresses {\r\n                    id\r\n                    firstLine\r\n                    secondLine\r\n                    city\r\n                    zipCode\r\n                    countryId\r\n                    countryName\r\n                    name\r\n                    isDeliveryAddress\r\n                    isDefaultDeliveryAddress\r\n                }\r\n                contacts{\r\n                isDefault\r\n                courtesy\r\n                name\r\n                surname\r\n                emails {\r\n                    emailAddress\r\n                    usage\r\n                }\r\n                phones {\r\n                    number\r\n                    type\r\n                }\r\n                socialMedias {\r\n                    link\r\n                    name\r\n                }\r\n                isDefault\r\n                }\r\n                paymentTermLines {\r\n                    id\r\n                    day\r\n                    condition\r\n                    type\r\n                    value\r\n                    payDays\r\n                    order\r\n                }\r\n                defaultAccountingAccountId              \r\n            }\r\n        }\r\n    }   \r\n}\r\n",
                    "variables": "{\r\n  \"id\":\"{{customerId}}\"\r\n}"
                  }
                },
                "url": {
                  "raw": "{{baseAddress}}/graphql",
                  "host": [
                    "{{baseAddress}}"
                  ],
                  "path": [
                    "graphql"
                  ]
                }
              },
              "response": []
            },
            {
              "name": "3 - M.deletecustomer {{customerId}}",
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "X-OrganizationId",
                    "value": "{{X-OrganizationId}}"
                  },
                  {
                    "key": "x-api-key",
                    "value": "{{subscriptionKey}}"
                  }
                ],
                "body": {
                  "mode": "graphql",
                  "graphql": {
                    "query": "mutation ($values:CustomerDeleteGLDtoInput!) {\r\n    deleteCustomer(input: $values) {\r\n    id\r\n  }\r\n}",
                    "variables": "{\r\n  \"values\":{\r\n    \"id\":\"{{customerId}}\"\r\n  }\r\n}"
                  }
                },
                "url": {
                  "raw": "{{baseAddress}}/graphql",
                  "host": [
                    "{{baseAddress}}"
                  ],
                  "path": [
                    "graphql"
                  ]
                }
              },
              "response": []
            },
            {
              "name": "4 - M.createCustomer with code & contact - {{customerId}} filled in",
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "exec": [
                      "pm.test(\"Variables creation\", function () {\r",
                      "    let jsd = pm.response.json();\r",
                      "\r",
                      "    if (jsd.data == null)\r",
                      "        {console.error(\"Unable to save environment variable\");return;}\r",
                      "\r",
                      "    let result = jsd.data.createCustomer;\r",
                      "    pm.environment.set(\"customerId\", result.id);\r",
                      "    console.log(\"'customerId' environment variable has been created : \" + pm.environment.get(\"customerId\"));\r",
                      "});\r",
                      ""
                    ],
                    "type": "text/javascript",
                    "packages": {},
                    "requests": {}
                  }
                },
                {
                  "listen": "prerequest",
                  "script": {
                    "exec": [
                      "let legislationCode = pm.environment.get(\"legislationCode\");\r",
                      "\r",
                      "if (legislationCode === 'FR') {\r",
                      "    pm.environment.set(\"identificationNumber\", \"926137611\");\r",
                      "    pm.environment.set(\"vatNumber\",\"FR33926137611\");\r",
                      "    pm.environment.set(\"code\",\"POSTMANDEMO\");\r",
                      "} else if (legislationCode === 'ES') {\r",
                      "    pm.environment.set(\"identificationNumber\", \"Y0476607S\");\r",
                      "    pm.environment.set(\"vatNumber\",\"ESY0476607S\");\r",
                      "    pm.environment.set(\"code\",\"POSTMANDEMO\");\r",
                      "} else if (legislationCode === 'DE') {\r",
                      "    pm.environment.set(\"identificationNumber\", \"90881100521\");\r",
                      "    pm.environment.set(\"vatNumber\",\"DE908811005\");\r",
                      "    pm.environment.set(\"code\",\"10200\");\r",
                      "} else {\r",
                      "    console.error(\"Unexpected legislationCode value\");\r",
                      "    return;\r",
                      "}\r",
                      "\r",
                      "console.log(\"'identificationNumber' & 'vatNumber' environment variables has been created with value: \" \r",
                      "    + pm.environment.get(\"identificationNumber\")+\" - \"+pm.environment.get(\"vatNumber\"));\r",
                      ""
                    ],
                    "type": "text/javascript",
                    "packages": {},
                    "requests": {}
                  }
                }
              ],
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "X-OrganizationId",
                    "value": "{{X-OrganizationId}}"
                  },
                  {
                    "key": "x-api-key",
                    "value": "{{subscriptionKey}}"
                  }
                ],
                "body": {
                  "mode": "graphql",
                  "graphql": {
                    "query": "mutation ($values: CustomerCreateGLDtoInput!) {  \r\n  createCustomer (input: $values) {\r\n    id\r\n    code\r\n  }\r\n}\r\n",
                    "variables": "{\r\n  \"values\":{\r\n    \"code\": \"{{code}}\",\r\n    \"documentId\":\"{{identificationNumber}}\",\r\n    \"vatNumber\":\"{{vatNumber}}\",\r\n    \"socialName\": \"Postman demo\",\r\n    \"tradeName\": \"POSTMANDEMO\",\r\n    \"addresses\": [{\r\n      \"firstLine\": \"123 Generic street\",\r\n      \"city\": \"Generic City\",\r\n      \"zipCode\": \"12345\",\r\n      \"countryIsoCodeAlpha2\":\"{{legislationCode}}\"\r\n    }],\r\n    \"contacts\":[{\r\n      \"isDefault\":true,\r\n      \"courtesy\":\"MR\",\r\n      \"name\":\"John\",\r\n      \"surname\":\"Smith\",\r\n      \"phones\":[{\r\n          \"isDefault\":true,\r\n          \"number\":\"01 02 03 04 05\",\r\n          \"type\":\"EMPTY\"\r\n      },\r\n      {\r\n          \"number\":\"06 07 08 09 10\",\r\n          \"type\":\"MOBILE\"\r\n      }],\r\n      \"emails\":[{\r\n          \"emailAddress\":\"smith@customerdemo.com\",\r\n          \"usage\":\"EMPTY\"\r\n      },\r\n      {\r\n          \"emailAddress\":\"info@customerdemo.com\",\r\n          \"usage\":\"PAYMENTS\",\r\n          \"isDefault\":true\r\n      }]\r\n    },\r\n    {\r\n      \"isDefault\":false,\r\n      \"name\":\"Infos\",\r\n      \"socialMedias\":[{\r\n          \"name\":\"site1\",\r\n          \"link\":\"www.customerdemo.com\"\r\n      }]\r\n    }]\r\n  }\r\n}\r\n"
                  }
                },
                "url": {
                  "raw": "{{baseAddress}}/graphql",
                  "host": [
                    "{{baseAddress}}"
                  ],
                  "path": [
                    "graphql"
                  ]
                }
              },
              "response": []
            },
            {
              "name": "5 - Q.customers filtered by Id",
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "exec": [
                      "pm.test(\"Variables creation\", function () {\r",
                      "    let jsd = pm.response.json();\r",
                      "\r",
                      "    if (jsd.data == null || jsd.data.customers.edges.length === 0)\r",
                      "        {console.error(\"Unable to save environment variable\");return;}\r",
                      "    let cust = jsd.data.customers.edges[0].node;\r",
                      "    if (cust.addresses && cust.addresses.length > 0)\r",
                      "    {\r",
                      "      pm.environment.set(\"custAddressId\", cust.addresses[0].id);\r",
                      "      console.log(\"'custAddressId' environment variable has been created : \" + pm.environment.get(\"custAddressId\"));\r",
                      "    }\r",
                      "});\r",
                      ""
                    ],
                    "type": "text/javascript"
                  }
                }
              ],
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "X-OrganizationId",
                    "value": "{{X-OrganizationId}}"
                  },
                  {
                    "key": "x-api-key",
                    "value": "{{subscriptionKey}}"
                  }
                ],
                "body": {
                  "mode": "graphql",
                  "graphql": {
                    "query": "query  ($id : UUID!) {\r\n    customers\r\n     (where : { id : { eq : $id }})  {\r\n        edges {\r\n            node {\r\n                    id   \r\n                socialName\r\n                tradeName\r\n                code\r\n                documentId\r\n                documentTypeId\r\n                countryAcronym\r\n                addresses {\r\n                    id\r\n                    firstLine\r\n                    secondLine\r\n                    city\r\n                    zipCode\r\n                    countryId\r\n                    countryName\r\n                    name\r\n                    isDeliveryAddress\r\n                    isDefaultDeliveryAddress\r\n                }\r\n                contacts{\r\n                isDefault\r\n                courtesy\r\n                name\r\n                surname\r\n                emails {\r\n                    emailAddress\r\n                    usage\r\n                }\r\n                phones {\r\n                    number\r\n                    type\r\n                }\r\n                socialMedias {\r\n                    link\r\n                    name\r\n                }\r\n                isDefault\r\n                }\r\n                paymentTermLines {\r\n                    id\r\n                    day\r\n                    condition\r\n                    type\r\n                    value\r\n                    payDays\r\n                    order\r\n                }\r\n                defaultAccountingAccountId              \r\n            }\r\n        }\r\n    }   \r\n}\r\n",
                    "variables": "{\r\n  \"id\":\"{{customerId}}\"\r\n}"
                  }
                },
                "url": {
                  "raw": "{{baseAddress}}/graphql",
                  "host": [
                    "{{baseAddress}}"
                  ],
                  "path": [
                    "graphql"
                  ]
                }
              },
              "response": []
            },
            {
              "name": "6 - M.updateCustomer {{customerId}}",
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "exec": [
                      ""
                    ],
                    "type": "text/javascript"
                  }
                }
              ],
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "X-OrganizationId",
                    "value": "{{X-OrganizationId}}"
                  },
                  {
                    "key": "x-api-key",
                    "value": "{{subscriptionKey}}"
                  }
                ],
                "body": {
                  "mode": "graphql",
                  "graphql": {
                    "query": "mutation ($values: CustomerUpdateGLDtoInput!) {  \r\n  updateCustomer (input: $values) {\r\n    id\r\n  }\r\n}\r\n",
                    "variables": "{\r\n  \"values\":{\r\n    \"id\":\"{{customerId}}\",\r\n    \"addresses\": [{\r\n      \"id\": \"{{custAddressId}}\",\r\n      \"requestedAction\":\"MODIFY\",\r\n      \"firstLine\": \"Rue tête d'Or MODIFY\"\r\n    }]\r\n }\r\n}\r\n    "
                  }
                },
                "url": {
                  "raw": "{{baseAddress}}/graphql",
                  "host": [
                    "{{baseAddress}}"
                  ],
                  "path": [
                    "graphql"
                  ]
                }
              },
              "response": []
            },
            {
              "name": "7 - Q.customers filtered by Id  Updated",
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "exec": [
                      ""
                    ],
                    "type": "text/javascript"
                  }
                }
              ],
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "X-OrganizationId",
                    "value": "{{X-OrganizationId}}"
                  },
                  {
                    "key": "x-api-key",
                    "value": "{{subscriptionKey}}"
                  }
                ],
                "body": {
                  "mode": "graphql",
                  "graphql": {
                    "query": "query  ($id : UUID!) {\r\n    customers\r\n     (where : { id : { eq : $id }})  {\r\n        edges {\r\n            node {\r\n                    id   \r\n                socialName\r\n                tradeName\r\n                code\r\n                documentId\r\n                documentTypeId\r\n                countryAcronym\r\n                addresses {\r\n                    id\r\n                    firstLine\r\n                    secondLine\r\n                    city\r\n                    zipCode\r\n                    countryId\r\n                    countryName\r\n                    name\r\n                    isDeliveryAddress\r\n                    isDefaultDeliveryAddress\r\n                }\r\n                contacts{\r\n                isDefault\r\n                courtesy\r\n                name\r\n                surname\r\n                emails {\r\n                    emailAddress\r\n                    usage\r\n                }\r\n                phones {\r\n                    number\r\n                    type\r\n                }\r\n                socialMedias {\r\n                    link\r\n                    name\r\n                }\r\n                isDefault\r\n                }\r\n                paymentTermLines {\r\n                    id\r\n                    day\r\n                    condition\r\n                    type\r\n                    value\r\n                    payDays\r\n                    order\r\n                }\r\n                defaultAccountingAccountId              \r\n            }\r\n        }\r\n    }   \r\n}\r\n\r\n",
                    "variables": "{\r\n  \"id\":\"{{customerId}}\"\r\n}"
                  }
                },
                "url": {
                  "raw": "{{baseAddress}}/graphql",
                  "host": [
                    "{{baseAddress}}"
                  ],
                  "path": [
                    "graphql"
                  ]
                }
              },
              "response": []
            },
            {
              "name": "8 - M.deletecustomer {{customerId}}",
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "X-OrganizationId",
                    "value": "{{X-OrganizationId}}"
                  },
                  {
                    "key": "x-api-key",
                    "value": "{{subscriptionKey}}"
                  }
                ],
                "body": {
                  "mode": "graphql",
                  "graphql": {
                    "query": "mutation ($values:CustomerDeleteGLDtoInput!) {\r\n    deleteCustomer(input: $values) {\r\n    id\r\n  }\r\n}",
                    "variables": "{\r\n  \"values\":{\r\n    \"id\":\"{{customerId}}\"\r\n  }\r\n}"
                  }
                },
                "url": {
                  "raw": "{{baseAddress}}/graphql",
                  "host": [
                    "{{baseAddress}}"
                  ],
                  "path": [
                    "graphql"
                  ]
                }
              },
              "response": []
            }
          ],
          "description": "The initial example for creation without a code **assumes that automatic numbering for the Customer resource is not inactive** in Sage Active under _Configuration > Company > Sequence Numbers._"
        },
        {
          "name": "M.create an account, then update it, then delete it",
          "item": [
            {
              "name": "1- Q.taxTreatments;  id filled in {taxTreatmentId}}",
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "exec": [
                      "pm.test(\"Variables creation\", function () {\r",
                      "    let jsd = pm.response.json();\r",
                      "\r",
                      "    if (jsd.data == null || jsd.data.taxTreatments.edges.length == 0)\r",
                      "        {console.error(\"Unable to save environment variable\");return;}\r",
                      "    pm.environment.set(\"taxTreatmentId\", jsd.data.taxTreatments.edges[0].node.id);\r",
                      "    console.log(\"'taxTreatmentId' environment variable has been created : \" + pm.environment.get(\"taxTreatmentId\"));\r",
                      "});\r",
                      ""
                    ],
                    "type": "text/javascript",
                    "packages": {}
                  }
                }
              ],
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "X-OrganizationId",
                    "value": "{{X-OrganizationId}}"
                  },
                  {
                    "key": "x-api-key",
                    "value": "{{subscriptionKey}}"
                  }
                ],
                "body": {
                  "mode": "graphql",
                  "graphql": {
                    "query": "query {\r\n    taxTreatments (\r\n        where: { \r\n        or: [\r\n            {taxCode: {eq:\"C0005\"}},\r\n            {taxCode: {eq:\"C001\"}},\r\n        ]}\r\n        ) {\r\n        edges {\r\n            node {\r\n                taxCode\r\n                id\r\n            }\r\n        }\r\n    }     \r\n}",
                    "variables": ""
                  }
                },
                "url": {
                  "raw": "{{baseAddress}}/graphql",
                  "host": [
                    "{{baseAddress}}"
                  ],
                  "path": [
                    "graphql"
                  ]
                }
              },
              "response": []
            },
            {
              "name": "2- M.createAccountingAccount  - new id filled in {{currentId}}",
              "event": [
                {
                  "listen": "prerequest",
                  "script": {
                    "exec": [
                      "let legislationCode = pm.environment.get(\"legislationCode\");\r",
                      "\r",
                      "if (legislationCode === 'FR') {\r",
                      "    pm.environment.set(\"accountCode\", \"626200001\");\r",
                      "} else if (legislationCode === 'ES') {\r",
                      "    pm.environment.set(\"accountCode\", \"62620001\");\r",
                      "} else if (legislationCode === 'DE') {\r",
                      "    pm.environment.set(\"accountCode\", \"3011\");\r",
                      "} else {\r",
                      "    console.error(\"Unexpected legislationCode value\");\r",
                      "    return;\r",
                      "}\r",
                      "\r",
                      "console.log(\"'accountCode' environment variable has been created with value: \" \r",
                      "    + pm.environment.get(\"accountCode\"));\r",
                      ""
                    ],
                    "type": "text/javascript",
                    "packages": {}
                  }
                },
                {
                  "listen": "test",
                  "script": {
                    "exec": [
                      "pm.test(\"Variables creation\", function () {\r",
                      "    let jsd = pm.response.json();\r",
                      "\r",
                      "    if (jsd.data == null || jsd.data.createAccountingAccount == null)\r",
                      "        {console.error(\"Unable to save environment variable\");return;}\r",
                      "    pm.environment.set(\"currentId\", jsd.data.createAccountingAccount.id);\r",
                      "    console.log(\"'currentId' environment variable has been created : \" + pm.environment.get(\"currentId\"));\r",
                      "});\r",
                      ""
                    ],
                    "type": "text/javascript",
                    "packages": {}
                  }
                }
              ],
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "X-OrganizationId",
                    "value": "{{X-OrganizationId}}"
                  },
                  {
                    "key": "x-api-key",
                    "value": "{{subscriptionKey}}"
                  }
                ],
                "body": {
                  "mode": "graphql",
                  "graphql": {
                    "query": "mutation ($values: AccountingAccountCreateGLDtoInput!) {  \r\n    createAccountingAccount(input: $values) {\r\n    id\r\n  }\r\n}",
                    "variables": "{\r\n  \"values\": {\r\n    \"accountLevel\": \"SUB_ACCOUNT\",\r\n    \"accountType\": \"INCOME_STATEMENT\",\r\n    \"code\": \"{{accountCode}}\",\r\n    \"name\": \"Phone\",\r\n    \"description\": \"\",\r\n    \"subAccountType\": \"CHARGE\",\r\n    \"taxTreatmentId\": \"{{taxTreatmentId}}\"\r\n  }\r\n} "
                  }
                },
                "url": {
                  "raw": "{{baseAddress}}/graphql",
                  "host": [
                    "{{baseAddress}}"
                  ],
                  "path": [
                    "graphql"
                  ]
                }
              },
              "response": []
            },
            {
              "name": "3- M.updateAccountingAccount  {{currentId}}",
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "X-OrganizationId",
                    "value": "{{X-OrganizationId}}"
                  },
                  {
                    "key": "x-api-key",
                    "value": "{{subscriptionKey}}"
                  }
                ],
                "body": {
                  "mode": "graphql",
                  "graphql": {
                    "query": "mutation ($values: AccountingAccountUpdateGLDtoInput!) {  \r\n    updateAccountingAccount(input: $values) {\r\n    id\r\n  }\r\n}",
                    "variables": "{\r\n  \"values\":{\r\n    \"id\": \"{{currentId}}\",\r\n    \"name\": \"Telephone 222\",\r\n    \"description\": \"\",\r\n    \"subAccountType\": \"CHARGE\",\r\n    \"taxTreatmentId\": \"{{taxTreatmentId}}\"\r\n  }\r\n} "
                  }
                },
                "url": {
                  "raw": "{{baseAddress}}/graphql",
                  "host": [
                    "{{baseAddress}}"
                  ],
                  "path": [
                    "graphql"
                  ]
                }
              },
              "response": []
            },
            {
              "name": "4- M.deleteAccountingAccount  {{currentId}}",
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "X-OrganizationId",
                    "value": "{{X-OrganizationId}}"
                  },
                  {
                    "key": "x-api-key",
                    "value": "{{subscriptionKey}}"
                  }
                ],
                "body": {
                  "mode": "graphql",
                  "graphql": {
                    "query": "mutation ($values:AccountingAccountDeleteGLDtoInput!) {\r\n    deleteAccountingAccount(input: $values) {\r\n    id\r\n  }\r\n}",
                    "variables": "{\r\n  \"values\":{\r\n    \"id\":\"{{currentId}}\"\r\n  }\r\n}"
                  }
                },
                "url": {
                  "raw": "{{baseAddress}}/graphql",
                  "host": [
                    "{{baseAddress}}"
                  ],
                  "path": [
                    "graphql"
                  ]
                }
              },
              "response": []
            }
          ],
          "description": "Step 1 will allow you to retrieve a tax code to associate with the account to be created."
        },
        {
          "name": "M.create Accounting Entries using codes, then delete it",
          "item": [
            {
              "name": "1- Q.accountingExercises - most recently opened, startDate filled in {{dateInFirstExercice}}",
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "exec": [
                      "pm.test(\"Variables creation\", function () {\r",
                      "    let jsd = pm.response.json();\r",
                      "    console.log(jsd.data.accountingExercises.edges[0].node.id);\r",
                      "    if (jsd.data == null || jsd.data.accountingExercises.edges.length == 0)\r",
                      "        {console.error(\"Unable to save environment variable\");return;}\r",
                      "    pm.environment.set(\"dateInFirstExercice\",jsd.data.accountingExercises.edges[0].node.startDate);\r",
                      "    console.log(\"'dateInFirstExercice' environment variable has been created : \" + pm.environment.get(\"dateInFirstExercice\"));\r",
                      "});\r",
                      "\r",
                      ""
                    ],
                    "type": "text/javascript"
                  }
                }
              ],
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "X-OrganizationId",
                    "value": "{{X-OrganizationId}}"
                  },
                  {
                    "key": "x-api-key",
                    "value": "{{subscriptionKey}}"
                  }
                ],
                "body": {
                  "mode": "graphql",
                  "graphql": {
                    "query": "query {\r\n    accountingExercises(\r\n        where: {status: {eq: OPEN}}\r\n        last:1\r\n        ) {\r\n        edges {\r\n            node {\r\n               startDate\r\n            }\r\n        }\r\n    }     \r\n}",
                    "variables": ""
                  }
                },
                "url": {
                  "raw": "{{baseAddress}}/graphql",
                  "host": [
                    "{{baseAddress}}"
                  ],
                  "path": [
                    "graphql"
                  ]
                }
              },
              "response": []
            },
            {
              "name": "2- Q.journalTypes - first type SALES_INVOICE",
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "exec": [
                      "pm.test(\"Variables creation\", function () {\r",
                      "    let jsd = pm.response.json();\r",
                      "\r",
                      "    if (jsd.data == null || jsd.data.journalTypes.edges.length == 0)\r",
                      "        {console.error(\"Unable to save environment variable\");return;}\r",
                      "    pm.environment.set(\"journalSalesCode\", jsd.data.journalTypes.edges[0].node.code);\r",
                      "     console.log(\"'journalSalesCode' environment variable has been created : \" + pm.environment.get(\"journalSalesCode\"));\r",
                      "\r",
                      "});"
                    ],
                    "type": "text/javascript"
                  }
                }
              ],
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "X-OrganizationId",
                    "value": "{{X-OrganizationId}}"
                  },
                  {
                    "key": "x-api-key",
                    "value": "{{subscriptionKey}}"
                  }
                ],
                "body": {
                  "mode": "graphql",
                  "graphql": {
                    "query": "query {\r\n     journalTypes(\r\n         where: {type: {eq: SALES_INVOICE}}\r\n         first:1) {\r\n        edges {\r\n            node {\r\n               code\r\n            }\r\n        }\r\n    }     \r\n}",
                    "variables": ""
                  }
                },
                "url": {
                  "raw": "{{baseAddress}}/graphql",
                  "host": [
                    "{{baseAddress}}"
                  ],
                  "path": [
                    "graphql"
                  ]
                }
              },
              "response": []
            },
            {
              "name": "3-Q.customers - first activated with account",
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "exec": [
                      "pm.test(\"Variables creation\", function () {\r",
                      "    let jsd = pm.response.json();\r",
                      "\r",
                      "    if (jsd.data == null || jsd.data.customers.edges.length == 0)\r",
                      "        {console.error(\"Unable to save environment variable\");return;}\r",
                      "    pm.environment.set(\"customerCode\", jsd.data.customers.edges[0].node.code);\r",
                      "    console.log(\"customerCode environment variable has been created : \" + pm.environment.get(\"customerCode\"));\r",
                      "    pm.environment.set(\"defaultAccountingAccountId\", jsd.data.customers.edges[0].node.defaultAccountingAccountId);\r",
                      "    console.log(\"defaultAccountingAccountId environment variable has been created : \" + pm.environment.get(\"defaultAccountingAccountId\"));\r",
                      "});"
                    ],
                    "type": "text/javascript",
                    "packages": {},
                    "requests": {}
                  }
                },
                {
                  "listen": "prerequest",
                  "script": {
                    "exec": [
                      ""
                    ],
                    "type": "text/javascript",
                    "packages": {},
                    "requests": {}
                  }
                }
              ],
              "request": {
                "auth": {
                  "type": "bearer",
                  "bearer": [
                    {
                      "key": "token",
                      "value": "{{accessToken}}",
                      "type": "string"
                    }
                  ]
                },
                "method": "POST",
                "header": [
                  {
                    "key": "X-OrganizationId",
                    "value": "{{X-OrganizationId}}"
                  },
                  {
                    "key": "x-api-key",
                    "value": "{{subscriptionKey}}"
                  }
                ],
                "body": {
                  "mode": "graphql",
                  "graphql": {
                    "query": "query {\r\n    customers (\r\n        order: [{ code: ASC }]\r\n        where: {\r\n            disabled: {eq: false}\r\n            socialName: {neq:\"Postman demo\"}\r\n            }\r\n        first:1\r\n        ) {\r\n        edges {\r\n            node {\r\n                  code\r\n                  defaultAccountingAccountId\r\n            }\r\n        }\r\n    }   \r\n}",
                    "variables": ""
                  }
                },
                "url": {
                  "raw": "{{baseAddress}}/graphql",
                  "host": [
                    "{{baseAddress}}"
                  ],
                  "path": [
                    "graphql"
                  ]
                }
              },
              "response": []
            },
            {
              "name": "4- Q.accountingAccounts sales & tax account",
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "exec": [
                      "pm.test(\"Variables creation\", function () {\r",
                      "    let jsd = pm.response.json();\r",
                      "    let edges = jsd.data?.accountingAccounts?.edges;\r",
                      "    if (edges == null || edges.length < 2)\r",
                      "        {console.error(\"Unable to save environment variable\");return;}\r",
                      "\r",
                      "    let salesAccount = pm.environment.get(\"salesAccount\");\r",
                      "    let taxAccount = pm.environment.get(\"taxAccount\");\r",
                      "\r",
                      "    for(let edge of edges) {\r",
                      "        let code = edge.node.code;\r",
                      "        if(code.startsWith(salesAccount)) {\r",
                      "            pm.environment.set(\"salesAccountCode\", code);\r",
                      "            console.log(\"'salesAccountCode' environment variable has been created : \" + pm.environment.get(\"salesAccountCode\"));\r",
                      "        } else if(code.startsWith(taxAccount)) {\r",
                      "            pm.environment.set(\"taxAccountCode\", code);\r",
                      "            console.log(\"'taxAccountCode' environment variable has been created : \" + pm.environment.get(\"taxAccountCode\"));\r",
                      "        }\r",
                      "        else{\r",
                      "            pm.environment.set(\"thirdLedgerAccountCode\", code);\r",
                      "            console.log(\"'thirdLedgerAccountCode' environment variable has been created : \" + pm.environment.get(\"thirdLedgerAccountCode\"));\r",
                      "        }\r",
                      "    }\r",
                      "});\r",
                      ""
                    ],
                    "type": "text/javascript",
                    "packages": {}
                  }
                },
                {
                  "listen": "prerequest",
                  "script": {
                    "exec": [
                      "let legislationCode = pm.environment.get(\"legislationCode\");\r",
                      "\r",
                      "if (legislationCode === 'FR') {\r",
                      "    pm.environment.set(\"salesAccount\", \"70105\");\r",
                      "    pm.environment.set(\"taxAccount\", \"445715\");\r",
                      "} else if (legislationCode === 'ES') {\r",
                      "    pm.environment.set(\"salesAccount\", \"70100\");\r",
                      "    pm.environment.set(\"taxAccount\", \"477000\");\r",
                      "} else if (legislationCode === 'DE') {\r",
                      "    pm.environment.set(\"salesAccount\", \"8300\");\r",
                      "    pm.environment.set(\"taxAccount\", \"1771\");\r",
                      "} else {\r",
                      "    console.error(\"Unexpected legislationCode value\");\r",
                      "    return;\r",
                      "}\r",
                      "\r",
                      "console.log(\"'salesAccount' environment variable has been created : \" + pm.environment.get(\"salesAccount\"));\r",
                      "console.log(\"'taxAccount' environment variable has been created : \" + pm.environment.get(\"taxAccount\"));\r",
                      ""
                    ],
                    "type": "text/javascript",
                    "packages": {}
                  }
                }
              ],
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "X-OrganizationId",
                    "value": "{{X-OrganizationId}}"
                  },
                  {
                    "key": "x-api-key",
                    "value": "{{subscriptionKey}}"
                  }
                ],
                "body": {
                  "mode": "graphql",
                  "graphql": {
                    "query": "query ($salesAccount : String!, $taxAccount : String!, $thirdLedgerAccount: UUID!) {\r\n    accountingAccounts (\r\n        where: { \r\n              or: [\r\n                { code: {startsWith: $salesAccount} },\r\n                { code: {startsWith: $taxAccount} }\r\n                { id: {eq: $thirdLedgerAccount} }\r\n              ],\r\n              deactivated: {eq:false},\r\n              accountLevel: {eq:SUB_ACCOUNT}\r\n        },\r\n    ) {\r\n        edges {\r\n            node {\r\n                code\r\n\r\n            }\r\n        }\r\n    }    \r\n}\r\n",
                    "variables": "{\r\n    \"salesAccount\":\"{{salesAccount}}\",\r\n    \"taxAccount\":\"{{taxAccount}}\",\r\n    \"thirdLedgerAccount\":\"{{defaultAccountingAccountId}}\"\r\n}\r\n"
                  }
                },
                "url": {
                  "raw": "{{baseAddress}}/graphql",
                  "host": [
                    "{{baseAddress}}"
                  ],
                  "path": [
                    "graphql"
                  ]
                }
              },
              "response": []
            },
            {
              "name": "5- M.CreateAccountingEntry Sales - new id filled in {{currentId}}",
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "exec": [
                      "pm.test(\"Variable creation\", function () {\r",
                      "    let jsd = pm.response.json();\r",
                      "\r",
                      "    if (jsd.data == null || jsd.data.createAccountingEntryUsingCodes == null)\r",
                      "        {console.error(\"Unable to save environment variable\");return;}\r",
                      "    let result = jsd.data.createAccountingEntryUsingCodes;\r",
                      "    pm.environment.set(\"currentId\", result.id);\r",
                      "    console.log(\"'currentId' environment variable has been created : \" + pm.environment.get(\"currentId\"));\r",
                      "});\r",
                      ""
                    ],
                    "type": "text/javascript",
                    "packages": {},
                    "requests": {}
                  }
                },
                {
                  "listen": "prerequest",
                  "script": {
                    "exec": [
                      "let taxBase = 150;\r",
                      "pm.environment.set(\"taxBase\", taxBase);\r",
                      "console.log(\"'taxBase' environment variable has been created : \" + pm.environment.get(\"taxBase\"));\r",
                      "\r",
                      "let legislationCode = pm.environment.get(\"legislationCode\");\r",
                      "let subAccountThird;\r",
                      "let taxPercentage;\r",
                      "if (legislationCode === 'FR') {\r",
                      "     taxPercentage=5.5;\r",
                      "} else if (legislationCode === 'ES') {\r",
                      "     taxPercentage=10;\r",
                      "} else if (legislationCode === 'DE') {\r",
                      "     taxPercentage=7;\r",
                      "} else {\r",
                      "    console.error(\"Unexpected legislationCode value\");\r",
                      "    return;\r",
                      "}\r",
                      "\r",
                      "let taxAmount = (taxBase * taxPercentage) / 100;\r",
                      "pm.environment.set(\"taxAmount\", taxAmount);\r",
                      "console.log(\"'taxAmount' environment variable has been created : \" + pm.environment.get(\"taxAmount\"));\r",
                      "\r",
                      "let amountIncludingTax = taxBase + taxAmount;\r",
                      "pm.environment.set(\"amountIncludingTax\", amountIncludingTax);\r",
                      "console.log(\"'amountIncludingTax' environment variable has been created : \" + pm.environment.get(\"amountIncludingTax\"));\r",
                      "\r",
                      ""
                    ],
                    "type": "text/javascript",
                    "packages": {},
                    "requests": {}
                  }
                }
              ],
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "X-OrganizationId",
                    "value": "{{X-OrganizationId}}"
                  },
                  {
                    "key": "x-api-key",
                    "value": "{{subscriptionKey}}"
                  }
                ],
                "body": {
                  "mode": "graphql",
                  "graphql": {
                    "query": "mutation CreateAccountingEntryUsingCodes ($values:AccountingEntryCreateUsingCodesGLDtoInput!) {    \r\n  createAccountingEntryUsingCodes (input: $values) {\r\n    id\r\n    number\r\n  }\r\n}\r\n",
                    "variables": "{\r\n    \"values\":{\r\n      \"description\": \"Facture FA0022\",\r\n      \"date\": \"{{dateInFirstExercice}}\",\r\n      \"documentDate\" : \"{{dateInFirstExercice}}\",\r\n      \"documentNumber\" : \"FA0022\",\r\n      \"journalTypeCode\": \"{{journalSalesCode}}\",\r\n      \"accountingEntryLines\": [\r\n        {\r\n          \"thirdCode\":\"{{customerCode}}\",\r\n          \"creditAmount\": 0,\r\n          \"debitAmount\": {{amountIncludingTax}},\r\n          \"subAccountCode\": \"{{thirdLedgerAccountCode}}\"\r\n        },\r\n        {\r\n          \"creditAmount\": {{taxBase}},\r\n          \"debitAmount\": 0,\r\n          \"subAccountCode\": \"{{salesAccountCode}}\"\r\n        },\r\n        {\r\n          \"creditAmount\": {{taxAmount}},\r\n          \"debitAmount\": 0,\r\n          \"subAccountCode\": \"{{taxAccountCode}}\"\r\n        }\r\n      ]\r\n    }\r\n}\r\n"
                  }
                },
                "url": {
                  "raw": "{{baseAddress}}/graphql",
                  "host": [
                    "{{baseAddress}}"
                  ],
                  "path": [
                    "graphql"
                  ]
                }
              },
              "response": []
            },
            {
              "name": "6- M.deleteAccountingEntry {{currentId}}",
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "X-OrganizationId",
                    "value": "{{X-OrganizationId}}"
                  },
                  {
                    "key": "x-api-key",
                    "value": "{{subscriptionKey}}"
                  }
                ],
                "body": {
                  "mode": "graphql",
                  "graphql": {
                    "query": "mutation ($values:AccountingEntryDeleteGLDtoInput!) {\r\n    deleteAccountingEntry(input: $values) {\r\n    id\r\n  }\r\n}",
                    "variables": "{\r\n  \"values\":{\r\n    \"id\":\"{{currentId}}\"\r\n  }\r\n}"
                  }
                },
                "url": {
                  "raw": "{{baseAddress}}/graphql",
                  "host": [
                    "{{baseAddress}}"
                  ],
                  "path": [
                    "graphql"
                  ]
                }
              },
              "response": []
            }
          ],
          "description": "The steps 1 to 5 will allow you to retrieve data necessary for the creation of the accounting entry :\n\n1. a valid date in an open fiscal period,\n    \n2. a journal code,\n    \n3. a customer code, and their general ledger account code\n    \n4. a sales and tax account codes.\n    \n\n**You must execute these steps in the specified order** before requesting the creation of the accounting entry."
        }
      ]
    },
    {
      "name": "Reference : common to all organizations",
      "item": [
        {
          "name": "Organizations",
          "item": [
            {
              "name": "✏️Q.organizations",
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "exec": [
                      ""
                    ],
                    "type": "text/javascript",
                    "packages": {},
                    "requests": {}
                  }
                }
              ],
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "x-api-key",
                    "value": "{{subscriptionKey}}"
                  }
                ],
                "body": {
                  "mode": "graphql",
                  "graphql": {
                    "query": "query {\r\n    organizations {\r\n        edges {\r\n            node {\r\n                id\r\n                onboardingCompleted\r\n                onboardingDateCompleted\r\n                legislationCode\r\n                socialName\r\n                creationDate\r\n                modificationDate\r\n                vatCriterion\r\n                currency{\r\n                    code\r\n                }\r\n                datevClientNumber\r\n                datevConsultantNumber\r\n                taxAuditExportNotes\r\n                emailMessage\r\n                emailSubject\r\n                sendEmailCopy\r\n                useWithholdingForSales\r\n                useWithholdingTaxTreatmentId\r\n                taxOfficialModelsOrganization{\r\n                    periodicity\r\n                    description\r\n                    initialDate\r\n                    finalDate\r\n                    territory\r\n                }\r\n                addresses {\r\n                    firstLine\r\n                    secondLine\r\n                    countryName\r\n                    countryId\r\n                    zipCode\r\n                    city\r\n                    province\r\n                    organizationId\r\n                    modificationDate\r\n                }\r\n                documentTypeId\r\n                contacts {\r\n                    creationDate\r\n                    modificationDate\r\n                    isDefault\r\n                    emails\r\n                    {\r\n                        creationDate\r\n                        modificationDate\r\n                        isDefault\r\n                        emailAddress\r\n                        usage                        \r\n                    }\r\n                    phones {\r\n                        id\r\n                        number                        \r\n                    }\r\n                    socialMedias {\r\n                        name\r\n                        link                        \r\n                    }\r\n                }\r\n            }\r\n        }\r\n        totalCount\r\n        pageInfo {\r\n            hasNextPage\r\n        }\r\n    }     \r\n}",
                    "variables": ""
                  }
                },
                "url": {
                  "raw": "{{baseAddress}}/graphql",
                  "host": [
                    "{{baseAddress}}"
                  ],
                  "path": [
                    "graphql"
                  ]
                }
              },
              "response": []
            },
            {
              "name": "Q.Number of Records per Organization Entity",
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "exec": [
                      ""
                    ],
                    "type": "text/javascript",
                    "packages": {},
                    "requests": {}
                  }
                }
              ],
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "X-OrganizationId",
                    "value": "{{X-OrganizationId}}",
                    "type": "text"
                  },
                  {
                    "key": "x-api-key",
                    "value": "{{subscriptionKey}}"
                  }
                ],
                "body": {
                  "mode": "graphql",
                  "graphql": {
                    "query": " query ($id:UUID){\r\n    organizations \r\n    (where : { id : { eq : $id }}) {\r\n        edges {\r\n            node {\r\n                id\r\n                socialName\r\n            }\r\n        }\r\n        totalCount\r\n    },\r\n    products { totalCount },\r\n    customers { totalCount },\r\n    suppliers { totalCount },\r\n    employees { totalCount },\r\n    journalTypes { totalCount },\r\n    accountingAccounts { totalCount },\r\n    accountingEntries { totalCount },\r\n    accountingEntryLines { totalCount },\r\n    salesQuotes { totalCount },\r\n    salesQuoteLines { totalCount },\r\n    salesOrders { totalCount },\r\n    salesOrderLines { totalCount },\r\n    salesDeliveryNotes { totalCount },\r\n    salesDeliveryNoteLines { totalCount },\r\n    salesInvoices { totalCount },\r\n    salesInvoiceLines { totalCount },\r\n    purchaseInvoices { totalCount }\r\n}",
                    "variables": "{\r\n    \"id\":\"{{X-OrganizationId}}\"\r\n}"
                  }
                },
                "url": {
                  "raw": "{{baseAddress}}/graphql",
                  "host": [
                    "{{baseAddress}}"
                  ],
                  "path": [
                    "graphql"
                  ]
                }
              },
              "response": []
            },
            {
              "name": "Q.organization filtered by Id {{X-OrganizationId}}",
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "x-api-key",
                    "value": "{{subscriptionKey}}"
                  }
                ],
                "body": {
                  "mode": "graphql",
                  "graphql": {
                    "query": "query  ($id : UUID!) {\r\n    organizations \r\n    (where : { id : { eq : $id }}) {\r\n        edges {\r\n            node {\r\n                id\r\n                onboardingCompleted\r\n                legislationCode\r\n                socialName\r\n                creationDate\r\n                modificationDate\r\n                addresses {\r\n                    firstLine\r\n                    secondLine\r\n                    countryName\r\n                    countryId\r\n                    zipCode\r\n                    city\r\n                    province\r\n                    organizationId\r\n                    modificationDate\r\n                }\r\n                documentTypeId\r\n                contacts {\r\n                    creationDate\r\n                    modificationDate\r\n                    isDefault\r\n                    emails\r\n                    {\r\n                        creationDate\r\n                        modificationDate\r\n                        isDefault\r\n                        emailAddress\r\n                        usage                        \r\n                    }\r\n                    phones {\r\n                        id\r\n                        number                        \r\n                    }\r\n                    socialMedias {\r\n                        name\r\n                        link                        \r\n                    }\r\n                }\r\n            }\r\n        }\r\n    }     \r\n}",
                    "variables": "{\r\n    \"id\":\"{{X-OrganizationId}}\"\r\n}"
                  }
                },
                "url": {
                  "raw": "{{baseAddress}}/graphql",
                  "host": [
                    "{{baseAddress}}"
                  ],
                  "path": [
                    "graphql"
                  ]
                }
              },
              "response": []
            }
          ]
        },
        {
          "name": "Countries",
          "item": [
            {
              "name": "Q.countries",
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "x-api-key",
                    "value": "{{subscriptionKey}}"
                  },
                  {
                    "key": "X-OrganizationId",
                    "value": "{{X-OrganizationId}}",
                    "type": "text"
                  }
                ],
                "body": {
                  "mode": "graphql",
                  "graphql": {
                    "query": "query {\r\n    countries (\r\n        order : [{isoCodeAlpha2:ASC}]\r\n    ) {\r\n        edges {\r\n            node {\r\n                id\r\n                name\r\n                isoCodeAlpha2\r\n                isoCodeAlpha3\r\n                isoNumber\r\n                creationDate\r\n                modificationDate\r\n                viesCode  \r\n            }\r\n        }\r\n        totalCount\r\n        pageInfo {\r\n            hasNextPage\r\n        }\r\n    }    \r\n}\r\n",
                    "variables": ""
                  }
                },
                "url": {
                  "raw": "{{baseAddress}}/graphql",
                  "host": [
                    "{{baseAddress}}"
                  ],
                  "path": [
                    "graphql"
                  ]
                }
              },
              "response": []
            }
          ]
        },
        {
          "name": "Zip codes",
          "item": [
            {
              "name": "Q.zipcodes",
              "event": [
                {
                  "listen": "prerequest",
                  "script": {
                    "exec": [
                      "const map = {\r",
                      "    FR: \"FRANCE\",\r",
                      "    DE: \"ALEMANIA\",\r",
                      "    ES: \"ESPAÑA\"\r",
                      "};\r",
                      "\r",
                      "const legislationCode = pm.variables.get(\"legislationCode\");\r",
                      "\r",
                      "if (map[legislationCode]) {\r",
                      "    pm.variables.set(\"country\", map[legislationCode]);\r",
                      "} else {\r",
                      "    console.warn(\"Unknown legislationCode:\", legislationCode);\r",
                      "}"
                    ],
                    "type": "text/javascript",
                    "packages": {},
                    "requests": {}
                  }
                }
              ],
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "x-api-key",
                    "value": "{{subscriptionKey}}"
                  },
                  {
                    "key": "X-OrganizationId",
                    "value": "{{X-OrganizationId}}",
                    "type": "text"
                  }
                ],
                "body": {
                  "mode": "graphql",
                  "graphql": {
                    "query": "#  FRANCE, ALEMANIA, ESPAÑA\r\nquery ($country: String!) {\r\n  zipCodes(\r\n    order: [{ country: ASC }, { zipCode: ASC }]\r\n    where: { country: { eq: $country } }\r\n  ) {\r\n    edges {\r\n      node {\r\n        id\r\n        country\r\n        countryId\r\n        zipCode\r\n        province\r\n        town\r\n      }\r\n    }\r\n    totalCount\r\n    pageInfo {\r\n      hasNextPage\r\n    }\r\n  }\r\n}",
                    "variables": "{\r\n  \"country\": \"{{country}}\"\r\n\r\n}"
                  }
                },
                "url": {
                  "raw": "{{baseAddress}}/graphql",
                  "host": [
                    "{{baseAddress}}"
                  ],
                  "path": [
                    "graphql"
                  ]
                }
              },
              "response": []
            }
          ]
        },
        {
          "name": "Document types",
          "item": [
            {
              "name": "Q.documentTypes",
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "x-api-key",
                    "value": "{{subscriptionKey}}"
                  },
                  {
                    "key": "X-OrganizationId",
                    "value": "{{X-OrganizationId}}",
                    "type": "text"
                  }
                ],
                "body": {
                  "mode": "graphql",
                  "graphql": {
                    "query": "query {\r\n    documentTypes (\r\n        order:[{code:ASC}]\r\n    ){\r\n        edges {\r\n            node {\r\n                id\r\n                code\r\n                name\r\n            }\r\n        }\r\n        totalCount\r\n        pageInfo {\r\n            hasNextPage\r\n        }\r\n    }    \r\n}",
                    "variables": ""
                  }
                },
                "url": {
                  "raw": "{{baseAddress}}/graphql",
                  "host": [
                    "{{baseAddress}}"
                  ],
                  "path": [
                    "graphql"
                  ]
                }
              },
              "response": []
            }
          ]
        },
        {
          "name": "Unit of measurements",
          "item": [
            {
              "name": "Q.unitOfMeasurements",
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "x-api-key",
                    "value": "{{subscriptionKey}}"
                  },
                  {
                    "key": "X-OrganizationId",
                    "value": "{{X-OrganizationId}}",
                    "type": "text"
                  }
                ],
                "body": {
                  "mode": "graphql",
                  "graphql": {
                    "query": "query {\r\n    unitOfMeasurements (\r\n        first: 100\r\n        order:[{name:ASC}]\r\n    ){\r\n        edges {\r\n            node {\r\n                id\r\n                name\r\n                numberOfDecimals\r\n            }\r\n        }\r\n    }    \r\n}",
                    "variables": ""
                  }
                },
                "url": {
                  "raw": "{{baseAddress}}/graphql",
                  "host": [
                    "{{baseAddress}}"
                  ],
                  "path": [
                    "graphql"
                  ]
                }
              },
              "response": []
            }
          ]
        },
        {
          "name": "Currencies",
          "item": [
            {
              "name": "Q.currencies",
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "x-api-key",
                    "value": "{{subscriptionKey}}"
                  },
                  {
                    "key": "X-OrganizationId",
                    "value": "{{X-OrganizationId}}",
                    "type": "text"
                  }
                ],
                "body": {
                  "mode": "graphql",
                  "graphql": {
                    "query": "query {\r\n    currencies (\r\n        first: 500\r\n        order : [{code:ASC}]\r\n    ) {\r\n        edges {\r\n            node {\r\n               id\r\n               code\r\n               description\r\n               precision\r\n            }\r\n        }\r\n    }    \r\n}\r\n",
                    "variables": ""
                  }
                },
                "url": {
                  "raw": "{{baseAddress}}/graphql",
                  "host": [
                    "{{baseAddress}}"
                  ],
                  "path": [
                    "graphql"
                  ]
                }
              },
              "response": []
            }
          ]
        },
        {
          "name": "Get Localized Enum Values",
          "item": [
            {
              "name": "Q.localizedEnumValues for German user",
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "x-api-key",
                    "value": "{{subscriptionKey}}"
                  }
                ],
                "body": {
                  "mode": "graphql",
                  "graphql": {
                    "query": "query($enumName: String!, $language: String!) {\r\n  localizedEnumValues(enumName: $enumName, language: $language) {\r\n    value\r\n    label\r\n  }\r\n}",
                    "variables": "{\r\n  \"enumName\": \"UnitOfMeasurementNameType\",\r\n  \"language\": \"de\"\r\n}"
                  }
                },
                "url": {
                  "raw": "{{baseAddress}}/graphql",
                  "host": [
                    "{{baseAddress}}"
                  ],
                  "path": [
                    "graphql"
                  ]
                }
              },
              "response": []
            },
            {
              "name": "Q.localizedEnumValues for French user",
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "x-api-key",
                    "value": "{{subscriptionKey}}"
                  }
                ],
                "body": {
                  "mode": "graphql",
                  "graphql": {
                    "query": "query($enumName: String!, $language: String!) {\r\n  localizedEnumValues(enumName: $enumName, language: $language) {\r\n    value\r\n    label\r\n  }\r\n}",
                    "variables": "{\r\n  \"enumName\": \"UnitOfMeasurementNameType\",\r\n  \"language\": \"fr\"\r\n}"
                  }
                },
                "url": {
                  "raw": "{{baseAddress}}/graphql",
                  "host": [
                    "{{baseAddress}}"
                  ],
                  "path": [
                    "graphql"
                  ]
                }
              },
              "response": []
            },
            {
              "name": "Q.localizedEnumValues for Spanish user",
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "x-api-key",
                    "value": "{{subscriptionKey}}"
                  }
                ],
                "body": {
                  "mode": "graphql",
                  "graphql": {
                    "query": "query($enumName: String!, $language: String!) {\r\n  localizedEnumValues(enumName: $enumName, language: $language) {\r\n    value\r\n    label\r\n  }\r\n}",
                    "variables": "{\r\n  \"enumName\": \"UnitOfMeasurementNameType\",\r\n  \"language\": \"es\"\r\n}"
                  }
                },
                "url": {
                  "raw": "{{baseAddress}}/graphql",
                  "host": [
                    "{{baseAddress}}"
                  ],
                  "path": [
                    "graphql"
                  ]
                }
              },
              "response": []
            },
            {
              "name": "Q.localizedEnumValues for English user",
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "x-api-key",
                    "value": "{{subscriptionKey}}"
                  }
                ],
                "body": {
                  "mode": "graphql",
                  "graphql": {
                    "query": "query($enumName: String!, $language: String!) {\r\n  localizedEnumValues(enumName: $enumName, language: $language) {\r\n    value\r\n    label\r\n  }\r\n}",
                    "variables": "{\r\n  \"enumName\": \"UnitOfMeasurementNameType\",\r\n  \"language\": \"es\"\r\n}"
                  }
                },
                "url": {
                  "raw": "{{baseAddress}}/graphql",
                  "host": [
                    "{{baseAddress}}"
                  ],
                  "path": [
                    "graphql"
                  ]
                }
              },
              "response": []
            }
          ]
        },
        {
          "name": "Get Localized Error Message",
          "item": [
            {
              "name": "Q.localizedErrorMessage Sample for German user",
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "x-api-key",
                    "value": "{{subscriptionKey}}"
                  }
                ],
                "body": {
                  "mode": "graphql",
                  "graphql": {
                    "query": "query($errorCode: String!, $language: String!) {\r\n  localizedErrorMessage(errorCode: $errorCode, language: $language) {\r\n    message\r\n  }\r\n}",
                    "variables": "{\r\n  \"errorCode\": \"accounting.businessErrors.accountingAccountApplyVatFalseAndDatevEnabledDE\",\r\n  \"language\": \"de\"\r\n}"
                  }
                },
                "url": {
                  "raw": "{{baseAddress}}/graphql",
                  "host": [
                    "{{baseAddress}}"
                  ],
                  "path": [
                    "graphql"
                  ]
                }
              },
              "response": []
            },
            {
              "name": "Q.localizedErrorMessage Sample for French user",
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "x-api-key",
                    "value": "{{subscriptionKey}}"
                  }
                ],
                "body": {
                  "mode": "graphql",
                  "graphql": {
                    "query": "query($errorCode: String!, $language: String!) {\r\n  localizedErrorMessage(errorCode: $errorCode, language: $language) {\r\n    message\r\n  }\r\n}",
                    "variables": "{\r\n  \"errorCode\": \"accounting.businessErrors.accountingEntryLinesBalanceMustBeZero\",\r\n  \"language\": \"fr-FR\"\r\n}"
                  }
                },
                "url": {
                  "raw": "{{baseAddress}}/graphql",
                  "host": [
                    "{{baseAddress}}"
                  ],
                  "path": [
                    "graphql"
                  ]
                }
              },
              "response": []
            },
            {
              "name": "Q.localizedErrorMessage Sample for Spanish user",
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "x-api-key",
                    "value": "{{subscriptionKey}}"
                  }
                ],
                "body": {
                  "mode": "graphql",
                  "graphql": {
                    "query": "query($errorCode: String!, $language: String!) {\r\n  localizedErrorMessage(errorCode: $errorCode, language: $language) {\r\n    message\r\n  }\r\n}",
                    "variables": "{\r\n  \"errorCode\": \"sales.businessErrors.invalidTotalQuantity\",\r\n  \"language\": \"es\"\r\n}"
                  }
                },
                "url": {
                  "raw": "{{baseAddress}}/graphql",
                  "host": [
                    "{{baseAddress}}"
                  ],
                  "path": [
                    "graphql"
                  ]
                }
              },
              "response": []
            },
            {
              "name": "Q.localizedErrorMessage Sample for English user",
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "x-api-key",
                    "value": "{{subscriptionKey}}"
                  }
                ],
                "body": {
                  "mode": "graphql",
                  "graphql": {
                    "query": "query($errorCode: String!, $language: String!) {\r\n  localizedErrorMessage(errorCode: $errorCode, language: $language) {\r\n    message\r\n  }\r\n}",
                    "variables": "{\r\n  \"errorCode\": \"sales.businessErrors.codeCannotContainBlankSpaces\",\r\n  \"language\": \"en-GB\"\r\n}"
                  }
                },
                "url": {
                  "raw": "{{baseAddress}}/graphql",
                  "host": [
                    "{{baseAddress}}"
                  ],
                  "path": [
                    "graphql"
                  ]
                }
              },
              "response": []
            }
          ],
          "description": "The **localizedErrorMessage** service retrieves a localized error message based on a given error code and a mandatory language parameter, ensuring an enhanced user experience with clear and specific error information.\n\nThis service supports the following languages: **French**, **Spanish**, **English**, and **German**."
        }
      ],
      "description": "This section specifically discusses resources that are common to all organizations"
    },
    {
      "name": "Reference : related to an organization",
      "item": [
        {
          "name": "🆕 Recommended Catalog-based APIs for Lists and Aggregations",
          "item": [
            {
              "name": "Aggregation Catalog",
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "exec": [
                      ""
                    ],
                    "type": "text/javascript",
                    "packages": {},
                    "requests": {}
                  }
                }
              ],
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "x-api-key",
                    "value": "{{subscriptionKey}}"
                  }
                ],
                "body": {
                  "mode": "graphql",
                  "graphql": {
                    "query": "query {\r\n  aggregationCatalog(contextContains: \"Accounting Entry\") {\r\n    definitions {\r\n      entityKey\r\n      context\r\n      aggregationTypes\r\n      periodTypes\r\n      filters\r\n      groupBy { name title1 title2 }\r\n      valueColumns\r\n      distinctCounts\r\n      searchScopes\r\n    }\r\n  }\r\n}",
                    "variables": "{\r\n    \"name\":\"sales\"\r\n}"
                  }
                },
                "url": {
                  "raw": "{{baseAddress}}/graphql",
                  "host": [
                    "{{baseAddress}}"
                  ],
                  "path": [
                    "graphql"
                  ]
                }
              },
              "response": []
            },
            {
              "name": "Aggregate Execute",
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "exec": [
                      ""
                    ],
                    "type": "text/javascript",
                    "packages": {},
                    "requests": {}
                  }
                }
              ],
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "x-api-key",
                    "value": "{{subscriptionKey}}"
                  },
                  {
                    "key": "X-OrganizationId",
                    "value": "{{X-OrganizationId}}",
                    "type": "text"
                  }
                ],
                "body": {
                  "mode": "graphql",
                  "graphql": {
                    "query": "query ($input: AggregationExecuteDtoInput!) {\r\n  aggregationExecute(input: $input) {\r\n    meta {\r\n      entityKey\r\n      context\r\n      policy\r\n      aggregationType\r\n      periodType\r\n      dateMin\r\n      dateMax\r\n      compare\r\n      top\r\n      includeOthers\r\n      othersLabel\r\n      filterName\r\n      groupByName\r\n      valueColumn1\r\n      valueColumn2\r\n      distinctCountName\r\n      search\r\n      searchScope\r\n    }\r\n    rows {\r\n      groupValue\r\n      secondValue\r\n      period\r\n      value1\r\n      value2\r\n      periodN\r\n      periodN_1\r\n      valueN\r\n      valueN_1\r\n      deltaPercent\r\n    }\r\n  }\r\n}\r\n",
                    "variables": "{\r\n  \"input\": {\r\n    \"entityKey\": \"queryAggregateSalesInvoices\",\r\n    \"aggregationType\": \"SUM\",\r\n    \"periodType\": \"Month\",\r\n    \"dateMin\": \"2025-01-01\",\r\n    \"dateMax\": \"2025-12-31\",\r\n    \"compare\": false,\r\n    \"top\": 5,\r\n    \"includeOthers\": false,\r\n    \"othersLabel\": \"Others\",\r\n    \"filterName\": \"All invoices (draft and validated)\",\r\n    \"groupByName\": \"Customer\",\r\n    \"valueColumn1\": \"Total Net\",\r\n    \"valueColumn2\": \"Total Liquid\",\r\n    \"distinctCountName\": \"Sales Invoices\"\r\n  }\r\n}\r\n"
                  }
                },
                "url": {
                  "raw": "{{baseAddress}}/graphql",
                  "host": [
                    "{{baseAddress}}"
                  ],
                  "path": [
                    "graphql"
                  ]
                }
              },
              "response": []
            },
            {
              "name": "List Catalog",
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "exec": [
                      ""
                    ],
                    "type": "text/javascript",
                    "packages": {},
                    "requests": {}
                  }
                }
              ],
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "x-api-key",
                    "value": "{{subscriptionKey}}"
                  }
                ],
                "body": {
                  "mode": "graphql",
                  "graphql": {
                    "query": "query ($name: String) {\r\n  listCatalog(contextContains: $name) {\r\n    definitions {\r\n      entityKey\r\n      context\r\n      filters\r\n      orderBy\r\n      supportsDateRange\r\n    }\r\n  }\r\n}\r\n",
                    "variables": "{\r\n    \"name\":\"sales\"\r\n}"
                  }
                },
                "url": {
                  "raw": "{{baseAddress}}/graphql",
                  "host": [
                    "{{baseAddress}}"
                  ],
                  "path": [
                    "graphql"
                  ]
                }
              },
              "response": []
            },
            {
              "name": "List Execute",
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "exec": [
                      ""
                    ],
                    "type": "text/javascript",
                    "packages": {},
                    "requests": {}
                  }
                }
              ],
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "x-api-key",
                    "value": "{{subscriptionKey}}"
                  },
                  {
                    "key": "X-OrganizationId",
                    "value": "{{X-OrganizationId}}",
                    "type": "text"
                  }
                ],
                "body": {
                  "mode": "graphql",
                  "graphql": {
                    "query": "query ($input: ListExecuteDtoInput!) {\r\n  listExecute(input: $input) {\r\n    meta {\r\n      entityKey\r\n      context\r\n      filterName\r\n      orderByName\r\n      dateMin\r\n      dateMax\r\n      search\r\n    }\r\n    rows\r\n    totalCount\r\n    pageInfo {\r\n      hasNextPage\r\n      endCursor\r\n    }\r\n  }\r\n}\r\n",
                    "variables": "{\r\n  \"input\": {\r\n    \"entityKey\": \"salesInvoiceLines\",\r\n    \"orderByName\": \"Invoice date desc\",\r\n    \"dateMin\": \"2024-01-01\",\r\n    \"dateMax\": \"2026-03-31\",\r\n    \"after\": null,\r\n    \"first\":100\r\n  }\r\n}\r\n"
                  }
                },
                "url": {
                  "raw": "{{baseAddress}}/graphql",
                  "host": [
                    "{{baseAddress}}"
                  ],
                  "path": [
                    "graphql"
                  ]
                }
              },
              "response": []
            }
          ]
        },
        {
          "name": "Users and Access",
          "item": [
            {
              "name": "Q.userProfile",
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "exec": [
                      ""
                    ],
                    "type": "text/javascript",
                    "packages": {},
                    "requests": {}
                  }
                }
              ],
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "x-api-key",
                    "value": "{{subscriptionKey}}"
                  }
                ],
                "body": {
                  "mode": "graphql",
                  "graphql": {
                    "query": "query {\r\n  userProfile {\r\n    applicationLanguageCode\r\n    authenticationEmail\r\n    fullName\r\n    lastName\r\n    firstName\r\n   \r\n    \r\n  }\r\n}\r\n",
                    "variables": ""
                  }
                },
                "url": {
                  "raw": "{{baseAddress}}/graphql",
                  "host": [
                    "{{baseAddress}}"
                  ],
                  "path": [
                    "graphql"
                  ]
                }
              },
              "response": []
            },
            {
              "name": "Q.users",
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "x-api-key",
                    "value": "{{subscriptionKey}}"
                  },
                  {
                    "key": "X-OrganizationId",
                    "value": "{{X-OrganizationId}}"
                  }
                ],
                "body": {
                  "mode": "graphql",
                  "graphql": {
                    "query": "query {\r\n    users {\r\n        edges {\r\n            node {\r\n                id\r\n                fullName\r\n                firstName\r\n                lastName\r\n                authenticationEmail\r\n                applicationLanguageCode\r\n                 auth0UserId\r\n              \r\n               \r\n            }\r\n        }\r\n    }     \r\n}\r\n\r\n",
                    "variables": ""
                  }
                },
                "url": {
                  "raw": "{{baseAddress}}/graphql",
                  "host": [
                    "{{baseAddress}}"
                  ],
                  "path": [
                    "graphql"
                  ]
                }
              },
              "response": []
            },
            {
              "name": "⚙️ Q.userAccessPolicyCheck",
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "x-api-key",
                    "value": "{{subscriptionKey}}"
                  },
                  {
                    "key": "X-OrganizationId",
                    "value": "{{X-OrganizationId}}"
                  }
                ],
                "body": {
                  "mode": "graphql",
                  "graphql": {
                    "query": "query ($actions: [String!]!) {\r\n  userAccessPolicyCheck (actions: $actions) {\r\n    action\r\n    isAllowed\r\n  }     \r\n}",
                    "variables": "{\r\n    \"actions\": [\r\n       \"accountingAccounts\",\r\n        \"accountingBalanceSheet\",\r\n        \"accountingEntries\",\r\n        \"accountingEntryDimensionTags\",\r\n        \"accountingEntryLines\",\r\n        \"accountingEntryPayments\",\r\n        \"accountingEntrySessions\",\r\n        \"accountingExercises\",\r\n        \"accountingKpis\",\r\n        \"accountingPlansMasterById\",\r\n        \"accountingProfitAndLoss\",\r\n        \"accountingReportPositions\",\r\n        \"accountingThirdPartyBalance\",\r\n        \"accountingTrialBalance\",\r\n        \"bankAccounts\",\r\n        \"bankMovements\",\r\n        \"bankingRules\",\r\n        \"businessAreas\",\r\n        \"closeSalesInvoice\",\r\n        \"countries\",\r\n        \"createAccountingAccount\",\r\n        \"createAccountingEntryUsingCodes\",\r\n        \"createAccountingEntryUsingIds\",\r\n        \"createAccountingExercise\",\r\n        \"createBusinessArea\",\r\n        \"createCustomer\",\r\n        \"createEmployee\",\r\n        \"createJobArea\",\r\n        \"createJournalType\",\r\n        \"createPaymentMean\",\r\n        \"createPaymentTerm\",\r\n        \"createProduct\",\r\n        \"createPurchaseInvoice\",\r\n        \"createSalesDeliveryNote\",\r\n        \"createSalesInvoice\",\r\n        \"createSalesOrder\",\r\n        \"createSalesQuote\",\r\n        \"createSupplier\",\r\n        \"currencies\",\r\n        \"customers\",\r\n        \"deleteAccountingAccount\",\r\n        \"deleteAccountingEntry\",\r\n        \"deleteBusinessArea\",\r\n        \"deleteCustomer\",\r\n        \"deleteEmployee\",\r\n        \"deleteJournalType\",\r\n        \"deletePaymentMean\",\r\n        \"deletePaymentTerm\",\r\n        \"deleteProduct\",\r\n        \"deletePurchaseInvoice\",\r\n        \"deleteSalesDeliveryNote\",\r\n        \"deleteSalesInvoice\",\r\n        \"deleteSalesOrder\",\r\n        \"deleteSalesQuote\",\r\n        \"deleteSupplier\",\r\n        \"dimensions\",\r\n        \"documentPdfEmailSalesDeliveryNote\",\r\n        \"documentPdfEmailSalesInvoice\",\r\n        \"documentPdfEmailSalesOrder\",\r\n        \"documentPdfEmailSalesQuote\",\r\n        \"documentPdfPreviewSalesDeliveryNote\",\r\n        \"documentPdfPreviewSalesInvoice\",\r\n        \"documentPdfPreviewSalesOrder\",\r\n        \"documentPdfPreviewSalesQuote\",\r\n        \"documentTypes\",\r\n        \"emailTemplates\",\r\n        \"employees\",\r\n        \"files\",\r\n        \"filesExport\",\r\n        \"generateCreditNote\",\r\n        \"invoiceTypes\",\r\n        \"jobAreas\",\r\n        \"journalTypes\",\r\n        \"linkRelatedSalesDocument\",\r\n        \"localizedEnumValues\",\r\n        \"localizedErrorMessage\",\r\n        \"operationalNumberPresetTexts\",\r\n        \"organizationAccountingSetupByOrgId\",\r\n        \"organizationSalesSetupByOrgId\",\r\n        \"organizations\",\r\n        \"paymentMeans\",\r\n        \"paymentMethods\",\r\n        \"paymentTerms\",\r\n        \"postPurchaseInvoice\",\r\n        \"postSalesInvoice\",\r\n        \"productPriceById\",\r\n        \"products\",\r\n        \"purchaseInvoiceLines\",\r\n        \"purchaseInvoiceOpenItems\",\r\n        \"purchaseInvoices\",\r\n        \"purchaseOpenItemSettlement\",\r\n        \"reconcileBankMovement\",\r\n        \"relatedSalesDocuments\",\r\n        \"salesDeliveryNoteLines\",\r\n        \"salesDeliveryNotes\",\r\n        \"salesDiscountLines\",\r\n        \"salesDiscounts\",\r\n        \"salesInvoiceLines\",\r\n        \"salesInvoiceOpenItems\",\r\n        \"salesInvoices\",\r\n        \"salesKpis\",\r\n        \"salesOpenItemSettlement\",\r\n        \"salesOrderLines\",\r\n        \"salesOrders\",\r\n        \"salesQuoteLines\",\r\n        \"salesQuotes\",\r\n        \"salesTariffLines\",\r\n        \"salesTariffs\",\r\n        \"suppliers\",\r\n        \"taxGroups\",\r\n        \"taxTreatments\",\r\n        \"taxes\",\r\n        \"thirdPartyCodeModeSettings\",\r\n        \"thirdPartyIdentification\",\r\n        \"transactionCategories\",\r\n        \"unReconcileBankMovement\",\r\n        \"unitOfMeasurementSalesSetups\",\r\n        \"unitOfMeasurements\",\r\n        \"updateAccountingAccount\",\r\n        \"updateCustomer\",\r\n        \"updateEmployee\",\r\n        \"updateJournalType\",\r\n        \"updateProduct\",\r\n        \"updatePurchaseInvoice\",\r\n        \"updateSalesDeliveryNote\",\r\n        \"updateSalesInvoice\",\r\n        \"updateSalesOrder\",\r\n        \"updateSalesQuote\",\r\n        \"updateSupplier\",\r\n        \"uploadFileToEntity\",\r\n        \"userProfile\",\r\n        \"users\",\r\n        \"zipCodes\"\r\n    ]\r\n}"
                  }
                },
                "url": {
                  "raw": "{{baseAddress}}/graphql",
                  "host": [
                    "{{baseAddress}}"
                  ],
                  "path": [
                    "graphql"
                  ]
                }
              },
              "response": []
            }
          ]
        },
        {
          "name": "Accounting",
          "item": [
            {
              "name": "Accounting Accounts",
              "item": [
                {
                  "name": "M.create an account, then update it, then delete it",
                  "item": [
                    {
                      "name": "1- Q.taxTreatments;  id filled in {taxTreatmentId}}",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "pm.test(\"Variables creation\", function () {\r",
                              "    let jsd = pm.response.json();\r",
                              "\r",
                              "    if (jsd.data == null || jsd.data.taxTreatments.edges.length == 0)\r",
                              "        {console.error(\"Unable to save environment variable\");return;}\r",
                              "    pm.environment.set(\"taxTreatmentId\", jsd.data.taxTreatments.edges[0].node.id);\r",
                              "    console.log(\"'taxTreatmentId' environment variable has been created : \" + pm.environment.get(\"taxTreatmentId\"));\r",
                              "});\r",
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "query {\r\n    taxTreatments (\r\n        where: { \r\n        or: [\r\n            {taxCode: {eq:\"C0005\"}},\r\n            {taxCode: {eq:\"C001\"}},\r\n        ]}\r\n        ) {\r\n        edges {\r\n            node {\r\n                taxCode\r\n                id\r\n            }\r\n        }\r\n    }     \r\n}",
                            "variables": ""
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "2- M.createAccountingAccount  - new id filled in {{currentId}}",
                      "event": [
                        {
                          "listen": "prerequest",
                          "script": {
                            "exec": [
                              "let legislationCode = pm.environment.get(\"legislationCode\");\r",
                              "\r",
                              "if (legislationCode === 'FR') {\r",
                              "    pm.environment.set(\"accountCode\", \"626200001\");\r",
                              "} else if (legislationCode === 'ES') {\r",
                              "    pm.environment.set(\"accountCode\", \"62620001\");\r",
                              "} else if (legislationCode === 'DE') {\r",
                              "    pm.environment.set(\"accountCode\", \"3011\");\r",
                              "} else {\r",
                              "    console.error(\"Unexpected legislationCode value\");\r",
                              "    return;\r",
                              "}\r",
                              "\r",
                              "console.log(\"'accountCode' environment variable has been created with value: \" \r",
                              "    + pm.environment.get(\"accountCode\"));\r",
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {}
                          }
                        },
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "pm.test(\"Variables creation\", function () {\r",
                              "    let jsd = pm.response.json();\r",
                              "\r",
                              "    if (jsd.data == null || jsd.data.createAccountingAccount == null)\r",
                              "        {console.error(\"Unable to save environment variable\");return;}\r",
                              "    pm.environment.set(\"currentId\", jsd.data.createAccountingAccount.id);\r",
                              "    console.log(\"'currentId' environment variable has been created : \" + pm.environment.get(\"currentId\"));\r",
                              "});\r",
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "mutation ($values: AccountingAccountCreateGLDtoInput!) {  \r\n    createAccountingAccount(input: $values) {\r\n    id\r\n  }\r\n}",
                            "variables": "{\r\n  \"values\": {\r\n    \"accountLevel\": \"SUB_ACCOUNT\",\r\n    \"accountType\": \"INCOME_STATEMENT\",\r\n    \"code\": \"{{accountCode}}\",\r\n    \"name\": \"Phone\",\r\n    \"description\": \"\",\r\n    \"subAccountType\": \"CHARGE\",\r\n    \"taxTreatmentId\": \"{{taxTreatmentId}}\"\r\n  }\r\n} "
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "3- M.updateAccountingAccount  {{currentId}}",
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "mutation ($values: AccountingAccountUpdateGLDtoInput!) {  \r\n    updateAccountingAccount(input: $values) {\r\n    id\r\n  }\r\n}",
                            "variables": "{\r\n  \"values\":{\r\n    \"id\": \"{{currentId}}\",\r\n    \"name\": \"Telephone 222\",\r\n    \"subAccountType\": \"CHARGE\",\r\n    \"taxTreatmentId\": \"{{taxTreatmentId}}\"\r\n  }\r\n} "
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "4- M.deleteAccountingAccount  {{currentId}}",
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "mutation ($values:AccountingAccountDeleteGLDtoInput!) {\r\n    deleteAccountingAccount(input: $values) {\r\n    id\r\n  }\r\n}",
                            "variables": "{\r\n  \"values\":{\r\n    \"id\":\"{{currentId}}\"\r\n  }\r\n}"
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    }
                  ],
                  "description": "Step 1 will allow you to retrieve a tax code to associate with the account to be created."
                },
                {
                  "name": "M.Simply create an account.",
                  "item": [
                    {
                      "name": "1- M.createAccountingAccount only with Code",
                      "event": [
                        {
                          "listen": "prerequest",
                          "script": {
                            "exec": [
                              "let legislationCode = pm.environment.get(\"legislationCode\");\r",
                              "\r",
                              "if (legislationCode === 'FR') {\r",
                              "    pm.environment.set(\"accountCode\", \"626200011\");\r",
                              "} else if (legislationCode === 'ES') {\r",
                              "    pm.environment.set(\"accountCode\", \"62620001\");\r",
                              "} else if (legislationCode === 'DE') {\r",
                              "    pm.environment.set(\"accountCode\", \"3012\");\r",
                              "} else {\r",
                              "    console.error(\"Unexpected legislationCode value\");\r",
                              "    return;\r",
                              "}\r",
                              "\r",
                              "console.log(\"'accountCode' environment variable has been created with value: \" \r",
                              "    + pm.environment.get(\"accountCode\"));\r",
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {}
                          }
                        },
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "pm.test(\"Variables creation\", function () {\r",
                              "    let jsd = pm.response.json();\r",
                              "\r",
                              "    if (jsd.data == null || jsd.data.createAccountingAccount == null)\r",
                              "        {console.error(\"Unable to save environment variable\");return;}\r",
                              "    pm.environment.set(\"currentId\", jsd.data.createAccountingAccount.id);\r",
                              "    console.log(\"'currentId' environment variable has been created : \" + pm.environment.get(\"currentId\"));\r",
                              "});\r",
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "mutation ($values: AccountingAccountCreateGLDtoInput!) {  \r\n    createAccountingAccount(input: $values) {\r\n    id\r\n  }\r\n}",
                            "variables": "{\r\n  \"values\": {\r\n    \"code\": \"{{accountCode}}\"\r\n  }\r\n} "
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "2- M.deleteAccountingAccount  {{currentId}}",
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "mutation ($values:AccountingAccountDeleteGLDtoInput!) {\r\n    deleteAccountingAccount(input: $values) {\r\n    id\r\n  }\r\n}",
                            "variables": "{\r\n  \"values\":{\r\n    \"id\":\"{{currentId}}\"\r\n  }\r\n}"
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "3- M.createAccountingAccount only with Code and Name",
                      "event": [
                        {
                          "listen": "prerequest",
                          "script": {
                            "exec": [
                              "let legislationCode = pm.environment.get(\"legislationCode\");\r",
                              "\r",
                              "if (legislationCode === 'FR') {\r",
                              "    pm.environment.set(\"accountCode\", \"626200013\");\r",
                              "} else if (legislationCode === 'ES') {\r",
                              "    pm.environment.set(\"accountCode\", \"62620003\");\r",
                              "} else if (legislationCode === 'DE') {\r",
                              "    pm.environment.set(\"accountCode\", \"3013\");\r",
                              "} else {\r",
                              "    console.error(\"Unexpected legislationCode value\");\r",
                              "    return;\r",
                              "}\r",
                              "\r",
                              "console.log(\"'accountCode' environment variable has been created with value: \" \r",
                              "    + pm.environment.get(\"accountCode\"));\r",
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {}
                          }
                        },
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "pm.test(\"Variables creation\", function () {\r",
                              "    let jsd = pm.response.json();\r",
                              "\r",
                              "    if (jsd.data == null || jsd.data.createAccountingAccount == null)\r",
                              "        {console.error(\"Unable to save environment variable\");return;}\r",
                              "    pm.environment.set(\"currentId\", jsd.data.createAccountingAccount.id);\r",
                              "    console.log(\"'currentId' environment variable has been created : \" + pm.environment.get(\"currentId\"));\r",
                              "});\r",
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "mutation ($values: AccountingAccountCreateGLDtoInput!) {  \r\n    createAccountingAccount(input: $values) {\r\n    id\r\n  }\r\n}",
                            "variables": "{\r\n  \"values\": {\r\n    \"code\": \"{{accountCode}}\",\r\n    \"name\": \"Phone\"\r\n  }\r\n} "
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "4- M.deleteAccountingAccount  {{currentId}}",
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "mutation ($values:AccountingAccountDeleteGLDtoInput!) {\r\n    deleteAccountingAccount(input: $values) {\r\n    id\r\n  }\r\n}",
                            "variables": "{\r\n  \"values\":{\r\n    \"id\":\"{{currentId}}\"\r\n  }\r\n}"
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    }
                  ]
                },
                {
                  "name": "✏️Q.accountingAccounts - first is filled in {{currentId}}",
                  "event": [
                    {
                      "listen": "test",
                      "script": {
                        "exec": [
                          "pm.test(\"Variables creation\", function () {\r",
                          "    let jsd = pm.response.json();\r",
                          "\r",
                          "    if (jsd.data == null || jsd.data.accountingAccounts.edges.length == 0)\r",
                          "        {console.error(\"Unable to save environment variable\");return;}\r",
                          "    pm.environment.set(\"currentId\", jsd.data.accountingAccounts.edges[0].node.id);\r",
                          "    console.log(\"'currentId' environment variable has been created : \" + pm.environment.get(\"currentId\"));\r",
                          "});"
                        ],
                        "type": "text/javascript",
                        "packages": {},
                        "requests": {}
                      }
                    }
                  ],
                  "request": {
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "query {\r\n    accountingAccounts \r\n    (first:500)\r\n    {\r\n       \r\n        edges {\r\n            node {\r\n                id\r\n                accountLevel\r\n                accountType\r\n                code\r\n                subAccountType\r\n                name\r\n                description\r\n                taxTreatmentId\r\n                collectiveAccount\r\n                datevAutomaticAccount\r\n                datevAccountNumber\r\n                applyVat\r\n                includedEurForGermany\r\n                transitionalPrepaymentAccountId\r\n                transitionalPrepaymentAccount\r\n                {\r\n                    code\r\n                    name\r\n                }\r\n                accountingAccountDimensionTags\r\n                {\r\n                    dimensionId\r\n                    dimensionTagId\r\n                }\r\n            }\r\n        }\r\n        totalCount\r\n        pageInfo {\r\n            hasNextPage\r\n        }\r\n    }     \r\n}",
                        "variables": ""
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                },
                {
                  "name": "Q.accountingAccounts filtered by Id {{currentId}}",
                  "event": [
                    {
                      "listen": "test",
                      "script": {
                        "exec": [
                          "pm.test(\"Variables creation\", function () {\r",
                          "    let jsd = pm.response.json();\r",
                          "\r",
                          "    if (jsd.data == null || jsd.data.accountingAccounts.edges.length == 0)\r",
                          "        {console.error(\"Unable to save environment variable\");return;}\r",
                          "    pm.environment.set(\"accountingAccountId\", jsd.data.accountingAccounts.edges[0].node.id);\r",
                          "    console.log(\"'accountingAccountId' environment variable has been created : \" + pm.environment.get(\"accountingAccountId\"));\r",
                          "});"
                        ],
                        "type": "text/javascript",
                        "packages": {}
                      }
                    }
                  ],
                  "request": {
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "query  ($id : UUID!) {\r\n    accountingAccounts\r\n    (where : { id : { eq : $id }}) {\r\n        edges {\r\n            node {\r\n                id\r\n                accountLevel\r\n                accountType\r\n                code\r\n                subAccountType\r\n                description\r\n                taxTreatmentId\r\n            }\r\n        }\r\n    }     \r\n}",
                        "variables": "{\r\n  \"id\":\"{{currentId}}\"\r\n}"
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                },
                {
                  "name": "Q.accountingReportPositions for all Accounts",
                  "event": [
                    {
                      "listen": "test",
                      "script": {
                        "exec": [
                          ""
                        ],
                        "type": "text/javascript",
                        "packages": {},
                        "requests": {}
                      }
                    }
                  ],
                  "request": {
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "query($input: AccountingReportPositionGLDtoInput!) {\r\n  accountingReportPositions(input: $input) {\r\n    id\r\n    code\r\n    description\r\n    accountType\r\n    accountLevel\r\n    subAccountType\r\n    taxTreatmentId\r\n    deactivated\r\n    collectiveAccount\r\n    datevAutomaticAccount\r\n    datevAccountNumber\r\n    applyVat\r\n    reportPositions {\r\n      balanceGuideLineId\r\n      balanceGuideLineCode\r\n      balanceGuideLineDescription\r\n      isDetail\r\n      isMain\r\n      alternativePositionIfNegative\r\n    }\r\n  }\r\n}",
                        "variables": "{\r\n  \"input\": {\r\n    \"isDetail\": true\r\n  }\r\n}"
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                },
                {
                  "name": "Q.accountingReportPositions by AccountId {{currentId}}",
                  "event": [
                    {
                      "listen": "test",
                      "script": {
                        "exec": [
                          ""
                        ],
                        "type": "text/javascript",
                        "packages": {},
                        "requests": {}
                      }
                    }
                  ],
                  "request": {
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "query($input: AccountingReportPositionGLDtoInput!) {\r\n  accountingReportPositions(input: $input) {\r\n    id\r\n    code\r\n    description\r\n    accountType\r\n    accountLevel\r\n    subAccountType\r\n    taxTreatmentId\r\n    deactivated\r\n    collectiveAccount\r\n    datevAutomaticAccount\r\n    datevAccountNumber\r\n    applyVat\r\n    reportPositions {\r\n      balanceGuideLineId\r\n      balanceGuideLineCode\r\n      balanceGuideLineDescription\r\n      isDetail\r\n      isMain\r\n      alternativePositionIfNegative\r\n    }\r\n  }\r\n}",
                        "variables": "{\r\n  \"input\": {\r\n    \"accountId\": \"{{currentId}}\",\r\n    \"isDetail\": true\r\n  }\r\n}"
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                }
              ]
            },
            {
              "name": "Accounting Plan master",
              "item": [
                {
                  "name": "⚙️ Q.accountingPlansMasterById chart of account - id filled in {{accountingPlanMasterId}}",
                  "event": [
                    {
                      "listen": "test",
                      "script": {
                        "exec": [
                          ""
                        ],
                        "type": "text/javascript",
                        "packages": {}
                      }
                    },
                    {
                      "listen": "prerequest",
                      "script": {
                        "exec": [
                          "let legislationCode = pm.environment.get(\"legislationCode\");\r",
                          "\r",
                          "if (legislationCode === 'FR') {\r",
                          "    pm.environment.set(\"accountingPlanMasterId\", \"2d421537-eed5-45d5-9173-8785fb55b161\");\r",
                          "} else if (legislationCode === 'ES') {\r",
                          "    pm.environment.set(\"accountingPlanMasterId\", \"4f51df1d-25d9-4a3b-9550-33e7e3cc11f7\");\r",
                          "} else if (legislationCode === 'DE') {\r",
                          "    pm.environment.set(\"accountingPlanMasterId\", \"d85024a3-d5d5-481f-8671-184711e2cb5e\");\r",
                          "} else {\r",
                          "    console.error(\"Unexpected legislationCode value\");\r",
                          "    return;\r",
                          "}\r",
                          "\r",
                          "console.log(\"'accountingPlanMasterId' environment variable has been created with value: \" \r",
                          "    + pm.environment.get(\"accountingPlanMasterId\"));\r",
                          ""
                        ],
                        "type": "text/javascript",
                        "packages": {}
                      }
                    }
                  ],
                  "request": {
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "query ($id:ID!) {\r\n    accountingPlansMasterById(id: $id) {\r\n        id\r\n        description\r\n        accountingPlanMasterLines {\r\n            code\r\n            name\r\n            accountLevel\r\n        }\r\n    }\r\n}",
                        "variables": "{\r\n  \"id\":\"{{accountingPlanMasterId}}\"\r\n}"
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                }
              ]
            },
            {
              "name": "Accounting Exercises",
              "item": [
                {
                  "name": "Q.accountingExercises - first id filled in {{currentId}}",
                  "event": [
                    {
                      "listen": "test",
                      "script": {
                        "exec": [
                          "pm.test(\"Variables creation\", function () {\r",
                          "    let jsd = pm.response.json();\r",
                          "    console.log(jsd.data.accountingExercises.edges[0].node.id);\r",
                          "    if (jsd.data == null || jsd.data.accountingExercises.edges.length == 0)\r",
                          "        {console.error(\"Unable to save environment variable\");return;}\r",
                          "    pm.environment.set(\"currentId\",jsd.data.accountingExercises.edges[0].node.id);\r",
                          "    console.log(\"'currentId' environment variable has been created : \" + pm.environment.get(\"currentId\"));\r",
                          "});\r",
                          "\r",
                          ""
                        ],
                        "type": "text/javascript"
                      }
                    }
                  ],
                  "request": {
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "query {\r\n    accountingExercises {\r\n        edges {\r\n            node {\r\n               id\r\n               exercise\r\n               status\r\n               startDate\r\n               endDate\r\n               description\r\n               periods {\r\n                   startDate\r\n                   endDate\r\n               }\r\n            }\r\n        }\r\n        totalCount\r\n        pageInfo {\r\n            hasNextPage\r\n        }\r\n    }     \r\n}",
                        "variables": ""
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                },
                {
                  "name": "Q.accountingExercises filtered by Id {{currentId}}",
                  "request": {
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "query  ($id : UUID!) {\r\n    accountingExercises\r\n     (where : { id : { eq : $id }})  {\r\n        edges {\r\n            node {\r\n               id\r\n               exercise\r\n               status\r\n               startDate\r\n               endDate\r\n               description\r\n               periods {\r\n                   startDate\r\n                   endDate\r\n               }\r\n            }\r\n        }\r\n    }     \r\n}",
                        "variables": "{\r\n    \"id\":\"{{currentId}}\"\r\n}"
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                },
                {
                  "name": "M.createAccountingExercise",
                  "event": [
                    {
                      "listen": "test",
                      "script": {
                        "exec": [
                          "pm.test(\"Status is OK 200\", function () {\r",
                          "    pm.response.to.have.status(200);\r",
                          "    pm.response.to.be.ok;\r",
                          "});\r",
                          "\r",
                          "pm.test(\"Response is JSon\", function () {\r",
                          "    pm.response.to.be.json;\r",
                          "});\r",
                          "\r",
                          "pm.test(\"Variable creation\", function () {\r",
                          "    let jsd = pm.response.json();\r",
                          "\r",
                          "    if (jsd.data == null)\r",
                          "        {console.error(\"Unable to save environment variable\");return;}\r",
                          "\r",
                          "    let result = jsd.data.createAccountingExercise;\r",
                          "    pm.environment.set(\"accountingExerciseId\", result.id);\r",
                          "    console.log(\"'accountingExerciseId' environment variable has been created : \" + pm.environment.get(\"accountingExerciseId\"));\r",
                          "});\r",
                          ""
                        ],
                        "type": "text/javascript"
                      }
                    }
                  ],
                  "request": {
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "mutation ($values: AccountingExerciseCreateGLDtoInput!) {  \r\n  createAccountingExercise (input: $values) {\r\n    id\r\n  }\r\n}\r\n",
                        "variables": "{\r\n    \"values\":{\r\n      \"exercise\":2023,\r\n      \"description\":\"Exo2023\",\r\n      \"startDate\":\"2023-01-01\",\r\n      \"numberPeriods\":12\r\n    }\r\n}"
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                }
              ]
            },
            {
              "name": "Journal Types",
              "item": [
                {
                  "name": "M.create, then update then delete a journalType",
                  "item": [
                    {
                      "name": "1- Q.accountingAccounts - fill in  {{accountId}}",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "\r",
                              "pm.test(\"Variables creation\", function () {\r",
                              "    let jsd = pm.response.json();\r",
                              "\r",
                              "    if (jsd.data == null || jsd.data.accountingAccounts.edges.length == 0)\r",
                              "        {console.error(\"Unable to save environment variable\");return;}\r",
                              "    pm.environment.set(\"accountId\", jsd.data.accountingAccounts.edges[0].node.id);\r",
                              "    console.log(\"'accountId' environment variable has been created : \" + pm.environment.get(\"accountId\"));\r",
                              "});\r",
                              ""
                            ],
                            "type": "text/javascript"
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "query {\r\n    accountingAccounts (\r\n        where :{\r\n             or:[\r\n             {code : { startsWith : \"5121\" }}\r\n             {code : { startsWith : \"5123\" }}\r\n             {code : { startsWith : \"1210\" }}\r\n             ]\r\n             }\r\n        first:1\r\n        ) {\r\n        edges {\r\n            node {\r\n                code,\r\n                id\r\n            \r\n            }\r\n        }     \r\n    }     \r\n}",
                            "variables": ""
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "2- M.createJournalType  - new id filled in {{currentId}}",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "pm.test(\"Variable creation\", function () {\r",
                              "    let jsd = pm.response.json();\r",
                              "\r",
                              "    if (jsd.data == null)\r",
                              "        {console.error(\"Unable to save environment variable\");return;}\r",
                              "\r",
                              "    let result = jsd.data.createJournalType;\r",
                              "    pm.environment.set(\"currentId\", result.id);\r",
                              "    console.log(\"'currentId' environment variable has been created : \" + pm.environment.get(\"currentId\"));\r",
                              "});\r",
                              ""
                            ],
                            "type": "text/javascript"
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "mutation ($values: JournalTypeCreateGLDtoInput!) {  \r\n  createJournalType (input: $values) {\r\n    id\r\n  }\r\n}\r\n",
                            "variables": "{\r\n    \"values\":{\r\n      \"code\":\"FINJT\",\r\n      \"name\":\"FinancialJournalType\",\r\n      \"type\":\"FINANCIAL\",\r\n      \"accountingAccountId\":\"{{accountId}}\"\r\n    }\r\n}"
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "3- M.updateJournalType",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "mutation ($values: JournalTypeUpdateGLDtoInput!) {  \r\n  updateJournalType (input: $values) {\r\n    id\r\n  }\r\n}\r\n",
                            "variables": "{\r\n    \"values\":{\r\n      \"id\": \"{{currentId}}\",\r\n      \"name\":\"FinancialJournalTypeUpdated\"\r\n    }\r\n}"
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "4- M.deleteJournalType {{currentId}}",
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "mutation ($values:JournalTypeDeleteGLDtoInput!) {\r\n    deleteJournalType(input: $values) {\r\n    id\r\n  }\r\n}",
                            "variables": "{\r\n  \"values\":{\r\n    \"id\":\"{{currentId}}\"\r\n  }\r\n}"
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    }
                  ]
                },
                {
                  "name": "✏️Q.journalTypes - first id filled in {{currentId}}",
                  "event": [
                    {
                      "listen": "test",
                      "script": {
                        "exec": [
                          "pm.test(\"Variables creation\", function () {\r",
                          "    let jsd = pm.response.json();\r",
                          "\r",
                          "    if (jsd.data == null || jsd.data.journalTypes.edges.length == 0)\r",
                          "        {console.error(\"Unable to save environment variable\");return;}\r",
                          "    pm.environment.set(\"currentId\", jsd.data.journalTypes.edges[0].node.id);\r",
                          "    console.log(\"'currentId' environment variable has been created : \" + pm.environment.get(\"currentId\"));\r",
                          "});"
                        ],
                        "type": "text/javascript",
                        "packages": {}
                      }
                    }
                  ],
                  "request": {
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "query {\r\n    journalTypes \r\n       (first:500){\r\n        edges {\r\n            node {\r\n               id\r\n               code\r\n               type\r\n               name\r\n               accountingAccountId\r\n               deactivated\r\n               isCreditNote\r\n               creditNoteReason\r\n            }\r\n        }\r\n        totalCount\r\n        pageInfo {\r\n            hasNextPage\r\n        }\r\n    }     \r\n}",
                        "variables": ""
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                },
                {
                  "name": "Q.journalTypes filtered by Id {{currentId}}",
                  "request": {
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "query  ($id : UUID!) {\r\n    journalTypes\r\n     (where : { id : { eq : $id }}) {\r\n        edges {\r\n            node {\r\n               id\r\n               code\r\n               type\r\n               name\r\n               accountingAccountId\r\n               deactivated\r\n            }\r\n        }\r\n    }     \r\n}",
                        "variables": "{\r\n  \"id\":\"{{currentId}}\"\r\n}"
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                }
              ]
            },
            {
              "name": "✏️Taxes",
              "item": [
                {
                  "name": "Q.taxes",
                  "request": {
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "query {\r\n    taxes\r\n       (first:500) {\r\n        edges {\r\n            node {\r\n                id\r\n                name\r\n                groupName\r\n                groupId\r\n                group{\r\n                    taxGroupCode\r\n                }\r\n                effectiveDate\r\n                inactive\r\n                inactivationDate\r\n                equivalenceSurchargePercentage\r\n                percentage\r\n                hasEquivalenceSurcharge\r\n                taxType\r\n            }\r\n        }\r\n        totalCount\r\n        pageInfo {\r\n            hasNextPage\r\n        }\r\n    }     \r\n}",
                        "variables": ""
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                }
              ]
            },
            {
              "name": "tax Groups",
              "item": [
                {
                  "name": "Q.taxGroups",
                  "request": {
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "query {\r\n    taxGroups {\r\n        edges {\r\n            node {\r\n                id\r\n                name\r\n                taxGroupCode\r\n                taxType\r\n                vatTaxation\r\n            }\r\n        }\r\n    }     \r\n}",
                        "variables": ""
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                }
              ]
            },
            {
              "name": "✏️Taxes Treatments",
              "item": [
                {
                  "name": "Q.taxTreatments",
                  "request": {
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "query {\r\n    taxTreatments \r\n       (first:500){\r\n        edges {\r\n            node {\r\n                id\r\n                description\r\n                taxCode\r\n                inactive\r\n                isIntracomunity\r\n                registerType\r\n                taxGroupId\r\n                taxGroup{\r\n                    taxGroupCode\r\n                    name\r\n                    taxType\r\n                    vatTaxation\r\n                }\r\n                taxType\r\n                inputAccountingAccount {\r\n                    code\r\n                    accountLevel\r\n                    accountType\r\n                    description\r\n                }\r\n                outputAccountingAccount {\r\n                    code\r\n                    accountLevel\r\n                    accountType\r\n                    description\r\n                }\r\n            }\r\n        }\r\n        totalCount\r\n        pageInfo {\r\n            hasNextPage\r\n        }\r\n    }     \r\n}",
                        "variables": ""
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                }
              ]
            },
            {
              "name": "✏️🆕 Invoice Type",
              "item": [
                {
                  "name": "Q.invoiceTypes",
                  "request": {
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "query {\r\n    invoiceTypes \r\n       (first:500){\r\n        edges {\r\n            node {\r\n              id\r\n              description\r\n              isAmendInvoice\r\n              registerType\r\n              siiCode\r\n              invoiceTypesCode\r\n              creationDate\r\n              modificationDate\r\n            }\r\n        }\r\n        totalCount\r\n        pageInfo {\r\n            hasNextPage\r\n        }\r\n    }     \r\n}",
                        "variables": ""
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                }
              ]
            },
            {
              "name": "✏️Accounting Entries",
              "item": [
                {
                  "name": "M.create Accounting Entries using codes, then delete it",
                  "item": [
                    {
                      "name": "1- Q.accountingExercises - most recently opened, startDate filled in {{dateInFirstExercice}}",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "pm.test(\"Variables creation\", function () {\r",
                              "    let jsd = pm.response.json();\r",
                              "    console.log(jsd.data.accountingExercises.edges[0].node.id);\r",
                              "    if (jsd.data == null || jsd.data.accountingExercises.edges.length == 0)\r",
                              "        {console.error(\"Unable to save environment variable\");return;}\r",
                              "    pm.environment.set(\"dateInFirstExercice\",jsd.data.accountingExercises.edges[0].node.startDate);\r",
                              "    console.log(\"'dateInFirstExercice' environment variable has been created : \" + pm.environment.get(\"dateInFirstExercice\"));\r",
                              "});\r",
                              "\r",
                              ""
                            ],
                            "type": "text/javascript"
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "query {\r\n    accountingExercises(\r\n        where: {status: {eq: OPEN}}\r\n        last:1\r\n        ) {\r\n        edges {\r\n            node {\r\n               startDate\r\n            }\r\n        }\r\n    }     \r\n}",
                            "variables": ""
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "2- Q.journalTypes - first type SALES_INVOICE",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "pm.test(\"Variables creation\", function () {\r",
                              "    let jsd = pm.response.json();\r",
                              "\r",
                              "    if (jsd.data == null || jsd.data.journalTypes.edges.length == 0)\r",
                              "        {console.error(\"Unable to save environment variable\");return;}\r",
                              "    pm.environment.set(\"journalSalesCode\", jsd.data.journalTypes.edges[0].node.code);\r",
                              "     console.log(\"'journalSalesCode' environment variable has been created : \" + pm.environment.get(\"journalSalesCode\"));\r",
                              "\r",
                              "});"
                            ],
                            "type": "text/javascript"
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "query {\r\n     journalTypes(\r\n         where: {type: {eq: SALES_INVOICE}}\r\n         first:1) {\r\n        edges {\r\n            node {\r\n               code\r\n            }\r\n        }\r\n    }     \r\n}",
                            "variables": ""
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "3-Q.customers - first activated with account",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "pm.test(\"Variables creation\", function () {\r",
                              "    let jsd = pm.response.json();\r",
                              "\r",
                              "    if (jsd.data == null || jsd.data.customers.edges.length == 0)\r",
                              "        {console.error(\"Unable to save environment variable\");return;}\r",
                              "    pm.environment.set(\"customerCode\", jsd.data.customers.edges[0].node.code);\r",
                              "    console.log(\"customerCode environment variable has been created : \" + pm.environment.get(\"customerCode\"));\r",
                              "    pm.environment.set(\"defaultAccountingAccountId\", jsd.data.customers.edges[0].node.defaultAccountingAccountId);\r",
                              "    console.log(\"defaultAccountingAccountId environment variable has been created : \" + pm.environment.get(\"defaultAccountingAccountId\"));\r",
                              "});"
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        },
                        {
                          "listen": "prerequest",
                          "script": {
                            "exec": [
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        }
                      ],
                      "request": {
                        "auth": {
                          "type": "bearer",
                          "bearer": [
                            {
                              "key": "token",
                              "value": "{{accessToken}}",
                              "type": "string"
                            }
                          ]
                        },
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "query {\r\n    customers (\r\n        order: [{ code: ASC }]\r\n        where: {\r\n            disabled: {eq: false}\r\n            }\r\n        first:1\r\n        ) {\r\n        edges {\r\n            node {\r\n                  code\r\n                  defaultAccountingAccountId\r\n            }\r\n        }\r\n    }   \r\n}",
                            "variables": ""
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "4- Q.accountingAccounts sales & tax account",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "pm.test(\"Variables creation\", function () {\r",
                              "    let jsd = pm.response.json();\r",
                              "    let edges = jsd.data?.accountingAccounts?.edges;\r",
                              "    if (edges == null || edges.length < 2)\r",
                              "        {console.error(\"Unable to save environment variable\");return;}\r",
                              "\r",
                              "    let salesAccount = pm.environment.get(\"salesAccount\");\r",
                              "    let taxAccount = pm.environment.get(\"taxAccount\");\r",
                              "\r",
                              "    for(let edge of edges) {\r",
                              "        let code = edge.node.code;\r",
                              "        if(code.startsWith(salesAccount)) {\r",
                              "            pm.environment.set(\"salesAccountCode\", code);\r",
                              "            console.log(\"'salesAccountCode' environment variable has been created : \" + pm.environment.get(\"salesAccountCode\"));\r",
                              "        } else if(code.startsWith(taxAccount)) {\r",
                              "            pm.environment.set(\"taxAccountCode\", code);\r",
                              "            console.log(\"'taxAccountCode' environment variable has been created : \" + pm.environment.get(\"taxAccountCode\"));\r",
                              "        }\r",
                              "        else{\r",
                              "            pm.environment.set(\"thirdLedgerAccountCode\", code);\r",
                              "            console.log(\"'thirdLedgerAccountCode' environment variable has been created : \" + pm.environment.get(\"thirdLedgerAccountCode\"));\r",
                              "        }\r",
                              "    }\r",
                              "});\r",
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {}
                          }
                        },
                        {
                          "listen": "prerequest",
                          "script": {
                            "exec": [
                              "let legislationCode = pm.environment.get(\"legislationCode\");\r",
                              "\r",
                              "if (legislationCode === 'FR') {\r",
                              "    pm.environment.set(\"salesAccount\", \"70105\");\r",
                              "    pm.environment.set(\"taxAccount\", \"445715\");\r",
                              "} else if (legislationCode === 'ES') {\r",
                              "    pm.environment.set(\"salesAccount\", \"70100\");\r",
                              "    pm.environment.set(\"taxAccount\", \"477000\");\r",
                              "} else if (legislationCode === 'DE') {\r",
                              "    pm.environment.set(\"salesAccount\", \"8300\");\r",
                              "    pm.environment.set(\"taxAccount\", \"1771\");\r",
                              "} else {\r",
                              "    console.error(\"Unexpected legislationCode value\");\r",
                              "    return;\r",
                              "}\r",
                              "\r",
                              "console.log(\"'salesAccount' environment variable has been created : \" + pm.environment.get(\"salesAccount\"));\r",
                              "console.log(\"'taxAccount' environment variable has been created : \" + pm.environment.get(\"taxAccount\"));\r",
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "query ($salesAccount : String!, $taxAccount : String!, $thirdLedgerAccount: UUID!) {\r\n    accountingAccounts (\r\n        where: { \r\n              or: [\r\n                { code: {startsWith: $salesAccount} },\r\n                { code: {startsWith: $taxAccount} }\r\n                { id: {eq: $thirdLedgerAccount} }\r\n              ],\r\n              deactivated: {eq:false},\r\n              accountLevel: {eq:SUB_ACCOUNT}\r\n        },\r\n    ) {\r\n        edges {\r\n            node {\r\n                code\r\n\r\n            }\r\n        }\r\n    }    \r\n}\r\n",
                            "variables": "{\r\n    \"salesAccount\":\"{{salesAccount}}\",\r\n    \"taxAccount\":\"{{taxAccount}}\",\r\n    \"thirdLedgerAccount\":\"{{defaultAccountingAccountId}}\"\r\n}\r\n"
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "5- M.CreateAccountingEntry Sales - new id filled in {{currentId}}",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "pm.test(\"Variable creation\", function () {\r",
                              "    let jsd = pm.response.json();\r",
                              "\r",
                              "    if (jsd.data == null || jsd.data.createAccountingEntryUsingCodes == null)\r",
                              "        {console.error(\"Unable to save environment variable\");return;}\r",
                              "    let result = jsd.data.createAccountingEntryUsingCodes;\r",
                              "    pm.environment.set(\"currentId\", result.id);\r",
                              "    console.log(\"'currentId' environment variable has been created : \" + pm.environment.get(\"currentId\"));\r",
                              "});\r",
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {}
                          }
                        },
                        {
                          "listen": "prerequest",
                          "script": {
                            "exec": [
                              "let taxBase = 150;\r",
                              "pm.environment.set(\"taxBase\", taxBase);\r",
                              "console.log(\"'taxBase' environment variable has been created : \" + pm.environment.get(\"taxBase\"));\r",
                              "\r",
                              "let legislationCode = pm.environment.get(\"legislationCode\");\r",
                              "let subAccountThird;\r",
                              "let taxPercentage;\r",
                              "if (legislationCode === 'FR') {\r",
                              "     taxPercentage=5.5;\r",
                              "} else if (legislationCode === 'ES') {\r",
                              "     taxPercentage=10;\r",
                              "} else if (legislationCode === 'DE') {\r",
                              "     taxPercentage=7;\r",
                              "} else {\r",
                              "    console.error(\"Unexpected legislationCode value\");\r",
                              "    return;\r",
                              "}\r",
                              "\r",
                              "let taxAmount = (taxBase * taxPercentage) / 100;\r",
                              "pm.environment.set(\"taxAmount\", taxAmount);\r",
                              "console.log(\"'taxAmount' environment variable has been created : \" + pm.environment.get(\"taxAmount\"));\r",
                              "\r",
                              "let amountIncludingTax = taxBase + taxAmount;\r",
                              "pm.environment.set(\"amountIncludingTax\", amountIncludingTax);\r",
                              "console.log(\"'amountIncludingTax' environment variable has been created : \" + pm.environment.get(\"amountIncludingTax\"));\r",
                              "\r",
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "mutation CreateAccountingEntryUsingCodes ($values:AccountingEntryCreateUsingCodesGLDtoInput!) {    \r\n  createAccountingEntryUsingCodes (input: $values) {\r\n    id\r\n    number\r\n  }\r\n}\r\n",
                            "variables": "{\r\n    \"values\":{\r\n      \"description\": \"Facture FA0022\",\r\n      \"date\": \"{{dateInFirstExercice}}\",\r\n      \"documentDate\" : \"{{dateInFirstExercice}}\",\r\n      \"documentNumber\" : \"FA0022\",\r\n      \"journalTypeCode\": \"{{journalSalesCode}}\",\r\n      \"accountingEntryLines\": [\r\n        {\r\n          \"thirdCode\":\"{{customerCode}}\",\r\n          \"creditAmount\": 0,\r\n          \"debitAmount\": {{amountIncludingTax}},\r\n          \"subAccountCode\": \"{{thirdLedgerAccountCode}}\"\r\n        },\r\n        {\r\n          \"creditAmount\": {{taxBase}},\r\n          \"debitAmount\": 0,\r\n          \"subAccountCode\": \"{{salesAccountCode}}\"\r\n        },\r\n        {\r\n          \"creditAmount\": {{taxAmount}},\r\n          \"debitAmount\": 0,\r\n          \"subAccountCode\": \"{{taxAccountCode}}\"\r\n        }\r\n      ]\r\n    }\r\n}\r\n"
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "6- M.deleteAccountingEntry {{currentId}}",
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "mutation ($values:AccountingEntryDeleteGLDtoInput!) {\r\n    deleteAccountingEntry(input: $values) {\r\n    id\r\n  }\r\n}",
                            "variables": "{\r\n  \"values\":{\r\n    \"id\":\"{{currentId}}\"\r\n  }\r\n}"
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "7- M.CreateAccountingEntry Sales - isgroupinInvoices option for ES {{currentId}}",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "pm.test(\"Variable creation\", function () {\r",
                              "    let jsd = pm.response.json();\r",
                              "\r",
                              "    if (jsd.data == null || jsd.data.createAccountingEntryUsingCodes == null)\r",
                              "        {console.error(\"Unable to save environment variable\");return;}\r",
                              "    let result = jsd.data.createAccountingEntryUsingCodes;\r",
                              "    pm.environment.set(\"currentId\", result.id);\r",
                              "    console.log(\"'currentId' environment variable has been created : \" + pm.environment.get(\"currentId\"));\r",
                              "});\r",
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        },
                        {
                          "listen": "prerequest",
                          "script": {
                            "exec": [
                              "let taxBase = 150;\r",
                              "pm.environment.set(\"taxBase\", taxBase);\r",
                              "console.log(\"'taxBase' environment variable has been created : \" + pm.environment.get(\"taxBase\"));\r",
                              "\r",
                              "let legislationCode = pm.environment.get(\"legislationCode\");\r",
                              "let subAccountThird;\r",
                              "let taxPercentage;\r",
                              "if (legislationCode === 'FR') {\r",
                              "     taxPercentage=5.5;\r",
                              "} else if (legislationCode === 'ES') {\r",
                              "     taxPercentage=10;\r",
                              "} else if (legislationCode === 'DE') {\r",
                              "     taxPercentage=7;\r",
                              "} else {\r",
                              "    console.error(\"Unexpected legislationCode value\");\r",
                              "    return;\r",
                              "}\r",
                              "\r",
                              "let taxAmount = (taxBase * taxPercentage) / 100;\r",
                              "pm.environment.set(\"taxAmount\", taxAmount);\r",
                              "console.log(\"'taxAmount' environment variable has been created : \" + pm.environment.get(\"taxAmount\"));\r",
                              "\r",
                              "let amountIncludingTax = taxBase + taxAmount;\r",
                              "pm.environment.set(\"amountIncludingTax\", amountIncludingTax);\r",
                              "console.log(\"'amountIncludingTax' environment variable has been created : \" + pm.environment.get(\"amountIncludingTax\"));\r",
                              "\r",
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "mutation CreateAccountingEntryUsingCodes ($values:AccountingEntryCreateUsingCodesGLDtoInput!) {    \r\n  createAccountingEntryUsingCodes (input: $values) {\r\n    id\r\n    number\r\n  }\r\n}\r\n",
                            "variables": "{\r\n    \"values\":{\r\n      \"description\": \"Facture FA0022\",\r\n      \"date\": \"{{dateInFirstExercice}}\",\r\n      \"documentDate\" : \"{{dateInFirstExercice}}\",\r\n      \"documentNumber\" : \"FA0022\",\r\n      \"journalTypeCode\": \"{{journalSalesCode}}\",\r\n      \"accountingEntryLines\": [\r\n        {\r\n          \"thirdCode\":\"{{customerCode}}\",\r\n          \"creditAmount\": 0,\r\n          \"debitAmount\": {{amountIncludingTax}},\r\n          \"subAccountCode\": \"{{thirdLedgerAccountCode}}\",\r\n          \"isGroupingInvoices\":true,\r\n  \r\n        \"startInvoiceNumber\":\"INV01\",\r\n        \r\n        \"finishInvoiceNumber\":\"INV05\"\r\n        },\r\n        {\r\n          \"creditAmount\": {{taxBase}},\r\n          \"debitAmount\": 0,\r\n          \"subAccountCode\": \"{{salesAccountCode}}\"\r\n        },\r\n        {\r\n          \"creditAmount\": {{taxAmount}},\r\n          \"debitAmount\": 0,\r\n          \"subAccountCode\": \"{{taxAccountCode}}\"\r\n        }\r\n      ]\r\n    }\r\n}\r\n"
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "8- M.deleteAccountingEntry {{currentId}}",
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "mutation ($values:AccountingEntryDeleteGLDtoInput!) {\r\n    deleteAccountingEntry(input: $values) {\r\n    id\r\n  }\r\n}",
                            "variables": "{\r\n  \"values\":{\r\n    \"id\":\"{{currentId}}\"\r\n  }\r\n}"
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    }
                  ],
                  "description": "The steps 1 to 5 will allow you to retrieve data necessary for the creation of the accounting entry :\n\n1. a valid date in an open fiscal period,\n    \n2. a journal code,\n    \n3. a customer code, and their general ledger account code\n    \n4. a sales and tax account codes.\n    \n\n**You must execute these steps in the specified order** before requesting the creation of the accounting entry."
                },
                {
                  "name": "M.create Accounting Entries using Ids, then delete it",
                  "item": [
                    {
                      "name": "1- Q.accountingExercises - most recently opened, startDate filled in {{dateInFirstExercice}}",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "pm.test(\"Variables creation\", function () {\r",
                              "    let jsd = pm.response.json();\r",
                              "    console.log(jsd.data.accountingExercises.edges[0].node.id);\r",
                              "    if (jsd.data == null || jsd.data.accountingExercises.edges.length == 0)\r",
                              "        {console.error(\"Unable to save environment variable\");return;}\r",
                              "    pm.environment.set(\"dateInFirstExercice\",jsd.data.accountingExercises.edges[0].node.startDate);\r",
                              "    console.log(\"'dateInFirstExercice' environment variable has been created : \" + pm.environment.get(\"dateInFirstExercice\"));\r",
                              "});\r",
                              "\r",
                              ""
                            ],
                            "type": "text/javascript"
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "query {\r\n    accountingExercises(\r\n        where: {status: {eq: OPEN}}\r\n        last:1\r\n        ) {\r\n        edges {\r\n            node {\r\n               startDate\r\n            }\r\n        }\r\n    }     \r\n}",
                            "variables": ""
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "2- Q.journalTypes - first type SALES_INVOICE",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "pm.test(\"Variables creation\", function () {\r",
                              "    let jsd = pm.response.json();\r",
                              "\r",
                              "    if (jsd.data == null || jsd.data.journalTypes.edges.length == 0)\r",
                              "        {console.error(\"Unable to save environment variable\");return;}\r",
                              "    pm.environment.set(\"journalSalesId\", jsd.data.journalTypes.edges[0].node.id);\r",
                              "    console.log(\"'journalSalesId' environment variable has been created : \" + pm.environment.get(\"journalSalesId\"));\r",
                              "});"
                            ],
                            "type": "text/javascript"
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "query {\r\n     journalTypes(\r\n         where: {type: {eq: SALES_INVOICE}}\r\n         first:1) {\r\n        edges {\r\n            node {\r\n               id\r\n            }\r\n        }\r\n    }     \r\n}",
                            "variables": ""
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "3-Q.customers - first activated with account",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "pm.test(\"Variables creation\", function () {\r",
                              "    let jsd = pm.response.json();\r",
                              "\r",
                              "    if (jsd.data == null || jsd.data.customers.edges.length == 0)\r",
                              "        {console.error(\"Unable to save environment variable\");return;}\r",
                              "    pm.environment.set(\"customerId\", jsd.data.customers.edges[0].node.id);\r",
                              "    console.log(\"customerId environment variable has been created : \" + pm.environment.get(\"customerId\"));\r",
                              "    pm.environment.set(\"defaultAccountingAccountId\", jsd.data.customers.edges[0].node.defaultAccountingAccountId);\r",
                              "    console.log(\"defaultAccountingAccountId environment variable has been created : \" + pm.environment.get(\"defaultAccountingAccountId\"));\r",
                              "\r",
                              "});"
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        },
                        {
                          "listen": "prerequest",
                          "script": {
                            "exec": [
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        }
                      ],
                      "request": {
                        "auth": {
                          "type": "bearer",
                          "bearer": [
                            {
                              "key": "token",
                              "value": "{{accessToken}}",
                              "type": "string"
                            }
                          ]
                        },
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "query {\r\n    customers (\r\n        order: [{ code: ASC }]\r\n        where: {\r\n            disabled: {eq: false}\r\n            }\r\n        first:1\r\n        ) {\r\n        edges {\r\n            node {\r\n                  id\r\n                  defaultAccountingAccountId\r\n            }\r\n        }\r\n    }   \r\n}",
                            "variables": ""
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "4- Q.accountingAccounts sales & tax account",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "pm.test(\"Variables creation\", function () {\r",
                              "    let jsd = pm.response.json();\r",
                              "    let edges = jsd.data?.accountingAccounts?.edges;\r",
                              "    if (edges == null || edges.length < 2)\r",
                              "        {console.error(\"Unable to save environment variable\");return;}\r",
                              "\r",
                              "    let salesAccount = pm.environment.get(\"salesAccount\");\r",
                              "    let taxAccount = pm.environment.get(\"taxAccount\");\r",
                              "\r",
                              "    for(let edge of edges) {\r",
                              "        let code = edge.node.code;\r",
                              "        if(code.startsWith(salesAccount)) {\r",
                              "            pm.environment.set(\"salesAccountId\", edge.node.id);\r",
                              "            console.log(\"'salesAccountId' environment variable has been created : \" + pm.environment.get(\"salesAccountId\"));\r",
                              "        } else if(code.startsWith(taxAccount)) {\r",
                              "            pm.environment.set(\"taxAccountId\", edge.node.id);\r",
                              "            console.log(\"'taxAccountId' environment variable has been created : \" + pm.environment.get(\"taxAccountId\"));\r",
                              "        }\r",
                              "    }\r",
                              "});\r",
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {}
                          }
                        },
                        {
                          "listen": "prerequest",
                          "script": {
                            "exec": [
                              "let legislationCode = pm.environment.get(\"legislationCode\");\r",
                              "\r",
                              "if (legislationCode === 'FR') {\r",
                              "    pm.environment.set(\"salesAccount\", \"70105\");\r",
                              "    pm.environment.set(\"taxAccount\", \"445715\");\r",
                              "} else if (legislationCode === 'ES') {\r",
                              "    pm.environment.set(\"salesAccount\", \"70100\");\r",
                              "    pm.environment.set(\"taxAccount\", \"477000\");\r",
                              "} else if (legislationCode === 'DE') {\r",
                              "    pm.environment.set(\"salesAccount\", \"8300\");\r",
                              "    pm.environment.set(\"taxAccount\", \"1771\");\r",
                              "} else {\r",
                              "    console.error(\"Unexpected legislationCode value\");\r",
                              "    return;\r",
                              "}\r",
                              "\r",
                              "console.log(\"'salesAccount' environment variable has been created : \" + pm.environment.get(\"salesAccount\"));\r",
                              "console.log(\"'taxAccount' environment variable has been created : \" + pm.environment.get(\"taxAccount\"));\r",
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "query ($salesAccount : String!, $taxAccount : String!) {\r\n    accountingAccounts (\r\n        where: { \r\n              or: [\r\n                { code: {startsWith: $salesAccount} },\r\n                { code: {startsWith: $taxAccount} }\r\n              ],\r\n              deactivated: {eq:false},\r\n              accountLevel: {eq:SUB_ACCOUNT}\r\n        },\r\n    ) {\r\n        edges {\r\n            node {\r\n                code\r\n                id\r\n            }\r\n        }\r\n    }    \r\n}\r\n",
                            "variables": "{\r\n    \"salesAccount\":\"{{salesAccount}}\",\r\n    \"taxAccount\":\"{{taxAccount}}\"\r\n}\r\n"
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "5- M.CreateAccountingEntry Sales - new id filled in {{currentId}}",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "pm.test(\"Variable creation\", function () {\r",
                              "    let jsd = pm.response.json();\r",
                              "\r",
                              "    if (jsd.data == null || jsd.data.createAccountingEntryUsingIds == null)\r",
                              "        {console.error(\"Unable to save environment variable\");return;}\r",
                              "    let result = jsd.data.createAccountingEntryUsingIds;\r",
                              "    pm.environment.set(\"currentId\", result.id);\r",
                              "    console.log(\"'currentId' environment variable has been created : \" + pm.environment.get(\"currentId\"));\r",
                              "});\r",
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {}
                          }
                        },
                        {
                          "listen": "prerequest",
                          "script": {
                            "exec": [
                              "let taxBase = 150;\r",
                              "pm.environment.set(\"taxBase\", taxBase);\r",
                              "console.log(\"'taxBase' environment variable has been created : \" + pm.environment.get(\"taxBase\"));\r",
                              "\r",
                              "let legislationCode = pm.environment.get(\"legislationCode\");\r",
                              "let taxPercentage;\r",
                              "if (legislationCode === 'FR') {\r",
                              "     taxPercentage=5.5;\r",
                              "} else if (legislationCode === 'ES') {\r",
                              "     taxPercentage=10;\r",
                              "} else if (legislationCode === 'DE') {\r",
                              "     taxPercentage=7;\r",
                              "} else {\r",
                              "    console.error(\"Unexpected legislationCode value\");\r",
                              "    return;\r",
                              "}\r",
                              "\r",
                              "let taxAmount = (taxBase * taxPercentage) / 100;\r",
                              "pm.environment.set(\"taxAmount\", taxAmount);\r",
                              "console.log(\"'taxAmount' environment variable has been created : \" + pm.environment.get(\"taxAmount\"));\r",
                              "\r",
                              "let amountIncludingTax = taxBase + taxAmount;\r",
                              "pm.environment.set(\"amountIncludingTax\", amountIncludingTax);\r",
                              "console.log(\"'amountIncludingTax' environment variable has been created : \" + pm.environment.get(\"amountIncludingTax\"));\r",
                              "\r",
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "mutation ($values:AccountingEntryCreateUsingIdsGLDtoInput!) {    \r\n  createAccountingEntryUsingIds (input: $values) {\r\n    id\r\n    number\r\n  }\r\n}\r\n",
                            "variables": "{\r\n    \"values\":{\r\n      \"description\": \"Facture FA0022\",\r\n      \"date\": \"{{dateInFirstExercice}}\",\r\n      \"documentDate\" : \"{{dateInFirstExercice}}\",\r\n      \"documentNumber\" : \"FA0022\",\r\n      \"journalTypeId\": \"{{journalSalesId}}\",\r\n      \"accountingEntryLines\": [\r\n        {\r\n          \"thirdId\":\"{{customerId}}\",\r\n          \"creditAmount\": 0,\r\n          \"debitAmount\": {{amountIncludingTax}},\r\n          \"subAccountId\": \"{{defaultAccountingAccountId}}\"\r\n        },\r\n        {\r\n          \"creditAmount\": {{taxBase}},\r\n          \"debitAmount\": 0,\r\n          \"subAccountId\": \"{{salesAccountId}}\"\r\n        },\r\n        {\r\n          \"creditAmount\": {{taxAmount}},\r\n          \"debitAmount\": 0,\r\n          \"subAccountId\": \"{{taxAccountId}}\"\r\n        }\r\n      ]\r\n    }\r\n}\r\n"
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "6- M.deleteAccountingEntry {{currentId}}",
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "mutation ($values:AccountingEntryDeleteGLDtoInput!) {\r\n    deleteAccountingEntry(input: $values) {\r\n    id\r\n  }\r\n}",
                            "variables": "{\r\n  \"values\":{\r\n    \"id\":\"{{currentId}}\"\r\n  }\r\n}"
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "7- M.CreateAccountingEntry Sales - is groupingInvoices option for ES {{currentId}}",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "pm.test(\"Variable creation\", function () {\r",
                              "    let jsd = pm.response.json();\r",
                              "\r",
                              "    if (jsd.data == null || jsd.data.createAccountingEntryUsingIds == null)\r",
                              "        {console.error(\"Unable to save environment variable\");return;}\r",
                              "    let result = jsd.data.createAccountingEntryUsingIds;\r",
                              "    pm.environment.set(\"currentId\", result.id);\r",
                              "    console.log(\"'currentId' environment variable has been created : \" + pm.environment.get(\"currentId\"));\r",
                              "});\r",
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        },
                        {
                          "listen": "prerequest",
                          "script": {
                            "exec": [
                              "let taxBase = 150;\r",
                              "pm.environment.set(\"taxBase\", taxBase);\r",
                              "console.log(\"'taxBase' environment variable has been created : \" + pm.environment.get(\"taxBase\"));\r",
                              "\r",
                              "let legislationCode = pm.environment.get(\"legislationCode\");\r",
                              "let taxPercentage;\r",
                              "if (legislationCode === 'FR') {\r",
                              "     taxPercentage=5.5;\r",
                              "} else if (legislationCode === 'ES') {\r",
                              "     taxPercentage=10;\r",
                              "} else if (legislationCode === 'DE') {\r",
                              "     taxPercentage=7;\r",
                              "} else {\r",
                              "    console.error(\"Unexpected legislationCode value\");\r",
                              "    return;\r",
                              "}\r",
                              "\r",
                              "let taxAmount = (taxBase * taxPercentage) / 100;\r",
                              "pm.environment.set(\"taxAmount\", taxAmount);\r",
                              "console.log(\"'taxAmount' environment variable has been created : \" + pm.environment.get(\"taxAmount\"));\r",
                              "\r",
                              "let amountIncludingTax = taxBase + taxAmount;\r",
                              "pm.environment.set(\"amountIncludingTax\", amountIncludingTax);\r",
                              "console.log(\"'amountIncludingTax' environment variable has been created : \" + pm.environment.get(\"amountIncludingTax\"));\r",
                              "\r",
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "mutation ($values:AccountingEntryCreateUsingIdsGLDtoInput!) {    \r\n  createAccountingEntryUsingIds (input: $values) {\r\n    id\r\n    number\r\n  }\r\n}\r\n",
                            "variables": "{\r\n    \"values\":{\r\n      \"description\": \"Facture FA0022\",\r\n      \"date\": \"{{dateInFirstExercice}}\",\r\n      \"documentDate\" : \"{{dateInFirstExercice}}\",\r\n      \"documentNumber\" : \"FA0022\",\r\n      \"journalTypeId\": \"{{journalSalesId}}\",\r\n      \"accountingEntryLines\": [\r\n        {\r\n          \"thirdId\":\"{{customerId}}\",\r\n          \"creditAmount\": 0,\r\n          \"debitAmount\": {{amountIncludingTax}},\r\n          \"subAccountId\": \"{{defaultAccountingAccountId}}\",\r\n           \"isGroupingInvoices\":true,\r\n  \r\n        \"startInvoiceNumber\":\"INV01\",\r\n        \r\n        \"finishInvoiceNumber\":\"INV05\"\r\n        },\r\n        {\r\n          \"creditAmount\": {{taxBase}},\r\n          \"debitAmount\": 0,\r\n          \"subAccountId\": \"{{salesAccountId}}\"\r\n        },\r\n        {\r\n          \"creditAmount\": {{taxAmount}},\r\n          \"debitAmount\": 0,\r\n          \"subAccountId\": \"{{taxAccountId}}\"\r\n        }\r\n      ]\r\n    }\r\n}\r\n"
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "8- M.deleteAccountingEntry {{currentId}}",
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "mutation ($values:AccountingEntryDeleteGLDtoInput!) {\r\n    deleteAccountingEntry(input: $values) {\r\n    id\r\n  }\r\n}",
                            "variables": "{\r\n  \"values\":{\r\n    \"id\":\"{{currentId}}\"\r\n  }\r\n}"
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    }
                  ],
                  "description": "The steps 1 to 5 will allow you to retrieve data necessary for the creation of the accounting entry :\n\n1. a valid date in an open fiscal period,\n    \n2. a journal Id,\n    \n3. a customer Id, and their general ledger account Id\n    \n4. a sales and tax account Ids."
                },
                {
                  "name": "✏️Q.accountingEntries - first id filled in {{currentId}}",
                  "event": [
                    {
                      "listen": "test",
                      "script": {
                        "exec": [
                          "pm.test(\"Variables creation\", function () {\r",
                          "    let jsd = pm.response.json();\r",
                          "\r",
                          "    if (jsd.data == null || jsd.data.accountingEntries.edges.length == 0)\r",
                          "        {console.error(\"Unable to save environment variable\");return;}\r",
                          "    pm.environment.set(\"currentId\", jsd.data.accountingEntries.edges[0].node.id);\r",
                          "    console.log(\"'currentId' environment variable has been created : \" + pm.environment.get(\"currentId\"));\r",
                          "});"
                        ],
                        "type": "text/javascript",
                        "packages": {},
                        "requests": {}
                      }
                    }
                  ],
                  "request": {
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "query {\r\n    accountingEntries(\r\n        first:500\r\n    ) {\r\n        edges {\r\n            node {\r\n                id\r\n                date\r\n                journalType{code}\r\n                salesInvoice{documentDate operationalNumber status}\r\n                number    \r\n                documentNumber\r\n                documentDate    \r\n                sourceType      \r\n                tanNumber          \r\n                currency{code}\r\n                accountingEntryLines {\r\n                    description\r\n                    creditAmount\r\n                    debitAmount\r\n                    order\r\n                    accountingEntryThirdParty {\r\n                        id\r\n                        code\r\n                        countryAcronym\r\n                        documentId\r\n                        identificationTypeId\r\n                        socialName\r\n                        thirdPartyId\r\n                        documentId\r\n                    }\r\n                    accountingEntryPayment {\r\n                        id                        \r\n                        matching\r\n                        matchingLetter\r\n                        matchId\r\n                    }\r\n                    accountingEntryDimensionTags {\r\n                        id                        \r\n                        dimensionId\r\n                       dimensionTagId\r\n                        amount\r\n                    }\r\n                    accountingEntryInvoice {\r\n                        id                        \r\n                        externalInvoiceNumber                  \r\n                        amount\r\n                        isCashVat\r\n                        isGroupingInvoices\r\n                        startInvoiceNumber\r\n                        finishInvoiceNumber\r\n                        invoiceTypeId \r\n                        invoiceType \r\n                        {description}\r\n                        accountingEntryTaxes {\r\n                            regimeType\r\n                            taxAmount\r\n                            taxBase\r\n                            taxPercentage\r\n                            taxGroupId\r\n                            taxTreatmentId\r\n                            id\r\n                            hasEquivalenceSurcharge\r\n                            equivalenceSurchargePercentage\r\n                            equivalenceSurchargeQuota\r\n                        }\r\n                    }\r\n                }\r\n            }\r\n        }\r\n        totalCount\r\n        pageInfo {\r\n            hasNextPage\r\n        }\r\n    }     \r\n}",
                        "variables": ""
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                },
                {
                  "name": "✏️Q.accountingEntries -  corrective invoice for ES",
                  "event": [
                    {
                      "listen": "test",
                      "script": {
                        "exec": [
                          "pm.test(\"Variables creation\", function () {\r",
                          "    let jsd = pm.response.json();\r",
                          "\r",
                          "    if (jsd.data == null || jsd.data.accountingEntries.edges.length == 0)\r",
                          "        {console.error(\"Unable to save environment variable\");return;}\r",
                          "    pm.environment.set(\"currentId\", jsd.data.accountingEntries.edges[0].node.id);\r",
                          "    console.log(\"'currentId' environment variable has been created : \" + pm.environment.get(\"currentId\"));\r",
                          "});"
                        ],
                        "type": "text/javascript",
                        "packages": {},
                        "requests": {}
                      }
                    },
                    {
                      "listen": "prerequest",
                      "script": {
                        "exec": [
                          "//LEGISLATIONS:ES"
                        ],
                        "type": "text/javascript",
                        "packages": {},
                        "requests": {}
                      }
                    }
                  ],
                  "request": {
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "query {\r\n    accountingEntries(\r\n        first:500\r\n        where:{journalType:{isCreditNote:{eq:true }}}\r\n    ) {\r\n        edges {\r\n            node {\r\n                id\r\n                date\r\n                journalType{code}\r\n                number    \r\n                documentNumber\r\n                documentDate          \r\n                accountingEntryLines {\r\n                    description\r\n                    creditAmount\r\n                    debitAmount\r\n                    accountingEntryThirdParty{\r\n                        countryAcronym\r\n                        socialName\r\n                    }\r\n                    accountingEntryInvoice {\r\n                       id                        \r\n                       documentDate\r\n                       externalInvoiceNumber\r\n                       creditNoteType\r\n                       creditNoteReason\r\n                       originalEntryInvoiceTaxesBaseSum\r\n                       originalEntryInvoiceTaxesSurchargeAmountSum\r\n                       originalAccountingEntryInvoice{\r\n                          id\r\n                          documentDate\r\n                          externalInvoiceNumber\r\n                       }\r\n                    }\r\n                }\r\n            }\r\n        }\r\n        totalCount\r\n        pageInfo {\r\n            hasNextPage\r\n        }\r\n    }     \r\n}",
                        "variables": ""
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                },
                {
                  "name": "Q.accountingPayments",
                  "event": [
                    {
                      "listen": "test",
                      "script": {
                        "exec": [
                          ""
                        ],
                        "type": "text/javascript",
                        "packages": {}
                      }
                    },
                    {
                      "listen": "prerequest",
                      "script": {
                        "exec": [
                          ""
                        ],
                        "type": "text/javascript",
                        "packages": {}
                      }
                    }
                  ],
                  "request": {
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "query {\r\n     accountingEntryPayments(\r\n       first:500\r\n       where :{\r\n         accountingEntryLine:{ accountingEntry: {date: { gte: \"2025-01-01\", lte: \"2025-12-31\" }}}},\r\n        ) {\r\n        edges {\r\n            node {\r\n                id                        \r\n                matching\r\n                matchingLetter\r\n                matchId\r\n                accountingEntryLine {\r\n                    id\r\n                    debitAmount\r\n                    creditAmount\r\n                }   \r\n            }\r\n        }\r\n    }\r\n}     ",
                        "variables": ""
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                },
                {
                  "name": "Q.accountingEntryDimensionTags",
                  "event": [
                    {
                      "listen": "test",
                      "script": {
                        "exec": [
                          ""
                        ],
                        "type": "text/javascript",
                        "packages": {}
                      }
                    },
                    {
                      "listen": "prerequest",
                      "script": {
                        "exec": [
                          ""
                        ],
                        "type": "text/javascript",
                        "packages": {}
                      }
                    }
                  ],
                  "request": {
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "query {\r\n    accountingEntryDimensionTags(\r\n        first:500\r\n       where :{\r\n        accountingEntryLine:{ accountingEntry: {date: { gte: \"2025-01-01\", lte: \"2025-12-31\" }}}},  \r\n      ) {\r\n        edges {\r\n            node {\r\n                id                        \r\n                dimensionId\r\n                dimensionTagId\r\n                amount\r\n                accountingEntryLine \r\n                {\r\n                    id\r\n                    debitAmount\r\n                    creditAmount\r\n                }   \r\n            }\r\n        }\r\n    }\r\n}   ",
                        "variables": ""
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                },
                {
                  "name": "Q.accountingEntries filtered by Id {{currentId}}",
                  "request": {
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "query  ($id : UUID!) {\r\n    accountingEntries\r\n     (where : { id : { eq : $id }}) {\r\n        edges {\r\n            node {\r\n                id\r\n                entryType\r\n                date\r\n                number                        \r\n                accountingEntryLines {\r\n                    description\r\n                    creditAmount\r\n                    debitAmount\r\n                    order\r\n                    accountingEntryThirdParty {\r\n                        id\r\n                        code\r\n                        countryAcronym\r\n                        documentId\r\n                        identificationTypeId\r\n                        socialName\r\n                        thirdPartyId\r\n                        documentId\r\n                    }\r\n                    accountingEntryPayment {\r\n                        id                        \r\n                        matching\r\n                        matchingLetter\r\n                    }\r\n                    accountingEntryInvoice {\r\n                        id                        \r\n                        externalInvoiceNumber                  \r\n                        amount\r\n                        accountingEntryTaxes {\r\n                            regimeType\r\n                            taxAmount\r\n                            taxBase\r\n                            taxPercentage\r\n                            taxGroupId\r\n                            taxTreatmentId\r\n                            id\r\n                        }\r\n                    }\r\n                }\r\n            }\r\n        }\r\n    }     \r\n}",
                        "variables": "{\r\n  \"id\":\"{{currentId}}\"\r\n}"
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                }
              ]
            },
            {
              "name": "Balances",
              "item": [
                {
                  "name": "⚙️ Trial Balance",
                  "item": [
                    {
                      "name": "1- Q.accountingExercises - most recently opened, startDate filled in {{dateInFirstExercice}}",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "pm.test(\"Variables creation\", function () {\r",
                              "    let jsd = pm.response.json();\r",
                              "    if (jsd.data == null || jsd.data.accountingExercises.edges.length == 0) {\r",
                              "        console.error(\"Unable to save environment variables\");\r",
                              "        return;\r",
                              "    }\r",
                              "    pm.environment.set(\"startDate\", jsd.data.accountingExercises.edges[0].node.startDate);\r",
                              "    pm.environment.set(\"endDate\", jsd.data.accountingExercises.edges[0].node.endDate);\r",
                              "    pm.environment.set(\"exerciseId\", jsd.data.accountingExercises.edges[0].node.id);   // Setting the id environment variable\r",
                              "    console.log(\"'startDate', 'endDate', and 'exerciseId' environment variables have been created: \" \r",
                              "    + pm.environment.get(\"startDate\") + \"-\" + pm.environment.get(\"endDate\") + \", exerciseId: \" + pm.environment.get(\"exerciseId\"));\r",
                              "\r",
                              "});\r",
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "query {\r\n    accountingExercises(\r\n        where: {status: {eq: OPEN}}\r\n        last:1\r\n        ) {\r\n        edges {\r\n            node {\r\n                id\r\n                startDate\r\n                endDate\r\n            }\r\n        }\r\n    }     \r\n}",
                            "variables": ""
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "2- ⚙️ Q.accountingTrialBalance",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "query($input: AccountingTrialBalanceGLDtoInput!) {\r\n  accountingTrialBalance(input: $input) {\r\n    accountCode\r\n    accountDescription\r\n    accountType\r\n    accumulatedBalance\r\n    accumulatedCreditAmount\r\n    accumulatedCreditBalance\r\n    accumulatedDebitAmount\r\n    accumulatedDebitBalance\r\n    balance\r\n    creditAmount\r\n    creditBalance\r\n    debitAmount\r\n    debitBalance\r\n  }\r\n}",
                            "variables": "{\r\n  \"input\": {\r\n    \"startAccountCode\": \"1000\",\r\n    \"endAccountCode\": \"4999\",\r\n    \"exerciseId\": \"{{exerciseId}}\",\r\n    \"startDate\": \"{{startDate}}\",\r\n    \"endDate\": \"{{endDate}}\",\r\n    \"isWithoutZeroBalance\": true,\r\n    \"isTrialBalanceComparative\": true,\r\n    \"showTemporaryCarryForward\": true,\r\n    \"showClosingEntries\": false\r\n    }\r\n}"
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    }
                  ]
                },
                {
                  "name": "⚙️ Third Party Balance",
                  "item": [
                    {
                      "name": "1- Q.accountingExercises - most recently opened, startDate filled in {{dateInFirstExercice}}",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "pm.test(\"Variables creation\", function () {\r",
                              "    let jsd = pm.response.json();\r",
                              "    if (jsd.data == null || jsd.data.accountingExercises.edges.length == 0) {\r",
                              "        console.error(\"Unable to save environment variables\");\r",
                              "        return;\r",
                              "    }\r",
                              "    pm.environment.set(\"startDate\", jsd.data.accountingExercises.edges[0].node.startDate);\r",
                              "    pm.environment.set(\"endDate\", jsd.data.accountingExercises.edges[0].node.endDate);\r",
                              "    pm.environment.set(\"exerciseId\", jsd.data.accountingExercises.edges[0].node.id);   // Setting the id environment variable\r",
                              "    console.log(\"'startDate', 'endDate', and 'exerciseId' environment variables have been created: \" \r",
                              "    + pm.environment.get(\"startDate\") + \"-\" + pm.environment.get(\"endDate\") + \", exerciseId: \" + pm.environment.get(\"exerciseId\"));\r",
                              "\r",
                              "});\r",
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "query {\r\n    accountingExercises(\r\n        where: {status: {eq: OPEN}}\r\n        last:1\r\n        ) {\r\n        edges {\r\n            node {\r\n                id\r\n                startDate\r\n                endDate\r\n            }\r\n        }\r\n    }     \r\n}",
                            "variables": ""
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "2- ⚙️ Q.accountingThirdPartyBalance",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "query($input: AccountingThirdPartyBalanceGLDtoInput!) {\r\n  accountingThirdPartyBalance(input: $input) {\r\n    thirdPartyDescription\r\n    thirdPartyId\r\n    accumulatedBalance\r\n    accumulatedCreditAmount\r\n    accumulatedCreditBalance\r\n    accumulatedDebitAmount\r\n    accumulatedDebitBalance\r\n    balance\r\n    creditAmount\r\n    creditBalance\r\n    debitAmount\r\n    debitBalance\r\n  }\r\n}",
                            "variables": "{\r\n  \"input\":{\r\n    \"thirdPartyCodeFrom\": \"\",\r\n    \"thirdPartyCodeTo\": \"ZZZZ\",\r\n    \"thirdPartyType\": \"CUSTOMER\",\r\n    \"exerciseId\": \"{{exerciseId}}\",\r\n    \"startDate\": \"{{startDate}}\",\r\n    \"endDate\": \"{{endDate}}\",\r\n    \"isWithoutZeroBalance\": true,\r\n    \"isBalanceComparative\": true,\r\n    \"showTemporaryCarryForward\": true\r\n}\r\n}"
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    }
                  ]
                },
                {
                  "name": "🆕⚙️ Balance Sheet",
                  "item": [
                    {
                      "name": "1- Q.accountingExercises - most recently opened, startDate filled in {{dateInFirstExercice}}",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "pm.test(\"Variables creation\", function () {\r",
                              "    let jsd = pm.response.json();\r",
                              "    if (jsd.data == null || jsd.data.accountingExercises.edges.length == 0) {\r",
                              "        console.error(\"Unable to save environment variables\");\r",
                              "        return;\r",
                              "    }\r",
                              "    pm.environment.set(\"startDate\", jsd.data.accountingExercises.edges[0].node.startDate);\r",
                              "    pm.environment.set(\"endDate\", jsd.data.accountingExercises.edges[0].node.endDate);\r",
                              "  \r",
                              "    console.log(\"'startDate', 'endDate' environment variables have been created: \" \r",
                              "    + pm.environment.get(\"startDate\") + \"-\" + pm.environment.get(\"endDate\"));\r",
                              "\r",
                              "});\r",
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "query {\r\n    accountingExercises(\r\n        where: {status: {eq: OPEN}}\r\n        last:1\r\n        ) {\r\n        edges {\r\n            node {\r\n                startDate\r\n                endDate\r\n            }\r\n        }\r\n    }     \r\n}",
                            "variables": ""
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "2-⚙️ Q.accountingBalanceSheet",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "query ($input: AccountingBalanceSheetGLDtoInput!) {\r\n  accountingBalanceSheet(input: $input) {\r\n    code\r\n    description\r\n    lineType\r\n    order\r\n    multiColumn\r\n    amountColumn1\r\n    amountColumn2\r\n    amountTotal\r\n  }\r\n}\r\n",
                            "variables": "{\r\n  \"input\": {\r\n    \"startDate\": \"{{startDate}}\",\r\n    \"endDate\": \"{{endDate}}\",\r\n    \"onlyLinesWithAmount\": false,\r\n    \"showTemporaryCarryForward\": false\r\n    }\r\n}"
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    }
                  ]
                },
                {
                  "name": "🆕⚙️ Profit And Loss",
                  "item": [
                    {
                      "name": "1- Q.accountingExercises - most recently opened, startDate filled in {{dateInFirstExercice}}",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "pm.test(\"Variables creation\", function () {\r",
                              "    let jsd = pm.response.json();\r",
                              "    if (jsd.data == null || jsd.data.accountingExercises.edges.length == 0) {\r",
                              "        console.error(\"Unable to save environment variables\");\r",
                              "        return;\r",
                              "    }\r",
                              "    pm.environment.set(\"startDate\", jsd.data.accountingExercises.edges[0].node.startDate);\r",
                              "    pm.environment.set(\"endDate\", jsd.data.accountingExercises.edges[0].node.endDate);\r",
                              "  \r",
                              "    console.log(\"'startDate', 'endDate' environment variables have been created: \" \r",
                              "    + pm.environment.get(\"startDate\") + \"-\" + pm.environment.get(\"endDate\"));\r",
                              "\r",
                              "});\r",
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "query {\r\n    accountingExercises(\r\n        where: {status: {eq: OPEN}}\r\n        last:1\r\n        ) {\r\n        edges {\r\n            node {\r\n                id\r\n                startDate\r\n                endDate\r\n            }\r\n        }\r\n    }     \r\n}",
                            "variables": ""
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "2-⚙️ Q.accountingProfitAndLoss",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "query ($input: AccountingProfitAndLossGLDtoInput!) {\r\n  accountingProfitAndLoss(input: $input) {\r\n    code\r\n    description\r\n    lineType\r\n    order\r\n    multiColumn\r\n    amountColumn1\r\n    amountColumn2\r\n    amountTotal\r\n  }\r\n}\r\n",
                            "variables": "{\r\n  \"input\": {\r\n    \"startDate\": \"{{startDate}}\",\r\n    \"endDate\": \"{{endDate}}\",\r\n    \"onlyLinesWithAmount\": false\r\n    }\r\n}"
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    }
                  ]
                }
              ]
            },
            {
              "name": "Accounting Settings",
              "item": [
                {
                  "name": "✏️Q.organizationAccountingSetupByOrgId {{X-OrganizationId}}",
                  "request": {
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "query ($id: ID!) {\r\n    organizationAccountingSetupByOrgId(id: $id) {\r\n        defaultCustomersAccountId\r\n        defaultSuppliersAccountId\r\n        subAccountingLength\r\n        taxRegime\r\n        annualAccountsModel\r\n        defaultBankAccountId\r\n        defaultBankJournalTypeId\r\n        defaultCashAccountId\r\n        defaultCashJournalTypeId\r\n        defaultInputVATAccountId\r\n        defaultOutputVATAccountId\r\n        defaultSaleProductsAccountId\r\n        defaultProfitAccountCFId\r\n        defaultLossAccountCFId\r\n        defaultOpeningAccountCFId\r\n        defaultOpeningJournalCFId\r\n        defaultResultAccountCFId\r\n        defaultCreditorsAccountCFId\r\n        defaultDebtorsAccountCFId\r\n        intracommunityAccountId\r\n        foreignAccountId\r\n        openItemsAutomaticAllocation\r\n        defaultPrepaymentCustomerAccountId\r\n        defaultPayrollJournalTypeId\r\n        defaultBankingAdjustmentsId \r\n        defaultBankingTransactionsId \r\n        defaultPayrollSessionId\r\n        defaultFixedAssetJournalTypeId\r\n    }\r\n}",
                        "variables": "{\r\n    \"id\":\"{{X-OrganizationId}}\"\r\n}"
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                },
                {
                  "name": "Q.Accounting Entry Sessions (DE Legislation only)",
                  "event": [
                    {
                      "listen": "prerequest",
                      "script": {
                        "exec": [
                          "//LEGISLATIONS:DE"
                        ],
                        "type": "text/javascript",
                        "packages": {},
                        "requests": {}
                      }
                    }
                  ],
                  "request": {
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "query {\r\n    accountingEntrySessions {\r\n        edges {\r\n            node {\r\n                id\r\n                name\r\n                isDefault\r\n                stamp\r\n            }\r\n        }\r\n        totalCount\r\n        pageInfo {\r\n            hasNextPage\r\n        }\r\n    }     \r\n}",
                        "variables": ""
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                },
                {
                  "name": "Q.Dimensions settings",
                  "request": {
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "query {\r\n  dimensions {\r\n    edges {\r\n      node {\r\n        id\r\n        code\r\n        name\r\n        description\r\n        isActive\r\n        creationDate\r\n        modificationDate\r\n        dimensionTags {\r\n          id\r\n          tagCode\r\n          name\r\n          isActive\r\n        }\r\n      }\r\n    }\r\n  }\r\n}\r\n",
                        "variables": ""
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                },
                {
                  "name": "🆕Q.Transaction Categories (purchase & expenses)",
                  "request": {
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "query {\r\n  transactionCategories(\r\n    where: {\r\n      type: { eq: PURCHASE }\r\n    }\r\n  ) {\r\n    edges {\r\n      node {\r\n        id\r\n        reason\r\n        accountingAccountId\r\n        accountingAccount {code name}\r\n        taxTreatmentId\r\n        taxTreatment {taxCode}\r\n        type\r\n        createdByDefault\r\n        disabled\r\n        default\r\n      }\r\n    }\r\n  }\r\n}",
                        "variables": ""
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                },
                {
                  "name": "🆕Q.Transaction Categories (bank transactions)",
                  "request": {
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "query {\r\n  transactionCategories(\r\n    where: {\r\n      type: { eq: NON_INVOICE }\r\n    }\r\n  ) {\r\n    edges {\r\n      node {\r\n        id\r\n        reason\r\n        accountingAccountId\r\n        accountingAccount {code name}\r\n        taxTreatmentId\r\n        taxTreatment {taxCode}\r\n        type\r\n        createdByDefault\r\n        disabled\r\n        default\r\n      }\r\n    }\r\n  }\r\n}",
                        "variables": ""
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                },
                {
                  "name": "🆕Q.Transaction Categories (ajustements)",
                  "request": {
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "query {\r\n  transactionCategories(\r\n    where: {\r\n      type: { eq: ADJUSTMENTS }\r\n    }\r\n  ) {\r\n    edges {\r\n      node {\r\n        id\r\n        reason\r\n        accountingAccountId\r\n        accountingAccount {code name}\r\n        taxTreatmentId\r\n        taxTreatment {taxCode}\r\n        type\r\n        createdByDefault\r\n        disabled\r\n        default\r\n      }\r\n    }\r\n  }\r\n}",
                        "variables": ""
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                }
              ]
            },
            {
              "name": "🆕Q.Accounting kpi services",
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "exec": [
                      ""
                    ],
                    "type": "text/javascript",
                    "packages": {},
                    "requests": {}
                  }
                }
              ],
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "X-OrganizationId",
                    "value": "{{X-OrganizationId}}"
                  },
                  {
                    "key": "x-api-key",
                    "value": "{{subscriptionKey}}"
                  },
                  {
                    "key": "Host",
                    "value": "eurmigreuwkpiapi.ambitiousground-42782c17.westeurope.azurecontainerapps.io",
                    "type": "text"
                  }
                ],
                "body": {
                  "mode": "graphql",
                  "graphql": {
                    "query": "query ($kpis: [AccountingIndicatorType!]!) {\r\n  accountingKpis(input: { kpiTypes: $kpis }) {\r\n    type\r\n    value\r\n    currency\r\n  }\r\n}\r\n",
                    "variables": "\r\n{\"kpis\":[\"ASSETS\",\"EQUITY\",\"EXCEPTIONAL_RESULT\",\"FINANCIAL_RESULT\",\"NET_RESULT\",\"OTHER_EXPENSES\",\"PURCHASES\",\"RESULT\",\"STAFF_COST\",\"TAXES\",\"TRADE_MARGIN\",\"TREASURY_BALANCE\",\"TURNOVER\",\"WORKING_CAPITAL\"]}"
                  }
                },
                "url": {
                  "raw": "{{baseAddress}}/graphql",
                  "host": [
                    "{{baseAddress}}"
                  ],
                  "path": [
                    "graphql"
                  ]
                }
              },
              "response": []
            }
          ],
          "description": "This section is dedicated to the accounting resources managed within the context of an organization. Accounting is the backbone of financial management and compliance in an organization.  \nThe resources described under this chapter are critical for various accounting operations such as general ledger management, tax calculation, and accounting entries.EndFragment"
        },
        {
          "name": "🆕Banks",
          "item": [
            {
              "name": "Bank Movements",
              "item": [
                {
                  "name": "⚙️Q.bankAccounts - first connected bank id stored in {{connectedBankId}}",
                  "event": [
                    {
                      "listen": "test",
                      "script": {
                        "exec": [
                          "pm.test(\"Get first active bank account with transactions\", function () {\r",
                          "    let jsd = pm.response.json();\r",
                          "\r",
                          "    if (!jsd.data || !jsd.data.bankAccounts) {\r",
                          "        console.error(\"bankAccounts not found\");\r",
                          "        return;\r",
                          "    }\r",
                          "\r",
                          "    let account = jsd.data.bankAccounts.find(acc => \r",
                          "        acc.bankingHasTransactions === true && acc.disabled === false\r",
                          "    );\r",
                          "\r",
                          "    if (!account) {\r",
                          "        console.warn(\"No active bank account with transactions found\");\r",
                          "        return;\r",
                          "    }\r",
                          "\r",
                          "    pm.environment.set(\"connectedBankId\", account.id);\r",
                          "    console.log(\"connectedBankId saved:\", account.id);\r",
                          "});"
                        ],
                        "type": "text/javascript",
                        "packages": {},
                        "requests": {}
                      }
                    }
                  ],
                  "request": {
                    "auth": {
                      "type": "bearer",
                      "bearer": [
                        {
                          "key": "token",
                          "value": "{{accessToken}}",
                          "type": "string"
                        }
                      ]
                    },
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "query {\r\n    bankAccounts{\r\n        id\r\n        creationDate\r\n        modificationDate\r\n        disabled\r\n        referenceName  \r\n        type\r\n\r\n        iban\r\n        bic\r\n        bankName\r\n        bankingBankLogo\r\n\r\n        accountingAccountCode\r\n        accountingAccountTotalBalance\r\n    \r\n        subAccountId\r\n        journalTypeId\r\n\r\n        balanceAmount\r\n        bankingAvailableBalanceAmount\r\n        bankingLedgerBalanceAmount\r\n        bankingAvailableBalanceDate\r\n        bankingLedgerBalanceDate\r\n\r\n        bankingConnectionStatus\r\n        bankingPendingTransactions\r\n        bankingHasTransactions\r\n        bankingLastTransactionsReceived\r\n                    \r\n    }   \r\n}",
                        "variables": ""
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                },
                {
                  "name": "🆕Q.bank movements - filtered by {{connectedBankId}}",
                  "event": [
                    {
                      "listen": "test",
                      "script": {
                        "exec": [
                          ""
                        ],
                        "type": "text/javascript",
                        "packages": {},
                        "requests": {}
                      }
                    }
                  ],
                  "request": {
                    "auth": {
                      "type": "bearer",
                      "bearer": [
                        {
                          "key": "token",
                          "value": "{{accessToken}}",
                          "type": "string"
                        }
                      ]
                    },
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "query ($bankAccountId: UUID!) {\r\n  bankMovements(\r\n    first: 20\r\n    where: { bankAccountId: { eq: $bankAccountId }}\r\n  ) {\r\n    edges {\r\n      node {\r\n        bankAccountId\r\n        id\r\n        linkStatus\r\n        linkStatusDate\r\n        dateFundsAvailable\r\n        datePosted\r\n        narrative1\r\n        referenceNumber\r\n        transactionAmount\r\n        transactionNarrative\r\n        transactionStatus\r\n        transactionType\r\n        linkedAccountingEntries {\r\n          accountingEntryId\r\n          bankJournalTypeId\r\n          date\r\n          description\r\n          documentNumber\r\n          id\r\n          isClosed\r\n          number\r\n          status\r\n        }\r\n        proposalItems {\r\n          bankAccountingEntryId\r\n          bankBillOfExchangeId\r\n          bankingRuleId\r\n          id\r\n          itemAmount\r\n          ponderationScore\r\n        }\r\n        reconciledItems {\r\n          bankAccountingEntryId\r\n          bankBillOfExchangeId\r\n          bankingRuleId\r\n          bankingRuleRejected\r\n          id\r\n          linked\r\n          originProposalItemId\r\n          reconciledBy\r\n          suggestedBy\r\n        }\r\n      }\r\n    }\r\n  }\r\n}\r\n",
                        "variables": "{\r\n    \"bankAccountId\":\"{{connectedBankId}}\"\r\n}"
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                },
                {
                  "name": "🆕Q.Banking Rules",
                  "event": [
                    {
                      "listen": "test",
                      "script": {
                        "exec": [
                          ""
                        ],
                        "type": "text/javascript",
                        "packages": {},
                        "requests": {}
                      }
                    }
                  ],
                  "request": {
                    "auth": {
                      "type": "bearer",
                      "bearer": [
                        {
                          "key": "token",
                          "value": "{{accessToken}}",
                          "type": "string"
                        }
                      ]
                    },
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "query {\r\n  bankingRules(first: 1) {\r\n    edges {\r\n      node {\r\n        id\r\n        accountingAccountId\r\n        bankAccountId\r\n        thirdPartyId\r\n        categoryId\r\n        action\r\n        kind\r\n        name\r\n        status\r\n        defaultProposalRule\r\n        ponderationScore\r\n        ruleApplied\r\n        sourceType\r\n        suggestionsProvided\r\n        createdByDefault\r\n        disabled\r\n        disabledDate\r\n        description\r\n        rationale\r\n        createdBy\r\n        updatedBy\r\n      }\r\n    }\r\n  }\r\n}\r\n",
                        "variables": ""
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                }
              ]
            },
            {
              "name": "Bank Reconciliation",
              "item": [
                {
                  "name": "1-Q.bankAccounts - first connected bank id stored in {{connectedBankId}} & {{paymentMethoId}}",
                  "event": [
                    {
                      "listen": "test",
                      "script": {
                        "exec": [
                          "pm.test(\"Get first active bank account with transactions\", function () {\r",
                          "    let jsd = pm.response.json();\r",
                          "\r",
                          "    if (!jsd.data || !jsd.data.bankAccounts) {\r",
                          "        console.error(\"bankAccounts not found\");\r",
                          "        return;\r",
                          "    }\r",
                          "\r",
                          "    let account = jsd.data.bankAccounts.find(acc => \r",
                          "        acc.bankingHasTransactions === true && acc.disabled === false\r",
                          "    );\r",
                          "\r",
                          "    if (!account) {\r",
                          "        console.warn(\"No active bank account with transactions found\");\r",
                          "        return;\r",
                          "    }\r",
                          "\r",
                          "    pm.environment.set(\"connectedBankId\", account.id);\r",
                          "    pm.environment.set(\"paymentMethodId\", account.paymentMethodId);\r",
                          "\r",
                          "    console.log(\"connectedBankId saved:\", account.id);\r",
                          "    console.log(\"paymentMethodId saved:\", account.paymentMethodId);\r",
                          "});"
                        ],
                        "type": "text/javascript",
                        "packages": {},
                        "requests": {}
                      }
                    }
                  ],
                  "request": {
                    "auth": {
                      "type": "bearer",
                      "bearer": [
                        {
                          "key": "token",
                          "value": "{{accessToken}}",
                          "type": "string"
                        }
                      ]
                    },
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "query {\r\n    bankAccounts{\r\n        id\r\n        paymentMethodId\r\n        disabled\r\n        referenceName  \r\n        bankName\r\n        bankingHasTransactions\r\n    }   \r\n}",
                        "variables": ""
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                },
                {
                  "name": "2-Q.bank movements - first item filtered by {{connectedBankId}}",
                  "event": [
                    {
                      "listen": "test",
                      "script": {
                        "exec": [
                          "pm.test(\"Variables creation\", function () {\r",
                          "    let jsd = pm.response.json();\r",
                          "\r",
                          "    if (jsd.data == null || jsd.data.bankMovements.edges.length == 0) {\r",
                          "        console.error(\"Unable to save environment variables\");\r",
                          "        return;\r",
                          "    }\r",
                          "\r",
                          "    let node = jsd.data.bankMovements.edges[0].node;\r",
                          "\r",
                          "    pm.environment.set(\"bankMovementId\", node.id);\r",
                          "    pm.environment.set(\"transactionAmount\", node.transactionAmount);\r",
                          "\r",
                          "    console.log(\"'bankMovementId' set to: \" + pm.environment.get(\"bankMovementId\"));\r",
                          "    console.log(\"'transactionAmount' set to: \" + pm.environment.get(\"transactionAmount\"));\r",
                          "});"
                        ],
                        "type": "text/javascript",
                        "packages": {},
                        "requests": {}
                      }
                    }
                  ],
                  "request": {
                    "auth": {
                      "type": "bearer",
                      "bearer": [
                        {
                          "key": "token",
                          "value": "{{accessToken}}",
                          "type": "string"
                        }
                      ]
                    },
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "query ($bankAccountId: UUID!) {\r\n  bankMovements(\r\n    first: 1\r\n    where: { bankAccountId: { eq: $bankAccountId }}\r\n  ) {\r\n    edges {\r\n      node {\r\n        bankAccountId\r\n        id\r\n        linkStatus\r\n        datePosted\r\n        narrative1\r\n        referenceNumber\r\n        transactionAmount\r\n        transactionType\r\n      }\r\n    }\r\n  }\r\n}\r\n",
                        "variables": "{\r\n    \"bankAccountId\":\"{{connectedBankId}}\"\r\n}"
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                },
                {
                  "name": "3-Q.accountingExercises - most recently opened, startDate filled in {{dateInFirstExercice}}",
                  "event": [
                    {
                      "listen": "test",
                      "script": {
                        "exec": [
                          "pm.test(\"Variables creation\", function () {\r",
                          "    let jsd = pm.response.json();\r",
                          "    console.log(jsd.data.accountingExercises.edges[0].node.id);\r",
                          "    if (jsd.data == null || jsd.data.accountingExercises.edges.length == 0)\r",
                          "        {console.error(\"Unable to save environment variable\");return;}\r",
                          "    pm.environment.set(\"dateInFirstExercice\",jsd.data.accountingExercises.edges[0].node.startDate);\r",
                          "    console.log(\"'dateInFirstExercice' environment variable has been created : \" + pm.environment.get(\"dateInFirstExercice\"));\r",
                          "});\r",
                          "\r",
                          ""
                        ],
                        "type": "text/javascript",
                        "packages": {}
                      }
                    }
                  ],
                  "request": {
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "query {\r\n    accountingExercises(\r\n        where: {status: {eq: OPEN}}\r\n        first:1\r\n        order:{startDate:DESC}\r\n        ) {\r\n        edges {\r\n            node {\r\n               startDate\r\n            }\r\n        }\r\n    }     \r\n}",
                        "variables": ""
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                },
                {
                  "name": "4-Q.customers - first activated & foreign legislation (for VAT=0)",
                  "event": [
                    {
                      "listen": "test",
                      "script": {
                        "exec": [
                          "pm.test(\"Variables creation\", function () {\r",
                          "    let jsd = pm.response.json();\r",
                          "\r",
                          "    if (jsd.data == null || jsd.data.customers.edges.length == 0)\r",
                          "        {console.error(\"Unable to save environment variable for customer\");return;}\r",
                          "    pm.environment.set(\"customerId\", jsd.data.customers.edges[0].node.id);\r",
                          "    console.log(\"customerId environment variable has been created : \" + pm.environment.get(\"customerId\"));\r",
                          "});"
                        ],
                        "type": "text/javascript",
                        "packages": {},
                        "requests": {}
                      }
                    },
                    {
                      "listen": "prerequest",
                      "script": {
                        "exec": [
                          ""
                        ],
                        "type": "text/javascript",
                        "packages": {},
                        "requests": {}
                      }
                    }
                  ],
                  "request": {
                    "auth": {
                      "type": "bearer",
                      "bearer": [
                        {
                          "key": "token",
                          "value": "{{accessToken}}",
                          "type": "string"
                        }
                      ]
                    },
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "query ($countryAcronym : String!) {\r\n    customers (\r\n        order: [{ code: ASC }]\r\n        where: {\r\n            countryAcronym: {neq:$countryAcronym}\r\n            disabled: {eq: false}\r\n            socialName: {neq:\"Postman demo\"}\r\n            }\r\n        first:1\r\n        ) {\r\n        edges {\r\n            node {\r\n                  id\r\n                  code\r\n                  socialName\r\n            }\r\n        }\r\n    }   \r\n}",
                        "variables": "{\r\n  \"countryAcronym\":\"{{legislationCode}}\"\r\n}"
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                },
                {
                  "name": "5-Q.Products - get 1 products",
                  "event": [
                    {
                      "listen": "test",
                      "script": {
                        "exec": [
                          "pm.test(\"Create environment variables for all products\", function () {\r",
                          "    let jsd = pm.response.json();\r",
                          "\r",
                          "    if (!jsd.data || !jsd.data.products || !jsd.data.products.edges || jsd.data.products.edges.length === 0) {\r",
                          "        console.error(\"Invalid response structure or no products found\");\r",
                          "        return;\r",
                          "    }\r",
                          "\r",
                          "    jsd.data.products.edges.forEach((edge, index) => {\r",
                          "        let varName = `productId_${index + 1}`;\r",
                          "        pm.environment.set(varName, edge.node.id);\r",
                          "        console.log(`${varName} = ${edge.node.id}`);\r",
                          "    });\r",
                          "\r",
                          "    console.log(\"✅ Environment variables for all products have been created\");\r",
                          "});\r",
                          ""
                        ],
                        "type": "text/javascript",
                        "packages": {},
                        "requests": {}
                      }
                    },
                    {
                      "listen": "prerequest",
                      "script": {
                        "exec": [
                          ""
                        ],
                        "type": "text/javascript",
                        "packages": {},
                        "requests": {}
                      }
                    }
                  ],
                  "request": {
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "query {\r\n  products (\r\n       order: [{ code: ASC }]\r\n       where: {category:{neq:CONCEPT}}\r\n       first:1\r\n  ) {\r\n    edges {\r\n      node {\r\n        id\r\n        code\r\n        name\r\n      }\r\n    }\r\n  }     \r\n}",
                        "variables": ""
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                },
                {
                  "name": "6-M.SalesInvoice Create an invoice",
                  "event": [
                    {
                      "listen": "test",
                      "script": {
                        "exec": [
                          "pm.test(\"Variable creation\", function () {\r",
                          "    let jsd = pm.response.json();\r",
                          "\r",
                          "    if (jsd.data == null)\r",
                          "        {console.error(\"Unable to save environment variable\");return;}\r",
                          "\r",
                          "    let result = jsd.data.createSalesInvoice;\r",
                          "    pm.environment.set(\"currentId\", result.id);\r",
                          "    console.log(\"'currentId' environment variable has been created : \" + pm.environment.get(\"currentId\"));\r",
                          "});\r",
                          "\r",
                          ""
                        ],
                        "type": "text/javascript",
                        "packages": {},
                        "requests": {}
                      }
                    }
                  ],
                  "request": {
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "mutation ($values: SalesInvoiceCreateGLDtoInput!) {  \r\n    createSalesInvoice(input: $values) {\r\n    id\r\n  }\r\n}",
                        "variables": "{\r\n  \"values\": {\r\n    \"customerId\": \"{{customerId}}\",\r\n    \"documentDate\": \"{{dateInFirstExercice}}\",\r\n    \"discount\":0,\r\n    \"lines\": [\r\n      {\r\n        \"productId\": \"{{productId_1}}\",\r\n        \"totalQuantity\": 1,\r\n        \"unitPrice\": {{transactionAmount}}\r\n      }\r\n    ]\r\n  }\r\n}"
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                },
                {
                  "name": "7-M.Close the invoice",
                  "event": [
                    {
                      "listen": "test",
                      "script": {
                        "exec": [
                          ""
                        ],
                        "type": "text/javascript",
                        "packages": {}
                      }
                    }
                  ],
                  "request": {
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "mutation($input: CloseSalesInvoiceGLDtoInput!) {\r\n  closeSalesInvoice(input: $input) {\r\n    id\r\n    operationalNumber\r\n  }\r\n}",
                        "variables": "{\r\n  \"input\": {\r\n    \"salesInvoiceId\": \"{{currentId}}\"\r\n  }\r\n}"
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                },
                {
                  "name": "8-Q.journalTypes - first type SALES_INVOICE",
                  "event": [
                    {
                      "listen": "test",
                      "script": {
                        "exec": [
                          "pm.test(\"Variables creation\", function () {\r",
                          "    let jsd = pm.response.json();\r",
                          "\r",
                          "    if (jsd.data == null || jsd.data.journalTypes.edges.length == 0)\r",
                          "        {console.error(\"Unable to save environment variable\");return;}\r",
                          "    pm.environment.set(\"journalSalesId\", jsd.data.journalTypes.edges[0].node.id);\r",
                          "     console.log(\"'journalSalesId' environment variable has been created : \" + pm.environment.get(\"journalSalesId\"));\r",
                          "\r",
                          "});"
                        ],
                        "type": "text/javascript",
                        "packages": {}
                      }
                    }
                  ],
                  "request": {
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "query {\r\n     journalTypes(\r\n         where: {type: {eq: SALES_INVOICE}}\r\n         first:1) {\r\n        edges {\r\n            node {\r\n               id\r\n            }\r\n        }\r\n    }     \r\n}",
                        "variables": ""
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                },
                {
                  "name": "9-M.Post the Invoice",
                  "event": [
                    {
                      "listen": "test",
                      "script": {
                        "exec": [
                          ""
                        ],
                        "type": "text/javascript",
                        "packages": {}
                      }
                    }
                  ],
                  "request": {
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "mutation($input: PostSalesInvoiceGLDtoInput!) {\r\n  postSalesInvoice(input: $input) {\r\n    accountingEntryId\r\n    accountingEntryNumber\r\n    accountingEntries {\r\n        accountingEntryId\r\n        accountingEntryNumber\r\n    }\r\n  }\r\n}",
                        "variables": "{\r\n  \"input\": {\r\n    \"salesInvoiceId\": \"{{currentId}}\",\r\n    \"accountingEntryDescription\": \"Sales Invoice validation\",\r\n    \"journalTypeId\": \"{{journalSalesId}}\"\r\n  }\r\n}"
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                },
                {
                  "name": "10-Q.SalesInvoiceOpenItems - Retrieve the IDs of the invoice due dates",
                  "event": [
                    {
                      "listen": "test",
                      "script": {
                        "exec": [
                          "pm.test(\"Variables creation\", function () {\r",
                          "    let jsd = pm.response.json();\r",
                          "\r",
                          "    if (jsd.data == null || jsd.data.salesInvoiceOpenItems.edges.length == 0) {\r",
                          "        console.error(\"Unable to save environment variable\");\r",
                          "        return;\r",
                          "    }\r",
                          "\r",
                          "    // Get the first node's data\r",
                          "    let firstNode = jsd.data.salesInvoiceOpenItems.edges[0].node;\r",
                          "\r",
                          "    // Retrieve the openItemId, documentNumber, and thirdPartyId\r",
                          "    let openItemId = firstNode.id;\r",
                          "    let documentNumber = firstNode.salesInvoice.operationalNumber;\r",
                          "    let thirdPartyId = firstNode.salesInvoice.customer.id;\r",
                          "    let firstDueDate= firstNode.dueDate;\r",
                          "\r",
                          "    // Save these values in environment variables\r",
                          "    pm.environment.set(\"openItemId\", openItemId);\r",
                          "    pm.environment.set(\"documentNumber\", documentNumber);\r",
                          "    pm.environment.set(\"thirdPartyId\", thirdPartyId);\r",
                          "    pm.environment.set(\"firstDueDate\", firstDueDate);\r",
                          "\r",
                          "    // Log the creation of these variables\r",
                          "    console.log(\"'openItemId' environment variable has been created: \" + pm.environment.get(\"openItemId\"));\r",
                          "    console.log(\"'documentNumber' environment variable has been created: \" + pm.environment.get(\"documentNumber\"));\r",
                          "    console.log(\"'thirdPartyId' environment variable has been created: \" + pm.environment.get(\"thirdPartyId\"));\r",
                          "     console.log(\"'firstDueDate' environment variable has been created: \" + pm.environment.get(\"firstDueDate\"));\r",
                          "});\r",
                          ""
                        ],
                        "type": "text/javascript",
                        "packages": {},
                        "requests": {}
                      }
                    },
                    {
                      "listen": "prerequest",
                      "script": {
                        "exec": [
                          ""
                        ],
                        "type": "text/javascript",
                        "packages": {},
                        "requests": {}
                      }
                    }
                  ],
                  "request": {
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "query($Id: UUID!) {\r\n  salesInvoiceOpenItems(\r\n    order: {dueDate:ASC}\r\n    where : {salesInvoice:{ id : { eq : $Id }}}\r\n  ) {\r\n    edges {\r\n      node {\r\n        salesInvoice {\r\n          firstDueDate\r\n          documentDate\r\n          operationalNumber\r\n          status\r\n          totalLiquid\r\n          customer {\r\n            id\r\n            code\r\n            socialName\r\n          }\r\n        }\r\n        id\r\n        status\r\n        amount\r\n        dueDate\r\n        paidAmountAccumulated\r\n        paymentMean {\r\n          description\r\n        }\r\n      }\r\n    }\r\n  }\r\n}\r\n",
                        "variables": "{\r\n  \"Id\": \"{{currentId}}\"\r\n}"
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                },
                {
                  "name": "11-M.SalesOpenItemSettlement  - pay the first due date.",
                  "event": [
                    {
                      "listen": "test",
                      "script": {
                        "exec": [
                          "pm.test(\"Save accountingEntryId\", function () {\r",
                          "    let jsd = pm.response.json();\r",
                          "\r",
                          "    if (!jsd.data || !jsd.data.salesOpenItemSettlement) {\r",
                          "        console.error(\"salesOpenItemSettlement not found\");\r",
                          "        return;\r",
                          "    }\r",
                          "\r",
                          "    let accountingEntryId = jsd.data.salesOpenItemSettlement.accountingEntryId;\r",
                          "\r",
                          "    pm.environment.set(\"accountingEntryId\", accountingEntryId);\r",
                          "\r",
                          "    console.log(\"accountingEntryId saved:\", accountingEntryId);\r",
                          "});"
                        ],
                        "type": "text/javascript",
                        "packages": {},
                        "requests": {}
                      }
                    }
                  ],
                  "request": {
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "mutation($input: SalesOpenItemSettlementGLDtoInput!) {\r\n  salesOpenItemSettlement(input: $input) {\r\n    accountingEntryId\r\n    accountingEntryNumber\r\n  }\r\n}",
                        "variables": "{\r\n  \"input\": {\r\n    \"entryDate\": \"{{firstDueDate}}\",\r\n    \"paymentMethodId\": \"{{paymentMethodId}}\",\r\n    \"description\": \"Settlement\",\r\n    \"documentNumber\": \"{{documentNumber}}\",\r\n    \"thirdPartyId\": \"{{thirdPartyId}}\",\r\n    \"salesOpenItemLinkagePaidAmounts\": [\r\n        {\r\n            \"openItemId\": \"{{openItemId}}\",\r\n            \"paidAmount\": {{transactionAmount}}\r\n        }\r\n    ]\r\n  }\r\n}"
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                },
                {
                  "name": "12-Reconcile Bank Movement with the bank entry payment",
                  "event": [
                    {
                      "listen": "test",
                      "script": {
                        "exec": [
                          "pm.test(\"Save reconcileId\", function () {\r",
                          "    let jsd = pm.response.json();\r",
                          "\r",
                          "    if (!jsd.data || !jsd.data.reconcileBankMovement) {\r",
                          "        console.error(\"reconcileBankMovement not found\");\r",
                          "        return;\r",
                          "    }\r",
                          "\r",
                          "    let reconcileId = jsd.data.reconcileBankMovement.id;\r",
                          "\r",
                          "    pm.environment.set(\"reconcileId\", reconcileId);\r",
                          "\r",
                          "    console.log(\"reconcileId saved:\", reconcileId);\r",
                          "});"
                        ],
                        "type": "text/javascript",
                        "packages": {},
                        "requests": {}
                      }
                    }
                  ],
                  "request": {
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "mutation (\r\n  $input: ReconcileBankMovementGLDtoInput!\r\n) {\r\n  reconcileBankMovement(input: $input) {\r\n    id\r\n  }\r\n}\r\n",
                        "variables": "{\r\n  \"input\": {\r\n    \"bankTransactionId\": \"{{bankMovementId}}\",\r\n    \"bankingRuleId\": null,\r\n    \"accountingEntries\": [\r\n      {\r\n        \"accountingEntryId\": \"{{accountingEntryId}}\"\r\n      }\r\n    ]\r\n  }\r\n}"
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                },
                {
                  "name": "13-UnReconcile Bank Movement",
                  "event": [
                    {
                      "listen": "test",
                      "script": {
                        "exec": [
                          ""
                        ],
                        "type": "text/javascript",
                        "packages": {},
                        "requests": {}
                      }
                    }
                  ],
                  "request": {
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "\r\nmutation (\r\n  $input: UnReconcileBankMovementGLDtoInput!\r\n) {\r\n  unReconcileBankMovement(input: $input) {\r\n    id\r\n  }\r\n}\r\n\r\n",
                        "variables": "{\r\n  \"input\": {\r\n    \"bankTransactionId\": \"{{reconcileId}}\"\r\n  }\r\n}\r\n\r\n"
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                }
              ]
            },
            {
              "name": "Payment methods",
              "item": [
                {
                  "name": "Q.paymentMethods - first id filled in {{currentId}}",
                  "event": [
                    {
                      "listen": "test",
                      "script": {
                        "exec": [
                          "pm.test(\"Variables creation\", function () {\r",
                          "    let jsd = pm.response.json();\r",
                          "\r",
                          "    if (jsd.data == null || jsd.data.paymentMethods.edges.length == 0)\r",
                          "        {console.error(\"Unable to save environment variable\");return;}\r",
                          "    pm.environment.set(\"currentId\", jsd.data.paymentMethods.edges[0].node.id);\r",
                          "    console.log(\"'currentId' environment variable has been created : \" + pm.environment.get(\"currentId\"));\r",
                          "});"
                        ],
                        "type": "text/javascript",
                        "packages": {}
                      }
                    }
                  ],
                  "request": {
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "query {\r\n    paymentMethods {\r\n        edges {\r\n            node {\r\n                id\r\n                creationDate\r\n                referenceName\r\n                type\r\n                journalType{\r\n                    code\r\n                }\r\n                subAccount{\r\n                    code\r\n                }\r\n                \r\n            }\r\n        }\r\n        totalCount\r\n        pageInfo {\r\n            hasNextPage\r\n        }\r\n    }     \r\n}",
                        "variables": ""
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                },
                {
                  "name": "Q.paymentMethods filtered by Id {{currentId}}",
                  "request": {
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "query  ($id : UUID!) {\r\n    paymentMethods\r\n     (where : { id : { eq : $id }}) {\r\n        edges {\r\n            node {\r\n                  id\r\n                creationDate\r\n                referenceName\r\n                type\r\n                journalType{\r\n                    code\r\n                }\r\n                subAccount{\r\n                    code\r\n                }\r\n            }\r\n        }\r\n    }     \r\n}",
                        "variables": "{\r\n  \"id\":\"{{currentId}}\"\r\n}"
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                }
              ]
            }
          ]
        },
        {
          "name": "Third parties (Contacts)",
          "item": [
            {
              "name": "Third Party Identification",
              "item": [
                {
                  "name": "Third Party simple filter",
                  "event": [
                    {
                      "listen": "test",
                      "script": {
                        "exec": [
                          ""
                        ],
                        "type": "text/javascript",
                        "packages": {},
                        "requests": {}
                      }
                    },
                    {
                      "listen": "prerequest",
                      "script": {
                        "exec": [
                          "//LEGISLATIONS:FR\r",
                          ""
                        ],
                        "type": "text/javascript",
                        "packages": {},
                        "requests": {}
                      }
                    }
                  ],
                  "request": {
                    "auth": {
                      "type": "bearer",
                      "bearer": [
                        {
                          "key": "token",
                          "value": "{{accessToken}}",
                          "type": "string"
                        }
                      ]
                    },
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "query($input: ThirdPartyIdentificationDtoInput!) {\r\n  thirdPartyIdentification(input: $input) {\r\n    businessName\r\n    siretSiren\r\n    address\r\n    city\r\n    zipCode\r\n    nafApeCode\r\n    vatNumber\r\n  }\r\n}\r\n",
                        "variables": "{\r\n  \"input\": {\r\n    \"name\":\"ALPHA\"\r\n  }\r\n}\r\n"
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                },
                {
                  "name": "Third Party advanced filter",
                  "event": [
                    {
                      "listen": "test",
                      "script": {
                        "exec": [
                          ""
                        ],
                        "type": "text/javascript",
                        "packages": {},
                        "requests": {}
                      }
                    },
                    {
                      "listen": "prerequest",
                      "script": {
                        "exec": [
                          "//LEGISLATIONS:FR\r",
                          ""
                        ],
                        "type": "text/javascript",
                        "packages": {},
                        "requests": {}
                      }
                    }
                  ],
                  "request": {
                    "auth": {
                      "type": "bearer",
                      "bearer": [
                        {
                          "key": "token",
                          "value": "{{accessToken}}",
                          "type": "string"
                        }
                      ]
                    },
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "query($input: ThirdPartyIdentificationDtoInput!) {\r\n  thirdPartyIdentification(input: $input) {\r\n    businessName\r\n    siretSiren\r\n    address\r\n    city\r\n    zipCode\r\n    nafApeCode\r\n    vatNumber\r\n  }\r\n}\r\n",
                        "variables": "{\r\n  \"input\": {\r\n    \"address\": \"rue Mérimee\",\r\n    \"city\": \"Paris\",\r\n    \"zipCode\": \"75016\",\r\n    \"nafCode\": \"81.10Z\",\r\n    \"searchLimit\": 10\r\n  }\r\n}\r\n\r\n\r\n           "
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                }
              ]
            },
            {
              "name": "Customers",
              "item": [
                {
                  "name": "M.create a customer, then update it, then delete it",
                  "item": [
                    {
                      "name": "1 - M.createCustomer with minimal information - {{currentId}} filled in",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "pm.test(\"Variables creation\", function () {\r",
                              "    let jsd = pm.response.json();\r",
                              "\r",
                              "    if (jsd.data == null)\r",
                              "        {console.error(\"Unable to save environment variable\");return;}\r",
                              "\r",
                              "    let result = jsd.data.createCustomer;\r",
                              "    pm.environment.set(\"currentId\", result.id);\r",
                              "    console.log(\"'currentId' environment variable has been created : \" + pm.environment.get(\"currentId\"));\r",
                              "});\r",
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        },
                        {
                          "listen": "prerequest",
                          "script": {
                            "exec": [
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "mutation ($values: CustomerCreateGLDtoInput!) {  \r\n  createCustomer (input: $values) {\r\n    id\r\n    code\r\n  }\r\n}\r\n",
                            "variables": "{\r\n  \"values\":{\r\n    \"socialName\": \"Postman Demo\",\r\n    \"tradeName\": \"PostDemo\",\r\n    \"addresses\": [{\r\n      \"firstLine\": \"123 Generic street\",\r\n      \"city\": \"Generic City\",\r\n      \"zipCode\": \"12345\",\r\n      \"countryIsoCodeAlpha2\":\"{{legislationCode}}\"\r\n    }]\r\n  }\r\n}"
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "2 - Q.customers filtered by Id",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "pm.test(\"Variables creation\", function () {\r",
                              "    let jsd = pm.response.json();\r",
                              "\r",
                              "    if (jsd.data == null || jsd.data.customers.edges.length === 0)\r",
                              "        {console.error(\"Unable to save environment variable\");return;}\r",
                              "    let cust = jsd.data.customers.edges[0].node;\r",
                              "    if (cust.addresses && cust.addresses.length > 0)\r",
                              "    {\r",
                              "      pm.environment.set(\"custAddressId\", cust.addresses[0].id);\r",
                              "      console.log(\"'custAddressId' environment variable has been created : \" + pm.environment.get(\"custAddressId\"));\r",
                              "    }\r",
                              "});\r",
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "query  ($id : UUID!) {\r\n    customers\r\n     (where : { id : { eq : $id }})  {\r\n        edges {\r\n            node {\r\n                    id   \r\n                socialName\r\n                tradeName\r\n                code\r\n                documentId\r\n                documentTypeId\r\n                countryAcronym\r\n                addresses {\r\n                    id\r\n                    firstLine\r\n                    secondLine\r\n                    city\r\n                    zipCode\r\n                    countryId\r\n                    countryName\r\n                    name\r\n                    isDeliveryAddress\r\n                    isDefaultDeliveryAddress\r\n                }\r\n                contacts{\r\n                isDefault\r\n                courtesy\r\n                name\r\n                surname\r\n                emails {\r\n                    emailAddress\r\n                    usage\r\n                }\r\n                phones {\r\n                    number\r\n                    type\r\n                }\r\n                socialMedias {\r\n                    link\r\n                    name\r\n                }\r\n                isDefault\r\n                }\r\n                paymentTermLines {\r\n                    id\r\n                    day\r\n                    condition\r\n                    type\r\n                    value\r\n                    payDays\r\n                    order\r\n                }\r\n                defaultAccountingAccountId              \r\n            }\r\n        }\r\n    }   \r\n}\r\n",
                            "variables": "{\r\n  \"id\":\"{{currentId}}\"\r\n}"
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "3 - M.deletecustomer {{currentId}}",
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "mutation ($values:CustomerDeleteGLDtoInput!) {\r\n    deleteCustomer(input: $values) {\r\n    id\r\n  }\r\n}",
                            "variables": "{\r\n  \"values\":{\r\n    \"id\":\"{{currentId}}\"\r\n  }\r\n}"
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "4 - M.createCustomer with more complete information- {{currentId}} filled in",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "pm.test(\"Variables creation\", function () {\r",
                              "    let jsd = pm.response.json();\r",
                              "\r",
                              "    if (jsd.data == null)\r",
                              "        {console.error(\"Unable to save environment variable\");return;}\r",
                              "\r",
                              "    let result = jsd.data.createCustomer;\r",
                              "    pm.environment.set(\"currentId\", result.id);\r",
                              "    console.log(\"'currentId' environment variable has been created : \" + pm.environment.get(\"currentId\"));\r",
                              "});\r",
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {}
                          }
                        },
                        {
                          "listen": "prerequest",
                          "script": {
                            "exec": [
                              "let legislationCode = pm.environment.get(\"legislationCode\");\r",
                              "\r",
                              "if (legislationCode === 'FR') {\r",
                              "    pm.environment.set(\"identificationNumber\", \"926137614\");\r",
                              "    pm.environment.set(\"vatNumber\",\"FR33926137614\");\r",
                              "    pm.environment.set(\"code\",\"CUSTDEMOCPLT\");\r",
                              "} else if (legislationCode === 'ES') {\r",
                              "    pm.environment.set(\"identificationNumber\", \"X7784493M\");\r",
                              "    pm.environment.set(\"vatNumber\",\"ESX7784493M\");\r",
                              "    pm.environment.set(\"code\",\"CUSTDEMOCPLT\");\r",
                              "} else if (legislationCode === 'DE') {\r",
                              "    pm.environment.set(\"identificationNumber\", \"90881100521\");\r",
                              "    pm.environment.set(\"vatNumber\",\"DE908811005\");\r",
                              "    pm.environment.set(\"code\",\"10200\");\r",
                              "} else {\r",
                              "    console.error(\"Unexpected legislationCode value\");\r",
                              "    return;\r",
                              "}\r",
                              "\r",
                              "console.log(\"'identificationNumber' & 'vatNumber' environment variables has been created with value: \" \r",
                              "    + pm.environment.get(\"identificationNumber\")+\" - \"+pm.environment.get(\"vatNumber\"));\r",
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "mutation ($values: CustomerCreateGLDtoInput!) {  \r\n  createCustomer (input: $values) {\r\n    id\r\n    code\r\n  }\r\n}\r\n",
                            "variables": "{\r\n  \"values\":{\r\n    \"code\": \"{{code}}\",\r\n    \"documentId\":\"{{identificationNumber}}\",\r\n    \"vatNumber\":\"{{vatNumber}}\",\r\n    \"socialName\": \"Customer Demo complete\",\r\n    \"tradeName\": \"CustDemo complete\",\r\n    \"addresses\": [{\r\n      \"firstLine\": \"123 Generic street\",\r\n      \"city\": \"Generic City\",\r\n      \"zipCode\": \"12345\",\r\n      \"countryIsoCodeAlpha2\":\"{{legislationCode}}\"\r\n    }],\r\n    \"contacts\":[{\r\n      \"isDefault\":true,\r\n      \"courtesy\":\"MR\",\r\n      \"name\":\"John\",\r\n      \"surname\":\"Smith\",\r\n      \"phones\":[{\r\n          \"isDefault\":true,\r\n          \"number\":\"01 02 03 04 05\",\r\n          \"type\":\"EMPTY\"\r\n      },\r\n      {\r\n          \"number\":\"06 07 08 09 10\",\r\n          \"type\":\"MOBILE\"\r\n      }],\r\n      \"emails\":[{\r\n          \"emailAddress\":\"smith@customerdemo.com\",\r\n          \"usage\":\"EMPTY\"\r\n      },\r\n      {\r\n          \"emailAddress\":\"info@customerdemo.com\",\r\n          \"usage\":\"PAYMENTS\",\r\n          \"isDefault\":true\r\n      }]\r\n    },\r\n    {\r\n      \"isDefault\":false,\r\n      \"name\":\"Infos\",\r\n      \"socialMedias\":[{\r\n          \"name\":\"site1\",\r\n          \"link\":\"www.customerdemo.com\"\r\n      }]\r\n    }],\r\n    \"paymentTermLines\":[{\r\n            \"type\":\"FIXED_AMOUNT\",\r\n            \"value\":500,\r\n            \"order\":1,\r\n            \"condition\":\"DAY_OF_PAYMENT\"\r\n        },\r\n        {\r\n            \"type\":\"PERCENTAGE\",\r\n            \"value\":30,\r\n            \"order\":2,\r\n            \"condition\":\"END_OF_MONTH\"\r\n        },\r\n        {\r\n            \"type\":\"REMAINING_AMOUNT\",\r\n            \"value\":0,\r\n            \"order\":9999,\r\n            \"condition\":\"END_OF_MONTH\",\r\n            \"day\":60\r\n        }\r\n    ]\r\n  }\r\n}\r\n"
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "5 - Q.customers filtered by Id",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "pm.test(\"Create environment variables for all IDs\", function () {\r",
                              "    const jsd = pm.response.json();\r",
                              "    if (!jsd?.data) return console.error(\"Invalid response structure, no data\");\r",
                              "\r",
                              "    // Find the first entity type that has edges with nodes\r",
                              "    const entityType = Object.keys(jsd.data).find(t => jsd.data[t]?.edges?.length > 0);\r",
                              "    if (!entityType) return console.error(\"No entity with edges found in response\");\r",
                              "\r",
                              "    const node = jsd.data[entityType].edges[0].node;\r",
                              "\r",
                              "    // Root entity ID\r",
                              "    pm.environment.set(\"currentId\", node.id);\r",
                              "    console.log(\"currentId:\", node.id);\r",
                              "\r",
                              "    // Aliases for plural → singular (or exceptions)\r",
                              "    const aliasMap = {\r",
                              "        addresses: \"addressId\",\r",
                              "        contacts: \"contactId\",\r",
                              "        emails: \"emailId\",\r",
                              "        phones: \"phoneId\",\r",
                              "        socialMedias: \"socialMediaId\",\r",
                              "        paymentTermLines: \"paymentTermLineId\",\r",
                              "        lines: \"lineId\"\r",
                              "    };\r",
                              "\r",
                              "    // Generic helper to create variables for collections\r",
                              "    const createVars = (collection, key, parentPrefix = \"\") => {\r",
                              "        if (!Array.isArray(collection)) return;\r",
                              "\r",
                              "        const prefix = aliasMap[key] || key.replace(/s$/, \"\") + \"Id\"; // fallback: naive singular\r",
                              "\r",
                              "        collection.forEach((item, i) => {\r",
                              "            const varName = `${parentPrefix}${prefix}_${i + 1}`;\r",
                              "            pm.environment.set(varName, item.id);\r",
                              "            console.log(`${varName}:`, item.id);\r",
                              "\r",
                              "            // Recursively handle nested collections if present\r",
                              "            Object.keys(item).forEach(subKey => {\r",
                              "                if (Array.isArray(item[subKey]) && item[subKey].length > 0) {\r",
                              "                   createVars(item[subKey], subKey, `${prefix}_${i + 1}_`);\r",
                              "                }\r",
                              "            });\r",
                              "        });\r",
                              "    };\r",
                              "\r",
                              "    // Explore all arrays at root level of the node\r",
                              "    Object.keys(node).forEach(key => {\r",
                              "        if (Array.isArray(node[key]) && node[key].length > 0) {\r",
                              "            createVars(node[key], key);\r",
                              "        }\r",
                              "    });\r",
                              "\r",
                              "    console.log(`✅ Environment variables created for ${entityType}`);\r",
                              "});\r",
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {}
                          }
                        },
                        {
                          "listen": "prerequest",
                          "script": {
                            "exec": [
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "query  ($id : UUID!) {\r\n    customers\r\n     (where : { id : { eq : $id }})  {\r\n        edges {\r\n            node {\r\n                id   \r\n                socialName\r\n                tradeName\r\n                code\r\n                documentId\r\n                documentTypeId\r\n                countryAcronym\r\n                customerType\r\n                addresses {\r\n                    id\r\n                    firstLine\r\n                    secondLine\r\n                    city\r\n                    zipCode\r\n                    countryId\r\n                    countryName\r\n                    name\r\n                    isDeliveryAddress\r\n                    isDefaultDeliveryAddress\r\n                }\r\n                contacts{\r\n                id\r\n                isDefault\r\n                courtesy\r\n                name\r\n                surname\r\n                emails {\r\n                    id\r\n                    emailAddress\r\n                    usage\r\n                }\r\n                phones {\r\n                    id\r\n                    number\r\n                    type\r\n                }\r\n                socialMedias {\r\n                    id\r\n                    link\r\n                    name\r\n                }\r\n                isDefault\r\n                }\r\n                paymentTermLines {\r\n                    id\r\n                    day\r\n                    condition\r\n                    type\r\n                    value\r\n                    payDays\r\n                    order\r\n                }\r\n                defaultAccountingAccountId              \r\n            }\r\n        }\r\n    }   \r\n}\r\n",
                            "variables": "{\r\n  \"id\":\"{{currentId}}\"\r\n}"
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "6 - M updateCustomer [requestedAction]",
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}",
                            "type": "default"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}",
                            "type": "default"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "mutation ($values: CustomerUpdateGLDtoInput!) {  \r\n  updateCustomer (input: $values) {\r\n    id\r\n  }\r\n}\r\n",
                            "variables": "{\n  \"values\": {\n    \"id\": \"{{currentId}}\",\n    \"socialName\": \"CUSTOMER REQACT\",\n    \"tradeName\": \"CUSTREQACT\",\n    \"addresses\": [\n      {\n        \"id\": \"{{addressId_1}}\",\n        \"firstLine\": \"123 Generic ReqAct street\",\n        \"countryIsoCodeAlpha2\": \"LU\"\n      }\n    ],\n    \"contacts\": [\n      {\n        \"id\": \"{{contactId_1}}\",\n        \"phones\": [\n          {\n            \"id\": \"{{contactId_1_phoneId_1}}\",\n            \"number\": \"01 23 45 67 89\"\n          }\n        ],\n        \"emails\": [\n          {\n            \"id\": \"{{contactId_1_emailId_1}}\",\n            \"requestedAction\": \"DELETE\"\n          }\n        ],\n        \"socialMedias\": [\n          {\n            \"link\": \"www.customerreqact.com\",\n            \"name\": \"sitePricincipal\"\n          }\n        ]\n      },\n      {\n        \"name\": \"New Contact reqact\",\n        \"isDefault\": false,\n        \"phones\": [\n          {\n            \"isDefault\": true,\n            \"number\": \"05 55 55 55 55\",\n            \"type\": \"LANDLINE\"\n          }\n        ]\n      }\n    ],\n    \"paymentTermLines\": [\n      {\n        \"id\": \"{{paymentTermLineId_3}}\",\n        \"day\": 30\n      }\n    ]\n  }\n}\n"
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "7 - 🆕M updateCustomer [replaceAll]",
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}",
                            "type": "default"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}",
                            "type": "default"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "mutation ($values: CustomerUpdateGLDtoInput!) {  \r\n  updateCustomer (input: $values) {\r\n    id\r\n  }\r\n}\r\n",
                            "variables": "{\n  \"values\": {\n    \"id\": \"{{currentId}}\",\n    \"socialName\": \"CUSTOMER REPALL\",\n    \"tradeName\": \"CUSTREPALL\",\n    \"replaceAll\": [\n      \"ADDRESSES\",\n      \"CONTACTS\",\n      \"PAYMENT_TERM_LINES\"\n    ],\n    \"addresses\": [\n      {\n        \"firstLine\": \"123 Generic RepAll street\",\n        \"city\": \"Generic City\",\n        \"zipCode\": \"12345\",\n        \"countryIsoCodeAlpha2\": \"LU\"\n      }\n    ],\n    \"contacts\": [\n      {\n        \"isDefault\": true,\n        \"courtesy\": \"MR\",\n        \"name\": \"JohnRepAll\",\n        \"surname\": \"Smith\",\n        \"phones\": [\n          {\n            \"isDefault\": true,\n            \"number\": \"01 23 45 67 89\",\n            \"type\": \"EMPTY\"\n          },\n          {\n            \"number\": \"06 07 08 09 10\",\n            \"type\": \"MOBILE\"\n          }\n        ],\n        \"emails\": [\n          {\n            \"emailAddress\": \"info@customerdemo.com\",\n            \"usage\": \"PAYMENTS\",\n            \"isDefault\": true\n          }\n        ],\n        \"socialMedias\": [\n          {\n            \"name\": \"sitePrincipal\",\n            \"link\": \"www.customernew.com\"\n          }\n        ]\n      },\n      {\n        \"isDefault\": false,\n        \"name\": \"Infos\",\n        \"socialMedias\": [\n          {\n            \"name\": \"new_site\",\n            \"link\": \"www.customerdemorepall.com\"\n          }\n        ]\n      },\n      {\n        \"name\": \"New Contact repall\",\n        \"isDefault\": false,\n        \"phones\": [\n          {\n            \"isDefault\": true,\n            \"number\": \"05 55 55 55 55\",\n            \"type\": \"LANDLINE\"\n          }\n        ]\n      }\n    ],\n    \"paymentTermLines\": [\n      {\n        \"day\": 60,\n        \"condition\": \"DAY_OF_PAYMENT\",\n        \"type\": \"REMAINING_AMOUNT\",\n        \"value\": 0,\n        \"payDays\": [],\n        \"order\": 1\n      }\n    ]\n  }\n}"
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "8 - M.deletecustomer {{currentId}}",
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "mutation ($values:CustomerDeleteGLDtoInput!) {\r\n    deleteCustomer(input: $values) {\r\n    id\r\n  }\r\n}",
                            "variables": "{\r\n  \"values\":{\r\n    \"id\":\"{{currentId}}\"\r\n  }\r\n}"
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "9 - 🆕M.createCustomer INDIVIDUAL - {{currentId}} filled in",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "pm.test(\"Variables creation\", function () {\r",
                              "    let jsd = pm.response.json();\r",
                              "\r",
                              "    if (jsd.data == null)\r",
                              "        {console.error(\"Unable to save environment variable\");return;}\r",
                              "\r",
                              "    let result = jsd.data.createCustomer;\r",
                              "    pm.environment.set(\"currentId\", result.id);\r",
                              "    console.log(\"'currentId' environment variable has been created : \" + pm.environment.get(\"currentId\"));\r",
                              "});\r",
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {}
                          }
                        },
                        {
                          "listen": "prerequest",
                          "script": {
                            "exec": [
                              "let legislationCode = pm.environment.get(\"legislationCode\");\r",
                              "\r",
                              "if (legislationCode === 'FR') {\r",
                              "    pm.environment.set(\"identificationNumber\", \"323456789\");\r",
                              "    pm.environment.set(\"vatNumber\",\"FR33323456789\");\r",
                              "} else if (legislationCode === 'ES') {\r",
                              "    pm.environment.set(\"identificationNumber\", \"Z4660201S\");\r",
                              "    pm.environment.set(\"vatNumber\",\"ESZ4660201S\");\r",
                              "} else if (legislationCode === 'DE') {\r",
                              "    pm.environment.set(\"identificationNumber\", \"80715887835\");\r",
                              "    pm.environment.set(\"vatNumber\",\"DE807158878\");\r",
                              "} else {\r",
                              "    console.error(\"Unexpected legislationCode value\");\r",
                              "    return;\r",
                              "}\r",
                              "\r",
                              "console.log(\"'identificationNumber' & 'vatNumber' environment variables has been created with value: \" \r",
                              "    + pm.environment.get(\"identificationNumber\")+\" - \"+pm.environment.get(\"vatNumber\"));\r",
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "mutation ($values: CustomerCreateGLDtoInput!) {  \r\n  createCustomer (input: $values) {\r\n    id\r\n    code\r\n  }\r\n}\r\n",
                            "variables": "{\r\n  \"values\":{\r\n    \"socialName\": \"Customer Individual\",\r\n    \"tradeName\": \"CustInd\",\r\n    \"customerType\": \"INDIVIDUAL\",\r\n    \"addresses\": [{\r\n      \"firstLine\": \"123 Generic street\",\r\n      \"city\": \"Generic City\",\r\n      \"zipCode\": \"12345\",\r\n      \"countryIsoCodeAlpha2\":\"{{legislationCode}}\"\r\n    }]\r\n  }\r\n}"
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "10 - M.deletecustomer {{customerId}}",
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "mutation ($values:CustomerDeleteGLDtoInput!) {\r\n    deleteCustomer(input: $values) {\r\n    id\r\n  }\r\n}",
                            "variables": "{\r\n  \"values\":{\r\n    \"id\":\"{{currentId}}\"\r\n  }\r\n}"
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    }
                  ],
                  "description": "The initial example for creation without a code **assumes that automatic numbering for the Customer resource is not inactive** in Sage Active under _Configuration > Company > Sequence Numbers._"
                },
                {
                  "name": "Q.customers - first id filled in {{currentId}}",
                  "event": [
                    {
                      "listen": "test",
                      "script": {
                        "exec": [
                          "pm.test(\"Variables creation\", function () {\r",
                          "    let jsd = pm.response.json();\r",
                          "\r",
                          "    if (jsd.data == null || jsd.data.customers.edges.length == 0)\r",
                          "        {console.error(\"Unable to save environment variable\");return;}\r",
                          "    pm.environment.set(\"currentId\", jsd.data.customers.edges[0].node.id);\r",
                          "    console.log(\"'currentId' environment variable has been created : \" + pm.environment.get(\"currentId\"));\r",
                          "});"
                        ],
                        "type": "text/javascript",
                        "packages": {},
                        "requests": {}
                      }
                    }
                  ],
                  "request": {
                    "auth": {
                      "type": "bearer",
                      "bearer": [
                        {
                          "key": "token",
                          "value": "{{accessToken}}",
                          "type": "string"
                        }
                      ]
                    },
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "query {\r\n    customers\r\n       (first:500) {\r\n        edges {\r\n            node {\r\n                sourceType\r\n                id   \r\n                socialName\r\n                tradeName\r\n                code\r\n                customerType\r\n                documentId\r\n                documentTypeId\r\n                documentLanguage\r\n                eInvoicingAddressType\r\n                eInvoicingAddress\r\n                countryAcronym\r\n                viesCode\r\n                addresses {\r\n                    id\r\n                    firstLine\r\n                    secondLine\r\n                    city\r\n                    zipCode\r\n                    countryId\r\n                    countryName\r\n                    countryIsoCodeAlpha2\r\n                    name\r\n                    isMainAddress\r\n                    isDeliveryAddress\r\n                    isDefaultDeliveryAddress\r\n                }\r\n                contacts{\r\n                    isDefaultCustomer\r\n                    courtesy\r\n                    name\r\n                    surname\r\n                emails {\r\n                    emailAddress\r\n                    usage\r\n                }\r\n                phones {\r\n                    number\r\n                    type\r\n                }\r\n                socialMedias {\r\n                    link\r\n                    name\r\n                }\r\n                isDefault\r\n                }\r\n                paymentTermLines {\r\n                    id\r\n                    day\r\n                    condition\r\n                    type\r\n                    value\r\n                    payDays\r\n                    order\r\n                }\r\n                defaultAccountingAccountId\r\n                defaultAccountingAccount{code name}\r\n                defaultPrepaymentAccountingAccountId\r\n                defaultPrepaymentAccountingAccount {code name}  \r\n                specialMention\r\n            }\r\n        }\r\n    }   \r\n}",
                        "variables": ""
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                },
                {
                  "name": "Q.customers filtered by Id {{currentId}}",
                  "request": {
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "query  ($id : UUID!) {\r\n    customers\r\n     (where : { id : { eq : $id }})  {\r\n        edges {\r\n            node {\r\n                id   \r\n                socialName\r\n                tradeName\r\n                code\r\n                documentId\r\n                documentTypeId\r\n                countryAcronym\r\n                addresses {\r\n                    id\r\n                    firstLine\r\n                    secondLine\r\n                    city\r\n                    zipCode\r\n                    countryId\r\n                    countryName\r\n                    countryIsoCodeAlpha2\r\n                    name\r\n                    isDeliveryAddress\r\n                    isDefaultDeliveryAddress\r\n                    isMainAddress\r\n                }\r\n                contacts{\r\n                isDefaultCustomer\r\n                courtesy\r\n                name\r\n                surname\r\n                emails {\r\n                    emailAddress\r\n                    usage\r\n                }\r\n                phones {\r\n                    number\r\n                    type\r\n                }\r\n                socialMedias {\r\n                    link\r\n                    name\r\n                }\r\n                isDefault\r\n                }\r\n                paymentTermLines {\r\n                    id\r\n                    day\r\n                    condition\r\n                    type\r\n                    value\r\n                    payDays\r\n                    order\r\n                }\r\n                defaultAccountingAccountId              \r\n            }\r\n        }\r\n    }   \r\n}\r\n\r\n",
                        "variables": "{\r\n  \"id\":\"{{currentId}}\"\r\n}"
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                }
              ]
            },
            {
              "name": "Suppliers",
              "item": [
                {
                  "name": "M.create a supplier, then update it, then delete it",
                  "item": [
                    {
                      "name": "1 - M.createSupplier with minimal information - {{currentId}} filled in",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "pm.test(\"Variables creation\", function () {\r",
                              "    let jsd = pm.response.json();\r",
                              "\r",
                              "    if (jsd.data == null)\r",
                              "        {console.error(\"Unable to save environment variable\");return;}\r",
                              "\r",
                              "    let result = jsd.data.createSupplier;\r",
                              "    pm.environment.set(\"currentId\", result.id);\r",
                              "    console.log(\"'currentId' environment variable has been created : \" + pm.environment.get(\"currentId\"));\r",
                              "});\r",
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        },
                        {
                          "listen": "prerequest",
                          "script": {
                            "exec": [
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "mutation ($values: SupplierCreateGLDtoInput!) {  \r\n  createSupplier (input: $values) {\r\n    id\r\n    code\r\n  }\r\n}\r\n",
                            "variables": "{\r\n  \"values\":{\r\n    \"socialName\": \"Postman Demo\",\r\n    \"tradeName\": \"POSTMANDEMO\",\r\n    \"addresses\": [{\r\n      \"firstLine\": \"123 Generic street\",\r\n      \"city\": \"Generic City\",\r\n      \"zipCode\": \"12345\",\r\n      \"countryIsoCodeAlpha2\":\"{{legislationCode}}\"\r\n    }]\r\n  }\r\n}"
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "3 - Q.suppliersfiltered by Id",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "pm.test(\"Create environment variables for all IDs\", function () {\r",
                              "    const jsd = pm.response.json();\r",
                              "    if (!jsd?.data) return console.error(\"Invalid response structure, no data\");\r",
                              "\r",
                              "    // Find the first entity type that has edges with nodes\r",
                              "    const entityType = Object.keys(jsd.data).find(t => jsd.data[t]?.edges?.length > 0);\r",
                              "    if (!entityType) return console.error(\"No entity with edges found in response\");\r",
                              "\r",
                              "    const node = jsd.data[entityType].edges[0].node;\r",
                              "\r",
                              "    // Root entity ID\r",
                              "    pm.environment.set(\"currentId\", node.id);\r",
                              "    console.log(\"currentId:\", node.id);\r",
                              "\r",
                              "    // Aliases for plural → singular (or exceptions)\r",
                              "    const aliasMap = {\r",
                              "        addresses: \"addressId\",\r",
                              "        contacts: \"contactId\",\r",
                              "        emails: \"emailId\",\r",
                              "        phones: \"phoneId\",\r",
                              "        socialMedias: \"socialMediaId\",\r",
                              "        paymentTermLines: \"paymentTermLineId\",\r",
                              "        lines: \"lineId\"\r",
                              "    };\r",
                              "\r",
                              "    // Generic helper to create variables for collections\r",
                              "    const createVars = (collection, key, parentPrefix = \"\") => {\r",
                              "        if (!Array.isArray(collection)) return;\r",
                              "\r",
                              "        const prefix = aliasMap[key] || key.replace(/s$/, \"\") + \"Id\"; // fallback: naive singular\r",
                              "\r",
                              "        collection.forEach((item, i) => {\r",
                              "            const varName = `${parentPrefix}${prefix}_${i + 1}`;\r",
                              "            pm.environment.set(varName, item.id);\r",
                              "            console.log(`${varName}:`, item.id);\r",
                              "\r",
                              "            // Recursively handle nested collections if present\r",
                              "            Object.keys(item).forEach(subKey => {\r",
                              "                if (Array.isArray(item[subKey]) && item[subKey].length > 0) {\r",
                              "                   createVars(item[subKey], subKey, `${prefix}_${i + 1}_`);\r",
                              "                }\r",
                              "            });\r",
                              "        });\r",
                              "    };\r",
                              "\r",
                              "    // Explore all arrays at root level of the node\r",
                              "    Object.keys(node).forEach(key => {\r",
                              "        if (Array.isArray(node[key]) && node[key].length > 0) {\r",
                              "            createVars(node[key], key);\r",
                              "        }\r",
                              "    });\r",
                              "\r",
                              "    console.log(`✅ Environment variables created for ${entityType}`);\r",
                              "});\r",
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {}
                          }
                        },
                        {
                          "listen": "prerequest",
                          "script": {
                            "exec": [
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "query  ($id : UUID!) {\r\n    suppliers\r\n     (where : { id : { eq : $id }})  {\r\n        edges {\r\n            node {\r\n                id   \r\n                socialName\r\n                tradeName\r\n                code\r\n                documentId\r\n                documentTypeId\r\n                countryAcronym\r\n                addresses {\r\n                    id\r\n                    firstLine\r\n                    secondLine\r\n                    city\r\n                    zipCode\r\n                    countryId\r\n                    countryName\r\n                    name\r\n                    isDeliveryAddress\r\n                    isDefaultDeliveryAddress\r\n                }\r\n                contacts{\r\n                id\r\n                isDefault\r\n                courtesy\r\n                name\r\n                surname\r\n                emails {\r\n                    id\r\n                    emailAddress\r\n                    usage\r\n                }\r\n                phones {\r\n                    id\r\n                    number\r\n                    type\r\n                }\r\n                socialMedias {\r\n                    id\r\n                    link\r\n                    name\r\n                }\r\n                isDefault\r\n                }\r\n                paymentTermLines {\r\n                    id\r\n                    day\r\n                    condition\r\n                    type\r\n                    value\r\n                    payDays\r\n                    order\r\n                }\r\n                defaultAccountingAccountId              \r\n            }\r\n        }\r\n    }   \r\n}\r\n",
                            "variables": "{\r\n  \"id\":\"{{currentId}}\"\r\n}"
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "6 - M.deletecustomer {{currentId}}",
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "mutation ($values:SupplierDeleteGLDtoInput!) {\r\n    deleteSupplier(input: $values) {\r\n    id\r\n  }\r\n}",
                            "variables": "{\r\n  \"values\":{\r\n    \"id\":\"{{currentId}}\"\r\n  }\r\n}"
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "2 - M.createSupplier with more complete information- {{currentId}} filled in",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "pm.test(\"Variables creation\", function () {\r",
                              "    let jsd = pm.response.json();\r",
                              "\r",
                              "    if (jsd.data == null)\r",
                              "        {console.error(\"Unable to save environment variable\");return;}\r",
                              "\r",
                              "    let result = jsd.data.createSupplier;\r",
                              "    pm.environment.set(\"currentId\", result.id);\r",
                              "    console.log(\"'currentId' environment variable has been created : \" + pm.environment.get(\"currentId\"));\r",
                              "});\r",
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        },
                        {
                          "listen": "prerequest",
                          "script": {
                            "exec": [
                              "let legislationCode = pm.environment.get(\"legislationCode\");\r",
                              "\r",
                              "if (legislationCode === 'FR') {\r",
                              "    pm.environment.set(\"identificationNumber\", \"926137614\");\r",
                              "    pm.environment.set(\"vatNumber\",\"FR33926137614\");\r",
                              "    pm.environment.set(\"code\",\"SUPPDEMOCPLT\");\r",
                              "} else if (legislationCode === 'ES') {\r",
                              "    pm.environment.set(\"identificationNumber\", \"X7784493M\");\r",
                              "    pm.environment.set(\"vatNumber\",\"ESX7784493M\");\r",
                              "    pm.environment.set(\"code\",\"SUPPDEMOCPLT\");\r",
                              "} else if (legislationCode === 'DE') {\r",
                              "    pm.environment.set(\"identificationNumber\", \"90881100521\");\r",
                              "    pm.environment.set(\"vatNumber\",\"DE908811005\");\r",
                              "    pm.environment.set(\"code\",\"70200\");\r",
                              "} else {\r",
                              "    console.error(\"Unexpected legislationCode value\");\r",
                              "    return;\r",
                              "}\r",
                              "\r",
                              "console.log(\"'identificationNumber' & 'vatNumber' environment variables has been created with value: \" \r",
                              "    + pm.environment.get(\"identificationNumber\")+\" - \"+pm.environment.get(\"vatNumber\"));\r",
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "mutation ($values: SupplierCreateGLDtoInput!) {  \r\n  createSupplier (input: $values) {\r\n    id\r\n    code\r\n  }\r\n}\r\n",
                            "variables": "{\r\n  \"values\":{\r\n    \"code\": \"{{code}}\",\r\n    \"documentId\":\"{{identificationNumber}}\",\r\n    \"vatNumber\":\"{{vatNumber}}\",\r\n    \"socialName\": \"POSTMANDEMO\",\r\n    \"tradeName\": \"POSTMANDEMO\",\r\n    \"addresses\": [{\r\n      \"firstLine\": \"123 Generic street\",\r\n      \"city\": \"Generic City\",\r\n      \"zipCode\": \"12345\",\r\n      \"countryIsoCodeAlpha2\":\"{{legislationCode}}\"\r\n    }],\r\n    \"contacts\":[{\r\n      \"isDefault\":true,\r\n      \"courtesy\":\"MR\",\r\n      \"name\":\"John\",\r\n      \"surname\":\"Smith\",\r\n      \"phones\":[{\r\n          \"isDefault\":true,\r\n          \"number\":\"01 02 03 04 05\",\r\n          \"type\":\"EMPTY\"\r\n      },\r\n      {\r\n          \"number\":\"06 07 08 09 10\",\r\n          \"type\":\"MOBILE\"\r\n      }],\r\n      \"emails\":[{\r\n          \"emailAddress\":\"smith@supplierdemo.com\",\r\n          \"usage\":\"EMPTY\"\r\n      },\r\n      {\r\n          \"emailAddress\":\"info@supplierdemo.com\",\r\n          \"usage\":\"PAYMENTS\",\r\n          \"isDefault\":true\r\n      }]\r\n    },\r\n    {\r\n      \"isDefault\":false,\r\n      \"name\":\"Infos\",\r\n      \"socialMedias\":[{\r\n          \"name\":\"site1\",\r\n          \"link\":\"www.supplierdemo.com\"\r\n      }]\r\n    }],\r\n    \"paymentTermLines\":[{\r\n            \"type\":\"FIXED_AMOUNT\",\r\n            \"value\":500,\r\n            \"order\":1,\r\n            \"condition\":\"DAY_OF_PAYMENT\"\r\n        },\r\n        {\r\n            \"type\":\"PERCENTAGE\",\r\n            \"value\":30,\r\n            \"order\":2,\r\n            \"condition\":\"END_OF_MONTH\"\r\n        },\r\n        {\r\n            \"type\":\"REMAINING_AMOUNT\",\r\n            \"value\":0,\r\n            \"order\":9999,\r\n            \"condition\":\"END_OF_MONTH\",\r\n            \"day\":60\r\n        }\r\n    ]\r\n  }\r\n}\r\n"
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "3 - Q.suppliersfiltered by Id",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "pm.test(\"Create environment variables for all IDs\", function () {\r",
                              "    const jsd = pm.response.json();\r",
                              "    if (!jsd?.data) return console.error(\"Invalid response structure, no data\");\r",
                              "\r",
                              "    // Find the first entity type that has edges with nodes\r",
                              "    const entityType = Object.keys(jsd.data).find(t => jsd.data[t]?.edges?.length > 0);\r",
                              "    if (!entityType) return console.error(\"No entity with edges found in response\");\r",
                              "\r",
                              "    const node = jsd.data[entityType].edges[0].node;\r",
                              "\r",
                              "    // Root entity ID\r",
                              "    pm.environment.set(\"currentId\", node.id);\r",
                              "    console.log(\"currentId:\", node.id);\r",
                              "\r",
                              "    // Aliases for plural → singular (or exceptions)\r",
                              "    const aliasMap = {\r",
                              "        addresses: \"addressId\",\r",
                              "        contacts: \"contactId\",\r",
                              "        emails: \"emailId\",\r",
                              "        phones: \"phoneId\",\r",
                              "        socialMedias: \"socialMediaId\",\r",
                              "        paymentTermLines: \"paymentTermLineId\",\r",
                              "        lines: \"lineId\"\r",
                              "    };\r",
                              "\r",
                              "    // Generic helper to create variables for collections\r",
                              "    const createVars = (collection, key, parentPrefix = \"\") => {\r",
                              "        if (!Array.isArray(collection)) return;\r",
                              "\r",
                              "        const prefix = aliasMap[key] || key.replace(/s$/, \"\") + \"Id\"; // fallback: naive singular\r",
                              "\r",
                              "        collection.forEach((item, i) => {\r",
                              "            const varName = `${parentPrefix}${prefix}_${i + 1}`;\r",
                              "            pm.environment.set(varName, item.id);\r",
                              "            console.log(`${varName}:`, item.id);\r",
                              "\r",
                              "            // Recursively handle nested collections if present\r",
                              "            Object.keys(item).forEach(subKey => {\r",
                              "                if (Array.isArray(item[subKey]) && item[subKey].length > 0) {\r",
                              "                   createVars(item[subKey], subKey, `${prefix}_${i + 1}_`);\r",
                              "                }\r",
                              "            });\r",
                              "        });\r",
                              "    };\r",
                              "\r",
                              "    // Explore all arrays at root level of the node\r",
                              "    Object.keys(node).forEach(key => {\r",
                              "        if (Array.isArray(node[key]) && node[key].length > 0) {\r",
                              "            createVars(node[key], key);\r",
                              "        }\r",
                              "    });\r",
                              "\r",
                              "    console.log(`✅ Environment variables created for ${entityType}`);\r",
                              "});\r",
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {}
                          }
                        },
                        {
                          "listen": "prerequest",
                          "script": {
                            "exec": [
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "query  ($id : UUID!) {\r\n    suppliers\r\n     (where : { id : { eq : $id }})  {\r\n        edges {\r\n            node {\r\n                id   \r\n                socialName\r\n                tradeName\r\n                code\r\n                documentId\r\n                documentTypeId\r\n                countryAcronym\r\n                addresses {\r\n                    id\r\n                    firstLine\r\n                    secondLine\r\n                    city\r\n                    zipCode\r\n                    countryId\r\n                    countryName\r\n                    name\r\n                    isDeliveryAddress\r\n                    isDefaultDeliveryAddress\r\n                }\r\n                contacts{\r\n                id\r\n                isDefault\r\n                courtesy\r\n                name\r\n                surname\r\n                emails {\r\n                    id\r\n                    emailAddress\r\n                    usage\r\n                }\r\n                phones {\r\n                    id\r\n                    number\r\n                    type\r\n                }\r\n                socialMedias {\r\n                    id\r\n                    link\r\n                    name\r\n                }\r\n                isDefault\r\n                }\r\n                paymentTermLines {\r\n                    id\r\n                    day\r\n                    condition\r\n                    type\r\n                    value\r\n                    payDays\r\n                    order\r\n                }\r\n                defaultAccountingAccountId              \r\n            }\r\n        }\r\n    }   \r\n}\r\n",
                            "variables": "{\r\n  \"id\":\"{{currentId}}\"\r\n}"
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "4 - M updateSupplier [requestedAction]",
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}",
                            "type": "default"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}",
                            "type": "default"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "mutation ($values: SupplierUpdateGLDtoInput!) {  \r\n  updateSupplier (input: $values) {\r\n    id\r\n  }\r\n}\r\n",
                            "variables": "{\n  \"values\": {\n    \"id\": \"{{currentId}}\",\n    \"socialName\": \"SUPPLIER REQACT\",\n    \"tradeName\": \"SUPPLREQACT\",\n    \"addresses\": [\n      {\n        \"id\": \"{{addressId_1}}\",\n        \"firstLine\": \"123 Generic ReqAct street\",\n        \"countryIsoCodeAlpha2\": \"LU\"\n      }\n    ],\n    \"contacts\": [\n      {\n        \"id\": \"{{contactId_1}}\",\n        \"phones\": [\n          {\n            \"id\": \"{{contactId_1_phoneId_1}}\",\n            \"number\": \"01 23 45 67 89\"\n          }\n        ],\n        \"emails\": [\n          {\n            \"id\": \"{{contactId_1_emailId_1}}\",\n            \"requestedAction\": \"DELETE\"\n          }\n        ],\n        \"socialMedias\": [\n          {\n            \"link\": \"www.supplierreqact.com\",\n            \"name\": \"sitePricincipal\"\n          }\n        ]\n      },\n      {\n        \"name\": \"New Contact reqact\",\n        \"isDefault\": false,\n        \"phones\": [\n          {\n            \"isDefault\": true,\n            \"number\": \"05 55 55 55 55\",\n            \"type\": \"LANDLINE\"\n          }\n        ]\n      }\n    ],\n    \"paymentTermLines\": [\n      {\n        \"id\": \"{{paymentTermLineId_3}}\",\n        \"day\": 30\n      }\n    ]\n  }\n}\n"
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "5 -M updateSupplier [replaceAll]",
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}",
                            "type": "default"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}",
                            "type": "default"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "mutation ($values: SupplierUpdateGLDtoInput!) {  \r\n  updateSupplier (input: $values) {\r\n    id\r\n  }\r\n}\r\n",
                            "variables": "{\n  \"values\": {\n    \"id\": \"{{currentId}}\",\n    \"socialName\": \"SUPPLIER REPALL\",\n    \"tradeName\": \"SUPPLREPALL\",\n    \"replaceAll\": [\n      \"ADDRESSES\",\n      \"CONTACTS\",\n      \"PAYMENT_TERM_LINES\"\n    ],\n    \"addresses\": [\n      {\n        \"firstLine\": \"123 Generic RepAll street\",\n        \"city\": \"Generic City\",\n        \"zipCode\": \"12345\",\n        \"countryIsoCodeAlpha2\": \"LU\"\n      }\n    ],\n    \"contacts\": [\n      {\n        \"isDefault\": true,\n        \"courtesy\": \"MR\",\n        \"name\": \"JohnRepAll\",\n        \"surname\": \"Smith\",\n        \"phones\": [\n          {\n            \"isDefault\": true,\n            \"number\": \"01 23 45 67 89\",\n            \"type\": \"EMPTY\"\n          },\n          {\n            \"number\": \"06 07 08 09 10\",\n            \"type\": \"MOBILE\"\n          }\n        ],\n        \"emails\": [\n          {\n            \"emailAddress\": \"info@supplierdemo.com\",\n            \"usage\": \"PAYMENTS\",\n            \"isDefault\": true\n          }\n        ],\n        \"socialMedias\": [\n          {\n            \"name\": \"sitePrincipal\",\n            \"link\": \"www.suppliernew.com\"\n          }\n        ]\n      },\n      {\n        \"isDefault\": false,\n        \"name\": \"Infos\",\n        \"socialMedias\": [\n          {\n            \"name\": \"new_site\",\n            \"link\": \"www.supplierdemorepall.com\"\n          }\n        ]\n      },\n      {\n        \"name\": \"New Contact repall\",\n        \"isDefault\": false,\n        \"phones\": [\n          {\n            \"isDefault\": true,\n            \"number\": \"05 55 55 55 55\",\n            \"type\": \"LANDLINE\"\n          }\n        ]\n      }\n    ],\n    \"paymentTermLines\": [\n      {\n        \"day\": 60,\n        \"condition\": \"DAY_OF_PAYMENT\",\n        \"type\": \"REMAINING_AMOUNT\",\n        \"value\": 0,\n        \"payDays\": [],\n        \"order\": 1\n      }\n    ]\n  }\n}"
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "6 - M.deleteSupplier {{currentId}}",
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "mutation ($values:SupplierDeleteGLDtoInput!) {\r\n    deleteSupplier(input: $values) {\r\n    id\r\n  }\r\n}",
                            "variables": "{\r\n  \"values\":{\r\n    \"id\":\"{{currentId}}\"\r\n  }\r\n}"
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    }
                  ],
                  "description": "The initial example for creation without a code **assumes that automatic numbering for the Customer resource is not inactive** in Sage Active under _Configuration > Company > Sequence Numbers._"
                },
                {
                  "name": "✏️Q.suppliers - first id filled in {{currentId}}",
                  "event": [
                    {
                      "listen": "test",
                      "script": {
                        "exec": [
                          "pm.test(\"Variables creation\", function () {\r",
                          "    let jsd = pm.response.json();\r",
                          "\r",
                          "    if (jsd.data == null || jsd.data.suppliers.edges.length == 0)\r",
                          "        {console.error(\"Unable to save environment variable\");return;}\r",
                          "    pm.environment.set(\"currentId\", jsd.data.suppliers.edges[0].node.id);\r",
                          "    console.log(\"'currentId' environment variable has been created : \" + pm.environment.get(\"currentId\"));\r",
                          "});"
                        ],
                        "type": "text/javascript",
                        "packages": {},
                        "requests": {}
                      }
                    }
                  ],
                  "request": {
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "query {\r\n    suppliers\r\n       (first:500) {\r\n        edges {\r\n            node {\r\n                sourceType\r\n                id   \r\n                socialName\r\n                tradeName\r\n                code\r\n                documentId\r\n                documentTypeId\r\n                countryAcronym\r\n                viesCode\r\n                vatCriterion\r\n                personalIncomeTax\r\n                taxTreatmentId\r\n                taxTreatment{taxCode description}\r\n                transactionCategoryId\r\n                transactionCategory{reason type default}\r\n                addresses {\r\n                    id\r\n                    firstLine\r\n                    secondLine\r\n                    city\r\n                    zipCode\r\n                    countryId\r\n                    countryName\r\n                    countryIsoCodeAlpha2\r\n                    name\r\n                    isMainAddress\r\n                }\r\n                contacts {\r\n                    isDefaultSupplier\r\n                    courtesy\r\n                    name\r\n                    surname\r\n                emails {\r\n                    emailAddress\r\n                    usage\r\n                }\r\n                phones {\r\n                    number\r\n                    type\r\n                }\r\n                socialMedias {\r\n                    link\r\n                    name\r\n                }\r\n                }\r\n                paymentTermLines {\r\n                    id\r\n                    day\r\n                    condition\r\n                    payDays\r\n                    order\r\n                }\r\n                defaultAccountingAccount{code}  \r\n                defaultPurchaseAccount{code}          \r\n            }\r\n        }\r\n        totalCount\r\n        pageInfo {\r\n            hasNextPage\r\n        }\r\n    }   \r\n}\r\n\r\n",
                        "variables": ""
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                },
                {
                  "name": "Q.suppliers filtered by Id {{currentId}}",
                  "request": {
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "query  ($id : UUID!) {\r\n    suppliers \r\n    (where : { id : { eq : $id }}) {\r\n        edges {\r\n            node {\r\n                id   \r\n                socialName\r\n                tradeName\r\n                code\r\n                documentId\r\n                documentTypeId\r\n                countryAcronym\r\n                addresses {\r\n                    id\r\n                    firstLine\r\n                    secondLine\r\n                    city\r\n                    zipCode\r\n                    countryId\r\n                    countryName\r\n                    countryIsoCodeAlpha2\r\n                    name\r\n                    isMainAddress               \r\n                }\r\n                contacts {\r\n                    isDefaultSupplier\r\n                    courtesy\r\n                    name\r\n                    surname\r\n                emails {\r\n                    emailAddress\r\n                    usage\r\n                }\r\n                phones {\r\n                    number\r\n                    type\r\n                }\r\n                socialMedias {\r\n                    link\r\n                    name\r\n                }\r\n                }\r\n                paymentTermLines {\r\n                    id\r\n                    day\r\n                    condition\r\n                    payDays\r\n                    order\r\n                }\r\n                defaultAccountingAccountId              \r\n            }\r\n        }\r\n    }   \r\n}",
                        "variables": "{\r\n  \"id\":\"{{currentId}}\"\r\n}"
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                }
              ]
            },
            {
              "name": "Employees",
              "item": [
                {
                  "name": "M.Create an employee, update an employee",
                  "item": [
                    {
                      "name": "1 - M.createEmployee without code - first id filled in {{currentId}}",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "pm.test(\"Variables creation\", function () {\r",
                              "    let jsd = pm.response.json();\r",
                              "\r",
                              "    if (jsd.data == null || jsd.data.createEmployee == null)\r",
                              "        {console.error(\"Unable to save environment variable\");return;}\r",
                              "    pm.environment.set(\"currentId\", jsd.data.createEmployee.id);\r",
                              "    console.log(\"'currentId' environment variable has been created : \" + pm.environment.get(\"currentId\"));\r",
                              "});\r",
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        },
                        {
                          "listen": "prerequest",
                          "script": {
                            "exec": [
                              " //LEGISLATIONS:!DE\r",
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "mutation ($values: EmployeeCreateGLDtoInput!) {  \r\n  createEmployee(input: $values) {\r\n    id\r\n    code\r\n  }\r\n}\r\n",
                            "variables": "{\r\n  \"values\":{\r\n    \"name\": \"Léon DURANT\",\r\n    \"shortName\": \"LEDU\",\r\n    \"comments\":\"Employee of the year\",\r\n      \"addresses\": [{\r\n      \"firstLine\": \"123 Generic street\",\r\n      \"city\": \"Generic City\",\r\n      \"zipCode\": \"12345\",\r\n      \"countryIsoCodeAlpha2\":\"{{legislationCode}}\"\r\n      }]\r\n  }\r\n}"
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "2 - M.updateEmployee {{currentId}}",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        },
                        {
                          "listen": "prerequest",
                          "script": {
                            "exec": [
                              " //LEGISLATIONS:!DE\r",
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "mutation ($values: EmployeeUpdateGLDtoInput!) {  \r\n  updateEmployee (input: $values) {\r\n    id\r\n  }\r\n}\r\n",
                            "variables": "{\r\n  \"values\":{\r\n    \"id\":\"{{currentId}}\",\r\n    \"name\": \"Léon DURANT MODIFY\"\r\n    }\r\n}\r\n    "
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "3 - M.deleteEmployee {{currentId}}",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        },
                        {
                          "listen": "prerequest",
                          "script": {
                            "exec": [
                              " //LEGISLATIONS:!DE\r",
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "mutation ($values: EmployeeUpdateGLDtoInput!) {  \r\n  updateEmployee (input: $values) {\r\n    id\r\n  }\r\n}\r\n",
                            "variables": "{\r\n  \"values\":{\r\n    \"id\":\"{{currentId}}\",\r\n    \"name\": \"Léon DURANT MODIFY\"\r\n    }\r\n}\r\n    "
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    }
                  ],
                  "description": "The initial example for creation without a code **assumes that automatic numbering for the Employee resource is not inactive** in Sage Active under _Configuration > Company > Sequence Numbers._"
                },
                {
                  "name": "Q.employees - first id filled in {{currentId}}",
                  "event": [
                    {
                      "listen": "test",
                      "script": {
                        "exec": [
                          "pm.test(\"Variables creation\", function () {\r",
                          "    let jsd = pm.response.json();\r",
                          "\r",
                          "    if (jsd.data == null || jsd.data.employees.edges.length == 0)\r",
                          "        {console.error(\"Unable to save environment variable\");return;}\r",
                          "    pm.environment.set(\"currentId\", jsd.data.employees.edges[0].node.id);\r",
                          "    console.log(\"'currentId' environment variable has been created : \" + pm.environment.get(\"currentId\"));\r",
                          "});"
                        ],
                        "type": "text/javascript",
                        "packages": {},
                        "requests": {}
                      }
                    },
                    {
                      "listen": "prerequest",
                      "script": {
                        "exec": [
                          " //LEGISLATIONS:!DE\r",
                          ""
                        ],
                        "type": "text/javascript",
                        "packages": {},
                        "requests": {}
                      }
                    }
                  ],
                  "request": {
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "query {\r\n    employees (   first:500\r\n        order : {creationDate:DESC}) {\r\n        edges {\r\n            node {\r\n                sourceType\r\n                id\r\n                code\r\n                name\r\n                shortName\r\n                status    \r\n                comments\r\n                addresses {\r\n                    firstLine\r\n                    secondLine\r\n                    zipCode\r\n                    city\r\n                    countryName\r\n                    countryIsoCodeAlpha2\r\n                }\r\n                contacts {\r\n                    isDefault\r\n                    courtesy\r\n                    name\r\n                    surname\r\n                    emails {\r\n                        emailAddress\r\n                        usage\r\n                    }\r\n                    phones {\r\n                        number\r\n                        type\r\n                    }\r\n                    socialMedias {\r\n                        link\r\n                        name\r\n                    }\r\n                }\r\n                defaultAccountingAccountId                \r\n            }\r\n        }\r\n        totalCount\r\n        pageInfo {\r\n            hasNextPage\r\n        }\r\n    }   \r\n}\r\n\r\n",
                        "variables": ""
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                },
                {
                  "name": "Q.employees filtered by Id {{currentId}}",
                  "event": [
                    {
                      "listen": "prerequest",
                      "script": {
                        "exec": [
                          " //LEGISLATIONS:!DE"
                        ],
                        "type": "text/javascript",
                        "packages": {},
                        "requests": {}
                      }
                    }
                  ],
                  "request": {
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "query  ($id : UUID!) {\r\n    employees \r\n    (where : { id : { eq : $id }}) {\r\n        edges {\r\n            node {\r\n                id\r\n                code\r\n                name\r\n                shortName\r\n                status    \r\n                comments\r\n                addresses {\r\n                    firstLine\r\n                    secondLine\r\n                    zipCode\r\n                    city\r\n                    countryName\r\n                    countryIsoCodeAlpha2\r\n                }\r\n                contacts {\r\n                    isDefault\r\n                    courtesy\r\n                    name\r\n                    surname\r\n                    emails {\r\n                        emailAddress\r\n                        usage\r\n                    }\r\n                    phones {\r\n                        number\r\n                        type\r\n                    }\r\n                    socialMedias {\r\n                        link\r\n                        name\r\n                    }\r\n                }\r\n                defaultAccountingAccountId                \r\n            }\r\n        }\r\n    }   \r\n}\r\n\r\n",
                        "variables": "{\r\n  \"id\":\"{{currentId}}\"\r\n}"
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                }
              ]
            },
            {
              "name": "Business areas",
              "item": [
                {
                  "name": "M.createBusinessArea - new id filled in {{currentId}}",
                  "event": [
                    {
                      "listen": "test",
                      "script": {
                        "exec": [
                          "pm.test(\"Variable creation\", function () {\r",
                          "    let jsd = pm.response.json();\r",
                          "\r",
                          "    if (jsd.data == null || jsd.data.createBusinessArea == null)\r",
                          "        {console.error(\"Unable to save environment variable\");return;}\r",
                          "    let result = jsd.data.createBusinessArea;\r",
                          "    pm.environment.set(\"currentId\", result.id);\r",
                          "    console.log(\"'currentId' environment variable has been created : \" + pm.environment.get(\"currentId\"));\r",
                          "});\r",
                          ""
                        ],
                        "type": "text/javascript"
                      }
                    }
                  ],
                  "request": {
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "mutation ($values:BusinessAreaCreateGLDtoInput!) {\r\n    createBusinessArea(input: $values) {\r\n    id\r\n  }\r\n}",
                        "variables": "{\r\n  \"values\":{\r\n    \"name\":\"Business Area 1\"\r\n  }\r\n}"
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                },
                {
                  "name": "Q.businessAreas  - first id filled in {{currentId}}",
                  "event": [
                    {
                      "listen": "test",
                      "script": {
                        "exec": [
                          "pm.test(\"Variables creation\", function () {\r",
                          "    let jsd = pm.response.json();\r",
                          "\r",
                          "    if (jsd.data == null || jsd.data.businessAreas.edges.length == 0)\r",
                          "        {console.error(\"Unable to save environment variable\");return;}\r",
                          "    pm.environment.set(\"currentId\", jsd.data.businessAreas.edges[0].node.id);\r",
                          "    console.log(\"'currentId' environment variable has been created : \" + pm.environment.get(\"currentId\"));\r",
                          "});"
                        ],
                        "type": "text/javascript"
                      }
                    }
                  ],
                  "request": {
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "query {\r\n    businessAreas {\r\n        edges {\r\n            node {\r\n                id\r\n                name\r\n                creationDate\r\n                modificationDate\r\n            }\r\n        }\r\n        totalCount\r\n        pageInfo {\r\n            hasNextPage\r\n        }\r\n    }    \r\n}",
                        "variables": ""
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                },
                {
                  "name": "Q.businessAreas filtered by Id  {{currentId}}",
                  "request": {
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "query {\r\n    businessAreas {\r\n        edges {\r\n            node {\r\n                id\r\n                name\r\n                creationDate\r\n                modificationDate\r\n            }\r\n        }\r\n    }    \r\n}",
                        "variables": "{\r\n  \"id\":\"{{currentId}}\"\r\n}"
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                },
                {
                  "name": "M.deleteBusinessArea {{currentId}}",
                  "request": {
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "mutation ($values:BusinessAreaDeleteGLDtoInput!) {\r\n    deleteBusinessArea(input: $values) {\r\n    id\r\n  }\r\n}",
                        "variables": "{\r\n  \"values\": {\r\n    \"id\": \"{{currentId}}\"\r\n  }\r\n}"
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                }
              ]
            },
            {
              "name": "Job areas",
              "item": [
                {
                  "name": "Q.jobAreas - first id filled in {{currentId}}",
                  "event": [
                    {
                      "listen": "test",
                      "script": {
                        "exec": [
                          "pm.test(\"Variables creation\", function () {\r",
                          "    let jsd = pm.response.json();\r",
                          "\r",
                          "    if (jsd.data == null || jsd.data.jobAreas.edges.length == 0)\r",
                          "        {console.error(\"Unable to save environment variable\");return;}\r",
                          "    pm.environment.set(\"currentId\", jsd.data.jobAreas.edges[0].node.id);\r",
                          "    console.log(\"'currentId' environment variable has been created : \" + pm.environment.get(\"currentId\"));\r",
                          "});"
                        ],
                        "type": "text/javascript"
                      }
                    }
                  ],
                  "request": {
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "query {\r\n    jobAreas {\r\n        edges {\r\n            node {\r\n                id\r\n                name\r\n                creationDate\r\n                modificationDate\r\n            }\r\n        }\r\n        totalCount\r\n        pageInfo {\r\n            hasNextPage\r\n        }\r\n    }    \r\n}",
                        "variables": ""
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                },
                {
                  "name": "Q.jobAreas filtered by Id {{currentId}}",
                  "request": {
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "query {\r\n    jobAreas {\r\n        edges {\r\n            node {\r\n                id\r\n                name\r\n                creationDate\r\n                modificationDate\r\n            }\r\n        }\r\n    }    \r\n}",
                        "variables": "{\r\n  \"id\":\"{{currentId}}\"\r\n}"
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                },
                {
                  "name": "M.createJobArea new id filled in {{currentId}}",
                  "event": [
                    {
                      "listen": "test",
                      "script": {
                        "exec": [
                          "pm.test(\"Variable creation\", function () {\r",
                          "    let jsd = pm.response.json();\r",
                          "\r",
                          "    if (jsd.data == null || jsd.data.createJobArea == null)\r",
                          "        {console.error(\"Unable to save environment variable\");return;}\r",
                          "    let result = jsd.data.createJobArea;\r",
                          "    pm.environment.set(\"currentId\", result.id);\r",
                          "    console.log(\"'currentId' environment variable has been created : \" + pm.environment.get(\"currentId\"));\r",
                          "});\r",
                          ""
                        ],
                        "type": "text/javascript",
                        "packages": {},
                        "requests": {}
                      }
                    },
                    {
                      "listen": "prerequest",
                      "script": {
                        "exec": [
                          ""
                        ],
                        "type": "text/javascript",
                        "packages": {},
                        "requests": {}
                      }
                    }
                  ],
                  "request": {
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "mutation ($values:JobAreaCreateGLDtoInput!) {\r\n    createJobArea(input: $values) {\r\n    id\r\n  }\r\n}",
                        "variables": "{\r\n  \"values\":{\r\n    \"name\":\"Job Area Demo\"\r\n  }\r\n}"
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                }
              ]
            },
            {
              "name": "Payment means",
              "item": [
                {
                  "name": "Q.paymentMeans - first id filled in {{currentId}}",
                  "event": [
                    {
                      "listen": "test",
                      "script": {
                        "exec": [
                          "pm.test(\"Variables creation\", function () {\r",
                          "    let jsd = pm.response.json();\r",
                          "\r",
                          "    if (jsd.data == null || jsd.data.paymentMeans.edges.length == 0)\r",
                          "        {console.error(\"Unable to save environment variable\");return;}\r",
                          "    pm.environment.set(\"currentId\", jsd.data.paymentMeans.edges[0].node.id);\r",
                          "    console.log(\"'currentId' environment variable has been created : \" + pm.environment.get(\"currentId\"));\r",
                          "});"
                        ],
                        "type": "text/javascript",
                        "packages": {},
                        "requests": {}
                      }
                    }
                  ],
                  "request": {
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "query {\r\n    paymentMeans {\r\n        edges {\r\n            node {\r\n                id\r\n                creationDate\r\n                description\r\n                type\r\n                inactive\r\n            }\r\n        }\r\n        totalCount\r\n        pageInfo {\r\n            hasNextPage\r\n        }\r\n    }     \r\n}",
                        "variables": ""
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                },
                {
                  "name": "Q.paymentMeans filtered by Id {{currentId}}",
                  "request": {
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "query  ($id : UUID!) {\r\n    paymentMeans \r\n     (where : { id : { eq : $id }}) {\r\n        edges {\r\n            node {\r\n                id\r\n                creationDate\r\n                description\r\n            }\r\n        }\r\n    }     \r\n}",
                        "variables": "{\r\n  \"id\":\"{{currentId}}\"\r\n}"
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                },
                {
                  "name": "M.createPaymentMean - new id filled in {{currentId}}",
                  "event": [
                    {
                      "listen": "test",
                      "script": {
                        "exec": [
                          "pm.test(\"Variable creation\", function () {\r",
                          "    let jsd = pm.response.json();\r",
                          "\r",
                          "    if (jsd.data == null || jsd.data.createPaymentMean == null)\r",
                          "        {console.error(\"Unable to save environment variable\");return;}\r",
                          "    let result = jsd.data.createPaymentMean;\r",
                          "    pm.environment.set(\"currentId\", result.id);\r",
                          "    console.log(\"'currentId' environment variable has been created : \" + pm.environment.get(\"currentId\"));\r",
                          "});\r",
                          ""
                        ],
                        "type": "text/javascript"
                      }
                    }
                  ],
                  "request": {
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "mutation ($values:PaymentMeanCreateGLDtoInput!) {\r\n    createPaymentMean(input: $values) {\r\n    id\r\n  }\r\n}",
                        "variables": "{\r\n  \"values\":{\r\n    \"description\":\"description payment\"\r\n  }\r\n}"
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                },
                {
                  "name": "M.deletePaymentMean {{currentId}}",
                  "request": {
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "mutation ($values:PaymentMeanDeleteGLDtoInput!) {\r\n    deletePaymentMean(input: $values) {\r\n    id\r\n  }\r\n}",
                        "variables": "{\r\n  \"values\": {\r\n    \"id\": \"{{currentId}}\"\r\n  }\r\n}"
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                }
              ]
            },
            {
              "name": "Payment terms",
              "item": [
                {
                  "name": "Q.paymentTerms - first id filled in {{currentId}}",
                  "event": [
                    {
                      "listen": "test",
                      "script": {
                        "exec": [
                          "pm.test(\"Variables creation\", function () {\r",
                          "    let jsd = pm.response.json();\r",
                          "\r",
                          "    if (jsd.data == null || jsd.data.paymentTerms.edges.length == 0)\r",
                          "        {console.error(\"Unable to save environment variable\");return;}\r",
                          "    pm.environment.set(\"currentId\", jsd.data.paymentTerms.edges[0].node.id);\r",
                          "    console.log(\"'currentId' environment variable has been created : \" + pm.environment.get(\"currentId\"));\r",
                          "});"
                        ],
                        "type": "text/javascript",
                        "packages": {}
                      }
                    }
                  ],
                  "request": {
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "query {\r\n    paymentTerms {\r\n        edges {\r\n            node {\r\n                id\r\n                name\r\n                modificationDate\r\n                lines {\r\n                    type\r\n                    paymentMeanId\r\n                    id\r\n                    day\r\n                    condition\r\n                    order\r\n                    payDays\r\n                }\r\n            }\r\n        }\r\n        totalCount\r\n        pageInfo {\r\n            hasNextPage\r\n        }\r\n    }     \r\n}",
                        "variables": ""
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                },
                {
                  "name": "Q.paymentTerms filtered by Id {{currentId}",
                  "request": {
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "query  ($id : UUID!) {\r\n    paymentTerms\r\n     (where : { id : { eq : $id }}) {\r\n        edges {\r\n            node {\r\n                id\r\n                name\r\n                modificationDate\r\n                lines {\r\n                    type\r\n                    paymentMeanId\r\n                    id\r\n                    day\r\n                    condition\r\n                    order\r\n                    payDays\r\n                }\r\n            }\r\n        }\r\n    }     \r\n}",
                        "variables": "{\r\n    \"id\":\"{{currentId}}\"\r\n}"
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                },
                {
                  "name": "M.createPaymentTerm - new id filled in  {{currentId}}",
                  "event": [
                    {
                      "listen": "test",
                      "script": {
                        "exec": [
                          "pm.test(\"Variable creation\", function () {\r",
                          "    let jsd = pm.response.json();\r",
                          "\r",
                          "    if (jsd.data == null || jsd.data.createPaymentTerm == null)\r",
                          "        {console.error(\"Unable to save environment variable\");return;}\r",
                          "    let result = jsd.data.createPaymentTerm;\r",
                          "    pm.environment.set(\"currentId\", result.id);\r",
                          "    console.log(\"'currentId' environment variable has been created : \" + pm.environment.get(\"currentId\"));\r",
                          "});\r",
                          ""
                        ],
                        "type": "text/javascript"
                      }
                    }
                  ],
                  "request": {
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "mutation ($values:PaymentTermCreateGLDtoInput!) {\r\n    createPaymentTerm(input: $values) {\r\n    id\r\n  }\r\n}",
                        "variables": "{\r\n  \"values\":{\r\n    \"name\":\"PaymentTermMulti\",\r\n    \"lines\":[\r\n    {\r\n      \"type\":\"FIXED_AMOUNT\",\r\n      \"value\":500,\r\n      \"order\":1,\r\n      \"condition\":\"DAY_OF_PAYMENT\"\r\n    },\r\n     {\r\n      \"type\":\"PERCENTAGE\",\r\n      \"value\":30,\r\n      \"order\":2,\r\n      \"condition\":\"END_OF_MONTH\"\r\n    },\r\n     {\r\n      \"type\":\"REMAINING_AMOUNT\",\r\n      \"value\":0,\r\n      \"order\":9999,\r\n      \"condition\":\"END_OF_MONTH\",\r\n      \"day\":60\r\n    }\r\n    ]\r\n  }\r\n}"
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                },
                {
                  "name": "M.deletePaymentTerm {{currentId}}",
                  "request": {
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "mutation ($values:PaymentTermDeleteGLDtoInput!) {\r\n    deletePaymentTerm(input: $values) {\r\n    id\r\n  }\r\n}",
                        "variables": "{\r\n  \"values\": {\r\n    \"id\": \"{{currentId}}\"\r\n  }\r\n}"
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                }
              ]
            },
            {
              "name": "🆕Q.Code field management (manual entry or sequential numbering)",
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "exec": [
                      ""
                    ],
                    "type": "text/javascript",
                    "packages": {},
                    "requests": {}
                  }
                },
                {
                  "listen": "prerequest",
                  "script": {
                    "packages": {},
                    "type": "text/javascript"
                  }
                }
              ],
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "X-OrganizationId",
                    "value": "{{X-OrganizationId}}"
                  },
                  {
                    "key": "x-api-key",
                    "value": "{{subscriptionKey}}"
                  }
                ],
                "body": {
                  "mode": "graphql",
                  "graphql": {
                    "query": "query {\r\n  thirdPartyCodeModeSettings {\r\n    customerCodeIsManual\r\n    supplierCodeIsManual\r\n    employeeCodeIsManual\r\n  }\r\n}",
                    "variables": ""
                  }
                },
                "url": {
                  "raw": "{{baseAddress}}/graphql",
                  "host": [
                    "{{baseAddress}}"
                  ],
                  "path": [
                    "graphql"
                  ]
                }
              },
              "response": []
            }
          ],
          "description": "This section provides details on third-party entities that interact with organizations.  \nThese entities include Customers, Suppliers, and Employees"
        },
        {
          "name": "Product management",
          "item": [
            {
              "name": "Products",
              "item": [
                {
                  "name": "M.createProduct then update it, then delete it",
                  "item": [
                    {
                      "name": "1- M.createProduct with default Tax Group- new id filled in {{currentid}}",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "pm.test(\"Variables creation\", function () {\r",
                              "    let jsd = pm.response.json();\r",
                              "\r",
                              "    if (jsd.data == null || jsd.data.createProduct == null)\r",
                              "        {console.error(\"Unable to save environment variable\");return;}\r",
                              "    pm.environment.set(\"currentId\", jsd.data.createProduct.id);\r",
                              "    console.log(\"'currentId' environment variable has been created : \" + pm.environment.get(\"currentId\"));\r",
                              "});\r",
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {}
                          }
                        },
                        {
                          "listen": "prerequest",
                          "script": {
                            "exec": [
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "mutation ($values: ProductCreateGLDtoInput!) {  \r\n    createProduct(input: $values) {\r\n    id\r\n  }\r\n}",
                            "variables": "{\r\n  \"values\":{\r\n      \"code\": \"PRODUCT01\",\r\n      \"name\": \"Test Product\",\r\n      \"comments\": \"comment\",\r\n      \"lineDescription\": \"Description Product\",\r\n      \"salesUnitPrice\":45\r\n  }\r\n} "
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "2- M.updateProduct {{currentId}}",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "mutation ($values: ProductUpdateGLDtoInput!) {  \r\n    updateProduct(input: $values) {\r\n    id\r\n  }\r\n}",
                            "variables": "{\r\n  \"values\":{\r\n      \"id\":\"{{currentId}}\",\r\n      \"name\": \"Product update\",\r\n      \"comments\": \"comment update\",\r\n      \"salesUnitPrice\": 46\r\n  }\r\n} "
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "3- M.deleteProduct {{currentId}}",
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "mutation ($values:ProductDeleteGLDtoInput!) {\r\n    deleteProduct(input: $values) {\r\n    id\r\n  }\r\n}",
                            "variables": "{\r\n  \"values\":{\r\n    \"id\":\"{{currentId}}\"\r\n  }\r\n}"
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    }
                  ]
                },
                {
                  "name": "M.createProduct for a specific Unit & tax percentage",
                  "item": [
                    {
                      "name": "1- Q.taxes First Tax not DOM, Tax Group filled in {{taxGroupId}}",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "pm.test(\"Variables creation\", function () {\r",
                              "    let jsd = pm.response.json();\r",
                              "\r",
                              "    // Ensure the taxes query returns data and has at least one tax item\r",
                              "    if (jsd.data == null || jsd.data.taxes == null || jsd.data.taxes.edges.length === 0) {\r",
                              "        console.error(\"No tax data available to save as environment variable\");\r",
                              "        return;\r",
                              "    }\r",
                              "\r",
                              "    // Get the groupId from the first tax entry in the list\r",
                              "    let groupId = jsd.data.taxes.edges[0].node.groupId;\r",
                              "    if (groupId != null) {\r",
                              "        pm.environment.set(\"taxGroupId\", groupId);\r",
                              "        console.log(\"'taxGroupId' environment variable has been created : \" + pm.environment.get(\"taxGroupId\"));\r",
                              "    } else {\r",
                              "        console.error(\"groupId is missing in the tax data\");\r",
                              "    }\r",
                              "});\r",
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "query {\r\n    taxes(\r\n        first:1\r\n        where:{taxType:{neq:DOM}}\r\n    ) {\r\n        edges {\r\n            node {\r\n                name\r\n                groupName\r\n                groupId\r\n                percentage\r\n\r\n            }\r\n        }\r\n    }     \r\n}",
                            "variables": ""
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "2- Q.unitOfMeasurements, GRAM Unit filled in {{unitId}}",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "pm.test(\"Variables creation\", function () {\r",
                              "    let jsd = pm.response.json();\r",
                              "\r",
                              "    // Ensure the query returns data and has at least one item\r",
                              "    if (jsd.data == null || jsd.data.unitOfMeasurementSalesSetups == null || jsd.data.unitOfMeasurementSalesSetups.edges.length === 0) {\r",
                              "        console.error(\"No data available to save as environment variable\");\r",
                              "        return;\r",
                              "    }\r",
                              "\r",
                              "    // Get the id from the first entry in the list\r",
                              "    let id = jsd.data.unitOfMeasurementSalesSetups.edges[0].node.unitOfMeasurementId;\r",
                              "    if (id != null) {\r",
                              "        pm.environment.set(\"unitId\", id);\r",
                              "        console.log(\"'unitId' environment variable has been created : \" + pm.environment.get(\"unitId\"));\r",
                              "    } else {\r",
                              "        console.error(\"id is missing in the data\");\r",
                              "    }\r",
                              "});\r",
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "query {\r\n    unitOfMeasurementSalesSetups(\r\n        where: {\r\n            unitOfMeasurement: { name: { eq: GRAM } }\r\n        }\r\n    ) {\r\n        edges {\r\n            node {\r\n                unitOfMeasurementId\r\n                active\r\n                category\r\n            }\r\n        }\r\n    }\r\n}\r\n",
                            "variables": ""
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "3- M.createProduct - new id filled in {{currentid}}",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "pm.test(\"Variables creation\", function () {\r",
                              "    let jsd = pm.response.json();\r",
                              "\r",
                              "    if (jsd.data == null || jsd.data.createProduct == null)\r",
                              "        {console.error(\"Unable to save environment variable\");return;}\r",
                              "    pm.environment.set(\"currentId\", jsd.data.createProduct.id);\r",
                              "    console.log(\"'currentId' environment variable has been created : \" + pm.environment.get(\"currentId\"));\r",
                              "});\r",
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {}
                          }
                        },
                        {
                          "listen": "prerequest",
                          "script": {
                            "exec": [
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "mutation ($values: ProductCreateGLDtoInput!) {  \r\n    createProduct(input: $values) {\r\n    id\r\n  }\r\n}",
                            "variables": "{\r\n  \"values\":{\r\n      \"code\": \"PRODUCT03\",\r\n      \"name\": \"Test Product\",\r\n      \"category\":\"PRODUCT\",\r\n      \"comments\": \"comment\",\r\n      \"lineDescription\": \"Description Product\",\r\n      \"salesUnitPrice\":45,\r\n      \"unitOfMeasurementId\":\"{{unitId}}\",\r\n      \"taxGroupId\":\"{{taxGroupId}}\"\r\n  }\r\n} "
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "4- M.deleteProduct {{currentId}}",
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "mutation ($values:ProductDeleteGLDtoInput!) {\r\n    deleteProduct(input: $values) {\r\n    id\r\n  }\r\n}",
                            "variables": "{\r\n  \"values\":{\r\n    \"id\":\"{{currentId}}\"\r\n  }\r\n}"
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    }
                  ]
                },
                {
                  "name": "Q.Products - first is filled in {{currentId}}",
                  "event": [
                    {
                      "listen": "test",
                      "script": {
                        "exec": [
                          "pm.test(\"Status is OK 200\", function () {\r",
                          "    pm.response.to.have.status(200);\r",
                          "    pm.response.to.be.ok;\r",
                          "});\r",
                          "\r",
                          "pm.test(\"Response is JSon\", function () {\r",
                          "    pm.response.to.be.json;\r",
                          "});\r",
                          "\r",
                          "pm.test(\"Variables creation\", function () {\r",
                          "    let jsd = pm.response.json();\r",
                          "\r",
                          "    if (jsd.data == null || jsd.data.products.edges.length == 0){\r",
                          "        console.log(\"Unable to save environment variable\");return;\r",
                          "    }\r",
                          "    pm.environment.set(\"currentId\", jsd.data.products.edges[0].node.id);\r",
                          "    console.log(\"'currentId' environment variable has been created : \" + pm.environment.get(\"currentId\"));\r",
                          "});\r",
                          ""
                        ],
                        "type": "text/javascript",
                        "packages": {},
                        "requests": {}
                      }
                    }
                  ],
                  "request": {
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "query {\r\n  products(\r\n    first:500\r\n    order: [{ code: ASC }]\r\n   )\r\n   {\r\n    edges {\r\n      node {\r\n        id\r\n        code\r\n        name\r\n        category\r\n        unitOfMeasurement{\r\n            name\r\n            numberOfDecimals\r\n        }\r\n        salesUnitPrice\r\n        firstSalesDiscount\r\n        taxGroupId\r\n        taxes{\r\n            groupName\r\n            name\r\n            percentage\r\n            equivalenceSurchargePercentage\r\n            taxType\r\n        }\r\n        lineDescription\r\n        comments\r\n        creationDate\r\n        modificationDate\r\n        obsolete\r\n        salesAccountingAccountId\r\n        salesAccountingAccount{\r\n            code\r\n        }\r\n        salesDeliveryNoteBlockingEnabled\r\n        salesInvoiceBlockingEnabled\r\n        salesOrderBlockingEnabled\r\n        useWithholding\r\n      }\r\n    }\r\n    totalCount\r\n    pageInfo {\r\n      hasNextPage\r\n    }\r\n  }     \r\n}",
                        "variables": ""
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                },
                {
                  "name": "Q.Products filtered by Id",
                  "event": [
                    {
                      "listen": "test",
                      "script": {
                        "exec": [
                          "pm.test(\"Status is OK 200\", function () {\r",
                          "    pm.response.to.have.status(200);\r",
                          "    pm.response.to.be.ok;\r",
                          "});\r",
                          "\r",
                          "pm.test(\"Response is JSon\", function () {\r",
                          "    pm.response.to.be.json;\r",
                          "});\r",
                          ""
                        ],
                        "type": "text/javascript",
                        "packages": {}
                      }
                    }
                  ],
                  "request": {
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "query  ($id : UUID!) {\r\n  products \r\n  (where : { id : { eq : $id }}) {\r\n    edges {\r\n      node {\r\n        id\r\n        code\r\n        name\r\n        category\r\n        unitOfMeasurement{\r\n            name\r\n            numberOfDecimals\r\n        }\r\n        salesUnitPrice\r\n        firstSalesDiscount\r\n        taxGroupId\r\n        lineDescription\r\n        comments\r\n        creationDate\r\n        modificationDate\r\n        obsolete\r\n        salesAccountingAccountId\r\n        salesDeliveryNoteBlockingEnabled\r\n        salesInvoiceBlockingEnabled\r\n        salesOrderBlockingEnabled\r\n      }\r\n    }\r\n  }     \r\n}",
                        "variables": "{\r\n    \"id\":\"{{currentId}}\"\r\n}"
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                }
              ]
            },
            {
              "name": "⚙️ Product Price service",
              "item": [
                {
                  "name": "Product Price for a customer",
                  "item": [
                    {
                      "name": "1-Q.Products - first product by code",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "pm.test(\"Variables creation\", function () {\r",
                              "    let jsd = pm.response.json();\r",
                              "\r",
                              "    if (jsd.data == null || jsd.data.products.edges.length == 0)\r",
                              "        {console.error(\"Unable to save environment variable for product\");return;}\r",
                              "    pm.environment.set(\"productId\", jsd.data.products.edges[0].node.id);\r",
                              "    console.log(\"productId environment variable has been created : \" + pm.environment.get(\"productId\"));\r",
                              "});"
                            ],
                            "type": "text/javascript",
                            "packages": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "query {\r\n  products (\r\n       order: [{ code: ASC }]\r\n       where: {category:{neq:CONCEPT}}\r\n       first:1\r\n  ) {\r\n    edges {\r\n      node {\r\n        id\r\n        code\r\n        name\r\n      }\r\n    }\r\n  }     \r\n}",
                            "variables": ""
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "2-Q.customers - first activated + socialName starts by A",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "pm.test(\"Variables creation\", function () {\r",
                              "    let jsd = pm.response.json();\r",
                              "\r",
                              "    if (jsd.data == null || jsd.data.customers.edges.length == 0)\r",
                              "        {console.error(\"Unable to save environment variable for customer\");return;}\r",
                              "    pm.environment.set(\"customerId\", jsd.data.customers.edges[0].node.id);\r",
                              "    console.log(\"customerId environment variable has been created : \" + pm.environment.get(\"customerId\"));\r",
                              "});"
                            ],
                            "type": "text/javascript",
                            "packages": {}
                          }
                        }
                      ],
                      "request": {
                        "auth": {
                          "type": "bearer",
                          "bearer": [
                            {
                              "key": "token",
                              "value": "{{accessToken}}",
                              "type": "string"
                            }
                          ]
                        },
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "query {\r\n    customers (\r\n        order: [{ code: ASC }]\r\n        where: {\r\n            socialName: {startsWith: \"a\"}\r\n            disabled: {eq: false}\r\n            }\r\n        first:1\r\n        ) {\r\n        edges {\r\n            node {\r\n                  id\r\n                  code\r\n                  socialName\r\n            }\r\n        }\r\n    }   \r\n}",
                            "variables": ""
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "3- ⚙️ Q-Action.ProductPriceById",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "pm.test(\"Status is OK 200\", function () {\r",
                              "    pm.response.to.have.status(200);\r",
                              "    pm.response.to.be.ok;\r",
                              "});\r",
                              "\r",
                              "pm.test(\"Response is JSon\", function () {\r",
                              "    pm.response.to.be.json;\r",
                              "});\r",
                              ""
                            ],
                            "type": "text/javascript"
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "query($id: ID!, $productPrice: ProductPriceGLDtoInput!) {\r\n  productPriceById(id: $id, productPrice: $productPrice) {\r\n    price {\r\n      code\r\n      name\r\n      source\r\n      value\r\n    }\r\n    firstDiscount {\r\n      code\r\n      name\r\n      source\r\n      value\r\n    }\r\n    taxGroupId\r\n    taxId\r\n    equivalenceSurchargePercentage\r\n    taxPercentage\r\n    taxTreatmentId\r\n  }\r\n}",
                            "variables": "{\r\n    \"id\":\"{{productId}}\",\r\n    \"productPrice\" : {\r\n        \"documentDate\" : \"2023-10-17\",\r\n        \"quantity\" : 5,\r\n        \"customerId\":\"{{customerId}}\"\r\n    }\r\n}"
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    }
                  ]
                },
                {
                  "name": "Product Price for a lead (no customer)",
                  "item": [
                    {
                      "name": "1-Q.Products - first product by code",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "pm.test(\"Variables creation\", function () {\r",
                              "    let jsd = pm.response.json();\r",
                              "\r",
                              "    if (jsd.data == null || jsd.data.products.edges.length == 0)\r",
                              "        {console.error(\"Unable to save environment variable for product\");return;}\r",
                              "    pm.environment.set(\"productId\", jsd.data.products.edges[0].node.id);\r",
                              "    console.log(\"productId environment variable has been created : \" + pm.environment.get(\"productId\"));\r",
                              "});"
                            ],
                            "type": "text/javascript",
                            "packages": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "query {\r\n  products (\r\n       order: [{ code: ASC }]\r\n       where: {category:{neq:CONCEPT}}\r\n       first:1\r\n  ) {\r\n    edges {\r\n      node {\r\n        id\r\n        code\r\n        name\r\n      }\r\n    }\r\n  }     \r\n}",
                            "variables": ""
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "2-Q-Action.ProductPriceById Country=current legislation",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "pm.test(\"Status is OK 200\", function () {\r",
                              "    pm.response.to.have.status(200);\r",
                              "    pm.response.to.be.ok;\r",
                              "});\r",
                              "\r",
                              "pm.test(\"Response is JSon\", function () {\r",
                              "    pm.response.to.be.json;\r",
                              "});\r",
                              ""
                            ],
                            "type": "text/javascript"
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "query($id: ID!, $productPrice: ProductPriceGLDtoInput!) {\r\n  productPriceById(id: $id, productPrice: $productPrice) {\r\n    price {\r\n      code\r\n      name\r\n      source\r\n      value\r\n    }\r\n    firstDiscount {\r\n      code\r\n      name\r\n      source\r\n      value\r\n    }\r\n    taxGroupId\r\n    taxId\r\n    equivalenceSurchargePercentage\r\n    taxPercentage\r\n    taxTreatmentId\r\n  }\r\n}",
                            "variables": "{\r\n    \"id\":\"{{productId}}\",\r\n    \"productPrice\" : {\r\n        \"documentDate\" : \"2023-10-17\",\r\n        \"quantity\" : 5\r\n    }\r\n}"
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "3-Q.documentType 02 (country=VIES)",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "pm.test(\"Variables creation\", function () {\r",
                              "    let jsd = pm.response.json();\r",
                              "\r",
                              "    if (jsd.data == null || jsd.data.documentTypes.edges.length == 0)\r",
                              "        {console.error(\"Unable to save environment variable for documentTypes\");return;}\r",
                              "    pm.environment.set(\"documentTypeId\", jsd.data.documentTypes.edges[0].node.id);\r",
                              "    console.log(\"documentTypeId environment variable has been created : \" + pm.environment.get(\"documentTypeId\"));\r",
                              "});"
                            ],
                            "type": "text/javascript"
                          }
                        }
                      ],
                      "request": {
                        "auth": {
                          "type": "bearer",
                          "bearer": [
                            {
                              "key": "token",
                              "value": "{{accessToken}}",
                              "type": "string"
                            }
                          ]
                        },
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "query {\r\n    documentTypes (\r\n        where: {code: {eq:\"02\"}}\r\n    ) {\r\n        edges {\r\n            node {\r\n                id\r\n            }\r\n        }\r\n    }    \r\n}",
                            "variables": ""
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "4- ⚙️ Q-Action.ProductPriceById",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "pm.test(\"Status is OK 200\", function () {\r",
                              "    pm.response.to.have.status(200);\r",
                              "    pm.response.to.be.ok;\r",
                              "});\r",
                              "\r",
                              "pm.test(\"Response is JSon\", function () {\r",
                              "    pm.response.to.be.json;\r",
                              "});\r",
                              ""
                            ],
                            "type": "text/javascript"
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "query($id: ID!, $productPrice: ProductPriceGLDtoInput!) {\r\n  productPriceById(id: $id, productPrice: $productPrice) {\r\n    price {\r\n      code\r\n      name\r\n      source\r\n      value\r\n    }\r\n    firstDiscount {\r\n      code\r\n      name\r\n      source\r\n      value\r\n    }\r\n    taxGroupId\r\n    taxId\r\n    equivalenceSurchargePercentage\r\n    taxPercentage\r\n    taxTreatmentId\r\n  }\r\n}",
                            "variables": "{\r\n    \"id\":\"{{productId}}\",\r\n    \"productPrice\" : {\r\n        \"documentDate\" : \"2023-10-17\",\r\n        \"quantity\" : 5,\r\n        \"documentTypeId\":\"{{documentTypeId}}\"\r\n    }\r\n}"
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "5-Q.documentType 06 (country<>VIES)",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "pm.test(\"Variables creation\", function () {\r",
                              "    let jsd = pm.response.json();\r",
                              "\r",
                              "    if (jsd.data == null || jsd.data.documentTypes.edges.length == 0)\r",
                              "        {console.error(\"Unable to save environment variable for documentTypes\");return;}\r",
                              "    pm.environment.set(\"documentTypeId\", jsd.data.documentTypes.edges[0].node.id);\r",
                              "    console.log(\"documentTypeId environment variable has been created : \" + pm.environment.get(\"documentTypeId\"));\r",
                              "});"
                            ],
                            "type": "text/javascript"
                          }
                        }
                      ],
                      "request": {
                        "auth": {
                          "type": "bearer",
                          "bearer": [
                            {
                              "key": "token",
                              "value": "{{accessToken}}",
                              "type": "string"
                            }
                          ]
                        },
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "query {\r\n    documentTypes (\r\n        where: {code: {eq:\"06\"}}\r\n    ) {\r\n        edges {\r\n            node {\r\n                id\r\n            }\r\n        }\r\n    }    \r\n}",
                            "variables": ""
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "6- ⚙️ Q-Action.ProductPriceById",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "pm.test(\"Status is OK 200\", function () {\r",
                              "    pm.response.to.have.status(200);\r",
                              "    pm.response.to.be.ok;\r",
                              "});\r",
                              "\r",
                              "pm.test(\"Response is JSon\", function () {\r",
                              "    pm.response.to.be.json;\r",
                              "});\r",
                              ""
                            ],
                            "type": "text/javascript"
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "query($id: ID!, $productPrice: ProductPriceGLDtoInput!) {\r\n  productPriceById(id: $id, productPrice: $productPrice) {\r\n    price {\r\n      code\r\n      name\r\n      source\r\n      value\r\n    }\r\n    firstDiscount {\r\n      code\r\n      name\r\n      source\r\n      value\r\n    }\r\n    taxGroupId\r\n    taxId\r\n    equivalenceSurchargePercentage\r\n    taxPercentage\r\n    taxTreatmentId\r\n  }\r\n}",
                            "variables": "{\r\n    \"id\":\"{{productId}}\",\r\n    \"productPrice\" : {\r\n        \"documentDate\" : \"2023-10-17\",\r\n        \"quantity\" : 5,\r\n        \"documentTypeId\":\"{{documentTypeId}}\"\r\n    }\r\n}"
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    }
                  ]
                }
              ],
              "description": "The **ProductPrice** service is designed to provide detailed pricing and discount information for a product.  \nThis pricing and discounting information is calculated based on a variety of rules and parameters, ensuring the most accurate and tailored result for your specific needs.  \nThe service returns both the calculated discount and price for the product.\n\nExamples of usage include:\n\n1. Calling the price service for a **customer**.\n    \n2. Calling the price service for a lead where the **country is national** (equivalent to `legislationCode`).\n    \n3. Calling the price service for a lead where the **country is within the VIES** (VAT Information Exchange System) but not national.\n    \n4. Calling the price service for a lead where the **country does not fall into the aforementioned categories**."
            },
            {
              "name": "Sales Tariffs",
              "item": [
                {
                  "name": "Q.SalesTariffs / add var.",
                  "event": [
                    {
                      "listen": "test",
                      "script": {
                        "exec": [
                          "\r",
                          "\r",
                          "pm.test(\"Variables creation\", function () {\r",
                          "    let jsd = pm.response.json();\r",
                          "    if (jsd.data == null || jsd.data.salesTariffs.edges.length == 0){\r",
                          "        console.error(\"Unable to save environment variable\");return;\r",
                          "    }\r",
                          "    pm.environment.set(\"salesTariffId\", jsd.data.salesTariffs.edges[0].node.id);\r",
                          "    console.log(\"'salesTariffId' environment variable has been created : \" + pm.environment.get(\"salesTariffId\"));\r",
                          "});\r",
                          ""
                        ],
                        "type": "text/javascript",
                        "packages": {},
                        "requests": {}
                      }
                    },
                    {
                      "listen": "prerequest",
                      "script": {
                        "exec": [
                          ""
                        ],
                        "type": "text/javascript",
                        "packages": {},
                        "requests": {}
                      }
                    }
                  ],
                  "request": {
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "{\r\n  salesTariffs \r\n   (order : { code : ASC}) {\r\n    edges {\r\n      node {\r\n        id\r\n        code\r\n        creationDate\r\n        enabled\r\n        endDate\r\n        lines {\r\n          id\r\n          creationDate\r\n          enabled\r\n          endDate\r\n          indicatorValue\r\n          modificationDate\r\n          productId\r\n          startDate\r\n          stretchs {\r\n            id\r\n            creationDate\r\n            fromUnits\r\n            indicatorValue\r\n            modificationDate\r\n            toUnits\r\n          }\r\n        }\r\n        modificationDate\r\n        name\r\n        startDate\r\n        type\r\n      }\r\n    }\r\n    totalCount\r\n    pageInfo {\r\n      hasNextPage\r\n    }\r\n  }\r\n}\r\n",
                        "variables": ""
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                },
                {
                  "name": "Q.SalesTariffs filtered by Id",
                  "event": [
                    {
                      "listen": "test",
                      "script": {
                        "exec": [
                          ""
                        ],
                        "type": "text/javascript",
                        "packages": {}
                      }
                    }
                  ],
                  "request": {
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "query  ($id : UUID!) {\r\n  salesTariffs \r\n  (where : { id : { eq : $id }}) {\r\n    edges {\r\n      node {\r\n        id\r\n        code\r\n        creationDate\r\n        enabled\r\n        endDate\r\n        lines {\r\n          id\r\n          creationDate\r\n          enabled\r\n          endDate\r\n          indicatorValue\r\n          modificationDate\r\n          productId\r\n          startDate\r\n          stretchs {\r\n            id\r\n            creationDate\r\n            fromUnits\r\n            indicatorValue\r\n            modificationDate\r\n            toUnits\r\n          }\r\n        }\r\n        modificationDate\r\n        name\r\n        startDate\r\n        type\r\n      }\r\n    }\r\n  }\r\n}\r\n",
                        "variables": "{\r\n    \"id\":\"{{salesTariffId}}\"\r\n}"
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                }
              ]
            },
            {
              "name": "Sales Discounts",
              "item": [
                {
                  "name": "Q.SalesDiscounts / add var.",
                  "event": [
                    {
                      "listen": "test",
                      "script": {
                        "exec": [
                          "pm.test(\"Variables creation\", function () {\r",
                          "    let jsd = pm.response.json();\r",
                          "    if (jsd.data == null || jsd.data.salesDiscounts.edges.length == 0){\r",
                          "        console.error(\"Unable to save environment variable\");return;\r",
                          "    }\r",
                          "    pm.environment.set(\"salesDiscountId\", jsd.data.salesDiscounts.edges[0].node.id);\r",
                          "    console.log(\"'salesDiscountId' environment variable has been created : \" + pm.environment.get(\"salesDiscountId\"));\r",
                          "});\r",
                          ""
                        ],
                        "type": "text/javascript",
                        "packages": {},
                        "requests": {}
                      }
                    },
                    {
                      "listen": "prerequest",
                      "script": {
                        "exec": [
                          ""
                        ],
                        "type": "text/javascript",
                        "packages": {},
                        "requests": {}
                      }
                    }
                  ],
                  "request": {
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "{\r\n  salesDiscounts \r\n  (order : { code : ASC}) {\r\n    edges {\r\n      node {\r\n        id        \r\n        code\r\n        creationDate\r\n        enabled\r\n        endDate\r\n        lines {\r\n          id\r\n          creationDate\r\n          endDate\r\n          modificationDate\r\n          productId\r\n          startDate\r\n          firstDiscount          \r\n          stretchs {\r\n            id\r\n            creationDate\r\n            fromUnits\r\n            modificationDate\r\n            toUnits\r\n            firstDiscount\r\n          }\r\n        }\r\n        modificationDate\r\n        name\r\n        startDate\r\n      }\r\n    }\r\n    totalCount\r\n    pageInfo {\r\n      hasNextPage\r\n    }\r\n  }\r\n}\r\n",
                        "variables": ""
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                },
                {
                  "name": "Q.SalesDiscounts filtered by Id",
                  "event": [
                    {
                      "listen": "test",
                      "script": {
                        "exec": [
                          "pm.test(\"Status is OK 200\", function () {\r",
                          "    pm.response.to.have.status(200);\r",
                          "    pm.response.to.be.ok;\r",
                          "});\r",
                          "\r",
                          "pm.test(\"Response is JSon\", function () {\r",
                          "    pm.response.to.be.json;\r",
                          "});\r",
                          ""
                        ],
                        "type": "text/javascript"
                      }
                    }
                  ],
                  "request": {
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "query  ($id : UUID!) {\r\n  salesDiscounts \r\n  (where : { id : { eq : $id }})  {\r\n    edges {\r\n      node {\r\n        id        \r\n        code\r\n        creationDate\r\n        enabled\r\n        endDate\r\n        lines {\r\n          id\r\n          creationDate\r\n          endDate\r\n          modificationDate\r\n          productId\r\n          startDate\r\n          firstDiscount          \r\n          stretchs {\r\n            id\r\n            creationDate\r\n            fromUnits\r\n            modificationDate\r\n            toUnits\r\n            firstDiscount\r\n          }\r\n        }\r\n        modificationDate\r\n        name\r\n        startDate\r\n      }\r\n    }\r\n  }\r\n}\r\n",
                        "variables": "{\r\n    \"id\":\"{{salesDiscountId}}\"\r\n}"
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                }
              ]
            }
          ],
          "description": "This section outlines the foundational role of Products in the scope of sales transactions.  \nProducts serve as the foundational elements for creating and managing sales transactions. The Products entity is pivotal in creating and managing Sales Quotes, Sales Orders, Sales Delivery Notes, and Sales"
        },
        {
          "name": "Sales Documents",
          "item": [
            {
              "name": "Sales Quotes",
              "item": [
                {
                  "name": "M. create a quote, then update it, then decline it, then delete it.",
                  "item": [
                    {
                      "name": "1-Q.customers - first activated & current legislation",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "pm.test(\"Variables creation\", function () {\r",
                              "    let jsd = pm.response.json();\r",
                              "\r",
                              "    if (jsd.data == null || jsd.data.customers.edges.length == 0)\r",
                              "        {console.error(\"Unable to save environment variable for customer\");return;}\r",
                              "    pm.environment.set(\"customerId\", jsd.data.customers.edges[0].node.id);\r",
                              "    console.log(\"customerId environment variable has been created : \" + pm.environment.get(\"customerId\"));\r",
                              "});"
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        },
                        {
                          "listen": "prerequest",
                          "script": {
                            "exec": [
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        }
                      ],
                      "request": {
                        "auth": {
                          "type": "bearer",
                          "bearer": [
                            {
                              "key": "token",
                              "value": "{{accessToken}}",
                              "type": "string"
                            }
                          ]
                        },
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "query ($countryAcronym : String!) {\r\n    customers (\r\n        order: [{ code: ASC }]\r\n        where: {\r\n            countryAcronym: {eq:$countryAcronym}\r\n            disabled: {eq: false}\r\n            socialName: {neq:\"Postman demo\"}\r\n            }\r\n        first:1\r\n        ) {\r\n        edges {\r\n            node {\r\n                  id\r\n                  code\r\n                  socialName\r\n            }\r\n        }\r\n    }   \r\n}",
                            "variables": "{\r\n  \"countryAcronym\":\"{{legislationCode}}\"\r\n}"
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "2-Q.Products - get 3 products",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "pm.test(\"Create environment variables for all products\", function () {\r",
                              "    let jsd = pm.response.json();\r",
                              "\r",
                              "    if (!jsd.data || !jsd.data.products || !jsd.data.products.edges || jsd.data.products.edges.length === 0) {\r",
                              "        console.error(\"Invalid response structure or no products found\");\r",
                              "        return;\r",
                              "    }\r",
                              "\r",
                              "    jsd.data.products.edges.forEach((edge, index) => {\r",
                              "        let varName = `productId_${index + 1}`;\r",
                              "        pm.environment.set(varName, edge.node.id);\r",
                              "        console.log(`${varName} = ${edge.node.id}`);\r",
                              "    });\r",
                              "\r",
                              "    console.log(\"✅ Environment variables for all products have been created\");\r",
                              "});\r",
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        },
                        {
                          "listen": "prerequest",
                          "script": {
                            "exec": [
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "query {\r\n  products (\r\n       order: [{ code: ASC }]\r\n       where: {category:{neq:CONCEPT}}\r\n       first:3\r\n  ) {\r\n    edges {\r\n      node {\r\n        id\r\n        code\r\n        name\r\n      }\r\n    }\r\n  }     \r\n}",
                            "variables": ""
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "3-M.SalesQuote Create a quote",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "pm.test(\"Variable creation\", function () {\r",
                              "    let jsd = pm.response.json();\r",
                              "\r",
                              "    if (jsd.data == null)\r",
                              "        {console.error(\"Unable to save environment variable\");return;}\r",
                              "\r",
                              "    let result = jsd.data.createSalesQuote;\r",
                              "    pm.environment.set(\"currentId\", result.id);\r",
                              "    console.log(\"'currentId' environment variable has been created : \" + pm.environment.get(\"currentId\"));\r",
                              "});\r",
                              "\r",
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        },
                        {
                          "listen": "prerequest",
                          "script": {
                            "exec": [
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "mutation ($values: SalesQuoteCreateGLDtoInput!) {  \r\n    createSalesQuote(input: $values) {\r\n    id\r\n    operationalNumber\r\n  }\r\n}",
                            "variables": "{\r\n  \"values\": {\r\n    \"customerId\": \"{{customerId}}\",\r\n    \"lines\": [\r\n      {\r\n        \"productId\": \"{{productId_1}}\",\r\n        \"totalQuantity\": 50,\r\n        \"unitPrice\": 11,\r\n        \"firstDiscount\": 5\r\n      },\r\n      {\r\n        \"productId\": \"{{productId_2}}\",\r\n        \"productName\":\"specific name\",\r\n        \"totalQuantity\": 4,\r\n        \"unitPrice\": 22,\r\n        \"firstDiscount\": 0\r\n      }\r\n    ]\r\n  }\r\n}"
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "4-Q.SalesQuotes filtered by Id",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "pm.test(\"Create environment variables for document and its lines\", function () {\r",
                              "    const jsd = pm.response.json();\r",
                              "    if (!jsd?.data) return console.error(\"No data found in response\");\r",
                              "\r",
                              "    // Take the first document type found (salesQuotes, salesOrders, etc.)\r",
                              "    const docType = Object.keys(jsd.data).find(t => jsd.data[t]?.edges?.length > 0);\r",
                              "    if (!docType) return console.error(\"No recognized document type found in response\");\r",
                              "\r",
                              "    const documentNode = jsd.data[docType].edges[0].node;\r",
                              "\r",
                              "    // Document ID\r",
                              "    pm.environment.set(\"currentId\", documentNode.id);\r",
                              "    console.log(\"currentId =\", documentNode.id);\r",
                              "\r",
                              "    // Customer ID if present\r",
                              "    if (documentNode.customerId) {\r",
                              "        pm.environment.set(\"customerId\", documentNode.customerId);\r",
                              "        console.log(\"customerId =\", documentNode.customerId);\r",
                              "    }\r",
                              "\r",
                              "    // Line IDs\r",
                              "    documentNode.lines?.forEach((line, i) => {\r",
                              "        const varName = `lineId_${i + 1}`;\r",
                              "        pm.environment.set(varName, line.id);\r",
                              "        console.log(`${varName} = ${line.id}`);\r",
                              "    });\r",
                              "\r",
                              "    console.log(`✅ Variables created for document and ${documentNode.lines?.length || 0} lines`);\r",
                              "});\r",
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        },
                        {
                          "listen": "prerequest",
                          "script": {
                            "exec": [
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "query ($id : UUID!) {\r\n  salesQuotes (where : { id : { eq : $id }}) {\r\n    edges {\r\n      node {\r\n        id\r\n        customerId\r\n        documentDate\r\n        operationalNumber\r\n        salesDiscountGroupId\r\n        salesTariffId\r\n        socialName\r\n        status\r\n        totalGross\r\n        totalLiquid\r\n        totalNet\r\n        totalVat\r\n        deliveryAddress{\r\n            city\r\n            countryId\r\n            countryName\r\n            firstLine\r\n            province\r\n            secondLine\r\n            zipCode\r\n        }\r\n        mainAddress{\r\n            city\r\n            countryId\r\n            countryName\r\n            firstLine\r\n            name\r\n            province\r\n            secondLine\r\n            zipCode           \r\n        }\r\n        lines{\r\n            id\r\n            firstDiscount\r\n            pendingQuantity\r\n            productCode\r\n            productId\r\n            productName\r\n            status\r\n            totalNet\r\n            totalQuantity\r\n            unitPrice\r\n            vatPercentage            \r\n        }\r\n      }\r\n    }\r\n  }\r\n}",
                            "variables": "{\r\n  \"id\":\"{{currentId}}\"\r\n}"
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "5-M.SalesQuote Update [requestedAction]",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "mutation ($values: SalesQuoteUpdateGLDtoInput!) {  \r\n    updateSalesQuote(input: $values) {\r\n      id\r\n  }\r\n}",
                            "variables": "{\r\n  \"values\": {\r\n    \"id\":\"{{currentId}}\",\r\n    \"lines\": [\r\n      {\r\n        \"id\":\"{{lineId_1}}\",\r\n        \"totalQuantity\": 49\r\n      },\r\n      {\r\n        \"id\":\"{{lineId_2}}\",\r\n        \"requestedAction\":\"DELETE\"\r\n      },\r\n      {\r\n        \"productId\": \"{{productId_3}}\",\r\n        \"totalQuantity\": 2,\r\n        \"unitPrice\": 11,\r\n        \"firstDiscount\": 5\r\n      }\r\n    ]\r\n  }\r\n}"
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "6-M.SalesQuote Update [replaceAll]",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "mutation ($values: SalesQuoteUpdateGLDtoInput!) {  \r\n    updateSalesQuote(input: $values) {\r\n      id\r\n  }\r\n}",
                            "variables": "{\r\n  \"values\": {\r\n    \"id\":\"{{currentId}}\",\r\n    \"replaceAll\":[\"LINES\"],\r\n     \"lines\": [\r\n      {\r\n        \"productId\": \"{{productId_1}}\",\r\n        \"totalQuantity\": 49,\r\n        \"unitPrice\": 11,\r\n        \"firstDiscount\": 5\r\n      },\r\n      {\r\n        \"productId\": \"{{productId_3}}\",\r\n        \"totalQuantity\": 4,\r\n        \"unitPrice\": 22,\r\n        \"firstDiscount\": 0\r\n      }\r\n     ]\r\n  }\r\n}"
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "7-M.SalesQuote Decline By Id",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "mutation ($values: SalesQuoteUpdateGLDtoInput!) {  \r\n    updateSalesQuote(input: $values) {\r\n      id\r\n  }\r\n}",
                            "variables": "{\r\n  \"values\": {\r\n    \"id\":\"{{currentId}}\",\r\n    \"updateDocumentStatus\": \"DECLINE\",\r\n    \"declinedReason\":\"The customer found a better offer elsewhere\"\r\n  }\r\n}"
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "8-M.SalesQuote Cancel Decline By Id",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "mutation ($values: SalesQuoteUpdateGLDtoInput!) {  \r\n    updateSalesQuote(input: $values) {\r\n      id\r\n  }\r\n}",
                            "variables": "{\r\n  \"values\": {\r\n    \"id\":\"{{currentId}}\",\r\n    \"updateDocumentStatus\": \"CANCEL_DECLINE\"\r\n  }\r\n}"
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "9-M.SalesQuote Delete By Id",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              ""
                            ],
                            "type": "text/javascript"
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "mutation ($values: SalesQuoteDeleteGLDtoInput!) {  \r\n    deleteSalesQuote(input: $values) {\r\n      id\r\n  }\r\n}",
                            "variables": "{\r\n  \"values\": {\r\n    \"id\":\"{{currentId}}\"\r\n  }\r\n}"
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    }
                  ],
                  "description": "For these examples, you will need:\n\n1. At least one customer\n    \n2. At least two products\n    \n\nFor the example of modifying the quote, we start from the created quote.\n\n- We modify the quantity of the first line,\n- delete the second line,\n- and add a new line with the same product as the first line."
                },
                {
                  "name": "M.Create a quote for a lead (no customer)",
                  "item": [
                    {
                      "name": "1-Q.Products - first & second product by code",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "pm.test(\"Variables creation\", function () {\r",
                              "    let jsd = pm.response.json();\r",
                              "\r",
                              "    if (jsd.data == null || jsd.data.products.edges.length == 0)\r",
                              "        {console.error(\"Unable to save environment variable for product\");return;}\r",
                              "    pm.environment.set(\"firstProductId\", jsd.data.products.edges[0].node.id);\r",
                              "    pm.environment.set(\"secondProductId\", jsd.data.products.edges[1].node.id);\r",
                              "    console.log(\"firstproductId & secondProductId environment variable has been created : \" + pm.environment.get(\"firstProductId\")+\" - \"+pm.environment.get(\"secondProductId\"));\r",
                              "});"
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        },
                        {
                          "listen": "prerequest",
                          "script": {
                            "exec": [
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "query {\r\n  products (\r\n       order: [{ code: ASC }]\r\n       where: {category:{neq:CONCEPT}}\r\n       first:2\r\n  ) {\r\n    edges {\r\n      node {\r\n        id\r\n        code\r\n        name\r\n      }\r\n    }\r\n  }     \r\n}",
                            "variables": ""
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "2-M.SalesQuote Create a quote (VIES country)",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "pm.test(\"Variable creation\", function () {\r",
                              "    let jsd = pm.response.json();\r",
                              "\r",
                              "    if (jsd.data == null)\r",
                              "        {console.error(\"Unable to save environment variable\");return;}\r",
                              "\r",
                              "    let result = jsd.data.createSalesQuote;\r",
                              "    pm.environment.set(\"currentId\", result.id);\r",
                              "    console.log(\"'currentId' environment variable has been created : \" + pm.environment.get(\"currentId\"));\r",
                              "});\r",
                              "\r",
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "mutation ($values: SalesQuoteCreateGLDtoInput!) {  \r\n    createSalesQuote(input: $values) {\r\n    id\r\n    operationalNumber\r\n  }\r\n}",
                            "variables": "{\r\n  \"values\": {\r\n    \"socialName\": \"Wiener Handels GmbH\",\r\n    \"contactName\": \"Maximilian Bauer\",\r\n    \"contactPhone\": \"+43 1 2345678\",\r\n    \"contactEmail\": \"maximilian.bauers@wienerhandels.at\",\r\n    \"mainAddress\":[\r\n    {\r\n        \"firstLine\": \"Stephansplatz 1\",\r\n        \"secondLine\": \"Floor 3\",\r\n        \"zipCode\": \"1010\",\r\n        \"city\": \"Vienna\",\r\n        \"countryIsoCodeAlpha2\": \"AT\"\r\n        }\r\n    ],\r\n    \"lines\": [\r\n      {\r\n        \"productId\": \"{{firstProductId}}\",\r\n        \"totalQuantity\": 50,\r\n        \"unitPrice\": 11,\r\n        \"firstDiscount\": 5\r\n      },\r\n      {\r\n        \"productId\": \"{{secondProductId}}\",\r\n        \"productName\":\"specific name\",\r\n        \"totalQuantity\": 4,\r\n        \"unitPrice\": 22,\r\n        \"firstDiscount\": 0\r\n      }\r\n    ]\r\n  }\r\n}"
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "3-M.SalesQuote Create a quote not VIES country",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "pm.test(\"Variable creation\", function () {\r",
                              "    let jsd = pm.response.json();\r",
                              "\r",
                              "    if (jsd.data == null)\r",
                              "        {console.error(\"Unable to save environment variable\");return;}\r",
                              "\r",
                              "    let result = jsd.data.createSalesQuote;\r",
                              "    pm.environment.set(\"currentId\", result.id);\r",
                              "    console.log(\"'currentId' environment variable has been created : \" + pm.environment.get(\"currentId\"));\r",
                              "});\r",
                              "\r",
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "mutation ($values: SalesQuoteCreateGLDtoInput!) {  \r\n    createSalesQuote(input: $values) {\r\n    id\r\n    operationalNumber\r\n  }\r\n}",
                            "variables": "{\r\n  \"values\": {\r\n    \"socialName\": \"Tokyo Shoji KK\",\r\n    \"contactName\": \"Taro Tanaka\",\r\n    \"contactPhone\": \"+81 3-1234-5678\",\r\n    \"contactEmail\": \"taro.tanaka@tokyoshoji.jp\",\r\n    \"mainAddress\": [\r\n      {\r\n        \"firstLine\": \"2-5-1 Marunouchi\",\r\n        \"secondLine\": \"Chiyoda-ku\",\r\n        \"zipCode\": \"100-0005\",\r\n        \"city\": \"Tokyo\",\r\n        \"countryIsoCodeAlpha2\": \"JP\"\r\n      }\r\n    ],\r\n    \"lines\": [\r\n      {\r\n        \"productId\": \"{{firstProductId}}\",\r\n        \"totalQuantity\": 50,\r\n        \"unitPrice\": 11,\r\n        \"firstDiscount\": 5\r\n      },\r\n      {\r\n        \"productId\": \"{{secondProductId}}\",\r\n        \"productName\":\"specific name\",\r\n        \"totalQuantity\": 4,\r\n        \"unitPrice\": 22,\r\n        \"firstDiscount\": 0\r\n      }\r\n    ]\r\n  }\r\n}"
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    }
                  ],
                  "description": "For these examples, you will need:\n\n1. At least two products\n2. Specify the countryIsoCodeAlpha2 for the lead's country."
                },
                {
                  "name": "⚙️ Q.Document Pdf Email",
                  "item": [
                    {
                      "name": "1 - Q.SalesQuotes first element filled in {{currentId}}",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "pm.test(\"Variables creation\", function () {\r",
                              "    let jsd = pm.response.json();\r",
                              "\r",
                              "    if (jsd.data == null || jsd.data.salesQuotes.edges.length == 0)\r",
                              "        {console.error(\"Unable to save environment variable\");return;}\r",
                              "    pm.environment.set(\"currentId\", jsd.data.salesQuotes.edges[0].node.id);\r",
                              "    console.log(\"'currentId' environment variable has been created : \" + pm.environment.get(\"currentId\"));\r",
                              "});"
                            ],
                            "type": "text/javascript",
                            "packages": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "query  {\r\n  salesQuotes (first:1) {\r\n    edges {\r\n      node {\r\n        id\r\n      }\r\n    }\r\n  }\r\n}",
                            "variables": ""
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "2 - Q.userProfile Get Email From",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "pm.test(\"Variables creation\", function () {\r",
                              "    let jsonResponse = pm.response.json();\r",
                              "\r",
                              "    if (jsonResponse.data == null || jsonResponse.data.userProfile == null)\r",
                              "        {console.error(\"Unable to save environment variable\"); return;}\r",
                              "    pm.environment.set(\"emailFrom\", jsonResponse.data.userProfile.authenticationEmail);\r",
                              "    console.log(\"'emailFrom' environment variable has been created : \" + pm.environment.get(\"emailFrom\"));\r",
                              "});\r",
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "query {\r\n  userProfile {\r\n    authenticationEmail\r\n  }\r\n}\r\n",
                            "variables": ""
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "3 - Q.Email New Quote template",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "pm.test(\"Save emailTemplate fields\", function () {\r",
                              "    let jsonResponse = pm.response.json();\r",
                              "\r",
                              "    if (\r",
                              "        jsonResponse.data == null ||\r",
                              "        jsonResponse.data.emailTemplates == null ||\r",
                              "        jsonResponse.data.emailTemplates.edges == null ||\r",
                              "        jsonResponse.data.emailTemplates.edges.length === 0\r",
                              "    ) {\r",
                              "        console.error(\"Unable to save environment variables\");\r",
                              "        return;\r",
                              "    }\r",
                              "\r",
                              "    let template = jsonResponse.data.emailTemplates.edges[0].node;\r",
                              "\r",
                              "    let templateFields = {\r",
                              "        subject: template.emailSubject,\r",
                              "        message: template.emailMessage,\r",
                              "        sendMeCopy: template.sendMeCopy,\r",
                              "    };\r",
                              "\r",
                              "    pm.environment.set(\"emailSubject\", templateFields.subject);\r",
                              "    pm.environment.set(\"emailMessage\", templateFields.message);\r",
                              "    pm.environment.set(\"sendEmailCopy\", templateFields.sendMeCopy);\r",
                              "    console.log(\"Email template fields saved to environment variables\", templateFields);\r",
                              "});\r",
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "query {\r\n  emailTemplates(\r\n    first: 1\r\n    where: { documentType: { eq: NEW_QUOTE } }\r\n  ) {\r\n    edges {\r\n      node {\r\n        id\r\n        emailSubject\r\n        emailMessage\r\n        sendMeCopy\r\n      }\r\n    }\r\n  }\r\n}\r\n",
                            "variables": ""
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "4 - ⚙️ Q.DocumentPdfEmail",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "query($input: DocumentPdfEmailGLDtoInput!) {\r\n  documentPdfEmail(input: $input) {\r\n    type\r\n    id\r\n  }\r\n}",
                            "variables": "{\r\n  \"input\": {\r\n    \"type\": \"SALES_QUOTE\",\r\n    \"id\": \"{{currentId}}\",\r\n    \"emailFrom\": \"{{emailFrom}}\",\r\n    \"emailTo\": \"test@sage.com\",\r\n    \"emailBcc\": \"test1@sage.com\",\r\n    \"sendEmailCopy\": {{sendEmailCopy}},\r\n    \"emailSubject\": \"{{emailSubject}}\",\r\n    \"emailMessage\": \"{{emailMessage}}\"\r\n  }\r\n}\r\n"
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    }
                  ],
                  "description": "### DocumentPdfEmail Service\n\nThe DocumentPdfEmail service facilitates the sending of documents in PDF format via email directly through the API. This service simplifies the process of dispatching PDF documents to designated recipients, complete with options for CC and BCC.\n\n#### Important:\n\n- The sender of the email must be the current Sage Active user. Hence, in the example, the user's email is retrieved via `userProfile`.\n    \n- Replace `emailTo` and/or `emailCC` in the variables with email addresses that will allow you to receive the email, such as your personal email address."
                },
                {
                  "name": "Q.SalesQuotes - first id filled in {{currentId}}",
                  "event": [
                    {
                      "listen": "test",
                      "script": {
                        "exec": [
                          "pm.test(\"Variables creation\", function () {\r",
                          "    let jsd = pm.response.json();\r",
                          "\r",
                          "    if (jsd.data == null || jsd.data.salesQuotes.edges.length == 0)\r",
                          "        {console.error(\"Unable to save environment variable\");return;}\r",
                          "    pm.environment.set(\"currentId\", jsd.data.salesQuotes.edges[0].node.id);\r",
                          "    console.log(\"'currentId' environment variable has been created : \" + pm.environment.get(\"currentId\"));\r",
                          "});"
                        ],
                        "type": "text/javascript",
                        "packages": {},
                        "requests": {}
                      }
                    }
                  ],
                  "request": {
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "query {\r\n  salesQuotes (\r\n        first:500\r\n        order: { operationalNumber: DESC }\r\n    )  {\r\n        edges {\r\n            node {\r\n                sourceType\r\n                id\r\n                socialName\r\n                operationalNumber\r\n                creationDate\r\n                customerId\r\n                documentDate\r\n                status\r\n                declinedReason\r\n                totalNet\r\n                discount\r\n                documentTypeId\r\n                documentType{code name}\r\n                documentLanguage\r\n                externalReference\r\n                lines{\r\n                    order\r\n                    productCode\r\n                    productId\r\n                    productName\r\n                    unitOfMeasurement{\r\n                        name\r\n                        numberOfDecimals\r\n                    }\r\n                    totalQuantity\r\n                    unitPrice\r\n                    firstDiscount\r\n                    totalNet\r\n                    withholdingPercentage\r\n                    totalWithholding\r\n                    totalLiquidNoWithholding\r\n                }\r\n            }\r\n        }\r\n        totalCount\r\n        pageInfo {\r\n         hasNextPage\r\n        }\r\n    }\r\n}",
                        "variables": ""
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                },
                {
                  "name": "Q.SalesQuotes filtered by Id",
                  "event": [
                    {
                      "listen": "test",
                      "script": {
                        "exec": [
                          ""
                        ],
                        "type": "text/javascript",
                        "packages": {}
                      }
                    }
                  ],
                  "request": {
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "query ($id : UUID!) {\r\n  salesQuotes (where : { id : { eq : $id }}) {\r\n    edges {\r\n      node {\r\n        id\r\n        customerId\r\n        documentDate\r\n        operationalNumber\r\n        salesDiscountGroupId\r\n        salesTariffId\r\n        socialName\r\n        status\r\n        totalGross\r\n        totalLiquid\r\n        totalNet\r\n        totalVat\r\n        deliveryAddress{\r\n            city\r\n            countryId\r\n            countryName\r\n            firstLine\r\n            province\r\n            secondLine\r\n            zipCode\r\n        }\r\n        mainAddress{\r\n            city\r\n            countryId\r\n            countryName\r\n            firstLine\r\n            name\r\n            province\r\n            secondLine\r\n            zipCode           \r\n        }\r\n        lines{\r\n            id\r\n            firstDiscount\r\n            pendingQuantity\r\n            productCode\r\n            productId\r\n            productName\r\n            status\r\n            totalNet\r\n            totalQuantity\r\n            unitPrice\r\n            vatPercentage            \r\n        }\r\n      }\r\n    }\r\n  }\r\n}",
                        "variables": "{\r\n  \"id\":\"{{currentId}}\"\r\n}"
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                },
                {
                  "name": "⚙️ Q.DocumentPdfPreview",
                  "event": [
                    {
                      "listen": "test",
                      "script": {
                        "exec": [
                          ""
                        ],
                        "type": "text/javascript"
                      }
                    }
                  ],
                  "request": {
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "    query($input: DocumentPdfPreviewGLDtoInput!) {\r\n        documentPdfPreview(input: $input) {\r\n            type\r\n            id\r\n            pdfPreview  \r\n        }\r\n    }",
                        "variables": "{\r\n  \"input\": {\r\n    \"type\": \"SALES_QUOTE\",\r\n    \"id\": \"{{currentId}}\"\r\n  }\r\n}\r\n"
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                }
              ],
              "description": "Two examples of quote creation:\n\n- A quote for an **existing customer** in Sage Active.\n- A quote for a **lead**, meaning a customer not yet existing in Sage Active."
            },
            {
              "name": "Sales Orders",
              "item": [
                {
                  "name": "M.create an order, then update it, then close it, then delete it",
                  "item": [
                    {
                      "name": "1-Q.customers - first activated & current legislation",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "pm.test(\"Variables creation\", function () {\r",
                              "    let jsd = pm.response.json();\r",
                              "\r",
                              "    if (jsd.data == null || jsd.data.customers.edges.length == 0)\r",
                              "        {console.error(\"Unable to save environment variable for customer\");return;}\r",
                              "    pm.environment.set(\"customerId\", jsd.data.customers.edges[0].node.id);\r",
                              "    console.log(\"customerId environment variable has been created : \" + pm.environment.get(\"customerId\"));\r",
                              "});"
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        },
                        {
                          "listen": "prerequest",
                          "script": {
                            "exec": [
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        }
                      ],
                      "request": {
                        "auth": {
                          "type": "bearer",
                          "bearer": [
                            {
                              "key": "token",
                              "value": "{{accessToken}}",
                              "type": "string"
                            }
                          ]
                        },
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "query ($countryAcronym : String!) {\r\n    customers (\r\n        order: [{ code: ASC }]\r\n        where: {\r\n            countryAcronym: {eq:$countryAcronym}\r\n            disabled: {eq: false}\r\n            socialName: {neq:\"Postman demo\"}\r\n            }\r\n        first:1\r\n        ) {\r\n        edges {\r\n            node {\r\n                  id\r\n                  code\r\n                  socialName\r\n            }\r\n        }\r\n    }   \r\n}",
                            "variables": "{\r\n  \"countryAcronym\":\"{{legislationCode}}\"\r\n}"
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "2-Q.Products - get 3 products",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "pm.test(\"Create environment variables for all products\", function () {\r",
                              "    let jsd = pm.response.json();\r",
                              "\r",
                              "    if (!jsd.data || !jsd.data.products || !jsd.data.products.edges || jsd.data.products.edges.length === 0) {\r",
                              "        console.error(\"Invalid response structure or no products found\");\r",
                              "        return;\r",
                              "    }\r",
                              "\r",
                              "    jsd.data.products.edges.forEach((edge, index) => {\r",
                              "        let varName = `productId_${index + 1}`;\r",
                              "        pm.environment.set(varName, edge.node.id);\r",
                              "        console.log(`${varName} = ${edge.node.id}`);\r",
                              "    });\r",
                              "\r",
                              "    console.log(\"✅ Environment variables for all products have been created\");\r",
                              "});\r",
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        },
                        {
                          "listen": "prerequest",
                          "script": {
                            "exec": [
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "query {\r\n  products (\r\n       order: [{ code: ASC }]\r\n       where: {category:{neq:CONCEPT}}\r\n       first:3\r\n  ) {\r\n    edges {\r\n      node {\r\n        id\r\n        code\r\n        name\r\n      }\r\n    }\r\n  }     \r\n}",
                            "variables": ""
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "3-M.SalesOrder Create an order",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "pm.test(\"Variable creation\", function () {\r",
                              "    let jsd = pm.response.json();\r",
                              "\r",
                              "    if (jsd.data == null)\r",
                              "        {console.error(\"Unable to save environment variable\");return;}\r",
                              "\r",
                              "    let result = jsd.data.createSalesOrder;\r",
                              "    pm.environment.set(\"currentId\", result.id);\r",
                              "    console.log(\"'currentId' environment variable has been created : \" + pm.environment.get(\"currentId\"));\r",
                              "});\r",
                              "\r",
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "mutation ($values: SalesOrderCreateGLDtoInput!) {  \r\n    createSalesOrder(input: $values) {\r\n    id\r\n    operationalNumber\r\n  }\r\n}",
                            "variables": "{\r\n  \"values\": {\r\n    \"customerId\": \"{{customerId}}\",\r\n    \"lines\": [\r\n      {\r\n        \"productId\": \"{{productId_1}}\",\r\n        \"totalQuantity\": 50,\r\n        \"unitPrice\": 11,\r\n        \"firstDiscount\": 5\r\n      },\r\n      {\r\n        \"productId\": \"{{productId_2}}\",\r\n        \"productName\":\"specific name\",\r\n        \"totalQuantity\": 4,\r\n        \"unitPrice\": 22,\r\n        \"firstDiscount\": 0\r\n      }\r\n    ]\r\n  }\r\n}"
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "4-Q.SalesOrders filtered by Id",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "pm.test(\"Create environment variables for document and its lines\", function () {\r",
                              "    const jsd = pm.response.json();\r",
                              "    if (!jsd?.data) return console.error(\"No data found in response\");\r",
                              "\r",
                              "    // Take the first document type found (salesQuotes, salesOrders, etc.)\r",
                              "    const docType = Object.keys(jsd.data).find(t => jsd.data[t]?.edges?.length > 0);\r",
                              "    if (!docType) return console.error(\"No recognized document type found in response\");\r",
                              "\r",
                              "    const documentNode = jsd.data[docType].edges[0].node;\r",
                              "\r",
                              "    // Document ID\r",
                              "    pm.environment.set(\"currentId\", documentNode.id);\r",
                              "    console.log(\"currentId =\", documentNode.id);\r",
                              "\r",
                              "    // Customer ID if present\r",
                              "    if (documentNode.customerId) {\r",
                              "        pm.environment.set(\"customerId\", documentNode.customerId);\r",
                              "        console.log(\"customerId =\", documentNode.customerId);\r",
                              "    }\r",
                              "\r",
                              "    // Line IDs\r",
                              "    documentNode.lines?.forEach((line, i) => {\r",
                              "        const varName = `lineId_${i + 1}`;\r",
                              "        pm.environment.set(varName, line.id);\r",
                              "        console.log(`${varName} = ${line.id}`);\r",
                              "    });\r",
                              "\r",
                              "    console.log(`✅ Variables created for document and ${documentNode.lines?.length || 0} lines`);\r",
                              "});\r",
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        },
                        {
                          "listen": "prerequest",
                          "script": {
                            "exec": [
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "query ($id : UUID!) {\r\n  salesOrders (where : { id : { eq : $id }}) {\r\n    edges {\r\n      node {\r\n        id\r\n        customerId\r\n        documentDate\r\n        operationalNumber\r\n        salesDiscountGroupId\r\n        salesTariffId\r\n        socialName\r\n        status\r\n        totalGross\r\n        totalLiquid\r\n        totalNet\r\n        totalVat\r\n        deliveryAddress{\r\n            city\r\n            countryId\r\n            countryName\r\n            firstLine\r\n            province\r\n            secondLine\r\n            zipCode\r\n        }\r\n        mainAddress{\r\n            city\r\n            countryId\r\n            countryName\r\n            firstLine\r\n            name\r\n            province\r\n            secondLine\r\n            zipCode           \r\n        }\r\n        lines{\r\n            id\r\n            firstDiscount\r\n            pendingQuantity\r\n            productCode\r\n            productId\r\n            productName\r\n            status\r\n            totalNet\r\n            totalQuantity\r\n            unitPrice\r\n            vatPercentage            \r\n        }\r\n      }\r\n    }\r\n  }\r\n}",
                            "variables": "{\r\n  \"id\":\"{{currentId}}\"\r\n}"
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "5-M.SalesOrder Update [requestedAction]",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "mutation ($values: SalesOrderUpdateGLDtoInput!) {  \r\n    updateSalesOrder(input: $values) {\r\n      id\r\n  }\r\n}",
                            "variables": "{\r\n  \"values\": {\r\n    \"id\":\"{{currentId}}\",\r\n    \"lines\": [\r\n      {\r\n        \"id\":\"{{lineId_1}}\",\r\n        \"totalQuantity\": 49\r\n      },\r\n      {\r\n        \"id\":\"{{lineId_2}}\",\r\n        \"requestedAction\":\"DELETE\"\r\n      },\r\n      {\r\n        \"productId\": \"{{productId_3}}\",\r\n        \"totalQuantity\": 2,\r\n        \"unitPrice\": 11,\r\n        \"firstDiscount\": 5\r\n      }\r\n    ]\r\n  }\r\n}"
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "6-M.SalesOrder Update [replaceAll]",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "mutation ($values: SalesOrderUpdateGLDtoInput!) {  \r\n    updateSalesOrder(input: $values) {\r\n      id\r\n  }\r\n}",
                            "variables": "{\r\n  \"values\": {\r\n    \"id\":\"{{currentId}}\",\r\n    \"replaceAll\":[\"LINES\"],\r\n     \"lines\": [\r\n      {\r\n        \"productId\": \"{{productId_1}}\",\r\n        \"totalQuantity\": 49,\r\n        \"unitPrice\": 11,\r\n        \"firstDiscount\": 5\r\n      },\r\n      {\r\n        \"productId\": \"{{productId_3}}\",\r\n        \"totalQuantity\": 4,\r\n        \"unitPrice\": 22,\r\n        \"firstDiscount\": 0\r\n      }\r\n     ]\r\n  }\r\n}"
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "7-M.SalesOrder Close By Id",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "mutation ($values: SalesOrderUpdateGLDtoInput!) {  \r\n    updateSalesOrder(input: $values) {\r\n      id\r\n  }\r\n}",
                            "variables": "{\r\n  \"values\": {\r\n    \"id\":\"{{currentId}}\",\r\n    \"updateDocumentStatus\":\"CLOSE\"\r\n  }\r\n}"
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "8-M.SalesOrder Delete By Id",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              ""
                            ],
                            "type": "text/javascript"
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "mutation ($values: SalesOrderDeleteGLDtoInput!) {  \r\n    deleteSalesOrder(input: $values) {\r\n      id\r\n  }\r\n}",
                            "variables": "{\r\n  \"values\": {\r\n    \"id\":\"{{currentId}}\"\r\n  }\r\n}"
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    }
                  ],
                  "description": "For these examples, you will need:\n\n1. At least one customer\n2. At least two products\n    \n\nFor the example of modifying the order, we start from the created order.\n\n- We modify the quantity of the first line,\n- delete the second line,\n- and add a new line with the same product as the first line."
                },
                {
                  "name": "⚙️Q.Document Pdf Email",
                  "item": [
                    {
                      "name": "1 - Q.SalesOrders first element filled in {{currentId}}",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "pm.test(\"Variables creation\", function () {\r",
                              "    let jsd = pm.response.json();\r",
                              "\r",
                              "    if (jsd.data == null || jsd.data.salesOrders.edges.length == 0)\r",
                              "        {console.error(\"Unable to save environment variable\");return;}\r",
                              "    pm.environment.set(\"currentId\", jsd.data.salesOrders.edges[0].node.id);\r",
                              "    console.log(\"'currentId' environment variable has been created : \" + pm.environment.get(\"currentId\"));\r",
                              "});"
                            ],
                            "type": "text/javascript",
                            "packages": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "query  {\r\n  salesOrders (first:1) {\r\n    edges {\r\n      node {\r\n        id\r\n      }\r\n    }\r\n  }\r\n}",
                            "variables": ""
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "2 - Q.userProfile Get Email From",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "pm.test(\"Variables creation\", function () {\r",
                              "    let jsonResponse = pm.response.json();\r",
                              "\r",
                              "    if (jsonResponse.data == null || jsonResponse.data.userProfile == null)\r",
                              "        {console.error(\"Unable to save environment variable\"); return;}\r",
                              "    pm.environment.set(\"emailFrom\", jsonResponse.data.userProfile.authenticationEmail);\r",
                              "    console.log(\"'emailFrom' environment variable has been created : \" + pm.environment.get(\"emailFrom\"));\r",
                              "});\r",
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "query {\r\n  userProfile {\r\n    authenticationEmail\r\n  }\r\n}\r\n",
                            "variables": ""
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "3 - Q.Email New Order template",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "pm.test(\"Save emailTemplate fields\", function () {\r",
                              "    let jsonResponse = pm.response.json();\r",
                              "\r",
                              "    if (\r",
                              "        jsonResponse.data == null ||\r",
                              "        jsonResponse.data.emailTemplates == null ||\r",
                              "        jsonResponse.data.emailTemplates.edges == null ||\r",
                              "        jsonResponse.data.emailTemplates.edges.length === 0\r",
                              "    ) {\r",
                              "        console.error(\"Unable to save environment variables\");\r",
                              "        return;\r",
                              "    }\r",
                              "\r",
                              "    let template = jsonResponse.data.emailTemplates.edges[0].node;\r",
                              "\r",
                              "    let templateFields = {\r",
                              "        subject: template.emailSubject,\r",
                              "        message: template.emailMessage,\r",
                              "        sendMeCopy: template.sendMeCopy\r",
                              "    };\r",
                              "\r",
                              "    pm.environment.set(\"emailSubject\", templateFields.subject);\r",
                              "    pm.environment.set(\"emailMessage\", templateFields.message);\r",
                              "    pm.environment.set(\"sendEmailCopy\", templateFields.sendMeCopy);\r",
                              "\r",
                              "    console.log(\"Email template fields saved to environment variables\", templateFields);\r",
                              "});\r",
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "query {\r\n  emailTemplates(\r\n    first: 1\r\n    where: { documentType: { eq: NEW_ORDER } }\r\n  ) {\r\n    edges {\r\n      node {\r\n        id\r\n        emailSubject\r\n        emailMessage\r\n        sendMeCopy\r\n      }\r\n    }\r\n  }\r\n}\r\n",
                            "variables": ""
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "4 - ⚙️ Q.DocumentPdfEmail",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "query($input: DocumentPdfEmailGLDtoInput!) {\r\n  documentPdfEmail(input: $input) {\r\n    type\r\n    id\r\n  }\r\n}",
                            "variables": "{\r\n  \"input\": {\r\n    \"type\": \"SALES_ORDER\",\r\n    \"id\": \"{{currentId}}\",\r\n    \"emailFrom\": \"{{emailFrom}}\",\r\n    \"emailTo\": \"test@sage.com\",\r\n    \"emailBcc\": \"test1@sage.com\",\r\n    \"sendEmailCopy\": {{sendEmailCopy}},\r\n    \"emailSubject\": \"{{emailSubject}}\",\r\n    \"emailMessage\": \"{{emailMessage}}\"\r\n  }\r\n}\r\n"
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    }
                  ],
                  "description": "### DocumentPdfEmail Service\n\nThe DocumentPdfEmail service facilitates the sending of documents in PDF format via email directly through the API. This service simplifies the process of dispatching PDF documents to designated recipients, complete with options for CC and BCC.\n\n#### Important:\n\n- The sender of the email must be the current Sage Active user. Hence, in the example, the user's email is retrieved via `userProfile`.\n    \n- Replace `emailTo` and/or `emailCC` in the variables with email addresses that will allow you to receive the email, such as your personal email address."
                },
                {
                  "name": "Q.SalesOrders - first id filled in {{currentId}}",
                  "event": [
                    {
                      "listen": "test",
                      "script": {
                        "exec": [
                          "pm.test(\"Variables creation\", function () {\r",
                          "    let jsd = pm.response.json();\r",
                          "\r",
                          "    if (jsd.data == null || jsd.data.salesOrders.edges.length == 0)\r",
                          "        {console.error(\"Unable to save environment variable\");return;}\r",
                          "    pm.environment.set(\"currentId\", jsd.data.salesOrders.edges[0].node.id);\r",
                          "    console.log(\"'currentId' environment variable has been created : \" + pm.environment.get(\"currentId\"));\r",
                          "});"
                        ],
                        "type": "text/javascript",
                        "packages": {},
                        "requests": {}
                      }
                    }
                  ],
                  "request": {
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "query {\r\n  salesOrders (\r\n        first:500\r\n        order: { operationalNumber: DESC }\r\n    )  {\r\n        edges {\r\n            node {\r\n                sourceType\r\n                id\r\n                socialName\r\n                operationalNumber\r\n                creationDate\r\n                customerId\r\n                documentDate\r\n                status\r\n                totalNet\r\n                discount\r\n                documentTypeId\r\n                documentType{code name}\r\n                documentLanguage\r\n                externalReference\r\n                lines{\r\n                    order\r\n                    productCode\r\n                    productId\r\n                    productName\r\n                    totalQuantity\r\n                    unitPrice\r\n                    firstDiscount\r\n                    totalNet\r\n                    withholdingPercentage\r\n                    totalWithholding\r\n                    totalLiquidNoWithholding\r\n                }\r\n            }\r\n        }\r\n        totalCount\r\n        pageInfo {\r\n         hasNextPage\r\n        }\r\n    }\r\n}",
                        "variables": ""
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                },
                {
                  "name": "Q.SalesOrders filtered by Id",
                  "event": [
                    {
                      "listen": "test",
                      "script": {
                        "exec": [
                          ""
                        ],
                        "type": "text/javascript",
                        "packages": {}
                      }
                    }
                  ],
                  "request": {
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "query ($id : UUID!) {\r\n  salesOrders (where : { id : { eq : $id }}) {\r\n    edges {\r\n      node {\r\n        id\r\n        customerId\r\n        documentDate\r\n        operationalNumber\r\n        salesDiscountGroupId\r\n        salesTariffId\r\n        socialName\r\n        status\r\n        totalGross\r\n        totalLiquid\r\n        totalNet\r\n        totalVat\r\n        deliveryAddress{\r\n            city\r\n            countryId\r\n            countryName\r\n            firstLine\r\n            province\r\n            secondLine\r\n            zipCode\r\n        }\r\n        mainAddress{\r\n            city\r\n            countryId\r\n            countryName\r\n            firstLine\r\n            name\r\n            province\r\n            secondLine\r\n            zipCode           \r\n        }\r\n        lines{\r\n            id\r\n            firstDiscount\r\n            pendingQuantity\r\n            productCode\r\n            productId\r\n            productName\r\n            unitOfMeasurement{\r\n                name\r\n                numberOfDecimals\r\n            }\r\n            status\r\n            totalNet\r\n            totalQuantity\r\n            unitPrice\r\n            vatPercentage            \r\n        }\r\n      }\r\n    }\r\n  }\r\n}",
                        "variables": "{\r\n  \"id\":\"{{currentId}}\"\r\n}"
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                },
                {
                  "name": "⚙️ Q.DocumentPdfPreview",
                  "event": [
                    {
                      "listen": "test",
                      "script": {
                        "exec": [
                          ""
                        ],
                        "type": "text/javascript"
                      }
                    }
                  ],
                  "request": {
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "    query($input: DocumentPdfPreviewGLDtoInput!) {\r\n        documentPdfPreview(input: $input) {\r\n            type\r\n            id\r\n            pdfPreview  \r\n        }\r\n    }",
                        "variables": "{\r\n  \"input\": {\r\n    \"type\": \"SALES_ORDER\",\r\n    \"id\": \"{{currentId}}\"\r\n  }\r\n}\r\n"
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                }
              ],
              "description": "Example of order creation:\n\n- An order for an existing customer in Sage Active.\n    \n\nNote that, unlike quotes which allow for inputting leads, an order must **always** be associated with an **existing customer**."
            },
            {
              "name": "Sales Delivery notes",
              "item": [
                {
                  "name": "M.create an delivery note, then update it, then close it, then delete it",
                  "item": [
                    {
                      "name": "1-Q.customers - first activated & current legislation",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "pm.test(\"Variables creation\", function () {\r",
                              "    let jsd = pm.response.json();\r",
                              "\r",
                              "    if (jsd.data == null || jsd.data.customers.edges.length == 0)\r",
                              "        {console.error(\"Unable to save environment variable for customer\");return;}\r",
                              "    pm.environment.set(\"customerId\", jsd.data.customers.edges[0].node.id);\r",
                              "    console.log(\"customerId environment variable has been created : \" + pm.environment.get(\"customerId\"));\r",
                              "});"
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        },
                        {
                          "listen": "prerequest",
                          "script": {
                            "exec": [
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        }
                      ],
                      "request": {
                        "auth": {
                          "type": "bearer",
                          "bearer": [
                            {
                              "key": "token",
                              "value": "{{accessToken}}",
                              "type": "string"
                            }
                          ]
                        },
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "query ($countryAcronym : String!) {\r\n    customers (\r\n        order: [{ code: ASC }]\r\n        where: {\r\n            countryAcronym: {eq:$countryAcronym}\r\n            disabled: {eq: false}\r\n            socialName: {neq:\"Postman demo\"}\r\n            }\r\n        first:1\r\n        ) {\r\n        edges {\r\n            node {\r\n                  id\r\n                  code\r\n                  socialName\r\n            }\r\n        }\r\n    }   \r\n}",
                            "variables": "{\r\n  \"countryAcronym\":\"{{legislationCode}}\"\r\n}"
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "2-Q.Products - get 3 products",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "pm.test(\"Create environment variables for all products\", function () {\r",
                              "    let jsd = pm.response.json();\r",
                              "\r",
                              "    if (!jsd.data || !jsd.data.products || !jsd.data.products.edges || jsd.data.products.edges.length === 0) {\r",
                              "        console.error(\"Invalid response structure or no products found\");\r",
                              "        return;\r",
                              "    }\r",
                              "\r",
                              "    jsd.data.products.edges.forEach((edge, index) => {\r",
                              "        let varName = `productId_${index + 1}`;\r",
                              "        pm.environment.set(varName, edge.node.id);\r",
                              "        console.log(`${varName} = ${edge.node.id}`);\r",
                              "    });\r",
                              "\r",
                              "    console.log(\"✅ Environment variables for all products have been created\");\r",
                              "});\r",
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        },
                        {
                          "listen": "prerequest",
                          "script": {
                            "exec": [
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "query {\r\n  products (\r\n       order: [{ code: ASC }]\r\n       where: {category:{neq:CONCEPT}}\r\n       first:3\r\n  ) {\r\n    edges {\r\n      node {\r\n        id\r\n        code\r\n        name\r\n      }\r\n    }\r\n  }     \r\n}",
                            "variables": ""
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "3-M.SalesDeliveryNote Create a delivery note",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "pm.test(\"Variable creation\", function () {\r",
                              "    let jsd = pm.response.json();\r",
                              "\r",
                              "    if (jsd.data == null)\r",
                              "        {console.error(\"Unable to save environment variable\");return;}\r",
                              "\r",
                              "    let result = jsd.data.createSalesDeliveryNote;\r",
                              "    pm.environment.set(\"currentId\", result.id);\r",
                              "    console.log(\"'currentId' environment variable has been created : \" + pm.environment.get(\"currentId\"));\r",
                              "});\r",
                              "\r",
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "mutation ($values: SalesDeliveryNoteCreateGLDtoInput!) {  \r\n    createSalesDeliveryNote(input: $values) {\r\n    id\r\n    operationalNumber\r\n  }\r\n}",
                            "variables": "{\r\n  \"values\": {\r\n    \"customerId\": \"{{customerId}}\",\r\n    \"lines\": [\r\n      {\r\n        \"productId\": \"{{productId_1}}\",\r\n        \"totalQuantity\": 50,\r\n        \"unitPrice\": 11,\r\n        \"firstDiscount\": 5\r\n      },\r\n      {\r\n        \"productId\": \"{{productId_2}}\",\r\n        \"productName\":\"specific name\",\r\n        \"totalQuantity\": 4,\r\n        \"unitPrice\": 22,\r\n        \"firstDiscount\": 0\r\n      }\r\n    ]\r\n  }\r\n}"
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "4-Q.SalesDeliveryNotes filtered by Id",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "pm.test(\"Create environment variables for document and its lines\", function () {\r",
                              "    const jsd = pm.response.json();\r",
                              "    if (!jsd?.data) return console.error(\"No data found in response\");\r",
                              "\r",
                              "    // Take the first document type found (salesQuotes, salesOrders, etc.)\r",
                              "    const docType = Object.keys(jsd.data).find(t => jsd.data[t]?.edges?.length > 0);\r",
                              "    if (!docType) return console.error(\"No recognized document type found in response\");\r",
                              "\r",
                              "    const documentNode = jsd.data[docType].edges[0].node;\r",
                              "\r",
                              "    // Document ID\r",
                              "    pm.environment.set(\"currentId\", documentNode.id);\r",
                              "    console.log(\"currentId =\", documentNode.id);\r",
                              "\r",
                              "    // Customer ID if present\r",
                              "    if (documentNode.customerId) {\r",
                              "        pm.environment.set(\"customerId\", documentNode.customerId);\r",
                              "        console.log(\"customerId =\", documentNode.customerId);\r",
                              "    }\r",
                              "\r",
                              "    // Line IDs\r",
                              "    documentNode.lines?.forEach((line, i) => {\r",
                              "        const varName = `lineId_${i + 1}`;\r",
                              "        pm.environment.set(varName, line.id);\r",
                              "        console.log(`${varName} = ${line.id}`);\r",
                              "    });\r",
                              "\r",
                              "    console.log(`✅ Variables created for document and ${documentNode.lines?.length || 0} lines`);\r",
                              "});\r",
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        },
                        {
                          "listen": "prerequest",
                          "script": {
                            "exec": [
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "query ($id : UUID!) {\r\n  salesDeliveryNotes (where : { id : { eq : $id }}) {\r\n    edges {\r\n      node {\r\n        id\r\n        customerId\r\n        documentDate\r\n        operationalNumber\r\n        salesDiscountGroupId\r\n        salesTariffId\r\n        socialName\r\n        status\r\n        totalGross\r\n        totalLiquid\r\n        totalNet\r\n        totalVat\r\n        deliveryAddress{\r\n            city\r\n            countryId\r\n            countryName\r\n            firstLine\r\n            province\r\n            secondLine\r\n            zipCode\r\n        }\r\n        mainAddress{\r\n            city\r\n            countryId\r\n            countryName\r\n            firstLine\r\n            name\r\n            province\r\n            secondLine\r\n            zipCode           \r\n        }\r\n        lines{\r\n            id\r\n            firstDiscount\r\n            productCode\r\n            productId\r\n            productName\r\n            totalNet\r\n            totalQuantity\r\n            unitPrice\r\n            vatPercentage            \r\n        }\r\n      }\r\n    }\r\n  }\r\n}",
                            "variables": "{\r\n  \"id\":\"{{currentId}}\"\r\n}"
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "5-M.SalesDeliveryNote Update [requestedAction]",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "mutation ($values: SalesDeliveryNoteUpdateGLDtoInput!) {  \r\n    updateSalesDeliveryNote(input: $values) {\r\n      id\r\n  }\r\n}",
                            "variables": "{\r\n  \"values\": {\r\n    \"id\":\"{{currentId}}\",\r\n    \"lines\": [\r\n      {\r\n        \"id\":\"{{lineId_1}}\",\r\n        \"totalQuantity\": 49\r\n      },\r\n      {\r\n        \"id\":\"{{lineId_2}}\",\r\n        \"requestedAction\":\"DELETE\"\r\n      },\r\n      {\r\n        \"productId\": \"{{productId_3}}\",\r\n        \"totalQuantity\": 2,\r\n        \"unitPrice\": 11,\r\n        \"firstDiscount\": 5\r\n      }\r\n    ]\r\n  }\r\n}"
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "6-M.SalesDeliveryNote Update [replaceAll]",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "mutation ($values: SalesDeliveryNoteUpdateGLDtoInput!) {  \r\n    updateSalesDeliveryNote(input: $values) {\r\n      id\r\n  }\r\n}",
                            "variables": "{\r\n  \"values\": {\r\n    \"id\":\"{{currentId}}\",\r\n    \"replaceAll\":[\"LINES\"],\r\n     \"lines\": [\r\n      {\r\n        \"productId\": \"{{productId_1}}\",\r\n        \"totalQuantity\": 49,\r\n        \"unitPrice\": 11,\r\n        \"firstDiscount\": 5\r\n      },\r\n      {\r\n        \"productId\": \"{{productId_3}}\",\r\n        \"totalQuantity\": 4,\r\n        \"unitPrice\": 22,\r\n        \"firstDiscount\": 0\r\n      }\r\n     ]\r\n  }\r\n}"
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "7-M.SalesDeliveryNotes Close By Id",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "mutation ($values: SalesDeliveryNoteUpdateGLDtoInput!) {  \r\n    updateSalesDeliveryNote(input: $values) {\r\n      id\r\n  }\r\n}",
                            "variables": "{\r\n  \"values\": {\r\n    \"id\":\"{{currentId}}\",\r\n    \"updateDocumentStatus\":\"CLOSE\"\r\n  }\r\n}"
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "8-M.SalesDeliveryNote Delete By Id",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              ""
                            ],
                            "type": "text/javascript"
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "mutation ($values: SalesDeliveryNoteDeleteGLDtoInput!) {  \r\n    deleteSalesDeliveryNote(input: $values) {\r\n      id\r\n  }\r\n}",
                            "variables": "{\r\n  \"values\": {\r\n    \"id\":\"{{currentId}}\"\r\n  }\r\n}"
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    }
                  ],
                  "description": "For these examples, you will need:\n\n1. At least one customer\n2. At least two products\n    \n\nFor the example of modifying the delivery note, we start from the created delivery note.\n\n- We modify the quantity of the first line,\n- delete the second line,\n- and add a new line with the same product as the first line."
                },
                {
                  "name": "⚙️ Q.Document Pdf Email",
                  "item": [
                    {
                      "name": "1 - Q.SalesDeliveryNotes first element filled in {{currentId}}",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "pm.test(\"Variables creation\", function () {\r",
                              "    let jsd = pm.response.json();\r",
                              "\r",
                              "    if (jsd.data == null || jsd.data.salesDeliveryNotes .edges.length == 0)\r",
                              "        {console.error(\"Unable to save environment variable\");return;}\r",
                              "    pm.environment.set(\"currentId\", jsd.data.salesDeliveryNotes .edges[0].node.id);\r",
                              "    console.log(\"'currentId' environment variable has been created : \" + pm.environment.get(\"currentId\"));\r",
                              "});"
                            ],
                            "type": "text/javascript",
                            "packages": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "query  {\r\n  salesDeliveryNotes  (first:1) {\r\n    edges {\r\n      node {\r\n        id\r\n      }\r\n    }\r\n  }\r\n}",
                            "variables": ""
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "2 - Q.userProfile Get Email From",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "pm.test(\"Variables creation\", function () {\r",
                              "    let jsonResponse = pm.response.json();\r",
                              "\r",
                              "    if (jsonResponse.data == null || jsonResponse.data.userProfile == null)\r",
                              "        {console.error(\"Unable to save environment variable\"); return;}\r",
                              "    pm.environment.set(\"emailFrom\", jsonResponse.data.userProfile.authenticationEmail);\r",
                              "    console.log(\"'emailFrom' environment variable has been created : \" + pm.environment.get(\"emailFrom\"));\r",
                              "});\r",
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "query {\r\n  userProfile {\r\n    authenticationEmail\r\n  }\r\n}\r\n",
                            "variables": ""
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "3 - Q.Email New Delivery Note template",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "pm.test(\"Save emailTemplate fields\", function () {\r",
                              "    let jsonResponse = pm.response.json();\r",
                              "\r",
                              "    if (\r",
                              "        jsonResponse.data == null ||\r",
                              "        jsonResponse.data.emailTemplates == null ||\r",
                              "        jsonResponse.data.emailTemplates.edges == null ||\r",
                              "        jsonResponse.data.emailTemplates.edges.length === 0\r",
                              "    ) {\r",
                              "        console.error(\"Unable to save environment variables\");\r",
                              "        return;\r",
                              "    }\r",
                              "\r",
                              "    let template = jsonResponse.data.emailTemplates.edges[0].node;\r",
                              "\r",
                              "    let templateFields = {\r",
                              "        subject: template.emailSubject,\r",
                              "        message: template.emailMessage,\r",
                              "        sendMeCopy: template.sendMeCopy,\r",
                              "    };\r",
                              "\r",
                              "    pm.environment.set(\"emailSubject\", templateFields.subject);\r",
                              "    pm.environment.set(\"emailMessage\", templateFields.message);\r",
                              "    pm.environment.set(\"sendEmailCopy\", templateFields.sendMeCopy);\r",
                              "\r",
                              "    console.log(\"Email template fields saved to environment variables\", templateFields);\r",
                              "});\r",
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "query {\r\n  emailTemplates(\r\n    first: 1\r\n    where: { documentType: { eq: NEW_DELIVERY_NOTE } }\r\n  ) {\r\n    edges {\r\n      node {\r\n        id\r\n        emailSubject\r\n        emailMessage\r\n        sendMeCopy\r\n      }\r\n    }\r\n  }\r\n}\r\n",
                            "variables": ""
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "2 - ⚙️ Q.DocumentPdfEmail",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "query($input: DocumentPdfEmailGLDtoInput!) {\r\n  documentPdfEmail(input: $input) {\r\n    type\r\n    id\r\n  }\r\n}",
                            "variables": "{\r\n  \"input\": {\r\n    \"type\": \"SALES_DELIVERY_NOTE\",\r\n    \"id\": \"{{currentId}}\",\r\n    \"emailFrom\": \"{{emailFrom}}\",\r\n    \"emailTo\": \"test@sage.com\",\r\n    \"emailBcc\": \"test1@sage.com\",\r\n    \"sendEmailCopy\": {{sendEmailCopy}},\r\n    \"emailSubject\": \"{{emailSubject}}\",\r\n    \"emailMessage\": \"{{emailMessage}}\"\r\n  }\r\n}\r\n"
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    }
                  ],
                  "description": "### DocumentPdfEmail Service\n\nThe DocumentPdfEmail service facilitates the sending of documents in PDF format via email directly through the API. This service simplifies the process of dispatching PDF documents to designated recipients, complete with options for CC and BCC.\n\n#### Important:\n\n- The sender of the email must be the current Sage Active user. Hence, in the example, the user's email is retrieved via `userProfile`.\n    \n- Replace `emailTo` and/or `emailCC` in the variables with email addresses that will allow you to receive the email, such as your personal email address."
                },
                {
                  "name": "Q.SalesDeliveryNotes - first id filled in {{currentId}}",
                  "event": [
                    {
                      "listen": "test",
                      "script": {
                        "exec": [
                          "pm.test(\"Variables creation\", function () {\r",
                          "    let jsd = pm.response.json();\r",
                          "\r",
                          "    if (jsd.data == null || jsd.data.salesDeliveryNotes.edges.length == 0)\r",
                          "        {console.error(\"Unable to save environment variable\");return;}\r",
                          "    pm.environment.set(\"currentId\", jsd.data.salesDeliveryNotes.edges[0].node.id);\r",
                          "    console.log(\"'currentId' environment variable has been created : \" + pm.environment.get(\"currentId\"));\r",
                          "});"
                        ],
                        "type": "text/javascript",
                        "packages": {},
                        "requests": {}
                      }
                    }
                  ],
                  "request": {
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "query {\r\n  salesDeliveryNotes (\r\n        first:500\r\n        order: { operationalNumber: DESC }\r\n    )  {\r\n        edges {\r\n            node {\r\n                sourceType\r\n                id\r\n                socialName\r\n                operationalNumber\r\n                creationDate\r\n                customerId\r\n                documentDate\r\n                status\r\n                totalNet\r\n                discount\r\n                documentTypeId\r\n                documentType{code name}\r\n                documentLanguage\r\n                externalReference\r\n                lines{\r\n                    productCode\r\n                    productId\r\n                    productName\r\n                    totalQuantity\r\n                    unitPrice\r\n                    firstDiscount\r\n                    totalNet\r\n                    withholdingPercentage\r\n                    totalWithholding\r\n                    totalLiquidNoWithholding\r\n                }\r\n            }\r\n        }\r\n        totalCount\r\n        pageInfo {\r\n         hasNextPage\r\n        }\r\n    }\r\n}",
                        "variables": ""
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                },
                {
                  "name": "Q.SalesDeliveryNotes filtered by Id",
                  "event": [
                    {
                      "listen": "test",
                      "script": {
                        "exec": [
                          ""
                        ],
                        "type": "text/javascript",
                        "packages": {}
                      }
                    }
                  ],
                  "request": {
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "query ($id : UUID!) {\r\n  salesDeliveryNotes (where : { id : { eq : $id }}) {\r\n    edges {\r\n      node {\r\n        id\r\n        customerId\r\n        documentDate\r\n        operationalNumber\r\n        salesDiscountGroupId\r\n        salesTariffId\r\n        socialName\r\n        status\r\n        totalGross\r\n        totalLiquid\r\n        totalNet\r\n        totalVat\r\n        deliveryAddress{\r\n            city\r\n            countryId\r\n            countryName\r\n            firstLine\r\n            province\r\n            secondLine\r\n            zipCode\r\n        }\r\n        mainAddress{\r\n            city\r\n            countryId\r\n            countryName\r\n            firstLine\r\n            name\r\n            province\r\n            secondLine\r\n            zipCode           \r\n        }\r\n        lines{\r\n            id\r\n            firstDiscount\r\n            productCode\r\n            productId\r\n            productName\r\n            unitOfMeasurement{\r\n                name\r\n                numberOfDecimals\r\n            }\r\n            totalNet\r\n            totalQuantity\r\n            unitPrice\r\n            vatPercentage            \r\n        }\r\n      }\r\n    }\r\n  }\r\n}",
                        "variables": "{\r\n  \"id\":\"{{currentId}}\"\r\n}"
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                },
                {
                  "name": "⚙️ Q.DocumentPdfPreview",
                  "event": [
                    {
                      "listen": "test",
                      "script": {
                        "exec": [
                          ""
                        ],
                        "type": "text/javascript"
                      }
                    }
                  ],
                  "request": {
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "    query($input: DocumentPdfPreviewGLDtoInput!) {\r\n        documentPdfPreview(input: $input) {\r\n            type\r\n            id\r\n            pdfPreview  \r\n        }\r\n    }",
                        "variables": "{\r\n  \"input\": {\r\n    \"type\": \"SALES_DELIVERY_NOTE\",\r\n    \"id\": \"{{currentId}}\"\r\n  }\r\n}\r\n"
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                }
              ],
              "description": "Example of delivery note creation:\n\n- A delivery note for an existing customer in Sage Active.\n    \n\nNote that, unlike quotes which allow for inputting leads, a delivery note must **always** be associated with an **existing customer**."
            },
            {
              "name": "Sales Invoice",
              "item": [
                {
                  "name": "M.create an invoice, then update it, then delete it",
                  "item": [
                    {
                      "name": "1-Q.accountingExercises - most recently opened, startDate filled in {{dateInFirstExercice}}",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "pm.test(\"Variables creation\", function () {\r",
                              "    let jsd = pm.response.json();\r",
                              "    console.log(jsd.data.accountingExercises.edges[0].node.id);\r",
                              "    if (jsd.data == null || jsd.data.accountingExercises.edges.length == 0)\r",
                              "        {console.error(\"Unable to save environment variable\");return;}\r",
                              "    pm.environment.set(\"dateInFirstExercice\",jsd.data.accountingExercises.edges[0].node.startDate);\r",
                              "    console.log(\"'dateInFirstExercice' environment variable has been created : \" + pm.environment.get(\"dateInFirstExercice\"));\r",
                              "});\r",
                              "\r",
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "query {\r\n    accountingExercises(\r\n        where: {status: {eq: OPEN}}\r\n        first:1\r\n        order:{startDate:DESC}\r\n        ) {\r\n        edges {\r\n            node {\r\n               startDate\r\n            }\r\n        }\r\n    }     \r\n}",
                            "variables": ""
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "2-Q.customers - first activated & current legislation",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "pm.test(\"Variables creation\", function () {\r",
                              "    let jsd = pm.response.json();\r",
                              "\r",
                              "    if (jsd.data == null || jsd.data.customers.edges.length == 0)\r",
                              "        {console.error(\"Unable to save environment variable for customer\");return;}\r",
                              "    pm.environment.set(\"customerId\", jsd.data.customers.edges[0].node.id);\r",
                              "    console.log(\"customerId environment variable has been created : \" + pm.environment.get(\"customerId\"));\r",
                              "});"
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        },
                        {
                          "listen": "prerequest",
                          "script": {
                            "exec": [
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        }
                      ],
                      "request": {
                        "auth": {
                          "type": "bearer",
                          "bearer": [
                            {
                              "key": "token",
                              "value": "{{accessToken}}",
                              "type": "string"
                            }
                          ]
                        },
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "query ($countryAcronym : String!) {\r\n    customers (\r\n        order: [{ code: ASC }]\r\n        where: {\r\n            countryAcronym: {eq:$countryAcronym}\r\n            disabled: {eq: false}\r\n            socialName: {neq:\"Postman demo\"}\r\n            }\r\n        first:1\r\n        ) {\r\n        edges {\r\n            node {\r\n                  id\r\n                  code\r\n                  socialName\r\n            }\r\n        }\r\n    }   \r\n}",
                            "variables": "{\r\n  \"countryAcronym\":\"{{legislationCode}}\"\r\n}"
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "3-Q.Products - get 3 products",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "pm.test(\"Create environment variables for all products\", function () {\r",
                              "    let jsd = pm.response.json();\r",
                              "\r",
                              "    if (!jsd.data || !jsd.data.products || !jsd.data.products.edges || jsd.data.products.edges.length === 0) {\r",
                              "        console.error(\"Invalid response structure or no products found\");\r",
                              "        return;\r",
                              "    }\r",
                              "\r",
                              "    jsd.data.products.edges.forEach((edge, index) => {\r",
                              "        let varName = `productId_${index + 1}`;\r",
                              "        pm.environment.set(varName, edge.node.id);\r",
                              "        console.log(`${varName} = ${edge.node.id}`);\r",
                              "    });\r",
                              "\r",
                              "    console.log(\"✅ Environment variables for all products have been created\");\r",
                              "});\r",
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        },
                        {
                          "listen": "prerequest",
                          "script": {
                            "exec": [
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "query {\r\n  products (\r\n       order: [{ code: ASC }]\r\n       where: {category:{neq:CONCEPT}}\r\n       first:3\r\n  ) {\r\n    edges {\r\n      node {\r\n        id\r\n        code\r\n        name\r\n      }\r\n    }\r\n  }     \r\n}",
                            "variables": ""
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "4-M.SalesInvoice Create an invoice",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "pm.test(\"Variable creation\", function () {\r",
                              "    let jsd = pm.response.json();\r",
                              "\r",
                              "    if (jsd.data == null)\r",
                              "        {console.error(\"Unable to save environment variable\");return;}\r",
                              "\r",
                              "    let result = jsd.data.createSalesInvoice;\r",
                              "    pm.environment.set(\"currentId\", result.id);\r",
                              "    console.log(\"'currentId' environment variable has been created : \" + pm.environment.get(\"currentId\"));\r",
                              "});\r",
                              "\r",
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "mutation ($values: SalesInvoiceCreateGLDtoInput!) {  \r\n    createSalesInvoice(input: $values) {\r\n    id\r\n  }\r\n}",
                            "variables": "{\r\n  \"values\": {\r\n    \"customerId\": \"{{customerId}}\",\r\n    \"documentDate\": \"{{dateInFirstExercice}}\",\r\n    \"lines\": [\r\n      {\r\n        \"productId\": \"{{productId_1}}\",\r\n        \"totalQuantity\": 50,\r\n        \"unitPrice\": 11,\r\n        \"firstDiscount\": 5\r\n      },\r\n      {\r\n        \"productId\": \"{{productId_2}}\",\r\n        \"productName\":\"specific name\",\r\n        \"totalQuantity\": 4,\r\n        \"unitPrice\": 22,\r\n        \"firstDiscount\": 0\r\n      }\r\n    ]\r\n  }\r\n}"
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "5-Q.SalesInvoices filtered by Id",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "pm.test(\"Create environment variables for document and its lines\", function () {\r",
                              "    const jsd = pm.response.json();\r",
                              "    if (!jsd?.data) return console.error(\"No data found in response\");\r",
                              "\r",
                              "    // Take the first document type found (salesQuotes, salesOrders, etc.)\r",
                              "    const docType = Object.keys(jsd.data).find(t => jsd.data[t]?.edges?.length > 0);\r",
                              "    if (!docType) return console.error(\"No recognized document type found in response\");\r",
                              "\r",
                              "    const documentNode = jsd.data[docType].edges[0].node;\r",
                              "\r",
                              "    // Document ID\r",
                              "    pm.environment.set(\"currentId\", documentNode.id);\r",
                              "    console.log(\"currentId =\", documentNode.id);\r",
                              "\r",
                              "    // Customer ID if present\r",
                              "    if (documentNode.customerId) {\r",
                              "        pm.environment.set(\"customerId\", documentNode.customerId);\r",
                              "        console.log(\"customerId =\", documentNode.customerId);\r",
                              "    }\r",
                              "\r",
                              "    // Line IDs\r",
                              "    documentNode.lines?.forEach((line, i) => {\r",
                              "        const varName = `lineId_${i + 1}`;\r",
                              "        pm.environment.set(varName, line.id);\r",
                              "        console.log(`${varName} = ${line.id}`);\r",
                              "    });\r",
                              "\r",
                              "    console.log(`✅ Variables created for document and ${documentNode.lines?.length || 0} lines`);\r",
                              "});\r",
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        },
                        {
                          "listen": "prerequest",
                          "script": {
                            "exec": [
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "query ($id : UUID!) {\r\n  salesInvoices (where : { id : { eq : $id }}) {\r\n    edges {\r\n      node {\r\n        id\r\n        customerId\r\n        documentDate\r\n        operationalNumber\r\n        salesDiscountGroupId\r\n        salesTariffId\r\n        socialName\r\n        status\r\n        totalGross\r\n        totalLiquid\r\n        totalNet\r\n        totalVat\r\n        deliveryAddress{\r\n            city\r\n            countryId\r\n            countryName\r\n            firstLine\r\n            province\r\n            secondLine\r\n            zipCode\r\n        }\r\n        mainAddress{\r\n            city\r\n            countryId\r\n            countryName\r\n            firstLine\r\n            name\r\n            province\r\n            secondLine\r\n            zipCode           \r\n        }\r\n        lines{\r\n            id\r\n            firstDiscount\r\n            productCode\r\n            productId\r\n            productName\r\n            totalNet\r\n            totalQuantity\r\n            unitPrice\r\n            vatPercentage            \r\n        }\r\n        paymentTermLines {\r\n            id\r\n            day\r\n            condition\r\n            type\r\n            value\r\n            payDays\r\n            order\r\n        }\r\n      }\r\n    }\r\n  }\r\n}",
                            "variables": "{\r\n  \"id\":\"{{currentId}}\"\r\n}"
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "6-M.SalesInvoices Update [requestedAction]",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "mutation ($values: SalesInvoiceUpdateGLDtoInput!) {  \r\n    updateSalesInvoice(input: $values) {\r\n      id\r\n  }\r\n}",
                            "variables": "{\r\n  \"values\": {\r\n    \"id\":\"{{currentId}}\",\r\n    \"lines\": [\r\n      {\r\n        \"id\":\"{{lineId_1}}\",\r\n        \"totalQuantity\": 49\r\n      },\r\n      {\r\n        \"id\":\"{{lineId_2}}\",\r\n        \"requestedAction\":\"DELETE\"\r\n      },\r\n      {\r\n        \"productId\": \"{{productId_3}}\",\r\n        \"totalQuantity\": 2,\r\n        \"unitPrice\": 11,\r\n        \"firstDiscount\": 5\r\n      }\r\n    ]\r\n  }\r\n}"
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "6-M.SalesInvoices Update [replaceAll]",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "mutation ($values: SalesInvoiceUpdateGLDtoInput!) {  \r\n    updateSalesInvoice(input: $values) {\r\n      id\r\n  }\r\n}",
                            "variables": "{\r\n  \"values\": {\r\n    \"id\":\"{{currentId}}\",\r\n    \"replaceAll\":[\"LINES\"],\r\n     \"lines\": [\r\n      {\r\n        \"productId\": \"{{productId_1}}\",\r\n        \"totalQuantity\": 49,\r\n        \"unitPrice\": 11,\r\n        \"firstDiscount\": 5\r\n      },\r\n      {\r\n        \"productId\": \"{{productId_3}}\",\r\n        \"totalQuantity\": 4,\r\n        \"unitPrice\": 22,\r\n        \"firstDiscount\": 0\r\n      }\r\n     ]\r\n  }\r\n}"
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "8-M.SalesInvoice Delete By Id",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              ""
                            ],
                            "type": "text/javascript"
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "mutation ($values: SalesInvoiceDeleteGLDtoInput!) {  \r\n    deleteSalesInvoice(input: $values) {\r\n      id\r\n  }\r\n}",
                            "variables": "{\r\n  \"values\": {\r\n    \"id\":\"{{currentId}}\"\r\n  }\r\n}"
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "9-M.SalesInvoice Create an invoice with Payment Term Lines",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "pm.test(\"Variable creation\", function () {\r",
                              "    let jsd = pm.response.json();\r",
                              "\r",
                              "    if (jsd.data == null)\r",
                              "        {console.error(\"Unable to save environment variable\");return;}\r",
                              "\r",
                              "    let result = jsd.data.createSalesInvoice;\r",
                              "    pm.environment.set(\"currentId\", result.id);\r",
                              "    console.log(\"'currentId' environment variable has been created : \" + pm.environment.get(\"currentId\"));\r",
                              "});\r",
                              "\r",
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "mutation ($values: SalesInvoiceCreateGLDtoInput!) {  \r\n    createSalesInvoice(input: $values) {\r\n    id\r\n  }\r\n}",
                            "variables": "{\r\n  \"values\": {\r\n    \"customerId\": \"{{customerId}}\",\r\n    \"documentDate\": \"{{dateInFirstExercice}}\",\r\n    \"lines\": [\r\n      {\r\n        \"productId\": \"{{productId_1}}\",\r\n        \"totalQuantity\": 50,\r\n        \"unitPrice\": 11,\r\n        \"firstDiscount\": 5\r\n      },\r\n      {\r\n        \"productId\": \"{{productId_1}}\",\r\n        \"productName\":\"specific name\",\r\n        \"totalQuantity\": 4,\r\n        \"unitPrice\": 22,\r\n        \"firstDiscount\": 0\r\n      }\r\n    ],\r\n    \"paymentTermLines\":[\r\n    {\r\n      \"type\":\"FIXED_AMOUNT\",\r\n      \"value\":500,\r\n      \"order\":1,\r\n      \"condition\":\"DAY_OF_PAYMENT\"\r\n    },\r\n     {\r\n      \"type\":\"PERCENTAGE\",\r\n      \"value\":30,\r\n      \"order\":2,\r\n      \"condition\":\"END_OF_MONTH\"\r\n    },\r\n     {\r\n      \"type\":\"REMAINING_AMOUNT\",\r\n      \"value\":0,\r\n      \"order\":9999,\r\n      \"condition\":\"END_OF_MONTH\",\r\n      \"day\":60\r\n    }\r\n    ]\r\n  }\r\n}"
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    }
                  ],
                  "description": "For these examples, you will need:\n\n1. At least one customer\n2. At least two products\n    \n\nFor the example of modifying the invoice, we start from the created invoice.\n\n- We modify the quantity of the first line,\n- delete the second line,\n- and add a new line with the same product as the first line."
                },
                {
                  "name": "M.create an invoice with an existing number",
                  "item": [
                    {
                      "name": "1-Q.customers - first activated & current legislation",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "pm.test(\"Variables creation\", function () {\r",
                              "    let jsd = pm.response.json();\r",
                              "\r",
                              "    if (jsd.data == null || jsd.data.customers.edges.length == 0)\r",
                              "        {console.error(\"Unable to save environment variable for customer\");return;}\r",
                              "    pm.environment.set(\"customerId\", jsd.data.customers.edges[0].node.id);\r",
                              "    console.log(\"customerId environment variable has been created : \" + pm.environment.get(\"customerId\"));\r",
                              "});"
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        },
                        {
                          "listen": "prerequest",
                          "script": {
                            "exec": [
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        }
                      ],
                      "request": {
                        "auth": {
                          "type": "bearer",
                          "bearer": [
                            {
                              "key": "token",
                              "value": "{{accessToken}}",
                              "type": "string"
                            }
                          ]
                        },
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "query ($countryAcronym : String!) {\r\n    customers (\r\n        order: [{ code: ASC }]\r\n        where: {\r\n            countryAcronym: {eq:$countryAcronym}\r\n            disabled: {eq: false}\r\n            socialName: {neq:\"Postman demo\"}\r\n            }\r\n        first:1\r\n        ) {\r\n        edges {\r\n            node {\r\n                  id\r\n                  code\r\n                  socialName\r\n            }\r\n        }\r\n    }   \r\n}",
                            "variables": "{\r\n  \"countryAcronym\":\"{{legislationCode}}\"\r\n}"
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "2-Q.Products - first & second product by code",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "pm.test(\"Variables creation\", function () {\r",
                              "    let jsd = pm.response.json();\r",
                              "\r",
                              "    if (jsd.data == null || jsd.data.products.edges.length == 0)\r",
                              "        {console.error(\"Unable to save environment variable for product\");return;}\r",
                              "    pm.environment.set(\"firstProductId\", jsd.data.products.edges[0].node.id);\r",
                              "    pm.environment.set(\"secondProductId\", jsd.data.products.edges[1].node.id);\r",
                              "    console.log(\"firstproductId & secondProductId environment variable has been created : \" + pm.environment.get(\"firstProductId\")+\" - \"+pm.environment.get(\"secondProductId\"));\r",
                              "});"
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        },
                        {
                          "listen": "prerequest",
                          "script": {
                            "exec": [
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "query {\r\n  products (\r\n       order: [{ code: ASC }]\r\n       where: {category:{neq:CONCEPT}}\r\n       first:2\r\n  ) {\r\n    edges {\r\n      node {\r\n        id\r\n        code\r\n        name\r\n      }\r\n    }\r\n  }     \r\n}",
                            "variables": ""
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "3-M.SalesInvoice Create an invoice",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "pm.test(\"Variable creation\", function () {\r",
                              "    let jsd = pm.response.json();\r",
                              "\r",
                              "    if (jsd.data == null)\r",
                              "        {console.error(\"Unable to save environment variable\");return;}\r",
                              "\r",
                              "    let result = jsd.data.createSalesInvoice;\r",
                              "    pm.environment.set(\"currentId\", result.id);\r",
                              "    console.log(\"'currentId' environment variable has been created : \" + pm.environment.get(\"currentId\"));\r",
                              "});\r",
                              "\r",
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "mutation ($values: SalesInvoiceCreateGLDtoInput!) {  \r\n    createSalesInvoice(input: $values) {\r\n    id\r\n  }\r\n}",
                            "variables": "{\r\n  \"values\": {\r\n    \"customerId\": \"{{customerId}}\",\r\n    \"operationalNumber\":\"FA0001\",\r\n    \"lines\": [\r\n      {\r\n        \"productId\": \"{{firstProductId}}\",\r\n        \"totalQuantity\": 50,\r\n        \"unitPrice\": 11,\r\n        \"firstDiscount\": 5\r\n      },\r\n      {\r\n        \"productId\": \"{{secondProductId}}\",\r\n        \"productName\":\"specific name\",\r\n        \"totalQuantity\": 4,\r\n        \"unitPrice\": 22,\r\n        \"firstDiscount\": 0\r\n      }\r\n    ]\r\n  }\r\n}"
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "4-Q.SalesInvoices filtered by Id (automatically closed)",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "pm.test(\"Variable creation\", function () {\r",
                              "    let jsd = pm.response.json();\r",
                              "\r",
                              "    // Vérifier si la réponse contient les données nécessaires\r",
                              "    if (!jsd.data || !jsd.data.salesInvoices || jsd.data.salesInvoices.edges.length === 0) {\r",
                              "        console.error(\"Unable to save environment variables\");\r",
                              "        return;\r",
                              "    }\r",
                              "\r",
                              "    // Récupérer le tableau des lignes\r",
                              "    let lines = jsd.data.salesInvoices.edges[0].node.lines;\r",
                              "\r",
                              "    // Vérifier si le tableau des lignes contient au moins deux éléments\r",
                              "    if (lines.length < 2) {\r",
                              "        console.error(\"Not enough lines to save environment variables\");\r",
                              "        return;\r",
                              "    }\r",
                              "\r",
                              "    // Définir les variables d'environnement pour les ID des deux premières lignes\r",
                              "    pm.environment.set(\"firstLineId\", lines[0].id);\r",
                              "    pm.environment.set(\"secondLineId\", lines[1].id);\r",
                              "\r",
                              "    // Logger les ID récupérés\r",
                              "    console.log(\"'firstLineId' and 'secondLineId' environment variables have been created: \" + pm.environment.get(\"firstLineId\") + \", \" + pm.environment.get(\"secondLineId\"));\r",
                              "});\r",
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "query ($id : UUID!) {\r\n  salesInvoices (where : { id : { eq : $id }}) {\r\n    edges {\r\n      node {\r\n        documentDate\r\n        operationalNumber\r\n        socialName\r\n        status\r\n        totalGross\r\n        totalLiquid\r\n        totalNet\r\n        totalVat\r\n        deliveryAddress{\r\n            city\r\n            countryId\r\n            countryName\r\n            firstLine\r\n            province\r\n            secondLine\r\n            zipCode\r\n        }\r\n        mainAddress{\r\n            city\r\n            countryId\r\n            countryName\r\n            firstLine\r\n            name\r\n            province\r\n            secondLine\r\n            zipCode           \r\n        }\r\n        lines{\r\n            id\r\n            firstDiscount\r\n            productCode\r\n            productId\r\n            productName\r\n            totalNet\r\n            totalQuantity\r\n            unitPrice\r\n            vatPercentage            \r\n        }\r\n      }\r\n    }\r\n  }\r\n}",
                            "variables": "{\r\n  \"id\":\"{{currentId}}\"\r\n}"
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    }
                  ]
                },
                {
                  "name": "M.validate and pay an Invoice (Post Invoice & Open Items Settlement)",
                  "item": [
                    {
                      "name": "1-Q.customers - first activated & current legislation",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "pm.test(\"Variables creation\", function () {\r",
                              "    let jsd = pm.response.json();\r",
                              "\r",
                              "    if (jsd.data == null || jsd.data.customers.edges.length == 0)\r",
                              "        {console.error(\"Unable to save environment variable for customer\");return;}\r",
                              "    pm.environment.set(\"customerId\", jsd.data.customers.edges[0].node.id);\r",
                              "    console.log(\"customerId environment variable has been created : \" + pm.environment.get(\"customerId\"));\r",
                              "});"
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        },
                        {
                          "listen": "prerequest",
                          "script": {
                            "exec": [
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        }
                      ],
                      "request": {
                        "auth": {
                          "type": "bearer",
                          "bearer": [
                            {
                              "key": "token",
                              "value": "{{accessToken}}",
                              "type": "string"
                            }
                          ]
                        },
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "query ($countryAcronym : String!) {\r\n    customers (\r\n        order: [{ code: ASC }]\r\n        where: {\r\n            countryAcronym: {eq:$countryAcronym}\r\n            disabled: {eq: false}\r\n            }\r\n        first:1\r\n        ) {\r\n        edges {\r\n            node {\r\n                  id\r\n                  code\r\n                  socialName\r\n            }\r\n        }\r\n    }   \r\n}",
                            "variables": "{\r\n  \"countryAcronym\":\"{{legislationCode}}\"\r\n}"
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "2-Q.Products - first & second product by code",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "pm.test(\"Variables creation\", function () {\r",
                              "    let jsd = pm.response.json();\r",
                              "\r",
                              "    if (jsd.data == null || jsd.data.products.edges.length == 0)\r",
                              "        {console.error(\"Unable to save environment variable for product\");return;}\r",
                              "    pm.environment.set(\"firstProductId\", jsd.data.products.edges[0].node.id);\r",
                              "    pm.environment.set(\"secondProductId\", jsd.data.products.edges[1].node.id);\r",
                              "    console.log(\"firstproductId & secondProductId environment variable has been created : \" + pm.environment.get(\"firstProductId\")+\" - \"+pm.environment.get(\"secondProductId\"));\r",
                              "});"
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        },
                        {
                          "listen": "prerequest",
                          "script": {
                            "exec": [
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "query {\r\n  products (\r\n       order: [{ code: ASC }]\r\n       where: {category:{neq:CONCEPT}}\r\n       first:2\r\n  ) {\r\n    edges {\r\n      node {\r\n        id\r\n        code\r\n        name\r\n      }\r\n    }\r\n  }     \r\n}",
                            "variables": ""
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "3-M.SalesInvoice Create an invoice",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "pm.test(\"Variable creation\", function () {\r",
                              "    let jsd = pm.response.json();\r",
                              "\r",
                              "    if (jsd.data == null)\r",
                              "        {console.error(\"Unable to save environment variable\");return;}\r",
                              "\r",
                              "    let result = jsd.data.createSalesInvoice;\r",
                              "    pm.environment.set(\"currentId\", result.id);\r",
                              "    console.log(\"'currentId' environment variable has been created : \" + pm.environment.get(\"currentId\"));\r",
                              "});\r",
                              "\r",
                              ""
                            ],
                            "type": "text/javascript"
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "mutation ($values: SalesInvoiceCreateGLDtoInput!) {  \r\n    createSalesInvoice(input: $values) {\r\n    id\r\n  }\r\n}",
                            "variables": "{\r\n  \"values\": {\r\n    \"customerId\": \"{{customerId}}\",\r\n    \"salesOrderNumber\":\"\",\r\n    \"lines\": [\r\n      {\r\n        \"productId\": \"{{firstProductId}}\",\r\n        \"totalQuantity\": 50,\r\n        \"unitPrice\": 11,\r\n        \"firstDiscount\": 5\r\n      },\r\n      {\r\n        \"productId\": \"{{secondProductId}}\",\r\n        \"productName\":\"specific name\",\r\n        \"totalQuantity\": 4,\r\n        \"unitPrice\": 22,\r\n        \"firstDiscount\": 0\r\n      }\r\n    ]\r\n  }\r\n}"
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "4-⚙️ M.Close the invoice",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "mutation($input: CloseSalesInvoiceGLDtoInput!) {\r\n  closeSalesInvoice(input: $input) {\r\n    id\r\n    operationalNumber\r\n  }\r\n}",
                            "variables": "{\r\n  \"input\": {\r\n    \"salesInvoiceId\": \"{{currentId}}\"\r\n  }\r\n}"
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "5- Q.journalTypes - first type SALES_INVOICE",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "pm.test(\"Variables creation\", function () {\r",
                              "    let jsd = pm.response.json();\r",
                              "\r",
                              "    if (jsd.data == null || jsd.data.journalTypes.edges.length == 0)\r",
                              "        {console.error(\"Unable to save environment variable\");return;}\r",
                              "    pm.environment.set(\"journalSalesId\", jsd.data.journalTypes.edges[0].node.id);\r",
                              "     console.log(\"'journalSalesId' environment variable has been created : \" + pm.environment.get(\"journalSalesId\"));\r",
                              "\r",
                              "});"
                            ],
                            "type": "text/javascript",
                            "packages": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "query {\r\n     journalTypes(\r\n         where: {type: {eq: SALES_INVOICE}}\r\n         first:1) {\r\n        edges {\r\n            node {\r\n               id\r\n            }\r\n        }\r\n    }     \r\n}",
                            "variables": ""
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "6- ⚙️ M.Post the Invoice",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "mutation($input: PostSalesInvoiceGLDtoInput!) {\r\n  postSalesInvoice(input: $input) {\r\n    accountingEntryId\r\n    accountingEntryNumber\r\n    accountingEntries {\r\n        accountingEntryId\r\n        accountingEntryNumber\r\n    }\r\n  }\r\n}",
                            "variables": "{\r\n  \"input\": {\r\n    \"salesInvoiceId\": \"{{currentId}}\",\r\n    \"accountingEntryDescription\": \"Sales Invoice validation\",\r\n    \"journalTypeId\": \"{{journalSalesId}}\"\r\n  }\r\n}"
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "7- Q.SalesInvoiceOpenItems - Retrieve the IDs of the invoice due dates.",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "pm.test(\"Variables creation\", function () {\r",
                              "    let jsd = pm.response.json();\r",
                              "\r",
                              "    if (jsd.data == null || jsd.data.salesInvoiceOpenItems.edges.length == 0) {\r",
                              "        console.error(\"Unable to save environment variable\");\r",
                              "        return;\r",
                              "    }\r",
                              "\r",
                              "    // Get the first node's data\r",
                              "    let firstNode = jsd.data.salesInvoiceOpenItems.edges[0].node;\r",
                              "\r",
                              "    // Retrieve the openItemId, documentNumber, and thirdPartyId\r",
                              "    let openItemId = firstNode.id;\r",
                              "    let documentNumber = firstNode.salesInvoice.operationalNumber;\r",
                              "    let thirdPartyId = firstNode.salesInvoice.customer.id;\r",
                              "    let firstDueDate= firstNode.salesInvoice.firstDueDate;\r",
                              "\r",
                              "    // Save these values in environment variables\r",
                              "    pm.environment.set(\"openItemId\", openItemId);\r",
                              "    pm.environment.set(\"documentNumber\", documentNumber);\r",
                              "    pm.environment.set(\"thirdPartyId\", thirdPartyId);\r",
                              "    pm.environment.set(\"firstDueDate\", firstDueDate);\r",
                              "\r",
                              "    // Log the creation of these variables\r",
                              "    console.log(\"'openItemId' environment variable has been created: \" + pm.environment.get(\"openItemId\"));\r",
                              "    console.log(\"'documentNumber' environment variable has been created: \" + pm.environment.get(\"documentNumber\"));\r",
                              "    console.log(\"'thirdPartyId' environment variable has been created: \" + pm.environment.get(\"thirdPartyId\"));\r",
                              "     console.log(\"'firstDueDate' environment variable has been created: \" + pm.environment.get(\"firstDueDate\"));\r",
                              "});\r",
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        },
                        {
                          "listen": "prerequest",
                          "script": {
                            "exec": [
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "query($Id: UUID!) {\r\n  salesInvoiceOpenItems(\r\n    order: {dueDate:ASC}\r\n    where : {salesInvoice:{ id : { eq : $Id }}}\r\n  ) {\r\n    edges {\r\n      node {\r\n        salesInvoice {\r\n          firstDueDate\r\n          documentDate\r\n          operationalNumber\r\n          status\r\n          totalLiquid\r\n          customer {\r\n            id\r\n            code\r\n            socialName\r\n          }\r\n        }\r\n        id\r\n        status\r\n        amount\r\n        dueDate\r\n        paidAmountAccumulated\r\n        paymentMean {\r\n          description\r\n        }\r\n      }\r\n    }\r\n  }\r\n}\r\n",
                            "variables": "{\r\n  \"Id\": \"{{currentId}}\"\r\n}"
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "8- Q.paymentMethods - first payment method",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "pm.test(\"Variables creation\", function () {\r",
                              "    let jsd = pm.response.json();\r",
                              "\r",
                              "    if (jsd.data == null || jsd.data.paymentMethods.edges.length == 0)\r",
                              "        {console.error(\"Unable to save environment variable\");return;}\r",
                              "    pm.environment.set(\"paymentMethodId\", jsd.data.paymentMethods.edges[0].node.id);\r",
                              "    console.log(\"'paymentMethodId' environment variable has been created : \" + pm.environment.get(\"paymentMethodId\"));\r",
                              "});"
                            ],
                            "type": "text/javascript",
                            "packages": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "query {\r\n    paymentMethods (\r\n        first:1\r\n    )    {\r\n\r\n        edges {\r\n            node {\r\n                id\r\n                creationDate\r\n                referenceName\r\n                type\r\n                journalType{\r\n                    code\r\n                }\r\n                subAccount{\r\n                    code\r\n                }\r\n                \r\n            }\r\n        }\r\n    }     \r\n}",
                            "variables": ""
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "9- ⚙️ M.SalesOpenItemSettlement  - Partially pay the first due date.",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "mutation($input: SalesOpenItemSettlementGLDtoInput!) {\r\n  salesOpenItemSettlement(input: $input) {\r\n    accountingEntryId\r\n    accountingEntryNumber\r\n  }\r\n}",
                            "variables": "{\r\n  \"input\": {\r\n    \"entryDate\": \"{{firstDueDate}}\",\r\n    \"paymentMethodId\": \"{{paymentMethodId}}\",\r\n    \"description\": \"Partiel settlement\",\r\n    \"documentNumber\": \"{{documentNumber}}\",\r\n    \"thirdPartyId\": \"{{thirdPartyId}}\",\r\n    \"salesOpenItemLinkagePaidAmounts\": [\r\n        {\r\n            \"openItemId\": \"{{openItemId}}\",\r\n            \"paidAmount\": 111\r\n        }\r\n    ]\r\n  }\r\n}"
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    }
                  ],
                  "description": "The example shows how to create and close an invoice, then validate (post) it, how to retrieve the due dates, their status, and their amounts, and then partially pay the first due date.\n\nYou will need:\n\n1. At least one customer\n    \n2. At least two products\n    \n3. A sales invoice created for the customer\n    \n4. A sales journal\n    \n5. A payment method set up for transactions"
                },
                {
                  "name": "🆕M.Generate Invoice with Online Payment",
                  "item": [
                    {
                      "name": "1-Q.customers - first activated & current legislation",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "pm.test(\"Variables creation\", function () {\r",
                              "    let jsd = pm.response.json();\r",
                              "\r",
                              "    if (jsd.data == null || jsd.data.customers.edges.length == 0)\r",
                              "        {console.error(\"Unable to save environment variable for customer\");return;}\r",
                              "    pm.environment.set(\"customerId\", jsd.data.customers.edges[0].node.id);\r",
                              "    console.log(\"customerId environment variable has been created : \" + pm.environment.get(\"customerId\"));\r",
                              "});"
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        },
                        {
                          "listen": "prerequest",
                          "script": {
                            "exec": [
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        }
                      ],
                      "request": {
                        "auth": {
                          "type": "bearer",
                          "bearer": [
                            {
                              "key": "token",
                              "value": "{{accessToken}}",
                              "type": "string"
                            }
                          ]
                        },
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "query ($countryAcronym : String!) {\r\n    customers (\r\n        order: [{ code: ASC }]\r\n        where: {\r\n            countryAcronym: {eq:$countryAcronym}\r\n            disabled: {eq: false}\r\n            }\r\n        first:1\r\n        ) {\r\n        edges {\r\n            node {\r\n                  id\r\n                  code\r\n                  socialName\r\n            }\r\n        }\r\n    }   \r\n}",
                            "variables": "{\r\n  \"countryAcronym\":\"{{legislationCode}}\"\r\n}"
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "2-Q.Products - first & second product by code",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "pm.test(\"Variables creation\", function () {\r",
                              "    let jsd = pm.response.json();\r",
                              "\r",
                              "    if (jsd.data == null || jsd.data.products.edges.length == 0)\r",
                              "        {console.error(\"Unable to save environment variable for product\");return;}\r",
                              "    pm.environment.set(\"firstProductId\", jsd.data.products.edges[0].node.id);\r",
                              "    pm.environment.set(\"secondProductId\", jsd.data.products.edges[1].node.id);\r",
                              "    console.log(\"firstproductId & secondProductId environment variable has been created : \" + pm.environment.get(\"firstProductId\")+\" - \"+pm.environment.get(\"secondProductId\"));\r",
                              "});"
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        },
                        {
                          "listen": "prerequest",
                          "script": {
                            "exec": [
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "query {\r\n  products (\r\n       order: [{ code: ASC }]\r\n       where: {category:{neq:CONCEPT}}\r\n       first:2\r\n  ) {\r\n    edges {\r\n      node {\r\n        id\r\n        code\r\n        name\r\n      }\r\n    }\r\n  }     \r\n}",
                            "variables": ""
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "3-Q.paymentMeans - Get the Online Payment",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "pm.test(\"Variables creation\", function () {\r",
                              "    let jsd = pm.response.json();\r",
                              "\r",
                              "    if (jsd.data == null || jsd.data.paymentMeans.edges.length == 0)\r",
                              "        {console.error(\"Unable to save environment variable\");return;}\r",
                              "    pm.environment.set(\"onlinePaymentMeanId\", jsd.data.paymentMeans.edges[0].node.id);\r",
                              "    console.log(\"'onlinePaymentMeanId' environment variable has been created : \" + pm.environment.get(\"onlinePaymentMeanId\"));\r",
                              "});"
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "query {\r\n  paymentMeans(\r\n    where: { type: { eq: PAYMENT_IN } }\r\n  ) {\r\n    edges {\r\n      node {\r\n        id\r\n        description\r\n        type\r\n      }\r\n    }\r\n  }\r\n}\r\n",
                            "variables": ""
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "4-M.SalesInvoice Create an invoice with Online Payment",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "pm.test(\"Variable creation\", function () {\r",
                              "    let jsd = pm.response.json();\r",
                              "\r",
                              "    if (jsd.data == null)\r",
                              "        {console.error(\"Unable to save environment variable\");return;}\r",
                              "\r",
                              "    let result = jsd.data.createSalesInvoice;\r",
                              "    pm.environment.set(\"currentId\", result.id);\r",
                              "    console.log(\"'currentId' environment variable has been created : \" + pm.environment.get(\"currentId\"));\r",
                              "});\r",
                              "\r",
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "mutation ($values: SalesInvoiceCreateGLDtoInput!) {  \r\n    createSalesInvoice(input: $values) {\r\n    id\r\n  }\r\n}",
                            "variables": "{\r\n  \"values\": {\r\n    \"customerId\": \"{{customerId}}\",\r\n    \"canGeneratePaymentLink\":true,\r\n    \"invoiceEmail\":\"test@sage.com\",\r\n    \"lines\": [\r\n      {\r\n        \"productId\": \"{{firstProductId}}\",\r\n        \"totalQuantity\": 50,\r\n        \"unitPrice\": 11,\r\n        \"firstDiscount\": 5\r\n      },\r\n      {\r\n        \"productId\": \"{{secondProductId}}\",\r\n        \"productName\":\"specific name\",\r\n        \"totalQuantity\": 4,\r\n        \"unitPrice\": 22,\r\n        \"firstDiscount\": 0\r\n      }\r\n    ],\r\n    \"paymentTermLines\":[\r\n    {\r\n      \"paymentMeanId\":\"{{onlinePaymentMeanId}}\",\r\n      \"type\":\"REMAINING_AMOUNT\",\r\n      \"value\":0,\r\n      \"condition\":\"DAY_OF_PAYMENT\",\r\n      \"day\":30\r\n    }\r\n    ]\r\n  }\r\n}"
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "5-⚙️ M.Close the invoice",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "mutation($input: CloseSalesInvoiceGLDtoInput!) {\r\n  closeSalesInvoice(input: $input) {\r\n    id\r\n    operationalNumber\r\n  }\r\n}",
                            "variables": "{\r\n  \"input\": {\r\n    \"salesInvoiceId\": \"{{currentId}}\"\r\n  }\r\n}"
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "4-Q.journalTypes - first type SALES_INVOICE",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "pm.test(\"Variables creation\", function () {\r",
                              "    let jsd = pm.response.json();\r",
                              "\r",
                              "    if (jsd.data == null || jsd.data.journalTypes.edges.length == 0)\r",
                              "        {console.error(\"Unable to save environment variable\");return;}\r",
                              "    pm.environment.set(\"journalSalesId\", jsd.data.journalTypes.edges[0].node.id);\r",
                              "     console.log(\"'journalSalesId' environment variable has been created : \" + pm.environment.get(\"journalSalesId\"));\r",
                              "\r",
                              "});"
                            ],
                            "type": "text/javascript",
                            "packages": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "query {\r\n     journalTypes(\r\n         where: {type: {eq: SALES_INVOICE}}\r\n         first:1) {\r\n        edges {\r\n            node {\r\n               id\r\n            }\r\n        }\r\n    }     \r\n}",
                            "variables": ""
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "5-⚙️ M.Post the Invoice",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "mutation($input: PostSalesInvoiceGLDtoInput!) {\r\n  postSalesInvoice(input: $input) {\r\n    accountingEntryId\r\n    accountingEntryNumber\r\n    accountingEntries {\r\n        accountingEntryId\r\n        accountingEntryNumber\r\n    }\r\n  }\r\n}",
                            "variables": "{\r\n  \"input\": {\r\n    \"salesInvoiceId\": \"{{currentId}}\",\r\n    \"accountingEntryDescription\": \"Sales Invoice validation\",\r\n    \"journalTypeId\": \"{{journalSalesId}}\"\r\n  }\r\n}"
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "6-Q.userProfile Get Email",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "pm.test(\"Variables creation\", function () {\r",
                              "    let jsonResponse = pm.response.json();\r",
                              "\r",
                              "    if (jsonResponse.data == null || jsonResponse.data.userProfile == null)\r",
                              "        {console.error(\"Unable to save environment variable\"); return;}\r",
                              "    pm.environment.set(\"emailFrom\", jsonResponse.data.userProfile.authenticationEmail);\r",
                              "    console.log(\"'emailFrom' environment variable has been created : \" + pm.environment.get(\"emailFrom\"));\r",
                              "});\r",
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "query {\r\n  userProfile {\r\n    authenticationEmail\r\n  }\r\n}\r\n",
                            "variables": ""
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "7-Q.Email New Invoice template",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "pm.test(\"Save emailTemplate fields\", function () {\r",
                              "    let jsonResponse = pm.response.json();\r",
                              "\r",
                              "    if (\r",
                              "        jsonResponse.data == null ||\r",
                              "        jsonResponse.data.emailTemplates == null ||\r",
                              "        jsonResponse.data.emailTemplates.edges == null ||\r",
                              "        jsonResponse.data.emailTemplates.edges.length === 0\r",
                              "    ) {\r",
                              "        console.error(\"Unable to save environment variables\");\r",
                              "        return;\r",
                              "    }\r",
                              "\r",
                              "    let template = jsonResponse.data.emailTemplates.edges[0].node;\r",
                              "\r",
                              "    let templateFields = {\r",
                              "        subject: template.emailSubject,\r",
                              "        message: template.emailMessage,\r",
                              "        sendMeCopy: template.sendMeCopy,\r",
                              "    };\r",
                              "\r",
                              "    pm.environment.set(\"emailSubject\", templateFields.subject);\r",
                              "    pm.environment.set(\"emailMessage\",JSON.stringify(template.emailMessage).slice(1, -1));\r",
                              "    pm.environment.set(\"sendEmailCopy\", templateFields.sendMeCopy);\r",
                              "\r",
                              "    console.log(\"Email template fields saved to environment variables\", templateFields);\r",
                              "});\r",
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "query {\r\n  emailTemplates(\r\n    first: 1\r\n    where: { documentType: { eq: NEW_INVOICE } }\r\n  ) {\r\n    edges {\r\n      node {\r\n        id\r\n        emailSubject\r\n        emailMessage\r\n        sendMeCopy\r\n      }\r\n    }\r\n  }\r\n}\r\n",
                            "variables": ""
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "8-⚙️ Q.DocumentPdfEmail",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "query($input: DocumentPdfEmailGLDtoInput!) {\r\n  documentPdfEmail(input: $input) {\r\n    type\r\n    id\r\n  }\r\n}",
                            "variables": "{\r\n  \"input\": {\r\n    \"type\": \"SALES_INVOICE\",\r\n    \"id\": \"{{currentId}}\",\r\n    \"emailFrom\": \"{{emailFrom}}\",\r\n    \"emailTo\": \"test@sage.com\",\r\n    \"sendEmailCopy\": {{sendEmailCopy}},\r\n    \"emailSubject\": \"{{emailSubject}}\",\r\n    \"emailMessage\": \"{{emailMessage}}\"\r\n  }\r\n}\r\n"
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    }
                  ]
                },
                {
                  "name": "🆕M.create an invoice with a specific prefix number",
                  "item": [
                    {
                      "name": "1- Q.accountingExercises - most recently opened, startDate filled in {{dateInFirstExercice}}",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "pm.test(\"Variables creation\", function () {\r",
                              "    let jsd = pm.response.json();\r",
                              "    console.log(jsd.data.accountingExercises.edges[0].node.id);\r",
                              "    if (jsd.data == null || jsd.data.accountingExercises.edges.length == 0)\r",
                              "        {console.error(\"Unable to save environment variable\");return;}\r",
                              "    pm.environment.set(\"dateInFirstExercice\",jsd.data.accountingExercises.edges[0].node.startDate);\r",
                              "    console.log(\"'dateInFirstExercice' environment variable has been created : \" + pm.environment.get(\"dateInFirstExercice\"));\r",
                              "});\r",
                              "\r",
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "query {\r\n    accountingExercises(\r\n        where: {status: {eq: OPEN}}\r\n        first:1\r\n        order:{startDate:DESC}\r\n        ) {\r\n        edges {\r\n            node {\r\n               startDate\r\n            }\r\n        }\r\n    }     \r\n}",
                            "variables": ""
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "2-Q.customers - first activated & current legislation",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "pm.test(\"Variables creation\", function () {\r",
                              "    let jsd = pm.response.json();\r",
                              "\r",
                              "    if (jsd.data == null || jsd.data.customers.edges.length == 0)\r",
                              "        {console.error(\"Unable to save environment variable for customer\");return;}\r",
                              "    pm.environment.set(\"customerId\", jsd.data.customers.edges[0].node.id);\r",
                              "    console.log(\"customerId environment variable has been created : \" + pm.environment.get(\"customerId\"));\r",
                              "});"
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        },
                        {
                          "listen": "prerequest",
                          "script": {
                            "exec": [
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        }
                      ],
                      "request": {
                        "auth": {
                          "type": "bearer",
                          "bearer": [
                            {
                              "key": "token",
                              "value": "{{accessToken}}",
                              "type": "string"
                            }
                          ]
                        },
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "query ($countryAcronym : String!) {\r\n    customers (\r\n        order: [{ code: ASC }]\r\n        where: {\r\n            countryAcronym: {eq:$countryAcronym}\r\n            disabled: {eq: false}\r\n            socialName: {neq:\"Postman demo\"}\r\n            }\r\n        first:1\r\n        ) {\r\n        edges {\r\n            node {\r\n                  id\r\n                  code\r\n                  socialName\r\n            }\r\n        }\r\n    }   \r\n}",
                            "variables": "{\r\n  \"countryAcronym\":\"{{legislationCode}}\"\r\n}"
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "3-Q.Products - get 3 products",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "pm.test(\"Create environment variables for all products\", function () {\r",
                              "    let jsd = pm.response.json();\r",
                              "\r",
                              "    if (!jsd.data || !jsd.data.products || !jsd.data.products.edges || jsd.data.products.edges.length === 0) {\r",
                              "        console.error(\"Invalid response structure or no products found\");\r",
                              "        return;\r",
                              "    }\r",
                              "\r",
                              "    jsd.data.products.edges.forEach((edge, index) => {\r",
                              "        let varName = `productId_${index + 1}`;\r",
                              "        pm.environment.set(varName, edge.node.id);\r",
                              "        console.log(`${varName} = ${edge.node.id}`);\r",
                              "    });\r",
                              "\r",
                              "    console.log(\"✅ Environment variables for all products have been created\");\r",
                              "});\r",
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        },
                        {
                          "listen": "prerequest",
                          "script": {
                            "exec": [
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "query {\r\n  products (\r\n       order: [{ code: ASC }]\r\n       where: {category:{neq:CONCEPT}}\r\n       first:3\r\n  ) {\r\n    edges {\r\n      node {\r\n        id\r\n        code\r\n        name\r\n      }\r\n    }\r\n  }     \r\n}",
                            "variables": ""
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "4-Q.OperationalNumberPresetText Get the most recent record",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "pm.test(\"Variables creation\", function () {\r",
                              "    let jsd = pm.response.json();\r",
                              "\r",
                              "    if (jsd.data == null || jsd.data.operationalNumberPresetTexts.edges.length == 0) {\r",
                              "        console.error(\"Unable to save environment variable for operationalNumberPresetText\");\r",
                              "        return;\r",
                              "    }\r",
                              "\r",
                              "    pm.environment.set(\r",
                              "        \"operationalNumberPresetTextId\",\r",
                              "        jsd.data.operationalNumberPresetTexts.edges[0].node.id\r",
                              "    );\r",
                              "\r",
                              "    console.log(\r",
                              "        \"operationalNumberPresetTextId environment variable has been created : \" +\r",
                              "        pm.environment.get(\"operationalNumberPresetTextId\")\r",
                              "    );\r",
                              "});"
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "query {\r\n  operationalNumberPresetTexts(\r\n    where:{operation:{eq:INVOICE}}\r\n    order:{creationDate:DESC}\r\n    first:1\r\n  ) {\r\n        edges {\r\n            node {\r\n                id\r\n                description\r\n                presetText\r\n            }\r\n        }\r\n    }\r\n}",
                            "variables": ""
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "5-M.SalesInvoice Create an invoice",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "pm.test(\"Variable creation\", function () {\r",
                              "    let jsd = pm.response.json();\r",
                              "\r",
                              "    if (jsd.data == null)\r",
                              "        {console.error(\"Unable to save environment variable\");return;}\r",
                              "\r",
                              "    let result = jsd.data.createSalesInvoice;\r",
                              "    pm.environment.set(\"currentId\", result.id);\r",
                              "    console.log(\"'currentId' environment variable has been created : \" + pm.environment.get(\"currentId\"));\r",
                              "});\r",
                              "\r",
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "mutation ($values: SalesInvoiceCreateGLDtoInput!) {  \r\n    createSalesInvoice(input: $values) {\r\n    id\r\n  }\r\n}",
                            "variables": "{\r\n  \"values\": {\r\n    \"customerId\": \"{{customerId}}\",\r\n    \"documentDate\": \"{{dateInFirstExercice}}\",\r\n    \"operationalNumberPresetTextId\":\"{{operationalNumberPresetTextId}}\",\r\n    \"lines\": [\r\n      {\r\n        \"productId\": \"{{productId_1}}\",\r\n        \"totalQuantity\": 50,\r\n        \"unitPrice\": 11,\r\n        \"firstDiscount\": 5\r\n      },\r\n      {\r\n        \"productId\": \"{{productId_2}}\",\r\n        \"productName\":\"specific name\",\r\n        \"totalQuantity\": 4,\r\n        \"unitPrice\": 22,\r\n        \"firstDiscount\": 0\r\n      }\r\n    ]\r\n  }\r\n}"
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "7-Q.SalesInvoices filtered by id (No number yet)",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        },
                        {
                          "listen": "prerequest",
                          "script": {
                            "exec": [
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "query ($id : UUID!) {\r\n  salesInvoices (where : { id : { eq : $id }}) {\r\n    edges {\r\n      node {\r\n        id\r\n        customerId\r\n        documentDate\r\n        operationalNumber\r\n        operationalNumberPresetText{presetText description}\r\n        salesDiscountGroupId\r\n        salesTariffId\r\n        socialName\r\n        status\r\n        totalGross\r\n        totalLiquid\r\n        totalNet\r\n        totalVat\r\n        deliveryAddress{\r\n            city\r\n            countryId\r\n            countryName\r\n            firstLine\r\n            province\r\n            secondLine\r\n            zipCode\r\n        }\r\n        mainAddress{\r\n            city\r\n            countryId\r\n            countryName\r\n            firstLine\r\n            name\r\n            province\r\n            secondLine\r\n            zipCode           \r\n        }\r\n        lines{\r\n            id\r\n            firstDiscount\r\n            productCode\r\n            productId\r\n            productName\r\n            totalNet\r\n            totalQuantity\r\n            unitPrice\r\n            vatPercentage            \r\n        }\r\n        paymentTermLines {\r\n            id\r\n            day\r\n            condition\r\n            type\r\n            value\r\n            payDays\r\n            order\r\n        }\r\n      }\r\n    }\r\n  }\r\n}",
                            "variables": "{\r\n  \"id\":\"{{currentId}}\"\r\n}"
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "8-⚙️ M.Close the invoice",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "mutation($input: CloseSalesInvoiceGLDtoInput!) {\r\n  closeSalesInvoice(input: $input) {\r\n    id\r\n    operationalNumber\r\n  }\r\n}",
                            "variables": "{\r\n  \"input\": {\r\n    \"salesInvoiceId\": \"{{currentId}}\"\r\n  }\r\n}"
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "9-Q.SalesInvoices filtered by Id (With the computed number)",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        },
                        {
                          "listen": "prerequest",
                          "script": {
                            "exec": [
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "query ($id : UUID!) {\r\n  salesInvoices (where : { id : { eq : $id }}) {\r\n    edges {\r\n      node {\r\n        id\r\n        customerId\r\n        documentDate\r\n        operationalNumber\r\n        operationalNumberPresetText{presetText description}\r\n        salesDiscountGroupId\r\n        salesTariffId\r\n        socialName\r\n        status\r\n        totalGross\r\n        totalLiquid\r\n        totalNet\r\n        totalVat\r\n        deliveryAddress{\r\n            city\r\n            countryId\r\n            countryName\r\n            firstLine\r\n            province\r\n            secondLine\r\n            zipCode\r\n        }\r\n        mainAddress{\r\n            city\r\n            countryId\r\n            countryName\r\n            firstLine\r\n            name\r\n            province\r\n            secondLine\r\n            zipCode           \r\n        }\r\n        lines{\r\n            id\r\n            firstDiscount\r\n            productCode\r\n            productId\r\n            productName\r\n            totalNet\r\n            totalQuantity\r\n            unitPrice\r\n            vatPercentage            \r\n        }\r\n        paymentTermLines {\r\n            id\r\n            day\r\n            condition\r\n            type\r\n            value\r\n            payDays\r\n            order\r\n        }\r\n      }\r\n    }\r\n  }\r\n}",
                            "variables": "{\r\n  \"id\":\"{{currentId}}\"\r\n}"
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    }
                  ]
                },
                {
                  "name": "🆕M.create a simplified invoice (ES only)",
                  "item": [
                    {
                      "name": "1- Q.accountingExercises - most recently opened, startDate filled in {{dateInFirstExercice}}",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "pm.test(\"Variables creation\", function () {\r",
                              "    let jsd = pm.response.json();\r",
                              "    console.log(jsd.data.accountingExercises.edges[0].node.id);\r",
                              "    if (jsd.data == null || jsd.data.accountingExercises.edges.length == 0)\r",
                              "        {console.error(\"Unable to save environment variable\");return;}\r",
                              "    pm.environment.set(\"dateInFirstExercice\",jsd.data.accountingExercises.edges[0].node.startDate);\r",
                              "    console.log(\"'dateInFirstExercice' environment variable has been created : \" + pm.environment.get(\"dateInFirstExercice\"));\r",
                              "});\r",
                              "\r",
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        },
                        {
                          "listen": "prerequest",
                          "script": {
                            "exec": [
                              "//LEGISLATIONS:ES"
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "query {\r\n    accountingExercises(\r\n        where: {status: {eq: OPEN}}\r\n        first:1\r\n        order:{startDate:DESC}\r\n        ) {\r\n        edges {\r\n            node {\r\n               startDate\r\n            }\r\n        }\r\n    }     \r\n}",
                            "variables": ""
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "2 - M.createCustomer Individual with minimal information",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "pm.test(\"Variables creation\", function () {\r",
                              "    let jsd = pm.response.json();\r",
                              "\r",
                              "    if (jsd.data == null)\r",
                              "        {console.error(\"Unable to save environment variable\");return;}\r",
                              "\r",
                              "    let result = jsd.data.createCustomer;\r",
                              "    pm.environment.set(\"customerId\", result.id);\r",
                              "    console.log(\"'customerId' environment variable has been created : \" + pm.environment.get(\"customerId\"));\r",
                              "});\r",
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        },
                        {
                          "listen": "prerequest",
                          "script": {
                            "exec": [
                              "//LEGISLATIONS:ES"
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "mutation ($values: CustomerCreateGLDtoInput!) {  \r\n  createCustomer (input: $values) {\r\n    id\r\n    code\r\n  }\r\n}\r\n",
                            "variables": "{\r\n  \"values\":{\r\n    \"code\":\"SIMPLIFIED\",\r\n    \"socialName\": \"SIMPLIFIED\",\r\n    \"customerType\":\"INDIVIDUAL\",\r\n    \"nonIdentifiedCustomer\": true,\r\n    \"printNameOnPdf\":true,\r\n    \"addresses\":[]\r\n  }\r\n}"
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "3-Q.Products - get 3 products",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "pm.test(\"Create environment variables for all products\", function () {\r",
                              "    let jsd = pm.response.json();\r",
                              "\r",
                              "    if (!jsd.data || !jsd.data.products || !jsd.data.products.edges || jsd.data.products.edges.length === 0) {\r",
                              "        console.error(\"Invalid response structure or no products found\");\r",
                              "        return;\r",
                              "    }\r",
                              "\r",
                              "    jsd.data.products.edges.forEach((edge, index) => {\r",
                              "        let varName = `productId_${index + 1}`;\r",
                              "        pm.environment.set(varName, edge.node.id);\r",
                              "        console.log(`${varName} = ${edge.node.id}`);\r",
                              "    });\r",
                              "\r",
                              "    console.log(\"✅ Environment variables for all products have been created\");\r",
                              "});\r",
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        },
                        {
                          "listen": "prerequest",
                          "script": {
                            "exec": [
                              "//LEGISLATIONS:ES"
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "query {\r\n  products (\r\n       order: [{ code: ASC }]\r\n       where: {category:{neq:CONCEPT}}\r\n       first:3\r\n  ) {\r\n    edges {\r\n      node {\r\n        id\r\n        code\r\n        name\r\n      }\r\n    }\r\n  }     \r\n}",
                            "variables": ""
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "4-M.SalesInvoice Create an invoice",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "pm.test(\"Variable creation\", function () {\r",
                              "    let jsd = pm.response.json();\r",
                              "\r",
                              "    if (jsd.data == null)\r",
                              "        {console.error(\"Unable to save environment variable\");return;}\r",
                              "\r",
                              "    let result = jsd.data.createSalesInvoice;\r",
                              "    pm.environment.set(\"currentId\", result.id);\r",
                              "    console.log(\"'currentId' environment variable has been created : \" + pm.environment.get(\"currentId\"));\r",
                              "});\r",
                              "\r",
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        },
                        {
                          "listen": "prerequest",
                          "script": {
                            "exec": [
                              "//LEGISLATIONS:ES"
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "mutation ($values: SalesInvoiceCreateGLDtoInput!) {  \r\n    createSalesInvoice(input: $values) {\r\n    id\r\n  }\r\n}",
                            "variables": "{\r\n  \"values\": {\r\n    \"customerId\": \"{{customerId}}\",\r\n    \"documentDate\": \"{{dateInFirstExercice}}\",\r\n    \"printNameOnPdf\":true,\r\n    \"lines\": [\r\n      {\r\n        \"productId\": \"{{productId_1}}\",\r\n        \"totalQuantity\": 50,\r\n        \"unitPrice\": 11,\r\n        \"firstDiscount\": 5\r\n      },\r\n      {\r\n        \"productId\": \"{{productId_2}}\",\r\n        \"productName\":\"specific name\",\r\n        \"totalQuantity\": 4,\r\n        \"unitPrice\": 22,\r\n        \"firstDiscount\": 0\r\n      }\r\n    ]\r\n  }\r\n}"
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "5-M.SalesInvoice Delete",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        },
                        {
                          "listen": "prerequest",
                          "script": {
                            "exec": [
                              "//LEGISLATIONS:ES"
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "mutation ($values: SalesInvoiceDeleteGLDtoInput!) {  \r\n    deleteSalesInvoice(input: $values) {\r\n      id\r\n  }\r\n}",
                            "variables": "{\r\n  \"values\": {\r\n    \"id\":\"{{currentId}}\"\r\n  }\r\n}"
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "6 -M.deletecustomer",
                      "event": [
                        {
                          "listen": "prerequest",
                          "script": {
                            "exec": [
                              "//LEGISLATIONS:ES"
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "mutation ($values:CustomerDeleteGLDtoInput!) {\r\n    deleteCustomer(input: $values) {\r\n    id\r\n  }\r\n}",
                            "variables": "{\r\n  \"values\":{\r\n    \"id\":\"{{customerId}}\"\r\n  }\r\n}"
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    }
                  ]
                },
                {
                  "name": "M.Advance Invoice",
                  "item": [
                    {
                      "name": "1- Q.accountingExercises - most recently opened, startDate filled in {{dateInFirstExercice}}",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "pm.test(\"Variables creation\", function () {\r",
                              "    let jsd = pm.response.json();\r",
                              "    console.log(jsd.data.accountingExercises.edges[0].node.id);\r",
                              "    if (jsd.data == null || jsd.data.accountingExercises.edges.length == 0)\r",
                              "        {console.error(\"Unable to save environment variable\");return;}\r",
                              "    pm.environment.set(\"dateInFirstExercice\",jsd.data.accountingExercises.edges[0].node.startDate);\r",
                              "    console.log(\"'dateInFirstExercice' environment variable has been created : \" + pm.environment.get(\"dateInFirstExercice\"));\r",
                              "});\r",
                              "\r",
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "query {\r\n    accountingExercises(\r\n        where: {status: {eq: OPEN}}\r\n        first:1\r\n        order:{startDate:DESC}\r\n        ) {\r\n        edges {\r\n            node {\r\n               startDate\r\n            }\r\n        }\r\n    }     \r\n}",
                            "variables": ""
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "2- Q.customers - first activated & current legislation",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "pm.test(\"Variables creation\", function () {\r",
                              "    let jsd = pm.response.json();\r",
                              "\r",
                              "    if (jsd.data == null || jsd.data.customers.edges.length == 0)\r",
                              "        {console.error(\"Unable to save environment variable for customer\");return;}\r",
                              "    pm.environment.set(\"customerId\", jsd.data.customers.edges[0].node.id);\r",
                              "    console.log(\"customerId environment variable has been created : \" + pm.environment.get(\"customerId\"));\r",
                              "});"
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        },
                        {
                          "listen": "prerequest",
                          "script": {
                            "exec": [
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        }
                      ],
                      "request": {
                        "auth": {
                          "type": "bearer",
                          "bearer": [
                            {
                              "key": "token",
                              "value": "{{accessToken}}",
                              "type": "string"
                            }
                          ]
                        },
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "query ($countryAcronym : String!) {\r\n    customers (\r\n        order: [{ code: ASC }]\r\n        where: {\r\n            countryAcronym: {eq:$countryAcronym}\r\n            disabled: {eq: false}\r\n            socialName: {neq:\"Postman demo\"}\r\n            }\r\n        first:1\r\n        ) {\r\n        edges {\r\n            node {\r\n                  id\r\n                  code\r\n                  socialName\r\n            }\r\n        }\r\n    }   \r\n}",
                            "variables": "{\r\n  \"countryAcronym\":\"{{legislationCode}}\"\r\n}"
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "3- Q. Get Advance Payement Product",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "pm.test(\"Advance product ID creation\", function () {\r",
                              "    let jsd = pm.response.json();\r",
                              "\r",
                              "    if (!jsd.data \r",
                              "        || !jsd.data.products \r",
                              "        || !jsd.data.products.edges \r",
                              "        || jsd.data.products.edges.length === 0) \r",
                              "    {\r",
                              "        console.error(\"Unable to save advanceProductId\");\r",
                              "        return;\r",
                              "    }\r",
                              "\r",
                              "    let id = jsd.data.products.edges[0].node.id;\r",
                              "    pm.environment.set(\"advanceProductId\", id);\r",
                              "\r",
                              "    console.log(\"'advanceProductId' has been created : \" + pm.environment.get(\"advanceProductId\"));\r",
                              "});\r",
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        },
                        {
                          "listen": "prerequest",
                          "script": {
                            "exec": [
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "query GetAdvancePaymentProduct {\r\n  products(where: { category: { eq: CONCEPT } }) {\r\n    edges {\r\n      node {\r\n        id\r\n        code\r\n        name\r\n      }\r\n    }\r\n  }\r\n}\r\n",
                            "variables": ""
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "4-M. Create Advance Invoice",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "pm.test(\"Variable creation\", function () {\r",
                              "    let jsd = pm.response.json();\r",
                              "\r",
                              "    if (jsd.data == null)\r",
                              "        {console.error(\"Unable to save environment variable\");return;}\r",
                              "\r",
                              "    let result = jsd.data.createSalesInvoice;\r",
                              "    pm.environment.set(\"advanceInvoiceId\", result.id);\r",
                              "    console.log(\"'advanceInvoiceId' environment variable has been created : \" + pm.environment.get(\"advanceInvoiceId\"));\r",
                              "});\r",
                              "\r",
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        },
                        {
                          "listen": "prerequest",
                          "script": {
                            "exec": [
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "mutation CreateAdvanceInvoice($values: SalesInvoiceCreateGLDtoInput!) {\r\n  createSalesInvoice(input: $values) {\r\n      id\r\n  }\r\n}\r\n",
                            "variables": "{\r\n  \"values\": {\r\n    \"customerId\": \"{{customerId}}\",\r\n    \"operationalNumber\":\"ADV001\",\r\n    \"documentDate\": \"{{dateInFirstExercice}}\",\r\n    \"lines\": [\r\n      {\r\n        \"productId\": \"{{advanceProductId}}\",\r\n        \"totalQuantity\": 1,\r\n        \"unitPrice\": 500\r\n      }\r\n    ]\r\n  }\r\n}\r\n"
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "5- Q.journalTypes - first type SALES_INVOICE",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "pm.test(\"Variables creation\", function () {\r",
                              "    let jsd = pm.response.json();\r",
                              "\r",
                              "    if (jsd.data == null || jsd.data.journalTypes.edges.length == 0)\r",
                              "        {console.error(\"Unable to save environment variable\");return;}\r",
                              "    pm.environment.set(\"journalSalesId\", jsd.data.journalTypes.edges[0].node.id);\r",
                              "     console.log(\"'journalSalesId' environment variable has been created : \" + pm.environment.get(\"journalSalesId\"));\r",
                              "\r",
                              "});"
                            ],
                            "type": "text/javascript",
                            "packages": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "query {\r\n     journalTypes(\r\n         where: {type: {eq: SALES_INVOICE}}\r\n         first:1) {\r\n        edges {\r\n            node {\r\n               id\r\n            }\r\n        }\r\n    }     \r\n}",
                            "variables": ""
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "6- ⚙️ M.Post the Advanced Invoice",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        },
                        {
                          "listen": "prerequest",
                          "script": {
                            "exec": [
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "mutation($values: PostSalesInvoiceGLDtoInput!) {\r\n  postSalesInvoice(input: $values) {\r\n    accountingEntryId\r\n    accountingEntryNumber\r\n    accountingEntries {\r\n        accountingEntryId\r\n        accountingEntryNumber\r\n    }\r\n  }\r\n}",
                            "variables": "{\r\n  \"values\": {\r\n    \"salesInvoiceId\": \"{{advanceInvoiceId}}\",\r\n    \"accountingEntryDescription\": \"Sales Invoice validation\",\r\n    \"journalTypeId\": \"{{journalSalesId}}\"\r\n  }\r\n}"
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "7- Q.Products - get 2 products",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "pm.test(\"Create environment variables for all products\", function () {\r",
                              "    let jsd = pm.response.json();\r",
                              "\r",
                              "    if (!jsd.data || !jsd.data.products || !jsd.data.products.edges || jsd.data.products.edges.length === 0) {\r",
                              "        console.error(\"Invalid response structure or no products found\");\r",
                              "        return;\r",
                              "    }\r",
                              "\r",
                              "    jsd.data.products.edges.forEach((edge, index) => {\r",
                              "        let varName = `productId_${index + 1}`;\r",
                              "        pm.environment.set(varName, edge.node.id);\r",
                              "        console.log(`${varName} = ${edge.node.id}`);\r",
                              "    });\r",
                              "\r",
                              "    console.log(\"✅ Environment variables for all products have been created\");\r",
                              "});\r",
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        },
                        {
                          "listen": "prerequest",
                          "script": {
                            "exec": [
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "query {\r\n  products (\r\n       order: [{ code: ASC }]\r\n       where: {category:{neq:CONCEPT}}\r\n       first:3\r\n  ) {\r\n    edges {\r\n      node {\r\n        id\r\n        code\r\n        name\r\n      }\r\n    }\r\n  }     \r\n}",
                            "variables": ""
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "8- M. Create Final Invoice",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "pm.test(\"Variable creation\", function () {\r",
                              "    let jsd = pm.response.json();\r",
                              "\r",
                              "    if (jsd.data == null)\r",
                              "        {console.error(\"Unable to save environment variable\");return;}\r",
                              "\r",
                              "    let result = jsd.data.createSalesInvoice;\r",
                              "    pm.environment.set(\"finalInvoiceId\", result.id);\r",
                              "    console.log(\"'finalInvoiceId' environment variable has been created : \" + pm.environment.get(\"finalInvoiceId\"));\r",
                              "});\r",
                              "\r",
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        },
                        {
                          "listen": "prerequest",
                          "script": {
                            "exec": [
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "mutation CreateFinalInvoice($values: SalesInvoiceCreateGLDtoInput!) {\r\n  createSalesInvoice(input: $values) {\r\n      id\r\n  }\r\n}\r\n",
                            "variables": "{\r\n  \"values\": {\r\n    \"customerId\": \"{{customerId}}\",\r\n    \"operationalNumber\":\"FIN002\",\r\n    \"documentDate\": \"{{dateInFirstExercice}}\",\r\n    \"lines\": [\r\n      {\r\n        \"productId\": \"{{productId_1}}\",\r\n        \"totalQuantity\": 3,\r\n        \"unitPrice\": 120\r\n      },\r\n      {\r\n        \"productId\": \"{{productId_2}}\",\r\n        \"totalQuantity\": 10,\r\n        \"unitPrice\": 45\r\n      },\r\n      {\r\n        \"productId\": \"{{advanceProductId}}\",\r\n        \"originId\": \"{{advanceInvoiceId}}\",\r\n        \"totalQuantity\": -1,\r\n        \"unitPrice\": 500\r\n      }\r\n    ]\r\n  }\r\n}\r\n"
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "9- ⚙️ M.Post the Final Invoice",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "mutation($input: PostSalesInvoiceGLDtoInput!) {\r\n  postSalesInvoice(input: $input) {\r\n    accountingEntryId\r\n    accountingEntryNumber\r\n    accountingEntries {\r\n        accountingEntryId\r\n        accountingEntryNumber\r\n    }\r\n  }\r\n}",
                            "variables": "{\r\n  \"input\": {\r\n    \"salesInvoiceId\": \"{{finalInvoiceId}}\",\r\n    \"accountingEntryDescription\": \"Sales Invoice validation\",\r\n    \"journalTypeId\": \"{{journalSalesId}}\"\r\n  }\r\n}"
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "10- Q.accountingEntries related to these invoices",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "query ($advanceInvoiceId: UUID!, $finalInvoiceId: UUID!) {\r\n    accountingEntries(\r\n        where: {\r\n            sourceEntityId: {in: [$advanceInvoiceId, $finalInvoiceId]}\r\n        }\r\n    )\r\n    {\r\n        edges {\r\n            node {\r\n                id\r\n                date\r\n                journalType{code}\r\n                sourceEntityId\r\n                salesInvoice{id documentDate operationalNumber status}\r\n                number    \r\n                documentNumber\r\n                documentDate    \r\n                sourceType      \r\n                accountingEntryLines {\r\n                    subAccount{code name}\r\n                    description\r\n                    creditAmount\r\n                    debitAmount\r\n                    order\r\n                    accountingEntryThirdParty {code socialName}\r\n                }\r\n            }\r\n        }\r\n        totalCount\r\n        pageInfo {\r\n            hasNextPage\r\n        }\r\n    }     \r\n}",
                            "variables": "{\r\n  \"advanceInvoiceId\": \"{{advanceInvoiceId}}\",\r\n  \"finalInvoiceId\": \"{{finalInvoiceId}}\"\r\n}\r\n"
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    }
                  ]
                },
                {
                  "name": "⚙️ M.Generate a Full Credit Note",
                  "item": [
                    {
                      "name": "1 - Q.SalesInvoices - not Pending and not hasCreditNote - first id filled in {{invoiceId}}",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "pm.test(\"Variables creation\", function () {\r",
                              "    let jsd = pm.response.json();\r",
                              "\r",
                              "    if (jsd.data == null || jsd.data.salesInvoices.edges.length == 0)\r",
                              "        {console.error(\"Unable to save environment variable\");return;}\r",
                              "    pm.environment.set(\"invoiceId\", jsd.data.salesInvoices.edges[0].node.id);\r",
                              "    console.log(\"'invoiceId' environment variable has been created : \" + pm.environment.get(\"invoiceId\"));\r",
                              "});"
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        },
                        {
                          "listen": "prerequest",
                          "script": {
                            "exec": [
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "query {\r\n  salesInvoices (\r\n        first:100\r\n        where: {\r\n          and: [\r\n            {status: {neq: \"Pending\"}},\r\n            {hasCreditNote: {eq: false}}\r\n          ]\r\n        }\r\n        order: { operationalNumber: DESC }\r\n    )  {\r\n        edges {\r\n            node {\r\n                id\r\n                socialName\r\n                operationalNumber\r\n                hasCreditNote\r\n                customerId\r\n                documentDate\r\n                status\r\n                totalNet\r\n                discount\r\n                lines{\r\n                    productCode\r\n                    productId\r\n                    productName\r\n                    totalQuantity\r\n                    unitPrice\r\n                    firstDiscount\r\n                    totalNet\r\n                }\r\n            }\r\n        }\r\n        totalCount\r\n        pageInfo {\r\n         hasNextPage\r\n        }\r\n    }\r\n}",
                            "variables": ""
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "2 - ⚙️ M.Generate a Credit Note for this invoice",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "pm.test(\"Credit Note ID Extraction\", function () {\r",
                              "    let jsd = pm.response.json();\r",
                              "\r",
                              "    if (jsd.data == null || jsd.data.generateCreditNote == null || jsd.data.generateCreditNote.id == null) {\r",
                              "        console.error(\"Unable to extract credit note ID\");\r",
                              "        return;\r",
                              "    }\r",
                              "\r",
                              "    pm.environment.set(\"creditNoteId\", jsd.data.generateCreditNote.id);\r",
                              "    console.log(\"CreditnoteId saved to environment: \" + pm.environment.get(\"creditNoteId\"));\r",
                              "});\r",
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        },
                        {
                          "listen": "prerequest",
                          "script": {
                            "exec": [
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "mutation($input: GenerateCreditNoteGLDtoInput!) {\r\n  generateCreditNote(input: $input) {\r\n    id\r\n  }\r\n}",
                            "variables": "{\r\n  \"input\": {\r\n    \"id\": \"{{invoiceId}}\"\r\n  }\r\n}"
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "3 - Q.SalesInvoice - Reading the credit note with the linked invoice information.",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "pm.test(\"Variables creation\", function () {\r",
                              "    let jsd = pm.response.json();\r",
                              "\r",
                              "    if (jsd.data == null || jsd.data.salesInvoices.edges.length == 0)\r",
                              "        {console.error(\"Unable to save environment variable\");return;}\r",
                              "    pm.environment.set(\"invoiceId\", jsd.data.salesInvoices.edges[0].node.id);\r",
                              "    console.log(\"'currentId' environment variable has been created : \" + pm.environment.get(\"invoiceId\"));\r",
                              "});"
                            ],
                            "type": "text/javascript",
                            "packages": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "query GetSalesInvoices($creditNoteId: UUID!) {\r\n  salesInvoices (\r\n        where: {id: {eq: $creditNoteId}}\r\n    ) {\r\n        edges {\r\n            node {\r\n                id\r\n                type\r\n                status\r\n                socialName\r\n                operationalNumber\r\n                customerId\r\n                documentDate\r\n                sourceSalesInvoice{\r\n                    type\r\n                    operationalNumber\r\n                    documentDate\r\n                }\r\n                totalNet\r\n                discount\r\n                lines{\r\n                    productCode\r\n                    productId\r\n                    productName\r\n                    totalQuantity\r\n                    unitPrice\r\n                    firstDiscount\r\n                    totalNet\r\n                }\r\n            }\r\n        }\r\n        totalCount\r\n        pageInfo {\r\n         hasNextPage\r\n        }\r\n    }\r\n}\r\n",
                            "variables": "{\r\n  \"creditNoteId\": \"{{creditNoteId}}\"\r\n}\r\n"
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    }
                  ],
                  "description": "Example of credit note generation:\n\n- Generating a credit note from a Closed or Posted invoice that does not yet have a credit note.\n    \n\nThe example\n\n1. retrieves the most recent invoice that is not in \"**`Pending`**\" status and has `hasCreditNote=false`.\n    \n2. It then generates a credit note.\n    \n3. Finally, It allows to read the credit Note with the linked invoice information.\n    \n\n**Attention:**  \nIf the initial query returns no records, you will need to validate an invoice in Sage Active so that its status is set to Closed or Posted."
                },
                {
                  "name": "⚙️ M.Generate a Partial Credit Note",
                  "item": [
                    {
                      "name": "1 - Q.SalesInvoices - not Pending and not hasCreditNote - first id filled in {{invoiceId}}",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "pm.test(\"Variables creation\", function () {\r",
                              "    let jsd = pm.response.json();\r",
                              "\r",
                              "    if (!jsd.data || !jsd.data.salesInvoices.edges.length) {\r",
                              "        console.error(\"Unable to save environment variables\");\r",
                              "        return;\r",
                              "    }\r",
                              "\r",
                              "    let invoiceNode = jsd.data.salesInvoices.edges[0].node;\r",
                              "    pm.environment.set(\"invoiceId\", invoiceNode.id);\r",
                              "    console.log(\"'invoiceId' environment variable has been created: \" + pm.environment.get(\"invoiceId\"));\r",
                              "\r",
                              "    let firstLine = invoiceNode.lines[0];\r",
                              "\r",
                              "    pm.environment.set(\"productId\", firstLine.productId);\r",
                              "    pm.environment.set(\"totalQuantity\", firstLine.totalQuantity);\r",
                              "\r",
                              "    console.log(\"'productId' environment variable has been created: \" + pm.environment.get(\"productId\"));\r",
                              "    console.log(\"'totalQuantity' environment variable has been created: \" + pm.environment.get(\"totalQuantity\"));\r",
                              "});\r",
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        },
                        {
                          "listen": "prerequest",
                          "script": {
                            "exec": [
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "query {\r\n  salesInvoices (\r\n        first:100\r\n        where: {\r\n          and: [\r\n            {status: {neq: \"Pending\"}},\r\n            {hasCreditNote: {eq: false}}\r\n          ]\r\n        }\r\n        order: { operationalNumber: DESC }\r\n    )  {\r\n        edges {\r\n            node {\r\n                id\r\n                socialName\r\n                operationalNumber\r\n                hasCreditNote\r\n                customerId\r\n                documentDate\r\n                status\r\n                totalNet\r\n                discount\r\n                lines{\r\n                    productCode\r\n                    productId\r\n                    productName\r\n                    totalQuantity\r\n                    unitPrice\r\n                    firstDiscount\r\n                    totalNet\r\n                }\r\n            }\r\n        }\r\n        totalCount\r\n        pageInfo {\r\n         hasNextPage\r\n        }\r\n    }\r\n}",
                            "variables": ""
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "2- Q.accountingExercises - most recently opened, startDate filled in {{dateOutFirstExercice}}",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "pm.test(\"Variables creation\", function () {\r",
                              "    let jsd = pm.response.json();\r",
                              "    console.log(jsd.data.accountingExercises.edges[0].node.id);\r",
                              "    if (jsd.data == null || jsd.data.accountingExercises.edges.length == 0)\r",
                              "        {console.error(\"Unable to save environment variable\");return;}\r",
                              "    pm.environment.set(\"dateOutFirstExercice\",jsd.data.accountingExercises.edges[0].node.endDate);\r",
                              "    console.log(\"'dateOutFirstExercice' environment variable has been created : \" + pm.environment.get(\"dateOutFirstExercice\"));\r",
                              "});\r",
                              "\r",
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "query {\r\n    accountingExercises(\r\n        where: {status: {eq: OPEN}}\r\n        first:1\r\n        order:{endDate:DESC}\r\n        ) {\r\n        edges {\r\n            node {\r\n               endDate\r\n            }\r\n        }\r\n    }     \r\n}",
                            "variables": ""
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "3 - ⚙️ M.Generate a Partial Credit Note for this invoice",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "pm.test(\"Credit Note ID Extraction\", function () {\r",
                              "    let jsd = pm.response.json();\r",
                              "\r",
                              "    if (jsd.data == null || jsd.data.generateCreditNote == null || jsd.data.generateCreditNote.id == null) {\r",
                              "        console.error(\"Unable to extract credit note ID\");\r",
                              "        return;\r",
                              "    }\r",
                              "\r",
                              "    pm.environment.set(\"creditNoteId\", jsd.data.generateCreditNote.id);\r",
                              "    console.log(\"CreditnoteId saved to environment: \" + pm.environment.get(\"creditNoteId\"));\r",
                              "});\r",
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        },
                        {
                          "listen": "prerequest",
                          "script": {
                            "exec": [
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "mutation($input: GenerateCreditNoteGLDtoInput!) {\r\n  generateCreditNote(input: $input) {\r\n    id\r\n  }\r\n}",
                            "variables": "{\r\n  \"input\": {\r\n    \"id\": \"{{invoiceId}}\", \r\n    \"outputDocumentDate\":\"{{dateOutFirstExercice}}\",\r\n    \"lines\": [\r\n      {\r\n        \"productId\": \"{{productId}}\",\r\n        \"quantity\": {{totalQuantity}}\r\n      }\r\n    ]\r\n  }\r\n}"
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "4 - Q.SalesInvoice - Reading the credit note with the linked invoice information.",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "pm.test(\"Variables creation\", function () {\r",
                              "    let jsd = pm.response.json();\r",
                              "\r",
                              "    if (jsd.data == null || jsd.data.salesInvoices.edges.length == 0)\r",
                              "        {console.error(\"Unable to save environment variable\");return;}\r",
                              "    pm.environment.set(\"invoiceId\", jsd.data.salesInvoices.edges[0].node.id);\r",
                              "    console.log(\"'currentId' environment variable has been created : \" + pm.environment.get(\"invoiceId\"));\r",
                              "});"
                            ],
                            "type": "text/javascript",
                            "packages": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "query GetSalesInvoices($creditNoteId: UUID!) {\r\n  salesInvoices (\r\n        where: {id: {eq: $creditNoteId}}\r\n    ) {\r\n        edges {\r\n            node {\r\n                id\r\n                type\r\n                status\r\n                socialName\r\n                operationalNumber\r\n                customerId\r\n                documentDate\r\n                sourceSalesInvoice{\r\n                    type\r\n                    operationalNumber\r\n                    documentDate\r\n                }\r\n                totalNet\r\n                discount\r\n                lines{\r\n                    productCode\r\n                    productId\r\n                    productName\r\n                    totalQuantity\r\n                    unitPrice\r\n                    firstDiscount\r\n                    totalNet\r\n                }\r\n            }\r\n        }\r\n        totalCount\r\n        pageInfo {\r\n         hasNextPage\r\n        }\r\n    }\r\n}\r\n",
                            "variables": "{\r\n  \"creditNoteId\": \"{{creditNoteId}}\"\r\n}\r\n"
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    }
                  ],
                  "description": "Example of credit note generation:\n\n- Generating a credit note from a Closed or Posted invoice that does not yet have a credit note.\n    \n\nThe example\n\n1. retrieves the most recent invoice that is not in \"**`Pending`**\" status and has `hasCreditNote=false`.\n    \n2. It then generates a **partial** credit note.\n    \n3. Finally, It allows to read the credit Note with the linked invoice information.\n    \n\n**Attention:**  \nIf the initial query returns no records, you will need to validate an invoice in Sage Active so that its status is set to Closed or Posted."
                },
                {
                  "name": "⚙️ 🆕 M.Generate a Partial Credit Note with a specific prefix number",
                  "item": [
                    {
                      "name": "1 - Q.SalesInvoices - not Pending and not hasCreditNote - first id filled in {{invoiceId}}",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "pm.test(\"Variables creation\", function () {\r",
                              "    let jsd = pm.response.json();\r",
                              "\r",
                              "    if (!jsd.data || !jsd.data.salesInvoices.edges.length) {\r",
                              "        console.error(\"Unable to save environment variables\");\r",
                              "        return;\r",
                              "    }\r",
                              "\r",
                              "    let invoiceNode = jsd.data.salesInvoices.edges[0].node;\r",
                              "    pm.environment.set(\"invoiceId\", invoiceNode.id);\r",
                              "    console.log(\"'invoiceId' environment variable has been created: \" + pm.environment.get(\"invoiceId\"));\r",
                              "\r",
                              "    let firstLine = invoiceNode.lines[0];\r",
                              "\r",
                              "    pm.environment.set(\"productId\", firstLine.productId);\r",
                              "    pm.environment.set(\"totalQuantity\", firstLine.totalQuantity);\r",
                              "\r",
                              "    console.log(\"'productId' environment variable has been created: \" + pm.environment.get(\"productId\"));\r",
                              "    console.log(\"'totalQuantity' environment variable has been created: \" + pm.environment.get(\"totalQuantity\"));\r",
                              "});\r",
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        },
                        {
                          "listen": "prerequest",
                          "script": {
                            "exec": [
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "query {\r\n  salesInvoices (\r\n        first:100\r\n        where: {\r\n          and: [\r\n            {status: {neq: \"Pending\"}},\r\n            {hasCreditNote: {eq: false}}\r\n          ]\r\n        }\r\n        order: { operationalNumber: DESC }\r\n    )  {\r\n        edges {\r\n            node {\r\n                id\r\n                socialName\r\n                operationalNumber\r\n                hasCreditNote\r\n                customerId\r\n                documentDate\r\n                status\r\n                totalNet\r\n                discount\r\n                lines{\r\n                    productCode\r\n                    productId\r\n                    productName\r\n                    totalQuantity\r\n                    unitPrice\r\n                    firstDiscount\r\n                    totalNet\r\n                }\r\n            }\r\n        }\r\n        totalCount\r\n        pageInfo {\r\n         hasNextPage\r\n        }\r\n    }\r\n}",
                            "variables": ""
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "2- Q.OperationalNumberPresetText Get the most recent record",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "pm.test(\"Variables creation\", function () {\r",
                              "    let jsd = pm.response.json();\r",
                              "\r",
                              "    if (jsd.data == null || jsd.data.operationalNumberPresetTexts.edges.length == 0) {\r",
                              "        console.error(\"Unable to save environment variable for operationalNumberPresetText\");\r",
                              "        return;\r",
                              "    }\r",
                              "\r",
                              "    pm.environment.set(\r",
                              "        \"operationalNumberPresetTextId\",\r",
                              "        jsd.data.operationalNumberPresetTexts.edges[0].node.id\r",
                              "    );\r",
                              "\r",
                              "    console.log(\r",
                              "        \"operationalNumberPresetTextId environment variable has been created : \" +\r",
                              "        pm.environment.get(\"operationalNumberPresetTextId\")\r",
                              "    );\r",
                              "});"
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "query {\r\n  operationalNumberPresetTexts(\r\n    where:{operation:{eq:INVOICE}}\r\n    order:{creationDate:DESC}\r\n    first:1\r\n  ) {\r\n        edges {\r\n            node {\r\n                id\r\n                description\r\n                presetText\r\n            }\r\n        }\r\n    }\r\n}",
                            "variables": ""
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "3 - ⚙️ M.Generate a Partial Credit Note for this invoice",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "pm.test(\"Credit Note ID Extraction\", function () {\r",
                              "    let jsd = pm.response.json();\r",
                              "\r",
                              "    if (jsd.data == null || jsd.data.generateCreditNote == null || jsd.data.generateCreditNote.id == null) {\r",
                              "        console.error(\"Unable to extract credit note ID\");\r",
                              "        return;\r",
                              "    }\r",
                              "\r",
                              "    pm.environment.set(\"creditNoteId\", jsd.data.generateCreditNote.id);\r",
                              "    console.log(\"CreditnoteId saved to environment: \" + pm.environment.get(\"creditNoteId\"));\r",
                              "});\r",
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        },
                        {
                          "listen": "prerequest",
                          "script": {
                            "exec": [
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "mutation($input: GenerateCreditNoteGLDtoInput!) {\r\n  generateCreditNote(input: $input) {\r\n    id\r\n  }\r\n}",
                            "variables": "{\r\n  \"input\": {\r\n    \"id\": \"{{invoiceId}}\", \r\n     \"operationalNumberPresetTextId\":\"{{operationalNumberPresetTextId}}\",\r\n    \"lines\": [\r\n      {\r\n        \"productId\": \"{{productId}}\",\r\n        \"quantity\": {{totalQuantity}}\r\n      }\r\n    ]\r\n  }\r\n}"
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "4 - Q.SalesInvoice - Reading the credit note with the linked invoice information.",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "pm.test(\"Variables creation\", function () {\r",
                              "    let jsd = pm.response.json();\r",
                              "\r",
                              "    if (jsd.data == null || jsd.data.salesInvoices.edges.length == 0)\r",
                              "        {console.error(\"Unable to save environment variable\");return;}\r",
                              "    pm.environment.set(\"invoiceId\", jsd.data.salesInvoices.edges[0].node.id);\r",
                              "    console.log(\"'currentId' environment variable has been created : \" + pm.environment.get(\"invoiceId\"));\r",
                              "});"
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "query GetSalesInvoices($creditNoteId: UUID!) {\r\n  salesInvoices (\r\n        where: {id: {eq: $creditNoteId}}\r\n    ) {\r\n        edges {\r\n            node {\r\n                id\r\n               operationalNumberPresetText{presetText description}\r\n                type\r\n                status\r\n                socialName\r\n                operationalNumber\r\n                customerId\r\n                documentDate\r\n                sourceSalesInvoice{\r\n                    type\r\n                    operationalNumber\r\n                    documentDate\r\n                }\r\n                totalNet\r\n                discount\r\n                lines{\r\n                    productCode\r\n                    productId\r\n                    productName\r\n                    totalQuantity\r\n                    unitPrice\r\n                    firstDiscount\r\n                    totalNet\r\n                }\r\n            }\r\n        }\r\n        totalCount\r\n        pageInfo {\r\n         hasNextPage\r\n        }\r\n    }\r\n}\r\n",
                            "variables": "{\r\n  \"creditNoteId\": \"{{creditNoteId}}\"\r\n}\r\n"
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    }
                  ],
                  "description": "Example of credit note generation:\n\n- Generating a credit note from a Closed or Posted invoice that does not yet have a credit note.\n    \n\nThe example\n\n1. retrieves the most recent invoice that is not in \"**`Pending`**\" status and has `hasCreditNote=false`.\n    \n2. It then generates a **partial** credit note.\n    \n3. Finally, It allows to read the credit Note with the linked invoice information.\n    \n\n**Attention:**  \nIf the initial query returns no records, you will need to validate an invoice in Sage Active so that its status is set to Closed or Posted."
                },
                {
                  "name": "⚙️ Q.Document Pdf Email",
                  "item": [
                    {
                      "name": "1 - Q.SalesInvoices first element filled in {{currentId}}",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "pm.test(\"Variables creation\", function () {\r",
                              "    let jsd = pm.response.json();\r",
                              "\r",
                              "    if (jsd.data == null || jsd.data.salesInvoices .edges.length == 0)\r",
                              "        {console.error(\"Unable to save environment variable\");return;}\r",
                              "    pm.environment.set(\"currentId\", jsd.data.salesInvoices .edges[0].node.id);\r",
                              "    console.log(\"'currentId' environment variable has been created : \" + pm.environment.get(\"currentId\"));\r",
                              "});"
                            ],
                            "type": "text/javascript",
                            "packages": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "query  {\r\n  salesInvoices  (first:1) {\r\n    edges {\r\n      node {\r\n        id\r\n      }\r\n    }\r\n  }\r\n}",
                            "variables": ""
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "2 - Q.userProfile Get Email From",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "pm.test(\"Variables creation\", function () {\r",
                              "    let jsonResponse = pm.response.json();\r",
                              "\r",
                              "    if (jsonResponse.data == null || jsonResponse.data.userProfile == null)\r",
                              "        {console.error(\"Unable to save environment variable\"); return;}\r",
                              "    pm.environment.set(\"emailFrom\", jsonResponse.data.userProfile.authenticationEmail);\r",
                              "    console.log(\"'emailFrom' environment variable has been created : \" + pm.environment.get(\"emailFrom\"));\r",
                              "});\r",
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "query {\r\n  userProfile {\r\n    authenticationEmail\r\n  }\r\n}\r\n",
                            "variables": ""
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "3 - Q.Email New Invoice template",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "pm.test(\"Save emailTemplate fields\", function () {\r",
                              "    let jsonResponse = pm.response.json();\r",
                              "\r",
                              "    if (\r",
                              "        jsonResponse.data == null ||\r",
                              "        jsonResponse.data.emailTemplates == null ||\r",
                              "        jsonResponse.data.emailTemplates.edges == null ||\r",
                              "        jsonResponse.data.emailTemplates.edges.length === 0\r",
                              "    ) {\r",
                              "        console.error(\"Unable to save environment variables\");\r",
                              "        return;\r",
                              "    }\r",
                              "\r",
                              "    let template = jsonResponse.data.emailTemplates.edges[0].node;\r",
                              "\r",
                              "    let templateFields = {\r",
                              "        subject: template.emailSubject,\r",
                              "        message: template.emailMessage,\r",
                              "        sendMeCopy: template.sendMeCopy,\r",
                              "    };\r",
                              "\r",
                              "    pm.environment.set(\"emailSubject\", templateFields.subject);\r",
                              "    pm.environment.set(\"emailMessage\", templateFields.message);\r",
                              "    pm.environment.set(\"sendEmailCopy\", templateFields.sendMeCopy);\r",
                              "\r",
                              "    console.log(\"Email template fields saved to environment variables\", templateFields);\r",
                              "});\r",
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "query {\r\n  emailTemplates(\r\n    first: 1\r\n    where: { documentType: { eq: NEW_INVOICE } }\r\n  ) {\r\n    edges {\r\n      node {\r\n        id\r\n        emailSubject\r\n        emailMessage\r\n        sendMeCopy\r\n      }\r\n    }\r\n  }\r\n}\r\n",
                            "variables": ""
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "4 - ⚙️ Q.DocumentPdfEmail",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "query($input: DocumentPdfEmailGLDtoInput!) {\r\n  documentPdfEmail(input: $input) {\r\n    type\r\n    id\r\n  }\r\n}",
                            "variables": "{\r\n  \"input\": {\r\n    \"type\": \"SALES_INVOICE\",\r\n    \"id\": \"{{currentId}}\",\r\n    \"emailFrom\": \"{{emailFrom}}\",\r\n    \"emailTo\": \"test@sage.com\",\r\n    \"emailBcc\": \"test1@sage.com\",\r\n    \"sendEmailCopy\": {{sendEmailCopy}},\r\n    \"emailSubject\": \"{{emailSubject}}\",\r\n    \"emailMessage\": \"{{emailMessage}}\"\r\n  }\r\n}\r\n"
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    }
                  ],
                  "description": "### DocumentPdfEmail Service\n\nThe DocumentPdfEmail service facilitates the sending of documents in PDF format via email directly through the API. This service simplifies the process of dispatching PDF documents to designated recipients, complete with options for CC and BCC.\n\n#### Important:\n\n- The sender of the email must be the current Sage Active user. Hence, in the example, the user's email is retrieved via `userProfile`.\n    \n- Replace `emailTo` and/or `emailCC` in the variables with email addresses that will allow you to receive the email, such as your personal email address."
                },
                {
                  "name": "Q.SalesInvoices - first id filled in {{currentId}}",
                  "event": [
                    {
                      "listen": "test",
                      "script": {
                        "exec": [
                          "pm.test(\"Variables creation\", function () {\r",
                          "    let jsd = pm.response.json();\r",
                          "\r",
                          "    if (jsd.data == null || jsd.data.salesInvoices.edges.length == 0)\r",
                          "        {console.error(\"Unable to save environment variable\");return;}\r",
                          "    pm.environment.set(\"currentId\", jsd.data.salesInvoices.edges[0].node.id);\r",
                          "    console.log(\"'currentId' environment variable has been created : \" + pm.environment.get(\"currentId\"));\r",
                          "});"
                        ],
                        "type": "text/javascript",
                        "packages": {},
                        "requests": {}
                      }
                    }
                  ],
                  "request": {
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "query {\r\n  salesInvoices (\r\n        first:500\r\n        order: { creationDate: DESC }\r\n    )  {\r\n        edges {\r\n            node {\r\n                sourceType\r\n                firstDueDate\r\n                id\r\n                socialName\r\n                operationalNumber\r\n                operationalNumberPresetTextId\r\n                operationalNumberPresetText{presetText description}\r\n                salesOrderNumber\r\n                creationDate\r\n                customerId\r\n                documentDate\r\n                status\r\n                totalNet\r\n                discount\r\n                documentTypeId\r\n                documentType{code name}\r\n                documentLanguage\r\n                createdInSoftwareVersion\r\n                specialMention\r\n                externalReference\r\n                lines{\r\n                    order\r\n                    productCode\r\n                    productId\r\n                    productName\r\n                    unitOfMeasurement{\r\n                        name\r\n                        numberOfDecimals\r\n                    }\r\n                    totalQuantity\r\n                    unitPrice\r\n                    firstDiscount\r\n                    totalNet\r\n                    availableForCreditNoteQuantity\r\n                    withholdingPercentage\r\n                    totalWithholding\r\n                    totalLiquidNoWithholding\r\n                }\r\n                openItems{\r\n                    status\r\n                    amount\r\n                    paidAmountAccumulated\r\n                    paymentMean{\r\n                        description\r\n                    }\r\n                }\r\n                paymentTermLines{\r\n                    order\r\n                    paymentMean{\r\n                        description\r\n                    }\r\n                    type\r\n                    value\r\n                    condition\r\n                    day\r\n                    payDays\r\n                }\r\n            }\r\n        }\r\n        totalCount\r\n        pageInfo {\r\n         hasNextPage\r\n        }\r\n    }\r\n}",
                        "variables": ""
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                },
                {
                  "name": "Q.SalesInvoices filtered by Id",
                  "event": [
                    {
                      "listen": "test",
                      "script": {
                        "exec": [
                          ""
                        ],
                        "type": "text/javascript",
                        "packages": {}
                      }
                    }
                  ],
                  "request": {
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "query ($id : UUID!) {\r\n  salesInvoices (where : { id : { eq : $id }}) {\r\n    edges {\r\n      node {\r\n        id\r\n        customerId\r\n        documentDate\r\n        operationalNumber\r\n        salesOrderNumber\r\n        salesDiscountGroupId\r\n        salesTariffId\r\n        socialName\r\n        status\r\n        totalGross\r\n        totalLiquid\r\n        totalNet\r\n        totalVat\r\n        deliveryAddress{\r\n            city\r\n            countryId\r\n            countryName\r\n            firstLine\r\n            province\r\n            secondLine\r\n            zipCode\r\n        }\r\n        mainAddress{\r\n            city\r\n            countryId\r\n            countryName\r\n            firstLine\r\n            name\r\n            province\r\n            secondLine\r\n            zipCode           \r\n        }\r\n        lines{\r\n            id\r\n            firstDiscount\r\n            productCode\r\n            productId\r\n            productName\r\n            totalNet\r\n            totalQuantity\r\n            unitPrice\r\n            vatPercentage            \r\n        }\r\n      }\r\n    }\r\n  }\r\n}",
                        "variables": "{\r\n  \"id\":\"{{currentId}}\"\r\n}"
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                },
                {
                  "name": "Q.SalesInvoiceOpenItems",
                  "event": [
                    {
                      "listen": "test",
                      "script": {
                        "exec": [
                          "pm.test(\"Variables creation\", function () {\r",
                          "    let jsd = pm.response.json();\r",
                          "\r",
                          "    if (jsd.data == null || jsd.data.salesInvoiceOpenItems.edges.length == 0) {\r",
                          "        console.error(\"Unable to save environment variable\");\r",
                          "        return;\r",
                          "    }\r",
                          "\r",
                          "    // Get the first node's data\r",
                          "    let firstNode = jsd.data.salesInvoiceOpenItems.edges[0].node;\r",
                          "\r",
                          "    // Retrieve the openItemId, documentNumber, and thirdPartyId\r",
                          "    let openItemId = firstNode.id;\r",
                          "    let documentNumber = firstNode.salesInvoice.operationalNumber;\r",
                          "    let thirdPartyId = firstNode.salesInvoice.customer.id;\r",
                          "\r",
                          "    // Save these values in environment variables\r",
                          "    pm.environment.set(\"openItemId\", openItemId);\r",
                          "    pm.environment.set(\"documentNumber\", documentNumber);\r",
                          "    pm.environment.set(\"thirdPartyId\", thirdPartyId);\r",
                          "\r",
                          "    // Log the creation of these variables\r",
                          "    console.log(\"'openItemId' environment variable has been created: \" + pm.environment.get(\"openItemId\"));\r",
                          "    console.log(\"'documentNumber' environment variable has been created: \" + pm.environment.get(\"documentNumber\"));\r",
                          "    console.log(\"'thirdPartyId' environment variable has been created: \" + pm.environment.get(\"thirdPartyId\"));\r",
                          "});\r",
                          ""
                        ],
                        "type": "text/javascript",
                        "packages": {}
                      }
                    }
                  ],
                  "request": {
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "query {\r\n  salesInvoiceOpenItems(\r\n    order: {dueDate:ASC}\r\n  ) {\r\n    edges {\r\n      node {\r\n        salesInvoice {\r\n          documentDate\r\n          operationalNumber\r\n          status\r\n          totalLiquid\r\n          customer {\r\n            id\r\n            code\r\n            socialName\r\n          }\r\n        }\r\n        id\r\n        status\r\n        amount\r\n        dueDate\r\n        paidAmountAccumulated\r\n        paymentMean {\r\n          description\r\n        }\r\n        isAdvanceInvoicePayment\r\n      }\r\n    }\r\n    totalCount\r\n    pageInfo {\r\n        hasNextPage\r\n    }\r\n  }\r\n  \r\n}\r\n",
                        "variables": ""
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                },
                {
                  "name": "⚙️ Q.DocumentPdfPreview",
                  "event": [
                    {
                      "listen": "test",
                      "script": {
                        "exec": [
                          ""
                        ],
                        "type": "text/javascript"
                      }
                    }
                  ],
                  "request": {
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "    query($input: DocumentPdfPreviewGLDtoInput!) {\r\n        documentPdfPreview(input: $input) {\r\n            type\r\n            id\r\n            pdfPreview  \r\n        }\r\n    }",
                        "variables": "{\r\n  \"input\": {\r\n    \"type\": \"SALES_INVOICE\",\r\n    \"id\": \"{{currentId}}\"\r\n  }\r\n}\r\n"
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                }
              ],
              "description": "Example of invoice creation:\n\n- An invoice for an existing customer in Sage Active.\n    \n\nNote that, unlike quotes which allow for inputting leads, an invoice must **always** be associated with an **existing customer**."
            },
            {
              "name": "Sales Document Settings",
              "item": [
                {
                  "name": "unitOfMeasurementSalesSetups",
                  "request": {
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-organizationId",
                        "value": "{{X-OrganizationId}}",
                        "type": "text"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "query {\r\n    unitOfMeasurementSalesSetups(\r\n       first:500\r\n       order: { unitOfMeasurement: { name: ASC } }\r\n    ) {\r\n        edges {\r\n            node {\r\n                id\r\n                active\r\n                category\r\n                unitOfMeasurement{\r\n                    name\r\n                    numberOfDecimals\r\n                }\r\n            }\r\n        }\r\n    }    \r\n}",
                        "variables": ""
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                },
                {
                  "name": "Q.organizationSalesSetupByOrgId {{X-OrganizationId}}",
                  "request": {
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "query ($id: ID!) {\r\n    organizationSalesSetupByOrgId(id: $id) {\r\n        salesDeliveryNoteDefaultPresetTextId \r\n        salesOrderDefaultPresetTextId\r\n        salesInvoiceDefaultPresetTextId\r\n        salesCreditNoteDefaultPresetTextId\r\n        useSalesTracking\r\n        useVATRatesForDOM\r\n        allowPostingSalesInvoice\r\n        defaultSalesPostingInvoiceJournalTypeId\r\n        defaultSalesPostingInvoiceSessionId\r\n        allowPostingPurchaseInvoice\r\n        defaultPurchasePostingInvoiceJournalTypeId\r\n        defaultPurchasePostingInvoiceSessionId\r\n        askGenerateNonIdentifiedSalesInvoicesByDefault\r\n        nonIdentifiedSalesInvoiceMaxAmount\r\n       \r\n    }\r\n}",
                        "variables": "{\r\n    \"id\":\"{{X-OrganizationId}}\"\r\n}"
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                },
                {
                  "name": "Q.OperationalNumberPresetText",
                  "request": {
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "query {\r\n  operationalNumberPresetTexts {\r\n        edges {\r\n            node {\r\n                creationDate\r\n                modificationDate\r\n                isDefault\r\n                operation\r\n                description\r\n                presetText\r\n            }\r\n        }\r\n        totalCount\r\n        pageInfo {\r\n         hasNextPage\r\n        }\r\n    }\r\n}",
                        "variables": ""
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                },
                {
                  "name": "🆕⚙️Q.Email templates",
                  "request": {
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "query {\r\n  emailTemplates {\r\n        edges {\r\n            node {\r\n                creationDate\r\n                modificationDate\r\n                documentType\r\n                name\r\n                isDefault\r\n                sendMeCopy\r\n                sendAdditionalCopy\r\n                cc\r\n                bcc\r\n                emailSubject\r\n                emailMessage\r\n            }\r\n        }\r\n        totalCount\r\n        pageInfo {\r\n         hasNextPage\r\n        }\r\n    }\r\n}",
                        "variables": ""
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                }
              ]
            },
            {
              "name": "related SalesDocuments",
              "item": [
                {
                  "name": "🆕Get related SalesDocuments",
                  "item": [
                    {
                      "name": "1-Q.SalesQuotes - first id filled in {{currentId}}",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "pm.test(\"Variables creation\", function () {\r",
                              "    let jsd = pm.response.json();\r",
                              "\r",
                              "    if (jsd.data == null || jsd.data.salesQuotes.edges.length == 0)\r",
                              "        {console.error(\"Unable to save environment variable\");return;}\r",
                              "    pm.environment.set(\"currentId\", jsd.data.salesQuotes.edges[0].node.id);\r",
                              "    console.log(\"'currentId' environment variable has been created : \" + pm.environment.get(\"currentId\"));\r",
                              "});"
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        },
                        {
                          "listen": "prerequest",
                          "script": {
                            "exec": [
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "query {\r\n  salesQuotes (\r\n        first:500\r\n        order: { operationalNumber: DESC }\r\n    )  {\r\n        edges {\r\n            node {\r\n                sourceType\r\n                id\r\n                socialName\r\n                operationalNumber\r\n                creationDate\r\n                customerId\r\n                documentDate\r\n                status\r\n                declinedReason\r\n                totalNet\r\n                discount\r\n                documentTypeId\r\n                documentType{code name}\r\n                externalReference\r\n                lines{\r\n                    order\r\n                    productCode\r\n                    productId\r\n                    productName\r\n                    unitOfMeasurement{\r\n                        name\r\n                        numberOfDecimals\r\n                    }\r\n                    totalQuantity\r\n                    unitPrice\r\n                    firstDiscount\r\n                    totalNet\r\n                }\r\n            }\r\n        }\r\n        totalCount\r\n        pageInfo {\r\n         hasNextPage\r\n        }\r\n    }\r\n}",
                            "variables": ""
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "2-Q. related Sales Documents",
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-organizationId",
                            "value": "{{X-OrganizationId}}",
                            "type": "text"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "query ($quoteId: UUID!) {\r\n  relatedSalesDocuments(\r\n    where: {\r\n    or: [\r\n        { documentId: { eq: $quoteId } }\r\n        { originId: { eq: $quoteId } }\r\n    ]\r\n    }\r\n    order: { creationDate: ASC }\r\n  ) {\r\n    edges {\r\n      node {\r\n        documentId\r\n        documentType\r\n        operationalNumber\r\n        documentDate\r\n        originId\r\n        originDocumentType\r\n        status\r\n        totalLiquid\r\n      }\r\n    }\r\n  }\r\n}\r\n",
                            "variables": "{\r\n  \"quoteId\": \"{{currentId}}\"\r\n}\r\n"
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "3-Q.current Fiscal Year",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "// Récupérer la réponse JSON\r",
                              "let response = pm.response.json();\r",
                              "\r",
                              "if (response.data.accountingExercises.edges.length > 0) {\r",
                              "    let exercise = response.data.accountingExercises.edges[0].node;\r",
                              "    pm.environment.set(\"startDate\", exercise.startDate);\r",
                              "    pm.environment.set(\"endDate\", exercise.endDate);\r",
                              "}"
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        },
                        {
                          "listen": "prerequest",
                          "script": {
                            "exec": [
                              "const today = new Date().toISOString().split('T')[0];\r",
                              "pm.variables.set(\"today\", today);\r",
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "# Retrieves the current fiscal (accounting) exercise based on the given $today date.  \r\n# It returns the startDate and endDate of the exercise, which can then be used  \r\n# to calculate KPIs over the current fiscal year.\r\n\r\nquery ($today: DateTime!) {\r\n  accountingExercises(\r\n    where: {\r\n      and: [\r\n        { status: { eq: OPEN } }\r\n        { startDate: { lte: $today } }\r\n        { endDate: { gte: $today } }\r\n      ]\r\n    }\r\n  ) {\r\n    edges {\r\n      node {\r\n        startDate\r\n        endDate\r\n      }\r\n    }\r\n  }\r\n}\r\n",
                            "variables": "{\r\n  \"today\": \"{{today}}\"\r\n}"
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "4-Q.Kpi All quotes converted",
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "# This query retrieves and aggregates converted salesQuotes within two dates.  \r\n# By default, the startDate and endDate values are provided by the \"current Fiscal Year\" query.  \r\n\r\nquery ($startDate: DateTime!, $endDate: DateTime!) {\r\n  relatedSalesDocuments(\r\n    where: {\r\n      documentDate: { gte: $startDate, lte: $endDate }\r\n      originDocumentType: { eq: QUOTE }\r\n    }\r\n  ) {\r\n    edges {\r\n      node {\r\n        originId\r\n        documentDate\r\n      }\r\n    }\r\n    aggregate(\r\n      aggregateFields: [\"originId|DISTINCTCOUNT\"]\r\n    ) {\r\n      aggregates {\r\n        value\r\n      }\r\n    }\r\n  }\r\n}\r\n",
                            "variables": "{\r\n  \"startDate\": \"{{startDate}}\",\r\n  \"endDate\": \"{{endDate}}\"\r\n}\r\n"
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    }
                  ]
                },
                {
                  "name": "🆕Link two documents",
                  "item": [
                    {
                      "name": "1-Q.customers - first activated & current legislation",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "pm.test(\"Variables creation\", function () {\r",
                              "    let jsd = pm.response.json();\r",
                              "\r",
                              "    if (jsd.data == null || jsd.data.customers.edges.length == 0)\r",
                              "        {console.error(\"Unable to save environment variable for customer\");return;}\r",
                              "    pm.environment.set(\"customerId\", jsd.data.customers.edges[0].node.id);\r",
                              "    console.log(\"customerId environment variable has been created : \" + pm.environment.get(\"customerId\"));\r",
                              "});"
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        },
                        {
                          "listen": "prerequest",
                          "script": {
                            "exec": [
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        }
                      ],
                      "request": {
                        "auth": {
                          "type": "bearer",
                          "bearer": [
                            {
                              "key": "token",
                              "value": "{{accessToken}}",
                              "type": "string"
                            }
                          ]
                        },
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "query ($countryAcronym : String!) {\r\n    customers (\r\n        order: [{ code: ASC }]\r\n        where: {\r\n            countryAcronym: {eq:$countryAcronym}\r\n            disabled: {eq: false}\r\n            }\r\n        first:1\r\n        ) {\r\n        edges {\r\n            node {\r\n                  id\r\n                  code\r\n                  socialName\r\n            }\r\n        }\r\n    }   \r\n}",
                            "variables": "{\r\n  \"countryAcronym\":\"{{legislationCode}}\"\r\n}"
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "2-Q.Products - get 3 products",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "pm.test(\"Create environment variables for all products\", function () {\r",
                              "    let jsd = pm.response.json();\r",
                              "\r",
                              "    if (!jsd.data || !jsd.data.products || !jsd.data.products.edges || jsd.data.products.edges.length === 0) {\r",
                              "        console.error(\"Invalid response structure or no products found\");\r",
                              "        return;\r",
                              "    }\r",
                              "\r",
                              "    jsd.data.products.edges.forEach((edge, index) => {\r",
                              "        let varName = `productId_${index + 1}`;\r",
                              "        pm.environment.set(varName, edge.node.id);\r",
                              "        console.log(`${varName} = ${edge.node.id}`);\r",
                              "    });\r",
                              "\r",
                              "    console.log(\"✅ Environment variables for all products have been created\");\r",
                              "});\r",
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        },
                        {
                          "listen": "prerequest",
                          "script": {
                            "exec": [
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "query {\r\n  products (\r\n       order: [{ code: ASC }]\r\n       where: {category:{neq:CONCEPT}}\r\n       first:3\r\n  ) {\r\n    edges {\r\n      node {\r\n        id\r\n        code\r\n        name\r\n      }\r\n    }\r\n  }     \r\n}",
                            "variables": ""
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "3-M.SalesQuote Create a quote",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "pm.test(\"Variable creation\", function () {\r",
                              "    let jsd = pm.response.json();\r",
                              "\r",
                              "    if (jsd.data == null)\r",
                              "        {console.error(\"Unable to save environment variable\");return;}\r",
                              "\r",
                              "    let result = jsd.data.createSalesQuote;\r",
                              "    pm.environment.set(\"originId\", result.id);\r",
                              "    console.log(\"'originId' environment variable has been created : \" + pm.environment.get(\"originId\"));\r",
                              "});\r",
                              "\r",
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        },
                        {
                          "listen": "prerequest",
                          "script": {
                            "exec": [
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "mutation ($values: SalesQuoteCreateGLDtoInput!) {  \r\n    createSalesQuote(input: $values) {\r\n    id\r\n    operationalNumber\r\n  }\r\n}",
                            "variables": "{\r\n  \"values\": {\r\n    \"customerId\": \"{{customerId}}\",\r\n    \"lines\": [\r\n      {\r\n        \"productId\": \"{{productId_1}}\",\r\n        \"totalQuantity\": 50,\r\n        \"unitPrice\": 11,\r\n        \"firstDiscount\": 5\r\n      },\r\n      {\r\n        \"productId\": \"{{productId_2}}\",\r\n        \"productName\":\"specific name\",\r\n        \"totalQuantity\": 4,\r\n        \"unitPrice\": 22,\r\n        \"firstDiscount\": 0\r\n      }\r\n    ]\r\n  }\r\n}"
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "4-M.SalesOrder Create an order",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "pm.test(\"Variable creation\", function () {\r",
                              "    let jsd = pm.response.json();\r",
                              "\r",
                              "    if (jsd.data == null)\r",
                              "        {console.error(\"Unable to save environment variable\");return;}\r",
                              "\r",
                              "    let result = jsd.data.createSalesOrder;\r",
                              "    pm.environment.set(\"documentId\", result.id);\r",
                              "    console.log(\"'documentId' environment variable has been created : \" + pm.environment.get(\"documentId\"));\r",
                              "});\r",
                              "\r",
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        },
                        {
                          "listen": "prerequest",
                          "script": {
                            "exec": [
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-OrganizationId",
                            "value": "{{X-OrganizationId}}"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "mutation ($values: SalesOrderCreateGLDtoInput!) {  \r\n    createSalesOrder(input: $values) {\r\n    id\r\n    operationalNumber\r\n  }\r\n}",
                            "variables": "{\r\n  \"values\": {\r\n    \"customerId\": \"{{customerId}}\",\r\n    \"lines\": [\r\n      {\r\n        \"productId\": \"{{productId_1}}\",\r\n        \"totalQuantity\": 50,\r\n        \"unitPrice\": 11,\r\n        \"firstDiscount\": 5\r\n      },\r\n      {\r\n        \"productId\": \"{{productId_2}}\",\r\n        \"productName\":\"specific name\",\r\n        \"totalQuantity\": 4,\r\n        \"unitPrice\": 22,\r\n        \"firstDiscount\": 0\r\n      }\r\n    ]\r\n  }\r\n}"
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "5-M. link related Sales Documents",
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-organizationId",
                            "value": "{{X-OrganizationId}}",
                            "type": "text"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "mutation($input: LinkRelatedSalesDocumentGLDtoInput!) {\r\n  linkRelatedSalesDocument(input: $input) {\r\n    documentId\r\n    documentType\r\n    originId\r\n    originDocumentType\r\n  }\r\n}\r\n",
                            "variables": "{\r\n  \"input\": {\r\n    \"documentId\": \"{{documentId}}\",\r\n    \"originId\": \"{{originId}}\"\r\n  }\r\n}\r\n"
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "6-Q. related Sales Documents",
                      "request": {
                        "method": "POST",
                        "header": [
                          {
                            "key": "X-organizationId",
                            "value": "{{X-OrganizationId}}",
                            "type": "text"
                          },
                          {
                            "key": "x-api-key",
                            "value": "{{subscriptionKey}}"
                          }
                        ],
                        "body": {
                          "mode": "graphql",
                          "graphql": {
                            "query": "query ($quoteId: UUID!) {\r\n  relatedSalesDocuments(\r\n    where: {\r\n    or: [\r\n        { documentId: { eq: $quoteId } }\r\n        { originId: { eq: $quoteId } }\r\n    ]\r\n    }\r\n    order: { creationDate: ASC }\r\n  ) {\r\n    edges {\r\n      node {\r\n        documentId\r\n        documentType\r\n        operationalNumber\r\n        documentDate\r\n        originId\r\n        originDocumentType\r\n        status\r\n        totalLiquid\r\n      }\r\n    }\r\n  }\r\n}\r\n",
                            "variables": "{\r\n  \"quoteId\": \"{{originId}}\"\r\n}\r\n"
                          }
                        },
                        "url": {
                          "raw": "{{baseAddress}}/graphql",
                          "host": [
                            "{{baseAddress}}"
                          ],
                          "path": [
                            "graphql"
                          ]
                        }
                      },
                      "response": []
                    }
                  ]
                }
              ]
            },
            {
              "name": "🆕Q.Sales kpi services",
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "exec": [
                      ""
                    ],
                    "type": "text/javascript",
                    "packages": {},
                    "requests": {}
                  }
                }
              ],
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "X-OrganizationId",
                    "value": "{{X-OrganizationId}}"
                  },
                  {
                    "key": "x-api-key",
                    "value": "{{subscriptionKey}}"
                  },
                  {
                    "key": "Host",
                    "value": "eurmigreuwkpiapi.ambitiousground-42782c17.westeurope.azurecontainerapps.io",
                    "type": "text"
                  }
                ],
                "body": {
                  "mode": "graphql",
                  "graphql": {
                    "query": "query ($kpis: [SalesIndicatorType!]!) {\r\n  salesKpis(input: { kpiTypes: $kpis }) {\r\n    type\r\n    value\r\n    currency\r\n  }\r\n}\r\n",
                    "variables": "\r\n{\"kpis\":[\"MONEY_IN\",\"MONEY_OUT\",\"QUOTES_WITH_RELATED_DOCUMENTS\",\"TOTAL_CUSTOMERS\",\"TOTAL_FROM_OPEN_QUOTES\"]}"
                  }
                },
                "url": {
                  "raw": "{{baseAddress}}/graphql",
                  "host": [
                    "{{baseAddress}}"
                  ],
                  "path": [
                    "graphql"
                  ]
                }
              },
              "response": []
            }
          ],
          "description": "This section outlines various types of sales documents that are essential to the sales process.\n\n  \nThese include:\n\n- Quotes,\n    \n- Orders,\n    \n- Delivery Notes,\n    \n- and Invoices.\n    \n\nEach type of document holds specific information and serves unique purposes."
        },
        {
          "name": "Purchase invoices",
          "item": [
            {
              "name": "M.create an invoice, then update it, then delete it",
              "item": [
                {
                  "name": "1- Q.accountingExercises - most recently opened, startDate filled in {{dateInFirstExercice}}",
                  "event": [
                    {
                      "listen": "test",
                      "script": {
                        "exec": [
                          "pm.test(\"Variables creation\", function () {\r",
                          "    let jsd = pm.response.json();\r",
                          "    console.log(jsd.data.accountingExercises.edges[0].node.id);\r",
                          "    if (jsd.data == null || jsd.data.accountingExercises.edges.length == 0)\r",
                          "        {console.error(\"Unable to save environment variable\");return;}\r",
                          "    pm.environment.set(\"dateInFirstExercice\",jsd.data.accountingExercises.edges[0].node.startDate);\r",
                          "    console.log(\"'dateInFirstExercice' environment variable has been created : \" + pm.environment.get(\"dateInFirstExercice\"));\r",
                          "});\r",
                          "\r",
                          ""
                        ],
                        "type": "text/javascript",
                        "packages": {}
                      }
                    }
                  ],
                  "request": {
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "query {\r\n    accountingExercises(\r\n        where: {status: {eq: OPEN}}\r\n        first:1\r\n        order:{startDate:DESC}\r\n        ) {\r\n        edges {\r\n            node {\r\n               startDate\r\n            }\r\n        }\r\n    }     \r\n}",
                        "variables": ""
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                },
                {
                  "name": "2-Q.suppliers - first activated & current legislation",
                  "event": [
                    {
                      "listen": "test",
                      "script": {
                        "exec": [
                          "pm.test(\"Variables creation\", function () {\r",
                          "    let jsd = pm.response.json();\r",
                          "\r",
                          "    if (jsd.data == null || jsd.data.suppliers.edges.length == 0)\r",
                          "        {console.error(\"Unable to save environment variable for customer\");return;}\r",
                          "    pm.environment.set(\"supplierId\", jsd.data.suppliers.edges[0].node.id);\r",
                          "    console.log(\"supplierId environment variable has been created : \" + pm.environment.get(\"supplierId\"));\r",
                          "});"
                        ],
                        "type": "text/javascript",
                        "packages": {}
                      }
                    }
                  ],
                  "request": {
                    "auth": {
                      "type": "bearer",
                      "bearer": [
                        {
                          "key": "token",
                          "value": "{{accessToken}}",
                          "type": "string"
                        }
                      ]
                    },
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "query ($countryAcronym : String!) {\r\n    suppliers (\r\n        order: [{ code: ASC }]\r\n        where: {\r\n            countryAcronym: {eq:$countryAcronym}\r\n            disabled: {eq: false}\r\n            }\r\n        first:1\r\n        ) {\r\n        edges {\r\n            node {\r\n                  id\r\n                  code\r\n                  socialName\r\n            }\r\n        }\r\n    }   \r\n}",
                        "variables": "{\r\n  \"countryAcronym\":\"{{legislationCode}}\"\r\n}"
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                },
                {
                  "name": "3-Q.taxes - get a tax for current legislation",
                  "event": [
                    {
                      "listen": "test",
                      "script": {
                        "exec": [
                          "pm.test(\"Variables creation\", function () {\r",
                          "    let jsd = pm.response.json();\r",
                          "\r",
                          "    if (jsd.data == null || jsd.data.taxes.edges.length == 0)\r",
                          "        {console.error(\"Unable to save environment variable for customer\");return;}\r",
                          "    pm.environment.set(\"taxId\", jsd.data.taxes.edges[0].node.id);\r",
                          "});\r",
                          "console.log(\"taxId environment variable has been created : \" + pm.environment.get(\"taxId\"));"
                        ],
                        "type": "text/javascript",
                        "packages": {}
                      }
                    },
                    {
                      "listen": "prerequest",
                      "script": {
                        "exec": [
                          "let legislationCode = pm.environment.get(\"legislationCode\");\r",
                          "let taxPercentage;\r",
                          "if (legislationCode === 'FR') {\r",
                          "     taxPercentage=5.5;\r",
                          "     taxCode=\"C0007\"\r",
                          "} else if (legislationCode === 'ES') {\r",
                          "     taxPercentage=21;\r",
                          "     taxCode=\"C0032\"\r",
                          "} else if (legislationCode === 'DE') {\r",
                          "     taxPercentage=7;\r",
                          "     taxCode=\"C001\"\r",
                          "} else {\r",
                          "    console.error(\"Unexpected legislationCode value\");\r",
                          "    return;\r",
                          "}\r",
                          "\r",
                          "pm.environment.set(\"taxPercentage\", taxPercentage);\r",
                          "console.log(\"'taxPercentage' environment variable has been created : \" + pm.environment.get(\"taxPercentage\"));\r",
                          "pm.environment.set(\"taxCode\", taxCode);\r",
                          "console.log(\"'taxCode' environment variable has been created : \" + pm.environment.get(\"taxCode\"));\r",
                          "\r",
                          "\r",
                          ""
                        ],
                        "type": "text/javascript",
                        "packages": {}
                      }
                    }
                  ],
                  "request": {
                    "auth": {
                      "type": "bearer",
                      "bearer": [
                        {
                          "key": "token",
                          "value": "{{accessToken}}",
                          "type": "string"
                        }
                      ]
                    },
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "query ($taxPercentage : Decimal!) {\r\n    taxes (\r\n        where: {\r\n            percentage: {eq:$taxPercentage}\r\n            }\r\n        first:1\r\n        ) {\r\n        edges {\r\n            node {\r\n                  id             \r\n            }\r\n        }\r\n    }   \r\n}",
                        "variables": "{\r\n  \"taxPercentage\":{{taxPercentage}}\r\n}"
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                },
                {
                  "name": "4-Q.tax Treatment - get a taxTreamenId for the current Taxe",
                  "event": [
                    {
                      "listen": "test",
                      "script": {
                        "exec": [
                          "pm.test(\"Variables creation\", function () {\r",
                          "    let jsd = pm.response.json();\r",
                          "\r",
                          "    if (jsd.data == null || jsd.data.taxTreatments.edges.length == 0)\r",
                          "        {console.error(\"Unable to save environment variable for customer\");return;}\r",
                          "    pm.environment.set(\"taxTreatmentId\", jsd.data.taxTreatments.edges[0].node.id);\r",
                          "});\r",
                          "console.log(\"taxTreatmentId environment variable has been created : \" + pm.environment.get(\"taxTreatmentId\"));\r",
                          ""
                        ],
                        "type": "text/javascript",
                        "packages": {}
                      }
                    },
                    {
                      "listen": "prerequest",
                      "script": {
                        "exec": [
                          ""
                        ],
                        "type": "text/javascript",
                        "packages": {}
                      }
                    }
                  ],
                  "request": {
                    "auth": {
                      "type": "bearer",
                      "bearer": [
                        {
                          "key": "token",
                          "value": "{{accessToken}}",
                          "type": "string"
                        }
                      ]
                    },
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "query ($taxCode : String!) {\r\n    taxTreatments (\r\n        where: {\r\n            taxCode: {eq:$taxCode}\r\n            }\r\n        order:{taxCode:DESC}\r\n        first:1\r\n        ) {\r\n        edges {\r\n            node {\r\n                 id\r\n                 description\r\n\r\n                  \r\n            }\r\n        }\r\n    }   \r\n}",
                        "variables": "{\r\n  \"taxCode\":\"{{taxCode}}\"\r\n}"
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                },
                {
                  "name": "5-Q.AccountingAccount - get an account for the current taxTreamenId",
                  "event": [
                    {
                      "listen": "test",
                      "script": {
                        "exec": [
                          "pm.test(\"Variables creation\", function () {\r",
                          "    let jsd = pm.response.json();\r",
                          "\r",
                          "    if (jsd.data == null || jsd.data.accountingAccounts.edges.length == 0)\r",
                          "        {console.error(\"Unable to save environment variable for customer\");return;}\r",
                          "    pm.environment.set(\"accountingAccountId\", jsd.data.accountingAccounts.edges[0].node.id);\r",
                          "});\r",
                          "console.log(\"accountingAccountId environment variable has been created : \" + pm.environment.get(\"accountingAccountId\"));\r",
                          ""
                        ],
                        "type": "text/javascript",
                        "packages": {}
                      }
                    },
                    {
                      "listen": "prerequest",
                      "script": {
                        "exec": [
                          ""
                        ],
                        "type": "text/javascript",
                        "packages": {}
                      }
                    }
                  ],
                  "request": {
                    "auth": {
                      "type": "bearer",
                      "bearer": [
                        {
                          "key": "token",
                          "value": "{{accessToken}}",
                          "type": "string"
                        }
                      ]
                    },
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "query ($taxTreatmentId : UUID!) {\r\n    accountingAccounts (\r\n        where: {\r\n            taxTreatmentId: {eq:$taxTreatmentId}\r\n            }\r\n        first:1\r\n        ) {\r\n        edges {\r\n            node {\r\n                 id\r\n                 code\r\n                  \r\n            }\r\n        }\r\n    }   \r\n}",
                        "variables": "{\r\n  \"taxTreatmentId\":\"{{taxTreatmentId}}\"\r\n}"
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                },
                {
                  "name": "6-M.PurchaseInvoice Create an invoice",
                  "event": [
                    {
                      "listen": "test",
                      "script": {
                        "exec": [
                          "pm.test(\"Variable creation\", function () {\r",
                          "    let jsd = pm.response.json();\r",
                          "\r",
                          "    if (jsd.data == null)\r",
                          "        {console.error(\"Unable to save environment variable\");return;}\r",
                          "\r",
                          "    let result = jsd.data.createPurchaseInvoice;\r",
                          "    pm.environment.set(\"currentId\", result.id);\r",
                          "    console.log(\"'currentId' environment variable has been created : \" + pm.environment.get(\"currentId\"));\r",
                          "});\r",
                          "\r",
                          ""
                        ],
                        "type": "text/javascript",
                        "packages": {}
                      }
                    },
                    {
                      "listen": "prerequest",
                      "script": {
                        "exec": [
                          "let taxBase = 150;\r",
                          "let taxPercentage = pm.environment.get(\"taxPercentage\");\r",
                          "let taxAmount = (taxBase * taxPercentage) / 100;\r",
                          "let totalLiquid = taxBase + taxAmount;\r",
                          "\r",
                          "pm.environment.set(\"taxAmount\", taxAmount);\r",
                          "console.log(\"'taxAmount' environment variable has been created: \" + pm.environment.get(\"taxAmount\"));\r",
                          "\r",
                          "pm.environment.set(\"totalLiquid\", totalLiquid);\r",
                          "console.log(\"'totalLiquid' environment variable has been created: \" + pm.environment.get(\"totalLiquid\"));\r",
                          "\r",
                          "pm.environment.set(\"taxBase\", taxBase);\r",
                          "console.log(\"'taxBase' environment variable has been created: \" + pm.environment.get(\"taxBase\"));\r",
                          ""
                        ],
                        "type": "text/javascript",
                        "packages": {}
                      }
                    }
                  ],
                  "request": {
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "mutation ($values: PurchaseInvoiceCreateGLDtoInput!) {  \r\n    createPurchaseInvoice(input: $values) {\r\n    id\r\n  }\r\n}",
                        "variables": "{\r\n  \"values\": {\r\n    \"supplierId\": \"{{supplierId}}\",\r\n    \"hasCashVat\": false,\r\n    \"invoiceNumber\":\"DEMO0001\",\r\n    \"invoiceDate\":\"{{dateInFirstExercice}}\",\r\n    \"operationDate\": \"{{dateInFirstExercice}}\",\r\n    \"totalLiquid\":{{totalLiquid}},\r\n    \"vatLines\": [\r\n        {\r\n            \"purchaseAccountingAccountId\":\"{{accountingAccountId}}\",\r\n            \"taxId\":\"{{taxId}}\",\r\n            \"taxTreatmentId\":\"{{taxTreatmentId}}\",\r\n            \"totalVat\":{{taxAmount}},\r\n            \"totalVatBase\":{{taxBase}}\r\n\r\n        }\r\n    ]\r\n  }\r\n}"
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                },
                {
                  "name": "7-Q.PurchaseInvoices filtered by Id",
                  "event": [
                    {
                      "listen": "test",
                      "script": {
                        "exec": [
                          "pm.test(\"Variable creation\", function () {\r",
                          "    let jsd = pm.response.json();\r",
                          "\r",
                          "    // Vérifier si la réponse contient les données nécessaires\r",
                          "    if (!jsd.data || !jsd.data.salesInvoices || jsd.data.salesInvoices.edges.length === 0) {\r",
                          "        console.error(\"Unable to save environment variables\");\r",
                          "        return;\r",
                          "    }\r",
                          "\r",
                          "    // Récupérer le tableau des lignes\r",
                          "    let lines = jsd.data.salesInvoices.edges[0].node.lines;\r",
                          "\r",
                          "    // Vérifier si le tableau des lignes contient au moins deux éléments\r",
                          "    if (lines.length < 2) {\r",
                          "        console.error(\"Not enough lines to save environment variables\");\r",
                          "        return;\r",
                          "    }\r",
                          "\r",
                          "    // Définir les variables d'environnement pour les ID des deux premières lignes\r",
                          "    pm.environment.set(\"firstLineId\", lines[0].id);\r",
                          "    pm.environment.set(\"secondLineId\", lines[1].id);\r",
                          "\r",
                          "    // Logger les ID récupérés\r",
                          "    console.log(\"'firstLineId' and 'secondLineId' environment variables have been created: \" + pm.environment.get(\"firstLineId\") + \", \" + pm.environment.get(\"secondLineId\"));\r",
                          "});\r",
                          ""
                        ],
                        "type": "text/javascript",
                        "packages": {}
                      }
                    }
                  ],
                  "request": {
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "query ($id : UUID!) {\r\n  purchaseInvoices (\r\n    where : { id : { eq : $id }}) \r\n      {\r\n        edges {\r\n            node {\r\n                status\r\n                firstDueDate\r\n                operationDate\r\n                id\r\n                invoiceDate\r\n                invoiceNumber\r\n                creationDate\r\n                supplier{\r\n                    socialName\r\n                }\r\n                vatLines{\r\n                    purchaseAccountingAccount{\r\n                        code\r\n                    }\r\n                    tax{\r\n                        name\r\n                        percentage\r\n                    }\r\n                    taxTreatment{\r\n                        taxCode\r\n                    }\r\n                }\r\n            }\r\n        }\r\n    }\r\n}",
                        "variables": "{\r\n  \"id\":\"{{currentId}}\"\r\n}"
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                },
                {
                  "name": "8-M.PurchaseInvoices Update By Id",
                  "event": [
                    {
                      "listen": "test",
                      "script": {
                        "exec": [
                          ""
                        ],
                        "type": "text/javascript",
                        "packages": {}
                      }
                    }
                  ],
                  "request": {
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "mutation ($values: PurchaseInvoiceUpdateGLDtoInput!) {  \r\n    updatePurchaseInvoice(input: $values) {\r\n      id\r\n  }\r\n}",
                        "variables": "{\r\n  \"values\": {\r\n    \"id\":\"{{currentId}}\",\r\n    \"invoiceNumber\": \"A0002\"\r\n  }\r\n}"
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                },
                {
                  "name": "9-M.PurchaseInvoice Delete By Id",
                  "event": [
                    {
                      "listen": "test",
                      "script": {
                        "exec": [
                          ""
                        ],
                        "type": "text/javascript",
                        "packages": {}
                      }
                    }
                  ],
                  "request": {
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "mutation ($values:PurchaseInvoiceDeleteGLDtoInput!) {  \r\n    deletePurchaseInvoice(input: $values) {\r\n      id\r\n  }\r\n}",
                        "variables": "{\r\n  \"values\": {\r\n    \"id\":\"{{currentId}}\"\r\n  }\r\n}"
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                }
              ],
              "description": "For these examples, you will need:\n\n1. At least one customer\n2. At least two products\n    \n\nFor the example of modifying the invoice, we start from the created invoice.\n\n- We modify the quantity of the first line,\n- delete the second line,\n- and add a new line with the same product as the first line."
            },
            {
              "name": "M.create an invoice (simplified mode)",
              "item": [
                {
                  "name": "1- Q.accountingExercises - most recently opened, startDate filled in {{dateInFirstExercice}}",
                  "event": [
                    {
                      "listen": "test",
                      "script": {
                        "exec": [
                          "pm.test(\"Variables creation\", function () {\r",
                          "    let jsd = pm.response.json();\r",
                          "    console.log(jsd.data.accountingExercises.edges[0].node.id);\r",
                          "    if (jsd.data == null || jsd.data.accountingExercises.edges.length == 0)\r",
                          "        {console.error(\"Unable to save environment variable\");return;}\r",
                          "    pm.environment.set(\"dateInFirstExercice\",jsd.data.accountingExercises.edges[0].node.startDate);\r",
                          "    console.log(\"'dateInFirstExercice' environment variable has been created : \" + pm.environment.get(\"dateInFirstExercice\"));\r",
                          "});\r",
                          "\r",
                          ""
                        ],
                        "type": "text/javascript",
                        "packages": {}
                      }
                    }
                  ],
                  "request": {
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "query {\r\n    accountingExercises(\r\n        where: {status: {eq: OPEN}}\r\n        first:1\r\n        order:{startDate:DESC}\r\n        ) {\r\n        edges {\r\n            node {\r\n               startDate\r\n            }\r\n        }\r\n    }     \r\n}",
                        "variables": ""
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                },
                {
                  "name": "2-Q.suppliers - first activated & current legislation",
                  "event": [
                    {
                      "listen": "test",
                      "script": {
                        "exec": [
                          "pm.test(\"Variables creation\", function () {\r",
                          "    let jsd = pm.response.json();\r",
                          "\r",
                          "    if (jsd.data == null || jsd.data.suppliers.edges.length == 0)\r",
                          "        {console.error(\"Unable to save environment variable for customer\");return;}\r",
                          "    pm.environment.set(\"supplierId\", jsd.data.suppliers.edges[0].node.id);\r",
                          "    console.log(\"supplierId environment variable has been created : \" + pm.environment.get(\"supplierId\"));\r",
                          "});"
                        ],
                        "type": "text/javascript",
                        "packages": {}
                      }
                    }
                  ],
                  "request": {
                    "auth": {
                      "type": "bearer",
                      "bearer": [
                        {
                          "key": "token",
                          "value": "{{accessToken}}",
                          "type": "string"
                        }
                      ]
                    },
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "query ($countryAcronym : String!) {\r\n    suppliers (\r\n        order: [{ code: ASC }]\r\n        where: {\r\n            countryAcronym: {eq:$countryAcronym}\r\n            disabled: {eq: false}\r\n            }\r\n        first:1\r\n        ) {\r\n        edges {\r\n            node {\r\n                  id\r\n                  code\r\n                  socialName\r\n            }\r\n        }\r\n    }   \r\n}",
                        "variables": "{\r\n  \"countryAcronym\":\"{{legislationCode}}\"\r\n}"
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                },
                {
                  "name": "3-M.PurchaseInvoice Create an invoice",
                  "event": [
                    {
                      "listen": "test",
                      "script": {
                        "exec": [
                          "pm.test(\"Variable creation\", function () {\r",
                          "    let jsd = pm.response.json();\r",
                          "\r",
                          "    if (jsd.data == null)\r",
                          "        {console.error(\"Unable to save environment variable\");return;}\r",
                          "\r",
                          "    let result = jsd.data.createPurchaseInvoice;\r",
                          "    pm.environment.set(\"currentId\", result.id);\r",
                          "    console.log(\"'currentId' environment variable has been created : \" + pm.environment.get(\"currentId\"));\r",
                          "});\r",
                          "\r",
                          ""
                        ],
                        "type": "text/javascript",
                        "packages": {},
                        "requests": {}
                      }
                    },
                    {
                      "listen": "prerequest",
                      "script": {
                        "exec": [
                          "let legislationCode = pm.environment.get(\"legislationCode\");\r",
                          "let taxPercentage;\r",
                          "if (legislationCode === 'FR') {\r",
                          "     taxPercentage = 20;\r",
                          "} else if (legislationCode === 'ES') {\r",
                          "     taxPercentage = 21;\r",
                          "} else if (legislationCode === 'DE') {\r",
                          "     taxPercentage = 19;\r",
                          "} else {\r",
                          "    console.error(\"Unexpected legislationCode value\");\r",
                          "    return;\r",
                          "}\r",
                          "\r",
                          "let taxBase = 150;\r",
                          "let taxAmount = (taxBase * taxPercentage) / 100; \r",
                          "let totalLiquid = taxBase + taxAmount;\r",
                          "\r",
                          "pm.environment.set(\"taxPercentage\", taxPercentage);\r",
                          "console.log(\"'taxPercentage' environment variable has been created : \" + pm.environment.get(\"taxPercentage\"));\r",
                          "\r",
                          "pm.environment.set(\"taxBase\", taxBase);\r",
                          "console.log(\"'taxBase' environment variable has been created: \" + pm.environment.get(\"taxBase\"));\r",
                          "\r",
                          "pm.environment.set(\"taxAmount\", taxAmount);\r",
                          "console.log(\"'taxAmount' environment variable has been created: \" + pm.environment.get(\"taxAmount\"));\r",
                          "\r",
                          "pm.environment.set(\"totalLiquid\", totalLiquid);\r",
                          "console.log(\"'totalLiquid' environment variable has been created: \" + pm.environment.get(\"totalLiquid\"));\r",
                          ""
                        ],
                        "type": "text/javascript",
                        "packages": {},
                        "requests": {}
                      }
                    }
                  ],
                  "request": {
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "mutation ($values: PurchaseInvoiceCreateGLDtoInput!) {  \r\n    createPurchaseInvoice(input: $values) {\r\n    id\r\n  }\r\n}",
                        "variables": "{\r\n  \"values\": {\r\n    \"hasCashVat\": false,\r\n    \"invoiceNumber\":\"DEMO0002\",\r\n    \"invoiceDate\":\"{{dateInFirstExercice}}\",\r\n    \"operationDate\": \"{{dateInFirstExercice}}\",\r\n    \"totalLiquid\":{{totalLiquid}},\r\n    \"vatLines\": [\r\n        {\r\n            \"vatPercentage\":{{taxPercentage}},\r\n            \"totalVat\":{{taxAmount}},\r\n            \"totalVatBase\":{{taxBase}}\r\n        }\r\n    ]\r\n  }\r\n}"
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                },
                {
                  "name": "4-M.PurchaseInvoice Delete By Id",
                  "event": [
                    {
                      "listen": "test",
                      "script": {
                        "exec": [
                          ""
                        ],
                        "type": "text/javascript",
                        "packages": {}
                      }
                    }
                  ],
                  "request": {
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "mutation ($values:PurchaseInvoiceDeleteGLDtoInput!) {  \r\n    deletePurchaseInvoice(input: $values) {\r\n      id\r\n  }\r\n}",
                        "variables": "{\r\n  \"values\": {\r\n    \"id\":\"{{currentId}}\"\r\n  }\r\n}"
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                }
              ],
              "description": "For these examples, you will need:\n\n1. At least one customer\n2. At least two products\n    \n\nFor the example of modifying the invoice, we start from the created invoice.\n\n- We modify the quantity of the first line,\n- delete the second line,\n- and add a new line with the same product as the first line."
            },
            {
              "name": "M.create an invoice with specific transaction category (simplified mode)",
              "item": [
                {
                  "name": "1- Q.accountingExercises - most recently opened, startDate filled in {{dateInFirstExercice}}",
                  "event": [
                    {
                      "listen": "test",
                      "script": {
                        "exec": [
                          "pm.test(\"Variables creation\", function () {\r",
                          "    let jsd = pm.response.json();\r",
                          "    console.log(jsd.data.accountingExercises.edges[0].node.id);\r",
                          "    if (jsd.data == null || jsd.data.accountingExercises.edges.length == 0)\r",
                          "        {console.error(\"Unable to save environment variable\");return;}\r",
                          "    pm.environment.set(\"dateInFirstExercice\",jsd.data.accountingExercises.edges[0].node.startDate);\r",
                          "    console.log(\"'dateInFirstExercice' environment variable has been created : \" + pm.environment.get(\"dateInFirstExercice\"));\r",
                          "});\r",
                          "\r",
                          ""
                        ],
                        "type": "text/javascript",
                        "packages": {}
                      }
                    }
                  ],
                  "request": {
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "query {\r\n    accountingExercises(\r\n        where: {status: {eq: OPEN}}\r\n        first:1\r\n        order:{startDate:DESC}\r\n        ) {\r\n        edges {\r\n            node {\r\n               startDate\r\n            }\r\n        }\r\n    }     \r\n}",
                        "variables": ""
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                },
                {
                  "name": "2-Q.suppliers - first activated & current legislation",
                  "event": [
                    {
                      "listen": "test",
                      "script": {
                        "exec": [
                          "pm.test(\"Variables creation\", function () {\r",
                          "    let jsd = pm.response.json();\r",
                          "\r",
                          "    if (jsd.data == null || jsd.data.suppliers.edges.length == 0)\r",
                          "        {console.error(\"Unable to save environment variable for customer\");return;}\r",
                          "    pm.environment.set(\"supplierId\", jsd.data.suppliers.edges[0].node.id);\r",
                          "    console.log(\"supplierId environment variable has been created : \" + pm.environment.get(\"supplierId\"));\r",
                          "});"
                        ],
                        "type": "text/javascript",
                        "packages": {}
                      }
                    }
                  ],
                  "request": {
                    "auth": {
                      "type": "bearer",
                      "bearer": [
                        {
                          "key": "token",
                          "value": "{{accessToken}}",
                          "type": "string"
                        }
                      ]
                    },
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "query ($countryAcronym : String!) {\r\n    suppliers (\r\n        order: [{ code: ASC }]\r\n        where: {\r\n            countryAcronym: {eq:$countryAcronym}\r\n            disabled: {eq: false}\r\n            }\r\n        first:1\r\n        ) {\r\n        edges {\r\n            node {\r\n                  id\r\n                  code\r\n                  socialName\r\n            }\r\n        }\r\n    }   \r\n}",
                        "variables": "{\r\n  \"countryAcronym\":\"{{legislationCode}}\"\r\n}"
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                },
                {
                  "name": "3-Q.transactionCategory- first eq PURCHASE",
                  "event": [
                    {
                      "listen": "test",
                      "script": {
                        "exec": [
                          "pm.test(\"Variables creation\", function () {\r",
                          "    let jsd = pm.response.json();\r",
                          "\r",
                          "    if (jsd.data == null || jsd.data.transactionCategories.edges.length == 0)\r",
                          "        {console.error(\"Unable to save environment variable for transactionCategories\");return;}\r",
                          "    pm.environment.set(\"transactionCategoryId\", jsd.data.transactionCategories.edges[0].node.id);\r",
                          "    console.log(\"transactionCategoryId environment variable has been created : \" + pm.environment.get(\"transactionCategoryId\"));\r",
                          "});"
                        ],
                        "type": "text/javascript",
                        "packages": {},
                        "requests": {}
                      }
                    }
                  ],
                  "request": {
                    "auth": {
                      "type": "bearer",
                      "bearer": [
                        {
                          "key": "token",
                          "value": "{{accessToken}}",
                          "type": "string"
                        }
                      ]
                    },
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "query {\r\n  transactionCategories(\r\n    where: {\r\n      type: { eq: PURCHASE }\r\n    }\r\n  first:1 ) {\r\n    edges {\r\n      node {\r\n        id\r\n        reason\r\n        accountingAccountId\r\n        accountingAccount {code name}\r\n        taxTreatmentId\r\n        taxTreatment {taxCode}\r\n        type\r\n        createdByDefault\r\n        disabled\r\n        default\r\n      }\r\n    }\r\n  }\r\n}",
                        "variables": ""
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                },
                {
                  "name": "4-M.PurchaseInvoice Create an invoice",
                  "event": [
                    {
                      "listen": "test",
                      "script": {
                        "exec": [
                          "pm.test(\"Variable creation\", function () {\r",
                          "    let jsd = pm.response.json();\r",
                          "\r",
                          "    if (jsd.data == null)\r",
                          "        {console.error(\"Unable to save environment variable\");return;}\r",
                          "\r",
                          "    let result = jsd.data.createPurchaseInvoice;\r",
                          "    pm.environment.set(\"currentId\", result.id);\r",
                          "    console.log(\"'currentId' environment variable has been created : \" + pm.environment.get(\"currentId\"));\r",
                          "});\r",
                          "\r",
                          ""
                        ],
                        "type": "text/javascript",
                        "packages": {},
                        "requests": {}
                      }
                    },
                    {
                      "listen": "prerequest",
                      "script": {
                        "exec": [
                          "let legislationCode = pm.environment.get(\"legislationCode\");\r",
                          "let taxPercentage;\r",
                          "if (legislationCode === 'FR') {\r",
                          "     taxPercentage = 20;\r",
                          "} else if (legislationCode === 'ES') {\r",
                          "     taxPercentage = 21;\r",
                          "} else if (legislationCode === 'DE') {\r",
                          "     taxPercentage = 19;\r",
                          "} else {\r",
                          "    console.error(\"Unexpected legislationCode value\");\r",
                          "    return;\r",
                          "}\r",
                          "\r",
                          "let taxBase = 150;\r",
                          "let taxAmount = (taxBase * taxPercentage) / 100; \r",
                          "let totalLiquid = taxBase + taxAmount;\r",
                          "\r",
                          "pm.environment.set(\"taxPercentage\", taxPercentage);\r",
                          "console.log(\"'taxPercentage' environment variable has been created : \" + pm.environment.get(\"taxPercentage\"));\r",
                          "\r",
                          "pm.environment.set(\"taxBase\", taxBase);\r",
                          "console.log(\"'taxBase' environment variable has been created: \" + pm.environment.get(\"taxBase\"));\r",
                          "\r",
                          "pm.environment.set(\"taxAmount\", taxAmount);\r",
                          "console.log(\"'taxAmount' environment variable has been created: \" + pm.environment.get(\"taxAmount\"));\r",
                          "\r",
                          "pm.environment.set(\"totalLiquid\", totalLiquid);\r",
                          "console.log(\"'totalLiquid' environment variable has been created: \" + pm.environment.get(\"totalLiquid\"));\r",
                          ""
                        ],
                        "type": "text/javascript",
                        "packages": {},
                        "requests": {}
                      }
                    }
                  ],
                  "request": {
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "mutation ($values: PurchaseInvoiceCreateGLDtoInput!) {  \r\n    createPurchaseInvoice(input: $values) {\r\n    id\r\n  }\r\n}",
                        "variables": "{\r\n  \"values\": {\r\n    \"supplierId\":\"{{supplierId}}\",\r\n    \"hasCashVat\": false,\r\n    \"invoiceNumber\":\"DEMO0002\",\r\n    \"invoiceDate\":\"{{dateInFirstExercice}}\",\r\n    \"operationDate\": \"{{dateInFirstExercice}}\",\r\n    \"totalLiquid\":{{totalLiquid}},\r\n    \"vatLines\": [\r\n        {  \r\n             \r\n            \"vatPercentage\":{{taxPercentage}},\r\n            \"totalVat\":{{taxAmount}},\r\n            \"totalVatBase\":{{taxBase}},\r\n            \"transactionCategoryId\":\"{{transactionCategoryId}}\"\r\n        }\r\n    ]\r\n  }\r\n}"
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                },
                {
                  "name": "5-M.PurchaseInvoice Delete By Id",
                  "event": [
                    {
                      "listen": "test",
                      "script": {
                        "exec": [
                          ""
                        ],
                        "type": "text/javascript",
                        "packages": {}
                      }
                    }
                  ],
                  "request": {
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "mutation ($values:PurchaseInvoiceDeleteGLDtoInput!) {  \r\n    deletePurchaseInvoice(input: $values) {\r\n      id\r\n  }\r\n}",
                        "variables": "{\r\n  \"values\": {\r\n    \"id\":\"{{currentId}}\"\r\n  }\r\n}"
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                }
              ],
              "description": "For these examples, you will need:\n\n1. At least one customer\n2. At least two products\n    \n\nFor the example of modifying the invoice, we start from the created invoice.\n\n- We modify the quantity of the first line,\n- delete the second line,\n- and add a new line with the same product as the first line."
            },
            {
              "name": "M.validate and pay an Invoice (Post Invoice & Open Items Settlement)",
              "item": [
                {
                  "name": "1- Q.accountingExercises - most recently opened, startDate filled in {{dateInFirstExercice}}",
                  "event": [
                    {
                      "listen": "test",
                      "script": {
                        "exec": [
                          "pm.test(\"Variables creation\", function () {\r",
                          "    let jsd = pm.response.json();\r",
                          "    console.log(jsd.data.accountingExercises.edges[0].node.id);\r",
                          "    if (jsd.data == null || jsd.data.accountingExercises.edges.length == 0)\r",
                          "        {console.error(\"Unable to save environment variable\");return;}\r",
                          "    pm.environment.set(\"dateInFirstExercice\",jsd.data.accountingExercises.edges[0].node.startDate);\r",
                          "    console.log(\"'dateInFirstExercice' environment variable has been created : \" + pm.environment.get(\"dateInFirstExercice\"));\r",
                          "});\r",
                          "\r",
                          ""
                        ],
                        "type": "text/javascript",
                        "packages": {}
                      }
                    }
                  ],
                  "request": {
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "query {\r\n    accountingExercises(\r\n        where: {status: {eq: OPEN}}\r\n        first:1\r\n        order:{startDate:DESC}\r\n        ) {\r\n        edges {\r\n            node {\r\n               startDate\r\n            }\r\n        }\r\n    }     \r\n}",
                        "variables": ""
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                },
                {
                  "name": "2-Q.suppliers - first activated & current legislation",
                  "event": [
                    {
                      "listen": "test",
                      "script": {
                        "exec": [
                          "pm.test(\"Variables creation\", function () {\r",
                          "    let jsd = pm.response.json();\r",
                          "\r",
                          "    if (jsd.data == null || jsd.data.suppliers.edges.length == 0)\r",
                          "        {console.error(\"Unable to save environment variable for customer\");return;}\r",
                          "    pm.environment.set(\"supplierId\", jsd.data.suppliers.edges[0].node.id);\r",
                          "    console.log(\"supplierId environment variable has been created : \" + pm.environment.get(\"supplierId\"));\r",
                          "});"
                        ],
                        "type": "text/javascript",
                        "packages": {}
                      }
                    }
                  ],
                  "request": {
                    "auth": {
                      "type": "bearer",
                      "bearer": [
                        {
                          "key": "token",
                          "value": "{{accessToken}}",
                          "type": "string"
                        }
                      ]
                    },
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "query ($countryAcronym : String!) {\r\n    suppliers (\r\n        order: [{ code: ASC }]\r\n        where: {\r\n            countryAcronym: {eq:$countryAcronym}\r\n            disabled: {eq: false}\r\n            }\r\n        first:1\r\n        ) {\r\n        edges {\r\n            node {\r\n                  id\r\n                  code\r\n                  socialName\r\n            }\r\n        }\r\n    }   \r\n}",
                        "variables": "{\r\n  \"countryAcronym\":\"{{legislationCode}}\"\r\n}"
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                },
                {
                  "name": "3-M.PurchaseInvoice Create an invoice",
                  "event": [
                    {
                      "listen": "test",
                      "script": {
                        "exec": [
                          "pm.test(\"Variable creation\", function () {\r",
                          "    let jsd = pm.response.json();\r",
                          "\r",
                          "    if (jsd.data == null)\r",
                          "        {console.error(\"Unable to save environment variable\");return;}\r",
                          "\r",
                          "    let result = jsd.data.createPurchaseInvoice;\r",
                          "    pm.environment.set(\"currentId\", result.id);\r",
                          "    console.log(\"'currentId' environment variable has been created : \" + pm.environment.get(\"currentId\"));\r",
                          "});\r",
                          "\r",
                          ""
                        ],
                        "type": "text/javascript",
                        "packages": {},
                        "requests": {}
                      }
                    },
                    {
                      "listen": "prerequest",
                      "script": {
                        "exec": [
                          "let legislationCode = pm.environment.get(\"legislationCode\");\r",
                          "let taxPercentage;\r",
                          "if (legislationCode === 'FR') {\r",
                          "     taxPercentage = 20;\r",
                          "} else if (legislationCode === 'ES') {\r",
                          "     taxPercentage = 21;\r",
                          "} else if (legislationCode === 'DE') {\r",
                          "     taxPercentage = 19;\r",
                          "} else {\r",
                          "    console.error(\"Unexpected legislationCode value\");\r",
                          "    return;\r",
                          "}\r",
                          "\r",
                          "let taxBase = 150;\r",
                          "let taxAmount = (taxBase * taxPercentage) / 100; \r",
                          "let totalLiquid = taxBase + taxAmount;\r",
                          "\r",
                          "pm.environment.set(\"taxPercentage\", taxPercentage);\r",
                          "console.log(\"'taxPercentage' environment variable has been created : \" + pm.environment.get(\"taxPercentage\"));\r",
                          "\r",
                          "pm.environment.set(\"taxBase\", taxBase);\r",
                          "console.log(\"'taxBase' environment variable has been created: \" + pm.environment.get(\"taxBase\"));\r",
                          "\r",
                          "pm.environment.set(\"taxAmount\", taxAmount);\r",
                          "console.log(\"'taxAmount' environment variable has been created: \" + pm.environment.get(\"taxAmount\"));\r",
                          "\r",
                          "pm.environment.set(\"totalLiquid\", totalLiquid);\r",
                          "console.log(\"'totalLiquid' environment variable has been created: \" + pm.environment.get(\"totalLiquid\"));\r",
                          "\r",
                          "\r",
                          "function randomSuffix(length) {\r",
                          "    const chars = \"ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789\";\r",
                          "    let out = \"\";\r",
                          "    for (let i = 0; i < length; i++) {\r",
                          "        out += chars.charAt(Math.floor(Math.random() * chars.length));\r",
                          "    }\r",
                          "    return out;\r",
                          "}\r",
                          "pm.environment.set(\"invoiceNumber\", \"DEMO0005-\"+randomSuffix(4));\r",
                          "console.log(\"Generated invoiceNumber:\", pm.environment.get(\"invoiceNumber\"));\r",
                          "\r",
                          "\r",
                          ""
                        ],
                        "type": "text/javascript",
                        "packages": {},
                        "requests": {}
                      }
                    }
                  ],
                  "request": {
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "mutation ($values: PurchaseInvoiceCreateGLDtoInput!) {  \r\n    createPurchaseInvoice(input: $values) {\r\n    id\r\n  }\r\n}",
                        "variables": "{\r\n  \"values\": {\r\n    \"supplierId\": \"{{supplierId}}\",\r\n    \"hasCashVat\": false,\r\n    \"invoiceNumber\":\"{{invoiceNumber}}\",\r\n    \"invoiceDate\":\"{{dateInFirstExercice}}\",\r\n    \"operationDate\": \"{{dateInFirstExercice}}\",\r\n    \"totalLiquid\":{{totalLiquid}},\r\n    \"vatLines\": [\r\n        {\r\n            \"vatPercentage\":{{taxPercentage}},\r\n            \"totalVat\":{{taxAmount}},\r\n            \"totalVatBase\":{{taxBase}}\r\n        }\r\n    ]\r\n  }\r\n}"
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                },
                {
                  "name": "4- Q.journalTypes - first type PURCHASE_INVOICE",
                  "event": [
                    {
                      "listen": "test",
                      "script": {
                        "exec": [
                          "pm.test(\"Variables creation\", function () {\r",
                          "    let jsd = pm.response.json();\r",
                          "\r",
                          "    if (jsd.data == null || jsd.data.journalTypes.edges.length == 0)\r",
                          "        {console.error(\"Unable to save environment variable\");return;}\r",
                          "    pm.environment.set(\"journalPurchaseId\", jsd.data.journalTypes.edges[0].node.id);\r",
                          "     console.log(\"'journalPurchaseId' environment variable has been created : \" + pm.environment.get(\"journalPurchaseId\"));\r",
                          "\r",
                          "});"
                        ],
                        "type": "text/javascript",
                        "packages": {}
                      }
                    },
                    {
                      "listen": "prerequest",
                      "script": {
                        "packages": {},
                        "type": "text/javascript"
                      }
                    }
                  ],
                  "request": {
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "query {\r\n     journalTypes(\r\n         where: {type: {eq: PURCHASE_INVOICE}}\r\n         first:1) {\r\n        edges {\r\n            node {\r\n               id\r\n            }\r\n        }\r\n    }     \r\n}",
                        "variables": ""
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                },
                {
                  "name": "5-⚙️ M.Post the Invoice",
                  "event": [
                    {
                      "listen": "test",
                      "script": {
                        "exec": [
                          ""
                        ],
                        "type": "text/javascript",
                        "packages": {}
                      }
                    }
                  ],
                  "request": {
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "mutation($input: PostPurchaseInvoiceGLDtoInput!) {\r\n  postPurchaseInvoice(input: $input) {\r\n    accountingEntryId\r\n    accountingEntryNumber\r\n  }\r\n}",
                        "variables": "{\r\n  \"input\": {\r\n    \"postingDate\":\"{{dateInFirstExercice}}\",\r\n    \"purchaseInvoiceId\": \"{{currentId}}\",\r\n    \"accountingEntryDescription\": \"Purchase Invoice validation\",\r\n    \"journalTypeId\": \"{{journalPurchaseId}}\"\r\n  }\r\n}"
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                },
                {
                  "name": "6-Q.PurchaseInvoiceOpenItems - Retrieve the IDs of the invoice due dates.",
                  "event": [
                    {
                      "listen": "test",
                      "script": {
                        "exec": [
                          "pm.test(\"Variables creation\", function () {\r",
                          "    let jsd = pm.response.json();\r",
                          "\r",
                          "    if (jsd.data == null || jsd.data.purchaseInvoiceOpenItems.edges.length == 0) {\r",
                          "        console.error(\"Unable to save environment variable\");\r",
                          "        return;\r",
                          "    }\r",
                          "\r",
                          "    // Get the first node's data\r",
                          "    let firstNode = jsd.data.purchaseInvoiceOpenItems.edges[0].node;\r",
                          "\r",
                          "    // Retrieve the openItemId, documentNumber, and thirdPartyId\r",
                          "    let openItemId = firstNode.id;\r",
                          "    let documentNumber = firstNode.purchaseInvoice.invoiceNumber;\r",
                          "    let thirdPartyId = firstNode.purchaseInvoice.supplier.id;\r",
                          "    let dueDate= firstNode.dueDate;\r",
                          "\r",
                          "    // Save these values in environment variables\r",
                          "    pm.environment.set(\"openItemId\", openItemId);\r",
                          "    pm.environment.set(\"documentNumber\", documentNumber);\r",
                          "    pm.environment.set(\"thirdPartyId\", thirdPartyId);\r",
                          "    pm.environment.set(\"dueDate\", dueDate);\r",
                          "\r",
                          "    // Log the creation of these variables\r",
                          "    console.log(\"'openItemId' environment variable has been created: \" + pm.environment.get(\"openItemId\"));\r",
                          "    console.log(\"'documentNumber' environment variable has been created: \" + pm.environment.get(\"documentNumber\"));\r",
                          "    console.log(\"'thirdPartyId' environment variable has been created: \" + pm.environment.get(\"thirdPartyId\"));\r",
                          "    console.log(\"'dueDate' environment variable has been created: \" + pm.environment.get(\"dueDate\"));\r",
                          "});\r",
                          ""
                        ],
                        "type": "text/javascript",
                        "packages": {},
                        "requests": {}
                      }
                    },
                    {
                      "listen": "prerequest",
                      "script": {
                        "exec": [
                          ""
                        ],
                        "type": "text/javascript",
                        "packages": {},
                        "requests": {}
                      }
                    }
                  ],
                  "request": {
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "query($Id: UUID!) {\r\n  purchaseInvoiceOpenItems(\r\n    order: {dueDate:ASC}\r\n    where : {purchaseInvoice:{ id : { eq : $Id }}}\r\n  ) {\r\n    edges {\r\n      node {\r\n        purchaseInvoice {\r\n          firstDueDate\r\n          invoiceDate\r\n          invoiceNumber\r\n          status\r\n          totalLiquid\r\n          supplier {\r\n            id\r\n            code\r\n            socialName\r\n          }\r\n        }\r\n        id\r\n        status\r\n        amount\r\n        dueDate\r\n        paidAmountAccumulated\r\n        paymentMean {\r\n          description\r\n        }\r\n      }\r\n    }\r\n    totalCount\r\n    pageInfo {\r\n        hasNextPage\r\n    }\r\n  }\r\n  \r\n}\r\n",
                        "variables": "{\r\n  \"Id\": \"{{currentId}}\"\r\n}"
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                },
                {
                  "name": "7-Q.paymentMethods - first payment method",
                  "event": [
                    {
                      "listen": "test",
                      "script": {
                        "exec": [
                          "pm.test(\"Variables creation\", function () {\r",
                          "    let jsd = pm.response.json();\r",
                          "\r",
                          "    if (jsd.data == null || jsd.data.paymentMethods.edges.length == 0)\r",
                          "        {console.error(\"Unable to save environment variable\");return;}\r",
                          "    pm.environment.set(\"paymentMethodId\", jsd.data.paymentMethods.edges[0].node.id);\r",
                          "    console.log(\"'paymentMethodId' environment variable has been created : \" + pm.environment.get(\"paymentMethodId\"));\r",
                          "});"
                        ],
                        "type": "text/javascript",
                        "packages": {}
                      }
                    }
                  ],
                  "request": {
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "query {\r\n    paymentMethods (\r\n        first:1\r\n    )    {\r\n\r\n        edges {\r\n            node {\r\n                id\r\n                creationDate\r\n                referenceName\r\n                type\r\n                journalType{\r\n                    code\r\n                }\r\n                subAccount{\r\n                    code\r\n                }\r\n                \r\n            }\r\n        }\r\n    }     \r\n}",
                        "variables": ""
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                },
                {
                  "name": "8-⚙️ M.PurchaseOpenItemSettlement  - Partially pay the first due date.",
                  "event": [
                    {
                      "listen": "test",
                      "script": {
                        "exec": [
                          ""
                        ],
                        "type": "text/javascript",
                        "packages": {}
                      }
                    }
                  ],
                  "request": {
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "mutation($input: PurchaseOpenItemSettlementGLDtoInput!) {\r\n  purchaseOpenItemSettlement(input: $input) {\r\n    accountingEntryId\r\n    accountingEntryNumber\r\n  }\r\n}",
                        "variables": "{\r\n  \"input\": {\r\n    \"entryDate\": \"{{dueDate}}\",\r\n    \"paymentMethodId\": \"{{paymentMethodId}}\",\r\n    \"description\": \"Partiel settlement\",\r\n    \"documentNumber\": \"{{documentNumber}}\",\r\n    \"thirdPartyId\": \"{{thirdPartyId}}\",\r\n    \"purchaseOpenItemLinkagePaidAmounts\": [\r\n        {\r\n            \"openItemId\": \"{{openItemId}}\",\r\n            \"paidAmount\": 50\r\n        }\r\n    ]\r\n  }\r\n}"
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                }
              ],
              "description": "The example shows how to create and close an invoice, then validate (post) it, how to retrieve the due dates, their status, and their amounts, and then partially pay the first due date.\n\nYou will need:\n\n1. At least one customer\n2. At least two products \n3. A sales invoice created for the customer  \n5. A sales journal\n6. A payment method set up for transactions\n    \n"
            },
            {
              "name": "Q.PurchaseInvoices - first id filled in {{currentId}}",
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "exec": [
                      "pm.test(\"Variables creation\", function () {\r",
                      "    let jsd = pm.response.json();\r",
                      "\r",
                      "    if (jsd.data == null || jsd.data.purchaseInvoices.edges.length == 0)\r",
                      "        {console.error(\"Unable to save environment variable\");return;}\r",
                      "    pm.environment.set(\"currentId\", jsd.data.purchaseInvoices.edges[0].node.id);\r",
                      "    console.log(\"'currentId' environment variable has been created : \" + pm.environment.get(\"currentId\"));\r",
                      "});"
                    ],
                    "type": "text/javascript",
                    "packages": {},
                    "requests": {}
                  }
                },
                {
                  "listen": "prerequest",
                  "script": {
                    "exec": [
                      ""
                    ],
                    "type": "text/javascript",
                    "packages": {},
                    "requests": {}
                  }
                }
              ],
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "X-OrganizationId",
                    "value": "{{X-OrganizationId}}"
                  },
                  {
                    "key": "x-api-key",
                    "value": "{{subscriptionKey}}"
                  }
                ],
                "body": {
                  "mode": "graphql",
                  "graphql": {
                    "query": "query {\r\n  purchaseInvoices (\r\n        first:500\r\n        order: { creationDate: ASC }\r\n    \r\n    )  {\r\n        edges {\r\n            node {\r\n                sourceType\r\n                eInvoicingStatus\r\n                status\r\n                description\r\n                fileId\r\n                fileName\r\n                firstDueDate\r\n                operationDate\r\n                id\r\n                invoiceDate\r\n                invoiceNumber\r\n                creationDate\r\n                totalLiquid\r\n                pendingAmount\r\n                hasCashVat\r\n                supplier{socialName}\r\n                vatLines{\r\n                    purchaseAccountingAccount{code}\r\n                    tax{name percentage}\r\n                    taxTreatment{taxCode}\r\n                    transactionCategoryId\r\n                    transactionCategory{reason type default}\r\n                }\r\n                openItems{\r\n                    status\r\n                    amount\r\n                    paidAmountAccumulated\r\n                    paymentMean{description}\r\n                }\r\n            }\r\n        }\r\n        totalCount\r\n        pageInfo {\r\n         hasNextPage\r\n        }\r\n    }\r\n}",
                    "variables": ""
                  }
                },
                "url": {
                  "raw": "{{baseAddress}}/graphql",
                  "host": [
                    "{{baseAddress}}"
                  ],
                  "path": [
                    "graphql"
                  ]
                }
              },
              "response": []
            },
            {
              "name": "Q.PurchaseInvoices generated from OCR - first id filled in {{currentId}}",
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "exec": [
                      "pm.test(\"Variables creation\", function () {\r",
                      "    let jsd = pm.response.json();\r",
                      "\r",
                      "    if (jsd.data == null || jsd.data.purchaseInvoices.edges.length == 0)\r",
                      "        {console.error(\"Unable to save environment variable\");return;}\r",
                      "    pm.environment.set(\"currentId\", jsd.data.purchaseInvoices.edges[0].node.id);\r",
                      "    console.log(\"'currentId' environment variable has been created : \" + pm.environment.get(\"currentId\"));\r",
                      "});"
                    ],
                    "type": "text/javascript",
                    "packages": {},
                    "requests": {}
                  }
                },
                {
                  "listen": "prerequest",
                  "script": {
                    "exec": [
                      ""
                    ],
                    "type": "text/javascript",
                    "packages": {},
                    "requests": {}
                  }
                }
              ],
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "X-OrganizationId",
                    "value": "{{X-OrganizationId}}"
                  },
                  {
                    "key": "x-api-key",
                    "value": "{{subscriptionKey}}"
                  }
                ],
                "body": {
                  "mode": "graphql",
                  "graphql": {
                    "query": "query {\r\n  purchaseInvoices (\r\n        first:500\r\n        where:{\r\n            sourceType:{eq:AP_AUTOMATION}\r\n            fileName:{neq:null}\r\n            fileId:{neq:null}\r\n            description:{ncontains:\"OcrStatusError\"}\r\n        }\r\n        order: { creationDate: ASC }\r\n    )  {\r\n        edges {\r\n            node {\r\n                sourceType\r\n                status\r\n                description\r\n                fileId\r\n                fileName\r\n                firstDueDate\r\n                operationDate\r\n                id\r\n                invoiceDate\r\n                invoiceNumber\r\n                creationDate\r\n                totalLiquid\r\n                pendingAmount\r\n                hasCashVat\r\n                supplier{\r\n                    socialName\r\n                }\r\n                vatLines{\r\n                    purchaseAccountingAccount{\r\n                        code\r\n                    }\r\n                    tax{\r\n                        name\r\n                        percentage\r\n                    }\r\n                    taxTreatment{\r\n                        taxCode\r\n                    }\r\n                }\r\n                openItems{\r\n                    status\r\n                    amount\r\n                    paidAmountAccumulated\r\n                    paymentMean{\r\n                        description\r\n                    }\r\n                }\r\n            }\r\n        }\r\n        totalCount\r\n        pageInfo {\r\n         hasNextPage\r\n        }\r\n    }\r\n}",
                    "variables": ""
                  }
                },
                "url": {
                  "raw": "{{baseAddress}}/graphql",
                  "host": [
                    "{{baseAddress}}"
                  ],
                  "path": [
                    "graphql"
                  ]
                }
              },
              "response": []
            },
            {
              "name": "Q.PurchaseInvoices filtered by Id",
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "exec": [
                      ""
                    ],
                    "type": "text/javascript",
                    "packages": {}
                  }
                }
              ],
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "X-OrganizationId",
                    "value": "{{X-OrganizationId}}"
                  },
                  {
                    "key": "x-api-key",
                    "value": "{{subscriptionKey}}"
                  }
                ],
                "body": {
                  "mode": "graphql",
                  "graphql": {
                    "query": "query ($id : UUID!) {\r\n  purchaseInvoices (\r\n    where : { id : { eq : $id }}) \r\n      {\r\n        edges {\r\n            node {\r\n                firstDueDate\r\n                operationDate\r\n                id\r\n                invoiceDate\r\n                invoiceNumber\r\n                creationDate\r\n                supplier{\r\n                    socialName\r\n                }\r\n                vatLines{\r\n                    purchaseAccountingAccount{\r\n                        code\r\n                    }\r\n                    tax{\r\n                        name\r\n                        percentage\r\n                    }\r\n                    taxTreatment{\r\n                        taxCode\r\n                    }\r\n                }\r\n            }\r\n        }\r\n    }\r\n}",
                    "variables": "{\r\n  \"id\":\"{{currentId}}\"\r\n}"
                  }
                },
                "url": {
                  "raw": "{{baseAddress}}/graphql",
                  "host": [
                    "{{baseAddress}}"
                  ],
                  "path": [
                    "graphql"
                  ]
                }
              },
              "response": []
            },
            {
              "name": "Q.PurchaseInvoiceOpenItems",
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "exec": [
                      ""
                    ],
                    "type": "text/javascript",
                    "packages": {},
                    "requests": {}
                  }
                }
              ],
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "X-OrganizationId",
                    "value": "{{X-OrganizationId}}"
                  },
                  {
                    "key": "x-api-key",
                    "value": "{{subscriptionKey}}"
                  }
                ],
                "body": {
                  "mode": "graphql",
                  "graphql": {
                    "query": "query {\r\n  purchaseInvoiceOpenItems(\r\n    order: {dueDate:ASC}\r\n  ) {\r\n    edges {\r\n      node {\r\n        purchaseInvoice {\r\n          invoiceDate\r\n          invoiceNumber\r\n          status\r\n          totalLiquid\r\n          supplier {\r\n            id\r\n            code\r\n            socialName\r\n          }\r\n        }\r\n        id\r\n        status\r\n        amount\r\n        dueDate\r\n        paidAmountAccumulated\r\n        paymentMean {\r\n          description\r\n        }\r\n      }\r\n    }\r\n    totalCount\r\n    pageInfo {\r\n        hasNextPage\r\n    }\r\n  }\r\n  \r\n}\r\n",
                    "variables": ""
                  }
                },
                "url": {
                  "raw": "{{baseAddress}}/graphql",
                  "host": [
                    "{{baseAddress}}"
                  ],
                  "path": [
                    "graphql"
                  ]
                }
              },
              "response": []
            }
          ],
          "description": "Example of invoice creation:\n\n- An invoice for an existing customer in Sage Active.\n    \n\nNote that, unlike quotes which allow for inputting leads, an invoice must **always** be associated with an **existing customer**."
        },
        {
          "name": "File Management",
          "item": [
            {
              "name": "Upload a file",
              "item": [
                {
                  "name": "1-Q.customers - first activated & current legislation",
                  "event": [
                    {
                      "listen": "test",
                      "script": {
                        "exec": [
                          "pm.test(\"Variables creation\", function () {\r",
                          "    let jsd = pm.response.json();\r",
                          "\r",
                          "    if (jsd.data == null || jsd.data.customers.edges.length == 0)\r",
                          "        {console.error(\"Unable to save environment variable for customer\");return;}\r",
                          "    pm.environment.set(\"customerId\", jsd.data.customers.edges[0].node.id);\r",
                          "    console.log(\"customerId environment variable has been created : \" + pm.environment.get(\"customerId\"));\r",
                          "});"
                        ],
                        "type": "text/javascript",
                        "packages": {},
                        "requests": {}
                      }
                    }
                  ],
                  "request": {
                    "auth": {
                      "type": "bearer",
                      "bearer": [
                        {
                          "key": "token",
                          "value": "{{accessToken}}",
                          "type": "string"
                        }
                      ]
                    },
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "query ($countryAcronym : String!) {\r\n    customers (\r\n        order: [{ code: ASC }]\r\n        where: {\r\n            countryAcronym: {eq:$countryAcronym}\r\n            disabled: {eq: false}\r\n            socialName: {neq:\"Postman demo\"}\r\n            }\r\n        first:1\r\n        ) {\r\n        edges {\r\n            node {\r\n                  id\r\n                  code\r\n                  socialName\r\n            }\r\n        }\r\n    }   \r\n}",
                        "variables": "{\r\n  \"countryAcronym\":\"{{legislationCode}}\"\r\n}"
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                },
                {
                  "name": "2-M.Upload a file to the customer",
                  "event": [
                    {
                      "listen": "test",
                      "script": {
                        "exec": [
                          "pm.test(\"Variable creation for uploaded file\", function () {\r",
                          "    let jsd = pm.response.json();\r",
                          "\r",
                          "    if (jsd.data == null || !jsd.data.uploadFileToEntity) {\r",
                          "        console.error(\"Unable to save environment variable for uploaded file\");\r",
                          "        return;\r",
                          "    }\r",
                          "\r",
                          "    pm.environment.set(\"uploadedFileId\", jsd.data.uploadFileToEntity.id);\r",
                          "    console.log(\"uploadedFileId environment variable has been created : \" + pm.environment.get(\"uploadedFileId\"));\r",
                          "});\r",
                          ""
                        ],
                        "type": "text/javascript",
                        "packages": {},
                        "requests": {}
                      }
                    },
                    {
                      "listen": "prerequest",
                      "script": {
                        "exec": [
                          "businessDate = new Date().toISOString();//.substring(0,10);\r",
                          "pm.environment.set(\"businessDate\", businessDate);\r",
                          "\r",
                          "fileComment = \"default comment\";\r",
                          "pm.environment.set(\"fileComment\", fileComment);\r",
                          "\r",
                          "// Logs for debugging\r",
                          "console.log(\"businessDate =\", businessDate);\r",
                          "console.log(\"fileComment =\", fileComment);\r",
                          ""
                        ],
                        "type": "text/javascript",
                        "packages": {},
                        "requests": {}
                      }
                    }
                  ],
                  "request": {
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      },
                      {
                        "key": "GraphQL-preflight",
                        "value": "1",
                        "type": "text"
                      }
                    ],
                    "body": {
                      "mode": "formdata",
                      "formdata": [
                        {
                          "key": "operations",
                          "value": "{\"query\":\"mutation ($input: UploadFileInput!) { uploadFileToEntity(input: $input){id}}\",\"variables\":{\"input\":{\"file\":null,\"entityType\":\"CUSTOMER\",\"entityId\":\"{{customerId}}\",\"businessDate\":\"{{businessDate}}\",\"comment\":\"{{fileComment}}\"}}}\n",
                          "type": "text"
                        },
                        {
                          "key": "map",
                          "value": "{ \"0\": [\"variables.input.file\"] }",
                          "type": "text"
                        },
                        {
                          "key": "0",
                          "type": "file",
                          "src": "/C:/Users/chcop/OneDrive - Sage Software, Inc/Sage Active GraphQL APIs _ SBD - sample_files/business_invoices/Amazon.pdf"
                        }
                      ]
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                },
                {
                  "name": "3–Q.Files Get uploaded file details",
                  "event": [
                    {
                      "listen": "test",
                      "script": {
                        "exec": [
                          ""
                        ],
                        "type": "text/javascript",
                        "packages": {},
                        "requests": {}
                      }
                    }
                  ],
                  "request": {
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "query ($uploadedFileId : String!) {  files(\r\n    where: { id: { eq: $uploadedFileId } }) {\r\n    edges {\r\n      node {\r\n        status\r\n        entityId\r\n        entityType\r\n        uploadDate\r\n        businessDate\r\n        fileName\r\n        type\r\n        comment\r\n        id\r\n        mimeType\r\n        size\r\n      }\r\n    }\r\n  }  \r\n}",
                        "variables": "{\r\n    \"uploadedFileId\":\"{{uploadedFileId}}\"\r\n}"
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                }
              ],
              "description": "The **UploadFileToEntity** mutation allows you to directly upload a file and associate it with a business entity such as a **Customer**, **Supplier**, or **AccountingEntry**.\n\nThe file is streamed directly through the GraphQL mutation using the `Upload` scalar type, following the GraphQL multipart request specification."
            },
            {
              "name": "Get download path for all files of a customer",
              "item": [
                {
                  "name": "1-Q.customers - first activated & current legislation",
                  "event": [
                    {
                      "listen": "test",
                      "script": {
                        "exec": [
                          "pm.test(\"Variables creation\", function () {\r",
                          "    let jsd = pm.response.json();\r",
                          "\r",
                          "    if (jsd.data == null || jsd.data.customers.edges.length == 0)\r",
                          "        {console.error(\"Unable to save environment variable for customer\");return;}\r",
                          "    pm.environment.set(\"customerId\", jsd.data.customers.edges[0].node.id);\r",
                          "    console.log(\"customerId environment variable has been created : \" + pm.environment.get(\"customerId\"));\r",
                          "});"
                        ],
                        "type": "text/javascript",
                        "packages": {},
                        "requests": {}
                      }
                    },
                    {
                      "listen": "prerequest",
                      "script": {
                        "exec": [
                          ""
                        ],
                        "type": "text/javascript",
                        "packages": {},
                        "requests": {}
                      }
                    }
                  ],
                  "request": {
                    "auth": {
                      "type": "bearer",
                      "bearer": [
                        {
                          "key": "token",
                          "value": "{{accessToken}}",
                          "type": "string"
                        }
                      ]
                    },
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "query ($countryAcronym : String!) {\r\n    customers (\r\n        order: [{ code: ASC }]\r\n        where: {\r\n            countryAcronym: {eq:$countryAcronym}\r\n            disabled: {eq: false}\r\n            socialName: {neq:\"Postman demo\"}\r\n            }\r\n        first:1\r\n        ) {\r\n        edges {\r\n            node {\r\n                  id\r\n                  code\r\n                  socialName\r\n            }\r\n        }\r\n    }   \r\n}",
                        "variables": "{\r\n  \"countryAcronym\":\"{{legislationCode}}\"\r\n}"
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                },
                {
                  "name": "2-Q.Files Get all file download path for this customer",
                  "event": [
                    {
                      "listen": "test",
                      "script": {
                        "exec": [
                          "pm.test(\"Variable creation for first fileId\", function () {\r",
                          "    let jsd = pm.response.json();\r",
                          "\r",
                          "    if (jsd.data == null || \r",
                          "        jsd.data.files == null || \r",
                          "        jsd.data.files.edges == null || \r",
                          "        jsd.data.files.edges.length === 0) {\r",
                          "        console.error(\"Unable to save environment variable for fileId\");\r",
                          "        return;\r",
                          "    }\r",
                          "\r",
                          "    let fileId = jsd.data.files.edges[0].node.id;\r",
                          "    pm.environment.set(\"fileId\", fileId);\r",
                          "    console.log(\"fileId environment variable has been created:\", pm.environment.get(\"fileId\"));\r",
                          "});\r",
                          ""
                        ],
                        "type": "text/javascript",
                        "packages": {},
                        "requests": {}
                      }
                    },
                    {
                      "listen": "prerequest",
                      "script": {
                        "exec": [
                          ""
                        ],
                        "type": "text/javascript",
                        "packages": {},
                        "requests": {}
                      }
                    }
                  ],
                  "request": {
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "query ($customerId : String!)  {\r\n  files(\r\n    first:100\r\n    where: { \r\n       entityType: { eq: CUSTOMER } \r\n       entityId: { eq: $customerId}\r\n    }) {\r\n    edges {\r\n      node {\r\n        id\r\n        businessDate\r\n        fileName\r\n        type\r\n        comment\r\n        mimeType\r\n        size\r\n        downloadPath\r\n      }\r\n    }\r\n  }  \r\n}",
                        "variables": "{\r\n    \"customerId\":\"{{customerId}}\"\r\n}"
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                },
                {
                  "name": "3-Q.Get download path for the first file of the previous query",
                  "event": [
                    {
                      "listen": "test",
                      "script": {
                        "exec": [
                          "pm.test(\"Variable creation for first downloadPath\", function () {\r",
                          "    let jsd = pm.response.json();\r",
                          "\r",
                          "    if (jsd.data == null || jsd.data.files.edges.length === 0) {\r",
                          "        console.error(\"Unable to save environment variable for downloadPath\");\r",
                          "        return;\r",
                          "    }\r",
                          "\r",
                          "    let downloadPath = jsd.data.files.edges[0].node.downloadPath;\r",
                          "    pm.environment.set(\"downloadPath\", downloadPath);\r",
                          "    console.log(\"downloadPath environment variable has been created:\", pm.environment.get(\"downloadPath\"));\r",
                          "});\r",
                          ""
                        ],
                        "type": "text/javascript",
                        "packages": {},
                        "requests": {}
                      }
                    }
                  ],
                  "request": {
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "query ($Id : String!) {  files(\r\n    where: { id: { eq: $Id } }) {\r\n    edges {\r\n      node {\r\n        fileName\r\n        type\r\n        mimeType\r\n        size\r\n        downloadPath\r\n      }\r\n    }\r\n  }  \r\n}",
                        "variables": "{\r\n    \"Id\":\"{{fileId}}\"\r\n}"
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                },
                {
                  "name": "4-Q.Download the file",
                  "request": {
                    "method": "GET",
                    "header": [],
                    "url": {
                      "raw": "{{baseAddress}}/{{downloadPath}}",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "{{downloadPath}}"
                      ]
                    }
                  },
                  "response": []
                }
              ]
            },
            {
              "name": "Get file information with different filters",
              "item": [
                {
                  "name": "Q.Files Get all file details for accounting entries",
                  "event": [
                    {
                      "listen": "test",
                      "script": {
                        "exec": [
                          ""
                        ],
                        "type": "text/javascript",
                        "packages": {},
                        "requests": {}
                      }
                    }
                  ],
                  "request": {
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "query {\r\n  files(\r\n        first: 100, \r\n        where: { entityType: { eq: ACCOUNTING_ENTRY } }\r\n    ) {\r\n    edges {\r\n      node {\r\n        entityId\r\n        entityType\r\n        uploadDate\r\n        businessDate\r\n        fileName\r\n        type\r\n        comment\r\n        id\r\n        mimeType\r\n        size\r\n      }\r\n    }\r\n  }  \r\n}",
                        "variables": ""
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                },
                {
                  "name": "Q.Files Get all file details between two dates",
                  "event": [
                    {
                      "listen": "test",
                      "script": {
                        "exec": [
                          ""
                        ],
                        "type": "text/javascript",
                        "packages": {},
                        "requests": {}
                      }
                    }
                  ],
                  "request": {
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "query {\r\n  files(\r\n        first: 100, \r\n        where: { \r\n        uploadDate: { gte: \"2025-01-01\", lte: \"2025-12-31\" }\r\n        }\r\n    ) {\r\n    edges {\r\n      node {\r\n        entityId\r\n        entityType\r\n        uploadDate\r\n        businessDate\r\n        fileName\r\n        type\r\n        comment\r\n        id\r\n        mimeType\r\n        size\r\n      }\r\n    }\r\n  }  \r\n}",
                        "variables": ""
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                }
              ]
            },
            {
              "name": "Upload a receipt & purchase invoices",
              "item": [
                {
                  "name": "1. M.Upload a file to generate a purchase invoice",
                  "event": [
                    {
                      "listen": "test",
                      "script": {
                        "exec": [
                          "pm.test(\"Variable creation for uploaded file\", function () {\r",
                          "    let jsd = pm.response.json();\r",
                          "\r",
                          "    if (jsd.data == null || !jsd.data.uploadFileToEntity) {\r",
                          "        console.error(\"Unable to save environment variable for uploaded file\");\r",
                          "        return;\r",
                          "    }\r",
                          "\r",
                          "    pm.environment.set(\"uploadedFileId\", jsd.data.uploadFileToEntity.id);\r",
                          "    console.log(\"uploadedFileId environment variable has been created : \" + pm.environment.get(\"uploadedFileId\"));\r",
                          "});\r",
                          ""
                        ],
                        "type": "text/javascript",
                        "packages": {},
                        "requests": {}
                      }
                    },
                    {
                      "listen": "prerequest",
                      "script": {
                        "exec": [
                          ""
                        ],
                        "type": "text/javascript",
                        "packages": {},
                        "requests": {}
                      }
                    }
                  ],
                  "request": {
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      },
                      {
                        "key": "GraphQL-preflight",
                        "value": "1",
                        "type": "text"
                      }
                    ],
                    "body": {
                      "mode": "formdata",
                      "formdata": [
                        {
                          "key": "operations",
                          "value": "{\"query\":\"mutation ($input: UploadFileInput!) { uploadFileToEntity(input: $input){id}}\",\"variables\":{\"input\":{\"file\":null,\"entityType\":\"AP_AUTOMATION\"}}}\n",
                          "type": "text"
                        },
                        {
                          "key": "map",
                          "value": "{ \"0\": [\"variables.input.file\"] }",
                          "type": "text"
                        },
                        {
                          "key": "0",
                          "type": "file",
                          "src": "/C:/Users/chcop/OneDrive - Sage Software, Inc/Sage Active GraphQL APIs _ SBD - sample_files/business_invoices/ELECTRODEPOT.pdf"
                        }
                      ]
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                },
                {
                  "name": "2.Q.Files Get uploaded file to check the status",
                  "event": [
                    {
                      "listen": "test",
                      "script": {
                        "exec": [
                          ""
                        ],
                        "type": "text/javascript",
                        "packages": {},
                        "requests": {}
                      }
                    },
                    {
                      "listen": "prerequest",
                      "script": {
                        "packages": {},
                        "type": "text/javascript"
                      }
                    }
                  ],
                  "request": {
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "query ($uploadedFileId : String!) {  files(\r\n    where: { id: { eq: $uploadedFileId } }) {\r\n    edges {\r\n      node {\r\n        status\r\n        fileName\r\n        type\r\n      }\r\n    }\r\n  }  \r\n}",
                        "variables": "{\r\n    \"uploadedFileId\":\"{{uploadedFileId}}\"\r\n}"
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                },
                {
                  "name": "3.Q.PurchaseInvoices by uploadFileId (to check if the invoice is created)",
                  "event": [
                    {
                      "listen": "test",
                      "script": {
                        "exec": [
                          "pm.test(\"Variables creation\", function () {\r",
                          "    let jsd = pm.response.json();\r",
                          "\r",
                          "    if (jsd.data == null || jsd.data.purchaseInvoices.edges.length == 0) {\r",
                          "        console.error(\"Unable to save environment variable\");\r",
                          "        return;\r",
                          "    }\r",
                          "\r",
                          "    // Extract fileId from the first purchase invoice\r",
                          "    pm.environment.set(\"currentId\", jsd.data.purchaseInvoices.edges[0].node.id);\r",
                          "    console.log(\"'currentId' environment variable has been created: \" + pm.environment.get(\"currentId\"));\r",
                          "});\r",
                          ""
                        ],
                        "type": "text/javascript",
                        "packages": {},
                        "requests": {}
                      }
                    },
                    {
                      "listen": "prerequest",
                      "script": {
                        "exec": [
                          "//WAIT10000"
                        ],
                        "type": "text/javascript",
                        "packages": {},
                        "requests": {}
                      }
                    }
                  ],
                  "request": {
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "# This query retrieves a purchase invoice by its unique ID ($id).\r\nquery($uploadedFileId:String!) {\r\n  purchaseInvoices (\r\n        where:{fileId:{eq:$uploadedFileId}}\r\n    )  {\r\n        edges {\r\n            node {\r\n                id\r\n                sourceType\r\n                status\r\n                description\r\n                fileId\r\n                fileName\r\n                operationDate\r\n                invoiceDate\r\n                invoiceNumber\r\n                totalLiquid\r\n                pendingAmount\r\n                supplier{\r\n                    code\r\n                    socialName\r\n                }\r\n            }\r\n        }\r\n    }\r\n}",
                        "variables": "{\r\n    \"uploadedFileId\":\"{{uploadedFileId}}\"\r\n}"
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                },
                {
                  "name": "4.Q.Files Get uploaded file details to retrieve previewPath DownloadPath",
                  "event": [
                    {
                      "listen": "test",
                      "script": {
                        "exec": [
                          "// Extract the first node from the response\r",
                          "const node = pm.response.json()?.data?.files?.edges?.[0]?.node;\r",
                          "\r",
                          "if (node) {\r",
                          "    if (node.previewPath) {\r",
                          "        pm.environment.set(\"previewPath\", node.previewPath);\r",
                          "        console.log(\"previewPath saved:\", node.previewPath);\r",
                          "    } else {\r",
                          "        console.warn(\"previewPath not found in response\");\r",
                          "    }\r",
                          "\r",
                          "    if (node.downloadPath) {\r",
                          "        pm.environment.set(\"downloadPath\", node.downloadPath);\r",
                          "        console.log(\"downloadPath saved:\", node.downloadPath);\r",
                          "    } else {\r",
                          "        console.warn(\"downloadPath not found in response\");\r",
                          "    }\r",
                          "} else {\r",
                          "    console.error(\"❌ No node found in response\");\r",
                          "}\r",
                          ""
                        ],
                        "type": "text/javascript",
                        "packages": {},
                        "requests": {}
                      }
                    },
                    {
                      "listen": "prerequest",
                      "script": {
                        "exec": [
                          ""
                        ],
                        "type": "text/javascript",
                        "packages": {},
                        "requests": {}
                      }
                    }
                  ],
                  "request": {
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "query ($uploadedFileId : String!) {  files(\r\n    where: { id: { eq: $uploadedFileId } }) {\r\n    edges {\r\n      node {\r\n        status\r\n        entityId\r\n        entityType\r\n        uploadDate\r\n        businessDate\r\n        fileName\r\n        type\r\n        comment\r\n        id\r\n        mimeType\r\n        size\r\n        previewPath\r\n        downloadPath\r\n      }\r\n    }\r\n  }  \r\n}",
                        "variables": "{\r\n    \"uploadedFileId\":\"{{uploadedFileId}}\"\r\n}"
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                },
                {
                  "name": "5.Q.Preview the file",
                  "request": {
                    "method": "GET",
                    "header": [],
                    "url": {
                      "raw": "{{baseAddress}}/{{previewPath}}",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "{{previewPath}}"
                      ]
                    }
                  },
                  "response": []
                },
                {
                  "name": "6.Q.Download the file",
                  "request": {
                    "method": "GET",
                    "header": [],
                    "url": {
                      "raw": "{{baseAddress}}/{{downloadPath}}",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "{{downloadPath}}"
                      ]
                    }
                  },
                  "response": []
                },
                {
                  "name": "7.Q.PurchaseInvoices List",
                  "event": [
                    {
                      "listen": "test",
                      "script": {
                        "exec": [
                          ""
                        ],
                        "type": "text/javascript",
                        "packages": {},
                        "requests": {}
                      }
                    }
                  ],
                  "request": {
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "# This query returns the list of purchase invoices sorted by invoiceDate in descending order.  \r\n# Replace DESC with ASC to reverse the sorting order.  \r\n#\r\n# The results can be filtered by status. Available statuses are:\r\n# - Uploaded: (Uploading) The invoice has been created but only contains the file name; it has not yet been processed.  \r\n# - Pending: (Pending) The invoice can be modified; it has not yet been transferred to accounting.  \r\n# - Closed: (Pending) The invoice was supposed to be transferred to accounting, but the operation failed or was canceled.  \r\n# - Posted: (Awaiting payment) The invoice can no longer be modified; it has been transferred to accounting.  \r\n# - PartiallyPaid: (Partially paid) The invoice is partially paid. Payments are pending.  \r\n# - Paid: (Paid) The invoice is fully paid.  \r\n# - SbdRejected: (OCR document rejected) This is not an actual invoice status. It is returned when the invoice was created through OCR recognition of a document, and the uploaded document was rejected by the antivirus (for example, if the file was password-protected or infected).\r\n\r\nquery($filterStatus: [String],$order:SortEnumType,$after: String) {\r\n  purchaseInvoices (\r\n        first: 50, \r\n        after: $after\r\n        where:{status:{nin:$filterStatus}}\r\n        order: { creationDate: $order }\r\n    )  {\r\n        edges {\r\n            node {\r\n                creationDate\r\n                sourceType\r\n                status\r\n                description\r\n                fileId\r\n                fileName\r\n                firstDueDate\r\n                operationDate\r\n                id\r\n                invoiceDate\r\n                invoiceNumber\r\n                totalLiquid\r\n                pendingAmount\r\n                supplier{\r\n                    code\r\n                    socialName\r\n                }\r\n            }\r\n        }\r\n        totalCount\r\n        pageInfo {\r\n         hasNextPage\r\n        }\r\n    }\r\n}",
                        "variables": "{\r\n    \"order\":\"DESC\",\r\n    \"after\":null,\r\n    \"filterStatus\":[\"Paid\"]\r\n}"
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                },
                {
                  "name": "8.M.PurchaseInvoice Delete By Id",
                  "event": [
                    {
                      "listen": "test",
                      "script": {
                        "exec": [
                          ""
                        ],
                        "type": "text/javascript",
                        "packages": {}
                      }
                    }
                  ],
                  "request": {
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "mutation ($values:PurchaseInvoiceDeleteGLDtoInput!) {  \r\n    deletePurchaseInvoice(input: $values) {\r\n      id\r\n  }\r\n}",
                        "variables": "{\r\n  \"values\": {\r\n    \"id\":\"{{currentId}}\"\r\n  }\r\n}"
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                }
              ]
            },
            {
              "name": "File Export - generate zip files of selected files",
              "item": [
                {
                  "name": "1-Q.FilesExport Generate zip and index path of all customer files",
                  "event": [
                    {
                      "listen": "test",
                      "script": {
                        "exec": [
                          ""
                        ],
                        "type": "text/javascript",
                        "packages": {},
                        "requests": {}
                      }
                    }
                  ],
                  "request": {
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "query ($language: String!) {\r\n  filesExport(\r\n    language: $language\r\n    where: {\r\n        entityType: { eq: CUSTOMER } \r\n    }\r\n  ) {\r\n    status\r\n    message\r\n    requestedAt\r\n  }\r\n}\r\n",
                        "variables": "{\r\n  \"language\": \"en\"\r\n}"
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                },
                {
                  "name": "2- Q.Files Get download and index path",
                  "event": [
                    {
                      "listen": "test",
                      "script": {
                        "exec": [
                          ""
                        ],
                        "type": "text/javascript",
                        "packages": {}
                      }
                    }
                  ],
                  "request": {
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-OrganizationId",
                        "value": "{{X-OrganizationId}}"
                      },
                      {
                        "key": "x-api-key",
                        "value": "{{subscriptionKey}}"
                      }
                    ],
                    "body": {
                      "mode": "graphql",
                      "graphql": {
                        "query": "query {\r\n  files(\r\n        first: 100, \r\n        where: { filesExport: {eq:true} } \r\n    ) {\r\n    edges {\r\n      node {\r\n        fileName\r\n        mimeType\r\n        size\r\n        downloadPath\r\n      }\r\n    }\r\n  }  \r\n}",
                        "variables": ""
                      }
                    },
                    "url": {
                      "raw": "{{baseAddress}}/graphql",
                      "host": [
                        "{{baseAddress}}"
                      ],
                      "path": [
                        "graphql"
                      ]
                    }
                  },
                  "response": []
                }
              ]
            }
          ],
          "description": "The **File Management** section provides the core functionalities to upload, retrieve, and manage files associated with business entities such as customers, suppliers, or accounting entries.\n\nThese files can be documents like invoices, receipts, or supporting attachments linked to operational records.  \nThe API supports uploading files directly through GraphQL using the `Upload` scalar and retrieving them with powerful filtering capabilities using the `files` query."
        }
      ],
      "description": "This section particularly addresses resources that are specific to an organization within a single tenant.\n\nWhen interacting with such resources via the Sage Active Public API, it’s crucial to specify the organization context by including `X-OrganizationId` in the request header."
    }
  ],
  "auth": {
    "type": "bearer",
    "bearer": [
      {
        "key": "token",
        "value": "{{accessToken}}",
        "type": "string"
      }
    ]
  },
  "event": [
    {
      "listen": "prerequest",
      "script": {
        "type": "text/javascript",
        "exec": [
          "// Due to the fact that examples of queries and mutations use URLs in the format {{baseAddress}}/graphql,",
          "// it is necessary to remove the trailing '/graphql' from the {{baseAddress}} environment variable if present.",
          "",
          "let baseAddress = pm.environment.get(\"baseAddress\");",
          "",
          "if (baseAddress.endsWith(\"/graphql\")) {",
          "    baseAddress = baseAddress.replace(\"/graphql\", \"\");",
          "    pm.environment.set(\"baseAddress\", baseAddress);",
          "}",
          ""
        ]
      }
    },
    {
      "listen": "test",
      "script": {
        "type": "text/javascript",
        "exec": [
          ""
        ]
      }
    }
  ]
}