コード例 #1
0
ファイル: ShengPaySet.cs プロジェクト: damoOnly/e-commerce
        protected void btnOK_Click(object sender, System.EventArgs e)
        {
            SiteSettings masterSettings = SettingsManager.GetMasterSettings(false);

            masterSettings.EnableAppShengPay = this.radEnableAppShengPay.SelectedValue;
            SettingsManager.Save(masterSettings);
            string          text        = string.Format("<xml><SenderId>{0}</SenderId><SellerKey>{1}</SellerKey><Seller_account_name></Seller_account_name></xml>", this.txtPartner.Text, this.txtKey.Text);
            PaymentModeInfo paymentMode = SalesHelper.GetPaymentMode("Ecdev.Plugins.Payment.ShengPayMobile.ShengPayMobileRequest");

            if (paymentMode == null)
            {
                PaymentModeInfo paymentMode2 = new PaymentModeInfo
                {
                    Name            = "盛付通手机网页支付",
                    Gateway         = "Ecdev.Plugins.Payment.ShengPayMobile.ShengPayMobileRequest",
                    Description     = string.Empty,
                    IsUseInpour     = false,
                    Charge          = 0m,
                    IsPercent       = false,
                    ApplicationType = PayApplicationType.payOnWAP,
                    Settings        = HiCryptographer.Encrypt(text)
                };
                SalesHelper.CreatePaymentMode(paymentMode2);
            }
            else
            {
                PaymentModeInfo paymentModeInfo = paymentMode;
                paymentModeInfo.Settings        = HiCryptographer.Encrypt(text);
                paymentModeInfo.ApplicationType = PayApplicationType.payOnWAP;
                SalesHelper.UpdatePaymentMode(paymentModeInfo);
            }
            this.ShowMsg("修改成功", true);
        }
コード例 #2
0
        protected void btnOK_Click(object sender, EventArgs e)
        {
            SiteSettings masterSettings = SettingsManager.GetMasterSettings(false);

            masterSettings.EnableAliOHAliPay = this.radEnableWapAliPay.SelectedValue;
            SettingsManager.Save(masterSettings);
            string          text        = string.Format("<xml><Partner>{0}</Partner><Key>{1}</Key><Seller_account_name>{2}</Seller_account_name></xml>", this.txtPartner.Text, this.txtKey.Text, this.txtAccount.Text);
            PaymentModeInfo paymentMode = SalesHelper.GetPaymentMode("hishop.plugins.payment.ws_wappay.wswappayrequest");

            if (paymentMode == null)
            {
                PaymentModeInfo info2 = new PaymentModeInfo {
                    Name            = "支付宝手机网页支付",
                    Gateway         = "hishop.plugins.payment.ws_wappay.wswappayrequest",
                    Description     = string.Empty,
                    IsUseInpour     = false,
                    Charge          = 0M,
                    IsPercent       = false,
                    ApplicationType = PayApplicationType.payOnWAP,
                    Settings        = HiCryptographer.Encrypt(text)
                };
                SalesHelper.CreatePaymentMode(info2);
            }
            else
            {
                PaymentModeInfo info4 = paymentMode;
                info4.Settings        = HiCryptographer.Encrypt(text);
                info4.ApplicationType = PayApplicationType.payOnWAP;
                SalesHelper.UpdatePaymentMode(info4);
            }
            this.ShowMsg("修改成功", true);
        }
コード例 #3
0
        protected void btnOK_Click(object sender, EventArgs e)
        {
            SiteSettings masterSettings = SettingsManager.GetMasterSettings();

            if (this.radEnableWapBankUnionPay.SelectedValue)
            {
                if (string.IsNullOrEmpty(this.txtPartner.Text))
                {
                    this.ShowMsg("商户号不能为空", false);
                    return;
                }
                if (string.IsNullOrEmpty(this.txtKey.Text))
                {
                    this.ShowMsg("证书密码不能为空", false);
                    return;
                }
            }
            masterSettings.EnableAPPBankUnionPay = this.radEnableWapBankUnionPay.SelectedValue;
            SettingsManager.Save(masterSettings);
            string arg = this.txtCerFileName.Text;

            if (this.fileBankUnionCert.HasFile)
            {
                if (!Globals.ValidateCertFile(this.fileBankUnionCert.PostedFile.FileName))
                {
                    this.ShowMsg("非法的证书文件", false);
                    return;
                }
                this.fileBankUnionCert.PostedFile.SaveAs(base.Server.MapPath("~/config/") + this.fileBankUnionCert.PostedFile.FileName);
                arg = this.fileBankUnionCert.PostedFile.FileName;
            }
            string          text        = $"<xml><Vmid>{this.txtPartner.Text.Trim()}</Vmid><SignCertFileName>{arg}</SignCertFileName><Key>{this.txtKey.Text.Trim()}</Key></xml>";
            PaymentModeInfo paymentMode = SalesHelper.GetPaymentMode("hishop.plugins.payment.bankuniongateway.bankuniongetwayrequest");

            if (paymentMode == null)
            {
                PaymentModeInfo paymentMode2 = new PaymentModeInfo
                {
                    Name            = "银联全渠道支付",
                    Gateway         = "hishop.plugins.payment.bankuniongateway.bankuniongetwayrequest",
                    Description     = string.Empty,
                    IsUseInpour     = false,
                    ApplicationType = PayApplicationType.payOnPC,
                    Settings        = HiCryptographer.Encrypt(text)
                };
                SalesHelper.CreatePaymentMode(paymentMode2);
            }
            else
            {
                PaymentModeInfo paymentModeInfo = paymentMode;
                paymentModeInfo.Settings        = HiCryptographer.Encrypt(text);
                paymentModeInfo.ApplicationType = PayApplicationType.payOnPC;
                SalesHelper.UpdatePaymentMode(paymentModeInfo);
            }
            this.ShowMsg("修改成功", true, "");
        }
コード例 #4
0
        protected void btnOK_Click(object sender, System.EventArgs e)
        {
            SiteSettings masterSettings = SettingsManager.GetMasterSettings(false);

            masterSettings.EnableAliOHAliPay = this.radEnableWapAliPay.SelectedValue;
            SettingsManager.Save(masterSettings);
            string text = string.Format("<xml><Partner>{0}</Partner><Key>{1}</Key><Seller_account_name>{2}</Seller_account_name></xml>", this.txtPartner.Text, this.txtKey.Text, this.txtAccount.Text);
            //bool flag = !string.IsNullOrWhiteSpace(this.txtPartner.Text) && !string.IsNullOrWhiteSpace(this.txtKey.Text) && !string.IsNullOrWhiteSpace(this.txtAccount.Text);
            PaymentModeInfo paymentMode = SalesHelper.GetPaymentMode("hishop.plugins.payment.ws_wappay.wswappayrequest");

            if (paymentMode == null)
            {
                PaymentModeInfo info2 = new PaymentModeInfo
                {
                    Name        = "支付宝手机支付",
                    Gateway     = "hishop.plugins.payment.ws_wappay.wswappayrequest",
                    Description = string.Empty,
                    IsUseInpour = true,
                    Charge      = 0m,
                    IsPercent   = false,
                    Settings    = HiCryptographer.Encrypt(text)
                };
                if (SalesHelper.CreatePaymentMode(info2) == PaymentModeActionStatus.Success)
                {
                    //SiteSettings masterSettings = SettingsManager.GetMasterSettings(false);
                    //masterSettings.EnableAlipayRequest = flag;
                    //SettingsManager.Save(masterSettings);
                    this.ShowMsg("设置成功", true);
                }
                else
                {
                    this.ShowMsg("设置失败", false);
                }
            }
            else
            {
                paymentMode.Settings = HiCryptographer.Encrypt(text);


                if (SalesHelper.UpdatePaymentMode(paymentMode) == PaymentModeActionStatus.Success)
                {
                    this.ShowMsg("设置成功", true);
                }
                else
                {
                    this.ShowMsg("设置失败", false);
                }
            }
        }
