Skip to content

Commit 46bd7a1

Browse files
authored
Merge pull request AuthorizeNet#145 from AuthorizeNet/future
Changes for Release 1.9.8
2 parents 5addace + d3a7180 commit 46bd7a1

File tree

104 files changed

+1322
-70
lines changed

Some content is hidden

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

104 files changed

+1322
-70
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,6 @@ logs
33

44
#intellij files
55
.idea
6-
*.iml
6+
*.iml
7+
.DS_Store
8+
docs/.DS_Store

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

docs/javadocs/net/authorize/api/contract/v1/SettingNameEnum.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,6 @@ <h2 title="Enum SettingNameEnum" class="title">Enum SettingNameEnum</h2>
121121
&lt;enumeration value="footerEmailReceipt"/>
122122
&lt;enumeration value="recurringBilling"/>
123123
&lt;enumeration value="duplicateWindow"/>
124-
&lt;enumeration value="testRequest"/>
125124
&lt;enumeration value="hostedProfileReturnUrl"/>
126125
&lt;enumeration value="hostedProfileReturnUrlText"/>
127126
&lt;enumeration value="hostedProfilePageBorderVisible"/>

docs/javadocs/net/authorize/api/contract/v1/TransactionResponse.html

Lines changed: 0 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,6 @@ <h2 title="Class TransactionResponse" class="title">Class TransactionResponse</h
116116
&lt;element name="transId" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
117117
&lt;element name="refTransID" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
118118
&lt;element name="transHash" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
119-
&lt;element name="testRequest" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
120119
&lt;element name="accountNumber" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
121120
&lt;element name="accountType" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
122121
&lt;element name="splitTenderId" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
@@ -368,10 +367,6 @@ <h3>Field Summary</h3>
368367
<td class="colFirst"><code>protected <a href="../../../../../net/authorize/api/contract/v1/TransactionResponse.SplitTenderPayments.html" title="class in net.authorize.api.contract.v1">TransactionResponse.SplitTenderPayments</a></code></td>
369368
<td class="colLast"><code><strong><a href="../../../../../net/authorize/api/contract/v1/TransactionResponse.html#splitTenderPayments">splitTenderPayments</a></strong></code>&nbsp;</td>
370369
</tr>
371-
<tr class="altColor">
372-
<td class="colFirst"><code>protected java.lang.String</code></td>
373-
<td class="colLast"><code><strong><a href="../../../../../net/authorize/api/contract/v1/TransactionResponse.html#testRequest">testRequest</a></strong></code>&nbsp;</td>
374-
</tr>
375370
<tr class="rowColor">
376371
<td class="colFirst"><code>protected java.lang.String</code></td>
377372
<td class="colLast"><code><strong><a href="../../../../../net/authorize/api/contract/v1/TransactionResponse.html#transHash">transHash</a></strong></code>&nbsp;</td>
@@ -511,13 +506,6 @@ <h3>Method Summary</h3>
511506
<td class="colLast"><code><strong><a href="../../../../../net/authorize/api/contract/v1/TransactionResponse.html#getSplitTenderPayments()">getSplitTenderPayments</a></strong>()</code>
512507
<div class="block">Gets the value of the splitTenderPayments property.</div>
513508
</td>
514-
</tr>
515-
<tr class="altColor">
516-
<td class="colFirst"><code>java.lang.String</code></td>
517-
<td class="colLast"><code><strong><a href="../../../../../net/authorize/api/contract/v1/TransactionResponse.html#getTestRequest()">getTestRequest</a></strong>()</code>
518-
<div class="block">Gets the value of the testRequest property.</div>
519-
</td>
520-
</tr>
521509
<tr class="rowColor">
522510
<td class="colFirst"><code>java.lang.String</code></td>
523511
<td class="colLast"><code><strong><a href="../../../../../net/authorize/api/contract/v1/TransactionResponse.html#getTransHash()">getTransHash</a></strong>()</code>
@@ -631,13 +619,6 @@ <h3>Method Summary</h3>
631619
<td class="colLast"><code><strong><a href="../../../../../net/authorize/api/contract/v1/TransactionResponse.html#setSplitTenderPayments(net.authorize.api.contract.v1.TransactionResponse.SplitTenderPayments)">setSplitTenderPayments</a></strong>(<a href="../../../../../net/authorize/api/contract/v1/TransactionResponse.SplitTenderPayments.html" title="class in net.authorize.api.contract.v1">TransactionResponse.SplitTenderPayments</a>&nbsp;value)</code>
632620
<div class="block">Sets the value of the splitTenderPayments property.</div>
633621
</td>
634-
</tr>
635-
<tr class="altColor">
636-
<td class="colFirst"><code>void</code></td>
637-
<td class="colLast"><code><strong><a href="../../../../../net/authorize/api/contract/v1/TransactionResponse.html#setTestRequest(java.lang.String)">setTestRequest</a></strong>(java.lang.String&nbsp;value)</code>
638-
<div class="block">Sets the value of the testRequest property.</div>
639-
</td>
640-
</tr>
641622
<tr class="rowColor">
642623
<td class="colFirst"><code>void</code></td>
643624
<td class="colLast"><code><strong><a href="../../../../../net/authorize/api/contract/v1/TransactionResponse.html#setTransHash(java.lang.String)">setTransHash</a></strong>(java.lang.String&nbsp;value)</code>
@@ -759,15 +740,6 @@ <h4>transHash</h4>
759740
<pre>protected&nbsp;java.lang.String transHash</pre>
760741
</li>
761742
</ul>
762-
<a name="testRequest">
763-
<!-- -->
764-
</a>
765-
<ul class="blockList">
766-
<li class="blockList">
767-
<h4>testRequest</h4>
768-
<pre>protected&nbsp;java.lang.String testRequest</pre>
769-
</li>
770-
</ul>
771743
<a name="accountNumber">
772744
<!-- -->
773745
</a>
@@ -1099,30 +1071,6 @@ <h4>setTransHash</h4>
10991071
<code>String</code></dd></dl>
11001072
</li>
11011073
</ul>
1102-
<a name="getTestRequest()">
1103-
<!-- -->
1104-
</a>
1105-
<ul class="blockList">
1106-
<li class="blockList">
1107-
<h4>getTestRequest</h4>
1108-
<pre>public&nbsp;java.lang.String&nbsp;getTestRequest()</pre>
1109-
<div class="block">Gets the value of the testRequest property.</div>
1110-
<dl><dt><span class="strong">Returns:</span></dt><dd>possible object is
1111-
<code>String</code></dd></dl>
1112-
</li>
1113-
</ul>
1114-
<a name="setTestRequest(java.lang.String)">
1115-
<!-- -->
1116-
</a>
1117-
<ul class="blockList">
1118-
<li class="blockList">
1119-
<h4>setTestRequest</h4>
1120-
<pre>public&nbsp;void&nbsp;setTestRequest(java.lang.String&nbsp;value)</pre>
1121-
<div class="block">Sets the value of the testRequest property.</div>
1122-
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>value</code> - allowed object is
1123-
<code>String</code></dd></dl>
1124-
</li>
1125-
</ul>
11261074
<a name="getAccountNumber()">
11271075
<!-- -->
11281076
</a>

