diff --git a/documents/iin.md b/documents/iin.md
new file mode 100644
index 00000000..8fec6f73
--- /dev/null
+++ b/documents/iin.md
@@ -0,0 +1,123 @@
+### Iin
+
+### Token IIN API
+
+```java
+String tokenIin = "412345";
+
+Iin token = instance.iin.fetch(tokenIin);
+```
+
+**Parameters:**
+
+| Name | Type | Description |
+|------------|--------|-----------------------------------|
+| tokenIin* | string | The token IIN. |
+
+**Response:**
+```json
+{
+ "iin": "412345",
+ "entity": "iin",
+ "network": "Visa",
+ "type": "credit",
+ "sub_type": "business",
+ "issuer_code": "HDFC",
+ "issuer_name": "HDFC Bank Ltd",
+ "international": false,
+ "is_tokenized": true,
+ "card_iin": "411111",
+ "emi":{
+ "available": true
+ },
+ "recurring": {
+ "available": true
+ },
+ "authentication_types": [
+ {
+ "type":"3ds"
+ },
+ {
+ "type":"otp"
+ }
+ ]
+}
+```
+-------------------------------------------------------------------------------------------------------
+
+### Fetch All IINs Supporting Native OTP
+
+```java
+JSONObject obj = new JSONObject();
+obj.put("flow","otp");
+
+Iin item = razorpayclient.iin.fetchList(obj);
+```
+
+**Parameters:**
+
+| Name | Type | Description |
+|------------|--------|-------------------------------------------------------------|
+| flow | string | Authentication flow is Native OTP. Possible value is `otp`. |
+
+**Response:**
+```json
+{
+ "count": 24,
+ "iins": [
+ "512967",
+ "180005",
+ "401704",
+ "401806",
+ "123456",
+ "411111",
+ "123512967",
+ "180012305",
+ "401123704"
+ ]
+}
+```
+-------------------------------------------------------------------------------------------------------
+
+### Fetch All IINs with Business Sub-type
+
+```java
+JSONObject obj = new JSONObject();
+obj.put("sub_type","business");
+
+Iin item = razorpayclient.iin.fetchList(obj);
+```
+
+**Parameters:**
+
+| Name | Type | Description |
+|------------|--------|--------------------------------------------------------|
+| sub_type | string | The sub_type of the IIN. Possible value is `business`. |
+
+**Response:**
+```json
+{
+ "count": 24,
+ "iins": [
+ "512967",
+ "180005",
+ "401704",
+ "401806",
+ "607389",
+ "652203",
+ "414367",
+ "787878",
+ "123456",
+ "411111",
+ "123512967",
+ "180012305",
+ "401123704"
+ ]
+}
+```
+-------------------------------------------------------------------------------------------------------
+
+**PN: * indicates mandatory fields**
+
+
+**For reference click [here](https://razorpay.com/docs/api/payments/cards/iin-api/#iin-entity)**
\ No newline at end of file
diff --git a/src/main/java/com/razorpay/Constants.java b/src/main/java/com/razorpay/Constants.java
index d6dda79d..45ce56c0 100755
--- a/src/main/java/com/razorpay/Constants.java
+++ b/src/main/java/com/razorpay/Constants.java
@@ -170,6 +170,7 @@ public class Constants {
static final String TOKEN = "/token";
static final String REVOKE = "/revoke";
+ static final String IIN_FETCH_LIST = "iins/list";
static final String DOCUMENTS = "/documents";
static final String DOCUMENT_FETCH = "/documents/%s";
diff --git a/src/main/java/com/razorpay/EntityNameURLMapping.java b/src/main/java/com/razorpay/EntityNameURLMapping.java
index 88f76736..4316dcd9 100644
--- a/src/main/java/com/razorpay/EntityNameURLMapping.java
+++ b/src/main/java/com/razorpay/EntityNameURLMapping.java
@@ -10,7 +10,7 @@
*/
public enum EntityNameURLMapping {
-
+ IINS("iin"),
INVOICES("invoice"),
SETTLEMENTS("settlement"),
PAYMENTS("payment"),
diff --git a/src/main/java/com/razorpay/IinClient.java b/src/main/java/com/razorpay/IinClient.java
index 9a86e621..425e7e40 100644
--- a/src/main/java/com/razorpay/IinClient.java
+++ b/src/main/java/com/razorpay/IinClient.java
@@ -1,5 +1,7 @@
package com.razorpay;
+import org.json.JSONObject;
+
public class IinClient extends ApiClient{
IinClient(String auth) {
@@ -10,4 +12,7 @@ public Iin fetch(String id) throws RazorpayException {
return get(Constants.VERSION, String.format(Constants.IIN_FETCH, id), null);
}
+ public Iin fetchList(JSONObject request) throws RazorpayException {
+ return get(Constants.VERSION, String.format(Constants.IIN_FETCH_LIST), request);
+ }
}
diff --git a/src/main/java/com/razorpay/Utils.java b/src/main/java/com/razorpay/Utils.java
index cc09683b..0beb2469 100644
--- a/src/main/java/com/razorpay/Utils.java
+++ b/src/main/java/com/razorpay/Utils.java
@@ -54,7 +54,6 @@ public static boolean verifySignature(String payload, String expectedSignature,
public static String generateOnboardingSignature(JSONObject attributes, String secret) throws RazorpayException {
String jsonString = attributes.toString();
- System.out.println("data to encrypt" + jsonString);
return encrypt(jsonString, secret);
}
diff --git a/src/test/java/com/razorpay/IinClientTest.java b/src/test/java/com/razorpay/IinClientTest.java
index be35ae22..81ffc255 100644
--- a/src/test/java/com/razorpay/IinClientTest.java
+++ b/src/test/java/com/razorpay/IinClientTest.java
@@ -1,5 +1,7 @@
package com.razorpay;
+import org.json.JSONArray;
+import org.json.JSONObject;
import org.junit.Test;
import org.mockito.InjectMocks;
@@ -54,4 +56,27 @@ public void fetch() throws RazorpayException {
assertTrue(false);
}
}
+
+ @Test
+ public void fetchList() throws RazorpayException {
+
+ JSONObject request = new JSONObject();
+ request.put("flow","otp");
+
+ JSONObject mockedResponseJson = new JSONObject();
+ mockedResponseJson.put("count", 0);
+ mockedResponseJson.put("entity", "iin");
+ JSONArray iinArray = new JSONArray();
+ mockedResponseJson.put("iins", iinArray);
+
+ try {
+ mockResponseFromExternalClient(mockedResponseJson.toString());
+ mockResponseHTTPCodeFromExternalClient(200);
+ Iin fetch = iinClient.fetchList(request);
+ assertNotNull(fetch);
+ assertEquals(true,fetch.has("iins"));
+ } catch (IOException e) {
+ assertTrue(false);
+ }
+ }
}