{
  "info": {
    "name": "MagniFinance SOAP API - TaxId Validation",
    "description": "Checks whether a tax id is valid for a country (today only `PT`), over SOAP 1.1 on the v1.1 endpoint. The request already has the envelope, `Content-Type` and `SOAPAction` set.\n\n1. Open the collection's **Variables** tab and fill in `email` and `token` (see https://developer.magnifinance.com/finance/getting-started/authentication/). Any subscription token works.\n2. Send the request. Change the `taxId` variable to try an invalid one: the answer is `InvalidTaxId` (4).\n\nWSDL: https://bo.magnifinance.com/MagniAPI/v1.1/Invoicing.asmx?WSDL\nDocs: https://developer.magnifinance.com/finance/tax-compliance/taxid-validation/soap/",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
  },
  "variable": [
    { "key": "baseUrl", "value": "https://bo.magnifinance.com" },
    { "key": "email", "value": "", "description": "Your API user email" },
    { "key": "token", "value": "", "type": "secret", "description": "Your subscription token" },
    { "key": "countryCode", "value": "PT" },
    { "key": "taxId", "value": "599138645" }
  ],
  "event": [
    {
      "listen": "test",
      "script": {
        "type": "text/javascript",
        "exec": [
          "pm.test('HTTP 200', () => pm.response.to.have.status(200));",
          "const text = pm.response.text();",
          "const error = (text.match(/<ErrorValue>[\\s\\S]*?<Name>([^<]*)<\\/Name>/) || [])[1] || '';",
          "pm.test('Tax id is valid (Type is Success)', () => pm.expect(text, error).to.include('<Type>Success</Type>'));"
        ]
      }
    }
  ],
  "item": [
    {
      "name": "TaxIdValidation",
      "request": {
        "method": "POST",
        "header": [
          { "key": "Content-Type", "value": "text/xml; charset=utf-8" },
          { "key": "SOAPAction", "value": "\"http://MagniAPI/v1.1/Invoicing/TaxIdValidation\"" }
        ],
        "url": { "raw": "{{baseUrl}}/MagniAPI/v1.1/Invoicing.asmx", "host": ["{{baseUrl}}"], "path": ["MagniAPI", "v1.1", "Invoicing.asmx"] },
        "body": {
          "mode": "raw",
          "options": { "raw": { "language": "xml" } },
          "raw": "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:inv=\"http://MagniAPI/v1.1/Invoicing/\">\n  <soapenv:Header/>\n  <soapenv:Body>\n    <inv:TaxIdValidation>\n      <inv:Authentication>\n        <inv:Email>{{email}}</inv:Email>\n        <inv:Token>{{token}}</inv:Token>\n      </inv:Authentication>\n      <inv:CountryCode>{{countryCode}}</inv:CountryCode>\n      <inv:TaxId>{{taxId}}</inv:TaxId>\n    </inv:TaxIdValidation>\n  </soapenv:Body>\n</soapenv:Envelope>"
        },
        "description": "Docs: https://developer.magnifinance.com/finance/tax-compliance/taxid-validation/soap/"
      }
    }
  ]
}
