Merge pull request #549 from DODMax/e-offline-pay

Allow offline payment when no gateway is defined
This commit is contained in:
Jeremy Quinton 2019-02-18 09:31:44 +02:00 committed by GitHub
commit 935170f256
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 5 deletions

View File

@ -186,14 +186,14 @@ class EventCheckoutController extends Controller
$paymentGateway = $activeAccountPaymentGateway;
} else {
$activeAccountPaymentGateway = $event->account->getGateway($event->account->payment_gateway_id);
//if no payment gateway configured don't go to the next step and show user error
if (empty($activeAccountPaymentGateway)) {
//if no payment gateway configured and no offline pay, don't go to the next step and show user error
if (empty($activeAccountPaymentGateway) && !$event->enable_offline_payments) {
return response()->json([
'status' => 'error',
'message' => 'No payment gateway configured',
]);
}
$paymentGateway = $activeAccountPaymentGateway->payment_gateway;
$paymentGateway = $activeAccountPaymentGateway ? $activeAccountPaymentGateway->payment_gateway : false;
}
/*
@ -389,7 +389,7 @@ class EventCheckoutController extends Controller
break;
default:
Log::error('No payment gateway configured.');
return repsonse()->json([
return response()->json([
'status' => 'error',
'message' => 'No payment gateway configured.'
]);

View File

@ -7,6 +7,7 @@ use App\Models\Order;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use Log;
class SendOrderNotification extends Job implements ShouldQueue
{

View File

@ -159,7 +159,13 @@
@if($event->enable_offline_payments)
<div class="offline_payment_toggle">
<div class="custom-checkbox">
@if($payment_gateway === false)
{{-- Force offline payment if no gateway --}}
<input type="hidden" name="pay_offline" value="1">
<input id="pay_offline" type="checkbox" value="1" checked disabled>
@else
<input data-toggle="toggle" id="pay_offline" name="pay_offline" type="checkbox" value="1">
@endif
<label for="pay_offline">@lang("Public_ViewEvent.pay_using_offline_methods")</label>
</div>
</div>