コード例 #5
0
        private void btnCreate_Click(object sender, System.EventArgs e)
        {
            string     gateway;
            ConfigData configData;
            decimal    charge;

            if (!this.ValidateValues(out gateway, out configData, out charge))
            {
                return;
            }
            PaymentModeInfo paymentMode = new PaymentModeInfo
            {
                Name            = this.txtName.Text,
                Description     = this.fcContent.Text.Replace("\r\n", "").Replace("\r", "").Replace("\n", ""),
                Gateway         = gateway,
                IsUseInpour     = this.radiIsUseInpour.SelectedValue,
                Charge          = charge,
                IsPercent       = this.chkIsPercent.Checked,
                ApplicationType = PayApplicationType.payOnPC,
                Settings        = this.txtName.Text == "微信扫码支付" ? "1hSUSkKQ/ENo0JDZah8KKQweixin" : HiCryptographer.Encrypt(configData.SettingsXml)
            };
            PaymentModeActionStatus paymentModeActionStatus = SalesHelper.CreatePaymentMode(paymentMode);

            if (paymentModeActionStatus == PaymentModeActionStatus.Success)
            {
                base.Response.Redirect(Globals.GetAdminAbsolutePath("sales/PaymentTypes.aspx"));
                return;
            }
            if (paymentModeActionStatus == PaymentModeActionStatus.DuplicateGateway)
            {
                this.ShowMsg("已经添加了一个相同类型的支付接口", false);
                return;
            }
            if (paymentModeActionStatus == PaymentModeActionStatus.DuplicateName)
            {
                this.ShowMsg("已经存在一个相同的支付方式名称", false);
                return;
            }
            if (paymentModeActionStatus == PaymentModeActionStatus.OutofNumber)
            {
                this.ShowMsg("支付方式的数目已经超出系统设置的数目", false);
                return;
            }
            this.ShowMsg("未知错误", false);
        }
コード例 #6
0
        protected void btnOK_Click(object sender, EventArgs e)
        {
            SiteSettings masterSettings = SettingsManager.GetMasterSettings();

            if (this.radEnableAppShengPay.SelectedValue)
            {
                if (string.IsNullOrEmpty(this.txtPartner.Text))
                {
                    this.ShowMsg("商户号不能为空", false);
                    return;
                }
                if (string.IsNullOrEmpty(this.txtKey.Text))
                {
                    this.ShowMsg("商户密钥不能为空", false);
                    return;
                }
            }
            masterSettings.EnableAppShengPay = this.radEnableAppShengPay.SelectedValue;
            SettingsManager.Save(masterSettings);
            string          text        = $"<xml><SenderId>{this.txtPartner.Text}</SenderId><SellerKey>{this.txtKey.Text}</SellerKey><Seller_account_name></Seller_account_name></xml>";
            PaymentModeInfo paymentMode = SalesHelper.GetPaymentMode("Hishop.Plugins.Payment.ShengPayMobile.ShengPayMobileRequest");

            if (paymentMode == null)
            {
                PaymentModeInfo paymentMode2 = new PaymentModeInfo
                {
                    Name            = "盛付通手机网页支付",
                    Gateway         = "Hishop.Plugins.Payment.ShengPayMobile.ShengPayMobileRequest",
                    Description     = string.Empty,
                    IsUseInpour     = false,
                    ApplicationType = PayApplicationType.payOnWAP,
                    Settings        = HiCryptographer.Encrypt(text)
                };
                SalesHelper.CreatePaymentMode(paymentMode2);
            }
            else
            {
                PaymentModeInfo paymentModeInfo = paymentMode;
                paymentModeInfo.Settings        = HiCryptographer.Encrypt(text);
                paymentModeInfo.ApplicationType = PayApplicationType.payOnWAP;
                SalesHelper.UpdatePaymentMode(paymentModeInfo);
            }
            this.ShowMsg("修改成功", true);
        }
コード例 #7
0
ファイル: AddPaymentType.cs プロジェクト: tyriankid/WFX
        private void btnCreate_Click(object sender, System.EventArgs e)
        {
            string     str;
            ConfigData data;
            decimal    num;

            if (this.ValidateValues(out str, out data, out num))
            {
                PaymentModeInfo paymentMode = new PaymentModeInfo
                {
                    Name               = this.txtName.Text,
                    Description        = this.fcContent.Text.Replace("\r\n", "").Replace("\r", "").Replace("\n", ""),
                    Gateway            = str,
                    IsUseInpour        = this.radiIsUseInpour.SelectedValue,
                    IsUseInDistributor = this.radiIsUseInDistributor.SelectedValue,
                    Charge             = num,
                    IsPercent          = this.chkIsPercent.Checked,
                    Settings           = HiCryptographer.Encrypt(data.SettingsXml)
                };
                switch (SalesHelper.CreatePaymentMode(paymentMode))
                {
                case PaymentModeActionStatus.Success:
                    base.Response.Redirect(Globals.GetAdminAbsolutePath("sales/PaymentTypes.aspx"));
                    break;

                case PaymentModeActionStatus.DuplicateName:
                    this.ShowMsg("已经存在一个相同的支付方式名称", false);
                    break;

                case PaymentModeActionStatus.OutofNumber:
                    this.ShowMsg("支付方式的数目已经超出系统设置的数目", false);
                    break;

                case PaymentModeActionStatus.DuplicateGateway:
                    this.ShowMsg("已经添加了一个相同类型的支付接口", false);
                    break;

                default:
                    this.ShowMsg("未知错误", false);
                    break;
                }
            }
        }
コード例 #8
0
        private void saveData()
        {
            if (string.IsNullOrEmpty(this.txt_mid.Text))
            {
                this.ShowMsg("请输入商户号!", false);
            }
            this.siteSettings.ShenPay_mid = this.txt_mid.Text;
            if (string.IsNullOrEmpty(this.txt_key.Text))
            {
                this.ShowMsg("请输入商家密钥(Key)!", false);
            }
            this.siteSettings.ShenPay_key = this.txt_key.Text;
            SettingsManager.Save(this.siteSettings);
            string          text        = string.Format("<xml><SenderId>{0}</SenderId><SellerKey>{1}</SellerKey><Seller_account_name></Seller_account_name></xml>", this.txt_mid.Text, this.txt_key.Text);
            PaymentModeInfo paymentMode = SalesHelper.GetPaymentMode("Hishop.Plugins.Payment.ShengPayMobile.ShengPayMobileRequest");

            if (paymentMode == null)
            {
                PaymentModeInfo paymentMode2 = new PaymentModeInfo
                {
                    Name            = "盛付通手机网页支付",
                    Gateway         = "Hishop.Plugins.Payment.ShengPayMobile.ShengPayMobileRequest",
                    Description     = string.Empty,
                    IsUseInpour     = false,
                    Charge          = 0m,
                    IsPercent       = false,
                    ApplicationType = PayApplicationType.payOnWAP,
                    Settings        = HiCryptographer.Encrypt(text)
                };
                SalesHelper.CreatePaymentMode(paymentMode2);
            }
            else
            {
                PaymentModeInfo paymentModeInfo = paymentMode;
                paymentModeInfo.Settings        = HiCryptographer.Encrypt(text);
                paymentModeInfo.ApplicationType = PayApplicationType.payOnWAP;
                SalesHelper.UpdatePaymentMode(paymentModeInfo);
            }
            this.ShowMsg("保存成功!", true);
        }
