cancel
Showing results for 
Search instead for 
Did you mean: 

Fatal error: Class 'Goetas\Xsd\XsdToPhp\Jms\Handler\BaseTypesHandler' not found

Here is the situation:

 

I'm trying to build a custom report with the API for my client.  I do not have SSH access, so I'm trying to load the SDK over FTP.  

 

Initially I tried just loading the SDK files from github, but could not get that to work.  Finally, I loaded composer on a different server, installed the SDK with composer, copied down the 'vendor' directory and loaded that into my project.

 

Now, I get this error:

 

Fatal error: Class 'Goetas\Xsd\XsdToPhp\Jms\Handler\BaseTypesHandler' not found in /path/to/project/vendor/authorizenet/authorizenet/lib/net/authorize/api/controller/base/ApiOperationBase.php on line 79

According to recordnotfound.com, there was an open issue for this exact problem but it has been closed.  However, I can't find anything on how the issue was resolved.

 

EDIT:  Found the closed ticket on github.  LINK

 

Just for fun, here is the code I'm trying to run:

 

<?php
error_reporting(-1); ini_set('display_errors', 'On');
date_default_timezone_set('America/Chicago');

require 'vendor/autoload.php';
use net\authorize\api\contract\v1 as AnetAPI;
use net\authorize\api\controller as AnetController; 

$start_datetime 	= "";
$end_datetime 		= "";
$start 			= '2016-05-01 00:00:00';
$end 			= '2016-05-31 00:00:00';

function create_authnet_timestamp($userdate){
	$stamp 		= strtotime($userdate);
	$date 		= date("Y-m-d", $stamp);
	$time 		= date("H:i:s", $stamp);
	$datetime 	= $date."T".$time."Z";
	return $datetime;
}

if($start != '' && $start != NULL && is_real_date($start) ){ 
	$start_datetime = create_authnet_timestamp($start);
}

if($end != '' 	&& $end != NULL   && is_real_date($end) ){ 
	$end_datetime 	= create_authnet_timestamp($end);
}

function getSettledBatchList($startDate, $endDate) {
	$api_id 	= "MY_API_ID";
	$account_key 	= "MY_TRANSACTION_ID";
	$batch_array 	= array();
	$start_dt 	= new DateTime($startDate);
	$end_dt 	= new DateTime($endDate);

	$merchAuth 	= new AnetAPI\MerchantAuthenticationType();
	$merchAuth->setName($api_id);
	$merchAuth->setTransactionKey($account_key);

	$request	= new AnetAPI\GetSettledBatchListRequest();
	$request->setMerchantAuthentication($merchAuth);
	$request->setIncludeStatistics(true);
	$request->setFirstSettlementDate($start_dt);
	$request->setLastSettlementDate($end_dt);

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

	if(($response != null) && ($response->getMessages()->getResultCode() == "Ok")){
		return $response;
	}else{
	    $errorMessages = $response->getMessages()->getMessage();
	    echo "Response : " . $errorMessages[0]->getCode() . "  " .$errorMessages[0]->getText() . "\n";
	    return false;
	}
}
$api_response 		= getSettledBatchList($start_datetime, $end_datetime);
var_dump($api_response); 

?>

 

 

I'm starting to pull my hair out a little.  Can anyone help?

 

phpjayhawk
Member
11 REPLIES 11

I am having this same problem and have tried many different combos.

 

Phpjayhawk, your post is as close to a complete description as I have seen to get this to work. I have put the lines from the temporary commit in both my composer.json and the authorize.net composer.json but I am still getting a failure with:

 

"The requested package jms/serializer xsd2php-dev as 0.18.0 exists as jms/serializer[0.11.0, 0.12.0, 0.13.0, 0.14.0, 0.15.0, 0.16.0, 1.0.0, 1.1.0, dev-master, 1.1.x-dev] but these are rejected by your constraint."

 

Can you post both your composer.json files please? I must be doing something wrong.

 

 

Thank you,

-Kaleb Clark

I finally got this resolved.

 

What I had overlooked is that you must install authorize.net php SDK exactly as it is stated on the github page. And dont forget the goetas serializer repository.

 

THEN replace the goetas xsd2php and xsd-reader lines in your composer.json file and the authorize.net composer file. Run a composer update and it should work. 

 

My problem was that I had too many versions of stuff hanging out. I finally removed everything and started over. I was just putting the new goetas lines in the composer.json files and trying to do a composer install. You have to do original install, then update with new lines.

 

Thanks all,

-Kaleb