示例#1
0
文件: api.php 项目: abrie/go-nam-taxi
 case 0:
     //validate pin
     $pin = $call->validatePIN($code);
     //  echo '<br/>'. md5((int)trim($code))."<<<";
     if ($pin === false) {
         $attempts = $call->loginAttempts($string->cell);
         if ($attempts > 3) {
             $feedback = array('code' => 1, 'msg' => "Invalid Pin Please Try Again! \n\r" . ($attempts - 3) . " Attempts left.");
         } else {
             $feedback = array('code' => 0, 'msg' => "Too many invalid attempt \n\r Account blocked");
         }
     } else {
         $info = $call->getSession($string->cell);
         $feedback = array('code' => 1, 'msg' => "Please confirm you want to pay \n N\$ {$info['amount']} \n To Taxi#: {$info['taxi_id']}? \n\r 1. Yes \n\r 2. No");
         // update session
         $call->updateSession($string->cell);
     }
     break;
 case 1:
     //process trans
     switch ($code) {
         case '1':
             // transfer
             $info = $call->executeTransacton($string->cell);
             if ($info) {
                 $feedback = array('code' => 0, 'msg' => "You have successfuly paid \n\r N\$ " . $info['amount'] . "\n\r Seat No: " . $info['seats'] . "\n\r To Taxi #: " . $info['taxi_id']);
             } else {
                 $feedback = array('code' => 0, 'msg' => "Oops sorry, an error occured\n\r");
                 //var_dump(DB::DBi()->errorInfo());
                 $call->deleteSession($string->cell);
             }