diff --git a/.env.local b/.env.local index 246e04fff..537e226a9 100644 --- a/.env.local +++ b/.env.local @@ -1,3 +1,4 @@ API_URL=http://localhost:3060 API_KEY=dvl-1510egmf4a23d80342403fb599qd WEBSITE_URL=http://localhost:3000 +LOG_LEVEL=debug \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 85aea1304..aeca4ffe8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -36,6 +36,7 @@ }, "devDependencies": { "@babel/cli": "^7.23.4", + "@babel/node": "^7.25.7", "@graphql-eslint/eslint-plugin": "^3.20.1", "@types/express": "^5.0.0", "@types/lodash": "^4.17.9", @@ -508,6 +509,38 @@ "node": ">=6.9.0" } }, + "node_modules/@babel/node": { + "version": "7.25.7", + "resolved": "https://registry.npmjs.org/@babel/node/-/node-7.25.7.tgz", + "integrity": "sha512-SLrRogiTuneH3mZeZQtWBECyVRtznezYdnH4UjatZjHrk/QP+GH9bqsToCWp23pPeA20NO1/p8kECzWt5TTpUA==", + "dev": true, + "dependencies": { + "@babel/register": "^7.25.7", + "commander": "^6.2.0", + "core-js": "^3.30.2", + "node-environment-flags": "^1.0.5", + "regenerator-runtime": "^0.14.0", + "v8flags": "^3.1.1" + }, + "bin": { + "babel-node": "bin/babel-node.js" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/node/node_modules/commander": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-6.2.1.tgz", + "integrity": "sha512-U7VdrJFnJgo4xjrHpTzu0yrHPGImdsmD95ZlgYSEajAn2JKzDhDTPG9kBTefmObL2w/ngeZnilk+OV9CG3d7UA==", + "dev": true, + "engines": { + "node": ">= 6" + } + }, "node_modules/@babel/parser": { "version": "7.25.6", "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.25.6.tgz", @@ -1728,6 +1761,25 @@ "@babel/core": "^7.0.0-0 || ^8.0.0-0 <8.0.0" } }, + "node_modules/@babel/register": { + "version": "7.25.7", + "resolved": "https://registry.npmjs.org/@babel/register/-/register-7.25.7.tgz", + "integrity": "sha512-qHTd2Rhn/rKhSUwdY6+n98FmwXN+N+zxSVx3zWqRe9INyvTpv+aQ5gDV2+43ACd3VtMBzPPljbb0gZb8u5ma6Q==", + "dev": true, + "dependencies": { + "clone-deep": "^4.0.1", + "find-cache-dir": "^2.0.0", + "make-dir": "^2.1.0", + "pirates": "^4.0.6", + "source-map-support": "^0.5.16" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, "node_modules/@babel/regjsgen": { "version": "0.8.0", "resolved": "https://registry.npmjs.org/@babel/regjsgen/-/regjsgen-0.8.0.tgz", @@ -4773,6 +4825,27 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/array.prototype.reduce": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/array.prototype.reduce/-/array.prototype.reduce-1.0.7.tgz", + "integrity": "sha512-mzmiUCVwtiD4lgxYP8g7IYy8El8p2CSMePvIbTS7gchKir/L1fgJrk0yDKmAX6mnRQFKNADYIk8nNlTris5H1Q==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.2", + "es-array-method-boxes-properly": "^1.0.0", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.0.0", + "is-string": "^1.0.7" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/array.prototype.tosorted": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/array.prototype.tosorted/-/array.prototype.tosorted-1.1.4.tgz", @@ -5571,6 +5644,20 @@ "node": ">=0.8" } }, + "node_modules/clone-deep": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/clone-deep/-/clone-deep-4.0.1.tgz", + "integrity": "sha512-neHB9xuzh/wk0dIHweyAXv2aPGZIVk3pLMe+/RNzINf17fe0OG96QroktYAUm7SM1PBnzTabaLboqqxDyMU+SQ==", + "dev": true, + "dependencies": { + "is-plain-object": "^2.0.4", + "kind-of": "^6.0.2", + "shallow-clone": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, "node_modules/cloudflare-ip": { "version": "0.0.7", "resolved": "https://registry.npmjs.org/cloudflare-ip/-/cloudflare-ip-0.0.7.tgz", @@ -5680,6 +5767,12 @@ "node": ">= 12" } }, + "node_modules/commondir": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz", + "integrity": "sha512-W9pAhw0ja1Edb5GVdIF1mjZw/ASI0AlShXM83UUGe2DVr5TdAPEA1OA8m/g8zWp9x6On7gqufY+FatDbC3MDQg==", + "dev": true + }, "node_modules/concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", @@ -5740,6 +5833,17 @@ "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", "integrity": "sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ==" }, + "node_modules/core-js": { + "version": "3.38.1", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-3.38.1.tgz", + "integrity": "sha512-OP35aUorbU3Zvlx7pjsFdu1rGNnD4pgw/CWoYzRY3t2EzoVT7shKHY1dlAy3f41cGIO7ZDPQimhGFTlEYkG/Hw==", + "dev": true, + "hasInstallScript": true, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/core-js" + } + }, "node_modules/core-js-compat": { "version": "3.38.1", "resolved": "https://registry.npmjs.org/core-js-compat/-/core-js-compat-3.38.1.tgz", @@ -6318,6 +6422,12 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/es-array-method-boxes-properly": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/es-array-method-boxes-properly/-/es-array-method-boxes-properly-1.0.0.tgz", + "integrity": "sha512-wd6JXUmyHmt8T5a2xreUwKcGPq6f1f+WwIJkijUqiGcJz1qqnZgP6XIK+QyIWU5lT7imeNxUll48bziG+TSYcA==", + "dev": true + }, "node_modules/es-define-property": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.0.tgz", @@ -7419,6 +7529,20 @@ "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==" }, + "node_modules/find-cache-dir": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-2.1.0.tgz", + "integrity": "sha512-Tq6PixE0w/VMFfCgbONnkiQIVol/JJL7nRMi20fqzA4NRs9AfeqMGeRdPi3wIhYkxjeBaWh2rxwapn5Tu3IqOQ==", + "dev": true, + "dependencies": { + "commondir": "^1.0.1", + "make-dir": "^2.0.0", + "pkg-dir": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, "node_modules/find-node-modules": { "version": "2.1.3", "resolved": "https://registry.npmjs.org/find-node-modules/-/find-node-modules-2.1.3.tgz", @@ -8769,6 +8893,18 @@ "node": ">=8" } }, + "node_modules/is-plain-object": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", + "integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==", + "dev": true, + "dependencies": { + "isobject": "^3.0.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/is-regex": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.4.tgz", @@ -8947,6 +9083,15 @@ "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", "dev": true }, + "node_modules/isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha512-WhB9zCku7EGTj/HQQRz5aUQEUeoQZH2bWcltRErOpymJ4boYE6wL9Tbr23krRPSZ+C5zqNSrSw+Cc7sZZ4b7vg==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/istanbul-lib-coverage": { "version": "3.2.2", "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.2.tgz", @@ -10887,6 +11032,15 @@ "json-buffer": "3.0.1" } }, + "node_modules/kind-of": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", + "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/kleur": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/kleur/-/kleur-3.0.3.tgz", @@ -11765,6 +11919,25 @@ "node": ">= 0.6" } }, + "node_modules/node-environment-flags": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/node-environment-flags/-/node-environment-flags-1.0.6.tgz", + "integrity": "sha512-5Evy2epuL+6TM0lCQGpFIj6KwiEsGh1SrHUhTbNX+sLbBtjidPZFAnVK9y5yU1+h//RitLbRHTIMyxQPtxMdHw==", + "dev": true, + "dependencies": { + "object.getownpropertydescriptors": "^2.0.3", + "semver": "^5.7.0" + } + }, + "node_modules/node-environment-flags/node_modules/semver": { + "version": "5.7.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz", + "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==", + "dev": true, + "bin": { + "semver": "bin/semver" + } + }, "node_modules/node-fetch": { "version": "2.7.0", "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz", @@ -12085,6 +12258,27 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/object.getownpropertydescriptors": { + "version": "2.1.8", + "resolved": "https://registry.npmjs.org/object.getownpropertydescriptors/-/object.getownpropertydescriptors-2.1.8.tgz", + "integrity": "sha512-qkHIGe4q0lSYMv0XI4SsBTJz3WaURhLvd0lKSgtVuOsJ2krg4SgMw3PIRQFMp07yi++UR3se2mkcLqsBNpBb/A==", + "dev": true, + "dependencies": { + "array.prototype.reduce": "^1.0.6", + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.2", + "es-object-atoms": "^1.0.0", + "gopd": "^1.0.1", + "safe-array-concat": "^1.1.2" + }, + "engines": { + "node": ">= 0.8" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/object.groupby": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/object.groupby/-/object.groupby-1.0.3.tgz", @@ -12493,6 +12687,79 @@ "node": ">= 6" } }, + "node_modules/pkg-dir": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-3.0.0.tgz", + "integrity": "sha512-/E57AYkoeQ25qkxMj5PBOVgF8Kiu/h7cYS30Z5+R7WaiCCBfLq58ZI/dSeaEKb9WVJV5n/03QwrN3IeWIFllvw==", + "dev": true, + "dependencies": { + "find-up": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/pkg-dir/node_modules/find-up": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", + "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", + "dev": true, + "dependencies": { + "locate-path": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/pkg-dir/node_modules/locate-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", + "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", + "dev": true, + "dependencies": { + "p-locate": "^3.0.0", + "path-exists": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/pkg-dir/node_modules/p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "dev": true, + "dependencies": { + "p-try": "^2.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/pkg-dir/node_modules/p-locate": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz", + "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", + "dev": true, + "dependencies": { + "p-limit": "^2.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/pkg-dir/node_modules/path-exists": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", + "integrity": "sha512-bpC7GYwiDYQ4wYLe+FA8lhRjhQCMcQGuSgGGqDkg/QerRWw9CmGRT0iSOVRSZJ29NMLZgIzqaljJ63oaL4NIJQ==", + "dev": true, + "engines": { + "node": ">=4" + } + }, "node_modules/possible-typed-array-names": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/possible-typed-array-names/-/possible-typed-array-names-1.0.0.tgz", @@ -13322,6 +13589,18 @@ "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==" }, + "node_modules/shallow-clone": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/shallow-clone/-/shallow-clone-3.0.1.tgz", + "integrity": "sha512-/6KqX+GVUdqPuPPd2LxDDxzX6CAbjJehAAOKlNpqqUpAqPM6HeL8f+o3a+JsyGjn2lv0WY8UsTgUJjU9Ok55NA==", + "dev": true, + "dependencies": { + "kind-of": "^6.0.2" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/shebang-command": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", @@ -13485,6 +13764,16 @@ "node": ">=0.10.0" } }, + "node_modules/source-map-support": { + "version": "0.5.21", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.21.tgz", + "integrity": "sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==", + "dev": true, + "dependencies": { + "buffer-from": "^1.0.0", + "source-map": "^0.6.0" + } + }, "node_modules/spdx-correct": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.2.0.tgz", @@ -14289,6 +14578,18 @@ "node": ">=10.12.0" } }, + "node_modules/v8flags": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/v8flags/-/v8flags-3.2.0.tgz", + "integrity": "sha512-mH8etigqMfiGWdeXpaaqGfs6BndypxusHHcv2qSHyZkGEznCd/qAXCWWRzeowtL54147cktFOC4P5y+kl8d8Jg==", + "dev": true, + "dependencies": { + "homedir-polyfill": "^1.0.1" + }, + "engines": { + "node": ">= 0.10" + } + }, "node_modules/validate-npm-package-license": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", diff --git a/package.json b/package.json index 867f68300..81fb926c5 100644 --- a/package.json +++ b/package.json @@ -46,7 +46,7 @@ "depcheck": "npx @opencollective/depcheck .", "deploy:production": "./scripts/pre-deploy.sh production && git push production main", "deploy:staging": "./scripts/pre-deploy.sh staging && git push -f staging main", - "dev": "nodemon src/server/index.js -x \"babel-node --extensions .js,.ts\" . -e js,ts", + "dev": "nodemon src/server/index.ts -x \"babel-node --extensions .js,.ts\" . -e js,ts", "git:clean": "./scripts/git_clean.sh", "graphql:update:local": "cp ../frontend/lib/graphql/*.graphql src/graphql/ && prettier src/graphql/*.graphql --write", "graphql:update": "npm-run-all graphql:updateV1 graphql:updateV2", @@ -66,6 +66,7 @@ }, "devDependencies": { "@babel/cli": "^7.23.4", + "@babel/node": "^7.25.7", "@graphql-eslint/eslint-plugin": "^3.20.1", "@types/express": "^5.0.0", "@types/lodash": "^4.17.9", @@ -121,7 +122,8 @@ ], "ignores": [ "jest", - "typescript" + "typescript", + "@babel/node" ] }, "heroku-run-build-script": true diff --git a/src/graphql/schema.graphql b/src/graphql/schema.graphql index eb04f601e..37fabb623 100644 --- a/src/graphql/schema.graphql +++ b/src/graphql/schema.graphql @@ -32,11 +32,6 @@ interface CollectiveInterface { backgroundImage: String backgroundImageUrl(height: Int, format: ImageFormat): String settings: JSON! - - """ - Defines if a collective is pledged - """ - isPledged: Boolean @deprecated(reason: "2023-11-20: Pledged collectives do not exist anymore") data: JSON @deprecated(reason: "2020-10-08: This field is not provided anymore and will return an empty object") """ @@ -429,6 +424,7 @@ This represents an Tier """ type Tier { id: Int + idV2: String! slug: String type: String name: String @@ -1079,7 +1075,6 @@ type CollectiveFeatures { CONTACT_COLLECTIVE: CollectiveFeatureStatus CONTACT_FORM: CollectiveFeatureStatus CREATE_COLLECTIVE: CollectiveFeatureStatus - CROSS_CURRENCY_MANUAL_TRANSACTIONS: CollectiveFeatureStatus TRANSFERWISE: CollectiveFeatureStatus PAYPAL_PAYOUTS: CollectiveFeatureStatus PAYPAL_DONATIONS: CollectiveFeatureStatus @@ -1146,6 +1141,7 @@ type Policies { MAXIMUM_VIRTUAL_CARD_LIMIT_AMOUNT_FOR_INTERVAL: MAXIMUM_VIRTUAL_CARD_LIMIT_AMOUNT_FOR_INTERVAL EXPENSE_CATEGORIZATION: EXPENSE_CATEGORIZATION EXPENSE_PUBLIC_VENDORS: Boolean + COLLECTIVE_ADMINS_CAN_SEE_PAYOUT_METHODS: Boolean } type EXPENSE_AUTHOR_CANNOT_APPROVE { @@ -2145,11 +2141,6 @@ type Collective implements CollectiveInterface { backgroundImage: String backgroundImageUrl(height: Int, format: ImageFormat): String settings: JSON! - - """ - Defines if a collective is pledged - """ - isPledged: Boolean @deprecated(reason: "2023-11-20: Pledged collectives do not exist anymore") data: JSON @deprecated(reason: "2020-10-08: This field is not provided anymore and will return an empty object") """ @@ -2419,11 +2410,6 @@ type Event implements CollectiveInterface { backgroundImage: String backgroundImageUrl(height: Int, format: ImageFormat): String settings: JSON! - - """ - Defines if a collective is pledged - """ - isPledged: Boolean @deprecated(reason: "2023-11-20: Pledged collectives do not exist anymore") data: JSON @deprecated(reason: "2020-10-08: This field is not provided anymore and will return an empty object") """ @@ -2693,11 +2679,6 @@ type Fund implements CollectiveInterface { backgroundImage: String backgroundImageUrl(height: Int, format: ImageFormat): String settings: JSON! - - """ - Defines if a collective is pledged - """ - isPledged: Boolean @deprecated(reason: "2023-11-20: Pledged collectives do not exist anymore") data: JSON @deprecated(reason: "2020-10-08: This field is not provided anymore and will return an empty object") """ @@ -2967,11 +2948,6 @@ type Organization implements CollectiveInterface { backgroundImage: String backgroundImageUrl(height: Int, format: ImageFormat): String settings: JSON! - - """ - Defines if a collective is pledged - """ - isPledged: Boolean @deprecated(reason: "2023-11-20: Pledged collectives do not exist anymore") data: JSON @deprecated(reason: "2020-10-08: This field is not provided anymore and will return an empty object") """ @@ -3241,11 +3217,6 @@ type Project implements CollectiveInterface { backgroundImage: String backgroundImageUrl(height: Int, format: ImageFormat): String settings: JSON! - - """ - Defines if a collective is pledged - """ - isPledged: Boolean @deprecated(reason: "2023-11-20: Pledged collectives do not exist anymore") data: JSON @deprecated(reason: "2020-10-08: This field is not provided anymore and will return an empty object") """ @@ -3810,11 +3781,6 @@ type User implements CollectiveInterface { backgroundImage: String backgroundImageUrl(height: Int, format: ImageFormat): String settings: JSON! - - """ - Defines if a collective is pledged - """ - isPledged: Boolean @deprecated(reason: "2023-11-20: Pledged collectives do not exist anymore") data: JSON @deprecated(reason: "2020-10-08: This field is not provided anymore and will return an empty object") """ @@ -4086,11 +4052,6 @@ type Vendor implements CollectiveInterface { backgroundImage: String backgroundImageUrl(height: Int, format: ImageFormat): String settings: JSON! - - """ - Defines if a collective is pledged - """ - isPledged: Boolean @deprecated(reason: "2023-11-20: Pledged collectives do not exist anymore") data: JSON @deprecated(reason: "2020-10-08: This field is not provided anymore and will return an empty object") """ @@ -4595,45 +4556,25 @@ type Mutation { """ email: String! ): UserDetails - - """ - Confirm the new user email from confirmation token - """ - confirmUserEmail( - """ - User's emailConfirmationToken - """ - token: String! - ): UserDetails editConnectedAccount(connectedAccount: ConnectedAccountInputType!): ConnectedAccountType - """ - Update a single tier - """ - editTier( - """ - The tier to update - """ - tier: TierInputType! - ): Tier - editTiers(id: Int!, tiers: [TierInputType]): [Tier] - """ Updates all the core contributors (role = ADMIN or MEMBER) for this collective. """ editCoreContributors(collectiveId: Int!, members: [MemberInputType!]!): CollectiveInterface - @deprecated(reason: "2021-07-02: Please use inviteMember, editMember or removeMember mutations from GQLV2") + @deprecated(reason: "2021-07-02: Please use inviteMember, editMember or removeMember mutations from GraphQLV2") """ A mutation to edit the public message of all matching members. """ editPublicMessage(FromCollectiveId: Int!, CollectiveId: Int!, message: String): [Member] - @deprecated(reason: "2021-01-27: Please use editPublicMessage from GQLV2") + @deprecated(reason: "2021-01-27: Please use editPublicMessage from GraphQLV2") """ Update a payment method """ updatePaymentMethod(id: Int!, name: String, monthlyLimitPerMember: Int): PaymentMethodType + @deprecated(reason: "2024-07-16: Please use updateOrder from GraphQLV2") """ Replace a payment method @@ -4820,7 +4761,6 @@ input CollectiveInputType { image: String backgroundImage: String tags: [String] - tiers: [TierInputType] settings: JSON data: JSON @deprecated(reason: "2020-10-08: data cannot be edited. This field will be ignored.") @@ -4880,90 +4820,6 @@ input LocationInputType { structured: JSON } -""" -Input type for TierType -""" -input TierInputType { - id: Int - type: String - name: String - description: String - - """ - A long, html-formatted description. - """ - longDescription: String - - """ - Whether this tier has a standalone page - """ - useStandalonePage: Boolean - - """ - Link to a video (YouTube, Vimeo). - """ - videoUrl: String - - """ - amount in the lowest unit of the currency of the host (ie. in cents) - """ - amount: Int - - """ - Button text - """ - button: String - currency: String - presets: [Int] - interval: String - maxQuantity: Int - minimumAmount: Int - amountType: String - - """ - amount that you are trying to raise with this tier - """ - goal: Int - customFields: [CustomFieldsInputType] - - """ - Start of the campaign - """ - startsAt: String - - """ - End of the campaign - """ - endsAt: String - - """ - Invoice receipt template - """ - invoiceTemplate: String -} - -""" -Input for custom fields for order -""" -input CustomFieldsInputType { - type: CustomFieldType - name: String - label: String - required: Boolean -} - -""" -Type of custom field -""" -enum CustomFieldType { - number - text - email - date - radio - url -} - """ Input type for MemberType """ diff --git a/src/graphql/schemaV2.graphql b/src/graphql/schemaV2.graphql index e162e839b..1b1811d6e 100644 --- a/src/graphql/schemaV2.graphql +++ b/src/graphql/schemaV2.graphql @@ -199,7 +199,11 @@ interface Account { githubHandle: String @deprecated(reason: "2022-06-03: Please use repositoryUrl") repositoryUrl: String @deprecated(reason: "2023-01-16: Please use socialLinks") socialLinks: [SocialLink!]! - currency: String + + """ + The currency of the account + """ + currency: Currency! expensePolicy: String """ @@ -207,11 +211,6 @@ interface Account { """ isIncognito: Boolean! imageUrl(height: Int, format: ImageFormat): String - - """ - Returns whether this account has a custom image - """ - hasImage: Boolean! backgroundImageUrl(height: Int, format: ImageFormat): String """ @@ -504,11 +503,31 @@ interface Account { """ includeHostedAccounts: Boolean + """ + Include orders from children events/projects + """ + includeChildrenAccounts: Boolean! = false + + """ + Only return orders that were paused by these roles. status must be set to PAUSED. + """ + pausedBy: [OrderPausedBy] + """ Only return orders that were paid with this payment method. Must be an admin of the account owning the payment method. """ paymentMethod: PaymentMethodReferenceInput + """ + Only return orders that match these payment method services + """ + paymentMethodService: [PaymentMethodService] + + """ + Only return orders that match these payment method types + """ + paymentMethodType: [PaymentMethodType] + """ Whether to include incognito orders. Must be admin or root. Only with filter null or OUTGOING. """ @@ -554,6 +573,16 @@ interface Account { """ dateTo: DateTime + """ + Only return pending orders that were expected after this date + """ + expectedDateFrom: DateTime + + """ + Only return pending orders that were expected before this date + """ + expectedDateTo: DateTime + """ The term to search """ @@ -569,6 +598,7 @@ interface Account { Same as onlySubscriptions, but returns only orders with active subscriptions """ onlyActiveSubscriptions: Boolean + expectedFundsFilter: ExpectedFundsFilter """ Return only orders made from/to that opposite account (only works when orders are already filtered with a main account) @@ -611,7 +641,7 @@ interface Account { """ Use this field to filter expenses on their statuses """ - status: ExpenseStatusFilter + status: [ExpenseStatusFilter] """ Use this field to filter expenses on their type (RECEIPT/INVOICE) @@ -683,6 +713,16 @@ interface Account { Filter expenses of type charges using these virtual cards """ virtualCards: [VirtualCardReferenceInput] + + """ + Filter expenses by the last user-role who replied to them + """ + lastCommentBy: [LastCommentBy] + + """ + Only return expenses that match these accounting categories + """ + accountingCategory: [String] ): ExpenseCollection! settings: JSON! conversations( @@ -777,6 +817,11 @@ interface Account { categories: [String]! stats: AccountStats + """ + Whether this account can have changelog updates + """ + canHaveChangelogUpdates: Boolean! + """ Updates published by the account. To see unpublished updates, you need to be an admin and have the scope "updates". """ @@ -795,6 +840,7 @@ interface Account { Only return published updates. """ onlyPublishedUpdates: Boolean = false + isDraft: Boolean onlyChangelogUpdates: Boolean orderBy: UpdateChronologicalOrderInput! = { field: CREATED_AT, direction: DESC } searchTerm: String @@ -836,6 +882,7 @@ interface Account { offset: Int! = 0 isActive: Boolean accountType: [AccountType] + searchTerm: String ): AccountCollection! """ @@ -852,6 +899,31 @@ interface Account { Logged-in user permissions on an account """ permissions: AccountPermissions! + + """ + Host application requests + """ + hostApplicationRequests( + """ + The number of results to fetch (default 10, max 1000) + """ + limit: Int! = 10 + + """ + The offset to use to fetch + """ + offset: Int! = 0 + + """ + Order of the results + """ + orderBy: ChronologicalOrderInput! = { field: CREATED_AT, direction: DESC } + + """ + Filter applications by status + """ + status: HostApplicationStatus + ): HostApplicationCollection! feed( """ Only returns activities before this date @@ -878,6 +950,11 @@ interface Account { If this account was duplicated, the accounts that were created from it """ duplicatedAccounts(limit: Int! = 100, offset: Int! = 0): AccountCollection! + + """ + EXPERIMENTAL (this may change or be removed) + """ + transactionReports(timeUnit: TimeUnit = MONTH, dateFrom: DateTime, dateTo: DateTime): TransactionReports } """ @@ -931,1269 +1008,1329 @@ enum SocialLinkType { TWITCH } -enum ImageFormat { - txt - png - jpg - gif - svg -} - -""" -A collection of "Members" (ie: Organization backing a Collective) -""" -type MemberCollection implements Collection { - offset: Int - limit: Int - totalCount: Int - nodes: [Member] -} - -""" -Collection interface shared by all collection types -""" -interface Collection { - offset: Int - limit: Int - totalCount: Int -} - -""" -All member roles -""" -enum MemberRole { - BACKER - ADMIN - CONTRIBUTOR - HOST - ATTENDEE - MEMBER - FUNDRAISER @deprecated(reason: "2022-09-12: This role does not exist anymore") - FOLLOWER - ACCOUNTANT - CONNECTED_ACCOUNT -} - -""" -A field whose value conforms to the standard internet email address format as specified in RFC822: https://www.w3.org/Protocols/rfc822/. -""" -scalar EmailAddress - """ -Input to order results chronologically +All supported currencies """ -input ChronologicalOrderInput { +enum Currency { """ - Field to chronologically order by. + US Dollar """ - field: DateTimeField! = CREATED_AT + USD """ - Ordering direction. + UAE Dirham """ - direction: OrderDirection! = DESC -} + AED -""" -All possible DateTime fields for a resource -""" -enum DateTimeField { """ - The creation time of a resource + Afghani """ - CREATED_AT -} - -""" -Possible directions in which to order a list of items -""" -enum OrderDirection { - ASC - DESC -} - -""" -An invitation to join the members of a collective -""" -type MemberInvitation { - id: String! + AFN """ - The person who invited the member, if any + Lek """ - inviter: Individual - createdAt: DateTime! - account: Account! - memberAccount: Account! - role: MemberRole! - description: String - tier: Tier - since: DateTime -} - -""" -Tier model -""" -type Tier { - id: String! - legacyId: Int! - slug: String - name: String - description: String + ALL """ - A long, html-formatted description. + Armenian Dram """ - longDescription: String + AMD """ - Link to a video (YouTube, Vimeo). + Netherlands Antillean Guilder """ - videoUrl: String + ANG """ - Get all orders + Kwanza """ - orders(limit: Int! = 100, offset: Int! = 0, status: [OrderStatus]): OrderCollection! - amount: Amount! - currency: String - button: String - goal: Amount! - type: TierType! - interval: TierInterval @deprecated(reason: "2020-08-24: Please use \"frequency\"") - frequency: TierFrequency! - presets: [Int] - maxQuantity: Int + AOA """ - Number of tickets available. Returns null if there is no limit. + Argentine Peso """ - availableQuantity: Int - customFields: JSON - amountType: TierAmountType! - minimumAmount: Amount! - endsAt: DateTime - invoiceTemplate: String - useStandalonePage: Boolean - singleTicket: Boolean - requireAddress: Boolean! + ARS """ - Returns a list of all the contributors for this tier + Australian Dollar """ - contributors( - """ - The number of results to fetch (default 10, max 1000) - """ - limit: Int! = 100 - - """ - The offset to use to fetch - """ - offset: Int! = 0 - ): ContributorCollection! - stats: TierStats -} + AUD -""" -A collection of "Orders" -""" -type OrderCollection implements Collection { - offset: Int - limit: Int - totalCount: Int - nodes: [Order] -} + """ + Aruban Florin + """ + AWG -""" -Order model -""" -type Order { - id: String! - legacyId: Int! - description: String + """ + Azerbaijanian Manat + """ + AZN """ - Base order amount (without platform tip) + Convertible Mark """ - amount: Amount! + BAM """ - Tax amount + Barbados Dollar """ - taxAmount: Amount + BBD """ - Total order amount, including all taxes and platform tip + Taka """ - totalAmount: Amount! - quantity: Int - status: OrderStatus - frequency: ContributionFrequency - nextChargeDate: DateTime - tier: Tier - fromAccount: Account - toAccount: Account + BDT """ - Transactions for this order ordered by createdAt ASC + Bulgarian Lev """ - transactions: [Transaction]! - createdAt: DateTime - updatedAt: DateTime + BGN """ - WARNING: Total amount donated between collectives, though there will be edge cases especially when looking on the Order level, as the order id is not used in calculating this. + Burundi Franc """ - totalDonations: Amount! - paymentMethod: PaymentMethod + BIF """ - Host fee percent attached to the Order. + Bermudian Dollar """ - hostFeePercent: Float + BMD """ - Platform Tip attached to the Order. + Brunei Dollar """ - platformTipAmount: Amount - platformTipEligible: Boolean - tags: [String]! - tax: TaxInfo - taxes: [OrderTax]! @deprecated(reason: "2023-04-13: Please use `tax` instead.") + BND """ - This represents a MemberOf relationship (ie: Collective backed by an Individual) attached to the Order. + Boliviano """ - membership: MemberOf + BOB """ - The permissions given to current logged in user for this order + Brazilian Real """ - permissions: OrderPermissions! + BRL """ - The accounting category attached to this order + Bahamian Dollar """ - accountingCategory: AccountingCategory + BSD """ - The list of activities (ie. approved, edited, etc) for this Order ordered by date ascending + Pula """ - activities: ActivityCollection! + BWP """ - Data related to the order + Belarussian Ruble """ - data: JSON + BYN """ - Custom data related to the order, based on the fields described by tier.customFields. Must be authenticated as an admin of the fromAccount or toAccount (returns null otherwise) + Belize Dollar """ - customData: JSON + BZD """ - Memo field which adds additional details about the order. For example in added funds this can be a note to mark what method (cheque, money order) the funds were received. + Canadian Dollar """ - memo: String + CAD """ - The account who created this order + Congolese Franc """ - createdByAccount: Account + CDF """ - Date the funds were received. + Swiss Franc """ - processedAt: DateTime + CHF """ - Data about the pending contribution + Chilean Peso """ - pendingContributionData: PendingOrderData + CLP """ - Whether the order needs confirmation (3DSecure/SCA) + Yuan Renminbi """ - needsConfirmation: Boolean + CNY """ - Returns the list of comments for this order, or `null` if user is not allowed to see them + Colombian Peso """ - comments( - """ - The number of results to fetch (default 10, max 1000) - """ - limit: Int! = 10 - - """ - The offset to use to fetch - """ - offset: Int! = 0 - orderBy: ChronologicalOrderInput = { field: CREATED_AT, direction: ASC } - ): CommentCollection -} - -""" -All order statuses -""" -enum OrderStatus { - NEW - REQUIRE_CLIENT_CONFIRMATION - PAID - ERROR - PROCESSING - REJECTED - ACTIVE - CANCELLED - PENDING - EXPIRED - DISPUTED - REFUNDED - PAUSED - IN_REVIEW -} - -enum ContributionFrequency { - MONTHLY - YEARLY - ONETIME -} - -""" -Transaction interface shared by all kind of transactions (Debit, Credit) -""" -interface Transaction { - id: String! - legacyId: Int! - uuid: String! @deprecated(reason: "2021-08-15: Use id instead.") - group: String! - type: TransactionType! - kind: TransactionKind - description( - """ - Wether to generate the description dynamically. - """ - dynamic: Boolean = false - - """ - Wether to generate the full description when using dynamic. - """ - full: Boolean = false - ): String - amount: Amount! - amountInHostCurrency: Amount! + COP """ - Exchange rate between the currency of the transaction and the currency of the host (transaction.amount * transaction.hostCurrencyFxRate = transaction.amountInHostCurrency) + Costa Rican Colon """ - hostCurrencyFxRate: Float - netAmount( - """ - Fetch HOST_FEE transaction and integrate in calculation for retro-compatiblity. - """ - fetchHostFee: Boolean = false - - """ - Fetch PAYMENT_PROCESSOR_FEE transaction for retro-compatiblity. - """ - fetchPaymentProcessorFee: Boolean = false + CRC - """ - Fetch TAX transaction for retro-compatiblity. - """ - fetchTax: Boolean = false - ): Amount! - netAmountInHostCurrency( - """ - Fetch HOST_FEE transaction and integrate in calculation for retro-compatiblity. - """ - fetchHostFee: Boolean = false + """ + Cabo Verde Escudo + """ + CVE - """ - Fetch PAYMENT_PROCESSOR_FEE transaction for retro-compatiblity. - """ - fetchPaymentProcessorFee: Boolean = false + """ + Czech Koruna + """ + CZK - """ - Fetch TAX transaction for retro-compatiblity. - """ - fetchTax: Boolean = false - ): Amount! - taxAmount( - """ - Fetch TAX transaction for retro-compatiblity. - """ - fetchTax: Boolean = false - ): Amount! + """ + Djibouti Franc + """ + DJF """ - If a tax is set, this field will contain more info about the tax + Danish Krone """ - taxInfo: TaxInfo - platformFee: Amount! - hostFee( - """ - Fetch HOST_FEE transaction for retro-compatiblity. - """ - fetchHostFee: Boolean = false - ): Amount - paymentProcessorFee( - """ - Fetch PAYMENT_PROCESSOR_FEE transaction for retro-compatiblity. - """ - fetchPaymentProcessorFee: Boolean = false - ): Amount - host: Account - account: Account - oppositeAccount: Account + DKK """ - The sender of a transaction (on CREDIT = oppositeAccount, DEBIT = account) + Dominican Peso """ - fromAccount: Account + DOP """ - The recipient of a transaction (on CREDIT = account, DEBIT = oppositeAccount) + Algerian Dinar """ - toAccount: Account - giftCardEmitterAccount: Account - createdAt: DateTime - updatedAt: DateTime - clearedAt: DateTime - expense: Expense - order: Order - isRefunded: Boolean - isRefund: Boolean - isDisputed: Boolean - isInReview: Boolean - paymentMethod: PaymentMethod - payoutMethod: PayoutMethod - permissions: TransactionPermissions - isOrderRejected: Boolean! - refundTransaction: Transaction + DZD """ - The opposite transaction (CREDIT -> DEBIT, DEBIT -> CREDIT) + Egyptian Pound """ - oppositeTransaction: Transaction - relatedTransactions( - """ - Filter by kind - """ - kind: [TransactionKind] - ): [Transaction]! + EGP """ - Merchant id related to the Transaction (Stripe, PayPal, Wise, Privacy) + Ethiopian Birr """ - merchantId: String + ETB """ - The balance after the Transaction has run. Only for financially active accounts. + Euro """ - balanceInHostCurrency: Amount - invoiceTemplate: String -} + EUR -""" -All transaction types -""" -enum TransactionType { - DEBIT - CREDIT -} - -enum TransactionKind { - ADDED_FUNDS - BALANCE_TRANSFER - CONTRIBUTION - EXPENSE - HOST_FEE - HOST_FEE_SHARE - HOST_FEE_SHARE_DEBT - PAYMENT_PROCESSOR_COVER - PAYMENT_PROCESSOR_DISPUTE_FEE - PAYMENT_PROCESSOR_FEE - PLATFORM_FEE - PLATFORM_TIP - PLATFORM_TIP_DEBT - PREPAID_PAYMENT_METHOD - TAX -} - -""" -Information about a tax -""" -type TaxInfo { """ - An unique identifier for this tax (GST, VAT, etc) + Fiji Dollar """ - id: String! + FJD """ - Identifier for this tax (GST, VAT, etc) + Falkland Islands Pound """ - type: OrderTaxType! + FKP """ - Percentage applied, between 0-100 + Pound Sterling """ - percentage: Int! @deprecated(reason: "Please use `rate` instead") + GBP """ - Percentage applied, between 0-1 + Lari """ - rate: Float! + GEL """ - Tax ID number of the 3rd party receiving/paying the tax + Gibraltar Pound """ - idNumber: String -} + GIP -""" -The type of a tax like GST, VAT, etc -""" -enum OrderTaxType { """ - European Value Added Tax + Dalasi """ - VAT + GMD """ - New Zealand Good and Services Tax + Guinea Franc """ - GST -} - -""" -This represents an Expense -""" -type Expense { - id: String! + GNF """ - Legacy ID as returned by API V1. Avoid relying on this field as it may be removed in the future. + Quetzal """ - legacyId: Int! + GTQ """ - Title/main description for this expense + Guyana Dollar """ - description: String! + GYD """ - Longer description for this expense + Hong Kong Dollar """ - longDescription: String + HKD """ - Total amount of the expense (sum of the item's amounts). + Lempira """ - amount: Int! @deprecated(reason: "2022-02-09: Please use amountV2") + HNL """ - Total amount of the expense + Kuna """ - amountV2( - """ - Source of the currency to express the amount. Defaults to the expense currency - """ - currencySource: ExpenseCurrencySource = EXPENSE - ): Amount + HRK """ - Taxes applied to this expense + Gourde """ - taxes: [TaxInfo]! + HTG """ - The exchange rate between the expense currency and the account currency + Forint """ - accountCurrencyFxRate: Float! @deprecated(reason: "2022-02-09: Please use amountV2") + HUF """ - The accounting category attached to this expense + Rupiah """ - accountingCategory: AccountingCategory + IDR """ - If available, this field will contain a breakdown of the expense values depending on who edited it + New Israeli Sheqel """ - valuesByRole: ExpenseValuesByRole + ILS """ - The time of creation + Indian Rupee """ - createdAt: DateTime! + INR """ - Currency that should be used for the payout + Iceland Krona """ - currency: Currency! + ISK """ - Whether this expense is a receipt or an invoice + Jamaican Dollar """ - type: ExpenseType! + JMD """ - The state of the expense (pending, approved, paid, rejected...etc) + Yen """ - status: ExpenseStatus! + JPY """ - The accounts who approved this expense + Kenyan Shilling """ - approvedBy: [Account]! + KES """ - The account who paid this expense + Som """ - paidBy: Account + KGS """ - Whether this expense is on hold + Riel """ - onHold: Boolean + KHR """ - Returns the list of comments for this expense, or `null` if user is not allowed to see them + Comoro Franc """ - comments( - """ - The number of results to fetch (default 10, max 1000) - """ - limit: Int! = 10 - - """ - The offset to use to fetch - """ - offset: Int! = 0 - orderBy: ChronologicalOrderInput = { field: CREATED_AT, direction: ASC } - ): CommentCollection + KMF """ - The account where the expense was submitted + Won """ - account: Account! + KRW """ - The account being paid by this expense + Cayman Islands Dollar """ - payee: Account! + KYD """ - The address of the payee + Tenge """ - payeeLocation: Location + KZT """ - The account who created this expense + Kip """ - createdByAccount: Account + LAK """ - The account from where the expense was paid + Lebanese Pound """ - host: Host + LBP """ - The payout method to use for this expense + Sri Lanka Rupee """ - payoutMethod: PayoutMethod - paymentMethod: PaymentMethod + LKR """ - The virtual card used to pay for this charge + Liberian Dollar """ - virtualCard: VirtualCard + LRD """ - (Optional) files attached to the expense + Loti """ - attachedFiles: [ExpenseAttachedFile!] - items: [ExpenseItem] + LSL """ - Additional information about the payment as HTML. Only visible to user and admins. + Moroccan Dirham """ - privateMessage: String + MAD """ - Information to display on the invoice. Only visible to user and admins. + Moldovan Leu """ - invoiceInfo: String + MDL """ - The fees payer for this expense + Malagasy Ariary """ - feesPayer: FeesPayer! + MGA """ - The permissions given to current logged in user for this expense + Denar """ - permissions: ExpensePermissions! + MKD """ - The list of activities (ie. approved, edited, etc) for this expense ordered by date ascending + Kyat """ - activities: [Activity!]! - tags: [String]! + MMK """ - Returns the list of legal documents required from the payee before the expense can be payed. Must be logged in. + Tugrik """ - requiredLegalDocuments: [LegalDocumentType] + MNT """ - Drafted field values that were still not persisted + Pataca """ - draft: JSON + MOP """ - The account that requested this expense to be submitted + Mauritius Rupee """ - requestedByAccount: Account - quote: ExpenseQuote - validateTransferRequirements( - """ - Details of the transfer - """ - details: JSON - ): [TransferWiseRequiredField] - recurringExpense: RecurringExpense + MUR """ - [Admin only] Security checks for this expense. Only available to expenses under trusted hosts. + Rufiyaa """ - securityChecks: [SecurityCheck] + MVR """ - Custom data for this expense + Kwacha """ - customData: JSON + MWK """ - The merchant ID for this expense + Mexican Peso """ - merchantId: String -} + MXN -""" -All supported expense currency sources -""" -enum ExpenseCurrencySource { """ - The expense currency expressed as the host currency + Malaysian Ringgit """ - HOST + MYR """ - The expense currency expressed as the account currency + Mozambique Metical """ - ACCOUNT + MZN """ - The expense currency expressed as the expense currency + Namibia Dollar """ - EXPENSE + NAD """ - The expense currency expressed as the expense currency + Naira """ - CREATED_BY_ACCOUNT -} - -""" -Fields for an accounting category -""" -type AccountingCategory { - id: String! + NGN """ - The code of the accounting category + Cordoba Oro """ - code: String! + NIO """ - The technical name of the accounting category + Norwegian Krone """ - name: String! + NOK """ - A friendly name for non-accountants (i.e. expense submitters and collective admins) + Nepalese Rupee """ - friendlyName: String + NPR """ - Whether this category is only meant for the host admins + New Zealand Dollar """ - hostOnly: Boolean! + NZD """ - Instructions for the expense submitters + Balboa """ - instructions: String + PAB """ - The account this category belongs to + Nuevo Sol """ - account: Host! + PEN """ - If meant for expenses, the types of expenses this category applies to + Kina """ - expensesTypes: [ExpenseType] + PGK """ - The kind of transactions this category applies to + Philippine Peso """ - kind: AccountingCategoryKind + PHP """ - The time of creation of this accounting category + Pakistan Rupee """ - createdAt: DateTime! -} + PKR -""" -This represents an Host account -""" -type Host implements Account & AccountWithContributions { - id: String! - legacyId: Int! + """ + Zloty + """ + PLN """ - The slug identifying the account (ie: babel) + Guarani """ - slug: String! - type: AccountType! + PYG """ - Public name + Qatari Rial """ - name: String + QAR """ - Private, legal name. Used for expense receipts, taxes, etc. Scope: "account". + Romanian Leu """ - legalName: String - description: String - longDescription: String - tags: [String] - website: String @deprecated(reason: "2023-01-16: Please use socialLinks") - twitterHandle: String @deprecated(reason: "2023-01-16: Please use socialLinks") - githubHandle: String @deprecated(reason: "2022-06-03: Please use repositoryUrl") - repositoryUrl: String @deprecated(reason: "2023-01-16: Please use socialLinks") - socialLinks: [SocialLink!]! - currency: String - expensePolicy: String + RON """ - Defines if the contributors wants to be incognito (name not displayed) + Serbian Dinar """ - isIncognito: Boolean! - imageUrl(height: Int, format: ImageFormat): String + RSD """ - Returns whether this account has a custom image + Russian Ruble """ - hasImage: Boolean! - backgroundImageUrl(height: Int, format: ImageFormat): String + RUB """ - The time of creation + Rwanda Franc """ - createdAt: DateTime - updatedAt: DateTime + RWF """ - Returns whether this account is archived + Saudi Riyal """ - isArchived: Boolean! + SAR """ - Whether this account is frozen + Solomon Islands Dollar """ - isFrozen: Boolean! + SBD """ - Returns whether the account accepts financial contributions. + Seychelles Rupee """ - isActive: Boolean + SCR """ - Returns whether the account is setup to Host collectives. + Swedish Krona """ - isHost: Boolean! + SEK """ - Returns true if the remote user is an admin of this account + Singapore Dollar """ - isAdmin: Boolean! - parentAccount: Account @deprecated(reason: "2022-12-16: use parent on AccountWithParent instead") + SGD """ - Get all members (admins, members, backers, followers) + Saint Helena Pound """ - members( - limit: Int! = 100 - offset: Int! = 0 - role: [MemberRole] - accountType: [AccountType] + SHP - """ - Admin only. To filter on the email address of a member, useful to check if a member exists. - """ - email: EmailAddress + """ + Leone + """ + SLL - """ - Order of the results - """ - orderBy: ChronologicalOrderInput! = { field: CREATED_AT, direction: ASC } - includeInherited: Boolean = true - ): MemberCollection! + """ + Somali Shilling + """ + SOS """ - [AUTHENTICATED] Returns the pending invitations + Surinam Dollar """ - memberInvitations( - """ - A reference to an account (usually Individual). Will return invitations sent to the account to join as a member - """ - memberAccount: AccountReferenceInput + SRD - """ - A reference to an account (usually Collective, Fund or Organization). Will return invitations sent to join this account as a member. - """ - account: AccountReferenceInput + """ + Lilangeni + """ + SZL - """ - An array of Member roles to filter for - """ - role: [MemberRole] - ): [MemberInvitation] + """ + Baht + """ + THB """ - The legal documents associated with this account + Somoni """ - legalDocuments( - """ - Filter by type - """ - type: [LegalDocumentType] - ): [LegalDocument] - memberOf( - limit: Int! = 150 - offset: Int! = 0 - role: [MemberRole] - accountType: [AccountType] - account: AccountReferenceInput + TJS - """ - Filter on whether the account is a host or not - """ - isHostAccount: Boolean + """ + Pa’anga + """ + TOP - """ - Filter on (un)approved collectives - """ - isApproved: Boolean + """ + Turkish Lira + """ + TRY - """ - Filter on archived collectives - """ - isArchived: Boolean + """ + Trinidad and Tobago Dollar + """ + TTD - """ - Whether incognito profiles should be included in the result. Only works if requesting user is an admin of the account. - """ - includeIncognito: Boolean = true + """ + New Taiwan Dollar + """ + TWD - """ - A term to search membership. Searches in collective tags, name, slug, members description and role. - """ - searchTerm: String + """ + Tanzanian Shilling + """ + TZS - """ - Filters on the Host fees structure applied to this account - """ - hostFeesStructure: HostFeeStructure + """ + Hryvnia + """ + UAH - """ - Order of the results - """ - orderBy: OrderByInput! = { field: CREATED_AT, direction: DESC } + """ + Uganda Shilling + """ + UGX - """ - Order the query by requested role order - """ - orderByRoles: Boolean - ): MemberOfCollection! + """ + Peso Uruguayo + """ + UYU """ - Returns the emails of the account. Individuals only have one, but organizations can have multiple emails. + Uzbekistan Sum """ - emails: [EmailAddress!] - transactions( - """ - The number of results to fetch (default 10, max 1000) - """ - limit: Int! = 100 + UZS - """ - The offset to use to fetch - """ - offset: Int! = 0 + """ + Dong + """ + VND - """ - The transaction type (DEBIT or CREDIT) - """ - type: TransactionType + """ + Vatu + """ + VUV - """ - The payment method types. Can include `null` for transactions without a payment method - """ - paymentMethodType: [PaymentMethodType] + """ + Tala + """ + WST - """ - The payment method services. - """ - paymentMethodService: [PaymentMethodService] + """ + CFA Franc BEAC + """ + XAF - """ - Reference of the account(s) assigned to the main side of the transaction you want to EXCLUDE from the results - """ - excludeAccount: [AccountReferenceInput] + """ + East Caribbean Dollar + """ + XCD - """ - Reference of the account assigned to the other side of the transaction (CREDIT -> sender, DEBIT -> recipient). Avoid, favor account instead. - """ - fromAccount: AccountReferenceInput + """ + CFA Franc BCEAO + """ + XOF - """ - Reference of the host accounting the transaction - """ - host: AccountReferenceInput + """ + CFP Franc + """ + XPF - """ - NOT IMPLEMENTED. Only return transactions that match these tags. - """ - tags: [String] @deprecated(reason: "2020-08-09: Was never implemented.") + """ + Yemeni Rial + """ + YER + + """ + Rand + """ + ZAR + """ + Zambian Kwacha + """ + ZMW +} + +enum ImageFormat { + txt + png + jpg + gif + svg +} + +""" +A collection of "Members" (ie: Organization backing a Collective) +""" +type MemberCollection implements Collection { + offset: Int + limit: Int + totalCount: Int + nodes: [Member] +} + +""" +Collection interface shared by all collection types +""" +interface Collection { + offset: Int + limit: Int + totalCount: Int +} + +""" +All member roles +""" +enum MemberRole { + BACKER + ADMIN + CONTRIBUTOR + HOST + ATTENDEE + MEMBER + FUNDRAISER @deprecated(reason: "2022-09-12: This role does not exist anymore") + FOLLOWER + ACCOUNTANT + CONNECTED_ACCOUNT +} + +""" +A field whose value conforms to the standard internet email address format as specified in RFC822: https://www.w3.org/Protocols/rfc822/. +""" +scalar EmailAddress + +""" +Input to order results chronologically +""" +input ChronologicalOrderInput { + """ + Field to chronologically order by. + """ + field: DateTimeField! = CREATED_AT + + """ + Ordering direction. + """ + direction: OrderDirection! = DESC +} + +""" +All possible DateTime fields for a resource +""" +enum DateTimeField { + """ + The creation time of a resource + """ + CREATED_AT + + """ + Transactions only: The date when a transaction was cleared by the payment processor + """ + EFFECTIVE_DATE +} + +""" +Possible directions in which to order a list of items +""" +enum OrderDirection { + ASC + DESC +} + +""" +An invitation to join the members of a collective +""" +type MemberInvitation { + id: String! + + """ + The person who invited the member, if any + """ + inviter: Individual + createdAt: DateTime! + account: Account! + memberAccount: Account! + role: MemberRole! + description: String + tier: Tier + since: DateTime +} + +""" +Tier model +""" +type Tier { + id: String! + legacyId: Int! + slug: String + name: String + description: String + + """ + A long, html-formatted description. + """ + longDescription: String + + """ + Link to a video (YouTube, Vimeo). + """ + videoUrl: String + + """ + Get all orders + """ + orders(limit: Int! = 100, offset: Int! = 0, status: [OrderStatus]): OrderCollection! + amount: Amount! + currency: String + button: String + goal: Amount! + type: TierType! + interval: TierInterval @deprecated(reason: "2020-08-24: Please use \"frequency\"") + frequency: TierFrequency! + presets: [Int] + maxQuantity: Int + + """ + Number of tickets available. Returns null if there is no limit. + """ + availableQuantity: Int + customFields: JSON + amountType: TierAmountType! + minimumAmount: Amount! + endsAt: DateTime + invoiceTemplate: String + useStandalonePage: Boolean + singleTicket: Boolean + requireAddress: Boolean! + + """ + Returns a list of all the contributors for this tier + """ + contributors( """ - The order of results + The number of results to fetch (default 10, max 1000) """ - orderBy: ChronologicalOrderInput! = { field: CREATED_AT, direction: DESC } + limit: Int! = 100 """ - Only return transactions where the amount is greater than or equal to this value (in cents) + The offset to use to fetch """ - minAmount: Int @deprecated(reason: "2020-08-09: GraphQL v2 should not expose amounts as integer.") + offset: Int! = 0 + ): ContributorCollection! + stats: TierStats +} + +""" +A collection of "Orders" +""" +type OrderCollection implements Collection { + offset: Int + limit: Int + totalCount: Int + nodes: [Order] +} + +""" +Order model +""" +type Order { + id: String! + legacyId: Int! + description: String + + """ + Base order amount (without platform tip) + """ + amount: Amount! + + """ + Tax amount + """ + taxAmount: Amount + + """ + Total order amount, including all taxes and platform tip + """ + totalAmount: Amount! + quantity: Int + status: OrderStatus + frequency: ContributionFrequency + nextChargeDate: DateTime + tier: Tier + fromAccount: Account + toAccount: Account + + """ + Transactions for this order ordered by createdAt ASC + """ + transactions: [Transaction]! + createdAt: DateTime + updatedAt: DateTime + + """ + WARNING: Total amount donated between collectives, though there will be edge cases especially when looking on the Order level, as the order id is not used in calculating this. + """ + totalDonations: Amount! + paymentMethod: PaymentMethod + paymentProcessorUrl: String + + """ + Host fee percent attached to the Order. + """ + hostFeePercent: Float + + """ + Payment processor fee attached to manually Added Funds. + """ + paymentProcessorFee: Amount + + """ + Platform Tip attached to the Order. + """ + platformTipAmount: Amount + platformTipEligible: Boolean + tags: [String]! + tax: TaxInfo + taxes: [OrderTax]! @deprecated(reason: "2023-04-13: Please use `tax` instead.") + + """ + This represents a MemberOf relationship (ie: Collective backed by an Individual) attached to the Order. + """ + membership: MemberOf + + """ + The permissions given to current logged in user for this order + """ + permissions: OrderPermissions! + + """ + The accounting category attached to this order + """ + accountingCategory: AccountingCategory + + """ + The list of activities (ie. approved, edited, etc) for this Order ordered by date ascending + """ + activities: ActivityCollection! + + """ + Data related to the order + """ + data: JSON + + """ + Custom data related to the order, based on the fields described by tier.customFields. Must be authenticated as an admin of the fromAccount or toAccount (returns null otherwise) + """ + customData: JSON + + """ + Memo field which adds additional details about the order. For example in added funds this can be a note to mark what method (cheque, money order) the funds were received. + """ + memo: String + + """ + The account who created this order + """ + createdByAccount: Account + + """ + Date the funds were received. + """ + processedAt: DateTime + + """ + Data about the pending contribution + """ + pendingContributionData: PendingOrderData - """ - Only return transactions where the amount is lower than or equal to this value (in cents) - """ - maxAmount: Int @deprecated(reason: "2020-08-09: GraphQL v2 should not expose amounts as integer.") + """ + Whether the order needs confirmation (3DSecure/SCA) + """ + needsConfirmation: Boolean + """ + Returns the list of comments for this order, or `null` if user is not allowed to see them + """ + comments( """ - Only return transactions that were created after this date + The number of results to fetch (default 10, max 1000) """ - dateFrom: DateTime + limit: Int! = 10 """ - Only return transactions that were created before this date + The offset to use to fetch """ - dateTo: DateTime + offset: Int! = 0 + orderBy: ChronologicalOrderInput = { field: CREATED_AT, direction: ASC } + ): CommentCollection +} - """ - Only return transactions that were cleared after this date - """ - clearedFrom: DateTime +""" +All order statuses +""" +enum OrderStatus { + NEW + REQUIRE_CLIENT_CONFIRMATION + PAID + ERROR + PROCESSING + REJECTED + ACTIVE + CANCELLED + PENDING + EXPIRED + DISPUTED + REFUNDED + PAUSED + IN_REVIEW +} - """ - Only return transactions that were cleared before this date - """ - clearedTo: DateTime +enum ContributionFrequency { + MONTHLY + YEARLY + ONETIME +} +""" +Transaction interface shared by all kind of transactions (Debit, Credit) +""" +interface Transaction { + id: String! + legacyId: Int! + uuid: String! @deprecated(reason: "2021-08-15: Use id instead.") + group: String! + type: TransactionType! + kind: TransactionKind + description( """ - The term to search + Wether to generate the description dynamically. """ - searchTerm: String + dynamic: Boolean = false """ - Only return transactions with an Expense attached + Wether to generate the full description when using dynamic. """ - hasExpense: Boolean + full: Boolean = false + ): String + amount: Amount! + amountInHostCurrency: Amount! + """ + Exchange rate between the currency of the transaction and the currency of the host (transaction.amount * transaction.hostCurrencyFxRate = transaction.amountInHostCurrency) + """ + hostCurrencyFxRate: Float + netAmount( """ - Only return transactions with this Expense attached + Fetch HOST_FEE transaction and integrate in calculation for retro-compatiblity. """ - expense: ExpenseReferenceInput + fetchHostFee: Boolean = false """ - Only return transactions that have an Expense of one of these expense types attached + Fetch PAYMENT_PROCESSOR_FEE transaction for retro-compatiblity. """ - expenseType: [ExpenseType] + fetchPaymentProcessorFee: Boolean = false """ - Only return transactions with an Order attached + Fetch TAX transaction for retro-compatiblity. """ - hasOrder: Boolean - + fetchTax: Boolean = false + ): Amount! + netAmountInHostCurrency( """ - Only return transactions for this order. + Fetch HOST_FEE transaction and integrate in calculation for retro-compatiblity. """ - order: OrderReferenceInput + fetchHostFee: Boolean = false """ - Used when filtering with the `host` argument to determine whether to include transactions on the fiscal host account (and children) + Fetch PAYMENT_PROCESSOR_FEE transaction for retro-compatiblity. """ - includeHost: Boolean! = true + fetchPaymentProcessorFee: Boolean = false """ - Whether to include regular transactions from the account (turn false if you only want Incognito or Gift Card transactions) + Fetch TAX transaction for retro-compatiblity. """ - includeRegularTransactions: Boolean! = true - + fetchTax: Boolean = false + ): Amount! + taxAmount( """ - If the account is a user and this field is true, contributions from the incognito profile will be included too (admins only) + Fetch TAX transaction for retro-compatiblity. """ - includeIncognitoTransactions: Boolean! = false + fetchTax: Boolean = false + ): Amount! + """ + If a tax is set, this field will contain more info about the tax + """ + taxInfo: TaxInfo + platformFee: Amount! + hostFee( """ - Whether to include transactions from children (Events and Projects) + Fetch HOST_FEE transaction for retro-compatiblity. """ - includeChildrenTransactions: Boolean! = false - + fetchHostFee: Boolean = false + ): Amount + paymentProcessorFee( """ - Whether to include transactions from Gift Cards issued by the account. + Fetch PAYMENT_PROCESSOR_FEE transaction for retro-compatiblity. """ - includeGiftCardTransactions: Boolean! = false + fetchPaymentProcessorFee: Boolean = false + ): Amount + paymentProcessorUrl: String + host: Account + account: Account + oppositeAccount: Account - """ - Whether to include debt transactions - """ - includeDebts: Boolean! = false + """ + The sender of a transaction (on CREDIT = oppositeAccount, DEBIT = account) + """ + fromAccount: Account + + """ + The recipient of a transaction (on CREDIT = account, DEBIT = oppositeAccount) + """ + toAccount: Account + giftCardEmitterAccount: Account + createdAt: DateTime + updatedAt: DateTime + clearedAt: DateTime + expense: Expense + order: Order + isRefunded: Boolean + isRefund: Boolean + isDisputed: Boolean + isInReview: Boolean + paymentMethod: PaymentMethod + payoutMethod: PayoutMethod + permissions: TransactionPermissions + isOrderRejected: Boolean! + refundTransaction: Transaction + """ + The opposite transaction (CREDIT -> DEBIT, DEBIT -> CREDIT) + """ + oppositeTransaction: Transaction + relatedTransactions( """ - To filter by transaction kind + Filter by kind """ kind: [TransactionKind] + ): [Transaction]! - """ - The transactions group to filter by - """ - group: [String] - virtualCard: [VirtualCardReferenceInput] + """ + Merchant id related to the Transaction (Stripe, PayPal, Wise, Privacy) + """ + merchantId: String - """ - Only return transactions that are refunds (or not refunds if false) - """ - isRefund: Boolean + """ + The balance after the Transaction has run. Only for financially active accounts. + """ + balanceInHostCurrency: Amount + invoiceTemplate: String +} + +""" +All transaction types +""" +enum TransactionType { + DEBIT + CREDIT +} + +enum TransactionKind { + ADDED_FUNDS + BALANCE_TRANSFER + CONTRIBUTION + EXPENSE + HOST_FEE + HOST_FEE_SHARE + HOST_FEE_SHARE_DEBT + PAYMENT_PROCESSOR_COVER + PAYMENT_PROCESSOR_DISPUTE_FEE + PAYMENT_PROCESSOR_FEE + PLATFORM_FEE + PLATFORM_TIP + PLATFORM_TIP_DEBT + PREPAID_PAYMENT_METHOD + TAX +} + +""" +Information about a tax +""" +type TaxInfo { + """ + An unique identifier for this tax (GST, VAT, etc) + """ + id: String! + + """ + Identifier for this tax (GST, VAT, etc) + """ + type: OrderTaxType! + + """ + Percentage applied, between 0-100 + """ + percentage: Int! @deprecated(reason: "Please use `rate` instead") + + """ + Percentage applied, between 0-1 + """ + rate: Float! + + """ + Tax ID number of the 3rd party receiving/paying the tax + """ + idNumber: String +} + +""" +The type of a tax like GST, VAT, etc +""" +enum OrderTaxType { + """ + European Value Added Tax + """ + VAT - """ - Only return transactions that are associated with these external merchant IDs - """ - merchantId: [String] + """ + New Zealand Good and Services Tax + """ + GST +} - """ - Only return transactions that are associated with these accounting categories - """ - accountingCategory: [String] - ): TransactionCollection! - orders( - """ - The number of results to fetch (default 10, max 1000) - """ - limit: Int! = 100 +""" +This represents an Expense +""" +type Expense { + id: String! - """ - The offset to use to fetch - """ - offset: Int! = 0 + """ + Legacy ID as returned by API V1. Avoid relying on this field as it may be removed in the future. + """ + legacyId: Int! - """ - If account is a host, also include hosted accounts orders - """ - includeHostedAccounts: Boolean + """ + Title/main description for this expense + """ + description: String! - """ - Only return orders that were paid with this payment method. Must be an admin of the account owning the payment method. - """ - paymentMethod: PaymentMethodReferenceInput + """ + Longer description for this expense + """ + longDescription: String - """ - Whether to include incognito orders. Must be admin or root. Only with filter null or OUTGOING. - """ - includeIncognito: Boolean = false + """ + User-provided reference number or any other identifier that references the invoice + """ + reference: String - """ - Account orders filter (INCOMING or OUTGOING) - """ - filter: AccountOrdersFilter + """ + Total amount of the expense (sum of the item's amounts). + """ + amount: Int! @deprecated(reason: "2022-02-09: Please use amountV2") + """ + Total amount of the expense + """ + amountV2( """ - Use this field to filter orders on their frequency (ONETIME, MONTHLY or YEARLY) + Source of the currency to express the amount. Defaults to the expense currency """ - frequency: ContributionFrequency + currencySource: ExpenseCurrencySource = EXPENSE + ): Amount - """ - Use this field to filter orders on their statuses - """ - status: [OrderStatus] + """ + Taxes applied to this expense + """ + taxes: [TaxInfo]! - """ - The order of results - """ - orderBy: ChronologicalOrderInput! = { field: CREATED_AT, direction: DESC } + """ + The exchange rate between the expense currency and the account currency + """ + accountCurrencyFxRate: Float! @deprecated(reason: "2022-02-09: Please use amountV2") - """ - Only return orders where the amount is greater than or equal to this value (in cents) - """ - minAmount: Int + """ + The accounting category attached to this expense + """ + accountingCategory: AccountingCategory - """ - Only return orders where the amount is lower than or equal to this value (in cents) - """ - maxAmount: Int + """ + If available, this field will contain a breakdown of the expense values depending on who edited it + """ + valuesByRole: ExpenseValuesByRole - """ - Only return orders that were created after this date - """ - dateFrom: DateTime + """ + The time of creation + """ + createdAt: DateTime! - """ - Only return orders that were created before this date - """ - dateTo: DateTime + """ + Currency that should be used for the payout + """ + currency: Currency! - """ - The term to search - """ - searchTerm: String - tierSlug: String @deprecated(reason: "2022-02-25: Should be replaced by a tier reference. Not existing yet.") + """ + Whether this expense is a receipt or an invoice + """ + type: ExpenseType! - """ - Only returns orders that have a subscription (monthly/yearly). Don't use together with frequency. - """ - onlySubscriptions: Boolean + """ + The state of the expense (pending, approved, paid, rejected...etc) + """ + status: ExpenseStatus! - """ - Same as onlySubscriptions, but returns only orders with active subscriptions - """ - onlyActiveSubscriptions: Boolean + """ + The accounts who approved this expense + """ + approvedBy: [Account]! - """ - Return only orders made from/to that opposite account (only works when orders are already filtered with a main account) - """ - oppositeAccount: AccountReferenceInput - ): OrderCollection! - expenses( - direction: ExpenseDirection + """ + The account who paid this expense + """ + paidBy: Account + + """ + Whether this expense is on hold + """ + onHold: Boolean + """ + Returns the list of comments for this expense, or `null` if user is not allowed to see them + """ + comments( """ The number of results to fetch (default 10, max 1000) """ @@ -2203,472 +2340,411 @@ type Host implements Account & AccountWithContributions { The offset to use to fetch """ offset: Int! = 0 + orderBy: ChronologicalOrderInput = { field: CREATED_AT, direction: ASC } + ): CommentCollection - """ - Reference of an account that is the payee of an expense - """ - fromAccount: AccountReferenceInput - - """ - Reference of an account that is the payer of an expense - """ - account: AccountReferenceInput + """ + The account where the expense was submitted + """ + account: Account! - """ - Return expenses only for this host - """ - host: AccountReferenceInput + """ + The account being paid by this expense + """ + payee: Account! - """ - Return expenses only created by this INDIVIDUAL account - """ - createdByAccount: AccountReferenceInput + """ + The address of the payee + """ + payeeLocation: Location - """ - Use this field to filter expenses on their statuses - """ - status: ExpenseStatusFilter + """ + The account who created this expense + """ + createdByAccount: Account - """ - Use this field to filter expenses on their type (RECEIPT/INVOICE) - """ - type: ExpenseType - types: [ExpenseType] + """ + The account from where the expense was paid + """ + host: Host - """ - Only expenses that match these tags - """ - tags: [String] @deprecated(reason: "2020-06-30: Please use tag (singular)") + """ + The payout method to use for this expense + """ + payoutMethod: PayoutMethod + paymentMethod: PaymentMethod - """ - Only expenses that match these tags - """ - tag: [String] + """ + The virtual card used to pay for this charge + """ + virtualCard: VirtualCard - """ - The order of results - """ - orderBy: ChronologicalOrderInput! = { field: CREATED_AT, direction: DESC } + """ + (Optional) files attached to the expense + """ + attachedFiles: [ExpenseAttachedFile!] + items: [ExpenseItem] - """ - Only return expenses where the amount is greater than or equal to this value (in cents) - """ - minAmount: Int + """ + Additional information about the payment as HTML. Only visible to user and admins. + """ + privateMessage: String - """ - Only return expenses where the amount is lower than or equal to this value (in cents) - """ - maxAmount: Int + """ + Information to display on the invoice. Only visible to user and admins. + """ + invoiceInfo: String - """ - Only return expenses that use the given type as payout method - """ - payoutMethodType: PayoutMethodType + """ + The fees payer for this expense + """ + feesPayer: FeesPayer! - """ - Only return expenses that were created after this date - """ - dateFrom: DateTime + """ + The permissions given to current logged in user for this expense + """ + permissions: ExpensePermissions! - """ - Only return expenses that were created after this date - """ - dateTo: DateTime + """ + The list of activities (ie. approved, edited, etc) for this expense ordered by date ascending + """ + activities: [Activity!]! + tags: [String]! - """ - The term to search - """ - searchTerm: String + """ + Returns the list of legal documents required from the payee before the expense can be payed. Must be logged in. + """ + requiredLegalDocuments: [LegalDocumentType] + """ + Returns the list of legal documents attached to this expense. Must be logged in as a host admin. + """ + legalDocuments( """ - Whether to include expenses from children of the account (Events and Projects) + The number of results to fetch (default 10, max 1000) """ - includeChildrenExpenses: Boolean! = false + limit: Int! = 10 """ - Only return expenses that contains this custom data. Requires being an admin of the collective, payee or host. + The offset to use to fetch """ - customData: JSON + offset: Int! = 0 """ - Filter expenses of type charges based on presence of receipts + Filter by type of legal document """ - chargeHasReceipts: Boolean + type: [LegalDocumentType] """ - Filter expenses of type charges using these virtual cards + Filter by status of legal document """ - virtualCards: [VirtualCardReferenceInput] - ): ExpenseCollection! - settings: JSON! - conversations( - limit: Int! = 15 - offset: Int! = 0 + status: [LegalDocumentRequestStatus] """ - Only return conversations matching this tag + The order of results """ - tag: String - ): ConversationCollection! + orderBy: ChronologicalOrderInput! = { field: CREATED_AT, direction: DESC } + ): LegalDocumentCollection """ - Returns conversation's tags for collective sorted by popularity + Drafted field values that were still not persisted """ - conversationsTags(limit: Int! = 30): [TagStat] + draft: JSON """ - Returns expense tags for collective sorted by popularity + The account that requested this expense to be submitted """ - expensesTags(limit: Int! = 30): [TagStat] + requestedByAccount: Account + quote: ExpenseQuote + validateTransferRequirements( + """ + Details of the transfer + """ + details: JSON + ): [TransferWiseRequiredField] + recurringExpense: RecurringExpense """ - The list of expense types supported by this account + [Admin only] Security checks for this expense. Only available to expenses under trusted hosts. """ - supportedExpenseTypes: [ExpenseType!]! - transferwise: TransferWise + securityChecks: [SecurityCheck] """ - The list of payout methods that this collective can use to get paid. In most cases, admin only and scope: "expenses". + Custom data for this expense """ - payoutMethods: [PayoutMethod] + customData: JSON """ - The list of payment methods that this collective can use to pay for Orders. Admin or Host only. Scope: "orders". + The merchant ID for this expense """ - paymentMethods( - type: [PaymentMethodType] - enumType: [PaymentMethodType] @deprecated(reason: "2021-08-20: use type instead from now") - service: [PaymentMethodService] + merchantId: String +} - """ - Whether to include expired payment methods. Payment methods expired since more than 6 months will never be returned. - """ - includeExpired: Boolean - ): [PaymentMethod] +""" +All supported expense currency sources +""" +enum ExpenseCurrencySource { + """ + The expense currency expressed as the host currency + """ + HOST """ - The list of payment methods for this account that are pending a client confirmation (3D Secure / SCA) + The expense currency expressed as the account currency """ - paymentMethodsWithPendingConfirmation: [PaymentMethod] + ACCOUNT """ - The list of connected accounts (Stripe, Twitter, etc ...). Admin only. Scope: "connectedAccounts". + The expense currency expressed as the expense currency """ - connectedAccounts: [ConnectedAccount] + EXPENSE """ - The list of applications created by this account. Admin only. Scope: "applications". + The expense currency expressed as the expense currency """ - oAuthApplications( - """ - The number of results to fetch (default 10, max 1000) - """ - limit: Int! = 10 + CREATED_BY_ACCOUNT +} - """ - The offset to use to fetch - """ - offset: Int! = 0 - ): OAuthApplicationCollection +""" +Fields for an accounting category +""" +type AccountingCategory { + id: String! """ - The address associated to this account. This field is always public for collectives and events. + The code of the accounting category """ - location: Location - categories: [String]! - stats: AccountStats + code: String! """ - Updates published by the account. To see unpublished updates, you need to be an admin and have the scope "updates". + The technical name of the accounting category """ - updates( - """ - The number of results to fetch (default 10, max 1000) - """ - limit: Int! = 10 - - """ - The offset to use to fetch - """ - offset: Int! = 0 + name: String! - """ - Only return published updates. - """ - onlyPublishedUpdates: Boolean = false - onlyChangelogUpdates: Boolean - orderBy: UpdateChronologicalOrderInput! = { field: CREATED_AT, direction: DESC } - searchTerm: String - ): UpdateCollection! + """ + A friendly name for non-accountants (i.e. expense submitters and collective admins) + """ + friendlyName: String """ - Describes the features enabled and available for this account + Whether this category is only meant for the host admins """ - features: CollectiveFeatures! + hostOnly: Boolean! """ - Virtual Cards attached to the account. Admin only. Scope: "virtualCards". + Instructions for the expense submitters """ - virtualCards( - limit: Int! = 100 - offset: Int! = 0 - state: String = null @deprecated(reason: "2023-11-06: Please use status.") - status: [VirtualCardStatus] - merchantAccount: AccountReferenceInput = null + instructions: String - """ - Only return expenses that were created after this date - """ - dateFrom: DateTime = null + """ + The account this category belongs to + """ + account: Host! - """ - Only return expenses that were created before this date - """ - dateTo: DateTime = null - orderBy: ChronologicalOrderInput = { field: CREATED_AT, direction: DESC } - ): VirtualCardCollection + """ + If meant for expenses, the types of expenses this category applies to + """ + expensesTypes: [ExpenseType] """ - Virtual Cards Merchants used by the account. Admin only. Scope: "virtualCards". + The kind of transactions this category applies to """ - virtualCardMerchants(limit: Int! = 100, offset: Int! = 0): AccountCollection - childrenAccounts( - limit: Int! = 100 - offset: Int! = 0 - isActive: Boolean - accountType: [AccountType] - ): AccountCollection! + kind: AccountingCategoryKind """ - Policies for the account. To see non-public policies you need to be admin and have the scope: "account". + The time of creation of this accounting category """ - policies: Policies! + createdAt: DateTime! """ - List of activities that the logged-in user is subscribed for this collective + If the category is applicable to the Host or Hosted Collectives """ - activitySubscriptions(channel: ActivityChannel): [ActivitySubscription] + appliesTo: AccountingCategoryAppliesTo! +} + +""" +This represents an Host account +""" +type Host implements Account & AccountWithContributions { + id: String! + legacyId: Int! """ - Logged-in user permissions on an account + The slug identifying the account (ie: babel) """ - permissions: AccountPermissions! - feed( - """ - Only returns activities before this date - """ - dateTo: DateTime + slug: String! + type: AccountType! - """ - Number of activities to retrieve - """ - limit: Int + """ + Public name + """ + name: String - """ - The classes of activity types to filter for - """ - classes: [ActivityClassType] - ): [Activity] + """ + Private, legal name. Used for expense receipts, taxes, etc. Scope: "account". + """ + legalName: String + description: String + longDescription: String + tags: [String] + website: String @deprecated(reason: "2023-01-16: Please use socialLinks") + twitterHandle: String @deprecated(reason: "2023-01-16: Please use socialLinks") + githubHandle: String @deprecated(reason: "2022-06-03: Please use repositoryUrl") + repositoryUrl: String @deprecated(reason: "2023-01-16: Please use socialLinks") + socialLinks: [SocialLink!]! """ - If created by duplication, the account from which this one was duplicated + The currency of the account """ - duplicatedFromAccount: Account + currency: Currency! + expensePolicy: String """ - If this account was duplicated, the accounts that were created from it + Defines if the contributors wants to be incognito (name not displayed) """ - duplicatedAccounts(limit: Int! = 100, offset: Int! = 0): AccountCollection! - webhooks( - """ - The number of results to fetch (default 10, max 1000) - """ - limit: Int! = 10 - - """ - The offset to use to fetch - """ - offset: Int! = 0 - account: AccountReferenceInput! - ): WebhookCollection! + isIncognito: Boolean! + imageUrl(height: Int, format: ImageFormat): String + backgroundImageUrl(height: Int, format: ImageFormat): String """ - Number of unique financial contributors. + The time of creation """ - totalFinancialContributors( - """ - Type of account (COLLECTIVE/EVENT/ORGANIZATION/INDIVIDUAL) - """ - accountType: AccountType - ): Int! - tiers( - """ - The number of results to fetch - """ - limit: Int! = 100 - - """ - The offset to use to fetch - """ - offset: Int! = 0 - ): TierCollection! + createdAt: DateTime + updatedAt: DateTime """ - All the persons and entities that contribute to this account + Returns whether this account is archived """ - contributors( - """ - The number of results to fetch (default 10, max 1000) - """ - limit: Int! = 10 - - """ - The offset to use to fetch - """ - offset: Int! = 0 - roles: [MemberRole] - ): ContributorCollection! + isArchived: Boolean! """ - How much platform fees are charged for this account + Whether this account is frozen """ - platformFeePercent: Float! + isFrozen: Boolean! """ - Returns true if a custom contribution to Open Collective can be submitted for contributions made to this account + Returns whether the account accepts financial contributions. """ - platformContributionAvailable: Boolean! - contributionPolicy: String + isActive: Boolean """ - Returns true if the remote user can start the process to resume contributions for account + Returns whether the account is setup to Host collectives. """ - canStartResumeContributionsProcess: Boolean! + isHost: Boolean! """ - Returns true if the account has started the process to resume contributions + Returns true if the remote user is an admin of this account """ - hasResumeContributionsProcessStarted: Boolean! + isAdmin: Boolean! + parentAccount: Account @deprecated(reason: "2022-12-16: use parent on AccountWithParent instead") """ - List of accounting categories for this host + Get all members (admins, members, backers, followers) """ - accountingCategories( + members( + limit: Int! = 100 + offset: Int! = 0 + role: [MemberRole] + accountType: [AccountType] + """ - Filter accounting categories by kind + Admin only. To filter on the email address of a member, useful to check if a member exists. """ - kind: [AccountingCategoryKind!] - ): AccountingCategoryCollection! - hostFeePercent: Float - totalHostedCollectives: Int @deprecated(reason: "2023-03-20: Renamed to totalHostedAccounts") - totalHostedAccounts: Int - isOpenToApplications: Boolean - termsUrl: URL - plan: HostPlan! - hostTransactionsReports(timeUnit: TimeUnit = MONTH, dateFrom: DateTime, dateTo: DateTime): HostTransactionReports - transactionsReport(dateFrom: DateTime, dateTo: DateTime): [TransactionSum] - hostMetrics( + email: EmailAddress + """ - A collection of accounts for which the metrics should be returned. + Order of the results """ - account: [AccountReferenceInput!] + orderBy: ChronologicalOrderInput! = { field: CREATED_AT, direction: ASC } + includeInherited: Boolean = true + ): MemberCollection! + """ + [AUTHENTICATED] Returns the pending invitations + """ + memberInvitations( """ - The start date of the time series + A reference to an account (usually Individual). Will return invitations sent to the account to join as a member """ - dateFrom: DateTime + memberAccount: AccountReferenceInput """ - The end date of the time series + A reference to an account (usually Collective, Fund or Organization). Will return invitations sent to join this account as a member. """ - dateTo: DateTime - ): HostMetrics! - hostMetricsTimeSeries( + account: AccountReferenceInput + """ - A collection of accounts for which the metrics should be returned. + An array of Member roles to filter for """ - account: [AccountReferenceInput!] + role: [MemberRole] + ): [MemberInvitation] + """ + The legal documents associated with this account + """ + legalDocuments( """ - The start date of the time series + Filter by type """ - dateFrom: DateTime + type: [LegalDocumentType] + ): [LegalDocument] + memberOf( + limit: Int! = 150 + offset: Int! = 0 + role: [MemberRole] + accountType: [AccountType] + account: AccountReferenceInput """ - The end date of the time series + Filter on whether the account is a host or not """ - dateTo: DateTime + isHostAccount: Boolean """ - The time unit of the time series (such as MONTH, YEAR, WEEK etc). If no value is provided this is calculated using the dateFrom and dateTo values. + Filter on (un)approved collectives """ - timeUnit: TimeUnit - ): HostMetricsTimeSeries! - - """ - The list of payment methods (Stripe, Paypal, manual bank transfer, etc ...) the Host can accept for its Collectives - """ - supportedPaymentMethods: [PaymentMethodLegacyType] - bankAccount: PayoutMethod - - """ - Paypal preapproval info. Returns null if PayPal account is not connected. - """ - paypalPreApproval: PaymentMethod - - """ - If the host supports PayPal, this will contain the client ID to use in the frontend - """ - paypalClientId: String - - """ - The list of payout methods this Host accepts for its expenses - """ - supportedPayoutMethods: [PayoutMethodType] - - """ - Stripe connected account - """ - stripe: StripeConnectedAccount + isApproved: Boolean - """ - Applications for this host - """ - hostApplications( """ - The number of results to fetch (default 10, max 1000) + Filter on archived collectives """ - limit: Int! = 10 + isArchived: Boolean """ - The offset to use to fetch + Whether incognito profiles should be included in the result. Only works if requesting user is an admin of the account. """ - offset: Int! = 0 + includeIncognito: Boolean = true """ - Search term for collective tags, id, name, slug and description. + A term to search membership. Searches in collective tags, name, slug, members description and role. """ searchTerm: String + """ + Filters on the Host fees structure applied to this account + """ + hostFeesStructure: HostFeeStructure + """ Order of the results """ - orderBy: ChronologicalOrderInput! = { field: CREATED_AT, direction: DESC } + orderBy: OrderByInput! = { field: CREATED_AT, direction: DESC } """ - Filter applications by status + Order the query by requested role order """ - status: HostApplicationStatus - ): HostApplicationCollection! + orderByRoles: Boolean + ): MemberOfCollection! """ - Pending applications for this host + Returns the emails of the account. Individuals only have one, but organizations can have multiple emails. """ - pendingApplications( + emails: [EmailAddress!] + transactions( """ The number of results to fetch (default 10, max 1000) """ - limit: Int! = 10 + limit: Int! = 100 """ The offset to use to fetch @@ -2676,242 +2752,164 @@ type Host implements Account & AccountWithContributions { offset: Int! = 0 """ - A term to search membership. Searches in collective tags, name, slug, members description and role. - """ - searchTerm: String - - """ - Order of the results - """ - orderBy: ChronologicalOrderInput! = { field: CREATED_AT, direction: DESC } - ): HostApplicationCollection! - @deprecated(reason: "2023-08-25: Deprecated in favour of host.hostApplications(status: PENDING).") - hostedVirtualCards( - """ - Search term (card name, card last four digits) + The transaction type (DEBIT or CREDIT) """ - searchTerm: String - limit: Int! = 100 - offset: Int! = 0 - state: String = null @deprecated(reason: "2023-06-12: Please use status.") - status: [VirtualCardStatus] - orderBy: ChronologicalOrderInput = { field: CREATED_AT, direction: DESC } - merchantAccount: AccountReferenceInput = null - collectiveAccountIds: [AccountReferenceInput] = null + type: TransactionType """ - Returns virtual cards with expenses from this date. + The payment method types. Can include `null` for transactions without a payment method """ - withExpensesDateFrom: DateTime + paymentMethodType: [PaymentMethodType] """ - Returns virtual cards with expenses to this date. + The payment method services. """ - withExpensesDateTo: DateTime + paymentMethodService: [PaymentMethodService] """ - Filter virtual cards with at least this amount in cents charged + Reference of the account(s) assigned to the main side of the transaction you want to EXCLUDE from the results """ - spentAmountFrom: AmountInput + excludeAccount: [AccountReferenceInput] """ - Filter virtual cards with up to this amount in cents charged + Reference of the account assigned to the other side of the transaction (CREDIT -> sender, DEBIT -> recipient). Avoid, favor account instead. """ - spentAmountTo: AmountInput + fromAccount: AccountReferenceInput """ - Filter virtual cards by whether they are missing receipts for any charges - """ - hasMissingReceipts: Boolean - ): VirtualCardCollection! - hostedVirtualCardMerchants(limit: Int! = 100, offset: Int! = 0): AccountCollection! - hostedVirtualCardCollectives(limit: Int! = 100, offset: Int! = 0): AccountCollection! - contributionStats( - """ - A collection of accounts for which the contribution stats should be returned. + Reference of the host accounting the transaction """ - account: [AccountReferenceInput!] + host: AccountReferenceInput """ - Calculate contribution statistics beginning from this date. + NOT IMPLEMENTED. Only return transactions that match these tags. """ - dateFrom: DateTime + tags: [String] @deprecated(reason: "2020-08-09: Was never implemented.") """ - Calculate contribution statistics until this date. + The order of results """ - dateTo: DateTime + orderBy: ChronologicalOrderInput! = { field: CREATED_AT, direction: DESC } """ - The time unit of the time series + Only return transactions where the amount is greater than or equal to this value (in cents) """ - timeUnit: TimeUnit - ): ContributionStats! - expenseStats( + minAmount: Int @deprecated(reason: "2020-08-09: GraphQL v2 should not expose amounts as integer.") + """ - A collection of accounts for which the expense stats should be returned. + Only return transactions where the amount is lower than or equal to this value (in cents) """ - account: [AccountReferenceInput!] + maxAmount: Int @deprecated(reason: "2020-08-09: GraphQL v2 should not expose amounts as integer.") """ - Calculate expense statistics beginning from this date. + Only return transactions that were created after this date """ dateFrom: DateTime """ - Calculate expense statistics until this date. + Only return transactions that were created before this date """ dateTo: DateTime """ - The time unit of the time series (such as MONTH, YEAR, WEEK etc). If no value is provided this is calculated using the dateFrom and dateTo values. - """ - timeUnit: TimeUnit - ): ExpenseStats! - - """ - Returns whether the host is trusted or not - """ - isTrustedHost: Boolean! - - """ - Returns whether the host has any Stripe disputed orders - """ - hasDisputedOrders: Boolean - - """ - Returns whether the host has any Stripe in review orders - """ - hasInReviewOrders: Boolean - - """ - Returns agreements with Hosted Accounts - """ - hostedAccountAgreements( - """ - The number of results to fetch (default 10, max 1000) + Only return transactions that were cleared after this date """ - limit: Int! = 10 + clearedFrom: DateTime """ - The offset to use to fetch + Only return transactions that were cleared before this date """ - offset: Int! = 0 + clearedTo: DateTime """ - Filter by accounts participating in the agreement + The term to search """ - accounts: [AccountReferenceInput] - ): AgreementCollection! + searchTerm: String - """ - Returns a list of vendors that works with this host - """ - vendors( """ - The number of results to fetch (default 10, max 1000) + Only return transactions with an Expense attached """ - limit: Int! = 100 + hasExpense: Boolean """ - The offset to use to fetch + Only return transactions with this Expense attached """ - offset: Int! = 0 + expense: ExpenseReferenceInput """ - Rank vendors based on their relationship with this account + Only return transactions that have an Expense of one of these expense types attached """ - forAccount: AccountReferenceInput + expenseType: [ExpenseType] """ - Filter on archived vendors + Only return transactions with an Order attached """ - isArchived: Boolean + hasOrder: Boolean """ - Search vendors related to this term based on name, description, tags, slug, and location + Only return transactions for this order. """ - searchTerm: String - ): VendorCollection! + order: OrderReferenceInput - """ - Returns a list of organizations that only transacted with this host and all its admins are also admins of this host. - """ - potentialVendors( """ - The number of results to fetch (default 10, max 1000) + Used when filtering with the `host` argument to determine whether to include transactions on the fiscal host account (and children) """ - limit: Int! = 100 + includeHost: Boolean! = true """ - The offset to use to fetch + Whether to include regular transactions from the account (turn false if you only want Incognito or Gift Card transactions) """ - offset: Int! = 0 - ): AccountCollection! + includeRegularTransactions: Boolean! = true - """ - Returns a list of accounts hosted by this host - """ - hostedAccounts( """ - The number of results to fetch (default 10, max 1000) + If the account is a user and this field is true, contributions from the incognito profile will be included too (admins only) """ - limit: Int! = 100 + includeIncognitoTransactions: Boolean! = false """ - The offset to use to fetch + Whether to include transactions from children (Events and Projects) """ - offset: Int! = 0 - accountType: [AccountType] + includeChildrenTransactions: Boolean! = false """ - Filter on (un)approved collectives + Whether to include transactions from Gift Cards issued by the account. """ - isApproved: Boolean = true + includeGiftCardTransactions: Boolean! = false """ - Filter on frozen accounts + Whether to include debt transactions """ - isFrozen: Boolean + includeDebts: Boolean! = false """ - Filter on unhosted accounts + To filter by transaction kind """ - isUnhosted: Boolean = false + kind: [TransactionKind] """ - Filters on the Host fees structure applied to this account + The transactions group to filter by """ - hostFeesStructure: HostFeeStructure + group: [String] + virtualCard: [VirtualCardReferenceInput] """ - A term to search membership. Searches in collective tags, name, slug, members description and role. + Only return transactions that are refunds (or not refunds if false) """ - searchTerm: String + isRefund: Boolean """ - Order of the results + Only return transactions that are associated with these external merchant IDs """ - orderBy: OrderByInput - ): AccountCollection! -} + merchantId: [String] -""" -An account that can receive financial contributions -""" -interface AccountWithContributions { - """ - Number of unique financial contributors. - """ - totalFinancialContributors( """ - Type of account (COLLECTIVE/EVENT/ORGANIZATION/INDIVIDUAL) + Only return transactions that are associated with these accounting categories """ - accountType: AccountType - ): Int! - tiers( + accountingCategory: [String] + ): TransactionCollection! + orders( """ - The number of results to fetch + The number of results to fetch (default 10, max 1000) """ limit: Int! = 100 @@ -2919,1143 +2917,1517 @@ interface AccountWithContributions { The offset to use to fetch """ offset: Int! = 0 - ): TierCollection! - """ - All the persons and entities that contribute to this account - """ - contributors( """ - The number of results to fetch (default 10, max 1000) + If account is a host, also include hosted accounts orders """ - limit: Int! = 10 + includeHostedAccounts: Boolean """ - The offset to use to fetch + Include orders from children events/projects """ - offset: Int! = 0 - roles: [MemberRole] - ): ContributorCollection! - - """ - How much platform fees are charged for this account - """ - platformFeePercent: Float! - - """ - Returns true if a custom contribution to Open Collective can be submitted for contributions made to this account - """ - platformContributionAvailable: Boolean! - contributionPolicy: String - - """ - Returns true if the remote user can start the process to resume contributions for account - """ - canStartResumeContributionsProcess: Boolean! - - """ - Returns true if the account has started the process to resume contributions - """ - hasResumeContributionsProcessStarted: Boolean! -} - -""" -A collection of "Tiers" -""" -type TierCollection implements Collection { - offset: Int - limit: Int - totalCount: Int - nodes: [Tier] -} - -""" -A collection of "Contributor" -""" -type ContributorCollection implements Collection { - offset: Int - limit: Int - totalCount: Int - nodes: [Contributor] -} - -"\n A person or an entity that contributes financially or by any other mean to the mission\n of the collective. While \"Member\" is dedicated to permissions, this type is meant\n to surface all the public contributors.\n " -type Contributor { - """ - A unique identifier for this member - """ - id: String! - - """ - Name of the contributor - """ - name: String! - - """ - All the roles for a given contributor - """ - roles: [MemberRole] - - """ - True if the contributor is a collective admin - """ - isAdmin: Boolean! - - """ - True if the contributor is a core contributor - """ - isCore: Boolean! - - """ - True if the contributor is a financial contributor - """ - isBacker: Boolean! + includeChildrenAccounts: Boolean! = false - """ - Member join date - """ - since: DateTime! + """ + Only return orders that were paused by these roles. status must be set to PAUSED. + """ + pausedBy: [OrderPausedBy] - """ - How much money the user has contributed for this (in cents, using collective currency) - """ - totalAmountDonated: Int! + """ + Only return orders that were paid with this payment method. Must be an admin of the account owning the payment method. + """ + paymentMethod: PaymentMethodReferenceInput - """ - Whether the contributor is an individual, an organization... - """ - type: String! + """ + Only return orders that match these payment method services + """ + paymentMethodService: [PaymentMethodService] - """ - Defines if the contributors wants to be incognito (name not displayed) - """ - isIncognito: Boolean! + """ + Only return orders that match these payment method types + """ + paymentMethodType: [PaymentMethodType] - """ - Description of how the member contribute. Will usually be a tier name, or "design" or "code". - """ - description: String + """ + Whether to include incognito orders. Must be admin or root. Only with filter null or OUTGOING. + """ + includeIncognito: Boolean = false - """ - If the contributor has a page on Open Collective, this is the slug to link to it - """ - collectiveSlug: String + """ + Account orders filter (INCOMING or OUTGOING) + """ + filter: AccountOrdersFilter - """ - Contributor avatar or logo - """ - image(height: Int, format: ImageFormat): String + """ + Use this field to filter orders on their frequency (ONETIME, MONTHLY or YEARLY) + """ + frequency: ContributionFrequency - """ - A public message from contributors to describe their contributions - """ - publicMessage: String -} + """ + Use this field to filter orders on their statuses + """ + status: [OrderStatus] -input AccountReferenceInput { - """ - The public id identifying the account (ie: dgm9bnk8-0437xqry-ejpvzeol-jdayw5re) - """ - id: String + """ + The order of results + """ + orderBy: ChronologicalOrderInput! = { field: CREATED_AT, direction: DESC } - """ - The internal id of the account (ie: 580) - """ - legacyId: Int @deprecated(reason: "2020-01-01: should only be used during the transition to GraphQL API v2.") + """ + Only return orders where the amount is greater than or equal to this value (in cents) + """ + minAmount: Int - """ - The slug identifying the account (ie: babel for https://opencollective.com/babel) - """ - slug: String -} + """ + Only return orders where the amount is lower than or equal to this value (in cents) + """ + maxAmount: Int -""" -A legal document (e.g. W9, W8BEN, W8BEN-E) -""" -type LegalDocument { - """ - Unique identifier for this legal document - """ - id: String! + """ + Only return orders that were created after this date + """ + dateFrom: DateTime - """ - The year this legal document is for - """ - year: Int! + """ + Only return orders that were created before this date + """ + dateTo: DateTime - """ - The type of legal document - """ - type: LegalDocumentType! + """ + Only return pending orders that were expected after this date + """ + expectedDateFrom: DateTime - """ - The status of the request for this legal document - """ - status: LegalDocumentRequestStatus! + """ + Only return pending orders that were expected before this date + """ + expectedDateTo: DateTime - """ - The service that provided this legal document - """ - service: LegalDocumentService! + """ + The term to search + """ + searchTerm: String + tierSlug: String @deprecated(reason: "2022-02-25: Should be replaced by a tier reference. Not existing yet.") - """ - The date and time the request for this legal document was created - """ - requestedAt: DateTime! + """ + Only returns orders that have a subscription (monthly/yearly). Don't use together with frequency. + """ + onlySubscriptions: Boolean - """ - The date and time this legal document was last updated - """ - updatedAt: DateTime! + """ + Same as onlySubscriptions, but returns only orders with active subscriptions + """ + onlyActiveSubscriptions: Boolean + expectedFundsFilter: ExpectedFundsFilter - """ - The account this legal document is for - """ - account: Account! + """ + Return only orders made from/to that opposite account (only works when orders are already filtered with a main account) + """ + oppositeAccount: AccountReferenceInput + ): OrderCollection! + expenses( + direction: ExpenseDirection - """ - URL to download the file. Must be logged in as an account admin. The returned URL will be protected by authentication + 2FA. - """ - documentLink: URL -} + """ + The number of results to fetch (default 10, max 1000) + """ + limit: Int! = 10 -""" -Type for a required legal document -""" -enum LegalDocumentType { - """ - US tax form (W9, W8BEN, W8BEN-E) - """ - US_TAX_FORM -} + """ + The offset to use to fetch + """ + offset: Int! = 0 -""" -Status for a legal document -""" -enum LegalDocumentRequestStatus { - NOT_REQUESTED - REQUESTED - RECEIVED - ERROR -} + """ + Reference of an account that is the payee of an expense + """ + fromAccount: AccountReferenceInput -""" -Type for a required legal document -""" -enum LegalDocumentService { - DROPBOX_FORMS - OPENCOLLECTIVE -} + """ + Reference of an account that is the payer of an expense + """ + account: AccountReferenceInput -""" -A collection of "MemberOf" (ie: Collective backed by an Organization) -""" -type MemberOfCollection implements Collection { - offset: Int - limit: Int - totalCount: Int - nodes: [MemberOf] - roles: [MemberOfCollectionRoles] -} + """ + Return expenses only for this host + """ + host: AccountReferenceInput -""" -An existing member role and account type combination used used to filter collections -""" -type MemberOfCollectionRoles { - type: AccountType! - role: MemberRole! -} + """ + Return expenses only created by this INDIVIDUAL account + """ + createdByAccount: AccountReferenceInput -""" -All supported expense types -""" -enum HostFeeStructure { - """ - Use global host fees - """ - DEFAULT + """ + Use this field to filter expenses on their statuses + """ + status: [ExpenseStatusFilter] - """ - Custom fee for this Collective only - """ - CUSTOM_FEE + """ + Use this field to filter expenses on their type (RECEIPT/INVOICE) + """ + type: ExpenseType + types: [ExpenseType] - """ - Set a monthly retainer for this Collective - """ - MONTHLY_RETAINER -} + """ + Only expenses that match these tags + """ + tags: [String] @deprecated(reason: "2020-06-30: Please use tag (singular)") -""" -Input to order results -""" -input OrderByInput { - """ - Field to order by. - """ - field: OrderByFieldType! + """ + Only expenses that match these tags + """ + tag: [String] - """ - Ordering direction. - """ - direction: OrderDirection! -} + """ + The order of results + """ + orderBy: ChronologicalOrderInput! = { field: CREATED_AT, direction: DESC } -""" -Possible fields you can use to order by -""" -enum OrderByFieldType { - CREATED_AT - MEMBER_COUNT - TOTAL_CONTRIBUTED + """ + Only return expenses where the amount is greater than or equal to this value (in cents) + """ + minAmount: Int - """ - The financial activity of the collective (number of transactions) - """ - ACTIVITY - RANK -} + """ + Only return expenses where the amount is lower than or equal to this value (in cents) + """ + maxAmount: Int -""" -A collection of Transactions (Debit or Credit) -""" -type TransactionCollection implements Collection { - offset: Int - limit: Int - totalCount: Int - nodes: [Transaction] - kinds: [TransactionKind] + """ + Only return expenses that use the given type as payout method + """ + payoutMethodType: PayoutMethodType - """ - The types of payment methods used in this collection, regardless of the pagination - """ - paymentMethodTypes: [PaymentMethodType]! -} + """ + Only return expenses that were created after this date + """ + dateFrom: DateTime -enum PaymentMethodType { - alipay @deprecated(reason: "Please use uppercase values") - creditcard @deprecated(reason: "Please use uppercase values") - prepaid @deprecated(reason: "Please use uppercase values") - payment @deprecated(reason: "Please use uppercase values") - subscription @deprecated(reason: "Please use uppercase values") - collective @deprecated(reason: "Please use uppercase values") - host @deprecated(reason: "Please use uppercase values") - adaptive @deprecated(reason: "Please use uppercase values") - giftcard @deprecated(reason: "Please use uppercase values") - manual @deprecated(reason: "Please use uppercase values") - crypto @deprecated(reason: "Please use uppercase values") - paymentintent @deprecated(reason: "Please use uppercase values") - us_bank_account @deprecated(reason: "Please use uppercase values") - sepa_debit @deprecated(reason: "Please use uppercase values") - bacs_debit @deprecated(reason: "Please use uppercase values") - bancontact @deprecated(reason: "Please use uppercase values") - link @deprecated(reason: "Please use uppercase values") - bank_transfer @deprecated(reason: "Please use uppercase values") - payout @deprecated(reason: "Please use uppercase values") - virtual_card @deprecated(reason: "Please use uppercase values") - ALIPAY - CREDITCARD - PREPAID - PAYMENT - SUBSCRIPTION - COLLECTIVE - HOST - ADAPTIVE - GIFTCARD - MANUAL - CRYPTO - PAYMENT_INTENT - US_BANK_ACCOUNT - SEPA_DEBIT - BACS_DEBIT - BANCONTACT - LINK - BANK_TRANSFER - PAYOUT - VIRTUAL_CARD -} + """ + Only return expenses that were created after this date + """ + dateTo: DateTime -enum PaymentMethodService { - PAYPAL - STRIPE - OPENCOLLECTIVE - PREPAID - THEGIVINGBLOCK - WISE -} + """ + The term to search + """ + searchTerm: String -input ExpenseReferenceInput { - """ - The public id identifying the expense (ie: dgm9bnk8-0437xqry-ejpvzeol-jdayw5re) - """ - id: String + """ + Whether to include expenses from children of the account (Events and Projects) + """ + includeChildrenExpenses: Boolean! = false - """ - The internal id of the expense (ie: 580) - """ - legacyId: Int -} + """ + Only return expenses that contains this custom data. Requires being an admin of the collective, payee or host. + """ + customData: JSON -""" -All supported expense types -""" -enum ExpenseType { - """ - Invoice: Charge for your time or get paid in advance. - """ - INVOICE + """ + Filter expenses of type charges based on presence of receipts + """ + chargeHasReceipts: Boolean - """ - Receipt: Get paid back for a purchase already made. - """ - RECEIPT + """ + Filter expenses of type charges using these virtual cards + """ + virtualCards: [VirtualCardReferenceInput] - """ - Funding Request: Request funding for a project or initiative. - """ - FUNDING_REQUEST + """ + Filter expenses by the last user-role who replied to them + """ + lastCommentBy: [LastCommentBy] - """ - Grant: Request funding for a project or initiative. - """ - GRANT + """ + Only return expenses that match these accounting categories + """ + accountingCategory: [String] + ): ExpenseCollection! + settings: JSON! + conversations( + limit: Int! = 15 + offset: Int! = 0 - """ - Unclassified expense - """ - UNCLASSIFIED + """ + Only return conversations matching this tag + """ + tag: String + ): ConversationCollection! """ - Credit Card Charge: Payment done using an issued (virtual) credit card issued by your Fiscal Host. + Returns conversation's tags for collective sorted by popularity """ - CHARGE + conversationsTags(limit: Int! = 30): [TagStat] """ - Settlement: expense generated by Open Collective to collect money owed by Fiscal Hosts. + Returns expense tags for collective sorted by popularity """ - SETTLEMENT -} + expensesTags(limit: Int! = 30): [TagStat] -input OrderReferenceInput { """ - The public id identifying the order (ie: dgm9bnk8-0437xqry-ejpvzeol-jdayw5re) + The list of expense types supported by this account """ - id: String + supportedExpenseTypes: [ExpenseType!]! + transferwise: TransferWise """ - The legacy public id identifying the order (ie: 4242) + The list of payout methods that this collective can use to get paid. In most cases, admin only and scope: "expenses". """ - legacyId: Int -} - -input VirtualCardReferenceInput { - id: String -} + payoutMethods: [PayoutMethod] -input PaymentMethodReferenceInput { """ - The id assigned to the payment method + The list of payment methods that this collective can use to pay for Orders. Admin or Host only. Scope: "orders". """ - id: String -} - -""" -Account orders filter (INCOMING or OUTGOING) -""" -enum AccountOrdersFilter { - INCOMING - OUTGOING -} - -""" -A collection of "Expenses" -""" -type ExpenseCollection implements Collection { - offset: Int - limit: Int - totalCount: Int - nodes: [Expense] - totalAmount: ExpenseCollectionTotalAmount -} + paymentMethods( + type: [PaymentMethodType] + enumType: [PaymentMethodType] @deprecated(reason: "2021-08-20: use type instead from now") + service: [PaymentMethodService] -type ExpenseCollectionTotalAmount { - amount(currency: Currency = USD): Amount - amountsByCurrency: [Amount] -} + """ + Whether to include expired payment methods. Payment methods expired since more than 6 months will never be returned. + """ + includeExpired: Boolean + ): [PaymentMethod] -""" -All supported currencies -""" -enum Currency { """ - US Dollar + The list of payment methods for this account that are pending a client confirmation (3D Secure / SCA) """ - USD + paymentMethodsWithPendingConfirmation: [PaymentMethod] """ - UAE Dirham + The list of connected accounts (Stripe, Twitter, etc ...). Admin only. Scope: "connectedAccounts". """ - AED + connectedAccounts: [ConnectedAccount] """ - Afghani + The list of applications created by this account. Admin only. Scope: "applications". """ - AFN + oAuthApplications( + """ + The number of results to fetch (default 10, max 1000) + """ + limit: Int! = 10 + + """ + The offset to use to fetch + """ + offset: Int! = 0 + ): OAuthApplicationCollection """ - Lek + The address associated to this account. This field is always public for collectives and events. """ - ALL + location: Location + categories: [String]! + stats: AccountStats """ - Armenian Dram + Whether this account can have changelog updates """ - AMD + canHaveChangelogUpdates: Boolean! """ - Netherlands Antillean Guilder + Updates published by the account. To see unpublished updates, you need to be an admin and have the scope "updates". """ - ANG + updates( + """ + The number of results to fetch (default 10, max 1000) + """ + limit: Int! = 10 - """ - Kwanza - """ - AOA + """ + The offset to use to fetch + """ + offset: Int! = 0 - """ - Argentine Peso - """ - ARS + """ + Only return published updates. + """ + onlyPublishedUpdates: Boolean = false + isDraft: Boolean + onlyChangelogUpdates: Boolean + orderBy: UpdateChronologicalOrderInput! = { field: CREATED_AT, direction: DESC } + searchTerm: String + ): UpdateCollection! """ - Australian Dollar + Describes the features enabled and available for this account """ - AUD + features: CollectiveFeatures! """ - Aruban Florin + Virtual Cards attached to the account. Admin only. Scope: "virtualCards". """ - AWG + virtualCards( + limit: Int! = 100 + offset: Int! = 0 + state: String = null @deprecated(reason: "2023-11-06: Please use status.") + status: [VirtualCardStatus] + merchantAccount: AccountReferenceInput = null - """ - Azerbaijanian Manat - """ - AZN + """ + Only return expenses that were created after this date + """ + dateFrom: DateTime = null + + """ + Only return expenses that were created before this date + """ + dateTo: DateTime = null + orderBy: ChronologicalOrderInput = { field: CREATED_AT, direction: DESC } + ): VirtualCardCollection """ - Convertible Mark + Virtual Cards Merchants used by the account. Admin only. Scope: "virtualCards". """ - BAM + virtualCardMerchants(limit: Int! = 100, offset: Int! = 0): AccountCollection + childrenAccounts( + limit: Int! = 100 + offset: Int! = 0 + isActive: Boolean + accountType: [AccountType] + searchTerm: String + ): AccountCollection! """ - Barbados Dollar + Policies for the account. To see non-public policies you need to be admin and have the scope: "account". """ - BBD + policies: Policies! """ - Taka + List of activities that the logged-in user is subscribed for this collective """ - BDT + activitySubscriptions(channel: ActivityChannel): [ActivitySubscription] """ - Bulgarian Lev + Logged-in user permissions on an account """ - BGN + permissions: AccountPermissions! """ - Burundi Franc + Host application requests """ - BIF + hostApplicationRequests( + """ + The number of results to fetch (default 10, max 1000) + """ + limit: Int! = 10 + + """ + The offset to use to fetch + """ + offset: Int! = 0 + + """ + Order of the results + """ + orderBy: ChronologicalOrderInput! = { field: CREATED_AT, direction: DESC } + + """ + Filter applications by status + """ + status: HostApplicationStatus + ): HostApplicationCollection! + feed( + """ + Only returns activities before this date + """ + dateTo: DateTime + + """ + Number of activities to retrieve + """ + limit: Int + + """ + The classes of activity types to filter for + """ + classes: [ActivityClassType] + ): [Activity] """ - Bermudian Dollar + If created by duplication, the account from which this one was duplicated """ - BMD + duplicatedFromAccount: Account """ - Brunei Dollar + If this account was duplicated, the accounts that were created from it """ - BND + duplicatedAccounts(limit: Int! = 100, offset: Int! = 0): AccountCollection! """ - Boliviano + EXPERIMENTAL (this may change or be removed) """ - BOB + transactionReports(timeUnit: TimeUnit = MONTH, dateFrom: DateTime, dateTo: DateTime): TransactionReports + webhooks( + """ + The number of results to fetch (default 10, max 1000) + """ + limit: Int! = 10 + + """ + The offset to use to fetch + """ + offset: Int! = 0 + account: AccountReferenceInput! + ): WebhookCollection! """ - Brazilian Real + Number of unique financial contributors. """ - BRL + totalFinancialContributors( + """ + Type of account (COLLECTIVE/EVENT/ORGANIZATION/INDIVIDUAL) + """ + accountType: AccountType + ): Int! + tiers( + """ + The number of results to fetch + """ + limit: Int! = 100 + + """ + The offset to use to fetch + """ + offset: Int! = 0 + ): TierCollection! """ - Bahamian Dollar + All the persons and entities that contribute to this account """ - BSD + contributors( + """ + The number of results to fetch (default 10, max 1000) + """ + limit: Int! = 10 + + """ + The offset to use to fetch + """ + offset: Int! = 0 + roles: [MemberRole] + ): ContributorCollection! """ - Pula + How much platform fees are charged for this account """ - BWP + platformFeePercent: Float! """ - Belarussian Ruble + Returns true if a custom contribution to Open Collective can be submitted for contributions made to this account """ - BYN + platformContributionAvailable: Boolean! + contributionPolicy: String """ - Belize Dollar + Returns true if the remote user can start the process to resume contributions for account """ - BZD + canStartResumeContributionsProcess: Boolean! """ - Canadian Dollar + Returns true if the account has started the process to resume contributions """ - CAD + hasResumeContributionsProcessStarted: Boolean! """ - Congolese Franc + List of accounting categories for this host """ - CDF + accountingCategories( + """ + Filter accounting categories by kind + """ + kind: [AccountingCategoryKind!] + + """ + Filter by accounting category applicable to this account + """ + account: AccountReferenceInput + ): AccountingCategoryCollection! + hostFeePercent: Float + totalHostedCollectives: Int @deprecated(reason: "2023-03-20: Renamed to totalHostedAccounts") + totalHostedAccounts: Int + isOpenToApplications: Boolean + termsUrl: URL + plan: HostPlan! """ - Swiss Franc + EXPERIMENTAL (this may change or be removed) """ - CHF + hostTransactionsReports(timeUnit: TimeUnit = MONTH, dateFrom: DateTime, dateTo: DateTime): HostTransactionReports + hostMetrics( + """ + A collection of accounts for which the metrics should be returned. + """ + account: [AccountReferenceInput!] + + """ + The start date of the time series + """ + dateFrom: DateTime + + """ + The end date of the time series + """ + dateTo: DateTime + ): HostMetrics! + hostMetricsTimeSeries( + """ + A collection of accounts for which the metrics should be returned. + """ + account: [AccountReferenceInput!] + + """ + The start date of the time series + """ + dateFrom: DateTime + + """ + The end date of the time series + """ + dateTo: DateTime + + """ + The time unit of the time series (such as MONTH, YEAR, WEEK etc). If no value is provided this is calculated using the dateFrom and dateTo values. + """ + timeUnit: TimeUnit + ): HostMetricsTimeSeries! """ - Chilean Peso + EXPERIMENTAL (this may change or be removed) """ - CLP + hostExpensesReport(timeUnit: TimeUnit = MONTH, dateFrom: DateTime, dateTo: DateTime): HostExpensesReports """ - Yuan Renminbi + The list of payment methods (Stripe, Paypal, manual bank transfer, etc ...) the Host can accept for its Collectives """ - CNY + supportedPaymentMethods: [PaymentMethodLegacyType] + bankAccount: PayoutMethod """ - Colombian Peso + Paypal preapproval info. Returns null if PayPal account is not connected. """ - COP + paypalPreApproval: PaymentMethod """ - Costa Rican Colon + If the host supports PayPal, this will contain the client ID to use in the frontend """ - CRC + paypalClientId: String """ - Cabo Verde Escudo + The list of payout methods this Host accepts for its expenses """ - CVE + supportedPayoutMethods: [PayoutMethodType] """ - Czech Koruna + Stripe connected account """ - CZK + stripe: StripeConnectedAccount """ - Djibouti Franc + Applications for this host """ - DJF + hostApplications( + """ + The number of results to fetch (default 10, max 1000) + """ + limit: Int! = 10 - """ - Danish Krone - """ - DKK + """ + The offset to use to fetch + """ + offset: Int! = 0 - """ - Dominican Peso - """ - DOP + """ + Search term for collective tags, id, name, slug and description. + """ + searchTerm: String - """ - Algerian Dinar - """ - DZD + """ + Order of the results + """ + orderBy: ChronologicalOrderInput! = { field: CREATED_AT, direction: DESC } - """ - Egyptian Pound - """ - EGP + """ + Filter applications by status + """ + status: HostApplicationStatus - """ - Ethiopian Birr - """ - ETB + """ + Filter host applications by the last user-role who replied to them + """ + lastCommentBy: [LastCommentBy] + ): HostApplicationCollection! """ - Euro + Pending applications for this host """ - EUR + pendingApplications( + """ + The number of results to fetch (default 10, max 1000) + """ + limit: Int! = 10 - """ - Fiji Dollar - """ - FJD + """ + The offset to use to fetch + """ + offset: Int! = 0 + + """ + A term to search membership. Searches in collective tags, name, slug, members description and role. + """ + searchTerm: String + + """ + Order of the results + """ + orderBy: ChronologicalOrderInput! = { field: CREATED_AT, direction: DESC } + ): HostApplicationCollection! + @deprecated(reason: "2023-08-25: Deprecated in favour of host.hostApplications(status: PENDING).") + hostedVirtualCards( + """ + Search term (card name, card last four digits) + """ + searchTerm: String + limit: Int! = 100 + offset: Int! = 0 + state: String = null @deprecated(reason: "2023-06-12: Please use status.") + status: [VirtualCardStatus] + orderBy: ChronologicalOrderInput = { field: CREATED_AT, direction: DESC } + merchantAccount: AccountReferenceInput = null + collectiveAccountIds: [AccountReferenceInput] = null + + """ + Returns virtual cards with expenses from this date. + """ + withExpensesDateFrom: DateTime + + """ + Returns virtual cards with expenses to this date. + """ + withExpensesDateTo: DateTime + + """ + Filter virtual cards with at least this amount in cents charged + """ + spentAmountFrom: AmountInput + + """ + Filter virtual cards with up to this amount in cents charged + """ + spentAmountTo: AmountInput + + """ + Filter virtual cards by whether they are missing receipts for any charges + """ + hasMissingReceipts: Boolean + ): VirtualCardCollection! + hostedVirtualCardMerchants(limit: Int! = 100, offset: Int! = 0): AccountCollection! + hostedVirtualCardCollectives(limit: Int! = 100, offset: Int! = 0): AccountCollection! + contributionStats( + """ + A collection of accounts for which the contribution stats should be returned. + """ + account: [AccountReferenceInput!] + + """ + Calculate contribution statistics beginning from this date. + """ + dateFrom: DateTime + + """ + Calculate contribution statistics until this date. + """ + dateTo: DateTime + + """ + The time unit of the time series + """ + timeUnit: TimeUnit + ): ContributionStats! + expenseStats( + """ + A collection of accounts for which the expense stats should be returned. + """ + account: [AccountReferenceInput!] + + """ + Calculate expense statistics beginning from this date. + """ + dateFrom: DateTime + + """ + Calculate expense statistics until this date. + """ + dateTo: DateTime + + """ + The time unit of the time series (such as MONTH, YEAR, WEEK etc). If no value is provided this is calculated using the dateFrom and dateTo values. + """ + timeUnit: TimeUnit + ): ExpenseStats! """ - Falkland Islands Pound + Returns whether the host is trusted or not """ - FKP + isTrustedHost: Boolean! """ - Pound Sterling + Returns whether the host has any Stripe disputed orders """ - GBP + hasDisputedOrders: Boolean """ - Lari + Returns whether the host has any Stripe in review orders """ - GEL + hasInReviewOrders: Boolean """ - Gibraltar Pound + Returns agreements with Hosted Accounts """ - GIP + hostedAccountAgreements( + """ + The number of results to fetch (default 10, max 1000) + """ + limit: Int! = 10 + + """ + The offset to use to fetch + """ + offset: Int! = 0 + + """ + Filter by accounts participating in the agreement + """ + accounts: [AccountReferenceInput] + ): AgreementCollection! """ - Dalasi + Returns a list of vendors that works with this host """ - GMD + vendors( + """ + The number of results to fetch (default 10, max 1000) + """ + limit: Int! = 100 + + """ + The offset to use to fetch + """ + offset: Int! = 0 + + """ + Rank vendors based on their relationship with this account + """ + forAccount: AccountReferenceInput + + """ + Filter on archived vendors + """ + isArchived: Boolean + + """ + Search vendors related to this term based on name, description, tags, slug, and location + """ + searchTerm: String + ): VendorCollection! """ - Guinea Franc + Returns a list of organizations that only transacted with this host and all its admins are also admins of this host. """ - GNF + potentialVendors( + """ + The number of results to fetch (default 10, max 1000) + """ + limit: Int! = 100 + + """ + The offset to use to fetch + """ + offset: Int! = 0 + ): AccountCollection! """ - Quetzal + Returns a list of accounts hosted by this host """ - GTQ + hostedAccounts( + """ + The number of results to fetch (default 10, max 1000) + """ + limit: Int! = 100 - """ - Guyana Dollar - """ - GYD + """ + The offset to use to fetch + """ + offset: Int! = 0 + accountType: [AccountType] - """ - Hong Kong Dollar - """ - HKD + """ + Filter on (un)approved collectives + """ + isApproved: Boolean = true - """ - Lempira - """ - HNL + """ + Filter on frozen accounts + """ + isFrozen: Boolean - """ - Kuna - """ - HRK + """ + Filter on unhosted accounts + """ + isUnhosted: Boolean = false - """ - Gourde - """ - HTG + """ + Filters on the Host fees structure applied to this account + """ + hostFeesStructure: HostFeeStructure - """ - Forint - """ - HUF + """ + A term to search membership. Searches in collective tags, name, slug, members description and role. + """ + searchTerm: String - """ - Rupiah - """ - IDR + """ + Order of the results + """ + orderBy: OrderByInput - """ - New Israeli Sheqel - """ - ILS + """ + Filter by the balance of the account + """ + balance: AmountRangeInput - """ - Indian Rupee - """ - INR + """ + Filter by the balance of the account and its children accounts (events and projects) + """ + consolidatedBalance: AmountRangeInput - """ - Iceland Krona - """ - ISK + """ + Filter by specific Account currencies + """ + currencies: [String] + ): HostedAccountCollection! """ - Jamaican Dollar + Returns the legal documents required by this host """ - JMD + requiredLegalDocuments: [LegalDocumentType!]! """ - Yen + Returns legal documents hosted by this host """ - JPY + hostedLegalDocuments( + """ + The number of results to fetch (default 10, max 1000) + """ + limit: Int! = 10 - """ - Kenyan Shilling - """ - KES + """ + The offset to use to fetch + """ + offset: Int! = 0 - """ - Som - """ - KGS + """ + Filter by type of legal document + """ + type: [LegalDocumentType] - """ - Riel - """ - KHR + """ + Filter by status of legal document + """ + status: [LegalDocumentRequestStatus] - """ - Comoro Franc - """ - KMF + """ + Filter by accounts + """ + account: [AccountReferenceInput] - """ - Won - """ - KRW + """ + Search term (name, description, ...) + """ + searchTerm: String - """ - Cayman Islands Dollar - """ - KYD + """ + The order of results + """ + orderBy: ChronologicalOrderInput! = { field: CREATED_AT, direction: DESC } - """ - Tenge - """ - KZT + """ + Filter by requested date from + """ + requestedAtFrom: DateTime - """ - Kip - """ - LAK + """ + Filter by requested date to + """ + requestedAtTo: DateTime + ): LegalDocumentCollection! """ - Lebanese Pound + Returns a list of transactions imports for this host """ - LBP + transactionsImports( + """ + The number of results to fetch (default 10, max 1000) + """ + limit: Int! = 10 - """ - Sri Lanka Rupee - """ - LKR + """ + The offset to use to fetch + """ + offset: Int! = 0 - """ - Liberian Dollar - """ - LRD + """ + The order of results + """ + orderBy: ChronologicalOrderInput! = { field: CREATED_AT, direction: DESC } + ): TransactionsImportsCollection! """ - Loti + Returns a list of transactions imports sources for this host """ - LSL + transactionsImportsSources: [NonEmptyString]! +} +""" +An account that can receive financial contributions +""" +interface AccountWithContributions { """ - Moroccan Dirham + Number of unique financial contributors. """ - MAD + totalFinancialContributors( + """ + Type of account (COLLECTIVE/EVENT/ORGANIZATION/INDIVIDUAL) + """ + accountType: AccountType + ): Int! + tiers( + """ + The number of results to fetch + """ + limit: Int! = 100 + + """ + The offset to use to fetch + """ + offset: Int! = 0 + ): TierCollection! """ - Moldovan Leu + All the persons and entities that contribute to this account """ - MDL + contributors( + """ + The number of results to fetch (default 10, max 1000) + """ + limit: Int! = 10 + + """ + The offset to use to fetch + """ + offset: Int! = 0 + roles: [MemberRole] + ): ContributorCollection! """ - Malagasy Ariary + How much platform fees are charged for this account """ - MGA + platformFeePercent: Float! """ - Denar + Returns true if a custom contribution to Open Collective can be submitted for contributions made to this account """ - MKD + platformContributionAvailable: Boolean! + contributionPolicy: String """ - Kyat + Returns true if the remote user can start the process to resume contributions for account """ - MMK + canStartResumeContributionsProcess: Boolean! """ - Tugrik + Returns true if the account has started the process to resume contributions """ - MNT + hasResumeContributionsProcessStarted: Boolean! +} + +""" +A collection of "Tiers" +""" +type TierCollection implements Collection { + offset: Int + limit: Int + totalCount: Int + nodes: [Tier] +} + +""" +A collection of "Contributor" +""" +type ContributorCollection implements Collection { + offset: Int + limit: Int + totalCount: Int + nodes: [Contributor] +} +"\n A person or an entity that contributes financially or by any other mean to the mission\n of the collective. While \"Member\" is dedicated to permissions, this type is meant\n to surface all the public contributors and properly groups contributors who are part of\n multiple tiers.\n " +type Contributor { """ - Pataca + A unique identifier for this member """ - MOP + id: String! """ - Mauritius Rupee + Name of the contributor """ - MUR + name: String! @deprecated(reason: "2024-08-26: Use account.name instead") """ - Rufiyaa + All the roles for a given contributor """ - MVR + roles: [MemberRole] """ - Kwacha + True if the contributor is a collective admin """ - MWK + isAdmin: Boolean! """ - Mexican Peso + True if the contributor is a core contributor """ - MXN + isCore: Boolean! """ - Malaysian Ringgit + True if the contributor is a financial contributor """ - MYR + isBacker: Boolean! """ - Mozambique Metical + Member join date """ - MZN + since: DateTime! """ - Namibia Dollar + How much money the user has contributed for this (in cents, using collective currency) """ - NAD + totalAmountDonated: Int! @deprecated(reason: "2024-08-26: Use totalAmountContributed instead") """ - Naira + How much money the user has contributed """ - NGN + totalAmountContributed: Amount! """ - Cordoba Oro + Whether the contributor is an individual, an organization... """ - NIO + type: String! @deprecated(reason: "2024-08-26: Use account.type instead") """ - Norwegian Krone + Defines if the contributors wants to be incognito (name not displayed) """ - NOK + isIncognito: Boolean! @deprecated(reason: "2024-08-26: Use account.isIncognito instead") """ - Nepalese Rupee + Description of how the member contribute. Will usually be a tier name, or "design" or "code". """ - NPR + description: String """ - New Zealand Dollar + If the contributor has a page on Open Collective, this is the slug to link to it. Always null for incognito contributors """ - NZD + collectiveSlug: String @deprecated(reason: "2024-08-26: Use account.slug instead") + account: String """ - Balboa + Contributor avatar or logo """ - PAB + image(height: Int, format: ImageFormat): String @deprecated(reason: "2024-08-26: Use account.image instead") """ - Nuevo Sol + A public message from contributors to describe their contributions """ - PEN + publicMessage: String +} +input AccountReferenceInput { """ - Kina + The public id identifying the account (ie: dgm9bnk8-0437xqry-ejpvzeol-jdayw5re) """ - PGK + id: String """ - Philippine Peso + The internal id of the account (ie: 580) """ - PHP + legacyId: Int @deprecated(reason: "2020-01-01: should only be used during the transition to GraphQL API v2.") """ - Pakistan Rupee + The slug identifying the account (ie: babel for https://opencollective.com/babel) """ - PKR + slug: String +} +""" +A legal document (e.g. W9, W8BEN, W8BEN-E) +""" +type LegalDocument { """ - Zloty + Unique identifier for this legal document """ - PLN + id: String! """ - Guarani + The year this legal document is for """ - PYG + year: Int! """ - Qatari Rial + The type of legal document """ - QAR + type: LegalDocumentType! """ - Romanian Leu + The status of the request for this legal document """ - RON + status: LegalDocumentRequestStatus! """ - Serbian Dinar + The service that provided this legal document """ - RSD + service: LegalDocumentService! """ - Russian Ruble + Whether this legal document is expired """ - RUB + isExpired: Boolean! """ - Rwanda Franc + The date and time the request for this legal document was created """ - RWF + requestedAt: DateTime! """ - Saudi Riyal + The date and time this legal document was last updated """ - SAR + updatedAt: DateTime! """ - Solomon Islands Dollar + The account this legal document is for """ - SBD + account: Account! """ - Seychelles Rupee + URL to download the file. Must be logged in as a host with access to the document. The returned URL will be protected by authentication + 2FA. """ - SCR + documentLink: URL +} +""" +Type for a required legal document +""" +enum LegalDocumentType { """ - Swedish Krona + US tax form (W9, W8BEN, W8BEN-E) """ - SEK + US_TAX_FORM +} + +""" +Status for a legal document +""" +enum LegalDocumentRequestStatus { + NOT_REQUESTED + REQUESTED + RECEIVED + ERROR + INVALID +} + +""" +Type for a required legal document +""" +enum LegalDocumentService { + DROPBOX_FORMS + OPENCOLLECTIVE +} +""" +A collection of "MemberOf" (ie: Collective backed by an Organization) +""" +type MemberOfCollection implements Collection { + offset: Int + limit: Int + totalCount: Int + nodes: [MemberOf] + roles: [MemberOfCollectionRoles] +} + +""" +An existing member role and account type combination used used to filter collections +""" +type MemberOfCollectionRoles { + type: AccountType! + role: MemberRole! +} + +""" +All supported expense types +""" +enum HostFeeStructure { """ - Singapore Dollar + Use global host fees """ - SGD + DEFAULT """ - Saint Helena Pound + Custom fee for this Collective only """ - SHP + CUSTOM_FEE """ - Leone + Set a monthly retainer for this Collective """ - SLL + MONTHLY_RETAINER +} +""" +Input to order collection +""" +input OrderByInput { """ - Somali Shilling + Field to order by. """ - SOS + field: OrderByFieldType! """ - Surinam Dollar + Ordering direction. """ - SRD + direction: OrderDirection! +} + +""" +Possible fields you can use to order by +""" +enum OrderByFieldType { + CREATED_AT """ - Lilangeni + The financial activity of the collective (number of transactions) """ - SZL + ACTIVITY + HOST_RANK + HOSTED_COLLECTIVES_COUNT + RANK + BALANCE + MEMBER_COUNT + TOTAL_CONTRIBUTED + NAME +} + +""" +A collection of Transactions (Debit or Credit) +""" +type TransactionCollection implements Collection { + offset: Int + limit: Int + totalCount: Int + nodes: [Transaction] + kinds: [TransactionKind] """ - Baht + The types of payment methods used in this collection, regardless of the pagination """ - THB + paymentMethodTypes: [PaymentMethodType]! +} + +enum PaymentMethodType { + default @deprecated(reason: "Please use uppercase values") + alipay @deprecated(reason: "Please use uppercase values") + creditcard @deprecated(reason: "Please use uppercase values") + prepaid @deprecated(reason: "Please use uppercase values") + payment @deprecated(reason: "Please use uppercase values") + subscription @deprecated(reason: "Please use uppercase values") + collective @deprecated(reason: "Please use uppercase values") + host @deprecated(reason: "Please use uppercase values") + adaptive @deprecated(reason: "Please use uppercase values") + giftcard @deprecated(reason: "Please use uppercase values") + manual @deprecated(reason: "Please use uppercase values") + crypto @deprecated(reason: "Please use uppercase values") + paymentintent @deprecated(reason: "Please use uppercase values") + us_bank_account @deprecated(reason: "Please use uppercase values") + sepa_debit @deprecated(reason: "Please use uppercase values") + bacs_debit @deprecated(reason: "Please use uppercase values") + bancontact @deprecated(reason: "Please use uppercase values") + link @deprecated(reason: "Please use uppercase values") + bank_transfer @deprecated(reason: "Please use uppercase values") + payout @deprecated(reason: "Please use uppercase values") + virtual_card @deprecated(reason: "Please use uppercase values") + swish @deprecated(reason: "Please use uppercase values") + DEFAULT + ALIPAY + CREDITCARD + PREPAID + PAYMENT + SUBSCRIPTION + COLLECTIVE + HOST + ADAPTIVE + GIFTCARD + MANUAL + CRYPTO + PAYMENT_INTENT + US_BANK_ACCOUNT + SEPA_DEBIT + BACS_DEBIT + BANCONTACT + LINK + BANK_TRANSFER + PAYOUT + VIRTUAL_CARD + SWISH +} + +enum PaymentMethodService { + PAYPAL + STRIPE + OPENCOLLECTIVE + THEGIVINGBLOCK + WISE +} +input ExpenseReferenceInput { """ - Somoni + The public id identifying the expense (ie: dgm9bnk8-0437xqry-ejpvzeol-jdayw5re) """ - TJS + id: String """ - Pa’anga + The internal id of the expense (ie: 580) """ - TOP + legacyId: Int +} +""" +All supported expense types +""" +enum ExpenseType { """ - Turkish Lira + Invoice: Charge for your time or get paid in advance. """ - TRY + INVOICE """ - Trinidad and Tobago Dollar + Receipt: Get paid back for a purchase already made. """ - TTD + RECEIPT """ - New Taiwan Dollar + Funding Request: Request funding for a project or initiative. """ - TWD + FUNDING_REQUEST """ - Tanzanian Shilling + Grant: Request funding for a project or initiative. """ - TZS + GRANT """ - Hryvnia + Unclassified expense """ - UAH + UNCLASSIFIED """ - Uganda Shilling + Credit Card Charge: Payment done using an issued (virtual) credit card issued by your Fiscal Host. """ - UGX + CHARGE """ - Peso Uruguayo + Settlement: expense generated by Open Collective to collect money owed by Fiscal Hosts. """ - UYU + SETTLEMENT +} +input OrderReferenceInput { """ - Uzbekistan Sum + The public id identifying the order (ie: dgm9bnk8-0437xqry-ejpvzeol-jdayw5re) """ - UZS + id: String """ - Dong + The legacy public id identifying the order (ie: 4242) """ - VND + legacyId: Int +} - """ - Vatu - """ - VUV +input VirtualCardReferenceInput { + id: String +} +""" +The user or system that paused the order +""" +enum OrderPausedBy { """ - Tala + Individual who administers the account for this contribution """ - WST + USER """ - CFA Franc BEAC + The host of the collective """ - XAF + HOST """ - East Caribbean Dollar + The platform """ - XCD + PLATFORM """ - CFA Franc BCEAO + The collective """ - XOF + COLLECTIVE +} +input PaymentMethodReferenceInput { """ - CFP Franc + The id assigned to the payment method """ - XPF + id: String +} - """ - Yemeni Rial - """ - YER +""" +Account orders filter (INCOMING or OUTGOING) +""" +enum AccountOrdersFilter { + INCOMING + OUTGOING +} - """ - Rand - """ - ZAR +""" +Expected funds filter (ALL_EXPECTED_FUNDS, ONLY_PENDING, ONLY_MANUAL) +""" +enum ExpectedFundsFilter { + ALL_EXPECTED_FUNDS + ONLY_PENDING + ONLY_MANUAL +} - """ - Zambian Kwacha - """ - ZMW +""" +A collection of "Expenses" +""" +type ExpenseCollection implements Collection { + offset: Int + limit: Int + totalCount: Int + nodes: [Expense] + totalAmount: ExpenseCollectionTotalAmount +} + +type ExpenseCollectionTotalAmount { + amount(currency: Currency = USD): Amount + amountsByCurrency: [Amount] } """ @@ -4089,6 +4461,7 @@ enum ExpenseStatusFilter { SCHEDULED_FOR_PAYMENT SPAM CANCELED + INVITE_DECLINED """ Only expenses that are ready to be paid (must be approved, have the sufficiant balance and have the tax forms completed) @@ -4114,6 +4487,26 @@ The `JSON` scalar type represents JSON values as specified by [ECMA-404](http:// """ scalar JSON +""" +Defines role of the last comment author +""" +enum LastCommentBy { + """ + Expense Submitter + """ + USER + + """ + Fiscal Host Admin + """ + HOST_ADMIN + + """ + Collective Admin + """ + COLLECTIVE_ADMIN +} + """ A collection of "Conversations" """ @@ -4330,6 +4723,26 @@ type PaymentMethod { """ includeHostedAccounts: Boolean + """ + Include orders from children events/projects + """ + includeChildrenAccounts: Boolean! = false + + """ + Only return orders that were paused by these roles. status must be set to PAUSED. + """ + pausedBy: [OrderPausedBy] + + """ + Only return orders that match these payment method services + """ + paymentMethodService: [PaymentMethodService] + + """ + Only return orders that match these payment method types + """ + paymentMethodType: [PaymentMethodType] + """ Whether to include incognito orders. Must be admin or root. Only with filter null or OUTGOING. """ @@ -4375,6 +4788,16 @@ type PaymentMethod { """ dateTo: DateTime + """ + Only return pending orders that were expected after this date + """ + expectedDateFrom: DateTime + + """ + Only return pending orders that were expected before this date + """ + expectedDateTo: DateTime + """ The term to search """ @@ -4390,6 +4813,7 @@ type PaymentMethod { Same as onlySubscriptions, but returns only orders with active subscriptions """ onlyActiveSubscriptions: Boolean + expectedFundsFilter: ExpectedFundsFilter """ Return only orders made from/to that opposite account (only works when orders are already filtered with a main account) @@ -4452,6 +4876,7 @@ enum ConnectedAccountService { github twitter transferwise + plaid privacy @deprecated(reason: "Not using this service anymore") thegivingblock meetup @deprecated(reason: "Not using this service anymore") @@ -4850,11 +5275,6 @@ type AccountStats { """ frequency: ContributionFrequency - """ - Filter contributions on whether they can be ported to another fiscal host directly - """ - hasPortability: Boolean - """ Include contributions to children accounts (Projects and Events) """ @@ -5233,7 +5653,6 @@ type CollectiveFeatures { CONTACT_COLLECTIVE: CollectiveFeatureStatus CONTACT_FORM: CollectiveFeatureStatus CREATE_COLLECTIVE: CollectiveFeatureStatus - CROSS_CURRENCY_MANUAL_TRANSACTIONS: CollectiveFeatureStatus TRANSFERWISE: CollectiveFeatureStatus PAYPAL_PAYOUTS: CollectiveFeatureStatus PAYPAL_DONATIONS: CollectiveFeatureStatus @@ -5298,6 +5717,7 @@ type Policies { MAXIMUM_VIRTUAL_CARD_LIMIT_AMOUNT_FOR_INTERVAL: MAXIMUM_VIRTUAL_CARD_LIMIT_AMOUNT_FOR_INTERVAL EXPENSE_CATEGORIZATION: EXPENSE_CATEGORIZATION EXPENSE_PUBLIC_VENDORS: Boolean + COLLECTIVE_ADMINS_CAN_SEE_PAYOUT_METHODS: Boolean } type EXPENSE_AUTHOR_CANNOT_APPROVE { @@ -5411,6 +5831,66 @@ type Permission { reasonDetails: JSON } +""" +A collection of "HostApplication" +""" +type HostApplicationCollection implements Collection { + offset: Int + limit: Int + totalCount: Int + nodes: [HostApplication] +} + +type HostApplication { + id: String! + + """ + The account who applied to this host + """ + account: Account! + + """ + The host the collective applied to + """ + host: Host! + + """ + The date on which the item was created + """ + createdAt: DateTime! + + """ + The date on which the item was updated + """ + updatedAt: DateTime! + status: HostApplicationStatus + message: String + customData: JSON + + """ + Returns the list of comments for this host application, or `null` if user is not allowed to see them + """ + comments( + """ + The number of results to fetch (default 10, max 1000) + """ + limit: Int! = 10 + + """ + The offset to use to fetch + """ + offset: Int! = 0 + orderBy: ChronologicalOrderInput = { field: CREATED_AT, direction: ASC } + ): CommentCollection +} + +enum HostApplicationStatus { + PENDING + APPROVED + REJECTED + EXPIRED +} + """ An activity describing something that happened on the platform """ @@ -5526,10 +6006,12 @@ enum ActivityType { COLLECTIVE_EXPENSE_UNSCHEDULED_FOR_PAYMENT COLLECTIVE_EXPENSE_ERROR COLLECTIVE_EXPENSE_INVITE_DRAFTED + COLLECTIVE_EXPENSE_INVITE_DECLINED COLLECTIVE_EXPENSE_RECURRING_DRAFTED COLLECTIVE_EXPENSE_MISSING_RECEIPT TAXFORM_REQUEST TAXFORM_RECEIVED + TAXFORM_INVALIDATED COLLECTIVE_VIRTUAL_CARD_ADDED COLLECTIVE_VIRTUAL_CARD_MISSING_RECEIPTS COLLECTIVE_VIRTUAL_CARD_RESUMED @@ -5549,10 +6031,12 @@ enum ActivityType { COLLECTIVE_CORE_MEMBER_REMOVED COLLECTIVE_CORE_MEMBER_EDITED COLLECTIVE_TRANSACTION_CREATED + TRANSACTIONS_IMPORT_CREATED COLLECTIVE_UPDATE_CREATED COLLECTIVE_UPDATE_PUBLISHED COLLECTIVE_CONTACT HOST_APPLICATION_CONTACT + HOST_APPLICATION_COMMENT_CREATED CONTRIBUTION_REJECTED SUBSCRIPTION_ACTIVATED SUBSCRIPTION_CANCELED @@ -5566,14 +6050,20 @@ enum ActivityType { ORDER_PENDING_CONTRIBUTION_REMINDER ORDER_PROCESSING ORDER_PAYMENT_FAILED + ORDER_REVIEW_OPENED + ORDER_REVIEW_CLOSED + ORDER_DISPUTE_CREATED + ORDER_DISPUTE_CLOSED ORDER_THANKYOU ORDER_UPDATED + ADDED_FUNDS_EDITED VENDOR_CREATED VENDOR_EDITED VENDOR_DELETED ORDER_PENDING_CREATED ORDER_PENDING_FOLLOWUP ORDER_PENDING_RECEIVED + ORDER_PENDING_EXPIRED ORDERS_SUSPICIOUS PAYMENT_FAILED PAYMENT_CREDITCARD_CONFIRMATION @@ -5621,6 +6111,55 @@ enum ActivityClassType { REPORTS } +""" +EXPERIMENTAL (this may change or be deleted): Host transaction report +""" +type TransactionReports { + """ + The start date of the time series + """ + dateFrom: DateTime + + """ + The end date of the time series + """ + dateTo: DateTime + + """ + The interval between two data points + """ + timeUnit: TimeUnit! + nodes: [TransactionReport!] +} + +""" +EXPERIMENTAL (this may change or be deleted) +""" +type TransactionReport { + date: DateTime + startingBalance: Amount! + endingBalance: Amount! + totalChange: Amount! + groups: [TransactionsAmountGroup]! +} + +""" +EXPERIMENTAL (this may change or be deleted): Transaction amounts grouped by type, kind, isRefund, isHost, expenseType +""" +type TransactionsAmountGroup { + netAmount: Amount + amount: Amount + platformFee: Amount + paymentProcessorFee: Amount + hostFee: Amount + taxAmount: Amount + type: TransactionType + kind: TransactionKind + isRefund: Boolean + isHost: Boolean + expenseType: ExpenseType +} + """ A collection of webhooks """ @@ -5765,47 +6304,8 @@ type HostTransactionReports { type HostTransactionReportNode { date: DateTime! - managedFunds: TransactionsReport! - operationalFunds: TransactionsReport! -} - -""" -Transactions report -""" -type TransactionsReport { - startingBalance: Amount! - endingBalance: Amount! - totalChange: Amount! - groups: [TransactionsAmountGroup]! -} - -""" -EXPERIMENTAL (this may change or be deleted): Transaction amounts grouped by type, kind, isRefund, isHost, expenseType -""" -type TransactionsAmountGroup { - netAmount: Amount - amount: Amount - platformFee: Amount - paymentProcessorFee: Amount - hostFee: Amount - taxAmount: Amount - type: TransactionType - kind: TransactionKind - isRefund: Boolean - isHost: Boolean - expenseType: ExpenseType -} - -""" -EXPERIMENTAL (this may change or be deleted): Transaction amounts grouped by type, kind, isRefund, isHost, expenseType -""" -type TransactionSum { - amount: Amount - type: TransactionType - kind: TransactionKind - isRefund: Boolean - isHost: Boolean - expenseType: ExpenseType + managedFunds: TransactionReport! + operationalFunds: TransactionReport! } """ @@ -5982,45 +6482,40 @@ type TimeSeriesAmountWithKindNode { } """ -Stripe connected account properties -""" -type StripeConnectedAccount { - username: String - issuingBalance: Amount -} - -""" -A collection of "HostApplication" +EXPERIMENTAL (this may change or be deleted): Host expenses report """ -type HostApplicationCollection implements Collection { - offset: Int - limit: Int - totalCount: Int - nodes: [HostApplication] -} - -type HostApplication { - id: String! +type HostExpensesReports { + """ + The start date of the time series + """ + dateFrom: DateTime """ - The account who applied to this host + The end date of the time series """ - account: Account! + dateTo: DateTime """ - The date on which the item was created + The interval between two data points """ - createdAt: DateTime! - status: HostApplicationStatus - message: String - customData: JSON + timeUnit: TimeUnit! + nodes: [HostExpensesReportNode!] } -enum HostApplicationStatus { - PENDING - APPROVED - REJECTED - EXPIRED +type HostExpensesReportNode { + date: DateTime! + isHost: Boolean! + accountingCategory: AccountingCategory + amount: Amount! + count: Int! +} + +""" +Stripe connected account properties +""" +type StripeConnectedAccount { + username: String + issuingBalance: Amount } """ @@ -6085,112 +6580,322 @@ enum CurrencyExchangeRateSourceType { PAYPAL """ - Wise API + Wise API + """ + WISE + + """ + User-provided exchange rate + """ + USER +} + +""" +Contribution statistics related to the given accounts +""" +type ContributionStats { + """ + The total number of contributions + """ + contributionsCount: Int! + + """ + Number of one time contributions + """ + oneTimeContributionsCount: Int! + + """ + Number of recurring contributions + """ + recurringContributionsCount: Int! + + """ + The daily average income + """ + dailyAverageIncomeAmount: Amount! +} + +""" +Expense statistics related to the given accounts +""" +type ExpenseStats { + """ + The total number of expenses + """ + expensesCount: Int! + + """ + The daily average paid in expenses + """ + dailyAverageAmount: Amount! + + """ + Number of invoices + """ + invoicesCount: Int! + + """ + Number of reimbursements + """ + reimbursementsCount: Int! + + """ + Number of grants + """ + grantsCount: Int! +} + +""" +A collection of "Agreement" +""" +type AgreementCollection implements Collection { + offset: Int + limit: Int + totalCount: Int + nodes: [Agreement!] +} + +""" +An agreement +""" +type Agreement { + id: String + title: String! + + """ + Additional notes about the agreement for the host admins + """ + notes: String + + """ + The time of creation of this agreement + """ + createdAt: DateTime! + createdBy: Account + account: Account! + host: Host! + expiresAt: DateTime + attachment: FileInfo +} + +""" +A collection of Vendors +""" +type VendorCollection implements Collection { + offset: Int + limit: Int + totalCount: Int + nodes: [Vendor!] +} + +""" +A collection of hosted "Accounts" +""" +type HostedAccountCollection implements Collection { + offset: Int + limit: Int + totalCount: Int + nodes: [Account] + currencies: [String] +} + +""" +Input type for an amount range with the value and currency +""" +input AmountRangeInput { + """ + The minimum amount (inclusive) + """ + gte: AmountInput + + """ + The maximum amount (inclusive) + """ + lte: AmountInput +} + +""" +A collection of "LegalDocument" +""" +type LegalDocumentCollection implements Collection { + offset: Int + limit: Int + totalCount: Int + nodes: [LegalDocument] +} + +""" +A collection of "TransactionsImports" +""" +type TransactionsImportsCollection implements Collection { + offset: Int + limit: Int + totalCount: Int + nodes: [TransactionsImport!] +} + +type TransactionsImport { + """ + The public id of the import + """ + id: String! + + """ + Account that holds the import + """ + account: Account! + + """ + URL of the import (e.g. link to the CSV file) + """ + file: FileInfo + + """ + Source of the import (e.g. "Bank of America", "Eventbrite", etc...) + """ + source: NonEmptyString! + + """ + Name of the import (e.g. "Contributions May 2021", "Tickets for Mautic Conference 2024") + """ + name: NonEmptyString! + + """ + Type of the import + """ + type: TransactionsImportType! + + """ + Configuration for the CSV import + """ + csvConfig: JSON + + """ + When the import was created + """ + createdAt: DateTime! + + """ + When the import was last updated """ - WISE + updatedAt: DateTime! """ - User-provided exchange rate + List of rows in the import """ - USER + rows: TransactionsImportRowCollection! + stats: TransactionsImportStats } """ -Contribution statistics related to the given accounts +A string that cannot be passed as an empty value """ -type ContributionStats { +scalar NonEmptyString + +""" +Type of the import +""" +enum TransactionsImportType { + CSV + MANUAL + PLAID +} + +""" +A collection of "TransactionsImportRow" +""" +type TransactionsImportRowCollection implements Collection { + offset: Int + limit: Int + totalCount: Int + nodes: [TransactionsImportRow!] +} + +""" +A row in a transactions import +""" +type TransactionsImportRow { """ - The total number of contributions + The public id of the imported row """ - contributionsCount: Int! + id: String! """ - Number of one time contributions + The source id of the row """ - oneTimeContributionsCount: Int! + sourceId: NonEmptyString! """ - Number of recurring contributions + Whether the row has been dismissed """ - recurringContributionsCount: Int! + isDismissed: Boolean! """ - The daily average income + The description of the row """ - dailyAverageIncomeAmount: Amount! -} + description: String! -""" -Expense statistics related to the given accounts -""" -type ExpenseStats { """ - The total number of expenses + The date of the row """ - expensesCount: Int! + date: DateTime! """ - The daily average paid in expenses + The amount of the row """ - dailyAverageAmount: Amount! + amount: Amount! """ - Number of invoices + The expense associated with the row """ - invoicesCount: Int! + expense: Expense """ - Number of reimbursements + The raw data of the row """ - reimbursementsCount: Int! + rawValue: JSONObject """ - Number of grants + The order associated with the row """ - grantsCount: Int! + order: Order } """ -A collection of "Agreement" +The `JSONObject` scalar type represents JSON objects as specified by [ECMA-404](http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf). """ -type AgreementCollection implements Collection { - offset: Int - limit: Int - totalCount: Int - nodes: [Agreement!] -} +scalar JSONObject -""" -An agreement -""" -type Agreement { - id: String - title: String! +type TransactionsImportStats { + """ + Total number of rows in the import + """ + total: Int! """ - Additional notes about the agreement for the host admins + Number of rows that have been ignored """ - notes: String + ignored: Int! """ - The time of creation of this agreement + Number of rows that have been converted to expenses """ - createdAt: DateTime! - createdBy: Account - account: Account! - host: Host! - expiresAt: DateTime - attachment: FileInfo + expenses: Int! + + """ + Number of rows that have been converted to orders + """ + orders: Int! + + """ + Number of rows that have been processed (either dismissed or converted to expenses or orders) + """ + processed: Int! } -""" -A collection of Vendors -""" -type VendorCollection implements Collection { - offset: Int - limit: Int - totalCount: Int - nodes: [Vendor!] +enum AccountingCategoryAppliesTo { + HOST + HOSTED_COLLECTIVES } type ExpenseValuesByRole { @@ -6212,11 +6917,6 @@ type ExpenseValuesByRole { hostAdmin: ExpenseValuesRoleDetails } -""" -A string that cannot be passed as an empty value -""" -scalar NonEmptyString - type ExpenseValuesRoleDetails { accountingCategory: AccountingCategory } @@ -6234,6 +6934,7 @@ enum ExpenseStatus { SCHEDULED_FOR_PAYMENT SPAM CANCELED + INVITE_DECLINED } """ @@ -6401,6 +7102,16 @@ type ExpensePermissions { """ canReject: Boolean! + """ + Whether the user or the given draft key is allowed decline the expense invite + """ + canDeclineExpenseInvite( + """ + Key for draft expense + """ + draftKey: String + ): Boolean! + """ Whether the current user can mark this expense as spam """ @@ -6433,6 +7144,12 @@ type ExpensePermissions { canUsePrivateNote: Boolean! canHold: Boolean! canRelease: Boolean! + canDownloadTaxForm: Boolean! + + """ + Whether the current user can see the private details of the payout method of this expense + """ + canSeePayoutMethodPrivateDetails: Boolean! edit: Permission! """ @@ -6454,6 +7171,7 @@ type ExpensePermissions { verifyDraftExpense: Permission! hold: Permission! release: Permission! + downloadTaxForm: Permission! } """ @@ -6777,7 +7495,11 @@ type Bot implements Account { githubHandle: String @deprecated(reason: "2022-06-03: Please use repositoryUrl") repositoryUrl: String @deprecated(reason: "2023-01-16: Please use socialLinks") socialLinks: [SocialLink!]! - currency: String + + """ + The currency of the account + """ + currency: Currency! expensePolicy: String """ @@ -6785,11 +7507,6 @@ type Bot implements Account { """ isIncognito: Boolean! imageUrl(height: Int, format: ImageFormat): String - - """ - Returns whether this account has a custom image - """ - hasImage: Boolean! backgroundImageUrl(height: Int, format: ImageFormat): String """ @@ -7109,11 +7826,31 @@ type Bot implements Account { """ includeHostedAccounts: Boolean + """ + Include orders from children events/projects + """ + includeChildrenAccounts: Boolean! = false + + """ + Only return orders that were paused by these roles. status must be set to PAUSED. + """ + pausedBy: [OrderPausedBy] + """ Only return orders that were paid with this payment method. Must be an admin of the account owning the payment method. """ paymentMethod: PaymentMethodReferenceInput + """ + Only return orders that match these payment method services + """ + paymentMethodService: [PaymentMethodService] + + """ + Only return orders that match these payment method types + """ + paymentMethodType: [PaymentMethodType] + """ Whether to include incognito orders. Must be admin or root. Only with filter null or OUTGOING. """ @@ -7159,6 +7896,16 @@ type Bot implements Account { """ dateTo: DateTime + """ + Only return pending orders that were expected after this date + """ + expectedDateFrom: DateTime + + """ + Only return pending orders that were expected before this date + """ + expectedDateTo: DateTime + """ The term to search """ @@ -7174,6 +7921,7 @@ type Bot implements Account { Same as onlySubscriptions, but returns only orders with active subscriptions """ onlyActiveSubscriptions: Boolean + expectedFundsFilter: ExpectedFundsFilter """ Return only orders made from/to that opposite account (only works when orders are already filtered with a main account) @@ -7216,7 +7964,7 @@ type Bot implements Account { """ Use this field to filter expenses on their statuses """ - status: ExpenseStatusFilter + status: [ExpenseStatusFilter] """ Use this field to filter expenses on their type (RECEIPT/INVOICE) @@ -7288,6 +8036,16 @@ type Bot implements Account { Filter expenses of type charges using these virtual cards """ virtualCards: [VirtualCardReferenceInput] + + """ + Filter expenses by the last user-role who replied to them + """ + lastCommentBy: [LastCommentBy] + + """ + Only return expenses that match these accounting categories + """ + accountingCategory: [String] ): ExpenseCollection! settings: JSON! conversations( @@ -7367,6 +8125,11 @@ type Bot implements Account { categories: [String]! stats: AccountStats + """ + Whether this account can have changelog updates + """ + canHaveChangelogUpdates: Boolean! + """ Updates published by the account. To see unpublished updates, you need to be an admin and have the scope "updates". """ @@ -7385,6 +8148,7 @@ type Bot implements Account { Only return published updates. """ onlyPublishedUpdates: Boolean = false + isDraft: Boolean onlyChangelogUpdates: Boolean orderBy: UpdateChronologicalOrderInput! = { field: CREATED_AT, direction: DESC } searchTerm: String @@ -7426,6 +8190,7 @@ type Bot implements Account { offset: Int! = 0 isActive: Boolean accountType: [AccountType] + searchTerm: String ): AccountCollection! """ @@ -7442,6 +8207,31 @@ type Bot implements Account { Logged-in user permissions on an account """ permissions: AccountPermissions! + + """ + Host application requests + """ + hostApplicationRequests( + """ + The number of results to fetch (default 10, max 1000) + """ + limit: Int! = 10 + + """ + The offset to use to fetch + """ + offset: Int! = 0 + + """ + Order of the results + """ + orderBy: ChronologicalOrderInput! = { field: CREATED_AT, direction: DESC } + + """ + Filter applications by status + """ + status: HostApplicationStatus + ): HostApplicationCollection! feed( """ Only returns activities before this date @@ -7468,6 +8258,11 @@ type Bot implements Account { If this account was duplicated, the accounts that were created from it """ duplicatedAccounts(limit: Int! = 100, offset: Int! = 0): AccountCollection! + + """ + EXPERIMENTAL (this may change or be removed) + """ + transactionReports(timeUnit: TimeUnit = MONTH, dateFrom: DateTime, dateTo: DateTime): TransactionReports webhooks( """ The number of results to fetch (default 10, max 1000) @@ -7512,7 +8307,11 @@ type Collective implements Account & AccountWithHost & AccountWithContributions githubHandle: String @deprecated(reason: "2022-06-03: Please use repositoryUrl") repositoryUrl: String @deprecated(reason: "2023-01-16: Please use socialLinks") socialLinks: [SocialLink!]! - currency: String + + """ + The currency of the account + """ + currency: Currency! expensePolicy: String """ @@ -7520,11 +8319,6 @@ type Collective implements Account & AccountWithHost & AccountWithContributions """ isIncognito: Boolean! imageUrl(height: Int, format: ImageFormat): String - - """ - Returns whether this account has a custom image - """ - hasImage: Boolean! backgroundImageUrl(height: Int, format: ImageFormat): String """ @@ -7844,11 +8638,31 @@ type Collective implements Account & AccountWithHost & AccountWithContributions """ includeHostedAccounts: Boolean + """ + Include orders from children events/projects + """ + includeChildrenAccounts: Boolean! = false + + """ + Only return orders that were paused by these roles. status must be set to PAUSED. + """ + pausedBy: [OrderPausedBy] + """ Only return orders that were paid with this payment method. Must be an admin of the account owning the payment method. """ paymentMethod: PaymentMethodReferenceInput + """ + Only return orders that match these payment method services + """ + paymentMethodService: [PaymentMethodService] + + """ + Only return orders that match these payment method types + """ + paymentMethodType: [PaymentMethodType] + """ Whether to include incognito orders. Must be admin or root. Only with filter null or OUTGOING. """ @@ -7894,6 +8708,16 @@ type Collective implements Account & AccountWithHost & AccountWithContributions """ dateTo: DateTime + """ + Only return pending orders that were expected after this date + """ + expectedDateFrom: DateTime + + """ + Only return pending orders that were expected before this date + """ + expectedDateTo: DateTime + """ The term to search """ @@ -7909,6 +8733,7 @@ type Collective implements Account & AccountWithHost & AccountWithContributions Same as onlySubscriptions, but returns only orders with active subscriptions """ onlyActiveSubscriptions: Boolean + expectedFundsFilter: ExpectedFundsFilter """ Return only orders made from/to that opposite account (only works when orders are already filtered with a main account) @@ -7951,7 +8776,7 @@ type Collective implements Account & AccountWithHost & AccountWithContributions """ Use this field to filter expenses on their statuses """ - status: ExpenseStatusFilter + status: [ExpenseStatusFilter] """ Use this field to filter expenses on their type (RECEIPT/INVOICE) @@ -8023,6 +8848,16 @@ type Collective implements Account & AccountWithHost & AccountWithContributions Filter expenses of type charges using these virtual cards """ virtualCards: [VirtualCardReferenceInput] + + """ + Filter expenses by the last user-role who replied to them + """ + lastCommentBy: [LastCommentBy] + + """ + Only return expenses that match these accounting categories + """ + accountingCategory: [String] ): ExpenseCollection! settings: JSON! conversations( @@ -8102,6 +8937,11 @@ type Collective implements Account & AccountWithHost & AccountWithContributions categories: [String]! stats: AccountStats + """ + Whether this account can have changelog updates + """ + canHaveChangelogUpdates: Boolean! + """ Updates published by the account. To see unpublished updates, you need to be an admin and have the scope "updates". """ @@ -8120,6 +8960,7 @@ type Collective implements Account & AccountWithHost & AccountWithContributions Only return published updates. """ onlyPublishedUpdates: Boolean = false + isDraft: Boolean onlyChangelogUpdates: Boolean orderBy: UpdateChronologicalOrderInput! = { field: CREATED_AT, direction: DESC } searchTerm: String @@ -8161,6 +9002,7 @@ type Collective implements Account & AccountWithHost & AccountWithContributions offset: Int! = 0 isActive: Boolean accountType: [AccountType] + searchTerm: String ): AccountCollection! """ @@ -8177,6 +9019,31 @@ type Collective implements Account & AccountWithHost & AccountWithContributions Logged-in user permissions on an account """ permissions: AccountPermissions! + + """ + Host application requests + """ + hostApplicationRequests( + """ + The number of results to fetch (default 10, max 1000) + """ + limit: Int! = 10 + + """ + The offset to use to fetch + """ + offset: Int! = 0 + + """ + Order of the results + """ + orderBy: ChronologicalOrderInput! = { field: CREATED_AT, direction: DESC } + + """ + Filter applications by status + """ + status: HostApplicationStatus + ): HostApplicationCollection! feed( """ Only returns activities before this date @@ -8203,6 +9070,11 @@ type Collective implements Account & AccountWithHost & AccountWithContributions If this account was duplicated, the accounts that were created from it """ duplicatedAccounts(limit: Int! = 100, offset: Int! = 0): AccountCollection! + + """ + EXPERIMENTAL (this may change or be removed) + """ + transactionReports(timeUnit: TimeUnit = MONTH, dateFrom: DateTime, dateTo: DateTime): TransactionReports webhooks( """ The number of results to fetch (default 10, max 1000) @@ -8231,6 +9103,11 @@ type Collective implements Account & AccountWithHost & AccountWithContributions """ hostFeePercent(paymentMethodService: PaymentMethodService, paymentMethodType: PaymentMethodType): Float + """ + Returns the Fiscal Host application + """ + hostApplication: HostApplication + """ How much platform fees are charged for this account """ @@ -8334,6 +9211,11 @@ interface AccountWithHost { """ hostFeePercent(paymentMethodService: PaymentMethodService, paymentMethodType: PaymentMethodType): Float + """ + Returns the Fiscal Host application + """ + hostApplication: HostApplication + """ Fees percentage that the platform takes for this collective """ @@ -8458,6 +9340,7 @@ type Credit implements Transaction { """ fetchPaymentProcessorFee: Boolean = false ): Amount! + paymentProcessorUrl: String host: Account """ @@ -8602,6 +9485,7 @@ type Debit implements Transaction { """ fetchPaymentProcessorFee: Boolean = false ): Amount! + paymentProcessorUrl: String host: Account """ @@ -8688,7 +9572,11 @@ type Event implements Account & AccountWithHost & AccountWithContributions & Acc githubHandle: String @deprecated(reason: "2022-06-03: Please use repositoryUrl") repositoryUrl: String @deprecated(reason: "2023-01-16: Please use socialLinks") socialLinks: [SocialLink!]! - currency: String + + """ + The currency of the account + """ + currency: Currency! expensePolicy: String """ @@ -8696,11 +9584,6 @@ type Event implements Account & AccountWithHost & AccountWithContributions & Acc """ isIncognito: Boolean! imageUrl(height: Int, format: ImageFormat): String - - """ - Returns whether this account has a custom image - """ - hasImage: Boolean! backgroundImageUrl(height: Int, format: ImageFormat): String """ @@ -9020,11 +9903,31 @@ type Event implements Account & AccountWithHost & AccountWithContributions & Acc """ includeHostedAccounts: Boolean + """ + Include orders from children events/projects + """ + includeChildrenAccounts: Boolean! = false + + """ + Only return orders that were paused by these roles. status must be set to PAUSED. + """ + pausedBy: [OrderPausedBy] + """ Only return orders that were paid with this payment method. Must be an admin of the account owning the payment method. """ paymentMethod: PaymentMethodReferenceInput + """ + Only return orders that match these payment method services + """ + paymentMethodService: [PaymentMethodService] + + """ + Only return orders that match these payment method types + """ + paymentMethodType: [PaymentMethodType] + """ Whether to include incognito orders. Must be admin or root. Only with filter null or OUTGOING. """ @@ -9070,6 +9973,16 @@ type Event implements Account & AccountWithHost & AccountWithContributions & Acc """ dateTo: DateTime + """ + Only return pending orders that were expected after this date + """ + expectedDateFrom: DateTime + + """ + Only return pending orders that were expected before this date + """ + expectedDateTo: DateTime + """ The term to search """ @@ -9085,6 +9998,7 @@ type Event implements Account & AccountWithHost & AccountWithContributions & Acc Same as onlySubscriptions, but returns only orders with active subscriptions """ onlyActiveSubscriptions: Boolean + expectedFundsFilter: ExpectedFundsFilter """ Return only orders made from/to that opposite account (only works when orders are already filtered with a main account) @@ -9127,7 +10041,7 @@ type Event implements Account & AccountWithHost & AccountWithContributions & Acc """ Use this field to filter expenses on their statuses """ - status: ExpenseStatusFilter + status: [ExpenseStatusFilter] """ Use this field to filter expenses on their type (RECEIPT/INVOICE) @@ -9199,6 +10113,16 @@ type Event implements Account & AccountWithHost & AccountWithContributions & Acc Filter expenses of type charges using these virtual cards """ virtualCards: [VirtualCardReferenceInput] + + """ + Filter expenses by the last user-role who replied to them + """ + lastCommentBy: [LastCommentBy] + + """ + Only return expenses that match these accounting categories + """ + accountingCategory: [String] ): ExpenseCollection! settings: JSON! conversations( @@ -9278,6 +10202,11 @@ type Event implements Account & AccountWithHost & AccountWithContributions & Acc categories: [String]! stats: AccountStats + """ + Whether this account can have changelog updates + """ + canHaveChangelogUpdates: Boolean! + """ Updates published by the account. To see unpublished updates, you need to be an admin and have the scope "updates". """ @@ -9296,6 +10225,7 @@ type Event implements Account & AccountWithHost & AccountWithContributions & Acc Only return published updates. """ onlyPublishedUpdates: Boolean = false + isDraft: Boolean onlyChangelogUpdates: Boolean orderBy: UpdateChronologicalOrderInput! = { field: CREATED_AT, direction: DESC } searchTerm: String @@ -9337,6 +10267,7 @@ type Event implements Account & AccountWithHost & AccountWithContributions & Acc offset: Int! = 0 isActive: Boolean accountType: [AccountType] + searchTerm: String ): AccountCollection! """ @@ -9353,6 +10284,31 @@ type Event implements Account & AccountWithHost & AccountWithContributions & Acc Logged-in user permissions on an account """ permissions: AccountPermissions! + + """ + Host application requests + """ + hostApplicationRequests( + """ + The number of results to fetch (default 10, max 1000) + """ + limit: Int! = 10 + + """ + The offset to use to fetch + """ + offset: Int! = 0 + + """ + Order of the results + """ + orderBy: ChronologicalOrderInput! = { field: CREATED_AT, direction: DESC } + + """ + Filter applications by status + """ + status: HostApplicationStatus + ): HostApplicationCollection! feed( """ Only returns activities before this date @@ -9379,6 +10335,11 @@ type Event implements Account & AccountWithHost & AccountWithContributions & Acc If this account was duplicated, the accounts that were created from it """ duplicatedAccounts(limit: Int! = 100, offset: Int! = 0): AccountCollection! + + """ + EXPERIMENTAL (this may change or be removed) + """ + transactionReports(timeUnit: TimeUnit = MONTH, dateFrom: DateTime, dateTo: DateTime): TransactionReports webhooks( """ The number of results to fetch (default 10, max 1000) @@ -9407,6 +10368,11 @@ type Event implements Account & AccountWithHost & AccountWithContributions & Acc """ hostFeePercent(paymentMethodService: PaymentMethodService, paymentMethodType: PaymentMethodType): Float + """ + Returns the Fiscal Host application + """ + hostApplication: HostApplication + """ How much platform fees are charged for this account """ @@ -9653,7 +10619,11 @@ type Individual implements Account { githubHandle: String @deprecated(reason: "2022-06-03: Please use repositoryUrl") repositoryUrl: String @deprecated(reason: "2023-01-16: Please use socialLinks") socialLinks: [SocialLink!]! - currency: String + + """ + The currency of the account + """ + currency: Currency! expensePolicy: String """ @@ -9661,11 +10631,6 @@ type Individual implements Account { """ isIncognito: Boolean! imageUrl(height: Int, format: ImageFormat): String - - """ - Returns whether this account has a custom image - """ - hasImage: Boolean! backgroundImageUrl(height: Int, format: ImageFormat): String """ @@ -9985,11 +10950,31 @@ type Individual implements Account { """ includeHostedAccounts: Boolean + """ + Include orders from children events/projects + """ + includeChildrenAccounts: Boolean! = false + + """ + Only return orders that were paused by these roles. status must be set to PAUSED. + """ + pausedBy: [OrderPausedBy] + """ Only return orders that were paid with this payment method. Must be an admin of the account owning the payment method. """ paymentMethod: PaymentMethodReferenceInput + """ + Only return orders that match these payment method services + """ + paymentMethodService: [PaymentMethodService] + + """ + Only return orders that match these payment method types + """ + paymentMethodType: [PaymentMethodType] + """ Whether to include incognito orders. Must be admin or root. Only with filter null or OUTGOING. """ @@ -10035,6 +11020,16 @@ type Individual implements Account { """ dateTo: DateTime + """ + Only return pending orders that were expected after this date + """ + expectedDateFrom: DateTime + + """ + Only return pending orders that were expected before this date + """ + expectedDateTo: DateTime + """ The term to search """ @@ -10050,6 +11045,7 @@ type Individual implements Account { Same as onlySubscriptions, but returns only orders with active subscriptions """ onlyActiveSubscriptions: Boolean + expectedFundsFilter: ExpectedFundsFilter """ Return only orders made from/to that opposite account (only works when orders are already filtered with a main account) @@ -10092,7 +11088,7 @@ type Individual implements Account { """ Use this field to filter expenses on their statuses """ - status: ExpenseStatusFilter + status: [ExpenseStatusFilter] """ Use this field to filter expenses on their type (RECEIPT/INVOICE) @@ -10164,6 +11160,16 @@ type Individual implements Account { Filter expenses of type charges using these virtual cards """ virtualCards: [VirtualCardReferenceInput] + + """ + Filter expenses by the last user-role who replied to them + """ + lastCommentBy: [LastCommentBy] + + """ + Only return expenses that match these accounting categories + """ + accountingCategory: [String] ): ExpenseCollection! settings: JSON! conversations( @@ -10241,6 +11247,11 @@ type Individual implements Account { categories: [String]! stats: AccountStats + """ + Whether this account can have changelog updates + """ + canHaveChangelogUpdates: Boolean! + """ Updates published by the account. To see unpublished updates, you need to be an admin and have the scope "updates". """ @@ -10259,6 +11270,7 @@ type Individual implements Account { Only return published updates. """ onlyPublishedUpdates: Boolean = false + isDraft: Boolean onlyChangelogUpdates: Boolean orderBy: UpdateChronologicalOrderInput! = { field: CREATED_AT, direction: DESC } searchTerm: String @@ -10300,6 +11312,7 @@ type Individual implements Account { offset: Int! = 0 isActive: Boolean accountType: [AccountType] + searchTerm: String ): AccountCollection! """ @@ -10316,6 +11329,31 @@ type Individual implements Account { Logged-in user permissions on an account """ permissions: AccountPermissions! + + """ + Host application requests + """ + hostApplicationRequests( + """ + The number of results to fetch (default 10, max 1000) + """ + limit: Int! = 10 + + """ + The offset to use to fetch + """ + offset: Int! = 0 + + """ + Order of the results + """ + orderBy: ChronologicalOrderInput! = { field: CREATED_AT, direction: DESC } + + """ + Filter applications by status + """ + status: HostApplicationStatus + ): HostApplicationCollection! feed( """ Only returns activities before this date @@ -10342,6 +11380,11 @@ type Individual implements Account { If this account was duplicated, the accounts that were created from it """ duplicatedAccounts(limit: Int! = 100, offset: Int! = 0): AccountCollection! + + """ + EXPERIMENTAL (this may change or be removed) + """ + transactionReports(timeUnit: TimeUnit = MONTH, dateFrom: DateTime, dateTo: DateTime): TransactionReports webhooks( """ The number of results to fetch (default 10, max 1000) @@ -10594,7 +11637,11 @@ type Organization implements Account & AccountWithContributions { githubHandle: String @deprecated(reason: "2022-06-03: Please use repositoryUrl") repositoryUrl: String @deprecated(reason: "2023-01-16: Please use socialLinks") socialLinks: [SocialLink!]! - currency: String + + """ + The currency of the account + """ + currency: Currency! expensePolicy: String """ @@ -10602,11 +11649,6 @@ type Organization implements Account & AccountWithContributions { """ isIncognito: Boolean! imageUrl(height: Int, format: ImageFormat): String - - """ - Returns whether this account has a custom image - """ - hasImage: Boolean! backgroundImageUrl(height: Int, format: ImageFormat): String """ @@ -10926,11 +11968,31 @@ type Organization implements Account & AccountWithContributions { """ includeHostedAccounts: Boolean + """ + Include orders from children events/projects + """ + includeChildrenAccounts: Boolean! = false + + """ + Only return orders that were paused by these roles. status must be set to PAUSED. + """ + pausedBy: [OrderPausedBy] + """ Only return orders that were paid with this payment method. Must be an admin of the account owning the payment method. """ paymentMethod: PaymentMethodReferenceInput + """ + Only return orders that match these payment method services + """ + paymentMethodService: [PaymentMethodService] + + """ + Only return orders that match these payment method types + """ + paymentMethodType: [PaymentMethodType] + """ Whether to include incognito orders. Must be admin or root. Only with filter null or OUTGOING. """ @@ -10976,6 +12038,16 @@ type Organization implements Account & AccountWithContributions { """ dateTo: DateTime + """ + Only return pending orders that were expected after this date + """ + expectedDateFrom: DateTime + + """ + Only return pending orders that were expected before this date + """ + expectedDateTo: DateTime + """ The term to search """ @@ -10991,6 +12063,7 @@ type Organization implements Account & AccountWithContributions { Same as onlySubscriptions, but returns only orders with active subscriptions """ onlyActiveSubscriptions: Boolean + expectedFundsFilter: ExpectedFundsFilter """ Return only orders made from/to that opposite account (only works when orders are already filtered with a main account) @@ -11033,7 +12106,7 @@ type Organization implements Account & AccountWithContributions { """ Use this field to filter expenses on their statuses """ - status: ExpenseStatusFilter + status: [ExpenseStatusFilter] """ Use this field to filter expenses on their type (RECEIPT/INVOICE) @@ -11105,6 +12178,16 @@ type Organization implements Account & AccountWithContributions { Filter expenses of type charges using these virtual cards """ virtualCards: [VirtualCardReferenceInput] + + """ + Filter expenses by the last user-role who replied to them + """ + lastCommentBy: [LastCommentBy] + + """ + Only return expenses that match these accounting categories + """ + accountingCategory: [String] ): ExpenseCollection! settings: JSON! conversations( @@ -11182,6 +12265,11 @@ type Organization implements Account & AccountWithContributions { categories: [String]! stats: AccountStats + """ + Whether this account can have changelog updates + """ + canHaveChangelogUpdates: Boolean! + """ Updates published by the account. To see unpublished updates, you need to be an admin and have the scope "updates". """ @@ -11200,6 +12288,7 @@ type Organization implements Account & AccountWithContributions { Only return published updates. """ onlyPublishedUpdates: Boolean = false + isDraft: Boolean onlyChangelogUpdates: Boolean orderBy: UpdateChronologicalOrderInput! = { field: CREATED_AT, direction: DESC } searchTerm: String @@ -11241,6 +12330,7 @@ type Organization implements Account & AccountWithContributions { offset: Int! = 0 isActive: Boolean accountType: [AccountType] + searchTerm: String ): AccountCollection! """ @@ -11257,6 +12347,31 @@ type Organization implements Account & AccountWithContributions { Logged-in user permissions on an account """ permissions: AccountPermissions! + + """ + Host application requests + """ + hostApplicationRequests( + """ + The number of results to fetch (default 10, max 1000) + """ + limit: Int! = 10 + + """ + The offset to use to fetch + """ + offset: Int! = 0 + + """ + Order of the results + """ + orderBy: ChronologicalOrderInput! = { field: CREATED_AT, direction: DESC } + + """ + Filter applications by status + """ + status: HostApplicationStatus + ): HostApplicationCollection! feed( """ Only returns activities before this date @@ -11283,6 +12398,11 @@ type Organization implements Account & AccountWithContributions { If this account was duplicated, the accounts that were created from it """ duplicatedAccounts(limit: Int! = 100, offset: Int! = 0): AccountCollection! + + """ + EXPERIMENTAL (this may change or be removed) + """ + transactionReports(timeUnit: TimeUnit = MONTH, dateFrom: DateTime, dateTo: DateTime): TransactionReports webhooks( """ The number of results to fetch (default 10, max 1000) @@ -11394,11 +12514,6 @@ type TransferWise { amountBatched: Amount } -""" -The `JSONObject` scalar type represents JSON objects as specified by [ECMA-404](http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf). -""" -scalar JSONObject - """ This represents a Vendor account """ @@ -11429,7 +12544,11 @@ type Vendor implements Account & AccountWithContributions { githubHandle: String @deprecated(reason: "2022-06-03: Please use repositoryUrl") repositoryUrl: String @deprecated(reason: "2023-01-16: Please use socialLinks") socialLinks: [SocialLink!]! - currency: String + + """ + The currency of the account + """ + currency: Currency! expensePolicy: String """ @@ -11437,11 +12556,6 @@ type Vendor implements Account & AccountWithContributions { """ isIncognito: Boolean! imageUrl(height: Int, format: ImageFormat): String - - """ - Returns whether this account has a custom image - """ - hasImage: Boolean! backgroundImageUrl(height: Int, format: ImageFormat): String """ @@ -11761,11 +12875,31 @@ type Vendor implements Account & AccountWithContributions { """ includeHostedAccounts: Boolean + """ + Include orders from children events/projects + """ + includeChildrenAccounts: Boolean! = false + + """ + Only return orders that were paused by these roles. status must be set to PAUSED. + """ + pausedBy: [OrderPausedBy] + """ Only return orders that were paid with this payment method. Must be an admin of the account owning the payment method. """ paymentMethod: PaymentMethodReferenceInput + """ + Only return orders that match these payment method services + """ + paymentMethodService: [PaymentMethodService] + + """ + Only return orders that match these payment method types + """ + paymentMethodType: [PaymentMethodType] + """ Whether to include incognito orders. Must be admin or root. Only with filter null or OUTGOING. """ @@ -11811,6 +12945,16 @@ type Vendor implements Account & AccountWithContributions { """ dateTo: DateTime + """ + Only return pending orders that were expected after this date + """ + expectedDateFrom: DateTime + + """ + Only return pending orders that were expected before this date + """ + expectedDateTo: DateTime + """ The term to search """ @@ -11826,6 +12970,7 @@ type Vendor implements Account & AccountWithContributions { Same as onlySubscriptions, but returns only orders with active subscriptions """ onlyActiveSubscriptions: Boolean + expectedFundsFilter: ExpectedFundsFilter """ Return only orders made from/to that opposite account (only works when orders are already filtered with a main account) @@ -11868,7 +13013,7 @@ type Vendor implements Account & AccountWithContributions { """ Use this field to filter expenses on their statuses """ - status: ExpenseStatusFilter + status: [ExpenseStatusFilter] """ Use this field to filter expenses on their type (RECEIPT/INVOICE) @@ -11940,6 +13085,16 @@ type Vendor implements Account & AccountWithContributions { Filter expenses of type charges using these virtual cards """ virtualCards: [VirtualCardReferenceInput] + + """ + Filter expenses by the last user-role who replied to them + """ + lastCommentBy: [LastCommentBy] + + """ + Only return expenses that match these accounting categories + """ + accountingCategory: [String] ): ExpenseCollection! settings: JSON! conversations( @@ -12019,6 +13174,11 @@ type Vendor implements Account & AccountWithContributions { categories: [String]! stats: AccountStats + """ + Whether this account can have changelog updates + """ + canHaveChangelogUpdates: Boolean! + """ Updates published by the account. To see unpublished updates, you need to be an admin and have the scope "updates". """ @@ -12037,6 +13197,7 @@ type Vendor implements Account & AccountWithContributions { Only return published updates. """ onlyPublishedUpdates: Boolean = false + isDraft: Boolean onlyChangelogUpdates: Boolean orderBy: UpdateChronologicalOrderInput! = { field: CREATED_AT, direction: DESC } searchTerm: String @@ -12078,6 +13239,7 @@ type Vendor implements Account & AccountWithContributions { offset: Int! = 0 isActive: Boolean accountType: [AccountType] + searchTerm: String ): AccountCollection! """ @@ -12094,6 +13256,31 @@ type Vendor implements Account & AccountWithContributions { Logged-in user permissions on an account """ permissions: AccountPermissions! + + """ + Host application requests + """ + hostApplicationRequests( + """ + The number of results to fetch (default 10, max 1000) + """ + limit: Int! = 10 + + """ + The offset to use to fetch + """ + offset: Int! = 0 + + """ + Order of the results + """ + orderBy: ChronologicalOrderInput! = { field: CREATED_AT, direction: DESC } + + """ + Filter applications by status + """ + status: HostApplicationStatus + ): HostApplicationCollection! feed( """ Only returns activities before this date @@ -12120,6 +13307,11 @@ type Vendor implements Account & AccountWithContributions { If this account was duplicated, the accounts that were created from it """ duplicatedAccounts(limit: Int! = 100, offset: Int! = 0): AccountCollection! + + """ + EXPERIMENTAL (this may change or be removed) + """ + transactionReports(timeUnit: TimeUnit = MONTH, dateFrom: DateTime, dateTo: DateTime): TransactionReports webhooks( """ The number of results to fetch (default 10, max 1000) @@ -12394,6 +13586,11 @@ type Query { Include vendors for this host """ includeVendorsForHost: AccountReferenceInput + + """ + Filter by the balance of the account and its children accounts (events and projects) + """ + consolidatedBalance: AmountRangeInput ): AccountCollection! activities( """ @@ -12570,7 +13767,7 @@ type Query { """ Use this field to filter expenses on their statuses """ - status: ExpenseStatusFilter + status: [ExpenseStatusFilter] """ Use this field to filter expenses on their type (RECEIPT/INVOICE) @@ -12642,6 +13839,16 @@ type Query { Filter expenses of type charges using these virtual cards """ virtualCards: [VirtualCardReferenceInput] + + """ + Filter expenses by the last user-role who replied to them + """ + lastCommentBy: [LastCommentBy] + + """ + Only return expenses that match these accounting categories + """ + accountingCategory: [String] ): ExpenseCollection! expenseTagStats( """ @@ -12828,11 +14035,31 @@ type Query { """ includeHostedAccounts: Boolean + """ + Include orders from children events/projects + """ + includeChildrenAccounts: Boolean! = false + + """ + Only return orders that were paused by these roles. status must be set to PAUSED. + """ + pausedBy: [OrderPausedBy] + """ Only return orders that were paid with this payment method. Must be an admin of the account owning the payment method. """ paymentMethod: PaymentMethodReferenceInput + """ + Only return orders that match these payment method services + """ + paymentMethodService: [PaymentMethodService] + + """ + Only return orders that match these payment method types + """ + paymentMethodType: [PaymentMethodType] + """ Whether to include incognito orders. Must be admin or root. Only with filter null or OUTGOING. """ @@ -12878,6 +14105,16 @@ type Query { """ dateTo: DateTime + """ + Only return pending orders that were expected after this date + """ + expectedDateFrom: DateTime + + """ + Only return pending orders that were expected before this date + """ + expectedDateTo: DateTime + """ The term to search """ @@ -12893,6 +14130,7 @@ type Query { Same as onlySubscriptions, but returns only orders with active subscriptions """ onlyActiveSubscriptions: Boolean + expectedFundsFilter: ExpectedFundsFilter """ Return only orders made from/to that opposite account (only works when orders are already filtered with a main account) @@ -12941,6 +14179,41 @@ type Query { """ throwIfMissing: Boolean = true ): Project + + """ + [!] Warning: this query is currently in beta and the API might change + """ + search( + """ + The search term to search for + """ + searchTerm: String! + + """ + Limit the scope of the search to this account and its children + """ + account: AccountReferenceInput + + """ + Limit the scope of the search to this host and its hosted accounts + """ + host: AccountReferenceInput + + """ + The maximum amount of time in millisecond to wait for a single entity type query to complete (for SQL search) + """ + timeout: Int! = 10000 + + """ + The default limit for each entity type + """ + defaultLimit: Int! = 10 + + """ + Whether to use ElasticSearch or not + """ + useElasticSearch: Boolean! = true + ): SearchResponse! tagStats( """ Return tags from collectives which includes this search term. Using this argument will ignore tagSearchTerm. Skipping this argument will use a more efficient query. @@ -12978,7 +14251,12 @@ type Query { """ The public id identifying the transaction (ie: rvelja97-pkzqbgq7-bbzyx6wd-50o8n4rm) """ - id: String + id: String @deprecated(reason: "2024-05-07: Please use the `transaction` field.") + + """ + Identifiers to retrieve the transaction. + """ + transaction: TransactionReferenceInput ): Transaction transactions( """ @@ -13152,6 +14430,16 @@ type Query { """ accountingCategory: [String] ): TransactionCollection! + + """ + Fetch a transactions import + """ + transactionsImport( + """ + The public id identifying the import (ie: rvelja97-pkzqbgq7-bbzyx6wd-50o8n4rm) + """ + id: String! + ): TransactionsImport update( """ Public identifier @@ -13168,6 +14456,10 @@ type Query { """ account: AccountReferenceInput ): Update + + """ + This query currently returns only published updates + """ updates( """ The number of results to fetch (default 10, max 1000) @@ -13193,6 +14485,8 @@ type Query { Host for the accounts for which to get updates """ host: [AccountReferenceInput] + onlyChangelogUpdates: Boolean + orderBy: UpdateChronologicalOrderInput! = { field: CREATED_AT, direction: DESC } ): UpdateCollection! paypalPlan( """ @@ -13271,6 +14565,7 @@ type Query { status: [VirtualCardRequestStatus] collective: [AccountReferenceInput] ): VirtualCardRequestCollection! + hostApplication(hostApplication: HostApplicationReferenceInput): HostApplication loggedInAccount: Individual me: Individual } @@ -13287,30 +14582,40 @@ enum TagSearchOperator { Two-letters country code following ISO3166_1 """ enum CountryISO { + """ + Andorra + """ + AD + + """ + The United Arab Emirates + """ + AE + """ Afghanistan """ AF """ - Åland Islands + Antigua and Barbuda """ - AX + AG """ - Albania + Anguilla """ - AL + AI """ - Algeria + Albania """ - DZ + AL """ - Andorra + Armenia """ - AD + AM """ Angola @@ -13318,9 +14623,9 @@ enum CountryISO { AO """ - Antigua and Barbuda + Antarctica """ - AG + AQ """ Argentina @@ -13328,9 +14633,14 @@ enum CountryISO { AR """ - Armenia + American Samoa """ - AM + AS + + """ + Austria + """ + AT """ Australia @@ -13338,9 +14648,14 @@ enum CountryISO { AU """ - Austria + Aruba """ - AT + AW + + """ + Åland Islands + """ + AX """ Azerbaijan @@ -13348,14 +14663,14 @@ enum CountryISO { AZ """ - The Bahamas + Bosnia and Herzegovina """ - BS + BA """ - Bahrain + Barbados """ - BH + BB """ Bangladesh @@ -13363,24 +14678,29 @@ enum CountryISO { BD """ - Barbados + Belgium """ - BB + BE """ - Belarus + Burkina """ - BY + BF """ - Belgium + Bulgaria """ - BE + BG """ - Belize + Bahrain """ - BZ + BH + + """ + Burundi + """ + BI """ Benin @@ -13388,24 +14708,29 @@ enum CountryISO { BJ """ - Bhutan + Saint Barthélemy """ - BT + BL """ - Bolivia + Bermuda """ - BO + BM """ - Bosnia and Herzegovina + Brunei """ - BA + BN """ - Botswana + Bolivia """ - BW + BO + + """ + Bonaire, Sint Eustatius and Saba + """ + BQ """ Brazil @@ -13413,34 +14738,34 @@ enum CountryISO { BR """ - Brunei + The Bahamas """ - BN + BS """ - Bulgaria + Bhutan """ - BG + BT """ - Burkina + Bouvet Island """ - BF + BV """ - Burundi + Botswana """ - BI + BW """ - Cambodia + Belarus """ - KH + BY """ - Cameroon + Belize """ - CM + BZ """ Canada @@ -13448,9 +14773,14 @@ enum CountryISO { CA """ - Cape Verde + Cocos Islands """ - CV + CC + + """ + The Democratic Republic of the Congo + """ + CD """ The Central African Republic @@ -13458,39 +14788,44 @@ enum CountryISO { CF """ - Chad + The Congo """ - TD + CG """ - Chile + Switzerland """ - CL + CH """ - China + Côte d'Ivoire """ - CN + CI """ - Colombia + Cook Islands """ - CO + CK """ - The Comoros + Chile """ - KM + CL """ - The Congo + Cameroon """ - CG + CM """ - The Democratic Republic of the Congo + China """ - CD + CN + + """ + Colombia + """ + CO """ Costa Rica @@ -13498,19 +14833,24 @@ enum CountryISO { CR """ - Côte d'Ivoire + Cuba """ - CI + CU """ - Croatia + Cape Verde """ - HR + CV """ - Cuba + Curaçao """ - CU + CW + + """ + Christmas Island + """ + CX """ Cyprus @@ -13523,15 +14863,20 @@ enum CountryISO { CZ """ - Denmark + Germany """ - DK + DE """ Djibouti """ DJ + """ + Denmark + """ + DK + """ Dominica """ @@ -13543,9 +14888,9 @@ enum CountryISO { DO """ - Timor-Leste + Algeria """ - TL + DZ """ Ecuador @@ -13553,19 +14898,19 @@ enum CountryISO { EC """ - Egypt + Estonia """ - EG + EE """ - El Salvador + Egypt """ - SV + EG """ - Equatorial Guinea + Western Sahara """ - GQ + EH """ Eritrea @@ -13573,59 +14918,54 @@ enum CountryISO { ER """ - Estonia + Spain """ - EE + ES """ Ethiopia """ ET - """ - Fiji - """ - FJ - """ Finland """ FI """ - France + Fiji """ - FR + FJ """ - Gabon + Falkland Islands """ - GA + FK """ - The Gambia + Micronesia """ - GM + FM """ - Georgia + Faroe Islands """ - GE + FO """ - Germany + France """ - DE + FR """ - Ghana + Gabon """ - GH + GA """ - Greece + The United Kingdom """ - GR + GB """ Grenada @@ -13633,719 +14973,689 @@ enum CountryISO { GD """ - Guatemala - """ - GT - - """ - Guernsey - """ - GG - - """ - Guinea - """ - GN - - """ - Guinea-Bissau - """ - GW - - """ - Guyana - """ - GY - - """ - Haiti - """ - HT - - """ - The Holy See + Georgia """ - VA + GE """ - Honduras + French Guiana """ - HN + GF """ - Hungary + Guernsey """ - HU + GG """ - Iceland + Ghana """ - IS + GH """ - India + Gibraltar """ - IN + GI """ - Indonesia + Greenland """ - ID + GL """ - Iran + The Gambia """ - IR + GM """ - Iraq + Guinea """ - IQ + GN """ - Ireland + Guadeloupe """ - IE + GP """ - Isle of Man + Equatorial Guinea """ - IM + GQ """ - Israel + Greece """ - IL + GR """ - Italy + South Georgia and The South Sandwich Islands """ - IT + GS """ - Jamaica + Guatemala """ - JM + GT """ - Japan + Guam """ - JP + GU """ - Jersey + Guinea-Bissau """ - JE + GW """ - Jordan + Guyana """ - JO + GY """ - Kazakhstan + Hong Kong """ - KZ + HK """ - Kenya + Heard Island and McDonald Islands """ - KE + HM """ - Kiribati + Honduras """ - KI + HN """ - The Democratic People's Republic of Korea + Croatia """ - KP + HR """ - The Republic of Korea + Haiti """ - KR + HT """ - Kuwait + Hungary """ - KW + HU """ - Kyrgyzstan + Indonesia """ - KG + ID """ - Laos + Ireland """ - LA + IE """ - Latvia + Israel """ - LV + IL """ - Lebanon + Isle of Man """ - LB + IM """ - Lesotho + India """ - LS + IN """ - Liberia + The British Indian Ocean Territory """ - LR + IO """ - Libya + Iraq """ - LY + IQ """ - Liechtenstein + Iran """ - LI + IR """ - Lithuania + Iceland """ - LT + IS """ - Luxembourg + Italy """ - LU + IT """ - Madagascar + Jersey """ - MG + JE """ - Malawi + Jamaica """ - MW + JM """ - Malaysia + Jordan """ - MY + JO """ - Maldives + Japan """ - MV + JP """ - Mali + Kenya """ - ML + KE """ - Malta + Kyrgyzstan """ - MT + KG """ - The Marshall Islands + Cambodia """ - MH + KH """ - Mauritania + Kiribati """ - MR + KI """ - Mauritius + The Comoros """ - MU + KM """ - Mexico + Saint Kitts and Nevis """ - MX + KN """ - Micronesia + The Democratic People's Republic of Korea """ - FM + KP """ - Moldova + The Republic of Korea """ - MD + KR """ - Monaco + Kuwait """ - MC + KW """ - Mongolia + Cayman Islands """ - MN + KY """ - Montenegro + Kazakhstan """ - ME + KZ """ - Morocco + Laos """ - MA + LA """ - Mozambique + Lebanon """ - MZ + LB """ - Myanmar + Saint Lucia """ - MM + LC """ - Namibia + Liechtenstein """ - NA + LI """ - Nauru + Sri Lanka """ - NR + LK """ - Nepal + Liberia """ - NP + LR """ - The Netherlands + Lesotho """ - NL + LS """ - New Zealand + Lithuania """ - NZ + LT """ - Nicaragua + Luxembourg """ - NI + LU """ - The Niger + Latvia """ - NE + LV """ - Nigeria + Libya """ - NG + LY """ - Norway + Morocco """ - NO + MA """ - Oman + Monaco """ - OM + MC """ - Pakistan + Moldova """ - PK + MD """ - Palau + Montenegro """ - PW + ME """ - Panama + Saint Martin """ - PA + MF """ - Papua New Guinea + Madagascar """ - PG + MG """ - Paraguay + The Marshall Islands """ - PY + MH """ - Peru + Macedonia """ - PE + MK """ - The Philippines + Mali """ - PH + ML """ - Poland + Myanmar """ - PL + MM """ - Portugal + Mongolia """ - PT + MN """ - Qatar + Macao """ - QA + MO """ - Romania + Northern Mariana Islands """ - RO + MP """ - Russia + Martinique """ - RU + MQ """ - Rwanda + Mauritania """ - RW + MR """ - Saint Kitts and Nevis + Montserrat """ - KN + MS """ - Saint Lucia + Malta """ - LC + MT """ - Saint Vincent and The Grenadines + Mauritius """ - VC + MU """ - Samoa + Maldives """ - WS + MV """ - San Marino + Malawi """ - SM + MW """ - Sao Tome and Principe + Mexico """ - ST + MX """ - Saudi Arabia + Malaysia """ - SA + MY """ - Senegal + Mozambique """ - SN + MZ """ - Serbia + Namibia """ - RS + NA """ - Seychelles + New Caledonia """ - SC + NC """ - Sierra Leone + The Niger """ - SL + NE """ - Singapore + Norfolk Island """ - SG + NF """ - Slovakia + Nigeria """ - SK + NG """ - Slovenia + Nicaragua """ - SI + NI """ - Solomon Islands + The Netherlands """ - SB + NL """ - Somalia + Norway """ - SO + NO """ - South Africa + Nepal """ - ZA + NP """ - Spain + Nauru """ - ES + NR """ - Sri Lanka + Niue """ - LK + NU """ - The Sudan + New Zealand """ - SD + NZ """ - Suriname + Oman """ - SR + OM """ - Swaziland + Panama """ - SZ + PA """ - Sweden + Peru """ - SE + PE """ - Switzerland + French Polynesia """ - CH + PF """ - Syria + Papua New Guinea """ - SY + PG """ - Tajikistan + The Philippines """ - TJ + PH """ - Tanzania + Pakistan """ - TZ + PK """ - Thailand + Poland """ - TH + PL """ - Macedonia + Saint Pierre and Miquelon """ - MK + PM """ - Togo + Pitcairn """ - TG + PN """ - Tonga + Puerto Rico """ - TO + PR """ - Trinidad and Tobago + The Occupied Palestinian Territory """ - TT + PS """ - Tunisia + Portugal """ - TN + PT """ - Turkey + Palau """ - TR + PW """ - Turkmenistan + Paraguay """ - TM + PY """ - Tuvalu + Qatar """ - TV + QA """ - Uganda + Réunion """ - UG + RE """ - Ukraine + Romania """ - UA + RO """ - The United Arab Emirates + Serbia """ - AE + RS """ - The United Kingdom + Russia """ - GB + RU """ - The United States + Rwanda """ - US + RW """ - Uruguay + Saudi Arabia """ - UY + SA """ - Uzbekistan + Solomon Islands """ - UZ + SB """ - Vanuatu + Seychelles """ - VU + SC """ - Venezuela + The Sudan """ - VE + SD """ - Viet Nam + Sweden """ - VN + SE """ - Yemen + Singapore """ - YE + SG """ - Zambia + Saint Helena """ - ZM + SH """ - Zimbabwe + Slovenia """ - ZW + SI """ - American Samoa + Svalbard and Jan Mayen """ - AS + SJ """ - Anguilla + Slovakia """ - AI + SK """ - Antarctica + Sierra Leone """ - AQ + SL """ - Aruba + San Marino """ - AW + SM """ - Bermuda + Senegal """ - BM + SN """ - Bouvet Island + Somalia """ - BV + SO """ - The British Indian Ocean Territory + Suriname """ - IO + SR """ - Cayman Islands + South Sudan """ - KY + SS """ - Christmas Island + Sao Tome and Principe """ - CX + ST """ - Cocos Islands + El Salvador """ - CC + SV """ - Cook Islands + Sint Maarten """ - CK + SX """ - Falkland Islands + Syria """ - FK + SY """ - Faroe Islands + Swaziland """ - FO + SZ """ - French Guiana + Turks and Caicos Islands """ - GF + TC """ - French Polynesia + Chad """ - PF + TD """ The French Southern Territories @@ -14353,169 +15663,169 @@ enum CountryISO { TF """ - Gibraltar + Togo """ - GI + TG """ - Greenland + Thailand """ - GL + TH """ - Guadeloupe + Tajikistan """ - GP + TJ """ - Guam + Tokelau """ - GU + TK """ - Heard Island and McDonald Islands + Timor-Leste """ - HM + TL """ - Hong Kong + Turkmenistan """ - HK + TM """ - Macao + Tunisia """ - MO + TN """ - Martinique + Tonga """ - MQ + TO """ - Mayotte + Turkey """ - YT + TR """ - Montserrat + Trinidad and Tobago """ - MS + TT """ - Netherlands Antilles + Tuvalu """ - AN + TV """ - New Caledonia + Taiwan """ - NC + TW """ - Niue + Tanzania """ - NU + TZ """ - Norfolk Island + Ukraine """ - NF + UA """ - Northern Mariana Islands + Uganda """ - MP + UG """ - The Occupied Palestinian Territory + United States Minor Outlying Islands """ - PS + UM """ - Pitcairn + The United States """ - PN + US """ - Puerto Rico + Uruguay """ - PR + UY """ - Réunion + Uzbekistan """ - RE + UZ """ - Saint Barthélemy + The Holy See """ - BL + VA """ - Saint Helena + Saint Vincent and The Grenadines """ - SH + VC """ - Saint Martin + Venezuela """ - MF + VE """ - Saint Pierre and Miquelon + British Virgin Islands """ - PM + VG """ - South Georgia and The South Sandwich Islands + US Virgin Islands """ - GS + VI """ - Svalbard and Jan Mayen + Viet Nam """ - SJ + VN """ - Taiwan + Vanuatu """ - TW + VU """ - Tokelau + Wallis and Futuna """ - TK + WF """ - Turks and Caicos Islands + Samoa """ - TC + WS """ - United States Minor Outlying Islands + Yemen """ - UM + YE """ - British Virgin Islands + Mayotte """ - VG + YT """ - US Virgin Islands + South Africa """ - VI + ZA """ - Wallis and Futuna + Zambia """ - WF + ZM """ - Western Sahara + Zimbabwe """ - EH + ZW } enum ActivityAndClassesType { @@ -14558,10 +15868,12 @@ enum ActivityAndClassesType { COLLECTIVE_EXPENSE_UNSCHEDULED_FOR_PAYMENT COLLECTIVE_EXPENSE_ERROR COLLECTIVE_EXPENSE_INVITE_DRAFTED + COLLECTIVE_EXPENSE_INVITE_DECLINED COLLECTIVE_EXPENSE_RECURRING_DRAFTED COLLECTIVE_EXPENSE_MISSING_RECEIPT TAXFORM_REQUEST TAXFORM_RECEIVED + TAXFORM_INVALIDATED COLLECTIVE_VIRTUAL_CARD_ADDED COLLECTIVE_VIRTUAL_CARD_MISSING_RECEIPTS COLLECTIVE_VIRTUAL_CARD_RESUMED @@ -14581,10 +15893,12 @@ enum ActivityAndClassesType { COLLECTIVE_CORE_MEMBER_REMOVED COLLECTIVE_CORE_MEMBER_EDITED COLLECTIVE_TRANSACTION_CREATED + TRANSACTIONS_IMPORT_CREATED COLLECTIVE_UPDATE_CREATED COLLECTIVE_UPDATE_PUBLISHED COLLECTIVE_CONTACT HOST_APPLICATION_CONTACT + HOST_APPLICATION_COMMENT_CREATED CONTRIBUTION_REJECTED SUBSCRIPTION_ACTIVATED SUBSCRIPTION_CANCELED @@ -14598,14 +15912,20 @@ enum ActivityAndClassesType { ORDER_PENDING_CONTRIBUTION_REMINDER ORDER_PROCESSING ORDER_PAYMENT_FAILED + ORDER_REVIEW_OPENED + ORDER_REVIEW_CLOSED + ORDER_DISPUTE_CREATED + ORDER_DISPUTE_CLOSED ORDER_THANKYOU ORDER_UPDATED + ADDED_FUNDS_EDITED VENDOR_CREATED VENDOR_EDITED VENDOR_DELETED ORDER_PENDING_CREATED ORDER_PENDING_FOLLOWUP ORDER_PENDING_RECEIVED + ORDER_PENDING_EXPIRED ORDERS_SUSPICIOUS PAYMENT_FAILED PAYMENT_CREDITCARD_CONFIRMATION @@ -14710,7 +16030,11 @@ type Fund implements Account & AccountWithHost & AccountWithContributions { githubHandle: String @deprecated(reason: "2022-06-03: Please use repositoryUrl") repositoryUrl: String @deprecated(reason: "2023-01-16: Please use socialLinks") socialLinks: [SocialLink!]! - currency: String + + """ + The currency of the account + """ + currency: Currency! expensePolicy: String """ @@ -14718,11 +16042,6 @@ type Fund implements Account & AccountWithHost & AccountWithContributions { """ isIncognito: Boolean! imageUrl(height: Int, format: ImageFormat): String - - """ - Returns whether this account has a custom image - """ - hasImage: Boolean! backgroundImageUrl(height: Int, format: ImageFormat): String """ @@ -15042,11 +16361,31 @@ type Fund implements Account & AccountWithHost & AccountWithContributions { """ includeHostedAccounts: Boolean + """ + Include orders from children events/projects + """ + includeChildrenAccounts: Boolean! = false + + """ + Only return orders that were paused by these roles. status must be set to PAUSED. + """ + pausedBy: [OrderPausedBy] + """ Only return orders that were paid with this payment method. Must be an admin of the account owning the payment method. """ paymentMethod: PaymentMethodReferenceInput + """ + Only return orders that match these payment method services + """ + paymentMethodService: [PaymentMethodService] + + """ + Only return orders that match these payment method types + """ + paymentMethodType: [PaymentMethodType] + """ Whether to include incognito orders. Must be admin or root. Only with filter null or OUTGOING. """ @@ -15092,6 +16431,16 @@ type Fund implements Account & AccountWithHost & AccountWithContributions { """ dateTo: DateTime + """ + Only return pending orders that were expected after this date + """ + expectedDateFrom: DateTime + + """ + Only return pending orders that were expected before this date + """ + expectedDateTo: DateTime + """ The term to search """ @@ -15107,6 +16456,7 @@ type Fund implements Account & AccountWithHost & AccountWithContributions { Same as onlySubscriptions, but returns only orders with active subscriptions """ onlyActiveSubscriptions: Boolean + expectedFundsFilter: ExpectedFundsFilter """ Return only orders made from/to that opposite account (only works when orders are already filtered with a main account) @@ -15149,7 +16499,7 @@ type Fund implements Account & AccountWithHost & AccountWithContributions { """ Use this field to filter expenses on their statuses """ - status: ExpenseStatusFilter + status: [ExpenseStatusFilter] """ Use this field to filter expenses on their type (RECEIPT/INVOICE) @@ -15221,6 +16571,16 @@ type Fund implements Account & AccountWithHost & AccountWithContributions { Filter expenses of type charges using these virtual cards """ virtualCards: [VirtualCardReferenceInput] + + """ + Filter expenses by the last user-role who replied to them + """ + lastCommentBy: [LastCommentBy] + + """ + Only return expenses that match these accounting categories + """ + accountingCategory: [String] ): ExpenseCollection! settings: JSON! conversations( @@ -15300,6 +16660,11 @@ type Fund implements Account & AccountWithHost & AccountWithContributions { categories: [String]! stats: AccountStats + """ + Whether this account can have changelog updates + """ + canHaveChangelogUpdates: Boolean! + """ Updates published by the account. To see unpublished updates, you need to be an admin and have the scope "updates". """ @@ -15318,6 +16683,7 @@ type Fund implements Account & AccountWithHost & AccountWithContributions { Only return published updates. """ onlyPublishedUpdates: Boolean = false + isDraft: Boolean onlyChangelogUpdates: Boolean orderBy: UpdateChronologicalOrderInput! = { field: CREATED_AT, direction: DESC } searchTerm: String @@ -15359,6 +16725,7 @@ type Fund implements Account & AccountWithHost & AccountWithContributions { offset: Int! = 0 isActive: Boolean accountType: [AccountType] + searchTerm: String ): AccountCollection! """ @@ -15375,6 +16742,31 @@ type Fund implements Account & AccountWithHost & AccountWithContributions { Logged-in user permissions on an account """ permissions: AccountPermissions! + + """ + Host application requests + """ + hostApplicationRequests( + """ + The number of results to fetch (default 10, max 1000) + """ + limit: Int! = 10 + + """ + The offset to use to fetch + """ + offset: Int! = 0 + + """ + Order of the results + """ + orderBy: ChronologicalOrderInput! = { field: CREATED_AT, direction: DESC } + + """ + Filter applications by status + """ + status: HostApplicationStatus + ): HostApplicationCollection! feed( """ Only returns activities before this date @@ -15401,6 +16793,11 @@ type Fund implements Account & AccountWithHost & AccountWithContributions { If this account was duplicated, the accounts that were created from it """ duplicatedAccounts(limit: Int! = 100, offset: Int! = 0): AccountCollection! + + """ + EXPERIMENTAL (this may change or be removed) + """ + transactionReports(timeUnit: TimeUnit = MONTH, dateFrom: DateTime, dateTo: DateTime): TransactionReports webhooks( """ The number of results to fetch (default 10, max 1000) @@ -15429,6 +16826,11 @@ type Fund implements Account & AccountWithHost & AccountWithContributions { """ hostFeePercent(paymentMethodService: PaymentMethodService, paymentMethodType: PaymentMethodType): Float + """ + Returns the Fiscal Host application + """ + hostApplication: HostApplication + """ How much platform fees are charged for this account """ @@ -15553,7 +16955,11 @@ type Project implements Account & AccountWithHost & AccountWithContributions & A githubHandle: String @deprecated(reason: "2022-06-03: Please use repositoryUrl") repositoryUrl: String @deprecated(reason: "2023-01-16: Please use socialLinks") socialLinks: [SocialLink!]! - currency: String + + """ + The currency of the account + """ + currency: Currency! expensePolicy: String """ @@ -15561,11 +16967,6 @@ type Project implements Account & AccountWithHost & AccountWithContributions & A """ isIncognito: Boolean! imageUrl(height: Int, format: ImageFormat): String - - """ - Returns whether this account has a custom image - """ - hasImage: Boolean! backgroundImageUrl(height: Int, format: ImageFormat): String """ @@ -15885,11 +17286,31 @@ type Project implements Account & AccountWithHost & AccountWithContributions & A """ includeHostedAccounts: Boolean + """ + Include orders from children events/projects + """ + includeChildrenAccounts: Boolean! = false + + """ + Only return orders that were paused by these roles. status must be set to PAUSED. + """ + pausedBy: [OrderPausedBy] + """ Only return orders that were paid with this payment method. Must be an admin of the account owning the payment method. """ paymentMethod: PaymentMethodReferenceInput + """ + Only return orders that match these payment method services + """ + paymentMethodService: [PaymentMethodService] + + """ + Only return orders that match these payment method types + """ + paymentMethodType: [PaymentMethodType] + """ Whether to include incognito orders. Must be admin or root. Only with filter null or OUTGOING. """ @@ -15935,6 +17356,16 @@ type Project implements Account & AccountWithHost & AccountWithContributions & A """ dateTo: DateTime + """ + Only return pending orders that were expected after this date + """ + expectedDateFrom: DateTime + + """ + Only return pending orders that were expected before this date + """ + expectedDateTo: DateTime + """ The term to search """ @@ -15950,6 +17381,7 @@ type Project implements Account & AccountWithHost & AccountWithContributions & A Same as onlySubscriptions, but returns only orders with active subscriptions """ onlyActiveSubscriptions: Boolean + expectedFundsFilter: ExpectedFundsFilter """ Return only orders made from/to that opposite account (only works when orders are already filtered with a main account) @@ -15992,7 +17424,7 @@ type Project implements Account & AccountWithHost & AccountWithContributions & A """ Use this field to filter expenses on their statuses """ - status: ExpenseStatusFilter + status: [ExpenseStatusFilter] """ Use this field to filter expenses on their type (RECEIPT/INVOICE) @@ -16064,6 +17496,16 @@ type Project implements Account & AccountWithHost & AccountWithContributions & A Filter expenses of type charges using these virtual cards """ virtualCards: [VirtualCardReferenceInput] + + """ + Filter expenses by the last user-role who replied to them + """ + lastCommentBy: [LastCommentBy] + + """ + Only return expenses that match these accounting categories + """ + accountingCategory: [String] ): ExpenseCollection! settings: JSON! conversations( @@ -16143,6 +17585,11 @@ type Project implements Account & AccountWithHost & AccountWithContributions & A categories: [String]! stats: AccountStats + """ + Whether this account can have changelog updates + """ + canHaveChangelogUpdates: Boolean! + """ Updates published by the account. To see unpublished updates, you need to be an admin and have the scope "updates". """ @@ -16161,6 +17608,7 @@ type Project implements Account & AccountWithHost & AccountWithContributions & A Only return published updates. """ onlyPublishedUpdates: Boolean = false + isDraft: Boolean onlyChangelogUpdates: Boolean orderBy: UpdateChronologicalOrderInput! = { field: CREATED_AT, direction: DESC } searchTerm: String @@ -16202,6 +17650,7 @@ type Project implements Account & AccountWithHost & AccountWithContributions & A offset: Int! = 0 isActive: Boolean accountType: [AccountType] + searchTerm: String ): AccountCollection! """ @@ -16218,6 +17667,31 @@ type Project implements Account & AccountWithHost & AccountWithContributions & A Logged-in user permissions on an account """ permissions: AccountPermissions! + + """ + Host application requests + """ + hostApplicationRequests( + """ + The number of results to fetch (default 10, max 1000) + """ + limit: Int! = 10 + + """ + The offset to use to fetch + """ + offset: Int! = 0 + + """ + Order of the results + """ + orderBy: ChronologicalOrderInput! = { field: CREATED_AT, direction: DESC } + + """ + Filter applications by status + """ + status: HostApplicationStatus + ): HostApplicationCollection! feed( """ Only returns activities before this date @@ -16244,6 +17718,11 @@ type Project implements Account & AccountWithHost & AccountWithContributions & A If this account was duplicated, the accounts that were created from it """ duplicatedAccounts(limit: Int! = 100, offset: Int! = 0): AccountCollection! + + """ + EXPERIMENTAL (this may change or be removed) + """ + transactionReports(timeUnit: TimeUnit = MONTH, dateFrom: DateTime, dateTo: DateTime): TransactionReports webhooks( """ The number of results to fetch (default 10, max 1000) @@ -16272,6 +17751,11 @@ type Project implements Account & AccountWithHost & AccountWithContributions & A """ hostFeePercent(paymentMethodService: PaymentMethodService, paymentMethodType: PaymentMethodType): Float + """ + Returns the Fiscal Host application + """ + hostApplication: HostApplication + """ How much platform fees are charged for this account """ @@ -16361,6 +17845,98 @@ type Project implements Account & AccountWithHost & AccountWithContributions & A parent: Account } +type SearchResponse { + """ + Search results + """ + results: SearchResults! +} + +""" +Search results for all types +""" +type SearchResults { + """ + Search results for Accounts + """ + accounts: SearchResultsAccounts + + """ + Search results for Comments + """ + comments: SearchResultsComments + + """ + Search results for Expenses + """ + expenses: SearchResultsExpenses + + """ + Search results for HostApplications + """ + hostApplications: SearchResultsHostApplications + + """ + Search results for Orders + """ + orders: SearchResultsOrders + + """ + Search results for Tiers + """ + tiers: SearchResultsTiers + + """ + Search results for Transactions + """ + transactions: SearchResultsTransactions + + """ + Search results for Updates + """ + updates: SearchResultsUpdates +} + +type SearchResultsAccounts { + collection: AccountCollection! + highlights: JSONObject +} + +type SearchResultsComments { + collection: CommentCollection! + highlights: JSONObject +} + +type SearchResultsExpenses { + collection: ExpenseCollection! + highlights: JSONObject +} + +type SearchResultsHostApplications { + collection: HostApplicationCollection! + highlights: JSONObject +} + +type SearchResultsOrders { + collection: OrderCollection! + highlights: JSONObject +} + +type SearchResultsTiers { + collection: TierCollection! + highlights: JSONObject +} + +type SearchResultsTransactions { + collection: TransactionCollection! + highlights: JSONObject +} + +type SearchResultsUpdates { + collection: UpdateCollection! + highlights: JSONObject +} + input TierReferenceInput { """ The id assigned to the Tier @@ -16378,6 +17954,18 @@ input TierReferenceInput { isCustom: Boolean } +input TransactionReferenceInput { + """ + The public id identifying the transaction (ie: dgm9bnk8-0437xqry-ejpvzeol-jdayw5re) + """ + id: String + + """ + The internal id of the transaction (ie: 580) + """ + legacyId: Int +} + """ A PayPal plan to associate with a contribution """ @@ -16400,70 +17988,17 @@ type VirtualCardRequestCollection implements Collection { nodes: [VirtualCardRequest!] } +input HostApplicationReferenceInput { + """ + The public id identifying the host application (ie: dgm9bnk8-0437xqry-ejpvzeol-jdayw5re) + """ + id: String +} + """ This is the root mutation """ type Mutation { - """ - Add funds to the given account. Scope: "host". - """ - addFunds( - """ - The account that will be used as the source of the funds - """ - fromAccount: AccountReferenceInput! - - """ - The account that will receive the funds - """ - account: AccountReferenceInput! - - """ - The tier to which the funds will be added - """ - tier: TierReferenceInput - - """ - The total amount of the order, including taxes - """ - amount: AmountInput! - - """ - The host fee percent to apply to the order, as a float between 0 and 100 - """ - hostFeePercent: Float - - """ - A short description of the contribution - """ - description: String! - - """ - A private note for the host - """ - memo: String - - """ - The date at which the order was processed - """ - processedAt: DateTime - - """ - The invoice template to use for this order - """ - invoiceTemplate: String - - """ - The tax to apply to the order - """ - tax: TaxInput - - """ - The accounting category of this order - """ - accountingCategory: AccountingCategoryReferenceInput - ): Order! - """ Create a Collective. Scope: "account". """ @@ -16662,7 +18197,22 @@ type Mutation { """ Message to send by email to the admins of the account """ - message: String + message: String @deprecated(reason: "2024-08-23: Use messageForAccountAdmins instead") + + """ + Message to send by email to the admins of the account + """ + messageForAccountAdmins: String + + """ + Message to send by email to the contributors when pausing their contributions (with PayPal) or unpausing + """ + messageForContributors: String + + """ + Whether to pause recurring contributions + """ + pauseExistingRecurringContributions: Boolean! = false ): Account! """ @@ -16806,6 +18356,146 @@ type Mutation { """ categories: [AccountingCategoryInput!]! ): Account! + + """ + Add funds to the given account. Scope: "host". + """ + addFunds( + """ + The account that will be used as the source of the funds + """ + fromAccount: AccountReferenceInput! + + """ + The account that will receive the funds + """ + account: AccountReferenceInput! + + """ + The tier to which the funds will be added + """ + tier: TierReferenceInput + + """ + The total amount of the order, including fees and taxes + """ + amount: AmountInput! + + """ + The payment processor fee amount + """ + paymentProcessorFee: AmountInput + + """ + The host fee percent to apply to the order, as a float between 0 and 100 + """ + hostFeePercent: Float + + """ + A short description of the contribution + """ + description: String! + + """ + A private note for the host + """ + memo: String + + """ + The date at which the order was processed + """ + processedAt: DateTime + + """ + The invoice template to use for this order + """ + invoiceTemplate: String + + """ + The tax to apply to the order + """ + tax: TaxInput + + """ + The accounting category of this order + """ + accountingCategory: AccountingCategoryReferenceInput + + """ + The transaction import row to associate with this order + """ + transactionsImportRow: TransactionsImportRowReferenceInput + ): Order! + + """ + Add funds to the given account. Scope: "host". + """ + editAddedFunds( + """ + The order to edit + """ + order: OrderReferenceInput! + + """ + The account that will be used as the source of the funds + """ + fromAccount: AccountReferenceInput! + + """ + The account that will receive the funds + """ + account: AccountReferenceInput! + + """ + The tier to which the funds will be added + """ + tier: TierReferenceInput + + """ + The total amount of the order, including fees and taxes + """ + amount: AmountInput! + + """ + The payment processor fee amount + """ + paymentProcessorFee: AmountInput + + """ + The host fee percent to apply to the order, as a float between 0 and 100 + """ + hostFeePercent: Float + + """ + A short description of the contribution + """ + description: String! + + """ + A private note for the host + """ + memo: String + + """ + The date at which the order was processed + """ + processedAt: DateTime + + """ + The invoice template to use for this order + """ + invoiceTemplate: String + + """ + The tax to apply to the order + """ + tax: TaxInput + + """ + The accounting category of this order + """ + accountingCategory: AccountingCategoryReferenceInput + ): Order! createApplication(application: ApplicationCreateInput!): Application updateApplication(application: ApplicationUpdateInput!): Application deleteApplication(application: ApplicationReferenceInput!): Application @@ -16958,6 +18648,11 @@ type Mutation { Recurring Expense information """ recurring: RecurringExpenseInput + + """ + If the expense was imported, this is the reference to the row + """ + transactionsImportRow: TransactionsImportRowReferenceInput ): Expense! """ @@ -16994,6 +18689,11 @@ type Mutation { """ expense: ExpenseReferenceInput! + """ + Expense draft key if its action by invited user without account + """ + draftKey: String + """ The action to trigger """ @@ -17097,12 +18797,17 @@ type Mutation { """ The account that applied to the host """ - account: AccountReferenceInput! + account: AccountReferenceInput @deprecated(reason: "2024-07-24: Please use hostApplication") + + """ + The host application + """ + hostApplication: HostApplicationReferenceInput """ The host concerned by the application """ - host: AccountReferenceInput! + host: AccountReferenceInput @deprecated(reason: "2024-07-24: Please use hostApplication") """ What to do with the application @@ -17165,6 +18870,16 @@ type Mutation { currentPassword: String ): SetPasswordResponse! + """ + Confirm email for Individual. Scope: "account". + """ + confirmEmail( + """ + The token to confirm the email. + """ + token: NonEmptyString! + ): IndividualConfirmEmailResponse! + """ Submit a legal document """ @@ -17185,6 +18900,36 @@ type Mutation { formData: JSON! ): LegalDocument! + """ + Edit the status of a legal document + """ + editLegalDocumentStatus( + """ + The ID of the legal document + """ + id: String! + + """ + The new status of the legal document + """ + status: LegalDocumentRequestStatus! + + """ + The host of the legal document + """ + host: AccountReferenceInput! + + """ + A message to explain the change in status. Will be sent to the legal document submitter + """ + message: String + + """ + The new document link for the legal document. Must pass status=RECEIVED. + """ + file: Upload + ): LegalDocument! + """ Invite a new member to the Collective. Scope: "account". """ @@ -17444,7 +19189,17 @@ type Mutation { """ A mutation for the host to approve or reject an order. Scope: "orders". """ - processPendingOrder(order: OrderUpdateInput!, action: ProcessOrderAction!): Order! + processPendingOrder( + """ + The order to process + """ + order: OrderUpdateInput! + + """ + The action to take on the order + """ + action: ProcessOrderAction! + ): Order! """ [Root only] A mutation to move orders from one account to another @@ -17561,6 +19316,36 @@ type Mutation { """ removePayoutMethod(payoutMethodId: String!): PayoutMethod! + """ + Generate a Plaid Link token + """ + generatePlaidLinkToken: PlaidLinkTokenCreateResponse! + + """ + Connect a Plaid account + """ + connectPlaidAccount( + """ + The public token returned by the Plaid Link flow + """ + publicToken: String! + + """ + The account to which the Plaid account should be connected + """ + host: AccountReferenceInput! + + """ + The name of the bank + """ + sourceName: String + + """ + The name of the bank account + """ + name: String + ): PlaidConnectAccountResponse! + """ [Root only] Edits account flags (deleted, banned, archived, trusted host) """ @@ -17648,68 +19433,113 @@ type Mutation { """ If true, the result will be simulated and summarized in the response message """ - dryRun: Boolean! - ): BanAccountResponse! + dryRun: Boolean! + ): BanAccountResponse! + + """ + [Root only] A mutation to move expenses from one account to another + """ + moveExpenses( + """ + The orders to move + """ + expenses: [ExpenseReferenceInput!]! + + """ + The account to move the expenses to. This must be a non USER account. + """ + destinationAccount: AccountReferenceInput! + ): [Expense]! + + """ + Refunds a transaction. Scope: "transactions". + """ + refundTransaction( + """ + Reference of the transaction to refund + """ + transaction: TransactionReferenceInput! + ): Transaction + + """ + Rejects transaction, removes member from Collective, and sends a message to the contributor. Scope: "transactions". + """ + rejectTransaction( + """ + Reference of the transaction to refund + """ + transaction: TransactionReferenceInput! + + """ + Message to send to the contributor whose contribution has been rejected + """ + message: String + ): Transaction! + + """ + Create a new import. To manually add transactions to it, use `importTransactions`. + """ + createTransactionsImport( + """ + Account that will hold the import (usually the host) + """ + account: AccountReferenceInput! + + """ + Source of the import (e.g. "Bank of America", "Eventbrite", etc...) + """ + source: NonEmptyString! - """ - [Root only] A mutation to move expenses from one account to another - """ - moveExpenses( """ - The orders to move + Name of the import (e.g. "Contributions May 2021", "Tickets for Mautic Conference 2024") """ - expenses: [ExpenseReferenceInput!]! + name: NonEmptyString! """ - The account to move the expenses to. This must be a non USER account. + Type of the import """ - destinationAccount: AccountReferenceInput! - ): [Expense]! + type: TransactionsImportType! + ): TransactionsImport! """ - [Root only] A mutation to set the tax from for an account. + Import transactions, manually or from a CSV file """ - setTaxForm( + importTransactions( """ - Reference to the Account the tax form should be set. + ID of the import to add transactions to """ - account: AccountReferenceInput! + id: NonEmptyString! """ - The tax from link. + Raw file from which the data was extracted """ - taxFormLink: URL! + file: Upload """ - The tax form year. + Configuration of the CSV file """ - year: Int! - ): SetTaxFormResult + csvConfig: JSONObject - """ - Refunds a transaction. Scope: "transactions". - """ - refundTransaction( """ - Reference of the transaction to refund + Data to import """ - transaction: TransactionReferenceInput! - ): Transaction + data: [TransactionsImportRowCreateInput!]! + ): TransactionsImport! """ - Rejects transaction, removes member from Collective, and sends a message to the contributor. Scope: "transactions". + Update transactions import rows to set new values or mark them as dismissed """ - rejectTransaction( + updateTransactionsImportRows( """ - Reference of the transaction to refund + ID of the import to add transactions to """ - transaction: TransactionReferenceInput! + id: NonEmptyString! """ - Message to send to the contributor whose contribution has been rejected + Rows to update """ - message: String - ): Transaction! + rows: [TransactionsImportRowUpdateInput!]! + ): TransactionsImport! """ Create update. Scope: "updates". @@ -18114,61 +19944,6 @@ type Mutation { sendSurveyResponse(surveyKey: String!, responseId: String!, score: Int!, text: String, okToContact: Boolean): Boolean } -""" -Input to set taxes for an expense -""" -input TaxInput { - """ - Tax type - """ - type: TaxType! - - """ - Tax rate as a float number between 0 and 1 - """ - rate: Float! - - """ - Tax identification number, if any - """ - idNumber: String - - """ - Country ISO code of the entity paying the tax - """ - country: CountryISO - - """ - An optional tax amount to make sure the tax displayed in your frontend matches the one calculated by the API - """ - amount: AmountInput -} - -""" -The type of a tax like GST, VAT, etc -""" -enum TaxType { - """ - European Value Added Tax - """ - VAT - - """ - New Zealand Good and Services Tax - """ - GST -} - -""" -Reference to an accounting category -""" -input AccountingCategoryReferenceInput { - """ - The ID of the accounting category - """ - id: NonEmptyString! -} - input CollectiveCreateInput { name: String! slug: String! @@ -18342,6 +20117,7 @@ input PoliciesInput { COLLECTIVE_MINIMUM_ADMINS: PoliciesCollectiveMinimumAdminsInput EXPENSE_CATEGORIZATION: PoliciesExpenseCategorizationInput EXPENSE_PUBLIC_VENDORS: Boolean + COLLECTIVE_ADMINS_CAN_SEE_PAYOUT_METHODS: Boolean } input PoliciesCollectiveExpenseAuthorCannotApprove { @@ -18401,6 +20177,73 @@ input AccountingCategoryInput { If meant for expenses, the types of expenses this category applies to """ expensesTypes: [ExpenseType] + + """ + If the category is applicable to the Host or Hosted Collectives + """ + appliesTo: AccountingCategoryAppliesTo! = HOSTED_COLLECTIVES +} + +""" +Input to set taxes for an expense +""" +input TaxInput { + """ + Tax type + """ + type: TaxType! + + """ + Tax rate as a float number between 0 and 1 + """ + rate: Float! + + """ + Tax identification number, if any + """ + idNumber: String + + """ + Country ISO code of the entity paying the tax + """ + country: CountryISO + + """ + An optional tax amount to make sure the tax displayed in your frontend matches the one calculated by the API + """ + amount: AmountInput +} + +""" +The type of a tax like GST, VAT, etc +""" +enum TaxType { + """ + European Value Added Tax + """ + VAT + + """ + New Zealand Good and Services Tax + """ + GST +} + +""" +Reference to an accounting category +""" +input AccountingCategoryReferenceInput { + """ + The ID of the accounting category + """ + id: NonEmptyString! +} + +input TransactionsImportRowReferenceInput { + """ + The id of the row + """ + id: NonEmptyString! } """ @@ -18464,7 +20307,7 @@ input CommentUpdateInput { } """ -Input to create a comment. You can only specify one entity type: expense, conversation or update +Input to create a comment. You can only specify one entity type: expense, conversation, update or host application """ input CommentCreateInput { html: String @@ -18474,6 +20317,11 @@ input CommentCreateInput { """ expense: ExpenseReferenceInput + """ + If your comment is linked to an host application, set it here + """ + hostApplication: HostApplicationReferenceInput + """ If your comment is linked to an order, set it here """ @@ -18598,7 +20446,7 @@ input ExpenseCreateInput { type: ExpenseType! """ - A private note that will be attached to your invoice, as HTML + A private note that will be attached to your invoice, as HTML. Only visible to the payee and the collective/host admins. """ privateMessage: String @@ -18646,6 +20494,11 @@ input ExpenseCreateInput { The accounting category this expense belongs to """ accountingCategory: AccountingCategoryReferenceInput + + """ + User-provided reference number or any other identifier that references the invoice + """ + reference: String } input PayoutMethodInput { @@ -18749,6 +20602,11 @@ input ExpenseUpdateInput { """ longDescription: String + """ + User-provided reference number or any other identifier that references the invoice + """ + reference: String + """ Currency that should be used for the payout. Defaults to the account currency """ @@ -18945,6 +20803,11 @@ enum ExpenseProcessAction { To release the expense from hold """ RELEASE + + """ + To decline an invited expense + """ + DECLINE_INVITED_EXPENSE } """ @@ -19044,7 +20907,7 @@ input ExpenseInviteDraftInput { type: ExpenseType! """ - A private note that will be attached to your invoice, as HTML + A private note that will be attached to your invoice, as HTML. Only visible to the payee and the collective/host admins. """ privateMessage: String @@ -19093,6 +20956,11 @@ input ExpenseInviteDraftInput { """ accountingCategory: AccountingCategoryReferenceInput + """ + User-provided reference number or any other identifier that references the invoice + """ + reference: String + """ Note to be sent to the invited user through email. """ @@ -19141,6 +21009,7 @@ type ProcessHostApplicationResponse { When sending a public message, this field will have the info about the conversation created """ conversation: Conversation + hostApplication: HostApplication } """ @@ -19173,6 +21042,23 @@ type SetPasswordResponse { token: String } +type IndividualConfirmEmailResponse { + """ + The account that was confirmed + """ + individual: Individual! + + """ + A new session token to use for the account. Only returned if user is signed in already. + """ + sessionToken: String +} + +""" +The `Upload` scalar type represents a file upload. +""" +scalar Upload + input MemberInvitationReferenceInput { """ The public id identifying the member invitation (ie: dgm9bnk8-0437xqry-ejpvzeol-jdayw5re) @@ -19517,6 +21403,11 @@ input OrderUpdateInput { Date the funds were received """ processedAt: DateTime + + """ + Reference to the transaction import row to link the order to + """ + transactionsImportRow: TransactionsImportRowReferenceInput } """ @@ -19551,6 +21442,7 @@ input PaymentIntentInput { amount: AmountInput! fromAccount: AccountReferenceInput toAccount: AccountReferenceInput! + frequency: ContributionFrequency } """ @@ -19733,6 +21625,40 @@ input SetupIntentInput { stripeAccount: String! } +type PlaidLinkTokenCreateResponse { + """ + The link token that will be used to initialize the Plaid Link flow. + """ + linkToken: String! + + """ + The expiration date for the link token in ISO 8601 format. + """ + expiration: String! + + """ + A unique identifier for the request, which can be used for troubleshooting. + """ + requestId: String! + + """ + A URL of a Plaid-hosted Link flow that will use the Link token returned by this request. Only present if the client is enabled for Host + """ + hostedLinkUrl: String +} + +type PlaidConnectAccountResponse { + """ + The connected account that was created + """ + connectedAccount: ConnectedAccount! + + """ + The transactions import that was created + """ + transactionsImport: TransactionsImport! +} + enum AccountCacheType { CLOUDFLARE GRAPHQL_QUERIES @@ -19768,20 +21694,73 @@ type BanAccountResponse { accounts: [Account!]! } -type SetTaxFormResult { - success: Boolean! +input TransactionsImportRowCreateInput { + """ + The source id of the row + """ + sourceId: NonEmptyString! + + """ + The description of the row + """ + description: String + + """ + The date of the row + """ + date: DateTime! + + """ + The amount of the row + """ + amount: AmountInput! + + """ + The raw value of the row + """ + rawValue: JSONObject + + """ + Whether the row is dismissed + """ + isDismissed: Boolean! = false } -input TransactionReferenceInput { +input TransactionsImportRowUpdateInput { """ - The public id identifying the transaction (ie: dgm9bnk8-0437xqry-ejpvzeol-jdayw5re) + The id of the row """ - id: String + id: NonEmptyString! """ - The internal id of the transaction (ie: 580) + The source id of the row """ - legacyId: Int + sourceId: NonEmptyString + + """ + The description of the row + """ + description: String + + """ + The date of the row + """ + date: DateTime + + """ + The amount of the row + """ + amount: AmountInput + + """ + Whether the row is dismissed + """ + isDismissed: Boolean = false + + """ + The order associated with the row + """ + order: OrderReferenceInput } """ @@ -19795,6 +21774,7 @@ input UpdateCreateInput { html: String! fromAccount: AccountReferenceInput account: AccountReferenceInput! + notificationAudience: UpdateAudience } """ @@ -19805,9 +21785,11 @@ input UpdateUpdateInput { slug: String title: String isPrivate: Boolean + isChangelog: Boolean makePublicOn: DateTime html: String fromAccount: AccountReferenceInput + notificationAudience: UpdateAudience } type UploadFileResult { @@ -19879,11 +21861,6 @@ input UploadFileInput { parsingOptions: OCRParsingOptionsInput = null } -""" -The `Upload` scalar type represents a file upload. -""" -scalar Upload - """ The kind of file that was uploaded """ @@ -19892,6 +21869,7 @@ enum UploadedFileKind { ACCOUNT_BANNER EXPENSE_ATTACHED_FILE EXPENSE_ITEM + TRANSACTIONS_IMPORT ACCOUNT_LONG_DESCRIPTION UPDATE COMMENT @@ -19973,6 +21951,8 @@ input TierUpdateInput { amount: AmountInput name: NonEmptyString description: String + longDescription: String + videoUrl: URL button: String goal: AmountInput type: TierType diff --git a/src/server/controllers/account-transactions.ts b/src/server/controllers/account-transactions.ts index 6de5528e1..ab574b2da 100644 --- a/src/server/controllers/account-transactions.ts +++ b/src/server/controllers/account-transactions.ts @@ -4,8 +4,15 @@ import gqlV2 from 'graphql-tag'; import { difference, get, head, intersection, isNil, pick, toUpper, trim } from 'lodash'; import moment from 'moment'; +import { accountNameAndLegalName, amountAsString } from '../lib/formatting'; import { graphqlRequest } from '../lib/graphql'; -import { parseToBooleanDefaultFalse, parseToBooleanDefaultTrue } from '../lib/utils'; +import { + applyMapping, + parseToBooleanDefaultFalse, + parseToBooleanDefaultTrue, + splitEnums, + splitIds, +} from '../lib/utils'; import { logger } from '../logger'; function json2csv(data, opts) { @@ -13,9 +20,6 @@ function json2csv(data, opts) { return parser.parse(data); } -const splitIds = (str) => str?.split(',').map(trim); -const splitEnums = (str) => splitIds(str).map(toUpper); - export const transactionsFragment = gqlV2` fragment TransactionsFragment on TransactionCollection { __typename @@ -296,26 +300,6 @@ const hostTransactionsQuery = gqlV2/* GraphQL */ ` ${transactionsFragment} `; -const formatAmountAsString = (amount) => { - const amountAsString = new Intl.NumberFormat('en-US', { style: 'currency', currency: amount.currency }).format( - amount.value, - ); - - return `${amountAsString} ${amount.currency}`; -}; - -const formatAccountName = (account) => { - const legalName = account?.legalName; - const name = account?.name; - if (!legalName && !name) { - return ''; - } else if (legalName && name && legalName !== name) { - return `${legalName} (${name})`; - } else { - return legalName || name; - } -}; - const getAccountingCategory = (transaction) => { return get(transaction, 'expense.accountingCategory') || get(transaction, 'order.accountingCategory'); }; @@ -338,7 +322,7 @@ const csvMapping = { isRefunded: (t) => (t.isRefunded ? 'REFUNDED' : ''), refundId: (t) => get(t, 'refundTransaction.id', ''), shortRefundId: (t) => get(t, 'refundTransaction.id', '').substr(0, 8), - displayAmount: (t) => formatAmountAsString(t.amount), + displayAmount: (t) => amountAsString(t.amount), amount: (t) => get(t, 'amountInHostCurrency.value', 0), creditAmount: (t) => (t.type === 'CREDIT' ? get(t, 'amountInHostCurrency.value', 0) : ''), debitAmount: (t) => (t.type === 'DEBIT' ? get(t, 'amountInHostCurrency.value', 0) : ''), @@ -349,15 +333,15 @@ const csvMapping = { balance: (t) => get(t, 'balanceInHostCurrency.value'), currency: (t) => get(t, 'amountInHostCurrency.currency'), accountSlug: (t) => get(t, 'account.slug'), - accountName: (t) => formatAccountName(t.account), + accountName: (t) => accountNameAndLegalName(t.account), accountType: (t) => get(t, 'account.type'), accountEmail: (t) => get(t, 'account.email'), oppositeAccountSlug: (t) => get(t, 'oppositeAccount.slug'), - oppositeAccountName: (t) => formatAccountName(t.oppositeAccount), + oppositeAccountName: (t) => accountNameAndLegalName(t.oppositeAccount), oppositeAccountType: (t) => get(t, 'oppositeAccount.type'), oppositeAccountEmail: (t) => get(t, 'oppositeAccount.email'), hostSlug: (t) => get(t, 'host.slug'), - hostName: (t) => formatAccountName(t.host), + hostName: (t) => accountNameAndLegalName(t.host), hostType: (t) => get(t, 'host.type'), orderId: (t) => get(t, 'order.id'), orderLegacyId: (t) => get(t, 'order.legacyId'), @@ -442,19 +426,6 @@ const defaultFields = [ 'orderProcessedDate', ]; -const applyMapping = (mapping, row) => { - const res = {}; - Object.keys(mapping).map((key) => { - const val = mapping[key]; - if (typeof val === 'function') { - return (res[key] = val(row)); - } else { - return (res[key] = get(row, val)); - } - }); - return res; -}; - type Params = { slug: string; reportType: 'hostTransactions' | 'transactions'; @@ -595,17 +566,17 @@ const accountTransactions: RequestHandler = async (req, res) => { variables.includeHost = parseToBooleanDefaultTrue(variables.includeHost); } - variables.fetchHostFee = parseToBooleanDefaultFalse(req.query.flattenHostFee); + variables.fetchHostFee = parseToBooleanDefaultFalse(req.query.flattenHostFee as string); if (variables.fetchHostFee) { variables.kind = difference(variables.kind || allKinds, ['HOST_FEE']); } - variables.fetchPaymentProcessorFee = parseToBooleanDefaultFalse(req.query.flattenPaymentProcessorFee); + variables.fetchPaymentProcessorFee = parseToBooleanDefaultFalse(req.query.flattenPaymentProcessorFee as string); if (variables.fetchPaymentProcessorFee) { variables.kind = difference(variables.kind || allKinds, ['PAYMENT_PROCESSOR_FEE']); } - variables.fetchTax = parseToBooleanDefaultFalse(req.query.flattenTax); + variables.fetchTax = parseToBooleanDefaultFalse(req.query.flattenTax as string); if (variables.fetchTax) { variables.kind = difference(variables.kind || allKinds, ['TAX']); } @@ -628,7 +599,7 @@ const accountTransactions: RequestHandler = async (req, res) => { } if (req.query.fullDescription) { - variables.fullDescription = parseToBooleanDefaultFalse(req.query.fullDescription); + variables.fullDescription = parseToBooleanDefaultFalse(req.query.fullDescription as string); } else { variables.fullDescription = req.params.reportType === 'hostTransactions' ? true : false; } @@ -671,7 +642,7 @@ const accountTransactions: RequestHandler = async (req, res) => { fields = difference(intersection(baseAllFields, [...baseDefaultFields, ...add]), remove); } - const fetchAll = variables.offset ? false : parseToBooleanDefaultFalse(req.query.fetchAll); + const fetchAll = variables.offset ? false : parseToBooleanDefaultFalse(req.query.fetchAll as string); // Add fields info to the query, to prevent fetching what's not needed variables.hasAccountingCategoryField = fields.some((field) => field.startsWith('accountingCategory')); diff --git a/src/server/controllers/hosted-collectives.ts b/src/server/controllers/hosted-collectives.ts new file mode 100644 index 000000000..c6367766a --- /dev/null +++ b/src/server/controllers/hosted-collectives.ts @@ -0,0 +1,307 @@ +import assert from 'assert'; + +import { Parser } from '@json2csv/plainjs'; +import type { RequestHandler } from 'express'; +import gqlV2 from 'graphql-tag'; +import { compact, get, pick, toNumber, trim } from 'lodash'; +import moment from 'moment'; + +import { amountAsString } from '../lib/formatting'; +import { graphqlRequest } from '../lib/graphql'; +import { applyMapping, parseToBooleanDefaultFalse, parseToBooleanDefaultTrue, splitEnums } from '../lib/utils'; +import { logger } from '../logger'; + +function json2csv(data, opts) { + const parser = new Parser(opts); + return parser.parse(data); +} + +export const hostedCollectivesQuery = gqlV2` + query HostedCollectives( + $hostSlug: String! + $limit: Int! + $offset: Int! + $sort: OrderByInput + $hostFeesStructure: HostFeeStructure + $searchTerm: String + $type: [AccountType] + $isApproved: Boolean + $isFrozen: Boolean + $isUnhosted: Boolean + $balance: AmountRangeInput + $consolidatedBalance: AmountRangeInput + $currencies: [String] + ) { + host(slug: $hostSlug) { + id + legacyId + slug + name + currency + hostedAccounts( + limit: $limit + offset: $offset + searchTerm: $searchTerm + hostFeesStructure: $hostFeesStructure + accountType: $type + orderBy: $sort + isApproved: $isApproved + isFrozen: $isFrozen + isUnhosted: $isUnhosted + balance: $balance + consolidatedBalance: $consolidatedBalance + currencies: $currencies + ) { + offset + limit + totalCount + nodes { + id + legacyId + name + legalName + slug + website + type + currency + imageUrl(height: 96) + isFrozen + isHost + tags + settings + createdAt + stats { + id + balance { + value + currency + } + totalAmountSpent { + value + currency + } + totalAmountReceived(net: true) { + value + currency + } + } + policies { + id + COLLECTIVE_ADMINS_CAN_SEE_PAYOUT_METHODS + } + ... on AccountWithHost { + hostFeesStructure + hostFeePercent + approvedAt + hostAgreements { + totalCount + nodes { + id + title + attachment { + id + url + name + type + } + } + } + } + admins: members(role: [ADMIN]) { + totalCount + nodes { + id + account { + id + name + legalName + ... on Individual { + email + } + } + } + } + ... on AccountWithParent { + parent { + id + slug + name + } + } + lastExpenseReceived: expenses(limit: 1, direction: RECEIVED, orderBy: { field: CREATED_AT, direction: DESC }) { + nodes { + id + createdAt + } + } + firstExpenseReceived: expenses(limit: 1, direction: RECEIVED, orderBy: { field: CREATED_AT, direction: ASC }) { + nodes { + id + createdAt + } + } + numberOfExpenses: expenses(direction: RECEIVED) { + totalCount + } + firstContributionReceived: orders(limit: 1, status: [PAID, ACTIVE], orderBy: { field: CREATED_AT, direction: ASC }) { + nodes { + createdAt + } + } + lastContributionReceived: orders(limit: 1, status: [PAID, ACTIVE], orderBy: { field: CREATED_AT, direction: DESC }) { + nodes { + createdAt + } + } + numberOfContributions: orders(status: [PAID, ACTIVE]) { + totalCount + } + } + } + } + } +`; + +const csvMapping = { + name: 'name', + slug: 'slug', + type: 'type', + legalName: 'legalName', + description: 'description', + website: 'website', + currency: 'currency', + approvedAt: 'approvedAt', + hostFeePercent: 'hostFeePercent', + balance: (account) => amountAsString(account.stats.balance), + adminEmails: (account) => compact(account.admins?.nodes.map((member) => member.account?.email)).join(','), + adminCount: (account) => account.admins?.totalCount, + firstContributionDate: (account) => account.firstContributionReceived?.nodes[0]?.createdAt, + lastContributionDate: (account) => account.lastContributionReceived?.nodes[0]?.createdAt, + totalAmountOfContributions: (account) => + account.stats.totalAmountReceived && amountAsString(account.stats.totalAmountReceived), + totalNumberOfContributions: (account) => account.numberOfContributions?.totalCount, + firstExpenseDate: (account) => account.firstExpenseReceived?.nodes[0]?.createdAt, + lastExpenseDate: (account) => account.lastExpenseReceived?.nodes[0]?.createdAt, + numberOfExpenses: (account) => account.numberOfExpenses?.totalCount, +}; + +const hostedCollectives: RequestHandler<{ slug: string; format: 'csv' | 'json' }> = async (req, res) => { + if (!['HEAD', 'GET'].includes(req.method)) { + res.status(405).send({ error: { message: 'Method not allowed' } }); + return; + } + + try { + // Forward Api Key or Authorization header + const headers = {}; + const apiKey = req.get('Api-Key') || req.query.apiKey; + const personalToken = req.get('Personal-Token') || req.query.personalToken; + // Support Cookies for direct-download capability + const authorization = req.get('Authorization') || req.cookies?.authorization; + + if (authorization) { + headers['Authorization'] = authorization; + } else if (apiKey) { + headers['Api-Key'] = apiKey; + } else if (personalToken) { + headers['Personal-Token'] = personalToken; + } + + const hostSlug = req.params.slug; + assert(hostSlug, 'Please provide a slug'); + + const variables = { + hostSlug, + limit: req.method === 'HEAD' ? 0 : req.query.limit ? toNumber(req.query.limit) : 1000, + offset: req.query.offset ? toNumber(req.query.offset) : 0, + sort: req.query.sort, + hostFeesStructure: req.query.hostFeesStructure, + searchTerm: req.query.searchTerm, + type: splitEnums(req.query.type as string), + isApproved: req.query.isApproved ? parseToBooleanDefaultTrue(req.query.isApproved as string) : undefined, + isFrozen: req.query.isFrozen ? parseToBooleanDefaultTrue(req.query.isFrozen as string) : undefined, + isUnhosted: req.query.isUnhosted ? parseToBooleanDefaultTrue(req.query.isUnhosted as string) : undefined, + currencies: splitEnums(req.query.currencies as string), + }; + const fetchAll = variables.offset ? false : parseToBooleanDefaultFalse(req.query.fetchAll as string); + logger.debug('hostedCollectives:query', variables); + + const fields = (get(req.query, 'fields', '') as string) + .split(',') + .map(trim) + .filter((v) => !!v); + + let result = await graphqlRequest(hostedCollectivesQuery, variables, { version: 'v2', headers }); + + switch (req.params.format) { + case 'csv': { + // don't cache at CDN level as the result may contain private information + if (authorization || apiKey || personalToken) { + res.append('Cache-Control', 'no-cache'); + } + if (req.params.format === 'csv') { + res.append('Content-Type', `text/csv;charset=utf-8`); + } else { + res.append('Content-Type', `text/plain;charset=utf-8`); + } + const filename = `hosted-collectives-${hostSlug}-${moment.utc().format('YYYYMMDD')}.${req.params.format}`; + res.append('Content-Disposition', `attachment; filename="${filename}"`); + res.append('Access-Control-Expose-Headers', 'X-Exported-Rows'); + res.append('X-Exported-Rows', result.host.hostedAccounts.totalCount); + if (req.method === 'HEAD') { + res.status(200).end(); + return; + } + + if (result.host.hostedAccounts.totalCount === 0) { + res.status(404).send('No transaction found.'); + break; + } + + const mapping = pick(csvMapping, fields); + const mappedTransactions = result.host.hostedAccounts.nodes.map((t) => applyMapping(mapping, t)); + res.write(json2csv(mappedTransactions, null)); + res.write(`\n`); + + if (result.host.hostedAccounts.totalCount > result.host.hostedAccounts.limit) { + if (fetchAll) { + do { + variables.offset += result.host.hostedAccounts.limit; + result = await graphqlRequest(hostedCollectivesQuery, variables, { version: 'v2', headers }); + const mappedTransactions = result.host.hostedAccounts.nodes.map((t) => applyMapping(mapping, t)); + res.write(json2csv(mappedTransactions, { header: false })); + res.write(`\n`); + } while ( + result.host.hostedAccounts.totalCount > + result.host.hostedAccounts.limit + result.host.hostedAccounts.offset + ); + } else { + res.write( + `Warning: totalCount is ${result.host.hostedAccounts.totalCount} and limit was ${result.host.hostedAccounts.limit}`, + ); + } + } + + res.end(); + break; + } + default: + res.send(result.host.hostedAccounts); + break; + } + } catch (err) { + if (err.message.match(/not found/i)) { + res.status(404).send(err.message); + } else { + logger.error(`Error while fetching hosted collectives: ${err.message}`); + logger.debug(err); + if (res.headersSent) { + res.end(`\nError while fetching hosted collectives.`); + } else { + res.status(400).send(`Error while fetching hosted collectives.`); + } + } + } +}; + +export default hostedCollectives; diff --git a/src/server/controllers/index.js b/src/server/controllers/index.js index ba2e6b3ca..0b08fb0a0 100644 --- a/src/server/controllers/index.js +++ b/src/server/controllers/index.js @@ -3,6 +3,7 @@ import accountOrders from './account-orders'; import accountTransactions from './account-transactions'; import * as collectives from './collectives'; import * as events from './events'; +import hostedCollectives from './hosted-collectives'; import * as members from './members'; import * as transactions from './transactions'; @@ -14,4 +15,5 @@ export default { accountContributors, accountOrders, accountTransactions, + hostedCollectives, }; diff --git a/src/server/lib/formatting.ts b/src/server/lib/formatting.ts new file mode 100644 index 000000000..b24be7207 --- /dev/null +++ b/src/server/lib/formatting.ts @@ -0,0 +1,19 @@ +export const amountAsString = (amount: { currency: string; value: number }) => { + const amountAsString = new Intl.NumberFormat('en-US', { style: 'currency', currency: amount.currency }).format( + amount.value, + ); + + return `${amountAsString} ${amount.currency}`; +}; + +export const accountNameAndLegalName = (account: { name?: string; legalName?: string }) => { + const legalName = account?.legalName; + const name = account?.name; + if (!legalName && !name) { + return ''; + } else if (legalName && name && legalName !== name) { + return `${legalName} (${name})`; + } else { + return legalName || name; + } +}; diff --git a/src/server/lib/utils.js b/src/server/lib/utils.ts similarity index 73% rename from src/server/lib/utils.js rename to src/server/lib/utils.ts index 105e1365c..68120057c 100644 --- a/src/server/lib/utils.js +++ b/src/server/lib/utils.ts @@ -1,10 +1,10 @@ -import { isNaN } from 'lodash'; +import { get, isNaN, toUpper, trim } from 'lodash'; export const getBaseApiUrl = () => { return process.env.API_URL; }; -export const getGraphqlUrl = ({ apiKey, version } = {}) => { +export const getGraphqlUrl = ({ apiKey, version }: { apiKey?: string; version?: string } = {}) => { if (apiKey) { return `${getBaseApiUrl()}/graphql/${version || 'v1'}?apiKey=${apiKey}`; } else { @@ -72,7 +72,7 @@ export function idOrUuid(req, res, next, idOrUuid) { .catch(next); } -export const parseToBooleanDefaultFalse = (value) => { +export const parseToBooleanDefaultFalse = (value: null | undefined | string | boolean) => { if (value === null || value === undefined || value === '') { return false; } @@ -80,10 +80,27 @@ export const parseToBooleanDefaultFalse = (value) => { return ['on', 'enabled', '1', 'true', 'yes', 1].includes(string); }; -export const parseToBooleanDefaultTrue = (value) => { +export const parseToBooleanDefaultTrue = (value: null | undefined | string | boolean) => { if (value === null || value === undefined || value === '') { return true; } const string = value.toString().trim().toLowerCase(); return !['off', 'disabled', '0', 'false', 'no', 0].includes(string); }; + +export const splitIds = (str?: string) => str?.split(',').map(trim) || []; + +export const splitEnums = (str?: string) => splitIds(str).map(toUpper); + +export const applyMapping = (mapping, row) => { + const res = {}; + Object.keys(mapping).map((key) => { + const val = mapping[key]; + if (typeof val === 'function') { + return (res[key] = val(row)); + } else { + return (res[key] = get(row, val)); + } + }); + return res; +}; diff --git a/src/server/routes.ts b/src/server/routes.ts index fccf07023..bfc79c33e 100644 --- a/src/server/routes.ts +++ b/src/server/routes.ts @@ -71,4 +71,6 @@ export const loadRoutes = (app: Express) => { ); app.get('/v2/:slug/contributors.:format(json|csv)', controllers.accountContributors); + + app.all('/v2/:slug/hosted-collectives.:format(json|csv)', controllers.hostedCollectives); };