I'm trying to implement an Authorize.net Automated Recurring Billing (ARB) API into my reservation system and am running into an error when trying to autoload the classes. Here is my custom autoload function that's not working:
function aim2_autoload($class) {
if (file_exists('../AIM-2.0/vendor/'.$class.'.php')) {
require '../AIM-2.0/vendor/'.$class.'.php';
}
if (file_exists('../AIM-2.0/vendor/authorizenet/authorizenet/lib/'.$class.'.php')) {
require '../AIM-2.0/vendor/authorizenet/authorizenet/lib/'.$class.'.php';
}
if (file_exists('../AIM-2.0/vendor/authorizenet/authorizenet/lib/shared/'.$class.'.php')) {
require '../AIM-2.0/vendor/authorizenet/authorizenet/lib/shared/'.$class.'.php';
}
if (file_exists('../AIM-2.0/vendor/authorizenet/authorizenet/lib/net/authorize/api/contract/v1/'.$class.'.php')) {
require '../AIM-2.0/vendor/authorizenet/authorizenet/lib/net/authorize/api/contract/v1/'.$class.'.php';
}
if (file_exists('../AIM-2.0/vendor/authorizenet/authorizenet/lib/net/authorize/api/controller/'.$class.'.php')) {
require '../AIM-2.0/vendor/authorizenet/authorizenet/lib/net/authorize/api/controller/'.$class.'.php';
}
}
spl_autoload_register('aim2_autoload');
use net\authorize\api\contract\v1 as AnetAPI;
use net\authorize\api\controller as AnetController;
However, I'm getting the error:
Fatal error: Class 'net\authorize\api\contract\v1\MerchantAuthenticationType' not found in /home/user/example.com/cart/reservation/ajax-submit.php on line 122.
I've tried searching for alternatives of using both use statements inside the autoload function, but found nothing. Any help would be appreciated.