diff --git a/documents/account.md b/documents/account.md
index 40070cfd..dfc2a68c 100644
--- a/documents/account.md
+++ b/documents/account.md
@@ -402,6 +402,63 @@ Account account = instance.account.fetch(accountId);
-------------------------------------------------------------------------------------------------------
+### Upload account documents
+```java
+String accountId = "acc_M83Uw27KXuC7c8";
+
+JSONObject request = new JSONObject();
+request.put("files","/Users/your_name/Downloads/sample_uploaded.jpeg");
+request.put("document_type","business_proof_url");
+
+Account account = instance.account.uploadAccountDoc(accountId, request);
+```
+
+**Parameters:**
+
+| Name | Type | Description |
+|----------------|-------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
+| accountId* | string | The unique identifier of a sub-merchant account generated by Razorpay. |
+| file* | string | The URL generated once the business proof document is uploaded. |
+| document_type* | string | The documents valid for the proof type to be shared. Possible values :
business_proof_of_identification: `shop_establishment_certificate`, `gst_certificate`, `msme_certificate`, `business_proof_url`, `business_pan_url`,
additional_documents : `form_12_a_url`, `form_80g_url`, `cancelled_cheque` |
+
+**Response:**
+```json
+{
+ "business_proof_of_identification": [
+ {
+ "type": "business_proof_url",
+ "url": ""
+ }
+ ]
+}
+```
+-------------------------------------------------------------------------------------------------------
+
+### Fetch account documents
+```java
+String accountId = "acc_LryDIBIjBDbOWy";
+
+Account account = instance.account.fetchAccountDoc(accountId);
+```
+
+**Parameters:**
+
+| Name | Type | Description |
+|-------------|-------------|------------------------------------------------------------------------|
+| accountId* | string | The unique identifier of a sub-merchant account generated by Razorpay. |
+
+**Response:**
+```json
+{
+ "business_proof_of_identification": [
+ {
+ "type": "business_proof_url",
+ "url": ""
+ }
+ ]
+}
+```
+-------------------------------------------------------------------------------------------------------
**PN: * indicates mandatory fields**
diff --git a/src/main/java/com/razorpay/AccountClient.java b/src/main/java/com/razorpay/AccountClient.java
index 03e49c3c..b17c230b 100644
--- a/src/main/java/com/razorpay/AccountClient.java
+++ b/src/main/java/com/razorpay/AccountClient.java
@@ -22,4 +22,11 @@ public Account edit(String id, JSONObject request) throws RazorpayException {
public Account delete(String id) throws RazorpayException {
return delete(Constants.VERSION_V2, String.format(Constants.ACCOUNT_DELETE, id), null);
}
+
+ public Account uploadAccountDoc(String id, JSONObject request) throws RazorpayException {
+ return post(Constants.VERSION_V2, String.format(Constants.UPLOAD_ACCOUNT_DOCUMENT, id), request);
+ }
+ public Account fetchAccountDoc(String id) throws RazorpayException {
+ return get(Constants.VERSION_V2, String.format(Constants.UPLOAD_ACCOUNT_DOCUMENT, id), null);
+ }
}
diff --git a/src/main/java/com/razorpay/Constants.java b/src/main/java/com/razorpay/Constants.java
index f6a7e9a8..d6dda79d 100755
--- a/src/main/java/com/razorpay/Constants.java
+++ b/src/main/java/com/razorpay/Constants.java
@@ -172,6 +172,8 @@ public class Constants {
static final String DOCUMENTS = "/documents";
static final String DOCUMENT_FETCH = "/documents/%s";
+
+ static final String UPLOAD_ACCOUNT_DOCUMENT = "accounts/%s/documents";
static final String UPLOAD_STAKEHOLDER_DOCUMENT = "accounts/%s/stakeholders/%s/documents";
static final String VIEW_RTO = "orders/%s/rto_review";
diff --git a/src/test/java/com/razorpay/AccountClientTest.java b/src/test/java/com/razorpay/AccountClientTest.java
index d67a3332..6ebba9dc 100644
--- a/src/test/java/com/razorpay/AccountClientTest.java
+++ b/src/test/java/com/razorpay/AccountClientTest.java
@@ -1,5 +1,6 @@
package com.razorpay;
+import org.json.JSONArray;
import org.json.JSONObject;
import org.junit.Test;
import org.mockito.InjectMocks;
@@ -230,4 +231,52 @@ private String getResponse(String account_id) {
" }\n" +
"}";
}
+
+ @Test
+ public void uploadAccountDoc() throws RazorpayException {
+ JSONObject request = new JSONObject();
+ request.put("files","/Users/your_name/Downloads/sample_uploaded.jpeg");
+ request.put("document_type","business_proof_url");
+
+ JSONObject mockedResponseJson = new JSONObject();
+ mockedResponseJson.put("entity","account");
+ JSONArray businessArray = new JSONArray();
+ JSONObject businessObj = new JSONObject();
+ businessObj.put("type","business_proof_url");
+ businessObj.put("url","");
+ businessArray.put(businessObj);
+ mockedResponseJson.put("business_proof_of_identification",businessArray);
+
+ try {
+ mockResponseFromExternalClient(mockedResponseJson.toString());
+ mockResponseHTTPCodeFromExternalClient(200);
+ Account document = accountClient.uploadAccountDoc(ACCOUNT_ID, request);
+ assertNotNull(document);
+ assertEquals(true,document.has("business_proof_of_identification"));
+ } catch (IOException e) {
+ assertTrue(false);
+ }
+ }
+
+ @Test
+ public void fetchAccountDoc() throws RazorpayException {
+
+ JSONObject mockedResponseJson = new JSONObject();
+ mockedResponseJson.put("entity","account");
+ JSONArray businessArray = new JSONArray();
+ JSONObject businessObj = new JSONObject();
+ businessObj.put("type","business_proof_url");
+ businessObj.put("url","");
+ businessArray.put(businessObj);
+ mockedResponseJson.put("business_proof_of_identification",businessArray);
+ try {
+ mockResponseFromExternalClient(mockedResponseJson.toString());
+ mockResponseHTTPCodeFromExternalClient(200);
+ Account document = accountClient.fetchAccountDoc(ACCOUNT_ID);
+ assertNotNull(document);
+ assertEquals(true,document.has("business_proof_of_identification"));
+ } catch (IOException e) {
+ assertTrue(false);
+ }
+ }
}