{
  "name": "ezGPT - bounded GET retry demo",
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "nodes": [
    {
      "id": "0d538f20-9dda-4ed7-bd5b-98e06c6b2cfb",
      "name": "Manual Trigger",
      "type": "n8n-nodes-base.manualTrigger",
      "typeVersion": 1,
      "parameters": {},
      "position": [
        0,
        0
      ]
    },
    {
      "id": "f61d4c00-0299-4a16-bda5-7f6fdaec792a",
      "name": "Demo Input",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "f75a3cc5-704a-451f-b01d-f5ab92f446cd",
              "name": "url",
              "type": "string",
              "value": "http://host.docker.internal:18113/order?mode=temporary&run=first"
            }
          ]
        },
        "includeOtherFields": false,
        "options": {}
      },
      "position": [
        220,
        0
      ]
    },
    {
      "id": "f60e1be8-78ff-4844-b55b-b0cf8663aac9",
      "name": "Fetch Order",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "parameters": {
        "url": "={{ $json.url }}",
        "options": {
          "timeout": 1000,
          "response": {
            "response": {
              "responseFormat": "json",
              "fullResponse": false,
              "neverError": false
            }
          }
        }
      },
      "position": [
        440,
        0
      ],
      "retryOnFail": true,
      "maxTries": 3,
      "waitBetweenTries": 1000,
      "onError": "continueErrorOutput"
    },
    {
      "id": "75d30344-66f1-445c-892d-ab7a1cc5b54d",
      "name": "Valid Response",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 2
          },
          "conditions": [
            {
              "id": "2535c50c-2247-4237-8df5-e26b0f98e2e8",
              "leftValue": "={{ typeof $json.order_id === \"string\" && $json.order_id.trim() !== \"\" && Number.isSafeInteger($json.amount_minor) && $json.amount_minor >= 0 && $json.currency === \"RUB\" }}",
              "rightValue": "",
              "operator": {
                "type": "boolean",
                "operation": "true",
                "singleValue": true
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "position": [
        660,
        -100
      ]
    },
    {
      "id": "36bbb463-8517-4a00-94a7-b4ecc060ab6e",
      "name": "Ready Order",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "b385112a-f115-488c-96aa-2f3b54599db3",
              "name": "order_id",
              "type": "string",
              "value": "={{ $json.order_id }}"
            },
            {
              "id": "98d1e48d-5e48-45c6-be26-b85676860e92",
              "name": "amount_minor",
              "type": "number",
              "value": "={{ $json.amount_minor }}"
            },
            {
              "id": "9cbaf64c-a211-4dab-89ae-46ff230e3394",
              "name": "currency",
              "type": "string",
              "value": "={{ $json.currency }}"
            },
            {
              "id": "5db24e79-43da-432c-836a-6bda4cbcd5fc",
              "name": "status",
              "type": "string",
              "value": "ready"
            }
          ]
        },
        "includeOtherFields": false,
        "options": {}
      },
      "position": [
        880,
        -200
      ]
    },
    {
      "id": "030d2ec9-1fca-4558-8735-41051119ea53",
      "name": "Invalid Payload",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "1dcddd80-db7e-4086-99d1-a4479b7c0d54",
              "name": "status",
              "type": "string",
              "value": "needs_review"
            },
            {
              "id": "8635a68d-58cf-4c6a-9de9-3a0cb254a7ad",
              "name": "reason",
              "type": "string",
              "value": "invalid_payload"
            }
          ]
        },
        "includeOtherFields": false,
        "options": {}
      },
      "position": [
        880,
        0
      ]
    },
    {
      "id": "7b51908e-4e70-4edb-919d-a359e0cc2cef",
      "name": "Request Failed",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "140696a9-a299-4aad-9f81-6dbc0c037f64",
              "name": "status",
              "type": "string",
              "value": "needs_review"
            },
            {
              "id": "33c15b51-c0af-40ca-8588-cce9971f2c66",
              "name": "reason",
              "type": "string",
              "value": "request_failed"
            },
            {
              "id": "07e412b2-bc0c-4bb0-8a10-509936d6b2d4",
              "name": "message",
              "type": "string",
              "value": "={{ $json.error?.message ?? $json.error ?? \"request_failed\" }}"
            }
          ]
        },
        "includeOtherFields": false,
        "options": {}
      },
      "position": [
        660,
        160
      ]
    }
  ],
  "connections": {
    "Manual Trigger": {
      "main": [
        [
          {
            "node": "Demo Input",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Demo Input": {
      "main": [
        [
          {
            "node": "Fetch Order",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Order": {
      "main": [
        [
          {
            "node": "Valid Response",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Request Failed",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Valid Response": {
      "main": [
        [
          {
            "node": "Ready Order",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Invalid Payload",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
