Error on view plugin in website "One or more errors occurred. (A view component named 'Rzorpya' could not be found. A view component must be a public non-abstract class ?

Thursday, January 27, 2022 3:03:22 PM
  • Posted: Tuesday, July 30, 2019 5:19 AM
  • 3
I"m trying to install new payment gateway razorpay in grand node 4.50 setup but they not installed properly or if installed they do not redirect to the controller and view getting an error on it.  Can you give the examples or demo video to how to install the plugin in grandenode.


Class Libery name :Grand.Plugin.Payments.RazorpayStandard
Controller .Cs code :
PaymentRazorpayStandardController

[code]using Grand.Core;
using Grand.Core.Domain.Payments;
using Grand.Framework.Controllers;
using Grand.Framework.MVC.Filters;
using Grand.Plugin.Payments.RazorpayStandard.Models;
using Grand.Services.Configuration;
using Grand.Services.Localization;
using Grand.Services.Orders;
using Grand.Services.Payments;
using Grand.Services.Security;
using Grand.Services.Stores;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Razorpay.Api;
using System.Collections.Generic;
using System.Threading.Tasks;
using Grand.Services.Logging;

namespace Grand.Plugin.Payments.RazorpayStandard.Controllers
{
    [AuthorizeAdmin]
    [Area("Admin")]
    public class PaymentRazorpayStandardController : BasePaymentController
    {
        #region Fields
        private readonly IWorkContext _workContext;
        private readonly IStoreService _storeService;
        private readonly ISettingService _settingService;
        private readonly IPaymentService _paymentService;
        private readonly IOrderService _orderService;
        private readonly IOrderProcessingService _orderProcessingService;
        private readonly ILocalizationService _localizationService;
        private readonly IStoreContext _storeContext;
        private readonly ILogger _logger;
        private readonly IWebHelper _webHelper;
        private readonly PaymentSettings _paymentSettings;
        private readonly IPermissionService _permissionService;
        private readonly RazorpaySettings _razorpayPaymentSettings;
        #endregion

        #region Ctor

        public PaymentRazorpayStandardController(IWorkContext workContext,
            IStoreService storeService,
            ISettingService settingService,
            IPaymentService paymentService,
            IOrderService orderService,
            IOrderProcessingService orderProcessingService,
            ILocalizationService localizationService,
            IStoreContext storeContext,
            ILogger logger,
            IWebHelper webHelper,
            PaymentSettings paymentSettings,
            IPermissionService permissionService,
            RazorpaySettings razorpayPaymentSettings)
        {
            this._workContext = workContext;
            this._storeService = storeService;
            this._settingService = settingService;
            this._paymentService = paymentService;
            this._orderService = orderService;
            this._orderProcessingService = orderProcessingService;
            this._localizationService = localizationService;
            this._storeContext = storeContext;
            this._logger = logger;
            this._webHelper = webHelper;
            this._paymentSettings = paymentSettings;
            this._permissionService = permissionService;
            this._razorpayPaymentSettings = razorpayPaymentSettings;
        }

        #endregion

        #region Methods
        [AuthorizeAdmin]
        [Area("Admin")]
        public async Task<IActionResult> Configure()
        {
            if (!await _permissionService.Authorize(StandardPermissionProvider.ManagePaymentMethods))
                return AccessDeniedView();

            var model = new ConfigurationModel {
                UseSandBox = _razorpayPaymentSettings.UseSandBox,
                PublicKey = _razorpayPaymentSettings.PublicKey,
                PrivateKey = _razorpayPaymentSettings.PrivateKey,
                AdditionalFee = _razorpayPaymentSettings.AdditionalFee,
                AdditionalFeePer
0
  • Posted: Tuesday, July 30, 2019 9:06 AM
  • 958
You've uploaded wrong file. Error is related with view component. Error message is very descriptive. If you want, check one of the standard GrandNode payment plugins. You can install them successfully so you can check how the installation works.
Best regards,
Patryk

GrandNode Team
0
  • Posted: Tuesday, July 30, 2019 11:11 AM
  • 3
I'm creating with an example of PayPal plugin but through errors.

https://www.dropbox.com/s/7rzv3a1orxakwwg/picturemessage_v4hakb3l.5fw.png?dl=0


Configure.cshtml

@{
    Layout = "_ConfigurePlugin";
}
@model ConfigurationModel
@using Grand.Plugin.Payments.RazorpayStandard.Models;

<form asp-controller="PaymentRazorpayStandard" asp-action="Configure" method="post">
    <antiforgery-token />
    <div class="form-horizontal">
        <div class="form-body">
            <div class="form-group">
                <div class="col-md-3 col-sm-3 text-right">
                    <admin-label asp-for="UseSandBox" class="control-label" />
                </div>
                <div class="col-md-9 col-sm-9">
                    <admin-input asp-for="UseSandBox" />
                    <span asp-validation-for="UseSandBox"></span>
                </div>
            </div>
            <div class="form-group">
                <div class="col-md-3 col-sm-3 text-right">
                    <admin-label asp-for="PrivateKey" class="control-label" />
                </div>
                <div class="col-md-9 col-sm-9">
                    <admin-input asp-for="PrivateKey" />
                    <span asp-validation-for="PrivateKey"></span>
                </div>
            </div>
            <div class="form-group">
                <div class="col-md-3 col-sm-3 text-right">
                    <admin-label asp-for="PublicKey" class="control-label" />
                </div>
                <div class="col-md-9 col-sm-9">
                    <admin-input asp-for="PublicKey" />
                    <span asp-validation-for="PublicKey"></span>
                </div>
            </div>
            <div class="form-group">
                <div class="col-md-3 col-sm-3 text-right">
                    <admin-label asp-for="AdditionalFee" class="control-label" />
                </div>
                <div class="col-md-9 col-sm-9">
                    <admin-input asp-for="AdditionalFee" />
                    <span asp-validation-for="AdditionalFee"></span>
                </div>
            </div>
            <div class="form-group">
                <div class="col-md-3 col-sm-3 text-right">
                    <admin-label asp-for="AdditionalFeePercentage" class="control-label" />
                </div>
                <div class="col-md-9 col-sm-9">
                    <admin-input asp-for="AdditionalFeePercentage" />
                    <span asp-validation-for="AdditionalFeePercentage"></span>
                </div>
            </div>
            <div class="form-actions">
                <div class="row">
                    <div class="col-md-offset-3 col-sm-offset-3 col-md-9 col-sm-9">
                        <input type="submit" name="save" class="btn green" value="@T("Admin.Common.Save")" />
                    </div>
                </div>
            </div>
        </div>
    </div>
</form>

0
  • Posted: Saturday, January 8, 2022 6:04 PM
  • 22
Hi rafeeq,

Are you able to create the Razorpay plugin?
Harshal
0
back to top
Filters