예제 #1
0
        public IHttpActionResult FetchBvn([FromBody] FetchBvn fetchBvn)
        {
            try {
                if (!ModelState.IsValid)
                {
                    return(BadRequest("Invalid data."));
                }

                string bvnReq = App.GetRedboxFetchBvnPayload(fetchBvn);

                string bvnRes = App.CallRedbox(bvnReq);

                LogWorker logworker = new LogWorker("BvnController", "FetchBvn", "OK");

                return(Ok(bvnRes));
            }
            catch (Exception ex)
            {
                LogWorker logworker = new LogWorker("BvnController", "FetchBvn", ex.ToString());
                return(InternalServerError());
            }
        }
예제 #2
0
        public static string GetRedboxFetchBvnPayload(FetchBvn fetchbvn)
        {
            string channel   = ConfigurationManager.AppSettings["channel"];
            string payload   = "";
            Random reqTranId = new Random();

            try
            {
                payload = "<soapenv:Envelope xmlns: soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns: soap =\"http://soap.request.manager.redbox.stanbic.com/\">" +
                          "<soapenv:Header/>" +
                          "<soapenv:Body>" +
                          "<soap:request>" +
                          "<channel>" + channel + "</channel>" +
                          "<type>FETCH_BVN</type>" +
                          "<customerId>" + fetchbvn.CustomerId + "</customerId>" +
                          "<customerIdType>" + fetchbvn.CustomerIdType + "</customerIdType>" +
                          "<submissionTime>" + fetchbvn.SubmissionTime + "</submissionTime>" +
                          "<reqTranId>" + reqTranId.Next(100000, 999999) + "</reqTranId>" +
                          "<body>" +
                          "<![CDATA[" +
                          "<otherRequestDetails>" +
                          "<passId>" + fetchbvn.PassId + "</passId>" +
                          "<passIdType>" + fetchbvn.PassIdType + "</passIdType>" +
                          "<passCodeType>" + fetchbvn.PassCodeType + "</passCodeType>" +
                          "<passCode>" + fetchbvn.PassCode + "</passCode>" +
                          "</otherRequestDetails>" +
                          "]]>" +
                          "</body>" +
                          "</soap:request>" +
                          "</soapenv:Body>";
            }
            catch
            {
                throw;
            }
            return(payload);
        }