Exemple #1
0
        public Operation <BlockChainTransaction> VerifyAndSaveTransactionHash(string transactionHash)
        => _authorizer.AuthorizeAccess(UserContext.CurrentPPP(), () =>
        {
            var currentUser  = UserContext.CurrentUser();
            var currentLevel = _query.CurrentBitLevel(currentUser);

            _query.GetTransactionWithHash(transactionHash)
            .ThrowIfNotNull(new Exception("A transaction already exists in the system with the supplied hash"));

            return(_blockChain
                   .VerifyTransaction(transactionHash, currentLevel)
                   .Then(opr =>
            {
                currentLevel.Donation.TransactionHash = transactionHash;
                return _pcommand.Update(currentLevel.Donation);
            })
                   .Then(opr => _backgroundProcessor.RepeatOperation <IBitLevelManager>(BackgroundJob_AutomaticConfirmation, UserContext.Impersonate(Constants.SystemUsers_Root), _blm => _blm.AutoConfirmDonations(), ScheduleInterval.Hourly)
                         .Then(_opr => opr.Result)));
        });