-
Notifications
You must be signed in to change notification settings - Fork 48
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 voucher per event and for all events of an organizer: apply voucher in billing setting #488
base: development
Are you sure you want to change the base?
Conversation
Reviewer's Guide by SourceryThis pull request implements the ability for organizers to apply voucher codes to their monthly invoices. It introduces a new "Invoice Voucher" field in the organizer billing settings. The backend logic now calculates the total amount due, applies any valid voucher, and updates the billing invoice accordingly. The voucher application logic considers voucher limitations, such as organizer restrictions and event-specific usage. Sequence diagram for monthly billing collection with voucher applicationsequenceDiagram
participant System
participant Event
participant BillingInvoice
participant InvoiceVoucher
System->>Event: collect_billing_invoice()
Event->>BillingInvoice: Check existing invoice
alt No existing invoice
Event->>Event: Calculate total amount
Event->>InvoiceVoucher: Check voucher validity
alt Valid voucher
InvoiceVoucher-->>Event: Apply voucher discount
end
Event->>BillingInvoice: Create new invoice with discount
BillingInvoice-->>System: Return billing response
alt Voucher applied
System->>InvoiceVoucher: Increment redeemed count
end
end
Entity relationship diagram for billing and voucher systemerDiagram
ORGANIZER ||--o{ EVENT : has
ORGANIZER ||--o| ORGANIZER_BILLING : has
ORGANIZER_BILLING ||--o| INVOICE_VOUCHER : uses
EVENT ||--o{ BILLING_INVOICE : generates
BILLING_INVOICE }|--|| INVOICE_VOUCHER : applies
BILLING_INVOICE {
decimal amount
decimal ticket_fee
decimal final_ticket_fee
decimal voucher_discount
date monthly_bill
}
INVOICE_VOUCHER {
string code
decimal value
string price_mode
}
Class diagram for billing and voucher modelsclassDiagram
class BillingInvoice {
+Decimal amount
+String currency
+Decimal ticket_fee
+Decimal final_ticket_fee
+Decimal voucher_discount
+Date monthly_bill
+save()
}
class OrganizerBillingModel {
+InvoiceVoucher invoice_voucher
+String stripe_customer_id
+save()
}
class InvoiceVoucher {
+calculate_price()
+is_active()
}
OrganizerBillingModel --> InvoiceVoucher
BillingInvoice --> OrganizerBillingModel
File-Level Changes
Assessment against linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
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.
Hey @HungNgien - I've reviewed your changes and they look great!
Here's what I looked at during the review
- 🟢 General issues: all looks good
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟢 Complexity: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Add a field to input invoice voucher for organizers
This PR resolves #382
Summary by Sourcery
Add support for invoice vouchers in billing settings. Apply voucher discounts to organizer or event-specific invoices.
New Features:
Tests: