Changes to payment models #32

Merged
valberg merged 35 commits from benjaoming/membersystem:payment-updates into main 2024-08-03 17:55:33 +00:00
Owner

Flagging incoming changes, no actions required.

This is stuff I consider "MVP", as in what we need urgently to send out payment links to members and receive payments via Stripe.

  • Allow products, orders etc
  • Define several products per membership type
  • Possibility to create a membership BEFORE it's paid
  • Mark memberships active when payments are received
  • Create membership history for each member (via Django admin)
  • Efficiently mark members in a list and choose "create for current year with an unpaid order" (Django Admin actions)
  • Order payment page w/ Stripe integration
  • Send email with order payment link
  • Send payment confirmation emails
  • Re-generate migrations
Flagging incoming changes, no actions required. This is stuff I consider "MVP", as in what we need urgently to send out payment links to members and receive payments via Stripe. - [x] Allow products, orders etc - [x] Define several products per membership type - [x] Possibility to create a membership BEFORE it's paid - [x] Mark memberships active when payments are received - [x] Create membership history for each member (via Django admin) - [x] Efficiently mark members in a list and choose "create <membership type> for current year with an unpaid order" (Django Admin actions) - [x] Order payment page w/ Stripe integration - [ ] Send email with order payment link - [ ] Send payment confirmation emails - [x] Re-generate migrations
benjaoming added 1 commit 2024-07-14 16:13:29 +00:00
benjaoming added 2 commits 2024-07-21 11:42:10 +00:00
benjaoming added 1 commit 2024-07-21 14:10:54 +00:00
Admin for Member model, not for User
Some checks failed
continuous-integration/drone/pr Build is failing
5055095c6b
benjaoming added 7 commits 2024-07-21 17:09:12 +00:00
benjaoming added 1 commit 2024-07-22 14:49:38 +00:00
Fix some admin columms
Some checks failed
continuous-integration/drone/pr Build is failing
d9de265de9
benjaoming added 3 commits 2024-07-25 22:58:04 +00:00
Author
Owner

An update: I've added a list of tasks in the description. This is getting nearer. If possible, I would consider to deploy some of the changes early so it's possible to add memberships and get things tested early.

