Ejemplo n.º 1
0
 protected void btnOK_Click(object sender, EventArgs e)
 {
     SiteSettings masterSettings = SettingsManager.GetMasterSettings(false);
     masterSettings.EnableWapShengPay = this.radEnableWapShengPay.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("Hishop.Plugins.Payment.ShengPayMobile.ShengPayMobileRequest");
     if (paymentMode == null)
     {
         PaymentModeInfo info2 = 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(info2);
     }
     else
     {
         PaymentModeInfo info4 = paymentMode;
         info4.Settings = HiCryptographer.Encrypt(text);
         info4.ApplicationType = PayApplicationType.payOnWAP;
         SalesHelper.UpdatePaymentMode(info4);
     }
     this.ShowMsg("修改成功", true);
 }
Ejemplo n.º 2
0
 public static bool DeletePaymentMode(int modeId)
 {
     PaymentModeInfo paymentMode = new PaymentModeInfo {
         ModeId = modeId
     };
     return (new PaymentModeDao().CreateUpdateDeletePaymentMode(paymentMode, DataProviderAction.Delete) == PaymentModeActionStatus.Success);
 }
Ejemplo n.º 3
0
 public static decimal CalcPayCharge(decimal cartMoney, PaymentModeInfo paymentModeInfo)
 {
     if (!paymentModeInfo.IsPercent)
     {
         return paymentModeInfo.Charge;
     }
     return (cartMoney * (paymentModeInfo.Charge / 100M));
 }
Ejemplo n.º 4
0
 public static PaymentModeActionStatus CreatePaymentMode(PaymentModeInfo paymentMode)
 {
     if (null == paymentMode)
     {
         return PaymentModeActionStatus.UnknowError;
     }
     Globals.EntityCoding(paymentMode, true);
     return new PaymentModeDao().CreateUpdateDeletePaymentMode(paymentMode, DataProviderAction.Create);
 }
Ejemplo n.º 5
0
 protected void btnOK_Click(object sender, 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);
     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)
         {
             SiteSettings settings = SettingsManager.GetMasterSettings(false);
             settings.EnableAlipayRequest = flag;
             SettingsManager.Save(settings);
             this.ShowMsg("设置成功", true);
         }
         else
         {
             this.ShowMsg("设置失败", false);
         }
     }
 }
Ejemplo n.º 6
0
        private 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 (SubsiteSalesHelper.CreatePaymentMode(paymentMode))
                {
                    case PaymentModeActionStatus.Success:
                        {
                            Response.Redirect("MyPaymentTypes.aspx");
                            return;
                        }
                    case PaymentModeActionStatus.DuplicateName:
                        {
                            ShowMsg("已经存在一个相同的支付方式名称", false);
                            return;
                        }
                    case PaymentModeActionStatus.OutofNumber:
                        {
                            ShowMsg("支付方式的数目已经超出系统设置的数目", false);
                            return;
                        }

                    case PaymentModeActionStatus.DuplicateGateway:
                        {
                            ShowMsg("已经添加了一个相同类型的支付接口", false);
                            return;
                        }
                }
                ShowMsg("未知错误", false);
            }
        }
Ejemplo n.º 7
0
        private void btnCreate_Click(object sender, 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"));
                        return;

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

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

                    case PaymentModeActionStatus.OutofNumber:
                        this.ShowMsg("支付方式的数目已经超出系统设置的数目", false);
                        return;
                }
                this.ShowMsg("未知错误", false);
            }
        }
 void DoValidate()
 {
     NameValueCollection values2 = new NameValueCollection();
     values2.Add(Page.Request.Form);
     values2.Add(Page.Request.QueryString);
     NameValueCollection parameters = values2;
     Gateway = Page.Request.QueryString["HIGW"];
     Notify = PaymentNotify.CreateInstance(Gateway, parameters);
     if (isBackRequest)
     {
         Notify.ReturnUrl = Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("DistributorInpourReturn_url", new object[] { Gateway }));
         Notify.ReturnUrl = Notify.ReturnUrl + "?" + Page.Request.Url.Query;
     }
     InpourId = Notify.GetOrderId();
     Amount = Notify.GetOrderAmount();
     InpourRequest = SubsiteStoreHelper.GetInpouRequest(InpourId);
     if (InpourRequest == null)
     {
         ResponseStatus(true, "success");
     }
     else
     {
         Amount = InpourRequest.InpourBlance;
         paymode = SubsiteStoreHelper.GetPaymentMode(InpourRequest.PaymentId);
         if (paymode == null)
         {
             ResponseStatus(true, "gatewaynotfound");
         }
         else
         {
             Notify.Finished += new EventHandler<FinishedEventArgs>(Notify_Finished);
             Notify.NotifyVerifyFaild += new EventHandler(Notify_NotifyVerifyFaild);
             Notify.Payment += new EventHandler(Notify_Payment);
             Notify.VerifyNotify(0x7530, Cryptographer.Decrypt(paymode.Settings));
         }
     }
 }
Ejemplo n.º 9
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            string str;
            ConfigData data;
            decimal num;
            if (ValidateValues(out str, out data, out num))
            {
                PaymentModeInfo info2 = new PaymentModeInfo();
                info2.ModeId = modeId;
                info2.Name = txtName.Text;
                info2.Description = fcContent.Text.Replace("\r\n", "").Replace("\r", "").Replace("\n", "");
                info2.Gateway = str;
                info2.IsUseInpour = radiIsUseInpour.SelectedValue;
                info2.Charge = num;
                info2.IsPercent = chkIsPercent.Checked;
                info2.Settings = Cryptographer.Encrypt(data.SettingsXml);
                PaymentModeInfo paymentMode = info2;
                switch (SubsiteSalesHelper.UpdatePaymentMode(paymentMode))
                {
                    case PaymentModeActionStatus.Success:
                        ShowMsg("成功修改了当前支付方式", true);
                        break;

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

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

                    case PaymentModeActionStatus.UnknowError:
                        ShowMsg("未知错误", false);
                        break;
                }
            }
        }
Ejemplo n.º 10
0
 void DoValidate()
 {
     NameValueCollection values2 = new NameValueCollection();
     values2.Add(this.Page.Request.Form);
     values2.Add(this.Page.Request.QueryString);
     NameValueCollection parameters = values2;
     this.Gateway = this.Page.Request.QueryString["HIGW"];
     this.Notify = PaymentNotify.CreateInstance(this.Gateway, parameters);
     if (this.isBackRequest)
     {
         this.Notify.ReturnUrl = Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("InpourReturn_url", new object[] { this.Gateway })) + "?" + this.Page.Request.Url.Query;
     }
     this.InpourId = this.Notify.GetOrderId();
     this.Amount = this.Notify.GetOrderAmount();
     this.InpourRequest = PersonalHelper.GetInpourBlance(this.InpourId);
     if (this.InpourRequest == null)
     {
         this.ResponseStatus(true, "success");
     }
     else
     {
         this.Amount = this.InpourRequest.InpourBlance;
         this.paymode = TradeHelper.GetPaymentMode(this.InpourRequest.PaymentId);
         if (this.paymode == null)
         {
             this.ResponseStatus(true, "gatewaynotfound");
         }
         else
         {
             this.Notify.Finished += new EventHandler<FinishedEventArgs>(this.Notify_Finished);
             this.Notify.NotifyVerifyFaild += new EventHandler(this.Notify_NotifyVerifyFaild);
             this.Notify.Payment += new EventHandler(this.Notify_Payment);
             this.Notify.VerifyNotify(0x7530, Cryptographer.Decrypt(this.paymode.Settings));
         }
     }
 }
Ejemplo n.º 11
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            string str;
            ConfigData data;
            decimal num;
            if (ValidateValues(out str, out data, out num))
            {
                PaymentModeInfo paymentMode = new PaymentModeInfo();
                paymentMode.ModeId = modeId;
                paymentMode.Name = txtName.Text.Trim();
                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.UpdatePaymentMode(paymentMode))
                {
                    case PaymentModeActionStatus.Success:
                        base.Response.Redirect(Globals.GetAdminAbsolutePath("sales/PaymentTypes.aspx"));
                        break;

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

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

                    case PaymentModeActionStatus.UnknowError:
                        ShowMsg("未知错误", false);
                        break;
                }
            }
        }
Ejemplo n.º 12
0
 public static bool DeletePaymentMode(int modeId)
 {
     PaymentModeInfo paymentMode = new PaymentModeInfo();
     paymentMode.ModeId = modeId;
     return (SalesProvider.Instance().CreateUpdateDeletePaymentMode(paymentMode, DataProviderAction.Delete) == PaymentModeActionStatus.Success);
 }
