Skip to content

Commit

Permalink
Merge pull request #28 from OpenSTFoundation/kyc_sdk_java_v2
Browse files Browse the repository at this point in the history
Implemented API's for kyc email send.
  • Loading branch information
AMAN-BARBARIA committed Dec 21, 2018
2 parents 71d534e + 14f4a5c commit ca66a14
Show file tree
Hide file tree
Showing 7 changed files with 113 additions and 3 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[OST KYC JAVA SDK v2.0.1](https://github.com/OpenSTFoundation/ost-kyc-sdk-java/tree/v2.0.1) December 17 2018
---

* Implemented API's for kyc email send

[OST KYC JAVA SDK v2.0.0](https://github.com/OpenSTFoundation/ost-kyc-sdk-java/tree/v2.0.0) November 28 2018
---

Initial release of the official OST KYC JAVA SDK<br />
This release has the OST KYC API V2 interaction layer implementation.
29 changes: 28 additions & 1 deletion 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.0</version>
<version>2.0.1</version>
</dependency>
```

Expand Down Expand Up @@ -143,6 +143,33 @@ JsonObject response = usersKycService.submit_kyc( params );
System.out.println("response: " + response.toString() );
```

Send Approve Email to User:

```java
HashMap <String, Object> params = new HashMap<String, Object>();
params.put("user_id", "11550");
JsonObject response = usersKycService.email_approve( params );
System.out.println("response: " + response.toString() );
```

Send Deny Email to User:

```java
HashMap <String, Object> params = new HashMap<String, Object>();
params.put("user_id", "11550");
JsonObject response = usersKycService.email_deny( params );
System.out.println("response: " + response.toString() );
```

Send Report Issue Email to User:

```java
HashMap <String, Object> params = new HashMap<String, Object>();
params.put("user_id", "11550");
JsonObject response = usersKycService.email_report_issue( params );
System.out.println("response: " + response.toString() );
```

Get a list of existing users kyc and other data:

```java
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.0.0
2.0.1
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.0-SNAPSHOT</version>
<version>2.0.1</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
25 changes: 25 additions & 0 deletions src/main/java/com/ost/kyc/services/v2/UsersKyc.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,31 @@ public JsonObject submit_kyc(Map<String,Object> params) throws MissingParameter,
return this.request.post(resource, params);
}

/**
* @param params Request Params
* @return API Response
*/
public JsonObject email_approve(Map<String,Object> params) throws MissingParameter, IOException, InvalidParameter {
String resource = this.urlPrefix + "/" + this.getUserId( params ) + "/email/approve";
return this.request.post(resource, params);
}
/**
* @param params Request Params
* @return API Response
*/
public JsonObject email_deny(Map<String,Object> params) throws MissingParameter, IOException, InvalidParameter {
String resource = this.urlPrefix + "/" + this.getUserId( params ) + "/email/deny";
return this.request.post(resource, params);
}
/**
* @param params Request Params
* @return API Response
*/
public JsonObject email_report_issue(Map<String,Object> params) throws MissingParameter, IOException, InvalidParameter {
String resource = this.urlPrefix + "/" + this.getUserId( params ) + "/email/report-issue";
return this.request.post(resource, params);
}

/**
* @param params Request Params
* @return API Response
Expand Down
12 changes: 12 additions & 0 deletions src/test/java/com/ost/kyc/services/ServiceTestBase.java
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,18 @@ protected static void validateResponseWithFaliure(JsonObject response) {

}

protected String getErrorCode(JsonObject response) {
JsonObject responseErr = (JsonObject) response.get("err");
return responseErr.get("code").getAsString();
}

protected void isUnProcessableEntity(JsonObject response) {
if (response.get("success").toString().equals("false")) {
String errCode = getErrorCode(response);
Assert.assertEquals( errCode, new String("UNPROCESSABLE_ENTITY"));
}
}

@After
public void tearDown() throws Exception {
OSTKYCSDK = null;
Expand Down
36 changes: 36 additions & 0 deletions src/test/java/com/ost/kyc/services/v2/UsersKycTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,42 @@ public void submit_kyc() throws Exception {

}

@Test
public void email_approve() throws Exception {
HashMap<String, Object> params = new HashMap<String, Object>();
String user_id = System.getenv("USER_ID");
params.put("user_id", user_id);

// Test-Case: Check Send Approve Email to User.
JsonObject response;
response = getService().email_approve(params);
isUnProcessableEntity(response);
}

@Test
public void email_deny() throws Exception {
HashMap<String, Object> params = new HashMap<String, Object>();
String user_id = System.getenv("USER_ID");
params.put("user_id", user_id);

// Test-Case: Check Send Deny Email to User.
JsonObject response;
response = getService().email_deny(params);
isUnProcessableEntity(response);
}

@Test
public void email_report_issue() throws Exception {
HashMap<String, Object> params = new HashMap<String, Object>();
String user_id = System.getenv("USER_ID");
params.put("user_id", user_id);

// Test-Case: Check Send Email Report Issue Email to User.
JsonObject response;
response = getService().email_report_issue(params);
isUnProcessableEntity(response);
}

@Test
public void get() throws Exception {
HashMap<String, Object> params = new HashMap<String, Object>();
Expand Down

0 comments on commit ca66a14

Please sign in to comment.