From 9060631e2d6ade4dc0bd8e4af9dd12365bb379ea Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 12 Aug 2026 05:33:21 +0000 Subject: [PATCH 1/4] chore(deps-dev): bump ruff from 0.15.22 to 0.16.2 Bumps [ruff](https://github.com/astral-sh/ruff) from 0.15.22 to 0.16.2. - [Release notes](https://github.com/astral-sh/ruff/releases) - [Changelog](https://github.com/astral-sh/ruff/blob/main/CHANGELOG.md) - [Commits](https://github.com/astral-sh/ruff/compare/0.15.22...0.16.2) --- updated-dependencies: - dependency-name: ruff dependency-version: 0.16.2 dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- README.md | 2 ++ uv.lock | 40 ++++++++++++++++++++-------------------- 2 files changed, 22 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index d8746b0c..fd51e154 100644 --- a/README.md +++ b/README.md @@ -48,6 +48,7 @@ import os from sumup import AsyncSumup + async def main(): client = AsyncSumup(api_key="sup_sk_MvxmLOl0...") @@ -55,6 +56,7 @@ async def main(): merchant = await client.merchants.get(merchant_code=os.environ["SUMUP_MERCHANT_CODE"]) print(f"Merchant: {merchant.merchant_code}") + asyncio.run(main()) ``` diff --git a/uv.lock b/uv.lock index 32f91daa..3cec5170 100644 --- a/uv.lock +++ b/uv.lock @@ -48,7 +48,7 @@ name = "exceptiongroup" version = "1.3.1" source = { registry = "https://pypi.org/simple" } dependencies = [ - { name = "typing-extensions", marker = "python_full_version < '3.13'" }, + { name = "typing-extensions" }, ] sdist = { url = "https://files.pythonhosted.org/packages/50/79/66800aadf48771f6b62f7eb014e352e5d06856655206165d775e675a02c9/exceptiongroup-1.3.1.tar.gz", hash = "sha256:8b412432c6055b0b7d14c310000ae93352ed6754f70fa8f7c34141f91c4e3219", size = 30371, upload-time = "2025-11-21T23:01:54.787Z" } wheels = [ @@ -288,27 +288,27 @@ wheels = [ [[package]] name = "ruff" -version = "0.15.22" +version = "0.16.2" source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/3a/06/ae069393fc66e8ff33036d4b368003833bf6e88ccf182e17e7a2f1c754fd/ruff-0.15.22.tar.gz", hash = "sha256:3f15175b1fb580126f58285a5dae6b2ea89000136d980c64499211f116b54809", size = 4785063, upload-time = "2026-07-16T15:14:13.244Z" } +sdist = { url = "https://files.pythonhosted.org/packages/73/e1/4508a569211b35599016e84ba65c1a992b7a4004b4b6c4bea02a851cba1b/ruff-0.16.2.tar.gz", hash = "sha256:c3d7828d12e8927a6fc65fe38e2c2541b9e762d360a1786d752cb1b8883b3c9c", size = 4885811, upload-time = "2026-08-07T13:31:01.432Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/23/18/ee54b7ae1e121be7a28ea6da4b67564ebb0530e183a54415ab7e3bcd2c4e/ruff-0.15.22-py3-none-linux_armv6l.whl", hash = "sha256:44423e73493737f5e7c5b41d475483898ff37afcdae38bc3da5085e29af1c2d8", size = 10781258, upload-time = "2026-07-16T15:13:19.452Z" }, - { url = "https://files.pythonhosted.org/packages/2f/d2/2520cb14761ddbeaf57642a76942fc36adcbdbe53b4532241995f6fc485c/ruff-0.15.22-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:b82c6482946e9eda7ff2e091d25b8bad3f718684e1916d41bd56873cee05b697", size = 10999477, upload-time = "2026-07-16T15:13:23.318Z" }, - { url = "https://files.pythonhosted.org/packages/c9/10/74e53572aa758dfaa678c2a2646b5c5515d884b7ca56be4d2ce03ca4b560/ruff-0.15.22-py3-none-macosx_11_0_arm64.whl", hash = "sha256:11c1c715af53a09f714e011106bffc419751ec8232fcb5da42173284ea3fec6f", size = 10466716, upload-time = "2026-07-16T15:13:26.162Z" }, - { url = "https://files.pythonhosted.org/packages/1e/cc/44eaaf0844e028182f2d0a8f2190d0f359159aed0a9e5ab861d892f1ae2a/ruff-0.15.22-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:742a29cf29bddb7c8327895d6a10e0e6c5b38a96dd407af9b5d0857f809c0576", size = 10892644, upload-time = "2026-07-16T15:13:29.229Z" }, - { url = "https://files.pythonhosted.org/packages/9f/21/8edf559014d2b0f82beea19cfb713993ad802ccda16868769979c6090a84/ruff-0.15.22-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:72af58b951b0ae395935ae79763dc349bc0eb706319d28f7a33ad2cfb3cfc178", size = 10576719, upload-time = "2026-07-16T15:13:32.35Z" }, - { url = "https://files.pythonhosted.org/packages/bf/1e/3a13abd392a3b50b62e5938a831f9ab6e588358cacad5c18545b716d2182/ruff-0.15.22-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:62d425005c1835eb24e2ee4161cb90e8db263415f4a71c8c72c33abaa6c0c224", size = 11376494, upload-time = "2026-07-16T15:13:35.958Z" }, - { url = "https://files.pythonhosted.org/packages/bf/3e/422d3d95bcf04dd78e1aeac22184d4f9a8fb2c01865d39d44618484a0317/ruff-0.15.22-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:e8b9b3f8779a4f08c969defc3c8c35abffaa757e601ed5ae66d6d1db6519969a", size = 12208370, upload-time = "2026-07-16T15:13:39.185Z" }, - { url = "https://files.pythonhosted.org/packages/1e/91/5d065a0e0a02bf4813f5119ad278462eed081d2b832eb7c021ade0ec9e65/ruff-0.15.22-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:1e0dd1b2e4d3d585f897a0d137cbf4eaf6223bef4e8ce34d6bb12556c5f9249e", size = 11581098, upload-time = "2026-07-16T15:13:42.132Z" }, - { url = "https://files.pythonhosted.org/packages/f6/f9/a0d4871d12fae702eb1f41b686caf05f1f8b124dc6db6f784f53d74918fa/ruff-0.15.22-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:365523eb91d9224e1bcb03b022fbf0facb8f9e23792a2c53d9d4b3924bdbdebb", size = 11399422, upload-time = "2026-07-16T15:13:45.2Z" }, - { url = "https://files.pythonhosted.org/packages/18/80/c843a5176cddbceb0b7e8dd41cf9993490796c1c469348d384f5a5c13c56/ruff-0.15.22-py3-none-manylinux_2_31_riscv64.whl", hash = "sha256:fabfd168afdf29fee5be98b831efa9683c94d7c5a3b58b9ce5a2e38444589a74", size = 11381683, upload-time = "2026-07-16T15:13:48.46Z" }, - { url = "https://files.pythonhosted.org/packages/d4/00/8485de0ae92239438a36cfc51350db9b9e85c9ebdfaea91b18e422706662/ruff-0.15.22-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:225dbf095a87f1d9f90f5fd7924d2613ee452a75a4308c63a8f50f761787aa7c", size = 10850295, upload-time = "2026-07-16T15:13:51.655Z" }, - { url = "https://files.pythonhosted.org/packages/fa/91/24977ec2ec72eaf15e4394ace2959fdff2dd1e14f03e005e838023407169/ruff-0.15.22-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:1877d63b9d24ed278744f1523fd11b85540566d54641f97c566d7d9dc5ca5296", size = 10579640, upload-time = "2026-07-16T15:13:54.79Z" }, - { url = "https://files.pythonhosted.org/packages/9c/47/9b51216951974df1f263ac19da550d34252e0ed7218c25f10c5ef9ed7517/ruff-0.15.22-py3-none-musllinux_1_2_i686.whl", hash = "sha256:a1606c510bd7215680d32efab38965f7cdec3ef69f5170a3f4791404ffdd5262", size = 11105077, upload-time = "2026-07-16T15:13:57.915Z" }, - { url = "https://files.pythonhosted.org/packages/c2/47/20e9d4a3b8016778acea5fc32bb50d35d207500a17ddb529ffa6996feef8/ruff-0.15.22-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:630479b18625f5ffc373f77603a22a9f8ac0acd7ff0501178b5db28ec71e9c64", size = 11490980, upload-time = "2026-07-16T15:14:01.032Z" }, - { url = "https://files.pythonhosted.org/packages/4d/76/3f72d8fc38c1cb77b38c56a70da9d0c17700cc1cc50f9649c9d3c8f5ba71/ruff-0.15.22-py3-none-win32.whl", hash = "sha256:e5ba0e4a13fd14abbed2a77b517a3911290c6c6c59ef67784328d1668fab76cf", size = 10789165, upload-time = "2026-07-16T15:14:04.16Z" }, - { url = "https://files.pythonhosted.org/packages/cb/46/4965251734c2b6fcdca1b1b187d20bcac3af0ee5b083b89c910bb961ce3a/ruff-0.15.22-py3-none-win_amd64.whl", hash = "sha256:9be63ba1eb936acd2d1342fb8337c356353706fce233b2a15a09a97037e6acde", size = 11938297, upload-time = "2026-07-16T15:14:07.316Z" }, - { url = "https://files.pythonhosted.org/packages/57/c9/e69b1ff4c8b69093ef08b8919ab767af0569666865b39c30a8795d88d3c6/ruff-0.15.22-py3-none-win_arm64.whl", hash = "sha256:e1168075b72158510839f250027659cdd78476f40507dd517892304c41318661", size = 11298172, upload-time = "2026-07-16T15:14:10.51Z" }, + { url = "https://files.pythonhosted.org/packages/14/57/db19951540f98859c956b50bdb4d31089b4d91e9f15e2968e7d5193806d5/ruff-0.16.2-py3-none-linux_armv6l.whl", hash = "sha256:3c8de4cf2181f01d57946d87d777aa52916976fc09942aed89938fab5e013318", size = 10847925, upload-time = "2026-08-07T13:30:14.468Z" }, + { url = "https://files.pythonhosted.org/packages/13/5a/995fe85a8470d3e391ac0f7fa8054bb454eaf33ee138196d6172ed1079c0/ruff-0.16.2-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:9a48cc05c6fbc811ca81b5d7ba95375affea6582d1b8024e455e41afbbf55344", size = 11072662, upload-time = "2026-08-07T13:30:18.143Z" }, + { url = "https://files.pythonhosted.org/packages/32/53/370d767c61c71a971a4ace36703a7ecd8c393956349a7325d7fab2b56827/ruff-0.16.2-py3-none-macosx_11_0_arm64.whl", hash = "sha256:a2c0d14fcbb26c91f0f867a6dc9bd71bbc30b1b6151829c884f23faeab2e5700", size = 10566771, upload-time = "2026-08-07T13:30:20.899Z" }, + { url = "https://files.pythonhosted.org/packages/85/d6/9d96948caf5a632be62d62202d5ec914d6856f204fd79eb036e5915e79ea/ruff-0.16.2-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:335c621622c4650330be50842561c6586ac6971bb8ab5407fe34dcc9efb16bbe", size = 10975825, upload-time = "2026-08-07T13:30:23.517Z" }, + { url = "https://files.pythonhosted.org/packages/3b/92/ea87129b3414acb0b5770563779c51804d37ac67675c7ba35447ddb14773/ruff-0.16.2-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:20e66910f2c37cc753f9ef6580c914a621b80c4fa3549d3e3521e29d0f5bfc3f", size = 10649437, upload-time = "2026-08-07T13:30:26.097Z" }, + { url = "https://files.pythonhosted.org/packages/ac/43/f8f291dcd4af5bb7872b74fdfa41a7cd7c856ca1d4069670971cf1b9f5cb/ruff-0.16.2-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:c7e36fbfba65510548156902bcf1350a979a958ce0347ce0f90d73894036b39f", size = 11446761, upload-time = "2026-08-07T13:30:28.752Z" }, + { url = "https://files.pythonhosted.org/packages/71/4a/ef991fb2fcf516ab71f0808adcdd8da5e18c8cde447f4ceaf5f47a5132a5/ruff-0.16.2-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:f0eab35f80df8f134aae5d1630e751901321d317cc8e50dc39e36fa3ed34cd12", size = 12336364, upload-time = "2026-08-07T13:30:31.468Z" }, + { url = "https://files.pythonhosted.org/packages/f3/24/f615e74f307e6ca0e56a482872477b856c70d530aa356abfb6dfe5ca8a80/ruff-0.16.2-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:40ea8c0594feb894e89c8c61ab9c103d38b0ea72dfde6c594107147ca31b1140", size = 11630720, upload-time = "2026-08-07T13:30:34.426Z" }, + { url = "https://files.pythonhosted.org/packages/c5/d3/8ef50149e8412a77f7ab409efdef0e2b23803707a3863da4fc64cb23d459/ruff-0.16.2-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ab3d62dde0b19facdd632008cc4827fc28ada7736c6bd35ab6f1050f0bfed53f", size = 11466130, upload-time = "2026-08-07T13:30:36.958Z" }, + { url = "https://files.pythonhosted.org/packages/dd/a7/a19334985c4dea8c381981fa252cd854c7ee52dc4b1686dc16f4a911c702/ruff-0.16.2-py3-none-manylinux_2_31_riscv64.whl", hash = "sha256:e43e1f5b8388da9eca1b9e88328d47a5cec794633ccf6f7484ac2dd15eee92c0", size = 11523634, upload-time = "2026-08-07T13:30:39.822Z" }, + { url = "https://files.pythonhosted.org/packages/6e/6c/96d192b0e742412ceda08c0a50f9669b253dde9fd6a60ea1a10c9fa79a63/ruff-0.16.2-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:c24788a980581e1d7ea3a0cbe4344c4fbeb0a6a9b1f4713aa46bb104f8294690", size = 10949807, upload-time = "2026-08-07T13:30:42.745Z" }, + { url = "https://files.pythonhosted.org/packages/fa/51/e26599ceca11e79ee255c7df515995561edf87e9ca1893284e44d98f5a86/ruff-0.16.2-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:81806b08329130005dd4a8a8394a0c9da8c6f4cafb16ba438d2a2ee6a18bedf1", size = 10646891, upload-time = "2026-08-07T13:30:45.522Z" }, + { url = "https://files.pythonhosted.org/packages/68/01/800c4b1f97bc8d7c6029e06b1f20473a3cf1e13c4933d8f3342add83fc55/ruff-0.16.2-py3-none-musllinux_1_2_i686.whl", hash = "sha256:4ce4e02bad779bef557f541a1b31f20d6abeae1cc05ed1b1ac019d4ffd1044c8", size = 11162063, upload-time = "2026-08-07T13:30:48.131Z" }, + { url = "https://files.pythonhosted.org/packages/e4/d0/1477ea50fc5a0d4b0b71d1d63d50770bdd794d90b43e37a7618e63ec9894/ruff-0.16.2-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:e0422abdf70070255fc4073ce9dfc814cc03db577013761ddd09bc1e4a9a4fbd", size = 11556038, upload-time = "2026-08-07T13:30:50.686Z" }, + { url = "https://files.pythonhosted.org/packages/b8/76/a7776f32048d991e16d4fa8ff91790b877342d3596cc3ed04acdbf1aaedc/ruff-0.16.2-py3-none-win32.whl", hash = "sha256:bf3a63d78fb39f4bf5ac8ae52051c5520505301abe19ba4e204c453b3f09bb0b", size = 10872850, upload-time = "2026-08-07T13:30:53.471Z" }, + { url = "https://files.pythonhosted.org/packages/00/0d/929c800d920e61397d82a01b60bffc68da3052c17d31de59efaad2e4ed75/ruff-0.16.2-py3-none-win_amd64.whl", hash = "sha256:bcabe2f6d0fc7819f1431793005af4e4de7371927d037345bf941252b195b9fa", size = 12023338, upload-time = "2026-08-07T13:30:56.193Z" }, + { url = "https://files.pythonhosted.org/packages/5b/6c/93e26c22c5f78ff87363e07da49c84955affbeb1098bd1936bf3b3f293bf/ruff-0.16.2-py3-none-win_arm64.whl", hash = "sha256:d614e95cedf38a2053fd351c55b103ba30d017d61688fdbfd40ee0412852a99f", size = 11374065, upload-time = "2026-08-07T13:30:58.775Z" }, ] [[package]] From 1f7ac9d0e1de86c9a17c981d4d1540da62bba72b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matou=C5=A1=20Dzivjak?= Date: Wed, 12 Aug 2026 22:59:04 +0200 Subject: [PATCH 2/4] fixups --- codegen/pkg/builder/out.go | 18 +- codegen/pkg/builder/types.go | 22 +- codegen/pkg/builder/types_test.go | 63 ++ codegen/templates/client.py.tmpl | 29 +- codegen/templates/resource.py.tmpl | 4 +- examples/card_reader_checkout.py | 2 +- examples/sync.py | 2 +- pyproject.toml | 2 +- sumup/__init__.py | 4 +- sumup/_client.py | 54 +- sumup/_exceptions.py | 11 +- sumup/_secret.py | 6 +- sumup/_service.py | 11 +- sumup/checkouts/__init__.py | 25 +- sumup/checkouts/resource.py | 205 +++-- sumup/customers/__init__.py | 13 +- sumup/customers/resource.py | 51 +- sumup/members/__init__.py | 15 +- sumup/members/resource.py | 117 ++- sumup/memberships/__init__.py | 15 +- sumup/memberships/resource.py | 74 +- sumup/merchants/__init__.py | 13 +- sumup/merchants/resource.py | 43 +- sumup/payouts/__init__.py | 11 +- sumup/payouts/resource.py | 39 +- sumup/readers/__init__.py | 17 +- sumup/readers/resource.py | 141 ++-- sumup/receipts/__init__.py | 11 +- sumup/receipts/resource.py | 27 +- sumup/roles/__init__.py | 13 +- sumup/roles/resource.py | 68 +- sumup/transactions/__init__.py | 17 +- sumup/transactions/resource.py | 132 ++-- sumup/types/__init__.py | 1114 ++++++++++++++-------------- tests/test_query_params.py | 3 +- tests/test_request_bodies.py | 5 +- uv.lock | 2 +- 37 files changed, 1212 insertions(+), 1187 deletions(-) create mode 100644 codegen/pkg/builder/types_test.go mode change 100755 => 100644 sumup/checkouts/__init__.py mode change 100755 => 100644 sumup/checkouts/resource.py mode change 100755 => 100644 sumup/customers/__init__.py mode change 100755 => 100644 sumup/customers/resource.py mode change 100755 => 100644 sumup/members/__init__.py mode change 100755 => 100644 sumup/members/resource.py mode change 100755 => 100644 sumup/memberships/__init__.py mode change 100755 => 100644 sumup/memberships/resource.py mode change 100755 => 100644 sumup/merchants/__init__.py mode change 100755 => 100644 sumup/merchants/resource.py mode change 100755 => 100644 sumup/payouts/__init__.py mode change 100755 => 100644 sumup/payouts/resource.py mode change 100755 => 100644 sumup/readers/__init__.py mode change 100755 => 100644 sumup/readers/resource.py mode change 100755 => 100644 sumup/receipts/__init__.py mode change 100755 => 100644 sumup/receipts/resource.py mode change 100755 => 100644 sumup/roles/__init__.py mode change 100755 => 100644 sumup/roles/resource.py mode change 100755 => 100644 sumup/transactions/__init__.py mode change 100755 => 100644 sumup/transactions/resource.py mode change 100755 => 100644 sumup/types/__init__.py diff --git a/codegen/pkg/builder/out.go b/codegen/pkg/builder/out.go index 8077045c..c5b3414d 100644 --- a/codegen/pkg/builder/out.go +++ b/codegen/pkg/builder/out.go @@ -310,10 +310,14 @@ func isGeneratedResourceDir(dir string) bool { } func (b *Builder) writeClientFile(fname string, tags []string) error { - f, err := os.OpenFile(fname, os.O_RDWR|os.O_CREATE|os.O_TRUNC, os.FileMode(0o755)) + f, err := os.OpenFile(fname, os.O_RDWR|os.O_CREATE|os.O_TRUNC, os.FileMode(0o644)) if err != nil { return fmt.Errorf("create %q: %w", fname, err) } + if err := f.Chmod(0o644); err != nil { + _ = f.Close() + return fmt.Errorf("set permissions on %q: %w", fname, err) + } defer func() { _ = f.Close() }() @@ -351,10 +355,14 @@ func (b *Builder) writeClientFile(fname string, tags []string) error { } func (b *Builder) writeAPIVersionFile(fname string) error { - f, err := os.OpenFile(fname, os.O_RDWR|os.O_CREATE|os.O_TRUNC, os.FileMode(0o755)) + f, err := os.OpenFile(fname, os.O_RDWR|os.O_CREATE|os.O_TRUNC, os.FileMode(0o644)) if err != nil { return fmt.Errorf("create %q: %w", fname, err) } + if err := f.Chmod(0o644); err != nil { + _ = f.Close() + return fmt.Errorf("set permissions on %q: %w", fname, err) + } defer func() { _ = f.Close() }() @@ -375,10 +383,14 @@ func openGeneratedFile(filename string) (*os.File, error) { } p := filepath.Join(cwd, filename) - f, err := os.OpenFile(p, os.O_RDWR|os.O_CREATE|os.O_TRUNC, os.FileMode(0o755)) + f, err := os.OpenFile(p, os.O_RDWR|os.O_CREATE|os.O_TRUNC, os.FileMode(0o644)) if err != nil { return nil, fmt.Errorf("create %q: %w", p, err) } + if err := f.Chmod(0o644); err != nil { + _ = f.Close() + return nil, fmt.Errorf("set permissions on %q: %w", p, err) + } return f, nil } diff --git a/codegen/pkg/builder/types.go b/codegen/pkg/builder/types.go index 937d5e44..ce989332 100644 --- a/codegen/pkg/builder/types.go +++ b/codegen/pkg/builder/types.go @@ -151,14 +151,12 @@ func (o *OneOfDeclaration) String() string { options = append(options, inputTypeName(option)) } if o.RequestOnly { - fmt.Fprintf(buf, "%sInput = typing.Union[%s]", o.Name, strings.Join(options, ", ")) + fmt.Fprintf(buf, "%sInput = %s", o.Name, strings.Join(options, " | ")) return buf.String() } - fmt.Fprintf(buf, "%s = typing.Union[", o.Name) - fmt.Fprint(buf, strings.Join(o.Options, ", ")) - fmt.Fprintf(buf, "]\n") + fmt.Fprintf(buf, "%s = %s\n", o.Name, strings.Join(o.Options, " | ")) if o.GenerateInput { - fmt.Fprintf(buf, "%sInput = typing.Union[%s]", o.Name, strings.Join(options, ", ")) + fmt.Fprintf(buf, "%sInput = %s", o.Name, strings.Join(options, " | ")) } return buf.String() } @@ -179,12 +177,12 @@ func (p *Property) String() string { if useAlias { aliasChoices := fmt.Sprintf("pydantic.AliasChoices(%q, %q)", alias, fieldName) if p.Optional { - fmt.Fprintf(buf, "%s: typing.Optional[%s] = pydantic.Field(default=None, serialization_alias=%q, validation_alias=%s)\n", fieldName, p.Type, alias, aliasChoices) + fmt.Fprintf(buf, "%s: %s | None = pydantic.Field(default=None, serialization_alias=%q, validation_alias=%s)\n", fieldName, p.Type, alias, aliasChoices) } else { fmt.Fprintf(buf, "%s: %s = pydantic.Field(serialization_alias=%q, validation_alias=%s)\n", fieldName, p.Type, alias, aliasChoices) } } else if p.Optional { - fmt.Fprintf(buf, "%s: typing.Optional[%s] = None\n", fieldName, p.Type) + fmt.Fprintf(buf, "%s: %s | None = None\n", fieldName, p.Type) } else { fmt.Fprintf(buf, "%s: %s\n", fieldName, p.Type) } @@ -210,9 +208,9 @@ func (p Property) MethodParameterString(allowNone bool) string { typeName := p.MethodParameterType() if p.Optional { if allowNone { - return fmt.Sprintf("%s: typing.Union[%s, None, NotGivenType] = NOT_GIVEN", p.FieldName(), typeName) + return fmt.Sprintf("%s: %s | None | NotGivenType = NOT_GIVEN", p.FieldName(), typeName) } - return fmt.Sprintf("%s: typing.Union[%s, NotGivenType] = NOT_GIVEN", p.FieldName(), typeName) + return fmt.Sprintf("%s: %s | NotGivenType = NOT_GIVEN", p.FieldName(), typeName) } return fmt.Sprintf("%s: %s", p.FieldName(), typeName) @@ -252,7 +250,7 @@ func (e *EnumDeclaration[E]) String() string { for _, v := range e.Values { values = append(values, fmt.Sprintf("%#v", v)) } - alias := fmt.Sprintf("typing.Union[typing.Literal[%s], %s]", strings.Join(values, ", "), pythonEnumBaseType(e.Type)) + alias := fmt.Sprintf("typing.Literal[%s] | %s", strings.Join(values, ", "), pythonEnumBaseType(e.Type)) if e.RequestOnly { return fmt.Sprintf("%sInput = %s\n", e.Name, alias) } @@ -319,9 +317,9 @@ func inputTypeName(typeName string) string { for i := range args { args[i] = inputTypeName(args[i]) } - return "typing.Union[" + strings.Join(args, ", ") + "]" + return strings.Join(args, " | ") case strings.HasPrefix(typeName, "typing.Optional[") && strings.HasSuffix(typeName, "]"): - return "typing.Optional[" + inputTypeName(typeName[len("typing.Optional["):len(typeName)-1]) + "]" + return inputTypeName(typeName[len("typing.Optional["):len(typeName)-1]) + " | None" case isPrimitiveType(typeName): return typeName default: diff --git a/codegen/pkg/builder/types_test.go b/codegen/pkg/builder/types_test.go new file mode 100644 index 00000000..d6ce4835 --- /dev/null +++ b/codegen/pkg/builder/types_test.go @@ -0,0 +1,63 @@ +package builder + +import "testing" + +func TestGeneratedTypesUseModernUnionSyntax(t *testing.T) { + tests := []struct { + name string + got string + want string + }{ + { + name: "optional property", + got: (&Property{ + Name: "expires_at", + Type: "datetime.datetime", + Optional: true, + }).String(), + want: "expires_at: datetime.datetime | None = None\n", + }, + { + name: "optional method parameter", + got: (&Property{ + Name: "status", + Type: "str", + Optional: true, + }).MethodParameterString(true), + want: "status: str | None | NotGivenType = NOT_GIVEN", + }, + { + name: "enum", + got: (&EnumDeclaration[string]{ + Name: "Status", + Type: "string", + Values: []string{"pending", "paid"}, + }).String(), + want: "Status = typing.Literal[\"paid\", \"pending\"] | str\n", + }, + { + name: "one of", + got: (&OneOfDeclaration{ + Name: "CheckoutResponse", + Options: []string{"CheckoutSuccess", "CheckoutAccepted"}, + }).String(), + want: "CheckoutResponse = CheckoutSuccess | CheckoutAccepted\n", + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if tt.got != tt.want { + t.Fatalf("generated type = %q, want %q", tt.got, tt.want) + } + }) + } +} + +func TestInputTypeNameConvertsLegacyUnionSyntax(t *testing.T) { + got := inputTypeName("typing.Union[Checkout, typing.Optional[list[Address]]]") + want := "CheckoutInput | typing.Sequence[AddressInput] | None" + if got != want { + t.Fatalf("inputTypeName() = %q, want %q", got, want) + } +} diff --git a/codegen/templates/client.py.tmpl b/codegen/templates/client.py.tmpl index 9e5f8861..830d3b70 100644 --- a/codegen/templates/client.py.tmpl +++ b/codegen/templates/client.py.tmpl @@ -1,7 +1,6 @@ # Code generated by `py-sdk-gen`. DO NOT EDIT. import os import httpx -import typing from ._service import Resource, AsyncResource, runtime_headers {{- range .Resources }} @@ -9,24 +8,24 @@ from .{{ .Package }} import {{ .Name }}Resource, Async{{ .Name }}Resource {{- end }} BASE_URL = "https://api.sumup.com" -TimeoutType = typing.Union[ - httpx.Timeout, - float, - tuple[ - typing.Optional[float], - typing.Optional[float], - typing.Optional[float], - typing.Optional[float], - ], -] +TimeoutType = ( + httpx.Timeout + | float + | tuple[ + float | None, + float | None, + float | None, + float | None, + ] +) class Sumup(Resource): def __init__( self, - api_key: typing.Optional[str] = None, + api_key: str | None = None, base_url: str = BASE_URL, - timeout: typing.Optional[TimeoutType] = None, + timeout: TimeoutType | None = None, ) -> None: self.api_key = api_key or os.getenv("SUMUP_API_KEY") super().__init__(httpx.Client( @@ -53,9 +52,9 @@ class Sumup(Resource): class AsyncSumup(AsyncResource): def __init__( self, - api_key: typing.Optional[str] = None, + api_key: str | None = None, base_url: str = BASE_URL, - timeout: typing.Optional[TimeoutType] = None, + timeout: TimeoutType | None = None, ) -> None: self.api_key = api_key or os.getenv("SUMUP_API_KEY") super().__init__(httpx.AsyncClient( diff --git a/codegen/templates/resource.py.tmpl b/codegen/templates/resource.py.tmpl index 564d2420..b8e3cded 100644 --- a/codegen/templates/resource.py.tmpl +++ b/codegen/templates/resource.py.tmpl @@ -39,7 +39,7 @@ class {{.Service}}Resource(Resource): {{- with .DeprecationNotice }} @typing_extensions.deprecated("{{ . }}") {{- end }} - def {{.FunctionName}}({{.ParamsString}}, headers: typing.Optional[HeaderTypes] = None){{ with .ResponseType }} -> {{ . }}{{ end }}: + def {{.FunctionName}}({{.ParamsString}}, headers: HeaderTypes | None = None){{ with .ResponseType }} -> {{ . }}{{ end }}: {{- with .Description}} ''' {{ indent 2 . }} @@ -97,7 +97,7 @@ class Async{{.Service}}Resource(AsyncResource): {{- with .DeprecationNotice }} @typing_extensions.deprecated("{{ . }}") {{- end }} - async def {{.FunctionName}}({{.ParamsString}}, headers: typing.Optional[HeaderTypes] = None){{ with .ResponseType }} -> {{ . }}{{ end }}: + async def {{.FunctionName}}({{.ParamsString}}, headers: HeaderTypes | None = None){{ with .ResponseType }} -> {{ . }}{{ end }}: {{- with .Description}} ''' {{ indent 2 . }} diff --git a/examples/card_reader_checkout.py b/examples/card_reader_checkout.py index 4140fff1..877e3aa1 100644 --- a/examples/card_reader_checkout.py +++ b/examples/card_reader_checkout.py @@ -1,5 +1,5 @@ -import os import asyncio +import os from sumup import AsyncSumup diff --git a/examples/sync.py b/examples/sync.py index 6a020e11..156c1a30 100644 --- a/examples/sync.py +++ b/examples/sync.py @@ -1,6 +1,6 @@ import os -from sumup import Sumup, APIError +from sumup import APIError, Sumup client = Sumup() diff --git a/pyproject.toml b/pyproject.toml index 238a78fe..71ed5d85 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,7 +3,7 @@ name = "sumup" description = "Official Python SDK for the SumUp API." version = "0.3.1" readme = "README.md" -requires-python = ">=3.10" +requires-python = ">=3.10,<3.15" keywords = ["sdk", "sumup", "payments"] authors = [{name = "SumUp", email = "support@sumup.com"}] dependencies = [ diff --git a/sumup/__init__.py b/sumup/__init__.py index 55f9ae10..a4fe0c52 100644 --- a/sumup/__init__.py +++ b/sumup/__init__.py @@ -1,5 +1,5 @@ -from sumup._client import Sumup, AsyncSumup -from sumup._service import Resource, AsyncResource +from sumup._client import AsyncSumup, Sumup from sumup._exceptions import APIError +from sumup._service import AsyncResource, Resource __all__ = ["APIError", "AsyncResource", "AsyncSumup", "Resource", "Sumup"] diff --git a/sumup/_client.py b/sumup/_client.py index 6fc4bfbb..d33266fc 100644 --- a/sumup/_client.py +++ b/sumup/_client.py @@ -1,39 +1,39 @@ # Code generated by `py-sdk-gen`. DO NOT EDIT. import os + import httpx -import typing - -from ._service import Resource, AsyncResource, runtime_headers -from .checkouts import CheckoutsResource, AsyncCheckoutsResource -from .customers import CustomersResource, AsyncCustomersResource -from .members import MembersResource, AsyncMembersResource -from .memberships import MembershipsResource, AsyncMembershipsResource -from .merchants import MerchantsResource, AsyncMerchantsResource -from .payouts import PayoutsResource, AsyncPayoutsResource -from .readers import ReadersResource, AsyncReadersResource -from .receipts import ReceiptsResource, AsyncReceiptsResource -from .roles import RolesResource, AsyncRolesResource -from .transactions import TransactionsResource, AsyncTransactionsResource + +from ._service import AsyncResource, Resource, runtime_headers +from .checkouts import AsyncCheckoutsResource, CheckoutsResource +from .customers import AsyncCustomersResource, CustomersResource +from .members import AsyncMembersResource, MembersResource +from .memberships import AsyncMembershipsResource, MembershipsResource +from .merchants import AsyncMerchantsResource, MerchantsResource +from .payouts import AsyncPayoutsResource, PayoutsResource +from .readers import AsyncReadersResource, ReadersResource +from .receipts import AsyncReceiptsResource, ReceiptsResource +from .roles import AsyncRolesResource, RolesResource +from .transactions import AsyncTransactionsResource, TransactionsResource BASE_URL = "https://api.sumup.com" -TimeoutType = typing.Union[ - httpx.Timeout, - float, - tuple[ - typing.Optional[float], - typing.Optional[float], - typing.Optional[float], - typing.Optional[float], - ], -] +TimeoutType = ( + httpx.Timeout + | float + | tuple[ + float | None, + float | None, + float | None, + float | None, + ] +) class Sumup(Resource): def __init__( self, - api_key: typing.Optional[str] = None, + api_key: str | None = None, base_url: str = BASE_URL, - timeout: typing.Optional[TimeoutType] = None, + timeout: TimeoutType | None = None, ) -> None: self.api_key = api_key or os.getenv("SUMUP_API_KEY") super().__init__( @@ -123,9 +123,9 @@ def transactions(self) -> TransactionsResource: class AsyncSumup(AsyncResource): def __init__( self, - api_key: typing.Optional[str] = None, + api_key: str | None = None, base_url: str = BASE_URL, - timeout: typing.Optional[TimeoutType] = None, + timeout: TimeoutType | None = None, ) -> None: self.api_key = api_key or os.getenv("SUMUP_API_KEY") super().__init__( diff --git a/sumup/_exceptions.py b/sumup/_exceptions.py index a43815bf..fbcafc1c 100644 --- a/sumup/_exceptions.py +++ b/sumup/_exceptions.py @@ -1,6 +1,3 @@ -import typing - - class SumupError(Exception): pass @@ -8,8 +5,8 @@ class SumupError(Exception): class APIError(SumupError): message: str - status: typing.Optional[int] - body: typing.Optional[object] + status: int | None + body: object | None """The API response body. @@ -21,9 +18,7 @@ class APIError(SumupError): If there was no response associated with this error then it will be `None`. """ - def __init__( - self, message: str, *, status: typing.Optional[int], body: typing.Optional[object] - ) -> None: + def __init__(self, message: str, *, status: int | None, body: object | None) -> None: super().__init__(message) self.message = message self.status = status diff --git a/sumup/_secret.py b/sumup/_secret.py index fbce7907..598e2bbb 100644 --- a/sumup/_secret.py +++ b/sumup/_secret.py @@ -38,7 +38,7 @@ def __bool__(self) -> bool: def __hash__(self) -> int: return hash(self._value) - def __eq__(self, other: Any) -> bool: + def __eq__(self, other: object) -> bool: if isinstance(other, Secret): return self._value == other._value if isinstance(other, str): @@ -51,14 +51,14 @@ def __get_pydantic_core_schema__( ) -> core_schema.CoreSchema: """Allow pydantic models to accept raw strings but serialize as plain str.""" - def validate(value: Any) -> "Secret": + def validate(value: Any) -> Secret: if isinstance(value, Secret): return value if isinstance(value, str): return cls(value) raise TypeError("Secret value must be a string") - def serialize(value: "Secret") -> str: + def serialize(value: Secret) -> str: return value._value return core_schema.no_info_plain_validator_function( diff --git a/sumup/_service.py b/sumup/_service.py index de95d08e..b703ab20 100644 --- a/sumup/_service.py +++ b/sumup/_service.py @@ -1,18 +1,19 @@ import datetime -import httpx import platform import sys import typing -from functools import lru_cache from collections.abc import Mapping, Sequence +from functools import lru_cache + +import httpx from ._api_version import __api_version__ -from ._version import __version__ from ._secret import Secret +from ._version import __version__ HeaderTypes = typing.Mapping[str, str] -PrimitiveQueryValue = typing.Optional[typing.Union[str, int, float]] -QueryValue = typing.Union[PrimitiveQueryValue, typing.Sequence[PrimitiveQueryValue]] +PrimitiveQueryValue = str | int | float | None +QueryValue = PrimitiveQueryValue | typing.Sequence[PrimitiveQueryValue] QueryParamTypes = typing.Mapping[str, QueryValue] diff --git a/sumup/checkouts/__init__.py b/sumup/checkouts/__init__.py old mode 100755 new mode 100644 index 83af1863..aff5faf9 --- a/sumup/checkouts/__init__.py +++ b/sumup/checkouts/__init__.py @@ -1,11 +1,4 @@ # Code generated by `py-sdk-gen`. DO NOT EDIT. -from .resource import ( - CheckoutsResource, - AsyncCheckoutsResource, - GetPaymentMethods200ResponseAvailablePaymentMethod, - GetPaymentMethods200Response, - ProcessCheckoutResponse, -) from ..types import ( AddressLegacy, Card, @@ -32,15 +25,17 @@ TransactionCheckoutInfo, TransactionStatus, ) - +from .resource import ( + AsyncCheckoutsResource, + CheckoutsResource, + GetPaymentMethods200Response, + GetPaymentMethods200ResponseAvailablePaymentMethod, + ProcessCheckoutResponse, +) __all__ = [ - "CheckoutsResource", - "AsyncCheckoutsResource", - "GetPaymentMethods200ResponseAvailablePaymentMethod", - "GetPaymentMethods200Response", - "ProcessCheckoutResponse", "AddressLegacy", + "AsyncCheckoutsResource", "Card", "CardType", "Checkout", @@ -48,12 +43,15 @@ "CheckoutCreateRequest", "CheckoutSuccess", "CheckoutUpdateRequest", + "CheckoutsResource", "Currency", "DetailsError", "EntryMode", "Error", "ErrorExtended", "ErrorForbidden", + "GetPaymentMethods200Response", + "GetPaymentMethods200ResponseAvailablePaymentMethod", "HostedCheckout", "MandatePayload", "MandateResponse", @@ -61,6 +59,7 @@ "PersonalDetails", "Problem", "ProcessCheckout", + "ProcessCheckoutResponse", "TransactionBase", "TransactionCheckoutInfo", "TransactionStatus", diff --git a/sumup/checkouts/resource.py b/sumup/checkouts/resource.py old mode 100755 new mode 100644 index bf557464..710140d4 --- a/sumup/checkouts/resource.py +++ b/sumup/checkouts/resource.py @@ -18,63 +18,62 @@ """ from __future__ import annotations + +import datetime +import typing + +import httpx +import pydantic +import typing_extensions + +from .._exceptions import APIError from .._service import ( - Resource, + NOT_GIVEN, AsyncResource, HeaderTypes, NotGivenType, - NOT_GIVEN, + Resource, serialize_query_params, serialize_request_data, ) -from .._exceptions import APIError from ..types import ( AddressLegacy, + AddressLegacyInput, Card, + CardInput, CardType, + CardTypeInput, Checkout, CheckoutAccepted, CheckoutCreateRequest, + CheckoutCreateRequestInput, CheckoutSuccess, CheckoutUpdateRequest, + CheckoutUpdateRequestInput, Currency, + CurrencyInput, DetailsError, EntryMode, Error, ErrorExtended, ErrorForbidden, HostedCheckout, + HostedCheckoutInput, MandatePayload, + MandatePayloadInput, MandateResponse, PaymentType, PersonalDetails, + PersonalDetailsInput, Problem, ProcessCheckout, + ProcessCheckoutInput, TransactionBase, TransactionCheckoutInfo, TransactionStatus, ) -from ..types import ( - AddressLegacyInput, - CardInput, - CardTypeInput, - CheckoutCreateRequestInput, - CheckoutUpdateRequestInput, - CurrencyInput, - HostedCheckoutInput, - MandatePayloadInput, - PersonalDetailsInput, - ProcessCheckoutInput, -) -import datetime -import httpx -import typing -import pydantic -import typing_extensions -CreateCheckoutBodyPurposeInput = typing.Union[ - typing.Literal["CHECKOUT", "SETUP_RECURRING_PAYMENT"], str -] +CreateCheckoutBodyPurposeInput = typing.Literal["CHECKOUT", "SETUP_RECURRING_PAYMENT"] | str class CreateCheckoutBodyInput(typing_extensions.TypedDict, total=False): @@ -222,9 +221,9 @@ class UpdateCheckoutBodyInput(typing_extensions.TypedDict, total=False): ] -ProcessCheckoutBodyPaymentTypeInput = typing.Union[ - typing.Literal["apple_pay", "bancontact", "blik", "boleto", "card", "google_pay", "ideal"], str -] +ProcessCheckoutBodyPaymentTypeInput = ( + typing.Literal["apple_pay", "bancontact", "blik", "boleto", "card", "google_pay", "ideal"] | str +) ProcessCheckoutBodyGooglePayInput = typing.Mapping[str, object] """ @@ -350,9 +349,9 @@ class GetPaymentMethods200Response(pydantic.BaseModel): GetPaymentMethods200Response is a schema definition. """ - available_payment_methods: typing.Optional[ - list[GetPaymentMethods200ResponseAvailablePaymentMethod] - ] = None + available_payment_methods: list[GetPaymentMethods200ResponseAvailablePaymentMethod] | None = ( + None + ) ListCheckouts200Response = list[CheckoutSuccess] @@ -360,7 +359,7 @@ class GetPaymentMethods200Response(pydantic.BaseModel): ListCheckouts200Response is a schema definition. """ -ProcessCheckoutResponse = typing.Union[CheckoutSuccess, CheckoutAccepted] +ProcessCheckoutResponse = CheckoutSuccess | CheckoutAccepted CreateApplePaySession200Response = dict[str, object] """ @@ -378,9 +377,9 @@ def list_available_payment_methods( self, merchant_code: str, *, - amount: typing.Union[float, NotGivenType] = NOT_GIVEN, - currency: typing.Union[str, NotGivenType] = NOT_GIVEN, - headers: typing.Optional[HeaderTypes] = None, + amount: float | NotGivenType = NOT_GIVEN, + currency: str | NotGivenType = NOT_GIVEN, + headers: HeaderTypes | None = None, ) -> GetPaymentMethods200Response: """ Get available payment methods @@ -422,14 +421,14 @@ def create( amount: float, currency: CurrencyInput, merchant_code: str, - description: typing.Union[str, None, NotGivenType] = NOT_GIVEN, - return_url: typing.Union[str, None, NotGivenType] = NOT_GIVEN, - customer_id: typing.Union[str, None, NotGivenType] = NOT_GIVEN, - purpose: typing.Union[CreateCheckoutBodyPurposeInput, None, NotGivenType] = NOT_GIVEN, - valid_until: typing.Union[datetime.datetime, None, NotGivenType] = NOT_GIVEN, - redirect_url: typing.Union[str, None, NotGivenType] = NOT_GIVEN, - hosted_checkout: typing.Union[HostedCheckoutInput, None, NotGivenType] = NOT_GIVEN, - headers: typing.Optional[HeaderTypes] = None, + description: str | None | NotGivenType = NOT_GIVEN, + return_url: str | None | NotGivenType = NOT_GIVEN, + customer_id: str | None | NotGivenType = NOT_GIVEN, + purpose: CreateCheckoutBodyPurposeInput | None | NotGivenType = NOT_GIVEN, + valid_until: datetime.datetime | None | NotGivenType = NOT_GIVEN, + redirect_url: str | None | NotGivenType = NOT_GIVEN, + hosted_checkout: HostedCheckoutInput | None | NotGivenType = NOT_GIVEN, + headers: HeaderTypes | None = None, ) -> Checkout: """ Create a checkout @@ -501,8 +500,8 @@ def create( def list( self, *, - checkout_reference: typing.Union[str, NotGivenType] = NOT_GIVEN, - headers: typing.Optional[HeaderTypes] = None, + checkout_reference: str | NotGivenType = NOT_GIVEN, + headers: HeaderTypes | None = None, ) -> ListCheckouts200Response: """ List checkouts @@ -533,9 +532,7 @@ def list( else: raise APIError(f"Unexpected response", status=resp.status_code, body=resp.text) - def get( - self, checkout_id: str, headers: typing.Optional[HeaderTypes] = None - ) -> CheckoutSuccess: + def get(self, checkout_id: str, headers: HeaderTypes | None = None) -> CheckoutSuccess: """ Retrieve a checkout @@ -569,13 +566,13 @@ def update( self, checkout_id: str, *, - amount: typing.Union[float, None, NotGivenType] = NOT_GIVEN, - currency: typing.Union[CurrencyInput, None, NotGivenType] = NOT_GIVEN, - description: typing.Union[str, None, NotGivenType] = NOT_GIVEN, - checkout_reference: typing.Union[str, None, NotGivenType] = NOT_GIVEN, - valid_until: typing.Union[datetime.datetime, None, NotGivenType] = NOT_GIVEN, - customer_id: typing.Union[str, None, NotGivenType] = NOT_GIVEN, - headers: typing.Optional[HeaderTypes] = None, + amount: float | None | NotGivenType = NOT_GIVEN, + currency: CurrencyInput | None | NotGivenType = NOT_GIVEN, + description: str | None | NotGivenType = NOT_GIVEN, + checkout_reference: str | None | NotGivenType = NOT_GIVEN, + valid_until: datetime.datetime | None | NotGivenType = NOT_GIVEN, + customer_id: str | None | NotGivenType = NOT_GIVEN, + headers: HeaderTypes | None = None, ) -> Checkout: """ Update a checkout @@ -626,15 +623,15 @@ def process( checkout_id: str, *, payment_type: ProcessCheckoutBodyPaymentTypeInput, - installments: typing.Union[int, None, NotGivenType] = NOT_GIVEN, - mandate: typing.Union[MandatePayloadInput, None, NotGivenType] = NOT_GIVEN, - card: typing.Union[CardInput, None, NotGivenType] = NOT_GIVEN, - google_pay: typing.Union[ProcessCheckoutBodyGooglePayInput, None, NotGivenType] = NOT_GIVEN, - apple_pay: typing.Union[ProcessCheckoutBodyApplePayInput, None, NotGivenType] = NOT_GIVEN, - token: typing.Union[str, None, NotGivenType] = NOT_GIVEN, - customer_id: typing.Union[str, None, NotGivenType] = NOT_GIVEN, - personal_details: typing.Union[PersonalDetailsInput, None, NotGivenType] = NOT_GIVEN, - headers: typing.Optional[HeaderTypes] = None, + installments: int | None | NotGivenType = NOT_GIVEN, + mandate: MandatePayloadInput | None | NotGivenType = NOT_GIVEN, + card: CardInput | None | NotGivenType = NOT_GIVEN, + google_pay: ProcessCheckoutBodyGooglePayInput | None | NotGivenType = NOT_GIVEN, + apple_pay: ProcessCheckoutBodyApplePayInput | None | NotGivenType = NOT_GIVEN, + token: str | None | NotGivenType = NOT_GIVEN, + customer_id: str | None | NotGivenType = NOT_GIVEN, + personal_details: PersonalDetailsInput | None | NotGivenType = NOT_GIVEN, + headers: HeaderTypes | None = None, ) -> ProcessCheckoutResponse: """ Process a checkout @@ -703,9 +700,7 @@ def process( else: raise APIError(f"Unexpected response", status=resp.status_code, body=resp.text) - def deactivate( - self, checkout_id: str, headers: typing.Optional[HeaderTypes] = None - ) -> Checkout: + def deactivate(self, checkout_id: str, headers: HeaderTypes | None = None) -> Checkout: """ Deactivate a checkout @@ -743,12 +738,7 @@ def deactivate( raise APIError(f"Unexpected response", status=resp.status_code, body=resp.text) def create_apple_pay_session( - self, - checkout_id: str, - *, - context: str, - target: str, - headers: typing.Optional[HeaderTypes] = None, + self, checkout_id: str, *, context: str, target: str, headers: HeaderTypes | None = None ) -> CreateApplePaySession200Response: """ Create an Apple Pay session @@ -801,9 +791,9 @@ async def list_available_payment_methods( self, merchant_code: str, *, - amount: typing.Union[float, NotGivenType] = NOT_GIVEN, - currency: typing.Union[str, NotGivenType] = NOT_GIVEN, - headers: typing.Optional[HeaderTypes] = None, + amount: float | NotGivenType = NOT_GIVEN, + currency: str | NotGivenType = NOT_GIVEN, + headers: HeaderTypes | None = None, ) -> GetPaymentMethods200Response: """ Get available payment methods @@ -845,14 +835,14 @@ async def create( amount: float, currency: CurrencyInput, merchant_code: str, - description: typing.Union[str, None, NotGivenType] = NOT_GIVEN, - return_url: typing.Union[str, None, NotGivenType] = NOT_GIVEN, - customer_id: typing.Union[str, None, NotGivenType] = NOT_GIVEN, - purpose: typing.Union[CreateCheckoutBodyPurposeInput, None, NotGivenType] = NOT_GIVEN, - valid_until: typing.Union[datetime.datetime, None, NotGivenType] = NOT_GIVEN, - redirect_url: typing.Union[str, None, NotGivenType] = NOT_GIVEN, - hosted_checkout: typing.Union[HostedCheckoutInput, None, NotGivenType] = NOT_GIVEN, - headers: typing.Optional[HeaderTypes] = None, + description: str | None | NotGivenType = NOT_GIVEN, + return_url: str | None | NotGivenType = NOT_GIVEN, + customer_id: str | None | NotGivenType = NOT_GIVEN, + purpose: CreateCheckoutBodyPurposeInput | None | NotGivenType = NOT_GIVEN, + valid_until: datetime.datetime | None | NotGivenType = NOT_GIVEN, + redirect_url: str | None | NotGivenType = NOT_GIVEN, + hosted_checkout: HostedCheckoutInput | None | NotGivenType = NOT_GIVEN, + headers: HeaderTypes | None = None, ) -> Checkout: """ Create a checkout @@ -924,8 +914,8 @@ async def create( async def list( self, *, - checkout_reference: typing.Union[str, NotGivenType] = NOT_GIVEN, - headers: typing.Optional[HeaderTypes] = None, + checkout_reference: str | NotGivenType = NOT_GIVEN, + headers: HeaderTypes | None = None, ) -> ListCheckouts200Response: """ List checkouts @@ -956,9 +946,7 @@ async def list( else: raise APIError(f"Unexpected response", status=resp.status_code, body=resp.text) - async def get( - self, checkout_id: str, headers: typing.Optional[HeaderTypes] = None - ) -> CheckoutSuccess: + async def get(self, checkout_id: str, headers: HeaderTypes | None = None) -> CheckoutSuccess: """ Retrieve a checkout @@ -992,13 +980,13 @@ async def update( self, checkout_id: str, *, - amount: typing.Union[float, None, NotGivenType] = NOT_GIVEN, - currency: typing.Union[CurrencyInput, None, NotGivenType] = NOT_GIVEN, - description: typing.Union[str, None, NotGivenType] = NOT_GIVEN, - checkout_reference: typing.Union[str, None, NotGivenType] = NOT_GIVEN, - valid_until: typing.Union[datetime.datetime, None, NotGivenType] = NOT_GIVEN, - customer_id: typing.Union[str, None, NotGivenType] = NOT_GIVEN, - headers: typing.Optional[HeaderTypes] = None, + amount: float | None | NotGivenType = NOT_GIVEN, + currency: CurrencyInput | None | NotGivenType = NOT_GIVEN, + description: str | None | NotGivenType = NOT_GIVEN, + checkout_reference: str | None | NotGivenType = NOT_GIVEN, + valid_until: datetime.datetime | None | NotGivenType = NOT_GIVEN, + customer_id: str | None | NotGivenType = NOT_GIVEN, + headers: HeaderTypes | None = None, ) -> Checkout: """ Update a checkout @@ -1049,15 +1037,15 @@ async def process( checkout_id: str, *, payment_type: ProcessCheckoutBodyPaymentTypeInput, - installments: typing.Union[int, None, NotGivenType] = NOT_GIVEN, - mandate: typing.Union[MandatePayloadInput, None, NotGivenType] = NOT_GIVEN, - card: typing.Union[CardInput, None, NotGivenType] = NOT_GIVEN, - google_pay: typing.Union[ProcessCheckoutBodyGooglePayInput, None, NotGivenType] = NOT_GIVEN, - apple_pay: typing.Union[ProcessCheckoutBodyApplePayInput, None, NotGivenType] = NOT_GIVEN, - token: typing.Union[str, None, NotGivenType] = NOT_GIVEN, - customer_id: typing.Union[str, None, NotGivenType] = NOT_GIVEN, - personal_details: typing.Union[PersonalDetailsInput, None, NotGivenType] = NOT_GIVEN, - headers: typing.Optional[HeaderTypes] = None, + installments: int | None | NotGivenType = NOT_GIVEN, + mandate: MandatePayloadInput | None | NotGivenType = NOT_GIVEN, + card: CardInput | None | NotGivenType = NOT_GIVEN, + google_pay: ProcessCheckoutBodyGooglePayInput | None | NotGivenType = NOT_GIVEN, + apple_pay: ProcessCheckoutBodyApplePayInput | None | NotGivenType = NOT_GIVEN, + token: str | None | NotGivenType = NOT_GIVEN, + customer_id: str | None | NotGivenType = NOT_GIVEN, + personal_details: PersonalDetailsInput | None | NotGivenType = NOT_GIVEN, + headers: HeaderTypes | None = None, ) -> ProcessCheckoutResponse: """ Process a checkout @@ -1126,9 +1114,7 @@ async def process( else: raise APIError(f"Unexpected response", status=resp.status_code, body=resp.text) - async def deactivate( - self, checkout_id: str, headers: typing.Optional[HeaderTypes] = None - ) -> Checkout: + async def deactivate(self, checkout_id: str, headers: HeaderTypes | None = None) -> Checkout: """ Deactivate a checkout @@ -1166,12 +1152,7 @@ async def deactivate( raise APIError(f"Unexpected response", status=resp.status_code, body=resp.text) async def create_apple_pay_session( - self, - checkout_id: str, - *, - context: str, - target: str, - headers: typing.Optional[HeaderTypes] = None, + self, checkout_id: str, *, context: str, target: str, headers: HeaderTypes | None = None ) -> CreateApplePaySession200Response: """ Create an Apple Pay session diff --git a/sumup/customers/__init__.py b/sumup/customers/__init__.py old mode 100755 new mode 100644 index e530c1cd..844b1ac0 --- a/sumup/customers/__init__.py +++ b/sumup/customers/__init__.py @@ -1,8 +1,4 @@ # Code generated by `py-sdk-gen`. DO NOT EDIT. -from .resource import ( - CustomersResource, - AsyncCustomersResource, -) from ..types import ( AddressLegacy, CardType, @@ -15,14 +11,17 @@ PersonalDetails, Problem, ) - +from .resource import ( + AsyncCustomersResource, + CustomersResource, +) __all__ = [ - "CustomersResource", - "AsyncCustomersResource", "AddressLegacy", + "AsyncCustomersResource", "CardType", "Customer", + "CustomersResource", "Error", "ErrorExtended", "ErrorForbidden", diff --git a/sumup/customers/resource.py b/sumup/customers/resource.py old mode 100755 new mode 100644 index 7c1d6348..138f6e1d --- a/sumup/customers/resource.py +++ b/sumup/customers/resource.py @@ -9,34 +9,39 @@ """ from __future__ import annotations + +import datetime +import typing + +import httpx +import pydantic +import typing_extensions + +from .._exceptions import APIError from .._service import ( - Resource, + NOT_GIVEN, AsyncResource, HeaderTypes, NotGivenType, - NOT_GIVEN, + Resource, serialize_query_params, serialize_request_data, ) -from .._exceptions import APIError from ..types import ( AddressLegacy, + AddressLegacyInput, CardType, Customer, + CustomerInput, Error, ErrorExtended, ErrorForbidden, MandateResponse, PaymentInstrumentResponse, PersonalDetails, + PersonalDetailsInput, Problem, ) -from ..types import AddressLegacyInput, CustomerInput, PersonalDetailsInput -import datetime -import httpx -import typing -import pydantic -import typing_extensions class CreateCustomerBodyInput(typing_extensions.TypedDict, total=False): @@ -82,8 +87,8 @@ def create( self, *, customer_id: str, - personal_details: typing.Union[PersonalDetailsInput, None, NotGivenType] = NOT_GIVEN, - headers: typing.Optional[HeaderTypes] = None, + personal_details: PersonalDetailsInput | None | NotGivenType = NOT_GIVEN, + headers: HeaderTypes | None = None, ) -> Customer: """ Create a customer @@ -132,7 +137,7 @@ def create( else: raise APIError(f"Unexpected response", status=resp.status_code, body=resp.text) - def get(self, customer_id: str, headers: typing.Optional[HeaderTypes] = None) -> Customer: + def get(self, customer_id: str, headers: HeaderTypes | None = None) -> Customer: """ Retrieve a customer @@ -173,8 +178,8 @@ def update( self, customer_id: str, *, - personal_details: typing.Union[PersonalDetailsInput, None, NotGivenType] = NOT_GIVEN, - headers: typing.Optional[HeaderTypes] = None, + personal_details: PersonalDetailsInput | None | NotGivenType = NOT_GIVEN, + headers: HeaderTypes | None = None, ) -> Customer: """ Update a customer @@ -220,7 +225,7 @@ def update( raise APIError(f"Unexpected response", status=resp.status_code, body=resp.text) def list_payment_instruments( - self, customer_id: str, headers: typing.Optional[HeaderTypes] = None + self, customer_id: str, headers: HeaderTypes | None = None ) -> ListPaymentInstruments200Response: """ List payment instruments @@ -261,7 +266,7 @@ def list_payment_instruments( raise APIError(f"Unexpected response", status=resp.status_code, body=resp.text) def deactivate_payment_instrument( - self, customer_id: str, token: str, headers: typing.Optional[HeaderTypes] = None + self, customer_id: str, token: str, headers: HeaderTypes | None = None ): """ Deactivate a payment instrument @@ -313,8 +318,8 @@ async def create( self, *, customer_id: str, - personal_details: typing.Union[PersonalDetailsInput, None, NotGivenType] = NOT_GIVEN, - headers: typing.Optional[HeaderTypes] = None, + personal_details: PersonalDetailsInput | None | NotGivenType = NOT_GIVEN, + headers: HeaderTypes | None = None, ) -> Customer: """ Create a customer @@ -363,7 +368,7 @@ async def create( else: raise APIError(f"Unexpected response", status=resp.status_code, body=resp.text) - async def get(self, customer_id: str, headers: typing.Optional[HeaderTypes] = None) -> Customer: + async def get(self, customer_id: str, headers: HeaderTypes | None = None) -> Customer: """ Retrieve a customer @@ -404,8 +409,8 @@ async def update( self, customer_id: str, *, - personal_details: typing.Union[PersonalDetailsInput, None, NotGivenType] = NOT_GIVEN, - headers: typing.Optional[HeaderTypes] = None, + personal_details: PersonalDetailsInput | None | NotGivenType = NOT_GIVEN, + headers: HeaderTypes | None = None, ) -> Customer: """ Update a customer @@ -451,7 +456,7 @@ async def update( raise APIError(f"Unexpected response", status=resp.status_code, body=resp.text) async def list_payment_instruments( - self, customer_id: str, headers: typing.Optional[HeaderTypes] = None + self, customer_id: str, headers: HeaderTypes | None = None ) -> ListPaymentInstruments200Response: """ List payment instruments @@ -492,7 +497,7 @@ async def list_payment_instruments( raise APIError(f"Unexpected response", status=resp.status_code, body=resp.text) async def deactivate_payment_instrument( - self, customer_id: str, token: str, headers: typing.Optional[HeaderTypes] = None + self, customer_id: str, token: str, headers: HeaderTypes | None = None ): """ Deactivate a payment instrument diff --git a/sumup/members/__init__.py b/sumup/members/__init__.py old mode 100755 new mode 100644 index 8f4bd754..c001d109 --- a/sumup/members/__init__.py +++ b/sumup/members/__init__.py @@ -1,9 +1,4 @@ # Code generated by `py-sdk-gen`. DO NOT EDIT. -from .resource import ( - MembersResource, - AsyncMembersResource, - ListMerchantMembers200Response, -) from ..types import ( Attributes, Invite, @@ -15,15 +10,19 @@ Problem, UserType, ) - +from .resource import ( + AsyncMembersResource, + ListMerchantMembers200Response, + MembersResource, +) __all__ = [ - "MembersResource", "AsyncMembersResource", - "ListMerchantMembers200Response", "Attributes", "Invite", + "ListMerchantMembers200Response", "Member", + "MembersResource", "MembershipStatus", "MembershipUser", "MembershipUserClassic", diff --git a/sumup/members/resource.py b/sumup/members/resource.py old mode 100755 new mode 100644 index bde87ddf..00b4da1d --- a/sumup/members/resource.py +++ b/sumup/members/resource.py @@ -5,34 +5,39 @@ """ from __future__ import annotations + +import datetime +import typing + +import httpx +import pydantic +import typing_extensions + +from .._exceptions import APIError +from .._secret import Secret from .._service import ( - Resource, + NOT_GIVEN, AsyncResource, HeaderTypes, NotGivenType, - NOT_GIVEN, + Resource, serialize_query_params, serialize_request_data, ) -from .._exceptions import APIError -from .._secret import Secret from ..types import ( Attributes, + AttributesInput, Invite, Member, MembershipStatus, + MembershipStatusInput, MembershipUser, MembershipUserClassic, Metadata, + MetadataInput, Problem, UserType, ) -from ..types import AttributesInput, MembershipStatusInput, MetadataInput -import datetime -import httpx -import typing -import pydantic -import typing_extensions class CreateMerchantMemberBodyInput(typing_extensions.TypedDict, total=False): @@ -158,7 +163,7 @@ class ListMerchantMembers200Response(pydantic.BaseModel): items: list[Member] - total_count: typing.Optional[int] = None + total_count: int | None = None class MembersResource(Resource): @@ -171,14 +176,14 @@ def list( self, merchant_code: str, *, - offset: typing.Union[int, NotGivenType] = NOT_GIVEN, - limit: typing.Union[int, NotGivenType] = NOT_GIVEN, - scroll: typing.Union[bool, NotGivenType] = NOT_GIVEN, - email: typing.Union[str, NotGivenType] = NOT_GIVEN, - user_id: typing.Union[str, NotGivenType] = NOT_GIVEN, - status: typing.Union[MembershipStatusInput, NotGivenType] = NOT_GIVEN, - roles: typing.Union[typing.Sequence[str], NotGivenType] = NOT_GIVEN, - headers: typing.Optional[HeaderTypes] = None, + offset: int | NotGivenType = NOT_GIVEN, + limit: int | NotGivenType = NOT_GIVEN, + scroll: bool | NotGivenType = NOT_GIVEN, + email: str | NotGivenType = NOT_GIVEN, + user_id: str | NotGivenType = NOT_GIVEN, + status: MembershipStatusInput | NotGivenType = NOT_GIVEN, + roles: typing.Sequence[str] | NotGivenType = NOT_GIVEN, + headers: HeaderTypes | None = None, ) -> ListMerchantMembers200Response: """ List members @@ -223,14 +228,14 @@ def create( self, merchant_code: str, *, - is_managed_user: typing.Union[bool, None, NotGivenType] = NOT_GIVEN, + is_managed_user: bool | None | NotGivenType = NOT_GIVEN, email: str, - password: typing.Union[Secret, None, NotGivenType] = NOT_GIVEN, - nickname: typing.Union[str, None, NotGivenType] = NOT_GIVEN, + password: Secret | None | NotGivenType = NOT_GIVEN, + nickname: str | None | NotGivenType = NOT_GIVEN, roles: typing.Sequence[str], - metadata: typing.Union[MetadataInput, None, NotGivenType] = NOT_GIVEN, - attributes: typing.Union[AttributesInput, None, NotGivenType] = NOT_GIVEN, - headers: typing.Optional[HeaderTypes] = None, + metadata: MetadataInput | None | NotGivenType = NOT_GIVEN, + attributes: AttributesInput | None | NotGivenType = NOT_GIVEN, + headers: HeaderTypes | None = None, ) -> Member: """ Create a member @@ -279,9 +284,7 @@ def create( else: raise APIError(f"Unexpected response", status=resp.status_code, body=resp.text) - def get( - self, merchant_code: str, member_id: str, headers: typing.Optional[HeaderTypes] = None - ) -> Member: + def get(self, merchant_code: str, member_id: str, headers: HeaderTypes | None = None) -> Member: """ Retrieve a member @@ -309,11 +312,11 @@ def update( merchant_code: str, member_id: str, *, - roles: typing.Union[typing.Sequence[str], None, NotGivenType] = NOT_GIVEN, - metadata: typing.Union[MetadataInput, None, NotGivenType] = NOT_GIVEN, - attributes: typing.Union[AttributesInput, None, NotGivenType] = NOT_GIVEN, - user: typing.Union[UpdateMerchantMemberBodyUserInput, None, NotGivenType] = NOT_GIVEN, - headers: typing.Optional[HeaderTypes] = None, + roles: typing.Sequence[str] | None | NotGivenType = NOT_GIVEN, + metadata: MetadataInput | None | NotGivenType = NOT_GIVEN, + attributes: AttributesInput | None | NotGivenType = NOT_GIVEN, + user: UpdateMerchantMemberBodyUserInput | None | NotGivenType = NOT_GIVEN, + headers: HeaderTypes | None = None, ) -> Member: """ Update a member @@ -369,9 +372,7 @@ def update( else: raise APIError(f"Unexpected response", status=resp.status_code, body=resp.text) - def delete( - self, merchant_code: str, member_id: str, headers: typing.Optional[HeaderTypes] = None - ): + def delete(self, merchant_code: str, member_id: str, headers: HeaderTypes | None = None): """ Delete a member @@ -410,14 +411,14 @@ async def list( self, merchant_code: str, *, - offset: typing.Union[int, NotGivenType] = NOT_GIVEN, - limit: typing.Union[int, NotGivenType] = NOT_GIVEN, - scroll: typing.Union[bool, NotGivenType] = NOT_GIVEN, - email: typing.Union[str, NotGivenType] = NOT_GIVEN, - user_id: typing.Union[str, NotGivenType] = NOT_GIVEN, - status: typing.Union[MembershipStatusInput, NotGivenType] = NOT_GIVEN, - roles: typing.Union[typing.Sequence[str], NotGivenType] = NOT_GIVEN, - headers: typing.Optional[HeaderTypes] = None, + offset: int | NotGivenType = NOT_GIVEN, + limit: int | NotGivenType = NOT_GIVEN, + scroll: bool | NotGivenType = NOT_GIVEN, + email: str | NotGivenType = NOT_GIVEN, + user_id: str | NotGivenType = NOT_GIVEN, + status: MembershipStatusInput | NotGivenType = NOT_GIVEN, + roles: typing.Sequence[str] | NotGivenType = NOT_GIVEN, + headers: HeaderTypes | None = None, ) -> ListMerchantMembers200Response: """ List members @@ -462,14 +463,14 @@ async def create( self, merchant_code: str, *, - is_managed_user: typing.Union[bool, None, NotGivenType] = NOT_GIVEN, + is_managed_user: bool | None | NotGivenType = NOT_GIVEN, email: str, - password: typing.Union[Secret, None, NotGivenType] = NOT_GIVEN, - nickname: typing.Union[str, None, NotGivenType] = NOT_GIVEN, + password: Secret | None | NotGivenType = NOT_GIVEN, + nickname: str | None | NotGivenType = NOT_GIVEN, roles: typing.Sequence[str], - metadata: typing.Union[MetadataInput, None, NotGivenType] = NOT_GIVEN, - attributes: typing.Union[AttributesInput, None, NotGivenType] = NOT_GIVEN, - headers: typing.Optional[HeaderTypes] = None, + metadata: MetadataInput | None | NotGivenType = NOT_GIVEN, + attributes: AttributesInput | None | NotGivenType = NOT_GIVEN, + headers: HeaderTypes | None = None, ) -> Member: """ Create a member @@ -519,7 +520,7 @@ async def create( raise APIError(f"Unexpected response", status=resp.status_code, body=resp.text) async def get( - self, merchant_code: str, member_id: str, headers: typing.Optional[HeaderTypes] = None + self, merchant_code: str, member_id: str, headers: HeaderTypes | None = None ) -> Member: """ Retrieve a member @@ -548,11 +549,11 @@ async def update( merchant_code: str, member_id: str, *, - roles: typing.Union[typing.Sequence[str], None, NotGivenType] = NOT_GIVEN, - metadata: typing.Union[MetadataInput, None, NotGivenType] = NOT_GIVEN, - attributes: typing.Union[AttributesInput, None, NotGivenType] = NOT_GIVEN, - user: typing.Union[UpdateMerchantMemberBodyUserInput, None, NotGivenType] = NOT_GIVEN, - headers: typing.Optional[HeaderTypes] = None, + roles: typing.Sequence[str] | None | NotGivenType = NOT_GIVEN, + metadata: MetadataInput | None | NotGivenType = NOT_GIVEN, + attributes: AttributesInput | None | NotGivenType = NOT_GIVEN, + user: UpdateMerchantMemberBodyUserInput | None | NotGivenType = NOT_GIVEN, + headers: HeaderTypes | None = None, ) -> Member: """ Update a member @@ -608,9 +609,7 @@ async def update( else: raise APIError(f"Unexpected response", status=resp.status_code, body=resp.text) - async def delete( - self, merchant_code: str, member_id: str, headers: typing.Optional[HeaderTypes] = None - ): + async def delete(self, merchant_code: str, member_id: str, headers: HeaderTypes | None = None): """ Delete a member diff --git a/sumup/memberships/__init__.py b/sumup/memberships/__init__.py old mode 100755 new mode 100644 index 90f5c48d..0a639ecd --- a/sumup/memberships/__init__.py +++ b/sumup/memberships/__init__.py @@ -1,9 +1,4 @@ # Code generated by `py-sdk-gen`. DO NOT EDIT. -from .resource import ( - MembershipsResource, - AsyncMembershipsResource, - ListMemberships200Response, -) from ..types import ( Attributes, Invite, @@ -14,17 +9,21 @@ Problem, ResourceType, ) - +from .resource import ( + AsyncMembershipsResource, + ListMemberships200Response, + MembershipsResource, +) __all__ = [ - "MembershipsResource", "AsyncMembershipsResource", - "ListMemberships200Response", "Attributes", "Invite", + "ListMemberships200Response", "Membership", "MembershipResource", "MembershipStatus", + "MembershipsResource", "Metadata", "Problem", "ResourceType", diff --git a/sumup/memberships/resource.py b/sumup/memberships/resource.py old mode 100755 new mode 100644 index 65dd4eb3..754419c5 --- a/sumup/memberships/resource.py +++ b/sumup/memberships/resource.py @@ -5,32 +5,36 @@ """ from __future__ import annotations + +import datetime +import typing + +import httpx +import pydantic +import typing_extensions + +from .._exceptions import APIError from .._service import ( - Resource, + NOT_GIVEN, AsyncResource, HeaderTypes, NotGivenType, - NOT_GIVEN, + Resource, serialize_query_params, serialize_request_data, ) -from .._exceptions import APIError from ..types import ( Attributes, Invite, Membership, MembershipResource, MembershipStatus, + MembershipStatusInput, Metadata, Problem, ResourceType, + ResourceTypeInput, ) -from ..types import MembershipStatusInput, ResourceTypeInput -import datetime -import httpx -import typing -import pydantic -import typing_extensions class ListMembershipsParamsResourceParentTypeInput(typing_extensions.TypedDict, total=False): @@ -38,8 +42,6 @@ class ListMembershipsParamsResourceParentTypeInput(typing_extensions.TypedDict, ListMembershipsParamsResourceParentType is a schema definition. """ - pass - class ListMemberships200Response(pydantic.BaseModel): """ @@ -60,19 +62,18 @@ def __init__(self, client: httpx.Client) -> None: def list( self, *, - offset: typing.Union[int, NotGivenType] = NOT_GIVEN, - limit: typing.Union[int, NotGivenType] = NOT_GIVEN, - kind: typing.Union[ResourceTypeInput, NotGivenType] = NOT_GIVEN, - status: typing.Union[MembershipStatusInput, NotGivenType] = NOT_GIVEN, - resource_type: typing.Union[ResourceTypeInput, NotGivenType] = NOT_GIVEN, - resource_attributes_sandbox: typing.Union[bool, NotGivenType] = NOT_GIVEN, - resource_name: typing.Union[str, NotGivenType] = NOT_GIVEN, - resource_parent_id: typing.Union[str, NotGivenType] = NOT_GIVEN, - resource_parent_type: typing.Union[ - ListMembershipsParamsResourceParentTypeInput, NotGivenType - ] = NOT_GIVEN, - roles: typing.Union[typing.Sequence[str], NotGivenType] = NOT_GIVEN, - headers: typing.Optional[HeaderTypes] = None, + offset: int | NotGivenType = NOT_GIVEN, + limit: int | NotGivenType = NOT_GIVEN, + kind: ResourceTypeInput | NotGivenType = NOT_GIVEN, + status: MembershipStatusInput | NotGivenType = NOT_GIVEN, + resource_type: ResourceTypeInput | NotGivenType = NOT_GIVEN, + resource_attributes_sandbox: bool | NotGivenType = NOT_GIVEN, + resource_name: str | NotGivenType = NOT_GIVEN, + resource_parent_id: str | NotGivenType = NOT_GIVEN, + resource_parent_type: ListMembershipsParamsResourceParentTypeInput + | NotGivenType = NOT_GIVEN, + roles: typing.Sequence[str] | NotGivenType = NOT_GIVEN, + headers: HeaderTypes | None = None, ) -> ListMemberships200Response: """ List memberships @@ -141,19 +142,18 @@ def __init__(self, client: httpx.AsyncClient) -> None: async def list( self, *, - offset: typing.Union[int, NotGivenType] = NOT_GIVEN, - limit: typing.Union[int, NotGivenType] = NOT_GIVEN, - kind: typing.Union[ResourceTypeInput, NotGivenType] = NOT_GIVEN, - status: typing.Union[MembershipStatusInput, NotGivenType] = NOT_GIVEN, - resource_type: typing.Union[ResourceTypeInput, NotGivenType] = NOT_GIVEN, - resource_attributes_sandbox: typing.Union[bool, NotGivenType] = NOT_GIVEN, - resource_name: typing.Union[str, NotGivenType] = NOT_GIVEN, - resource_parent_id: typing.Union[str, NotGivenType] = NOT_GIVEN, - resource_parent_type: typing.Union[ - ListMembershipsParamsResourceParentTypeInput, NotGivenType - ] = NOT_GIVEN, - roles: typing.Union[typing.Sequence[str], NotGivenType] = NOT_GIVEN, - headers: typing.Optional[HeaderTypes] = None, + offset: int | NotGivenType = NOT_GIVEN, + limit: int | NotGivenType = NOT_GIVEN, + kind: ResourceTypeInput | NotGivenType = NOT_GIVEN, + status: MembershipStatusInput | NotGivenType = NOT_GIVEN, + resource_type: ResourceTypeInput | NotGivenType = NOT_GIVEN, + resource_attributes_sandbox: bool | NotGivenType = NOT_GIVEN, + resource_name: str | NotGivenType = NOT_GIVEN, + resource_parent_id: str | NotGivenType = NOT_GIVEN, + resource_parent_type: ListMembershipsParamsResourceParentTypeInput + | NotGivenType = NOT_GIVEN, + roles: typing.Sequence[str] | NotGivenType = NOT_GIVEN, + headers: HeaderTypes | None = None, ) -> ListMemberships200Response: """ List memberships diff --git a/sumup/merchants/__init__.py b/sumup/merchants/__init__.py old mode 100755 new mode 100644 index 2350afd3..6d4ab3b8 --- a/sumup/merchants/__init__.py +++ b/sumup/merchants/__init__.py @@ -1,8 +1,4 @@ # Code generated by `py-sdk-gen`. DO NOT EDIT. -from .resource import ( - MerchantsResource, - AsyncMerchantsResource, -) from ..types import ( Address, Attributes, @@ -28,12 +24,14 @@ Timestamps, Version, ) - +from .resource import ( + AsyncMerchantsResource, + MerchantsResource, +) __all__ = [ - "MerchantsResource", - "AsyncMerchantsResource", "Address", + "AsyncMerchantsResource", "Attributes", "BasePerson", "Branding", @@ -47,6 +45,7 @@ "LegalType", "ListPersonsResponseBody", "Merchant", + "MerchantsResource", "Meta", "Ownership", "Person", diff --git a/sumup/merchants/resource.py b/sumup/merchants/resource.py old mode 100755 new mode 100644 index f650fe55..f3e929db --- a/sumup/merchants/resource.py +++ b/sumup/merchants/resource.py @@ -5,16 +5,24 @@ """ from __future__ import annotations + +import datetime +import typing + +import httpx +import pydantic +import typing_extensions + +from .._exceptions import APIError from .._service import ( - Resource, + NOT_GIVEN, AsyncResource, HeaderTypes, NotGivenType, - NOT_GIVEN, + Resource, serialize_query_params, serialize_request_data, ) -from .._exceptions import APIError from ..types import ( Address, Attributes, @@ -40,11 +48,6 @@ Timestamps, Version, ) -import datetime -import httpx -import typing -import pydantic -import typing_extensions class MerchantsResource(Resource): @@ -57,8 +60,8 @@ def get( self, merchant_code: str, *, - version: typing.Union[str, NotGivenType] = NOT_GIVEN, - headers: typing.Optional[HeaderTypes] = None, + version: str | NotGivenType = NOT_GIVEN, + headers: HeaderTypes | None = None, ) -> Merchant: """ Get Merchant @@ -95,8 +98,8 @@ def list_persons( self, merchant_code: str, *, - version: typing.Union[str, NotGivenType] = NOT_GIVEN, - headers: typing.Optional[HeaderTypes] = None, + version: str | NotGivenType = NOT_GIVEN, + headers: HeaderTypes | None = None, ) -> ListPersonsResponseBody: """ List Persons @@ -134,8 +137,8 @@ def get_person( merchant_code: str, person_id: str, *, - version: typing.Union[str, NotGivenType] = NOT_GIVEN, - headers: typing.Optional[HeaderTypes] = None, + version: str | NotGivenType = NOT_GIVEN, + headers: HeaderTypes | None = None, ) -> Person: """ Get Person @@ -179,8 +182,8 @@ async def get( self, merchant_code: str, *, - version: typing.Union[str, NotGivenType] = NOT_GIVEN, - headers: typing.Optional[HeaderTypes] = None, + version: str | NotGivenType = NOT_GIVEN, + headers: HeaderTypes | None = None, ) -> Merchant: """ Get Merchant @@ -217,8 +220,8 @@ async def list_persons( self, merchant_code: str, *, - version: typing.Union[str, NotGivenType] = NOT_GIVEN, - headers: typing.Optional[HeaderTypes] = None, + version: str | NotGivenType = NOT_GIVEN, + headers: HeaderTypes | None = None, ) -> ListPersonsResponseBody: """ List Persons @@ -256,8 +259,8 @@ async def get_person( merchant_code: str, person_id: str, *, - version: typing.Union[str, NotGivenType] = NOT_GIVEN, - headers: typing.Optional[HeaderTypes] = None, + version: str | NotGivenType = NOT_GIVEN, + headers: HeaderTypes | None = None, ) -> Person: """ Get Person diff --git a/sumup/payouts/__init__.py b/sumup/payouts/__init__.py old mode 100755 new mode 100644 index 9a7c283b..46a21f6c --- a/sumup/payouts/__init__.py +++ b/sumup/payouts/__init__.py @@ -1,8 +1,4 @@ # Code generated by `py-sdk-gen`. DO NOT EDIT. -from .resource import ( - PayoutsResource, - AsyncPayoutsResource, -) from ..types import ( Error, ErrorExtended, @@ -10,14 +6,17 @@ FinancialPayouts, Problem, ) - +from .resource import ( + AsyncPayoutsResource, + PayoutsResource, +) __all__ = [ - "PayoutsResource", "AsyncPayoutsResource", "Error", "ErrorExtended", "FinancialPayout", "FinancialPayouts", + "PayoutsResource", "Problem", ] diff --git a/sumup/payouts/resource.py b/sumup/payouts/resource.py old mode 100755 new mode 100644 index becf17c0..78dea3b6 --- a/sumup/payouts/resource.py +++ b/sumup/payouts/resource.py @@ -7,26 +7,29 @@ """ from __future__ import annotations + +import datetime +import typing + +import httpx +import pydantic +import typing_extensions + +from .._exceptions import APIError from .._service import ( - Resource, + NOT_GIVEN, AsyncResource, HeaderTypes, NotGivenType, - NOT_GIVEN, + Resource, serialize_query_params, serialize_request_data, ) -from .._exceptions import APIError from ..types import Error, ErrorExtended, FinancialPayout, FinancialPayouts, Problem -import datetime -import httpx -import typing -import pydantic -import typing_extensions -ListPayoutsV1ParamsFormatInput = typing.Union[typing.Literal["csv", "json"], str] +ListPayoutsV1ParamsFormatInput = typing.Literal["csv", "json"] | str -ListPayoutsV1ParamsOrderInput = typing.Union[typing.Literal["asc", "desc"], str] +ListPayoutsV1ParamsOrderInput = typing.Literal["asc", "desc"] | str class PayoutsResource(Resource): @@ -41,10 +44,10 @@ def list( *, start_date: datetime.date, end_date: datetime.date, - format: typing.Union[ListPayoutsV1ParamsFormatInput, NotGivenType] = NOT_GIVEN, - limit: typing.Union[int, NotGivenType] = NOT_GIVEN, - order: typing.Union[ListPayoutsV1ParamsOrderInput, NotGivenType] = NOT_GIVEN, - headers: typing.Optional[HeaderTypes] = None, + format: ListPayoutsV1ParamsFormatInput | NotGivenType = NOT_GIVEN, + limit: int | NotGivenType = NOT_GIVEN, + order: ListPayoutsV1ParamsOrderInput | NotGivenType = NOT_GIVEN, + headers: HeaderTypes | None = None, ) -> FinancialPayouts: """ List payouts @@ -107,10 +110,10 @@ async def list( *, start_date: datetime.date, end_date: datetime.date, - format: typing.Union[ListPayoutsV1ParamsFormatInput, NotGivenType] = NOT_GIVEN, - limit: typing.Union[int, NotGivenType] = NOT_GIVEN, - order: typing.Union[ListPayoutsV1ParamsOrderInput, NotGivenType] = NOT_GIVEN, - headers: typing.Optional[HeaderTypes] = None, + format: ListPayoutsV1ParamsFormatInput | NotGivenType = NOT_GIVEN, + limit: int | NotGivenType = NOT_GIVEN, + order: ListPayoutsV1ParamsOrderInput | NotGivenType = NOT_GIVEN, + headers: HeaderTypes | None = None, ) -> FinancialPayouts: """ List payouts diff --git a/sumup/readers/__init__.py b/sumup/readers/__init__.py old mode 100755 new mode 100644 index 4d040350..48fe970f --- a/sumup/readers/__init__.py +++ b/sumup/readers/__init__.py @@ -1,9 +1,4 @@ # Code generated by `py-sdk-gen`. DO NOT EDIT. -from .resource import ( - ReadersResource, - AsyncReadersResource, - ListReaders200Response, -) from ..types import ( Affiliate, Amount, @@ -30,14 +25,16 @@ StatusResponse, Unauthorized, ) - +from .resource import ( + AsyncReadersResource, + ListReaders200Response, + ReadersResource, +) __all__ = [ - "ReadersResource", - "AsyncReadersResource", - "ListReaders200Response", "Affiliate", "Amount", + "AsyncReadersResource", "BadRequest", "CreateReaderCheckoutError", "CreateReaderCheckoutRequest", @@ -46,6 +43,7 @@ "CreateReaderTerminateError", "CreateReaderTerminateUnprocessableEntity", "GetReaderCheckoutResponse", + "ListReaders200Response", "Metadata", "NotFound", "Problem", @@ -58,6 +56,7 @@ "ReaderPaymentResponse", "ReaderPaymentResponseData", "ReaderStatus", + "ReadersResource", "StatusResponse", "Unauthorized", ] diff --git a/sumup/readers/resource.py b/sumup/readers/resource.py old mode 100755 new mode 100644 index 7f601d03..78beca82 --- a/sumup/readers/resource.py +++ b/sumup/readers/resource.py @@ -1,57 +1,58 @@ # Code generated by `py-sdk-gen`. DO NOT EDIT. # ruff: noqa: F401, F541 from __future__ import annotations + +import datetime +import typing + +import httpx +import pydantic +import typing_extensions + +from .._exceptions import APIError from .._service import ( - Resource, + NOT_GIVEN, AsyncResource, HeaderTypes, NotGivenType, - NOT_GIVEN, + Resource, serialize_query_params, serialize_request_data, ) -from .._exceptions import APIError from ..types import ( Affiliate, + AffiliateInput, Amount, + AmountInput, BadRequest, CreateReaderCheckoutError, CreateReaderCheckoutRequest, + CreateReaderCheckoutRequestInput, CreateReaderCheckoutResponse, CreateReaderCheckoutUnprocessableEntity, CreateReaderTerminateError, CreateReaderTerminateUnprocessableEntity, GetReaderCheckoutResponse, Metadata, + MetadataInput, NotFound, Problem, Reader, ReaderDevice, ReaderId, + ReaderIdInput, ReaderName, + ReaderNameInput, ReaderPairingCode, + ReaderPairingCodeInput, ReaderPaymentRequestParams, + ReaderPaymentRequestParamsInput, ReaderPaymentResponse, ReaderPaymentResponseData, ReaderStatus, StatusResponse, Unauthorized, ) -from ..types import ( - AffiliateInput, - AmountInput, - CreateReaderCheckoutRequestInput, - MetadataInput, - ReaderIdInput, - ReaderNameInput, - ReaderPairingCodeInput, - ReaderPaymentRequestParamsInput, -) -import datetime -import httpx -import typing -import pydantic -import typing_extensions class CreateGoReaderCheckoutBodyInput(typing_extensions.TypedDict, total=False): @@ -203,7 +204,7 @@ class CreateReaderCheckoutBodyAffiliateInput(typing_extensions.TypedDict, total= ] -CreateReaderCheckoutBodyCardTypeInput = typing.Union[typing.Literal["credit", "debit"], str] +CreateReaderCheckoutBodyCardTypeInput = typing.Literal["credit", "debit"] | str class CreateReaderCheckoutBodyTotalAmountInput(typing_extensions.TypedDict, total=False): @@ -329,11 +330,11 @@ def create_go_checkout( merchant_code: str, reader_id: ReaderId, *, - affiliate: typing.Union[AffiliateInput, None, NotGivenType] = NOT_GIVEN, + affiliate: AffiliateInput | None | NotGivenType = NOT_GIVEN, client_transaction_id: str, - tip_amount: typing.Union[int, None, NotGivenType] = NOT_GIVEN, + tip_amount: int | None | NotGivenType = NOT_GIVEN, total_amount: AmountInput, - headers: typing.Optional[HeaderTypes] = None, + headers: HeaderTypes | None = None, ) -> ReaderPaymentResponse: """ Create a Go Reader Payment @@ -397,7 +398,7 @@ def create_go_checkout( raise APIError(f"Unexpected response", status=resp.status_code, body=resp.text) def list( - self, merchant_code: str, headers: typing.Optional[HeaderTypes] = None + self, merchant_code: str, headers: HeaderTypes | None = None ) -> ListReaders200Response: """ List Readers @@ -431,8 +432,8 @@ def create( *, pairing_code: ReaderPairingCodeInput, name: ReaderNameInput, - metadata: typing.Union[MetadataInput, None, NotGivenType] = NOT_GIVEN, - headers: typing.Optional[HeaderTypes] = None, + metadata: MetadataInput | None | NotGivenType = NOT_GIVEN, + headers: HeaderTypes | None = None, ) -> Reader: """ Create a Reader @@ -476,7 +477,7 @@ def create( raise APIError(f"Unexpected response", status=resp.status_code, body=resp.text) def get( - self, merchant_code: str, reader_id: ReaderId, headers: typing.Optional[HeaderTypes] = None + self, merchant_code: str, reader_id: ReaderId, headers: HeaderTypes | None = None ) -> Reader: """ Retrieve a Reader @@ -504,9 +505,7 @@ def get( else: raise APIError(f"Unexpected response", status=resp.status_code, body=resp.text) - def delete( - self, merchant_code: str, reader_id: ReaderId, headers: typing.Optional[HeaderTypes] = None - ): + def delete(self, merchant_code: str, reader_id: ReaderId, headers: HeaderTypes | None = None): """ Delete a reader @@ -538,9 +537,9 @@ def update( merchant_code: str, reader_id: ReaderId, *, - name: typing.Union[ReaderNameInput, None, NotGivenType] = NOT_GIVEN, - metadata: typing.Union[MetadataInput, None, NotGivenType] = NOT_GIVEN, - headers: typing.Optional[HeaderTypes] = None, + name: ReaderNameInput | None | NotGivenType = NOT_GIVEN, + metadata: MetadataInput | None | NotGivenType = NOT_GIVEN, + headers: HeaderTypes | None = None, ) -> Reader: """ Update a Reader @@ -587,20 +586,16 @@ def create_checkout( merchant_code: str, reader_id: str, *, - aade: typing.Union[CreateReaderCheckoutBodyAadeInput, None, NotGivenType] = NOT_GIVEN, - affiliate: typing.Union[ - CreateReaderCheckoutBodyAffiliateInput, None, NotGivenType - ] = NOT_GIVEN, - card_type: typing.Union[ - CreateReaderCheckoutBodyCardTypeInput, None, NotGivenType - ] = NOT_GIVEN, - description: typing.Union[str, None, NotGivenType] = NOT_GIVEN, - installments: typing.Union[int, None, NotGivenType] = NOT_GIVEN, - return_url: typing.Union[str, None, NotGivenType] = NOT_GIVEN, - tip_rates: typing.Union[typing.Sequence[float], None, NotGivenType] = NOT_GIVEN, - tip_timeout: typing.Union[int, None, NotGivenType] = NOT_GIVEN, + aade: CreateReaderCheckoutBodyAadeInput | None | NotGivenType = NOT_GIVEN, + affiliate: CreateReaderCheckoutBodyAffiliateInput | None | NotGivenType = NOT_GIVEN, + card_type: CreateReaderCheckoutBodyCardTypeInput | None | NotGivenType = NOT_GIVEN, + description: str | None | NotGivenType = NOT_GIVEN, + installments: int | None | NotGivenType = NOT_GIVEN, + return_url: str | None | NotGivenType = NOT_GIVEN, + tip_rates: typing.Sequence[float] | None | NotGivenType = NOT_GIVEN, + tip_timeout: int | None | NotGivenType = NOT_GIVEN, total_amount: CreateReaderCheckoutBodyTotalAmountInput, - headers: typing.Optional[HeaderTypes] = None, + headers: HeaderTypes | None = None, ) -> CreateReaderCheckoutResponse: """ Create a Reader Checkout @@ -675,7 +670,7 @@ def create_checkout( raise APIError(f"Unexpected response", status=resp.status_code, body=resp.text) def get_status( - self, merchant_code: str, reader_id: str, headers: typing.Optional[HeaderTypes] = None + self, merchant_code: str, reader_id: str, headers: HeaderTypes | None = None ) -> StatusResponse: """ Get a Reader Status @@ -735,7 +730,7 @@ def get_status( raise APIError(f"Unexpected response", status=resp.status_code, body=resp.text) def terminate_checkout( - self, merchant_code: str, reader_id: str, headers: typing.Optional[HeaderTypes] = None + self, merchant_code: str, reader_id: str, headers: HeaderTypes | None = None ): """ Terminate a Reader Checkout @@ -797,7 +792,7 @@ def get_checkout( merchant_code: str, reader_id: str, checkout_id: str, - headers: typing.Optional[HeaderTypes] = None, + headers: HeaderTypes | None = None, ) -> GetReaderCheckoutResponse: """ Get a Reader Checkout @@ -841,11 +836,11 @@ async def create_go_checkout( merchant_code: str, reader_id: ReaderId, *, - affiliate: typing.Union[AffiliateInput, None, NotGivenType] = NOT_GIVEN, + affiliate: AffiliateInput | None | NotGivenType = NOT_GIVEN, client_transaction_id: str, - tip_amount: typing.Union[int, None, NotGivenType] = NOT_GIVEN, + tip_amount: int | None | NotGivenType = NOT_GIVEN, total_amount: AmountInput, - headers: typing.Optional[HeaderTypes] = None, + headers: HeaderTypes | None = None, ) -> ReaderPaymentResponse: """ Create a Go Reader Payment @@ -909,7 +904,7 @@ async def create_go_checkout( raise APIError(f"Unexpected response", status=resp.status_code, body=resp.text) async def list( - self, merchant_code: str, headers: typing.Optional[HeaderTypes] = None + self, merchant_code: str, headers: HeaderTypes | None = None ) -> ListReaders200Response: """ List Readers @@ -943,8 +938,8 @@ async def create( *, pairing_code: ReaderPairingCodeInput, name: ReaderNameInput, - metadata: typing.Union[MetadataInput, None, NotGivenType] = NOT_GIVEN, - headers: typing.Optional[HeaderTypes] = None, + metadata: MetadataInput | None | NotGivenType = NOT_GIVEN, + headers: HeaderTypes | None = None, ) -> Reader: """ Create a Reader @@ -988,7 +983,7 @@ async def create( raise APIError(f"Unexpected response", status=resp.status_code, body=resp.text) async def get( - self, merchant_code: str, reader_id: ReaderId, headers: typing.Optional[HeaderTypes] = None + self, merchant_code: str, reader_id: ReaderId, headers: HeaderTypes | None = None ) -> Reader: """ Retrieve a Reader @@ -1017,7 +1012,7 @@ async def get( raise APIError(f"Unexpected response", status=resp.status_code, body=resp.text) async def delete( - self, merchant_code: str, reader_id: ReaderId, headers: typing.Optional[HeaderTypes] = None + self, merchant_code: str, reader_id: ReaderId, headers: HeaderTypes | None = None ): """ Delete a reader @@ -1050,9 +1045,9 @@ async def update( merchant_code: str, reader_id: ReaderId, *, - name: typing.Union[ReaderNameInput, None, NotGivenType] = NOT_GIVEN, - metadata: typing.Union[MetadataInput, None, NotGivenType] = NOT_GIVEN, - headers: typing.Optional[HeaderTypes] = None, + name: ReaderNameInput | None | NotGivenType = NOT_GIVEN, + metadata: MetadataInput | None | NotGivenType = NOT_GIVEN, + headers: HeaderTypes | None = None, ) -> Reader: """ Update a Reader @@ -1099,20 +1094,16 @@ async def create_checkout( merchant_code: str, reader_id: str, *, - aade: typing.Union[CreateReaderCheckoutBodyAadeInput, None, NotGivenType] = NOT_GIVEN, - affiliate: typing.Union[ - CreateReaderCheckoutBodyAffiliateInput, None, NotGivenType - ] = NOT_GIVEN, - card_type: typing.Union[ - CreateReaderCheckoutBodyCardTypeInput, None, NotGivenType - ] = NOT_GIVEN, - description: typing.Union[str, None, NotGivenType] = NOT_GIVEN, - installments: typing.Union[int, None, NotGivenType] = NOT_GIVEN, - return_url: typing.Union[str, None, NotGivenType] = NOT_GIVEN, - tip_rates: typing.Union[typing.Sequence[float], None, NotGivenType] = NOT_GIVEN, - tip_timeout: typing.Union[int, None, NotGivenType] = NOT_GIVEN, + aade: CreateReaderCheckoutBodyAadeInput | None | NotGivenType = NOT_GIVEN, + affiliate: CreateReaderCheckoutBodyAffiliateInput | None | NotGivenType = NOT_GIVEN, + card_type: CreateReaderCheckoutBodyCardTypeInput | None | NotGivenType = NOT_GIVEN, + description: str | None | NotGivenType = NOT_GIVEN, + installments: int | None | NotGivenType = NOT_GIVEN, + return_url: str | None | NotGivenType = NOT_GIVEN, + tip_rates: typing.Sequence[float] | None | NotGivenType = NOT_GIVEN, + tip_timeout: int | None | NotGivenType = NOT_GIVEN, total_amount: CreateReaderCheckoutBodyTotalAmountInput, - headers: typing.Optional[HeaderTypes] = None, + headers: HeaderTypes | None = None, ) -> CreateReaderCheckoutResponse: """ Create a Reader Checkout @@ -1187,7 +1178,7 @@ async def create_checkout( raise APIError(f"Unexpected response", status=resp.status_code, body=resp.text) async def get_status( - self, merchant_code: str, reader_id: str, headers: typing.Optional[HeaderTypes] = None + self, merchant_code: str, reader_id: str, headers: HeaderTypes | None = None ) -> StatusResponse: """ Get a Reader Status @@ -1247,7 +1238,7 @@ async def get_status( raise APIError(f"Unexpected response", status=resp.status_code, body=resp.text) async def terminate_checkout( - self, merchant_code: str, reader_id: str, headers: typing.Optional[HeaderTypes] = None + self, merchant_code: str, reader_id: str, headers: HeaderTypes | None = None ): """ Terminate a Reader Checkout @@ -1309,7 +1300,7 @@ async def get_checkout( merchant_code: str, reader_id: str, checkout_id: str, - headers: typing.Optional[HeaderTypes] = None, + headers: HeaderTypes | None = None, ) -> GetReaderCheckoutResponse: """ Get a Reader Checkout diff --git a/sumup/receipts/__init__.py b/sumup/receipts/__init__.py old mode 100755 new mode 100644 index 06b14261..4c41f7f7 --- a/sumup/receipts/__init__.py +++ b/sumup/receipts/__init__.py @@ -1,8 +1,4 @@ # Code generated by `py-sdk-gen`. DO NOT EDIT. -from .resource import ( - ReceiptsResource, - AsyncReceiptsResource, -) from ..types import ( Error, Problem, @@ -17,10 +13,12 @@ TransactionEventType, TransactionId, ) - +from .resource import ( + AsyncReceiptsResource, + ReceiptsResource, +) __all__ = [ - "ReceiptsResource", "AsyncReceiptsResource", "Error", "Problem", @@ -30,6 +28,7 @@ "ReceiptMerchantData", "ReceiptReader", "ReceiptTransaction", + "ReceiptsResource", "TransactionEventId", "TransactionEventStatus", "TransactionEventType", diff --git a/sumup/receipts/resource.py b/sumup/receipts/resource.py old mode 100755 new mode 100644 index 5cdbc8ad..15eb0b84 --- a/sumup/receipts/resource.py +++ b/sumup/receipts/resource.py @@ -5,16 +5,24 @@ """ from __future__ import annotations + +import datetime +import typing + +import httpx +import pydantic +import typing_extensions + +from .._exceptions import APIError from .._service import ( - Resource, + NOT_GIVEN, AsyncResource, HeaderTypes, NotGivenType, - NOT_GIVEN, + Resource, serialize_query_params, serialize_request_data, ) -from .._exceptions import APIError from ..types import ( Error, Problem, @@ -29,11 +37,6 @@ TransactionEventType, TransactionId, ) -import datetime -import httpx -import typing -import pydantic -import typing_extensions class ReceiptsResource(Resource): @@ -47,8 +50,8 @@ def get( transaction_id: str, *, mid: str, - tx_event_id: typing.Union[int, NotGivenType] = NOT_GIVEN, - headers: typing.Optional[HeaderTypes] = None, + tx_event_id: int | NotGivenType = NOT_GIVEN, + headers: HeaderTypes | None = None, ) -> Receipt: """ Retrieve receipt details @@ -106,8 +109,8 @@ async def get( transaction_id: str, *, mid: str, - tx_event_id: typing.Union[int, NotGivenType] = NOT_GIVEN, - headers: typing.Optional[HeaderTypes] = None, + tx_event_id: int | NotGivenType = NOT_GIVEN, + headers: HeaderTypes | None = None, ) -> Receipt: """ Retrieve receipt details diff --git a/sumup/roles/__init__.py b/sumup/roles/__init__.py old mode 100755 new mode 100644 index 427a5c0f..9ba1a556 --- a/sumup/roles/__init__.py +++ b/sumup/roles/__init__.py @@ -1,21 +1,20 @@ # Code generated by `py-sdk-gen`. DO NOT EDIT. -from .resource import ( - RolesResource, - AsyncRolesResource, - ListMerchantRoles200Response, -) from ..types import ( Metadata, Problem, Role, ) - +from .resource import ( + AsyncRolesResource, + ListMerchantRoles200Response, + RolesResource, +) __all__ = [ - "RolesResource", "AsyncRolesResource", "ListMerchantRoles200Response", "Metadata", "Problem", "Role", + "RolesResource", ] diff --git a/sumup/roles/resource.py b/sumup/roles/resource.py old mode 100755 new mode 100644 index 1dc28736..e3e3dd4b --- a/sumup/roles/resource.py +++ b/sumup/roles/resource.py @@ -5,23 +5,25 @@ """ from __future__ import annotations + +import datetime +import typing + +import httpx +import pydantic +import typing_extensions + +from .._exceptions import APIError from .._service import ( - Resource, + NOT_GIVEN, AsyncResource, HeaderTypes, NotGivenType, - NOT_GIVEN, + Resource, serialize_query_params, serialize_request_data, ) -from .._exceptions import APIError -from ..types import Metadata, Problem, Role -from ..types import MetadataInput -import datetime -import httpx -import typing -import pydantic -import typing_extensions +from ..types import Metadata, MetadataInput, Problem, Role class CreateMerchantRoleBodyInput(typing_extensions.TypedDict, total=False): @@ -87,7 +89,7 @@ def __init__(self, client: httpx.Client) -> None: super().__init__(client) def list( - self, merchant_code: str, headers: typing.Optional[HeaderTypes] = None + self, merchant_code: str, headers: HeaderTypes | None = None ) -> ListMerchantRoles200Response: """ List roles @@ -117,9 +119,9 @@ def create( *, name: str, permissions: typing.Sequence[str], - metadata: typing.Union[MetadataInput, None, NotGivenType] = NOT_GIVEN, - description: typing.Union[str, None, NotGivenType] = NOT_GIVEN, - headers: typing.Optional[HeaderTypes] = None, + metadata: MetadataInput | None | NotGivenType = NOT_GIVEN, + description: str | None | NotGivenType = NOT_GIVEN, + headers: HeaderTypes | None = None, ) -> Role: """ Create a role @@ -155,9 +157,7 @@ def create( else: raise APIError(f"Unexpected response", status=resp.status_code, body=resp.text) - def get( - self, merchant_code: str, role_id: str, headers: typing.Optional[HeaderTypes] = None - ) -> Role: + def get(self, merchant_code: str, role_id: str, headers: HeaderTypes | None = None) -> Role: """ Retrieve a role @@ -180,9 +180,7 @@ def get( else: raise APIError(f"Unexpected response", status=resp.status_code, body=resp.text) - def delete( - self, merchant_code: str, role_id: str, headers: typing.Optional[HeaderTypes] = None - ): + def delete(self, merchant_code: str, role_id: str, headers: HeaderTypes | None = None): """ Delete a role @@ -213,10 +211,10 @@ def update( merchant_code: str, role_id: str, *, - name: typing.Union[str, None, NotGivenType] = NOT_GIVEN, - permissions: typing.Union[typing.Sequence[str], None, NotGivenType] = NOT_GIVEN, - description: typing.Union[str, None, NotGivenType] = NOT_GIVEN, - headers: typing.Optional[HeaderTypes] = None, + name: str | None | NotGivenType = NOT_GIVEN, + permissions: typing.Sequence[str] | None | NotGivenType = NOT_GIVEN, + description: str | None | NotGivenType = NOT_GIVEN, + headers: HeaderTypes | None = None, ) -> Role: """ Update a role @@ -260,7 +258,7 @@ def __init__(self, client: httpx.AsyncClient) -> None: super().__init__(client) async def list( - self, merchant_code: str, headers: typing.Optional[HeaderTypes] = None + self, merchant_code: str, headers: HeaderTypes | None = None ) -> ListMerchantRoles200Response: """ List roles @@ -290,9 +288,9 @@ async def create( *, name: str, permissions: typing.Sequence[str], - metadata: typing.Union[MetadataInput, None, NotGivenType] = NOT_GIVEN, - description: typing.Union[str, None, NotGivenType] = NOT_GIVEN, - headers: typing.Optional[HeaderTypes] = None, + metadata: MetadataInput | None | NotGivenType = NOT_GIVEN, + description: str | None | NotGivenType = NOT_GIVEN, + headers: HeaderTypes | None = None, ) -> Role: """ Create a role @@ -329,7 +327,7 @@ async def create( raise APIError(f"Unexpected response", status=resp.status_code, body=resp.text) async def get( - self, merchant_code: str, role_id: str, headers: typing.Optional[HeaderTypes] = None + self, merchant_code: str, role_id: str, headers: HeaderTypes | None = None ) -> Role: """ Retrieve a role @@ -353,9 +351,7 @@ async def get( else: raise APIError(f"Unexpected response", status=resp.status_code, body=resp.text) - async def delete( - self, merchant_code: str, role_id: str, headers: typing.Optional[HeaderTypes] = None - ): + async def delete(self, merchant_code: str, role_id: str, headers: HeaderTypes | None = None): """ Delete a role @@ -386,10 +382,10 @@ async def update( merchant_code: str, role_id: str, *, - name: typing.Union[str, None, NotGivenType] = NOT_GIVEN, - permissions: typing.Union[typing.Sequence[str], None, NotGivenType] = NOT_GIVEN, - description: typing.Union[str, None, NotGivenType] = NOT_GIVEN, - headers: typing.Optional[HeaderTypes] = None, + name: str | None | NotGivenType = NOT_GIVEN, + permissions: typing.Sequence[str] | None | NotGivenType = NOT_GIVEN, + description: str | None | NotGivenType = NOT_GIVEN, + headers: HeaderTypes | None = None, ) -> Role: """ Update a role diff --git a/sumup/transactions/__init__.py b/sumup/transactions/__init__.py old mode 100755 new mode 100644 index 2ee3ef7f..b5197a21 --- a/sumup/transactions/__init__.py +++ b/sumup/transactions/__init__.py @@ -1,9 +1,4 @@ # Code generated by `py-sdk-gen`. DO NOT EDIT. -from .resource import ( - TransactionsResource, - AsyncTransactionsResource, - ListTransactionsV21200Response, -) from ..types import ( CardResponse, CardType, @@ -30,15 +25,17 @@ TransactionHistory, TransactionId, TransactionMixinHistory, - TransactionStatus, TransactionsHistoryLink, + TransactionStatus, +) +from .resource import ( + AsyncTransactionsResource, + ListTransactionsV21200Response, + TransactionsResource, ) - __all__ = [ - "TransactionsResource", "AsyncTransactionsResource", - "ListTransactionsV21200Response", "CardResponse", "CardType", "Currency", @@ -50,6 +47,7 @@ "HorizontalAccuracy", "Lat", "Link", + "ListTransactionsV21200Response", "Lon", "PaymentType", "Problem", @@ -66,4 +64,5 @@ "TransactionMixinHistory", "TransactionStatus", "TransactionsHistoryLink", + "TransactionsResource", ] diff --git a/sumup/transactions/resource.py b/sumup/transactions/resource.py old mode 100755 new mode 100644 index 22f68928..aeb15741 --- a/sumup/transactions/resource.py +++ b/sumup/transactions/resource.py @@ -22,16 +22,24 @@ """ from __future__ import annotations + +import datetime +import typing + +import httpx +import pydantic +import typing_extensions + +from .._exceptions import APIError from .._service import ( - Resource, + NOT_GIVEN, AsyncResource, HeaderTypes, NotGivenType, - NOT_GIVEN, + Resource, serialize_query_params, serialize_request_data, ) -from .._exceptions import APIError from ..types import ( CardResponse, CardType, @@ -39,6 +47,7 @@ Device, ElvCardAccount, EntryMode, + EntryModeInput, Error, Event, HorizontalAccuracy, @@ -46,6 +55,7 @@ Link, Lon, PaymentType, + PaymentTypeInput, Problem, Product, TransactionBase, @@ -58,15 +68,9 @@ TransactionHistory, TransactionId, TransactionMixinHistory, - TransactionStatus, TransactionsHistoryLink, + TransactionStatus, ) -from ..types import EntryModeInput, PaymentTypeInput -import datetime -import httpx -import typing -import pydantic -import typing_extensions class RefundTransactionBodyInput(typing_extensions.TypedDict, total=False): @@ -84,15 +88,13 @@ class RefundTransactionBodyInput(typing_extensions.TypedDict, total=False): ] -ListTransactionsV21ParamsOrderInput = typing.Union[typing.Literal["ascending", "descending"], str] +ListTransactionsV21ParamsOrderInput = typing.Literal["ascending", "descending"] | str -ListTransactionsV21ParamsStatuseInput = typing.Union[ - typing.Literal["CANCELLED", "CHARGE_BACK", "FAILED", "REFUNDED", "SUCCESSFUL"], str -] +ListTransactionsV21ParamsStatuseInput = ( + typing.Literal["CANCELLED", "CHARGE_BACK", "FAILED", "REFUNDED", "SUCCESSFUL"] | str +) -ListTransactionsV21ParamsTypeInput = typing.Union[ - typing.Literal["CHARGE_BACK", "PAYMENT", "REFUND"], str -] +ListTransactionsV21ParamsTypeInput = typing.Literal["CHARGE_BACK", "PAYMENT", "REFUND"] | str RefundTransaction201Response = dict[str, object] """ @@ -105,9 +107,9 @@ class ListTransactionsV21200Response(pydantic.BaseModel): ListTransactionsV21200Response is a schema definition. """ - items: typing.Optional[list[TransactionHistory]] = None + items: list[TransactionHistory] | None = None - links: typing.Optional[list[TransactionsHistoryLink]] = None + links: list[TransactionsHistoryLink] | None = None class TransactionsResource(Resource): @@ -121,8 +123,8 @@ def refund( merchant_code: str, transaction_id: str, *, - amount: typing.Union[float, None, NotGivenType] = NOT_GIVEN, - headers: typing.Optional[HeaderTypes] = None, + amount: float | None | NotGivenType = NOT_GIVEN, + headers: HeaderTypes | None = None, ) -> RefundTransaction201Response: """ Refund a transaction @@ -185,11 +187,11 @@ def get( self, merchant_code: str, *, - id: typing.Union[str, NotGivenType] = NOT_GIVEN, - transaction_code: typing.Union[str, NotGivenType] = NOT_GIVEN, - foreign_transaction_id: typing.Union[str, NotGivenType] = NOT_GIVEN, - client_transaction_id: typing.Union[str, NotGivenType] = NOT_GIVEN, - headers: typing.Optional[HeaderTypes] = None, + id: str | NotGivenType = NOT_GIVEN, + transaction_code: str | NotGivenType = NOT_GIVEN, + foreign_transaction_id: str | NotGivenType = NOT_GIVEN, + client_transaction_id: str | NotGivenType = NOT_GIVEN, + headers: HeaderTypes | None = None, ) -> TransactionFull: """ Retrieve a transaction @@ -245,24 +247,20 @@ def list( self, merchant_code: str, *, - transaction_code: typing.Union[str, NotGivenType] = NOT_GIVEN, - order: typing.Union[ListTransactionsV21ParamsOrderInput, NotGivenType] = NOT_GIVEN, - limit: typing.Union[int, NotGivenType] = NOT_GIVEN, - users: typing.Union[typing.Sequence[str], NotGivenType] = NOT_GIVEN, - statuses: typing.Union[ - typing.Sequence[ListTransactionsV21ParamsStatuseInput], NotGivenType - ] = NOT_GIVEN, - payment_types: typing.Union[typing.Sequence[PaymentTypeInput], NotGivenType] = NOT_GIVEN, - entry_modes: typing.Union[typing.Sequence[EntryModeInput], NotGivenType] = NOT_GIVEN, - types: typing.Union[ - typing.Sequence[ListTransactionsV21ParamsTypeInput], NotGivenType - ] = NOT_GIVEN, - changes_since: typing.Union[datetime.datetime, NotGivenType] = NOT_GIVEN, - newest_time: typing.Union[datetime.datetime, NotGivenType] = NOT_GIVEN, - newest_ref: typing.Union[str, NotGivenType] = NOT_GIVEN, - oldest_time: typing.Union[datetime.datetime, NotGivenType] = NOT_GIVEN, - oldest_ref: typing.Union[str, NotGivenType] = NOT_GIVEN, - headers: typing.Optional[HeaderTypes] = None, + transaction_code: str | NotGivenType = NOT_GIVEN, + order: ListTransactionsV21ParamsOrderInput | NotGivenType = NOT_GIVEN, + limit: int | NotGivenType = NOT_GIVEN, + users: typing.Sequence[str] | NotGivenType = NOT_GIVEN, + statuses: typing.Sequence[ListTransactionsV21ParamsStatuseInput] | NotGivenType = NOT_GIVEN, + payment_types: typing.Sequence[PaymentTypeInput] | NotGivenType = NOT_GIVEN, + entry_modes: typing.Sequence[EntryModeInput] | NotGivenType = NOT_GIVEN, + types: typing.Sequence[ListTransactionsV21ParamsTypeInput] | NotGivenType = NOT_GIVEN, + changes_since: datetime.datetime | NotGivenType = NOT_GIVEN, + newest_time: datetime.datetime | NotGivenType = NOT_GIVEN, + newest_ref: str | NotGivenType = NOT_GIVEN, + oldest_time: datetime.datetime | NotGivenType = NOT_GIVEN, + oldest_ref: str | NotGivenType = NOT_GIVEN, + headers: HeaderTypes | None = None, ) -> ListTransactionsV21200Response: """ List transactions @@ -336,8 +334,8 @@ async def refund( merchant_code: str, transaction_id: str, *, - amount: typing.Union[float, None, NotGivenType] = NOT_GIVEN, - headers: typing.Optional[HeaderTypes] = None, + amount: float | None | NotGivenType = NOT_GIVEN, + headers: HeaderTypes | None = None, ) -> RefundTransaction201Response: """ Refund a transaction @@ -400,11 +398,11 @@ async def get( self, merchant_code: str, *, - id: typing.Union[str, NotGivenType] = NOT_GIVEN, - transaction_code: typing.Union[str, NotGivenType] = NOT_GIVEN, - foreign_transaction_id: typing.Union[str, NotGivenType] = NOT_GIVEN, - client_transaction_id: typing.Union[str, NotGivenType] = NOT_GIVEN, - headers: typing.Optional[HeaderTypes] = None, + id: str | NotGivenType = NOT_GIVEN, + transaction_code: str | NotGivenType = NOT_GIVEN, + foreign_transaction_id: str | NotGivenType = NOT_GIVEN, + client_transaction_id: str | NotGivenType = NOT_GIVEN, + headers: HeaderTypes | None = None, ) -> TransactionFull: """ Retrieve a transaction @@ -460,24 +458,20 @@ async def list( self, merchant_code: str, *, - transaction_code: typing.Union[str, NotGivenType] = NOT_GIVEN, - order: typing.Union[ListTransactionsV21ParamsOrderInput, NotGivenType] = NOT_GIVEN, - limit: typing.Union[int, NotGivenType] = NOT_GIVEN, - users: typing.Union[typing.Sequence[str], NotGivenType] = NOT_GIVEN, - statuses: typing.Union[ - typing.Sequence[ListTransactionsV21ParamsStatuseInput], NotGivenType - ] = NOT_GIVEN, - payment_types: typing.Union[typing.Sequence[PaymentTypeInput], NotGivenType] = NOT_GIVEN, - entry_modes: typing.Union[typing.Sequence[EntryModeInput], NotGivenType] = NOT_GIVEN, - types: typing.Union[ - typing.Sequence[ListTransactionsV21ParamsTypeInput], NotGivenType - ] = NOT_GIVEN, - changes_since: typing.Union[datetime.datetime, NotGivenType] = NOT_GIVEN, - newest_time: typing.Union[datetime.datetime, NotGivenType] = NOT_GIVEN, - newest_ref: typing.Union[str, NotGivenType] = NOT_GIVEN, - oldest_time: typing.Union[datetime.datetime, NotGivenType] = NOT_GIVEN, - oldest_ref: typing.Union[str, NotGivenType] = NOT_GIVEN, - headers: typing.Optional[HeaderTypes] = None, + transaction_code: str | NotGivenType = NOT_GIVEN, + order: ListTransactionsV21ParamsOrderInput | NotGivenType = NOT_GIVEN, + limit: int | NotGivenType = NOT_GIVEN, + users: typing.Sequence[str] | NotGivenType = NOT_GIVEN, + statuses: typing.Sequence[ListTransactionsV21ParamsStatuseInput] | NotGivenType = NOT_GIVEN, + payment_types: typing.Sequence[PaymentTypeInput] | NotGivenType = NOT_GIVEN, + entry_modes: typing.Sequence[EntryModeInput] | NotGivenType = NOT_GIVEN, + types: typing.Sequence[ListTransactionsV21ParamsTypeInput] | NotGivenType = NOT_GIVEN, + changes_since: datetime.datetime | NotGivenType = NOT_GIVEN, + newest_time: datetime.datetime | NotGivenType = NOT_GIVEN, + newest_ref: str | NotGivenType = NOT_GIVEN, + oldest_time: datetime.datetime | NotGivenType = NOT_GIVEN, + oldest_ref: str | NotGivenType = NOT_GIVEN, + headers: HeaderTypes | None = None, ) -> ListTransactionsV21200Response: """ List transactions diff --git a/sumup/types/__init__.py b/sumup/types/__init__.py old mode 100755 new mode 100644 index 406ad47d..235e523e --- a/sumup/types/__init__.py +++ b/sumup/types/__init__.py @@ -1,7 +1,9 @@ # Code generated by `py-sdk-gen`. DO NOT EDIT. from __future__ import annotations + import datetime import typing + import pydantic import typing_extensions @@ -33,96 +35,96 @@ class Address(pydantic.BaseModel): Pattern: ^[A-Z]{2}$ """ - autonomous_community: typing.Optional[str] = None + autonomous_community: str | None = None """ In Spain, an autonomous community is the first sub-national level of political and administrative division. Max length: 60 """ - city: typing.Optional[str] = None + city: str | None = None """ The city of the address. Max length: 60 """ - commune: typing.Optional[str] = None + commune: str | None = None """ In many countries, terms cognate with "commune" are used, referring to the community living in the area andthe common interest. Used in countries such as Chile. Max length: 60 """ - county: typing.Optional[str] = None + county: str | None = None """ A county is a geographic region of a country used for administrative or other purposes in some nations. Usedin countries such as Ireland, Romania, etc. Max length: 60 """ - department: typing.Optional[str] = None + department: str | None = None """ A department (French: département, Spanish: departamento) is an administrative or political division inseveral countries. Used in countries such as Colombia. Max length: 60 """ - district: typing.Optional[str] = None + district: str | None = None """ A district is a type of administrative division that in some countries is managed by the local government. Usedin countries such as Portugal. Max length: 60 """ - eircode: typing.Optional[str] = None + eircode: str | None = None """ A postal address in Ireland. Max length: 10 """ - municipality: typing.Optional[str] = None + municipality: str | None = None """ A municipality is usually a single administrative division having corporate status and powers of self-government orjurisdiction as granted by national and regional laws to which it is subordinate. Used in countries such asColombia. Max length: 60 """ - neighborhood: typing.Optional[str] = None + neighborhood: str | None = None """ Locality level of the address. Used in countries such as Brazil or Chile. Max length: 60 """ - post_code: typing.Optional[str] = None + post_code: str | None = None """ The postal code (aka. zip code) of the address. Max length: 10 """ - post_town: typing.Optional[str] = None + post_town: str | None = None """ A post town is a required part of all postal addresses in the United Kingdom and Ireland, and a basic unitof the postal delivery system. Max length: 60 """ - province: typing.Optional[str] = None + province: str | None = None """ The province where the address is located. This may not be relevant in some countries. Max length: 60 """ - region: typing.Optional[str] = None + region: str | None = None """ The region where the address is located. This may not be relevant in some countries. Max length: 60 """ - state: typing.Optional[str] = None + state: str | None = None """ Most often, a country has a single state, with various administrative divisions. The term "state" is sometimesused to refer to the federated polities that make up the federation. Used in countries such as the United Statesand Brazil. Max length: 60 """ - street_address: typing.Optional[list[str]] = None + street_address: list[str] | None = None """ Max items: 2 """ - zip_code: typing.Optional[str] = None + zip_code: str | None = None """ A US system of postal codes used by the United States Postal Service (USPS). Max length: 10 @@ -134,32 +136,32 @@ class AddressLegacy(pydantic.BaseModel): Profile's personal address information. """ - city: typing.Optional[str] = None + city: str | None = None """ City name from the address. """ - country: typing.Optional[str] = None + country: str | None = None """ Two letter country code formatted according to [ISO3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2). """ - line_1: typing.Optional[str] = None + line_1: str | None = None """ First line of the address with details of the street name and number. """ - line_2: typing.Optional[str] = None + line_2: str | None = None """ Second line of the address with details of the building, unit, apartment, and floor numbers. """ - postal_code: typing.Optional[str] = None + postal_code: str | None = None """ Postal code from the address. """ - state: typing.Optional[str] = None + state: str | None = None """ State name or abbreviation from the address. """ @@ -260,15 +262,15 @@ class AmountDict(typing_extensions.TypedDict, total=False): Object attributes that are modifiable only by SumUp applications. """ -BadRequestErrorsType = typing.Union[ +BadRequestErrorsType = ( typing.Literal[ "DUPLICATE_HEADERS", "INVALID_BEARER_TOKEN", "INVALID_USER_AGENT", "NOT_ENOUGH_UNPAID_PAYOUTS", - ], - str, -] + ] + | str +) class BadRequestErrors(pydantic.BaseModel): @@ -281,7 +283,7 @@ class BadRequestErrors(pydantic.BaseModel): Key indicating type of error """ - detail: typing.Optional[str] = None + detail: str | None = None """ Fuller message giving context to error """ @@ -368,27 +370,27 @@ class BasePerson(pydantic.BaseModel): Read only """ - address: typing.Optional[Address] = None + address: Address | None = None """ An address somewhere in the world. The address fields used depend on the country conventions. For example, inGreat Britain, `city` is `post_town`. In the United States, the top-level administrative unit used in addressesis `state`, whereas in Chile it's `region`. Whether an address is valid or not depends on whether the locally required fields are present. Fields not supported ina country will be ignored. Address documentation: https://developer.sumup.com/tools/glossary/address """ - birthdate: typing.Optional[datetime.date] = None + birthdate: datetime.date | None = None """ The date of birth of the individual, represented as an ISO 8601:2004 [ISO8601‑2004] YYYY-MM-DD format. Format: date """ - change_status: typing.Optional[ChangeStatus] = None + change_status: ChangeStatus | None = None """ Reflects the status of changes submitted through the `PATCH` endpoints for the Merchant or Persons. If somechanges have not been applied yet, the status will be `pending`. If all changes have been applied, the status`done`. The status is only returned after write operations or on read endpoints when the `version` query parameter isprovided. Read only """ - citizenship: typing.Optional[CountryCode] = None + citizenship: CountryCode | None = None """ An [ISO3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) country code. This definition users `oneOf` with a two-character string @@ -398,63 +400,63 @@ class BasePerson(pydantic.BaseModel): Pattern: ^[A-Z]{2}$ """ - country_of_residence: typing.Optional[str] = None + country_of_residence: str | None = None """ An [ISO3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) country code representing the countrywhere the Person resides. Min length: 2 Max length: 2 """ - family_name: typing.Optional[str] = None + family_name: str | None = None """ The last name(s) of the individual. Max length: 60 """ - given_name: typing.Optional[str] = None + given_name: str | None = None """ The first name(s) of the individual. Max length: 60 """ - identifiers: typing.Optional[PersonalIdentifiers] = None + identifiers: PersonalIdentifiers | None = None """ A list of country-specific personal identifiers. Max items: 32 """ - middle_name: typing.Optional[str] = None + middle_name: str | None = None """ Middle name(s) of the End-User. Note that in some cultures, people can have multiple middle names; all canbe present, with the names being separated by space characters. Also note that in some cultures, middle namesare not used. Max length: 60 """ - nationality: typing.Optional[str] = None + nationality: str | None = None """ The Person's nationality. May be an [ISO3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) countrycode, but legacy data may not conform to this standard. """ - ownership: typing.Optional[Ownership] = None + ownership: Ownership | None = None - phone_number: typing.Optional[PhoneNumber] = None + phone_number: PhoneNumber | None = None """ A publicly available phone number in [E.164](https://en.wikipedia.org/wiki/E.164) format. Max length: 16 """ - relationships: typing.Optional[list[str]] = None + relationships: list[str] | None = None """ A list of roles the Person has in the Merchant or towards SumUp. A Merchant must have at least one Person withthe relationship `representative`. Min items: 1 Max items: 1 """ - user_id: typing.Optional[str] = None + user_id: str | None = None """ A corresponding identity user ID for the Person, if they have a user account. """ - version: typing.Optional[Version] = None + version: Version | None = None """ The version of the resource. The version reflects a specific change submitted to the API via one of the `PATCH`endpoints. """ @@ -465,52 +467,52 @@ class Branding(pydantic.BaseModel): Settings used to apply the Merchant's branding to email receipts, invoices, checkouts, and other products. """ - background_color: typing.Optional[str] = None + background_color: str | None = None """ A hex color value representing the preferred background color of this merchant. """ - footer_text: typing.Optional[str] = None + footer_text: str | None = None """ Footer text rendered on receipts and other customer-facing products. Min length: 1 Max length: 500 """ - hero: typing.Optional[str] = None + hero: str | None = None """ Data-URL encoded hero image for the merchant business. Format: uri """ - icon: typing.Optional[str] = None + icon: str | None = None """ An icon for the merchant. Must be square. Format: uri """ - logo: typing.Optional[str] = None + logo: str | None = None """ A logo for the merchant that will be used in place of the icon and without the merchant's name next to itif there's sufficient space. Format: uri """ - primary_color: typing.Optional[str] = None + primary_color: str | None = None """ A hex color value representing the primary branding color of this merchant (your brand color). """ - primary_color_fg: typing.Optional[str] = None + primary_color_fg: str | None = None """ A hex color value representing the color of the text displayed on branding color of this merchant. """ - secondary_color: typing.Optional[str] = None + secondary_color: str | None = None """ A hex color value representing the secondary branding color of this merchant (accent color used for buttons). """ - secondary_color_fg: typing.Optional[str] = None + secondary_color_fg: str | None = None """ A hex color value representing the color of the text displayed on secondary branding color of this merchant. """ @@ -521,19 +523,19 @@ class BusinessProfile(pydantic.BaseModel): Business information about the merchant. This information will be visible to the merchant's customers. """ - address: typing.Optional[Address] = None + address: Address | None = None """ An address somewhere in the world. The address fields used depend on the country conventions. For example, inGreat Britain, `city` is `post_town`. In the United States, the top-level administrative unit used in addressesis `state`, whereas in Chile it's `region`. Whether an address is valid or not depends on whether the locally required fields are present. Fields not supported ina country will be ignored. Address documentation: https://developer.sumup.com/tools/glossary/address """ - branding: typing.Optional[Branding] = None + branding: Branding | None = None """ Settings used to apply the Merchant's branding to email receipts, invoices, checkouts, and other products. """ - dynamic_descriptor: typing.Optional[str] = None + dynamic_descriptor: str | None = None """ The descriptor is the text that your customer sees on their bank account statement. The more recognisable your descriptor is, the less risk you have of receiving disputes (e.g. chargebacks). @@ -542,33 +544,33 @@ class BusinessProfile(pydantic.BaseModel): Pattern: ^[a-zA-Z0-9 \\-+\\'_.]{0,30}$ """ - email: typing.Optional[str] = None + email: str | None = None """ A publicly available email address. Max length: 255 """ - name: typing.Optional[str] = None + name: str | None = None """ The customer-facing business name. Min length: 1 Max length: 150 """ - phone_number: typing.Optional[PhoneNumber] = None + phone_number: PhoneNumber | None = None """ A publicly available phone number in [E.164](https://en.wikipedia.org/wiki/E.164) format. Max length: 16 """ - website: typing.Optional[str] = None + website: str | None = None """ The business's publicly available website. Max length: 255 """ -CardType = typing.Union[ +CardType = ( typing.Literal[ "ALELO", "AMEX", @@ -594,14 +596,14 @@ class BusinessProfile(pydantic.BaseModel): "VISA_VPAY", "VPAY", "VR", - ], - str, -] + ] + | str +) CardTypeInput = CardType -CardExpiryMonth = typing.Union[ - typing.Literal["01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12"], str -] +CardExpiryMonth = ( + typing.Literal["01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12"] | str +) CardExpiryMonthInput = CardExpiryMonth @@ -649,7 +651,7 @@ class Card(pydantic.BaseModel): Issuing card network of the payment card used for the transaction. """ - zip_code: typing.Optional[str] = None + zip_code: str | None = None """ Required five-digit ZIP code. Applicable only to merchant users in the USA. Write only @@ -722,7 +724,7 @@ class CardResponse(pydantic.BaseModel): Details of the payment card. """ - last_4_digits: typing.Optional[str] = None + last_4_digits: str | None = None """ Last 4 digits of the payment card number. Read only @@ -730,13 +732,13 @@ class CardResponse(pydantic.BaseModel): Max length: 4 """ - type: typing.Optional[CardType] = None + type: CardType | None = None """ Issuing card network of the payment card used for the transaction. """ -Currency = typing.Union[ +Currency = ( typing.Literal[ "BGN", "BRL", @@ -754,12 +756,12 @@ class CardResponse(pydantic.BaseModel): "RON", "SEK", "USD", - ], - str, -] + ] + | str +) CurrencyInput = Currency -EntryMode = typing.Union[ +EntryMode = ( typing.Literal[ "APPLE_PAY", "BANCONTACT", @@ -788,12 +790,12 @@ class CardResponse(pydantic.BaseModel): "SATISPAY", "SOFORT", "TWINT", - ], - str, -] + ] + | str +) EntryModeInput = EntryMode -MandateResponseStatus = typing.Union[typing.Literal["active", "inactive"], str] +MandateResponseStatus = typing.Literal["active", "inactive"] | str class MandateResponse(pydantic.BaseModel): @@ -801,23 +803,23 @@ class MandateResponse(pydantic.BaseModel): Details of the mandate linked to the saved payment instrument. """ - merchant_code: typing.Optional[str] = None + merchant_code: str | None = None """ Merchant account for which the mandate is valid. """ - status: typing.Optional[MandateResponseStatus] = None + status: MandateResponseStatus | None = None """ Current lifecycle status of the mandate. """ - type: typing.Optional[str] = None + type: str | None = None """ Type of mandate stored for the checkout or payment instrument. """ -PaymentType = typing.Union[ +PaymentType = ( typing.Literal[ "APM", "BALANCE", @@ -830,14 +832,12 @@ class MandateResponse(pydantic.BaseModel): "POS", "RECURRING", "UNKNOWN", - ], - str, -] + ] + | str +) PaymentTypeInput = PaymentType -TransactionStatus = typing.Union[ - typing.Literal["CANCELLED", "FAILED", "PENDING", "REFUNDED", "SUCCESSFUL"], str -] +TransactionStatus = typing.Literal["CANCELLED", "FAILED", "PENDING", "REFUNDED", "SUCCESSFUL"] | str class TransactionBase(pydantic.BaseModel): @@ -845,33 +845,33 @@ class TransactionBase(pydantic.BaseModel): Details of the transaction. """ - amount: typing.Optional[float] = None + amount: float | None = None """ Total amount of the transaction. """ - currency: typing.Optional[Currency] = None + currency: Currency | None = None """ Three-letter [ISO4217](https://en.wikipedia.org/wiki/ISO_4217) code of the currency for the amount. Currently supportedcurrency values are enumerated above. """ - id: typing.Optional[str] = None + id: str | None = None """ Unique ID of the transaction. """ - installments_count: typing.Optional[int] = None + installments_count: int | None = None """ Current number of the installment for deferred payments. Min: 1 """ - payment_type: typing.Optional[PaymentType] = None + payment_type: PaymentType | None = None """ Payment type used for the transaction. """ - status: typing.Optional[TransactionStatus] = None + status: TransactionStatus | None = None """ Current status of the transaction. @@ -882,12 +882,12 @@ class TransactionBase(pydantic.BaseModel): - `REFUNDED`: The transaction was refunded in full or in part. """ - timestamp: typing.Optional[datetime.datetime] = None + timestamp: datetime.datetime | None = None """ Date and time of the creation of the transaction. Response format expressed according to [ISO8601](https://en.wikipedia.org/wiki/ISO_8601) code. """ - transaction_code: typing.Optional[str] = None + transaction_code: str | None = None """ Transaction code returned by the acquirer/processing entity after processing the transaction. """ @@ -898,33 +898,33 @@ class TransactionCheckoutInfo(pydantic.BaseModel): Checkout-specific fields associated with a transaction. """ - auth_code: typing.Optional[str] = None + auth_code: str | None = None """ Authorization code for the transaction sent by the payment card issuer or bank. Applicable only to card payments. """ - entry_mode: typing.Optional[EntryMode] = None + entry_mode: EntryMode | None = None """ Entry mode of the payment details. """ - merchant_code: typing.Optional[str] = None + merchant_code: str | None = None """ Unique code of the registered merchant to whom the payment is made. """ - tip_amount: typing.Optional[float] = None + tip_amount: float | None = None """ Amount of the tip (out of the total transaction amount). """ - vat_amount: typing.Optional[float] = None + vat_amount: float | None = None """ Amount of the applicable VAT (out of the total transaction amount). """ -CheckoutStatus = typing.Union[typing.Literal["EXPIRED", "FAILED", "PAID", "PENDING"], str] +CheckoutStatus = typing.Literal["EXPIRED", "FAILED", "PAID", "PENDING"] | str class CheckoutTransaction(pydantic.BaseModel): @@ -932,48 +932,48 @@ class CheckoutTransaction(pydantic.BaseModel): CheckoutTransaction is a schema definition. """ - amount: typing.Optional[float] = None + amount: float | None = None """ Total amount of the transaction. """ - auth_code: typing.Optional[str] = None + auth_code: str | None = None """ Authorization code for the transaction sent by the payment card issuer or bank. Applicable only to card payments. """ - currency: typing.Optional[Currency] = None + currency: Currency | None = None """ Three-letter [ISO4217](https://en.wikipedia.org/wiki/ISO_4217) code of the currency for the amount. Currently supportedcurrency values are enumerated above. """ - entry_mode: typing.Optional[EntryMode] = None + entry_mode: EntryMode | None = None """ Entry mode of the payment details. """ - id: typing.Optional[str] = None + id: str | None = None """ Unique ID of the transaction. """ - installments_count: typing.Optional[int] = None + installments_count: int | None = None """ Current number of the installment for deferred payments. Min: 1 """ - merchant_code: typing.Optional[str] = None + merchant_code: str | None = None """ Unique code of the registered merchant to whom the payment is made. """ - payment_type: typing.Optional[PaymentType] = None + payment_type: PaymentType | None = None """ Payment type used for the transaction. """ - status: typing.Optional[TransactionStatus] = None + status: TransactionStatus | None = None """ Current status of the transaction. @@ -984,22 +984,22 @@ class CheckoutTransaction(pydantic.BaseModel): - `REFUNDED`: The transaction was refunded in full or in part. """ - timestamp: typing.Optional[datetime.datetime] = None + timestamp: datetime.datetime | None = None """ Date and time of the creation of the transaction. Response format expressed according to [ISO8601](https://en.wikipedia.org/wiki/ISO_8601) code. """ - tip_amount: typing.Optional[float] = None + tip_amount: float | None = None """ Amount of the tip (out of the total transaction amount). """ - transaction_code: typing.Optional[str] = None + transaction_code: str | None = None """ Transaction code returned by the acquirer/processing entity after processing the transaction. """ - vat_amount: typing.Optional[float] = None + vat_amount: float | None = None """ Amount of the applicable VAT (out of the total transaction amount). """ @@ -1010,84 +1010,84 @@ class Checkout(pydantic.BaseModel): Core checkout resource returned by the Checkouts API. A checkout is created before payment processing andthen updated as payment attempts, redirects, and resulting transactions are attached to it. """ - amount: typing.Optional[float] = None + amount: float | None = None """ Amount to be charged to the payer, expressed in major units. """ - checkout_reference: typing.Optional[str] = None + checkout_reference: str | None = None """ Merchant-defined reference for the checkout. Use it to correlate the SumUp checkout with your own order, cart,subscription, or payment attempt in your systems. Max length: 90 """ - currency: typing.Optional[Currency] = None + currency: Currency | None = None """ Three-letter [ISO4217](https://en.wikipedia.org/wiki/ISO_4217) code of the currency for the amount. Currently supportedcurrency values are enumerated above. """ - customer_id: typing.Optional[str] = None + customer_id: str | None = None """ Merchant-scoped identifier of the customer associated with the checkout. Use it when storing payment instrumentsor reusing saved customer context for recurring and returning-payer flows. """ - date: typing.Optional[datetime.datetime] = None + date: datetime.datetime | None = None """ Date and time of the creation of the payment checkout. Response format expressed according to [ISO8601](https://en.wikipedia.org/wiki/ISO_8601) code. """ - description: typing.Optional[str] = None + description: str | None = None """ Short merchant-defined description shown in SumUp tools and reporting. Use it to make the checkout easier torecognize in dashboards, support workflows, and reconciliation. """ - hosted_checkout_url: typing.Optional[str] = None + hosted_checkout_url: str | None = None """ URL of the SumUp-hosted payment page that handles the payment flow. Returned when Hosted Checkout is enabledfor the checkout. Read only Format: uri """ - id: typing.Optional[str] = None + id: str | None = None """ Unique SumUp identifier of the checkout resource. Read only """ - mandate: typing.Optional[MandateResponse] = None + mandate: MandateResponse | None = None """ Details of the mandate linked to the saved payment instrument. """ - merchant_code: typing.Optional[str] = None + merchant_code: str | None = None """ Merchant account that receives the payment. """ - return_url: typing.Optional[str] = None + return_url: str | None = None """ Optional backend callback URL used by SumUp to notify your platform about processing updates for the checkout. Format:uri """ - status: typing.Optional[CheckoutStatus] = None + status: CheckoutStatus | None = None """ Current high-level state of the checkout. `PENDING` means the checkout exists but is not yet completed, `PAID`means a payment succeeded, `FAILED` means the latest processing attempt failed, and `EXPIRED` means the checkoutcan no longer be processed. """ - transactions: typing.Optional[list[CheckoutTransaction]] = None + transactions: list[CheckoutTransaction] | None = None """ Payment attempts and resulting transaction records linked to this checkout. Use the Transactions endpoints whenyou need the authoritative payment result and event history. Unique items only """ - valid_until: typing.Optional[datetime.datetime] = None + valid_until: datetime.datetime | None = None """ Optional expiration timestamp. The checkout must be processed before this moment, otherwise it becomes unusable.If omitted, the checkout does not have an explicit expiry time. """ -CheckoutAcceptedNextStepMechanism = typing.Union[typing.Literal["browser", "iframe"], str] +CheckoutAcceptedNextStepMechanism = typing.Literal["browser", "iframe"] | str CheckoutAcceptedNextStepPayload = dict[str, str] """ @@ -1100,27 +1100,27 @@ class CheckoutAcceptedNextStep(pydantic.BaseModel): Instructions for the next action the payer or client must take. """ - mechanism: typing.Optional[list[CheckoutAcceptedNextStepMechanism]] = None + mechanism: list[CheckoutAcceptedNextStepMechanism] | None = None """ Allowed presentation mechanisms for the next step. `iframe` means the flow can be embedded, while `browser` meansit can be completed through a full-page redirect. """ - method: typing.Optional[str] = None + method: str | None = None """ HTTP method to use when following the next step. """ - payload: typing.Optional[CheckoutAcceptedNextStepPayload] = None + payload: CheckoutAcceptedNextStepPayload | None = None """ Parameters required to complete the next step. The exact keys depend on the payment provider and flow type. """ - redirect_url: typing.Optional[str] = None + redirect_url: str | None = None """ Merchant URL where the payer returns after the external flow finishes. """ - url: typing.Optional[str] = None + url: str | None = None """ URL to open or submit in order to continue processing. """ @@ -1131,7 +1131,7 @@ class CheckoutAccepted(pydantic.BaseModel): Response returned when checkout processing requires an additional payer action, such as a 3DS challenge ora redirect to an external payment method page. """ - next_step: typing.Optional[CheckoutAcceptedNextStep] = None + next_step: CheckoutAcceptedNextStep | None = None """ Instructions for the next action the payer or client must take. """ @@ -1162,9 +1162,7 @@ class HostedCheckoutDict(typing_extensions.TypedDict, total=False): HostedCheckoutInput = HostedCheckoutDict -CheckoutCreateRequestPurpose = typing.Union[ - typing.Literal["CHECKOUT", "SETUP_RECURRING_PAYMENT"], str -] +CheckoutCreateRequestPurpose = typing.Literal["CHECKOUT", "SETUP_RECURRING_PAYMENT"] | str CheckoutCreateRequestPurposeInput = CheckoutCreateRequestPurpose @@ -1194,39 +1192,39 @@ class CheckoutCreateRequest(pydantic.BaseModel): Merchant account that should receive the payment. """ - customer_id: typing.Optional[str] = None + customer_id: str | None = None """ Merchant-scoped customer identifier. Required when setting up recurring payments and useful when the checkoutshould be linked to a returning payer. """ - description: typing.Optional[str] = None + description: str | None = None """ Short merchant-defined description shown in SumUp tools and reporting for easier identification of the checkout. """ - hosted_checkout: typing.Optional[HostedCheckout] = None + hosted_checkout: HostedCheckout | None = None """ Hosted Checkout configuration. Enable it to receive a SumUp-hosted payment page URL in the checkout response. """ - purpose: typing.Optional[CheckoutCreateRequestPurpose] = None + purpose: CheckoutCreateRequestPurpose | None = None """ Business purpose of the checkout. Use `CHECKOUT` for a standard payment and `SETUP_RECURRING_PAYMENT` whencollecting consent and payment details for future recurring charges. Default: "CHECKOUT" """ - redirect_url: typing.Optional[str] = None + redirect_url: str | None = None """ URL where the payer should be sent after a redirect-based payment or SCA flow completes. This is required for[APMs](https://developer.sumup.com/online-payments/apm/introduction) and recommended for card checkouts thatmay require [3DS](https://developer.sumup.com/online-payments/features/3ds). If it is omitted, the [Payment Widget](https://developer.sumup.com/online-payments/checkouts)can render the challenge in an iframe instead of using a full-page redirect. """ - return_url: typing.Optional[str] = None + return_url: str | None = None """ Optional backend callback URL used by SumUp to notify your platform about processing updates for the checkout. Format:uri """ - valid_until: typing.Optional[datetime.datetime] = None + valid_until: datetime.datetime | None = None """ Optional expiration timestamp. The checkout must be processed before this moment, otherwise it becomes unusable.If omitted, the checkout does not have an explicit expiry time. """ @@ -1321,7 +1319,7 @@ class CheckoutCreateRequestDict(typing_extensions.TypedDict, total=False): CheckoutCreateRequestInput = CheckoutCreateRequestDict -CheckoutSuccessStatus = typing.Union[typing.Literal["EXPIRED", "FAILED", "PAID", "PENDING"], str] +CheckoutSuccessStatus = typing.Literal["EXPIRED", "FAILED", "PAID", "PENDING"] | str class CheckoutSuccessTransaction(pydantic.BaseModel): @@ -1329,48 +1327,48 @@ class CheckoutSuccessTransaction(pydantic.BaseModel): CheckoutSuccessTransaction is a schema definition. """ - amount: typing.Optional[float] = None + amount: float | None = None """ Total amount of the transaction. """ - auth_code: typing.Optional[str] = None + auth_code: str | None = None """ Authorization code for the transaction sent by the payment card issuer or bank. Applicable only to card payments. """ - currency: typing.Optional[Currency] = None + currency: Currency | None = None """ Three-letter [ISO4217](https://en.wikipedia.org/wiki/ISO_4217) code of the currency for the amount. Currently supportedcurrency values are enumerated above. """ - entry_mode: typing.Optional[EntryMode] = None + entry_mode: EntryMode | None = None """ Entry mode of the payment details. """ - id: typing.Optional[str] = None + id: str | None = None """ Unique ID of the transaction. """ - installments_count: typing.Optional[int] = None + installments_count: int | None = None """ Current number of the installment for deferred payments. Min: 1 """ - merchant_code: typing.Optional[str] = None + merchant_code: str | None = None """ Unique code of the registered merchant to whom the payment is made. """ - payment_type: typing.Optional[PaymentType] = None + payment_type: PaymentType | None = None """ Payment type used for the transaction. """ - status: typing.Optional[TransactionStatus] = None + status: TransactionStatus | None = None """ Current status of the transaction. @@ -1381,22 +1379,22 @@ class CheckoutSuccessTransaction(pydantic.BaseModel): - `REFUNDED`: The transaction was refunded in full or in part. """ - timestamp: typing.Optional[datetime.datetime] = None + timestamp: datetime.datetime | None = None """ Date and time of the creation of the transaction. Response format expressed according to [ISO8601](https://en.wikipedia.org/wiki/ISO_8601) code. """ - tip_amount: typing.Optional[float] = None + tip_amount: float | None = None """ Amount of the tip (out of the total transaction amount). """ - transaction_code: typing.Optional[str] = None + transaction_code: str | None = None """ Transaction code returned by the acquirer/processing entity after processing the transaction. """ - vat_amount: typing.Optional[float] = None + vat_amount: float | None = None """ Amount of the applicable VAT (out of the total transaction amount). """ @@ -1407,7 +1405,7 @@ class CheckoutSuccessPaymentInstrument(pydantic.BaseModel): Details of the saved payment instrument created or reused during checkout processing. """ - token: typing.Optional[str] = None + token: str | None = None """ Token value """ @@ -1418,105 +1416,105 @@ class CheckoutSuccess(pydantic.BaseModel): Checkout resource returned after a synchronous processing attempt. In addition to the base checkout fields, itcan include the resulting transaction identifiers and any newly created payment instrument token. """ - amount: typing.Optional[float] = None + amount: float | None = None """ Amount to be charged to the payer, expressed in major units. """ - checkout_reference: typing.Optional[str] = None + checkout_reference: str | None = None """ Merchant-defined reference for the checkout. Use it to correlate the SumUp checkout with your own order, cart,subscription, or payment attempt in your systems. Max length: 90 """ - currency: typing.Optional[Currency] = None + currency: Currency | None = None """ Three-letter [ISO4217](https://en.wikipedia.org/wiki/ISO_4217) code of the currency for the amount. Currently supportedcurrency values are enumerated above. """ - customer_id: typing.Optional[str] = None + customer_id: str | None = None """ Merchant-scoped identifier of the customer associated with the checkout. Use it when storing payment instrumentsor reusing saved customer context for recurring and returning-payer flows. """ - date: typing.Optional[datetime.datetime] = None + date: datetime.datetime | None = None """ Date and time of the creation of the payment checkout. Response format expressed according to [ISO8601](https://en.wikipedia.org/wiki/ISO_8601) code. """ - description: typing.Optional[str] = None + description: str | None = None """ Short merchant-defined description shown in SumUp tools and reporting. Use it to make the checkout easier torecognize in dashboards, support workflows, and reconciliation. """ - hosted_checkout_url: typing.Optional[str] = None + hosted_checkout_url: str | None = None """ URL of the SumUp-hosted payment page that handles the payment flow. Returned when Hosted Checkout is enabledfor the checkout. Read only Format: uri """ - id: typing.Optional[str] = None + id: str | None = None """ Unique SumUp identifier of the checkout resource. Read only """ - mandate: typing.Optional[MandateResponse] = None + mandate: MandateResponse | None = None """ Details of the mandate linked to the saved payment instrument. """ - merchant_code: typing.Optional[str] = None + merchant_code: str | None = None """ Merchant account that receives the payment. """ - merchant_name: typing.Optional[str] = None + merchant_name: str | None = None """ Name of the merchant """ - payment_instrument: typing.Optional[CheckoutSuccessPaymentInstrument] = None + payment_instrument: CheckoutSuccessPaymentInstrument | None = None """ Details of the saved payment instrument created or reused during checkout processing. """ - redirect_url: typing.Optional[str] = None + redirect_url: str | None = None """ URL where the payer is redirected after a redirect-based payment or SCA flow completes. """ - return_url: typing.Optional[str] = None + return_url: str | None = None """ Optional backend callback URL used by SumUp to notify your platform about processing updates for the checkout. Format:uri """ - status: typing.Optional[CheckoutSuccessStatus] = None + status: CheckoutSuccessStatus | None = None """ Current high-level state of the checkout. `PENDING` means the checkout exists but is not yet completed, `PAID`means a payment succeeded, `FAILED` means the latest processing attempt failed, and `EXPIRED` means the checkoutcan no longer be processed. """ - transaction_code: typing.Optional[str] = None + transaction_code: str | None = None """ Transaction code of the successful transaction with which the payment for the checkout is completed. Read only """ - transaction_id: typing.Optional[str] = None + transaction_id: str | None = None """ Transaction ID of the successful transaction with which the payment for the checkout is completed. Read only """ - transactions: typing.Optional[list[CheckoutSuccessTransaction]] = None + transactions: list[CheckoutSuccessTransaction] | None = None """ Payment attempts and resulting transaction records linked to this checkout. Use the Transactions endpoints whenyou need the authoritative payment result and event history. Unique items only """ - valid_until: typing.Optional[datetime.datetime] = None + valid_until: datetime.datetime | None = None """ Optional expiration timestamp. The checkout must be processed before this moment, otherwise it becomes unusable.If omitted, the checkout does not have an explicit expiry time. """ @@ -1527,33 +1525,33 @@ class CheckoutUpdateRequest(pydantic.BaseModel): Request body for updating an existing checkout. Include only the fields that should be changed. """ - amount: typing.Optional[float] = None + amount: float | None = None """ Updated amount to be charged to the payer, expressed in major units. """ - checkout_reference: typing.Optional[str] = None + checkout_reference: str | None = None """ Updated merchant-defined reference for the checkout. Max length: 90 """ - currency: typing.Optional[Currency] = None + currency: Currency | None = None """ Three-letter [ISO4217](https://en.wikipedia.org/wiki/ISO_4217) code of the currency for the amount. Currently supportedcurrency values are enumerated above. """ - customer_id: typing.Optional[str] = None + customer_id: str | None = None """ Updated merchant-scoped customer identifier associated with the checkout. """ - description: typing.Optional[str] = None + description: str | None = None """ Updated short merchant-defined description shown in SumUp tools and reporting. """ - valid_until: typing.Optional[datetime.datetime] = None + valid_until: datetime.datetime | None = None """ Updated expiration timestamp. The checkout must be processed before this moment, otherwise it becomes unusable. """ @@ -1666,24 +1664,24 @@ class Company(pydantic.BaseModel): Company documentation: https://developer.sumup.com/tools/glossary/merchant#company """ - address: typing.Optional[Address] = None + address: Address | None = None """ An address somewhere in the world. The address fields used depend on the country conventions. For example, inGreat Britain, `city` is `post_town`. In the United States, the top-level administrative unit used in addressesis `state`, whereas in Chile it's `region`. Whether an address is valid or not depends on whether the locally required fields are present. Fields not supported ina country will be ignored. Address documentation: https://developer.sumup.com/tools/glossary/address """ - attributes: typing.Optional[Attributes] = None + attributes: Attributes | None = None """ Object attributes that are modifiable only by SumUp applications. """ - identifiers: typing.Optional[CompanyIdentifiers] = None + identifiers: CompanyIdentifiers | None = None """ A list of country-specific company identifiers. """ - legal_type: typing.Optional[LegalType] = None + legal_type: LegalType | None = None """ The unique legal type reference as defined in the country SDK. We do not rely on IDs as used by other services.Consumers of this API are expected to use the country SDK to map to any other IDs, translation keys, ordescriptions. Min length: 4 @@ -1691,33 +1689,33 @@ class Company(pydantic.BaseModel): The country SDK documentation for legal types.: https://developer.sumup.com/tools/glossary/merchant#legal-types """ - merchant_category_code: typing.Optional[str] = None + merchant_category_code: str | None = None """ The merchant category code for the account as specified by [ISO18245](https://www.iso.org/standard/33365.html). MCCsare used to classify businesses based on the goods or services they provide. Pattern: ^[0-9]{4}$ """ - name: typing.Optional[str] = None + name: str | None = None """ The company's legal name. Min length: 1 Max length: 150 """ - phone_number: typing.Optional[PhoneNumber] = None + phone_number: PhoneNumber | None = None """ A publicly available phone number in [E.164](https://en.wikipedia.org/wiki/E.164) format. Max length: 16 """ - trading_address: typing.Optional[Address] = None + trading_address: Address | None = None """ An address somewhere in the world. The address fields used depend on the country conventions. For example, inGreat Britain, `city` is `post_town`. In the United States, the top-level administrative unit used in addressesis `state`, whereas in Chile it's `region`. Whether an address is valid or not depends on whether the locally required fields are present. Fields not supported ina country will be ignored. Address documentation: https://developer.sumup.com/tools/glossary/address """ - website: typing.Optional[str] = None + website: str | None = None """ HTTP(S) URL of the company's website. Max length: 255 @@ -1734,7 +1732,7 @@ class CreateReaderCheckoutErrorErrors(pydantic.BaseModel): Error code """ - detail: typing.Optional[str] = None + detail: str | None = None """ Error message """ @@ -1824,7 +1822,7 @@ class CreateReaderCheckoutRequestAffiliate(pydantic.BaseModel): It is a unique identifier for the key and should be generated by the integrator in the [Affiliate Keys](https://developer.sumup.com/affiliate-keys) page. """ - tags: typing.Optional[CreateReaderCheckoutRequestAffiliateTags] = None + tags: CreateReaderCheckoutRequestAffiliateTags | None = None """ Additional metadata for the transaction. It is key-value object that can be associated with the transaction. @@ -1869,7 +1867,7 @@ class CreateReaderCheckoutRequestAffiliateDict(typing_extensions.TypedDict, tota CreateReaderCheckoutRequestAffiliateInput = CreateReaderCheckoutRequestAffiliateDict -CreateReaderCheckoutRequestCardType = typing.Union[typing.Literal["credit", "debit"], str] +CreateReaderCheckoutRequestCardType = typing.Literal["credit", "debit"] | str CreateReaderCheckoutRequestCardTypeInput = CreateReaderCheckoutRequestCardType @@ -1937,30 +1935,30 @@ class CreateReaderCheckoutRequest(pydantic.BaseModel): For example, EUR 1.00 is represented as value 100 with minor unit of 2. """ - aade: typing.Optional[CreateReaderCheckoutRequestAade] = None + aade: CreateReaderCheckoutRequestAade | None = None """ Optional object containing data for transactions from ERP integrators in Greece that comply with the AADE1155 protocol. When such regulatory/business requirements apply, this object must be provided and contains the data needed tovalidate the transaction with the AADE signature provider. """ - affiliate: typing.Optional[CreateReaderCheckoutRequestAffiliate] = None + affiliate: CreateReaderCheckoutRequestAffiliate | None = None """ Affiliate metadata for the transaction. It is a field that allow for integrators to track the source of the transaction. """ - card_type: typing.Optional[CreateReaderCheckoutRequestCardType] = None + card_type: CreateReaderCheckoutRequestCardType | None = None """ The card type of the card used for the transaction. Is is required only for some countries (e.g: Brazil). """ - description: typing.Optional[str] = None + description: str | None = None """ Description of the checkout to be shown in the Merchant Sales """ - installments: typing.Optional[int] = None + installments: int | None = None """ Number of installments for the transaction. It may vary according to the merchant country. @@ -1971,21 +1969,21 @@ class CreateReaderCheckoutRequest(pydantic.BaseModel): Min: 1 """ - return_url: typing.Optional[str] = None + return_url: str | None = None """ Webhook URL to which the payment result will be sent. It must be a HTTPS url. Format: uri """ - tip_rates: typing.Optional[list[float]] = None + tip_rates: list[float] | None = None """ List of tipping rates to be displayed to the cardholder. The rates are in percentage and should be between 0.01 and 0.99. The list should be sorted in ascending order. """ - tip_timeout: typing.Optional[int] = None + tip_timeout: int | None = None """ Time in seconds the cardholder has to select a tip rate. If not provided, the default value is 30 seconds. @@ -2088,7 +2086,7 @@ class CreateReaderCheckoutResponseData(pydantic.BaseModel): It can be used later to fetch the transaction details via the [Transactions API](https://developer.sumup.com/api/transactions/get). """ - checkout_id: typing.Optional[str] = None + checkout_id: str | None = None """ The checkout ID is a unique identifier for the checkout. """ @@ -2126,7 +2124,7 @@ class CreateReaderTerminateErrorErrors(pydantic.BaseModel): Error code """ - detail: typing.Optional[str] = None + detail: str | None = None """ Error message """ @@ -2159,38 +2157,38 @@ class PersonalDetails(pydantic.BaseModel): Personal details for the customer. """ - address: typing.Optional[AddressLegacy] = None + address: AddressLegacy | None = None """ Profile's personal address information. """ - birth_date: typing.Optional[datetime.date] = None + birth_date: datetime.date | None = None """ Date of birth of the customer. Format: date """ - email: typing.Optional[str] = None + email: str | None = None """ Email address of the customer. """ - first_name: typing.Optional[str] = None + first_name: str | None = None """ First name of the customer. """ - last_name: typing.Optional[str] = None + last_name: str | None = None """ Last name of the customer. """ - phone: typing.Optional[str] = None + phone: str | None = None """ Phone number of the customer. """ - tax_id: typing.Optional[str] = None + tax_id: str | None = None """ An identification number user for tax purposes (e.g. CPF) Max length: 255 @@ -2243,7 +2241,7 @@ class Customer(pydantic.BaseModel): Unique ID of the customer. """ - personal_details: typing.Optional[PersonalDetails] = None + personal_details: PersonalDetails | None = None """ Personal details for the customer. """ @@ -2268,9 +2266,9 @@ class DetailsErrorFailedConstraint(pydantic.BaseModel): DetailsErrorFailedConstraint is a schema definition. """ - message: typing.Optional[str] = None + message: str | None = None - reference: typing.Optional[str] = None + reference: str | None = None class DetailsError(pydantic.BaseModel): @@ -2278,22 +2276,22 @@ class DetailsError(pydantic.BaseModel): Error message structure. """ - details: typing.Optional[str] = None + details: str | None = None """ Details of the error. """ - failed_constraints: typing.Optional[list[DetailsErrorFailedConstraint]] = None + failed_constraints: list[DetailsErrorFailedConstraint] | None = None """ List of violated validation constraints. """ - status: typing.Optional[float] = None + status: float | None = None """ The status code. """ - title: typing.Optional[str] = None + title: str | None = None """ Short title of the error. """ @@ -2304,27 +2302,27 @@ class Device(pydantic.BaseModel): Details of the device used to create the transaction. """ - model: typing.Optional[str] = None + model: str | None = None """ Device model. """ - name: typing.Optional[str] = None + name: str | None = None """ Device name. """ - system_name: typing.Optional[str] = None + system_name: str | None = None """ Device OS. """ - system_version: typing.Optional[str] = None + system_version: str | None = None """ Device OS version. """ - uuid: typing.Optional[str] = None + uuid: str | None = None """ Device UUID. """ @@ -2335,22 +2333,22 @@ class ElvCardAccount(pydantic.BaseModel): Details of the ELV card account associated with the transaction. """ - iban: typing.Optional[str] = None + iban: str | None = None """ ELV IBAN. """ - last_4_digits: typing.Optional[str] = None + last_4_digits: str | None = None """ ELV card account number last 4 digits. """ - sequence_no: typing.Optional[int] = None + sequence_no: int | None = None """ ELV card sequence number. """ - sort_code: typing.Optional[str] = None + sort_code: str | None = None """ ELV card sort code. """ @@ -2361,12 +2359,12 @@ class Error(pydantic.BaseModel): Error message structure. """ - error_code: typing.Optional[str] = None + error_code: str | None = None """ Platform code for the error. """ - message: typing.Optional[str] = None + message: str | None = None """ Short description of the error. """ @@ -2377,17 +2375,17 @@ class ErrorExtended(pydantic.BaseModel): Error payload with the invalid parameter reference. """ - error_code: typing.Optional[str] = None + error_code: str | None = None """ Platform code for the error. """ - message: typing.Optional[str] = None + message: str | None = None """ Short description of the error. """ - param: typing.Optional[str] = None + param: str | None = None """ Parameter name (with relative location) to which the error applies. Parameters from embedded resources aredisplayed using dot notation. For example, `card.name` refers to the `name` parameter embedded in the `card`object. """ @@ -2398,17 +2396,17 @@ class ErrorForbidden(pydantic.BaseModel): Error message for forbidden requests. """ - error_code: typing.Optional[str] = None + error_code: str | None = None """ Platform code for the error. """ - error_message: typing.Optional[str] = None + error_message: str | None = None """ Short description of the error. """ - status_code: typing.Optional[str] = None + status_code: str | None = None """ HTTP status code for the error. """ @@ -2420,16 +2418,14 @@ class ErrorForbidden(pydantic.BaseModel): Format: int64 """ -TransactionEventStatus = typing.Union[ +TransactionEventStatus = ( typing.Literal[ "FAILED", "PAID_OUT", "PENDING", "RECONCILED", "REFUNDED", "SCHEDULED", "SUCCESSFUL" - ], - str, -] + ] + | str +) -TransactionEventType = typing.Union[ - typing.Literal["CHARGE_BACK", "PAYOUT", "PAYOUT_DEDUCTION", "REFUND"], str -] +TransactionEventType = typing.Literal["CHARGE_BACK", "PAYOUT", "PAYOUT_DEDUCTION", "REFUND"] | str TransactionId = str """ @@ -2442,38 +2438,38 @@ class Event(pydantic.BaseModel): High-level transaction event details. """ - amount: typing.Optional[float] = None + amount: float | None = None """ Amount of the event. """ - deducted_amount: typing.Optional[float] = None + deducted_amount: float | None = None """ Amount deducted for the event. """ - deducted_fee_amount: typing.Optional[float] = None + deducted_fee_amount: float | None = None """ Amount of the fee deducted for the event. """ - fee_amount: typing.Optional[float] = None + fee_amount: float | None = None """ Amount of the fee related to the event. """ - id: typing.Optional[TransactionEventId] = None + id: TransactionEventId | None = None """ Unique ID of the transaction event. Format: int64 """ - installment_number: typing.Optional[int] = None + installment_number: int | None = None """ Consecutive number of the installment. """ - status: typing.Optional[TransactionEventStatus] = None + status: TransactionEventStatus | None = None """ Status of the transaction event. @@ -2488,34 +2484,34 @@ class Event(pydantic.BaseModel): - `FAILED`: The event could not be completed. Typical examples are a payout that could not be executed oran event that was rejected during processing. """ - timestamp: typing.Optional[datetime.datetime] = None + timestamp: datetime.datetime | None = None """ Date and time of the transaction event. """ - transaction_id: typing.Optional[TransactionId] = None + transaction_id: TransactionId | None = None """ Unique ID of the transaction. """ - type: typing.Optional[TransactionEventType] = None + type: TransactionEventType | None = None """ Type of the transaction event. """ -FinancialPayoutType = typing.Union[ +FinancialPayoutType = ( typing.Literal[ "BALANCE_DEDUCTION", "CHARGE_BACK_DEDUCTION", "DD_RETURN_DEDUCTION", "PAYOUT", "REFUND_DEDUCTION", - ], - str, -] + ] + | str +) -FinancialPayoutStatus = typing.Union[typing.Literal["FAILED", "SUCCESSFUL"], str] +FinancialPayoutStatus = typing.Literal["FAILED", "SUCCESSFUL"] | str class FinancialPayout(pydantic.BaseModel): @@ -2579,13 +2575,13 @@ class FinancialPayout(pydantic.BaseModel): Ordered list of payout and payout-deduction records. """ -GetReaderCheckoutResponseDataCardType = typing.Union[typing.Literal["credit", "debit"], str] +GetReaderCheckoutResponseDataCardType = typing.Literal["credit", "debit"] | str -GetReaderCheckoutResponseDataPaymentType = typing.Union[typing.Literal["card", "pix"], str] +GetReaderCheckoutResponseDataPaymentType = typing.Literal["card", "pix"] | str -GetReaderCheckoutResponseDataStatus = typing.Union[ - typing.Literal["cancelled", "failed", "pending", "successful"], str -] +GetReaderCheckoutResponseDataStatus = ( + typing.Literal["cancelled", "failed", "pending", "successful"] | str +) class GetReaderCheckoutResponseDataTotalAmount(pydantic.BaseModel): @@ -2691,7 +2687,7 @@ class GetReaderCheckoutResponseData(pydantic.BaseModel): Checkout expiration timestamp. After this time, the checkout will be automatically cancelled. """ - payment_failure_reason: typing.Optional[str] = None + payment_failure_reason: str | None = None """ Payment failure reason """ @@ -2738,28 +2734,28 @@ class Link(pydantic.BaseModel): Details of a link to a related resource. """ - href: typing.Optional[str] = None + href: str | None = None """ URL for accessing the related resource. Format: uri """ - max_amount: typing.Optional[float] = None + max_amount: float | None = None """ Maximum allowed amount for the refund. """ - min_amount: typing.Optional[float] = None + min_amount: float | None = None """ Minimum allowed amount for the refund. """ - rel: typing.Optional[str] = None + rel: str | None = None """ Specifies the relation to the current resource. """ - type: typing.Optional[str] = None + type: str | None = None """ Specifies the media type of the related resource. """ @@ -2776,27 +2772,27 @@ class Person(pydantic.BaseModel): Read only """ - address: typing.Optional[Address] = None + address: Address | None = None """ An address somewhere in the world. The address fields used depend on the country conventions. For example, inGreat Britain, `city` is `post_town`. In the United States, the top-level administrative unit used in addressesis `state`, whereas in Chile it's `region`. Whether an address is valid or not depends on whether the locally required fields are present. Fields not supported ina country will be ignored. Address documentation: https://developer.sumup.com/tools/glossary/address """ - birthdate: typing.Optional[datetime.date] = None + birthdate: datetime.date | None = None """ The date of birth of the individual, represented as an ISO 8601:2004 [ISO8601‑2004] YYYY-MM-DD format. Format: date """ - change_status: typing.Optional[ChangeStatus] = None + change_status: ChangeStatus | None = None """ Reflects the status of changes submitted through the `PATCH` endpoints for the Merchant or Persons. If somechanges have not been applied yet, the status will be `pending`. If all changes have been applied, the status`done`. The status is only returned after write operations or on read endpoints when the `version` query parameter isprovided. Read only """ - citizenship: typing.Optional[CountryCode] = None + citizenship: CountryCode | None = None """ An [ISO3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) country code. This definition users `oneOf` with a two-character string @@ -2806,63 +2802,63 @@ class Person(pydantic.BaseModel): Pattern: ^[A-Z]{2}$ """ - country_of_residence: typing.Optional[str] = None + country_of_residence: str | None = None """ An [ISO3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) country code representing the countrywhere the Person resides. Min length: 2 Max length: 2 """ - family_name: typing.Optional[str] = None + family_name: str | None = None """ The last name(s) of the individual. Max length: 60 """ - given_name: typing.Optional[str] = None + given_name: str | None = None """ The first name(s) of the individual. Max length: 60 """ - identifiers: typing.Optional[PersonalIdentifiers] = None + identifiers: PersonalIdentifiers | None = None """ A list of country-specific personal identifiers. Max items: 32 """ - middle_name: typing.Optional[str] = None + middle_name: str | None = None """ Middle name(s) of the End-User. Note that in some cultures, people can have multiple middle names; all canbe present, with the names being separated by space characters. Also note that in some cultures, middle namesare not used. Max length: 60 """ - nationality: typing.Optional[str] = None + nationality: str | None = None """ The Person's nationality. May be an [ISO3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) countrycode, but legacy data may not conform to this standard. """ - ownership: typing.Optional[Ownership] = None + ownership: Ownership | None = None - phone_number: typing.Optional[PhoneNumber] = None + phone_number: PhoneNumber | None = None """ A publicly available phone number in [E.164](https://en.wikipedia.org/wiki/E.164) format. Max length: 16 """ - relationships: typing.Optional[list[str]] = None + relationships: list[str] | None = None """ A list of roles the Person has in the Merchant or towards SumUp. A Merchant must have at least one Person withthe relationship `representative`. Min items: 1 Max items: 1 """ - user_id: typing.Optional[str] = None + user_id: str | None = None """ A corresponding identity user ID for the Person, if they have a user account. """ - version: typing.Optional[Version] = None + version: Version | None = None """ The version of the resource. The version reflects a specific change submitted to the API via one of the `PATCH`endpoints. """ @@ -2883,7 +2879,7 @@ class ListPersonsResponseBody(pydantic.BaseModel): Max: 180 """ -MandatePayloadType = typing.Union[typing.Literal["recurrent"], str] +MandatePayloadType = typing.Literal["recurrent"] | str MandatePayloadTypeInput = MandatePayloadType @@ -2902,7 +2898,7 @@ class MandatePayload(pydantic.BaseModel): Browser or client user agent observed when consent was collected. """ - user_ip: typing.Optional[str] = None + user_ip: str | None = None """ IP address of the payer when the mandate was accepted. """ @@ -2933,9 +2929,7 @@ class MandatePayloadDict(typing_extensions.TypedDict, total=False): MandatePayloadInput = MandatePayloadDict -MembershipStatus = typing.Union[ - typing.Literal["accepted", "disabled", "expired", "pending", "unknown"], str -] +MembershipStatus = typing.Literal["accepted", "disabled", "expired", "pending", "unknown"] | str MembershipStatusInput = MembershipStatus @@ -2952,9 +2946,7 @@ class MembershipUserClassic(pydantic.BaseModel): """ -UserType = typing.Union[ - typing.Literal["managed_user", "service_account", "system_account", "user"], str -] +UserType = typing.Literal["managed_user", "service_account", "system_account", "user"] | str class MembershipUser(pydantic.BaseModel): @@ -2994,23 +2986,23 @@ class MembershipUser(pydantic.BaseModel): Deprecated: Rely on `type` instead. """ - classic: typing.Optional[MembershipUserClassic] = None + classic: MembershipUserClassic | None = None """ Classic identifiers of the user. Deprecated: this operation is deprecated """ - disabled_at: typing.Optional[datetime.datetime] = None + disabled_at: datetime.datetime | None = None """ Time when the user has been disabled. Applies only to virtual users (`virtual_user: true`). """ - nickname: typing.Optional[str] = None + nickname: str | None = None """ User's nickname. Used for display purposes only. """ - picture: typing.Optional[str] = None + picture: str | None = None """ URL of the End-User's profile picture. This URL refers to an image file (for example, a PNG, JPEG, or GIFimage file), rather than to a Web page containing an image. Format: uri @@ -3061,23 +3053,23 @@ class Member(pydantic.BaseModel): The timestamp of when the member was last updated. """ - attributes: typing.Optional[Attributes] = None + attributes: Attributes | None = None """ Object attributes that are modifiable only by SumUp applications. """ - invite: typing.Optional[Invite] = None + invite: Invite | None = None """ Pending invitation for membership. """ - metadata: typing.Optional[Metadata] = None + metadata: Metadata | None = None """ Set of user-defined key-value pairs attached to the object. Partial updates are not supported. When updating, alwayssubmit whole metadata. Maximum of 64 parameters are allowed in the object. Max properties: 64 """ - user: typing.Optional[MembershipUser] = None + user: MembershipUser | None = None """ Information about the user associated with the membership. """ @@ -3126,12 +3118,12 @@ class MembershipResource(pydantic.BaseModel): The timestamp of when the membership resource was last updated. """ - attributes: typing.Optional[Attributes] = None + attributes: Attributes | None = None """ Object attributes that are modifiable only by SumUp applications. """ - logo: typing.Optional[str] = None + logo: str | None = None """ Logo fo the resource. Format: uri @@ -3193,17 +3185,17 @@ class Membership(pydantic.BaseModel): The timestamp of when the membership was last updated. """ - attributes: typing.Optional[Attributes] = None + attributes: Attributes | None = None """ Object attributes that are modifiable only by SumUp applications. """ - invite: typing.Optional[Invite] = None + invite: Invite | None = None """ Pending invitation for membership. """ - metadata: typing.Optional[Metadata] = None + metadata: Metadata | None = None """ Set of user-defined key-value pairs attached to the object. Partial updates are not supported. When updating, alwayssubmit whole metadata. Maximum of 64 parameters are allowed in the object. Max properties: 64 @@ -3286,23 +3278,23 @@ class Merchant(pydantic.BaseModel): Readonly """ - alias: typing.Optional[str] = None + alias: str | None = None """ A user-facing name of the merchant account for use in dashboards and other user-facing applications. Forcustomer-facing business name see `merchant.business_profile`. """ - avatar: typing.Optional[str] = None + avatar: str | None = None """ A user-facing small-format logo for use in dashboards and other user-facing applications. For customer-facing brandingsee `merchant.business_profile.branding`. Format: uri """ - business_profile: typing.Optional[BusinessProfile] = None + business_profile: BusinessProfile | None = None """ Business information about the merchant. This information will be visible to the merchant's customers. """ - business_type: typing.Optional[str] = None + business_type: str | None = None """ The business type. * `sole_trader`: The business is run by an self-employed individual. @@ -3312,39 +3304,39 @@ class Merchant(pydantic.BaseModel): * `government_entity`: The business is state owned and operated """ - change_status: typing.Optional[ChangeStatus] = None + change_status: ChangeStatus | None = None """ Reflects the status of changes submitted through the `PATCH` endpoints for the Merchant or Persons. If somechanges have not been applied yet, the status will be `pending`. If all changes have been applied, the status`done`. The status is only returned after write operations or on read endpoints when the `version` query parameter isprovided. Read only """ - classic: typing.Optional[ClassicMerchantIdentifiers] = None + classic: ClassicMerchantIdentifiers | None = None - company: typing.Optional[Company] = None + company: Company | None = None """ Information about the company or business. This is legal information that is used for verification. Company documentation: https://developer.sumup.com/tools/glossary/merchant#company """ - meta: typing.Optional[Meta] = None + meta: Meta | None = None """ A set of key-value pairs that you can attach to an object. This can be useful for storing additional informationabout the object in a structured format. **Warning**: Updating Meta will overwrite the existing data. Make sure to always include the complete JSON object. """ - organization_id: typing.Optional[str] = None + organization_id: str | None = None """ ID of the organization the merchant belongs to (if any). """ - sandbox: typing.Optional[bool] = None + sandbox: bool | None = None """ True if the merchant is a sandbox for testing. """ - version: typing.Optional[Version] = None + version: Version | None = None """ The version of the resource. The version reflects a specific change submitted to the API via one of the `PATCH`endpoints. """ @@ -3369,7 +3361,7 @@ class NotFound(pydantic.BaseModel): errors: NotFoundErrors -PaymentInstrumentResponseType = typing.Union[typing.Literal["card"], str] +PaymentInstrumentResponseType = typing.Literal["card"] | str class PaymentInstrumentResponseCard(pydantic.BaseModel): @@ -3377,7 +3369,7 @@ class PaymentInstrumentResponseCard(pydantic.BaseModel): Details of the payment card. """ - last_4_digits: typing.Optional[str] = None + last_4_digits: str | None = None """ Last 4 digits of the payment card number. Read only @@ -3385,7 +3377,7 @@ class PaymentInstrumentResponseCard(pydantic.BaseModel): Max length: 4 """ - type: typing.Optional[CardType] = None + type: CardType | None = None """ Issuing card network of the payment card used for the transaction. """ @@ -3396,35 +3388,35 @@ class PaymentInstrumentResponse(pydantic.BaseModel): Payment Instrument Response """ - active: typing.Optional[bool] = None + active: bool | None = None """ Indicates whether the payment instrument is active and can be used for payments. To deactivate it, send a`DELETE` request to the resource endpoint. Read only Default: true """ - card: typing.Optional[PaymentInstrumentResponseCard] = None + card: PaymentInstrumentResponseCard | None = None """ Details of the payment card. """ - created_at: typing.Optional[datetime.datetime] = None + created_at: datetime.datetime | None = None """ Creation date of payment instrument. Response format expressed according to [ISO8601](https://en.wikipedia.org/wiki/ISO_8601) code. """ - mandate: typing.Optional[MandateResponse] = None + mandate: MandateResponse | None = None """ Details of the mandate linked to the saved payment instrument. """ - token: typing.Optional[str] = None + token: str | None = None """ Unique token identifying the saved payment card for a customer. Read only """ - type: typing.Optional[PaymentInstrumentResponseType] = None + type: PaymentInstrumentResponseType | None = None """ Type of the payment instrument. """ @@ -3443,23 +3435,23 @@ class Problem(pydantic.BaseModel): Format: uri """ - detail: typing.Optional[str] = None + detail: str | None = None """ A human-readable explanation specific to this occurrence of the problem. """ - instance: typing.Optional[str] = None + instance: str | None = None """ A URI reference that identifies the specific occurrence of the problem. Format: uri """ - status: typing.Optional[int] = None + status: int | None = None """ The HTTP status code generated by the origin server for this occurrence of the problem. """ - title: typing.Optional[str] = None + title: str | None = None """ A short, human-readable summary of the problem type. """ @@ -3495,9 +3487,9 @@ def additional_properties(self, value: dict[str, object]) -> None: object.__setattr__(self, "__pydantic_extra__", dict(value)) -ProcessCheckoutPaymentType = typing.Union[ - typing.Literal["apple_pay", "bancontact", "blik", "boleto", "card", "google_pay", "ideal"], str -] +ProcessCheckoutPaymentType = ( + typing.Literal["apple_pay", "bancontact", "blik", "boleto", "card", "google_pay", "ideal"] | str +) ProcessCheckoutPaymentTypeInput = ProcessCheckoutPaymentType ProcessCheckoutGooglePay = dict[str, object] @@ -3523,44 +3515,44 @@ class ProcessCheckout(pydantic.BaseModel): Payment method used for this processing attempt. It determines which additional request fields are required. """ - apple_pay: typing.Optional[ProcessCheckoutApplePay] = None + apple_pay: ProcessCheckoutApplePay | None = None """ Raw payment token object received from Apple Pay. Send the Apple Pay response payload as-is. """ - card: typing.Optional[Card] = None + card: Card | None = None """ __Required when payment type is `card`.__ Details of the payment card. """ - customer_id: typing.Optional[str] = None + customer_id: str | None = None """ Customer identifier associated with the saved payment instrument. Required when `token` is provided. """ - google_pay: typing.Optional[ProcessCheckoutGooglePay] = None + google_pay: ProcessCheckoutGooglePay | None = None """ Raw `PaymentData` object received from Google Pay. Send the Google Pay response payload as-is. """ - installments: typing.Optional[int] = None + installments: int | None = None """ Number of installments for deferred payments. Available only to merchant users in Brazil. Min: 1 Max: 12 """ - mandate: typing.Optional[MandatePayload] = None + mandate: MandatePayload | None = None """ Mandate details used when a checkout should create a reusable card token for future recurring or merchant-initiated payments. """ - personal_details: typing.Optional[PersonalDetails] = None + personal_details: PersonalDetails | None = None """ Personal details for the customer. """ - token: typing.Optional[str] = None + token: str | None = None """ Saved-card token to use instead of raw card details when processing with a previously stored payment instrument. """ @@ -3646,65 +3638,65 @@ class Product(pydantic.BaseModel): Purchase product. """ - name: typing.Optional[str] = None + name: str | None = None """ Product name. """ - price: typing.Optional[float] = None + price: float | None = None """ Product price. Format: decimal """ - price_label: typing.Optional[str] = None + price_label: str | None = None """ Product description. """ - price_with_vat: typing.Optional[float] = None + price_with_vat: float | None = None """ Product price incl. VAT. Format: decimal """ - quantity: typing.Optional[int] = None + quantity: int | None = None """ Product quantity. """ - single_vat_amount: typing.Optional[float] = None + single_vat_amount: float | None = None """ VAT amount for a single product. Format: decimal """ - total_price: typing.Optional[float] = None + total_price: float | None = None """ Quantity x product price. Format: decimal """ - total_with_vat: typing.Optional[float] = None + total_with_vat: float | None = None """ Total price incl. VAT. Format: decimal """ - vat_amount: typing.Optional[float] = None + vat_amount: float | None = None """ VAT amount. Format: decimal """ - vat_rate: typing.Optional[float] = None + vat_rate: float | None = None """ VAT percentage. Format: decimal """ -ReaderDeviceModel = typing.Union[typing.Literal["solo", "virtual-solo"], str] +ReaderDeviceModel = typing.Literal["solo", "virtual-solo"] | str class ReaderDevice(pydantic.BaseModel): @@ -3738,7 +3730,7 @@ class ReaderDevice(pydantic.BaseModel): Max length: 500 """ -ReaderStatus = typing.Union[typing.Literal["expired", "paired", "processing", "unknown"], str] +ReaderStatus = typing.Literal["expired", "paired", "processing", "unknown"] | str class Reader(pydantic.BaseModel): @@ -3786,13 +3778,13 @@ class Reader(pydantic.BaseModel): The timestamp of when the reader was last updated. """ - metadata: typing.Optional[Metadata] = None + metadata: Metadata | None = None """ Set of user-defined key-value pairs attached to the object. Partial updates are not supported. When updating, alwayssubmit whole metadata. Maximum of 64 parameters are allowed in the object. Max properties: 64 """ - service_account_id: typing.Optional[str] = None + service_account_id: str | None = None """ Identifier of the system-managed service account associated with this reader. Present only for readers that are already paired. @@ -3801,7 +3793,7 @@ class Reader(pydantic.BaseModel): """ -ReaderCheckoutStatusChangePayloadStatus = typing.Union[typing.Literal["failed", "successful"], str] +ReaderCheckoutStatusChangePayloadStatus = typing.Literal["failed", "successful"] | str class ReaderCheckoutStatusChangePayload(pydantic.BaseModel): @@ -3825,7 +3817,7 @@ class ReaderCheckoutStatusChangePayload(pydantic.BaseModel): The current status of the transaction. """ - transaction_id: typing.Optional[str] = None + transaction_id: str | None = None """ The transaction id. Deprecated: use `client_transaction_id` instead. Format: uuid @@ -3881,9 +3873,9 @@ class ReaderPaymentRequestParams(pydantic.BaseModel): total_amount: Amount - affiliate: typing.Optional[Affiliate] = None + affiliate: Affiliate | None = None - tip_amount: typing.Optional[int] = None + tip_amount: int | None = None """ Optional tip amount in minor units, added on top of total_amount. """ @@ -3918,12 +3910,12 @@ class ReaderPaymentResponseData(pydantic.BaseModel): ReaderPaymentResponseData is a schema definition. """ - client_transaction_id: typing.Optional[str] = None + client_transaction_id: str | None = None """ Caller-supplied correlation identifier that was provided in the request. """ - transaction_code: typing.Optional[str] = None + transaction_code: str | None = None """ Transaction code returned by the acquirer/processing entity after processing the transaction. """ @@ -3934,7 +3926,7 @@ class ReaderPaymentResponse(pydantic.BaseModel): ReaderPaymentResponse is a schema definition. """ - data: typing.Optional[ReaderPaymentResponseData] = None + data: ReaderPaymentResponseData | None = None class ReceiptCard(pydantic.BaseModel): @@ -3942,12 +3934,12 @@ class ReceiptCard(pydantic.BaseModel): Payment card details displayed on the receipt. """ - last_4_digits: typing.Optional[str] = None + last_4_digits: str | None = None """ Card last 4 digits. """ - type: typing.Optional[str] = None + type: str | None = None """ Card Scheme. """ @@ -3958,24 +3950,24 @@ class ReceiptEvent(pydantic.BaseModel): Transaction event details as rendered on the receipt. """ - amount: typing.Optional[str] = None + amount: str | None = None """ Amount of the event. Format: double """ - id: typing.Optional[TransactionEventId] = None + id: TransactionEventId | None = None """ Unique ID of the transaction event. Format: int64 """ - receipt_no: typing.Optional[str] = None + receipt_no: str | None = None """ Receipt number associated with the event. """ - status: typing.Optional[TransactionEventStatus] = None + status: TransactionEventStatus | None = None """ Status of the transaction event. @@ -3990,17 +3982,17 @@ class ReceiptEvent(pydantic.BaseModel): - `FAILED`: The event could not be completed. Typical examples are a payout that could not be executed oran event that was rejected during processing. """ - timestamp: typing.Optional[datetime.datetime] = None + timestamp: datetime.datetime | None = None """ Date and time of the transaction event. """ - transaction_id: typing.Optional[TransactionId] = None + transaction_id: TransactionId | None = None """ Unique ID of the transaction. """ - type: typing.Optional[TransactionEventType] = None + type: TransactionEventType | None = None """ Type of the transaction event. """ @@ -4011,23 +4003,23 @@ class ReceiptMerchantDataMerchantProfileAddress(pydantic.BaseModel): ReceiptMerchantDataMerchantProfileAddress is a schema definition. """ - address_line1: typing.Optional[str] = None + address_line1: str | None = None - address_line2: typing.Optional[str] = None + address_line2: str | None = None - city: typing.Optional[str] = None + city: str | None = None - country: typing.Optional[str] = None + country: str | None = None - country_en_name: typing.Optional[str] = None + country_en_name: str | None = None - country_native_name: typing.Optional[str] = None + country_native_name: str | None = None - landline: typing.Optional[str] = None + landline: str | None = None - post_code: typing.Optional[str] = None + post_code: str | None = None - region_name: typing.Optional[str] = None + region_name: str | None = None class ReceiptMerchantDataMerchantProfile(pydantic.BaseModel): @@ -4035,21 +4027,21 @@ class ReceiptMerchantDataMerchantProfile(pydantic.BaseModel): Merchant profile details displayed on the receipt. """ - address: typing.Optional[ReceiptMerchantDataMerchantProfileAddress] = None + address: ReceiptMerchantDataMerchantProfileAddress | None = None - business_name: typing.Optional[str] = None + business_name: str | None = None - company_registration_number: typing.Optional[str] = None + company_registration_number: str | None = None - email: typing.Optional[str] = None + email: str | None = None - language: typing.Optional[str] = None + language: str | None = None - merchant_code: typing.Optional[str] = None + merchant_code: str | None = None - vat_id: typing.Optional[str] = None + vat_id: str | None = None - website: typing.Optional[str] = None + website: str | None = None class ReceiptMerchantData(pydantic.BaseModel): @@ -4057,12 +4049,12 @@ class ReceiptMerchantData(pydantic.BaseModel): Receipt merchant data """ - locale: typing.Optional[str] = None + locale: str | None = None """ Locale used for rendering localized receipt fields. """ - merchant_profile: typing.Optional[ReceiptMerchantDataMerchantProfile] = None + merchant_profile: ReceiptMerchantDataMerchantProfile | None = None """ Merchant profile details displayed on the receipt. """ @@ -4073,18 +4065,18 @@ class ReceiptReader(pydantic.BaseModel): Card reader details displayed on the receipt. """ - code: typing.Optional[str] = None + code: str | None = None """ Reader serial number. """ - type: typing.Optional[str] = None + type: str | None = None """ Reader type. """ -ReceiptTransactionProcessA = typing.Union[typing.Literal["CREDIT", "DEBIT"], str] +ReceiptTransactionProcessA = typing.Literal["CREDIT", "DEBIT"] | str class ReceiptTransactionProduct(pydantic.BaseModel): @@ -4092,59 +4084,59 @@ class ReceiptTransactionProduct(pydantic.BaseModel): ReceiptTransactionProduct is a schema definition. """ - description: typing.Optional[str] = None + description: str | None = None """ Product description """ - name: typing.Optional[str] = None + name: str | None = None """ Product name """ - price: typing.Optional[str] = None + price: str | None = None """ Product price Format: double """ - price_with_vat: typing.Optional[str] = None + price_with_vat: str | None = None """ Product price including VAT Format: double """ - quantity: typing.Optional[int] = None + quantity: int | None = None """ Product quantity Format: int64 """ - single_vat_amount: typing.Optional[str] = None + single_vat_amount: str | None = None """ VAT amount for a single product Format: double """ - total_price: typing.Optional[str] = None + total_price: str | None = None """ Quantity x product price Format: double """ - total_with_vat: typing.Optional[str] = None + total_with_vat: str | None = None """ Total price including VAT Format: double """ - vat_amount: typing.Optional[str] = None + vat_amount: str | None = None """ VAT amount Format: double """ - vat_rate: typing.Optional[str] = None + vat_rate: str | None = None """ VAT rate Format: double @@ -4156,22 +4148,22 @@ class ReceiptTransactionVatRate(pydantic.BaseModel): ReceiptTransactionVatRate is a schema definition. """ - gross: typing.Optional[float] = None + gross: float | None = None """ Gross """ - net: typing.Optional[float] = None + net: float | None = None """ Net """ - rate: typing.Optional[float] = None + rate: float | None = None """ Rate """ - vat: typing.Optional[float] = None + vat: float | None = None """ Vat """ @@ -4182,102 +4174,102 @@ class ReceiptTransaction(pydantic.BaseModel): Transaction information. """ - amount: typing.Optional[str] = None + amount: str | None = None """ Transaction amount. """ - card: typing.Optional[ReceiptCard] = None + card: ReceiptCard | None = None """ Payment card details displayed on the receipt. """ - card_reader: typing.Optional[ReceiptReader] = None + card_reader: ReceiptReader | None = None """ Card reader details displayed on the receipt. """ - currency: typing.Optional[str] = None + currency: str | None = None """ Transaction currency. """ - entry_mode: typing.Optional[str] = None + entry_mode: str | None = None """ Transaction entry mode. """ - events: typing.Optional[list[ReceiptEvent]] = None + events: list[ReceiptEvent] | None = None """ Events """ - installments_count: typing.Optional[int] = None + installments_count: int | None = None """ Number of installments. """ - merchant_code: typing.Optional[str] = None + merchant_code: str | None = None """ Merchant code. """ - payment_type: typing.Optional[str] = None + payment_type: str | None = None """ Transaction type. """ - process_as: typing.Optional[ReceiptTransactionProcessA] = None + process_as: ReceiptTransactionProcessA | None = None """ Debit/Credit. """ - products: typing.Optional[list[ReceiptTransactionProduct]] = None + products: list[ReceiptTransactionProduct] | None = None """ Products """ - receipt_no: typing.Optional[str] = None + receipt_no: str | None = None """ Receipt number """ - status: typing.Optional[str] = None + status: str | None = None """ Transaction processing status. """ - timestamp: typing.Optional[datetime.datetime] = None + timestamp: datetime.datetime | None = None """ Time created at. """ - tip_amount: typing.Optional[str] = None + tip_amount: str | None = None """ Tip amount (included in transaction amount). """ - transaction_code: typing.Optional[str] = None + transaction_code: str | None = None """ Transaction code. """ - transaction_id: typing.Optional[TransactionId] = None + transaction_id: TransactionId | None = None """ Unique ID of the transaction. """ - vat_amount: typing.Optional[str] = None + vat_amount: str | None = None """ Transaction VAT amount. """ - vat_rates: typing.Optional[list[ReceiptTransactionVatRate]] = None + vat_rates: list[ReceiptTransactionVatRate] | None = None """ Vat rates. """ - verification_method: typing.Optional[str] = None + verification_method: str | None = None """ Cardholder verification method. """ @@ -4294,13 +4286,13 @@ class ReceiptAcquirerData(pydantic.BaseModel): Acquirer-specific metadata related to the card authorization. """ - authorization_code: typing.Optional[str] = None + authorization_code: str | None = None - local_time: typing.Optional[str] = None + local_time: str | None = None - return_code: typing.Optional[str] = None + return_code: str | None = None - tid: typing.Optional[str] = None + tid: str | None = None class Receipt(pydantic.BaseModel): @@ -4308,22 +4300,22 @@ class Receipt(pydantic.BaseModel): Receipt details for a transaction. """ - acquirer_data: typing.Optional[ReceiptAcquirerData] = None + acquirer_data: ReceiptAcquirerData | None = None """ Acquirer-specific metadata related to the card authorization. """ - emv_data: typing.Optional[ReceiptEmvData] = None + emv_data: ReceiptEmvData | None = None """ EMV-specific metadata returned for card-present payments. """ - merchant_data: typing.Optional[ReceiptMerchantData] = None + merchant_data: ReceiptMerchantData | None = None """ Receipt merchant data """ - transaction_data: typing.Optional[ReceiptTransaction] = None + transaction_data: ReceiptTransaction | None = None """ Transaction information. """ @@ -4365,23 +4357,23 @@ class Role(pydantic.BaseModel): The timestamp of when the role was last updated. """ - description: typing.Optional[str] = None + description: str | None = None """ User-defined description of the role. """ - metadata: typing.Optional[Metadata] = None + metadata: Metadata | None = None """ Set of user-defined key-value pairs attached to the object. Partial updates are not supported. When updating, alwayssubmit whole metadata. Maximum of 64 parameters are allowed in the object. Max properties: 64 """ -StatusResponseDataConnectionType = typing.Union[ - typing.Literal["Wi-Fi", "btle", "edge", "gprs", "lte", "umts", "usb"], str -] +StatusResponseDataConnectionType = ( + typing.Literal["Wi-Fi", "btle", "edge", "gprs", "lte", "umts", "usb"] | str +) -StatusResponseDataState = typing.Union[ +StatusResponseDataState = ( typing.Literal[ "IDLE", "SELECTING_TIP", @@ -4389,11 +4381,11 @@ class Role(pydantic.BaseModel): "WAITING_FOR_CARD", "WAITING_FOR_PIN", "WAITING_FOR_SIGNATURE", - ], - str, -] + ] + | str +) -StatusResponseDataStatus = typing.Union[typing.Literal["OFFLINE", "ONLINE"], str] +StatusResponseDataStatus = typing.Literal["OFFLINE", "ONLINE"] | str class StatusResponseData(pydantic.BaseModel): @@ -4406,34 +4398,34 @@ class StatusResponseData(pydantic.BaseModel): Status of a device """ - battery_level: typing.Optional[float] = None + battery_level: float | None = None """ Battery level percentage Min: 0 Max: 100 """ - battery_temperature: typing.Optional[int] = None + battery_temperature: int | None = None """ Battery temperature in Celsius """ - connection_type: typing.Optional[StatusResponseDataConnectionType] = None + connection_type: StatusResponseDataConnectionType | None = None """ Type of connection used by the device """ - firmware_version: typing.Optional[str] = None + firmware_version: str | None = None """ Firmware version of the device """ - last_activity: typing.Optional[datetime.datetime] = None + last_activity: datetime.datetime | None = None """ Timestamp of the last activity from the device """ - state: typing.Optional[StatusResponseDataState] = None + state: StatusResponseDataState | None = None """ Latest state of the device """ @@ -4452,41 +4444,41 @@ class TransactionEvent(pydantic.BaseModel): Detailed information about a transaction event. """ - amount: typing.Optional[float] = None + amount: float | None = None """ Amount of the event. Format: decimal """ - date: typing.Optional[datetime.date] = None + date: datetime.date | None = None """ Date when the transaction event occurred. Format: date """ - due_date: typing.Optional[datetime.date] = None + due_date: datetime.date | None = None """ Date when the transaction event is due to occur. Format: date """ - event_type: typing.Optional[TransactionEventType] = None + event_type: TransactionEventType | None = None """ Type of the transaction event. """ - id: typing.Optional[TransactionEventId] = None + id: TransactionEventId | None = None """ Unique ID of the transaction event. Format: int64 """ - installment_number: typing.Optional[int] = None + installment_number: int | None = None """ Consecutive number of the installment that is paid. Applicable only payout events, i.e. `event_type = PAYOUT`. """ - status: typing.Optional[TransactionEventStatus] = None + status: TransactionEventStatus | None = None """ Status of the transaction event. @@ -4501,15 +4493,15 @@ class TransactionEvent(pydantic.BaseModel): - `FAILED`: The event could not be completed. Typical examples are a payout that could not be executed oran event that was rejected during processing. """ - timestamp: typing.Optional[datetime.datetime] = None + timestamp: datetime.datetime | None = None """ Date and time of the transaction event. """ -TransactionMixinHistoryPayoutPlan = typing.Union[ - typing.Literal["ACCELERATED_INSTALLMENT", "SINGLE_PAYMENT", "TRUE_INSTALLMENT"], str -] +TransactionMixinHistoryPayoutPlan = ( + typing.Literal["ACCELERATED_INSTALLMENT", "SINGLE_PAYMENT", "TRUE_INSTALLMENT"] | str +) class TransactionMixinHistory(pydantic.BaseModel): @@ -4517,32 +4509,32 @@ class TransactionMixinHistory(pydantic.BaseModel): Additional transaction fields used by history and detailed views. """ - payout_plan: typing.Optional[TransactionMixinHistoryPayoutPlan] = None + payout_plan: TransactionMixinHistoryPayoutPlan | None = None """ Payout plan of the registered user at the time when the transaction was made. """ - payouts_received: typing.Optional[int] = None + payouts_received: int | None = None """ Number of payouts that are made to the registered user specified in the `user` property. """ - payouts_total: typing.Optional[int] = None + payouts_total: int | None = None """ Total number of payouts to the registered user specified in the `user` property. """ - product_summary: typing.Optional[str] = None + product_summary: str | None = None """ Short description of the payment. The value is taken from the `description` property of the related checkout resource. """ -TransactionFullPayoutPlan = typing.Union[ - typing.Literal["ACCELERATED_INSTALLMENT", "SINGLE_PAYMENT", "TRUE_INSTALLMENT"], str -] +TransactionFullPayoutPlan = ( + typing.Literal["ACCELERATED_INSTALLMENT", "SINGLE_PAYMENT", "TRUE_INSTALLMENT"] | str +) -TransactionFullSimplePaymentType = typing.Union[ +TransactionFullSimplePaymentType = ( typing.Literal[ "APM", "BALANCE", @@ -4558,20 +4550,20 @@ class TransactionMixinHistory(pydantic.BaseModel): "MANUAL_ENTRY", "MOTO", "RECURRING", - ], - str, -] + ] + | str +) -TransactionFullVerificationMethod = typing.Union[ +TransactionFullVerificationMethod = ( typing.Literal[ "na", "none", "offline PIN", "offline PIN + signature", "online PIN", "signature" - ], - str, -] + ] + | str +) -TransactionFullPayoutType = typing.Union[typing.Literal["BANK_ACCOUNT", "PREPAID_CARD"], str] +TransactionFullPayoutType = typing.Literal["BANK_ACCOUNT", "PREPAID_CARD"] | str -TransactionFullProcessA = typing.Union[typing.Literal["CREDIT", "DEBIT"], str] +TransactionFullProcessA = typing.Literal["CREDIT", "DEBIT"] | str class TransactionFullVatRate(pydantic.BaseModel): @@ -4579,32 +4571,32 @@ class TransactionFullVatRate(pydantic.BaseModel): TransactionFullVatRate is a schema definition. """ - gross: typing.Optional[float] = None + gross: float | None = None """ Gross amount of products having this VAT rate applied. Format: decimal """ - net: typing.Optional[float] = None + net: float | None = None """ NET amount of products having this VAT rate applied. Format: decimal """ - rate: typing.Optional[float] = None + rate: float | None = None """ VAT rate. Format: decimal """ - vat: typing.Optional[float] = None + vat: float | None = None """ VAT amount of this rate applied. Format: decimal """ -TransactionFullSimpleStatus = typing.Union[ +TransactionFullSimpleStatus = ( typing.Literal[ "CANCELLED", "CANCEL_FAILED", @@ -4616,9 +4608,9 @@ class TransactionFullVatRate(pydantic.BaseModel): "REFUNDED", "REFUND_FAILED", "SUCCESSFUL", - ], - str, -] + ] + | str +) class TransactionFullLocation(pydantic.BaseModel): @@ -4626,19 +4618,19 @@ class TransactionFullLocation(pydantic.BaseModel): Details of the payment location as received from the payment terminal. """ - horizontal_accuracy: typing.Optional[HorizontalAccuracy] = None + horizontal_accuracy: HorizontalAccuracy | None = None """ Indication of the precision of the geographical position received from the payment terminal. """ - lat: typing.Optional[Lat] = None + lat: Lat | None = None """ Latitude value from the coordinates of the payment location (as received from the payment terminal reader). Min: 0 Max: 90 """ - lon: typing.Optional[Lon] = None + lon: Lon | None = None """ Longitude value from the coordinates of the payment location (as received from the payment terminal reader). Min: 0 @@ -4651,170 +4643,170 @@ class TransactionFull(pydantic.BaseModel): Full transaction resource with checkout, payout, and event details. """ - amount: typing.Optional[float] = None + amount: float | None = None """ Total amount of the transaction. """ - auth_code: typing.Optional[str] = None + auth_code: str | None = None """ Authorization code for the transaction sent by the payment card issuer or bank. Applicable only to card payments. """ - card: typing.Optional[CardResponse] = None + card: CardResponse | None = None """ Details of the payment card. """ - client_transaction_id: typing.Optional[str] = None + client_transaction_id: str | None = None """ Client transaction id. """ - currency: typing.Optional[Currency] = None + currency: Currency | None = None """ Three-letter [ISO4217](https://en.wikipedia.org/wiki/ISO_4217) code of the currency for the amount. Currently supportedcurrency values are enumerated above. """ - device_info: typing.Optional[Device] = None + device_info: Device | None = None """ Details of the device used to create the transaction. """ - elv_account: typing.Optional[ElvCardAccount] = None + elv_account: ElvCardAccount | None = None """ Details of the ELV card account associated with the transaction. """ - entry_mode: typing.Optional[EntryMode] = None + entry_mode: EntryMode | None = None """ Entry mode of the payment details. """ - events: typing.Optional[list[Event]] = None + events: list[Event] | None = None """ Compact list of events related to the transaction. """ - fee_amount: typing.Optional[float] = None + fee_amount: float | None = None """ Transaction SumUp total fee amount. Format: decimal """ - foreign_transaction_id: typing.Optional[str] = None + foreign_transaction_id: str | None = None """ External/foreign transaction id (passed by clients). """ - horizontal_accuracy: typing.Optional[HorizontalAccuracy] = None + horizontal_accuracy: HorizontalAccuracy | None = None """ Indication of the precision of the geographical position received from the payment terminal. """ - id: typing.Optional[str] = None + id: str | None = None """ Unique ID of the transaction. """ - installments_count: typing.Optional[int] = None + installments_count: int | None = None """ Current number of the installment for deferred payments. Min: 1 """ - lat: typing.Optional[Lat] = None + lat: Lat | None = None """ Latitude value from the coordinates of the payment location (as received from the payment terminal reader). Min: 0 Max: 90 """ - links: typing.Optional[list[Link]] = None + links: list[Link] | None = None """ List of hyperlinks for accessing related resources. """ - local_time: typing.Optional[datetime.datetime] = None + local_time: datetime.datetime | None = None """ Local date and time of the creation of the transaction. """ - location: typing.Optional[TransactionFullLocation] = None + location: TransactionFullLocation | None = None """ Details of the payment location as received from the payment terminal. """ - lon: typing.Optional[Lon] = None + lon: Lon | None = None """ Longitude value from the coordinates of the payment location (as received from the payment terminal reader). Min: 0 Max: 180 """ - merchant_code: typing.Optional[str] = None + merchant_code: str | None = None """ Unique code of the registered merchant to whom the payment is made. """ - merchant_id: typing.Optional[int] = None + merchant_id: int | None = None """ SumUp merchant internal Id. Format: int64 """ - payment_type: typing.Optional[PaymentType] = None + payment_type: PaymentType | None = None """ Payment type used for the transaction. """ - payout_date: typing.Optional[datetime.date] = None + payout_date: datetime.date | None = None """ The date of the payout. Format: date """ - payout_plan: typing.Optional[TransactionFullPayoutPlan] = None + payout_plan: TransactionFullPayoutPlan | None = None """ Payout plan of the registered user at the time when the transaction was made. """ - payout_type: typing.Optional[TransactionFullPayoutType] = None + payout_type: TransactionFullPayoutType | None = None """ Payout type for the transaction. """ - payouts_received: typing.Optional[int] = None + payouts_received: int | None = None """ Number of payouts that are made to the registered user specified in the `user` property. """ - payouts_total: typing.Optional[int] = None + payouts_total: int | None = None """ Total number of payouts to the registered user specified in the `user` property. """ - process_as: typing.Optional[TransactionFullProcessA] = None + process_as: TransactionFullProcessA | None = None """ Debit/Credit. """ - product_summary: typing.Optional[str] = None + product_summary: str | None = None """ Short description of the payment. The value is taken from the `description` property of the related checkout resource. """ - products: typing.Optional[list[Product]] = None + products: list[Product] | None = None """ List of products from the merchant's catalogue for which the transaction serves as a payment. """ - simple_payment_type: typing.Optional[TransactionFullSimplePaymentType] = None + simple_payment_type: TransactionFullSimplePaymentType | None = None """ Simple name of the payment type. """ - simple_status: typing.Optional[TransactionFullSimpleStatus] = None + simple_status: TransactionFullSimpleStatus | None = None """ High-level status of the transaction from the merchant's perspective. @@ -4830,7 +4822,7 @@ class TransactionFull(pydantic.BaseModel): - `NON_COLLECTION`: The amount could not be collected from the merchant after a chargeback or related adjustment. """ - status: typing.Optional[TransactionStatus] = None + status: TransactionStatus | None = None """ Current status of the transaction. @@ -4841,60 +4833,60 @@ class TransactionFull(pydantic.BaseModel): - `REFUNDED`: The transaction was refunded in full or in part. """ - tax_enabled: typing.Optional[bool] = None + tax_enabled: bool | None = None """ Indicates whether tax deduction is enabled for the transaction. """ - timestamp: typing.Optional[datetime.datetime] = None + timestamp: datetime.datetime | None = None """ Date and time of the creation of the transaction. Response format expressed according to [ISO8601](https://en.wikipedia.org/wiki/ISO_8601) code. """ - tip_amount: typing.Optional[float] = None + tip_amount: float | None = None """ Amount of the tip (out of the total transaction amount). """ - transaction_code: typing.Optional[str] = None + transaction_code: str | None = None """ Transaction code returned by the acquirer/processing entity after processing the transaction. """ - transaction_events: typing.Optional[list[TransactionEvent]] = None + transaction_events: list[TransactionEvent] | None = None """ Detailed list of events related to the transaction. """ - username: typing.Optional[str] = None + username: str | None = None """ Email address of the registered user (merchant) to whom the payment is made. Format: email """ - vat_amount: typing.Optional[float] = None + vat_amount: float | None = None """ Amount of the applicable VAT (out of the total transaction amount). """ - vat_rates: typing.Optional[list[TransactionFullVatRate]] = None + vat_rates: list[TransactionFullVatRate] | None = None """ List of VAT rates applicable to the transaction. """ - verification_method: typing.Optional[TransactionFullVerificationMethod] = None + verification_method: TransactionFullVerificationMethod | None = None """ Verification method used for the transaction. """ -TransactionHistoryPayoutPlan = typing.Union[ - typing.Literal["ACCELERATED_INSTALLMENT", "SINGLE_PAYMENT", "TRUE_INSTALLMENT"], str -] +TransactionHistoryPayoutPlan = ( + typing.Literal["ACCELERATED_INSTALLMENT", "SINGLE_PAYMENT", "TRUE_INSTALLMENT"] | str +) -TransactionHistoryType = typing.Union[typing.Literal["CHARGE_BACK", "PAYMENT", "REFUND"], str] +TransactionHistoryType = typing.Literal["CHARGE_BACK", "PAYMENT", "REFUND"] | str -TransactionHistoryPayoutType = typing.Union[typing.Literal["BANK_ACCOUNT", "PREPAID_CARD"], str] +TransactionHistoryPayoutType = typing.Literal["BANK_ACCOUNT", "PREPAID_CARD"] | str class TransactionHistory(pydantic.BaseModel): @@ -4902,80 +4894,80 @@ class TransactionHistory(pydantic.BaseModel): Transaction entry returned in history listing responses. """ - amount: typing.Optional[float] = None + amount: float | None = None """ Total amount of the transaction. """ - card_type: typing.Optional[CardType] = None + card_type: CardType | None = None """ Issuing card network of the payment card used for the transaction. """ - client_transaction_id: typing.Optional[str] = None + client_transaction_id: str | None = None """ Client-specific ID of the transaction. """ - currency: typing.Optional[Currency] = None + currency: Currency | None = None """ Three-letter [ISO4217](https://en.wikipedia.org/wiki/ISO_4217) code of the currency for the amount. Currently supportedcurrency values are enumerated above. """ - id: typing.Optional[str] = None + id: str | None = None """ Unique ID of the transaction. """ - installments_count: typing.Optional[int] = None + installments_count: int | None = None """ Current number of the installment for deferred payments. Min: 1 """ - payment_type: typing.Optional[PaymentType] = None + payment_type: PaymentType | None = None """ Payment type used for the transaction. """ - payout_date: typing.Optional[datetime.date] = None + payout_date: datetime.date | None = None """ Payout date (if paid out at once). Format: date """ - payout_plan: typing.Optional[TransactionHistoryPayoutPlan] = None + payout_plan: TransactionHistoryPayoutPlan | None = None """ Payout plan of the registered user at the time when the transaction was made. """ - payout_type: typing.Optional[TransactionHistoryPayoutType] = None + payout_type: TransactionHistoryPayoutType | None = None """ Payout type. """ - payouts_received: typing.Optional[int] = None + payouts_received: int | None = None """ Number of payouts that are made to the registered user specified in the `user` property. """ - payouts_total: typing.Optional[int] = None + payouts_total: int | None = None """ Total number of payouts to the registered user specified in the `user` property. """ - product_summary: typing.Optional[str] = None + product_summary: str | None = None """ Short description of the payment. The value is taken from the `description` property of the related checkout resource. """ - refunded_amount: typing.Optional[float] = None + refunded_amount: float | None = None """ Total refunded amount. Format: decimal """ - status: typing.Optional[TransactionStatus] = None + status: TransactionStatus | None = None """ Current status of the transaction. @@ -4986,27 +4978,27 @@ class TransactionHistory(pydantic.BaseModel): - `REFUNDED`: The transaction was refunded in full or in part. """ - timestamp: typing.Optional[datetime.datetime] = None + timestamp: datetime.datetime | None = None """ Date and time of the creation of the transaction. Response format expressed according to [ISO8601](https://en.wikipedia.org/wiki/ISO_8601) code. """ - transaction_code: typing.Optional[str] = None + transaction_code: str | None = None """ Transaction code returned by the acquirer/processing entity after processing the transaction. """ - transaction_id: typing.Optional[TransactionId] = None + transaction_id: TransactionId | None = None """ Unique ID of the transaction. """ - type: typing.Optional[TransactionHistoryType] = None + type: TransactionHistoryType | None = None """ Type of the transaction for the registered user specified in the `user` property. """ - user: typing.Optional[str] = None + user: str | None = None """ Email address of the registered user (merchant) to whom the payment is made. Format: email @@ -5029,9 +5021,7 @@ class TransactionsHistoryLink(pydantic.BaseModel): """ -UnauthorizedErrorsType = typing.Union[ - typing.Literal["INVALID_ACCESS_TOKEN", "INVALID_PASSWORD"], str -] +UnauthorizedErrorsType = typing.Literal["INVALID_ACCESS_TOKEN", "INVALID_PASSWORD"] | str class UnauthorizedErrors(pydantic.BaseModel): @@ -5044,7 +5034,7 @@ class UnauthorizedErrors(pydantic.BaseModel): Fuller message giving context to error """ - type: typing.Optional[UnauthorizedErrorsType] = None + type: UnauthorizedErrorsType | None = None """ Key indicating type of error. Present only for typed 401 responses (e.g. invalid token, invalid password). Absentfor generic unauthorized responses. """ diff --git a/tests/test_query_params.py b/tests/test_query_params.py index 7b0ba00a..09b9b555 100644 --- a/tests/test_query_params.py +++ b/tests/test_query_params.py @@ -1,6 +1,7 @@ +import typing + import httpx import pytest -import typing from sumup._service import NotGivenType diff --git a/tests/test_request_bodies.py b/tests/test_request_bodies.py index f05a4460..8f98e87f 100644 --- a/tests/test_request_bodies.py +++ b/tests/test_request_bodies.py @@ -1,5 +1,6 @@ import datetime import json + import httpx @@ -39,7 +40,7 @@ def handler(request: httpx.Request) -> httpx.Response: checkout_reference="checkout-ref", currency="EUR", merchant_code="merchant-123", - valid_until=datetime.datetime(2024, 1, 2, 3, 4, 5), + valid_until=datetime.datetime(2024, 1, 2, 3, 4, 5, tzinfo=datetime.timezone.utc), ) assert response.id == "checkout-123" @@ -50,5 +51,5 @@ def handler(request: httpx.Request) -> httpx.Response: "checkout_reference": "checkout-ref", "currency": "EUR", "merchant_code": "merchant-123", - "valid_until": "2024-01-02T03:04:05", + "valid_until": "2024-01-02T03:04:05+00:00", } diff --git a/uv.lock b/uv.lock index 3cec5170..bb14b22b 100644 --- a/uv.lock +++ b/uv.lock @@ -1,6 +1,6 @@ version = 1 revision = 3 -requires-python = ">=3.10" +requires-python = ">=3.10, <3.15" [[package]] name = "annotated-types" From 1f3d0943112778ae40d6508100817c1fc59424ad Mon Sep 17 00:00:00 2001 From: "sumup-release-bot[bot]" <241716704+sumup-release-bot[bot]@users.noreply.github.com> Date: Wed, 12 Aug 2026 21:04:24 +0000 Subject: [PATCH 3/4] chore: generate code --- sumup/memberships/resource.py | 1 + 1 file changed, 1 insertion(+) diff --git a/sumup/memberships/resource.py b/sumup/memberships/resource.py index 754419c5..908f46b2 100644 --- a/sumup/memberships/resource.py +++ b/sumup/memberships/resource.py @@ -43,6 +43,7 @@ class ListMembershipsParamsResourceParentTypeInput(typing_extensions.TypedDict, """ + class ListMemberships200Response(pydantic.BaseModel): """ ListMemberships200Response is a schema definition. From e969856a6342c0563608b05e7730af2724ddfbab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matou=C5=A1=20Dzivjak?= Date: Wed, 12 Aug 2026 23:08:14 +0200 Subject: [PATCH 4/4] fix command oreder --- .github/workflows/generate.yaml | 6 +++--- justfile | 2 +- sumup/memberships/resource.py | 1 - 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/workflows/generate.yaml b/.github/workflows/generate.yaml index 56baef60..a3072d2e 100644 --- a/.github/workflows/generate.yaml +++ b/.github/workflows/generate.yaml @@ -53,12 +53,12 @@ jobs: run: go run . samples --sdk-version-file ../sumup/_version.py --out /tmp/sumup-py-code-samples.json ../openapi.json working-directory: codegen - - name: Format - run: uv run ruff format - - name: Auto-fix run: uv run ruff check --fix + - name: Format + run: uv run ruff format + - name: Create GitHub App token id: app-token uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0 diff --git a/justfile b/justfile index ec8d06a3..fb542dfd 100644 --- a/justfile +++ b/justfile @@ -26,7 +26,7 @@ check-fix: # Generate code from OpenAPI specs [group('misc')] -generate: && fmt check-fix +generate: && check-fix fmt go -C codegen run . generate \ --out ../sumup/ \ ../openapi.json diff --git a/sumup/memberships/resource.py b/sumup/memberships/resource.py index 908f46b2..754419c5 100644 --- a/sumup/memberships/resource.py +++ b/sumup/memberships/resource.py @@ -43,7 +43,6 @@ class ListMembershipsParamsResourceParentTypeInput(typing_extensions.TypedDict, """ - class ListMemberships200Response(pydantic.BaseModel): """ ListMemberships200Response is a schema definition.