Location observers
This commit is contained in:
parent
4e58c92bd3
commit
486804eb30
|
|
@ -24,8 +24,8 @@ class LocationObserver
|
|||
public function created(Location $location)
|
||||
{
|
||||
|
||||
if ($location->client->country_id == 840 && $location->client->company->calculate_taxes && !$location->client->company->account->isFreeHostedClient()) {
|
||||
UpdateLocationTaxData::dispatch($location, $location->client->company);
|
||||
if ($location->country_id == 840 && $location->company->calculate_taxes && !$location->company->account->isFreeHostedClient()) {
|
||||
UpdateLocationTaxData::dispatch($location, $location->company);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -39,8 +39,8 @@ class LocationObserver
|
|||
public function updated(Location $location)
|
||||
{
|
||||
|
||||
if ($location->getOriginal('postal_code') != $location->postal_code && $location->country_id == 840 && $location->client->company->calculate_taxes && !$location->client->company->account->isFreeHostedClient()) {
|
||||
UpdateLocationTaxData::dispatch($location, $location->client->company);
|
||||
if ($location->getOriginal('postal_code') != $location->postal_code && $location->country_id == 840 && $location->company->calculate_taxes && !$location->company->account->isFreeHostedClient()) {
|
||||
UpdateLocationTaxData::dispatch($location, $location->company);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ class LocationFactory extends Factory
|
|||
'city' => $this->faker->city(),
|
||||
'state' => $this->faker->state(),
|
||||
'postal_code' => $this->faker->postcode(),
|
||||
'country_id' => 4,
|
||||
'country_id' => 840,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -331,6 +331,7 @@ class LocationApiTest extends TestCase
|
|||
$location = Location::factory()->create([
|
||||
'company_id' => $this->company->id,
|
||||
'user_id' => $this->user->id,
|
||||
'country_id' => '840',
|
||||
]);
|
||||
|
||||
$response = $this->withHeaders([
|
||||
|
|
|
|||
Loading…
Reference in New Issue