public function sendSmsPaymentSuccess($params) { $user = User::where('account_id', '=', $this->account_id)->get()->first(); if (!is_null($user)) { $senderId = "OODOOP"; $message = "Your Payment of Rs." . $this->amount . " for Account ID " . $this->account_id . " is Successful.\n Your transaction id is" . $this->transaction_code . " \n for your future reference. Contact support@oodoo.co.in or +91 8940808080 for more info."; $mobileNumber = Config::get('custom_config.mobile'); if (is_null($mobileNumber)) { $mobileNumber = $user->mobile; } $return = PaymentTransaction::sendsms($mobileNumber, $senderId, $message); } }
public function replyMessage() { $client = $this->getClient(); $service = new Google_Service_Gmail($client); $userId = 'me'; $thread_id = Input::get('thread_id'); $assign_to = Input::get('assign_to'); $employee = Employee::where('employee_identity', $assign_to)->get()->first(); $employee_name = $employee->name; $employee_mobile = $employee->mobile; DB::table('create_mail_table')->insert(['thread_id' => $thread_id, 'label' => 'ASSIGN', 'body' => '' . Auth::employee()->get()->name . ' assigned the complaint to ' . $employee_name . '', 'from_mail' => Auth::employee()->get()->name, 'time' => Date("Y-m-d H:i:s")]); $ticket_no = TicketSupport::where('thread_id', $thread_id)->get()->first(); if (!$ticket_no) { $ticket_no = $this->generateTicketNo(); $ticketMail = new TicketSupport(); $ticketMail->thread_id = $thread_id; $ticketMail->ticket_no = $ticket_no; $ticketMail->status = 'open'; $ticketMail->assign_to = $assign_to; $ticketMail->save(); } else { $ticket_no = $ticket_no->ticket_no; } $senderDet = MailSupport::where('thread_id', $thread_id)->orderBy('time', 'ASC')->get()->first(); $from = $senderDet->to_mail; $to = $senderDet->from_mail; $subject = $senderDet->subject; $content = Input::get('body'); $body = 'Hi ' . $from . '\\n Ticket No : ' . $ticket_no . '\\n\\n' . $content . '\\n\\nSincerely\\n' . Auth::employee()->get()->name . '\\nOODOO Support team.'; $message = new Google_Service_Gmail_Message(); $text = 'From: ' . $from . ' To: ' . $to . ' Subject: Re: ' . $subject . ' ' . $body . ''; $encoded_message = rtrim(strtr(base64_encode($text), '+/', '-_'), '='); $message->setRaw($encoded_message); $message = $service->users_messages->send($userId, $message); $thread = $message->setThreadId($thread_id); #var_dump($message); die; $senderId = "OODOOS"; $content = 'compilant ' . 'Ticket No ' . $ticket_no; $return = PaymentTransaction::sendsms($employee_mobile, $senderId, $content); $inboxmail = new MailSupport(); $inboxmail->message_id = $message->getId(); $inboxmail->thread_id = $thread_id; $inboxmail->history_id = 1111; $inboxmail->label = 'SENT'; $inboxmail->subject = $subject; $inboxmail->from_mail = $from; $inboxmail->to_mail = $to; $inboxmail->body = $body; if (isset($attachment)) { $inboxmail->attachment = json_encode($attachment); } $time = Date("Y-m-d H:i:s"); $inboxmail->time = $time; if ($inboxmail->save()) { return Response::json(array('from' => $from, 'body' => $body, 'time' => $time, 'assign_to' => $assign_to)); } else { return Response::json(array('mail' => "false")); } }