/// <summary>Creates a PaymentGateway Invoker for the appropriate agency</summary> /// <param name="paymentMethod"></param> /// <param name="amount"></param> /// <returns></returns> public static PaymentGatewayInvoker Create(string paymentMethod, decimal amount) { string locale = Thread.CurrentThread.CurrentCulture.Name; PaymentGatewayInvoker invoker = null; var config = HLConfigManager.Configurations.PaymentsConfiguration; try { if (config.HasPaymentGateway && !string.IsNullOrEmpty(config.PaymentGatewayInvoker)) { var args = new object[] { paymentMethod, amount }; string invokerType = config.PaymentGatewayInvoker; var type = Type.GetType(string.Concat(RootNameSpace, invokerType), true, true); invoker = Activator.CreateInstance(type, BindingFlags.NonPublic | BindingFlags.Instance, null, args, null) as PaymentGatewayInvoker; } else { //LogBlindError(string.Empty, string.Format(ErrorMissingGateWayConfigInfo, locale, paymentMethod)); LoggerHelper.Error(string.Format(ErrorMissingGateWayConfigInfo, locale, paymentMethod)); } invoker.GetOrderNumber(); return(invoker); } catch (Exception ex) { //LogBlindError((null != invoker) ? invoker._gatewayName : config.PaymentGatewayInvoker.Replace("Invoker", string.Empty), ex.Message); LoggerHelper.Error(string.Format(ErrorFailedToInstantiateGatewayInvoker, config.PaymentGatewayInvoker, ex.Message)); throw ex; } }