コード例 #1
0
ファイル: PaymentDAO.cs プロジェクト: pavelkasyanov/LalkaBank
 public void CreateOrUpdate(Payments payment)
 {
     lock (Look)
     {
         _db.Payments.AddOrUpdate(payment);
         _db.SaveChanges();
     }
 }
コード例 #2
0
 public void TooShort()
 {
     Assert.False(Payments.IsValidIso11649Reference("RF04"));
 }
コード例 #3
0
 public void ValidWithLowercase()
 {
     Assert.True(Payments.IsValidIso11649Reference("RF66qs9H7NJ4fvs99SPO"));
 }
コード例 #4
0
 public void ValidWithLowercaseLetters()
 {
     Assert.True(Payments.IsValidIso11649Reference("RF 44 all lower case"));
 }
コード例 #5
0
 public void Valid()
 {
     Assert.True(Payments.IsValidIso11649Reference("RF49N73GBST73AKL38ZX"));
 }
コード例 #6
0
 public void TooShortException()
 {
     Assert.Throws <ArgumentException>(() => Payments.CreateIso11649Reference(""));
 }
コード例 #7
0
 public void CreateCreditorReference()
 {
     Assert.Equal("RF91B334BOPQE39D902DC", Payments.CreateIso11649Reference("B334BOPQE39D902DC"));
 }
コード例 #8
0
 public void FormatShort()
 {
     Assert.Equal("RF15 093", Payments.FormatIban("RF15093"));
 }
コード例 #9
0
 public void InvalidLengthQrReference()
 {
     Assert.False(Payments.IsValidQrReference("2100000003139471430009017"));
 }
コード例 #10
0
 public ActionResult PaymentCheck(Payments payments)
 {
     return(RedirectToAction("PaymentCheckOut", new { id = payments.Id }));
 }
コード例 #11
0
 public async Task <bool> AddPayment(Payments payment)
 {
     return(await _paymentRepository.AddPayment(payment));
 }
コード例 #12
0
 public void Add(Payment payment)
 {
     Payments.Add(payment);
 }
コード例 #13
0
        /// <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"
            });
        }
コード例 #14
0
ファイル: AppointmentT.cs プロジェクト: ChemBrain/OpenDental
        ///<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);
        }
コード例 #15
0
ファイル: XeroCoreApi.cs プロジェクト: pseabury/Xero-Net
 public Payment Create(Payment item)
 {
     return(Payments.Create(item));
 }
コード例 #16
0
 public void InvalidChecksum99()
 {
     Assert.False(Payments.IsValidIban("RF991X"));
 }
コード例 #17
0
 public void ValidQrReferenceWithSpaces()
 {
     Assert.True(Payments.IsValidQrReference("21 00000 00003 13947 14300 09017"));
 }
コード例 #18
0
 public void FormatLong()
 {
     Assert.Equal("RF41 BD93 DJ3Q GGD9 JI22 D", Payments.FormatIban("RF41BD93DJ3QGGD9JI22D"));
 }
コード例 #19
0
 public void InvalidQrReferenceWithLetters()
 {
     Assert.False(Payments.IsValidQrReference("210000S00003139471430009017"));
 }
コード例 #20
0
 public void CreateCreditorReferenceWithLeadingZero()
 {
     Assert.Equal("RF097", Payments.CreateIso11649Reference("7"));
 }
コード例 #21
0
 public void InvalidQrReferenceWithSpecialChar()
 {
     Assert.False(Payments.IsValidQrReference("210000000%03139471430009017"));
 }
コード例 #22
0
 public void InvalidCharacterException()
 {
     Assert.Throws <ArgumentException>(() => Payments.CreateIso11649Reference("ABC-DEF"));
 }
コード例 #23
0
 public void InvalidCheckDigitQrReference()
 {
     Assert.False(Payments.IsValidQrReference("210000000003139471430009016"));
 }
コード例 #24
0
 public void ValidWithSpaces()
 {
     Assert.True(Payments.IsValidIso11649Reference("RF08 B370 0321"));
 }
コード例 #25
0
 public void FormatQrReference()
 {
     Assert.Equal("12 34560 00000 00129 11462 90514",
                  Payments.FormatQrReferenceNumber("123456000000001291146290514"));
 }
コード例 #26
0
 public void ValidWithTrailingAndLeadingSpaces()
 {
     Assert.True(Payments.IsValidIso11649Reference(" RF19N8BG33KQ9HSS7BG "));
 }
コード例 #27
0
 public void InvalidChecksum()
 {
     Assert.False(Payments.IsValidIban("RF43029348BDEF3823"));
 }
コード例 #28
0
 public void ValidShort()
 {
     Assert.True(Payments.IsValidIso11649Reference("RF040"));
 }
コード例 #29
0
 public void InvalidChecksum00()
 {
     Assert.False(Payments.IsValidIban("RF0072"));
 }
コード例 #30
0
 public void InvalidChecksum01()
 {
     Assert.False(Payments.IsValidIban("RF0154"));
 }
コード例 #31
0
ファイル: XeroCoreApi.cs プロジェクト: pseabury/Xero-Net
 public IEnumerable <Payment> Create(IEnumerable <Payment> items)
 {
     return(Payments.Create(items));
 }