cancel
Showing results for 
Search instead for 
Did you mean: 

Composer issue at install

Not sure what is going on but composer isn't happy with the composer.json file. It is currently:

 

{
"name": "authorizenet/authorizenet",
"type": "library",
"description": "Official PHP SDK for Authorize.Net",
"keywords": ["authorizenet", "authorize.net", "payment", "ecommerce"],
"license": "proprietary",
"homepage": "http://developer.authorize.net",
"require": {
"php": ">=5.6",
"ext-curl": "*",
"ext-json": "*",
"ext-simplexml": "*",
"ext-xmlwriter": "*",
"goetas-webservices/xsd2php-runtime":"^0.2.2",
"authorizenet/authorizenet": "~1.9"
},
"require-dev": {
"phpunit/phpunit": "~4.0",
"phpmd/phpmd": "~2.0"
},
"autoload": {
"classmap": ["lib"]
},
"autoload-dev": {
"classmap": ["tests"]
}
}

 

Error message is:

 

Your requirements could not be resolved to an installable set of packages.

Problem 1
- The requested package authorizenet/authorizenet No version set (parsed as 1.0.0) is satisfiable by authorizenet/authorizenet[No version set (parsed as 1.0.0)] but these conflict with your requirements or minimum-stability.

 

Any suggestions would be greatly appreciated.

 

Thanks,

Al

 

ahawtin2018
Member
1 ACCEPTED SOLUTION

Accepted Solutions

Thanks for the hint Ashu.

 

I am using Drupal which uses the library API. I had to dig into the module code to redirect the library reference from the library root directory to the vendor subdirectory. Just completed a successful test transaction so over this initial hurdle. Appreciate your help.

 

Al

View solution in original post

7 REPLIES 7

Hi @ahawtin2018


The error I see in the composer used above is that you have included dependency on "authorizenet/authorizenet" in your require tag, when the name provided is also "authorizenet/authorizent".
In other words, Authorize.Net package cannot depend on itself .

If your goal is to use a specific version of authorizenet sdk, then you can use a composer similar to the sample code composer :

 

{
  "require": {
  "php": ">=5.6",
  "ext-curl": "*",
  "phpunit/phpunit": "~4.8||~6.0",
  "authorizenet/authorizenet": ">=1.9.3 || <2.0"
  },
  "autoload": {
    "classmap": ["constants"]
  }
}

 

 Please reply if that works, or are you looking for some thing else?

ashu
Authorize.Net Developer Authorize.Net Developer
Authorize.Net Developer

Thank you Ashu,

 

I updated composer.json and reran. I think we are getting close but I still encountered an error:

 

Generating autoload files


[RuntimeException]
Could not scan for classes inside "constants" which does not appear to be a file nor a folder


update [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--lock] [--no-custom-installers] [--no-autoloader] [--no-scripts] [--no-progress] [--with-dependencies] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--ignore-platform-reqs] [--prefer-stable] [--prefer-lowest] [-i|--interactive] [--root-reqs] [--] [<packages>]...

 

Any suggestions as to what might be causing this problem?

 

Regards

Al

ahawtin2018
Member

Ashu/AI, I was having the same problem, but taking just the line

 

"authorizenet/authorizenet": ">=1.9.3 || <2.0",

 

from Ashu's suggestion and putting that in the authorize.net included composer.json allowed this to execute without error.

 

However, now that I try and process a transaction in a previoulsy functionalauthorize.net install, I get

 

Fatal error: Class 'JMS\Serializer\Handler\StdClassHandler' not found in /var/www/html/.../authorize.net/vendor/jms/serializer/src/JMS/Serializer/SerializerBuilder.php on line 162

 

Any idea?

Wow - that is great to hear (in a way). I did manage to get a clean run of composer with Ashu's composer.json file. Then I run into the same problem:

 

Class 'JMS\Serializer\Handler\StdClassHandler' not found in JMS\Serializer\SerializerBuilder->addDefaultHandlers() (line 162 of /home/basicsby/public_html/basics-test/sites/all/libraries/anet_php_sdk/vendor/jms/serializer/src/JMS/Serializer/SerializerBuilder.php)

 

Having some troulbe tracking down the problem and any help would be appreciated.

 

Al

ahawtin2018
Member


Please share the code you are executing.

Also, are you including 'vendor/autoload.php'?
Please make sure to require 'vendor/autoload.php'  instead of 'autoload.php' in your code.

ashu
Authorize.Net Developer Authorize.Net Developer
Authorize.Net Developer

Thanks for the hint Ashu.

 

I am using Drupal which uses the library API. I had to dig into the module code to redirect the library reference from the library root directory to the vendor subdirectory. Just completed a successful test transaction so over this initial hurdle. Appreciate your help.

 

Al

Hi Ashu - unfortunately I am pointing to that and am still getting the error. 

 

Fatal error: Class 'JMS\Serializer\Handler\StdClassHandler' not found in /var/www/html/.../authorize.net/vendor/jms/serializer/src/JMS/Serializer/SerializerBuilder.php on line 162

Here is my simple test code. This is on a test server created from an image that was running an earlier version of Auhorize.net successfully for a number of years now.

 

<?php
define("AUTHORIZENET_SANDBOX", true);
require_once 'authorize.net/vendor/autoload.php'; // New file in 1.9x
$transaction = new AuthorizeNetAIM('DELETED', 'DELETED');
$transaction->amount = '7.99';
$transaction->card_num = '4111-1111-1111-1111';
$transaction->exp_date = '10/22';
$transaction->card_code = '123';

$transaction->description = "Sample Transaction";

$transaction->first_name	= "John";
$transaction->last_name	= "Doe";
$transaction->address		= "1234 Street";
$transaction->state			= "WA";
$transaction->zip			= "90210";


$response = $transaction->authorizeAndCapture();

if ($response->approved) {
  echo "<h1>Success! The test credit card has been charged!</h1>";
  echo "Transaction ID: " . $response->transaction_id;
} else {
  echo $response->error_message;
}
?>

Thank you for your help :)