{
  "info": {
    "name": "MagniFinance SOAP API - Tax Communication",
    "description": "Switch the automatic communication of documents to the Tax Authority (AT) on or off, check whether it is on, and list the communicated documents, over SOAP 1.1. Every 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/).\n2. To turn the service on, also fill in `atUsername` and `atPassword` with the AT user that has the WFA/WDT permissions.\n3. Send **ActivationGet** first: it only reads.\n\nWSDL: https://bo.magnifinance.com/MagniAPI/taxcommunication.asmx?wsdl\nDocs: https://developer.magnifinance.com/finance/tax-compliance/tax-communication/",
    "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": "atUsername", "value": "", "description": "Tax Authority (AT) user with the WFA/WDT permissions, e.g. 123456789/1" },
    { "key": "atPassword", "value": "", "type": "secret", "description": "Password of that AT user" }
  ],
  "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] || '';",
          "const detail = (text.match(/<Detail>([^<]*)<\\/Detail>/) || [])[1] || '';",
          "pm.test('Type is Success', () => pm.expect(text, `${error} ${detail}`.trim()).to.include('<Type>Success</Type>'));",
          "// ActivationSet with IsActive true succeeds even when the AT rejects the credentials, so check the result too.",
          "const turningOn = /<tax:IsActive>true</.test((pm.request.body && pm.request.body.raw) || '');",
          "if (turningOn) pm.test('Tax Communication is now active', () => pm.expect(text, 'the AT rejected the credentials, so the service was switched off').to.include('<IsActive>true</IsActive>'));"
        ]
      }
    }
  ],
  "item": [
    {
      "name": "ActivationGet",
      "request": {
        "method": "POST",
        "header": [
          { "key": "Content-Type", "value": "text/xml; charset=utf-8" },
          { "key": "SOAPAction", "value": "\"http://MagniAPI/TaxCommunication/ActivationGet\"" }
        ],
        "url": { "raw": "{{baseUrl}}/MagniAPI/taxcommunication.asmx", "host": ["{{baseUrl}}"], "path": ["MagniAPI", "taxcommunication.asmx"] },
        "body": {
          "mode": "raw",
          "options": { "raw": { "language": "xml" } },
          "raw": "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:tax=\"http://MagniAPI/TaxCommunication/\">\n  <soapenv:Header/>\n  <soapenv:Body>\n    <tax:ActivationGet>\n      <tax:authentication>\n        <tax:Email>{{email}}</tax:Email>\n        <tax:Token>{{token}}</tax:Token>\n      </tax:authentication>\n    </tax:ActivationGet>\n  </soapenv:Body>\n</soapenv:Envelope>"
        },
        "description": "Is the service on? Read `IsActive`.\n\nDocs: https://developer.magnifinance.com/finance/tax-compliance/tax-communication/activation-get/"
      }
    },
    {
      "name": "ActivationSet",
      "request": {
        "method": "POST",
        "header": [
          { "key": "Content-Type", "value": "text/xml; charset=utf-8" },
          { "key": "SOAPAction", "value": "\"http://MagniAPI/TaxCommunication/ActivationSet\"" }
        ],
        "url": { "raw": "{{baseUrl}}/MagniAPI/taxcommunication.asmx", "host": ["{{baseUrl}}"], "path": ["MagniAPI", "taxcommunication.asmx"] },
        "body": {
          "mode": "raw",
          "options": { "raw": { "language": "xml" } },
          "raw": "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:tax=\"http://MagniAPI/TaxCommunication/\">\n  <soapenv:Header/>\n  <soapenv:Body>\n    <tax:ActivationSet>\n      <tax:authentication>\n        <tax:Email>{{email}}</tax:Email>\n        <tax:Token>{{token}}</tax:Token>\n      </tax:authentication>\n      <tax:activation>\n        <tax:Username>{{atUsername}}</tax:Username>\n        <tax:Password>{{atPassword}}</tax:Password>\n        <tax:IsActive>true</tax:IsActive>\n      </tax:activation>\n    </tax:ActivationSet>\n  </soapenv:Body>\n</soapenv:Envelope>"
        },
        "description": "Turns the service on with the AT credentials in `atUsername` / `atPassword`. If the AT rejects them the request still succeeds but `IsActive` is `false`. Set `IsActive` to `false` to turn it off.\n\nDocs: https://developer.magnifinance.com/finance/tax-compliance/tax-communication/activation-set/"
      }
    },
    {
      "name": "CommunicationList",
      "request": {
        "method": "POST",
        "header": [
          { "key": "Content-Type", "value": "text/xml; charset=utf-8" },
          { "key": "SOAPAction", "value": "\"http://MagniAPI/TaxCommunication/CommunicationList\"" }
        ],
        "url": { "raw": "{{baseUrl}}/MagniAPI/taxcommunication.asmx", "host": ["{{baseUrl}}"], "path": ["MagniAPI", "taxcommunication.asmx"] },
        "body": {
          "mode": "raw",
          "options": { "raw": { "language": "xml" } },
          "raw": "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:tax=\"http://MagniAPI/TaxCommunication/\">\n  <soapenv:Header/>\n  <soapenv:Body>\n    <tax:CommunicationList>\n      <tax:authentication>\n        <tax:Email>{{email}}</tax:Email>\n        <tax:Token>{{token}}</tax:Token>\n      </tax:authentication>\n      <tax:parameters>\n        <tax:TotalElements>100</tax:TotalElements>\n        <tax:ElementsPerPage>10</tax:ElementsPerPage>\n        <tax:CurrentPage>1</tax:CurrentPage>\n      </tax:parameters>\n    </tax:CommunicationList>\n  </soapenv:Body>\n</soapenv:Envelope>"
        },
        "description": "A page of the documents communicated to the AT and their status.\n\nDocs: https://developer.magnifinance.com/finance/tax-compliance/tax-communication/list-documents/"
      }
    }
  ]
}
