When testing Chargent’s callouts, you can’t use the HttpCalloutMock class in Salesforce because it must be done from within the Chargent managed package/namespace. To create sample responses and ensure that your code behaves appropriately, use the following workaround:
Use the following code to wrap the call to Chargent Webservices:
if(!test.isRunnungTest()){
//code that makes call out here
}
else{
//create a transaction record manually or set whatever values need for your test to continue
}