check_order_callback and after payment redirect gives signature mismatch
Closed this issue · 4 comments
When mycelium gear makes the call back and you have an 'after payment redirect url' set, it will give a signature mismatch as mycelium urlencodes the enter you put in as the after payment redirect.
I tried decoding/encoding and signature still mismatches. I think it has something to do with the recent bug in Mycelium Gear.
were you encoding the whole $request_uri or just the part of the string after the after_payment_redirect_to?
In the check_order_callback function I added the following after:
$request_uri = "$request_path?" . rawurldecode(http_build_query($_GET));
if (preg_match('/after_payment_redirect_to=(?P.*?)&/i',$request_uri, $matches)){
$rewrite = urlencode($matches['url']);
$request_uri = str_replace($matches['url'], $rewrite, $request_uri);
}
It does require you to generate a new gateway_secret if you add/remove an after payment url in mycelium gear, but it will result in a correct signature.
Your regex gives me the following error:
Warning: preg_match(): Compilation failed: unrecognized character after (?P at offset 29 in
Anyway, I solved it by directly encoding the $_GET['after_payment_redirect_to'] before I process it in $request_uri 35cb518
Thank you!
lol forgot to put name identifier in with the regex match when I typed it in here..