/// <summary> /// Prepare paged payment method list model /// </summary> /// <param name="searchModel">Payment method search model</param> /// <returns>Payment method list model</returns> public virtual PaymentMethodListModel PreparePaymentMethodListModel(PaymentMethodSearchModel searchModel) { if (searchModel == null) { throw new ArgumentNullException(nameof(searchModel)); } //get payment methods var paymentMethods = _paymentPluginManager.LoadAllPlugins().ToPagedList(searchModel); //prepare grid model var model = new PaymentMethodListModel().PrepareToGrid(searchModel, paymentMethods, () => { return(paymentMethods.Select(method => { //fill in model values from the entity var paymentMethodModel = method.ToPluginModel <PaymentMethodModel>(); //fill in additional values (not existing in the entity) paymentMethodModel.IsActive = _paymentPluginManager.IsPluginActive(method); paymentMethodModel.ConfigurationUrl = method.GetConfigurationPageUrl(); paymentMethodModel.LogoUrl = _paymentPluginManager.GetPluginLogoUrl(method); paymentMethodModel.RecurringPaymentType = _localizationService.GetLocalizedEnum(method.RecurringPaymentType); return paymentMethodModel; })); }); return(model); }
/// <summary> /// Prepare paged payment method list model /// </summary> /// <param name="searchModel">Payment method search model</param> /// <returns>Payment method list model</returns> public virtual PaymentMethodListModel PreparePaymentMethodListModel(PaymentMethodSearchModel searchModel) { if (searchModel == null) { throw new ArgumentNullException(nameof(searchModel)); } //get payment methods var paymentMethods = _paymentService.LoadAllPaymentMethods(); //prepare grid model var model = new PaymentMethodListModel { Data = paymentMethods.PaginationByRequestModel(searchModel).Select(method => { //fill in model values from the entity var paymentMethodModel = method.ToPluginModel <PaymentMethodModel>(); //fill in additional values (not existing in the entity) paymentMethodModel.IsActive = _paymentService.IsPaymentMethodActive(method); paymentMethodModel.ConfigurationUrl = method.GetConfigurationPageUrl(); paymentMethodModel.LogoUrl = PluginManager.GetLogoUrl(method.PluginDescriptor); paymentMethodModel.RecurringPaymentType = _localizationService.GetLocalizedEnum(method.RecurringPaymentType); return(paymentMethodModel); }), Total = paymentMethods.Count }; return(model); }
/// <summary> /// Prepare payment method search model /// </summary> /// <param name="searchModel">Payment method search model</param> /// <returns>Payment method search model</returns> public virtual PaymentMethodSearchModel PreparePaymentMethodSearchModel(PaymentMethodSearchModel searchModel) { if (searchModel == null) { throw new ArgumentNullException(nameof(searchModel)); } //prepare page parameters searchModel.SetGridPageSize(); return(searchModel); }
public virtual IActionResult Methods(PaymentMethodSearchModel searchModel) { if (!_permissionService.Authorize(StandardPermissionProvider.ManagePaymentMethods)) { return(AccessDeniedKendoGridJson()); } //prepare model var model = _paymentModelFactory.PreparePaymentMethodListModel(searchModel); return(Json(model)); }
/// <returns>A task that represents the asynchronous operation</returns> public virtual async Task <IActionResult> Methods(PaymentMethodSearchModel searchModel) { if (!await _permissionService.AuthorizeAsync(StandardPermissionProvider.ManagePaymentMethods)) { return(await AccessDeniedDataTablesJson()); } //prepare model var model = await _paymentModelFactory.PreparePaymentMethodListModelAsync(searchModel); return(Json(model)); }
public PaymentMethodsModel() { PaymentsMethod = new PaymentMethodSearchModel(); PaymentMethodRestriction = new PaymentMethodRestrictionModel(); }
/// <summary> /// Prepare payment method search model /// </summary> /// <param name="searchModel">Payment method search model</param> /// <returns>Payment method search model</returns> protected virtual Task <PaymentMethodSearchModel> PreparePaymentMethodSearchModelAsync(PaymentMethodSearchModel searchModel) { if (searchModel == null) { throw new ArgumentNullException(nameof(searchModel)); } //prepare page parameters searchModel.SetGridPageSize(); return(Task.FromResult(searchModel)); }