refactor: Split shipping_address into component fields for ShipLogic API

- Create migration to add shipping_street_address, shipping_local_area, shipping_city, shipping_zone, shipping_country, shipping_postcode, shipping_type
- Update Order model fillable array with new address component fields
- Remove address parsing logic from CourierService
- Use individual address fields directly in ShipLogic API payload
- Fields match ShipLogic API requirements (street_address, local_area, city, zone, code, country, type)
- Note: Custom orders address collection can be implemented later
This commit is contained in:
twotalesanimation
2026-01-02 21:40:16 +02:00
parent 206ea2d35c
commit 124ab46507
4 changed files with 905 additions and 9 deletions
@@ -0,0 +1,43 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('orders', function (Blueprint $table) {
// Add new address component columns
$table->string('shipping_street_address')->nullable()->after('shipping_address');
$table->string('shipping_local_area')->nullable()->after('shipping_street_address');
$table->string('shipping_city')->nullable()->after('shipping_local_area');
$table->string('shipping_zone')->nullable()->after('shipping_city');
$table->string('shipping_country')->default('ZA')->after('shipping_zone');
$table->string('shipping_postcode')->nullable()->after('shipping_country');
$table->enum('shipping_type', ['residential', 'business'])->default('residential')->after('shipping_postcode');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('orders', function (Blueprint $table) {
$table->dropColumn([
'shipping_street_address',
'shipping_local_area',
'shipping_city',
'shipping_zone',
'shipping_country',
'shipping_postcode',
'shipping_type',
]);
});
}
};