Skip to content

CI broken on main: ECOMMERCE_DEFAULT_PAYMENT_GATEWAY declared twice, crashes every Django management command #3831

Description

@AhtishamShahid

Summary

main/settings.py declares ECOMMERCE_DEFAULT_PAYMENT_GATEWAY via get_string(...), but that name is already registered a few hundred lines earlier through import_settings_modules("mitol.payment_gateway.settings", ...), which itself calls get_string(name="ECOMMERCE_DEFAULT_PAYMENT_GATEWAY", ...).

mitol.common.envs's registry raises if the same env var name is declared twice within one process:

ValueError: Environment variable 'ECOMMERCE_DEFAULT_PAYMENT_GATEWAY' was used more than once

This currently crashes every Django management command on main (manage.py check, manage.py migrate, pytest via pytest-django, etc.), and is failing CI (python-checks and all python-tests shards) on every open PR, including #3802.

Where it was introduced

Introduced by #3810 ("Add learner refund request workflow"), which replaced:

if ECOMMERCE_DEFAULT_PAYMENT_GATEWAY == "None":  # noqa: F405
    ECOMMERCE_DEFAULT_PAYMENT_GATEWAY = MITOL_PAYMENT_GATEWAY_CYBERSOURCE

with a redundant get_string() declaration on top of it (main/settings.py:1655-1662), duplicating what mitol/payment_gateway/settings/__init__.py already declares.

Fix

Drop the redundant get_string() call in main/settings.py and keep only the "None" → CyberSource normalization that already existed before #3810.

Fix: #PR_NUMBER

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions