User is getting an error while the transaction we have checked in our internal code there is an error in HTTP response.
here is the code
Http h = new Http();
HttpRequest req = new HttpRequest();
req.setMethod('POST');
system.debug('TestE'+auto.endPoint__c);
req.setEndpoint(auto.endPoint__c);
req.setHeader('Content-Type','application/json');//Set the Proper Header
req.setHeader('Accept','application/json');
system.debug('Test');
req.setBody(generateJSON());//JSON body as String
system.debug('Test');
HttpResponse res=new HttpResponse();
system.debug('Status 1'+req);
res=h.send(req);
system.debug('Resonpse**********'+res);
system.debug('Test1');
if(res.getStatusCode() == 200)
{
system.debug('Status'+res.getStatusCode());
String responseText = res.getBody();
JsonResponce=res.getBody();
system.debug('res.getBody() '+res.getBody());
if(responseText != null)
{
responseText = responseText.trim().replace('\uFEFF', '');
AuthrorizeNetTransactionResponse jsonResponse = new AuthrorizeNetTransactionResponse();
jsonResponse = AuthrorizeNetTransactionResponse.parse(responseText);
System.debug('**********jsonResponse************'+jsonResponse);
system.debug('AuthoObj'+authoObj);
authoObj.JSON_response__c=responseText;
authoObj.Transaction_Id__c=jsonResponse.transactionResponse.transId;
rCodeChar= jsonResponse.transactionResponse.responseCode;
We are getting an error null pointer on the below line
authoObj.Transaction_Id__c=jsonResponse.transactionResponse.transId;
rCodeChar= jsonResponse.transactionResponse.responseCode;
which means the response is getting
can somebody explain to me why this error is coming
and why jsonResponse.transactionResponse.transId; is geetting null value ?
05-25-2021 03:36 AM