public function paymentGet() { if (isset($_GET)) { $amount = HsbcPayment::null2unknown($_GET["vpc_Amount"]); $locale = HsbcPayment::null2unknown($_GET["vpc_Locale"]); $batchNo = HsbcPayment::null2unknown($_GET["vpc_BatchNo"]); $command = HsbcPayment::null2unknown($_GET["vpc_Command"]); $message = HsbcPayment::null2unknown($_GET["vpc_Message"]); $version = HsbcPayment::null2unknown($_GET["vpc_Version"]); $cardType = HsbcPayment::null2unknown($_GET["vpc_Card"]); $orderInfo = HsbcPayment::null2unknown($_GET["vpc_OrderInfo"]); $receiptNo = HsbcPayment::null2unknown($_GET["vpc_ReceiptNo"]); $merchantID = HsbcPayment::null2unknown($_GET["vpc_Merchant"]); $authorizeID = HsbcPayment::null2unknown($_GET["vpc_AuthorizeId"]); $merchTxnRef = HsbcPayment::null2unknown($_GET["vpc_MerchTxnRef"]); $transactionNo = HsbcPayment::null2unknown($_GET["vpc_TransactionNo"]); $acqResponseCode = HsbcPayment::null2unknown($_GET["vpc_AcqResponseCode"]); $txnResponseCode = HsbcPayment::null2unknown($_GET["vpc_TxnResponseCode"]); $verType = array_key_exists("vpc_VerType", $_GET) ? $_GET["vpc_VerType"] : "No Value Returned"; $verStatus = array_key_exists("vpc_VerStatus", $_GET) ? $_GET["vpc_VerStatus"] : "No Value Returned"; $token = array_key_exists("vpc_VerToken", $_GET) ? $_GET["vpc_VerToken"] : "No Value Returned"; $verSecurLevel = array_key_exists("vpc_VerSecurityLevel", $_GET) ? $_GET["vpc_VerSecurityLevel"] : "No Value Returned"; $enrolled = array_key_exists("vpc_3DSenrolled", $_GET) ? $_GET["vpc_3DSenrolled"] : "No Value Returned"; $xid = array_key_exists("vpc_3DSXID", $_GET) ? $_GET["vpc_3DSXID"] : "No Value Returned"; $acqECI = array_key_exists("vpc_3DSECI", $_GET) ? $_GET["vpc_3DSECI"] : "No Value Returned"; $authStatus = array_key_exists("vpc_3DSstatus", $_GET) ? $_GET["vpc_3DSstatus"] : "No Value Returned"; $payment_info = HsbcPayment::where('HSBC_payment_id', $merchTxnRef); if ($payment_info) { $qsi_res_code = HsbcPayment::getResponseDescription($txnResponseCode); $pay = array(); $pay = array('paid_amount' => $amount / 100, 'vpc_txn_res_code' => $txnResponseCode, 'qsi_res_code' => $qsi_res_code, 'vpc_message' => $message, 'vpc_receipt_number' => $receiptNo, 'vpc_txn_no' => $transactionNo, 'vpc_acq_res_code' => $acqResponseCode, 'vpc_bank_auth_id' => $authorizeID, 'vpc_batch_no' => $batchNo, 'card_type' => $cardType, 'vpc_merchant' => $merchantID, 'vpc_command' => $command, 'vpc_version' => $version, 'vpc_Locale' => $locale, 'vpc_OrderInfo' => $orderInfo); $HSBC_payments = DB::table('hsbc_payments')->where('HSBC_payment_id', $merchTxnRef)->update($pay); if (substr_count($orderInfo, 'A') != 0) { if ($txnResponseCode == 0) { $mybooking = 0; $payment = DB::table('payments')->where('HSBC_payment_id', $merchTxnRef)->update(array('my_booking' => $mybooking)); $booking = Booking::where('payment_reference_number', $orderInfo)->first(); $this->sendBookingEmails($booking); } } if (substr_count($orderInfo, 'B') != 0) { if ($txnResponseCode == 0) { $mybooking = 0; $payment = DB::table('payments')->where('HSBC_payment_id', $merchTxnRef)->update(array('my_booking' => $mybooking)); $booking = Booking::where('payment_reference_number', $orderInfo)->first(); $this->sendBookingEmails($booking); } } if (substr_count($orderInfo, 'O') != 0) { if ($txnResponseCode == 0) { $mybooking = 0; $payment = DB::table('payments')->where('HSBC_payment_id', $merchTxnRef)->update(array('my_booking' => $mybooking)); $booking = Booking::where('payment_reference_number', $orderInfo)->first(); $payment = Payment::where('reference_number', $orderInfo)->first(); //dd($booking->email); // Mail::send('emails/online-payment', array( // 'payment' => $payment, // 'booking' => $booking // ), function ($message) use ($booking) { // $message->subject('Online Payment Receipt : ' . $booking->reference_number) // ->from('*****@*****.**', 'SriLankaHotels.Travel') // ->bcc('*****@*****.**') // ->to('*****@*****.**'); // }); Mail::send('emails/online-payment', array('booking' => $booking, 'payment' => $payment), function ($message) use($booking, $payment) { $message->subject('Payment : ' . $payment->reference_number)->from('*****@*****.**', 'SriLankaHotels.Travel')->to($booking->email, $booking->booking_name)->bcc('*****@*****.**', 'Admin'); }); Session::flash('global', 'Thank you for paying online. </br> We have emailed you the online payment invoice'); // return View::make('pages.message'); } Session::flash('global', 'Sorry Your Payment was unsuccessful!'); // return View::make('pages.message'); } if (substr_count($orderInfo, 'AP') != 0) { if ($txnResponseCode == 0) { $mybooking = 0; $payment = DB::table('payments')->where('HSBC_payment_id', $merchTxnRef)->update(array('my_booking' => $mybooking)); $booking = Booking::where('payment_reference_number', $orderInfo)->first(); $this->sendBookingEmails($booking); } } $url = "http://srilankahotels.travel/message"; header("Location: {$url}"); exit; } else { die("An error occurred. Please contact administrator"); } } else { header("Location:index.php"); exit; } }