Skip to content

Commit 9d11480

Browse files
authored
Merge pull request #213 from AuthorizeNet/future-alternate
Future alternate
2 parents 251f125 + 5fe5b87 commit 9d11480

File tree

274 files changed

+1417
-1387
lines changed

Some content is hidden

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

274 files changed

+1417
-1387
lines changed

.github/workflows/java-workflow.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
fail-fast: false
1616
matrix:
1717
operating-system: [ubuntu-latest, macos-latest, windows-latest]
18-
java-version: ['8'] # , '11', '16', '17', '18', '19', '20', '21', '22'] # Blocking higher versions SDK using jaxb
18+
java-version: ['11', '16', '17', '18', '19', '20', '21', '22'] # Removed Java 8 as it is incompatible with jakarta
1919
distribution: ['temurin']
2020
runs-on: ${{matrix.operating-system}}
2121
steps:
@@ -32,13 +32,13 @@ jobs:
3232
uses: actions/checkout@v4
3333
with:
3434
repository: 'authorizenet/sample-code-java'
35-
ref: 'future'
35+
ref: 'future-alternate'
3636
path: ${{env.sample_code_java}}
37-
- name: Setup Java 1.8 to build the SDK
37+
- name: Setup Java 17 to build the SDK
3838
uses: actions/setup-java@v2
3939
with:
4040
distribution: 'temurin'
41-
java-version: '8'
41+
java-version: '17'
4242
- name: Build the Java SDK
4343
run: |
4444
mvn -version

README.md

Lines changed: 49 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,20 @@
11
# Authorize.Net Java SDK
22

