Exemple #1
0
        public static PaymentNotify CreateInstance(string name, NameValueCollection parameters)
        {
            PaymentNotify result;

            if (string.IsNullOrEmpty(name))
            {
                result = null;
            }
            else
            {
                object[] args = new object[]
                {
                    parameters
                };
                PaymentPlugins paymentPlugins = PaymentPlugins.Instance();
                Type           plugin         = paymentPlugins.GetPlugin("PaymentRequest", name);
                if (plugin == null)
                {
                    result = null;
                }
                else
                {
                    Type pluginWithNamespace = paymentPlugins.GetPluginWithNamespace("PaymentNotify", plugin.Namespace);
                    if (pluginWithNamespace == null)
                    {
                        result = null;
                    }
                    else
                    {
                        result = (Activator.CreateInstance(pluginWithNamespace, args) as PaymentNotify);
                    }
                }
            }
            return(result);
        }
Exemple #2
0
        public static PaymentRequest CreateInstance(string name, string configXml, string orderId, decimal amount, string subject, string body, string buyerEmail, DateTime date, string showUrl, string returnUrl, string notifyUrl, string attach)
        {
            if (string.IsNullOrEmpty(name))
            {
                return(null);
            }
            object[] args = new object[]
            {
                orderId,
                amount,
                subject,
                body,
                buyerEmail,
                date,
                showUrl,
                returnUrl,
                notifyUrl,
                attach
            };
            Type plugin = PaymentPlugins.Instance().GetPlugin("PaymentRequest", name);

            if (plugin == null)
            {
                return(null);
            }
            PaymentRequest paymentRequest = Activator.CreateInstance(plugin, args) as PaymentRequest;

            if (paymentRequest != null && !string.IsNullOrEmpty(configXml))
            {
                XmlDocument xmlDocument = new XmlDocument();
                xmlDocument.LoadXml(configXml);
                paymentRequest.InitConfig(xmlDocument.FirstChild);
            }
            return(paymentRequest);
        }
        public static PaymentRequest CreateInstance(string name)
        {
            if (string.IsNullOrEmpty(name))
            {
                return(null);
            }
            Type plugin = PaymentPlugins.Instance().GetPlugin("PaymentRequest", name);

            if (plugin == null)
            {
                return(null);
            }
            return(Activator.CreateInstance(plugin) as PaymentRequest);
        }
Exemple #4
0
 private static void ProcessPaymentRequest(HttpContext context)
 {
     if (context.Request["action"] == "getlist")
     {
         PaymentPlugins paymentPlugins = PaymentPlugins.Instance();
         context.Response.ContentType = "application/json";
         context.Response.Write(paymentPlugins.GetPlugins().ToJsonString());
         return;
     }
     if (context.Request["action"] == "getmetadata")
     {
         context.Response.ContentType = "text/xml";
         PaymentRequest paymentRequest = PaymentRequest.CreateInstance(context.Request["name"]);
         if (paymentRequest == null)
         {
             context.Response.Write("<xml></xml>");
             return;
         }
         context.Response.Write(paymentRequest.GetMetaData().OuterXml);
     }
 }
Exemple #5
0
        public static PaymentRequest CreateInstance(string name)
        {
            PaymentRequest result;

            if (string.IsNullOrEmpty(name))
            {
                result = null;
            }
            else
            {
                Type plugin = PaymentPlugins.Instance().GetPlugin("PaymentRequest", name);
                if (plugin == null)
                {
                    result = null;
                }
                else
                {
                    result = (Activator.CreateInstance(plugin) as PaymentRequest);
                }
            }
            return(result);
        }