PRD created: /reportburster/_apps/flowkraft/_ai-hub/agents-output-artifacts/athena/billing-portal-prd.org

Key highlights:

Data Model ER Diagram

Billing Portal ER Diagram — Customer, User, Bill entities with relationships

Grails Domain Models

Customer.groovy Domain
class Customer {
    String name
    String email
    Date dateCreated
    Date lastUpdated

    static hasMany = [users: User, bills: Bill]

    static constraints = {
        name blank: false
        email email: true, unique: true, blank: false
    }
}
User.groovy Domain
class User {
    String email
    String password
    boolean enabled = false

    static belongsTo = [customer: Customer]

    static constraints = {
        email email: true, unique: true, blank: false
        password blank: false, password: true
        enabled nullable: false
    }

    static mapping = {
        password column: '`password`'
    }
}
Bill.groovy Domain
class Bill {
    String billNumber
    BigDecimal amount
    Date dueDate
    BillStatus status = BillStatus.UNPAID
    String pdfPath

    static belongsTo = [customer: Customer]

    static constraints = {
        billNumber blank: false, unique: true
        amount min: 0.0
        dueDate nullable: false
        pdfPath nullable: true
    }

    enum BillStatus {
        PAID, UNPAID, OVERDUE
    }
}

User Stories

Account Management

US-AM-1 Self-service registration (link to existing customer via email)
US-AM-2 Email verification
US-AM-3 Password reset
US-AM-4 Login

Billing Portal

US-BP-1 View bills (newest first)
US-BP-2 Filter by status (paid/unpaid/overdue)
US-BP-3 Download PDF
US-BP-4 Pay online

Payment from Email

US-PE-1 Direct payment link (no login required)

Admin Interface

US-AD-1 CRUD customers
US-AD-2 CRUD users
US-AD-3 CRUD bills
US-AD-4 View all bills (newest first)

Automation (ReportBurster Integration)

US-AU-1 Auto-create customer if doesn't exist
US-AU-2 Create bill record
US-AU-3 Send email with payment link