Authorize.net. Transaction Response Result Code = "Error" but ErrorCode and ErrorText are null

62 views Asked by At

I had Transaction Response Result Code = "Error" but I don't know what the error was because all other error parameters are null.

This is what I get:

{
    "response": true,
    "getResultCode": "Error",
    "getMessages": null,
    "getResponseCode": null,
    "getAuthCode": null,
    "getTransId": null,
    "messageCode": null,
    "msgDescription": null,
    "transactionResponseErrors": null,
    "getErrorCode": null,
    "getErrorText": null
}

The code that constructs the above json is this one:

        $controller = new AnetController\CreateTransactionController($req);
        $response = $controller->executeWithApiResponse(\net\authorize\api\constants\ANetEnvironment::SANDBOX);

        if ($response != null) {
                $tresp = $response->getTransactionResponse();
                if ($tresp != null && $tresp->getMessages() != null) {
                    if ($tresp != null){
                        $tresponse = $tresp;
                        $result1 = array(
                            'response' => ($response != null)? true: false,
                            'getResultCode' => $response->getMessages()->getResultCode(),
                            'getMessages' => ($response->getTransactionResponse()->getMessages() != null)? array(
                                'msjCode' => $response->getTransactionResponse()->getMessages()[0]->getCode(),
                                'msjDesc' => $response->getTransactionResponse()->getMessages()[0]->getDescription()
                            ): null,
                            'getResponseCode' => ($tresponse->getResponseCode() != null)? $tresponse->getResponseCode(): null,
                            'getAuthCode' => ($tresponse->getAuthCode() != null)? $tresponse->getAuthCode(): null,
                            'getTransId' => ($tresponse->getTransId() != null)? $tresponse->getTransId(): null,
                            'messageCode' => ($tresponse->getMessages() != null)? $tresponse->getMessages()[0]->getCode(): null,
                            'msgDescription' => ($tresponse->getMessages() != null)? $tresponse->getMessages()[0]->getDescription(): null,
                            'transactionResponseErrors' => ($tresponse->getErrors() != null)? array(
                                'errorText' => $tresponse->getErrors()[0]->getErrorText(),
                                'errorCode' => $tresponse->getErrors()[0]->getErrorCode()
                            ): null,
                            'getErrorCode' => ($tresponse->getErrors() != null)?  $tresponse->getErrors()[0]->getErrorCode(): null,
                            'getErrorText' => ($tresponse->getErrors() != null)? $tresponse->getErrors()[0]->getErrorText(): null
                        );
                    }
             }
      }

Anyone has a clue of what is happening?

0

There are 0 answers