woocommerceHelper = $woocommerceHelper; $this->subscribersRepository = $subscribersRepository; } public function updateSubscriberEngagement($orderId): void { $order = $this->woocommerceHelper->wcGetOrder($orderId); if (!$order instanceof WC_Order) { return; } $subscriber = $this->subscribersRepository->findOneBy(['email' => $order->get_billing_email()]); if (!$subscriber instanceof SubscriberEntity) { return; } $this->subscribersRepository->maybeUpdateLastEngagement($subscriber); } public function updateSubscriberLastPurchase($orderId): void { $order = $this->woocommerceHelper->wcGetOrder($orderId); if (!$order instanceof WC_Order) { return; } $subscriber = $this->subscribersRepository->findOneBy(['email' => $order->get_billing_email()]); if (!$subscriber instanceof SubscriberEntity) { return; } $this->subscribersRepository->maybeUpdateLastPurchaseAt($subscriber); } }