-
Notifications
You must be signed in to change notification settings - Fork 45
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
Implement schedule task to collect billing invoice #417
Merged
mariobehling
merged 80 commits into
fossasia:development
from
lcduong:feat-383-implement-schedule-task
Nov 21, 2024
Merged
Changes from 55 commits
Commits
Show all changes
80 commits
Select commit
Hold shift + click to select a range
33c32e1
Implement schedule task to collect billing invoice
fb65f1f
consider sourcery-ai and fix isort
75a08f6
Implement billing settings form for organizer
odkhang b0d7932
Resolve conflict
odkhang 9b499db
Fix flake8 in pipeline
odkhang a17173a
implement create and save payment_information
odkhang 055b2d7
Fix isort, flake8 in pipeline
odkhang b7dbc11
Merge branch 'development' into feat-383-implement-schedule-task
045bfe4
implement payment-information-v1
odkhang e7510d2
src/pretix/control/views/organizer_views/organizer_view.py
odkhang 0c4b5f6
Code refactoring
odkhang f596f95
Code refactoring
odkhang ede87ff
Remove payment_information attribute
odkhang eb22165
Implement tax validation
odkhang 8cf14e5
Update code
odkhang 25f70a9
Update code
odkhang abc5731
Fix flake8 in pipeline
odkhang dbf24b2
Add pyvat package
odkhang 7b1fe49
Fix flake8 in pipeline
odkhang 27b71a6
Latest code
odkhang 063d2a6
Fix flake8 in pipeline
odkhang c4b9ce5
Add logger error
odkhang 7133019
Fix flake8 in pipeline
odkhang 891d3e8
implement trigger invoice to organizer
723ce29
Merge remote-tracking branch 'upstream/feat-383-implement-schedule-ta…
odkhang 9a5929c
Merge branch 'development' into feature-380
odkhang 35f3376
Merge branch 'development' into feature-380
odkhang 3d4249a
Fix conflict pretix/base/migration
odkhang 072ef08
Merge branch 'feature-380' of github.com:odkhang/eventyay-tickets int…
odkhang edd7d64
Implement auto billing charge
odkhang 97fbc9c
Merge branch 'development' into feature-380
odkhang 8b5f87e
Fix conflict pretix base migration
odkhang 17064b1
Update pretix base migration
odkhang db4f7b2
Add logging information and modify error logging
odkhang fa91edd
Merge branch 'feature-380' into feature-380-v3
odkhang d7d0ea9
Merge remote-tracking branch 'upstream/feature-380' into feat-383-imp…
3fb85e2
Implement auto billing charge
odkhang 022a8fb
update schedule task
odkhang 5fdbe3d
Merge branch 'development' into feat-383-implement-schedule-task
odkhang c2c8524
fix isort, flake8 and update branch
odkhang c6f5fdd
fix isort pipeline
lcduong 582f94b
Merge remote-tracking branch 'upstream/feature-380-v3' into feat-383-…
lcduong f70b561
Implement automatic payment charging
odkhang 1d20c45
update invoice template
lcduong 2b932f5
Merge remote-tracking branch 'upstream/feature-380-v3' into feat-383-…
lcduong b0faf51
change var name, format code
lcduong bd8dfc4
Implement automatic payment charging
odkhang 9922347
Merge remote-tracking branch 'upstream/feature-383' into feat-383-imp…
lcduong 3a1118b
Add comment
odkhang 26e10d4
Merge remote-tracking branch 'upstream/feature-383' into feat-383-imp…
lcduong 7605c38
Implement show error message
odkhang 7abf71c
Merge remote-tracking branch 'upstream/feature-383' into feat-383-imp…
lcduong e19de5c
handle case update invoice to expired
lcduong 67be7eb
fix isort, flake8 pipeline
lcduong ffcf3f5
Update api to trigger billing task for testing
lcduong 3b19d22
Implement stripe webhook secret key in global setting
odkhang 5d5e638
Add comment,save tax_id, show error and sucess message
odkhang 9afbad4
Merge remote-tracking branch 'upstream/feature-383' into feat-383-imp…
lcduong 8f48821
Merge remote-tracking branch 'upstream/feature-380' into feat-383-imp…
lcduong e555acd
handle case get mail backend for global settings
lcduong 0673121
fix isort pipeline
lcduong 4eee5a7
fix sending custom mail smtp
lcduong 62f7bf7
tickets fee should be calculated based on net amount
lcduong b04b50f
remove unsed import to fix pipeline
lcduong 2e7cfd3
correct import to fix isort
lcduong 13b2944
Update code
odkhang 38154c7
Fix flake8 in pipeline
odkhang ea52541
Merge branch 'development' into feature-380
odkhang 8512f8c
Update code
odkhang 4aa0e3c
Update code
odkhang e41650b
Update code
odkhang aa86746
fix flake8 in pipeline
odkhang f76094a
move validation to clean method and move get_country_name to countrie…
odkhang ddde2c6
Merge remote-tracking branch 'upstream/feature-380' into feat-383-imp…
lcduong 80e1fe1
Merge branch 'development' into feat-383-implement-schedule-task
lcduong 5ed3a49
formar code
lcduong 14a7b09
Merge branch 'development' into feat-383-implement-schedule-task
odkhang 4cc2bb8
Merge branch 'development' into feat-383-implement-schedule-task
lcduong fe0627b
merge migration file
lcduong 1ef5f46
fix isort
lcduong File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
[program:pretixtask] | ||
command=/usr/local/bin/pretix taskbeat | ||
autostart=true | ||
autorestart=true | ||
priority=5 | ||
user=pretixuser | ||
stdout_logfile=/dev/fd/1 | ||
stdout_logfile_maxbytes=0 | ||
stderr_logfile=/dev/fd/2 | ||
stderr_logfile_maxbytes=0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
...etix/base/migrations/0003_alter_cachedcombinedticket_id_alter_cachedticket_id_and_more.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# Generated by Django 5.1.2 on 2024-10-31 09:30 | ||
|
||
import django.db.models.deletion | ||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("pretixbase", "0003_event_is_video_creation_and_more"), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name="OrganizerBillingModel", | ||
fields=[ | ||
( | ||
"id", | ||
models.BigAutoField( | ||
auto_created=True, primary_key=True, serialize=False | ||
), | ||
), | ||
("primary_contact_name", models.CharField(max_length=255)), | ||
("primary_contact_email", models.EmailField(max_length=255)), | ||
("company_or_organization_name", models.CharField(max_length=255)), | ||
("address_line_1", models.CharField(max_length=255)), | ||
("address_line_2", models.CharField(max_length=255)), | ||
("city", models.CharField(max_length=255)), | ||
("zip_code", models.CharField(max_length=255)), | ||
("country", models.CharField(max_length=255)), | ||
("preferred_language", models.CharField(max_length=255)), | ||
("tax_id", models.CharField(max_length=255)), | ||
("stripe_customer_id", models.CharField(max_length=255, null=True)), | ||
( | ||
"stripe_payment_method_id", | ||
models.CharField(max_length=255, null=True), | ||
), | ||
("stripe_setup_intent_id", models.CharField(max_length=255, null=True)), | ||
( | ||
"organizer", | ||
models.ForeignKey( | ||
on_delete=django.db.models.deletion.CASCADE, | ||
related_name="billing", | ||
to="pretixbase.organizer", | ||
), | ||
), | ||
], | ||
), | ||
] |
49 changes: 49 additions & 0 deletions
49
src/pretix/base/migrations/0003_create_billing_invoice_table.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# Generated by Django 5.1.2 on 2024-10-29 04:33 | ||
|
||
import datetime | ||
|
||
import django.contrib.postgres.fields | ||
import django.db.models.deletion | ||
from django.db import migrations, models | ||
|
||
import pretix.base.models.base | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('pretixbase', '0003_alter_cachedcombinedticket_id_alter_cachedticket_id_and_more'), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='BillingInvoice', | ||
fields=[ | ||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False)), | ||
('status', models.CharField(default='n', max_length=1)), | ||
('amount', models.DecimalField(decimal_places=2, max_digits=10)), | ||
('currency', models.CharField(max_length=3)), | ||
('ticket_fee', models.DecimalField(decimal_places=2, max_digits=10)), | ||
('payment_method', models.CharField(max_length=20, null=True)), | ||
('paid_datetime', models.DateTimeField(blank=True, null=True)), | ||
('note', models.TextField(null=True)), | ||
('monthly_bill', models.DateField(default=datetime.date.today)), | ||
('created_at', models.DateTimeField(auto_now_add=True)), | ||
('created_by', models.CharField(max_length=50)), | ||
('updated_at', models.DateTimeField(auto_now=True)), | ||
('updated_by', models.CharField(max_length=50)), | ||
('last_reminder_datetime', models.DateTimeField(blank=True, null=True)), | ||
('next_reminder_datetime', models.DateTimeField(blank=True, null=True)), | ||
('reminder_schedule', django.contrib.postgres.fields.ArrayField(base_field=models.IntegerField(), default=list, size=None)), | ||
('reminder_enabled', models.BooleanField(default=True)), | ||
('event', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='pretixbase.event')), | ||
('organizer', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='pretixbase.organizer')), | ||
], | ||
options={ | ||
'verbose_name': 'Billing Invoice', | ||
'verbose_name_plural': 'Billing Invoices', | ||
'ordering': ('-created_at',), | ||
}, | ||
bases=(models.Model, pretix.base.models.base.LoggingMixin), | ||
), | ||
] |
18 changes: 18 additions & 0 deletions
18
src/pretix/base/migrations/0004_billinginvoice_stripe_payment_intent_id_and_more.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Generated by Django 5.1.2 on 2024-11-05 04:08 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("pretixbase", "0003_create_billing_invoice_table"), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name="billinginvoice", | ||
name="stripe_payment_intent_id", | ||
field=models.CharField(max_length=50, null=True), | ||
) | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
from datetime import date | ||
|
||
from django.contrib.postgres.fields import ArrayField | ||
from django.db import models | ||
from django.utils.translation import gettext_lazy as _ | ||
from django_scopes import ScopedManager | ||
|
||
from pretix.base.models import LoggedModel | ||
|
||
|
||
class BillingInvoice(LoggedModel): | ||
STATUS_PENDING = "n" | ||
STATUS_PAID = "p" | ||
STATUS_EXPIRED = "e" | ||
STATUS_CANCELED = "c" | ||
|
||
STATUS_CHOICES = [ | ||
(STATUS_PENDING, _("pending")), | ||
(STATUS_PAID, _("paid")), | ||
(STATUS_EXPIRED, _("expired")), | ||
(STATUS_CANCELED, _("canceled")), | ||
] | ||
|
||
organizer = models.ForeignKey('Organizer', on_delete=models.CASCADE) | ||
# organizer_billing = models.ForeignKey('OrganizerBilling', on_delete=models.CASCADE) | ||
event = models.ForeignKey('Event', on_delete=models.CASCADE) | ||
|
||
status = models.CharField(max_length=1, choices=STATUS_CHOICES, default=STATUS_PENDING) | ||
amount = models.DecimalField(max_digits=10, decimal_places=2) | ||
currency = models.CharField(max_length=3) | ||
|
||
ticket_fee = models.DecimalField(max_digits=10, decimal_places=2) | ||
payment_method = models.CharField(max_length=20, null=True, blank=True) | ||
paid_datetime = models.DateTimeField(null=True, blank=True) | ||
note = models.TextField(null=True, blank=True) | ||
|
||
monthly_bill = models.DateField(default=date.today) | ||
created_at = models.DateTimeField(auto_now_add=True) | ||
created_by = models.CharField(max_length=50) | ||
updated_at = models.DateTimeField(auto_now=True) | ||
updated_by = models.CharField(max_length=50) | ||
|
||
last_reminder_datetime = models.DateTimeField(null=True, blank=True) | ||
next_reminder_datetime = models.DateTimeField(null=True, blank=True) | ||
reminder_schedule = ArrayField( | ||
models.IntegerField(), | ||
default=list, # Sets the default to an empty list | ||
blank=True, | ||
help_text="Days after creation for reminders, e.g., [14, 28]" | ||
) | ||
reminder_enabled = models.BooleanField(default=True) | ||
stripe_payment_intent_id = models.CharField(max_length=50, null=True, blank=True) | ||
|
||
objects = ScopedManager(organizer='organizer') | ||
|
||
class Meta: | ||
verbose_name = "Billing Invoice" | ||
verbose_name_plural = "Billing Invoices" | ||
ordering = ("-created_at",) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Let introduce only 1 DB migration file, to not inflate the number.
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 solved it, only 1 migration file now for new table creation.