1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 21:22:58 +01:00

Update authentication page

This commit is contained in:
Benjamin Beganović 2021-07-30 14:09:29 +02:00
parent 202cc9d670
commit e306278547
2 changed files with 10 additions and 42 deletions

View File

@ -11,8 +11,8 @@ use App\Models\Payment;
use App\Models\PaymentType;
use App\Models\SystemLog;
use App\PaymentDrivers\MolliePaymentDriver;
use Illuminate\Contracts\Container\BindingResolutionException;
use Illuminate\Contracts\View\Factory;
use Illuminate\Http\RedirectResponse;
use Illuminate\View\View;
class CreditCard
@ -50,8 +50,6 @@ class CreditCard
*/
public function paymentResponse(PaymentResponseRequest $request)
{
dd($this->mollie->gateway->mandates->listForId('cst_6S77wEkuQT'));
// TODO: Unit tests.
$amount = number_format((float) $this->mollie->payment_hash->data->amount_with_fee, 2, '.', '');
@ -162,15 +160,14 @@ class CreditCard
return render('gateways.mollie.credit_card.authorize', $data);
}
public function authorizeResponse($request)
/**
* Handle authorization response.
*
* @param mixed $request
* @return RedirectResponse
*/
public function authorizeResponse($request): RedirectResponse
{
$customer = $this->mollie->gateway->customers->create([
'name' => $this->mollie->client->name,
'metadata' => [
'id' => $this->mollie->client->hashed_id,
],
]);
// Save $customer->id to database..
return redirect()->route('client.payment_methods.index');
}
}

View File

@ -1,37 +1,8 @@
@extends('portal.ninja2020.layout.payments', ['gateway_title' => ctrans('texts.credit_card'), 'card_title' =>
ctrans('texts.credit_card')])
@section('gateway_head')
@endsection
@section('gateway_content')
<form action="{{ route('client.payment_methods.store', ['method' => App\Models\GatewayType::CREDIT_CARD]) }}"
method="post" id="server_response">
@csrf
<input type="hidden" name="company_gateway_id" value="{{ $gateway->gateway_id }}">
{{-- <input type="hidden" name="payment_method_id" value="1"> --}}
<input type="hidden" name="gateway_response" id="gateway_response">
</form>
@component('portal.ninja2020.components.general.card-element', ['title' => ctrans('texts.method')])
{{ ctrans('texts.credit_card') }}
@endcomponent
@component('portal.ninja2020.components.general.card-element-single')
Click the "Add Payment Method" button to complete test payment.
@endcomponent
@component('portal.ninja2020.gateways.includes.pay_now', ['id' => 'authorize-card'])
{{ ctrans('texts.add_payment_method') }}
{{ __('texts.payment_method_cannot_be_authorized_first') }}
@endcomponent
@endsection
@section('gateway_footer')
<script>
document.getElementById('authorize-card')
.addEventListener('click', (e) => {
document.getElementById('server_response').submit();
});
</script>
@endsection