info:
  name: Azzeratore ritenute per contratto NON economico
  type: http
  seq: 9

http:
  method: POST
  url: "{{elixFormsApiUrl}}/eftl/process/v1"
  headers:
    - name: x-requested-with
      value: XMLHttpRequest
    - name: x-api-key
      value: "{{elixFormsWsAuthenticationToken}}"
    - name: x-ef-request-id
      value: "17144"
      disabled: true
    - name: x-ef-request-id
      value: "25889"
  body:
    type: json
    data: |-
      {
        "userDocument": "{{elixBase64EftlDocument}}", // see the pre-request script
        "userContext": {
          "lang": "IT"
        }
      }
  auth: inherit

runtime:
  scripts:
    - type: before-request
      code: |-
        const { prepareEftlDocument } = require("./elixFormsJs.js")
        // Copy-pasta your EFTL document below inside the template literals (`)
        prepareEftlDocument(String.raw`
        [EFTL]
        [VAR name="azzeratoreNonEconomico" type="number"][% azzeratoreNonEconomico = 1; %][/VAR]
        [VAR name="isEconomico" type="boolean"][TAG]GETVALUEBYTAG,CONTRATTO_ECONOMICO,REQUEST,IUQOID[/TAG][/VAR]
        [VAR name="esenzioneRitenute" type="string"][TAG]SCHEMAID,341,COL0089,IUQOID, , [/TAG][/VAR]
        [VAR name="mostraRitenute" type="boolean"][IS_EMPTY varname="esenzioneRitenute" /][/VAR]


        [IF]
          [CONDITION][% isEconomico == true || mostraRitenute == false %][/CONDITION]
          [THEN][% azzeratoreNonEconomico = 0; %][/THEN]
        [/IF]

        [%= azzeratoreNonEconomico %]
        [/EFTL]
        `);

settings:
  encodeUrl: true
  timeout: 0
  followRedirects: true
  maxRedirects: 5
  forwardAuthorizationHeader: true
