View Issue Details

IDProjectCategoryView StatusLast Update
0007168module PayPalmodule PayPal - subpublic2020-09-22 10:04
Reportermichael_keiluweit Assigned To 
PrioritynormalSeverityfeatureReproducibilityalways
Status resolvedResolutionfixed 
Product Version6.2.0 
Fixed in VersionPatch for 5.3 
Summary0007168: The method Caller::validateResponse only catches ACK failures, but not internal service errors.
DescriptionThe PayPal module has the method \OxidEsales\PayPalModule\Core\Caller::validateResponse to check if the server responded with an "Failure" for the array key "ACK".
Not only that there are more situations which could (should/must?) checked and documented (https://developer.paypal.com/docs/nvp-soap-api/NVPAPIOverview/#respond-to-an-nvp-response), but there could be the case the server sends a INTERNAL_SERVICE_ERROR or SERVICE_UNAVAILABLE (https://developer.paypal.com/docs/api/reference/api-responses/#http-status-codes).

Writing the other error cases to the log are useful for the developers to trace down what happend in most of the cases.
Also it should be considered to mark the payment of the order as not paid yet, as the PayPal Service returned an error. The transaction should be checked manually.

Examples:

Response from PayPal [2020-08-06 13:37:18] SESS ID: $sid array ( '{____"name":_"INTERNAL_SERVICE_ERROR",____"message":_"An_internal_service_error_has_occurred",____"debugId":_"$debugId",____"links":_' => array ( '{ "href": "https://developer.paypal.com/docs/api/overview/#error", "rel": "information_link" }' => '', ),)
 
Response from PayPal [2020-07-15 17:55:04] SESS ID: $sid array (  '{____"name":_"SERVICE_UNAVAILABLE",____"message":_"Service_Unavailable",____"debugId":_"$debugId",____"links":_' =>   array (    '{        "href": "https://developer.paypal.com/docs/api/overview/#error",        "rel": "information_link"    }' => '',  ),)



The method I talked about:
protected function validateResponse($response)
{
    if ('Failure' == $response['ACK']) {
            $exception = oxNew(PayPalResponseException::class, $response['L_LONGMESSAGE0'], $response['L_ERRORCODE0']);
        throw $exception;
    }
}
https://github.com/OXID-eSales/paypal/blob/master/Core/Caller.php#L170
TagsNo tags attached.

Activities

There are no notes attached to this issue.