nhance/app/Controllers/Chatbot/ReimbursementClaimStatusConversation.php
2025-09-11 09:34:18 +05:30

48 lines
1.8 KiB
PHP

<?php
// namespace App\Conversations;
namespace App\Controllers\Chatbot;
use App\Helpers\ChatbotHelper;
use BotMan\BotMan\Messages\Conversations\Conversation;
use BotMan\BotMan\Messages\Outgoing\Question;
use BotMan\BotMan\Messages\Outgoing\Actions\Button;
class ReimbursementClaimStatusConversation extends Conversation
{
public function run()
{
$this->claimStatus();
}
protected function claimStatus()
{
$this->say("Fetching Status please wait ...");
$chat_session_info = get_chatbot_session_info();
$data = ChatbotHelper::getReimbursementClaimStatus($chat_session_info);
log_message('error','Claim Number - ' . json_encode($data['claim_number']));
$this->bot->types();
if ($data){
if(isset($data['claim_number']) && $data['claim_number'] !== null)
{
log_message('error','Claim Number YES- ' . json_encode($data['claim_number']));
$this->say("The claim status for the claim Number {$data['claim_number']} is currently in <strong>{$data['client_status']}</strong> status. <br> More Detailed Information is sent to your mail");
}
else
{
log_message('error','Claim Number NO- ' . json_encode($data['claim_number']));
$this->say("The claim status for your latest claim (ID not generated) is currently in <strong>{$data['client_status']}</strong> status. <br> More Detailed Information is sent to your mail");
}
$this->bot->startConversation(new doYouWantToContinueConversation());
}else{
$this->say("No Claim Raised against the user.");
$this->bot->startConversation(new doYouWantToContinueConversation());
}
}
}