Exemplo n.º 1
0
        public async Task SendSessionReplyAsync(string txId, SessionReplyMessage.SessionReplyMessageCode code)
        {
            var transaction = await _transactionsRepository.GetAsync(txId);

            if (transaction == null)
            {
                throw new NullReferenceException();
            }

            if (transaction.Status != TransactionStatus.SessionRequested)
            {
                return; //todo: handle properly
            }
            if (!_benefeciarySessionsDict.TryGetValue(transaction.SessionId, out var beneficiarySession))
            {
                return; //todo: handle this case.
            }
            await beneficiarySession.SessionReplyAsync(_vaspInformation, code);

            if (code == SessionReplyMessage.SessionReplyMessageCode.SessionAccepted)
            {
                transaction.Status = TransactionStatus.SessionConfirmed;
            }
            else
            {
                transaction.Status             = TransactionStatus.SessionDeclined;
                transaction.SessionDeclineCode = SessionReplyMessage.GetMessageCode(code);
            }

            await _transactionsRepository.UpdateAsync(transaction);
        }
 public async Task <TransactionDomainModel> GetTransaction(int transactionId, string accessKey)
 {
     return(await _transactionsRepository.GetAsync(transactionId, accessKey));
 }