Skip to main content
Version: Webel

Customer Property Agreement Renewal

Author(s)

  • Bishwanath Jana
  • Dipak Mourya

Last Updated Date

2025-08-27


SRS References

  • Agreement Management Module
  • Customer Property Mapping
  • Notification System
  • Scheduler Services

Version History

VersionDateChangesAuthor
1.02025-08-27Initial implementation planBishwanath Jana

Feature Overview

Objective:
Implement a robust and user-friendly process for renewing Customer Property (CP) agreements in the ERP system. The feature will automate agreement renewal flows, ensure data consistency (especially with CP codes), and provide clear user options for different renewal scenarios.

Scope:

  • Handle three main agreement scenarios: No existing agreement, Expired agreement, and Open/Running agreement
  • Provide two renewal options for running agreements: future-dated renewal and immediate renewal
  • Automatic CP code generation and management
  • Integration with existing notification scheduler
  • Enhanced agreement reporting with status filters

Dependencies:

  • Existing Customer Property Management system
  • Agreement Expiry Notification Scheduler
  • Property Status Management via Portal Integration
  • Email Service for notifications

Requirements

  1. Agreement Status Detection: System must identify three scenarios - No Agreement, Expired Agreement, and Open/Running Agreement
  2. Renewal Options: For running agreements, provide two options - future-dated renewal and immediate expiry with new agreement
  3. Automatic CP Management: System must automatically generate new CP codes and close old ones during renewal
  4. Rate Modification: Support modification of Rent Rate, Service Charge, and Permission Fee during renewal
  5. Scheduler Integration: Implement background scheduler for future-dated agreement activation
  6. Agreement Report Enhancements: Add status filters (Open, Expired, Released) with color coding
  7. Audit Trail: Maintain complete audit trail for all agreement modifications and renewals
  8. Data Consistency: Ensure seamless integration with existing property status management and portal updates
  9. Performance: Handle renewal operations within acceptable time limits without system performance impact

