From 34e1fc2ef886341f0dd8f144b0a8a68648b7299d Mon Sep 17 00:00:00 2001 From: Kees Hink Date: Thu, 9 Oct 2025 10:53:41 +0200 Subject: [PATCH 1/2] Remove closing sequence from README headings According to https://github.github.com/gfm/#atx-headings these are optional, let's keep things as clean as possible. Pypi also accepts Github-flavored markdown, so this should not change rendering anywhere. --- README.md | 32 ++++++++++++++++---------------- release_process.md | 2 +- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index d633010b..92436f5d 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ Accepting [iDEAL](https://www.mollie.com/en/payments/ideal/), [Bancontact/Mister [![PyPI version](https://badge.fury.io/py/mollie-api-python.svg)](http://badge.fury.io/py/mollie-api-python) ![Tests](https://github.com/mollie/mollie-api-python/actions/workflows/tests.yaml/badge.svg) -## Requirements ## +## Requirements To use the Mollie API client, the following things are required: + Get yourself a free [Mollie account](https://my.mollie.com/dashboard/signup). No sign up costs. @@ -21,10 +21,10 @@ To use the Mollie API client, the following things are required: + Up-to-date OpenSSL (or other SSL/TLS toolkit) + Mollie API client for Python has a dependency on [Requests](http://docs.python-requests.org/en/master/) and [Requests-OAuthlib](https://requests-oauthlib.readthedocs.io/en/latest/) -## Migration to v3 ## +## Migration to v3 If your application uses a recent v2 version of the Mollie API client and you're ready to migrate to v3, [read all about the API changes](https://github.com/mollie/mollie-api-python/blob/master/v3-api-changes.md) that we made. Use the docs to quickly find how to update your integration code and use the v3 client correctly. -## Installation ## +## Installation **Please note:** If you want to install an older version of the Mollie API client (current major version is `v3`), then please refer to their respective github branches for installation instructions: - version 2.x.x is available from the [v2-develop branch](https://github.com/mollie/mollie-api-python/tree/v2-develop). - version 1.x.x is available from the [v1-develop branch](https://github.com/mollie/mollie-api-python/tree/v1-develop). @@ -63,7 +63,7 @@ export MOLLIE_PUBLIC_URL=https://some.ngrok.url.io $ python examples/app.py ``` -## How to receive payments ## +## How to receive payments To successfully receive a payment, these steps should be implemented: @@ -75,7 +75,7 @@ To successfully receive a payment, these steps should be implemented: Find our full documentation online on [docs.mollie.com](https://docs.mollie.com). -## Getting started ## +## Getting started Importing the Mollie API Client ```python @@ -109,7 +109,7 @@ For a payment create example, see [Example 1 - New Payment](https://github.com/m In general, request body parameters for an API endpoint should be added to a dictionary and provided as the first argument (or `data` keyword argument). Query string parameters can be provided as keyword arguments. -## Retrieving payments ## +## Retrieving payments We can use the `payment.id` to retrieve a payment and check if the payment `isPaid`. ```python @@ -127,13 +127,13 @@ payments = mollie_client.payments.list() For an extensive example of listing payments with the details and status, see [Example 5 - Payments History](https://github.com/mollie/mollie-api-python/blob/master/examples/05-payments-history.py). -## Payment webhook ## +## Payment webhook When the status of a payment changes the `webhookUrl` we specified in the creation of the payment will be called. There we can use the `id` from our POST parameters to check te status and act upon that, see [Example 2 - Webhook verification](https://github.com/mollie/mollie-api-python/blob/master/examples/02-webhook-verification.py). -## Multicurrency ## +## Multicurrency Since the 2.0 version of the API (supported by version 2.0.0 of the client) non-EUR payments for your customers is now supported. A full list of available currencies can be found [in our documentation](https://docs.mollie.com/guides/multicurrency). @@ -150,7 +150,7 @@ payment = mollie_client.payments.create({ ``` _After the customer completes the payment, the `payment.settlement_amount` will contain the amount + currency that will be settled on your account._ -### Fully integrated iDEAL payments ### +### Fully integrated iDEAL payments If you want to fully integrate iDEAL payments in your web site, some additional steps are required. First, you need to retrieve the list of issuers (banks) that support iDEAL and have your customer pick the issuer @@ -180,7 +180,7 @@ payment = mollie_client.payments.create({ ``` The `payment.checkout_url` is a URL that points directly to the online banking environment of the selected issuer. -### Refunding payments ### +### Refunding payments The API also supports refunding payments. Note that there is no confirmation and that all refunds are immediate and definitive. Refunds are only supported for iDEAL, credit card, Bancontact, SOFORT Banking, PayPal, Belfius Direct Net, KBC/CBC, @@ -200,7 +200,7 @@ refund = payment.refunds.create({ For a working example, see [Example 11 - Refund payment](https://github.com/mollie/mollie-api-python/blob/master/examples/11-refund-payment.py). -## OAuth2 ## +## OAuth2 At https://docs.mollie.com/oauth/getting-started the OAuth process is explained. Please read this first. @@ -232,7 +232,7 @@ The merchant can then grant the authorization to your client application for the Mollie will then redirect the merchant back to the Redirect URI you have specified. The URI will contain some query parameters, which contains the auth token. At the page listening at the Redirect URI, you should extract that token, and use it to request a regular OAuth token. -### Initializing via OAuth2 ### +### Initializing via OAuth2 You should implement the `get_token` and `set_token` methods yourself. They should retrieve and store the OAuth token that is sent from Mollie somewhere in your application (f.i. in the database). @@ -283,16 +283,16 @@ mollie_client.setup_oauth_authorization_response(authorization_response) mollie_client.organizations.get('me') ``` -## API documentation ## +## API documentation If you wish to learn more about our API, please visit the [Mollie Developer Portal](https://www.mollie.com/en/developers). API Documentation is available in English. -## Want to help us make our API client even better? ## +## Want to help us make our API client even better? Want to help us make our API client even better? We take [pull requests](https://github.com/mollie/mollie-api-python/pulls?utf8=%E2%9C%93&q=is%3Apr), sure. But how would you like to contribute to a technology oriented organization? Mollie is hiring developers and system engineers. [Check out our vacancies](https://jobs.mollie.com/) or [get in touch](mailto:personeel@mollie.com). -## License ## +## License [BSD (Berkeley Software Distribution) License](https://opensource.org/licenses/bsd-license.php). Copyright (c) 2014-2022, Mollie B.V. -## Support ## +## Support Contact: [www.mollie.com](https://www.mollie.com) — info@mollie.com — +31 20 820 20 70 diff --git a/release_process.md b/release_process.md index e4e00f22..d0519684 100644 --- a/release_process.md +++ b/release_process.md @@ -1,4 +1,4 @@ -## Release Process ## +## Release Process To create a release there are a few steps you should follow: - We use [Semantic Versioning](https://semver.org/). If you're going to release a breaking change or a major new feature, do a minor version bump (x.y.z => x.y+1.z). Otherwise, do a patch version bump (x.y.z => x.y.z+1). - If you decide to do a minor version change, handle deprecations. See (Pending)DeprecationWarning subclasses in `error.py`. From 6cfc5f0425204d219ec02d34765aed9b406d5259 Mon Sep 17 00:00:00 2001 From: Kees Hink Date: Thu, 9 Oct 2025 11:50:37 +0200 Subject: [PATCH 2/2] Replace Makefile with tox setup in pyproject.toml We can now remove the Makefile: - tox does our testing - GitHub Actions creates releases - there's no need for a virtualenv anymore Note that we remove the `safety` step, that's still run in CI (tests.yaml). --- DEVELOPMENT.md | 24 ++++++++++++++++++++ Makefile | 59 -------------------------------------------------- README.md | 8 ++++++- pyproject.toml | 32 +++++++++++++++++++++++++++ 4 files changed, 63 insertions(+), 60 deletions(-) create mode 100644 DEVELOPMENT.md delete mode 100644 Makefile diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md new file mode 100644 index 00000000..b20867f6 --- /dev/null +++ b/DEVELOPMENT.md @@ -0,0 +1,24 @@ +# Development + +## Running tests locally + +To run tests locally, install [tox](https://tox.wiki/) using [uv](https://docs.astral.sh/uv/) +with [tox-uv](https://github.com/tox-dev/tox-uv): + +```bash +uv tool install tox --with tox-uv +``` + +Install Python versions: + +```bash +uv python install 3.8 3.9 3.10 3.11 3.12 +``` + +To run tests for all Python versions: + +```shell +tox +``` + +TODO: Deduplicate Python version list in [tests.yaml](.github/workflows/tests.yaml) diff --git a/Makefile b/Makefile deleted file mode 100644 index 18fdc423..00000000 --- a/Makefile +++ /dev/null @@ -1,59 +0,0 @@ -# use virtualenv or virtualenv-wrapper location based on availability -ifdef WORKON_HOME - VIRTUALENV = $(WORKON_HOME)/mollie-api-python -endif -ifndef VIRTUALENV - VIRTUALENV = $(PWD)/env -endif - -PYTHON_VERSION = 3.8 -PYTHON = $(VIRTUALENV)/bin/python - - -.PHONY: virtualenv -virtualenv: $(VIRTUALENV) # alias -$(VIRTUALENV): - $(shell which python$(PYTHON_VERSION)) -m venv $(VIRTUALENV) - $(PYTHON) -m pip install --upgrade pip setuptools wheel - - -.PHONY: develop -develop: mollie_api_python.egg-info # alias -mollie_api_python.egg-info: virtualenv - $(PYTHON) -m pip install -r test_requirements.txt - $(PYTHON) -m pip install -e . - - -.PHONY: test -test: develop - $(PYTHON) -m flake8 - $(PYTHON) -m mypy --config mypy.ini mollie/ - $(PYTHON) -m pytest - # Jinja, https://data.safetycli.com/v/70612/97c - $(PYTHON) -m safety check --ignore 70612 - - -dist/mollie_api_python-*-py3-none-any.whl: virtualenv - $(PYTHON) -m pip install --upgrade build - $(PYTHON) -m build --wheel - - -dist/mollie-api-python-*.tar.gz: virtualenv - $(PYTHON) -m pip install --upgrade build - $(PYTHON) -m build --sdist - - -.PHONY: build -build: dist/mollie_api_python-*-py3-none-any.whl dist/mollie-api-python-*.tar.gz - - -.PHONY: clean -clean: - rm -f -r build/ dist/ htmlcov/ .eggs/ mollie_api_python.egg-info .pytest_cache .mypy_cache - find . -type f -name '*.pyc' -delete - find . -type d -name __pycache__ -delete - - -.PHONY: realclean -realclean: clean - rm -f -r $(VIRTUALENV) diff --git a/README.md b/README.md index 92436f5d..460ad2bf 100644 --- a/README.md +++ b/README.md @@ -288,7 +288,13 @@ If you wish to learn more about our API, please visit the [Mollie Developer Port ## Want to help us make our API client even better? -Want to help us make our API client even better? We take [pull requests](https://github.com/mollie/mollie-api-python/pulls?utf8=%E2%9C%93&q=is%3Apr), sure. But how would you like to contribute to a technology oriented organization? Mollie is hiring developers and system engineers. [Check out our vacancies](https://jobs.mollie.com/) or [get in touch](mailto:personeel@mollie.com). +Want to help us make our API client even better? +We take [pull requests](https://github.com/mollie/mollie-api-python/pulls?utf8=%E2%9C%93&q=is%3Apr), sure. +Check out [DEVELOPMENT.md](./DEVELOPMENT.md). + +But how would you like to contribute to a technology oriented organization? +Mollie is hiring developers and system engineers. +[Check out our vacancies](https://jobs.mollie.com/) or [get in touch](mailto:personeel@mollie.com). ## License [BSD (Berkeley Software Distribution) License](https://opensource.org/licenses/bsd-license.php). diff --git a/pyproject.toml b/pyproject.toml index cfcd5a9f..cd477b95 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -22,3 +22,35 @@ exclude_lines = [ "pragma: no cover", "if TYPE_CHECKING:", ] + +[tool.tox] +requires = ["tox>=4.19"] +env_list = ["flake8", "3.12", "3.11", "3.10", "3.9", "3.8", "type"] + +[tool.tox.env_run_base] +description = "Run tests under {base_python}" +deps = [ + "pytest", + "pytest-cov", + "pytest-mock", + "mock", + "responses", +] +commands = [["pytest"]] + +[tool.tox.env.type] +description = "Run type check" +deps = [ + "mypy", + "types-requests", +] +commands = [["mypy", "--config", "mypy.ini", "mollie"]] + +[tool.tox.env.flake8] +description = "Run codestyle check" +deps = [ + "flake8", + "flake8-isort", + "flake8-black", +] +commands = [["flake8", "mollie"]]