public SortedDictionary <string, object> GetRongHeDynamicQRCodePayRequestParameter(int companyId, string storeId, string machineSn, string orderSn, decimal amount, string paybarcode) { var payConfig = BaseGeneralService <Entity.PayConfiguration, EFDbContext> .Find(o => o.CompanyId == companyId && o.PayType == 25); if (payConfig == null || payConfig.State == 0) { throw new PosException("支付配置尚未启用,无法授权支付!"); } var storePaymentAuthorization = BaseGeneralService <Entity.StorePaymentAuthorization, EFDbContext> .Find(o => o.CompanyId == companyId && o.PayType == 25 && o.StoreId == storeId); if (storePaymentAuthorization == null || storePaymentAuthorization.State == 0) { throw new PosException("门店支付尚未授权,无法进行支付!"); } var QCTPAY_CALLBACK = ConfigurationManager.AppSettings["QCTPAY_CALLBACK"].ToString(); if (string.IsNullOrEmpty(QCTPAY_CALLBACK)) { throw new PosException("支付配置不完整,无法完成支付!"); } var reqParams = new SortedDictionary <string, object>(); reqParams.Add("charset", CHARSET); reqParams.Add("method", QCTTRADE_PAY_MERCHSCAN); reqParams.Add("mch_id", payConfig.PaymentMerchantNumber); reqParams.Add("store_id", storePaymentAuthorization.MapPaymentStoreId); reqParams.Add("device_id", machineSn); reqParams.Add("sign_type", SIGNTYPE); reqParams.Add("version", VERSION); reqParams.Add("out_trade_no", orderSn); reqParams.Add("create_date", DateTime.Now); reqParams.Add("total_amount", amount); reqParams.Add("buyer_pay_token", paybarcode); reqParams.Add("pay_notify_url", QCTPAY_CALLBACK); reqParams.Add("buyer_mobile", ""); reqParams.Add("goods_name", payConfig.Description); reqParams.Add("goods_desc", ""); reqParams.Add("sign", Sign(reqParams, payConfig.SecurityKey)); return(reqParams); }
public ThirdPartyPaymentStatus GetPayStatus() { var payConfig = BaseGeneralService <Pharos.Logic.Entity.PayConfiguration, EFDbContext> .Find(o => o.CompanyId == CompanyId && o.PayType == 25); var ordersn = ShoppingCartFactory.Factory(StoreId, MachineSn, CompanyId, DeviceSn).PayOrderSn; var storePaymentAuthorization = BaseGeneralService <Pharos.Logic.Entity.StorePaymentAuthorization, EFDbContext> .Find(o => o.CompanyId == CompanyId && o.PayType == 25 && o.StoreId == StoreId); var mic = int.Parse(payConfig.PaymentMerchantNumber); var entity = PayNotifyResultService.Find(o => o.ApiCode == 25 && o.PaySN == ordersn && o.CompanyId == mic); if (entity == null) { return(ThirdPartyPaymentStatus.Unknown); } else if (entity.State == "PAYSUCCESS") { return(ThirdPartyPaymentStatus.Complete); } else { return(ThirdPartyPaymentStatus.Error); } }