/// <summary> /// Registers a Tie bet action /// </summary> /// <param name="gameActionData"></param> /// <param name="context"></param> /// <returns></returns> async Task <Guid> IGameCommands.TieBetAsync([NotNull] GameActionData gameActionData, [NotNull] GameActionContext context) { var gameProviderId = await ValidateGameProvider(context.GameProviderCode); ValidateTransactionIsUnique(gameActionData.ExternalTransactionId, gameProviderId); using (var scope = CustomTransactionScope.GetTransactionScopeAsync()) { var round = GetRound(gameActionData); await _walletOperations.TieBetAsync(round.Data.PlayerId, round.Data.GameId, round.Data.Id, gameActionData.Amount, gameActionData.ExternalTransactionId); var tieGameActionId = round.Tie(gameActionData, context); await _repository.SaveChangesAsync(); round.Events.ForEach(ev => _eventBus.Publish(ev)); scope.Complete(); return(tieGameActionId); } }
async Task <Guid> IGameCommands.TieBetAsync([NotNull] GameActionData actionData, [NotNull] GameActionContext context) { var gameProviderId = await ValidateGameProviderAsync(context.GameProviderCode); ValidateTransactionIsUnique(actionData.ExternalTransactionId, gameProviderId); using (var scope = CustomTransactionScope.GetTransactionScopeAsync()) { var round = GetRound(actionData); var walletTransactionId = await _walletOperations.TieBetAsync(round.Data.PlayerId, round.Data.GameId, round.Data.Id, actionData.Amount); var tieGameActionId = round.Tie( actionData.Description, walletTransactionId, actionData.ExternalTransactionId, actionData.ExternalBetId, actionData.TransactionReferenceId, actionData.BatchId); await _repository.SaveChangesAsync(); await _gameEventsProcessor.Process(round.Events, context.PlayerToken, round.Data.BrandCode, actionData, context.GameProviderCode); scope.Complete(); return(tieGameActionId); } }