This commit is contained in:
Benjamin Beganović 2021-04-28 15:03:22 +02:00
parent 9c97421a55
commit 7d8c135ba7
5 changed files with 39 additions and 3 deletions

View File

@ -38,6 +38,18 @@ class CreditCard
$this->braintree->init();
}
public function authorizeView(array $data)
{
$data['gateway'] = $this->braintree;
return render('gateways.braintree.credit_card.authorize', $data);
}
public function authorizeResponse($data)
{
}
/**
* Credit card payment page.
*
@ -52,6 +64,13 @@ class CreditCard
return render('gateways.braintree.credit_card.pay', $data);
}
/**
* Process the credit card payments.
*
* @param PaymentResponseRequest $request
* @return \Illuminate\Http\RedirectResponse|void
* @throws PaymentFailed
*/
public function paymentResponse(PaymentResponseRequest $request)
{
$state = [
@ -94,8 +113,6 @@ class CreditCard
'gateway_type_id' => GatewayType::CREDIT_CARD,
];
// Store card if checkbox selected.
$payment = $this->braintree->createPayment($data, Payment::STATUS_COMPLETED);
SystemLogger::dispatch(

View File

@ -66,6 +66,16 @@ class BraintreePaymentDriver extends BaseDriver
];
}
public function authorizeView($data)
{
return $this->payment_method->authorizeView($data);
}
public function authorizeResponse($data)
{
return $this->payment_method->authorizeResponse($data);
}
public function processPaymentView(array $data)
{
return $this->payment_method->paymentView($data);

View File

@ -4235,6 +4235,8 @@ $LANG = array(
'notification_quote_created_subject' => 'Quote :invoice was created for :client',
'notification_credit_created_subject' => 'Credit :invoice was created to :client',
'notification_credit_created_subject' => 'Credit :invoice was created for :client',
'payment_method_cannot_be_authorized_first' => 'This payment method can be can saved for future use, once you complete your first transaction. Don\'t forget to check "Store credit card details" during payment process.',
);
return $LANG;

View File

@ -0,0 +1,7 @@
@extends('portal.ninja2020.layout.payments', ['gateway_title' => 'Credit card', 'card_title' => 'Credit card'])
@section('gateway_content')
@component('portal.ninja2020.components.general.card-element-single', ['title' => 'Credit card', 'show_title' => false])
{{ __('texts.payment_method_cannot_be_authorized_first') }}
@endcomponent
@endsection