Add Woo Manager email notification milestones with shared mail templates.
Deploy Ladill Woo Manager / deploy (push) Successful in 2m11s
Deploy Ladill Woo Manager / deploy (push) Successful in 2m11s
New order, store connected, Pro expiry, and past-due alerts use the Ladill notification layout with woo branding; expiry reminders dedupe per threshold like hosting. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -6,6 +6,7 @@ use App\Models\WooStore;
|
||||
use App\Services\Woo\CategoryIngestService;
|
||||
use App\Services\Woo\OrderIngestService;
|
||||
use App\Services\Woo\ProductIngestService;
|
||||
use App\Services\Woo\WooNotificationService;
|
||||
use App\Services\Woo\WooWebhookVerifier;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
@@ -17,6 +18,7 @@ class WooWebhookController extends Controller
|
||||
private OrderIngestService $orders,
|
||||
private ProductIngestService $products,
|
||||
private CategoryIngestService $categories,
|
||||
private WooNotificationService $notifications,
|
||||
) {}
|
||||
|
||||
public function __invoke(Request $request, string $storePublicId): JsonResponse
|
||||
@@ -46,7 +48,7 @@ class WooWebhookController extends Controller
|
||||
}
|
||||
|
||||
return match (true) {
|
||||
str_starts_with($topic, 'order.') => $this->handleOrder($store, $payload),
|
||||
str_starts_with($topic, 'order.') => $this->handleOrder($store, $topic, $payload),
|
||||
str_starts_with($topic, 'product_category.') => $this->handleCategory($store, $topic, $payload),
|
||||
str_starts_with($topic, 'product.') => $this->handleProduct($store, $topic, $payload),
|
||||
default => response()->json(['ignored' => true]),
|
||||
@@ -54,10 +56,14 @@ class WooWebhookController extends Controller
|
||||
}
|
||||
|
||||
/** @param array<string, mixed> $payload */
|
||||
private function handleOrder(WooStore $store, array $payload): JsonResponse
|
||||
private function handleOrder(WooStore $store, string $topic, array $payload): JsonResponse
|
||||
{
|
||||
$order = $this->orders->ingest($store, $payload);
|
||||
|
||||
if ($topic === 'order.created' && $order->wasRecentlyCreated) {
|
||||
$this->notifications->orderReceived($order, $store);
|
||||
}
|
||||
|
||||
return response()->json([
|
||||
'ok' => true,
|
||||
'order_id' => $order->id,
|
||||
|
||||
Reference in New Issue
Block a user