From f1d31dee886620c92257458eb65a7f8984f6a619 Mon Sep 17 00:00:00 2001 From: Mike Gilfillan Date: Tue, 3 Mar 2020 15:45:02 +0000 Subject: [PATCH 1/2] Check the authorization status is "valid" rather than "ready" According to https://tools.ietf.org/html/rfc8555#section-7.1.4 the status of an authorization object can only be "pending", "valid", or "revoked". An order can have a status of "ready" but never an authorization. --- src/Client.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Client.php b/src/Client.php index 5ca07ad..680326d 100644 --- a/src/Client.php +++ b/src/Client.php @@ -286,7 +286,7 @@ class Client sleep(1); } while ($maxAttempts < 0 && $data['status'] == 'pending'); - return (isset($data['status']) && $data['status'] == 'ready'); + return (isset($data['status']) && $data['status'] == 'valid'); } /** From 6b55f256ae5aab69e6157168af3d5ec4765c7dbb Mon Sep 17 00:00:00 2001 From: Mike Gilfillan Date: Tue, 3 Mar 2020 15:56:42 +0000 Subject: [PATCH 2/2] Fix incorrect comparison when auto-retrying authorization Previously only 1 attempt to authorize would be made --- src/Client.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Client.php b/src/Client.php index 680326d..d3d67c0 100644 --- a/src/Client.php +++ b/src/Client.php @@ -284,7 +284,7 @@ class Client ); $data = json_decode((string)$response->getBody(), true); sleep(1); - } while ($maxAttempts < 0 && $data['status'] == 'pending'); + } while ($maxAttempts > 0 && $data['status'] == 'pending'); return (isset($data['status']) && $data['status'] == 'valid'); }