mirror of
				https://github.com/invoiceninja/invoiceninja.git
				synced 2025-11-04 02:57:33 -05:00 
			
		
		
		
	fixes for tests
This commit is contained in:
		
							parent
							
								
									4bccdae01e
								
							
						
					
					
						commit
						f2a8e5f4df
					
				@ -56,6 +56,7 @@ class UpdateCompanyLedgerWithInvoice
 | 
			
		||||
        if($ledger)
 | 
			
		||||
            $balance = $ledger->balance;
 | 
			
		||||
 | 
			
		||||
\Log::error("adjusting balance {$balance}");
 | 
			
		||||
 | 
			
		||||
        $company_ledger = CompanyLedgerFactory::create($this->invoice->company_id, $this->invoice->user_id);
 | 
			
		||||
        $company_ledger->client_id = $this->invoice->client_id;
 | 
			
		||||
 | 
			
		||||
@ -9,7 +9,7 @@
 | 
			
		||||
 * @license https://opensource.org/licenses/AAL
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
namespace Jobs\Invoice;
 | 
			
		||||
namespace App\Jobs\Invoice;
 | 
			
		||||
 | 
			
		||||
use App\Events\Payment\PaymentWasCreated;
 | 
			
		||||
use App\Factory\PaymentFactory;
 | 
			
		||||
@ -23,7 +23,6 @@ use Illuminate\Contracts\Queue\ShouldQueue;
 | 
			
		||||
use Illuminate\Foundation\Bus\Dispatchable;
 | 
			
		||||
use Illuminate\Queue\InteractsWithQueue;
 | 
			
		||||
use Illuminate\Queue\SerializesModels;
 | 
			
		||||
use Illuminate\Support\Facades\Log;
 | 
			
		||||
 | 
			
		||||
class MarkInvoicePaid implements ShouldQueue
 | 
			
		||||
{
 | 
			
		||||
@ -68,6 +67,6 @@ class MarkInvoicePaid implements ShouldQueue
 | 
			
		||||
 | 
			
		||||
        UpdateCompanyLedgerWithPayment::dispatchNow($payment, $payment->amount);
 | 
			
		||||
        
 | 
			
		||||
        return $invoice;
 | 
			
		||||
        return $this->invoice;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -43,8 +43,6 @@ class PaymentCreatedActivity implements ShouldQueue
 | 
			
		||||
 | 
			
		||||
        $invoices = $payment->invoices;
 | 
			
		||||
        
 | 
			
		||||
        \Log::error($invoices->count());
 | 
			
		||||
        
 | 
			
		||||
        $fields = new \stdClass;
 | 
			
		||||
 | 
			
		||||
        $fields->payment_id = $payment->id;
 | 
			
		||||
 | 
			
		||||
@ -252,14 +252,9 @@ class BasePaymentDriver
 | 
			
		||||
                        ->whereClientId($this->client->id)
 | 
			
		||||
                        ->get();
 | 
			
		||||
 | 
			
		||||
        \Log::error($hashed_ids);
 | 
			
		||||
        \Log::error($invoices->count());
 | 
			
		||||
 | 
			
		||||
		$payment->invoices()->sync($invoices);
 | 
			
		||||
        $payment->save();
 | 
			
		||||
 | 
			
		||||
        \Log::error(print_r($payment,1));
 | 
			
		||||
 | 
			
		||||
        return $payment;
 | 
			
		||||
  	}
 | 
			
		||||
}
 | 
			
		||||
@ -108,6 +108,8 @@ class InvoiceRepository extends BaseRepository
 | 
			
		||||
        $this->markInvitationsSent();
 | 
			
		||||
 | 
			
		||||
        $invoice->save();
 | 
			
		||||
\Log::error("marking sent");
 | 
			
		||||
        UpdateCompanyLedgerWithInvoice::dispatchNow($this->invoice, $this->balance);
 | 
			
		||||
 | 
			
		||||
        return $invoice;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -6,6 +6,7 @@ use App\DataMapper\DefaultSettings;
 | 
			
		||||
use App\Events\Invoice\InvoiceWasMarkedSent;
 | 
			
		||||
use App\Events\Invoice\InvoiceWasUpdated;
 | 
			
		||||
use App\Helpers\Invoice\InvoiceCalc;
 | 
			
		||||
use App\Listeners\Invoice\CreateInvoiceInvitation;
 | 
			
		||||
use App\Models\Account;
 | 
			
		||||
use App\Models\Client;
 | 
			
		||||
use App\Models\ClientContact;
 | 
			
		||||
@ -16,6 +17,7 @@ use App\Models\GroupSetting;
 | 
			
		||||
use App\Models\Invoice;
 | 
			
		||||
use App\Models\User;
 | 
			
		||||
use App\Models\UserAccount;
 | 
			
		||||
use App\Repositories\InvoiceRepository;
 | 
			
		||||
use Illuminate\Database\Seeder;
 | 
			
		||||
use Illuminate\Support\Facades\Log;
 | 
			
		||||
 | 
			
		||||
@ -109,8 +111,9 @@ class RandomDataSeeder extends Seeder
 | 
			
		||||
        factory(\App\Models\Invoice::class,500)->create(['user_id' => $user->id, 'company_id' => $company->id, 'client_id' => $client->id, 'settings' => ClientSettings::buildClientSettings($company->settings, $client->settings)]);
 | 
			
		||||
 | 
			
		||||
        $invoices = Invoice::all();
 | 
			
		||||
        $invoice_repo = new InvoiceRepository();
 | 
			
		||||
 | 
			
		||||
        $invoices->each(function ($invoice){
 | 
			
		||||
        $invoices->each(function ($invoice) use($invoice_repo){
 | 
			
		||||
                
 | 
			
		||||
            $invoice_calc = new InvoiceCalc($invoice, $invoice->settings);
 | 
			
		||||
 | 
			
		||||
@ -118,6 +121,10 @@ class RandomDataSeeder extends Seeder
 | 
			
		||||
            
 | 
			
		||||
            $invoice->save();
 | 
			
		||||
 | 
			
		||||
            event(new CreateInvoiceInvitation($invoice));
 | 
			
		||||
 | 
			
		||||
            $invoice_repo->markSent($invoice);
 | 
			
		||||
 | 
			
		||||
            event(new InvoiceWasMarkedSent($invoice));
 | 
			
		||||
        });
 | 
			
		||||
        
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user