Simplify CHS - [Due Reminder]

Simplify CHS - [Due Reminder]

Doubts?

  • If queue sysparameter is not On still we will allow email to all
  • there can be few members for which emails or whatsapp number is not there or they are inactive do we have to inform them for these members mail cannot be sent

Changes in MemberStatementReportOption

  • In MemberStatementReportOption add button for WhatsApp This new button will be enable only when record exist in WhatsAppDbTasks table for that task code & dbname

  • Need to add one more method for MemberWhatsApp
    In that method if they are sending Whatsapp to individual members then we can validate if that member is inactive or Whatsapp number is not there
    After that if queue report is active and for ALL Members whatsapp is selected then we will navigate it to AllMemberQueueWhatsApp else SingleMemberWhatsApp like MFG Detailed queries and methods pending to add

  • In MemberStatementEmail need to check Queue Report Sysparameter is allowed or not, if queue report is active and for ALL Members emails is selected then we will navigate it to AllMemberQueueEmail else SingleMemberEmail like MFG Detailed queries and methods pending to add

  • changes for whatsapp needs to be added

Changes in MemberStatementService and IMemberStatementService

  • Need to add AllMemberQueueWhatsApp, AllMemberQueueEmail, SingleMemberWhatsApp
  • Sample for Whatsapp changes
public async Task<string> SendReminders(List<MemberStatementReport> members)
{
    var ErrorMsg = "";
    
    foreach (var member in members)
    {
        var templateComponents = new List<object>();
        
        var parameters = new List<string>
        {
            member.membername,                   // {1} - Member name instead of hardcoded "Sharmili"
            $"₹{member.amount:N0}",             // {2} - Amount from member details
            "Payment reminder - Sent via WA API" // {3} - Fixed message
        };

        if (parameters?.Any() == true)
        {
            var components = new
            {
                type = "body",
                parameters = parameters.Select(p => new { type = "text", text = p }).ToArray()
            };
            templateComponents.Add(components);
        }

        var payload = new
        {
            messaging_product = "whatsapp",
            to = member.membercontactno, // Use member's contact number
            type = "template",
            template = new
            {
                name = "payment_confirmation",
                language = new { code = "en_US" },
                components = templateComponents
            }
        };
        
        var phoneNumberId = _configuration["WhatsAppApiConfiguration:PhoneNumberId"];
        var response = await _WhatsAppHttpClient.PostAsJsonAsync($"{phoneNumberId}/messages", payload);
        var content = await response.Content.ReadAsStringAsync();
        
        if (!response.IsSuccessStatusCode)
        {
            var error = await response.Content.ReadAsStringAsync();
            ErrorMsg += $"Failed to send WhatsApp message to {member.membername}: {error}\n";
        }
    }
    
    return ErrorMsg;
}

Changes in MemberStatementController

  • Need to comment this validation Email can be send to single member at a time
  • Need to show this two validations, Please update email in the Member Master. & Mail may not be sent for In-Active member. only when email is sent for single member
  • Need to show this two validations, Please update number in the Member Master. & WhatsApp may not be sent for In-Active member. only when WhatsApp is sent for single member
  • If member id is 000000 then need to validate Print Nil Due Statement must be N
  • Need to add AllMemberQueueEmail