-
Notifications
You must be signed in to change notification settings - Fork 2
Issue #129: Updated payment method display in the profile registrations list, added a method column to the Payment model, updated save payment code for registration and membership features.
#131
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 2 commits
be343b7
3d505e3
04ebead
e7f7280
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,15 +1,15 @@ | ||
| # @changed 2024.03.28, 15:18 | ||
| # @changed 2024.04.06, 19:55 | ||
|
|
||
| - model: dds_registration.event | ||
| pk: 1 | ||
| fields: | ||
| id: 1 | ||
| code: 'first' | ||
| title: 'The first event' | ||
| description: 'First event description' | ||
| description: 'The first event description' | ||
| success_email: 'dmia@yandex.ru' | ||
| public: 1 | ||
| registration_open: '2024-03-25' | ||
| registration_close: '2024-04-20' | ||
| registration_open: '2024-04-06' | ||
| registration_close: '2024-04-25' | ||
| max_participants: 5 | ||
| payment_deadline_days: 30 | ||
| payment_details: '' | ||
| refund_last_day: '2024-04-30' |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,19 +1,19 @@ | ||
| # @changed 2024.03.28, 15:18 | ||
| # @changed 2024.04.06, 19:59 | ||
|
|
||
| - model: dds_registration.registrationoption | ||
| pk: 1 | ||
| fields: | ||
| id: 1 | ||
| item: 'Registration' | ||
| price: 100 | ||
| currency: 'USD' | ||
| currency: 'CHF' | ||
| event_id: 1 | ||
|
|
||
| - model: dds_registration.registrationoption | ||
| pk: 2 | ||
| fields: | ||
| id: 2 | ||
| item: 'T-Shirt' | ||
| price: 10 | ||
| price: 19 | ||
| currency: 'USD' | ||
| event_id: 1 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| # @changed 2024.04.06, 20:05 | ||
|
|
||
| - model: dds_registration.payment | ||
| pk: 1 | ||
| fields: | ||
| id: 1 | ||
| created: '2024-04-06' | ||
| updated: '2024-04-06' | ||
| status: 'CREATED' | ||
| data: '{"user": {"id": 2, "name": "John Lennon", "address": "251 Menlove Avenue, Liverpool, Merseyside L25 7SA, UK"}, "extra": "", "kind": "event", "method": "STRIPE", "event": {"id": 1, "title": "The first event"}, "registration": {"id": 1}, "option": {"id": 1, "item": "Registration"}, "price": 100.0, "currency": "CHF"}' |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,13 +1,13 @@ | ||
| # @changed 2024.03.28, 21:07 | ||
| # @changed 2024.04.06, 20:01 | ||
|
|
||
| - model: dds_registration.registration | ||
| pk: 1 | ||
| fields: | ||
| id: 1 | ||
| status: 'SUBMITTED' | ||
| created_at: '2024-03-28 20:00:00.000000' | ||
| updated_at: '2024-03-28 20:00:00.000000' | ||
| created_at: '2024-04-06 19:59:46.154852' | ||
| updated_at: '2024-04-06 19:59:46.167242' | ||
| event_id: 1 | ||
| invoice_id: null | ||
| payment_id: 1 | ||
| user_id: 2 | ||
| option_id: 1 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| # Generated by Django 5.0.3 on 2024-04-06 20:25 | ||
|
|
||
| from django.db import migrations, models | ||
|
|
||
|
|
||
| class Migration(migrations.Migration): | ||
|
|
||
| dependencies = [ | ||
| ('dds_registration', '0002_remove_event_refund_window_days_and_more'), | ||
| ] | ||
|
|
||
| operations = [ | ||
| migrations.AddField( | ||
| model_name='payment', | ||
| name='method', | ||
| field=models.TextField(choices=[('STRIPE', 'Credit Card (Stripe - costs 2-4% more due to credit card fees)'), ('INVOICE', 'Bank Transfer (Invoice)')], default='INVOICE'), | ||
| ), | ||
| ] |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -28,6 +28,7 @@ def membership_application(request: HttpRequest): | |
| form = MembershipForm(request.POST) | ||
|
|
||
| if form.is_valid(): | ||
| payment_method = form.cleaned_data["payment_method"] | ||
| payment = Payment( | ||
| status="CREATED", | ||
| data={ | ||
|
|
@@ -41,7 +42,7 @@ def membership_application(request: HttpRequest): | |
| "membership": { | ||
| "type": form.cleaned_data["membership_type"], | ||
| }, | ||
| "method": form.cleaned_data["payment_method"], | ||
| "method": payment_method, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What is the idea behind this change? You create a variable to only use it once. I suggest reverting this change. |
||
| "price": MEMBERSHIP_DATA[form.cleaned_data["membership_type"]]["price"], | ||
| "currency": MEMBERSHIP_DATA[form.cleaned_data["membership_type"]]["currency"], | ||
| }, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -45,5 +45,3 @@ | |
| </div> | ||
| {% endfor %} | ||
| </fieldset> | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -51,7 +51,7 @@ | |
| </td> | ||
| <td class="col-payment"> | ||
| {% if payment %} | ||
| {{ payment.get_payment_method_display }} | ||
| {{ payment.get_method_display }} | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We can add a method to |
||
| {% endif %} | ||
| </td> | ||
| <td class="col-paid"> | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please revert this, we already store this in
data:There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't agree with this (hiding data in hard-to-access entities isn't a good coding approach), but ok: going to create helpers to extract them from there.