using System; using System.Collections.Generic; using System.Data; using System.Linq; using System.Text; namespace LYFZ.Software.MainBusiness.FinancialManagement { class FinancialPayApiControl { public string SerialNumber { get; set; } public int PayApiControl(string StrOrdNumber, string payType, decimal paymentAmount) { LYFZ.BLL.BLL_ErpSystemConfigure config = new BLL.BLL_ErpSystemConfigure(); if (payType.Replace(" ", "")==("微信刷卡支付")) { DataSet ds = config.GetSystemConfigure("*", "WeiXinPayConfig"); if (ds.Tables[0].Rows.Count > 0) { LYFZ.Model.Model_ErpSystemConfigure modConfig = config.DataRowToModel(ds.Tables[0].Rows[0]); LYFZ.BLL.WXConfigData data = new LYFZ.BLL.WXConfigData(); data = (LYFZ.BLL.WXConfigData)Json.JsonTool.JsonToObject(modConfig.Sconfig_Value, data); if (LYFZ.BLL.BLL_SystemGlobalSetting.SysTemGlobalSetMoel.ThirdOnlinePay) { data.MCHID = data.SubMchId; //data.SubMchId = ""; } if (!string.IsNullOrEmpty(data.AppId) && !string.IsNullOrEmpty(data.MCHID) && !string.IsNullOrEmpty(data.Key) && data.Open && !string.IsNullOrEmpty(data.SubMchId)) { LYFZ.Software.MainBusiness.OAShopManagement.frmActionPay actionPay = new OAShopManagement.frmActionPay(); if (LYFZ.BLL.BLL_SystemGlobalSetting.SysTemGlobalSetMoel.ThirdOnlinePay) { data.MCHID = data.SubMchId; data.SubMchId = ""; } actionPay.BindInfoData(payType.Replace(" ", ""), paymentAmount, data.AppId, data.MCHID, data.Key, data.SubMchId, StrOrdNumber.Trim() + "_" + DateTime.Now.ToString("HHmmssff"), data.TypeData.ToString()); if (actionPay.ShowDialog() != System.Windows.Forms.DialogResult.OK) { MessageBoxCustom.Show("取消微信刷卡支付,保存取消"); return -1; } else { SerialNumber = actionPay.SerialNumber; return 1; } } else if(!data.Open) { MessageBoxCustom.Show("第三方支付 微信刷卡支付未开启,保存取消,请更换付款方式"); return -1; } } } else if (payType.ToString().Replace(" ", "")==("支付宝条码支付")) { DataSet ds = config.GetSystemConfigure("*", "AliPayConfig"); if (ds.Tables[0].Rows.Count > 0) { LYFZ.Model.Model_ErpSystemConfigure modConfig = config.DataRowToModel(ds.Tables[0].Rows[0]); BLL.AliConfigData data = new BLL.AliConfigData(); data = (BLL.AliConfigData)Json.JsonTool.JsonToObject(modConfig.Sconfig_Value, data); if (!string.IsNullOrEmpty(data.AppId) && !string.IsNullOrEmpty(data.MCHID) && !string.IsNullOrEmpty(data.Key) && data.Open) { LYFZ.Software.MainBusiness.OAShopManagement.frmActionPay actionPay = new OAShopManagement.frmActionPay(); if (!string.IsNullOrEmpty(data.SignType)) { actionPay.signtype = data.SignType; } actionPay.BindInfoData(payType.Replace(" ", ""), paymentAmount, data.AppId, data.MCHID, data.Key, data.SubMchId, StrOrdNumber.Trim() + "_" + DateTime.Now.ToString("HHmmssff"), data.TypeData.ToString()); if (actionPay.ShowDialog() != System.Windows.Forms.DialogResult.OK) { MessageBoxCustom.Show("取消支付宝面对面支付,保存取消"); return -1; } else { SerialNumber = actionPay.SerialNumber; return 1; } } else if (!data.Open) { MessageBoxCustom.Show("第三方支付 支付宝条码支付未开启,保存取消,请更换付款方式"); return -1; } } } return 0; } } }