diff --git a/app/Http/Controllers/ClientPortal/PaymentController.php b/app/Http/Controllers/ClientPortal/PaymentController.php index 61cdc83456be..b3bbf2a94bcb 100644 --- a/app/Http/Controllers/ClientPortal/PaymentController.php +++ b/app/Http/Controllers/ClientPortal/PaymentController.php @@ -232,6 +232,7 @@ class PaymentController extends Controller public function response(PaymentResponseRequest $request) { $gateway = CompanyGateway::find($request->input('company_gateway_id'))->firstOrFail(); + $payment_hash = PaymentHash::whereRaw('BINARY `hash`= ?', [$request->payment_hash])->first(); return $gateway diff --git a/app/PaymentDrivers/BaseDriver.php b/app/PaymentDrivers/BaseDriver.php index 7e097c704b53..4d4b017beecf 100644 --- a/app/PaymentDrivers/BaseDriver.php +++ b/app/PaymentDrivers/BaseDriver.php @@ -460,4 +460,9 @@ class BaseDriver extends AbstractPaymentDriver return $this; } + + public function getCompanyGatewayId(): int + { + return $this->company_gateway->id; + } } diff --git a/app/PaymentDrivers/CustomPaymentDriver.php b/app/PaymentDrivers/CustomPaymentDriver.php index 03c76eb7007f..3c5d4bad1967 100644 --- a/app/PaymentDrivers/CustomPaymentDriver.php +++ b/app/PaymentDrivers/CustomPaymentDriver.php @@ -28,27 +28,15 @@ class CustomPaymentDriver extends BaseDriver /** * Returns the gateway types. */ - public function gatewayTypes() :array + public function gatewayTypes(): array { $types = [ - GatewayType::CREDIT_CARD, + GatewayType::CUSTOM, ]; return $types; } - public function authorize($payment_method) - { - } - - public function purchase($amount, $return_client_response = false) - { - } - - public function refund(Payment $payment, $amount, $return_client_response = false) - { - } - public function setPaymentMethod($payment_method_id) { $this->payment_method = $payment_method_id; @@ -56,13 +44,33 @@ class CustomPaymentDriver extends BaseDriver return $this; } + /** + * View for displaying custom content of the driver. + * + * @param array $data + * @return mixed + */ public function processPaymentView($data) { - return render('gateways.custom.landing_page', $data); + $data['title'] = $this->company_gateway->getConfigField('name'); + $data['instructions'] = $this->company_gateway->getConfigField('text'); + + $this->payment_hash->data = array_merge((array) $this->payment_hash->data, $data); + $this->payment_hash->save(); + + $data['gateway'] = $this; + + return render('gateways.custom.payment', $data); } + /** + * Processing method for payment. Should never be reached with this driver. + * + * @return mixed + */ public function processPaymentResponse($request) { + return redirect()->route('client.invoices'); } /** diff --git a/resources/lang/en/texts.php b/resources/lang/en/texts.php index 3eef076b20d0..565053ca7601 100644 --- a/resources/lang/en/texts.php +++ b/resources/lang/en/texts.php @@ -3314,6 +3314,9 @@ return [ 'service' => 'Service', 'pay' => 'Pay', + + 'instructions' => 'Instructions', + 'notification_invoice_reminder1_sent_subject' => 'Reminder 1 for Invoice :invoice was sent to :client', 'notification_invoice_reminder2_sent_subject' => 'Reminder 2 for Invoice :invoice was sent to :client', 'notification_invoice_reminder3_sent_subject' => 'Reminder 3 for Invoice :invoice was sent to :client', diff --git a/resources/views/portal/ninja2020/gateways/checkout/credit_card.blade.php.old b/resources/views/portal/ninja2020/gateways/checkout/credit_card.blade.php.old deleted file mode 100644 index 71f54319f938..000000000000 --- a/resources/views/portal/ninja2020/gateways/checkout/credit_card.blade.php.old +++ /dev/null @@ -1,128 +0,0 @@ -@extends('portal.ninja2020.layout.app') -@section('meta_title', ctrans('texts.checkout_com')) - -@push('head') - - - - - - - -@endpush - -@section('body') -
- -- {{ ctrans('texts.complete_your_payment') }} -
-