Skip to content

Commit f89a325

Browse files
committed
Merge branch 'main' into prod
2 parents 43d0634 + 907a09d commit f89a325

32 files changed

Lines changed: 1712 additions & 1879 deletions

.github/workflows/docker-latest.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ on:
66

77
env:
88
REGISTRY: ghcr.io
9-
IMAGE_NAME: jacobsalumni/membermanagement:latest
9+
IMAGE_NAME: beyondthepond/membermanagement:latest
1010
PLATFORMS: linux/amd64
1111

1212
jobs:

.github/workflows/docker-prod.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ on:
66

77
env:
88
REGISTRY: ghcr.io
9-
IMAGE_NAME: jacobsalumni/membermanagement:prod
9+
IMAGE_NAME: beyondthepond/membermanagement:prod
1010
PLATFORMS: linux/amd64
1111

1212
jobs:

.github/workflows/main.yml

Lines changed: 14 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -8,29 +8,28 @@ jobs:
88
runs-on: ubuntu-latest
99
strategy:
1010
matrix:
11-
python: ["3.10"]
12-
node: ["16"]
11+
python: ["3.13"]
12+
node: ["18"]
1313
browser: ["chrome", "firefox"]
1414

1515
steps:
1616
- uses: actions/checkout@v3
1717

1818
- name: Install Python ${{ matrix.python }}
19-
uses: actions/setup-python@v4
19+
uses: actions/setup-python@v5
2020
with:
2121
python-version: ${{ matrix.python }}
22+
23+
- name: Run 'poetry install'
24+
run: |
25+
pip install poetry
26+
poetry install
27+
2228
- name: Install Chrome Webdriver
2329
if: ${{ matrix.browser == 'chrome' }}
2430
run: |
25-
python3 -m venv venv
26-
source venv/bin/activate
27-
28-
pip install seleniumbase
2931
sudo apt-get install -y google-chrome-stable
30-
seleniumbase install chromedriver
31-
32-
deactivate
33-
rm -rf venv
32+
poetry run seleniumbase install chromedriver
3433
- name: Install Firefox Webdriver
3534
if: ${{ matrix.browser == 'firefox' }}
3635
run: |
@@ -55,22 +54,10 @@ jobs:
5554
' | sudo tee /etc/apt/preferences.d/mozilla-firefox > /dev/null
5655
sudo apt-get -y install firefox
5756
58-
59-
python3 -m venv venv
60-
source venv/bin/activate
61-
6257
sudo apt-get install -y firefox
6358
64-
pip install seleniumbase
65-
seleniumbase install geckodriver
59+
poetry run seleniumbase install geckodriver
6660
67-
deactivate
68-
rm -rf venv
69-
- name: Run 'poetry install'
70-
run: |
71-
pip install poetry
72-
poetry config virtualenvs.create false
73-
poetry install
7461
7562
- name: Install Node ${{ matrix.node }}
7663
uses: actions/setup-node@v1
@@ -83,12 +70,13 @@ jobs:
8370
run: yarn build
8471
- name: Check if 'black' has been run
8572
run:
86-
black --exclude 'migrations' --check .
73+
poetry run black --exclude 'migrations' --check .
8774
- name: Run 'pytest'
8875
env:
8976
SELENIUM_WEBDRIVER: ${{ matrix.browser }}
9077
ENABLE_GEOCACHE_TEST: '1'
91-
run: pytest --timeout=300
78+
DJANGO_SETTINGS_MODULE: 'MemberManagement.test_settings'
79+
run: poetry run pytest -n 4 --time-limit=300
9280

9381
smoke:
9482
name: Docker Smoke Test

