Skip to content

Commit cc81fe7

Browse files
committed
Updating README.md about old model code deprecation
1 parent e924732 commit cc81fe7

File tree

3 files changed

+122
-0
lines changed

3 files changed

+122
-0
lines changed

CONTRIBUTING.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
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.

MIGRATING.md

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
# Migrating from Legacy Authorize.Net APIs
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 |
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) | - |
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+
// Run this sample from command line with:
67+
// java -jar target/ChargeCreditCard-jar-with-dependencies.jar
68+
//
69+
public static ANetApiResponse run(String apiLoginId, String transactionKey, Double amount) {
70+
71+
// Set the request to operate in either the sandbox or production environment
72+
ApiOperationBase.setEnvironment(Environment.SANDBOX);
73+
74+
// Create object with merchant authentication details
75+
MerchantAuthenticationType merchantAuthenticationType = new MerchantAuthenticationType() ;
76+
merchantAuthenticationType.setName(apiLoginId);
77+
merchantAuthenticationType.setTransactionKey(transactionKey);
78+
79+
// Populate the payment data
80+
PaymentType paymentType = new PaymentType();
81+
CreditCardType creditCard = new CreditCardType();
82+
creditCard.setCardNumber("4242424242424242");
83+
creditCard.setExpirationDate("0822");
84+
paymentType.setCreditCard(creditCard);
85+
86+
// Create the payment transaction object
87+
TransactionRequestType txnRequest = new TransactionRequestType();
88+
txnRequest.setTransactionType(TransactionTypeEnum.AUTH_CAPTURE_TRANSACTION.value());
89+
txnRequest.setPayment(paymentType);
90+
txnRequest.setAmount(new BigDecimal(amount).setScale(2, RoundingMode.CEILING));
91+
92+
// Create the API request and set the parameters for this specific request
93+
CreateTransactionRequest apiRequest = new CreateTransactionRequest();
94+
apiRequest.setMerchantAuthentication(merchantAuthenticationType);
95+
apiRequest.setTransactionRequest(txnRequest);
96+
97+
// Call the controller
98+
CreateTransactionController controller = new CreateTransactionController(apiRequest);
99+
controller.execute();
100+
101+
// Get the response
102+
CreateTransactionResponse response = new CreateTransactionResponse();
103+
response = controller.getApiResponse();
104+
105+
return response;
106+
}
107+
}
108+
```

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 are confused about any Authorize.Net features, please create an issue for it. Also you can search for it 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

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy