public function checkData($input)
 {
     $validtoken = sha1($input['type'] . $this->merchantID . $input['merchantRef'] . '{' . $this->transactionKey . '}');
     if ($input['token'] != $validtoken) {
         $authCode = '';
         $responseCode = "DECLINED";
         $responseDesc = "Invalid token";
     } else {
         $authCode = '1111';
         $responseCode = "SUCCESS";
         $responseDesc = "";
         switch ($input['type']) {
             case "VALIDATE":
                 // Check if merchantRef is still valid
                 Log::info('7-Connect-Validate: validating ' . $input['merchantRef']);
                 break;
             case "CONFIRM":
                 // Update the paid status of the table
                 $data = ['payment_reference' => $input['sevenConnectId'], 'transaction_data' => serialize($input), 'status' => 'posted'];
                 $transaction = UserTransaction::where('transaction_no', $input['merchantRef'])->update($data);
                 Log::info('7-Connect-Validate: confirmed ' . $input['merchantRef']);
                 break;
             default:
                 $responseCode = "DECLINED";
                 $responseDesc = "Unknown transaction type";
         }
     }
     $token = sha1($input['type'] . $this->merchantID . $input['merchantRef'] . $authCode . $responseCode . '{' . $this->transactionKey . '}');
     //set GET variables
     $fields = array('merchantID' => $this->merchantID, 'merchantRef' => $input['merchantRef'], 'amount' => $input['amount'], 'authCode' => $authCode, 'responseCode' => $responseCode, 'responseDesc' => $responseDesc, 'token' => $token);
     $params = http_build_query($fields);
     //output response
     return "?{$params}";
 }
 private function recordTransaction($refNo, $paymentMethod, $user, $event)
 {
     $userTrans = new UserTransaction();
     $userTrans->user_id = $user->id;
     $userTrans->transaction_no = $refNo;
     $userTrans->event_id = $event->id;
     $userTrans->payment_method = $paymentMethod;
     $userTrans->amount = $this->amount;
     $userTrans->status = 'unpaid';
     $userTrans->save();
     return $userTrans;
 }