paytrace_driver = $paytrace_driver; } public function authorizeView($data) { $data['client_key'] = $this->paytrace_driver->getAuthToken(); return render('gateways.paytrace.authorize', $data); } public function authorizeResponse($request) { $data = $request->all(); return response()->json([], 200); } public function paymentView($data) { return render('gateways.paytrace.pay', $data); } public function paymentResponse(Request $request) { $response_array = $request->all(); // if($response_array['payment_status'] == 'COMPLETE') { // $this->payfast->logSuccessfulGatewayResponse(['response' => $response_array, 'data' => $this->paytrace_driver->payment_hash], SystemLog::TYPE_PAYFAST); // return $this->processSuccessfulPayment($response_array); // } // else { // $this->processUnsuccessfulPayment($response_array); // } } private function processSuccessfulPayment($response_array) { // $payment = $this->paytrace_driver->createPayment($payment_record, Payment::STATUS_COMPLETED); } private function processUnsuccessfulPayment($server_response) { // PaymentFailureMailer::dispatch($this->paytrace_driver->client, $server_response->cancellation_reason, $this->paytrace_driver->client->company, $server_response->amount); // PaymentFailureMailer::dispatch( // $this->paytrace_driver->client, // $server_response, // $this->paytrace_driver->client->company, // $server_response['amount_gross'] // ); // $message = [ // 'server_response' => $server_response, // 'data' => $this->paytrace_driver->payment_hash->data, // ]; // SystemLogger::dispatch( // $message, // SystemLog::CATEGORY_GATEWAY_RESPONSE, // SystemLog::EVENT_GATEWAY_FAILURE, // SystemLog::TYPE_PAYFAST, // $this->payfast->client, // $this->payfast->client->company, // ); // throw new PaymentFailed('Failed to process the payment.', 500); } }