Skip to content

Commit a018827

Browse files
committed
Changes to make the sdk works with custom autoloader script and PHP 7.
classmap.php ============ Added Yaml class mapping references to make custom autoloader to work. Ref : #86 README.md ========= Added an argument to composer update command for composer to work with PHP 7 Ref : #78 .travis.yml =========== Added an argument to composer install command to make sure the sdk works with PHP 7
1 parent a454fbf commit a018827

3 files changed

Lines changed: 20 additions & 1 deletion

File tree

.travis.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
language: php
22

33
php:
4+
- 5.6
45
- 7.0
56

67
sudo: false
78

89
before_script:
910
- pecl install xmldiff
10-
- composer install --prefer-dist --dev
11+
- composer install --prefer-dist --ignore-platform-reqs
1112
- chmod +x ./test-sample-codes.sh
1213
- git submodule update --recursive
1314

README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ require 'vendor/autoload.php';
2727
```
2828
*Note: you'll need a composer.json file with the following require section and to run
2929
`composer update`.*
30+
3031
```json
3132
{
3233
"require": {
@@ -52,6 +53,15 @@ Alternatively, we provide a custom `SPL` autoloader:
5253
require 'path/to/anet_php_sdk/autoload.php';
5354
```
5455

56+
**Issue with PHP 7:** *You may get below error when run the composer update with PHP 7. To get rid of this error, use `composer update --ignore-platform-reqs`*
57+
```php
58+
Problem 1
59+
- Installation request for authorizenet/authorizenet 1.8.6.2 -> satisfiable
60+
by authorizenet/authorizenet[1.8.6.2].
61+
- authorizenet/authorizenet 1.8.6.2 requires php ~5.3 -> your PHP version (7
62+
.0.3RC1) or value of "config.platform.php" in composer.json does not satisfy that requirement.
63+
```
64+
5565
## Authentication
5666
To authenticate with the Authorize.Net API you will need to retrieve your API Login ID and Transaction Key from the [`Merchant Interface`](https://account.authorize.net/). You can find these details in the Settings section.
5767
If you need a sandbox account you can sign up for one really easily [`here`](https://developer.authorize.net/sandbox/).
@@ -139,6 +149,11 @@ else
139149
echo "Charge Credit card Null response returned";
140150
}
141151
```
152+
### Setting Production Environment
153+
Replace the environment constant in the execute method. For example, in the method above:
154+
```php
155+
$response = $controller->executeWithApiResponse( \net\authorize\api\constants\ANetEnvironment::PRODUCTION);
156+
```
142157

143158
## Logging
144159

classmap.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,9 @@
182182
'PhpOption\None' => $vendorDir . '/phpoption/phpoption/src/PhpOption/None.php',
183183
'PhpOption\Option' => $vendorDir . '/phpoption/phpoption/src/PhpOption/Option.php',
184184
'PhpOption\Some' => $vendorDir . '/phpoption/phpoption/src/PhpOption/Some.php',
185+
'Symfony\Component\Yaml\Yaml' => $vendorDir . '/Symfony/Yaml/Yaml.php',
186+
'Symfony\Component\Yaml\Parser' => $vendorDir . '/Symfony/Yaml/Parser.php',
187+
'Symfony\Component\Yaml\Inline' => $vendorDir . '/Symfony/Yaml/Inline.php',
185188

186189
'AuthorizeNetAIM' => $libDir . 'AuthorizeNetAIM.php',
187190
'AuthorizeNetAIM_Response' => $libDir . 'AuthorizeNetAIM.php',

0 commit comments

Comments
 (0)