razorpay 3.2.1 → 3.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +17 -0
  3. data/README.md +18 -1
  4. data/documents/customer.md +242 -0
  5. data/documents/dispute.md +301 -0
  6. data/documents/documents.md +65 -0
  7. data/documents/oauth_token.md +142 -0
  8. data/documents/order.md +71 -0
  9. data/documents/payment.md +253 -0
  10. data/documents/transfers.md +40 -0
  11. data/lib/razorpay/constants.rb +6 -1
  12. data/lib/razorpay/customer.rb +16 -0
  13. data/lib/razorpay/dispute.rb +26 -0
  14. data/lib/razorpay/document.rb +19 -0
  15. data/lib/razorpay/oauth_token.rb +109 -0
  16. data/lib/razorpay/order.rb +8 -0
  17. data/lib/razorpay/payload_validator.rb +93 -0
  18. data/lib/razorpay/payment.rb +4 -0
  19. data/lib/razorpay/request.rb +24 -7
  20. data/lib/razorpay/transfer.rb +4 -0
  21. data/lib/razorpay/utility.rb +24 -0
  22. data/lib/razorpay/validation_config.rb +11 -0
  23. data/lib/razorpay.rb +10 -1
  24. data/test/fixtures/dispute_collection.json +67 -0
  25. data/test/fixtures/dispute_error.json +10 -0
  26. data/test/fixtures/document_error.json +10 -0
  27. data/test/fixtures/error_customer.json +10 -0
  28. data/test/fixtures/error_eligibility.json +10 -0
  29. data/test/fixtures/error_eligibility_check.json +10 -0
  30. data/test/fixtures/fake_bank_account.json +9 -0
  31. data/test/fixtures/fake_dispute.json +29 -0
  32. data/test/fixtures/fake_document.json +9 -0
  33. data/test/fixtures/fake_eligiblity.json +79 -0
  34. data/test/fixtures/fake_fulfillment.json +10 -0
  35. data/test/fixtures/fake_oauth_token.json +8 -0
  36. data/test/fixtures/fake_payment_expanded_details.json +38 -0
  37. data/test/fixtures/fake_payment_expanded_details_card.json +50 -0
  38. data/test/fixtures/fake_revoke_token.json +3 -0
  39. data/test/fixtures/fake_rto.json +15 -0
  40. data/test/fixtures/order_error.json +10 -0
  41. data/test/fixtures/payment_error.json +10 -0
  42. data/test/fixtures/reversals_collection.json +22 -0
  43. data/test/fixtures/transfer_error.json +10 -0
  44. data/test/razorpay/test_customer.rb +105 -0
  45. data/test/razorpay/test_dispute.rb +98 -0
  46. data/test/razorpay/test_document.rb +27 -0
  47. data/test/razorpay/test_oauth_token.rb +105 -0
  48. data/test/razorpay/test_order.rb +43 -1
  49. data/test/razorpay/test_payload_validator.rb +61 -0
  50. data/test/razorpay/test_payment.rb +23 -1
  51. data/test/razorpay/test_razorpay.rb +17 -0
  52. data/test/razorpay/test_transfer.rb +17 -0
  53. data/test/razorpay/test_utility.rb +34 -0
  54. metadata +59 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5cd01ee8ed4e390a472e9054a4383fde2482eea27f29992bf7d7fc39f33b24c9
4
- data.tar.gz: b099a18ac979054c0862c1bdfbb643cb997d42cd5b8bb73c034811109793537e
3
+ metadata.gz: 378791c954dc8fd9cd1b32fac1f61e4955bb8cf0e0df081f6be872ca22d26da8
4
+ data.tar.gz: dced052941fccf512cbbffaa2ca4e36949c96f12456908bea790e7511f4062ab
5
5
  SHA512:
6
- metadata.gz: 726a001671bd021fb23623a05bcda7a952ee618b4b327d45643dddbe3feae613069aa0abb83fb695b798b759638ba5073cfa50711162dc2077c14e462221fd9b
7
- data.tar.gz: 1fe13db4f2ace27314ccc8601e7679289ad1f3fb02ee150fced0c1c192e8727e01c1922c883bf66d627c10997a635de0b81b1ab51f0f859d650391a3fe01dbe9
6
+ metadata.gz: e0c9d0ceec3e76d8e996ea56e3032f615891278c37c511b3f6e777508e6525b9eaddecb11fd02ecf09cd7845562680d085f13a14f6591cfe88b692e496d52a01
7
+ data.tar.gz: 1513933a083dbb5df97ad56e5cb898c3538ca51186a9118818c4bc6c05838f29bf6e3af1c0dc836b65d260152ba6ad85dfde26b9877ef0830868f2f8b1521c04
data/CHANGELOG.md CHANGED
@@ -4,6 +4,23 @@ Changelog for Razorpay-Ruby SDK.
4
4
 
5
5
  ## Unreleased
6
6
 
7
+ ## [3.2.3] - 2024-05-27
8
+
9
+ feat: Added new API endpoints
10
+ * Added support for `add_bank_account`, `delete_bank_account`, `request_eligibility_check` & `fetch_eligibility` on customer
11
+ * Added support for `expand_details` on payment
12
+ * Added support for fetch Reversals for a Transfer
13
+ * Added support for Dispute
14
+ * Added support for Document
15
+ * Added support for `view_rto` & `edit_fulfillment` on order
16
+
17
+ ## [3.2.2] - 2024-04-16
18
+
19
+ feat: Added oauth APIs and support for access token based authentication mechanism
20
+ * Added oauth APIs (getAuthURL, getAccessToken, refreshToken, revokeToken)
21
+ * Added support for access token based authentication mechanism
22
+ * Added support for onboarding signature generation
23
+
7
24
  ## [3.2.1] - 2023-12-19
8
25
 
9
26
  Rollback: Generic access point due to some performance concern
data/README.md CHANGED
@@ -27,7 +27,11 @@ Ruby 2.6.8 or later
27
27
 
28
28
  Remember to `require 'razorpay'` before anything else.
29
29
 
30
- Next, you need to setup your key and secret using the following:
30
+ Next, you need to setup your auth details. This setup can be done via two ways:
31
+
32
+ ### Using Private Auth
33
+
34
+ you need to setup your key and secret using the following:
31
35
 
32
36
  ```rb
33
37
  Razorpay.setup('key_id', 'key_secret')
@@ -38,6 +42,16 @@ You can set customer headers for your requests using the following:
38
42
  Razorpay.headers = {"CUSTOM_APP_HEADER" => "CUSTOM_VALUE"}
39
43
  ```
40
44
 
45
+ ### Using Access Token
46
+ you need to setup your access token using the following
47
+ ```rb
48
+ Razorpay.setup_with_oauth('access_token')
49
+ ```
50
+ You can set customer headers for your requests using the following:
51
+ ```rb
52
+ Razorpay.headers = {"CUSTOM_APP_HEADER" => "CUSTOM_VALUE"}
53
+ ```
54
+
41
55
  You can find your API keys at <https://dashboard.razorpay.com/#/app/keys>.
42
56
 
43
57
  If you are using rails, the right place to do this might be `config/initializers/razorpay.rb`.
