VirtueMart Forum

VirtueMart 2 + 3 + 4 => Plugins: Payment, Shipment and others => Topic started by: EIF on June 08, 2021, 23:44:52 PM

Title: CardGate plugin - Callback response not working
Post by: EIF on June 08, 2021, 23:44:52 PM
I am trying to use a new payment provider CardGate. The have a plugin for virtuemart. I have installed their plugin and I am able to test some payments, simulation payments.

But when I try to test the callback, there is no callback response received. So Virtuemart is not getting a signal to change the order. it doens't know it is a succes, failure, cancel, etc.

Cardgate says their plugin works, but at my webshops (tried 2 different ones) I can't get it to work. Cardgate are not willing to help me. They say it is wrong at my side.

But I have no clue what could be wrong. I have disabled most of my plugins, tested on a old virtuemart version and the most recent one. Checked the rights of the folders and files, but no succes.

The only thing the say, it could be wrong in the callback proces, which is the following code:

protected function _process_callback() {


defined( 'DS' ) or define( 'DS', DIRECTORY_SEPARATOR );

if ( !class_exists( 'VmConfig' ) ) {
require(VMPATH_ADMIN .DS. 'helpers' . DS . 'config.php');
}

if ( !class_exists( 'vmPSPlugin' ) ) {
require(VMPATH_ADMIN .DS.'plugins'.DS.'vmpsplugin.php');
}

if ( !class_exists( 'VirtueMartCart' ) ) {
require(VMPATH_SITE . DS . 'helpers' . DS . 'cart.php');
}

if ( !class_exists( 'VirtueMartModelOrders' ) ) {
require( VMPATH_SITE. DS . 'models' . DS . 'orders.php' );
}

JPluginHelper::importPlugin( 'vmpayment' );

$dispatcher = JEventDispatcher::getInstance();

$returnValues = $dispatcher->trigger( 'plgVmOnCgpCallback', array( $_POST ) );

return $_POST['transaction_id'] . "." . $_POST['status'];
}


But I don't have a clue what could be wrong.

Can someone help me to figure this out?
Title: Re: CardGate plugin - Callback response not working
Post by: Jörgen on June 09, 2021, 09:26:17 AM
What VM version has cardgate used for development?

Jörgen
Title: Re: CardGate plugin - Callback response not working
Post by: EIF on June 09, 2021, 09:46:10 AM
I am not sure for, but they say their plugin works with Joomla 3.9.23 and Virtuemart 3.8.8. I tried older version and the latest versions: 3.9.27 with 3.8.8.


Do you think there is a compatibilty issue?
Title: Re: CardGate plugin - Callback response not working
Post by: EIF on June 09, 2021, 16:50:42 PM
I have installed the plugin on a different domain, but with the same extensions, same plugin, same servers and even the samen versions.

With this domain it works, but on the other not.

When looking in the server log I see a 500 error: 500   POST /index.php?option=com_cgp&task=callback HTTP/1.0
That url is correct, that is the callback url.

But why it doesn't work here, but does work on the other domain.
Title: Re: CardGate plugin - Callback response not working
Post by: GJC Web Design on June 09, 2021, 22:04:44 PM
Investigate the 500 error

http://forum.virtuemart.net/index.php?topic=117042.0

Title: Re: CardGate plugin - Callback response not working
Post by: EIF on June 09, 2021, 22:48:10 PM
Thank you for the link.

The server log files doesn't say much. But I have turned the error reporting to maximum.

Now I see a more detailed error for the callback response. Its says:

QuoteFatal error: Declaration of TableUsergroups::check($nrOfValues) must be compatible with VmTable::check() in /var/www/vhosts/mydomain.com/domains/mydomain.coml/public_html/administrator/components/com_virtuemart/tables/usergroups.php on line 60

Strangly, my other domain with a virtuemart installation doesn't have this php file. Anyone have an idea why that is? What is this file for?

Do anyone understand what this error means and how I can fix this?

EDIT: When I remove this "usergroups.php" file, the callback receives a response, so it is working now. BUT... can I just remove this file? Where is it for? Does it break something else now?

Title: Re: CardGate plugin - Callback response not working
Post by: jenkinhill on June 10, 2021, 11:24:33 AM
My VM 3.8.x installations do not have administrator/components/com_virtuemart/tables/usergroups.php but it was present in VM2. Is this a site that has been updated from very old versions?

Title: Re: CardGate plugin - Callback response not working
Post by: EIF on June 10, 2021, 14:43:04 PM
Actually it does, a long time ago.

I am not sure if other files and scripts are related to this usergroups.php file. In other words: I don't know if I break something else when deleting it.
Title: Re: CardGate plugin - Callback response not working
Post by: GJC Web Design on June 10, 2021, 15:56:30 PM
its not even in com_virtuemart.2.0.26 so IMHO safe to delete  -- last appears in com_virtuemart.2.0.24
Title: Re: CardGate plugin - Callback response not working
Post by: EIF on June 14, 2021, 16:53:28 PM
That is very old. I've checked the file itself and the first comment copyright tags reffers to year 2010. Hmmzz... very old.

I have deleted the file, which also excists in 3 other folders. Also removed the reference to it from the script.php.