Exemplo n.º 1
0
        public static string DoOTPValidationWithoutCustomerRegistration(string requestStr)
        {
            Serializer          ser           = new Serializer();
            string              xmlOutputData = string.Empty;
            string              responseCode  = string.Empty;
            DateTime            requestTime   = DateTime.Now;
            ValidateOTPResponse objResp       = new ValidateOTPResponse();

            try
            {
                ValidateOTPRequestEx obj = ser.Deserialize <ValidateOTPRequestEx>(requestStr);
                if (obj != null)
                {
                    bool isSaved = MandateRepo.ValidateOtp(obj.MandateCode, obj.OTP, Convert.ToDecimal(obj.Amount));

                    responseCode = isSaved ? ResponseCodeMap.Successful : ResponseCodeMap.InvalidXml;

                    objResp = new ValidateOTPResponse
                    {
                        BankCode      = obj.BankCode,
                        BillerID      = obj.BillerID,
                        BillerName    = obj.BillerName,
                        BillerTransId = obj.BillerTransId,
                        MandateCode   = obj.MandateCode,
                        TransType     = obj.TransType,
                        ResponseCode  = responseCode,
                        Amount        = obj.Amount,
                        HashValue     = obj.HashValue
                    };
                }
                else
                {
                    objResp = new ValidateOTPResponse {
                        ResponseCode = ResponseCodeMap.InvalidXml
                    };
                }
                xmlOutputData = ser.Serialize <ValidateOTPResponse>(objResp);
            }
            catch (Exception e) { ExceptionLogRepo.SaveExceptionLog(e);
                                  xmlOutputData = ser.Serialize <ValidateOTPResponse>(new ValidateOTPResponse {
                    ResponseCode = ResponseCodeMap.InvalidXml
                }); }
            DateTime responseTime = DateTime.Now;

            RequestResponseRepository.SaveRequestResponse("ASMX", requestStr, requestTime, "", xmlOutputData, responseTime);
            return(xmlOutputData);
        }