[FEATURE]: Membership Fee 5 - Cycle Management & Member Integration #279

Open
opened 2025-12-11 15:49:36 +01:00 by moritz · 0 comments
Owner

Goal: Implement cycle status management and complete member integration.

Scope:

  • Complete MembershipFeeCycle resource:
    • Status transitions (paid, unpaid, suspended)
    • Actions: mark_as_paid, mark_as_suspended, mark_as_unpaid
    • Permissions (Admin, Treasurer can change status)
    • Member can read own cycles
  • Create Ash change module: validate_same_interval.ex
    • Validate membership fee type change (same interval only)
    • Trigger cycle regeneration on allowed change
  • Extend Member resource:
    • Add calculations: current_cycle_status, overdue_count
    • Add change hook for membership fee type assignment
    • Regenerate cycles when type changes (future unpaid cycles only)
  • Handle membership fee type change logic:
    • Validate same interval
    • Delete future unpaid cycles
    • Regenerate with new amount
    • Keep paid/suspended cycles unchanged

Files to Create/Modify:

  • lib/membership_fees/membership_fee_cycle.ex - Complete resource
  • lib/membership_fees/changes/validate_same_interval.ex
  • Update lib/membership/member.ex with calculations and change hooks

Tests to Write:

  • Unit Tests for Cycle Status:

    • Status defaults to :unpaid
    • All status transitions allowed (unpaid ↔ paid ↔ suspended)
    • Status changes work via actions
    • Permissions enforced (only Admin/Treasurer can change)
  • Unit Tests for Member Calculations:

    • current_cycle_status returns correct status
    • overdue_count counts unpaid cycles correctly
    • Calculations work for members with no cycles
    • Calculations work for members with multiple cycles
  • Unit Tests for Type Change Validation:

    • Can change to type with same interval
    • Cannot change to type with different interval (error message)
    • Validation error is clear and helpful
  • Integration Tests for Type Change:

    • On allowed change: future unpaid cycles regenerated
    • On allowed change: paid/suspended cycles unchanged
    • On allowed change: amount updated to new type's amount
    • Change is atomic (transaction, all or nothing)
    • Member calculations update after type change
  • Permission Tests:

    • Admin can change cycle status
    • Treasurer can change cycle status
    • Member can read own cycles
    • Member cannot change cycle status
    • Other roles cannot access cycles

Acceptance Criteria:

  • Cycle status management fully functional
  • Member type change validation works
  • Cycle regeneration on type change works
  • Member calculations work correctly
  • All permissions enforced
**Goal:** Implement cycle status management and complete member integration. **Scope:** - Complete `MembershipFeeCycle` resource: - Status transitions (paid, unpaid, suspended) - Actions: `mark_as_paid`, `mark_as_suspended`, `mark_as_unpaid` - Permissions (Admin, Treasurer can change status) - Member can read own cycles - Create Ash change module: `validate_same_interval.ex` - Validate membership fee type change (same interval only) - Trigger cycle regeneration on allowed change - Extend Member resource: - Add calculations: `current_cycle_status`, `overdue_count` - Add change hook for membership fee type assignment - Regenerate cycles when type changes (future unpaid cycles only) - Handle membership fee type change logic: - Validate same interval - Delete future unpaid cycles - Regenerate with new amount - Keep paid/suspended cycles unchanged **Files to Create/Modify:** - `lib/membership_fees/membership_fee_cycle.ex` - Complete resource - `lib/membership_fees/changes/validate_same_interval.ex` - Update `lib/membership/member.ex` with calculations and change hooks **Tests to Write:** - **Unit Tests for Cycle Status:** - Status defaults to :unpaid - All status transitions allowed (unpaid ↔ paid ↔ suspended) - Status changes work via actions - Permissions enforced (only Admin/Treasurer can change) - **Unit Tests for Member Calculations:** - `current_cycle_status` returns correct status - `overdue_count` counts unpaid cycles correctly - Calculations work for members with no cycles - Calculations work for members with multiple cycles - **Unit Tests for Type Change Validation:** - Can change to type with same interval - Cannot change to type with different interval (error message) - Validation error is clear and helpful - **Integration Tests for Type Change:** - On allowed change: future unpaid cycles regenerated - On allowed change: paid/suspended cycles unchanged - On allowed change: amount updated to new type's amount - Change is atomic (transaction, all or nothing) - Member calculations update after type change - **Permission Tests:** - Admin can change cycle status - Treasurer can change cycle status - Member can read own cycles - Member cannot change cycle status - Other roles cannot access cycles **Acceptance Criteria:** - Cycle status management fully functional - Member type change validation works - Cycle regeneration on type change works - Member calculations work correctly - All permissions enforced
moritz added this to the Membership Fees milestone 2025-12-11 15:49:36 +01:00
moritz added the
medium priority
M
labels 2025-12-11 15:49:36 +01:00
moritz self-assigned this 2025-12-11 15:49:37 +01:00
moritz added this to the Sprint 10: 11.12-08.01 project 2025-12-11 15:49:37 +01:00
moritz changed title from [FEATURE]: Membership Fee - Cycle Management & Member Integration to [FEATURE]: Membership Fee 5 - Cycle Management & Member Integration 2025-12-11 15:51:11 +01:00
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: local-it/mitgliederverwaltung#279
No description provided.