Skip to content
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

Add Discount Management and Application to Billing System #283

Conversation

sweep-ai[bot]
Copy link
Contributor

@sweep-ai sweep-ai bot commented Dec 24, 2024

This pull request was created by Sweep to resolve the following request by @curtisdelicata:

Description: Implement a system for applying discounts and promo codes to invoices.

Tasks:
Create Discount model and migration.
Develop a UI for creating and managing discounts.
Implement functionality to apply discounts to invoices.
Acceptance Criteria:
Users can create and apply discounts or promo codes to invoices.
Discounts are reflected in the invoice total.

Continue chatting at https://sweep-chat-demo.vercel.app/c/a5463bfe-7e29-4a25-be54-74cc28d588ad.

Purpose

Implement a comprehensive discount management system for invoices, allowing creation, validation, and application of discounts across the billing workflow.

Description

This pull request introduces a complete discount management feature to the billing system. The implementation includes:

  • A new Discount model with robust validation and usage tracking
  • Database migration to support discount functionality
  • Updated Invoice model to incorporate discount-related fields
  • A BillingService method to apply discounts to invoices
  • A DiscountController for managing discount CRUD operations
  • Validation for discount codes, including time-based and usage-based restrictions

The discount system supports two types of discounts:

  1. Percentage-based discounts
  2. Fixed-amount discounts

Key features include:

  • Unique discount codes
  • Start and end date validity
  • Maximum usage limits
  • Currency support
  • Automatic discount application and tracking

Summary

  • Added new Discount model with comprehensive attributes
  • Created database migration for discounts table
  • Updated Invoice model with discount-related methods
  • Implemented BillingService::applyDiscount() method
  • Added DiscountController for discount management
  • Introduced discount validation and application logic
  • Supported percentage and fixed-amount discounts
  • Added validation for discount code usage

@curtisdelicata curtisdelicata merged commit 33294a3 into main Dec 24, 2024
1 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant