Fixes for credit creation after downgrading a subscription service
This commit is contained in:
parent
490c026a08
commit
5d459aaa2f
3 changed files with 4 additions and 5 deletions
|
|
@ -83,9 +83,8 @@ class PaymentRepository extends BaseRepository {
|
|||
if ($data['amount'] == '') {
|
||||
$data['amount'] = array_sum(array_column($data['invoices'], 'amount'));
|
||||
}
|
||||
|
||||
|
||||
$client->service()->updatePaidToDate($data['amount'])->save();
|
||||
// $client->paid_to_date += $data['amount'];
|
||||
$client->save();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -105,8 +105,8 @@ class ApplyPayment
|
|||
|
||||
private function addPaymentToLedger()
|
||||
{
|
||||
$this->payment->amount += $this->amount_applied;
|
||||
$this->payment->applied += $this->amount_applied;
|
||||
// $this->payment->amount += $this->amount_applied;
|
||||
// $this->payment->applied += $this->amount_applied;
|
||||
$this->payment->status_id = Payment::STATUS_COMPLETED;
|
||||
$this->payment->currency_id = $this->credit->client->getSetting('currency_id');
|
||||
$this->payment->save();
|
||||
|
|
|
|||
|
|
@ -416,7 +416,7 @@ else
|
|||
foreach($invoice->line_items as $item)
|
||||
{
|
||||
|
||||
if($item->product_key != ctrans('texts.refund'))
|
||||
if($item->product_key != ctrans('texts.refund') && ($item->type_id == "1" || $item->type_id == "2"))
|
||||
{
|
||||
|
||||
$item->cost = ($item->cost*$ratio*$multiplier);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue