public TransactionSummary Get(string transactionId)
        {
            SystemLog log = new SystemLog();

            TransactionSummary response = null;

            try
            {
                response = Services.DataService.DataRetrieval.RetrieveTransaction(log, transactionId);
            }
            catch (Exception ex)
            {
                log.LogError(ex.Message);
            }

            return(response);
        }
示例#2
0
        public BankResponse Post([FromBody] Transaction transaction)
        {
            SystemLog log  = new SystemLog();
            IBank     bank = null;

            BankResponse response = null;

            try
            {
                bank = Services.BankServices.BankServices.GetBank(transaction);

                if (bank != null)
                {
                    response = bank.ProcessPayment(transaction);
                }

                Services.Common.CommonMethods.SaveTransaction(log, transaction, response);
            }
            catch (Exception ex)
            {
                if (bank == null)
                {
                    response = new BankResponse()
                    {
                        Message = ex.Message, HttpStatusCode = 502
                    }
                }
                ;

                log.LogError(ex.Message);
                response = new BankResponse()
                {
                    HttpStatusCode = 501
                };
            }

            return(response);
        }
    }