Skip to content

Flow Name: [I2C] Chargent Transaction - Recurring Charge Approved

Last Updated: 2025-06-20 Source Code: I2C_Chargent_Transaction_Recurring_Charge_Approved.flow-meta.xml

API Name: I2C_Chargent_Transaction_Recurring_Charge_Approved Status: Active Type: Custom Trigger: ChargentTransaction creation (after save) when response status is "Approved" and type is "Charge"

Business Purpose

Initiates auto-renewal processing chain when recurring charge transactions are approved by preventing duplicate processing and triggering the main auto-renewal flow on the related ChargentOrder.

Process Flow

  1. Async Processing: Uses async after commit for performance
  2. Recursion Check: Queries current transaction to verify it hasn't been processed (Renewal_Processed__c = false)
  3. Account Lookup: Retrieves related Account information
  4. Order Type Validation: Checks if this is a recurring PAC order vs standard order
  5. Prevention Flag: Sets Renewal_Processed__c = true to prevent reprocessing
  6. Trigger Auto-Renewal: Updates ChargentOrder Process_Auto_Renewed__c = true (only if currently false)
📊 Click to view Process Flow Diagram
flowchart TD
    Start([Start: ChargentTransaction creation (after save) when response status is "Approved" and type is "Charge"]) --> Lookup[Lookup Related Data]

    Lookup --> Found{Data<br/>Found?}
    Found -->|No| End([End])
    Found -->|Yes| Calculate[Calculate/Determine Values]

    Calculate --> Update[Update Records]
    Update --> End

    style Start fill:#e1f5ff
    style Lookup fill:#f0e1ff
    style Found fill:#fff4e1
    style Calculate fill:#e1ffe1
    style Update fill:#ffe1e1
    style End fill:#e1f5ff

Key Business Rules

  • Only processes "Approved" transactions of type "Charge"
  • Must not have been previously processed (Renewal_Processed__c = false)
  • Uses filter to ensure Process_Auto_Renewed__c is false before updating ChargentOrder
  • Handles both standard and recurring PAC order types
  • Async processing for performance optimization

Dependencies

  • ChargentOrders__Transaction__c with fields: ChargentOrders__Response_Status__c, ChargentOrders__Type__c, Renewal_Processed__c
  • ChargentOrders__ChargentOrder__c with Process_Auto_Renewed__c field
  • Account object relationship through ChargentOrder
  • Downstream dependency on I2C_Chargent_Order_Payment_Received flow

Changes

No specific PR references noted in flow description.

⚠️ Pre-Go-Live Concerns

CRITICAL - Fix Before Go-Live

  • No error handling if ChargentOrder update fails
  • Could create orphaned processed transactions if downstream flow fails

HIGH - Address Soon After Go-Live

  • Missing validation that required relationships exist
  • No logging for processed transactions
  • Potential race conditions with multiple transactions

MEDIUM - Future Enhancement

  • Add error handling and rollback mechanisms
  • Implement audit logging for transaction processing
  • Consider using platform events instead of direct field updates

LOW - Monitor

  • Monitor for failed auto-renewal triggering
  • Track processing success rates
  • Validate async processing timing

Maintenance Notes

Moderate complexity flow that serves as the entry point for auto-renewal processing. Critical for subscription renewal functionality. Monitor closely for processing failures and consider adding comprehensive error handling before production deployment.