Skip to content

Commit

Permalink
Merge pull request #31 from OpenSTFoundation/develop
Browse files Browse the repository at this point in the history
Fix to allow number values for id and user_id in the parameters.
  • Loading branch information
Tejas-Sangani authored Dec 21, 2018
2 parents 795b26d + f4cebff commit 26cc485
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 9 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
[OST KYC JAVA SDK v2.0.2](https://github.com/OpenSTFoundation/ost-kyc-sdk-java/tree/v2.0.2) December 21 2018
---

* Fix to allow number values for id and user_id in the parameters.

[OST KYC JAVA SDK v2.0.1](https://github.com/OpenSTFoundation/ost-kyc-sdk-java/tree/v2.0.1) December 17 2018
---

Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ To use this node module, developers will need to:
<dependency>
<groupId>com.ost</groupId>
<artifactId>ost-kyc-sdk-java</artifactId>
<version>2.0.1</version>
<version>2.0.2</version>
</dependency>
```

Expand Down Expand Up @@ -69,8 +69,8 @@ nestedparam.put("timeout", (long) 15);
sdkConfig.put("config", nestedparam);


OSTSDK ostObj = new OSTSDK(sdkConfig);
services = (Manifest) ostObj.services;
OSTKYCSDK ostObj = new OSTKYCSDK(sdkConfig);
com.ost.kyc.services.v2.Manifest services = (com.ost.kyc.services.v2.Manifest) ostObj.services;
```

### Users Module
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.0.1
2.0.2
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.ost</groupId>
<artifactId>ost-kyc-sdk-java</artifactId>
<version>2.0.1</version>
<version>2.0.2</version>
<name>OST KYC SDK for Java</name>
<description>The official OST KYC SDK for Java(https://dev.ost.com/docs/kyc/index.html).</description>
<packaging>jar</packaging>
Expand Down
10 changes: 8 additions & 2 deletions src/main/java/com/ost/kyc/services/OSTKYCAPIService.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,14 @@ public String getUserId(Map<String, Object> params) throws MissingParameter, Inv
}

public Boolean isValidParameter(Object params) throws InvalidParameter {
Pattern p = Pattern.compile("[0-9a-zA-Z.-]+");
return p.matcher((String) params).matches();
if(params instanceof Number){
return true;
}else if(params instanceof String){
Pattern p = Pattern.compile("[0-9a-zA-Z.-]+");
return p.matcher((String) params).matches();
}else{
return false;
}
}

public class MissingParameter extends Exception {
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/com/ost/kyc/services/v2/UserTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public void get() throws Exception {

HashMap<String, Object> params = getParams();
String user_id = System.getenv("USER_ID");
params.put("id", user_id);
params.put("id", Integer.parseInt(user_id));

// Test-Case: Get an existing User.
JsonObject response;
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/com/ost/kyc/services/v2/UsersKycTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public void email_report_issue() throws Exception {
public void get() throws Exception {
HashMap<String, Object> params = new HashMap<String, Object>();
String user_id = System.getenv("USER_ID");
params.put("user_id", user_id);
params.put("user_id", Integer.parseInt(user_id));

// Test-Case: Get an existing UserKyc.
JsonObject response;
Expand Down

0 comments on commit 26cc485

Please sign in to comment.