Esempio n. 1
0
        public async Task <Transaction> RegisterOutgoingTransactionAsync(
            Transaction transaction,
            VirtualAssetsAccountNumber virtualAssetsAccountNumber)
        {
            transaction.Status = TransactionStatus.Created;

            var originatorSession = await _vaspClient.CreateOriginatorSessionAsync(virtualAssetsAccountNumber.VaspCode);

            _originatorSessionsDict.TryAdd(originatorSession.Id, originatorSession);

            transaction.SessionId = originatorSession.Id;

            await _transactionsRepository.CreateAsync(transaction);

            await _sessionsRepository.CreateAsync(originatorSession.SessionInfo);

            await originatorSession.SessionRequestAsync(_vaspInformation);

            transaction.Status = TransactionStatus.SessionRequested;

            await _transactionsRepository.UpdateAsync(transaction);

            return(transaction);
        }