Request : Update USSd.php 
=================================================
Note :  if USSD times up when i dial the code again let me continue from the previous page.


1. Agents Assistance
   -----------------
   1. Onboarding 
   2. T&C
   3. Agents Signup
   4. Exit



 1. Onboarding :
=====================================================
     a, Call API : impact_tsp_app/api/agents_verify_api.php 
     -  Verify that is agents is exist and active
request : {
    "agents_mobileno": "23355653409"
}

results : {
    "ok": true,
    "data": {
        "agency_index": "139",
        "agent_code": "EQU0726000004",
        "agent_name": "benjamin Ayima",
        "agents_mobileno": "233244229547",
        "agency_status": "Active"
    }
}

if "ok": true then move to the next page else let the agents keep on trying

   b, Enter Customer mobile number : call API :impact_tsp_app/api/get_name.php

Request :  {
  "mobile_no": "233244845114",
  "channel": "mtn-gh"
}

Results : {
    "ok": true,
    "mobile_no": "233244845114",
    "customer_name": "JENNIFER AKUA GIDI",
    "response": {
        "Message": "Success",
        "ResponseCode": "0000",
        "Data": {
            "IsRegistered": true,
            "Name": "JENNIFER AKUA GIDI",
            "Status": "active"
        }
    }
}

note :  if "customer_name": "" is empty capture it
    c, Enter Date Of Birth : 01-01-1980
    d, Select products call API : impact_tsp_app/api/products.php
results : {
    "success": true,
    "message": "Products retrieved successfully.",
    "data": {
        "count": 3,
        "products": [
            {
                "id": 1,
                "display_name": "Bronze",
                "life_benefit": 2000,
                "total_monthly_premium": 8
            },
            {
                "id": 2,
                "display_name": "Gold",
                "life_benefit": 5000,
                "total_monthly_premium": 13
            },
            {
                "id": 3,
                "display_name": "Platinum",
                "life_benefit": 7500,
                "total_monthly_premium": 17.5
            }
        ]
    }
}

note : call API to check date of birth : /impact_tsp_app/api/age.php?product_id=2&date_of_birth=1980-01-01

results : {
    "success": true,
    "message": "Customer is eligible for this product.",
    "data": {
        "product": {
            "id": 2,
            "display_name": "Gold",
            "minimum_age": 18,
            "maximum_age": 75
        },
        "customer": {
            "date_of_birth": "1985-05-20",
            "calculated_age": 41
        },
        "eligible": true
    }
}

e,Enter email address : eg martinboadudanso@gmail.com then call API's : /impact_tsp_app/api/validate_email.php
Request : 
{
    "email": "mdansokwaku@impactlife.com.gh"
}

Results : 
{
    "success": true,
    "valid": true,
    "message": "The email address has a valid format and domain.",
    "email": "mdansokwaku@impactlife.com.gh",
    "local_part": "mdansokwaku",
    "domain": "impactlife.com.gh",
    "valid_format": true,
    "dns_checked": true,
    "mx_found": false,
    "a_record_found": true
}

f,Enter occupation : eg Trader

g, Enter 
    - Next of Kin Name	: eg: Martin Danso
    - Next of Kin dateofbirth	: 1987-09-10 call API to validate :  /impact_tsp_app/api/age.php?product_id=2&date_of_birth=1987-09-10
Results : 
{
    "success": true,
    "message": "Customer is eligible for this product.",
    "data": {
        "product": {
            "id": 2,
            "display_name": "Gold",
            "minimum_age": 18,
            "maximum_age": 75
        },
        "customer": {
            "date_of_birth": "1987-09-10",
            "calculated_age": 38
        },
        "eligible": true
    }
}

    - Next of Kin Contact : eg:0244229547


f. Call Signup : /impact_tsp_app/api/signup.php

Request : 
{
    "mobile_no": "233556534409",
    "customer_name": "Martin Danso",
    "date_of_birth": "1980-01-01",
    "gender": "MALE",
    "product_id": 1,
    "momo_network": "MTN",
    "email": "araymong@impactlife.com.gh",
    "location": "Accra",
    "occupation": "Software Developer",
    "agency_index": "139",
    "next_of_kin": {
        "mobile_no": "0244886993",
        "nextkin_name": "Jane Owusua",
        "date_of_birth": "1982-05-15",
        "gender": "FEMALE",
        "relationship": "MOTHER",
        "userindex": "193"
    }
}

