private ValidateCustomerResponse ReturnUmemeResponse(ThirdPartyInterfaces.PegPay.Response levelOneResp, ValidateCustomerRequest requestData, string requestCustType) { ValidateCustomerResponse queryResp = new ValidateCustomerResponse(); //stanbic requested that for UMEME //we only return success if customer type returned matches //customer type in request if (levelOneResp.ResponseField5 == requestCustType) { queryResp.Details.Status.StatusCode = ""; queryResp.Details.Status.Description = ""; queryResp.Details.Resultz.Area = levelOneResp.ResponseField3; queryResp.Details.Resultz.CustomerName = levelOneResp.ResponseField2; queryResp.Details.Resultz.CustomerReference = levelOneResp.ResponseField1; queryResp.Details.Resultz.CustomerType = levelOneResp.ResponseField5; queryResp.Details.Resultz.OutstandingBalance = levelOneResp.ResponseField4; queryResp.Details.Resultz.Tin = levelOneResp.ResponseField3; queryResp.Details.Status.StatusCode = "200"; queryResp.Details.Status.Description = "Successful"; queryResp.Details.Resultz.StatusCode = "0"; queryResp.Details.Resultz.StatusDescription = "SUCCESS"; } else { queryResp.Details.Status.StatusCode = "200"; queryResp.Details.Status.Description = "Successful"; queryResp.Details.Resultz.StatusCode = "100"; queryResp.Details.Resultz.StatusDescription = "INVALID CUSTOMER REFERENCE"; } return(queryResp); }
public ValidateCustomerResponse QueryCustomerDetails(ValidateCustomerRequest requestData) { ValidateCustomerResponse queryResp = new ValidateCustomerResponse(); try { System.Net.ServicePointManager.ServerCertificateValidationCallback = RemoteCertificateValidation; //pick correct service name from db DataTable dt = dh.GetServiceDetailsFromDB(requestData.PayLoad.ServiceCode); if (dt.Rows.Count > 0) { DataRow dr = dt.Rows[0]; string ServiceCode = dr["ServiceCode"].ToString(); string ServiceName = dr["ServiceName"].ToString(); string ServiceID = dr["ServiceID"].ToString(); string requestCustType = ""; if (ServiceCode.Equals("NWSC")) { //read area from db requestData.PayLoad.Area = ServiceName.Split(' ')[1]; } else if (ServiceCode.Equals("UMEME")) { requestCustType = ServiceName.Split(' ')[1].ToUpper(); } //else if (ServiceCode == "FLEXIPAY-MERCHANT") //{ // return GetMerchantDetails(requestData, ServiceID); //} //generate level 1 query object QueryRequest levelOneQuery = GetPegpayQueryObject(requestData, ServiceCode); //query from level 1 PegPay levelOneApi = new PegPay(); ThirdPartyInterfaces.PegPay.Response levelOneResp = levelOneApi.QueryCustomerDetails(levelOneQuery); //return appropriate response if (levelOneResp.ResponseField6.Equals("0")) { if (ServiceCode.Equals("UMEME")) { queryResp = ReturnUmemeResponse(levelOneResp, requestData, requestCustType); } else if (ServiceCode.Equals("FLEXIPAY")) { queryResp.Details.Status.StatusCode = ""; queryResp.Details.Status.Description = ""; queryResp.Details.Resultz.Area = levelOneResp.ResponseField3; queryResp.Details.Resultz.CustomerName = levelOneResp.ResponseField2; queryResp.Details.Resultz.CustomerReference = levelOneResp.ResponseField1; queryResp.Details.Resultz.CustomerType = levelOneResp.ResponseField5; queryResp.Details.Resultz.OutstandingBalance = levelOneResp.ResponseField4; queryResp.Details.Resultz.Tin = levelOneResp.ResponseField8;//requestData.PayLoad.Area; queryResp.Details.Status.StatusCode = "200"; queryResp.Details.Status.Description = "Successful"; queryResp.Details.Resultz.StatusCode = "0"; queryResp.Details.Resultz.StatusDescription = "SUCCESS"; } else if (ServiceCode.Equals("URA")) { queryResp.Details.Status.StatusCode = ""; queryResp.Details.Status.Description = ""; queryResp.Details.Resultz.Area = levelOneResp.ResponseField3; queryResp.Details.Resultz.CustomerName = levelOneResp.ResponseField2; queryResp.Details.Resultz.CustomerReference = levelOneResp.ResponseField1; queryResp.Details.Resultz.CustomerType = levelOneResp.ResponseField5; queryResp.Details.Resultz.OutstandingBalance = levelOneResp.ResponseField4; queryResp.Details.Resultz.Tin = levelOneResp.ResponseField3; queryResp.Details.Resultz.RegistrationDate = string.IsNullOrEmpty(levelOneResp.ResponseField8) ? "" : levelOneResp.ResponseField8; queryResp.Details.Resultz.ExpiryDate = string.IsNullOrEmpty(levelOneResp.ResponseField9) ? "" : levelOneResp.ResponseField9; queryResp.Details.Status.StatusCode = "200"; queryResp.Details.Status.Description = "Successful"; queryResp.Details.Resultz.StatusCode = "0"; queryResp.Details.Resultz.StatusDescription = "SUCCESS"; } else if (ServiceCode.Equals("NSSF")) { queryResp.Details.Status.StatusCode = ""; queryResp.Details.Status.Description = ""; queryResp.Details.Resultz.Area = levelOneResp.ResponseField10; queryResp.Details.Resultz.CustomerName = levelOneResp.ResponseField2; queryResp.Details.Resultz.CustomerReference = levelOneResp.ResponseField1; queryResp.Details.Resultz.CustomerType = levelOneResp.ResponseField5; queryResp.Details.Resultz.OutstandingBalance = levelOneResp.ResponseField4; queryResp.Details.Resultz.Tin = levelOneResp.ResponseField9; queryResp.Details.Resultz.RegistrationDate = ""; queryResp.Details.Resultz.ExpiryDate = levelOneResp.ResponseField3; queryResp.Details.Status.StatusCode = "200"; queryResp.Details.Status.Description = "Successful"; queryResp.Details.Resultz.StatusCode = "0"; queryResp.Details.Resultz.StatusDescription = "SUCCESS"; } else if (ServiceCode.Equals("DSTV") || ServiceCode.Equals("GOTV")) { queryResp = ReturnDSTVResponse(levelOneResp, requestData, ServiceCode); } else { queryResp.Details.Status.StatusCode = ""; queryResp.Details.Status.Description = ""; queryResp.Details.Resultz.Area = levelOneResp.ResponseField3; queryResp.Details.Resultz.CustomerName = levelOneResp.ResponseField2; queryResp.Details.Resultz.CustomerReference = levelOneResp.ResponseField1; queryResp.Details.Resultz.CustomerType = levelOneResp.ResponseField5; queryResp.Details.Resultz.OutstandingBalance = levelOneResp.ResponseField4; queryResp.Details.Resultz.Tin = levelOneResp.ResponseField3; queryResp.Details.Status.StatusCode = "200"; queryResp.Details.Status.Description = "Successful"; queryResp.Details.Resultz.StatusCode = "0"; queryResp.Details.Resultz.StatusDescription = "SUCCESS"; } } else { if (ServiceCode.Equals("NSSF")) { if (levelOneResp.ResponseField7.ToUpper().Contains("EXPIRED")) { levelOneResp.ResponseField7 = "TRANSACTION NUMBER EXPIRED"; } else if (levelOneResp.ResponseField7.ToUpper().Contains("DELETED")) { levelOneResp.ResponseField7 = "TRANSACTION NUMBER DELETED"; } else if (levelOneResp.ResponseField7.ToUpper().Contains("EXISTS")) { levelOneResp.ResponseField7 = "NO TRANSACTION NUMBER"; } else if (levelOneResp.ResponseField7.ToUpper().Contains("NUMBER PAID")) { levelOneResp.ResponseField7 = "TRANSACTION NUMBER ALREADY PAID"; } queryResp.Details.Status.StatusCode = "200"; queryResp.Details.Status.Description = "Successful"; queryResp.Details.Resultz.StatusCode = "100"; queryResp.Details.Resultz.StatusDescription = levelOneResp.ResponseField7; } else { queryResp.Details.Status.StatusCode = "200"; queryResp.Details.Status.Description = "Successful"; queryResp.Details.Resultz.StatusCode = "100"; queryResp.Details.Resultz.StatusDescription = levelOneResp.ResponseField7; } } } else { queryResp.Details.Status.StatusCode = "200"; queryResp.Details.Status.Description = "Successful"; queryResp.Details.Resultz.StatusCode = "100"; queryResp.Details.Resultz.StatusDescription = "INVALID MERCHANT ID"; } return(queryResp); } catch (Exception e) { throw e; } }