mirror of
				https://github.com/invoiceninja/invoiceninja.git
				synced 2025-10-31 13:47:32 -04:00 
			
		
		
		
	Fixes for paid invoices via gateways
This commit is contained in:
		
							parent
							
								
									0b56e8d4cb
								
							
						
					
					
						commit
						2f7e01c5a4
					
				| @ -201,6 +201,14 @@ class InvoiceService | |||||||
|         return $this; |         return $this; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     public function updateStatus() | ||||||
|  |     { | ||||||
|  |         if($this->invoice->balance == 0) | ||||||
|  |             $this->setStatus(Invoice::STATUS_PAID); | ||||||
|  | 
 | ||||||
|  |         return $this; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|     public function toggleFeesPaid() |     public function toggleFeesPaid() | ||||||
|     { |     { | ||||||
|         $this->invoice->line_items = collect($this->invoice->line_items) |         $this->invoice->line_items = collect($this->invoice->line_items) | ||||||
|  | |||||||
| @ -73,6 +73,7 @@ class UpdateInvoicePayment | |||||||
|             $invoice->service() //caution what if we amount paid was less than partial - we wipe it!
 |             $invoice->service() //caution what if we amount paid was less than partial - we wipe it!
 | ||||||
|                 ->clearPartial() |                 ->clearPartial() | ||||||
|                 ->updateBalance($paid_amount * -1) |                 ->updateBalance($paid_amount * -1) | ||||||
|  |                 ->updateStatus() | ||||||
|                 ->save(); |                 ->save(); | ||||||
| 
 | 
 | ||||||
|             event(new InvoiceWasUpdated($invoice, $invoice->company, Ninja::eventVars())); |             event(new InvoiceWasUpdated($invoice, $invoice->company, Ninja::eventVars())); | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user