Skip to content

Commit 73935bd

Browse files
author
brianmc
committed
Merge branch 'srmisra-Future' into Future
2 parents e4bae89 + 8f87550 commit 73935bd

43 files changed

Lines changed: 1947 additions & 329 deletions

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: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@
223223
'net\authorize\util\LogFactory' => $libDir . 'net/authorize/util/LogFactory.php',
224224
'net\authorize\util\ANetSensitiveFields' => $libDir . 'net/authorize/util/ANetSensitiveFields.php',
225225
'net\authorize\util\SensitiveTag' => $libDir . 'net/authorize/util/SensitiveTag.php',
226-
226+
'net\authorize\util\SensitiveDataConfigType' => $libDir . 'net/authorize/util/SensitiveDataConfigType.php',
227227

228228
//constants
229229
'net\authorize\api\constants\ANetEnvironment' => $libDir . 'net/authorize/api/constants/ANetEnvironment.php',
@@ -242,16 +242,19 @@
242242
'net\authorize\api\contract\v1\ARBGetSubscriptionListRequest' => $libDir . 'net/authorize/api/contract/v1/ARBGetSubscriptionListRequest.php',
243243
'net\authorize\api\contract\v1\ARBGetSubscriptionListResponse' => $libDir . 'net/authorize/api/contract/v1/ARBGetSubscriptionListResponse.php',
244244
'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',
245247
'net\authorize\api\contract\v1\ARBGetSubscriptionStatusRequest' => $libDir . 'net/authorize/api/contract/v1/ARBGetSubscriptionStatusRequest.php',
246248
'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',
247250
'net\authorize\api\contract\v1\ARBSubscriptionType' => $libDir . 'net/authorize/api/contract/v1/ARBSubscriptionType.php',
248251
'net\authorize\api\contract\v1\ARBUpdateSubscriptionRequest' => $libDir . 'net/authorize/api/contract/v1/ARBUpdateSubscriptionRequest.php',
249252
'net\authorize\api\contract\v1\ARBUpdateSubscriptionResponse' => $libDir . 'net/authorize/api/contract/v1/ARBUpdateSubscriptionResponse.php',
250253
'net\authorize\api\contract\v1\ArrayOfSettingType' => $libDir . 'net/authorize/api/contract/v1/ArrayOfSettingType.php',
251254
'net\authorize\api\contract\v1\AuthenticateTestRequest' => $libDir . 'net/authorize/api/contract/v1/AuthenticateTestRequest.php',
252255
'net\authorize\api\contract\v1\AuthenticateTestResponse' => $libDir . 'net/authorize/api/contract/v1/AuthenticateTestResponse.php',
253256
'net\authorize\api\contract\v1\BankAccountMaskedType' => $libDir . 'net/authorize/api/contract/v1/BankAccountMaskedType.php',
254-
'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',
255258
'net\authorize\api\contract\v1\BatchDetailsType' => $libDir . 'net/authorize/api/contract/v1/BatchDetailsType.php',
256259
'net\authorize\api\contract\v1\BatchStatisticType' => $libDir . 'net/authorize/api/contract/v1/BatchStatisticType.php',
257260
'net\authorize\api\contract\v1\CardArtType' => $libDir . 'net/authorize/api/contract/v1/CardArtType.php',
@@ -277,7 +280,9 @@
277280
'net\authorize\api\contract\v1\CustomerDataType' => $libDir . 'net/authorize/api/contract/v1/CustomerDataType.php',
278281
'net\authorize\api\contract\v1\CustomerPaymentProfileBaseType' => $libDir . 'net/authorize/api/contract/v1/CustomerPaymentProfileBaseType.php',
279282
'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',
280284
'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',
281286
'net\authorize\api\contract\v1\CustomerPaymentProfileType' => $libDir . 'net/authorize/api/contract/v1/CustomerPaymentProfileType.php',
282287
'net\authorize\api\contract\v1\CustomerProfileBaseType' => $libDir . 'net/authorize/api/contract/v1/CustomerProfileBaseType.php',
283288
'net\authorize\api\contract\v1\CustomerProfileExType' => $libDir . 'net/authorize/api/contract/v1/CustomerProfileExType.php',
@@ -305,6 +310,8 @@
305310
'net\authorize\api\contract\v1\FingerPrintType' => $libDir . 'net/authorize/api/contract/v1/FingerPrintType.php',
306311
'net\authorize\api\contract\v1\GetBatchStatisticsRequest' => $libDir . 'net/authorize/api/contract/v1/GetBatchStatisticsRequest.php',
307312
'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',
308315
'net\authorize\api\contract\v1\GetCustomerPaymentProfileRequest' => $libDir . 'net/authorize/api/contract/v1/GetCustomerPaymentProfileRequest.php',
309316
'net\authorize\api\contract\v1\GetCustomerPaymentProfileResponse' => $libDir . 'net/authorize/api/contract/v1/GetCustomerPaymentProfileResponse.php',
310317
'net\authorize\api\contract\v1\GetCustomerProfileIdsRequest' => $libDir . 'net/authorize/api/contract/v1/GetCustomerProfileIdsRequest.php',
@@ -368,6 +375,7 @@
368375
'net\authorize\api\contract\v1\SendCustomerTransactionReceiptResponse' => $libDir . 'net/authorize/api/contract/v1/SendCustomerTransactionReceiptResponse.php',
369376
'net\authorize\api\contract\v1\SettingType' => $libDir . 'net/authorize/api/contract/v1/SettingType.php',
370377
'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',
371379
'net\authorize\api\contract\v1\SubscriptionDetailType' => $libDir . 'net/authorize/api/contract/v1/SubscriptionDetailType.php',
372380
'net\authorize\api\contract\v1\SubscriptionPaymentType' => $libDir . 'net/authorize/api/contract/v1/SubscriptionPaymentType.php',
373381
'net\authorize\api\contract\v1\TokenMaskedType' => $libDir . 'net/authorize/api/contract/v1/TokenMaskedType.php',
@@ -407,6 +415,7 @@
407415
//Controllers
408416
'net\authorize\api\controller\ARBCancelSubscriptionController' => $libDir . 'net/authorize/api/controller/ARBCancelSubscriptionController.php',
409417
'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',
410419
'net\authorize\api\controller\ARBGetSubscriptionListController' => $libDir . 'net/authorize/api/controller/ARBGetSubscriptionListController.php',
411420
'net\authorize\api\controller\ARBGetSubscriptionStatusController' => $libDir . 'net/authorize/api/controller/ARBGetSubscriptionStatusController.php',
412421
'net\authorize\api\controller\ARBUpdateSubscriptionController' => $libDir . 'net/authorize/api/controller/ARBUpdateSubscriptionController.php',
@@ -423,6 +432,7 @@
423432
'net\authorize\api\controller\DeleteCustomerShippingAddressController' => $libDir . 'net/authorize/api/controller/DeleteCustomerShippingAddressController.php',
424433
'net\authorize\api\controller\GetBatchStatisticsController' => $libDir . 'net/authorize/api/controller/GetBatchStatisticsController.php',
425434
'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',
426436
'net\authorize\api\controller\GetCustomerProfileController' => $libDir . 'net/authorize/api/controller/GetCustomerProfileController.php',
427437
'net\authorize\api\controller\GetCustomerProfileIdsController' => $libDir . 'net/authorize/api/controller/GetCustomerProfileIdsController.php',
428438
'net\authorize\api\controller\GetCustomerShippingAddressController' => $libDir . 'net/authorize/api/controller/GetCustomerShippingAddressController.php',

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: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ public function setECheck($bank_aba_code, $bank_acct_num, $bank_acct_type, $bank
287287
'bank_acct_num' => $bank_acct_num,
288288
'bank_acct_type' => $bank_acct_type,
289289
'bank_name' => $bank_name,
290-
'bank_acct_name' => $bank_acct_type,
290+
'bank_acct_name' => $bank_acct_name,
291291
'echeck_type' => $echeck_type,
292292
)
293293
);

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+
```
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<?php
2+
3+
namespace net\authorize\api\contract\v1;
4+
5+
/**
6+
* Class representing ARBGetSubscriptionRequest
7+
*/
8+
class ARBGetSubscriptionRequest extends ANetApiRequestType
9+
{
10+
11+
/**
12+
* @property string $subscriptionId
13+
*/
14+
private $subscriptionId = null;
15+
16+
/**
17+
* Gets as subscriptionId
18+
*
19+
* @return string
20+
*/
21+
public function getSubscriptionId()
22+
{
23+
return $this->subscriptionId;
24+
}
25+
26+
/**
27+
* Sets a new subscriptionId
28+
*
29+
* @param string $subscriptionId
30+
* @return self
31+
*/
32+
public function setSubscriptionId($subscriptionId)
33+
{
34+
$this->subscriptionId = $subscriptionId;
35+
return $this;
36+
}
37+
38+
39+
}
40+
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<?php
2+
3+
namespace net\authorize\api\contract\v1;
4+
5+
/**
6+
* Class representing ARBGetSubscriptionResponse
7+
*/
8+
class ARBGetSubscriptionResponse extends ANetApiResponseType
9+
{
10+
11+
/**
12+
* @property \net\authorize\api\contract\v1\ARBSubscriptionMaskedType $subscription
13+
*/
14+
private $subscription = null;
15+
16+
/**
17+
* Gets as subscription
18+
*
19+
* @return \net\authorize\api\contract\v1\ARBSubscriptionMaskedType
20+
*/
21+
public function getSubscription()
22+
{
23+
return $this->subscription;
24+
}
25+
26+
/**
27+
* Sets a new subscription
28+
*
29+
* @param \net\authorize\api\contract\v1\ARBSubscriptionMaskedType $subscription
30+
* @return self
31+
*/
32+
public function setSubscription(\net\authorize\api\contract\v1\ARBSubscriptionMaskedType $subscription)
33+
{
34+
$this->subscription = $subscription;
35+
return $this;
36+
}
37+
38+
39+
}
40+

0 commit comments

Comments
 (0)