An update: I've added a list of tasks in the description. This is getting nearer. If possible, I would consider to deploy some of the changes early so it's possible to add memberships and get things tested early.
benjaoming added 1 commit 2024-07-28 08:55:55 +00:00
Add dynamic admin actions for bulk creating memberships
Some checks failed
continuous-integration/drone/pr Build is failing
3193cafe4b
benjaoming added 2 commits 2024-07-28 16:56:28 +00:00
benjaoming added 1 commit 2024-07-28 20:39:36 +00:00
Bootstrap an Order detail page
Some checks failed
continuous-integration/drone/pr Build is failing
6bf42ecba3
benjaoming added 1 commit 2024-07-28 21:28:17 +00:00
Add details to order page
Some checks failed
continuous-integration/drone/pr Build is failing
e2f4a66645
Author
Owner
image
<img width="1004" alt="image" src="/attachments/8b97b849-8648-41bb-af76-c6a2e25977c9">
benjaoming added 1 commit 2024-07-29 22:24:33 +00:00
Add Stripe to requirements
Some checks failed
continuous-integration/drone/pr Build is failing
78b3264bb6
benjaoming added 2 commits 2024-07-30 23:03:05 +00:00
benjaoming added 1 commit 2024-07-31 19:35:39 +00:00
benjaoming added 2 commits 2024-07-31 22:34:25 +00:00
benjaoming reviewed 2024-07-31 22:34:59 +00:00
@ -23,6 +23,8 @@ dependencies = [
"django-registries==0.0.3",
"django-view-decorator==0.0.4",
"django-oauth-toolkit~=2.4",
"django_stubs_ext~=5.0",
Author
Owner

Noting that this got reintroduced... I don't use it... but is it used? Or did you remove it on purpose @valberg ?

Noting that this got reintroduced... I don't use it... but is it used? Or did you remove it on purpose @valberg ?
Owner

I did not do it on purpose no 😊 my all means remove it if it is isn't being used

I did not do it on purpose no 😊 my all means remove it if it is isn't being used
Author
Owner

Oh god now I know what's going on... it's for the mypy django-stubs thing...

Yes, we need it for running mypy with Django. I think I spend 2 minutes to get it working. But I didn't actually fix any errors. I think we can keep it for now and then we should open an issue if we want to keep using it.

Or we can decide that we don't want to spend time on this because it doesn't find any real issues.

Oh god now I know what's going on... it's for the mypy django-stubs thing... Yes, we need it for running mypy with Django. I think I spend 2 minutes to get it working. But I didn't actually fix any errors. I think we can keep it for now and then we should open an issue if we want to keep using it. Or we can decide that we don't want to spend time on this because it doesn't find any real issues.
Author
Owner

#37

https://git.data.coop/data.coop/membersystem/issues/37
benjaoming marked this conversation as resolved
benjaoming reviewed 2024-07-31 22:35:35 +00:00
pyproject.toml Outdated
@ -67,3 +69,3 @@
no-cov = "cov --no-cov {args}"
typecheck = "mypy --config-file=pyproject.toml ."
requirements = "hatch env run --env default -- python --version; hatch env run --env dev -- python --version"
requirements = "pip-compile pyproject.toml"
Author
Owner

Isn't this the correct way @valberg ?

Isn't this the correct way @valberg ?
Owner

Yeah the one being removed is the "correct" way which I found at https://github.com/juftin/hatch-pip-compile/blob/main/docs/upgrading.md

Yeah the one being removed is the "correct" way which I found at https://github.com/juftin/hatch-pip-compile/blob/main/docs/upgrading.md
Author
Owner

I get this error when running it: LockFileError: Could not find lock file python version

image
I get this error when running it: `LockFileError: Could not find lock file python version` <img width="687" alt="image" src="/attachments/26d96dfc-0f57-4606-b140-f8d10be6aea4">
132 KiB
Author
Owner

Maybe that error is because the old "requirements.txt" I had didn't specify the Python version using the same string pattern 🤪

Notably when this was changed, the command started working:

-# This file is autogenerated by pip-compile with Python 3.12
-# by the following command:
+# This file is autogenerated by hatch-pip-compile with Python 3.12

After that, it started working.

Maybe that error is because the old "requirements.txt" I had didn't specify the Python version using the same string pattern 🤪 Notably when this was changed, the command started working: ``` -# This file is autogenerated by pip-compile with Python 3.12 -# by the following command: +# This file is autogenerated by hatch-pip-compile with Python 3.12 ``` After that, it started working.
Author
Owner

I've restored it... hatch env run --env default -- python --version; hatch env run --env dev -- python --version is really incomprehensible compared to the old version, also funny that hatch run dev:requirements spawns another hatch command in another environment - but I guess that it's just part of some magic that Just Works.

I've restored it... `hatch env run --env default -- python --version; hatch env run --env dev -- python --version` is really incomprehensible compared to the old version, also funny that `hatch run dev:requirements` spawns another hatch command in another environment - but I guess that it's just part of some magic that Just Works.
benjaoming marked this conversation as resolved
benjaoming reviewed 2024-07-31 22:36:15 +00:00
@ -13,3 +13,3 @@
]
dependencies = [
"Django~=5.0",
"Django>=5.1b1,<5.2",
Author
Owner

It should be okay to use the new Django 5.1... then we can help out if we discover a bug :) it's rc1 now...

