Skip to content

Commit

Permalink
added failure case & doc correction
Browse files Browse the repository at this point in the history
  • Loading branch information
ankitdas13 committed May 24, 2024
1 parent c23e690 commit 374c702
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 7 deletions.
14 changes: 7 additions & 7 deletions documents/documents.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ Razorpay::Document.create({

**Parameters:**

| Name | Type | Description |
|-------|-----------|--------------------------------------------------|
| file* | string | The URL generated once the business proof document is uploaded. |
| purpose | string | Possible value is `dispute_evidence` |
| Name | Type | Description |
|---------|-----------|-----------------------------------------------------------------|
| file* | string | The URL generated once the business proof document is uploaded. |
| purpose | string | Possible value is `dispute_evidence` |

**Response:**
```json
Expand All @@ -40,9 +40,9 @@ Razorpay::Document.fetch(documentId)

**Parameters:**

| Name | Type | Description |
|-------|-----------|--------------------------------------------------|
| documentId | string | The unique identifier of the document. |
| Name | Type | Description |
|-------------|-----------|--------------------------------------------------|
| documentId | string | The unique identifier of the document. |

**Response:**
```json
Expand Down
10 changes: 10 additions & 0 deletions test/fixtures/document_error.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"error": {
"code": "BAD_REQUEST_ERROR",
"description": "Invalid file id provided or merchant is unauthorized to access the fileId(s) provided",
"source": "NA",
"step": "NA",
"reason": "NA",
"metadata": {}
}
}
11 changes: 11 additions & 0 deletions test/razorpay/test_document.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,16 @@ def setup
def test_document_should_be_defined
refute_nil Razorpay::Document
end

def test_document_should_be_defined_exception
para_attr = {}
stub_get(%r{documents/#{@document_id}$}, 'document_error')
assert_raises(Razorpay::Error) do
document = Razorpay::Document.fetch(@document_id)
if document.error
raise Razorpay::Error.new, document.error['code']
end
end
end
end
end

0 comments on commit 374c702

Please sign in to comment.