Skip to content

Commit bdb5577

Browse files
authored
Merge pull request #338 from khaaldrogo/future
Changes for release 1.9.8
2 parents 0cb5494 + 9507f6d commit bdb5577

38 files changed

+399
-35
lines changed

CONTRIBUTING.md

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
Thanks for contributing to the Authorize.Net PHP SDK.
2+
3+
Before you submit a pull request, we ask that you consider the following:
4+
5+
- Submit an issue to state the problem your pull request solves or the funtionality that it adds. We can then advise on the feasability of the pull request, and let you know if there are other possible solutions.
6+
- Part of the SDK is auto-generated based on the XML schema. Due to this auto-generation, we cannot merge contributions for request or response classes. You are welcome to open an issue to report problems or suggest improvements. Auto-generated classes include all files inside [contract/v1](https://github.com/AuthorizeNet/sdk-php/tree/master/lib/net/authorize/api/contract/v1) and [controller](https://github.com/AuthorizeNet/sdk-php/tree/master/lib/net/authorize/api/controller) folders, except [controller/base](https://github.com/AuthorizeNet/sdk-php/tree/master/lib/net/authorize/api/controller/base).
7+
- Files marked as deprecated are no longer supported. Issues and pull requests for changes to these deprecated files will be closed.
8+
- Recent changes will be in future branch. Check the code in *future* branch first to see if a fix has already been merged, before suggesting changes to a file.
9+
- **Always create pull request to the future branch.** The pull request will be merged to future, and later pushed to master as part of the next release.

MIGRATING.md

+85
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
# Migrating from Legacy Authorize.Net Classes
2+
3+
Authorize.Net no longer supports several legacy classes, including AuthorizeNetAIM.php, AuthorizenetSIM.php, and others listed below, as part of PHP-SDK. If you are using any of these, we recommend that you update your code to use the new Authorize.Net API classes.
4+
5+
**For details on the deprecation and replacement of legacy Authorize.Net APIs, visit https://developer.authorize.net/api/upgrade_guide/.**
6+
7+
## Full list of classes that are no longer supported
8+
| Class | New Feature | Sample Codes directory/repository |
9+
|----------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------|
10+
| AuthorizeNetAIM.php | [PaymentTransactions](https://developer.authorize.net/api/reference/index.html#payment-transactions) | [sample-code-php/PaymentTransactions](https://github.com/AuthorizeNet/sample-code-php/tree/master/PaymentTransactions) |
11+
| AuthorizeNetARB.php | [RecurringBilling](https://developer.authorize.net/api/reference/index.html#recurring-billing) | [sample-code-php/RecurringBilling](https://github.com/AuthorizeNet/sample-code-php/tree/master/RecurringBilling) |
12+
| AuthorizeNetCIM.php | [CustomerProfiles](https://developer.authorize.net/api/reference/index.html#customer-profiles) | [sample-code-php/CustomerProfiles](https://github.com/AuthorizeNet/sample-code-php/tree/master/CustomerProfiles) |
13+
| Hosted CIM | [Accept Customer](https://developer.authorize.net/content/developer/en_us/api/reference/features/customer_profiles.html#Using_the_Accept_Customer_Hosted_Form) | Not available |
14+
| AuthorizeNetCP.php | [PaymentTransactions](https://developer.authorize.net/api/reference/index.html#payment-transactions) | [sample-code-php/PaymentTransactions](https://github.com/AuthorizeNet/sample-code-php/tree/master/PaymentTransactions) |
15+
| AuthorizeNetDPM.php | [Accept.JS](https://developer.authorize.net/api/reference/features/acceptjs.html) | [Sample Accept Application](https://github.com/AuthorizeNet/accept-sample-app) |
16+
| AuthorizeNetSIM.php | [Accept Hosted](https://developer.authorize.net/content/developer/en_us/api/reference/features/accept_hosted.html) | Not available |
17+
| AuthorizeNetSOAP.php | [PaymentTransactions](https://developer.authorize.net/api/reference/index.html#payment-transactions) | [sample-code-php/PaymentTransactions](https://github.com/AuthorizeNet/sample-code-php/tree/master/PaymentTransactions) |
18+
| AuthorizeNetTD.php | [TransactionReporting](https://developer.authorize.net/api/reference/index.html#transaction-reporting) | [sample-code-php/TransactionReporting/](https://github.com/AuthorizeNet/sample-code-php/tree/master/TransactionReporting) |
19+
20+
## Example
21+
#### Old AuthorizeNetAIM example:
22+
```php
23+
define("AUTHORIZENET_API_LOGIN_ID", "YOURLOGIN");
24+
define("AUTHORIZENET_TRANSACTION_KEY", "YOURKEY");
25+
define("AUTHORIZENET_SANDBOX", true);
26+
$sale = new AuthorizeNetAIM;
27+
$sale->amount = "5.99";
28+
$sale->card_num = '6011000000000012';
29+
$sale->exp_date = '04/15';
30+
$response = $sale->authorizeAndCapture();
31+
if ($response->approved) {
32+
$transaction_id = $response->transaction_id;
33+
}
34+
```
35+
#### Corresponding new model code (charge-credit-card):
36+
```php
37+
require 'vendor/autoload.php';
38+
use net\authorize\api\contract\v1 as AnetAPI;
39+
use net\authorize\api\controller as AnetController;
40+
41+
define("AUTHORIZENET_LOG_FILE", "phplog");
42+
$merchantAuthentication = new AnetAPI\MerchantAuthenticationType();
43+
$merchantAuthentication->setName("YOURLOGIN");
44+
$merchantAuthentication->setTransactionKey("YOURKEY");
45+
// Create the payment data for a credit card
46+
$creditCard = new AnetAPI\CreditCardType();
47+
$creditCard->setCardNumber("6011000000000012");
48+
$creditCard->setExpirationDate("2015-04");
49+
$creditCard->setCardCode("123");
50+
51+
// Add the payment data to a paymentType object
52+
$paymentOne = new AnetAPI\PaymentType();
53+
$paymentOne->setCreditCard($creditCard);
54+
55+
$transactionRequestType = new AnetAPI\TransactionRequestType();
56+
$transactionRequestType->setTransactionType("authCaptureTransaction");
57+
$transactionRequestType->setAmount("5.99");
58+
$transactionRequestType->setPayment($paymentOne);
59+
60+
// Assemble the complete transaction request
61+
$request = new AnetAPI\CreateTransactionRequest();
62+
$request->setMerchantAuthentication($merchantAuthentication);
63+
$request->setTransactionRequest($transactionRequestType);
64+
65+
// Create the controller and get the response
66+
$controller = new AnetController\CreateTransactionController($request);
67+
$response = $controller->executeWithApiResponse(\net\authorize\api\constants\ANetEnvironment::SANDBOX);
68+
69+
if ($response != null) {
70+
// Check to see if the API request was successfully received and acted upon
71+
if ($response->getMessages()->getResultCode() == "Ok") {
72+
// Since the API request was successful, look for a transaction response
73+
// and parse it to display the results of authorizing the card
74+
$tresponse = $response->getTransactionResponse();
75+
76+
if ($tresponse != null && $tresponse->getMessages() != null) {
77+
echo " Successfully created transaction with Transaction ID: " . $tresponse->getTransId() . "\n";
78+
echo " Transaction Response Code: " . $tresponse->getResponseCode() . "\n";
79+
echo " Message Code: " . $tresponse->getMessages()[0]->getCode() . "\n";
80+
echo " Auth Code: " . $tresponse->getAuthCode() . "\n";
81+
echo " Description: " . $tresponse->getMessages()[0]->getDescription() . "\n";
82+
}
83+
}
84+
}
85+
```

README.md

+8-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,13 @@
1212
* An Authorize.Net account (see _Registration & Configuration_ section below)
1313
* TLS 1.2 capable versions of libcurl and OpenSSL (or its equivalent)
1414

15+
### Migrating from older versions
16+
Since August 2018, the Authorize.Net API has been reorganized to be more merchant focused. AuthorizeNetAIM, AuthorizeNetARB, AuthorizeNetCIM, Reporting and AuthorizeNetSIM classes have all been deprecated in favor of `net\authorize\api` . To see the full list of mapping of new features corresponding to the deprecated features, you can see [MIGRATING.md](MIGRATING.md).
17+
18+
### Contribution
19+
- If you need information or clarification about any Authorize.Net features, please create an issue for it. Also you can search in the [Authorize.Net developer community](https://community.developer.authorize.net/).
20+
- Before creating pull requests, please read [CONTRIBUTING.md](CONTRIBUTING.md)
21+
1522
### TLS 1.2
1623
The Authorize.Net APIs only support connections using the TLS 1.2 security protocol. This SDK communicates with the Authorize.Net API using `libcurl` and `OpenSSL` (or equivalent crypto library). It's important to make sure you have new enough versions of these components to support TLS 1.2. Additionally, it's very important to keep these components up to date going forward to mitigate the risk of any security flaws that may be discovered in these libraries.
1724

@@ -50,7 +57,7 @@ override the new secure-http default setting)*.
5057
{
5158
"require": {
5259
"php": ">=5.6",
53-
"authorizenet/authorizenet": "~1.9.7"
60+
"authorizenet/authorizenet": "~1.9.8"
5461
}
5562
}
5663
```

autoload.php

+7
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
11
<?php
2+
/**
3+
* @deprecated since version 1.9.8
4+
* @deprecated Always use composer generated autoload.php, by requiring vendor/autoload.php instead of autoload.php
5+
* @deprecated require "autoload.php"; --> require "vendor/autoload.php";
6+
*/
7+
trigger_error('Custom autoloader is deprecated, use composer generated "vendor/autoload.php" instead of "autoload.php" .', E_USER_DEPRECATED);
8+
29
/**
310
* Custom SPL autoloader for the AuthorizeNet SDK
411
*

classmap.php

+22-16
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010

1111
$baseDir = __DIR__ ;
1212
$libDir = $baseDir . DIRECTORY_SEPARATOR . 'lib' . DIRECTORY_SEPARATOR;
13-
$sharedDir = $libDir . 'shared' . DIRECTORY_SEPARATOR;
13+
$deprecated = $libDir . DIRECTORY_SEPARATOR . 'deprecated' . DIRECTORY_SEPARATOR;
14+
$sharedDir = $deprecated . DIRECTORY_SEPARATOR . 'shared' . DIRECTORY_SEPARATOR;
1415
$vendorDir = $baseDir . '/vendor';
1516

1617
return array(
@@ -44,6 +45,8 @@
4445
'JMS\Parser\SimpleLexer' => $vendorDir . '/jms/parser-lib/src/JMS/Parser/SimpleLexer.php',
4546
'JMS\Parser\SyntaxErrorException' => $vendorDir . '/jms/parser-lib/src/JMS/Parser/SyntaxErrorException.php',
4647
'JMS\Serializer\AbstractVisitor' => $vendorDir . '/jms/serializer/src/JMS/Serializer/AbstractVisitor.php',
48+
'JMS\Serializer\Accessor\AccessorStrategyInterface' => $vendorDir . '/jms/serializer/src/JMS/Serializer/Accessor/AccessorStrategyInterface.php',
49+
'JMS\Serializer\Accessor\DefaultAccessorStrategy' => $vendorDir . '/jms/serializer/src/JMS/Serializer/Accessor/DefaultAccessorStrategy.php',
4750
'JMS\Serializer\ArrayTransformerInterface' => $vendorDir . '/jms/serializer/src/JMS/Serializer/ArrayTransformerInterface.php',
4851
'JMS\Serializer\Context' => $vendorDir . '/jms/serializer/src/JMS/Serializer/Context.php',
4952
'JMS\Serializer\ContextFactory\CallableContextFactory' => $vendorDir . '/jms/serializer/src/JMS/Serializer/ContextFactory/CallableContextFactory.php',
@@ -52,13 +55,16 @@
5255
'JMS\Serializer\ContextFactory\DefaultDeserializationContextFactory' => $vendorDir . '/jms/serializer/src/JMS/Serializer/ContextFactory/DefaultDeserializationContextFactory.php',
5356
'JMS\Serializer\ContextFactory\DefaultSerializationContextFactory' => $vendorDir . '/jms/serializer/src/JMS/Serializer/ContextFactory/DefaultSerializationContextFactory.php',
5457
'JMS\Serializer\ContextFactory\DeserializationContextFactoryInterface' => $vendorDir . '/jms/serializer/src/JMS/Serializer/ContextFactory/DeserializationContextFactoryInterface.php',
55-
'JMS\Serializer\ContextFactory\SerializationContextFactoryInterface' => $vendorDir . '/jms/serializer/src/JMS/Serializer/ContextFactory/SerializationContextFactoryInterface.php',
58+
'JMS\Serializer\ContextFactory\SerializationContextFactoryInterface' => $vendorDir . '/jms/serializer/src/JMS/Serializer/ContextFactory/SerializationContextFactoryInterface.php',
5659
'JMS\Serializer\DeserializationContext' => $vendorDir . '/jms/serializer/src/JMS/Serializer/DeserializationContext.php',
5760
'JMS\Serializer\GenericDeserializationVisitor' => $vendorDir . '/jms/serializer/src/JMS/Serializer/GenericDeserializationVisitor.php',
5861
'JMS\Serializer\GenericSerializationVisitor' => $vendorDir . '/jms/serializer/src/JMS/Serializer/GenericSerializationVisitor.php',
5962
'JMS\Serializer\GraphNavigator' => $vendorDir . '/jms/serializer/src/JMS/Serializer/GraphNavigator.php',
63+
'JMS\Serializer\GraphNavigatorInterface' => $vendorDir . '/jms/serializer/src/JMS/Serializer/GraphNavigatorInterface.php',
64+
'JMS\Serializer\Handler\StdClassHandler' => $vendorDir . '/jms/serializer/src/JMS/Serializer/Handler/StdClassHandler.php',
6065
'JMS\Serializer\JsonDeserializationVisitor' => $vendorDir . '/jms/serializer/src/JMS/Serializer/JsonDeserializationVisitor.php',
6166
'JMS\Serializer\JsonSerializationVisitor' => $vendorDir . '/jms/serializer/src/JMS/Serializer/JsonSerializationVisitor.php',
67+
'JMS\Serializer\NullAwareVisitorInterface' => $vendorDir . '/jms/serializer/src/JMS/Serializer/NullAwareVisitorInterface.php',
6268
'JMS\Serializer\SerializationContext' => $vendorDir . '/jms/serializer/src/JMS/Serializer/SerializationContext.php',
6369
'JMS\Serializer\Serializer' => $vendorDir . '/jms/serializer/src/JMS/Serializer/Serializer.php',
6470
'JMS\Serializer\SerializerBuilder' => $vendorDir . '/jms/serializer/src/JMS/Serializer/SerializerBuilder.php',
@@ -196,30 +202,30 @@
196202
'Symfony\Component\Yaml\Parser' => $vendorDir . '/symfony/yaml/Parser.php',
197203
'Symfony\Component\Yaml\Inline' => $vendorDir . '/symfony/yaml/Inline.php',
198204

199-
'AuthorizeNetAIM' => $libDir . 'AuthorizeNetAIM.php',
200-
'AuthorizeNetAIM_Response' => $libDir . 'AuthorizeNetAIM.php',
201-
'AuthorizeNetARB' => $libDir . 'AuthorizeNetARB.php',
202-
'AuthorizeNetARB_Response' => $libDir . 'AuthorizeNetARB.php',
205+
'AuthorizeNetAIM' => $deprecated . 'AuthorizeNetAIM.php',
206+
'AuthorizeNetAIM_Response' => $deprecated . 'AuthorizeNetAIM.php',
207+
'AuthorizeNetARB' => $deprecated . 'AuthorizeNetARB.php',
208+
'AuthorizeNetARB_Response' => $deprecated . 'AuthorizeNetARB.php',
203209
'AuthorizeNetAddress' => $sharedDir . 'AuthorizeNetTypes.php',
204210
'AuthorizeNetBankAccount' => $sharedDir . 'AuthorizeNetTypes.php',
205-
'AuthorizeNetCIM' => $libDir . 'AuthorizeNetCIM.php',
206-
'AuthorizeNetCIM_Response' => $libDir . 'AuthorizeNetCIM.php',
207-
'AuthorizeNetCP' => $libDir . 'AuthorizeNetCP.php',
208-
'AuthorizeNetCP_Response' => $libDir . 'AuthorizeNetCP.php',
211+
'AuthorizeNetCIM' => $deprecated . 'AuthorizeNetCIM.php',
212+
'AuthorizeNetCIM_Response' => $deprecated . 'AuthorizeNetCIM.php',
213+
'AuthorizeNetCP' => $deprecated . 'AuthorizeNetCP.php',
214+
'AuthorizeNetCP_Response' => $deprecated . 'AuthorizeNetCP.php',
209215
'AuthorizeNetCreditCard' => $sharedDir . 'AuthorizeNetTypes.php',
210216
'AuthorizeNetCustomer' => $sharedDir . 'AuthorizeNetTypes.php',
211-
'AuthorizeNetDPM' => $libDir . 'AuthorizeNetDPM.php',
217+
'AuthorizeNetDPM' => $deprecated . 'AuthorizeNetDPM.php',
212218
'AuthorizeNetException' => $sharedDir . 'AuthorizeNetException.php',
213219
'AuthorizeNetLineItem' => $sharedDir . 'AuthorizeNetTypes.php',
214220
'AuthorizeNetPayment' => $sharedDir . 'AuthorizeNetTypes.php',
215221
'AuthorizeNetPaymentProfile' => $sharedDir . 'AuthorizeNetTypes.php',
216222
'AuthorizeNetRequest' => $sharedDir . 'AuthorizeNetRequest.php',
217223
'AuthorizeNetResponse' => $sharedDir . 'AuthorizeNetResponse.php',
218-
'AuthorizeNetSIM' => $libDir . 'AuthorizeNetSIM.php',
219-
'AuthorizeNetSIM_Form' => $libDir . 'AuthorizeNetSIM.php',
220-
'AuthorizeNetSOAP' => $libDir . 'AuthorizeNetSOAP.php',
221-
'AuthorizeNetTD' => $libDir . 'AuthorizeNetTD.php',
222-
'AuthorizeNetTD_Response' => $libDir . 'AuthorizeNetTD.php',
224+
'AuthorizeNetSIM' => $deprecated . 'AuthorizeNetSIM.php',
225+
'AuthorizeNetSIM_Form' => $deprecated . 'AuthorizeNetSIM.php',
226+
'AuthorizeNetSOAP' => $deprecated . 'AuthorizeNetSOAP.php',
227+
'AuthorizeNetTD' => $deprecated . 'AuthorizeNetTD.php',
228+
'AuthorizeNetTD_Response' => $deprecated . 'AuthorizeNetTD.php',
223229
'AuthorizeNetTransaction' => $sharedDir . 'AuthorizeNetTypes.php',
224230
'AuthorizeNetXMLResponse' => $sharedDir . 'AuthorizeNetXMLResponse.php',
225231
'AuthorizeNet_Subscription' => $sharedDir . 'AuthorizeNetTypes.php',

lib/AuthorizeNetAIM.php renamed to lib/deprecated/AuthorizeNetAIM.php

+10
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,14 @@
11
<?php
2+
/**
3+
* @deprecated since version 1.9.8
4+
* @deprecated We have reorganized and simplified the Authorize.Net API to ease integration and to focus on merchants' needs.
5+
* @deprecated We have deprecated AIM, ARB, CIM, and Reporting as separate options, in favor of AuthorizeNet::API.
6+
* @deprecated We have also deprecated SIM as a separate option, in favor of Accept Hosted. See https://developer.authorize.net/api/reference/features/accept_hosted.html for details on Accept Hosted.
7+
* @deprecated For details on the deprecation and replacement of legacy Authorize.Net methods, visit https://developer.authorize.net/api/upgrade_guide/.
8+
* @deprecated For AIM, refer examples in https://github.com/AuthorizeNet/sample-code-php/tree/master/PaymentTransactions
9+
*/
10+
trigger_error('AuthorizeNetAIM is deprecated, use AuthorizeNet::API instead. For AIM, see examples in https://github.com/AuthorizeNet/sample-code-php/tree/master/PaymentTransactions .', E_USER_DEPRECATED);
11+
212
/**
313
* Easily interact with the Authorize.Net AIM API.
414
*

lib/AuthorizeNetARB.php renamed to lib/deprecated/AuthorizeNetARB.php

+10
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,14 @@
11
<?php
2+
/**
3+
* @deprecated since version 1.9.8
4+
* @deprecated We have reorganized and simplified the Authorize.Net API to ease integration and to focus on merchants' needs.
5+
* @deprecated We have deprecated AIM, ARB, CIM, and Reporting as separate options, in favor of AuthorizeNet::API.
6+
* @deprecated We have also deprecated SIM as a separate option, in favor of Accept Hosted. See https://developer.authorize.net/api/reference/features/accept_hosted.html for details on Accept Hosted.
7+
* @deprecated For details on the deprecation and replacement of legacy Authorize.Net methods, visit https://developer.authorize.net/api/upgrade_guide/.
8+
* @deprecated For ARB, refer examples in https://github.com/AuthorizeNet/sample-code-php/tree/master/RecurringBilling
9+
*/
10+
trigger_error('AuthorizeNetARB is deprecated, use AuthorizeNet::API instead. For ARB, see examples in https://github.com/AuthorizeNet/sample-code-php/tree/master/RecurringBilling .', E_USER_DEPRECATED);
11+
212
/**
313
* Easily interact with the Authorize.Net ARB XML API.
414
*

0 commit comments

Comments
 (0)