mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-06-01 02:54:36 -04:00
Add Payment Method - client side
This commit is contained in:
parent
b1836224e2
commit
7cfe0c22fb
@ -118,7 +118,7 @@ class PaymentController extends Controller
|
|||||||
'token' => auth()->user()->client->gateway_token($gateway->id),
|
'token' => auth()->user()->client->gateway_token($gateway->id),
|
||||||
];
|
];
|
||||||
|
|
||||||
return view($gateway->driver()->viewForType($payment_method_id), $data);
|
return view('gateways.pay_now', $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -35,7 +35,12 @@ class PaymentMethodController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function create()
|
public function create()
|
||||||
{
|
{
|
||||||
echo 'hello';
|
$data = [
|
||||||
|
'gateway' => $gateway,
|
||||||
|
'token' => false,
|
||||||
|
];
|
||||||
|
|
||||||
|
return view('portal.default.gateways.authorize', $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -15,9 +15,11 @@ use App\DataMapper\ClientSettings;
|
|||||||
use App\DataMapper\CompanySettings;
|
use App\DataMapper\CompanySettings;
|
||||||
use App\Models\Client;
|
use App\Models\Client;
|
||||||
use App\Models\Company;
|
use App\Models\Company;
|
||||||
|
use App\Models\CompanyGateway;
|
||||||
use App\Models\Country;
|
use App\Models\Country;
|
||||||
use App\Models\Currency;
|
use App\Models\Currency;
|
||||||
use App\Models\Filterable;
|
use App\Models\Filterable;
|
||||||
|
use App\Models\GatewayType;
|
||||||
use App\Models\GroupSetting;
|
use App\Models\GroupSetting;
|
||||||
use App\Models\Timezone;
|
use App\Models\Timezone;
|
||||||
use App\Utils\Traits\CompanyGatewaySettings;
|
use App\Utils\Traits\CompanyGatewaySettings;
|
||||||
@ -226,6 +228,32 @@ class Client extends BaseModel
|
|||||||
return $this->belongsTo(GroupSetting::class);
|
return $this->belongsTo(GroupSetting::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the first Credit Card Gateway
|
||||||
|
*
|
||||||
|
* @return NULL|CompanyGateway The Priority Credit Card gateway
|
||||||
|
*/
|
||||||
|
public function getCreditCardGateway() :?CompanyGateway
|
||||||
|
{
|
||||||
|
$payment_gateways = $this->getSetting('payment_gateways');
|
||||||
|
|
||||||
|
/* If we have a custom gateway list pass this back first */
|
||||||
|
if($payment_gateways)
|
||||||
|
$gateways = $this->company->company_gateways->whereIn('id', $payment_gateways);
|
||||||
|
else
|
||||||
|
$gateways = $this->company->company_gateways;
|
||||||
|
|
||||||
|
foreach($gateways as $gateway)
|
||||||
|
{
|
||||||
|
|
||||||
|
if(in_array(GatewayType::CREDIT_CARD, $gateway->driver()->gatewayTypes()))
|
||||||
|
return $gateway;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generates an array of payment urls per client
|
* Generates an array of payment urls per client
|
||||||
* for a given amount.
|
* for a given amount.
|
||||||
@ -245,7 +273,7 @@ class Client extends BaseModel
|
|||||||
$payment_gateways = $this->getSetting('payment_gateways');
|
$payment_gateways = $this->getSetting('payment_gateways');
|
||||||
|
|
||||||
/* If we have a custom gateway list pass this back first */
|
/* If we have a custom gateway list pass this back first */
|
||||||
if($settings)
|
if($payment_gateways)
|
||||||
$gateways = $this->company->company_gateways->whereIn('id', $payment_gateways);
|
$gateways = $this->company->company_gateways->whereIn('id', $payment_gateways);
|
||||||
else
|
else
|
||||||
$gateways = $this->company->company_gateways;
|
$gateways = $this->company->company_gateways;
|
||||||
|
@ -33,6 +33,7 @@ class BasePaymentDriver
|
|||||||
|
|
||||||
/* Member variables */
|
/* Member variables */
|
||||||
protected $refundable = false;
|
protected $refundable = false;
|
||||||
|
|
||||||
protected $token_billing = false;
|
protected $token_billing = false;
|
||||||
|
|
||||||
public function __construct(CompanyGateway $company_gateway, $invitation = false)
|
public function __construct(CompanyGateway $company_gateway, $invitation = false)
|
||||||
|
31
resources/views/portal/default/gateways/authorize.blade.php
Normal file
31
resources/views/portal/default/gateways/authorize.blade.php
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
@extends('portal.default.layouts.master')
|
||||||
|
@section('header')
|
||||||
|
|
||||||
|
@stop
|
||||||
|
@section('body')
|
||||||
|
<main class="main">
|
||||||
|
<div class="container-fluid">
|
||||||
|
<div class="row" style="padding-top: 30px;">
|
||||||
|
<div class="col d-flex justify-content-center">
|
||||||
|
<div class="card w-50 p-10">
|
||||||
|
<div class="card-header">
|
||||||
|
{{ ctrans('texts.payment')}}
|
||||||
|
</div>
|
||||||
|
<div class="card-body">
|
||||||
|
<h2>{{ ctrans('texts.add_credit_card')}}</h2>
|
||||||
|
|
||||||
|
@include($gateway->driver()->viewForType(GatewayType::CREDIT_CARD))
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
</body>
|
||||||
|
@endsection
|
||||||
|
@push('scripts')
|
||||||
|
@endpush
|
||||||
|
@section('footer')
|
||||||
|
@endsection
|
||||||
|
|
66
resources/views/portal/default/gateways/pay_now.blade.php
Normal file
66
resources/views/portal/default/gateways/pay_now.blade.php
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
@extends('portal.default.layouts.master')
|
||||||
|
@section('header')
|
||||||
|
|
||||||
|
@stop
|
||||||
|
@section('body')
|
||||||
|
<main class="main">
|
||||||
|
<div class="container-fluid">
|
||||||
|
<div class="row" style="padding-top: 30px;">
|
||||||
|
<div class="col d-flex justify-content-center">
|
||||||
|
<div class="card w-50 p-10">
|
||||||
|
<div class="card-header">
|
||||||
|
{{ ctrans('texts.payment')}}
|
||||||
|
</div>
|
||||||
|
<div class="card-body">
|
||||||
|
<div class="list-group">
|
||||||
|
@foreach($invoices as $invoice)
|
||||||
|
<a class="list-group-item list-group-item-action flex-column align-items-start" href="javascript:void(0);">
|
||||||
|
<div class="d-flex w-100 justify-content-between">
|
||||||
|
<h5 class="mr-4"># {{ $invoice->invoice_number }}</h5>
|
||||||
|
<small>{{ $invoice->due_date }}</small>
|
||||||
|
</div>
|
||||||
|
<p class="mb-1 pull-right">{{ $invoice->balance }}</p>
|
||||||
|
<small>
|
||||||
|
@if($invoice->po_number)
|
||||||
|
{{ $invoice->po_number }}
|
||||||
|
@elseif($invoice->public_notes)
|
||||||
|
{{ $invoice->public_notes }}
|
||||||
|
@else
|
||||||
|
{{ $invoice->invoice_date}}
|
||||||
|
@endif
|
||||||
|
</small>
|
||||||
|
</a>
|
||||||
|
@endforeach
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="py-md-5">
|
||||||
|
<ul class="list-group">
|
||||||
|
<li class="list-group-item d-flex list-group-item-action justify-content-between align-items-center"><strong>{{ ctrans('texts.total')}}</strong>
|
||||||
|
<h3><span class="badge badge-primary badge-pill"><strong>{{ $amount }}</strong></span></h3>
|
||||||
|
</li>
|
||||||
|
@if($fee)
|
||||||
|
<li class="list-group-item d-flex list-group-item-action justify-content-between align-items-center"><strong>{{ ctrans('texts.gateway_fee')}}</strong>
|
||||||
|
<h3><span class="badge badge-primary badge-pill"><strong>{{ $fee }}</strong></span></h3>
|
||||||
|
</li>
|
||||||
|
<li class="list-group-item d-flex list-group-item-action justify-content-between align-items-center"><strong>{{ ctrans('texts.amount_due')}}</strong>
|
||||||
|
<h3><span class="badge badge-primary badge-pill"><strong>{{ $amount_with_fee }}</strong></span></h3>
|
||||||
|
</li>
|
||||||
|
@endif
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@include($gateway->driver()->viewForType($payment_method_id))
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
</body>
|
||||||
|
@endsection
|
||||||
|
@push('scripts')
|
||||||
|
@endpush
|
||||||
|
@section('footer')
|
||||||
|
@endsection
|
||||||
|
|
@ -1,78 +1,17 @@
|
|||||||
@extends('portal.default.layouts.master')
|
<!-- Stripe Credit Card TOKEN Form-->
|
||||||
@section('header')
|
@if($token)
|
||||||
|
|
||||||
@stop
|
<!-- Stripe Credit Card TOKEN Form-->
|
||||||
@section('body')
|
|
||||||
<main class="main">
|
|
||||||
<div class="container-fluid">
|
|
||||||
<div class="row" style="padding-top: 30px;">
|
|
||||||
<div class="col d-flex justify-content-center">
|
|
||||||
<div class="card w-50 p-10">
|
|
||||||
<div class="card-header">
|
|
||||||
{{ ctrans('texts.payment')}}
|
|
||||||
</div>
|
|
||||||
<div class="card-body">
|
|
||||||
<div class="list-group">
|
|
||||||
@foreach($invoices as $invoice)
|
|
||||||
<a class="list-group-item list-group-item-action flex-column align-items-start" href="javascript:void(0);">
|
|
||||||
<div class="d-flex w-100 justify-content-between">
|
|
||||||
<h5 class="mr-4"># {{ $invoice->invoice_number }}</h5>
|
|
||||||
<small>{{ $invoice->due_date }}</small>
|
|
||||||
</div>
|
|
||||||
<p class="mb-1 pull-right">{{ $invoice->balance }}</p>
|
|
||||||
<small>
|
|
||||||
@if($invoice->po_number)
|
|
||||||
{{ $invoice->po_number }}
|
|
||||||
@elseif($invoice->public_notes)
|
|
||||||
{{ $invoice->public_notes }}
|
|
||||||
@else
|
|
||||||
{{ $invoice->invoice_date}}
|
|
||||||
@endif
|
|
||||||
</small>
|
|
||||||
</a>
|
|
||||||
@endforeach
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="py-md-5">
|
@else
|
||||||
<ul class="list-group">
|
<!-- Stripe Credit Card Payment Form-->
|
||||||
<li class="list-group-item d-flex list-group-item-action justify-content-between align-items-center"><strong>{{ ctrans('texts.total')}}</strong>
|
<div class="py-md-5">
|
||||||
<h3><span class="badge badge-primary badge-pill"><strong>{{ $amount }}</strong></span></h3>
|
|
||||||
</li>
|
</div>
|
||||||
@if($fee)
|
<!-- Stripe Credit Card Payment Form-->
|
||||||
<li class="list-group-item d-flex list-group-item-action justify-content-between align-items-center"><strong>{{ ctrans('texts.gateway_fee')}}</strong>
|
@endif
|
||||||
<h3><span class="badge badge-primary badge-pill"><strong>{{ $fee }}</strong></span></h3>
|
|
||||||
</li>
|
|
||||||
<li class="list-group-item d-flex list-group-item-action justify-content-between align-items-center"><strong>{{ ctrans('texts.amount_due')}}</strong>
|
|
||||||
<h3><span class="badge badge-primary badge-pill"><strong>{{ $amount_with_fee }}</strong></span></h3>
|
|
||||||
</li>
|
|
||||||
@endif
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Stripe Credit Card TOKEN Form-->
|
|
||||||
@if($token)
|
|
||||||
|
|
||||||
<!-- Stripe Credit Card TOKEN Form-->
|
|
||||||
|
|
||||||
@else
|
|
||||||
<!-- Stripe Credit Card Payment Form-->
|
|
||||||
<div class="py-md-5">
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<!-- Stripe Credit Card Payment Form-->
|
|
||||||
@endif
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</main>
|
|
||||||
</body>
|
|
||||||
@endsection
|
|
||||||
@push('scripts')
|
@push('scripts')
|
||||||
<script src="https://js.stripe.com/v3/"></script>
|
<script src="https://js.stripe.com/v3/"></script>
|
||||||
@endpush
|
@endpush
|
||||||
@section('footer')
|
|
||||||
@endsection
|
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user