Beispiel #1
0
        public async Task <IActionResult> check([FromBody] StatusRequest request)
        {
            FundsTransferResponse r = null;

            try
            {
                if (!ModelState.IsValid)
                {
                    return(BadRequest(Utility.GetResponse(ModelState)));
                }

                LogFundsTransfer l = await _orclRepo.getTransactionRef(request);

                if (l == null || string.IsNullOrEmpty(l.trnRefNo))
                {
                    return(StatusCode((int)HttpStatusCode.BadRequest,
                                      Utility.GetResponse(Constant.REF_NO_NOT_FOUND, HttpStatusCode.BadRequest)));
                }

                _StatusRequest _request = new _StatusRequest()
                {
                    transactionRef = l.trnRefNo
                };

                r = await _orclRepo.ValidateTransactionByRef(_request);

                if (r == null || string.IsNullOrEmpty(r.status))
                {
                    return(StatusCode((int)HttpStatusCode.ExpectationFailed,
                                      Utility.GetResponse(Constant.UKNOWN_STATUS, HttpStatusCode.ExpectationFailed)));
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
                _logger.LogError($"{request.requestId} :: {ex.ToString()}");
                return(StatusCode((int)HttpStatusCode.InternalServerError, AgencyBanking.Helpers.Utility.GetResponse(ex)));
            }

            return(CreatedAtAction("check", r));
        }
        public async Task <IActionResult> check([FromBody] StatusRequest request)
        {
            FundsTransferResponse r = new FundsTransferResponse();

            try
            {
                if (!ModelState.IsValid)
                {
                    return(BadRequest(Commons.Helpers.Utility.GetResponse(ModelState)));
                }

                r = await _orclRepo.ValidateTransactionByRef(request.transactionRef);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
                _logger.LogError($"{request.transactionRef} ::- {ex.ToString()}");
                return(StatusCode((int)HttpStatusCode.InternalServerError, Commons.Helpers.Utility.GetResponse(ex)));
            }

            return(CreatedAtAction("check", r));
        }