Skip to content

Commit d2b145a

Browse files
author
Sunny Raj Rathod
authored
Merge pull request #129 from gnongsiej/master
Fixing NumberFormatException and classpath
2 parents 1ca59d1 + 70eb69e commit d2b145a

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

.classpath

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
<classpathentry kind="src" path="resources"/>
55
<classpathentry kind="src" path="src/test/java"/>
66
<classpathentry kind="lib" path="lib/commons-logging-1.1.1.jar"/>
7-
<classpathentry kind="lib" path="lib/httpclient-4.0.1.jar"/>
8-
<classpathentry kind="lib" path="lib/httpcore-4.0.1.jar"/>
7+
<classpathentry kind="lib" path="lib/httpclient-4.5.3.jar"/>
8+
<classpathentry kind="lib" path="lib/httpcore-4.4.6.jar"/>
99
<classpathentry kind="lib" path="lib/junit-4.8.2.jar"/>
1010
<classpathentry kind="lib" path="lib/log4j-1.2.16.jar"/>
1111
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>

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

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ public class Result<T> extends net.authorize.Result<T> {
1717
private ResponseCode responseCode;
1818
private ResponseReasonCode reasonResponseCode;
1919
private String responseText;
20+
private String transactionId;
2021

2122
private Result() { }
2223

@@ -29,8 +30,11 @@ public static <T> Result<T> createResult(T object, Map<ResponseField, String> re
2930
}
3031

3132
String responseCodeStr = responseMap.get(ResponseField.RESPONSE_CODE);
33+
34+
result.transactionId = responseMap.get(ResponseField.TRANSACTION_ID);
35+
3236
result.responseCode = responseCodeStr!=null && !"".equals(responseCodeStr)?
33-
ResponseCode.findByResponseCode(Integer.parseInt(responseCodeStr)):
37+
ResponseCode.findByResponseCode(Double.valueOf(responseCodeStr).intValue()):
3438
ResponseCode.ERROR;
3539

3640
String responseReasonCodeStr = responseMap.get(ResponseField.RESPONSE_REASON_CODE);
@@ -58,6 +62,10 @@ public String getResponseText() {
5862
return responseText;
5963
}
6064

65+
public String getTransactionId() {
66+
return transactionId;
67+
}
68+
6169
public boolean isApproved() {
6270
return ResponseCode.APPROVED.equals(this.responseCode);
6371
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public static Result createResult(String apiLoginId, String merchantMD5Key, Map<
6969
}
7070

7171
result.responseCode = responseCodeStr!=null && !"".equals(responseCodeStr)?
72-
ResponseCode.findByResponseCode(Integer.parseInt(responseCodeStr)):
72+
ResponseCode.findByResponseCode(Double.valueOf(responseCodeStr).intValue()):
7373
ResponseCode.UNKNOWN;
7474
result.reasonResponseCode = responseReasonCodeStr!=null && !"".equals(responseReasonCodeStr)?
7575
ResponseReasonCode.findByReasonCode(Integer.parseInt(responseReasonCodeStr)):

0 commit comments

Comments
 (0)