Ejemplo n.º 13
0
 public static PaymentModeInfo PopulatePayment(IDataRecord reader)
 {
     if (null == reader)
     {
         return null;
     }
     PaymentModeInfo info = new PaymentModeInfo {
         ModeId = (int) reader["ModeId"],
         Name = (string) reader["Name"],
         DisplaySequence = (int) reader["DisplaySequence"],
         IsUseInpour = (bool) reader["IsUseInpour"],
         Charge = (decimal) reader["Charge"],
         IsPercent = (bool) reader["IsPercent"]
     };
     try
     {
         info.IsUseInDistributor = (bool) reader["IsUseInDistributor"];
     }
     catch
     {
         info.IsUseInDistributor = false;
     }
     if (reader["Description"] != DBNull.Value)
     {
         info.Description = (string) reader["Description"];
     }
     if (reader["Gateway"] != DBNull.Value)
     {
         info.Gateway = (string) reader["Gateway"];
     }
     if (reader["Settings"] != DBNull.Value)
     {
         info.Settings = (string) reader["Settings"];
     }
     return info;
 }
Ejemplo n.º 14
0
 public static PaymentModeInfo PopulatePayment(IDataRecord reader)
 {
     if (null == reader)
     {
         return null;
     }
     PaymentModeInfo info2 = new PaymentModeInfo();
     info2.ModeId = (int) reader["ModeId"];
     info2.Name = (string) reader["Name"];
     info2.DisplaySequence = (int) reader["DisplaySequence"];
     info2.IsUseInpour = (bool) reader["IsUseInpour"];
     info2.Charge = (decimal) reader["Charge"];
     info2.IsPercent = (bool) reader["IsPercent"];
     PaymentModeInfo info = info2;
     if (reader["Description"] != DBNull.Value)
     {
         info.Description = (string) reader["Description"];
     }
     if (reader["Gateway"] != DBNull.Value)
     {
         info.Gateway = (string) reader["Gateway"];
     }
     if (reader["Settings"] != DBNull.Value)
     {
         info.Settings = (string) reader["Settings"];
     }
     return info;
 }
Ejemplo n.º 15
0
 public static PaymentModeActionStatus UpdatePaymentMode(PaymentModeInfo paymentMode)
 {
     if (null == paymentMode)
     {
         return PaymentModeActionStatus.UnknowError;
     }
     Globals.EntityCoding(paymentMode, true);
     return SubsiteSalesProvider.Instance().CreateUpdateDeletePaymentMode(paymentMode, DataProviderAction.Update);
 }
Ejemplo n.º 16
0
 public override PaymentModeActionStatus CreateUpdateDeletePaymentMode(PaymentModeInfo paymentMode, DataProviderAction action)
 {
     if (null == paymentMode)
     {
         return PaymentModeActionStatus.UnknowError;
     }
     DbCommand storedProcCommand = database.GetStoredProcCommand("cp_PaymentType_CreateUpdateDelete");
     database.AddInParameter(storedProcCommand, "Action", DbType.Int32, (int)action);
     database.AddOutParameter(storedProcCommand, "Status", DbType.Int32, 4);
     if (action == DataProviderAction.Create)
     {
         database.AddOutParameter(storedProcCommand, "ModeId", DbType.Int32, 4);
     }
     else
     {
         database.AddInParameter(storedProcCommand, "ModeId", DbType.Int32, paymentMode.ModeId);
     }
     if (action != DataProviderAction.Delete)
     {
         database.AddInParameter(storedProcCommand, "Name", DbType.String, paymentMode.Name);
         database.AddInParameter(storedProcCommand, "Description", DbType.String, paymentMode.Description);
         database.AddInParameter(storedProcCommand, "Gateway", DbType.String, paymentMode.Gateway);
         database.AddInParameter(storedProcCommand, "IsUseInpour", DbType.Boolean, paymentMode.IsUseInpour);
         database.AddInParameter(storedProcCommand, "Charge", DbType.Currency, paymentMode.Charge);
         database.AddInParameter(storedProcCommand, "IsPercent", DbType.Boolean, paymentMode.IsPercent);
         database.AddInParameter(storedProcCommand, "Settings", DbType.String, paymentMode.Settings);
     }
     database.ExecuteNonQuery(storedProcCommand);
     return (PaymentModeActionStatus)((int)database.GetParameterValue(storedProcCommand, "Status"));
 }
Ejemplo n.º 17
0
 public override PaymentModeInfo GetPaymentMode(int modeId)
 {
     PaymentModeInfo info = new PaymentModeInfo();
     DbCommand sqlStringCommand = database.GetSqlStringCommand("SELECT * FROM Hishop_PaymentTypes WHERE ModeId = @ModeId");
     database.AddInParameter(sqlStringCommand, "ModeId", DbType.Int32, modeId);
     using (IDataReader reader = database.ExecuteReader(sqlStringCommand))
     {
         if (reader.Read())
         {
             info = DataMapper.PopulatePayment(reader);
         }
     }
     return info;
 }
Ejemplo n.º 18
0
 public abstract PaymentModeActionStatus CreateUpdateDeletePaymentMode(PaymentModeInfo paymentMode, DataProviderAction action);