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}"; }