Refactor the pricing calculation service and shipping rate import logic to improve consistency and reliability. This includes updating direction naming conventions, enhancing model casting, and adding comprehensive test suites. - Update `ShippingRatesImport` to use 'outbound' and 'inbound' instead of 'export' and 'import' - Refactor `PriceCalculatorService` to use a more modular calculation structure - Update `ShippingRate` model to use explicit property casting for zones - Add `HasFactory` trait to `Country` and `ShippingRate` models - Add new database factories for `Country` and `ShippingRate` - Implement new feature tests for API endpoints and service logic - Add new service tests for `PriceCalculatorService`
25 lines
693 B
PHP
25 lines
693 B
PHP
<?php
|
|
|
|
namespace Database\Factories;
|
|
|
|
use App\Models\Country;
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
|
|
class CountryFactory extends Factory
|
|
{
|
|
protected $model = Country::class;
|
|
|
|
public function definition(): array
|
|
{
|
|
return [
|
|
'iso_code' => $this->faker->countryCode(),
|
|
'name' => $this->faker->country(),
|
|
'export_zone_parcel' => $this->faker->numberBetween(1, 10),
|
|
'export_zone_doc' => $this->faker->numberBetween(1, 10),
|
|
'import_zone_parcel' => $this->faker->numberBetween(1, 10),
|
|
'import_zone_doc' => $this->faker->numberBetween(1, 10),
|
|
'is_active' => true,
|
|
];
|
|
}
|
|
}
|