Skip to content

Commit 43dac8b

Browse files
authored
Merge pull request #142 from vijayabraj/master
Deprecating old model code of Java SDK
2 parents 3a99433 + ea93c55 commit 43dac8b

File tree

91 files changed

+948
-9
lines changed

Some content is hidden

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

91 files changed

+948
-9
lines changed

CONTRIBUTING.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
Thanks for contributing to the Authorize.Net Java 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-java/tree/master/src/main/java/net/authorize/api/contract/v1) and [controller](https://github.com/AuthorizeNet/sdk-java/tree/master/src/main/java/net/authorize/api/controller) folders, except [controller/base](https://github.com/AuthorizeNet/sdk-java/tree/master/src/main/java/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 the [future branch](https://github.com/AuthorizeNet/sdk-java/tree/future). Before submitting an issue or pull request, check the future branch first to see if a fix has already been merged.
9+
- **Always use the future branch for pull requests.** We will first merge pull requests to the future branch, before pushing to the master branch for the next release.

MIGRATING.md

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
# Migrating from Legacy Authorize.Net Classes
2+
3+
Authorize.Net no longer supports several legacy classes, including AIM, ARB and others listed below, as part of sdk-java. If you are using any of these, we recommend that you update your code to use the new Authorize.Net API classes under (net/authorize/api).
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+
| AIM (net/authorize/aim) | [PaymentTransactions](https://developer.authorize.net/api/reference/index.html#payment-transactions) | [sample-code-java/PaymentTransactions](https://github.com/AuthorizeNet/sample-code-java/tree/master/src/main/java/net/authorize/sample/PaymentTransactions) |
11+
| ARB (net/authorize/arb) | [RecurringBilling](https://developer.authorize.net/api/reference/index.html#recurring-billing) | [sample-code-java/Recurring Billing](https://github.com/AuthorizeNet/sample-code-java/tree/master/src/main/java/net/authorize/sample/RecurringBilling) |
12+
| CIM (net/authorize/cim) | [CustomerProfiles](https://developer.authorize.net/api/reference/index.html#customer-profiles) | [sample-code-java/CustomerProfiles](https://github.com/AuthorizeNet/sample-code-java/tree/master/src/main/java/net/authorize/sample/CustomerProfiles) |
13+
| SIM (net/authorize/sim) | [Accept Hosted](https://developer.authorize.net/content/developer/en_us/api/reference/features/accept_hosted.html) | Not available |
14+
| Reporting (net/authorize/reporting) | [TransactionReporting](https://developer.authorize.net/api/reference/index.html#transaction-reporting) | [sample-code-java/TransactionReporting](https://github.com/AuthorizeNet/sample-code-java/tree/master/src/main/java/net/authorize/sample/TransactionReporting) |
15+
16+
## Example
17+
#### Old AuthorizeNetAIM example:
18+
```java
19+
import net.authorize.DeviceType;
20+
import net.authorize.Environment;
21+
import net.authorize.MarketType;
22+
import net.authorize.Merchant;
23+
import net.authorize.TransactionType;
24+
25+
import net.authorize.aim.Transaction;
26+
import net.authorize.aim.cardpresent.Result;
27+
28+
import net.authorize.data.creditcard.CardType;
29+
import net.authorize.data.creditcard.CreditCard;
30+
31+
public class ChargeCreditCard{
32+
33+
//AIM
34+
public static void main(String[] args) {
35+
CreditCard creditCard = CreditCard.createCreditCard();
36+
creditCard.setCardType(CardType.VISA);
37+
creditCard.setCreditCardNumber("4111111111111111");
38+
creditCard.setExpirationMonth("12");
39+
creditCard.setExpirationYear("2020");
40+
41+
merchant = Merchant.createMerchant(Environment.SANDBOX, apiLoginID, transactionKey);
42+
merchant.setDeviceType(DeviceType.VIRTUAL_TERMINAL);
43+
merchant.setMarketType(MarketType.RETAIL);
44+
45+
// create transaction
46+
Transaction authCaptureTransaction = merchant.createAIMTransaction(
47+
TransactionType.AUTH_CAPTURE, totalAmount);
48+
authCaptureTransaction.setCreditCard(creditCard);
49+
50+
Result<Transaction> result = (Result<Transaction>) merchant.postTransaction(authCaptureTransaction);
51+
}
52+
}
53+
```
54+
#### Corresponding new model code (charge-credit-card):
55+
```java
56+
import java.math.BigDecimal;
57+
import java.math.RoundingMode;
58+
59+
import net.authorize.Environment;
60+
import net.authorize.api.contract.v1.*;
61+
import net.authorize.api.controller.CreateTransactionController;
62+
import net.authorize.api.controller.base.ApiOperationBase;
63+
64+
public class ChargeCreditCard {
65+
66+
public static void main(String[] args) {
67+
68+
// Set the request to operate in either the sandbox or production environment
69+
ApiOperationBase.setEnvironment(Environment.SANDBOX);
70+
71+
// Create object with merchant authentication details
72+
MerchantAuthenticationType merchantAuthenticationType = new MerchantAuthenticationType() ;
73+
merchantAuthenticationType.setName(apiLoginId);
74+
merchantAuthenticationType.setTransactionKey(transactionKey);
75+
76+
// Populate the payment data
77+
PaymentType paymentType = new PaymentType();
78+
CreditCardType creditCard = new CreditCardType();
79+
creditCard.setCardNumber("4111111111111111");
80+
creditCard.setExpirationDate("1220");
81+
paymentType.setCreditCard(creditCard);
82+
83+
// Create the payment transaction object
84+
TransactionRequestType txnRequest = new TransactionRequestType();
85+
txnRequest.setTransactionType(TransactionTypeEnum.AUTH_CAPTURE_TRANSACTION.value());
86+
txnRequest.setPayment(paymentType);
87+
txnRequest.setAmount(new BigDecimal(amount).setScale(2, RoundingMode.CEILING));
88+
89+
// Create the API request and set the parameters for this specific request
90+
CreateTransactionRequest apiRequest = new CreateTransactionRequest();
91+
apiRequest.setMerchantAuthentication(merchantAuthenticationType);
92+
apiRequest.setTransactionRequest(txnRequest);
93+
94+
// Call the controller
95+
CreateTransactionController controller = new CreateTransactionController(apiRequest);
96+
controller.execute();
97+
98+
// Get the response
99+
CreateTransactionResponse response = new CreateTransactionResponse();
100+
response = controller.getApiResponse();
101+
102+
return response;
103+
}
104+
}
105+
```

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,13 @@ _Note: Support for building the SDK with either Ant or Maven has been made. Plea
2323
* hamcrest-library-1.3.jar : unit testing
2424
* jmock-2.6.0.jar : unit testing
2525

26+
### Migrating from older versions
27+
Since August 2018, the Authorize.Net API has been reorganized to be more merchant focused. AuthorizeNet AIM, ARB, CIM, Transaction Reporting and SIM 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).
28+
29+
### Contribution
30+
- 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/).
31+
- Before creating pull requests, please read [CONTRIBUTING.md](CONTRIBUTING.md)
32+
2633
### TLS 1.2
2734
The Authorize.Net APIs only support connections using the TLS 1.2 security protocol. It's important to make sure you have new enough versions of all required 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 your system or any libraries it uses.
2835

src/main/java/net/authorize/AuthNetField.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,16 @@
22

33
/**
44
* Enumeration to handle all the x_ field names and xml element names
5+
*
6+
* @deprecated since version 1.9.8
7+
* @deprecated We have reorganized and simplified the Authorize.Net API to ease integration and to focus on merchants' needs.
8+
* @deprecated We have deprecated AIM, ARB, CIM, and Reporting as separate options, in favor of AuthorizeNet::API (package: net.authorize.api.*).
9+
* @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.
10+
* @deprecated For details on AIM, see https://github.com/AuthorizeNet/sample-code-java/tree/master/src/main/java/net/authorize/sample/PaymentTransactions.
11+
* @deprecated For details on the deprecation and replacement of legacy Authorize.Net methods, visit https://developer.authorize.net/api/upgrade_guide/.
12+
*
513
*/
14+
@Deprecated
615
public enum AuthNetField {
716
ELEMENT__ACCOUNT_NUMBER("AccountNumber"),
817
ELEMENT__ACCOUNT_TYPE("AccountType"),

src/main/java/net/authorize/Merchant.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,15 @@
1515
* The Merchant is also responsible for creating transactions and
1616
* posting them to the gateway are performed through the Merchant.
1717
*
18+
* @deprecated since version 1.9.8
19+
* @deprecated We have reorganized and simplified the Authorize.Net API to ease integration and to focus on merchants' needs.
20+
* @deprecated We have deprecated AIM, ARB, CIM, and Reporting as separate options, in favor of AuthorizeNet::API (package: net.authorize.api.*).
21+
* @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.
22+
* @deprecated For details on AIM, see https://github.com/AuthorizeNet/sample-code-java/tree/master/src/main/java/net/authorize/sample/PaymentTransactions.
23+
* @deprecated For details on the deprecation and replacement of legacy Authorize.Net methods, visit https://developer.authorize.net/api/upgrade_guide/.
24+
*
1825
*/
26+
@Deprecated
1927
public class Merchant implements Serializable {
2028

2129
/**
@@ -203,6 +211,7 @@ public void setUserRef(String userRef) {
203211
*
204212
* @return A newly created Transaction will be returned.
205213
*/
214+
@Deprecated
206215
public net.authorize.aim.Transaction createAIMTransaction(TransactionType transactionType,
207216
BigDecimal amount) {
208217
return net.authorize.aim.Transaction.createTransaction(this, transactionType, amount);
@@ -217,6 +226,7 @@ public net.authorize.aim.Transaction createAIMTransaction(TransactionType transa
217226
*
218227
* @return A newly created Transaction will be returned.
219228
*/
229+
@Deprecated
220230
public net.authorize.sim.Transaction createSIMTransaction(TransactionType transactionType,
221231
long fingerPrintSequence, BigDecimal amount) {
222232

@@ -231,6 +241,7 @@ public net.authorize.sim.Transaction createSIMTransaction(TransactionType transa
231241
*
232242
* @return A newly created Transaction will be returned.
233243
*/
244+
@Deprecated
234245
public net.authorize.arb.Transaction createARBTransaction(net.authorize.arb.TransactionType transactionType, Subscription subscription) {
235246

236247
return net.authorize.arb.Transaction.createTransaction(this, transactionType, subscription);
@@ -243,6 +254,7 @@ public net.authorize.arb.Transaction createARBTransaction(net.authorize.arb.Tran
243254
*
244255
* @return A newly created Transaction will be returned.
245256
*/
257+
@Deprecated
246258
public net.authorize.cim.Transaction createCIMTransaction(net.authorize.cim.TransactionType transactionType) {
247259

248260
return net.authorize.cim.Transaction.createTransaction(this, transactionType);
@@ -255,6 +267,7 @@ public net.authorize.cim.Transaction createCIMTransaction(net.authorize.cim.Tran
255267
*
256268
* @return A newly created Transaction will be returned.
257269
*/
270+
@Deprecated
258271
public net.authorize.reporting.Transaction createReportingTransaction(net.authorize.reporting.TransactionType transactionType) {
259272

260273
return net.authorize.reporting.Transaction.createTransaction(this, transactionType);
@@ -268,6 +281,7 @@ public net.authorize.reporting.Transaction createReportingTransaction(net.author
268281
* @return Result is returned with each post.
269282
*
270283
*/
284+
@Deprecated
271285
public net.authorize.Result<?> postTransaction(Transaction transaction) {
272286

273287
Result<Transaction> result = null;

src/main/java/net/authorize/PaymentMethod.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,16 @@
33
/**
44
* The method of payment for the transaction.
55
* CC (credit card) or ECHECK (electronic check).
6+
*
7+
* @deprecated since version 1.9.8
8+
* @deprecated We have reorganized and simplified the Authorize.Net API to ease integration and to focus on merchants' needs.
9+
* @deprecated We have deprecated AIM, ARB, CIM, and Reporting as separate options, in favor of AuthorizeNet::API (package: net.authorize.api.*).
10+
* @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.
11+
* @deprecated For details on AIM, see https://github.com/AuthorizeNet/sample-code-java/tree/master/src/main/java/net/authorize/sample/PaymentTransactions.
12+
* @deprecated For details on the deprecation and replacement of legacy Authorize.Net methods, visit https://developer.authorize.net/api/upgrade_guide/.
13+
*
614
*/
15+
@Deprecated
716
public enum PaymentMethod {
817
CREDIT_CARD("CC"),
918
E_CHECK("ECHECK"),

src/main/java/net/authorize/ResponseCode.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,15 @@
66
* Response code indicates the overall status of the transaction
77
* with possible values of approved, declined, error, or held for review.
88
*
9+
* @deprecated since version 1.9.8
10+
* @deprecated We have reorganized and simplified the Authorize.Net API to ease integration and to focus on merchants' needs.
11+
* @deprecated We have deprecated AIM, ARB, CIM, and Reporting as separate options, in favor of AuthorizeNet::API (package: net.authorize.api.*).
12+
* @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.
13+
* @deprecated For details on AIM, see https://github.com/AuthorizeNet/sample-code-java/tree/master/src/main/java/net/authorize/sample/PaymentTransactions.
14+
* @deprecated For details on the deprecation and replacement of legacy Authorize.Net methods, visit https://developer.authorize.net/api/upgrade_guide/.
15+
*
916
*/
17+
@Deprecated
1018
public enum ResponseCode {
1119
APPROVED(1, "This transaction has been approved."),
1220
DECLINED(2, "This transaction has been declined"),

src/main/java/net/authorize/ResponseField.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,16 @@
1010
*
1111
* This enum is leveraged across all the integrations of
1212
* AIM,SIM,DPM,ARB and CIM.
13+
*
14+
* @deprecated since version 1.9.8
15+
* @deprecated We have reorganized and simplified the Authorize.Net API to ease integration and to focus on merchants' needs.
16+
* @deprecated We have deprecated AIM, ARB, CIM, and Reporting as separate options, in favor of AuthorizeNet::API (package: net.authorize.api.*).
17+
* @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.
18+
* @deprecated For details on AIM, see https://github.com/AuthorizeNet/sample-code-java/tree/master/src/main/java/net/authorize/sample/PaymentTransactions.
19+
* @deprecated For details on the deprecation and replacement of legacy Authorize.Net methods, visit https://developer.authorize.net/api/upgrade_guide/.
1320
*
1421
*/
22+
@Deprecated
1523
public enum ResponseField {
1624
RESPONSE_CODE(AuthNetField.X_RESPONSE_CODE.getFieldName()),
1725
RESPONSE_SUBCODE(null),

src/main/java/net/authorize/ResponseReasonCode.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,15 @@
66
/**
77
* Response Reason Code is a numeric representation of a more specific reason for the transaction status.
88
*
9+
* @deprecated since version 1.9.8
10+
* @deprecated We have reorganized and simplified the Authorize.Net API to ease integration and to focus on merchants' needs.
11+
* @deprecated We have deprecated AIM, ARB, CIM, and Reporting as separate options, in favor of AuthorizeNet::API (package: net.authorize.api.*).
12+
* @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.
13+
* @deprecated For details on AIM, see https://github.com/AuthorizeNet/sample-code-java/tree/master/src/main/java/net/authorize/sample/PaymentTransactions.
14+
* @deprecated For details on the deprecation and replacement of legacy Authorize.Net methods, visit https://developer.authorize.net/api/upgrade_guide/.
15+
*
916
*/
17+
@Deprecated
1018
public enum ResponseReasonCode {
1119

1220
RRC_1_1(ResponseCode.APPROVED, 1,"This transaction has been approved.", ""),

src/main/java/net/authorize/Result.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,16 @@
55
import java.security.MessageDigest;
66
import java.security.NoSuchAlgorithmException;
77

8+
/**
9+
*
10+
* @deprecated since version 1.9.8
11+
* @deprecated We have reorganized and simplified the Authorize.Net API to ease integration and to focus on merchants' needs.
12+
* @deprecated We have deprecated AIM, ARB, CIM, and Reporting as separate options, in favor of AuthorizeNet::API (package: net.authorize.api.*).
13+
* @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.
14+
* @deprecated For details on AIM, see https://github.com/AuthorizeNet/sample-code-java/tree/master/src/main/java/net/authorize/sample/PaymentTransactions.
15+
* @deprecated For details on the deprecation and replacement of legacy Authorize.Net methods, visit https://developer.authorize.net/api/upgrade_guide/.
16+
*/
17+
@Deprecated
818
public abstract class Result<T> implements Serializable {
919

1020
private static final long serialVersionUID = 1L;

0 commit comments

Comments
 (0)