private static void LoadPaymentTypes(DalContext dalContext) { var cardPaymentPrice = new Price() { GrossAmount = 0, NetAmount = 0, VatRate = 8 }; var cardPayment = new CardPayment { ServiceFee = cardPaymentPrice, Name = "Card payment" }; var onlinePaymentPrice = new Price() { GrossAmount = 3, NetAmount = 2.78m, VatRate = 8 }; var onlinePayment = new OnlinePayment() { ServiceFee = onlinePaymentPrice, Name = "Online payment" }; dalContext.Prices.Add(cardPaymentPrice); dalContext.CardPayments.Add(cardPayment); dalContext.Prices.Add(onlinePaymentPrice); dalContext.OnlinePayments.Add(onlinePayment); dalContext.SaveChanges(); }
//TEST Commit2 public OnlinePayment GetpayuData(decimal amount, string name) { OnlinePayment _data = new OnlinePayment(); string strCRN = string.Empty; string strAMT = string.Empty; string strRID = string.Empty; _data.Amount = amount; _data.Name = name; strCRN = RandomString(); //// "213851359"; // random generating strRID = RandomString(); _data.OnlineTrackId = strRID; string strHash = Generatehash512(strRID + DateTime.Now); _data.ReferenceNumber = strHash.ToString().Substring(0, 20); _data.CRN = strCRN; _data.MerchantID = "test"; //// Your merchantid _data.Encryptedstring = "test"; ////Your salt _data.TransactionDesc = "Application"; var hashVarsSeq = "key|txnid|amount|productinfo|firstname|email|udf1|udf2|udf3|udf4|udf5|udf6|udf7|udf8|udf9|udf10".Split('|'); // spliting hash sequence from config var hash_string = _data.MerchantID + "|" + _data.OnlineTrackId + "|" + _data.Amount.ToString("g29") + "|" + _data.TransactionDesc + "|" + _data.Name + "|"; hash_string += _data.Email + "|" + _data.CRN + "||||||||||"; hash_string += _data.Encryptedstring; //// appending SALT _data.Checksum = Generatehash512(hash_string).ToLower(); return(_data); }
public static void ProxyExample() { Console.WriteLine("---------- Proxy example"); var payment = new OnlinePayment(new CashPayment()); payment.Pay(200000); payment.Pay(1000); }
public void CompletePurchase(OnlinePayment completedPayment) { var passTemplate = _passTemplateRepository.Get(completedPayment.ItemId.ToInt()); var user = _userRepository.Get(completedPayment.InitiatedBy); _userPassAppender.AddPassToUser(user, PassPaymentStatus.Paid.ToString(), passTemplate); _userRepository.Update(user); }
static void Main(string[] args) { //sample 1 Console.WriteLine("---------- Proxy example"); var payment = new OnlinePayment(new CashPayment()); payment.Pay(200000); payment.Pay(1000); }
public decimal GetFee(OnlinePayment onlinePayment) { if (onlinePayment.ItemType == OnlinePaymentItem.WindyLindy) { return(new NoFeeStrategy() .GetFee(onlinePayment)); } return(new PoliFeeCalculation(onlinePayment.Price) .Calculate() .Result()); }
public IItemStrategy GetStrategy(OnlinePayment onlinePayment) { switch (onlinePayment.ItemType) { case OnlinePaymentItem.WindyLindy: return(_windyLindyStrategy); case OnlinePaymentItem.Pass: return(_passStrategy); default: throw new ArgumentException("Don't have any strategies for item type: {0}".FormatWith(onlinePayment.ItemType)); } }
public OnlinePayment getMobileAppArray(PaymentModel things1) { List <OnlinePayment> data = new List <OnlinePayment>(); OnlinePayment retData = new OnlinePayment(); try { int n = 0; detmobile = things1; SqlConnection conn = new SqlConnection(commonCode.conStr); conn.Open(); SqlCommand cmd = new SqlCommand("Pro_onlinePayment", conn); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@login_Id", SqlDbType.Int).Value = things1.login_id; cmd.Parameters.Add("@ad_id", SqlDbType.Int).Value = things1.ad_id; cmd.Parameters.Add("@category_id", SqlDbType.Int).Value = things1.category_id; cmd.Parameters.Add("@subcategory_id", SqlDbType.Int).Value = things1.subcategory_id; cmd.Parameters.Add("@transaction_Amount", SqlDbType.Int).Value = things1.transaction_Amount; cmd.Parameters.Add("@email_id", SqlDbType.NVarChar).Value = things1.email_id; cmd.Parameters.Add("@mode", SqlDbType.NVarChar).Value = "GET_MERCHANT_DETAILS"; DataSet ds = new DataSet(); SqlDataAdapter da = new SqlDataAdapter(); da.SelectCommand = cmd; da.Fill(ds); DataTable Dt = ds.Tables[0]; conn.Close(); data = commonCode.ConvertDataTable <OnlinePayment>(Dt); // chesksumKey = data[0].checksum_key; if (data[0].provider == "TRACKNPAY") { transId = data[0].transId; things1.transaction_Id = transId; retData.address_line_1 = things1.category_id.ToString(); retData.address_line_2 = things1.ad_id.ToString(); retData.amount = things1.transaction_Amount.ToString(); retData.apiKey = data[0].apiKey; retData.city = "city"; retData.country = "IND"; retData.currency = "INR"; retData.description = data[0].description; retData.email = data[0].email; retData.mobileNumber = data[0].mobileNumber; retData.mode = data[0].mode; retData.order_id = data[0].transId.ToString(); retData.return_url = "http://rmcnet.in/"; retData.salt = data[0].salt; retData.state = "state"; retData.customerName = data[0].customerName; retData.transId = data[0].transId; retData.udf1 = "udf1"; retData.udf2 = "udf2"; retData.udf3 = "udf3"; retData.udf4 = "udf4"; retData.udf5 = "udf5"; retData.zipCode = "000000"; retData.provider = data[0].provider; // Convert the string to the checksum value chesksumValue = Generatehash512(data[0].salt + "|" + things1.category_id + "|" + things1.ad_id + "|" + things1.transaction_Amount + "|" + data[0].apiKey + "|city|IND|INR|" + data[0].description + "|" + data[0].email + "|" + data[0].mode + "|" + data[0].customerName + "|" + data[0].transId + "|" + data[0].mobileNumber + "|http://api.rmcnet.in//api/Payment/return_responseTracknPay|state|udf1|udf2|udf3|udf4|udf5|" + data[0].zipCode); string url = HttpContext.Current.Request.Url.AbsoluteUri; salt = data[0].salt; //retData.checksum_key = chesksumValue; //RemotePost remotepost = new RemotePost(); //remotepost.Url = "https://biz.traknpay.in/v2/getpaymentrequest?api_key=" + data[0].apiKey + "&return_url=https://valaischool.com/api/Payment/return_responseTracknPay&mode=" + data[0].mode + "&order_id=" + data[0].transId + "&amount=" + things1[0].amount + "&name=" + data[0].StudentName + "¤cy=INR&description=" + data[0].description + "&address_line_1=address_line_1&address_line_2=address_line_2&phone=" + data[0].mobileNumber + "&email=" + data[0].email + "&city=" + data[0].city + "&state=state&country=IND&zip_code=" + data[0].zipCode + "&udf1=udf1&udf2=udf2&udf3=udf3&udf4=udf4&udf5=udf5&hash=" + chesksumValue; //testurl = remotepost.Url.ToString(); //enterMsg(things1[0].org_Id, things1[0].academic_Id, things1[0].student_Id, chesksumValue, url, testurl); } return(retData); } catch (Exception e) { return(retData); } }
public ActionResult PayCard(PinViewModel Pin) { var verifyCon = db.OnlinePayments.ToList(); if (verifyCon.Count() < 1) { Pin.StartFrom = "000000"; } for (int counter = 1; counter <= Pin.Quantity; counter++) { int length = Pin.Digit; //--------------Payment Reference Number----------------------------- int maxSize = Pin.Digit; char[] chars = new char[62]; string numbers = "0123456789"; chars = numbers.ToCharArray(); int size = maxSize; byte[] data = new byte[1]; RNGCryptoServiceProvider crypto = new RNGCryptoServiceProvider(); crypto.GetNonZeroBytes(data); size = maxSize; data = new byte[size]; crypto.GetNonZeroBytes(data); StringBuilder result = new StringBuilder(size); foreach (byte b in data) { result.Append(chars[b % (chars.Length - 1)]); } //ViewBag.Url = result.ToString(); //********************************* int limit = 1000000; string SerialNo; var maxValue = ""; if (Pin.StartFrom == null) { maxValue = db.OnlinePayments.OrderByDescending(x => x.OnlinePaymentId).Where(x => x.CardSerialNumber.Contains(Pin.SerialCode.ToUpper())).FirstOrDefault().CardSerialNumber; } else { maxValue = Pin.SerialCode.ToUpper() + "/" + Pin.StartFrom; } var defaultnumber = Pin.SerialCode.ToUpper() + "/" + "000000"; if (maxValue == null) { maxValue = defaultnumber; } maxValue = maxValue.Substring(5, 6); int rst = int.Parse(maxValue); int NewNumber = limit + rst + 1; string val = NewNumber.ToString(); val = val.Substring(1, 6); SerialNo = Pin.SerialCode.ToUpper() + "/" + val; //SerialNo = "SEMB/" + val; Pin.StartFrom = null; var year = DateTime.Now.Year; //************************** OnlinePayment cardNumber = db.OnlinePayments.Create(); cardNumber.CardPinNumber = result.ToString(); cardNumber.CardSerialNumber = SerialNo; cardNumber.BatchNumber = year.ToString() + Pin.BatchNumber.ToUpper(); cardNumber.IsUsed = false; cardNumber.IsValid = true; cardNumber.DateProduced = DateTime.Now; db.OnlinePayments.Add(cardNumber); db.SaveChanges(); ViewBag.Success = Pin.Quantity; TempData["Check"] = "Ok"; } return(RedirectToAction("PayCard", new { id = ViewBag.Success, batch = Pin.BatchNumber.ToUpper() })); }
public decimal GetFee(OnlinePayment onlinePayment) { return 0; }
public decimal GetFee(OnlinePayment onlinePayment) { return(new PayPalFeeCalculation(onlinePayment.Price) .Calculate() .Result()); }
private bool IsItemValidToPurchase(OnlinePayment payment) { var validationStrategy = _validationStrategyFactory.GetStrategy(payment.ItemType); return(validationStrategy.IsValid(payment.ItemId)); }