コード例 #1
0
        public static int SetPluginProperties(int userId, int pluginId, KeyValueBunch props)
        {
            string xmlText = String.Empty;

            string[][]     pluginProps = null;
            SecurityResult result      = StorehouseController.CheckAccountNotDemoAndActive();

            //
            if (!result.Success)
            {
                return(result.ResultCode);
            }
            if (props != null)
            {
                // create system plugin
                SystemPluginBase pluginObj = GetSystemPluginInstance(userId, pluginId, false);
                // crypt sensitive data
                foreach (string keyName in props.GetAllKeys())
                {
                    //
                    string keyValue = props[keyName];
                    //
                    if (pluginObj.SecureSettings != null)
                    {
                        int indexOf = Array.IndexOf(pluginObj.SecureSettings, keyName);
                        // crypt sensitive data
                        if (indexOf > -1)
                        {
                            keyValue = CryptoUtils.Encrypt(keyValue);
                        }
                    }
                    //
                    props[keyName] = keyValue;
                }

                // load old properties
                KeyValueBunch oldProps = GetPluginPropertiesInternal(userId, pluginId,
                                                                     false, pluginObj.SecureSettings);
                // merge old props with new props
                foreach (string keyName in props.GetAllKeys())
                {
                    // copy
                    oldProps[keyName] = props[keyName];
                }
                //
                pluginProps = oldProps.KeyValueArray;
            }
            // build update xml
            xmlText = SettingsHelper.ConvertObjectSettings(pluginProps, "properties", "property");
            //
            return(EcommerceProvider.SetPluginProperties(SecurityContext.User.UserId, userId, pluginId, xmlText));
        }
コード例 #2
0
 public EnomResult ExecuteCommand(string commandName, KeyValueBunch commandArgs)
 {
     AddParam("Command", commandName);
     // copy attributes
     foreach (string keyName in commandArgs.GetAllKeys())
     {
         AddParam(keyName, commandArgs[keyName]);
     }
     //
     return(new EnomResult(ExecuteCommand()));
 }
コード例 #3
0
		private void BindPlanQuotas(KeyValueBunch quotas)
		{
			string[] groupKeys = quotas.GetAllKeys();
			//
			foreach (string groupKey in groupKeys)
			{
				//
				PlaceHolder container = (PlaceHolder)FindControl(groupKey);
				//
				if (container != null)
					container.Visible = true;

				//
				Repeater repeater = (Repeater)FindControl(groupKey + "_Quotas");
				//
				if (repeater != null)
				{
					//
					repeater.DataSource = quotas[groupKey].Split(',');
					//
					repeater.DataBind();
				}
			}
		}
コード例 #4
0
        public static CheckoutFormParams GetCheckoutFormParams(string contractId, int invoiceId,
                                                               string methodName, KeyValueBunch options)
        {
            Contract contractInfo = ContractSystem.ContractController.GetContract(contractId);

            // Impersonate
            ContractSystem.ContractController.ImpersonateAsContractReseller(contractInfo);
            //
            SupportedPlugin pmPlugin = GetResellerPMPlugin(contractInfo.ResellerId, methodName);

            //
            if (pmPlugin == null)
            {
                throw new Exception("Incorrect payment method has been specified");
            }
            // create instance of plugin
            IInteractivePaymentGatewayProvider provider = (IInteractivePaymentGatewayProvider)
                                                          SystemPluginController.GetSystemPluginInstance(contractInfo, pmPlugin, true);
            //
            Invoice userInvoice = InvoiceController.GetCustomerInvoiceInternally(invoiceId);
            //
            List <InvoiceItem> invoiceLines = InvoiceController.GetCustomerInvoiceItems(invoiceId);
            // load contract account
            ContractAccount account = ContractSystem.ContractController.GetContractAccountSettings(contractId);

            // build form parameters
            FormParameters formParams = new FormParameters();

            // copy reseller id
            formParams[FormParameters.CONTRACT] = userInvoice.ContractId;
            // copy invoice number
            formParams[FormParameters.INVOICE] = userInvoice.InvoiceId.ToString();
            // copy invoice amount
            formParams[FormParameters.AMOUNT] = userInvoice.Total.ToString("0.00");
            // copy invoice tax amount
            formParams[FormParameters.TAX_AMOUNT] = userInvoice.TaxAmount.ToString("0.00");
            // copy invoice currency
            formParams[FormParameters.CURRENCY] = userInvoice.Currency;

            // copy first name
            formParams[FormParameters.FIRST_NAME] = account[ContractAccount.FIRST_NAME];
            // copy last name
            formParams[FormParameters.LAST_NAME] = account[ContractAccount.LAST_NAME];
            // copy email
            formParams[FormParameters.EMAIL] = account[ContractAccount.EMAIL];
            // copy address
            formParams[FormParameters.ADDRESS] = account[ContractAccount.ADDRESS];
            // copy country
            formParams[FormParameters.COUNTRY] = account[ContractAccount.COUNTRY];
            // copy phone number
            formParams[FormParameters.PHONE] = account[ContractAccount.PHONE_NUMBER];
            // copy city
            formParams[FormParameters.CITY] = account[ContractAccount.CITY];
            // copy state
            formParams[FormParameters.STATE] = account[ContractAccount.STATE];
            // copy zip
            formParams[FormParameters.ZIP] = account[ContractAccount.ZIP];
            // copy options if any
            if (options != null)
            {
                foreach (string keyName in options.GetAllKeys())
                {
                    formParams[keyName] = options[keyName];
                }
            }

            // return result
            return(provider.GetCheckoutFormParams(formParams, invoiceLines.ToArray()));
        }