コード例 #9
0
        protected void btnOK_Click(object sender, System.EventArgs e)
        {
            string text = string.Format("<xml><Partner>{0}</Partner><Key>{1}</Key><Seller_account_name>{2}</Seller_account_name></xml>", this.txtPartner.Text, this.txtKey.Text, this.txtAccount.Text);

            System.Collections.Generic.IList <PaymentModeInfo> paymentModes = SalesHelper.GetPaymentModes(PayApplicationType.payOnVX);
            if (paymentModes == null || paymentModes.Count == 0)
            {
                PaymentModeInfo paymentMode = new PaymentModeInfo
                {
                    Name        = "支付宝手机支付",
                    Gateway     = "Ecdev.plugins.payment.ws_wappay.wswappayrequest",
                    Description = string.Empty,
                    IsUseInpour = true,
                    Charge      = 0m,
                    IsPercent   = false,
                    Settings    = HiCryptographer.Encrypt(text)
                };
                if (SalesHelper.CreatePaymentMode(paymentMode) == PaymentModeActionStatus.Success)
                {
                    this.ShowMsg("设置成功", true);
                    return;
                }
                this.ShowMsg("设置失败", false);
                return;
            }
            else
            {
                PaymentModeInfo paymentModeInfo = paymentModes[0];
                paymentModeInfo.Settings = HiCryptographer.Encrypt(text);
                if (SalesHelper.UpdatePaymentMode(paymentModeInfo) == PaymentModeActionStatus.Success)
                {
                    this.ShowMsg("设置成功", true);
                    return;
                }
                this.ShowMsg("设置失败", false);
                return;
            }
        }
コード例 #10
0
        protected void btnOK_Click(object sender, System.EventArgs e)
        {
            SiteSettings masterSettings = SettingsManager.GetMasterSettings(false);

            masterSettings.EnableAppWxPay = this.radEnableAppWxPay.SelectedValue;
            SettingsManager.Save(masterSettings);

            string text = string.Format("<xml><AppId>{0}</AppId><Key>{1}</Key><AppSecret>{2}</AppSecret><MchId>{3}</MchId></xml>", this.txtAppId.Text, this.txtKey.Text, this.txtAppSecret.Text, this.txtMchId.Text);

            PaymentModeInfo paymentMode = SalesHelper.GetPaymentMode("Ecdev.plugins.payment.WxpayQrCode.QrCodeRequest");

            if (paymentMode == null)
            {
                paymentMode = new PaymentModeInfo
                {
                    Name            = "微信扫码支付",
                    Gateway         = "Ecdev.plugins.payment.WxpayQrCode.QrCodeRequest",
                    Description     = "微信扫码支付",
                    IsUseInpour     = false,
                    Charge          = 0m,
                    IsPercent       = false,
                    ApplicationType = PayApplicationType.payOnPC,
                    Settings        = HiCryptographer.Encrypt(text)
                };

                SalesHelper.CreatePaymentMode(paymentMode);
            }
            else
            {
                PaymentModeInfo paymentModeInfo = paymentMode;
                paymentModeInfo.Name            = "微信扫码支付";
                paymentModeInfo.Description     = "微信扫码支付";
                paymentModeInfo.Settings        = HiCryptographer.Encrypt(text);
                paymentModeInfo.ApplicationType = PayApplicationType.payOnPC;
                SalesHelper.UpdatePaymentMode(paymentModeInfo);
            }
            this.ShowMsg("修改成功", true);
        }
コード例 #11
0
        protected void btnOK_Click(object sender, EventArgs e)
        {
            string text = $"<xml><Partner>{this.txtPartner.Text}</Partner><Key>{this.txtKey.Text}</Key><Seller_account_name>{this.txtAccount.Text}</Seller_account_name></xml>";
            IList <PaymentModeInfo> paymentModes = SalesHelper.GetPaymentModes(PayApplicationType.payOnVX);

            if (paymentModes == null || paymentModes.Count == 0)
            {
                PaymentModeInfo paymentMode = new PaymentModeInfo
                {
                    Name        = "支付宝手机支付",
                    Gateway     = "hishop.plugins.payment.ws_wappay.wswappayrequest",
                    Description = string.Empty,
                    IsUseInpour = true,
                    Settings    = HiCryptographer.Encrypt(text)
                };
                if (SalesHelper.CreatePaymentMode(paymentMode))
                {
                    this.ShowMsg("设置成功", true);
                }
                else
                {
                    this.ShowMsg("设置失败", false);
                }
            }
            else
            {
                PaymentModeInfo paymentModeInfo = paymentModes[0];
                paymentModeInfo.Settings = HiCryptographer.Encrypt(text);
                if (SalesHelper.UpdatePaymentMode(paymentModeInfo))
                {
                    this.ShowMsg("设置成功", true, "");
                }
                else
                {
                    this.ShowMsg("设置失败", false, "");
                }
            }
        }
コード例 #12
0
        protected void btnCreate_Click(object sender, EventArgs e)
        {
            string     str;
            ConfigData data;
            decimal    num;

            if (ValidateValues(out str, out data, out num))
            {
                PaymentModeInfo paymentMode = new PaymentModeInfo();
                paymentMode.Name        = txtName.Text;
                paymentMode.Description = fcContent.Text.Replace("\r\n", "").Replace("\r", "").Replace("\n", "");
                paymentMode.Gateway     = str;
                paymentMode.IsUseInpour = radiIsUseInpour.SelectedValue;
                paymentMode.Charge      = num;
                paymentMode.IsPercent   = chkIsPercent.Checked;
                paymentMode.Settings    = Cryptographer.Encrypt(data.SettingsXml);
                switch (SalesHelper.CreatePaymentMode(paymentMode))
                {
                case PaymentModeActionStatus.Success:
                    Response.Redirect(Globals.GetAdminAbsolutePath("sales/PaymentTypes.aspx"));
                    return;

                case PaymentModeActionStatus.DuplicateName:
                    ShowMsg("已经存在一个相同的支付方式名称", false);
                    return;

                case PaymentModeActionStatus.OutofNumber:
                    ShowMsg("支付方式的数目已经超出系统设置的数目", false);
                    return;

                case PaymentModeActionStatus.DuplicateGateway:
                    ShowMsg("已经添加了一个相同类型的支付接口", false);
                    return;
                }
                ShowMsg("未知错误", false);
            }
        }
コード例 #13
0
        protected void btnOK_Click(object sender, System.EventArgs e)
        {
            SiteSettings masterSettings = SettingsManager.GetMasterSettings(false);

            masterSettings.EnableAppTFTPay = this.radEnableAppTFTPay.SelectedValue;
            SettingsManager.Save(masterSettings);

            string text = string.Format("<xml><Cert>{0}</Cert><CertKey>{1}</CertKey><PublicKey>{2}</PublicKey><Gateway>{3}</Gateway></xml>", this.txtCert.Text, this.txtKey.Text, this.txtPublicKey.Text, this.txtGateway.Text);

            PaymentModeInfo paymentMode = SalesHelper.GetPaymentMode("Ecdev.plugins.payment.tft_apppay.tftwappayrequest");

            if (paymentMode == null)
            {
                paymentMode = new PaymentModeInfo
                {
                    Name            = "腾付通移动支付",
                    Gateway         = "Ecdev.plugins.payment.tft_apppay.tftwappayrequest",
                    Description     = string.Empty,
                    IsUseInpour     = false,
                    Charge          = 0m,
                    IsPercent       = false,
                    ApplicationType = PayApplicationType.payOnApp,
                    Settings        = HiCryptographer.Encrypt(text)
                };

                SalesHelper.CreatePaymentMode(paymentMode);
            }
            else
            {
                PaymentModeInfo paymentModeInfo = paymentMode;
                paymentModeInfo.Settings        = HiCryptographer.Encrypt(text);
                paymentModeInfo.ApplicationType = PayApplicationType.payOnApp;
                SalesHelper.UpdatePaymentMode(paymentModeInfo);
            }
            this.ShowMsg("修改成功", true);
        }