Design Specifications

  • UI/UX Design:

    Alt text Alt text

  • Data Models:
    Enhanced existing models to support agreement renewal functionality.

    // Enhanced Agreement Status Enum
    public enum AgreementStatus
    {
    Open, // Currently active
    Closed, // Completed normally
    Released, // Terminated early
    Expired, // Past end date
    PendingActivation // Future-dated, waiting for scheduler
    }

    // Enhanced CP Struct for Renewal Support
    public class CPStruct
    {
    // Existing fields...
    public DateTime? ScheduledActivationDate { get; set; }
    public string? PendingCPCode { get; set; }
    public bool HasPendingRenewal { get; set; }
    }

    // Agreement Renewal Request Model
    public class AgreementRenewalRequest
    {
    public string CustomerId { get; set; }
    public string PropertyCode { get; set; }
    public string CPCode { get; set; }
    public RenewalType RenewalType { get; set; }
    public DateTime NewStartDate { get; set; }
    public DateTime NewEndDate { get; set; }
    public string PeriodOfAgreement { get; set; }
    public DateTime ExecutionDate { get; set; }
    public decimal RentRate { get; set; }
    public decimal ServiceChargeRate { get; set; }
    public decimal PermissionFeeRate { get; set; }
    public string Remarks { get; set; }
    }

    public enum RenewalType
    {
    NewAgreement, // Scenario A - No existing agreement
    ExpiredRenewal, // Scenario B - Expired agreement
    ImmediateRenewal, // Scenario C, Option 2 - Force expire current
    FutureRenewal // Scenario C, Option 1 - Schedule future renewal
    }
  • API Interfaces: Updated backend API endpoints (previous renewal endpoints replaced) focusing on distinct Get/Set operations and scheduler integration. Frontend tasks remain unchanged.

    EndpointMethodPurposeKey ParametersResponseStatus Codes
    /api/agreements/dataGETFetch current agreement (and status) for a given customer + propertycustomerId (string, required)
    propertyCode (string, required)
    AgreementData (includes status + summary)200, 404, 500
    /api/agreementsPOSTCreate / renew ("Set") agreement (simple or immediate renewal)AgreementRenewalRequest (body)AgreementCreateResult (id, cpCode, message)201, 400, 409, 500
    /api/agreements/{agreementId}/detailsGETFetch full agreement details (lines, rates, history)agreementId (guid/string)AgreementDetails200, 404, 500
    /api/agreements/{agreementId}/detailsPOSTUpdate agreement detail set (rates, period, remarks)agreementId (guid/string)
    AgreementDetailsUpdateRequest (body)
    AgreementDetailsUpdateResult200, 400, 409, 500
    /api/agreements/scheduler/pending-activationGET(Internal/Admin) List agreements waiting activationdate (optional, date)List<PendingActivationItem>200, 204, 500
    (Background Scheduler – no public endpoint)N/ADaily activation of future-dated agreements; closes old CP & activates new-Logged execution summary-
    /api/agreement/cp-code/generatePOST(Retained) Generate new CP code for renewal (if rates changed)oldCPCode (string)
    renewalRequest (body)
    string (new CP code)200, 400, 500
  • Workflow:
    End-to-end agreement renewal workflow covering all scenarios.

    Phase 1 Workflow (Simple Renewals):

    1. User selects customer from Agreement Report screen
    2. System displays only occupied properties for selected customer
    3. User selects property and initiates renewal process
    4. System detects current agreement status and scenario type
    5. For Scenario A (No Agreement): Generate new agreement directly
    6. For Scenario B (Expired Agreement): Create renewal with new agreement
    7. For Scenario C Option 2 (Immediate Renewal): Expire current agreement and create new one
    8. System automatically generates new CP code if rates are modified
    9. Update property status and billing mappings

    Phase 2 Workflow (Future-Dated Renewals):

    1. For Scenario C Option 1 (Future Renewal): Create agreement with PendingActivation status
    2. Set scheduled activation date and generate pending CP code
    3. Background scheduler checks daily for agreements due for activation
    4. On activation date: Close old agreement, activate new agreement and CP mapping

    Data Flow Sequence:

    Frontend Request → Agreement Status Service → Determine Scenario → 
    Agreement Renewal Service → CP Code Service → Database Updates →
    Portal Integration → Response

Development Tasks & Estimates

NoTask NameEstimate (Hours)DependenciesNotes
1Minimal DB field & enum updates1.5NoneAdd new fields, enum values, indexes if needed
2Model & DTO adjustments (Agreement / Details)0.5Task 1Align request/response contracts
3DAL updates (repositories + CP code helper)2Task 1CRUD + CP code generation integration
4GET agreement data API (/api/agreements/data)1.5Task 2,3Returns status + summary
5SET agreement (create/renew) API (POST /api/agreements)2Task 3,4Handles immediate renewals
6GET agreement details API1Task 3Full detail retrieval
7SET agreement details API1Task 6Update rates/period/remarks
8CP code generation endpoint integration0.75Task 3,5Reuse existing logic
9Lightweight activation scheduler job1Task 5Future-dated activation + status flip
11Unit tests (core services happy paths)1Tasks 4-10Focused minimal coverage
12Integration test (end-to-end renewal flow)0.5Task 11Single scenario walkthrough
13Logging & error handling pass0.5Tasks 4-12Standardize responses
14Documentation & review0.5Tasks 1-13Update SRS + API specs
17Create a UI screen and page route for agreement renewal with messages if no agreement is available and action buttons1 hourNone
18Integrate the minimal API for the property list and implement a filter for it1 hourNone
19Display the table and agreement list fetched from the filter2 hoursNone
20Create a new modal with a two-step stepper for agreement renewal, first step for agreement details view and second step for agreement view1.5 hoursNone
21Create a modal to fetch agreement details and property and display them in a form so the user can view or update if required3.5 hoursNone
22Integrate the API to set agreement details and agreement and property details1.5 hoursNone
23Create a new component for a PDF viewer so users can preview changes, download, and view uploaded documents2 hoursNone
24Integrate the API to fetch the agreement list0.75 hoursNone
25Create a modal for users to manually upload the agreement1 hourNone
26Integrate the API to submit scanned and signed agreements uploaded in the document section1 hourNone
27Convert the HTML code to Base64 format and send it to the navigation endpoint0.75 hoursNone
28Test all details thoroughly for all required conditions to ensure everything is working properly3 hoursNone
29Overall Total32 hours-Backend 13h + Frontend 19h

