/// <summary> /// 条码支付 /// </summary> /// <param name="pay">条码支付实体</param> /// <param name="payBack">条码支付实体返回</param> /// <param name="message">错误信息</param> /// <returns></returns> internal bool Pay(Pay pay, out PayBack payBack, out string message) { _log.Info("条码支付 Pay 开始"); var payRequst = new AlipayTradePayRequest(); payRequst.SetNotifyUrl(AlipayConfig.NotifyUrl); payRequst.BizContent = JsonConvert.SerializeObject(pay, new Newtonsoft.Json.JsonSerializerSettings() { DefaultValueHandling = DefaultValueHandling.Ignore }).ToLower(); var payResponse = client.Execute(payRequst); if (payResponse.Code == "10000") { _log.Info("条码支付成功!"); payBack = new PayBack() { Code = payResponse.Code, Msg = payResponse.Msg, Out_Trade_No = payResponse.OutTradeNo, Sub_Code = payResponse.SubCode, Sub_Msg = payResponse.SubMsg, Buyer_Logon_Id = payResponse.BuyerLogonId, Buyer_Pay_Amount = Convert.ToDecimal(payResponse.BuyerPayAmount), Buyer_User_Id = payResponse.BuyerUserId, Card_Balance = Convert.ToDecimal(payResponse.CardBalance), Discount_Goods_Detail = payResponse.DiscountGoodsDetail, Fund_Bill_List = GetTradeFundBills(payResponse.FundBillList), Gmt_Payment = Convert.ToDateTime(payResponse.GmtPayment), Invoice_Amount = Convert.ToDecimal(payResponse.InvoiceAmount), Point_Amount = Convert.ToDecimal(payResponse.PointAmount), Receipt_Amount = Convert.ToDecimal(payResponse.ReceiptAmount), Store_Name = payResponse.StoreName, Total_Amount = payResponse.TotalAmount, Trade_No = payResponse.TradeNo, Voucher_Detail_List = GetVoucherDetails(payResponse.VoucherDetailList) }; message = ""; return(true); } else { payBack = null; message = $"{ payResponse.Msg},{payResponse.SubMsg}"; _log.Error($"条码支付失败:{message}"); return(false); } }
public async Task <bool> ValidateRideSettings() { if (!EmailHelper.IsEmail(Email)) { await this.Services().Message.ShowMessage(this.Services().Localize["InvalidEmailTitle"], this.Services().Localize["InvalidEmailMessage"]); return(false); } if (string.IsNullOrEmpty(Name) || string.IsNullOrEmpty(Phone)) { await this.Services().Message.ShowMessage(this.Services().Localize["UpdateBookingSettingsInvalidDataTitle"], this.Services().Localize["UpdateBookingSettingsEmptyField"]); return(false); } if (!PhoneNumber.IsNumberPossible()) { await this.Services().Message.ShowMessage(this.Services().Localize["UpdateBookingSettingsInvalidDataTitle"], string.Format(this.Services().Localize["InvalidPhoneErrorMessage"], PhoneNumber.GetPhoneExample())); return(false); } if (ChargeTypeId == ChargeTypes.Account.Id && string.IsNullOrWhiteSpace(AccountNumber) && string.IsNullOrWhiteSpace(CustomerNumber)) { await this.Services().Message.ShowMessage(this.Services().Localize["UpdateBookingSettingsInvalidDataTitle"], this.Services().Localize["UpdateBookingSettingsEmptyAccount"]); return(false); } if (Settings.IsPayBackRegistrationFieldRequired == true && !PayBack.HasValue()) { await this.Services().Message.ShowMessage(this.Services().Localize["UpdateBookingSettingsInvalidDataTitle"], this.Services().Localize["NoPayBackErrorMessage"]); return(false); } if (PayBack.HasValue() && (PayBack.Length > 10 || !PayBack.IsNumber())) { await this.Services().Message.ShowMessage(this.Services().Localize["UpdateBookingSettingsInvalidDataTitle"], this.Services().Localize["InvalidPayBackErrorMessage"]); return(false); } // PayBack value is set to string empty if the field is left empty by the user _bookingSettings.PayBack = _bookingSettings.PayBack == string.Empty ? null : _bookingSettings.PayBack; Phone = PhoneHelper.GetDigitsFromPhoneNumber(Phone); if (ChargeTypeId == ChargeTypes.Account.Id) { var creditCard = PaymentPreferences.SelectedCreditCardId == Guid.Empty ? default(Guid?) : PaymentPreferences.SelectedCreditCardId; try { // Validate if the charge account needs to have a card on file to be used var chargeAccount = await _accountPaymentService.GetAccountCharge(AccountNumber, CustomerNumber); if (chargeAccount.UseCardOnFileForPayment && creditCard == default(Guid?)) { await this.Services().Message.ShowMessage(this.Services().Localize["UpdateBookingSettingsInvalidDataTitle"], this.Services().Localize["UpdateBookingSettingsInvalidCoF"]); return(false); } } catch { this.Services().Message.ShowMessage(this.Services().Localize["UpdateBookingSettingsInvalidDataTitle"], this.Services().Localize["UpdateBookingSettingsInvalidAccount"]).HandleErrors(); return(false); } } return(true); }
public PayBack AddPayBack(string html) { DbContext(); var regex = new PayBackCname(); var win = regex.win.Matches(html); var wideBefore = regex.wideBefore.Matches(html); var wideAfter = regex.wideAfter.Matches(html); var tripleBefor = regex.tripleBefor.Matches(html); var tripleCenter = regex.tripleCenter.Matches(html); var tripleAfter = regex.tripleAfter.Matches(html); var refund = regex.refund.Matches(html); var payback = new PayBack(); var headCount = win.Count + wideBefore.Count + wideAfter.Count + tripleBefor.Count + tripleCenter.Count + tripleAfter.Count; // 馬番 switch (headCount) { case 22: payback.TanshoNum = int.Parse(win[0].Value); payback.Fuku1Num = int.Parse(win[1].Value); payback.Fuku2Num = int.Parse(win[2].Value); payback.Fuku3Num = int.Parse(win[3].Value); payback.Wakuren1Waku = int.Parse(wideBefore[0].Value); payback.Wakuren2Waku = int.Parse(wideAfter[0].Value); payback.Wide1_1Num = int.Parse(wideBefore[1].Value); payback.Wide1_2Num = int.Parse(wideAfter[1].Value); payback.Wide2_1Num = int.Parse(wideBefore[2].Value); payback.Wide2_2Num = int.Parse(wideAfter[2].Value); payback.Wide3_1Num = int.Parse(wideBefore[3].Value); payback.Wide3_2Num = int.Parse(wideAfter[3].Value); payback.Umaren1Num = int.Parse(wideBefore[4].Value); payback.Umaren2Num = int.Parse(wideAfter[4].Value); payback.Umatan1Num = int.Parse(wideBefore[5].Value); payback.Umatan2Num = int.Parse(wideAfter[5].Value); payback.Sanfuku1Num = int.Parse(tripleBefor[0].Value); payback.Sanfuku2Num = int.Parse(tripleCenter[0].Value); payback.Sanfuku3Num = int.Parse(tripleAfter[0].Value); payback.Santan1Num = int.Parse(tripleBefor[1].Value); payback.Santan2Num = int.Parse(tripleCenter[1].Value); payback.Santan3Num = int.Parse(tripleAfter[1].Value); break; case 20: payback.TanshoNum = int.Parse(win[0].Value); payback.Fuku1Num = int.Parse(win[1].Value); payback.Fuku2Num = int.Parse(win[2].Value); payback.Fuku3Num = int.Parse(win[3].Value); payback.Wide1_1Num = int.Parse(wideBefore[0].Value); payback.Wide1_2Num = int.Parse(wideAfter[0].Value); payback.Wide2_1Num = int.Parse(wideBefore[1].Value); payback.Wide2_2Num = int.Parse(wideAfter[1].Value); payback.Wide3_1Num = int.Parse(wideBefore[2].Value); payback.Wide3_2Num = int.Parse(wideAfter[2].Value); payback.Umaren1Num = int.Parse(wideBefore[3].Value); payback.Umaren2Num = int.Parse(wideAfter[3].Value); payback.Umatan1Num = int.Parse(wideBefore[4].Value); payback.Umatan2Num = int.Parse(wideAfter[4].Value); payback.Sanfuku1Num = int.Parse(tripleBefor[0].Value); payback.Sanfuku2Num = int.Parse(tripleCenter[0].Value); payback.Sanfuku3Num = int.Parse(tripleAfter[0].Value); payback.Santan1Num = int.Parse(tripleBefor[1].Value); payback.Santan2Num = int.Parse(tripleCenter[1].Value); payback.Santan3Num = int.Parse(tripleAfter[1].Value); break; case 19: payback.TanshoNum = int.Parse(win[0].Value); payback.Fuku1Num = int.Parse(win[1].Value); payback.Fuku2Num = int.Parse(win[2].Value); payback.Wide1_1Num = int.Parse(wideBefore[0].Value); payback.Wide1_2Num = int.Parse(wideAfter[0].Value); payback.Wide2_1Num = int.Parse(wideBefore[1].Value); payback.Wide2_2Num = int.Parse(wideAfter[1].Value); payback.Wide3_1Num = int.Parse(wideBefore[2].Value); payback.Wide3_2Num = int.Parse(wideAfter[2].Value); payback.Umaren1Num = int.Parse(wideBefore[3].Value); payback.Umaren2Num = int.Parse(wideAfter[3].Value); payback.Umatan1Num = int.Parse(wideBefore[4].Value); payback.Umatan2Num = int.Parse(wideAfter[4].Value); payback.Sanfuku1Num = int.Parse(tripleBefor[0].Value); payback.Sanfuku2Num = int.Parse(tripleCenter[0].Value); payback.Sanfuku3Num = int.Parse(tripleAfter[0].Value); payback.Santan1Num = int.Parse(tripleBefor[1].Value); payback.Santan2Num = int.Parse(tripleCenter[1].Value); payback.Santan3Num = int.Parse(tripleAfter[1].Value); break; } var refundCount = refund.Count; // 払戻金 switch (refundCount) { case 12: payback.TanshoRe = int.Parse(refund[0].Value, System.Globalization.NumberStyles.AllowThousands); payback.Fuku1Re = int.Parse(refund[1].Value, System.Globalization.NumberStyles.AllowThousands); payback.Fuku2Re = int.Parse(refund[2].Value, System.Globalization.NumberStyles.AllowThousands); payback.Fuku3Re = int.Parse(refund[3].Value, System.Globalization.NumberStyles.AllowThousands); payback.WakurenRe = int.Parse(refund[4].Value, System.Globalization.NumberStyles.AllowThousands); payback.Wide1Re = int.Parse(refund[5].Value, System.Globalization.NumberStyles.AllowThousands); payback.Wide2Re = int.Parse(refund[6].Value, System.Globalization.NumberStyles.AllowThousands); payback.Wide3Re = int.Parse(refund[7].Value, System.Globalization.NumberStyles.AllowThousands); payback.UmarenRe = int.Parse(refund[8].Value, System.Globalization.NumberStyles.AllowThousands); payback.UmatanRe = int.Parse(refund[9].Value, System.Globalization.NumberStyles.AllowThousands); payback.SanfukuRe = int.Parse(refund[10].Value, System.Globalization.NumberStyles.AllowThousands); payback.SantanRe = int.Parse(refund[11].Value, System.Globalization.NumberStyles.AllowThousands); break; case 11: payback.TanshoRe = int.Parse(refund[0].Value, System.Globalization.NumberStyles.AllowThousands); payback.Fuku1Re = int.Parse(refund[1].Value, System.Globalization.NumberStyles.AllowThousands); payback.Fuku2Re = int.Parse(refund[2].Value, System.Globalization.NumberStyles.AllowThousands); payback.Fuku3Re = int.Parse(refund[3].Value, System.Globalization.NumberStyles.AllowThousands); payback.Wide1Re = int.Parse(refund[4].Value, System.Globalization.NumberStyles.AllowThousands); payback.Wide2Re = int.Parse(refund[5].Value, System.Globalization.NumberStyles.AllowThousands); payback.Wide3Re = int.Parse(refund[6].Value, System.Globalization.NumberStyles.AllowThousands); payback.UmarenRe = int.Parse(refund[7].Value, System.Globalization.NumberStyles.AllowThousands); payback.UmatanRe = int.Parse(refund[8].Value, System.Globalization.NumberStyles.AllowThousands); payback.SanfukuRe = int.Parse(refund[9].Value, System.Globalization.NumberStyles.AllowThousands); payback.SantanRe = int.Parse(refund[10].Value, System.Globalization.NumberStyles.AllowThousands); break; case 10: payback.TanshoRe = int.Parse(refund[0].Value, System.Globalization.NumberStyles.AllowThousands); payback.Fuku1Re = int.Parse(refund[1].Value, System.Globalization.NumberStyles.AllowThousands); payback.Fuku2Re = int.Parse(refund[2].Value, System.Globalization.NumberStyles.AllowThousands); payback.Wide1Re = int.Parse(refund[3].Value, System.Globalization.NumberStyles.AllowThousands); payback.Wide2Re = int.Parse(refund[4].Value, System.Globalization.NumberStyles.AllowThousands); payback.Wide3Re = int.Parse(refund[5].Value, System.Globalization.NumberStyles.AllowThousands); payback.UmarenRe = int.Parse(refund[6].Value, System.Globalization.NumberStyles.AllowThousands); payback.UmatanRe = int.Parse(refund[7].Value, System.Globalization.NumberStyles.AllowThousands); payback.SanfukuRe = int.Parse(refund[8].Value, System.Globalization.NumberStyles.AllowThousands); payback.SantanRe = int.Parse(refund[9].Value, System.Globalization.NumberStyles.AllowThousands); break; } context.PayBack.Add(payback); context.SaveChanges(); return(payback); }