pom.xml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,11 @@
8181
<version>1.3</version>
8282
<scope>test</scope>
8383
</dependency>
84+
<dependency>
85+
<groupId>com.google.code.gson</groupId>
86+
<artifactId>gson</artifactId>
87+
<version>2.3.1</version>
88+
</dependency>
8489
</dependencies>
8590
<properties>
8691
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
@@ -145,16 +150,23 @@
145150
</plugin>
146151
</plugins>
147152
<resources>
153+
<resource>
154+
<directory>resources</directory>
155+
<filtering>true</filtering>
156+
<includes>
157+
<include>**/AuthorizedNetSensitiveTagsConfig.json</include>
158+
</includes>
159+
</resource>
148160
<resource>
149161
<directory>resources</directory>
150162
<filtering>false</filtering>
151163
<includes>
152-
<include>*</include>
164+
<include>**/*.*</include>
153165
</includes>
154166
<excludes>
155167
<exclude>log4j.properties</exclude>
156168
</excludes>
157-
</resource>
169+
</resource>
158170
</resources>
159171
</build>
160172
</project>
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
{
2+
"sensitiveTags": [
3+
{
4+
"tagName": "cardCode",
5+
"pattern": "",
6+
"replacement": "xxx",
7+
"disableMask": false
8+
},
9+
{
10+
"tagName": "cardNumber",
11+
"pattern": "(\\p{N}+)(\\p{N}{4})",
12+
"replacement": "xxxx-$2",
13+
"disableMask": false
14+
},
15+
{
16+
"tagName": "expirationDate",
17+
"pattern": "",
18+
"replacement": "xxx",
19+
"disableMask": false
20+
},
21+
{
22+
"tagName": "accountNumber",
23+
"pattern": "(\\p{N}+)(\\p{N}{4})",
24+
"replacement": "xxxx-$2",
25+
"disableMask": false
26+
},
27+
{
28+
"tagName": "nameOnAccount",
29+
"pattern": "",
30+
"replacement": "xxx",
31+
"disableMask": false
32+
},
33+
{
34+
"tagName": "transactionKey",
35+
"pattern": "",
36+
"replacement": "xxx",
37+
"disableMask": false
38+
}
39+
],
40+
"sensitiveStringRegexes": [
41+
"4\\p{N}{3}([\\ \\-]?)\\p{N}{4}\\1\\p{N}{4}\\1\\p{N}{4}",
42+
"4\\p{N}{3}([\\ \\-]?)(?:\\p{N}{4}\\1){2}\\p{N}(?:\\p{N}{3})?",
43+
"5[1-5]\\p{N}{2}([\\ \\-]?)\\p{N}{4}\\1\\p{N}{4}\\1\\p{N}{4}",
44+
"6(?:011|22(?:1(?=[\\ \\-]?(?:2[6-9]|[3-9]))|[2-8]|9(?=[\\ \\-]?(?:[01]|2[0-5])))|4[4-9]\\p{N}|5\\p{N}\\p{N})([\\ \\-]?)\\p{N}{4}\\1\\p{N}{4}\\1\\p{N}{4}",
45+
"35(?:2[89]|[3-8]\\p{N})([\\ \\-]?)\\p{N}{4}\\1\\p{N}{4}\\1\\p{N}{4}",
46+
"3[47]\\p{N}\\p{N}([\\ \\-]?)\\p{N}{6}\\1\\p{N}{5}"
47+
]
48+
}
49+

resources/project.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
project.basedir=${basedir}

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"),

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