Post by X-Rayden » Sun Apr 20, 2008 9:24 pm

i have problem with a callback procedure of a payment method.

the problem is, that the callback will not accept "get" variable.

if they tried something like "index.php?controler=...." will not work....

i tried to make a copy of index.php and "force" the variable, but it didnt work, do you have some idea ?

i'd like to make something like a /iscallback.php so it will work...

User avatar
New member

Posts

Joined
Sat Jan 12, 2008 3:54 am
Location - Québec, Qc, Canada

Post by bruce » Thu Apr 24, 2008 8:16 pm

You should be able to make this work.

I did a little test by modifying the default paypal callback function and found that it does accept a "get" variable

Code: Select all

	function callback() 
    {
        if ($this->request->has('user_id', 'get'))
        {
            die($this->request->get('user_id', 'get'));
        }
     ...   
  
The url for my test was generated by the following statement...

Code: Select all

$this->url->ssl('checkout_process', 'callback', array('payment' => 'paypal','user_id' => 'freddo'))
and looks like...

Code: Select all

http://localhost/store/index.php?controller=checkout_process&action=callback&payment=paypal&user_id=freddo
The result of pasting that url into my browser is exactly what you would expect. The value "freddo" is printed and code execution stops.

Active Member

Posts

Joined
Wed Dec 12, 2007 2:26 pm

Post by ogun » Thu Aug 14, 2008 9:59 am

could you give some explanation on how opencart handles gets?

i was confused by this bit:
bruce wrote: The url for my test was generated by the following statement...

Code: Select all

$this->url->ssl('checkout_process', 'callback', array('payment' => 'paypal','user_id' => 'freddo'))
and looks like...

Code: Select all

http://localhost/store/index.php?controller=checkout_process&action=callback&payment=paypal&user_id=freddo
was the generation part important/happening as part of something else? does the url have to be processed and handed over from another file?

been modifying the protx contribution to handle the response from protx - which comes in as a get variable called 'crypt' (which will then need to be decrypted by the protx payment module before the details can be processed). have got things set up well enough as a demo script/class to test its functions, but now that i've started plumbing it into opencart, i'm running out of steam.

Code: Select all

http://www.mywebsite.com/opencart/index.php?controller=checkout_process&payment=protx&action=callback&crypt=iwiJVNlAxEOPTkM...NIBiHwYw==
...causes a 'page not found' error - but removing the 'crypt' from the url produces the error i'd expect to see (which is the one from my callback function complaining that 'crypt' is not set).

think i'm missing something fundamental in how opencart handles urls/gets rather than running into a specific problem with the module.
Last edited by ogun on Thu Aug 14, 2008 10:02 am, edited 1 time in total.

Active Member

Posts

Joined
Tue Aug 14, 2007 6:04 am

Post by bruce » Thu Aug 14, 2008 10:20 am

Is the crypt value url encoded? It should be.

Active Member

Posts

Joined
Wed Dec 12, 2007 2:26 pm

Post by ogun » Thu Aug 14, 2008 10:32 am

it is. i chopped it down in that example because it's a very long string.

Active Member

Posts

Joined
Tue Aug 14, 2007 6:04 am

Post by bruce » Thu Aug 14, 2008 10:55 am

I think you are correct with your interpretation of the problem. I cannot reproduce it without a string of the same length as your real crypt variable.

How long is it?

Active Member

Posts

Joined
Wed Dec 12, 2007 2:26 pm

Post by ogun » Thu Aug 14, 2008 11:10 am

usually a few hundred characters - but i've tried it with crypt=test and it still causes the 'page cannot be found' error, as does adding cat=dog or anything else.

seems like it's failing the equivalent of a whitelist somewhere, e.g. expecting controller, payment and action but nothing else.
i haven't changed any core files, just ones in the protx module - should i be editing something to support the new variable? did you have to change any files beyond paypal.php to get your example to work?

Active Member

Posts

Joined
Tue Aug 14, 2007 6:04 am

Post by ogun » Thu Aug 14, 2008 9:19 pm

bah, it was my own silly fault.

the last time i looked at opencart, i started to make a few changes to router.php specifically for the protx crypt (the crypt can contain forward slashes) and never finished them. that's what was causing the problem. must remember to diff before doing anything else...

/slaps forehead.

Active Member

Posts

Joined
Tue Aug 14, 2007 6:04 am

Post by bruce » Thu Aug 14, 2008 9:20 pm

heh heh... bring it around, I will slap it too  :D

Active Member

Posts

Joined
Wed Dec 12, 2007 2:26 pm
Who is online

Users browsing this forum: No registered users and 2 guests