mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-30 23:04:34 -04:00
Fixes for "Pay now" with invoices (#3523)
* Fixes for invoice payments - Changed the input from $hashed_ids to invoices[] as an array - Fixes for payment.js * Fix redirect back
This commit is contained in:
parent
4af34a186c
commit
2b85feedc0
@ -75,11 +75,11 @@ class PaymentController extends Controller
|
|||||||
* The request will also contain the amount
|
* The request will also contain the amount
|
||||||
* and invoice ids for reference.
|
* and invoice ids for reference.
|
||||||
*
|
*
|
||||||
* @return void
|
* @return \Illuminate\Http\RedirectResponse|mixed
|
||||||
*/
|
*/
|
||||||
public function process()
|
public function process()
|
||||||
{
|
{
|
||||||
$invoices = Invoice::whereIn('id', $this->transformKeys(explode(",", request()->input('hashed_ids'))))
|
$invoices = Invoice::whereIn('id', $this->transformKeys(request()->invoices))
|
||||||
->whereClientId(auth()->user()->client->id)
|
->whereClientId(auth()->user()->client->id)
|
||||||
->get();
|
->get();
|
||||||
|
|
||||||
@ -90,7 +90,9 @@ class PaymentController extends Controller
|
|||||||
});
|
});
|
||||||
|
|
||||||
if ($invoices->count() == 0) {
|
if ($invoices->count() == 0) {
|
||||||
return back()->with(['warning' => 'No payable invoices selected']);
|
return redirect()
|
||||||
|
->route('client.invoices.index')
|
||||||
|
->with(['warning' => 'No payable invoices selected.']);
|
||||||
}
|
}
|
||||||
|
|
||||||
$invoices->map(function ($invoice) {
|
$invoices->map(function ($invoice) {
|
||||||
@ -99,6 +101,7 @@ class PaymentController extends Controller
|
|||||||
return $invoice;
|
return $invoice;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
$payment_methods = auth()->user()->client->getPaymentMethods($amount);
|
$payment_methods = auth()->user()->client->getPaymentMethods($amount);
|
||||||
|
|
||||||
//boot the payment gateway
|
//boot the payment gateway
|
||||||
|
2
resources/js/clients/invoices/payment.js
vendored
2
resources/js/clients/invoices/payment.js
vendored
@ -16,6 +16,8 @@ class Payment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
handleMethodSelect(element) {
|
handleMethodSelect(element) {
|
||||||
|
document.getElementById('company_gateway_id').value = element.dataset.companyGatewayId;
|
||||||
|
document.getElementById('payment_method_id').value = element.dataset.gatewayTypeId;
|
||||||
|
|
||||||
if (this.shouldDisplaySignature && !this.shouldDisplayTerms) {
|
if (this.shouldDisplaySignature && !this.shouldDisplayTerms) {
|
||||||
this.displayTerms();
|
this.displayTerms();
|
||||||
|
@ -10,7 +10,9 @@
|
|||||||
@section('body')
|
@section('body')
|
||||||
<form action="{{ route('client.payments.process') }}" method="post" id="payment-form">
|
<form action="{{ route('client.payments.process') }}" method="post" id="payment-form">
|
||||||
@csrf
|
@csrf
|
||||||
<input type="hidden" name="hashed_ids" value="{!! $hashed_ids !!}" id="hashed_ids">
|
@foreach($invoices as $invoice)
|
||||||
|
<input type="hidden" name="invoices[]" value="{{ $invoice->hashed_id }}">
|
||||||
|
@endforeach
|
||||||
<input type="hidden" name="company_gateway_id" id="company_gateway_id">
|
<input type="hidden" name="company_gateway_id" id="company_gateway_id">
|
||||||
<input type="hidden" name="payment_method_id" id="payment_method_id">
|
<input type="hidden" name="payment_method_id" id="payment_method_id">
|
||||||
</form>
|
</form>
|
||||||
@ -51,7 +53,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@foreach($invoices as $invoice)
|
@foreach($invoices as $invoice)
|
||||||
<div class="bg-white shadow overflow-hidden sm:rounded-lg mb-4">
|
<div class="bg-white shadow overflow-hidden sm:rounded-lg mb-4">
|
||||||
<div class="px-4 py-5 border-b border-gray-200 sm:px-6">
|
<div class="px-4 py-5 border-b border-gray-200 sm:px-6">
|
||||||
|
Loading…
x
Reference in New Issue
Block a user