コード例 #14
0
        protected void btnOK_Click(object sender, EventArgs e)
        {
            SiteSettings    masterSettings = SettingsManager.GetMasterSettings();
            string          text           = string.Format("<xml><Partner>{0}</Partner><Key>{1}</Key><PublicKey>{2}</PublicKey><Seller_account_name>{3}</Seller_account_name></xml>", this.txtPartner.Text.Trim(), this.txtKey.Text.Trim(), this.txtPublicKey.Text.Trim(), "");
            PaymentModeInfo paymentMode    = SalesHelper.GetPaymentMode("hishop.plugins.payment.ws_wappay.wswappayrequest");

            if (this.radEnableWapAliPay.SelectedValue && (string.IsNullOrEmpty(this.txtPartner.Text.Trim()) || string.IsNullOrEmpty(this.txtKey.Text.Trim()) || string.IsNullOrEmpty(this.txtPublicKey.Text.Trim())))
            {
                this.ShowMsg("支付宝H5网页支付是开启状态,请填写正确的配置信息", false);
            }
            else
            {
                if (paymentMode == null)
                {
                    PaymentModeInfo paymentMode2 = new PaymentModeInfo
                    {
                        Name        = "支付宝H5网页支付",
                        Gateway     = "hishop.plugins.payment.ws_wappay.wswappayrequest",
                        Description = string.Empty,
                        IsUseInpour = false,
                        Settings    = HiCryptographer.Encrypt(text),
                        ModeType    = ((!masterSettings.EnableAppWapAliPay) ? PayModeType.NoUsed : PayModeType.Pay)
                    };
                    SalesHelper.CreatePaymentMode(paymentMode2);
                }
                else
                {
                    PaymentModeInfo paymentModeInfo = paymentMode;
                    paymentModeInfo.Settings        = HiCryptographer.Encrypt(text);
                    paymentModeInfo.ApplicationType = PayApplicationType.payOnWAP;
                    paymentModeInfo.ModeType        = ((!masterSettings.EnableWapAliPay && !masterSettings.EnableAppWapAliPay) ? PayModeType.NoUsed : PayModeType.Pay);
                    string empty = string.Empty;
                    SalesHelper.UpdatePaymentModeSync(paymentModeInfo, out empty);
                }
                string text2 = $"<xml><Partner>{this.txtAppPartner.Text.Trim()}</Partner><Key>{this.txtAppKey.Text.Trim()}</Key><Seller_account_name>{this.txtAppAccount.Text.Trim()}</Seller_account_name></xml>";
                if (this.radEnableAppAliPay.SelectedValue && (string.IsNullOrEmpty(this.txtAppPartner.Text.Trim()) || string.IsNullOrEmpty(this.txtAppKey.Text.Trim()) || string.IsNullOrEmpty(this.txtAppAccount.Text.Trim())))
                {
                    this.ShowMsg("支付宝app支付是开启状态,请填写正确的配置信息", false);
                }
                else
                {
                    PaymentModeInfo paymentMode3 = SalesHelper.GetPaymentMode("hishop.plugins.payment.ws_apppay.wswappayrequest");
                    if (paymentMode3 == null)
                    {
                        PaymentModeInfo paymentMode4 = new PaymentModeInfo
                        {
                            Name            = "支付宝app支付",
                            Gateway         = "hishop.plugins.payment.ws_apppay.wswappayrequest",
                            Description     = string.Empty,
                            IsUseInpour     = false,
                            ApplicationType = PayApplicationType.payOnApp,
                            Settings        = HiCryptographer.Encrypt(text2),
                            ModeType        = ((!masterSettings.EnableAppAliPay) ? PayModeType.NoUsed : PayModeType.Pay)
                        };
                        SalesHelper.CreatePaymentMode(paymentMode4);
                    }
                    else
                    {
                        PaymentModeInfo paymentModeInfo2 = paymentMode3;
                        paymentModeInfo2.Settings        = HiCryptographer.Encrypt(text2);
                        paymentModeInfo2.ApplicationType = PayApplicationType.payOnApp;
                        paymentModeInfo2.ModeType        = ((!masterSettings.EnableAppAliPay) ? PayModeType.NoUsed : PayModeType.Pay);
                        SalesHelper.UpdatePaymentMode(paymentModeInfo2);
                    }
                    masterSettings.EnableAppAliPay    = this.radEnableAppAliPay.SelectedValue;
                    masterSettings.EnableAppWapAliPay = this.radEnableWapAliPay.SelectedValue;
                    SettingsManager.Save(masterSettings);
                    this.ShowMsg("修改成功", true, "");
                }
            }
        }
コード例 #15
0
ファイル: AppAliPaySet.cs プロジェクト: damoOnly/e-commerce
        protected void btnOK_Click(object sender, System.EventArgs e)
        {
            SiteSettings masterSettings = SettingsManager.GetMasterSettings(false);

            masterSettings.EnableAppAliPay    = this.radEnableAppAliPay.SelectedValue;
            masterSettings.EnableAppWapAliPay = this.radEnableWapAliPay.SelectedValue;
            SettingsManager.Save(masterSettings);

            string          wapSettings    = string.Format("<xml><Partner>{0}</Partner><Key>{1}</Key><Seller_account_name>{2}</Seller_account_name></xml>", this.txtPartner.Text, this.txtKey.Text, this.txtAccount.Text);
            PaymentModeInfo paymentModeWap = SalesHelper.GetPaymentMode("Ecdev.plugins.payment.ws_wappay.wswappayrequest");

            if (paymentModeWap == null)
            {
                paymentModeWap = new PaymentModeInfo
                {
                    Name            = "支付宝手机网页支付",
                    Gateway         = "Ecdev.plugins.payment.ws_wappay.wswappayrequest",
                    Description     = string.Empty,
                    IsUseInpour     = false,
                    Charge          = 0m,
                    IsPercent       = false,
                    ApplicationType = PayApplicationType.payOnWAP,
                    Settings        = HiCryptographer.Encrypt(wapSettings)
                };
                SalesHelper.CreatePaymentMode(paymentModeWap);
            }
            else
            {
                PaymentModeInfo paymentModeInfo = paymentModeWap;
                paymentModeInfo.Settings        = HiCryptographer.Encrypt(wapSettings);
                paymentModeInfo.ApplicationType = PayApplicationType.payOnWAP;
                SalesHelper.UpdatePaymentMode(paymentModeInfo);
            }

            string appSettings = string.Format("<xml><Partner>{0}</Partner><Key>{1}</Key><Seller_account_name>{2}</Seller_account_name></xml>", this.txtAppPartner.Text, this.txtAppKey.Text, this.txtAppAccount.Text);

            System.Collections.Generic.IList <PaymentModeInfo> paymentModes = SalesHelper.GetPaymentModes(PayApplicationType.payOnApp);
            if (paymentModes == null || paymentModes.Count == 0)
            {
                PaymentModeInfo paymentMode3 = new PaymentModeInfo
                {
                    Name            = "支付宝手机应用内支付",
                    Gateway         = "Ecdev.plugins.payment.ws_apppay.wswappayrequest",
                    Description     = string.Empty,
                    IsUseInpour     = false,
                    Charge          = 0m,
                    IsPercent       = false,
                    ApplicationType = PayApplicationType.payOnApp,
                    Settings        = HiCryptographer.Encrypt(appSettings)
                };
                SalesHelper.CreatePaymentMode(paymentMode3);
            }
            else
            {
                PaymentModeInfo paymentModeApp = paymentModes[0];
                paymentModeApp.Settings        = HiCryptographer.Encrypt(appSettings);
                paymentModeApp.ApplicationType = PayApplicationType.payOnApp;
                SalesHelper.UpdatePaymentMode(paymentModeApp);
            }
            this.ShowMsg("修改成功", true);
        }
