Offline payment method for customer
This commit is contained in:
		@@ -18,11 +18,28 @@ class OfflinePaymentConfirm
 | 
			
		||||
            return [];
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $invoice = $event->invoice;
 | 
			
		||||
 | 
			
		||||
        $gateway = [];
 | 
			
		||||
 | 
			
		||||
        $payment_methods = json_decode(setting('offlinepayment.methods'), true);
 | 
			
		||||
 | 
			
		||||
        foreach ($payment_methods as $payment_method) {
 | 
			
		||||
            if ($payment_method['code'] == $event->gateway) {
 | 
			
		||||
                $gateway = $payment_method;
 | 
			
		||||
 | 
			
		||||
                break;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $html = view('offlinepayment::confirm', compact('gateway', 'invoice'))->render();
 | 
			
		||||
 | 
			
		||||
        return [
 | 
			
		||||
            'code' => $event->gateway,
 | 
			
		||||
            'name' => $event->gateway,
 | 
			
		||||
            'code' => $gateway['code'],
 | 
			
		||||
            'name' => $gateway['name'],
 | 
			
		||||
            'description' => $gateway['description'],
 | 
			
		||||
            'redirect' => false,
 | 
			
		||||
            'html' => true,
 | 
			
		||||
            'html' => $html,
 | 
			
		||||
        ];
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -10,4 +10,7 @@ return [
 | 
			
		||||
    'order'            => 'Order',
 | 
			
		||||
    'payment_gateways' => 'Offline Payment Methods',
 | 
			
		||||
 | 
			
		||||
    'confirm' => 'Confirm',
 | 
			
		||||
    'loading' => 'Loading',
 | 
			
		||||
 | 
			
		||||
];
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										35
									
								
								modules/OfflinePayment/Resources/views/confirm.blade.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										35
									
								
								modules/OfflinePayment/Resources/views/confirm.blade.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,35 @@
 | 
			
		||||
<h2>{{ $gateway['name'] }}</h2>
 | 
			
		||||
 | 
			
		||||
@if ($gateway['description'])
 | 
			
		||||
<div class="well well-sm">
 | 
			
		||||
    {{ $gateway['description'] }}
 | 
			
		||||
</div>
 | 
			
		||||
@endif
 | 
			
		||||
<div class="buttons">
 | 
			
		||||
    <div class="pull-right">
 | 
			
		||||
        <input type="button" value="{{ trans('offlinepayment::offlinepayment.confirm') }}" id="button-confirm" class="btn btn-success" data-loading-text="{{ trans('offlinepayment::offlinepayment.loading') }}" />
 | 
			
		||||
    </div>
 | 
			
		||||
</div>
 | 
			
		||||
<script type="text/javascript"><!--
 | 
			
		||||
    $('#button-confirm').on('click', function() {
 | 
			
		||||
        $.ajax({
 | 
			
		||||
            url: '{{ url("customers/invoices/" . $invoice->id . "/confirm") }}',
 | 
			
		||||
            type: 'POST',
 | 
			
		||||
            dataType: 'JSON',
 | 
			
		||||
            data: {payment_method: '{{ $gateway['code'] }}'},
 | 
			
		||||
            cache: false,
 | 
			
		||||
            headers: { 'X-CSRF-TOKEN': '{{ csrf_token() }}' },
 | 
			
		||||
            beforeSend: function() {
 | 
			
		||||
                $('#button-confirm').button('loading');
 | 
			
		||||
            },
 | 
			
		||||
            complete: function() {
 | 
			
		||||
                $('#button-confirm').button('reset');
 | 
			
		||||
            },
 | 
			
		||||
            success: function(data) {
 | 
			
		||||
                if (data['success']) {
 | 
			
		||||
                    location.reload();
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        });
 | 
			
		||||
    });
 | 
			
		||||
    //--></script>
 | 
			
		||||
		Reference in New Issue
	
	Block a user