1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-05 18:52:44 +01:00
invoiceninja/app/Http/Controllers/ClientPortal/PaymentController.php

113 lines
2.9 KiB
PHP
Raw Normal View History

2019-08-16 07:20:28 +02:00
<?php
/**
* Invoice Ninja (https://invoiceninja.com)
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2019. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
namespace App\Http\Controllers\ClientPortal;
use App\Filters\PaymentFilters;
use App\Http\Controllers\Controller;
use App\Models\Payment;
use App\Utils\Traits\MakesHash;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Log;
use Yajra\DataTables\Facades\DataTables;
use Yajra\DataTables\Html\Builder;
/**
* Class InvoiceController
* @package App\Http\Controllers\ClientPortal\InvoiceController
*/
class PaymentController extends Controller
{
use MakesHash;
/**
* Show the list of Invoices
*
* @param \App\Filters\InvoiceFilters $filters The filters
*
* @return \Illuminate\Http\Response
*/
public function index(PaymentFilters $filters, Builder $builder)
{
//$payments = Payment::filter($filters);
$payments = Payment::all();
2019-08-16 07:20:28 +02:00
if (request()->ajax()) {
return DataTables::of($payments)->addColumn('action', function ($payment) {
return '<a href="/client/payments/'. $payment->hashed_id .'/edit" class="btn btn-xs btn-primary"><i class="glyphicon glyphicon-edit"></i>'.ctrans('texts.view').'</a>';
})->editColumn('payment_type_id', function ($payment) {
return $payment->type->name;
2019-08-16 07:20:28 +02:00
})
->editColumn('status_id', function ($payment){
return Payment::badgeForStatus($payment->status_id);
2019-08-16 07:20:28 +02:00
})
->rawColumns(['action', 'status_id','payment_type_id'])
2019-08-16 07:20:28 +02:00
->make(true);
}
$data['html'] = $builder;
return view('portal.default.payments.index', $data);
}
/**
* Display the specified resource.
*
* @param \App\Models\Invoice $invoice The invoice
*
* @return \Illuminate\Http\Response
*/
public function show(RecurringInvoice $invoice)
{
}
2019-09-12 08:10:21 +02:00
/**
* Presents the payment screen for a given
* gateway and payment method.
* The request will also contain the amount
* and invoice ids for reference
* @param int $company_gateway_id The CompanyGateway ID
* @param int $payment_method_id The PaymentMethod ID
* @return void
*/
public function process($company_gateway_id, $payment_method_id)
{
$invoices = request()->input('ids');
$amount = request()->input('amount');
//build a cache record to maintain state
//boot the payment gateway
//build the gateway specific views
$data = [
'redirect_url' =>,
'amount' =>,
'gateway_data' =>,
'cache_hash' =>,
];
return view('', $data);
}
2019-08-16 07:20:28 +02:00
}