Example #1
0
        public async Task UserAcceptedDepositOfferSuccessTest()
        {
            _offerMinmalInfo.StatusCode = 5;

            var offerManager = new OfferManager(
                _fakedSteamHubConnection,
                _fakedOfferService,
                new RpcSteamListener(_loggerDummy),
                _loggerDummy,
                _fakedGrpcServiceFactory,
                _fakedUserService,
                _fakedRepoServiceFactory
                );


            await offerManager.HandleOffer(_offerMinmalInfo);

            A.CallTo(() => _fakedSteamServiceClient.GetPlayerInfoAsync(new GetPlayerInfoRequest
            {
                SteamId = _offerMinmalInfo.SteamId
            })).MustHaveHappened();

            A.CallTo(() => _fakedUserService.FindAsync(_offerMinmalInfo.SteamId)).MustHaveHappened();
            A.CallTo(() => _fakedUserService.UpdateUserInfoIfNeeded(A <DatabaseModel.User> ._, A <DatabaseModel.User> ._)).MustHaveHappened();

            A.CallTo(() => _fakedSteamHubConnection.SendOfferStatusToUser(A <OfferStatusRequest> .That.Matches(request => request.StatusCode == 5),
                                                                          ("user Steamid"))).MustHaveHappened();
            A.CallTo(() => _fakedOfferService.DepositSteamOfferAsync(A <OfferStatusRequest> ._)).MustHaveHappened();
        }
Example #2
0
        private async Task HandleDeposit(OfferStatusRequest offer)
        {
            await UpdateUserDataAsync(offer);

            try
            {
                await _offerService.DepositSteamOfferAsync(offer);
            }
            catch (CantCompleteSteamDeposit e)
            {
                _logger.Error(offer.SteamId, null, e, new Dictionary <string, object>
                {
                    { "Offer", offer }
                });
                await _steamHubConnections.SendErrorMessageRelatedToOurApi("Internal error processing offer, please try again later!", offer.SteamId);
            }
            catch (SteamMarketNameFuckupException e)
            {
                e.Data.Add("steamId", offer.SteamId);
                _logger.Critical(e);
                await _steamHubConnections.SendErrorMessageRelatedToOurApi("Internal error processing offer, please try again later!", offer.SteamId);
            }
        }