{
  "elementsLearnedData": [],
  "elementsTestData": [],
  "flow": {
    "id": "0A9EC703-9B2A-4BE7-8D2E-8C5833E4A767",
    "name": "GoCardless: payout reconciled in QuickBooks"
  },
  "flowVersion": {
    "clientMetadata": {
      "viewport": {
        "x": 73.34742258802612,
        "y": -122.15225648659896,
        "zoom": 0.7856725166675803
      },
      "autoSave": true,
      "descriptions": {
        "flow": "When a GoCardless payout lands in the bank, records each customer payment in it as a payment in QuickBooks Online and posts a summary to the finance channel in Slack, with fees, refunds and any payer it could not match.",
        "initialData": "",
        "initialDataFields": {}
      }
    },
    "description": "When a GoCardless payout lands in the bank, records each customer payment in it as a payment in QuickBooks Online and posts a summary to the finance channel in Slack, with fees, refunds and any payer it could not match.",
    "elements": [
      {
        "clientMetadata": {
          "notes": "Fetch one payout - amount, fees deducted, arrival date, status.",
          "elementId": "EXTENSION:::SHARED:::default:::gocardless:::getPayout",
          "isFirstElement": false,
          "blockDefinitionId": "api-service-method",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Get the payout Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::gocardless:::getPayout",
          "legacyElementId": "JS###v1###GoCardlessService###getPayout",
          "methodName": "getPayout",
          "position": {
            "x": 400,
            "y": 490
          }
        },
        "flowElementId": "A474ED9F-F3E7-45C5-A7A9-35078A2AF2F9",
        "groupId": null,
        "id": "E34F29A8-C258-4261-9F4C-5D3C16DB5CD8",
        "metaInfo": {
          "bodyParams": [
            {
              "name": "payoutId",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "RESULT",
                    "label": "Payout event",
                    "subPathSegments": [
                      {
                        "key": "links",
                        "optional": false
                      },
                      {
                        "key": "payout",
                        "optional": false
                      }
                    ],
                    "type": "TRIGGER_DATA",
                    "value": "03A1A010-9532-406E-8B5F-7F5B3041FDBF"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "clientValidationState": {
            "errorMessage": "Block: 'Get the payout', Error: OAuth Connection is required",
            "valid": false
          },
          "connectionId": null,
          "enabled": true,
          "hostType": "SHARED",
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "methodName": "getPayout",
          "onFailElemId": null,
          "packageId": "default",
          "resultAlias": "Payout",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "gocardless",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Get the payout",
        "nextElementIds": [
          "D4C81E61-74FB-4129-91F7-EF0C71F9CCF6"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "notes": "Fires when a payout from GoCardless to your bank account changes state - paid (money in your bank), bounced, FX rate confirmed, or tax updated.",
          "elementId": "EXTENSION:::SHARED:::default:::gocardless:::onPayoutEvent",
          "isFirstElement": true,
          "blockDefinitionId": "EXTENSION:::SHARED:::default:::gocardless:::onPayoutEvent",
          "newElementId": "EXTENSION:::SHARED:::default:::gocardless:::onPayoutEvent",
          "legacyElementId": "JS###v1###GoCardlessService###onPayoutEvent",
          "methodName": "onPayoutEvent",
          "position": {
            "x": 110,
            "y": 490
          }
        },
        "flowElementId": "5495872D-BC96-45B5-8F8A-857B6CF06CD2",
        "groupId": null,
        "id": "03A1A010-9532-406E-8B5F-7F5B3041FDBF",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": "Block: 'Payout paid', Error: OAuth Connection is required",
            "valid": false
          },
          "condition": null,
          "connectionId": null,
          "dynamicData": [],
          "eventName": "onPayoutEvent",
          "frequency": {
            "repeat": {
              "every": 900
            },
            "schedule": "custom"
          },
          "hostType": "SHARED",
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": null
          },
          "onFailElemId": null,
          "packageId": "default",
          "resultAlias": "Payout event",
          "serviceId": "gocardless",
          "slaConditions": [],
          "staticData": {
            "action": "paid"
          },
          "storeResult": true,
          "subtype": "POLLING",
          "type": "CUSTOM"
        },
        "name": "Payout paid",
        "nextElementIds": [
          "E34F29A8-C258-4261-9F4C-5D3C16DB5CD8"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "TRIGGER"
      },
      {
        "clientMetadata": {
          "elementId": "data-bucket",
          "isFirstElement": false,
          "blockDefinitionId": "data-bucket",
          "fieldKeys": {
            "recorded": "c86707c8-8fb7-44b4-9712-8ba7dd9476c4",
            "unmatched": "1e7d7f5a-8dac-4710-b72a-dbaf7bd63991"
          },
          "position": {
            "x": 1002.3639746763798,
            "y": 496.5455898705519
          }
        },
        "flowElementId": "B1378C58-8076-4DB5-8786-721F14F2D2B2",
        "groupId": null,
        "id": "303C14BF-7E12-46E9-BED2-27F9CCCD8EA9",
        "metaInfo": {
          "bucketName": "Tally",
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "fields": [
            {
              "name": "recorded",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "EMPTY_STRING",
                    "label": null,
                    "type": "KEYWORD",
                    "value": ""
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "unmatched",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "EMPTY_STRING",
                    "label": null,
                    "type": "KEYWORD",
                    "value": ""
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "logging": null,
          "onFailElemId": null,
          "resultAlias": "tally",
          "storeResult": true
        },
        "name": "Start the tally",
        "nextElementIds": [],
        "nextGroupIds": [
          "C8C43E9B-24AF-4FEC-A862-2C40C5A9A52B"
        ],
        "type": "DATA_BUCKET"
      },
      {
        "clientMetadata": {
          "notes": "List the line items inside a payout - every payment, refund, and fee that adds up to the total. Use for full reconciliation showing exactly which customer payments made up each bank deposit.",
          "elementId": "EXTENSION:::SHARED:::default:::gocardless:::listPayoutItems",
          "isFirstElement": false,
          "blockDefinitionId": "api-service-method",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "List what the payout paid Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::gocardless:::listPayoutItems",
          "legacyElementId": "JS###v1###GoCardlessService###listPayoutItems",
          "methodName": "listPayoutItems",
          "position": {
            "x": 690,
            "y": 490
          }
        },
        "flowElementId": "568779BC-6994-4113-8C23-8C04745D60D1",
        "groupId": null,
        "id": "D4C81E61-74FB-4129-91F7-EF0C71F9CCF6",
        "metaInfo": {
          "bodyParams": [
            {
              "name": "payoutId",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Payout",
                    "subPathSegments": [
                      {
                        "key": "id",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "E34F29A8-C258-4261-9F4C-5D3C16DB5CD8"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "includeTaxes",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "K_FALSE",
                    "label": null,
                    "type": "KEYWORD",
                    "value": false
                  }
                ],
                "mode": "BASIC",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "limit",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "NUMBER",
                    "label": null,
                    "type": "INPUT",
                    "value": 500
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "cursor",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "clientValidationState": {
            "errorMessage": "Block: 'List what the payout paid', Error: OAuth Connection is required",
            "valid": false
          },
          "connectionId": null,
          "enabled": true,
          "hostType": "SHARED",
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "methodName": "listPayoutItems",
          "onFailElemId": null,
          "packageId": "default",
          "resultAlias": "Payout items",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "gocardless",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "List what the payout paid",
        "nextElementIds": [
          "303C14BF-7E12-46E9-BED2-27F9CCCD8EA9"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "elementId": "condition",
          "isFirstElement": false,
          "blockDefinitionId": "condition",
          "position": {
            "x": 922,
            "y": 219
          }
        },
        "flowElementId": "AC58D4C7-BF6E-49C8-87C0-2FE8AA3762E7",
        "groupId": "C8C43E9B-24AF-4FEC-A862-2C40C5A9A52B",
        "id": "AC0368A8-DCD2-4324-9F7C-3D23F1AC24D5",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "condition": {
            "conditionParts": [
              {
                "id": "b094aab4-c4a6-4641-ae62-27c9589f6ce9",
                "nestedOperation": null,
                "operation": "arrayLengthEquals",
                "property": {
                  "expression": [
                    {
                      "id": "ELEMENT_RESULT",
                      "label": "QuickBooks match",
                      "subPathSegments": [
                        {
                          "key": "QueryResponse",
                          "optional": false
                        },
                        {
                          "key": "Customer",
                          "optional": false
                        }
                      ],
                      "type": "ELEMENT_LINK",
                      "value": "860BBF6B-1AF2-4125-9CBA-CF7D221A5A7B"
                    }
                  ],
                  "mode": "EXPRESSION",
                  "parseJsonString": false,
                  "resultType": null
                },
                "propertyType": "ARRAY",
                "values": [
                  {
                    "expression": [
                      {
                        "id": "NUMBER",
                        "label": null,
                        "type": "INPUT",
                        "value": 1
                      }
                    ],
                    "mode": "EXPRESSION",
                    "parseJsonString": false,
                    "resultType": null
                  }
                ]
              }
            ],
            "grouping": [
              "b094aab4-c4a6-4641-ae62-27c9589f6ce9"
            ]
          },
          "elseComponent": {
            "componentId": "0BADD5AE-30EC-4748-B367-05BF03426F9F",
            "componentType": "ELEMENT"
          },
          "logging": null,
          "onFailElemId": null,
          "resultAlias": "One match",
          "storeResult": false,
          "thenComponent": {
            "componentId": "F3B07F6F-E04B-4119-BB06-AEC959827AC4",
            "componentType": "ELEMENT"
          }
        },
        "name": "One customer in QuickBooks?",
        "nextElementIds": [
          "F3B07F6F-E04B-4119-BB06-AEC959827AC4",
          "0BADD5AE-30EC-4748-B367-05BF03426F9F"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "preferredDateFormats": []
        },
        "type": "CONDITION"
      },
      {
        "clientMetadata": {
          "elementId": "data-bucket",
          "isFirstElement": false,
          "blockDefinitionId": "data-bucket",
          "fieldKeys": {
            "unmatched": "9b10b63d-d042-4293-a525-7c796c659072"
          },
          "position": {
            "x": 548,
            "y": 349
          }
        },
        "flowElementId": "61C7ADCA-A00D-4F70-88B7-F80AA1D7FDF3",
        "groupId": "C8C43E9B-24AF-4FEC-A862-2C40C5A9A52B",
        "id": "0BADD5AE-30EC-4748-B367-05BF03426F9F",
        "metaInfo": {
          "bucketName": "Tally",
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "fields": [
            {
              "name": "unmatched",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "EXECUTION_CONTEXT_DATA_BUCKET_VARIABLE",
                    "label": "Tally - unmatched",
                    "subPathSegments": null,
                    "type": "EXECUTION_CONTEXT_PATH",
                    "value": "executionContext.dataBuckets.Tally.unmatched",
                    "valueSegments": [
                      {
                        "key": "executionContext",
                        "optional": false
                      },
                      {
                        "key": "dataBuckets",
                        "optional": false
                      },
                      {
                        "key": "Tally",
                        "optional": false
                      },
                      {
                        "key": "unmatched",
                        "optional": false
                      }
                    ]
                  },
                  {
                    "id": "NEWLINE",
                    "label": null,
                    "type": "KEYWORD",
                    "value": "\n"
                  },
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Payer",
                    "subPathSegments": [
                      {
                        "key": "line",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "3BCD5BB1-9230-4690-B26E-D7091F7D2955"
                  },
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": ", no single QuickBooks customer named "
                  },
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Payer",
                    "subPathSegments": [
                      {
                        "key": "name",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "3BCD5BB1-9230-4690-B26E-D7091F7D2955"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "logging": null,
          "onFailElemId": null,
          "resultAlias": "addunm",
          "storeResult": true
        },
        "name": "Add it to the unmatched list",
        "nextElementIds": [],
        "nextGroupIds": [],
        "type": "DATA_BUCKET"
      },
      {
        "clientMetadata": {
          "notes": "Sends messages to Slack channels with optional Block Kit rich layouts. Supports plain text with Slack formatting, or advanced Block Kit JSON for buttons, menus, and interactive elements. Returns the message timestamp and channel ID for later updates or tracking.",
          "elementId": "EXTENSION:::SHARED:::default:::slack:::sendMessageToChannel",
          "isFirstElement": false,
          "blockDefinitionId": "api-service-method",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Tell finance in Slack Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::slack:::sendMessageToChannel",
          "legacyElementId": "JS###v1###Slack###sendMessageToChannel",
          "methodName": "sendMessageToChannel",
          "position": {
            "x": 375.9999999999999,
            "y": 632
          }
        },
        "flowElementId": "E33A2B2E-8EBB-47AA-9740-333F7BAEC1B9",
        "groupId": null,
        "id": "4F36178A-9147-49E3-B7BC-17EF42BD3B2D",
        "metaInfo": {
          "bodyParams": [
            {
              "name": "channelId",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": ""
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "messageText",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Summary",
                    "subPathSegments": [
                      {
                        "key": "text",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "980C6BE7-4DEC-47D7-92CE-E048631B4B3A"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "threadId",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "sendAsBot",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "K_FALSE",
                    "label": null,
                    "type": "KEYWORD",
                    "value": false
                  }
                ],
                "mode": "BASIC",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "botName",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "botIcon",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "replyBroadcast",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "K_FALSE",
                    "label": null,
                    "type": "KEYWORD",
                    "value": false
                  }
                ],
                "mode": "BASIC",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "imageURL",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "blocks",
              "type": "COMPLEX_LIST",
              "value": []
            }
          ],
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "connectionId": null,
          "enabled": true,
          "hostType": "SHARED",
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "methodName": "sendMessageToChannel",
          "onFailElemId": null,
          "packageId": "default",
          "resultAlias": "Finance message",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "slack",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Tell finance in Slack",
        "nextElementIds": [],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "notes": "Fetch one mandate - scheme, status, next earliest charge date, links to customer and bank account.",
          "elementId": "EXTENSION:::SHARED:::default:::gocardless:::getMandate",
          "isFirstElement": false,
          "blockDefinitionId": "api-service-method",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Get the mandate Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::gocardless:::getMandate",
          "legacyElementId": "JS###v1###GoCardlessService###getMandate",
          "methodName": "getMandate",
          "position": {
            "x": 573,
            "y": 40
          }
        },
        "flowElementId": "D2CDE284-F9FF-4040-BFB8-87C0DABA6C2E",
        "groupId": "C8C43E9B-24AF-4FEC-A862-2C40C5A9A52B",
        "id": "4D760F51-FF6C-43F7-9C63-80423D73EED8",
        "metaInfo": {
          "bodyParams": [
            {
              "name": "mandateId",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "LIST_ITERATOR_CURRENT_ELEMENT",
                    "label": null,
                    "subPathSegments": [
                      {
                        "key": "links",
                        "optional": false
                      },
                      {
                        "key": "mandate",
                        "optional": false
                      }
                    ],
                    "type": "LIST_ITERATOR_CURRENT_ELEMENT",
                    "value": "C8C43E9B-24AF-4FEC-A862-2C40C5A9A52B"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "clientValidationState": {
            "errorMessage": "Block: 'Get the mandate', Error: OAuth Connection is required",
            "valid": false
          },
          "connectionId": null,
          "enabled": true,
          "hostType": "SHARED",
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "methodName": "getMandate",
          "onFailElemId": null,
          "packageId": "default",
          "resultAlias": "Mandate",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "gocardless",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Get the mandate",
        "nextElementIds": [
          "9C7CA77B-5A99-4D69-9C73-BFDDB1751460"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "elementId": "custom-cloud-code",
          "isFirstElement": false,
          "blockDefinitionId": "custom-cloud-code",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Work out the payer and amount Result"
          },
          "position": {
            "x": 1292,
            "y": 49
          }
        },
        "flowElementId": "91D0A42D-7389-4235-8C5F-3C841BBD1972",
        "groupId": "C8C43E9B-24AF-4FEC-A862-2C40C5A9A52B",
        "id": "3BCD5BB1-9230-4690-B26E-D7091F7D2955",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "codeArguments": [
            {
              "name": "amount",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "LIST_ITERATOR_CURRENT_ELEMENT",
                    "label": null,
                    "subPathSegments": [
                      {
                        "key": "amount",
                        "optional": false
                      }
                    ],
                    "type": "LIST_ITERATOR_CURRENT_ELEMENT",
                    "value": "C8C43E9B-24AF-4FEC-A862-2C40C5A9A52B"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "paymentId",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "LIST_ITERATOR_CURRENT_ELEMENT",
                    "label": null,
                    "subPathSegments": [
                      {
                        "key": "links",
                        "optional": false
                      },
                      {
                        "key": "payment",
                        "optional": false
                      }
                    ],
                    "type": "LIST_ITERATOR_CURRENT_ELEMENT",
                    "value": "C8C43E9B-24AF-4FEC-A862-2C40C5A9A52B"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "currency",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Payout",
                    "subPathSegments": [
                      {
                        "key": "currency",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "E34F29A8-C258-4261-9F4C-5D3C16DB5CD8"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "givenName",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Payer record",
                    "subPathSegments": [
                      {
                        "key": "given_name",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "9C7CA77B-5A99-4D69-9C73-BFDDB1751460"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "familyName",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Payer record",
                    "subPathSegments": [
                      {
                        "key": "family_name",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "9C7CA77B-5A99-4D69-9C73-BFDDB1751460"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "companyName",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Payer record",
                    "subPathSegments": [
                      {
                        "key": "company_name",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "9C7CA77B-5A99-4D69-9C73-BFDDB1751460"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "codeBody": {
            "expression": [
              {
                "id": "TEXT",
                "label": null,
                "type": "INPUT",
                "value": "const name = companyName || [givenName, familyName].filter(Boolean).join(' ');\nconst major = Math.round(Number(amount)) / 100;\nreturn {\n  name,\n  amount: major,\n  line: `- ${name || 'Unknown payer'}: ${major.toFixed(2)} ${currency} (GoCardless payment ${paymentId})`,\n};"
              }
            ],
            "mode": "EXPRESSION",
            "parseJsonString": false,
            "resultType": null
          },
          "enabled": true,
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "onFailElemId": null,
          "resultAlias": "Payer",
          "retryPolicy": null,
          "saveToVariable": null,
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "type": "CUSTOM_CLOUD_CODE"
        },
        "name": "Work out the payer and amount",
        "nextElementIds": [
          "860BBF6B-1AF2-4125-9CBA-CF7D221A5A7B"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "notes": "Queries customers in QuickBooks Online with optional search filtering. Search matches against the DisplayName field. Results are paginated and sorted by DisplayName.",
          "elementId": "EXTENSION:::SHARED:::default:::quickbooks-online:::listCustomers",
          "isFirstElement": false,
          "blockDefinitionId": "api-service-method",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Find the customer in QuickBooks Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::quickbooks-online:::listCustomers",
          "legacyElementId": "JS###v1###QuickBooksOnlineService###listCustomers",
          "methodName": "listCustomers",
          "position": {
            "x": 1287,
            "y": 210
          }
        },
        "flowElementId": "5579E8C0-EF7F-48D2-BEB2-8AE3A573D138",
        "groupId": "C8C43E9B-24AF-4FEC-A862-2C40C5A9A52B",
        "id": "860BBF6B-1AF2-4125-9CBA-CF7D221A5A7B",
        "metaInfo": {
          "bodyParams": [
            {
              "name": "search",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Payer",
                    "subPathSegments": [
                      {
                        "key": "name",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "3BCD5BB1-9230-4690-B26E-D7091F7D2955"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "maxResults",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "NUMBER",
                    "label": null,
                    "type": "INPUT",
                    "value": 2
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "startPosition",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "clientValidationState": {
            "errorMessage": "Block: 'Find the customer in QuickBooks', Error: OAuth Connection is required",
            "valid": false
          },
          "connectionId": null,
          "enabled": true,
          "hostType": "SHARED",
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "methodName": "listCustomers",
          "onFailElemId": null,
          "packageId": "default",
          "resultAlias": "QuickBooks match",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "quickbooks-online",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Find the customer in QuickBooks",
        "nextElementIds": [
          "AC0368A8-DCD2-4324-9F7C-3D23F1AC24D5"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "notes": "Fetch one customer's full profile - name, email, address, language, identity numbers. Use when you have a customer ID and need their details for display or downstream logic.",
          "elementId": "EXTENSION:::SHARED:::default:::gocardless:::getCustomer",
          "isFirstElement": false,
          "blockDefinitionId": "api-service-method",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Get the payer Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::gocardless:::getCustomer",
          "legacyElementId": "JS###v1###GoCardlessService###getCustomer",
          "methodName": "getCustomer",
          "position": {
            "x": 955,
            "y": 40
          }
        },
        "flowElementId": "B4F0A5D5-6249-4E6A-B584-91679FD77AF1",
        "groupId": "C8C43E9B-24AF-4FEC-A862-2C40C5A9A52B",
        "id": "9C7CA77B-5A99-4D69-9C73-BFDDB1751460",
        "metaInfo": {
          "bodyParams": [
            {
              "name": "customerId",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Mandate",
                    "subPathSegments": [
                      {
                        "key": "links",
                        "optional": false
                      },
                      {
                        "key": "customer",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "4D760F51-FF6C-43F7-9C63-80423D73EED8"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "clientValidationState": {
            "errorMessage": "Block: 'Get the payer', Error: OAuth Connection is required",
            "valid": false
          },
          "connectionId": null,
          "enabled": true,
          "hostType": "SHARED",
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "methodName": "getCustomer",
          "onFailElemId": null,
          "packageId": "default",
          "resultAlias": "Payer record",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "gocardless",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Get the payer",
        "nextElementIds": [
          "3BCD5BB1-9230-4690-B26E-D7091F7D2955"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "elementId": "error-handler",
          "isFirstElement": false,
          "blockDefinitionId": "error-handler",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "QuickBooks refused it Result"
          },
          "position": {
            "x": 161,
            "y": 349
          }
        },
        "flowElementId": "AA5F31B8-CD29-4A14-879A-FE19255FADC6",
        "groupId": "C8C43E9B-24AF-4FEC-A862-2C40C5A9A52B",
        "id": "C3C6BE63-6EB7-4376-8A20-578DD74A26AF",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "logging": null,
          "onFailElemId": null,
          "resultAlias": "QuickBooks error",
          "saveToVariable": null,
          "storeResult": true
        },
        "name": "QuickBooks refused it",
        "nextElementIds": [
          "BE0634F0-346F-4094-8AA2-F3968A98D1FF"
        ],
        "nextGroupIds": [],
        "type": "ERROR_HANDLER"
      },
      {
        "clientMetadata": {
          "notes": "Creates a new payment in QuickBooks Online to record a payment received from a customer. You can optionally link the payment to a specific invoice. If no invoice is specified, the payment is recorded as an unapplied payment.",
          "elementId": "EXTENSION:::SHARED:::default:::quickbooks-online:::createPayment",
          "isFirstElement": false,
          "blockDefinitionId": "api-service-method",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Record the payment in QuickBooks Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::quickbooks-online:::createPayment",
          "legacyElementId": "JS###v1###QuickBooksOnlineService###createPayment",
          "methodName": "createPayment",
          "position": {
            "x": 523,
            "y": 210
          }
        },
        "flowElementId": "BCAC5A32-002C-4F1D-95D0-BBE904E3D54D",
        "groupId": "C8C43E9B-24AF-4FEC-A862-2C40C5A9A52B",
        "id": "F3B07F6F-E04B-4119-BB06-AEC959827AC4",
        "metaInfo": {
          "bodyParams": [
            {
              "name": "customerId",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "QuickBooks match",
                    "subPathSegments": [
                      {
                        "key": "QueryResponse",
                        "optional": false
                      },
                      {
                        "key": "Customer",
                        "optional": false
                      },
                      {
                        "index": 0,
                        "last": false
                      },
                      {
                        "key": "Id",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "860BBF6B-1AF2-4125-9CBA-CF7D221A5A7B"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "totalAmt",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Payer",
                    "subPathSegments": [
                      {
                        "key": "amount",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "3BCD5BB1-9230-4690-B26E-D7091F7D2955"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "paymentDate",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Payout",
                    "subPathSegments": [
                      {
                        "key": "arrival_date",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "E34F29A8-C258-4261-9F4C-5D3C16DB5CD8"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "paymentMethodId",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "invoiceId",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "clientValidationState": {
            "errorMessage": "Block: 'Record the payment in QuickBooks', Error: OAuth Connection is required",
            "valid": false
          },
          "connectionId": null,
          "enabled": true,
          "hostType": "SHARED",
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "methodName": "createPayment",
          "onFailElemId": "C3C6BE63-6EB7-4376-8A20-578DD74A26AF",
          "packageId": "default",
          "resultAlias": "QuickBooks payment",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "quickbooks-online",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Record the payment in QuickBooks",
        "nextElementIds": [
          "02864BEF-6EFB-42B6-BBB9-96BD69E45586"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "elementId": "condition",
          "isFirstElement": true,
          "blockDefinitionId": "condition",
          "position": {
            "x": 167,
            "y": 49
          }
        },
        "flowElementId": "A1EC912E-85A3-4A16-AB0C-EAA5F24764F3",
        "groupId": "C8C43E9B-24AF-4FEC-A862-2C40C5A9A52B",
        "id": "B8A232D8-6533-4929-AFC8-3A3A41D51183",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "condition": {
            "conditionParts": [
              {
                "id": "e20d9b02-1899-46a0-85c8-79fddf08ac1e",
                "nestedOperation": null,
                "operation": "equal",
                "property": {
                  "expression": [
                    {
                      "id": "LIST_ITERATOR_CURRENT_ELEMENT",
                      "label": null,
                      "subPathSegments": [
                        {
                          "key": "type",
                          "optional": false
                        }
                      ],
                      "type": "LIST_ITERATOR_CURRENT_ELEMENT",
                      "value": "C8C43E9B-24AF-4FEC-A862-2C40C5A9A52B"
                    }
                  ],
                  "mode": "EXPRESSION",
                  "parseJsonString": false,
                  "resultType": null
                },
                "propertyType": "STRING",
                "values": [
                  {
                    "expression": [
                      {
                        "id": "TEXT",
                        "label": null,
                        "type": "INPUT",
                        "value": "payment_paid_out"
                      }
                    ],
                    "mode": "EXPRESSION",
                    "parseJsonString": false,
                    "resultType": null
                  }
                ]
              }
            ],
            "grouping": [
              "e20d9b02-1899-46a0-85c8-79fddf08ac1e"
            ]
          },
          "elseComponent": null,
          "logging": null,
          "onFailElemId": null,
          "resultAlias": "Is customer payment",
          "storeResult": false,
          "thenComponent": {
            "componentId": "4D760F51-FF6C-43F7-9C63-80423D73EED8",
            "componentType": "ELEMENT"
          }
        },
        "name": "Customer payment?",
        "nextElementIds": [
          "4D760F51-FF6C-43F7-9C63-80423D73EED8"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "preferredDateFormats": []
        },
        "type": "CONDITION"
      },
      {
        "clientMetadata": {
          "elementId": "custom-cloud-code",
          "isFirstElement": false,
          "blockDefinitionId": "custom-cloud-code",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Write the finance summary Result"
          },
          "position": {
            "x": 659.9999999999999,
            "y": 636
          }
        },
        "flowElementId": "ECBC0E4A-660D-4F46-B25F-128BB9D070B5",
        "groupId": null,
        "id": "980C6BE7-4DEC-47D7-92CE-E048631B4B3A",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "codeArguments": [
            {
              "name": "payoutId",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Payout",
                    "subPathSegments": [
                      {
                        "key": "id",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "E34F29A8-C258-4261-9F4C-5D3C16DB5CD8"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "amount",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Payout",
                    "subPathSegments": [
                      {
                        "key": "amount",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "E34F29A8-C258-4261-9F4C-5D3C16DB5CD8"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "deductedFees",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Payout",
                    "subPathSegments": [
                      {
                        "key": "deducted_fees",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "E34F29A8-C258-4261-9F4C-5D3C16DB5CD8"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "currency",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Payout",
                    "subPathSegments": [
                      {
                        "key": "currency",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "E34F29A8-C258-4261-9F4C-5D3C16DB5CD8"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "arrivalDate",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Payout",
                    "subPathSegments": [
                      {
                        "key": "arrival_date",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "E34F29A8-C258-4261-9F4C-5D3C16DB5CD8"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "reference",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Payout",
                    "subPathSegments": [
                      {
                        "key": "reference",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "E34F29A8-C258-4261-9F4C-5D3C16DB5CD8"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "items",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Payout items",
                    "subPathSegments": [
                      {
                        "key": "items",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "D4C81E61-74FB-4129-91F7-EF0C71F9CCF6"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "hasMore",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Payout items",
                    "subPathSegments": [
                      {
                        "key": "hasMore",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "D4C81E61-74FB-4129-91F7-EF0C71F9CCF6"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "recorded",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "EXECUTION_CONTEXT_DATA_BUCKET_VARIABLE",
                    "label": "Tally - recorded",
                    "subPathSegments": null,
                    "type": "EXECUTION_CONTEXT_PATH",
                    "value": "executionContext.dataBuckets.Tally.recorded",
                    "valueSegments": [
                      {
                        "key": "executionContext",
                        "optional": false
                      },
                      {
                        "key": "dataBuckets",
                        "optional": false
                      },
                      {
                        "key": "Tally",
                        "optional": false
                      },
                      {
                        "key": "recorded",
                        "optional": false
                      }
                    ]
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "unmatched",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "EXECUTION_CONTEXT_DATA_BUCKET_VARIABLE",
                    "label": "Tally - unmatched",
                    "subPathSegments": null,
                    "type": "EXECUTION_CONTEXT_PATH",
                    "value": "executionContext.dataBuckets.Tally.unmatched",
                    "valueSegments": [
                      {
                        "key": "executionContext",
                        "optional": false
                      },
                      {
                        "key": "dataBuckets",
                        "optional": false
                      },
                      {
                        "key": "Tally",
                        "optional": false
                      },
                      {
                        "key": "unmatched",
                        "optional": false
                      }
                    ]
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "codeBody": {
            "expression": [
              {
                "id": "TEXT",
                "label": null,
                "type": "INPUT",
                "value": "const money = (minor) => (Number(minor) / 100).toFixed(2) + ' ' + currency;\nconst list = Array.isArray(items) ? items : [];\nconst sumOf = (types) => list.filter(i => types.includes(i.type)).reduce((t, i) => t + Number(i.amount), 0);\nconst count = (types) => list.filter(i => types.includes(i.type)).length;\nconst done = String(recorded || '').trim();\nconst missed = String(unmatched || '').trim();\nconst lines = [\n  `*GoCardless payout ${payoutId} arrived ${arrivalDate}*`,\n  `Paid to the bank: ${money(amount)}${reference ? ` (bank reference ${reference})` : ''}`,\n  `Customer payments in it: ${count(['payment_paid_out'])}, ${money(sumOf(['payment_paid_out']))}`,\n  `GoCardless fees deducted: ${money(deductedFees)}`,\n];\nconst refunds = count(['refund', 'refund_funds_returned']);\nif (refunds) lines.push(`Refunds taken out: ${refunds}, ${money(Math.abs(sumOf(['refund', 'refund_funds_returned'])))}`);\nconst chargebacks = count(['payment_charged_back', 'payment_refunded']);\nif (chargebacks) lines.push(`Charge-backs or refunded payments: ${chargebacks}`);\nlines.push('', done ? `*Recorded in QuickBooks*\\n${done}` : '*Nothing was recorded in QuickBooks.*');\nif (missed) lines.push('', `*Needs a person*\\n${missed}`);\nif (hasMore) lines.push('', 'This payout has more than 500 items. Only the first 500 were checked; record the rest by hand.');\nreturn { text: lines.join('\\n') };"
              }
            ],
            "mode": "EXPRESSION",
            "parseJsonString": false,
            "resultType": null
          },
          "enabled": true,
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "onFailElemId": null,
          "resultAlias": "Summary",
          "retryPolicy": null,
          "saveToVariable": null,
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "type": "CUSTOM_CLOUD_CODE"
        },
        "name": "Write the finance summary",
        "nextElementIds": [
          "4F36178A-9147-49E3-B7BC-17EF42BD3B2D"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "elementId": "data-bucket",
          "isFirstElement": false,
          "blockDefinitionId": "data-bucket",
          "fieldKeys": {
            "unmatched": "72194d23-8f96-48b9-b202-535877d6d269"
          },
          "position": {
            "x": 110,
            "y": 479
          }
        },
        "flowElementId": "8F96AB19-4EEE-49A2-9164-82322182811B",
        "groupId": "C8C43E9B-24AF-4FEC-A862-2C40C5A9A52B",
        "id": "BE0634F0-346F-4094-8AA2-F3968A98D1FF",
        "metaInfo": {
          "bucketName": "Tally",
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "fields": [
            {
              "name": "unmatched",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "EXECUTION_CONTEXT_DATA_BUCKET_VARIABLE",
                    "label": "Tally - unmatched",
                    "subPathSegments": null,
                    "type": "EXECUTION_CONTEXT_PATH",
                    "value": "executionContext.dataBuckets.Tally.unmatched",
                    "valueSegments": [
                      {
                        "key": "executionContext",
                        "optional": false
                      },
                      {
                        "key": "dataBuckets",
                        "optional": false
                      },
                      {
                        "key": "Tally",
                        "optional": false
                      },
                      {
                        "key": "unmatched",
                        "optional": false
                      }
                    ]
                  },
                  {
                    "id": "NEWLINE",
                    "label": null,
                    "type": "KEYWORD",
                    "value": "\n"
                  },
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Payer",
                    "subPathSegments": [
                      {
                        "key": "line",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "3BCD5BB1-9230-4690-B26E-D7091F7D2955"
                  },
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": ", QuickBooks refused it: "
                  },
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "QuickBooks error",
                    "subPathSegments": [
                      {
                        "key": "message",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "C3C6BE63-6EB7-4376-8A20-578DD74A26AF"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "logging": null,
          "onFailElemId": null,
          "resultAlias": "adderr",
          "storeResult": true
        },
        "name": "Add the refusal to the unmatched list",
        "nextElementIds": [],
        "nextGroupIds": [],
        "type": "DATA_BUCKET"
      },
      {
        "clientMetadata": {
          "elementId": "data-bucket",
          "isFirstElement": false,
          "blockDefinitionId": "data-bucket",
          "fieldKeys": {
            "recorded": "287136c5-9d8e-4cdc-a4d0-4124bb7115b1"
          },
          "position": {
            "x": 149,
            "y": 219
          }
        },
        "flowElementId": "D8A444A2-E5D9-4C9B-BD35-593923BC3AEB",
        "groupId": "C8C43E9B-24AF-4FEC-A862-2C40C5A9A52B",
        "id": "02864BEF-6EFB-42B6-BBB9-96BD69E45586",
        "metaInfo": {
          "bucketName": "Tally",
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "fields": [
            {
              "name": "recorded",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "EXECUTION_CONTEXT_DATA_BUCKET_VARIABLE",
                    "label": "Tally - recorded",
                    "subPathSegments": null,
                    "type": "EXECUTION_CONTEXT_PATH",
                    "value": "executionContext.dataBuckets.Tally.recorded",
                    "valueSegments": [
                      {
                        "key": "executionContext",
                        "optional": false
                      },
                      {
                        "key": "dataBuckets",
                        "optional": false
                      },
                      {
                        "key": "Tally",
                        "optional": false
                      },
                      {
                        "key": "recorded",
                        "optional": false
                      }
                    ]
                  },
                  {
                    "id": "NEWLINE",
                    "label": null,
                    "type": "KEYWORD",
                    "value": "\n"
                  },
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Payer",
                    "subPathSegments": [
                      {
                        "key": "line",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "3BCD5BB1-9230-4690-B26E-D7091F7D2955"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "logging": null,
          "onFailElemId": null,
          "resultAlias": "addrec",
          "storeResult": true
        },
        "name": "Add it to the recorded list",
        "nextElementIds": [],
        "nextGroupIds": [],
        "type": "DATA_BUCKET"
      }
    ],
    "firstElementId": "03A1A010-9532-406E-8B5F-7F5B3041FDBF",
    "groups": [
      {
        "clientMetadata": {
          "elementId": "list-iterator",
          "isFirstElement": false,
          "blockDefinitionId": "list-iterator",
          "viewport": {
            "x": -59.87029831387808,
            "y": 3.6835278858625173,
            "zoom": 0.91
          },
          "position": {
            "x": 978.545589870552,
            "y": 634.3639746763797
          }
        },
        "flowElementId": "16EF1A76-97B3-4E1F-BDAD-D27B1D14A2E9",
        "groupId": null,
        "id": "C8C43E9B-24AF-4FEC-A862-2C40C5A9A52B",
        "loopType": "LIST_ITERATOR",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": "Block: 'For each item in the payout', Error: Children have error",
            "valid": false
          },
          "enabled": true,
          "firstElementId": "B8A232D8-6533-4929-AFC8-3A3A41D51183",
          "list": {
            "expression": [
              {
                "id": "ELEMENT_RESULT",
                "label": "Payout items",
                "subPathSegments": [
                  {
                    "key": "items",
                    "optional": false
                  }
                ],
                "type": "ELEMENT_LINK",
                "value": "D4C81E61-74FB-4129-91F7-EF0C71F9CCF6"
              }
            ],
            "mode": "EXPRESSION",
            "parseJsonString": false,
            "resultType": null
          },
          "onFailElemId": null,
          "resultAlias": "loop",
          "storeResult": true
        },
        "name": "For each item in the payout",
        "nextElementIds": [
          "980C6BE7-4DEC-47D7-92CE-E048631B4B3A"
        ],
        "nextGroupIds": [],
        "type": "LOOP"
      }
    ],
    "id": "436AF73F-7BA9-4BF0-BD51-63C4B416D383",
    "metaInfo": {
      "clientValidationState": {
        "errorMessage": "Please fix problems before start. Blocks with issues have red badge in the top-right corner of a block, hover it to see what needs to be done.",
        "valid": false
      },
      "errorMessage": "Please fix problems before start. Blocks with issues have red badge in the top-right corner of a block, hover it to see what needs to be done.",
      "executionStaticData": [],
      "initialData": null,
      "initialDataDefaultValues": {},
      "ownerFlowVersionId": null,
      "schedule": null,
      "sharedMemory": {
        "anchor": {
          "missingAnchorPolicy": null,
          "path": null,
          "type": "FLOW_MEMORY"
        },
        "expirationInSec": null
      },
      "wasLive": false
    }
  },
  "slaCalendars": [],
  "slaGoals": [],
  "subFlows": [],
  "exportDate": "2026-11-18T10:16:57.067Z"
}