コード例 #16
0
        private void btnCreate_Click(object sender, EventArgs e)
        {
            string     text       = default(string);
            ConfigData configData = default(ConfigData);

            if (this.ValidateValues(out text, out configData))
            {
                PaymentModeInfo paymentMode = new PaymentModeInfo
                {
                    Name            = Globals.StripAllTags(this.txtName.Text),
                    Description     = this.fcContent.Text.Replace("\r\n", "").Replace("\r", "").Replace("\n", ""),
                    Gateway         = text,
                    IsUseInpour     = this.radiIsUseInpour.SelectedValue,
                    ApplicationType = PayApplicationType.payOnPC,
                    Settings        = HiCryptographer.Encrypt(configData.SettingsXml),
                    DisplaySequence = 0
                };
                if (SalesHelper.CreatePaymentMode(paymentMode))
                {
                    if (text == "hishop.plugins.payment.wxqrcode.wxqrcoderequest")
                    {
                        PaymentModeInfo paymentMode2 = SalesHelper.GetPaymentMode(text);
                        if (paymentMode2 != null)
                        {
                            ConfigData   configData2    = new ConfigData(HiCryptographer.Decrypt(paymentMode2.Settings));
                            string       settingsXml    = configData2.SettingsXml;
                            string       xmlNodeValue   = Globals.GetXmlNodeValue(settingsXml, "AppId");
                            string       xmlNodeValue2  = Globals.GetXmlNodeValue(settingsXml, "MCHID");
                            string       xmlNodeValue3  = Globals.GetXmlNodeValue(settingsXml, "AppSecret");
                            string       xmlNodeValue4  = Globals.GetXmlNodeValue(settingsXml, "Sub_AppId");
                            string       xmlNodeValue5  = Globals.GetXmlNodeValue(settingsXml, "Sub_mch_Id");
                            string       xmlNodeValue6  = Globals.GetXmlNodeValue(settingsXml, "CertPath");
                            string       xmlNodeValue7  = Globals.GetXmlNodeValue(settingsXml, "MCHID");
                            SiteSettings masterSettings = SettingsManager.GetMasterSettings();
                            if (string.IsNullOrEmpty(xmlNodeValue4) && string.IsNullOrEmpty(xmlNodeValue5))
                            {
                                masterSettings.WeixinAppId     = xmlNodeValue;
                                masterSettings.WeixinPartnerID = xmlNodeValue2;
                                masterSettings.Main_AppId      = "";
                                masterSettings.Main_Mch_ID     = "";
                            }
                            else
                            {
                                masterSettings.WeixinAppId     = xmlNodeValue4;
                                masterSettings.WeixinPartnerID = xmlNodeValue5;
                                masterSettings.Main_Mch_ID     = xmlNodeValue2;
                                masterSettings.Main_AppId      = xmlNodeValue;
                            }
                            masterSettings.WeixinPartnerKey   = xmlNodeValue3;
                            masterSettings.WeixinCertPath     = xmlNodeValue6;
                            masterSettings.WeixinCertPassword = xmlNodeValue7;
                            SettingsManager.Save(masterSettings);
                        }
                    }
                    base.Response.Redirect(Globals.GetAdminAbsolutePath("sales/PaymentTypes.aspx"));
                }
                else
                {
                    this.ShowMsg("未知错误", false);
                }
            }
        }
コード例 #17
0
        private void saveData()
        {
            Chenduo.BLL.sf_website   bll     = new Chenduo.BLL.sf_website();
            Chenduo.Model.sf_website website = bll.GetModelByWid(wid);

            if (string.IsNullOrEmpty(this.txt_mid.Text))
            {
                this.ShowMsg("请输入支付宝帐号!", false);
            }
            this.siteSettings.Alipay_mid = this.txt_mid.Text;
            website.Alipay_mid           = this.txt_mid.Text;

            if (string.IsNullOrEmpty(this.txt_mName.Text))
            {
                this.ShowMsg("请输入支付宝帐号姓名!", false);
            }
            this.siteSettings.Alipay_mName = this.txt_mName.Text;
            website.Alipay_mName           = this.txt_mName.Text;

            if (string.IsNullOrEmpty(this.txt_pid.Text))
            {
                this.ShowMsg("请输入合作者身份(PID)!", false);
            }
            this.siteSettings.Alipay_Pid = this.txt_pid.Text;
            website.Alipay_Pid           = this.txt_pid.Text;

            if (string.IsNullOrEmpty(this.txt_key.Text))
            {
                this.ShowMsg("请输入安全校验码(Key)!", false);
            }
            string text = string.Format("<xml><Partner>{0}</Partner><Key>{1}</Key><Seller_account_name>{2}</Seller_account_name></xml>", this.txt_pid.Text, this.txt_key.Text, this.txt_mid.Text);

            if (!string.IsNullOrWhiteSpace(this.txt_pid.Text) && !string.IsNullOrWhiteSpace(this.txt_key.Text))
            {
                string.IsNullOrWhiteSpace(this.txt_mid.Text);
            }
            PaymentModeInfo paymentMode = SalesHelper.GetPaymentMode("hishop.plugins.payment.ws_wappay.wswappayrequest", this.wid);

            if (paymentMode == null)
            {
                PaymentModeInfo info2 = new PaymentModeInfo {
                    Name        = "支付宝手机支付",
                    Gateway     = "hishop.plugins.payment.ws_wappay.wswappayrequest",
                    Description = string.Empty,
                    IsUseInpour = true,
                    Charge      = 0M,
                    IsPercent   = false,
                    Settings    = HiCryptographer.Encrypt(text),
                    wid         = this.wid
                };
                if (SalesHelper.CreatePaymentMode(info2) == PaymentModeActionStatus.Success)
                {
                    this.siteSettings.Alipay_Key = this.txt_key.Text;
                    website.Alipay_Key           = this.txt_key.Text;
                    bll.Update(website);
                    //SettingsManager.Save(this.siteSettings);
                    this.ShowMsg("设置成功", true);
                }
                else
                {
                    this.ShowMsg("设置失败", false);
                }
            }
            else
            {
                paymentMode.Settings = HiCryptographer.Encrypt(text);
                if (SalesHelper.UpdatePaymentMode(paymentMode) == PaymentModeActionStatus.Success)
                {
                    this.siteSettings.Alipay_Key = this.txt_key.Text;
                    website.Alipay_Key           = this.txt_key.Text;
                    bll.Update(website);
                    //SettingsManager.Save(this.siteSettings);
                    this.ShowMsg("设置成功", true);
                }
                else
                {
                    this.ShowMsg("设置失败", false);
                }
            }
        }
