mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-24 02:14:21 -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)) {
|
||||
$query->orWhereIn('status_id', [Invoice::STATUS_SENT, Invoice::STATUS_PARTIAL])
|
||||
->where('due_date', '<', Carbon::now())
|
||||
->orWhere('due_date', null)
|
||||
->orWhere('partial_due_date', '<', Carbon::now());
|
||||
}
|
||||
});
|
||||
|
@ -311,7 +311,7 @@ class BillingPortalPurchasev2 extends Component
|
||||
'description' => $p->notes,
|
||||
'product_key' => $p->product_key,
|
||||
'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),
|
||||
'total' => $total,
|
||||
'qty' => $qty,
|
||||
@ -329,7 +329,7 @@ class BillingPortalPurchasev2 extends Component
|
||||
'description' => $p->notes,
|
||||
'product_key' => $p->product_key,
|
||||
'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),
|
||||
'total' => $total,
|
||||
'qty' => $qty,
|
||||
@ -352,7 +352,7 @@ class BillingPortalPurchasev2 extends Component
|
||||
'description' => $p->notes,
|
||||
'product_key' => $p->product_key,
|
||||
'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),
|
||||
'total' => $total,
|
||||
'qty' => $qty,
|
||||
@ -375,7 +375,7 @@ class BillingPortalPurchasev2 extends Component
|
||||
'description' => $p->notes,
|
||||
'product_key' => $p->product_key,
|
||||
'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),
|
||||
'total' => $total,
|
||||
'qty' => $qty,
|
||||
|
@ -12,12 +12,16 @@
|
||||
|
||||
namespace App\PaymentDrivers;
|
||||
|
||||
use App\Models\ClientGatewayToken;
|
||||
use App\Models\GatewayType;
|
||||
use App\Models\Invoice;
|
||||
use App\Models\Payment;
|
||||
use App\Models\SystemLog;
|
||||
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\Models\ClientGatewayToken;
|
||||
|
||||
/**
|
||||
* Class CustomPaymentDriver.
|
||||
@ -81,6 +85,7 @@ class CustomPaymentDriver extends BaseDriver
|
||||
$this->payment_hash->save();
|
||||
|
||||
$data['gateway'] = $this;
|
||||
$data['payment_hash'] = $this->payment_hash->hash;
|
||||
|
||||
return render('gateways.custom.payment', $data);
|
||||
}
|
||||
@ -92,6 +97,56 @@ class CustomPaymentDriver extends BaseDriver
|
||||
*/
|
||||
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');
|
||||
}
|
||||
|
||||
|
@ -107,7 +107,9 @@
|
||||
<div>
|
||||
<div class="flex justify-between text-base font-medium text-gray-900">
|
||||
<h3>
|
||||
{!! nl2br($product->markdownNotes()) !!}
|
||||
<article class="prose">
|
||||
{!! $product->markdownNotes() !!}
|
||||
</article>
|
||||
</h3>
|
||||
<p class="ml-0">{{ \App\Utils\Number::formatMoney($product->price, $subscription->company) }}</p>
|
||||
</div>
|
||||
@ -145,7 +147,11 @@
|
||||
<div class="ml-0 flex flex-1 flex-col">
|
||||
<div>
|
||||
<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>
|
||||
</div>
|
||||
</div>
|
||||
@ -186,7 +192,11 @@
|
||||
<div class="ml-0 flex flex-1 flex-col">
|
||||
<div>
|
||||
<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>
|
||||
</div>
|
||||
<p class="mt-1 text-sm text-gray-500"></p>
|
||||
@ -234,7 +244,7 @@
|
||||
|
||||
@foreach($bundle->toArray() as $item)
|
||||
<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>
|
||||
</div>
|
||||
@endforeach
|
||||
|
@ -1,7 +1,15 @@
|
||||
@extends('portal.ninja2020.layout.payments', ['gateway_title' => $title, 'card_title' => $title])
|
||||
|
||||
@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 }}
|
||||
@endcomponent
|
||||
|
||||
@ -11,3 +19,18 @@
|
||||
{!! nl2br($instructions) !!}
|
||||
@endcomponent
|
||||
@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