Exemple #1
0
        public async Task Register(string ip, string clientId)
        {
            var record = await _linkRedirectRepository.GetRedirect(ip);

            if (record == null || DateTime.UtcNow > record.ExpirationDt)
            {
                return;
            }

            var item = await _referralRepository.SaveReferral(clientId, record.AffiliateId);

            _memoryCache.Set(Constants.GetCacheReferralKey(clientId), item);

            await _logger.WriteInfoAsync(nameof(AffiliateService), nameof(Register), $"New referral {clientId} for {record.AffiliateId} registered. (Link expiration {record.ExpirationDt}");
        }