mariodian/Geary

checkOrderCallback does not work

Closed this issue · 10 comments

The signatures never match. I guess the bug is somewhere in the code that calculates the signature before comparing it.

Can you perhaps try it without this change? 35cb518

Confirm. Does not work checking too. "Signature mismatch", but key/secret correct.

Same here, I get empty $order variable.

I also get PHP Notice: Undefined index: REDIRECT_URL The function falls back to script name then I not really understand this. I would really appreciate a fix.

@mariodian I tried commenting out 35cb518 but it does not work.

I placed a 50$ bounty on this: https://www.bountysource.com/issues/49674995-checkordercallback-does-not-work

First time doing bountysource, I expected a bountysource bot to post this.

Hi @nextgenthemes, @mariodian ,

I have fixed this and created a pull request. I have tested it and everything and the signature checks out.

Please use the following code samples to test it out:

<?php
error_reporting(E_ALL);
require_once('Geary.php');

$gateway_id = '{mycellium_gateway_id}';
$gateway_secret = '{mycellium_gateway_secret}';

$price = 1.00;

$ch = curl_init();

$geary = new Geary($gateway_id, $gateway_secret);

$keychain_id = 1;

if (empty($_GET)) {
  $order = $geary->create_order($price, $keychain_id,'foo');

  if ($order->payment_id) {
      die("<a href=\"https://gateway.gear.mycelium.com/pay/{$order->payment_id}\" target='_blank'>Pay</a> ");
}
} else {
  echo(json_encode($geary->check_order_callback()));
}

P.S: Use testnet coins for easier testing, and also, replace the {mycellium_gateway_id}
and {mycellium_gateway_secret} placeholder with your own, after creating a Mycellium gear account that is testnet enabled;

Thanks,

Alex.

@pennycoders Awesome, thanks. It works! I not tested your example code but my implementation.

Just by looking at it $ch = curl_init(); line seems to have purpose.

Hi @nextgenthemes,

The problem was within the Geary class (Please see my pull request), not the code which was using it. @mariodian, can you please accept my PR so we can close this issue ?

Also, if you need help testing it, maybe I can be of help.

Cheers!

@pennycoders Obviously I know that the problem was in the Geary class. I tested your PR in a WordPress plugin I am working on and it works (as I already said above)

@mariodian was very fast in pulling my last PRs. Its weekend, he will probably not take long to pull it. Enjoy your bounty.

Cool. Glad you got it sorted out! hehe.

@nextgenthemes thanks for the fix. I tested it and it works. Merged.

The funny thing is my original code works on my local machine (I have the same PHP settings on my remote server and it works there too.

Either way, your solution is cleaner.