コード例 #18
0
        protected void btnOK_Click(object sender, EventArgs e)
        {
            SiteSettings masterSettings = SettingsManager.GetMasterSettings();

            if (masterSettings.IsDemoSite)
            {
                this.ShowMsg("演示站不允许修改支付配置信息", false);
            }
            else
            {
                if (this.radEnableWxPay.SelectedValue || this.radEnableWxH5Pay.SelectedValue)
                {
                    if (string.IsNullOrEmpty(this.txtAppId.Text))
                    {
                        this.ShowMsg("微信支付AppId不能为空!", false);
                        return;
                    }
                    if (string.IsNullOrEmpty(this.txtAppSecret.Text))
                    {
                        this.ShowMsg("微信支付AppSecret不能为空!", false);
                        return;
                    }
                    if (string.IsNullOrEmpty(this.txtPartnerID.Text))
                    {
                        this.ShowMsg("微信支付mch_id不能为空!", false);
                        return;
                    }
                    if (string.IsNullOrEmpty(this.txtPartnerKey.Text))
                    {
                        this.ShowMsg("微信支付Key不能为空!", false);
                        return;
                    }
                }
                string weixinCertPath = this.txtCerFileName.Text;
                if (this.file_UploadCert.HasFile)
                {
                    if (!Globals.ValidateCertFile(this.file_UploadCert.PostedFile.FileName))
                    {
                        this.ShowMsg("非法的证书文件", false);
                        return;
                    }
                    string newFileName = this.GetNewFileName(this.file_UploadCert.PostedFile.FileName);
                    this.file_UploadCert.PostedFile.SaveAs(base.Server.MapPath("~/pay/cert/") + newFileName);
                    weixinCertPath = "/pay/cert/" + newFileName;
                }
                string weixinAppId = this.setting.WeixinAppId;
                this.setting.WeixinAppId     = this.txtAppId.Text;
                this.setting.WeixinAppSecret = this.txtAppSecret.Text;
                this.setting.WeixinPartnerID = this.txtPartnerID.Text;
                if (this.txtPartnerKey.Text.Replace("*", "").Length != 6)
                {
                    this.setting.WeixinPartnerKey = this.txtPartnerKey.Text;
                }
                this.setting.WeixinPaySignKey    = this.txtPaySignKey.Text;
                this.setting.EnableWeiXinRequest = this.radEnableWxPay.SelectedValue;
                this.setting.EnableWapWeiXinPay  = this.radEnableWxH5Pay.SelectedValue;
                this.setting.OpenAppWxPay        = this.radEnableAppWxPay.SelectedValue;
                this.setting.WeixinCertPath      = weixinCertPath;
                if (this.OnOffServiceMode.SelectedValue)
                {
                    string text  = Globals.StripAllTags(this.txtMainAppID.Text);
                    string text2 = Globals.StripAllTags(this.txtMainMchID.Text);
                    if (string.IsNullOrEmpty(text) || string.IsNullOrEmpty(text2))
                    {
                        this.ShowMsg("开启了服务商模式,请输入服务商商户ID和服务商AppID", false);
                        return;
                    }
                    this.setting.Main_AppId  = text;
                    this.setting.Main_Mch_ID = text2;
                }
                else
                {
                    this.setting.Main_AppId  = "";
                    this.setting.Main_Mch_ID = "";
                }
                if (string.IsNullOrEmpty(this.setting.Main_Mch_ID))
                {
                    this.setting.WeixinCertPassword = this.txtPartnerID.Text;
                }
                else
                {
                    this.setting.WeixinCertPassword = this.setting.Main_Mch_ID;
                }
                if (weixinAppId != this.setting.WeixinAppId)
                {
                    WXFansHelper.ClearFansData();
                    this.setting.IsInitWXFansInteractData = false;
                    this.setting.IsInitWXFansData         = false;
                }
                if (this.radEnableWxQrcodePay.SelectedValue)
                {
                    string text3 = "";
                    text3 = ((string.IsNullOrEmpty(this.setting.Main_AppId) || string.IsNullOrEmpty(this.setting.Main_Mch_ID)) ? $"<xml><AppId>{this.setting.WeixinAppId}</AppId><MCHID>{this.setting.WeixinPartnerID}</MCHID><AppSecret>{this.setting.WeixinPartnerKey}</AppSecret><CertPath>{this.setting.WeixinCertPath}</CertPath></xml>" : $"<xml><AppId>{this.setting.Main_AppId}</AppId><MCHID>{this.setting.Main_Mch_ID}</MCHID><AppSecret>{this.setting.WeixinPartnerKey}</AppSecret><Sub_AppId>{this.setting.WeixinAppId}</Sub_AppId><Sub_mch_Id>{this.setting.WeixinPartnerID}</Sub_mch_Id><CertPath>{this.setting.WeixinCertPath}</CertPath></xml>");
                    if (this.wxQrCodePay == null)
                    {
                        PaymentModeInfo paymentMode = new PaymentModeInfo
                        {
                            Name            = "微信扫码支付",
                            Gateway         = "hishop.plugins.payment.wxqrcode.wxqrcoderequest",
                            Description     = string.Empty,
                            IsUseInpour     = this.OnOffPcInpour.SelectedValue,
                            ApplicationType = PayApplicationType.payOnPC,
                            Settings        = HiCryptographer.Encrypt(text3)
                        };
                        SalesHelper.CreatePaymentMode(paymentMode);
                    }
                    else
                    {
                        PaymentModeInfo paymentModeInfo = this.wxQrCodePay;
                        paymentModeInfo.Settings        = HiCryptographer.Encrypt(text3);
                        paymentModeInfo.ApplicationType = PayApplicationType.payOnPC;
                        paymentModeInfo.IsUseInpour     = this.OnOffPcInpour.SelectedValue;
                        SalesHelper.UpdatePaymentMode(paymentModeInfo);
                    }
                }
                else if (this.wxQrCodePay != null)
                {
                    SalesHelper.DeletePaymentMode(this.wxQrCodePay.ModeId);
                }
                SettingsManager.Save(this.setting);
                this.ShowMsg("保存支付设置成功", true, "");
            }
        }
コード例 #19
0
ファイル: CashSetting.cs プロジェクト: spiltservice/cloudshop
        protected void btnSave_Click(object sender, EventArgs e)
        {
            SiteSettings masterSettings = SettingsManager.GetMasterSettings();
            decimal      num            = default(decimal);

            if (string.IsNullOrEmpty(this.txtMinimumSingleShot.Text.Trim()))
            {
                this.ShowMsg("单次提现最小限额不可为空", false);
                return;
            }
            if (!decimal.TryParse(this.txtMinimumSingleShot.Text.Trim(), out num))
            {
                this.ShowMsg("单次提现最小限额,请填写正整数!", false);
                return;
            }
            if (num < decimal.One)
            {
                this.ShowMsg("单次提现最小限额,必须大于等于1!", false);
                return;
            }
            masterSettings.MinimumSingleShot       = num;
            masterSettings.EnableBulkPaymentAliPay = this.ooEnableBulkPaymentAliPay.SelectedValue;
            masterSettings.EnableBulkPaymentWeixin = this.ooEnableBulkPaymentWeixin.SelectedValue;
            SettingsManager.Save(masterSettings);
            string          text            = "";
            string          text2           = "";
            PaymentModeInfo paymentModeInfo = new PaymentModeInfo();
            string          text3;
            string          text4;
            string          text5;
            string          selectedValue;
            string          obj;
            string          empty;

            if (masterSettings.EnableBulkPaymentWeixin)
            {
                text3 = this.txtWeixinMchAppid.Text;
                text4 = this.txtWeixinMchid.Text;
                text5 = this.txtWeixinKey.Text;
                string text6 = (this.ViewState["WeixinKeyCover"] == null) ? "" : ((string)this.ViewState["WeixinKeyCover"]);
                string text7 = (this.ViewState["WeixinKey"] == null) ? "" : ((string)this.ViewState["WeixinKey"]);
                if (!string.IsNullOrEmpty(text6))
                {
                    if (text5.Equals(text6))
                    {
                        text5 = text7;
                    }
                    else if (text5.Contains("*"))
                    {
                        this.ShowMsg("请清除原有的Key再输入正确的Key(您在商户中心自己设置的32位字符串)!", false);
                        this.txtWeixinKey.Text = text6;
                        return;
                    }
                }
                else if (string.IsNullOrEmpty(text5))
                {
                    this.ShowMsg("请输入Key(您在商户中心自己设置的32位字符串)!", false);
                    return;
                }
                selectedValue = this.ddlWeixinCheckName.SelectedValue;
                empty         = string.Empty;
                obj           = text4;
                if (this.fileWeixinCertPath.HasFile)
                {
                    if (Globals.ValidateCertFile(this.fileWeixinCertPath.PostedFile.FileName))
                    {
                        empty = "/config/" + this.fileWeixinCertPath.PostedFile.FileName;
                        this.fileWeixinCertPath.PostedFile.SaveAs(base.Server.MapPath("~/config/") + this.fileWeixinCertPath.PostedFile.FileName);
                        goto IL_02b6;
                    }
                    this.ShowMsg("非法的证书文件!", false);
                    return;
                }
                empty = this.hidWeixinCertPath.Value;
                goto IL_02b6;
            }
            goto IL_03f2;
IL_02b6:
            if (string.IsNullOrEmpty(empty))
            {
                this.ShowMsg("请上传证书!", false);
                return;
            }
            text            = $"<xml><mch_appid>{text3.ToNullString()}</mch_appid><mchid>{text4.ToNullString()}</mchid><check_name>{selectedValue.ToNullString()}</check_name><certPath>{empty.ToNullString()}</certPath><certPassword>{obj.ToNullString()}</certPassword><Key>{text5.ToNullString()}</Key></xml>";
            text2           = "Hishop.Plugins.Outpay.Weixin.WeixinRequest";
            paymentModeInfo = SalesHelper.GetPaymentMode(text2);
            if (paymentModeInfo == null)
            {
                paymentModeInfo                 = new PaymentModeInfo();
                paymentModeInfo.Gateway         = text2;
                paymentModeInfo.Description     = "微信批量放款";
                paymentModeInfo.ApplicationType = PayApplicationType.payOnAll;
                paymentModeInfo.Name            = "微信批量放款";
                paymentModeInfo.ModeType        = PayModeType.Outpay;
                paymentModeInfo.Settings        = HiCryptographer.Encrypt(text);
                paymentModeInfo.IsUseInpour     = false;
                SalesHelper.CreatePaymentMode(paymentModeInfo);
            }
            else
            {
                paymentModeInfo.Gateway         = text2;
                paymentModeInfo.Description     = "微信批量放款";
                paymentModeInfo.ApplicationType = PayApplicationType.payOnAll;
                paymentModeInfo.Name            = "微信批量放款";
                paymentModeInfo.ModeType        = PayModeType.Outpay;
                paymentModeInfo.Settings        = HiCryptographer.Encrypt(text);
                paymentModeInfo.IsUseInpour     = false;
                SalesHelper.UpdatePaymentMode(paymentModeInfo);
            }
            goto IL_03f2;
IL_03f2:
            if (masterSettings.EnableBulkPaymentAliPay)
            {
                string text8  = this.txtAlipayAccountName.Text;
                string text9  = this.txtAlipayEmail.Text;
                string text10 = this.txtAlipayKey.Text;
                string text11 = this.txtAlipayPartner.Text;
                text            = $"<xml><partner>{text11.ToNullString()}</partner><key>{text10.ToNullString()}</key><email>{text9.ToNullString()}</email><account_name>{text8.ToNullString()}</account_name></xml>";
                text2           = "Hishop.Plugins.Outpay.Alipay.AlipayRequest";
                paymentModeInfo = SalesHelper.GetPaymentMode(text2);
                if (paymentModeInfo == null)
                {
                    paymentModeInfo                 = new PaymentModeInfo();
                    paymentModeInfo.Gateway         = text2;
                    paymentModeInfo.Description     = "支付宝批量放款";
                    paymentModeInfo.ApplicationType = PayApplicationType.payOnAll;
                    paymentModeInfo.Name            = "支付宝批量放款";
                    paymentModeInfo.ModeType        = PayModeType.Outpay;
                    paymentModeInfo.Settings        = HiCryptographer.Encrypt(text);
                    paymentModeInfo.IsUseInpour     = false;
                    SalesHelper.CreatePaymentMode(paymentModeInfo);
                }
                else
                {
                    paymentModeInfo.Gateway         = text2;
                    paymentModeInfo.Description     = "支付宝批量放款";
                    paymentModeInfo.ApplicationType = PayApplicationType.payOnAll;
                    paymentModeInfo.Name            = "支付宝批量放款";
                    paymentModeInfo.ModeType        = PayModeType.Outpay;
                    paymentModeInfo.Settings        = HiCryptographer.Encrypt(text);
                    paymentModeInfo.IsUseInpour     = false;
                    SalesHelper.UpdatePaymentMode(paymentModeInfo);
                }
            }
            this.ShowMsg("修改成功!", true);
            this.BeLoad();
        }
