private function validatePromotion(array $payload, ConstraintViolationList $violationList)
    {
        /** @var bool|null $useCodes */
        $useCodes = $this->getValue($payload, 'use_codes', null);

        /** @var string $code */
        $code = $this->getValue($payload, 'code', null);

        $validFrom = $this->getValue($payload, 'valid_from', null);

        /** @var string|null $validUntil */
        $validUntil = $this->getValue($payload, 'valid_until', null);

        if ($useCodes !== null && $code !== null) {
            $trimmedCode = trim($code);

            if ($useCodes && trim($code) === '') {
                $violationList->add($this->buildViolation('Please provide a valid code', $code));
            }

            if ($useCodes && strlen($code) > strlen($trimmedCode)) {
                $violationList->add($this->buildViolation('Code may not have any leading or ending whitespaces', $code));
            }
        }

        // if we have both a date from and until, make sure that
        // the dateUntil is always in the future.
        if ($validFrom !== null && $validUntil !== null) {
            // now convert into real date times
            // and start comparing them
            $dateFrom = new \DateTime($validFrom);
            $dateUntil = new \DateTime($validUntil);
            if ($dateUntil < $dateFrom) {
                $violationList->add($this->buildViolation('Expiration Date of Promotion must be after that Begin Data', $payload['valid_until']));
            }
        }
    }