3-
[![Travis CI Status](https://travis-ci.org/AuthorizeNet/sdk-java.svg?branch=master)](https://travis-ci.org/AuthorizeNet/sdk-java)
4-
[![Code Climate](https://codeclimate.com/github/AuthorizeNet/sdk-java/badges/gpa.svg)](https://codeclimate.com/github/AuthorizeNet/sdk-java)
3+
[![Authorize.net Java CI](https://github.com/AuthorizeNet/sdk-java/actions/workflows/java-workflow.yml/badge.svg?branch=master)](https://github.com/AuthorizeNet/sdk-java/actions/workflows/java-workflow.yml)
54
[![Maven Central](https://img.shields.io/maven-central/v/net.authorize/anet-java-sdk.svg?style=flat)](http://mvnrepository.com/artifact/net.authorize/anet-java-sdk)
6-
5+
6+
## IMPORTANT NOTE
7+
8+
### Support for Java 1.8
9+
10+
**A new version that supports Java 1.8 is `v2.0.7`. This is the _LAST_ release with support for Java 1.8.**
11+
12+
### Support for Java 9 and higher
13+
14+
**A new version of the SDK has been released that supports Java 9 and higher. This new version is `v3.0.0`.**
15+
716
## Requirements
8-
* JDK 1.5.0 to JDK 1.8.0
17+
* JDK 9 and higher
918
* Ant 1.6.2 or higher (build SDK only)
1019
* Maven 2.2.0 or higher (build SDK only)
1120
* An Authorize.Net account (see _Registration & Configuration_ section below)
@@ -15,20 +24,28 @@ _Note 1: Support for building the SDK with either Ant or Maven has been made. Pl
1524
_Note 2: Support for higher versions of JDK (>= 1.9.0) has not been made available._
1625

1726
### Dependencies
18-
* commons-logging-1.1.1.jar : logging
19-
* log4j-2.17.1.jar : logging
20-
* httpclient-4.0.1.jar : http communication with the payment gateway
21-
* httpcore-4.0.1.jar : http communication with the payment gateway
22-
* junit-4.8.2.jar : unit testing
23-
* hamcrest-core-1.3.jar : unit testing
24-
* hamcrest-library-1.3.jar : unit testing
25-
* jmock-2.6.0.jar : unit testing
27+
* commons-logging-1.3.3
28+
* log4j-2.23.1
29+
* log4j-jcl-2.23.1
30+
* log4j-api-2.23.1
31+
* log4j-core-2.23.1
32+
* log4j-1.2-api-2.23.1
33+
* httpclient5-5.3.1
34+
* httpcore5-5.2.5
35+
* gson-2.11.0
36+
* jakarta.xml.bind-api-4.0.2
37+
* jaxb-runtime-4.0.5
38+
* jackson-module-jakarta-xmlbind-annotations-2.17.2
39+
* junit-4.13.1
40+
* hamcrest-core-1.3
41+
* hamcrest-library-1.3
42+
* jmock-2.6.0
2643

2744
### Migrating from older versions
28-
Since August 2018, the Authorize.Net API has been reorganized to be more merchant focused. Authorize.Net AIM, ARB, CIM, Transaction Reporting, and SIM classes have been deprecated in favor of `net\authorize\api`. To see the full list of mapping of new features corresponding to the deprecated features, see [MIGRATING.md](MIGRATING.md).
45+
Since August 2018, the Authorize.Net API has been reorganized to be more merchant focused. Authorize.Net AIM, ARB, CIM, Transaction Reporting, and SIM classes have been deprecated in favor of `net\authorize\api`. To see the full list of mapping of new features corresponding to the deprecated features, see [MIGRATING.md](MIGRATING.md).
2946

3047
### Contribution
31-
- If you need information or clarification about Authorize.Net features, create an issue with your question. You can also search the [Authorize.Net developer community](https://community.developer.authorize.net/) for discussions related to your question.
48+
- If you need information or clarification about Authorize.Net features, create an issue with your question. You can also search the [Authorize.Net developer community](https://community.developer.authorize.net/) for discussions related to your question.
3249
- Before creating pull requests, read [the contributors guide](CONTRIBUTING.md).
3350

3451
### TLS 1.2
@@ -68,7 +85,7 @@ Authorize.Net maintains a complete sandbox environment for testing and developme
6885
ApiOperationBase.setEnvironment(Environment.PRODUCTION);
6986
```
7087

71-
API credentials are different for each environment, so be sure to switch to the appropriate credentials when switching environments.
88+
API credentials are different for each environment, so be sure to switch to the appropriate credentials when switching environments.
7289

7390
## SDK Usage Examples and Sample Code
7491
When using this SDK, downloading the Authorize.Net sample code repository is recommended.
@@ -127,27 +144,22 @@ To create the javadocs:
127144
### Testing Guide
128145
For additional help in testing your own code, Authorize.Net maintains a [comprehensive testing guide](http://developer.authorize.net/hello_world/testing_guide/) that includes test credit card numbers to use and special triggers to generate certain responses from the sandbox environment.
129146

130-
## Logging Sensitive Data
131-
132-
The Authorize.Net Java SDK uses Log4J framework for logging purposes. Enable the logger by keeping a configuration file `Log4j.properties` in the resources folder of the application. A sample [Log4.properties](https://github.com/AuthorizeNet/sdk-java/blob/master/resources/log4j.properties) file has been provided as a reference.
133-
134-
The possible log levels are `DEBUG, INFO, WARN, ERROR` and `FATAL`. There is a new pattern layout introduced to mask sensitive data while logging and can be used with the application by providing the following configurations in the `Log4j.properties` file:
135-
136-
```
137-
// Default configuration which logs the entries in clear text
138-
139-
log4j.appender.S.layout = org.apache.log4j.PatternLayout
140-
log4j.appender.R.layout = org.apache.log4j.PatternLayout
141-
142-
// Configuration which masks the sensitive data in the log entries
143-
144-
log4j.appender.S.layout = net.authorize.util.SensitiveFilterLayout
145-
log4j.appender.R.layout = net.authorize.util.SensitiveFilterLayout
146-
147-
```
148-
149-
By default the logger comes with two appenders, **console** and **file transport**.
150-
147+
## Logging Sensitive Data
148+
149+
The Authorize.Net Java SDK uses Log4J2 framework for logging purposes. Enable the logger by keeping a configuration file `log4j2.xml` in the resources folder of the application. A sample [log4j2.xml](https://github.com/AuthorizeNet/sdk-java/blob/master/resources/log4j2.xml) file has been provided as a reference.
150+
151+
The possible log levels are `DEBUG, INFO, WARN, ERROR` and `FATAL`. There is a new pattern layout introduced to mask sensitive data while logging and can be used with the application by making the following configurations in the `log4j2.xml` file:
152+
153+
1. Create your own appender under `<Appenders></Appenders>` and insert the `<PatternLayout><pattern></pattern></PatternLayout>` section. (Example is present in the `log4j2.xml` file)
154+
* To enable masking of sensitive data, replace `%m` with `%maskedMessage`.
155+
* To disable masking, replace `%maskedMessage` with `%m`.
156+
2. Create a logger under `<Loggers></Loggers>`
157+
3. The `name` field in the `<Logger>` should contain the namespace from where log messages needs to be written to file.
158+
4. Attach an `<AppenderRef>` section where the `ref` field uses one of the Appenders that have been created under the `<Appenders>` section.
159+
5. Do **NOT** modify the logger with `<Root>`.
160+
161+
By default the logger comes with two appenders, **LogToConsole** and **RollingFile**.
162+
151163
The sensitive fields that are masked during logging are:
152164
* Card Number
153165
* Card Code
@@ -156,7 +168,7 @@ The sensitive fields that are masked during logging are:
156168
* Account Number
157169
* Name on Account
158170

159-
There is also a list of regular expressions which the sensitive logger uses to mask credit card numbers while logging.
171+
There is also a list of regular expressions which the sensitive logger uses to mask credit card numbers while logging.
160172

161173
More information on the regular expressions used during sensitive data logging [can be found here](https://github.com/AuthorizeNet/sdk-java/blob/master/resources/AuthorizedNetSensitiveTagsConfig.json).
162174

pom.xml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,22 @@
120120
<version>2.11.0</version>
121121
<scope>compile</scope>
122122
</dependency>
123+
<!-- Required for JVM after JDK 9 -->
124+
<dependency>
125+
<groupId>jakarta.xml.bind</groupId>
126+
<artifactId>jakarta.xml.bind-api</artifactId>
127+
<version>4.0.2</version>
128+
</dependency>
129+
<dependency>
130+
<groupId>org.glassfish.jaxb</groupId>
131+
<artifactId>jaxb-runtime</artifactId>
132+
<version>4.0.5</version>
133+
</dependency>
134+
<dependency>
135+
<groupId>com.fasterxml.jackson.module</groupId>
136+
<artifactId>jackson-module-jakarta-xmlbind-annotations</artifactId>
137+
<version>2.17.2</version>
138+
</dependency>
123139
</dependencies>
124140
<properties>
125141
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

scripts/generateObjectsFromXsd.cmd

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,5 +81,11 @@ FOR %%x IN (Request Response) DO (
8181
)
8282
)
8383
DEL /q /s *.bak
84+
85+
FOR /r "%XSDSRCDIR%%XSDGENFOLDER%" %%F IN (*.java) DO (
86+
@ECHO Converting %%F to use Jakarta
87+
POWERSHELL -Command "(Get-Content '%%F') | ForEach-Object { $_ -replace 'import javax.xml.bind', 'import jakarta.xml.bind' } | ForEach-Object { $_ -replace '@javax.xml.bind', '@jakarta.xml.bind' } | ForEach-Object { $_ -replace 'elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED', 'elementFormDefault = jakarta.xml.bind.annotation.XmlNsForm.QUALIFIED' } | Set-Content '%%F'"
88+
)
89+
8490
ENDLOCAL
8591
@ECHO FINISHED %DATE%-%TIME%

src/main/java/net/authorize/api/contract/v1/ANetApiRequest.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,17 @@
22
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802
33
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
44
// Any modifications to this file will be lost upon recompilation of the source schema.
5-
// Generated on: 2024.08.29 at 03:44:59 AM IST
5+
// Generated on: 2024.08.29 at 03:15:31 AM IST
66
//
77

88

99
package net.authorize.api.contract.v1;
1010

11-
import javax.xml.bind.annotation.XmlAccessType;
12-
import javax.xml.bind.annotation.XmlAccessorType;
13-
import javax.xml.bind.annotation.XmlElement;
14-
import javax.xml.bind.annotation.XmlSeeAlso;
15-
import javax.xml.bind.annotation.XmlType;
11+
import jakarta.xml.bind.annotation.XmlAccessType;
12+
import jakarta.xml.bind.annotation.XmlAccessorType;
13+
import jakarta.xml.bind.annotation.XmlElement;
14+
import jakarta.xml.bind.annotation.XmlSeeAlso;
15+
import jakarta.xml.bind.annotation.XmlType;
1616

1717

1818
/**

src/main/java/net/authorize/api/contract/v1/ANetApiResponse.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,17 @@
22
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802
33
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
44
// Any modifications to this file will be lost upon recompilation of the source schema.
5-
// Generated on: 2024.08.29 at 03:44:59 AM IST
5+
// Generated on: 2024.08.29 at 03:15:31 AM IST
66
//
77

88

99
package net.authorize.api.contract.v1;
1010

11-
import javax.xml.bind.annotation.XmlAccessType;
12-
import javax.xml.bind.annotation.XmlAccessorType;
13-
import javax.xml.bind.annotation.XmlElement;
14-
import javax.xml.bind.annotation.XmlSeeAlso;
15-
import javax.xml.bind.annotation.XmlType;
11+
import jakarta.xml.bind.annotation.XmlAccessType;
12+
import jakarta.xml.bind.annotation.XmlAccessorType;
13+
import jakarta.xml.bind.annotation.XmlElement;
14+
import jakarta.xml.bind.annotation.XmlSeeAlso;
15+
import jakarta.xml.bind.annotation.XmlType;
1616

1717

1818
/**

src/main/java/net/authorize/api/contract/v1/ARBCancelSubscriptionRequest.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,17 @@
22
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802
33
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
44
// Any modifications to this file will be lost upon recompilation of the source schema.
5-
// Generated on: 2024.08.29 at 03:44:59 AM IST
5+
// Generated on: 2024.08.29 at 03:15:31 AM IST
66
//
77

88

99
package net.authorize.api.contract.v1;
1010

11-
import javax.xml.bind.annotation.XmlAccessType;
12-
import javax.xml.bind.annotation.XmlAccessorType;
13-
import javax.xml.bind.annotation.XmlElement;
14-
import javax.xml.bind.annotation.XmlRootElement;
15-
import javax.xml.bind.annotation.XmlType;
11+
import jakarta.xml.bind.annotation.XmlAccessType;
12+
import jakarta.xml.bind.annotation.XmlAccessorType;
13+
import jakarta.xml.bind.annotation.XmlElement;
14+
import jakarta.xml.bind.annotation.XmlRootElement;
15+
import jakarta.xml.bind.annotation.XmlType;
1616

1717

1818
/**

src/main/java/net/authorize/api/contract/v1/ARBCancelSubscriptionResponse.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,16 @@
22
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802
33
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
44
// Any modifications to this file will be lost upon recompilation of the source schema.
5-
// Generated on: 2024.08.29 at 03:44:59 AM IST
5+
// Generated on: 2024.08.29 at 03:15:31 AM IST
66
//
77

88

99
package net.authorize.api.contract.v1;
1010

11-
import javax.xml.bind.annotation.XmlAccessType;
12-
import javax.xml.bind.annotation.XmlAccessorType;
13-
import javax.xml.bind.annotation.XmlRootElement;
14-
import javax.xml.bind.annotation.XmlType;
11+
import jakarta.xml.bind.annotation.XmlAccessType;
12+
import jakarta.xml.bind.annotation.XmlAccessorType;
13+
import jakarta.xml.bind.annotation.XmlRootElement;
14+
import jakarta.xml.bind.annotation.XmlType;
1515

1616

1717
/**

src/main/java/net/authorize/api/contract/v1/ARBCreateSubscriptionRequest.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,17 @@
22
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802
33
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
44
// Any modifications to this file will be lost upon recompilation of the source schema.
5-
// Generated on: 2024.08.29 at 03:44:59 AM IST
5+
// Generated on: 2024.08.29 at 03:15:31 AM IST
66
//
77

88

99
package net.authorize.api.contract.v1;
1010

11-
import javax.xml.bind.annotation.XmlAccessType;
12-
import javax.xml.bind.annotation.XmlAccessorType;
13-
import javax.xml.bind.annotation.XmlElement;
14-
import javax.xml.bind.annotation.XmlRootElement;
15-
import javax.xml.bind.annotation.XmlType;
11+
import jakarta.xml.bind.annotation.XmlAccessType;
12+
import jakarta.xml.bind.annotation.XmlAccessorType;
13+
import jakarta.xml.bind.annotation.XmlElement;
14+
import jakarta.xml.bind.annotation.XmlRootElement;
15+
import jakarta.xml.bind.annotation.XmlType;
1616

1717

1818
/**

src/main/java/net/authorize/api/contract/v1/ARBCreateSubscriptionResponse.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,16 @@
22
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802
33
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
44
// Any modifications to this file will be lost upon recompilation of the source schema.
5-
// Generated on: 2024.08.29 at 03:44:59 AM IST
5+
// Generated on: 2024.08.29 at 03:15:31 AM IST
66
//
77

88

99
package net.authorize.api.contract.v1;
1010

11-
import javax.xml.bind.annotation.XmlAccessType;
12-
import javax.xml.bind.annotation.XmlAccessorType;
13-
import javax.xml.bind.annotation.XmlRootElement;
14-
import javax.xml.bind.annotation.XmlType;
11+
import jakarta.xml.bind.annotation.XmlAccessType;
12+
import jakarta.xml.bind.annotation.XmlAccessorType;
13+
import jakarta.xml.bind.annotation.XmlRootElement;
14+
import jakarta.xml.bind.annotation.XmlType;
1515

1616

1717
/**

0 commit comments

Comments
 (0)