/// <summary> /// Input Validation for Updating /// </summary> /// <param name="update"></param> /// <returns></returns> public IDPProxyResponse UpdateValidation(Update update) { IDPProxyResponse message = null; Regex junk_Chars = new Regex(@"[\\\~!@#$%^*()_+{}|""?`;',/[\]]+"); if (string.IsNullOrEmpty(update.receiptNumber) | junk_Chars.IsMatch(update.receiptNumber)) { message = new IDPProxyResponse(Constant.RESPONSE_FAILURE, Constant.ERR_VALIDATION + Constant.receiptNumber); } else if (string.IsNullOrEmpty(update.voidReceiptNumber) | junk_Chars.IsMatch(update.voidReceiptNumber)) { message = new IDPProxyResponse(Constant.RESPONSE_FAILURE, Constant.ERR_VALIDATION + Constant.voidReceiptNumber); } else if (update.lastModifiedDate.ToString() == "") { message = new IDPProxyResponse(Constant.RESPONSE_FAILURE, Constant.ERR_VALIDATION + Constant.lastModifiedDate); } else { message = new IDPProxyResponse(Constant.RESPONSE_SUCCESS, Constant.VALIDATION_SUCCESS + update.receiptNumber); } return(message); }
public IDPProxyResponse CheckValidation(PaymentIDPProxyInputRequest PaymentIDPProxyInputRequest) { IDPProxyResponse message = null; Regex junk_Chars = new Regex(@"[\\\~!@#$%^*()_+{}|""?`;',/[\]]+"); if (string.IsNullOrEmpty(PaymentIDPProxyInputRequest.checkNumber) | junk_Chars.IsMatch(PaymentIDPProxyInputRequest.checkNumber)) { message = new IDPProxyResponse(Constant.RESPONSE_FAILURE, Constant.ERR_VALIDATION + Constant.checkNumber); } else { message = new IDPProxyResponse(Constant.RESPONSE_SUCCESS, Constant.VALIDATION_SUCCESS + PaymentIDPProxyInputRequest.receiptNumber); } return(message); }
public IDPProxyResponse insertIDPDetail(PaymentIDPProxyInputRequest PaymentIDPProxyInputRequest) { try { String Error = ""; String cardEncrypt = String.Empty; int lineItemCount = 0; string paymentid = string.Empty; InsertPaymentitem obj = new InsertPaymentitem(); if (ConfigurationSettings.AppSettings["LoggingEntry"].ToString() == "1") { LogServiceRequest(PaymentIDPProxyInputRequest); } if (!string.IsNullOrEmpty(PaymentIDPProxyInputRequest.receiptNumber.ToString())) { log.WriteLog("Input Request received for the receipt number: " + PaymentIDPProxyInputRequest.receiptNumber.ToString()); } //Input Field validations message = (obj.Validation(PaymentIDPProxyInputRequest)); if ((message.responseCode == Constant.RESPONSE_FAILURE)) { log.WriteLog(message.responseCode + '-' + message.responseMessage); return(message); } if (PaymentIDPProxyInputRequest.paymentMethod.Equals("CRDC") || PaymentIDPProxyInputRequest.paymentMethod.Equals("EFT")) { message = (obj.CardValidation(PaymentIDPProxyInputRequest)); if ((message.responseCode == Constant.RESPONSE_FAILURE)) { log.WriteLog(message.responseCode + '-' + message.responseMessage); return(message); } } if (PaymentIDPProxyInputRequest.paymentMethod.Equals("CHCK")) { message = (obj.CheckValidation(PaymentIDPProxyInputRequest)); if ((message.responseCode == Constant.RESPONSE_FAILURE)) { log.WriteLog(message.responseCode + '-' + message.responseMessage); return(message); } } if (PaymentIDPProxyInputRequest.LineItem.Count >= 0) { foreach (LineItem item in PaymentIDPProxyInputRequest.LineItem) { message = (obj.ValidationLineItem(item)); if (message != null) { if ((message.responseCode == Constant.RESPONSE_FAILURE)) { log.WriteLog(message.responseCode + '-' + message.responseMessage); return(message); } } else { message = new IDPProxyResponse(Constant.RESPONSE_SUCCESS, ""); } } } if (message.responseCode == Constant.RESPONSE_SUCCESS) { message = new IDPProxyResponse(Constant.RESPONSE_SUCCESS, Constant.VALIDATION_SUCCESS + PaymentIDPProxyInputRequest.receiptNumber); //Mapping the PC Data to PT Corresponding Fields int[] ID_PNE = { 4, 5, 6, 13, 15, 16, 17, 18, 1, 3, 20 }; switch (PaymentIDPProxyInputRequest.applicationContext.application) { case "BILLIVR": PaymentIDPProxyInputRequest.applicationContext.application = ID_PNE[2].ToString(); break; case "HUON": PaymentIDPProxyInputRequest.applicationContext.application = ID_PNE[3].ToString(); break; case "NETPOS": PaymentIDPProxyInputRequest.applicationContext.application = ID_PNE[4].ToString(); break; case "PAS": PaymentIDPProxyInputRequest.applicationContext.application = ID_PNE[5].ToString(); break; case "AGNTINTRA": PaymentIDPProxyInputRequest.applicationContext.application = ID_PNE[6].ToString(); break; case "SIS": PaymentIDPProxyInputRequest.applicationContext.application = ID_PNE[7].ToString(); break; case "PCBCKOFF": PaymentIDPProxyInputRequest.applicationContext.application = ID_PNE[10].ToString(); break; default: message = new IDPProxyResponse(Constant.RESPONSE_FAILURE, Constant.ERR_VALIDATION + Constant.application); log.WriteLog(message.responseCode + '-' + message.responseMessage); return(message); } //Payment Method Mapping switch (PaymentIDPProxyInputRequest.paymentMethod) { case "CRDC": PaymentIDPProxyInputRequest.paymentMethod = ID_PNE[8].ToString(); break; case "CASH": PaymentIDPProxyInputRequest.paymentMethod = ID_PNE[9].ToString(); break; case "CHCK": PaymentIDPProxyInputRequest.paymentMethod = ID_PNE[0].ToString(); break; case "EFT": PaymentIDPProxyInputRequest.paymentMethod = ID_PNE[1].ToString(); break; default: message = new IDPProxyResponse(Constant.RESPONSE_FAILURE, Constant.ERR_VALIDATION + Constant.paymentMethod); log.WriteLog(message.responseCode + '-' + message.responseMessage); return(message); } //Method Call to Insert Payment Details paymentid = obj.InsertPaymentItem(PaymentIDPProxyInputRequest); //Modified the below code to avoid duplicate receipt number enteries if (!string.IsNullOrEmpty(paymentid)) { if (paymentid.Trim() == "0") { message = new IDPProxyResponse(Constant.RESPONSE_FAILURE, Constant.RECEIPT_DUPLICATE); log.WriteLog(message.responseCode + '-' + message.responseMessage); return(message); } } //Changed the Flow for Insertion and removed the if structure for multi line item foreach (LineItem Item in PaymentIDPProxyInputRequest.LineItem) { if (message.responseCode == Constant.RESPONSE_SUCCESS) { //Mapping for Product Code message = new IDPProxyResponse(Constant.RESPONSE_SUCCESS, Constant.VALIDATION_SUCCESS + PaymentIDPProxyInputRequest.receiptNumber); //MAIG - CH1 - BEGIN - Modified the logic to get the Product code directly from External Interface /*if ((Item.dataSource.Equals(Constant.PAS)) & (Item.policyNumber.Length.Equals(13))) * { * if (Item.policyNumber.Substring(0, 2).Equals(Constant.CA_State)) * { * Item.productCode = Constant.AUT; * } * else * { * Item.productCode = Constant.AAASS; * } * } * else if (((Item.dataSource.Equals(Constant.HUON)) & (Item.policyNumber.Length.Equals(9)) | ((Item.dataSource.Equals(Constant.POES))&&Item.productCode.Equals(Constant.ProductCode_PA)) | (Item.dataSource.Equals(Constant.ADES)))) * { * Item.productCode = Constant.POES_AUTO; * } * else if (Item.dataSource.Equals(Constant.HDES) | ((Item.dataSource.Equals(Constant.POES)) && Item.productCode.Equals(Constant.ProductCode_HO))) * { * Item.productCode = Constant.HME; * } * else if (Item.dataSource.Equals(Constant.PUPSYS)) * { * Item.productCode = Constant.PUP; * } * else if ((Item.dataSource.Equals(Constant.SIS))) * { * if ((Item.productCode.Equals(Constant.ProductCode_PA))) * { * Item.productCode = Constant.WUA; * } * else if (Item.productCode.Equals(Constant.ProductCode_HO)) * { * Item.productCode = Constant.WUH; * } * else if ((Item.productCode.Equals(Constant.ProductCode_DF))) * { * Item.productCode = Constant.DF; * } * else if (Item.productCode.Equals(Constant.ProductCode_WC)) * { * Item.productCode = Constant.WUW; * } * else if ((Item.productCode.Equals(Constant.ProductCode_MC))) * { * Item.productCode = Constant.WUM; * } * else * { * message = new IDPProxyResponse(Constant.RESPONSE_FAILURE, Constant.ERR_VALIDATION + Constant.productCode); * log.WriteLog(message.responseCode + '-' + message.responseMessage); * return message; * } * } * else if (Item.dataSource.Equals(Constant.HLSYS)) * { * Item.productCode = Constant.HL; * } * else * { * message = new IDPProxyResponse(Constant.RESPONSE_FAILURE, Constant.ERR_VALIDATION + Constant.dataSource); * log.WriteLog(message.responseCode + '-' + message.responseMessage); * return message; * }*/ //MAIG - CH1 - END - Modified the logic to get the Product code directly from External Interface //Mapping for Revenue Type if (Item.revenueType == Constant.revenuetype_ERND) { Item.revenueType = Constant.Revenue_Earned; } else if (Item.revenueType == Constant.revenuetype_INST) { Item.revenueType = Constant.Revenue_Installment; } else if (Item.revenueType == Constant.revenuetype_DOWN) { Item.revenueType = Constant.Revenue_Down; } else if (!string.IsNullOrEmpty(Item.revenueType)) { message = new IDPProxyResponse(Constant.RESPONSE_FAILURE, Constant.ERR_VALIDATION + Constant.revenueType); log.WriteLog(message.responseCode + '-' + message.responseMessage); return(message); } if (string.IsNullOrEmpty(PaymentIDPProxyInputRequest.checkNumber)) { if (PaymentIDPProxyInputRequest.paymentMethod.ToUpper().Equals("CASH")) { PaymentIDPProxyInputRequest.checkNumber = string.Empty; } } Error = obj.InsertItem(Item, paymentid, PaymentIDPProxyInputRequest.checkNumber, PaymentIDPProxyInputRequest.paymentMethod, lineItemCount); if ((Error == "") || (paymentid == "")) { message = new IDPProxyResponse(Constant.RESPONSE_FAILURE, Constant.VALIDATION_FAILURE); log.WriteLog(message.responseCode + '-' + message.responseMessage); return(message); } //Invoked the Echeck/Card Payment Method SP Call if (PaymentIDPProxyInputRequest.paymentMethod.Equals("1") || PaymentIDPProxyInputRequest.paymentMethod.Equals("5")) { message = new IDPProxyResponse(Constant.RESPONSE_SUCCESS, Constant.VALIDATION_SUCCESS + PaymentIDPProxyInputRequest.receiptNumber); cardEncrypt = PaymentIDPProxyInputRequest.card.cardEcheckNumber.ToString(); PaymentIDPProxyInputRequest.card.cardEcheckNumber = "XXXXXXXXXXXX" + cardEncrypt.Substring(11, 4).ToString(); obj.InsertCardCheck(paymentid, PaymentIDPProxyInputRequest.card); message = new IDPProxyResponse(Constant.RESPONSE_SUCCESS, Constant.VALIDATION_SUCCESS + PaymentIDPProxyInputRequest.receiptNumber); } } else { log.WriteLog(message.responseCode + '-' + message.responseMessage); return(message); } lineItemCount++; } } } catch (FaultException ex) { log.WriteLog(ex.Message.ToString()); } catch (CommunicationException exp) { log.WriteLog(exp.Message.ToString()); } catch (Exception e) { String Err_Msg = e.ToString(); message = new IDPProxyResponse(Constant.RESPONSE_FAILURE, Err_Msg); log.WriteLog(message.responseCode + '-' + message.responseMessage); return(message); } log.WriteLog(message.responseCode + '-' + message.responseMessage); message = new IDPProxyResponse(Constant.RESPONSE_SUCCESS, Constant.VALIDATION_SUCCESS + PaymentIDPProxyInputRequest.receiptNumber); return(message); }
public IDPProxyResponse updateIDPReversalDetail(Update update) { try { if (ConfigurationSettings.AppSettings["LoggingEntry"].ToString() == "1") { System.Xml.Serialization.XmlSerializer serializerReq = new System.Xml.Serialization.XmlSerializer(update.GetType()); StringWriter writerReq = new StringWriter(); serializerReq.Serialize(writerReq, update); log.WriteLog(" Payment IDP Proxy Service Request for update from Payment Central : \r\n " + writerReq); writerReq.Close(); } log.WriteLog("Updation Request for the Receipt Number :" + update.receiptNumber); string flag = string.Empty; IDPProxyResponse message = null; InsertPaymentitem obj = new InsertPaymentitem(); //Input Field Validation message = (obj.UpdateValidation(update)); if (message.responseCode == Constant.RESPONSE_SUCCESS) { //SP CALL to invoke to update the transaction details flag = obj.PCPayUpdateVoid(update); if (flag == Constant.VALUE) { //CHG0072116 -Modified the message for failure in update process message = new IDPProxyResponse(Constant.RESPONSE_FAILURE, Constant.UPDATE_NO_RCPT_NUMBER); log.WriteLog(message.responseCode + '-' + message.responseMessage); return(message); } else { message = new IDPProxyResponse(Constant.RESPONSE_SUCCESS, Constant.UPDATE_SUCCESS + update.receiptNumber); log.WriteLog(message.responseCode + '-' + message.responseMessage); return(message); } } else { log.WriteLog(message.responseCode + '-' + message.responseMessage); return(message); } } catch (FaultException ex) { log.WriteLog(ex.Message.ToString()); return(null); } catch (CommunicationException exp) { log.WriteLog(exp.Message.ToString()); return(null); } catch (ArgumentException ex) { String Err_Msg = ex.ToString(); message = new IDPProxyResponse(Constant.RESPONSE_FAILURE, Err_Msg); log.WriteLog(message.responseCode + '-' + message.responseMessage); return(message); } }
/// <summary> /// Input Validation for Common Attributes /// </summary> /// <param name="PaymentIDPProxyInputRequest"></param> /// <returns></returns> public IDPProxyResponse Validation(PaymentIDPProxyInputRequest PaymentIDPProxyInputRequest) { IDPProxyResponse message = null; message = new IDPProxyResponse(Constant.RESPONSE_SUCCESS, Constant.VALIDATION_SUCCESS + PaymentIDPProxyInputRequest.receiptNumber); Regex junk_Chars = new Regex(@"[\\\~!@#$%^*()_+{}|""?`;',/[\]]+"); decimal amount = 0.0M; decimal TotAmt = 0.0M; if ((PaymentIDPProxyInputRequest.applicationContext.application == Constant.APP_SALESX) | (PaymentIDPProxyInputRequest.applicationContext.application == Constant.APP_PMTTOOL) | (PaymentIDPProxyInputRequest.applicationContext.application == Constant.APP_PAYMENTX)) { message = new IDPProxyResponse(Constant.RESPONSE_FAILURE, Constant.ERR_VALIDATION + Constant.application); } else if (string.IsNullOrEmpty(PaymentIDPProxyInputRequest.applicationContext.application) | junk_Chars.IsMatch(PaymentIDPProxyInputRequest.applicationContext.application)) { message = new IDPProxyResponse(Constant.RESPONSE_FAILURE, Constant.ERR_VALIDATION + Constant.application); } else if (string.IsNullOrEmpty(PaymentIDPProxyInputRequest.externalReferenceNumber) | junk_Chars.IsMatch(PaymentIDPProxyInputRequest.externalReferenceNumber)) { message = new IDPProxyResponse(Constant.RESPONSE_FAILURE, Constant.ERR_VALIDATION + Constant.externalReferenceNumber); } else if (string.IsNullOrEmpty(PaymentIDPProxyInputRequest.districtOffice) | junk_Chars.IsMatch(PaymentIDPProxyInputRequest.districtOffice)) { message = new IDPProxyResponse(Constant.RESPONSE_FAILURE, Constant.ERR_VALIDATION + Constant.districtOffice); } else if (!string.IsNullOrEmpty(PaymentIDPProxyInputRequest.branchHubNumber)) { if (junk_Chars.IsMatch(PaymentIDPProxyInputRequest.branchHubNumber)) { message = new IDPProxyResponse(Constant.RESPONSE_FAILURE, Constant.ERR_VALIDATION + Constant.branchHubNumber); } } else if (string.IsNullOrEmpty(PaymentIDPProxyInputRequest.userId) | junk_Chars.IsMatch(PaymentIDPProxyInputRequest.userId)) { message = new IDPProxyResponse(Constant.RESPONSE_FAILURE, Constant.ERR_VALIDATION + Constant.userId); } else if (string.IsNullOrEmpty(PaymentIDPProxyInputRequest.receiptNumber) | junk_Chars.IsMatch(PaymentIDPProxyInputRequest.receiptNumber)) { message = new IDPProxyResponse(Constant.RESPONSE_FAILURE, Constant.ERR_VALIDATION + Constant.receiptNumber); } else if (PaymentIDPProxyInputRequest.createdDate.ToString() == "") { message = new IDPProxyResponse(Constant.RESPONSE_FAILURE, Constant.ERR_VALIDATION + Constant.createdDate); } else if ((PaymentIDPProxyInputRequest.totalAmount == 0) | junk_Chars.IsMatch(PaymentIDPProxyInputRequest.totalAmount.ToString())) { message = new IDPProxyResponse(Constant.RESPONSE_FAILURE, Constant.ERR_VALIDATION + Constant.totalAmount); } else if (!((PaymentIDPProxyInputRequest.totalAmount == 0) | junk_Chars.IsMatch(PaymentIDPProxyInputRequest.totalAmount.ToString()))) { if (PaymentIDPProxyInputRequest.LineItem.Count == 1) { if (!(Decimal.Equals(PaymentIDPProxyInputRequest.totalAmount, PaymentIDPProxyInputRequest.LineItem[0].Amount))) { message = new IDPProxyResponse(Constant.RESPONSE_FAILURE, Constant.ERR_VALIDATION + Constant.totalAmount); } } else if (PaymentIDPProxyInputRequest.LineItem.Count > 1) { foreach (LineItem item in PaymentIDPProxyInputRequest.LineItem) { TotAmt = TotAmt + item.Amount; amount = TotAmt; } if (Decimal.Equals(PaymentIDPProxyInputRequest.totalAmount, TotAmt)) { PaymentIDPProxyInputRequest.totalAmount = TotAmt; } if (!(Decimal.Equals(PaymentIDPProxyInputRequest.totalAmount, amount))) { message = new IDPProxyResponse(Constant.RESPONSE_FAILURE, Constant.ERR_VALIDATION + Constant.totalAmount); } } } if (string.IsNullOrEmpty(PaymentIDPProxyInputRequest.paymentMethod) | junk_Chars.IsMatch(PaymentIDPProxyInputRequest.paymentMethod)) { message = new IDPProxyResponse(Constant.RESPONSE_FAILURE, Constant.ERR_VALIDATION + Constant.paymentMethod); } // else if (PaymentIDPProxyInputRequest.paymentMethod.ToUpper().Equals("CHCK")) { if ((string.IsNullOrEmpty(PaymentIDPProxyInputRequest.checkNumber))) { message = new IDPProxyResponse(Constant.RESPONSE_FAILURE, Constant.ERR_VALIDATION + Constant.checkNumber); } } return(message); }
/// <summary> /// Line Item Input Validation /// </summary> /// <param name="input"></param> /// <returns></returns> public IDPProxyResponse ValidationLineItem(LineItem input) { IDPProxyResponse message = null; Regex junk_Chars = new Regex(@"[\\\~!@#$%^*()_+{}|""?`;',/[\]]+"); //Line Item Validation if (string.IsNullOrEmpty(input.dataSource) | junk_Chars.IsMatch(input.dataSource)) { message = new IDPProxyResponse(Constant.RESPONSE_FAILURE, Constant.ERR_VALIDATION + Constant.dataSource); } else if (!(input.dataSource.Equals(Constant.PAS) | input.dataSource.Equals(Constant.SIS) | input.dataSource.Equals(Constant.HDES) | input.dataSource.Equals(Constant.ADES) | input.dataSource.Equals(Constant.HUON) | input.dataSource.Equals(Constant.PUPSYS) | input.dataSource.Equals(Constant.HLSYS))) { message = new IDPProxyResponse(Constant.RESPONSE_FAILURE, Constant.ERR_VALIDATION + Constant.dataSource); } else if (string.IsNullOrEmpty(input.writingCompany) | junk_Chars.IsMatch(input.writingCompany)) { message = new IDPProxyResponse(Constant.RESPONSE_FAILURE, Constant.ERR_VALIDATION + Constant.writingCompany); } else if (!(input.writingCompany.Equals(Constant.writingcompany_CSIIB) | (input.writingCompany.Equals(Constant.writingcompany_4WUIC)) | (input.writingCompany.Equals(Constant.writingcompany_1MWIC)))) { message = new IDPProxyResponse(Constant.RESPONSE_FAILURE, Constant.ERR_VALIDATION + Constant.writingCompany); } else if (string.IsNullOrEmpty(input.productCode) | junk_Chars.IsMatch(input.productCode)) { message = new IDPProxyResponse(Constant.RESPONSE_FAILURE, Constant.ERR_VALIDATION + Constant.productCode); } else if (!(input.productCode.Equals(Constant.ProductCode_PA) | input.productCode.Equals(Constant.ProductCode_HO) | input.productCode.Equals(Constant.ProductCode_HL) | input.productCode.Equals(Constant.ProductCode_PU) | input.productCode.Equals(Constant.ProductCode_DF) | input.productCode.Equals(Constant.ProductCode_MC) | input.productCode.Equals(Constant.ProductCode_WC) | input.productCode.Equals(Constant.ProductCode_IM))) { message = new IDPProxyResponse(Constant.RESPONSE_FAILURE, Constant.ERR_VALIDATION + Constant.productCode); } else if (!string.IsNullOrEmpty(input.policyPrefix)) { if (junk_Chars.IsMatch(input.policyPrefix)) { message = new IDPProxyResponse(Constant.RESPONSE_FAILURE, Constant.ERR_VALIDATION + Constant.policyPrefix); } } else if (string.IsNullOrEmpty(input.policyNumber) | junk_Chars.IsMatch(input.policyNumber)) { message = new IDPProxyResponse(Constant.RESPONSE_FAILURE, Constant.ERR_VALIDATION + Constant.policyNumber); } else if (!string.IsNullOrEmpty(input.policyState)) { if (junk_Chars.IsMatch(input.policyState)) { message = new IDPProxyResponse(Constant.RESPONSE_FAILURE, Constant.ERR_VALIDATION + Constant.policyState); } } else if (string.IsNullOrEmpty(input.Amount.ToString()) | junk_Chars.IsMatch(input.Amount.ToString())) { message = new IDPProxyResponse(Constant.RESPONSE_FAILURE, Constant.ERR_VALIDATION + Constant.Amount); } else if (!string.IsNullOrEmpty(input.revenueType)) { if (junk_Chars.IsMatch(input.revenueType)) { message = new IDPProxyResponse(Constant.RESPONSE_FAILURE, Constant.ERR_VALIDATION + Constant.revenueType); } } else { message = new IDPProxyResponse(Constant.RESPONSE_SUCCESS, ""); } return(message); }