@@ -70,6 +84,9 @@ If you are using rails, the right place to do this might be `config/initializers
70
84
  - [Register NACH and Charge First Payment Together](documents/registerNach.md)
71
85
  - [Payment Verification](documents/paymentVerification.md)
72
86
  - [Webhook](documents/webhook.md)
87
+ - [OAuthToken](documents/oauth_token.md)
88
+ - [Dispute](documents/dispute.md)
89
+ - [Document](documents/documents.md)
73
90
 
74
91
  ## Development
75
92
 
@@ -157,6 +157,248 @@ Razorpay::Customer.fetch(customerId)
157
157
 
158
158
  -------------------------------------------------------------------------------------------------------
159
159
 
160
+ ### Add Bank Account of Customer
161
+
162
+ ```rb
163
+ customerId = "cust_N5mywh91sXB69O"
164
+
165
+ Razorpay::Customer.add_bank_account(customerId,{
166
+ "ifsc_code": "UTIB0000194",
167
+ "account_number": "916010082985661",
168
+ "beneficiary_name": "Pratheek",
169
+ "beneficiary_address1": "address 1",
170
+ "beneficiary_address2": "address 2",
171
+ "beneficiary_address3": "address 3",
172
+ "beneficiary_address4": "address 4",
173
+ "beneficiary_email": "random@email.com",
174
+ "beneficiary_mobile": "8762489310",
175
+ "beneficiary_city": "Bangalore",
176
+ "beneficiary_state": "KA",
177
+ "beneficiary_country": "IN"
178
+ })
179
+ ```
180
+
181
+ **Parameters:**
182
+
183
+ | Name | Type | Description |
184
+ |----------------------|----------|----------------------------------------------------------------------------|
185
+ | customerId* | string | Unique identifier of the customer. |
186
+ | account_number | string | Customer's bank account number. For example, `0002020000304030434`. |
187
+ | beneficiary_name | string | The name of the beneficiary associated with the bank account. |
188
+ | beneficiary_address1 | string | The virtual payment address. |
189
+ | beneficiary_email | string | Email address of the beneficiary. For example, `gaurav.kumar@example.com`. |
190
+ | beneficiary_mobile | integer | Mobile number of the beneficiary. |
191
+ | beneficiary_city | string | The name of the city of the beneficiary. |
192
+ | beneficiary_state | string | The state of the beneficiary. |
193
+ | beneficiary_country | string | The country of the beneficiary. |
194
+ | beneficiary_pin | interger | The pin code of the beneficiary's address. |
195
+ | ifsc_code | string | The IFSC code of the bank branch associated with the account. |
196
+
197
+ **Response:**
198
+ ```json
199
+ {
200
+ "id": "ba_LSZht1Cm7xFTwF",
201
+ "entity": "bank_account",
202
+ "ifsc": "ICIC0001207",
203
+ "bank_name": "ICICI Bank",
204
+ "name": "Gaurav Kumar",
205
+ "notes": [],
206
+ "account_number": "XXXXXXXXXXXXXXX0434"
207
+ }
208
+ ```
209
+
210
+ -------------------------------------------------------------------------------------------------------
211
+
212
+ ### Delete Bank Account of Customer
213
+
214
+ ```rb
215
+ customerId = "cust_N5mywh91sXB69O"
216
+
217
+ bankAccountId = "ba_N6aM8uo64IzxHu"
218
+
219
+ Razorpay::Customer.delete_bank_account(customerId, bankAccountId)
220
+ ```
221
+
222
+ **Parameters:**
223
+
224
+ | Name | Type | Description |
225
+ |---------------|-----------|-------------------------------------------------------------------|
226
+ | customerId* | string | Customer id of the customer whose bank account is to be deleted. |
227
+ | bankAccountId | string | The bank_id that needs to be deleted. |
228
+
229
+ **Response:**
230
+ ```json
231
+ {
232
+ "id": "ba_Evg09Ll05SIPSD",
233
+ "ifsc": "ICIC0001207",
234
+ "bank_name": "ICICI Bank",
235
+ "name": "Test R4zorpay",
236
+ "account_number": "XXXXXXXXXXXXXXX0434",
237
+ "status": "deleted"
238
+ }
239
+ ```
240
+
241
+ -------------------------------------------------------------------------------------------------------
242
+
243
+ ### Eligibility Check API
244
+
245
+ ```rb
246
+ Razorpay::Customer.request_eligibility_check({
247
+ "inquiry": "affordability",
248
+ "amount": 500,
249
+ "currency": "INR",
250
+ "customer": {
251
+ "id": "elig_xxxxxxxxxxxxx",
252
+ "contact": "+919999999999",
253
+ "ip": "105.106.107.108",
254
+ "referrer": "https://merchansite.com/example/paybill",
255
+ "user_agent": "Mozilla/5.0"
256
+ }
257
+ })
258
+ ```
259
+
260
+ **Parameters:**
261
+
262
+ | Name | Type | Description |
263
+ |-------------|---------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
264
+ | inquiry | string | List of methods or instruments on which eligibility check is required. Possible value is `affordability`. |
265
+ | amount* | integer | The amount for which the order was created, in currency subunits. For example, for an amount of ₹295, enter `29500`. The user makes a payment for this amount against the order; hence, eligibility is checked for the amount. |
266
+ | currency* | string | A three-letter ISO code for the currency in which you want to accept the payment. Possible value is `INR`. |
267
+ | customer* | object | Customer details. [here](https://razorpay.com/docs/payments/payment-gateway/affordability/eligibility-check/#eligibility-check-api) |
268
+ | instruments | object | Payment instruments on which an eligibility check is required. [here](https://razorpay.com/docs/payments/payment-gateway/affordability/eligibility-check/#eligibility-check-api) |
269
+
270
+
271
+ **Response:**
272
+ ```json
273
+ {
274
+ "amount": "500000",
275
+ "customer": {
276
+ "id": "KkBhM9EC1Y0HTm",
277
+ "contact": "+919999999999"
278
+ },
279
+ "instruments": [
280
+ {
281
+ "method": "emi",
282
+ "issuer": "HDFC",
283
+ "type": "debit",
284
+ "eligibility_req_id": "elig_xxxxxxxxxxxxx",
285
+ "eligibility": {
286
+ "status": "eligible"
287
+ }
288
+ },
289
+ {
290
+ "method": "paylater",
291
+ "provider": "getsimpl",
292
+ "eligibility_req_id": "elig_xxxxxxxxxxxxx",
293
+ "eligibility": {
294
+ "status": "eligible"
295
+ }
296
+ },
297
+ {
298
+ "method": "paylater",
299
+ "provider": "icic",
300
+ "eligibility_req_id": "elig_xxxxxxxxxxxxx",
301
+ "eligibility": {
302
+ "status": "eligible"
303
+ }
304
+ },
305
+ {
306
+ "method": "cardless_emi",
307
+ "provider": "walnut369",
308
+ "eligibility_req_id": "elig_xxxxxxxxxxxxx",
309
+ "eligibility": {
310
+ "status": "ineligible",
311
+ "error": {
312
+ "code": "GATEWAY_ERROR",
313
+ "description": "The customer has not been approved by the partner.",
314
+ "source": "business",
315
+ "step": "inquiry",
316
+ "reason": "user_not_approved"
317
+ }
318
+ }
319
+ },
320
+ {
321
+ "method": "cardless_emi",
322
+ "provider": "zestmoney",
323
+ "eligibility_req_id": "elig_xxxxxxxxxxxxx",
324
+ "eligibility": {
325
+ "status": "ineligible",
326
+ "error": {
327
+ "code": "GATEWAY_ERROR",
328
+ "description": "The customer has exhausted their credit limit.",
329
+ "source": "business",
330
+ "step": "inquiry",
331
+ "reason": "credit_limit_exhausted"
332
+ }
333
+ }
334
+ },
335
+ {
336
+ "method": "paylater",
337
+ "provider": "lazypay",
338
+ "eligibility_req_id": "elig_xxxxxxxxxxxxx",
339
+ "eligibility": {
340
+ "status": "ineligible",
341
+ "error": {
342
+ "code": "GATEWAY_ERROR",
343
+ "description": "The order amount is less than the minimum transaction amount.",
344
+ "source": "business",
345
+ "step": "inquiry",
346
+ "reason": "min_amt_required"
347
+ }
348
+ }
349
+ }
350
+ ]
351
+ }
352
+ ```
353
+
354
+ -------------------------------------------------------------------------------------------------------
355
+
356
+ ### Fetch Eligibility by id
357
+
358
+ ```rb
359
+ eligibilityId = "elig_F1cxDoHWD4fkQt"
360
+ Razorpay::Customer.fetch_eligibility(eligibilityId)
361
+ ```
362
+
363
+ **Parameters:**
364
+
365
+ | Name | Type | Description |
366
+ |---------------|-------------|--------------------------------------------------------------------|
367
+ | eligibilityId | string | The unique identifier of the eligibility request to be retrieved. |
368
+
369
+ **Response:**
370
+ ```json
371
+ {
372
+ "instruments": [
373
+ {
374
+ "method": "paylater",
375
+ "provider": "lazypay",
376
+ "eligibility_req_id": "elig_xxxxxxxxxxxxx",
377
+ "eligibility": {
378
+ "status": "eligible"
379
+ }
380
+ },
381
+ {
382
+ "method": "paylater",
383
+ "provider": "getsimpl",
384
+ "eligibility_req_id": "elig_xxxxxxxxxxxxx",
385
+ "eligibility": {
386
+ "status": "ineligible",
387
+ "error": {
388
+ "code": "GATEWAY_ERROR",
389
+ "description": "The customer has exhausted their credit limit",
390
+ "source": "gateway",
391
+ "step": "inquiry",
392
+ "reason": "credit_limit_exhausted"
393
+ }
394
+ }
395
+ }
396
+ ]
397
+ }
398
+ ```
399
+
400
+ -------------------------------------------------------------------------------------------------------
401
+
160
402
  **PN: * indicates mandatory fields**
161
403
  <br>
162
404
  <br>
@@ -0,0 +1,301 @@
1
+ ## Document
2
+
3
+ ### Fetch All Disputes
4
+
5
+ ```rb
6
+ Razorpay::Dispute.all()
7
+ ```
8
+
9
+ **Response:**
10
+ ```json
11
+ {
12
+ "entity": "collection",
13
+ "count": 1,
14
+ "items": [
15
+ {
16
+ "id": "disp_Esz7KAitoYM7PJ",
17
+ "entity": "dispute",
18
+ "payment_id": "pay_EsyWjHrfzb59eR",
19
+ "amount": 10000,
20
+ "currency": "INR",
21
+ "amount_deducted": 0,
22
+ "reason_code": "pre_arbitration",
23
+ "respond_by": 1590604200,
24
+ "status": "open",
25
+ "phase": "pre_arbitration",
26
+ "created_at": 1590059211,
27
+ "evidence": {
28
+ "amount": 10000,
29
+ "summary": null,
30
+ "shipping_proof": null,
31
+ "billing_proof": null,
32
+ "cancellation_proof": null,
33
+ "customer_communication": null,
34
+ "proof_of_service": null,
35
+ "explanation_letter": null,
36
+ "refund_confirmation": null,
37
+ "access_activity_log": null,
38
+ "refund_cancellation_policy": null,
39
+ "term_and_conditions": null,
40
+ "others": null,
41
+ "submitted_at": null
42
+ }
43
+ }
44
+ ]
45
+ }
46
+ ```
47
+ -------------------------------------------------------------------------------------------------------
48
+
49
+ ### Fetch a Dispute
50
+
51
+ ```rb
52
+ disputeId = "disp_0000000000000"
53
+
54
+ Razorpay::Dispute.fetch(disputeId)
55
+ ```
56
+
57
+ **Parameters:**
58
+
59
+ | Name | Type | Description |
60
+ |-------------|--------|--------------------------------------------------|
61
+ | disputeId* | string | The unique identifier of the dispute. |
62
+
63
+ **Response:**
64
+ ```json
65
+ {
66
+ "id": "disp_AHfqOvkldwsbqt",
67
+ "entity": "dispute",
68
+ "payment_id": "pay_EsyWjHrfzb59eR",
69
+ "amount": 10000,
70
+ "currency": "INR",
71
+ "amount_deducted": 0,
72
+ "reason_code": "pre_arbitration",
73
+ "respond_by": 1590604200,
74
+ "status": "open",
75
+ "phase": "pre_arbitration",
76
+ "created_at": 1590059211,
77
+ "evidence": {
78
+ "amount": 10000,
79
+ "summary": "goods delivered",
80
+ "shipping_proof": null,
81
+ "billing_proof": null,
82
+ "cancellation_proof": null,
83
+ "customer_communication": null,
84
+ "proof_of_service": null,
85
+ "explanation_letter": null,
86
+ "refund_confirmation": null,
87
+ "access_activity_log": null,
88
+ "refund_cancellation_policy": null,
89
+ "term_and_conditions": null,
90
+ "others": null,
91
+ "submitted_at": null
92
+ }
93
+ }
94
+ ```
95
+ -------------------------------------------------------------------------------------------------------
96
+
97
+ ### Accept a Dispute
98
+
99
+ ```rb
100
+ disputeId = "disp_0000000000000"
101
+
102
+ Razorpay::Dispute.accept(disputeId)
103
+ ```
104
+
105
+ **Parameters:**
106
+
107
+ | Name | Type | Description |
108
+ |-------------|--------|--------------------------------------------------|
109
+ | disputeId* | string | The unique identifier of the dispute. |
110
+
111
+ **Response:**
112
+ ```json
113
+ {
114
+ "id": "disp_AHfqOvkldwsbqt",
115
+ "entity": "dispute",
116
+ "payment_id": "pay_EsyWjHrfzb59eR",
117
+ "amount": 10000,
118
+ "currency": "INR",
119
+ "amount_deducted": 10000,
120
+ "reason_code": "pre_arbitration",
121
+ "respond_by": 1590604200,
122
+ "status": "lost",
123
+ "phase": "pre_arbitration",
124
+ "created_at": 1590059211,
125
+ "evidence": {
126
+ "amount": 10000,
127
+ "summary": null,
128
+ "shipping_proof": null,
129
+ "billing_proof": null,
130
+ "cancellation_proof": null,
131
+ "customer_communication": null,
132
+ "proof_of_service": null,
133
+ "explanation_letter": null,
134
+ "refund_confirmation": null,
135
+ "access_activity_log": null,
136
+ "refund_cancellation_policy": null,
137
+ "term_and_conditions": null,
138
+ "others": null,
139
+ "submitted_at": null
140
+ }
141
+ }
142
+ ```
143
+ -------------------------------------------------------------------------------------------------------
144
+ ### Contest a Dispute (Draft)
145
+
146
+ ```rb
147
+ # Use this API sample code for draft
148
+
149
+ disputeId = "disp_0000000000000"
150
+
151
+ Razorpay::Dispute.contest(disputeId,{
152
+ "amount": 5000,
153
+ "summary": "goods delivered",
154
+ "shipping_proof": [
155
+ "doc_EFtmUsbwpXwBH9",
156
+ "doc_EFtmUsbwpXwBH8"
157
+ ],
158
+ "others": [
159
+ {
160
+ "type": "receipt_signed_by_customer",
161
+ "document_ids": [
162
+ "doc_EFtmUsbwpXwBH1",
163
+ "doc_EFtmUsbwpXwBH7"
164
+ ]
165
+ }
166
+ ],
167
+ "action": "draft"
168
+ })
169
+ ```
170
+
171
+ **Parameters:**
172
+
173
+ | Name | Type | Description |
174
+ |-----------------|---------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
175
+ | disputeId* | string | The unique identifier of the dispute. |
176
+ | amount | integer | The amount being contested. If the contest amount is not mentioned, we will assume it to be a full dispute contest. |
177
+ | summary | string | The explanation provided by you for contesting the dispute. It can have a maximum length of 1000 characters. |
178
+ | shipping_proof | array | List of document ids which serves as proof that the product was shipped to the customer at their provided address. It should show their complete shipping address, if possible. |
179
+ | others | array | All keys listed [here](https://razorpay.com/docs/api/disputes/contest) are supported |
180
+ | action | string | Possible value is `draft` or `submit` |
181
+
182
+ **Response:**
183
+ ```json
184
+ {
185
+ "id": "disp_AHfqOvkldwsbqt",
186
+ "entity": "dispute",
187
+ "payment_id": "pay_EsyWjHrfzb59eR",
188
+ "amount": 10000,
189
+ "currency": "INR",
190
+ "amount_deducted": 0,
191
+ "reason_code": "chargeback",
192
+ "respond_by": 1590604200,
193
+ "status": "open",
194
+ "phase": "chargeback",
195
+ "created_at": 1590059211,
196
+ "evidence": {
197
+ "amount": 5000,
198
+ "summary": "goods delivered",
199
+ "shipping_proof": [
200
+ "doc_EFtmUsbwpXwBH9",
201
+ "doc_EFtmUsbwpXwBH8"
202
+ ],
203
+ "billing_proof": null,
204
+ "cancellation_proof": null,
205
+ "customer_communication": null,
206
+ "proof_of_service": null,
207
+ "explanation_letter": null,
208
+ "refund_confirmation": null,
209
+ "access_activity_log": null,
210
+ "refund_cancellation_policy": null,
211
+ "term_and_conditions": null,
212
+ "others": [
213
+ {
214
+ "type": "receipt_signed_by_customer",
215
+ "document_ids": [
216
+ "doc_EFtmUsbwpXwBH1",
217
+ "doc_EFtmUsbwpXwBH7"
218
+ ]
219
+ }
220
+ ],
221
+ "submitted_at": null
222
+ }
223
+ }
224
+ ```
225
+
226
+ -------------------------------------------------------------------------------------------------------
227
+ ### Contest a Dispute (Submit)
228
+
229
+ ```rb
230
+ # Use this API sample code for submit
231
+
232
+ disputeId = "disp_0000000000000"
233
+
234
+ Razorpay::Dispute.contest(disputeId, {
235
+ "billing_proof": [
236
+ "doc_EFtmUsbwpXwBG9",
237
+ "doc_EFtmUsbwpXwBG8"
238
+ ],
239
+ "action": "submit"
240
+ })
241
+ ```
242
+
243
+ **Parameters:**
244
+
245
+ | Name | Type | Description |
246
+ |-----------------|---------|--------------------------------------------------------------------------------------|
247
+ | disputeId* | string | The unique identifier of the dispute. |
248
+ | billing_proof | integer | List of document ids which serves as proof of order confirmation, such as a receipt. |
249
+ | action | string | Possible value is `draft` or `submit` |
250
+
251
+ **Response:**
252
+ ```json
253
+ {
254
+ "id": "disp_AHfqOvkldwsbqt",
255
+ "entity": "dispute",
256
+ "payment_id": "pay_EsyWjHrfzb59eR",
257
+ "amount": 10000,
258
+ "currency": "INR",
259
+ "amount_deducted": 0,
260
+ "reason_code": "chargeback",
261
+ "respond_by": 1590604200,
262
+ "status": "under_review",
263
+ "phase": "chargeback",
264
+ "created_at": 1590059211,
265
+ "evidence": {
266
+ "amount": 5000,
267
+ "summary": "goods delivered",
268
+ "shipping_proof": [
269
+ "doc_EFtmUsbwpXwBH9",
270
+ "doc_EFtmUsbwpXwBH8"
271
+ ],
272
+ "billing_proof": [
273
+ "doc_EFtmUsbwpXwBG9",
274
+ "doc_EFtmUsbwpXwBG8"
275
+ ],
276
+ "cancellation_proof": null,
277
+ "customer_communication": null,
278
+ "proof_of_service": null,
279
+ "explanation_letter": null,
280
+ "refund_confirmation": null,
281
+ "access_activity_log": null,
282
+ "refund_cancellation_policy": null,
283
+ "term_and_conditions": null,
284
+ "others": [
285
+ {
286
+ "type": "receipt_signed_by_customer",
287
+ "document_ids": [
288
+ "doc_EFtmUsbwpXwBH1",
289
+ "doc_EFtmUsbwpXwBH7"
290
+ ]
291
+ }
292
+ ],
293
+ "submitted_at": 1590603200
294
+ }
295
+ }
296
+ ```
297
+ -------------------------------------------------------------------------------------------------------
298
+ **PN: * indicates mandatory fields**
299
+ <br>
300
+ <br>
301
+ **For reference click [here](https://razorpay.com/docs/api/documents)**
@@ -0,0 +1,65 @@
1
+ ## Document
2
+
3
+ ### Create a Document
4
+
5
+ ```rb
6
+ Razorpay::Document.create({
7
+ "file": File.new("/Users/your_name/Downloads/sample_uploaded.jpeg"),
8
+ "purpose": "dispute_evidence"
9
+ });
10
+ ```
11
+
12
+ **Parameters:**
13
+
14
+ | Name | Type | Description |
15
+ |---------|-----------|-----------------------------------------------------------------|
16
+ | file* | string | The URL generated once the business proof document is uploaded. |
17
+ | purpose | string | Possible value is `dispute_evidence` |
18
+
19
+ **Response:**
20
+ ```json
21
+ {
22
+ "id": "doc_EsyWjHrfzb59Re",
23
+ "entity": "document",
24
+ "purpose": "dispute_evidence",
25
+ "name": "doc_19_12_2020.jpg",
26
+ "mime_type": "image/png",
27
+ "size": 2863,
28
+ "created_at": 1590604200
29
+ }
30
+ ```
31
+ -------------------------------------------------------------------------------------------------------
32
+
33
+ ### Fetch Document Information
34
+
35
+ ```rb
36
+ documentId = "doc_NiyXWXXXXXXXXX"
37
+
38
+ Razorpay::Document.fetch(documentId)
39
+ ```
40
+
41
+ **Parameters:**
42
+
43
+ | Name | Type | Description |
44
+ |-------------|-----------|--------------------------------------------------|
45
+ | documentId | string | The unique identifier of the document. |
46
+
47
+ **Response:**
48
+ ```json
49
+ {
50
+ "entity": "document",
51
+ "id": "doc_00000000000000",
52
+ "purpose": "dispute_evidence",
53
+ "created_at": 1701701378,
54
+ "mime_type": "application/pdf",
55
+ "display_name": "ppm_00000000000000",
56
+ "size": 404678,
57
+ "url": ""
58
+ }
59
+ ```
60
+ -------------------------------------------------------------------------------------------------------
61
+
62
+ **PN: * indicates mandatory fields**
63
+ <br>
64
+ <br>
65
+ **For reference click [here](https://razorpay.com/docs/api/documents)**