`completePurchase()` additional security features
See Issue #12 for further details.
Summary of the changes, possibly breaking to some merchant sites:
- The
completePurchase()
andcompleteAuthorize()
methods now require the originaltransactionId
to be set. If the transaction being returned with the user does not have atransactionId
matching thetransactionId
expected, thenisSuccessful()
will returnfalse
regardless of status of the transaction behind it. - The
completePurchase()
method returns aRequest
message. To inspect the transaction result details, you mustsend()
this request to get aResponse
message. Previously theRequest
andResponse
were shared and all transaction results could be inspected in both. The README documentation has been updated to show how this works.
In summary completePurchase()
now works like this:
$completeRequest = $gateway->completePurhcase([
'secret' -> $signingSecret,
'transactionId' = $originalTransactionId,
]);
$completeResponse = $completeRequest->send();
$success = $completeResponse->isSuccessful();
If your merchant site does not include [at least] the 'transactionId' or does not send()
the request to get a response, then it must do from version 3.1.0 onwards.