Hi,
I am updating a payment plugin I developed for nopCommerce 3.9 to nopCommerce 4.20.
I can get nopCommerce 4.20 to install the plugin without any problems. However when I click on the "Configure" button I get a "Page not found" error.
I searched these forums for similar issues, and double-checked the following:
1) GetConfigurationPageUrl:
public override string GetConfigurationPageUrl()
{
return $"{_webHelper.GetStoreLocation()}Admin/SagePay/Configure";
}
2) GetPublicViewComponentName:
public string GetPublicViewComponentName()
{
return "SagePay";
}
3) File located of the Views folder:
- _ViewImports.cshtml
- Configure.cshtml
- PaymentInfo.cshtml
4) Contents of my Configure.cshtml file:
@model Nop.Plugin.Payments.SagePay.Models.ConfigurationModel
@inject Nop.Core.IWebHelper webHelper
@{
Layout = "";
}
@await Component.InvokeAsync("StoreScopeConfiguration")
<form asp-controller="PaymentSagePay" asp-action="Configure" method="post">
<div class="panel-group">
<div class="panel panel-default">
<div class="panel-body">
<h5>This payment plugin is for use with the Sage PayNow Payment Gateway South Africa.</h5>
<div class="form-group">
<div class="col-md-3">
<nop-override-store-checkbox asp-for="MerchantId_OverrideForStore" asp-input="MerchantId" asp-store-scope="@Model.ActiveStoreScopeConfiguration" />
<nop-label asp-for="MerchantId" />
</div>
<div class="col-md-9">
<nop-editor asp-for="MerchantId" />
<span asp-validation-for="MerchantId"></span>
</div>
</div>
<div class="form-group">
<div class="col-md-3">
<nop-override-store-checkbox asp-for="SagePayServiceKey_OverrideForStore" asp-input="SagePayServiceKey" asp-store-scope="@Model.ActiveStoreScopeConfiguration" />
<nop-label asp-for="SagePayServiceKey" />
</div>
<div class="col-md-9">
<nop-editor asp-for="SagePayServiceKey" />
<span asp-validation-for="SagePayServiceKey"></span>
</div>
</div>
<div class="form-group">
<div class="col-md-9 col-md-offset-3">
<input type="submit" name="save" class="btn bg-primary" value="@T("Admin.Common.Save")" />
</div>
</div>
</div>
</div>
</div>
</form>
5) My Configure Method in my plugin Controller:
[AuthorizeAdmin]
[Area(AreaNames.Admin)]
public IActionResult Configure()
{
if (!_permissionService.Authorize(StandardPermissionProvider.ManagePaymentMethods))
return AccessDeniedView();
//load settings for a chosen store scope
var storeScope = _storeContext.ActiveStoreScopeConfiguration;
var sagePayPaymentSettings = _settingService.LoadSetting<SagePayPaymentSettings>(storeScope);
var model = new ConfigurationModel
{
MerchantId = sagePayPaymentSettings.MerchantId,
SagePayServiceKey = sagePayPaymentSettings.SagePayServiceKey
};
if (storeScope <= 0)
return View("~/Plugins/Payments.SagePay/Views/Configure.cshtml", model);
model.MerchantId_OverrideForStore = _settingService.SettingExists(sagePayPaymentSettings, x => x.MerchantId, storeScope);
model.SagePayServiceKey_OverrideForStore = _settingService.SettingExists(sagePayPaymentSettings, x => x.SagePayServiceKey, storeScope);
return View("~/Plugins/Payments.SagePay/Views/Configure.cshtml", model);
}
Am I doing something wrong, or perhaps missing something? I've also tried clearing the cache, uninstalling the plugin and re-installing it.
Any suggestions would be greatly appreciated.
Regards
Jaco Ferreira