Exemplo n.º 1
0
        /// <summary>
        /// Gets the gatherd data from a receipt form
        /// </summary>
        /// <returns></returns>
        public Receipt GetReceiptFromForm()
        {
            string fname = Request.Form["Firstname"];
            string lname = Request.Form["Lastname"];
            string Month = Request.Form["Month"];
            string Year  = Request.Form["Month"];
            string Nr    = Request.Form["AccNr"];
            string CVC   = Request.Form["CVCNr"];

            //gets length of account nr
            int    lengthOfAccNr = Nr.Length;
            string accNrRedacted = string.Empty;

            //Foreach char in account nr replace with star char
            for (int i = 0; i < lengthOfAccNr; i++)
            {
                accNrRedacted += "*";
            }
            if (lengthOfAccNr > 5)
            {
                //take last fourchars in redacted account number and return last four numbers in original account nr
                accNrRedacted = accNrRedacted.Remove(accNrRedacted.Length - 4, 4) + Nr.Substring(Nr.Length - 4);
            }

            //Create new receipt object
            Models.Cart.Receipt receipt = new Models.Cart.Receipt()
            {
                FullName   = fname + " " + lname,
                Date       = DateTime.Now.ToString(),
                AccountNr  = accNrRedacted,
                FinalPrice = Models.Cart.CartItem.FinalPrice
            };
            return(receipt);
        }
Exemplo n.º 2
0
 /// <summary>
 /// Sets the data based on predetrmind values
 /// </summary>
 /// <returns></returns>
 private Receipt GetReceiptFromAutofill()
 {
     Models.Cart.Receipt receipt = new Models.Cart.Receipt()
     {
         FullName   = Models.StoreFront.StoreFront.CustomerList[(int)Session["UserId"] - 1].Firstname + " " + Models.StoreFront.StoreFront.CustomerList[(int)Session["UserId"] - 1].Lastname,
         Date       = DateTime.Now.ToString(),
         AccountNr  = "[REDACTED]",
         FinalPrice = Models.Cart.CartItem.FinalPrice
     };
     return(receipt);
 }