Ejemplo n.º 1
0
        public static ReceiptAction IsReceiptValid(string ReceiptNumber, string Mobile, string Email, string SecurityCode)
        {
            ReceiptAction ra = new ReceiptAction();

            Activity <ExternalPay> activity = new Activity <ExternalPay>()
            {
                ActivityType = ActivityType.ExtPay,
            };
            ExternalPay ep = new ExternalPay()
            {
                TempReceiptNumber = ReceiptNumber, Mobile = Mobile, Email = Email, SecurityCode = SecurityCode
            };

            activity.ActivityToLog = ep;
            ActivityHandler AH = new ActivityHandler();

            try
            {
                logging Lvws = new logging();
                VerifyReceiptDetailsforGCSSite Vrfr = Lvws.VerifyReceiptDetailsforGCSSite(ReceiptNumber, Mobile, Email, SecurityCode);


                ra.VerifyReceiptDetailsforGCSSite = Vrfr;

                ReceiptDetailsMinified rd = null;
                string TokenId            = "0";
                if (Vrfr.Proceed)
                {
                    System.Data.DataSet ds = new System.Data.DataSet();

                    ds = Lvws.GetPaymentDetailsforGCSSite(ReceiptNumber, Mobile, Email, false);
                    //to retain decimal value as string (18, 3)..Normal decimal property round off it and removes unneccesary trailing zeroes
                    ds.Tables[0].Rows[0]["Amount"] = Convert.ToDecimal(ds.Tables[0].Rows[0]["Amount"]) + Convert.ToDecimal(0.210);
                    GCSPayment GP = new GCSPayment();
                    rd = GP.BindData <ReceiptDetailsMinified>(ds.Tables[0]);

                    TokenId = Lvws.ExplicitDecryptTokenCall(rd.TokenId);

                    //RandomStringGenerator4DotNet is installed to get random text -- To inject false string in token
                    RandomStringGenerator.StringGenerator RSG = new RandomStringGenerator.StringGenerator()
                    {
                        MinNumericChars = 1, MinLowerCaseChars = 2, MinUpperCaseChars = 1
                    };
                    string randstr = RSG.GenerateString(4);
                    rd.TokenId = rd.TokenId.Insert(3, randstr);

                    activity.TokenId = TokenId;
                }
                ra.ReceiptDetailsMinified = rd;


                AH.LoggerCall <ExternalPay>(activity, LogLevel.Info, null, TokenId, "Receipt Lookup", ErrorAt.None, ep);

                return(ra);
            }
            catch (Exception ex)
            {
                AH.LoggerCall <ExternalPay>(activity, LogLevel.Error, ex, "0", "Receipt Lookup", ErrorAt.ReceiptLookup, ep);

                VerifyReceiptDetailsforGCSSite VerifyReceiptDetailsforGCSSite = new VerifyReceiptDetailsforGCSSite()
                {
                    Proceed = false, Message = "Some error has occured . Please Contact IT Team"
                };

                ra.VerifyReceiptDetailsforGCSSite = VerifyReceiptDetailsforGCSSite;
                return(ra);
            }
        }