public void CreateOrUpdate(Payments payment) { lock (Look) { _db.Payments.AddOrUpdate(payment); _db.SaveChanges(); } }
public void TooShort() { Assert.False(Payments.IsValidIso11649Reference("RF04")); }
public void ValidWithLowercase() { Assert.True(Payments.IsValidIso11649Reference("RF66qs9H7NJ4fvs99SPO")); }
public void ValidWithLowercaseLetters() { Assert.True(Payments.IsValidIso11649Reference("RF 44 all lower case")); }
public void Valid() { Assert.True(Payments.IsValidIso11649Reference("RF49N73GBST73AKL38ZX")); }
public void TooShortException() { Assert.Throws <ArgumentException>(() => Payments.CreateIso11649Reference("")); }
public void CreateCreditorReference() { Assert.Equal("RF91B334BOPQE39D902DC", Payments.CreateIso11649Reference("B334BOPQE39D902DC")); }
public void FormatShort() { Assert.Equal("RF15 093", Payments.FormatIban("RF15093")); }
public void InvalidLengthQrReference() { Assert.False(Payments.IsValidQrReference("2100000003139471430009017")); }
public ActionResult PaymentCheck(Payments payments) { return(RedirectToAction("PaymentCheckOut", new { id = payments.Id })); }
public async Task <bool> AddPayment(Payments payment) { return(await _paymentRepository.AddPayment(payment)); }
public void Add(Payment payment) { Payments.Add(payment); }
/// <summary> /// 修改用户支付方式 /// </summary> /// <param name="paymentsDTO">支付方式实体</param> /// <returns></returns> public ResultDTO UpdatePaymentExt(PaymentsVM paymentsVM) { if (paymentsVM == null || paymentsVM.PaymentIds == null || !paymentsVM.PaymentIds.Any()) { return new ResultDTO { ResultCode = 1, Message = "支付方式不能为空" } } ; if (paymentsVM.AppScoreSetting == null) { paymentsVM.AppScoreSetting = new AppScoreSettingDTO(); } //app是否有积分功能项 var isMyIntegral = BACBP.CheckMyIntegral(paymentsVM.AppId); if (isMyIntegral && paymentsVM.AppScoreSetting.IsCashForScore && CustomConfig.ScoreCostList.All(c => c != paymentsVM.AppScoreSetting.ScoreCost)) { return(new ResultDTO { ResultCode = 2, Message = "积分设置不合法" }); } Payments p = new Payments(); List <Payments> payments = Payments.ObjectSet().Where(n => n.AppId == paymentsVM.AppId).ToList(); ContextSession contextSession = ContextFactory.CurrentThreadContext; try { foreach (Payments item in payments) { item.EntityState = System.Data.EntityState.Deleted; contextSession.Delete(item); } if (paymentsVM.PaymentIds != null && paymentsVM.PaymentIds.Count() > 0) { foreach (var item in paymentsVM.PaymentIds) { Guid payId; if (!Guid.TryParse(item, out payId)) { continue; } string name = AllPayment.ObjectSet().Where(n => n.Id == payId).Select(n => n.PaymentName).FirstOrDefault(); DateTime dt = DateTime.Now; PaymentsDTO paymentsDTO = new PaymentsDTO(); paymentsDTO.Id = Guid.NewGuid(); paymentsDTO.Name = name; paymentsDTO.AppId = paymentsVM.AppId; paymentsDTO.Code = dt.ToFileTime().ToString(); paymentsDTO.SubTime = DateTime.Now; paymentsDTO.SubId = paymentsVM.AppId; paymentsDTO.PaymentId = new Guid(item); paymentsDTO.IsOnuse = paymentsVM.IsOnuse; paymentsDTO.PaymentName = name; if (name == "支付宝") { paymentsDTO.AliPayPartnerId = paymentsVM.AliPayPartnerId; paymentsDTO.AliPayPrivateKey = paymentsVM.AliPayPrivateKey; paymentsDTO.AliPayPublicKey = paymentsVM.AliPayPublicKey; paymentsDTO.AliPaySeller = paymentsVM.AliPaySeller; paymentsDTO.AliPayVerifyCode = paymentsVM.AliPayVerifyCode; } paymentsDTO.EntityState = System.Data.EntityState.Added; Payments payment = new Payments().FromEntityData(paymentsDTO); contextSession.SaveObject(payment); } } //保存积分抵现设置 if (isMyIntegral) { var appExt = AppExtension.ObjectSet().FirstOrDefault(c => c.Id == paymentsVM.AppId); if (appExt != null) { appExt.IsCashForScore = paymentsVM.AppScoreSetting.IsCashForScore; appExt.ModifiedOn = DateTime.Now; appExt.EntityState = EntityState.Modified; } else { appExt = AppExtension.CreateAppExtension(); appExt.Id = paymentsVM.AppId; appExt.IsCashForScore = paymentsVM.AppScoreSetting.IsCashForScore; contextSession.SaveObject(appExt); } if (paymentsVM.AppScoreSetting.IsCashForScore) { //差异判断,设置不变,不重新保存 var lastScoreSetting = ScoreSetting.ObjectSet().Where(c => c.AppId == paymentsVM.AppId).OrderByDescending(c => c.SubTime).FirstOrDefault(); if (lastScoreSetting == null || lastScoreSetting.ScoreCost != paymentsVM.AppScoreSetting.ScoreCost) { ScoreSetting scoreSetting = ScoreSetting.CreateScoreSetting(); scoreSetting.ScoreCost = paymentsVM.AppScoreSetting.ScoreCost; scoreSetting.AppId = paymentsVM.AppId; contextSession.SaveObject(scoreSetting); } } } contextSession.SaveChange(); //删除缓存 Jinher.JAP.Cache.GlobalCacheWrapper.Remove("G_PaymentInfo", paymentsVM.AppId.ToString(), "BTPCache"); Jinher.JAP.Cache.GlobalCacheWrapper.Remove("G_AliPayInfo", paymentsVM.AppId.ToString(), "BTPCache"); } catch (Exception ex) { LogHelper.Error(string.Format("修改用户支付方式服务异常。paymentsVM:{0}", JsonHelper.JsonSerializer(paymentsVM)), ex); return(new ResultDTO { ResultCode = 1, Message = "Error" }); } return(new ResultDTO { ResultCode = 0, Message = "Success" }); }
///<summary>Most of the logic for breaking an appointment. Pass in the brokenFee (the number the user enters in the brokenAppointment window), ///Optionally pass in if the brokenappointment procedure is being deleted. Returns the broken procedure that was created.</summary> public static Procedure BreakAppointment(Appointment appt, Patient pat, ProcedureCode procCode, double feeOverride, bool isDeleteBrokenProc = false) { //suppressHistory is true due to below logic creating a log with a specific HistAppointmentAction instead of the generic changed. DateTime datePrevious = appt.DateTStamp; bool suppressHistory = false; if (procCode != null) { suppressHistory = procCode.ProcCode == "D9986" || procCode.ProcCode == "D9987"; } Appointments.SetAptStatus(appt, ApptStatus.Broken, suppressHistory); //Appointments S-Class handles Signalods if (appt.AptStatus != ApptStatus.Complete) //seperate log entry for completed appointments. { SecurityLogs.MakeLogEntry(Permissions.AppointmentEdit, pat.PatNum, appt.ProcDescript + ", " + appt.AptDateTime.ToString() + ", Broken from the Appts module.", appt.AptNum, datePrevious); } else { SecurityLogs.MakeLogEntry(Permissions.AppointmentCompleteEdit, pat.PatNum, appt.ProcDescript + ", " + appt.AptDateTime.ToString() + ", Broken from the Appts module.", appt.AptNum, datePrevious); } List <Procedure> listProcedures = Procedures.GetProcsForSingle(appt.AptNum, false); //splits should only exist on procs if they are using tp pre-payments List <PaySplit> listSplitsForApptProcs = new List <PaySplit>(); bool isNonRefundable = false; double brokenProcAmount = 0; if (listProcedures.Count > 0) { listSplitsForApptProcs = PaySplits.GetPaySplitsFromProcs(listProcedures.Select(x => x.ProcNum).ToList()); } Procedure brokenProcedure = new Procedure(); #region Charting the proc if (procCode != null) { switch (procCode.ProcCode) { case "D9986": //Missed HistAppointments.CreateHistoryEntry(appt.AptNum, HistAppointmentAction.Missed); break; case "D9987": //Cancelled HistAppointments.CreateHistoryEntry(appt.AptNum, HistAppointmentAction.Cancelled); break; } brokenProcedure.PatNum = pat.PatNum; brokenProcedure.ProvNum = (procCode.ProvNumDefault > 0 ? procCode.ProvNumDefault : appt.ProvNum); brokenProcedure.CodeNum = procCode.CodeNum; brokenProcedure.ProcDate = DateTime.Today; brokenProcedure.DateEntryC = DateTime.Now; brokenProcedure.ProcStatus = ProcStat.C; brokenProcedure.ClinicNum = appt.ClinicNum; brokenProcedure.UserNum = Security.CurUser.UserNum; brokenProcedure.Note = Lans.g("AppointmentEdit", "Appt BROKEN for") + " " + appt.ProcDescript + " " + appt.AptDateTime.ToString(); brokenProcedure.PlaceService = (PlaceOfService)PrefC.GetInt(PrefName.DefaultProcedurePlaceService); //Default proc place of service for the Practice is used. List <InsSub> listInsSubs = InsSubs.RefreshForFam(Patients.GetFamily(pat.PatNum)); List <InsPlan> listInsPlans = InsPlans.RefreshForSubList(listInsSubs); List <PatPlan> listPatPlans = PatPlans.Refresh(pat.PatNum); InsPlan insPlanPrimary = null; InsSub insSubPrimary = null; if (listPatPlans.Count > 0) { insSubPrimary = InsSubs.GetSub(listPatPlans[0].InsSubNum, listInsSubs); insPlanPrimary = InsPlans.GetPlan(insSubPrimary.PlanNum, listInsPlans); } double procFee; long feeSch; if (insPlanPrimary == null || procCode.NoBillIns) { feeSch = FeeScheds.GetFeeSched(0, pat.FeeSched, brokenProcedure.ProvNum); } else //Only take into account the patient's insurance fee schedule if the D9986 procedure is not marked as NoBillIns { feeSch = FeeScheds.GetFeeSched(insPlanPrimary.FeeSched, pat.FeeSched, brokenProcedure.ProvNum); } procFee = Fees.GetAmount0(brokenProcedure.CodeNum, feeSch, brokenProcedure.ClinicNum, brokenProcedure.ProvNum); if (insPlanPrimary != null && insPlanPrimary.PlanType == "p" && !insPlanPrimary.IsMedical) //PPO { double provFee = Fees.GetAmount0(brokenProcedure.CodeNum, Providers.GetProv(brokenProcedure.ProvNum).FeeSched, brokenProcedure.ClinicNum, brokenProcedure.ProvNum); brokenProcedure.ProcFee = Math.Max(provFee, procFee); } else { brokenProcedure.ProcFee = procFee; } if (!PrefC.GetBool(PrefName.EasyHidePublicHealth)) { brokenProcedure.SiteNum = pat.SiteNum; } Procedures.Insert(brokenProcedure); Procedure procOld = brokenProcedure.Copy(); //Now make a claimproc if the patient has insurance. We do this now for consistency because a claimproc could get created in the future. List <Benefit> listBenefits = Benefits.Refresh(listPatPlans, listInsSubs); List <ClaimProc> listClaimProcsForProc = ClaimProcs.RefreshForProc(brokenProcedure.ProcNum); Procedures.ComputeEstimates(brokenProcedure, pat.PatNum, listClaimProcsForProc, false, listInsPlans, listPatPlans, listBenefits, pat.Age, listInsSubs); if (listSplitsForApptProcs.Count > 0 && PrefC.GetBool(PrefName.TpPrePayIsNonRefundable) && procCode.ProcCode == "D9986") { //if there are pre-payments, non-refundable pre-payments is turned on, and the broken appointment is a missed code then auto-fill //the window with the sum of the procs for the appointment. Transfer money below after broken procedure is confirmed by the user. //normally goes to the form to let the user speficy, this is the auto filled amount for the form. brokenProcedure.ProcFee = feeOverride; //listSplitsForApptProcs.Sum(x => x.SplitAmt); isNonRefundable = true; } if (isDeleteBrokenProc) { brokenProcedure.ProcStatus = ProcStat.D; } brokenProcedure.ProcFee = feeOverride; brokenProcAmount = feeOverride; Procedures.Update(brokenProcedure, procOld); } #endregion //Note this MUST come after FormProcBroken since clicking cancel in that window will delete the procedure. if (isNonRefundable && !isDeleteBrokenProc && listSplitsForApptProcs.Count > 0) { //transfer what the user specified in the broken appointment window. //transfer up to the amount specified by the user foreach (Procedure proc in listProcedures) { if (brokenProcAmount == 0) { break; } List <PaySplit> listSplitsForAppointmentProcedure = listSplitsForApptProcs.FindAll(x => x.ProcNum == proc.ProcNum); foreach (PaySplit split in listSplitsForAppointmentProcedure) { if (brokenProcAmount == 0) { break; } double amt = Math.Min(brokenProcAmount, split.SplitAmt); Payments.CreateTransferForTpProcs(proc, new List <PaySplit> { split }, brokenProcedure, amt); brokenProcAmount -= amt; } } } return(brokenProcedure); }
public Payment Create(Payment item) { return(Payments.Create(item)); }
public void InvalidChecksum99() { Assert.False(Payments.IsValidIban("RF991X")); }
public void ValidQrReferenceWithSpaces() { Assert.True(Payments.IsValidQrReference("21 00000 00003 13947 14300 09017")); }
public void FormatLong() { Assert.Equal("RF41 BD93 DJ3Q GGD9 JI22 D", Payments.FormatIban("RF41BD93DJ3QGGD9JI22D")); }
public void InvalidQrReferenceWithLetters() { Assert.False(Payments.IsValidQrReference("210000S00003139471430009017")); }
public void CreateCreditorReferenceWithLeadingZero() { Assert.Equal("RF097", Payments.CreateIso11649Reference("7")); }
public void InvalidQrReferenceWithSpecialChar() { Assert.False(Payments.IsValidQrReference("210000000%03139471430009017")); }
public void InvalidCharacterException() { Assert.Throws <ArgumentException>(() => Payments.CreateIso11649Reference("ABC-DEF")); }
public void InvalidCheckDigitQrReference() { Assert.False(Payments.IsValidQrReference("210000000003139471430009016")); }
public void ValidWithSpaces() { Assert.True(Payments.IsValidIso11649Reference("RF08 B370 0321")); }
public void FormatQrReference() { Assert.Equal("12 34560 00000 00129 11462 90514", Payments.FormatQrReferenceNumber("123456000000001291146290514")); }
public void ValidWithTrailingAndLeadingSpaces() { Assert.True(Payments.IsValidIso11649Reference(" RF19N8BG33KQ9HSS7BG ")); }
public void InvalidChecksum() { Assert.False(Payments.IsValidIban("RF43029348BDEF3823")); }
public void ValidShort() { Assert.True(Payments.IsValidIso11649Reference("RF040")); }
public void InvalidChecksum00() { Assert.False(Payments.IsValidIban("RF0072")); }
public void InvalidChecksum01() { Assert.False(Payments.IsValidIban("RF0154")); }
public IEnumerable <Payment> Create(IEnumerable <Payment> items) { return(Payments.Create(items)); }