/// <summary> /// Adds the pay element. /// </summary> /// <param name="handlerName">Name of the handler.</param> /// <param name="element">The element.</param> static void AddPayElement(string handlerName, PayMethodElement element) { PaymentHandlerElement handler = GetPayHandlerConfigElement(handlerName); RemovePayElement(handler, element); handler.HandlerPayMethods.Add(element); }
/// <summary> /// Removes the specified element. /// </summary> /// <param name="element">The element.</param> public void Remove(PayMethodElement element) { if (BaseIndexOf(element) >= 0) { BaseRemove(element.MethodName); } }
/// <summary> /// Adds the pay element. /// </summary> /// <param name="handlerName">Name of the handler.</param> /// <param name="element">The element.</param> public static void RemovePayElement(string handlerName, string elementName) { PaymentHandlerElement handler = GetPayHandlerConfigElement(handlerName); PayMethodElement element = HandlersPayMethod(handler.HandlerName).DefaultIfEmpty(null).FirstOrDefault(h => h.MethodName == elementName); if (element != null) { RemovePayElement(handler, element); } }
/// <summary> /// Adds the pay element. /// </summary> /// <param name="handlerName">Name of the handler.</param> /// <param name="methodName">Name of the method.</param> /// <param name="code">The code.</param> /// <param name="description">The descrption.</param> public static void AddPayElement(string handlerName, string methodName, string code, string description) { PaymentHandlerElement handler = GetPayHandlerConfigElement(handlerName); if (!PaymethodExists(methodName)) { PayMethodElement element = new PayMethodElement() { MethodName = methodName, Code = code, Description = description }; AddPayElement(handlerName, element); } }
/// <summary> /// Modifies the pay element. /// </summary> /// <param name="currentHandlerName">Name of the current handler.</param> /// <param name="currentMethodName">Name of the current method.</param> /// <param name="newHandlerName">New name of the handler.</param> /// <param name="newMethodName">New name of the method.</param> /// <param name="code">The code.</param> /// <param name="description">The description.</param> public static void ModifyPayElement(string currentHandlerName, string currentMethodName, string newHandlerName, string newMethodName, string code, string description) { PaymentHandlerElement currentHandler = null; bool changeMethodName = newMethodName != currentMethodName; bool changeHandler = currentHandlerName != newHandlerName; if (_handlers.ContainsKey(currentHandlerName)) { currentHandler = _handlers[currentHandlerName]; } if (currentHandler == null) { currentHandler = _handlers[newHandlerName]; changeHandler = true; } PaymentHandlerElement newHandler = _handlers[newHandlerName]; if (changeHandler) {// chaging the handler PayMethodElement element = HandlersPayMethod(currentHandler.HandlerName).DefaultIfEmpty(null).FirstOrDefault(h => h.MethodName == currentMethodName); if (element != null) { RemovePayElement(currentHandler, element); } AddPayElement(newHandlerName, newMethodName, code, description); } else { //we are not changing the handler PayMethodElement element = HandlersPayMethod(newHandler.HandlerName).DefaultIfEmpty(null).FirstOrDefault(h => h.MethodName == currentMethodName); if (element != null) { //current paymethod exists for the handler if (changeMethodName) { element.MethodName = newMethodName; } element.Code = code; element.Description = description; } } }
/// <summary> /// Removes the pay element. /// </summary> /// <param name="handler">The handler.</param> /// <param name="element">The element.</param> static void RemovePayElement(PaymentHandlerElement handler, PayMethodElement element) { handler.HandlerPayMethods.Remove(element); }
/// <summary> /// Adds the specified element. /// </summary> /// <param name="element">The element.</param> public void Add(PayMethodElement element) { BaseAdd(element); }