[英]Nopcommerce unable to find my Payment Method plugin's component
I am developing a customized Payment Method plugin for my client. 我正在为客户开发定制的“付款方式”插件。 I am a beginner in Nopcommerce plugin development and here's my plugin directory structure:
我是Nopcommerce插件开发的初学者,这是我的插件目录结构:
Here's my CODBookingPaymentProcessor.cs
这是我的
CODBookingPaymentProcessor.cs
public class CODBookingPaymentProcessor : BasePlugin, IPaymentMethod
{
#region Ctor
public CODBookingPaymentProcessor()
{
}
#endregion
#region Methods
public bool SupportCapture => false;
public bool SupportPartiallyRefund => false;
public bool SupportRefund => false;
public bool SupportVoid => false;
public RecurringPaymentType RecurringPaymentType => RecurringPaymentType.NotSupported;
public PaymentMethodType PaymentMethodType => PaymentMethodType.Standard;
public bool SkipPaymentInfo => false;
public string PaymentMethodDescription => "Pay booking and extras before order placing.";
public CancelRecurringPaymentResult CancelRecurringPayment(CancelRecurringPaymentRequest cancelPaymentRequest)
{
return new CancelRecurringPaymentResult();
}
public bool CanRePostProcessPayment(Order order)
{
if (order == null)
throw new ArgumentNullException(nameof(order));
//it's not a redirection payment method. So we always return false
return false;
}
public CapturePaymentResult Capture(CapturePaymentRequest capturePaymentRequest)
{
return new CapturePaymentResult { Errors = new[] { "Capture method not supported" } };
}
public decimal GetAdditionalHandlingFee(IList<ShoppingCartItem> cart)
{
return 0;
}
public ProcessPaymentRequest GetPaymentInfo(IFormCollection form)
{
return new ProcessPaymentRequest();
}
public string GetPublicViewComponentName()
{
return "CODBooking";
}
public bool HidePaymentMethod(IList<ShoppingCartItem> cart)
{
return false;
}
public void PostProcessPayment(PostProcessPaymentRequest postProcessPaymentRequest)
{
}
public ProcessPaymentResult ProcessPayment(ProcessPaymentRequest processPaymentRequest)
{
return new ProcessPaymentResult();
}
public ProcessPaymentResult ProcessRecurringPayment(ProcessPaymentRequest processPaymentRequest)
{
return new ProcessPaymentResult();
}
public RefundPaymentResult Refund(RefundPaymentRequest refundPaymentRequest)
{
return new RefundPaymentResult();
}
public IList<string> ValidatePaymentForm(IFormCollection form)
{
return null;
}
public VoidPaymentResult Void(VoidPaymentRequest voidPaymentRequest)
{
return new VoidPaymentResult();
}
#endregion
}
PaymentCODBookingController.cs
code: PaymentCODBookingController.cs
代码:
[AuthorizeAdmin]
[Area(AreaNames.Admin)]
public class PaymentCODBookingController : BasePaymentController
{
private readonly IPermissionService _permissionService;
public PaymentCODBookingController(IPermissionService permissionService)
{
_permissionService = permissionService;
}
}
CODBookingViewComponent.cs
code: CODBookingViewComponent.cs
代码:
[ViewComponent(Name = "CODBooking")]
public class CODBookingViewComponent : NopViewComponent
{
public IViewComponentResult Invoke()
{
return View("~/Plugins/Payments.CODBookingPaymentProcessor/Views/CODBooking.cshtml");
}
}
CODBooking.cshtml
code: CODBooking.cshtml
代码:
@{
Layout = "";
}
<p>TESTING...</p>
The problem is that system is unable to find CODBooking.cshtml
view. 问题是系统无法找到
CODBooking.cshtml
视图。 I tried every possible path format but none worked. 我尝试了所有可能的路径格式,但是没有一种有效。
I checked other plugins and they are also defining the component path just like mine. 我检查了其他插件,它们也像我的一样定义了组件路径。
.cshtml文件名“ Boooking.cshtml”中有一个错字:)仔细观察。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.