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); }
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); }
public static PaymentPlugins Instance() { if (instance == null) { lock (LockHelper) { if (instance == null) { instance = new PaymentPlugins(); } } } instance.VerifyIndex(); return(instance); }
public static PaymentPlugins Instance() { if (instance == null) { lock (LockHelper) { if (instance == null) { instance = new PaymentPlugins(); } } } instance.VerifyIndex(); return instance; }
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); } }
public static PaymentPlugins Instance() { if (PaymentPlugins.instance == null) { object lockHelper; Monitor.Enter(lockHelper = PaymentPlugins.LockHelper); try { if (PaymentPlugins.instance == null) { PaymentPlugins.instance = new PaymentPlugins(); } } finally { Monitor.Exit(lockHelper); } } PaymentPlugins.instance.VerifyIndex(); return(PaymentPlugins.instance); }
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); }