log_repository = new MessageLogRepository(); } /** * Build duplicate key. * * @param int $order_id Order ID. * @param string $order_status Order status. * @param string $recipient_phone Phone. * @param string $channel Channel. * @param string $template_message Template message. */ public static function build_key( int $order_id, string $order_status, string $recipient_phone, string $channel, string $template_message ): string { return hash( 'sha256', implode( '|', array( $order_id, $order_status, $recipient_phone, $channel, md5( $template_message ) ) ) ); } /** * Check if already successfully sent. * * @param string $duplicate_key Duplicate key. */ public function already_sent( string $duplicate_key ): bool { return $this->log_repository->successful_duplicate_exists( $duplicate_key ); } }