This manual is being depreciated. Much of the information here is out of date.

The new Jomres Documentation, updated in 2022, can be found at Jomres.net/documentation.

Debugging payment gateways

Introduction

It's not possible to tell  you how to actually debug an individual payment gateway, as each one is different, however we will tell you how to collect information to go about debugging a gateway.

The first thing you need to know, is that when a booking is created in Jomres, it's not actually inserted as a completed booking until after the gateway has confirmed that payment was successful, this is done when the task is set to completebk (so, in the url you'd see something like index.php?option=com_jomres&task=completebk). At this point your 00610 gateway file is called (for example, with the Paypal gateway that script's called j00610paypal.class.php). This is the script that decides if the callback from the gateway is valid, then compares various bits of information to check that the correct amount was paid. If it's valid then the insertInternetBooking function is called and the booking is inserted.

As the callbacks from the gateways often happen in the background (i.e. you can't see any output on the page) it is difficult to actually tell, from the page you're on, whether or not the booking was inserted successfully. This isn't a major problem, as there are tools within Jomres that'll help you to see when the gateway service has called you back.

Note : this doc assumes that your "Site Configuration Advanced site config" option is set to Yes.

Enabling logging

The first thing you need to do is log into the administrator area of your Jomres installation, and go to Components -> Jomres. In the menu on the left hand side, under the section "Main" you'll see the option "Site Configuration". Click on this, and you are offered a series of tabs. One of those tabs is called Site Configuration - Debugging tab. Click on that.

Here you can enable different types of logging. The three we are interested in are Gateway logs, Request log and System log. Which you should enable depends on what the nature of your problem is.

Gateway logs are typically used by gateways themselves to record the information that was received, and what decisions they made based on that information. If you think that a gateway's not allowed a booking to be inserted because some data was not validated correctly, then this is the log you should be analysing.
Request logs will request all http requests to Jomres. This type of logging will collect a lot of information which might be difficult to analyse due to it's sheer quantity, but if you think that a gateway's not calling your Jomres installation back due to a faulty callback url, this log is the best way to check for that.
System logs are typically used by the Jomres Access control system to log if a user was denied access to a script based on the Access Control feature's settings. If you suspect that the access control of Jomres is set incorrectly, this is a good way to check for that.

To start with, you probably just want to enable the Gateway logs, so set that option to Yes and click Save.

Viewing log files

Now you are ready to view the log files. Again, in the menu on the left hand side you will see a section called "Developer tools", click on that to expand the options. One of those is Available logs, click on it.

This page might be empty, so you'll need to do a test booking, running through a payment at least once, to create a log file. Do that, then reload the page. You should now see two links : Gateway and Gateway noupdate.

The two links will both access the gateway log. Gateway will show the last 10 messages generated by the gateway log, and will run an ajax query in the background which will update the page with new log messages as they're made, whereas the "noupdate" link will provide you with more logs but will not update as new ones are generated.

You can now look at these logs to see if there is information in those logs that will help you to understand what is happening when the gateway attempts (or otherwise) to contact your installation.


You're a developer and would like to add your own logging to a gateway script

If you are a developer, you may well need to log gateway activity to ensure that things are happening as expected. The easiest way to do this is to use the following function :

gateway_log("My text goes here");

which will add text to your gateway log. You can then use the "Gateway" log to analyse the results of your test bookings.