mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-24 02:14:21 -04:00
Fixes for calculating pro rata refunds between subscriptions with differing frequencies
This commit is contained in:
parent
686b48c42b
commit
b0e61759d5
@ -22,7 +22,7 @@ use Livewire\Component;
|
||||
class SubscriptionPlanSwitch extends Component
|
||||
{
|
||||
/**
|
||||
* @var RecurringInvoice
|
||||
* @var \App\Models\RecurringInvoice
|
||||
*/
|
||||
public $recurring_invoice;
|
||||
|
||||
|
@ -355,7 +355,7 @@ class SubscriptionService
|
||||
* @param Invoice $invoice
|
||||
* @return float
|
||||
*/
|
||||
private function calculateProRataRefund($invoice) :float
|
||||
private function calculateProRataRefund($invoice, $subscription = null) :float
|
||||
{
|
||||
if (!$invoice || !$invoice->date) {
|
||||
return 0;
|
||||
@ -367,7 +367,10 @@ class SubscriptionService
|
||||
|
||||
$days_of_subscription_used = $start_date->diffInDays($current_date);
|
||||
|
||||
$days_in_frequency = $this->getDaysInFrequency();
|
||||
if($subscription)
|
||||
$days_in_frequency = $subscription->service()->getDaysInFrequency();
|
||||
else
|
||||
$days_in_frequency = $this->getDaysInFrequency();
|
||||
|
||||
if ($days_of_subscription_used >= $days_in_frequency) {
|
||||
return 0;
|
||||
|
2
public/vendor/livewire/livewire.js
vendored
2
public/vendor/livewire/livewire.js
vendored
File diff suppressed because one or more lines are too long
2
public/vendor/livewire/livewire.js.map
vendored
2
public/vendor/livewire/livewire.js.map
vendored
File diff suppressed because one or more lines are too long
2
public/vendor/livewire/manifest.json
vendored
2
public/vendor/livewire/manifest.json
vendored
@ -1 +1 @@
|
||||
{"/livewire.js":"/livewire.js?id=fe747446aa84856d8b66"}
|
||||
{"/livewire.js":"/livewire.js?id=90730a3b0e7144480175"}
|
Loading…
x
Reference in New Issue
Block a user