public function sendSms($receiver, $txnId) { $receiver = self::mobileFormat($receiver); if ($receiver && $txnId) { $db = new DBHandler(); $db->connect(); $lead = $db->retrieveLeadByTxnId($txnId); $sender = "TNF100PH"; $msg = "Congratulations! You have successfully registered to 2016 TNF 100! Check your email for your reg summary. Get your favorite TNF items using this exclusive discount coupon code: " . $lead['coupon_code'] . ". Present the code at the time of purchase. See you on April 30-May 1. Break all boundaries!"; $sema = new SemaphoreClient(); $response = $sema->sendSms($receiver, $sender, $msg); $date = new DateTime('now'); $msgstat = (int) $response->code; if ((int) $response->code >= 200) { $network = self::getNetworkByMobile($response->to); $data = array("msg_type" => "online registration", "mobile" => $response->to, "network" => $network, "shortcode" => $response->from, "date_received" => $date->format('Y-m-d G:i:s'), "channel" => "TNF 100 2016 Registration", "message_id" => $response->message_id, "message" => $msg, "full_msg" => json_encode($response), "msg_status" => $response->code . ': ' . $response->status, "status" => strtoupper($response->status)); self::saveOutbox($lead, $data, $txnId); } else { $msgstat = 0; $network = self::getNetworkByMobile($receiver); $data = array("msg_type" => "error", "mobile" => $receiver, "network" => $network, "shortcode" => $sender, "date_received" => $date->format('Y-m-d G:i:s'), "channel" => "TNF 100 2016 Registration", "message" => $msg, "full_msg" => json_encode($response), "msg_status" => $response->code . ': ' . $response->status, "status" => strtoupper($response->status)); self::saveOutbox($lead, $data, $txnId); } } }
public function processPdt($get) { if (isset($get['tx']) && isset($get['st']) && strtolower($get['st']) == 'completed') { $db = new DBHandler(); $db->connect(); $paypal = new Paypal(); $data = $paypal->pdt($get['tx']); // Datas $u = new Utility(); $params = array(); $items = array(); // if ((isset($data['option_selection20']) && $data['option_selection20'] != '') && (isset($data['option_selection21']) && $data['option_selection21'] != '')) { // $params = $u->processBookingPaypalData($data); // $params['couponCode'] = $db->retrieveLeadLastId() . 'SEDA' . $u->generateBookingCode(); // // Items // $items = $u->processBookingPaypalItems($data); // } else { $params = $u->processPaypalData($data); $params['couponCode'] = $db->retrieveLeadLastId() . $u->generateCode(); // Items $items = $u->processPaypalItems($data); // } // End of Datas if (DEBUG == true) { $datas = implode(",", $params); error_log(date('[Y-m-d H:i e] ') . "Save Data Leads in PDT: {$datas}" . PHP_EOL, 3, DATA_LOG); } $lead = array(); $check = $db->retrieveLeadByTxnId($get['tx']); if (!$check) { // if ((isset($data['option_selection20']) && $data['option_selection20'] != '') && (isset($data['option_selection21']) && $data['option_selection21'] != '')) { // $db->insertBookLead($params, $items); // if ($params['singlet'] == 'XS') { // $db->updateInventory(); // } // } else { $db->insertLead($params, $items); if ($params['singlet'] == 'XS') { $db->updateInventory(); } // } // // $analytics = new Analytics; // $analytics->ga($params, $items); // // $now = new DateTime(); // $params['date_added'] = $now->format('Y-m-d G:i:s'); // // $mail = new MailerHandler(); // $mail->sendMail($params); // // // $sms = new SMS(); // $sms->sendSms($params['contact'],$get['tx']); // if ((isset($data['option_selection20']) && $data['option_selection20'] != '') && (isset($data['option_selection21']) && $data['option_selection21'] != '')) { // $mail->sendMailToSeda($params); // } //$bm = new BenchmarkHandler; //$bm->addOnlineLeadToBenchmark($params); $now = new DateTime(); $params['date_added'] = $now->format('Y-m-d G:i:s'); $lead = $params; } else { // $book = $db->retrieveBookingByLeadId($check['id']); // if ($book) { // $check['revenue'] = $book['total_payment']; // $check['check_in'] = $book['check_in']; // $check['check_out'] = $book['check_out']; // $check['booked_room'] = $book['booked_room']; // $check['max'] = $book['max']; // $check['hotel'] = $book['hotel']; // $check['days'] = $book['days']; // } // $lead = $check; } // $ss = new SpreadsheetHandler; // $duplicate = $ss->isEntryDuplicate($get['tx']); // if (!$duplicate) { // $ss->addLeadToDocs($params); // if ((isset($data['option_selection20']) && $data['option_selection20'] != '') && (isset($data['option_selection21']) && $data['option_selection21'] != '')) { // $ss->addHotelBookingToDocs($params); // } // } if ($lead) { // Go to Thank you page. return $lead; } else { // Go to failed or pending page return array(); } } else { return false; } }
<?php ini_set('display_errors', 1); $data = array(); if (isset($_GET['txnId']) && isset($_GET['st']) && $_GET['st'] == 'completed') { include_once "../../../src/Utility/Constant.php"; include_once "../../../src/Database/DBHandler.php"; $db = new DBHandler(); $db->connect(); if ($db->isConnected()) { $data = $db->retrieveLeadByTxnId($_GET['txnId']); } } include 'admin_header.php'; ?> <div class="row"> <div class="large-9 large-centered columns promoContent"> <div class="panel panel-title"> <img src="../img/tnf100-logo.png" alt=""> </div> <div class="panel panel-content"> <h1>TNF100 REGISTRATION SUMMARY</h1> <h2 class="summaryIntro"> Congratulations <?php if ($data['gender'] == 'Male') { ?> Mr. <?php } elseif ($data['gender'] == 'female') {