{
  "flow": [
    {
      "id": 1,
      "mapper": {},
      "module": "tally:watchNewResponse",
      "version": 1,
      "metadata": {
        "designer": {
          "x": 0,
          "y": 0
        },
        "interface": [
          {
            "name": "eventId",
            "type": "text",
            "label": "Event ID"
          },
          {
            "name": "responseId",
            "type": "text",
            "label": "Response ID"
          },
          {
            "name": "submissionId",
            "type": "text",
            "label": "Submission ID"
          },
          {
            "name": "respondentId",
            "type": "text",
            "label": "Respondent ID"
          },
          {
            "name": "formId",
            "type": "text",
            "label": "Form ID"
          },
          {
            "name": "formName",
            "type": "text",
            "label": "Form Name"
          },
          {
            "name": "createdAt",
            "type": "date",
            "label": "Created at"
          },
          {
            "name": "submissionPdfUrl",
            "type": "url",
            "label": "Submission PDF URL"
          },
          {
            "name": "submissionPreviewUrl",
            "type": "url",
            "label": "Submission Preview URL"
          },
          {
            "name": "fields",
            "spec": [
              {
                "name": "שם מלא",
                "type": "text"
              },
              {
                "name": "מייל",
                "type": "email"
              },
              {
                "name": "מוצר",
                "type": "text"
              },
              {
                "name": "כמות",
                "type": "number"
              },
              {
                "name": "מחיר ליחידה",
                "type": "number"
              }
            ],
            "type": "collection",
            "label": "Fields"
          },
          {
            "name": "fieldsById",
            "spec": [
              {
                "name": "question_BL5ZMR",
                "type": "text",
                "label": "שם מלא"
              },
              {
                "name": "question_k0x5Mo",
                "type": "email",
                "label": "מייל"
              },
              {
                "name": "question_v0b4ol",
                "type": "text",
                "label": "מוצר"
              },
              {
                "name": "question_KPyLdX",
                "type": "number",
                "label": "כמות"
              },
              {
                "name": "question_LEyXRl",
                "type": "number",
                "label": "מחיר ליחידה"
              }
            ],
            "type": "collection",
            "label": "Fields by ID"
          }
        ],
        "parameters": [
          {
            "name": "__IMTHOOK__",
            "type": "hook:tally",
            "label": "Webhook",
            "required": true
          }
        ]
      },
      "parameters": {
        "__IMTHOOK__": null
      }
    },
    {
      "id": 2,
      "mapper": {
        "cc": {},
        "cash": {},
        "email": "{{1.fields.`מייל`}}",
        "items": [
          {
            "quantity": "{{1.fields.`כמות`}}",
            "unitprice": "{{1.fields.`מחיר ליחידה`}}",
            "description": "{{1.fields.`מוצר`}}"
          }
        ],
        "barter": {},
        "paypal": {},
        "doctype": "deal",
        "doc_lang": "he",
        "send_sms": false,
        "send_email": true,
        "autoinvoice": false,
        "client_name": "{{1.fields.`שם מלא`}}",
        "banktransfer": {},
        "autoinvoice_cc": false
      },
      "module": "icount:documentCreate",
      "version": 1,
      "metadata": {
        "expect": [
          {
            "name": "doctype",
            "type": "select",
            "label": "Document type",
            "required": true
          },
          {
            "name": "client_id",
            "type": "select",
            "label": "Client ID"
          },
          {
            "name": "custom_client_id",
            "type": "text",
            "label": "Custom Client ID (from external system)"
          },
          {
            "name": "vat_id",
            "type": "number",
            "label": "Client VAT ID"
          },
          {
            "name": "email",
            "type": "email",
            "label": "Client email"
          },
          {
            "name": "client_name",
            "type": "text",
            "label": "Client name"
          },
          {
            "name": "client_address",
            "type": "text",
            "label": "Client address"
          },
          {
            "name": "user_id",
            "type": "select",
            "label": "User ID of the employee who issued document(s)"
          },
          {
            "name": "username",
            "type": "text",
            "label": "Username of the employee who issued document(s)"
          },
          {
            "name": "user_email",
            "type": "email",
            "label": "Email address of the employee who issued document(s)"
          },
          {
            "name": "salesman_id",
            "type": "select",
            "label": "Salesman ID"
          },
          {
            "name": "doc_date",
            "time": false,
            "type": "date",
            "label": "Document date"
          },
          {
            "name": "paydate",
            "time": false,
            "type": "date",
            "label": "Last payment date"
          },
          {
            "name": "duedate",
            "time": false,
            "type": "date",
            "label": "Due date"
          },
          {
            "name": "income_type_id",
            "type": "select",
            "label": "Income type ID"
          },
          {
            "name": "income_type_name",
            "type": "text",
            "label": "Income type name (only if income_type_id is not passed). The system will lookup income type by name. If it does not exist - it will be created automatically."
          },
          {
            "name": "expense_type_id",
            "type": "select",
            "label": "Expense Type ID"
          },
          {
            "name": "currency_id",
            "type": "select",
            "label": "Currency ID"
          },
          {
            "name": "rate",
            "type": "number",
            "label": "Currency exchange rate"
          },
          {
            "name": "tax_exempt",
            "type": "boolean",
            "label": "Tax exempt document?"
          },
          {
            "name": "vat_percent",
            "type": "number",
            "label": "VAT percent (if applicable)"
          },
          {
            "name": "totalsum",
            "type": "number",
            "label": "Total excluding VAT, before discount and roundup"
          },
          {
            "name": "discount",
            "type": "number",
            "label": "Discount"
          },
          {
            "name": "discount_incvat",
            "type": "number",
            "label": "Discount (including VAT). If discount_incvat is passed the system will extract VAT and calculate discount automatically"
          },
          {
            "name": "roundup",
            "type": "number",
            "label": "Roundup"
          },
          {
            "name": "afterdiscount",
            "type": "number",
            "label": "Total excluding VAT, after discount and roundup"
          },
          {
            "name": "totalwithvat",
            "type": "number",
            "label": "Total including VAT"
          },
          {
            "name": "paid",
            "type": "number",
            "label": "Total amount paid by all payment methods"
          },
          {
            "name": "totalwht",
            "type": "number",
            "label": "With Holding Tax amount"
          },
          {
            "name": "totalpaid",
            "type": "number",
            "label": "Total paid including WithHolding Tax"
          },
          {
            "name": "items",
            "spec": {
              "name": "value",
              "type": "collection"
            },
            "type": "array"
          },
          {
            "name": "cash",
            "spec": [
              {
                "name": "sum",
                "type": "number",
                "label": "Cash amount"
              }
            ],
            "type": "collection",
            "label": "Cash payment"
          },
          {
            "name": "cheques",
            "spec": {
              "name": "value",
              "type": "collection"
            },
            "type": "array",
            "label": "Cheques"
          },
          {
            "name": "banktransfer",
            "spec": [
              {
                "name": "sum",
                "type": "number",
                "label": "Bank Transfer amount"
              },
              {
                "name": "date",
                "type": "date",
                "label": "Bank Transfer date"
              },
              {
                "name": "account",
                "type": "integer",
                "label": "Bank account ID where BankTransfer was deposited"
              }
            ],
            "type": "collection",
            "label": "Bank Transfer payment"
          },
          {
            "name": "cc",
            "spec": [
              {
                "name": "sum",
                "type": "number",
                "label": "Amount"
              },
              {
                "name": "date",
                "time": false,
                "type": "date",
                "label": "Date"
              },
              {
                "name": "num_of_payments",
                "type": "integer",
                "label": "Number of installments"
              },
              {
                "name": "first_payment",
                "type": "number",
                "label": "First payment amount"
              },
              {
                "name": "token_id",
                "type": "integer",
                "label": "Credit-Card token ID"
              },
              {
                "name": "card_number",
                "type": "integer",
                "label": "Credit-Card number"
              },
              {
                "name": "card_type",
                "type": "select",
                "label": "Credit-Card type"
              },
              {
                "name": "cvv",
                "type": "integer",
                "label": "CVV"
              },
              {
                "name": "exp_year",
                "type": "integer",
                "label": "Card Expiration year"
              },
              {
                "name": "exp_month",
                "type": "integer",
                "label": "Card Expiration month",
                "validate": {
                  "max": 12,
                  "min": 0
                }
              },
              {
                "name": "holder_id",
                "type": "integer",
                "label": "Card Holder ID"
              },
              {
                "name": "holder_name",
                "type": "text",
                "label": "Card Holder name"
              },
              {
                "name": "confirmation_code",
                "type": "text",
                "label": "Confirmation number"
              }
            ],
            "type": "collection",
            "label": "Credit-Card payment"
          },
          {
            "name": "paypal",
            "spec": [
              {
                "name": "sum",
                "type": "number",
                "label": "Amount"
              },
              {
                "name": "date",
                "time": false,
                "type": "date",
                "label": "Date"
              },
              {
                "name": "txn_id",
                "type": "text",
                "label": "Transaction ID"
              },
              {
                "name": "payer_name",
                "type": "text",
                "label": "Payer name"
              }
            ],
            "type": "collection",
            "label": "PayPal payment method"
          },
          {
            "name": "barter",
            "spec": [
              {
                "name": "sum",
                "type": "number",
                "label": "Amount"
              }
            ],
            "type": "collection",
            "label": "Barter payment method"
          },
          {
            "name": "autoinvoice",
            "type": "boolean",
            "label": "Is autoinvoice"
          },
          {
            "name": "autocheque_detail",
            "type": "text",
            "label": "Autocheque Detail"
          },
          {
            "name": "autoinvoice_cc",
            "type": "boolean",
            "label": "Enable automatic invoices on credit-card installments"
          },
          {
            "name": "autocc_detail",
            "type": "text",
            "label": "Auto CC Detail"
          },
          {
            "name": "autocc_income_type_id",
            "type": "integer",
            "label": "Income type ID for automatic invoices on credit-card installments"
          },
          {
            "name": "autocc_exempt",
            "type": "boolean",
            "label": "Tax exempt flag for automatic invoices on credit-card installments"
          },
          {
            "name": "enable_paynow",
            "type": "boolean",
            "label": "Enable self-payment ilink by customer"
          },
          {
            "name": "based_on",
            "spec": {
              "name": "value",
              "type": "collection"
            },
            "type": "array",
            "label": "Base documents list"
          },
          {
            "name": "doc_title",
            "type": "text",
            "label": "Document title"
          },
          {
            "name": "hwc",
            "type": "text",
            "label": "Additional comments"
          },
          {
            "name": "append_preset_comments",
            "type": "text",
            "label": "Preset comments"
          },
          {
            "name": "sanity_string",
            "type": "text",
            "label": "Sanity string"
          },
          {
            "name": "doc_lang",
            "type": "text",
            "label": "Lang",
            "validate": {
              "max": 2,
              "min": 2
            }
          },
          {
            "name": "send_email",
            "type": "boolean",
            "label": "Send doc original by email?"
          },
          {
            "name": "send_sms",
            "type": "boolean",
            "label": "Send doc original by sms?"
          }
        ],
        "designer": {
          "x": 300,
          "y": 0
        },
        "interface": [
          {
            "name": "client_id",
            "type": "array",
            "label": "Client ID"
          },
          {
            "name": "custom_client_id",
            "type": "text",
            "label": "Custom Client ID"
          },
          {
            "name": "doctype",
            "type": "array",
            "label": "Document type"
          },
          {
            "name": "docnum",
            "type": "integer",
            "label": "Document number"
          },
          {
            "name": "doc_url",
            "type": "text",
            "label": "Document original URL"
          },
          {
            "name": "doc_copy_url",
            "type": "text",
            "label": "Document copy URL"
          },
          {
            "name": "api",
            "spec": [
              {
                "name": "version",
                "type": "uinteger",
                "label": "Version"
              },
              {
                "name": "tz",
                "type": "uinteger",
                "label": "Time Zone"
              },
              {
                "name": "ts",
                "type": "uinteger",
                "label": "Timestamp"
              },
              {
                "name": "lang",
                "type": "text",
                "label": "Language",
                "validate": {
                  "max": 2,
                  "min": 2
                }
              },
              {
                "name": "rid",
                "type": "uinteger",
                "label": "Request ID"
              },
              {
                "name": "module",
                "type": "text",
                "label": "Module"
              },
              {
                "name": "method",
                "type": "text",
                "label": "Method"
              }
            ],
            "type": "collection",
            "label": "API details"
          },
          {
            "name": "status",
            "type": "boolean",
            "label": "Operation status"
          },
          {
            "name": "reason",
            "type": "text",
            "label": "Error code"
          },
          {
            "name": "error_description",
            "type": "text",
            "label": "Short error descripion"
          },
          {
            "name": "error_details",
            "type": "array",
            "label": "Detailed error messages list"
          }
        ],
        "parameters": [
          {
            "name": "__IMTCONN__",
            "type": "account:icount",
            "label": "Connection",
            "required": true
          }
        ]
      },
      "parameters": {
        "__IMTCONN__": null
      }
    }
  ],
  "name": "הזמנה מטופס הופכת למסמך ב-iCount ונשלחת ללקוח",
  "metadata": {
    "instant": true,
    "version": 1,
    "designer": {
      "orphans": []
    },
    "scenario": {
      "dlq": false,
      "slots": null,
      "dataloss": false,
      "maxErrors": 3,
      "autoCommit": true,
      "roundtrips": 1,
      "sequential": false,
      "confidential": false,
      "freshVariables": false,
      "autoCommitTriggerLast": true
    }
  }
}
