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