Skip to content

Commit 72063fc

Browse files
committed
Merge remote-tracking branch 'refs/remotes/upstream-master/master'
2 parents 3f562a6 + 5486413 commit 72063fc

3 files changed

Lines changed: 18 additions & 26 deletions

File tree

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ before_script:
1515
script:
1616
- vendor/phpunit/phpunit/phpunit --coverage-clover=coverage.clover
1717
- cd sample-code-php
18-
- composer install --prefer-dist --ignore-platform-reqs
18+
- composer install --prefer-dist
1919
- vendor/phpunit/phpunit/phpunit test-runner.php .
2020

2121
after_script:

README.md

Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
Authorize.Net PHP SDK
22
======================
33

4-
[![Travis](https://img.shields.io/travis/AuthorizeNet/sdk-php/master.svg)]
5-
(https://travis-ci.org/AuthorizeNet/sdk-php)
4+
[![Travis](https://img.shields.io/travis/AuthorizeNet/sdk-php/master.svg)](https://travis-ci.org/AuthorizeNet/sdk-php)
65
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/AuthorizeNet/sdk-php/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/AuthorizeNet/sdk-php/?branch=master)
76
[![Packagist](https://img.shields.io/packagist/v/authorizenet/authorizenet.svg)](https://packagist.org/packages/authorizenet/authorizenet)
87

@@ -44,37 +43,28 @@ Alternatively, we provide a custom `SPL` autoloader:
4443
require 'path/to/anet_php_sdk/autoload.php';
4544
```
4645

47-
**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`*
48-
```php
49-
Problem 1
50-
- Installation request for authorizenet/authorizenet 1.8.6.2 -> satisfiable
51-
by authorizenet/authorizenet[1.8.6.2].
52-
- authorizenet/authorizenet 1.8.6.2 requires php ~5.3 -> your PHP version (7
53-
.0.3RC1) or value of "config.platform.php" in composer.json does not satisfy that requirement.
54-
```
55-
5646
## Authentication
5747
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.
5848
If you need a sandbox account you can sign up for one really easily [`here`](https://developer.authorize.net/sandbox/).
5949

6050
Once you have your keys simply plug them into the appropriate variables, as per the below code dealing with the authentication part of the flow.
6151

6252
...
63-
````php
53+
```php
6454
use net\authorize\api\contract\v1 as AnetAPI;
65-
````
55+
```
6656
...
67-
````php
57+
```php
6858
$merchantAuthentication = new AnetAPI\MerchantAuthenticationType();
6959
$merchantAuthentication->setName("YOURLOGIN");
7060
$merchantAuthentication->setTransactionKey("YOURKEY");
71-
````
61+
```
7262
...
7363

74-
````php
64+
```php
7565
$request = new AnetAPI\CreateTransactionRequest();
7666
$request->setMerchantAuthentication($merchantAuthentication);
77-
````
67+
```
7868
...
7969

8070
## Usage Examples
@@ -87,7 +77,7 @@ Apart from this README, you can find details and examples of using the SDK in th
8777
### Quick Usage Example (with Charge Credit Card - Authorize and Capture)
8878
Note: The following is a php console application. Ensure that you can invoke the php command from command line.
8979
- Save the below code to a php file named, say, `charge-credit-card.php`
90-
- Open command prompt and navigate to your sdk folder ( if want to run from a different folder, modify the `require` statement to have the full path to the sdk e.g. `require 'c:/anet-sdk-php/vendor/autoload.php'` in place of `require 'vendor/autoload.php'` )
80+
- Open command prompt and navigate to your SDK folder ( if want to run from a different folder, modify the `require` statement to have the full path to the SDK e.g. `require 'c:/anet-sdk-php/vendor/autoload.php'` in place of `require 'vendor/autoload.php'` )
9181
- Update dependecies - e.g., With composer, type `composer update`
9282
- Type `php [<path to folder containing the php file>\]charge-credit-card.php`
9383

@@ -148,7 +138,7 @@ $response = $controller->executeWithApiResponse( \net\authorize\api\constants\AN
148138

149139
## Logging
150140

151-
SDK generates log with masking for sensitive data like credit card, expiration dates. The provided levels for logging are
141+
The SDK generates a log with masking for sensitive data like credit card, expiration dates. The provided levels for logging are
152142
`debug`, `info`, `warn`, `error`. Add ````use \net\authorize\util\LogFactory;````. Logger can be initialized using `$logger = LogFactory::getLog(get_class($this));`
153143
The default log file `phplog` gets generated in the current folder. The subsequent logs are appended to the same file, unless the execution folder is changed, and a new log file is generated.
154144

@@ -158,7 +148,7 @@ The default log file `phplog` gets generated in the current folder. The subseque
158148
- Logging using formatting `$logger->debugFormat("Integer: %d, Float: %f, Xml-Request: %s\n", array(100, 1.29f, $xmlRequest));`
159149

160150
### Customizing Sensitive Tags
161-
A local copy of [AuthorizedNetSensitiveTagsConfig.json](/lib/net/authorize/util/ANetSensitiveFields.php) gets generated when code invoking the logger first gets executed. The local file can later be edited by developer to re-configure what is masked and what is visible (*Do not edit the json in sdk*).
151+
A local copy of [AuthorizedNetSensitiveTagsConfig.json](/lib/net/authorize/util/ANetSensitiveFields.php) gets generated when code invoking the logger first gets executed. The local file can later be edited by developer to re-configure what is masked and what is visible. (*Do not edit the JSON in the SDK*).
162152
- For each element of the `sensitiveTags` array,
163153
- `tagName` field corresponds to the name of the property in object, or xml-tag that should be hidden entirely ( *XXXX* shown if no replacement specified ) or masked (e.g. showing the last 4 digits of credit card number).
164154
- `pattern`[<sup>[Note]</sup>](#regex-note) and `replacement`[<sup>[Note]</sup>](#regex-note) can be left `""`, if the default is to be used (as defined in [Log.php](/lib/net/authorize/util/Log.php)). `pattern` gives the regex to identify, while `replacement` defines the visible part.

tests/AuthorizeNetAIM_Test.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
class AuthorizeNetAIM_Sandbox_Test extends PHPUnit_Framework_TestCase
44
{
5+
private $alternateApiLoginId = "22Pav9kBpn";
6+
private $alternateTransactionKey = "35vB2T6kkZZW582q";
57

68
public function testAuthCapture()
79
{
@@ -438,12 +440,12 @@ public function testAuthCaptureVoid()
438440

439441
public function testAdvancedAIM()
440442
{
441-
$auth = new AuthorizeNetAIM;
442-
$auth->amount = "45.00";
443+
$auth = new AuthorizeNetAIM($this->alternateApiLoginId, $this->alternateTransactionKey);
444+
$auth->amount = "50.00";
443445

444446
// Use eCheck:
445447
$auth->setECheck(
446-
'121042882',
448+
'125000024',
447449
'123456789123',
448450
'CHECKING',
449451
'Bank of Earth',
@@ -468,12 +470,12 @@ public function testAdvancedAIM()
468470
$auth_code = $response->transaction_id;
469471

470472
// Now capture:
471-
$capture = new AuthorizeNetAIM;
473+
$capture = new AuthorizeNetAIM($this->alternateApiLoginId, $this->alternateTransactionKey);
472474
$capture_response = $capture->priorAuthCapture($auth_code);
473475
$this->assertTrue($capture_response->approved);
474476

475477
// Now void:
476-
$void = new AuthorizeNetAIM;
478+
$void = new AuthorizeNetAIM($this->alternateApiLoginId, $this->alternateTransactionKey);
477479
$void_response = $void->void($capture_response->transaction_id);
478480
$this->assertTrue($void_response->approved);
479481
}

0 commit comments

Comments
 (0)