Using the JSON file:
/authorize/composer.json
By using the provided code:
{
"require": {
"php": ">=5.6",
"ext-curl": "*",
"phpunit/phpunit": "~4.8||~6.0",
"authorizenet/authorizenet": ">=1.9.6 || <2.0"
},
"autoload": {
"classmap": ["constants"]
}
}
and by running the command
composer update
I received the follwoing output:
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 31 installs, 0 updates, 0 removals
- Installing symfony/polyfill-ctype (v1.8.0): Downloading (100%)
- Installing symfony/yaml (v3.4.11): Downloading (100%)
- Installing sebastian/version (1.0.6): Downloading (100%)
- Installing sebastian/global-state (1.1.1): Downloading (100%)
- Installing sebastian/recursion-context (1.0.5): Downloading (100%)
- Installing sebastian/exporter (1.2.2): Downloading (100%)
- Installing sebastian/environment (1.3.8): Downloading (100%)
- Installing sebastian/diff (1.4.3): Downloading (100%)
- Installing sebastian/comparator (1.2.4): Downloading (100%)
- Installing doctrine/instantiator (1.0.5): Downloading (100%)
- Installing phpunit/php-text-template (1.2.1): Downloading (100%)
- Installing phpunit/phpunit-mock-objects (2.3.8): Downloading (100%)
- Installing phpunit/php-timer (1.0.9): Downloading (100%)
- Installing phpunit/php-file-iterator (1.4.5): Downloading (100%)
- Installing phpunit/php-token-stream (1.4.12): Downloading (100%)
- Installing phpunit/php-code-coverage (2.2.4): Downloading (100%)
- Installing webmozart/assert (1.3.0): Downloading (100%)
- Installing phpdocumentor/reflection-common (1.0.1): Downloading (100%)
- Installing phpdocumentor/type-resolver (0.4.0): Downloading (100%)
- Installing phpdocumentor/reflection-docblock (3.3.2): Downloading (100%)
- Installing phpspec/prophecy (1.7.6): Downloading (100%)
- Installing phpunit/phpunit (4.8.36): Downloading (100%)
- Installing doctrine/lexer (v1.0.1): Downloading (100%)
- Installing doctrine/annotations (v1.4.0): Downloading (100%)
- Installing phpoption/phpoption (1.5.0): Downloading (100%)
- Installing phpcollection/phpcollection (0.5.0): Downloading (100%)
- Installing jms/parser-lib (1.0.0): Downloading (100%)
- Installing jms/metadata (1.6.0): Downloading (100%)
- Installing jms/serializer (1.12.1): Downloading (100%)
- Installing goetas-webservices/xsd2php-runtime (v0.2.8): Downloading (100%)
- Installing authorizenet/authorizenet (1.9.6): Downloading (100%)
symfony/yaml suggests installing symfony/console (For validating YAML files using the lint command)
sebastian/global-state suggests installing ext-uopz (*)
phpunit/php-code-coverage suggests installing ext-xdebug (>=2.2.1)
phpunit/phpunit suggests installing phpunit/php-invoker (~1.1)
jms/serializer suggests installing doctrine/collections (Required if you like to use doctrine collection types as ArrayCollection.)
jms/serializer suggests installing doctrine/cache (Required if you like to use cache functionality.)
Writing lock file
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] [--no-suggest] [--with-dependencies] [--with-all-dependencies] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--ignore-platform-reqs] [--prefer-stable] [--prefer-lowest] [-i|--interactive] [--root-reqs] [--] [<packages>]...
What caused this error and how do I resolve this to move forward?
[RuntimeException]
Could not scan for classes inside "constants" which does not appear to be a file nor a folder
06-07-2018 07:53 PM
Following the steps here: https://developer.authorize.net/hello_world/ Step 3, I loaded charge-credit-card.php in the browser ...
Warning: include(/public_html/authorize/vendor/authorizenet/authorizenet/vendor/jms/serializer/src/JMS/Serializer/Annotation/Type.php): failed to open stream: No such file or directory in /public_html/authorize/vendor/authorizenet/authorizenet/autoload.php on line 16
Warning: include(): Failed opening '/public_html/authorize/vendor/authorizenet/authorizenet/vendor/jms/serializer/src/JMS/Serializer/Annotation/Type.php' for inclusion (include_path='.:/opt/cpanel/ea-php56/root/usr/share/pear') in /public_html/authorize/vendor/authorizenet/authorizenet/autoload.php on line 16
Fatal error: Class 'JMS\Serializer\Annotation\Type' not found in /public_html/authorize/vendor/authorizenet/authorizenet/lib/net/authorize/util/SensitiveDataConfigType.php on line 6
06-07-2018 08:25 PM
The images you shared are failing to load. Please share them again, as they can be helpful for reviewing and understanding your issue.
Meanwhile, can you try running the following 3 steps (no manual file modifications):
Example ($ denotes the Git bash prompt):
$ git clone https://github.com/AuthorizeNet/sample-code-php
$ cd sample-code-php
$ composer update
$ php PaymentTransactions/charge-credit-card.php
For running the php code, command promot or Git bash should suffice, you do not need to run the php file in a browser. If using Windows command prompt, only the 4th command would use '\' instead of '/' .
If this step succeeds, you can make any changes you wish to charge-credit-card.php and test them.
Thanks
Ashutosh
06-08-2018 05:10 AM
Thanks. It appears to be resolved
06-09-2018 04:46 PM
That is great to hear! Thanks for updating us.
Can you also share if there was any mistake that other novices can look after, or any improvement that can be done to the documentation to simplify it?
Ashutosh
Happy Coding!
Authorize.Net
06-09-2018 06:25 PM
Sure thing... In my case. Perhaps in general.
https://github.com/AuthorizeNet/sdk-php
Installation Composer
We recommend using Composer. (Note: we never recommend you override the new secure-http default setting). Update your composer.json file as per the example below and then run composer update.
{
"require": {
"php": ">=5.6",
"authorizenet/authorizenet": "~1.9.7"
}
}
But the provided file https://github.com/AuthorizeNet/sdk-php/blob/master/composer.json is modified and not the same as the instructions and not the same as https://developer.authorize.net/hello_world/ Step 1
You will also note the Hellow World - Step 1 is out of date for the SDK...
Composer with this file content resolved for me:
{ "require": { "php": ">=5.6", "authorizenet/authorizenet": "~1.9.7" } }
There seems to be an issue as well with clear guidance for use and getting started.
For instance. After getting the SDK working, where and how to place (folder hyerarchy) for adding https://github.com/AuthorizeNet/accept-sample-app in for testing.
And one more, the https://github.com/AuthorizeNet/accept-sample-app despite havinging followed this to a T and having all requirements met... It still will not allow access with the Customer ID (and yes it is entered on my Sandbox.
How to Use the Sample App
Clone or download this repository.
Host the sample app in any web server supporting PHP, for example IIS or XAMPP (Apache). HTTPS (SSL) must be enabled for your website.
Set the authentication credentials in the application so that it uses your Authorize.Net sandbox (test) account. If you haven't yet signed up for a sandbox account, you can create a sandbox account at our [Developer Center] (https://developer.authorize.net/hello_world/sandbox/). Set environment variables for API_LOGIN_ID and TRANSACTION_KEY using the credentials for your Authorize.Net sandbox account. For example, in httpd.conf, you would add the following lines:
SetEnv API_LOGIN_ID your_id SetEnv TRANSACTION_KEY your_key
For IIS, you could set these environment variables in FastCGI Settings -> Environment Variables.
Set the authentication credentials that Accept.js uses. Edit the acceptJSCaller() function in acceptJSCaller.js to use your API login ID and public client key for the values of authData.apiLoginID and authData.clientKey. A public client key can be created by logging into the Merchant Interface and navigating to Account --> Security Settings --> Manage Public Client Key.
Browse the application (index.php) over HTTPS connection.
To "log in", use a customer profile ID that already exists within your account or create a new one by using the Create a Customer Profile API.
In these examples, payment forms are shown in the same page and Shipping forms are handled in a separate modal popup. However, any of the types of display can be chosen to display any type of form.
While I see why all are broken up into their own repository. I think there is an oportunity to keep continuity and guidance for using / testing all. You may also note the empty README files... why include them if you have no content. The reference page https://developer.authorize.net/api/reference/features/acceptjs.html with "complete" html examples is also somwhat decieving as it does not clearly advise to what page you should post the form. Self? Also does not appear to work as when attempted no response appears to display or did I miss something in the instructions?
Perhaps I am just a bit frustrated for an out of the box experience I am use to with other platforms and examples. Finding no 3rd party reference either, and somewhat dated and lacking reference and few replies to forum posts here (excluding present thread).
Just know I'm out 2 weeks working on my project and I just need to be done and on par with learning how to use the SDK properly.
06-15-2018 03:13 PM
why is the autoload mapping necessary in the composer file as seen here: https://github.com/AuthorizeNet/sdk-php/blob/master/composer.json ?
09-13-2022 10:17 AM