Testing & Quality Assurance

  • Unit Tests:
    Comprehensive unit testing for all core services and business logic components.

    • Agreement Status Detection Service tests for all scenario types
    • Agreement Renewal Service tests for each renewal type
    • CP Code Management Service tests for generation and lifecycle operations
    • Database operation tests with transaction rollback scenarios
    • Validation tests for request models and business rules
  • Integration Tests:
    End-to-end testing of complete renewal workflows and system integrations.

    • Complete renewal workflow testing for all scenarios (A, B, C-Option1, C-Option2)
    • Database transaction consistency testing across multiple tables
    • Portal integration testing for property status updates
    • Email service integration testing
    • Background scheduler integration with database operations
  • Acceptance Criteria:
    Feature completion criteria based on functional requirements.

    • All three agreement scenarios (No Agreement, Expired, Running) handled correctly
    • Both renewal options for running agreements work as specified
    • Automatic CP code generation and old CP closure functions properly
    • Rate modifications during renewal work without data inconsistency
    • Background scheduler activates future-dated agreements on correct dates
    • (Notification suppression not in scope for this document)
    • Agreement reports display correct status filters and color coding
    • All database operations maintain referential integrity
    • Performance meets acceptable response time requirements
  • Testing Tools:
    Standard testing framework and tools used in the existing project.

    • xUnit for unit testing
    • Moq for service mocking
    • Entity Framework In-Memory Database for integration testing
    • Postman for API endpoint testing
    • Custom database transaction testing utilities

Deployment Considerations

  • Configuration Changes:
    Minimal configuration changes required due to leveraging existing infrastructure.

    • Background service registration for Agreement Activation Scheduler
    • Database connection string validation for new table columns
    • Email template updates for agreement renewal (if required)
    • Logging configuration for new services and schedulers
  • Rollout Plan:
    Phased implementation approach to minimize risk and ensure system stability.

    Phase 1 Rollout (Weeks 1-6):

    • Deploy database schema updates during maintenance window
    • Release core agreement renewal services for simple scenarios
    • Enable enhanced agreement reports with status filters
    • Conduct user acceptance testing with limited user group

    Phase 2 Rollout (Weeks 7-8):

    • Deploy background scheduler service
    • Enable future-dated renewal functionality
    • Update notification scheduler with suppression logic
    • Full feature rollout to all users

    Migration Strategy:

    • Existing agreement data requires no migration
    • New database columns with default values ensure backward compatibility
    • Agreement status values updated through normal application logic

Risks & Mitigations

RiskImpactLikelihoodMitigation Strategy
CP Code Generation ConflictsHighMediumImplement robust unique code generation with retry logic and fallback mechanisms
Data Consistency During RenewalHighLowUse database transactions for all renewal operations and implement rollback procedures
Background Scheduler ReliabilityMediumMediumImplement comprehensive error handling, logging, and monitoring for scheduler services
Performance Impact on Large DatasetsMediumLowOptimize database queries, implement proper indexing, and conduct load testing
Integration Issues with PortalMediumLowThorough testing of existing portal integration endpoints and error handling
User Training and AdoptionLowMediumProvide comprehensive documentation and training materials for different renewal scenarios

Review & Approval

  • Reviewer:
    Ayon Das

  • Approval Date:
    2025-09-02


Notes

  • This implementation plan focuses on backend services and API development
  • Frontend components and UI/UX implementation are out of scope for this document
  • The phased approach allows for early delivery of simple renewal scenarios while complex scheduler-dependent functionality is developed
  • All new services leverage existing infrastructure and patterns to minimize development risk
  • Comprehensive testing strategy ensures reliability and data consistency throughout the renewal process