Jump to content

Process() or Call() for Payment Gateways?


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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...