public static string DoMandateRequery(string requestStr) { Serializer ser = new Serializer(); string xmlOutputData = string.Empty; string responseCode = string.Empty; DateTime requestTime = DateTime.Now; RequeryMandateResponse objResp = new RequeryMandateResponse(); try { RequeryMandateRequest obj = ser.Deserialize <RequeryMandateRequest>(requestStr); if (obj != null) { MandateLog mandate = MandateRepo.QueryMandate(obj.MandateCode, obj.BillerID); responseCode = mandate != null ? ResponseCodeMap.Successful : ResponseCodeMap.UnknownError; objResp = new RequeryMandateResponse { BankCode = mandate.BankCode, BillerID = mandate.BillerId, BillerName = mandate.BillerName, BillerTransId = mandate.BillerTransId, MandateCode = mandate.MandateCode, TransType = mandate.TransType, ResponseCode = responseCode, HashValue = mandate.HashValue, AcctName = mandate.AccountName, AcctNumber = mandate.AccountNumber }; } else { objResp = new RequeryMandateResponse { ResponseCode = ResponseCodeMap.InvalidXml }; } xmlOutputData = ser.Serialize <RequeryMandateResponse>(objResp); } catch (Exception e) { ExceptionLogRepo.SaveExceptionLog(e); xmlOutputData = ser.Serialize <RequeryMandateResponse>(new RequeryMandateResponse { ResponseCode = ResponseCodeMap.InvalidXml }); } DateTime responseTime = DateTime.Now; RequestResponseRepository.SaveRequestResponse("ASMX", requestStr, requestTime, "", xmlOutputData, responseTime); return(xmlOutputData); }
public static string DoMandateCreation(string createMandateStr) { Serializer ser = new Serializer(); string xmlOutputData = string.Empty; string responseCode = string.Empty; DateTime requestTime = DateTime.Now; CreateMandateResponse objResp = new CreateMandateResponse(); try { CreateMandateRequest obj = ser.Deserialize <CreateMandateRequest>(createMandateStr); if (obj != null) { if (!string.IsNullOrEmpty(obj.BillerID) || !string.IsNullOrEmpty(obj.BillerName) || !string.IsNullOrEmpty(obj.BillerTransId) || !string.IsNullOrEmpty(obj.AcctName) || !string.IsNullOrEmpty(obj.AcctNumber) || !string.IsNullOrEmpty(obj.BankCode)) { MandateLog mlog = new MandateLog() { AccountName = obj.AcctName, BankCode = obj.BankCode, AccountNumber = obj.AcctNumber, BillerId = obj.BillerID, BillerName = obj.BillerName, BillerTransId = obj.BillerTransId, DateCreated = DateTime.Now, HashValue = obj.HashValue, TransType = obj.TransType }; bool isSaved = MandateRepo.SaveMandate(mlog); responseCode = isSaved ? ResponseCodeMap.Successful : ResponseCodeMap.UnknownError; objResp = new CreateMandateResponse { AcctName = obj.AcctName, AcctNumber = obj.AcctNumber, BankCode = obj.BankCode, BillerID = obj.BillerID, BillerName = obj.BillerName, BillerTransId = obj.BillerTransId, MandateCode = isSaved ? mlog.MandateCode : "", TransType = obj.TransType, ResponseCode = responseCode }; } else { objResp = new CreateMandateResponse { ResponseCode = ResponseCodeMap.InvalidXml }; } } else { objResp = new CreateMandateResponse { ResponseCode = ResponseCodeMap.InvalidXml }; } xmlOutputData = ser.Serialize <CreateMandateResponse>(objResp); } catch (Exception e) { ExceptionLogRepo.SaveExceptionLog(e); xmlOutputData = ser.Serialize <CreateMandateResponse>(new CreateMandateResponse { ResponseCode = ResponseCodeMap.InvalidXml }); } DateTime responseTime = DateTime.Now; RequestResponseRepository.SaveRequestResponse("ASMX", createMandateStr, requestTime, "", xmlOutputData, responseTime); return(xmlOutputData); }