Jump to content

Process() or Call() for Payment Gateways?


Guillaume

Recommended Posts

In some payment gateways, the function call() seem to be used to process the payment, while in some others it seems to be the function process().
Looking at cubecart.class.php, I found the following (rom line 278 onwards):

                            if (file_exists($class_file)) {
                                include $class_file;
                                $gateway = new Gateway($GLOBALS['config']->get($module));
                                $command = (isset($_GET['cmd'])) ? strtolower($_GET['cmd']) : null;
                                if (!empty($command)) {
                                    # if (method_exists($gateway, $command)) $gateway->{$command}();
                                    switch ($_GET['cmd']) {
                                    case 'call':
                                        if (method_exists($gateway, 'call')) {
                                            $gateway->call();
                                        }
                                        exit;
                                        break;
                                    case 'process':
                                        if (method_exists($gateway, 'process')) {
                                            $gateway->process();
                                        }
                                        break;
                                    }
                                }
                            }
                            
My interpretation of this is that there is a variable $_GET['cmd'] depending on which either the function process() is used, or the function call(). However, I couldn't find much information about this variable, studying the code. I would apprecate if anyone could enlight me on what exactly it does, as this would make my understanding clearer of when exactly each of these functions are called.
What I am especially after is, when exactly each of these functions are called. Is call() used when the payment providers gets back to the merchant? And process() used when the payment has been accepted (i.e. independently of the user closing the window)? What puzzles me is that this piece of code is in a function loadpage(), which implies that it is tighted to the UI experience.

Best regards,
Guillaume

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...