For this example, I'm going to use the Cheque / Money Order payment plugin but could as well applicable to other plugins.
The payment instructions could be found during Checkout (before the Order is placed). However, at this point, customers won't be writing the details down thinking that they could access the info sometime later after the order is placed.
At the Order Details page (after the Order is placed), there's no way the customers could access the payment instructions anymore. I know I could add a FAQ page or info page with the payment instructions but that would not be intuitive anymore and customers won't even think to look for pages like that in the first place.
It would be better if the plugin could include a ViewComponent on the Order Details page. This way the plugin has more control over what to display. It could even include javascript files or css stylesheets in the View of the ViewComponent.
Note: Although in the screenshot above, PartialView is mentioned, but a ViewComponent is more suitable and inline with how nopCommerce works.
Let's take another example, the PayPal Standard payment plugin.
Here, Nop.Web is only displaying one button which probably good enough for PayPal. It is presumtuous to assume that this also applies to every other payment gateways out there. Other banks could require some actions to be taken first before being redirected to their payment authorisation page thus might require several additional buttons to be displayed. Or to have a hyperlink when clicked would display the "Terms & Conditions" of using the bank's service.
The correct way would be as mentioned, give more control to the payment plugin to include a ViewComponent to display whatever that the plugin deem necessary instead of having Nop.Web catering for every single possible scenario.
We could extend this and introduce two more methods: GetOrderDetailsViewComponentName() which is the ViewComponent on the Order Details page explained above, and GetCheckoutCompletedViewComponentName() which is the ViewComponent to be displayed after checkout is completed.
GetCheckoutCompletedViewComponentName() is useful for manual/offline Payment plugins to attach a reminder to customer after the checkout process is completed.
For this example, I'm going to use the Cheque / Money Order payment plugin but could as well applicable to other plugins.
The payment instructions could be found during Checkout (before the Order is placed). However, at this point, customers won't be writing the details down thinking that they could access the info sometime later after the order is placed.
At the Order Details page (after the Order is placed), there's no way the customers could access the payment instructions anymore. I know I could add a FAQ page or info page with the payment instructions but that would not be intuitive anymore and customers won't even think to look for pages like that in the first place.
It would be better if the plugin could include a
ViewComponent
on the Order Details page. This way the plugin has more control over what to display. It could even include javascript files or css stylesheets in theView
of theViewComponent
. Note: Although in the screenshot above,PartialView
is mentioned, but aViewComponent
is more suitable and inline with how nopCommerce works.Let's take another example, the PayPal Standard payment plugin.
The code to display the "Retry Payment" button is controlled by
Nop.Web
instead of by the plugin. https://github.com/nopSolutions/nopCommerce/blob/e19fe8c85c7ca2b7f44b989ce1792fe1a517fc7f/src/Presentation/Nop.Web/Views/Order/Details.cshtml#L203-L214Here,
Nop.Web
is only displaying one button which probably good enough for PayPal. It is presumtuous to assume that this also applies to every other payment gateways out there. Other banks could require some actions to be taken first before being redirected to their payment authorisation page thus might require several additional buttons to be displayed. Or to have a hyperlink when clicked would display the "Terms & Conditions" of using the bank's service.The correct way would be as mentioned, give more control to the payment plugin to include a
ViewComponent
to display whatever that the plugin deem necessary instead of havingNop.Web
catering for every single possible scenario.Currently, in
IPaymentMethod
interface which is implemented by Payment plugins, there's a method calledGetPublicViewComponentName()
which is used to display theViewComponent
of the payment instructions/info as shown in the first screenshot. https://github.com/nopSolutions/nopCommerce/blob/12dd4825dfb56bbc64e192cd35d25e3205427646/src/Libraries/Nop.Services/Payments/IPaymentMethod.cs#L133-L137We could extend this and introduce two more methods:
GetOrderDetailsViewComponentName()
which is theViewComponent
on the Order Details page explained above, andGetCheckoutCompletedViewComponentName()
which is theViewComponent
to be displayed after checkout is completed.GetCheckoutCompletedViewComponentName()
is useful for manual/offline Payment plugins to attach a reminder to customer after the checkout process is completed.