From 9df493883762cba27b8e7951ba8ee78630cc4c77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Beganovi=C4=87?= Date: Thu, 10 Dec 2020 12:38:23 +0100 Subject: [PATCH] change gateway type & remove processPayment --- app/PaymentDrivers/CustomPaymentDriver.php | 32 +++++++++------------- 1 file changed, 13 insertions(+), 19 deletions(-) diff --git a/app/PaymentDrivers/CustomPaymentDriver.php b/app/PaymentDrivers/CustomPaymentDriver.php index 492ecfe66e51..00e111ba4105 100644 --- a/app/PaymentDrivers/CustomPaymentDriver.php +++ b/app/PaymentDrivers/CustomPaymentDriver.php @@ -34,7 +34,7 @@ class CustomPaymentDriver extends BaseDriver public function gatewayTypes(): array { $types = [ - GatewayType::CREDIT_CARD, + GatewayType::CUSTOM, ]; return $types; @@ -47,6 +47,12 @@ class CustomPaymentDriver extends BaseDriver return $this; } + /** + * View for displaying custom content of the driver. + * + * @param array $data + * @return mixed + */ public function processPaymentView($data) { $data['title'] = $this->company_gateway->getConfigField('name'); @@ -60,26 +66,14 @@ class CustomPaymentDriver extends BaseDriver return render('gateways.custom.payment', $data); } + /** + * Processing method for payment. Should never be reached with this driver. + * + * @return mixed + */ public function processPaymentResponse($request) { - $data = [ - 'payment_method' => GatewayType::CREDIT_CARD, - 'payment_type' => PaymentType::CREDIT_CARD_OTHER, - 'amount' => $this->payment_hash->data->amount_with_fee, - 'transaction_reference' => \Illuminate\Support\Str::uuid(), - ]; - - $payment = $this->createPayment($data, Payment::STATUS_PENDING); - - SystemLogger::dispatch( - ['response' => $data, 'data' => $data], - SystemLog::CATEGORY_GATEWAY_RESPONSE, - SystemLog::EVENT_GATEWAY_SUCCESS, - SystemLog::TYPE_STRIPE, - $this->client, - ); - - return redirect()->route('client.payments.show', ['payment' => $this->encodePrimaryKey($payment->id)]); + return redirect()->route('client.invoices'); } /**