It should be okay to use the new Django 5.1... then we can help out if we discover a bug :) it's rc1 now...
benjaoming marked this conversation as resolved
benjaoming reviewed 2024-07-31 22:36:59 +00:00
@ -25,6 +28,8 @@ CSRF_TRUSTED_ORIGINS = env.list(
ADMINS = [tuple(x.split(":")) for x in env.list("DJANGO_ADMINS", default=[])]
DEFAULT_FROM_EMAIL = "server@data.coop"
Author
Owner

This is important for sending error 500 emails because often the default "@localhost" will not succeed.

This is important for sending error 500 emails because often the default "@localhost" will not succeed.
benjaoming marked this conversation as resolved
benjaoming reviewed 2024-07-31 22:37:30 +00:00
src/pytest.ini Outdated
@ -2,4 +0,0 @@
testpaths = .
python_files = tests.py test_*.py *_tests.py
DJANGO_SETTINGS_MODULE = project.settings
#norecursedirs = dist tmp* .svn .*
Author
Owner

This belongs in pyproject.toml now

This belongs in pyproject.toml now
valberg marked this conversation as resolved
benjaoming reviewed 2024-07-31 22:41:29 +00:00
@ -5,3 +6,4 @@
from django.utils.translation import gettext_lazy as _
from environs import Env
django_stubs_ext.monkeypatch()
Author
Owner

This is where django-stubs is used. It's said to be "production safe" :)

This is where django-stubs is used. It's said to be "production safe" :)
Owner

Ah yes! I can vouch for it - we use it at $WORK without issues

Ah yes! I can vouch for it - we use it at $WORK without issues
Author
Owner

Nice! I'm gonna vouch that we keep it for now and see if we'll start using mypy checks or not... now at least, it can be run.

Nice! I'm gonna vouch that we keep it for now and see if we'll start using mypy checks or not... now at least, it can be run.
Author
Owner

#37

https://git.data.coop/data.coop/membersystem/issues/37
benjaoming marked this conversation as resolved
benjaoming added 1 commit 2024-07-31 22:59:26 +00:00
Merge branch 'main' of git.data.coop:data.coop/membersystem into payment-updates
Some checks failed
continuous-integration/drone/pr Build is failing
17e5f969af
Author
Owner

All the merge conflicts took the air out of the balloon.. gonna continue tomorrow and ping you once the last couple of items are solved @valberg

(however, I think that I would prefer to add the email stuff in a follow-up PR because it's gonna be sent async anyways.. so we can always send folks a confirmation email later, as long as we store the data in the db)

All the merge conflicts took the air out of the balloon.. gonna continue tomorrow and ping you once the last couple of items are solved @valberg (however, I think that I would prefer to add the email stuff in a follow-up PR because it's gonna be sent async anyways.. so we can always send folks a confirmation email later, as long as we store the data in the db)
benjaoming added 1 commit 2024-08-01 10:51:37 +00:00
Reduce amount of migrations
Some checks failed
continuous-integration/drone/pr Build is failing
0a74f62627
benjaoming added 1 commit 2024-08-01 10:52:29 +00:00
Example API key doesn't need to look like a secret
Some checks failed
continuous-integration/drone/pr Build is failing
b9deb3f54e
benjaoming added 1 commit 2024-08-01 10:57:36 +00:00
Clean up README
Some checks failed
continuous-integration/drone/pr Build is failing
37719191b7
benjaoming added 1 commit 2024-08-01 11:04:55 +00:00
Re-instate updated pip-compile command, regenerate requirements*.txt
Some checks failed
continuous-integration/drone/pr Build is failing
037c204411
benjaoming changed title from WIP: Changes to payment models to Changes to payment models 2024-08-01 12:14:15 +00:00
benjaoming requested review from valberg 2024-08-01 12:14:24 +00:00
benjaoming added 1 commit 2024-08-01 14:20:16 +00:00
Remove duped definition of DEFAULT_FROM_EMAIL
Some checks failed
continuous-integration/drone/pr Build is failing
ba55d18e5b
benjaoming added 1 commit 2024-08-01 15:06:16 +00:00
Update success message
Some checks failed
continuous-integration/drone/pr Build is failing
5a8e036dd1
valberg added 1 commit 2024-08-02 22:59:55 +00:00
Update Makefile
Some checks failed
continuous-integration/drone/pr Build is failing
c809e5652c
benjaoming added 1 commit 2024-08-03 10:56:51 +00:00
Merge branch 'main' of git.data.coop:data.coop/membersystem into payment-updates
Some checks failed
continuous-integration/drone/pr Build is failing
9326c77736
valberg approved these changes 2024-08-03 11:16:06 +00:00
Author
Owner

Are you getting ready to deploy? I'm on parental duties today, but I'll have some time in the evening if there's something bork'ed.

In case it deploys and works well, I can start to put data in the system (products, MembershipTypes, generate orders etc).

If you can confirm that send_mail works, I'll also start to work on a change that can send out payment links to members. In parallel to that, I'll give some test bunnies from the board a payment link so we know it works :)

Are you getting ready to deploy? I'm on parental duties today, but I'll have some time in the evening if there's something bork'ed. In case it deploys and works well, I can start to put data in the system (products, MembershipTypes, generate orders etc). If you can confirm that `send_mail` works, I'll also start to work on a change that can send out payment links to members. In parallel to that, I'll give some test bunnies from the board a payment link so we know it works :)
Owner

@benjaoming I can do the deploy tonight

@benjaoming I can do the deploy tonight
valberg merged commit 4254baf09d into main 2024-08-03 17:55:33 +00:00
valberg referenced this pull request from a commit 2024-08-03 17:55:35 +00:00
benjaoming deleted branch payment-updates 2024-08-03 20:57:47 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: data.coop/membersystem#32
No description provided.