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
1 ACCEPTED SOLUTION

Accepted Solutions

Hey Everybody, in case you missed it, there has been a patch to the composer.json released that solves this issue.

 

Link To Github Commit

 

So update your composer.json with the new lines, run "composer update" and you're good to go.

View solution in original post

11 REPLIES 11

Same for me. I followed the steps judiciously, use composer, update with no errors but then "PHP Fatal error:  Class 'Goetas\Xsd\XsdToPhp\Jms\Handler\BaseTypesHandler' not found in /var/www/html... /lib/net/authorize/api/controller/base/ApiOperationBase.php on line 82 ", somebody have any clue how to address this.?

arnaldof
Member

IF you look in the classmap

 

 'Goetas\Xsd\XsdToPhp\Jms\Handler\BaseTypesHandler' => $vendorDir . '/goetas/xsd2php/lib/Jms/Handler/BaseTypesHandler.php',
   39      'Goetas\Xsd\XsdToPhp\Jms\Handler\XmlSchemaDateHandler' => $vendorDir . '/goetas/xsd2php/lib/Jms/Handler/XmlSchemaDateHandler.php',

 

There's files missing from goetas/xsd2php package.

 

I tried googling the missing files and couldn't find it...

I've just begun work on converting to this API, and I am also stymied by this error.

Fiala1904
Member

Hey Everybody, in case you missed it, there has been a patch to the composer.json released that solves this issue.

 

Link To Github Commit

 

So update your composer.json with the new lines, run "composer update" and you're good to go.

I followed these intstructions but it did not fix the problem for me. I also attempted to delete the goetas/xsd2php folder and re-run update and it did not pull in the needed files. Is there a special setting in composer that I need to have to get this to work? Or any other suggestions? This is pretty critical to a project I am working on. I hope the developers at Authorize.Net will fix this ASAP.

Hey BVB,

 

Can you post the contents of your composer.json file?  I'm guessing that's where the issue is.  That was where my problem was.

I was able to fix this. I made a mistake when trying to fix this I attempted to edit the authorizenet package's composer.json file. Part of the instructions for installing this package (https://github.com/AuthorizeNet/sdk-php) are to put that line in the composer.json file of your app. So, essentially that line is in two spots if you did it the way I did - in your own composer.json and the authorizenet package's composer.json. This worked for me after I updated the referenced line in both composer.json files.

Thanks for the quick response phpjayhawk! Also, in my post above that link does not work because it attempted to include the ) at the end of the URL. Here is a working link: https://github.com/AuthorizeNet/sdk-php

No problem at all.  Glad you got it worked out!