コード例 #20
0
        protected void btnOK_Click(object sender, EventArgs e)
        {
            string          text        = string.Format("<xml><Partner>{0}</Partner><Key>{1}</Key><PublicKey>{3}</PublicKey><Seller_account_name>{2}</Seller_account_name></xml>", this.txtPartner.Text.Trim(), this.txtKey.Text.Trim(), this.txtAccount.Text.Trim(), this.txtPublicKey.Text.Trim());
            PaymentModeInfo paymentMode = SalesHelper.GetPaymentMode("hishop.plugins.payment.ws_wappay.wswappayrequest");

            if (this.radEnableAppAliPay.SelectedValue)
            {
                if (string.IsNullOrEmpty(this.txtPartner.Text.Trim()) || string.IsNullOrEmpty(this.txtKey.Text.Trim()) || string.IsNullOrEmpty(this.txtPublicKey.Text.Trim()))
                {
                    this.ShowMsg("支付宝H5网页支付为开启状态,请填写正确的配置信息", false);
                    return;
                }
                if (paymentMode == null)
                {
                    PaymentModeInfo paymentMode2 = new PaymentModeInfo
                    {
                        Name            = "支付宝H5网页支付",
                        Gateway         = "hishop.plugins.payment.ws_wappay.wswappayrequest",
                        Description     = string.Empty,
                        IsUseInpour     = false,
                        ApplicationType = PayApplicationType.payOnWAP,
                        Settings        = HiCryptographer.Encrypt(text),
                        ModeType        = ((!this.setting.EnableWapAliPay) ? PayModeType.NoUsed : PayModeType.Pay)
                    };
                    SalesHelper.CreatePaymentMode(paymentMode2);
                    this.setting.EnableWapAliPay       = this.radEnableAppAliPay.SelectedValue;
                    this.setting.EnableWeixinWapAliPay = this.radEnableAppAliPay.SelectedValue;
                    this.setting.EnableAppWapAliPay    = this.radEnableAppAliPay.SelectedValue;
                }
                else
                {
                    PaymentModeInfo paymentModeInfo = paymentMode;
                    paymentModeInfo.Settings           = HiCryptographer.Encrypt(text);
                    paymentModeInfo.ApplicationType    = PayApplicationType.payOnWAP;
                    paymentModeInfo.ModeType           = ((!this.setting.EnableWapAliPay && !this.setting.EnableAppWapAliPay && !this.setting.EnableWeixinWapAliPay) ? PayModeType.NoUsed : PayModeType.Pay);
                    this.setting.EnableWapAliPay       = this.radEnableAppAliPay.SelectedValue;
                    this.setting.EnableWeixinWapAliPay = this.radEnableAppAliPay.SelectedValue;
                    SalesHelper.UpdatePaymentMode(paymentModeInfo);
                }
                string gateway = "hishop.plugins.payment.alipaywx.alipaywxrequest";
                string text2   = "<xml><Key>{Key}</Key><SellerEmail>{SellerEmail}</SellerEmail><Partner>{Partner}</Partner><PublicKey>{PublicKey}</PublicKey></xml>";
                string text3   = text2;
                text3 = text3.Replace("{Key}", this.txtKey.Text.Trim());
                text3 = text3.Replace("{SellerEmail}", this.txtAccount.Text.Trim());
                text3 = text3.Replace("{Partner}", this.txtPartner.Text.Trim());
                text3 = text3.Replace("{PublicKey}", this.txtPublicKey.Text.Trim());
                PaymentModeInfo paymentMode3 = SalesHelper.GetPaymentMode(gateway);
                if (paymentMode3 == null)
                {
                    PaymentModeInfo paymentMode4 = new PaymentModeInfo
                    {
                        Name            = "支付宝微信端支付",
                        Gateway         = gateway,
                        Description     = string.Empty,
                        IsUseInpour     = false,
                        ApplicationType = PayApplicationType.payOnVX,
                        Settings        = HiCryptographer.Encrypt(text3)
                    };
                    SalesHelper.CreatePaymentMode(paymentMode4);
                    this.setting.EnableWeixinWapAliPay = this.radEnableAppAliPay.SelectedValue;
                }
                else
                {
                    PaymentModeInfo paymentModeInfo2 = paymentMode3;
                    paymentModeInfo2.Settings        = HiCryptographer.Encrypt(text3);
                    paymentModeInfo2.ApplicationType = PayApplicationType.payOnVX;
                    SalesHelper.UpdatePaymentMode(paymentModeInfo2);
                    this.setting.EnableWeixinWapAliPay = this.radEnableAppAliPay.SelectedValue;
                    string empty = string.Empty;
                }
            }
            else
            {
                this.setting.EnableWeixinWapAliPay = this.radEnableAppAliPay.SelectedValue;
                this.setting.EnableWapAliPay       = this.radEnableAppAliPay.SelectedValue;
                this.setting.EnableAppWapAliPay    = this.radEnableAppAliPay.SelectedValue;
            }
            if (this.OnoffYLQQD.SelectedValue)
            {
                if (string.IsNullOrEmpty(this.txtYLQQDPartner.Text))
                {
                    this.ShowMsg("银联全渠道支付商户号不能为空", false);
                    return;
                }
                if (string.IsNullOrEmpty(this.txtYLQQDKey.Text))
                {
                    this.ShowMsg("银联全渠道支付商户密钥不能为空", false);
                    return;
                }
                this.setting.EnableBankUnionPay = this.OnoffYLQQD.SelectedValue;
                string arg = this.txtYLQQDCerFileName.Text;
                if (this.fileBankUnionCert.HasFile)
                {
                    if (!Globals.ValidateCertFile(this.fileBankUnionCert.PostedFile.FileName))
                    {
                        this.ShowMsg("银联全渠道支付非法的证书文件", false);
                        return;
                    }
                    this.fileBankUnionCert.PostedFile.SaveAs(base.Server.MapPath("~/config/") + this.fileBankUnionCert.PostedFile.FileName);
                    arg = this.fileBankUnionCert.PostedFile.FileName;
                }
                string          text4        = $"<xml><Vmid>{this.txtYLQQDPartner.Text.Trim()}</Vmid><SignCertFileName>{arg}</SignCertFileName><Key>{this.txtYLQQDKey.Text.Trim()}</Key></xml>";
                PaymentModeInfo paymentMode5 = SalesHelper.GetPaymentMode("hishop.plugins.payment.bankuniongateway.bankuniongetwayrequest");
                if (paymentMode5 == null)
                {
                    PaymentModeInfo paymentMode6 = new PaymentModeInfo
                    {
                        Name            = "银联全渠道支付",
                        Gateway         = "hishop.plugins.payment.bankuniongateway.bankuniongetwayrequest",
                        Description     = string.Empty,
                        IsUseInpour     = false,
                        ApplicationType = PayApplicationType.payOnPC,
                        Settings        = HiCryptographer.Encrypt(text4)
                    };
                    SalesHelper.CreatePaymentMode(paymentMode6);
                }
                else
                {
                    PaymentModeInfo paymentModeInfo3 = paymentMode5;
                    paymentModeInfo3.Settings        = HiCryptographer.Encrypt(text4);
                    paymentModeInfo3.ApplicationType = PayApplicationType.payOnPC;
                    SalesHelper.UpdatePaymentMode(paymentModeInfo3);
                }
            }
            else
            {
                this.setting.EnableBankUnionPay = this.OnoffYLQQD.SelectedValue;
            }
            if (this.OnoffSFT.SelectedValue)
            {
                if (string.IsNullOrEmpty(this.txtSPPartner.Text))
                {
                    this.ShowMsg("盛付通支付商户号不能为空", false);
                    return;
                }
                if (string.IsNullOrEmpty(this.txtSPKey.Text))
                {
                    this.ShowMsg("盛付通支付商户密钥不能为空", false);
                    return;
                }
                this.setting.EnableWapShengPay = this.OnoffSFT.SelectedValue;
                string          text5        = $"<xml><SenderId>{this.txtSPPartner.Text}</SenderId><SellerKey>{this.txtSPKey.Text}</SellerKey><Seller_account_name></Seller_account_name></xml>";
                PaymentModeInfo paymentMode7 = SalesHelper.GetPaymentMode("Hishop.Plugins.Payment.ShengPayMobile.ShengPayMobileRequest");
                if (paymentMode7 == null)
                {
                    PaymentModeInfo paymentMode8 = new PaymentModeInfo
                    {
                        Name            = "盛付通手机网页支付",
                        Gateway         = "Hishop.Plugins.Payment.ShengPayMobile.ShengPayMobileRequest",
                        Description     = string.Empty,
                        IsUseInpour     = false,
                        ApplicationType = PayApplicationType.payOnWAP,
                        Settings        = HiCryptographer.Encrypt(text5)
                    };
                    SalesHelper.CreatePaymentMode(paymentMode8);
                }
                else
                {
                    PaymentModeInfo paymentModeInfo4 = paymentMode7;
                    paymentModeInfo4.Settings        = HiCryptographer.Encrypt(text5);
                    paymentModeInfo4.ApplicationType = PayApplicationType.payOnWAP;
                    SalesHelper.UpdatePaymentMode(paymentModeInfo4);
                }
            }
            else
            {
                this.setting.EnableWapShengPay = false;
            }
            if (this.OnoffKJZFB.SelectedValue)
            {
                if (string.IsNullOrEmpty(this.txtKJZFBKey.Text))
                {
                    this.ShowMsg("跨境支付宝支付安全校验码不能为空!", false);
                    return;
                }
                if (string.IsNullOrEmpty(this.txtSellerEmail.Text))
                {
                    this.ShowMsg("跨境支付宝支付收款支付宝账号不能为空!", false);
                    return;
                }
                if (string.IsNullOrEmpty(this.txtKJZFBPartner.Text))
                {
                    this.ShowMsg("跨境支付宝支付合作者身份不能为空!", false);
                    return;
                }
                if (string.IsNullOrEmpty(this.txtCurrency.Text))
                {
                    this.ShowMsg("跨境支付宝支付币种不能为空!", false);
                    return;
                }
                string text6 = "<xml><Key>{Key}</Key><SellerEmail>{SellerEmail}</SellerEmail><Partner>{Partner}</Partner><RMB>{RMB}</RMB><Currency>{Currency}</Currency></xml>";
                text6 = text6.Replace("{Key}", this.txtKJZFBKey.Text.Trim());
                text6 = text6.Replace("{SellerEmail}", this.txtSellerEmail.Text.Trim());
                text6 = text6.Replace("{Partner}", this.txtKJZFBPartner.Text.Trim());
                text6 = text6.Replace("{RMB}", this.ooRMB.SelectedValue ? "1" : "0");
                text6 = text6.Replace("{Currency}", this.txtCurrency.Text.Trim());
                PaymentModeInfo paymentMode9 = SalesHelper.GetPaymentMode("hishop.plugins.payment.alipaycrossbordermobilepayment.alipaycrossbordermobilepaymentrequest");
                if (paymentMode9 == null)
                {
                    PaymentModeInfo paymentMode10 = new PaymentModeInfo
                    {
                        Name            = "跨境支付宝支付",
                        Gateway         = "hishop.plugins.payment.alipaycrossbordermobilepayment.alipaycrossbordermobilepaymentrequest",
                        Description     = string.Empty,
                        IsUseInpour     = false,
                        ApplicationType = PayApplicationType.payOnVX,
                        Settings        = HiCryptographer.Encrypt(text6)
                    };
                    SalesHelper.CreatePaymentMode(paymentMode10);
                }
                else
                {
                    PaymentModeInfo paymentModeInfo5 = paymentMode9;
                    paymentModeInfo5.Settings        = HiCryptographer.Encrypt(text6);
                    paymentModeInfo5.ApplicationType = PayApplicationType.payOnVX;
                    SalesHelper.UpdatePaymentMode(paymentModeInfo5);
                }
                this.setting.EnableWapAliPayCrossBorder = this.OnoffKJZFB.SelectedValue;
            }
            else
            {
                this.setting.EnableWapAliPayCrossBorder = this.OnoffKJZFB.SelectedValue;
            }
            SettingsManager.Save(this.setting);
            this.ShowMsg("保存支付设置成功", true, "");
        }