Deploy Ladill Woo Manager / deploy (push) Failing after 2s
Standalone app with SSO shell, WordPress plugin connect flow, webhook ingest, fulfillment inbox, and plugin activation API — no payment processing. Co-authored-by: Cursor <cursoragent@cursor.com>
73 lines
2.0 KiB
PHP
73 lines
2.0 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
class WooOrder extends Model
|
|
{
|
|
public const FULFILLMENT_NEW = 'new';
|
|
public const FULFILLMENT_CONFIRMED = 'confirmed';
|
|
public const FULFILLMENT_PREPARING = 'preparing';
|
|
public const FULFILLMENT_READY = 'ready';
|
|
public const FULFILLMENT_DELIVERED = 'delivered';
|
|
public const FULFILLMENT_CANCELLED = 'cancelled';
|
|
|
|
public const FULFILLMENT_STATUSES = [
|
|
self::FULFILLMENT_NEW => 'New',
|
|
self::FULFILLMENT_CONFIRMED => 'Confirmed',
|
|
self::FULFILLMENT_PREPARING => 'Preparing',
|
|
self::FULFILLMENT_READY => 'Ready',
|
|
self::FULFILLMENT_DELIVERED => 'Delivered',
|
|
self::FULFILLMENT_CANCELLED => 'Cancelled',
|
|
];
|
|
|
|
protected $fillable = [
|
|
'woo_store_id',
|
|
'external_order_id',
|
|
'order_number',
|
|
'wc_status',
|
|
'payment_status',
|
|
'customer_name',
|
|
'customer_email',
|
|
'customer_phone',
|
|
'line_items',
|
|
'billing_address',
|
|
'shipping_address',
|
|
'currency',
|
|
'total_minor',
|
|
'fulfillment_status',
|
|
'wc_updated_at',
|
|
'metadata',
|
|
];
|
|
|
|
protected $casts = [
|
|
'line_items' => 'array',
|
|
'billing_address' => 'array',
|
|
'shipping_address' => 'array',
|
|
'metadata' => 'array',
|
|
'total_minor' => 'integer',
|
|
'wc_updated_at' => 'datetime',
|
|
];
|
|
|
|
public function store(): BelongsTo
|
|
{
|
|
return $this->belongsTo(WooStore::class, 'woo_store_id');
|
|
}
|
|
|
|
public function fulfillmentLabel(): string
|
|
{
|
|
return self::FULFILLMENT_STATUSES[$this->fulfillment_status ?? self::FULFILLMENT_NEW]
|
|
?? ucfirst((string) $this->fulfillment_status);
|
|
}
|
|
|
|
public function totalFormatted(): string
|
|
{
|
|
$minor = (int) $this->total_minor;
|
|
$currency = strtoupper((string) ($this->currency ?: 'GHS'));
|
|
|
|
return $currency.' '.number_format($minor / 100, 2);
|
|
}
|
|
}
|