Skip to content

Commit 01990f0

Browse files
committed
Merge pull request #91 from AuthorizeNet/Future
Merging Future branch for November 2015 Release
2 parents d2ae7b0 + 8a6e1f2 commit 01990f0

49 files changed

Lines changed: 2468 additions & 339 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 90 additions & 222 deletions
Large diffs are not rendered by default.

classmap.php

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
2-
spl_autoload_extensions(".php"); // comma-separated list
3-
spl_autoload_register();
2+
spl_autoload_extensions(".php"); // comma-separated list
3+
spl_autoload_register();
44

55
/**
66
* A map of classname => filename for SPL autoloading.
@@ -219,6 +219,11 @@
219219
//'net\authorize\util\ObjectToXml' => $libDir . 'net/authorize/util/ObjectToXml.php',
220220
'net\authorize\util\HttpClient' => $libDir . 'net/authorize/util/HttpClient.php',
221221
'net\authorize\util\Helpers' => $libDir . 'net/authorize/util/Helpers.php',
222+
'net\authorize\util\Log' => $libDir . 'net/authorize/util/Log.php',
223+
'net\authorize\util\LogFactory' => $libDir . 'net/authorize/util/LogFactory.php',
224+
'net\authorize\util\ANetSensitiveFields' => $libDir . 'net/authorize/util/ANetSensitiveFields.php',
225+
'net\authorize\util\SensitiveTag' => $libDir . 'net/authorize/util/SensitiveTag.php',
226+
'net\authorize\util\SensitiveDataConfigType' => $libDir . 'net/authorize/util/SensitiveDataConfigType.php',
222227

223228
//constants
224229
'net\authorize\api\constants\ANetEnvironment' => $libDir . 'net/authorize/api/constants/ANetEnvironment.php',
@@ -237,16 +242,19 @@
237242
'net\authorize\api\contract\v1\ARBGetSubscriptionListRequest' => $libDir . 'net/authorize/api/contract/v1/ARBGetSubscriptionListRequest.php',
238243
'net\authorize\api\contract\v1\ARBGetSubscriptionListResponse' => $libDir . 'net/authorize/api/contract/v1/ARBGetSubscriptionListResponse.php',
239244
'net\authorize\api\contract\v1\ARBGetSubscriptionListSortingType' => $libDir . 'net/authorize/api/contract/v1/ARBGetSubscriptionListSortingType.php',
245+
'net\authorize\api\contract\v1\ARBGetSubscriptionRequest' => $libDir . 'net/authorize/api/contract/v1/ARBGetSubscriptionRequest.php',
246+
'net\authorize\api\contract\v1\ARBGetSubscriptionResponse' => $libDir . 'net/authorize/api/contract/v1/ARBGetSubscriptionResponse.php',
240247
'net\authorize\api\contract\v1\ARBGetSubscriptionStatusRequest' => $libDir . 'net/authorize/api/contract/v1/ARBGetSubscriptionStatusRequest.php',
241248
'net\authorize\api\contract\v1\ARBGetSubscriptionStatusResponse' => $libDir . 'net/authorize/api/contract/v1/ARBGetSubscriptionStatusResponse.php',
249+
'net\authorize\api\contract\v1\ARBSubscriptionMaskedType' => $libDir . 'net/authorize/api/contract/v1/ARBSubscriptionMaskedType.php',
242250
'net\authorize\api\contract\v1\ARBSubscriptionType' => $libDir . 'net/authorize/api/contract/v1/ARBSubscriptionType.php',
243251
'net\authorize\api\contract\v1\ARBUpdateSubscriptionRequest' => $libDir . 'net/authorize/api/contract/v1/ARBUpdateSubscriptionRequest.php',
244252
'net\authorize\api\contract\v1\ARBUpdateSubscriptionResponse' => $libDir . 'net/authorize/api/contract/v1/ARBUpdateSubscriptionResponse.php',
245253
'net\authorize\api\contract\v1\ArrayOfSettingType' => $libDir . 'net/authorize/api/contract/v1/ArrayOfSettingType.php',
246254
'net\authorize\api\contract\v1\AuthenticateTestRequest' => $libDir . 'net/authorize/api/contract/v1/AuthenticateTestRequest.php',
247255
'net\authorize\api\contract\v1\AuthenticateTestResponse' => $libDir . 'net/authorize/api/contract/v1/AuthenticateTestResponse.php',
248256
'net\authorize\api\contract\v1\BankAccountMaskedType' => $libDir . 'net/authorize/api/contract/v1/BankAccountMaskedType.php',
249-
'net\authorize\api\contract\v1\BankAccountType' => $libDir . 'net/authorize/api/contract/v1/Bank`AccountType.php',
257+
'net\authorize\api\contract\v1\BankAccountType' => $libDir . 'net/authorize/api/contract/v1/BankAccountType.php',
250258
'net\authorize\api\contract\v1\BatchDetailsType' => $libDir . 'net/authorize/api/contract/v1/BatchDetailsType.php',
251259
'net\authorize\api\contract\v1\BatchStatisticType' => $libDir . 'net/authorize/api/contract/v1/BatchStatisticType.php',
252260
'net\authorize\api\contract\v1\CardArtType' => $libDir . 'net/authorize/api/contract/v1/CardArtType.php',
@@ -272,7 +280,9 @@
272280
'net\authorize\api\contract\v1\CustomerDataType' => $libDir . 'net/authorize/api/contract/v1/CustomerDataType.php',
273281
'net\authorize\api\contract\v1\CustomerPaymentProfileBaseType' => $libDir . 'net/authorize/api/contract/v1/CustomerPaymentProfileBaseType.php',
274282
'net\authorize\api\contract\v1\CustomerPaymentProfileExType' => $libDir . 'net/authorize/api/contract/v1/CustomerPaymentProfileExType.php',
283+
'net\authorize\api\contract\v1\CustomerPaymentProfileListItemType' => $libDir . 'net/authorize/api/contract/v1/CustomerPaymentProfileListItemType.php',
275284
'net\authorize\api\contract\v1\CustomerPaymentProfileMaskedType' => $libDir . 'net/authorize/api/contract/v1/CustomerPaymentProfileMaskedType.php',
285+
'net\authorize\api\contract\v1\CustomerPaymentProfileSortingType' => $libDir . 'net/authorize/api/contract/v1/CustomerPaymentProfileSortingType.php',
276286
'net\authorize\api\contract\v1\CustomerPaymentProfileType' => $libDir . 'net/authorize/api/contract/v1/CustomerPaymentProfileType.php',
277287
'net\authorize\api\contract\v1\CustomerProfileBaseType' => $libDir . 'net/authorize/api/contract/v1/CustomerProfileBaseType.php',
278288
'net\authorize\api\contract\v1\CustomerProfileExType' => $libDir . 'net/authorize/api/contract/v1/CustomerProfileExType.php',
@@ -300,6 +310,8 @@
300310
'net\authorize\api\contract\v1\FingerPrintType' => $libDir . 'net/authorize/api/contract/v1/FingerPrintType.php',
301311
'net\authorize\api\contract\v1\GetBatchStatisticsRequest' => $libDir . 'net/authorize/api/contract/v1/GetBatchStatisticsRequest.php',
302312
'net\authorize\api\contract\v1\GetBatchStatisticsResponse' => $libDir . 'net/authorize/api/contract/v1/GetBatchStatisticsResponse.php',
313+
'net\authorize\api\contract\v1\GetCustomerPaymentProfileListRequest' => $libDir . 'net/authorize/api/contract/v1/GetCustomerPaymentProfileListRequest.php',
314+
'net\authorize\api\contract\v1\GetCustomerPaymentProfileListResponse' => $libDir . 'net/authorize/api/contract/v1/GetCustomerPaymentProfileListResponse.php',
303315
'net\authorize\api\contract\v1\GetCustomerPaymentProfileRequest' => $libDir . 'net/authorize/api/contract/v1/GetCustomerPaymentProfileRequest.php',
304316
'net\authorize\api\contract\v1\GetCustomerPaymentProfileResponse' => $libDir . 'net/authorize/api/contract/v1/GetCustomerPaymentProfileResponse.php',
305317
'net\authorize\api\contract\v1\GetCustomerProfileIdsRequest' => $libDir . 'net/authorize/api/contract/v1/GetCustomerProfileIdsRequest.php',
@@ -363,6 +375,7 @@
363375
'net\authorize\api\contract\v1\SendCustomerTransactionReceiptResponse' => $libDir . 'net/authorize/api/contract/v1/SendCustomerTransactionReceiptResponse.php',
364376
'net\authorize\api\contract\v1\SettingType' => $libDir . 'net/authorize/api/contract/v1/SettingType.php',
365377
'net\authorize\api\contract\v1\SolutionType' => $libDir . 'net/authorize/api/contract/v1/SolutionType.php',
378+
'net\authorize\api\contract\v1\SubscriptionCustomerProfileType' => $libDir . 'net/authorize/api/contract/v1/SubscriptionCustomerProfileType.php',
366379
'net\authorize\api\contract\v1\SubscriptionDetailType' => $libDir . 'net/authorize/api/contract/v1/SubscriptionDetailType.php',
367380
'net\authorize\api\contract\v1\SubscriptionPaymentType' => $libDir . 'net/authorize/api/contract/v1/SubscriptionPaymentType.php',
368381
'net\authorize\api\contract\v1\TokenMaskedType' => $libDir . 'net/authorize/api/contract/v1/TokenMaskedType.php',
@@ -402,6 +415,7 @@
402415
//Controllers
403416
'net\authorize\api\controller\ARBCancelSubscriptionController' => $libDir . 'net/authorize/api/controller/ARBCancelSubscriptionController.php',
404417
'net\authorize\api\controller\ARBCreateSubscriptionController' => $libDir . 'net/authorize/api/controller/ARBCreateSubscriptionController.php',
418+
'net\authorize\api\controller\ARBGetSubscriptionController' => $libDir . 'net/authorize/api/controller/ARBGetSubscriptionController.php',
405419
'net\authorize\api\controller\ARBGetSubscriptionListController' => $libDir . 'net/authorize/api/controller/ARBGetSubscriptionListController.php',
406420
'net\authorize\api\controller\ARBGetSubscriptionStatusController' => $libDir . 'net/authorize/api/controller/ARBGetSubscriptionStatusController.php',
407421
'net\authorize\api\controller\ARBUpdateSubscriptionController' => $libDir . 'net/authorize/api/controller/ARBUpdateSubscriptionController.php',
@@ -418,6 +432,7 @@
418432
'net\authorize\api\controller\DeleteCustomerShippingAddressController' => $libDir . 'net/authorize/api/controller/DeleteCustomerShippingAddressController.php',
419433
'net\authorize\api\controller\GetBatchStatisticsController' => $libDir . 'net/authorize/api/controller/GetBatchStatisticsController.php',
420434
'net\authorize\api\controller\GetCustomerPaymentProfileController' => $libDir . 'net/authorize/api/controller/GetCustomerPaymentProfileController.php',
435+
'net\authorize\api\controller\GetCustomerPaymentProfileListController' => $libDir . 'net/authorize/api/controller/GetCustomerPaymentProfileListController.php',
421436
'net\authorize\api\controller\GetCustomerProfileController' => $libDir . 'net/authorize/api/controller/GetCustomerProfileController.php',
422437
'net\authorize\api\controller\GetCustomerProfileIdsController' => $libDir . 'net/authorize/api/controller/GetCustomerProfileIdsController.php',
423438
'net\authorize\api\controller\GetCustomerShippingAddressController' => $libDir . 'net/authorize/api/controller/GetCustomerShippingAddressController.php',
@@ -437,4 +452,4 @@
437452
'net\authorize\api\controller\UpdateSplitTenderGroupController' => $libDir . 'net/authorize/api/controller/UpdateSplitTenderGroupController.php',
438453
'net\authorize\api\controller\ValidateCustomerPaymentProfileController' => $libDir . 'net/authorize/api/controller/ValidateCustomerPaymentProfileController.php',
439454

440-
);
455+
);

composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@
1111
"ext-json": "*",
1212
"ext-simplexml": "*",
1313
"ext-xmlwriter": "*",
14+
"goetas/xsd2php":"2.*@dev",
15+
"goetas/xsd-reader":"2.*@dev",
1416
"jms/serializer": "xsd2php-dev as 0.18.0"
1517
},
1618
"require-dev": {
1719
"phpunit/phpunit": "~4.0",
18-
"phpmd/phpmd": "~2.0",
19-
"goetas/xsd2php":"2.*@dev",
20-
"goetas/xsd-reader":"2.*@dev"
20+
"phpmd/phpmd": "~2.0"
2121
},
2222
"suggest": {
2323
"phpdocumentor/phpdocumentor": "For generating API documentation"

lib/AuthorizeNetAIM.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
/**
33
* Easily interact with the Authorize.Net AIM API.
44
*
5+
*
56
* Example Authorize and Capture Transaction against the Sandbox:
67
* <code>
78
* <?php require_once 'AuthorizeNet.php'
@@ -286,7 +287,7 @@ public function setECheck($bank_aba_code, $bank_acct_num, $bank_acct_type, $bank
286287
'bank_acct_num' => $bank_acct_num,
287288
'bank_acct_type' => $bank_acct_type,
288289
'bank_name' => $bank_name,
289-
'bank_acct_name' => $bank_acct_type,
290+
'bank_acct_name' => $bank_acct_name,
290291
'echeck_type' => $echeck_type,
291292
)
292293
);

lib/AuthorizeNetCIM.php

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -488,7 +488,10 @@ public function getValidationResponse()
488488
public function getCustomerProfileIds()
489489
{
490490
$ids = (array)$this->xml->ids;
491-
return $ids["numericString"];
491+
if(!empty($ids))
492+
return $ids["numericString"];
493+
else
494+
return $ids;
492495
}
493496

494497
/**
@@ -497,7 +500,10 @@ public function getCustomerProfileIds()
497500
public function getCustomerPaymentProfileIds()
498501
{
499502
$ids = (array)$this->xml->customerPaymentProfileIdList;
500-
return $ids["numericString"];
503+
if(!empty($ids))
504+
return $ids["numericString"];
505+
else
506+
return $ids;
501507
}
502508

503509
/**
@@ -506,7 +512,10 @@ public function getCustomerPaymentProfileIds()
506512
public function getCustomerShippingAddressIds()
507513
{
508514
$ids = (array)$this->xml->customerShippingAddressIdList;
509-
return $ids["numericString"];
515+
if(!empty($ids))
516+
return $ids["numericString"];
517+
else
518+
return $ids;
510519
}
511520

512521
/**

lib/DeprecatedSamples.md

Lines changed: 198 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,198 @@
1+
Old Usage Examples (Of Deprecated SDK Functionality)
2+
=======================================
3+
4+
**PLEASE NOTE: These examples are for deprecated functionality. Refer to the [README](/README.md) in root folder of the SDK for the new examples.**
5+
6+
## Requirements
7+
8+
- PHP 5.3+ *(>=5.3.10 recommended)*
9+
- cURL PHP Extension
10+
- JSON PHP Extension
11+
- SimpleXML PHP Extension
12+
- An Authorize.Net Merchant Account or Sandbox Account. You can get a
13+
free sandbox account at http://developer.authorize.net/sandbox/
14+
15+
## Autoloading
16+
17+
[`Composer`](http://getcomposer.org) currently has a [MITM](https://github.com/composer/composer/issues/1074)
18+
security vulnerability. However, if you wish to use it, require its autoloader in
19+
your script or bootstrap file:
20+
```php
21+
require 'vendor/autoload.php';
22+
```
23+
*Note: you'll need a composer.json file with the following require section and to run
24+
`composer update`.*
25+
```json
26+
"require": {
27+
"authorizenet/authorizenet": "~1.8"
28+
}
29+
```
30+
31+
Alternatively, we provide a custom `SPL` autoloader:
32+
```php
33+
require 'path/to/anet_php_sdk/autoload.php';
34+
```
35+
36+
## Authentication
37+
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.
38+
If you need a sandbox account you can sign up for one really easily [`here`](https://developer.authorize.net/sandbox/).
39+
40+
Once you have your keys simply plug them into the appropriate variables as per the samples below.
41+
42+
````php
43+
define("AUTHORIZENET_API_LOGIN_ID", "YOURLOGIN");
44+
define("AUTHORIZENET_TRANSACTION_KEY", "YOURKEY");
45+
````
46+
47+
## Usage Examples
48+
49+
See below for basic usage examples. View the `tests/` folder for more examples of
50+
each API. Additional documentation is in the `docs/` folder.
51+
52+
### AuthorizeNetAIM.php Quick Usage Example
53+
54+
```php
55+
define("AUTHORIZENET_API_LOGIN_ID", "YOURLOGIN");
56+
define("AUTHORIZENET_TRANSACTION_KEY", "YOURKEY");
57+
define("AUTHORIZENET_SANDBOX", true);
58+
$sale = new AuthorizeNetAIM;
59+
$sale->amount = "5.99";
60+
$sale->card_num = '6011000000000012';
61+
$sale->exp_date = '04/15';
62+
$response = $sale->authorizeAndCapture();
63+
if ($response->approved) {
64+
$transaction_id = $response->transaction_id;
65+
}
66+
```
67+
68+
### AuthorizeNetAIM.php Advanced Usage Example
69+
70+
```php
71+
define("AUTHORIZENET_API_LOGIN_ID", "YOURLOGIN");
72+
define("AUTHORIZENET_TRANSACTION_KEY", "YOURKEY");
73+
define("AUTHORIZENET_SANDBOX", true);
74+
$auth = new AuthorizeNetAIM;
75+
$auth->amount = "45.00";
76+
77+
// Use eCheck:
78+
$auth->setECheck(
79+
'121042882',
80+
'123456789123',
81+
'CHECKING',
82+
'Bank of Earth',
83+
'Jane Doe',
84+
'WEB'
85+
);
86+
87+
// Set multiple line items:
88+
$auth->addLineItem('item1', 'Golf tees', 'Blue tees', '2', '5.00', 'N');
89+
$auth->addLineItem('item2', 'Golf shirt', 'XL', '1', '40.00', 'N');
90+
91+
// Set Invoice Number:
92+
$auth->invoice_num = time();
93+
94+
// Set a Merchant Defined Field:
95+
$auth->setCustomField("entrance_source", "Search Engine");
96+
97+
// Authorize Only:
98+
$response = $auth->authorizeOnly();
99+
100+
if ($response->approved) {
101+
$auth_code = $response->transaction_id;
102+
103+
// Now capture:
104+
$capture = new AuthorizeNetAIM;
105+
$capture_response = $capture->priorAuthCapture($auth_code);
106+
107+
// Now void:
108+
$void = new AuthorizeNetAIM;
109+
$void_response = $void->void($capture_response->transaction_id);
110+
}
111+
```
112+
113+
### AuthorizeNetARB.php Usage Example
114+
115+
```php
116+
define("AUTHORIZENET_API_LOGIN_ID", "YOURLOGIN");
117+
define("AUTHORIZENET_TRANSACTION_KEY", "YOURKEY");
118+
$subscription = new AuthorizeNet_Subscription;
119+
$subscription->name = "PHP Monthly Magazine";
120+
$subscription->intervalLength = "1";
121+
$subscription->intervalUnit = "months";
122+
$subscription->startDate = "2011-03-12";
123+
$subscription->totalOccurrences = "12";
124+
$subscription->amount = "12.99";
125+
$subscription->creditCardCardNumber = "6011000000000012";
126+
$subscription->creditCardExpirationDate= "2018-10";
127+
$subscription->creditCardCardCode = "123";
128+
$subscription->billToFirstName = "Rasmus";
129+
$subscription->billToLastName = "Doe";
130+
131+
// Create the subscription.
132+
$request = new AuthorizeNetARB;
133+
$response = $request->createSubscription($subscription);
134+
$subscription_id = $response->getSubscriptionId();
135+
```
136+
137+
### AuthorizeNetCIM.php Usage Example
138+
139+
```php
140+
define("AUTHORIZENET_API_LOGIN_ID", "YOURLOGIN");
141+
define("AUTHORIZENET_TRANSACTION_KEY", "YOURKEY");
142+
$request = new AuthorizeNetCIM;
143+
// Create new customer profile
144+
$customerProfile = new AuthorizeNetCustomer;
145+
$customerProfile->description = "Description of customer";
146+
$customerProfile->merchantCustomerId = time();
147+
$customerProfile->email = "test@domain.com";
148+
$response = $request->createCustomerProfile($customerProfile);
149+
if ($response->isOk()) {
150+
$customerProfileId = $response->getCustomerProfileId();
151+
}
152+
```
153+
154+
### AuthorizeNetSIM.php Usage Example
155+
156+
```php
157+
define("AUTHORIZENET_API_LOGIN_ID", "YOURLOGIN");
158+
define("AUTHORIZENET_MD5_SETTING", "");
159+
$message = new AuthorizeNetSIM;
160+
if ($message->isAuthorizeNet()) {
161+
$transactionId = $message->transaction_id;
162+
}
163+
```
164+
165+
### AuthorizeNetDPM.php Usage Example
166+
167+
```php
168+
$url = "http://YOUR_DOMAIN.com/direct_post.php";
169+
$api_login_id = 'YOUR_API_LOGIN_ID';
170+
$transaction_key = 'YOUR_TRANSACTION_KEY';
171+
$md5_setting = 'YOUR_MD5_SETTING'; // Your MD5 Setting
172+
$amount = "5.99";
173+
AuthorizeNetDPM::directPostDemo($url, $api_login_id, $transaction_key, $amount, $md5_setting);
174+
```
175+
176+
### AuthorizeNetCP.php Usage Example
177+
178+
```php
179+
define("AUTHORIZENET_API_LOGIN_ID", "YOURLOGIN");
180+
define("AUTHORIZENET_TRANSACTION_KEY", "YOURKEY");
181+
define("AUTHORIZENET_MD5_SETTING", "");
182+
$sale = new AuthorizeNetCP;
183+
$sale->amount = '59.99';
184+
$sale->device_type = '4';
185+
$sale->setTrack1Data('%B4111111111111111^CARDUSER/JOHN^1803101000000000020000831000000?');
186+
$response = $sale->authorizeAndCapture();
187+
$trans_id = $response->transaction_id;
188+
```
189+
190+
### AuthorizeNetTD.php Usage Example
191+
192+
```php
193+
define("AUTHORIZENET_API_LOGIN_ID", "YOURLOGIN");
194+
define("AUTHORIZENET_TRANSACTION_KEY", "YOURKEY");
195+
$request = new AuthorizeNetTD;
196+
$response = $request->getTransactionDetails("12345");
197+
echo $response->xml->transaction->transactionStatus;
198+
```

0 commit comments

Comments
 (0)