Welcome EInvoice email

This commit is contained in:
David Bomba 2024-11-25 15:36:28 +11:00
parent bb85d1d21c
commit 61e71a43ca
6 changed files with 22 additions and 17 deletions

View File

@ -106,11 +106,11 @@ class EInvoiceController extends BaseController
$pm->InstructionNote = $payment_means['information']; $pm->InstructionNote = $payment_means['information'];
} }
nlog($pm); // nlog($pm);
$einvoice->PaymentMeans[] = $pm; $einvoice->PaymentMeans[] = $pm;
} }
nlog($einvoice); // nlog($einvoice);
$stub = new \stdClass(); $stub = new \stdClass();
$stub->Invoice = $einvoice; $stub->Invoice = $einvoice;

View File

@ -165,6 +165,16 @@ class License extends StaticModel
} }
public function countEntities(): int
{
if (!is_array($this->entities)) {
return 0;
}
return count($this->entities);
}
public function findEntity(string $key, mixed $value): ?TaxEntity public function findEntity(string $key, mixed $value): ?TaxEntity
{ {

View File

@ -67,6 +67,11 @@ class StorecoveProxy
$response = $this->storecove->setupLegalEntity($data); $response = $this->storecove->setupLegalEntity($data);
if (is_array($response)) { if (is_array($response)) {
if ($this->company->account->companies()->whereNotNull('legal_entity_id')->count() == 1) {
\Modules\Admin\Jobs\Storecove\SendWelcomeEmail::dispatch($this->company);
}
return $response; return $response;
} }

View File

@ -88,6 +88,4 @@ Contact support: contact@invoiceninja.com
Thank you for choosing our e-invoicing service. Thank you for choosing our e-invoicing service.
" "
]; ];

View File

@ -191,6 +191,9 @@ class ReportCsvGenerationTest extends TestCase
*/ */
private function buildData() private function buildData()
{ {
if($this->account)
$this->account->forceDelete();
/** @var \App\Models\Account $account */ /** @var \App\Models\Account $account */
$this->account = Account::factory()->create([ $this->account = Account::factory()->create([
'hosted_client_count' => 1000, 'hosted_client_count' => 1000,
@ -301,7 +304,7 @@ class ReportCsvGenerationTest extends TestCase
$this->assertEquals('john@doe.com', $this->getFirstValueByColumn($csv, 'Contact Email')); $this->assertEquals('john@doe.com', $this->getFirstValueByColumn($csv, 'Contact Email'));
$this->account->forceDelete(); $this->account->forceDelete();
} }
@ -473,17 +476,6 @@ $this->account->forceDelete();
$this->assertEquals(1, $q->count()); $this->assertEquals(1, $q->count());
// $q = Invoice::whereJsonContains('line_items', ['product_key' => 'Bob the builder']);
// $this->assertEquals(0, $q->count());
// $q = Invoice::whereJsonContains('line_items', ['product_key' => 'bob']);
// $this->assertEquals(0, $q->count());
// $q->forceDelete();
// Invoice::withTrashed()->cursor()->each(function ($i) { $i->forceDelete();});
$this->account->forceDelete(); $this->account->forceDelete();
} }

View File

@ -363,7 +363,7 @@ class EInvoiceValidationTest extends TestCase
'company_id' => $company->id, 'company_id' => $company->id,
'classification' => 'individual', 'classification' => 'individual',
'vat_number' => '', 'vat_number' => '',
'country_id' => 276, 'country_id' => 2763,
'address1' => '10 Wallaby Way', 'address1' => '10 Wallaby Way',
'address2' => '', 'address2' => '',
'city' => 'Sydney', 'city' => 'Sydney',