Skip to content

Commit 9ebd59f

Browse files
author
srathod
committed
- Added clientId constant.
1 parent 2efd206 commit 9ebd59f

File tree

3 files changed

+7
-25
lines changed

3 files changed

+7
-25
lines changed

build.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0"?>
22
<project name="anet-java-sdk" default="compile" basedir=".">
3-
<property name="version" value="1.8.2" />
3+
<property name="version" value="1.9.0" />
44
<property name="dirs.base" value="${basedir}" />
55
<property name="src.dir" value="${basedir}/src/main/java" />
66
<property name="javadocs.dir" value="${basedir}/docs/javadocs" />

src/main/java/net/authorize/api/controller/base/ApiOperationBase.java

Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
import net.authorize.api.contract.v1.MessageTypeEnum;
1616
import net.authorize.api.contract.v1.MessagesType;
1717
import net.authorize.api.contract.v1.MessagesType.Message;
18+
import net.authorize.util.Constants;
1819
import net.authorize.util.HttpUtility;
1920
import net.authorize.util.LogHelper;
2021

@@ -75,9 +76,7 @@ protected void setApiRequest(Q apiRequest) {
7576
}
7677

7778
protected void setClientId() {
78-
String clientId = "sdk-java-" + getVersion();
79-
80-
this.apiRequest.setClientId(clientId);
79+
this.apiRequest.setClientId(getClientId());
8180
}
8281

8382
public S getApiResponse() {
@@ -253,26 +252,7 @@ private void validateAndSetMerchantAuthentication() {
253252
}
254253
}
255254

256-
public synchronized String getVersion() {
257-
String version = null;
258-
259-
// try to load from maven properties first
260-
try {
261-
Properties p = new Properties();
262-
InputStream is = getClass().getResourceAsStream("/META-INF/maven/net.authorize/anet-java-sdk/pom.properties");
263-
if (is != null) {
264-
p.load(is);
265-
version = p.getProperty("version", "");
266-
}
267-
} catch (Exception e) {
268-
// ignore
269-
}
270-
271-
if (version == null) {
272-
// we could not compute the version so use a blank
273-
version = "";
274-
}
275-
276-
return version;
255+
public synchronized String getClientId() {
256+
return Constants.CLIENT_ID;
277257
}
278258
}

src/main/java/net/authorize/util/Constants.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,6 @@ public final class Constants {
3232

3333
public static final String HTTP_READ_TIME_OUT = "http.ReadTimeout";
3434
public static final int HTTP_READ_TIME_OUT_DEFAULT_VALUE = 30000;
35+
36+
public static final String CLIENT_ID = "sdk-java-1.9.0";
3537
}

0 commit comments

Comments
 (0)