deliveryUri = $delivery->getUri(); $this->delivery = $delivery; } /** * Return a unique name for this event * @see \oat\oatbox\event\Event::getName() */ public function getName() { return self::class; } /** * Specify data which should be serialized to JSON * @link http://php.net/manual/en/jsonserializable.jsonserialize.php * @return mixed data which can be serialized by json_encode, * which is a value of any type other than a resource. * @since 5.4.0 */ public function jsonSerialize() { return [ 'delivery' => $this->delivery->getUri(), ]; } /** * @return string */ public function getWebhookEventName() { return 'DeliveryCreatedEvent'; } /** * @return array */ public function serializeForWebhook(): array { $testUri = null; try { $testProperty = new \core_kernel_classes_Property(DeliveryAssemblyService::PROPERTY_ORIGIN); $testUri = $this->delivery->getOnePropertyValue($testProperty)->getUri(); } catch (\Throwable $e) {} return [ 'deliveryId' => $this->deliveryUri, 'testId' => $testUri, ]; } }