Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GetForExchange doesn't accept JSON #63

Closed
Woodehh opened this issue Jun 6, 2019 · 2 comments
Closed

GetForExchange doesn't accept JSON #63

Woodehh opened this issue Jun 6, 2019 · 2 comments

Comments

@Woodehh
Copy link

Woodehh commented Jun 6, 2019

Hey there,

There is a problem with the GetForExchange function. The problem resides in Transaction.php and affects users that selected the option for return json.

A viable solution to the problem would be the following:

public static function getForExchange()
    {
        if (isset($_GET['order_id'])) {
            return self::get($_GET['order_id']);
        }
        if (isset($_POST['order_id'])) {
            return self::get($_POST['order_id']);
        }

        //try to see if it's json
        $input = file_get_contents('php://input');

        $json = json_decode($input,true);
        if (json_last_error() == 0)
            return self::get($json['order_id']);

        $xml = simplexml_load_string($input);
        return self::get($xml->order_id);
    }

I did not have the time to do a PR, but i wanted to let you and others know that this is an issue.

Cheers

@chris-kruining
Copy link
Contributor

#64 would solve this ;)

@Woodehh
Copy link
Author

Woodehh commented Jun 24, 2019

Cheers! Good job.

@IvoWams IvoWams closed this as completed Jul 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants