By Artem Lebsak on Monday, 10 January 2022
Posted in General Issues
Likes 0
Views 715
Votes 0
Hello,

I am testing my custom payment gateway and this URL

index.php?option=com_payplans&view=payment&task=complete&gateway=mygateway&action=error

gives me an error

Call to undefined method PayPlansViewPayment::setTemplate()


Here is my code for onPayplansPaymentAfter event


public function onPayplansPaymentAfter(PPPayment $payment, &$action, &$data, $controller)
{
$logs = PPLog::getLog($payment, PPLogger::LEVEL_ERROR);
$record = array_pop($logs);

if ($record && !empty($record))
{
$action = 'error';
}

return parent::onPayplansPaymentAfter($payment, $action, $data, $controller);
}


The problem is that you are passing $this (View object) on dispatch of the onPayplansPaymentAfter event in Payment view and onPayplansPaymentAfter is expecting controller:


// Trigger apps, so they can perform post payment work
$args = array($payment, &$action, &$post, $this);
$html = PP::event()->trigger('onPayplansPaymentAfter', $args, 'payment', $payment);


Best regards,
Artem
Hey Artem,

We will include this fix in our coming release.
For now to fix this issue refer following.

1. Find the attached file and replace it with the below-mentioned file paths.
root\administrator\components\com_payplans\includes\app\abstract\payment.php

2. Find attached files and add this to root\components\com_payplans\themes\wireframe\payment\error\ path
root\components\com_payplans\themes\wireframe\payment\error\default.php
root\components\com_payplans\themes\wireframe\payment\error\default.js


Do the changes and take a look at this issue again.
Update us if still issue persists.
·
Monday, 10 January 2022 17:11
·
0 Likes
·
0 Votes
·
0 Comments
·
Hey Artem,

I am really sorry for the delayed response.

If you want us to check your custom gateway code, I am really sorry but unfortunately, we cannot accommodate your request currently as it is beyond our support scope's policy as outlined in https://stackideas.com/support

You can take references from any existing payment method code to know the working.

Update us if you will have any queries.
·
Monday, 10 January 2022 13:23
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi Manisha,

As you can see I am using your code for onPayplansPaymentAfter event, calling parent onPayplansPaymentAfter from my plugin.

And your parent::onPayplansPaymentAfter does not process this event normally for action 'error', because you are passing View instead of Controller.

That is your code from PayPlans Payment View:

// Trigger apps, so they can perform post payment work
$args = array($payment, &$action, &$post, $this);
$html = PP::event()->trigger('onPayplansPaymentAfter', $args, 'payment', $payment);


Check your abstract class PPAppPayment and onPayplansPaymentAfter function there. This line is the cause of the problem:

$controller->setTemplate('complete_'.$action);


Best regards,
Artem
·
Monday, 10 January 2022 15:45
·
0 Likes
·
0 Votes
·
0 Comments
·
Hey Artem,

I am able to replicate this issue now. Earlier this issue not replicated at my end somehow.
Can you update me with your site backend & FTP details, I'll apply the fix for you.

Looking forward to your response.
·
Monday, 10 January 2022 16:27
·
0 Likes
·
0 Votes
·
0 Comments
·
Can you write down it here? I am quite experienced in development and can apply it
If no I will wait for a fix in your next PayPlans version.

Best regards,
Artem
·
Monday, 10 January 2022 16:37
·
0 Likes
·
0 Votes
·
0 Comments
·
Thank you. I will give it a try and let you know.
·
Monday, 10 January 2022 17:31
·
0 Likes
·
0 Votes
·
0 Comments
·
Hey Artem,

You're most welcome.
Keep us updated if you face any issues.

Thank you for understanding!
·
Monday, 10 January 2022 17:32
·
0 Likes
·
0 Votes
·
0 Comments
·
Thanks it it is working well now.
·
Wednesday, 12 January 2022 20:30
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi there,

You are most welcome. Glad to hear that your issue has been resolved now.

Just for your information, I have locked and marked this thread as resolved to avoid confusion in the future. Please start a new thread if you have any other issues in the future so it will be easier for us to manage your inquiries.

Thanks for understanding.
·
Wednesday, 12 January 2022 21:01
·
0 Likes
·
0 Votes
·
0 Comments
·
View Full Post