Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

404 error #409

Open
fullstact69 opened this issue Mar 11, 2021 · 4 comments
Open

404 error #409

fullstact69 opened this issue Mar 11, 2021 · 4 comments

Comments

@fullstact69
Copy link

I tried to use php sdk without composer like this way

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

But when I use
$merchantAuthentication = new AnetAPI\MerchantAuthenticationType();
I am getting 404 error. How can I resolve it?

@gregorysandoval
Copy link

I find adding it to the namespaces explicitly fixes this, e.g.:
use net\authorize\api\contract\v1 as AnetAPI;
use net\authorize\api\contract\v1\MerchantAuthenticationType;
use net\authorize\api\controller as AnetController;

I haven't had time to dig into the class or SDK and figure out exactly why yet. May also affect ARB types, not sure.

Good luck!

@fullstact69
Copy link
Author

I tried to use
use net\authorize\api\contract\v1\MerchantAuthenticationType;
But still same error 404 page not found.
How to resolve it?

@gregorysandoval
Copy link

gregorysandoval commented Mar 12, 2021

I'm just a dev trying to help you out here. I mis-read your original issue, the advice I gave relates to if your IDE is showing a "unknown type" error for the merchauth object.

For the 3 apps I have set up using the SDK, my structure looks like this:

|app-root|
-|authnet|
-- autoload.php (this file)
-- classmap.php
-- LICENSE
-- [lib]
-- [vendor]
|web-root|

The autoload, classmap, LICENSE files and lib directory are copied from a clone of the SDK repo as of v2.0.0 (when external package dependencies were removed). The vendor directory was creating by using composer for earlier installs (pre v2.0.0.0) and it has separate autoloader files that composer installed.

If you are installing without composer, I see in the installation instructions it says:

Custom SPL Autoloader
Alternatively, we provide a custom SPL autoloader for you to reference from within your PHP file:

require 'path/to/anet_php_sdk/autoload.php';
This autoloader still requires the vendor directory and all of its dependencies to exist. However, this is a possible solution for cases where composer can't be run on a given system. You can run composer locally or on another system to build the directory, then copy the vendor directory to the desired system."

That would seem to indicate to me that you are missing files that composer installs in the vendor directory. I'd suggest installing with composer to recreate that file structure, then moving that to your server.

Also note that, at least in my example, the SDK lib and vendor directories are outside of the web root. So in my files when I require the "vendor/autoload.php" that path is from the server root, not the web root.

Good luck!

@fullstact69
Copy link
Author

I installed with composer to recreate that file structure, and I copied it to my server.
So vendor directory was created. But still same 404 error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants