mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-31 09:54:34 -04:00
Fixes for invoice filters - overdue
This commit is contained in:
parent
448a139475
commit
f5a5946cb7
@ -69,7 +69,6 @@ class InvoiceFilters extends QueryFilters
|
|||||||
if (in_array('overdue', $status_parameters)) {
|
if (in_array('overdue', $status_parameters)) {
|
||||||
$query->orWhereIn('status_id', [Invoice::STATUS_SENT, Invoice::STATUS_PARTIAL])
|
$query->orWhereIn('status_id', [Invoice::STATUS_SENT, Invoice::STATUS_PARTIAL])
|
||||||
->where('due_date', '<', Carbon::now())
|
->where('due_date', '<', Carbon::now())
|
||||||
->orWhere('due_date', null)
|
|
||||||
->orWhere('partial_due_date', '<', Carbon::now());
|
->orWhere('partial_due_date', '<', Carbon::now());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -311,7 +311,7 @@ class BillingPortalPurchasev2 extends Component
|
|||||||
'description' => $p->notes,
|
'description' => $p->notes,
|
||||||
'product_key' => $p->product_key,
|
'product_key' => $p->product_key,
|
||||||
'unit_cost' => $p->price,
|
'unit_cost' => $p->price,
|
||||||
'product' => nl2br(substr($p->notes, 0, 50)),
|
'product' => substr(strip_tags($p->markdownNotes()), 0, 50),
|
||||||
'price' => Number::formatMoney($total, $this->subscription->company).' / '. RecurringInvoice::frequencyForKey($this->subscription->frequency_id),
|
'price' => Number::formatMoney($total, $this->subscription->company).' / '. RecurringInvoice::frequencyForKey($this->subscription->frequency_id),
|
||||||
'total' => $total,
|
'total' => $total,
|
||||||
'qty' => $qty,
|
'qty' => $qty,
|
||||||
@ -329,7 +329,7 @@ class BillingPortalPurchasev2 extends Component
|
|||||||
'description' => $p->notes,
|
'description' => $p->notes,
|
||||||
'product_key' => $p->product_key,
|
'product_key' => $p->product_key,
|
||||||
'unit_cost' => $p->price,
|
'unit_cost' => $p->price,
|
||||||
'product' => nl2br(substr($p->notes, 0, 50)),
|
'product' => substr(strip_tags($p->markdownNotes()), 0, 50),
|
||||||
'price' => Number::formatMoney($total, $this->subscription->company),
|
'price' => Number::formatMoney($total, $this->subscription->company),
|
||||||
'total' => $total,
|
'total' => $total,
|
||||||
'qty' => $qty,
|
'qty' => $qty,
|
||||||
@ -352,7 +352,7 @@ class BillingPortalPurchasev2 extends Component
|
|||||||
'description' => $p->notes,
|
'description' => $p->notes,
|
||||||
'product_key' => $p->product_key,
|
'product_key' => $p->product_key,
|
||||||
'unit_cost' => $p->price,
|
'unit_cost' => $p->price,
|
||||||
'product' => nl2br(substr($p->notes, 0, 50)),
|
'product' => substr(strip_tags($p->markdownNotes()), 0, 50),
|
||||||
'price' => Number::formatMoney($total, $this->subscription->company).' / '. RecurringInvoice::frequencyForKey($this->subscription->frequency_id),
|
'price' => Number::formatMoney($total, $this->subscription->company).' / '. RecurringInvoice::frequencyForKey($this->subscription->frequency_id),
|
||||||
'total' => $total,
|
'total' => $total,
|
||||||
'qty' => $qty,
|
'qty' => $qty,
|
||||||
@ -375,7 +375,7 @@ class BillingPortalPurchasev2 extends Component
|
|||||||
'description' => $p->notes,
|
'description' => $p->notes,
|
||||||
'product_key' => $p->product_key,
|
'product_key' => $p->product_key,
|
||||||
'unit_cost' => $p->price,
|
'unit_cost' => $p->price,
|
||||||
'product' => nl2br(substr($p->notes, 0, 50)),
|
'product' => substr(strip_tags($p->markdownNotes()), 0, 50),
|
||||||
'price' => Number::formatMoney($total, $this->subscription->company),
|
'price' => Number::formatMoney($total, $this->subscription->company),
|
||||||
'total' => $total,
|
'total' => $total,
|
||||||
'qty' => $qty,
|
'qty' => $qty,
|
||||||
|
@ -12,12 +12,16 @@
|
|||||||
|
|
||||||
namespace App\PaymentDrivers;
|
namespace App\PaymentDrivers;
|
||||||
|
|
||||||
use App\Models\ClientGatewayToken;
|
|
||||||
use App\Models\GatewayType;
|
|
||||||
use App\Models\Invoice;
|
use App\Models\Invoice;
|
||||||
use App\Models\Payment;
|
use App\Models\Payment;
|
||||||
|
use App\Models\SystemLog;
|
||||||
use App\Utils\HtmlEngine;
|
use App\Utils\HtmlEngine;
|
||||||
|
use App\Models\GatewayType;
|
||||||
|
use App\Models\PaymentHash;
|
||||||
|
use App\Models\PaymentType;
|
||||||
|
use App\Jobs\Util\SystemLogger;
|
||||||
use App\Utils\Traits\MakesHash;
|
use App\Utils\Traits\MakesHash;
|
||||||
|
use App\Models\ClientGatewayToken;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class CustomPaymentDriver.
|
* Class CustomPaymentDriver.
|
||||||
@ -81,6 +85,7 @@ class CustomPaymentDriver extends BaseDriver
|
|||||||
$this->payment_hash->save();
|
$this->payment_hash->save();
|
||||||
|
|
||||||
$data['gateway'] = $this;
|
$data['gateway'] = $this;
|
||||||
|
$data['payment_hash'] = $this->payment_hash->hash;
|
||||||
|
|
||||||
return render('gateways.custom.payment', $data);
|
return render('gateways.custom.payment', $data);
|
||||||
}
|
}
|
||||||
@ -92,6 +97,56 @@ class CustomPaymentDriver extends BaseDriver
|
|||||||
*/
|
*/
|
||||||
public function processPaymentResponse($request)
|
public function processPaymentResponse($request)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
if ($request->has('gateway_response')) {
|
||||||
|
|
||||||
|
$this->client = auth()->guard('contact')->user()->client;
|
||||||
|
|
||||||
|
$state = [
|
||||||
|
'server_response' => json_decode($request->gateway_response),
|
||||||
|
'payment_hash' => $request->payment_hash,
|
||||||
|
];
|
||||||
|
|
||||||
|
$payment_hash = PaymentHash::where('hash', $request->payment_hash)->first();
|
||||||
|
|
||||||
|
if($payment_hash)
|
||||||
|
{
|
||||||
|
$this->payment_hash = $payment_hash;
|
||||||
|
|
||||||
|
$payment_hash->data = array_merge((array) $payment_hash->data, $state);
|
||||||
|
$payment_hash->save();
|
||||||
|
}
|
||||||
|
|
||||||
|
$gateway_response = json_decode($request->gateway_response);
|
||||||
|
|
||||||
|
if ($gateway_response->status == 'COMPLETED') {
|
||||||
|
$this->logSuccessfulGatewayResponse(['response' => json_decode($request->gateway_response), 'data' => $payment_hash], SystemLog::TYPE_CUSTOM);
|
||||||
|
|
||||||
|
$data = [
|
||||||
|
'payment_method' => '',
|
||||||
|
'payment_type' => PaymentType::CREDIT_CARD_OTHER,
|
||||||
|
'amount' => $payment_hash->amount_with_fee(),
|
||||||
|
'transaction_reference' => $gateway_response?->purchase_units[0]?->payments?->captures[0]?->id,
|
||||||
|
'gateway_type_id' => GatewayType::PAYPAL,
|
||||||
|
];
|
||||||
|
|
||||||
|
$payment = $this->createPayment($data, Payment::STATUS_COMPLETED);
|
||||||
|
|
||||||
|
SystemLogger::dispatch(
|
||||||
|
['response' => $payment_hash->data->server_response, 'data' => $data],
|
||||||
|
SystemLog::CATEGORY_GATEWAY_RESPONSE,
|
||||||
|
SystemLog::EVENT_GATEWAY_SUCCESS,
|
||||||
|
SystemLog::TYPE_STRIPE,
|
||||||
|
$this->client,
|
||||||
|
$this->client->company,
|
||||||
|
);
|
||||||
|
|
||||||
|
return redirect()->route('client.payments.show', ['payment' => $this->encodePrimaryKey($payment->id)]);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
return redirect()->route('client.invoices');
|
return redirect()->route('client.invoices');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -107,7 +107,9 @@
|
|||||||
<div>
|
<div>
|
||||||
<div class="flex justify-between text-base font-medium text-gray-900">
|
<div class="flex justify-between text-base font-medium text-gray-900">
|
||||||
<h3>
|
<h3>
|
||||||
{!! nl2br($product->markdownNotes()) !!}
|
<article class="prose">
|
||||||
|
{!! $product->markdownNotes() !!}
|
||||||
|
</article>
|
||||||
</h3>
|
</h3>
|
||||||
<p class="ml-0">{{ \App\Utils\Number::formatMoney($product->price, $subscription->company) }}</p>
|
<p class="ml-0">{{ \App\Utils\Number::formatMoney($product->price, $subscription->company) }}</p>
|
||||||
</div>
|
</div>
|
||||||
@ -145,7 +147,11 @@
|
|||||||
<div class="ml-0 flex flex-1 flex-col">
|
<div class="ml-0 flex flex-1 flex-col">
|
||||||
<div>
|
<div>
|
||||||
<div class="flex justify-between text-base font-medium text-gray-900">
|
<div class="flex justify-between text-base font-medium text-gray-900">
|
||||||
<h3>{!! nl2br($product->markdownNotes()) !!}</h3>
|
<h3>
|
||||||
|
<article class="prose">
|
||||||
|
{!! $product->markdownNotes() !!}
|
||||||
|
</article>
|
||||||
|
</h3>
|
||||||
<p class="ml-0">{{ \App\Utils\Number::formatMoney($product->price, $subscription->company) }} / {{ App\Models\RecurringInvoice::frequencyForKey($subscription->frequency_id) }}</p>
|
<p class="ml-0">{{ \App\Utils\Number::formatMoney($product->price, $subscription->company) }} / {{ App\Models\RecurringInvoice::frequencyForKey($subscription->frequency_id) }}</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -186,7 +192,11 @@
|
|||||||
<div class="ml-0 flex flex-1 flex-col">
|
<div class="ml-0 flex flex-1 flex-col">
|
||||||
<div>
|
<div>
|
||||||
<div class="flex justify-between text-base font-medium text-gray-900">
|
<div class="flex justify-between text-base font-medium text-gray-900">
|
||||||
<h3>{!! nl2br($product->markdownNotes()) !!}</h3>
|
<h3>
|
||||||
|
<article class="prose">
|
||||||
|
{!! $product->markdownNotes() !!}
|
||||||
|
</article>
|
||||||
|
</h3>
|
||||||
<p class="ml-0">{{ \App\Utils\Number::formatMoney($product->price, $subscription->company) }}</p>
|
<p class="ml-0">{{ \App\Utils\Number::formatMoney($product->price, $subscription->company) }}</p>
|
||||||
</div>
|
</div>
|
||||||
<p class="mt-1 text-sm text-gray-500"></p>
|
<p class="mt-1 text-sm text-gray-500"></p>
|
||||||
@ -234,7 +244,7 @@
|
|||||||
|
|
||||||
@foreach($bundle->toArray() as $item)
|
@foreach($bundle->toArray() as $item)
|
||||||
<div class="flex justify-between mt-1 mb-1">
|
<div class="flex justify-between mt-1 mb-1">
|
||||||
<span class="font-light text-sm">{{ $item['qty'] }} x {{ substr(str_replace(["\r","\n","<BR>","<BR />","<br>","<br />"]," ", $item['product']), 0, 30) . "..." }}</span>
|
<span class="font-light text-sm">{{ $item['qty'] }} x {{ $item['product'] }}</span>
|
||||||
<span class="font-bold text-sm">{{ $item['price'] }}</span>
|
<span class="font-bold text-sm">{{ $item['price'] }}</span>
|
||||||
</div>
|
</div>
|
||||||
@endforeach
|
@endforeach
|
||||||
|
@ -1,7 +1,15 @@
|
|||||||
@extends('portal.ninja2020.layout.payments', ['gateway_title' => $title, 'card_title' => $title])
|
@extends('portal.ninja2020.layout.payments', ['gateway_title' => $title, 'card_title' => $title])
|
||||||
|
|
||||||
@section('gateway_content')
|
@section('gateway_content')
|
||||||
@component('portal.ninja2020.components.general.card-element', ['title' => ctrans('texts.payment_type')])
|
<form action="{{ route('client.payments.response') }}" method="post" id="server-response">
|
||||||
|
@csrf
|
||||||
|
<input type="hidden" name="gateway_response">
|
||||||
|
<input type="hidden" name="payment_hash" value="{{ $payment_hash }}">
|
||||||
|
<input type="hidden" name="company_gateway_id" value="{{ $gateway->getCompanyGatewayId() }}">
|
||||||
|
<input type="hidden" name="payment_method_id" value="{{ $payment_method_id }}">
|
||||||
|
<input type="hidden" name="token">
|
||||||
|
</form>
|
||||||
|
@component('portal.ninja2020.components.general.card-element', ['title' => ctrans('texts.payment_type')])
|
||||||
{{ $title }}
|
{{ $title }}
|
||||||
@endcomponent
|
@endcomponent
|
||||||
|
|
||||||
@ -11,3 +19,18 @@
|
|||||||
{!! nl2br($instructions) !!}
|
{!! nl2br($instructions) !!}
|
||||||
@endcomponent
|
@endcomponent
|
||||||
@endsection
|
@endsection
|
||||||
|
<script>
|
||||||
|
|
||||||
|
function submitResponse(response){
|
||||||
|
|
||||||
|
console.log("lets go!");
|
||||||
|
|
||||||
|
document.querySelector(
|
||||||
|
'input[name="gateway_response"]'
|
||||||
|
).value = JSON.stringify(response);
|
||||||
|
|
||||||
|
document.getElementById('server-response').submit();
|
||||||
|
console.log("we did not go!!");
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
Loading…
x
Reference in New Issue
Block a user