Results : 
{
    "success": true,
    "message": "An existing pending registration was found for this mobile number. No duplicate record was created; the mandate request was submitted again.",
    "data": {
        "record_created": false,
        "main_life_id": 200,
        "policy_no": "TSP-260700000007",
        "mobile_no": "233556534409",
        "product": "Bronze",
        "premium": 8,
        "payment_status": "Pending",
        "momo_network": "MTN",
        "mandate": {
            "ok": true,
            "mandate_status": "PENDING",
            "is_pending": true,
            "http_code": 200,
            "api_num_used": 66,
            "api_num_next": 67,
            "startDate": "2026-07-23",
            "endDate": "2076-07-23",
            "referenceNo": "66-TSP-260700000007",
            "request": {
                "merchantId": "aede37cd-8527-4c81-91ec-99f5846ec5fd",
                "productId": "27aa4ce0-54ec-4a0c-97cb-4491b7fdd5fb",
                "debitAccount": "233556534409",
                "debitAmount": "8.00",
                "frequencyType": "MONTHLY",
                "startDate": "2026-07-23",
                "endDate": "2076-07-23",
                "debitDay": "1",
                "debitTime": "18:00",
                "referenceNo": "66-TSP-260700000007",
                "channel": "MTN",
                "currency": "GHS",
                "triggerDebitStatus": true,
                "notificationStatus": true,
                "configuration": [
                    {
                        "name": "retryAttempts",
                        "value": "3"
                    }
                ]
            },
            "response": {
                "responseCode": "03",
                "responseMessage": "your request is being processed"
            },
            "success_check": {
                "ok": true,
                "status": "PENDING",
                "is_pending": true,
                "reason": "ITC request is being processed or awaiting customer approval",
                "responseCode": "03",
                "responseMessage": "your request is being processed"
            },
            "url": "https://apis.itcsrvc.com/direct-debit/subscription/subscribe",
            "message": "Mandate request has been submitted and is being processed by ITC.",
            "itc_response_code": "03",
            "itc_response_message": "your request is being processed"
        }
    }
}



   2. T&C
================================================
  a, Enter Customer Mobile Number : eg 02442229547
  b, Call API : impact_tsp_app/api/terms_condition.php to send the terms and condition
     Request : {
    "mobile_no": "0244229547"
}

Results : {
    "success": true,
    "message": "Terms and Conditions SMS sent successfully.",
    "data": {
        "product_code": "N/A",
        "product_name": "N/A",
        "mobile_no": "233244229547",
        "mobile_local": "0244229547",
        "message_type": "T&C",
        "sms_response": "{\"rate\":0.0243,\"messageId\":\"ff5b2b60-4355-4f4b-840e-07c59c1cf104\",\"status\":0,\"networkId\":\"62001\",\"clientReference\":null,\"statusDescription\":\"request submitted successfully\"}"
    }
}



  3. Agents Signup
================================================
  a, Enter Agents Name :  Kwame Mensah
     
     - Select Comopany  : IMPACT
                          EQUITY
                          MHC

     Note : IMPACT = 1 ,EQUITY = 2 ,MHC = 3 : this means 

     if i select IMPACT then partner_id = 1 
     if i select EQUITY then partner_id = 2 
     if i select MHC    then partner_id = 3 

     Call API :  /impact_tsp_app/api/agents_signup_api.php 
     Request : 
{
    "agent_status": "Active", : default
    "agent_name": "Raymond Were",
    "partner_id": "3",
    "agents_mobileno": "233207417776" : pick it from the 
}

{
    "ok": true,
    "message": "Agent created successfully and SMS sent",
    "reference": "A6B3B47F",
    "data": {
        "agency_index": 141,
        "agent_code": "MHC0726000006",
        "agent_status": "Active",
        "agent_name": "Raymond Were",
        "agents_mobileno": "233207417776",
        "partner_id": 3,
        "partner_name": "MHC",
        "inputdate": "2026-07-28 10:20:00",
        "sms_sent": true,
        "sms_http_code": 201
    }
}

     
  


