Пример #1
0
        public async Task RefundLottery_WrongLotteryId_Exits()
        {
            _lotteryService.GetLotteryAsync(1).ReturnsNull();

            await _sut.RefundLotteryAsync(1, _userAndOrganization);

            await _participantService.DidNotReceiveWithAnyArgs().GetParticipantsCountedAsync(default);
Пример #2
0
        public async Task RefundLotteryAsync(int lotteryId, UserAndOrganizationDto userOrg)
        {
            var lottery = await _lotteryService.GetLotteryAsync(lotteryId);

            if (lottery == null || lottery.OrganizationId != userOrg.OrganizationId)
            {
                return;
            }

            try
            {
                var refundLogs = await CreateKudosLogsAsync(lottery, userOrg);
                await AddKudosLogsAsync(lottery, refundLogs, userOrg);
                await UpdateUserProfilesAsync(lottery, refundLogs, userOrg);
            }
            catch (Exception e)
            {
                _logger.Error(e);
                _asyncRunner.Run <ILotteryService>(async n => await n.UpdateRefundFailedFlagAsync(lottery.Id, true, userOrg), _uow.ConnectionName);
            }
        }