Beispiel #1
0
 public static void SaveRequestResponse(string customerId, NameEnquiryResponseResult response)
 {
     try
     {
         var jsonResp = JsonConvert.SerializeObject(response);
         using (var dc = new InterswitchNameEnquiryEntities())
         {
             var obj = new RequestResponseLog();
             obj.RequestBody  = customerId;
             obj.RequestTime  = DateTime.Now;
             obj.ResponseBody = jsonResp;
             obj.ResponseTime = DateTime.Now;
             dc.RequestResponseLogs.Add(obj);
             dc.SaveChanges();
         }
     }
     catch (Exception e)
     {
         Utils.LogError(e, "SaveRequestResponse");
     }
 }
Beispiel #2
0
        public static NameEnquiryResponseResult DoNameEnquiry(string customerId)
        {
            var obj = new NameEnquiryResponseResult();

            try
            {
                if (Utils.UseDummyDataForOracleRequest)
                {
                    if (customerId == "0003321999")
                    {
                        obj.AccountCurrency = "566";
                        obj.AccountType     = "10";
                        obj.CountryCode     = "NG";
                        obj.CountryOfBirth  = "Nigeria";
                        obj.CustomerAddress = new CustomerAddress {
                            AddrLine1 = "No 30", AddrLine2 = "Benue Road", City = "Otukpo", PostalCode = "", StateCode = ""
                        };
                        obj.CustomerID   = "0003321999";
                        obj.CustomerName = new CustomerName {
                            FirstName = "Balarabe", LastName = "Rilwan", OtherNames = "Musa"
                        };
                        obj.CustomerPhoneNo = "08023221100";
                        obj.DOB             = "05/09/1960";
                        obj.Nationality     = "Nigerian";
                        obj.ResponseCode    = "00";
                    }
                    else
                    {
                        obj.ResponseCode = "25";
                    }
                }
                else
                {
                    var custObj = GetCustomerInfoByCustId(customerId);
                    if (custObj != null)
                    {
                        obj.AccountCurrency = custObj.AccountCurrency;
                        obj.AccountType     = custObj.AccountType;
                        obj.CountryCode     = custObj.CountryCode;
                        obj.CountryOfBirth  = custObj.Nationality;
                        obj.CustomerAddress = new CustomerAddress {
                            AddrLine1 = custObj.AddrLine1, AddrLine2 = custObj.AddrLine2, City = custObj.City, PostalCode = "", StateCode = custObj.StateCode
                        };
                        obj.CustomerID   = customerId;
                        obj.CustomerName = new CustomerName {
                            FirstName = custObj.FirstName, LastName = custObj.LastName, OtherNames = custObj.OtherNames
                        };
                        obj.CustomerPhoneNo = custObj.CustomerPhoneNo;
                        obj.DOB             = custObj.DOB;
                        obj.Nationality     = custObj.Nationality;
                        obj.ResponseCode    = "00";
                    }
                    else
                    {
                        obj.ResponseCode = "25";
                    }
                }

                Repository.SaveRequestResponse(customerId, obj);
            }
            catch (Exception e)
            {
                Utils.LogError(e, "");
            }
            return(obj);
        }