Is it really supposed to be like that with PCP in Joomla?
Posted: 07 Mar 2024, 18:35
Cart 5 Beta 37
It seems that the Dispatcher dispatches the events to all Publish PCP (in Plugins) one by one.
Then they all need to check if it's them who need to execute it or false if not?
E.g. like it is (only) in the code for PayPal
So if you have 20 PCP installed and published in Plugins, then they will all be 'executed/checked' until it gets to the one you want (alphabetically if I'm not mistaken).
And if ANY of them uses old code which doesn't have $eventData or don't do the above check, that wrong plugin may try to process it?!
And the fact that you did or did not install them, or unpublished them in Phoca Cart doesn't seem to be relevant?
Seems to me it's a big danger when customers want to update, if the PCP aren't up to do or don't implement that check.
If all that is normal functionality, my next question: if a payment is aborted for whatever reason, the Order stays in Pending ... forever?
There is no way for the customer to try payment again and also the Cart is always emptied even if payment isn't finished (so customer could try again with some other PCP maybe without needing to add all products to the cart again)?
There is also no message indicating that this order will (probably) never be executed? No error message or anything is being stored?
Pending isn't always a dead state, is it? So customer might expect the order will go out of Pending after a while, which in this case it never will?
Not trying to be negative, just trying to understand if it's all 'as expected' or still due to it being a beta and what I should know to create a PCP myself.
Thanks
It seems that the Dispatcher dispatches the events to all Publish PCP (in Plugins) one by one.
Then they all need to check if it's them who need to execute it or false if not?
E.g. like it is (only) in the code for PayPal
Code: Select all
protected $name = 'paypal_standard';
...
function onPCPbeforeProceedToPayment(&$proceed, &$message, $eventData) {
if (!isset($eventData['pluginname']) || isset($eventData['pluginname']) && $eventData['pluginname'] != $this->name) {
return false;
}
And if ANY of them uses old code which doesn't have $eventData or don't do the above check, that wrong plugin may try to process it?!
And the fact that you did or did not install them, or unpublished them in Phoca Cart doesn't seem to be relevant?
Seems to me it's a big danger when customers want to update, if the PCP aren't up to do or don't implement that check.
If all that is normal functionality, my next question: if a payment is aborted for whatever reason, the Order stays in Pending ... forever?
There is no way for the customer to try payment again and also the Cart is always emptied even if payment isn't finished (so customer could try again with some other PCP maybe without needing to add all products to the cart again)?
There is also no message indicating that this order will (probably) never be executed? No error message or anything is being stored?
Pending isn't always a dead state, is it? So customer might expect the order will go out of Pending after a while, which in this case it never will?
Not trying to be negative, just trying to understand if it's all 'as expected' or still due to it being a beta and what I should know to create a PCP myself.
Thanks