.vscode/settings.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
{
22
"python.formatting.provider": "black",
33
"python.testing.pytestArgs": [
4-
"."
4+
".",
5+
"-n 2"
56
],
67
"python.testing.unittestEnabled": false,
78
"python.testing.pytestEnabled": true,

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ RUN git describe --always > /PORTAL_VERSION
55
RUN echo "Saved version file containing '$(cat /PORTAL_VERSION)'"
66

77
# image for building node dependencies
8-
FROM node:16-alpine AS frontend
8+
FROM node:18-alpine AS frontend
99

1010
RUN apk add --no-cache \
1111
git
@@ -23,7 +23,7 @@ ADD assets/ /app/assets/
2323
RUN yarn build
2424

2525
# image for python
26-
FROM python:3.10-alpine
26+
FROM python:3.13-alpine
2727

2828
# Install binary python dependencies
2929
RUN apk add --no-cache \

MemberManagement/docker_settings.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,3 +88,12 @@
8888
# Donation receipts
8989
PDF_RENDER_SERVER = os.environ.get("PDF_RENDER_SERVER")
9090
SIGNATURE_IMAGE = os.path.join(BASE_DIR, os.environ.setdefault("SIGNATURE_IMAGE", ""))
91+
92+
93+
STRIPE_CONTRIBUTOR_PRICE_ID = os.environ.get("STRIPE_CONTRIBUTOR_PRICE_ID")
94+
STRIPE_PATRON_PRICE_ID = os.environ.get("STRIPE_PATRON_PRICE_ID")
95+
STRIPE_STARTER_PRICE_ID = os.environ.get("STRIPE_STARTER_PRICE_ID")
96+
97+
STRIPE_CONTRIBUTOR_PRODUCT_ID = os.environ.get("STRIPE_CONTRIBUTOR_PRODUCT_ID")
98+
STRIPE_PATRON_PRODUCT_ID = os.environ.get("STRIPE_PATRON_PRODUCT_ID")
99+
STRIPE_STARTER_PRODUCT_ID = os.environ.get("STRIPE_STARTER_PRODUCT_ID")

MemberManagement/settings.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,3 +251,13 @@
251251
pass
252252

253253
SITE_ID = 1
254+
255+
# Product IDs, used for reconciling local data from Stripe data
256+
STRIPE_CONTRIBUTOR_PRODUCT_ID = "prod_SUs3ndpRDNqw9C"
257+
STRIPE_PATRON_PRODUCT_ID = "prod_SUs4SFxhRtJgV5"
258+
STRIPE_STARTER_PRODUCT_ID = "prod_S7cQEP8uPJu675"
259+
260+
# Exact price IDs, used for signups
261+
STRIPE_CONTRIBUTOR_PRICE_ID = "price_1Rc03OK8wO5tRpJk4crjyiAj"
262+
STRIPE_PATRON_PRICE_ID = "price_1Rc05JK8wO5tRpJkX3EvIcnA"
263+
STRIPE_STARTER_PRICE_ID = "price_1RDNBKK8wO5tRpJk4y3CLUAS"

MemberManagement/tests/test_access.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,6 @@
3333
+ [
3434
"registry_vote",
3535
"setup_membership",
36-
"setup_subscription",
37-
"update_subscription",
38-
"view_payments",
3936
]
4037
)
4138

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Member Management Portal
22

3-
![Build Status](https://github.com/JacobsAlumni/MemberManagement/workflows/CI/badge.svg)
3+
![Build Status](https://github.com/BeyondThePond/MemberManagement/workflows/CI/badge.svg)
44

55
The Django Application for managing Jacobs University Bremen Alumni Members.
66

@@ -91,9 +91,9 @@ See the Configuration sections of the appropriate settings to configure.
9191
### Deployment via Docker
9292

9393
It is also possible to deploy this application via [Docker](https://www.docker.com/).
94-
This repository is automatically built as a [GitHub Package](https://github.com/users/jacobsalumni/packages/container/package/membermanagement) for every push on the main and prod branches.
95-
- for the `main` branch, use `ghcr.io/jacobsalumni/membermanagement:latest`
96-
- for the `prod` branch, use `ghcr.io/jacobsalumni/membermanagement:prod`
94+
This repository is automatically built as a [GitHub Package](https://github.com/users/beyondthepond/packages/container/package/membermanagement) for every push on the main and prod branches.
95+
- for the `main` branch, use `ghcr.io/beyondthepond/membermanagement:latest`
96+
- for the `prod` branch, use `ghcr.io/beyondthepond/membermanagement:prod`
9797

9898
For Docker purposes the configuration file `MemberManagement/docker_settings.py` is used.
9999
By default, it also uses a local sqlite database.

alumni/fields/tier.py

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
from __future__ import annotations
22

3+
from MemberManagement import settings
4+
35
from .custom import CustomTextChoiceField
46

57
__all__ = ["TierField"]
@@ -10,18 +12,29 @@ class TierField(CustomTextChoiceField):
1012
CONTRIBUTOR = "co"
1113
PATRON = "pa"
1214

13-
CHOICES = (
15+
CHOICES = [
1416
(CONTRIBUTOR, "Contributor – Standard membership for 39€ p.a."),
1517
(STARTER, "Starter – Free Membership for 0€ p.a."),
1618
(PATRON, "Patron – Premium membership for 249€ p.a."),
17-
)
19+
]
1820

1921
STRIPE_IDS = {
2022
CONTRIBUTOR: "contributor-membership",
2123
STARTER: "starter-membership",
2224
PATRON: "patron-membership",
2325
}
2426

27+
STRIPE_ID_TO_TIER = {
28+
# Legacy IDs
29+
"contributor-membership": CONTRIBUTOR,
30+
"patron-membership": PATRON,
31+
"starter-membership": STARTER,
32+
# New IDs
33+
settings.STRIPE_CONTRIBUTOR_PRODUCT_ID: CONTRIBUTOR,
34+
settings.STRIPE_PATRON_PRODUCT_ID: PATRON,
35+
settings.STRIPE_STARTER_PRODUCT_ID: STARTER,
36+
}
37+
2538
@staticmethod
2639
def get_description(value):
2740
for k, v in TierField.CHOICES:
@@ -31,3 +44,9 @@ def get_description(value):
3144
@staticmethod
3245
def get_stripe_id(value):
3346
return TierField.STRIPE_IDS[value]
47+
48+
@staticmethod
49+
def get_tier_from_stripe_id(stripe_id: str) -> str:
50+
"""Maps a Stripe plan ID to a membership tier."""
51+
52+
return TierField.STRIPE_ID_TO_TIER.get(stripe_id, "Unknown")

0 commit comments

Comments
 (0)