Example #1
0
        //authorize request
        public Wallet AuthorizeRequest(authorizeRequest request)
        {
            string connection = ConfigurationManager.ConnectionStrings["SqlConnection"].ToString();

            using (var con = new SqlConnection(connection))
            {
                DynamicParameters param = new DynamicParameters();
                param.Add("acctId", request.acctId);
                var execute = con.Query <Wallet>("authorizeRequest", param, commandType: CommandType.StoredProcedure).FirstOrDefault();
                return(execute);
            }
        }
        public ActionResult AuthorizeRequest()
        {
            authorizeRequest  request  = new authorizeRequest();
            acctRepository    acctRepo = new acctRepository();
            authorizeResponse response = new authorizeResponse();

            //Input stream

            using (Stream stream = Request.InputStream)
            {
                using (StreamReader reader = new StreamReader(stream))
                {
                    request = JsonConvert.DeserializeObject <authorizeRequest>(reader.ReadToEnd());
                }
            }

            //end of Input stream

            var wallet = acctRepo.AuthorizeRequest(request);

            //validation
            if (wallet == null)
            {
                response.merchantCode = request.merchantCode;
                response.serialNo     = request.serialNo;
                response.msg          = "account not found";
                response.code         = 50100;
                return(Json(response));
            }

            response.acctInfo     = wallet;
            response.merchantCode = request.merchantCode;
            response.serialNo     = request.serialNo;
            response.msg          = "success";
            response.code         = 0;



            //end of validation

            return(Json(response));
        }