Skip to content

Commit

Permalink
update jdoc & json object
Browse files Browse the repository at this point in the history
  • Loading branch information
ankitdas13 committed Mar 26, 2024
1 parent b732528 commit 8c37bc5
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 27 deletions.
14 changes: 7 additions & 7 deletions documents/account.md
Original file line number Diff line number Diff line change
Expand Up @@ -415,10 +415,10 @@ 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. |
| 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 : <br> business_proof_of_identification: `shop_establishment_certificate`, `gst_certificate`, `msme_certificate`, `business_proof_url`, `business_pan_url`, <br><br> additional_documents : `form_12_a_url`, `form_80g_url`, `cancelled_cheque` |

**Response:**
Expand All @@ -443,9 +443,9 @@ Account account = instance.account.fetchAccountDoc(accountId);

**Parameters:**

| Name | Type | Description |
|-------------|-------------|---------------------------------------------|
| accountId* | string | The unique identifier of a sub-merchant account generated by Razorpay. |
| Name | Type | Description |
|-------------|-------------|------------------------------------------------------------------------|
| accountId* | string | The unique identifier of a sub-merchant account generated by Razorpay. |

**Response:**
```json
Expand Down
40 changes: 20 additions & 20 deletions src/test/java/com/razorpay/AccountClientTest.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.razorpay;

import org.json.JSONArray;
import org.json.JSONObject;
import org.junit.Test;
import org.mockito.InjectMocks;
Expand Down Expand Up @@ -237,17 +238,17 @@ public void uploadAccountDoc() throws RazorpayException {
request.put("files","/Users/your_name/Downloads/sample_uploaded.pdf");
request.put("document_type","business_proof_url");

String mockedResponseJson = "{\n" +
" \"entity\": \"account\",\n" +
" \"business_proof_of_identification\": [\n" +
" {\n" +
" \"type\": \"business_proof_url\",\n" +
" \"url\": \"<https://rzp.io/i/bzDKbNg>\"\n" +
" }\n" +
" ]\n" +
"}";
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","<https://rzp.io/i/bzDKbNg>");
businessArray.put(businessObj);
mockedResponseJson.put("business_proof_of_identification",businessArray);

try {
mockResponseFromExternalClient(mockedResponseJson);
mockResponseFromExternalClient(mockedResponseJson.toString());
mockResponseHTTPCodeFromExternalClient(200);
Account document = accountClient.uploadAccountDoc(ACCOUNT_ID, request);
assertNotNull(document);
Expand All @@ -260,17 +261,16 @@ public void uploadAccountDoc() throws RazorpayException {
@Test
public void fetchAccountDoc() throws RazorpayException {

String mockedResponseJson = "{\n" +
" \"entity\": \"account\",\n" +
" \"business_proof_of_identification\": [\n" +
" {\n" +
" \"type\": \"business_proof_url\",\n" +
" \"url\": \"<https://rzp.io/i/bzDKbNg>\"\n" +
" }\n" +
" ]\n" +
"}";
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","<https://rzp.io/i/bzDKbNg>");
businessArray.put(businessObj);
mockedResponseJson.put("business_proof_of_identification",businessArray);
try {
mockResponseFromExternalClient(mockedResponseJson);
mockResponseFromExternalClient(mockedResponseJson.toString());
mockResponseHTTPCodeFromExternalClient(200);
Account document = accountClient.fetchAccountDoc(ACCOUNT_ID);
assertNotNull(document);
Expand Down

0 comments on commit 8c37bc5

Please sign in to comment.