razorpay 3.0.0 → 3.1.0

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 (77) hide show
  1. checksums.yaml +4 -4
  2. data/.github/pull_request_template.md +8 -0
  3. data/.github/workflows/ci.yml +79 -0
  4. data/CHANGELOG.md +21 -0
  5. data/README.md +5 -1
  6. data/documents/Invoice.md +11 -3
  7. data/documents/account.md +449 -0
  8. data/documents/addon.md +23 -1
  9. data/documents/card.md +73 -29
  10. data/documents/customer.md +2 -0
  11. data/documents/emandate.md +20 -12
  12. data/documents/fund.md +19 -17
  13. data/documents/items.md +65 -41
  14. data/documents/order.md +51 -0
  15. data/documents/papernach.md +40 -20
  16. data/documents/payment.md +247 -14
  17. data/documents/paymentLink.md +37 -19
  18. data/documents/plan.md +3 -3
  19. data/documents/productConfiguration.md +444 -0
  20. data/documents/qrcode.md +17 -19
  21. data/documents/refund.md +11 -10
  22. data/documents/registerEmandate.md +25 -18
  23. data/documents/registerNach.md +49 -57
  24. data/documents/settlement.md +1 -0
  25. data/documents/stakeholder.md +334 -0
  26. data/documents/subscriptions.md +3 -1
  27. data/documents/tokens.md +201 -2
  28. data/documents/transfers.md +292 -195
  29. data/documents/upi.md +25 -28
  30. data/documents/virtualAccount.md +18 -13
  31. data/documents/webhook.md +224 -0
  32. data/lib/razorpay/account.rb +39 -0
  33. data/lib/razorpay/addon.rb +5 -1
  34. data/lib/razorpay/card.rb +4 -0
  35. data/lib/razorpay/constants.rb +2 -2
  36. data/lib/razorpay/iin.rb +15 -0
  37. data/lib/razorpay/order.rb +1 -1
  38. data/lib/razorpay/payment.rb +8 -0
  39. data/lib/razorpay/payment_method.rb +17 -0
  40. data/lib/razorpay/product.rb +37 -0
  41. data/lib/razorpay/request.rb +16 -16
  42. data/lib/razorpay/stakeholder.rb +39 -0
  43. data/lib/razorpay/token.rb +28 -0
  44. data/lib/razorpay/virtual_account.rb +1 -1
  45. data/lib/razorpay/webhook.rb +50 -0
  46. data/lib/razorpay.rb +7 -0
  47. data/razorpay-ruby.gemspec +2 -1
  48. data/test/fixtures/fake_account.json +78 -0
  49. data/test/fixtures/fake_card_reference.json +5 -0
  50. data/test/fixtures/fake_create_upi_payment.json +3 -0
  51. data/test/fixtures/fake_iin_token.json +23 -0
  52. data/test/fixtures/fake_product.json +138 -0
  53. data/test/fixtures/fake_stakeholder.json +29 -0
  54. data/test/fixtures/fake_tokenise_customer.json +40 -0
  55. data/test/fixtures/fake_validate_vpa.json +5 -0
  56. data/test/fixtures/fake_webhook.json +79 -0
  57. data/test/fixtures/fake_webhook_by_account_id.json +22 -0
  58. data/test/fixtures/fetch_tnc.json +11 -0
  59. data/test/fixtures/payment_methods_collection.json +149 -0
  60. data/test/fixtures/stakeholder_collection.json +35 -0
  61. data/test/fixtures/webhook_by_account_collection.json +35 -0
  62. data/test/fixtures/webhook_collection.json +85 -0
  63. data/test/razorpay/test_account.rb +134 -0
  64. data/test/razorpay/test_addon.rb +6 -2
  65. data/test/razorpay/test_card.rb +6 -0
  66. data/test/razorpay/test_customer.rb +8 -8
  67. data/test/razorpay/test_iin.rb +23 -0
  68. data/test/razorpay/test_order.rb +1 -1
  69. data/test/razorpay/test_payment.rb +46 -2
  70. data/test/razorpay/test_product.rb +67 -0
  71. data/test/razorpay/test_settlement.rb +1 -1
  72. data/test/razorpay/test_stakeholder.rb +87 -0
  73. data/test/razorpay/test_token.rb +66 -0
  74. data/test/razorpay/test_transfer.rb +1 -1
  75. data/test/razorpay/test_webhook.rb +132 -0
  76. data/test/test_helper.rb +2 -0
  77. metadata +76 -7
data/documents/tokens.md CHANGED
@@ -40,7 +40,7 @@ Razorpay::Payment.fetch(paymentId)
40
40
  "wallet": null,
41
41
  "vpa": null,
42
42
  "email": "gaurav.kumar@example.com",
43
- "contact": "+919876543210",
43
+ "contact": "9999999999",
44
44
  "customer_id": "cust_DtHaBuooGHTuyZ",
45
45
  "token_id": "token_FHfn3rIiM1Z8nr",
46
46
  "notes": {
@@ -184,7 +184,7 @@ customerId = "cust_1Aa00000000004"
184
184
 
185
185
  tokenId = "token_Hxe0skTXLeg9pF"
186
186
 
187
- Razorpay::fetch(customerId).deleteToken(tokenId)
187
+ Razorpay::Customer.fetch(customerId).deleteToken(tokenId)
188
188
  ```
189
189
 
190
190
  **Parameters:**
@@ -201,7 +201,206 @@ Razorpay::fetch(customerId).deleteToken(tokenId)
201
201
  }
202
202
  ```
203
203
  -------------------------------------------------------------------------------------------------------
204
+ ### Fetch VPA tokens of a customer id
204
205
 
206
+ ```rb
207
+ Razorpay::Customer.fetch(customerId).fetchTokens
208
+ ```
209
+
210
+ **Parameters:**
211
+
212
+ | Name | Type | Description |
213
+ |---------------|-------------|---------------------------------------------|
214
+ | customerId* | string | The id of the customer to be fetched |
215
+
216
+ **Response:**
217
+ ```json
218
+ {
219
+ "entity": "collection",
220
+ "count": 1,
221
+ "items": [
222
+ {
223
+ "id": "token_EeroOjvOvorT5L",
224
+ "entity": "token",
225
+ "token": "4ydxm47GQjrIEx",
226
+ "bank": null,
227
+ "wallet": null,
228
+ "method": "card",
229
+ "card": {
230
+ "entity": "card",
231
+ "name": "Gaurav Kumar",
232
+ "last4": "8430",
233
+ "network": "Visa",
234
+ "type": "credit",
235
+ "issuer": "HDFC",
236
+ "international": false,
237
+ "emi": true,
238
+ "expiry_month": 12,
239
+ "expiry_year": 2022,
240
+ "flows": {
241
+ "otp": true,
242
+ "recurring": true
243
+ }
244
+ },
245
+ "vpa": null,
246
+ "recurring": false,
247
+ "auth_type": null,
248
+ "mrn": null,
249
+ "used_at": 1586976724,
250
+ "created_at": 1586976724,
251
+ "expired_at": 1672511399,
252
+ "dcc_enabled": false
253
+ }
254
+ ]
255
+ }
256
+ ```
257
+ -------------------------------------------------------------------------------------------------------
258
+
259
+ ### Create a token
260
+
261
+ ```rb
262
+
263
+ Razorpay::Token.create({
264
+ "customer_id": "cust_1Aa00000000001",
265
+ "method": "card",
266
+ "card": {
267
+ "number": "4111111111111111",
268
+ "cvv": "123",
269
+ "expiry_month": "12",
270
+ "expiry_year": "21",
271
+ "name": "Gaurav Kumar"
272
+ },
273
+ "authentication": {
274
+ "provider": "razorpay",
275
+ "provider_reference_id": "pay_123wkejnsakd",
276
+ "authentication_reference_number": "100222021120200000000742753928"
277
+ },
278
+ "notes": []
279
+ })
280
+ ```
281
+
282
+ **Parameters:**
283
+
284
+ | Name | Type | Description |
285
+ |---------------|-------------|---------------------------------------------|
286
+ | customerId* | string | The id of the customer to be fetched |
287
+ | method* | string | The type of object that needs to be tokenised. Currently, `card` is the only supported value. |
288
+ | card* | object | All keys listed [here](https://razorpay.com/docs/partners/aggregators/partner-auth/token-sharing/#create-token-on-behalf-of-a-sub-merchant) are supported
289
+ |
290
+ | authentication | object | All keys listed [here](https://razorpay.com/docs/partners/aggregators/partner-auth/token-sharing/#create-token-on-behalf-of-a-sub-merchant) are supported |
291
+
292
+ **Response:**
293
+ ```json
294
+ {
295
+ "id": "token_IJmat4GwYATMtx",
296
+ "entity": "token",
297
+ "method": "card",
298
+ "card": {
299
+ "last4": "1111",
300
+ "network": "Visa",
301
+ "type": "credit",
302
+ "issuer": "IDFB",
303
+ "international": false,
304
+ "emi": false,
305
+ "sub_type": "consumer"
306
+ },
307
+ "customer": {
308
+ "id": "cust_1Aa00000000001",
309
+ "entity": "customer",
310
+ "name": "Bob",
311
+ "email": "bob@gmail.com",
312
+ "contact": "9000090000",
313
+ "gstin": null,
314
+ "notes": {
315
+ "notes_key_1": "Tea, Earl Grey, Hot",
316
+ "notes_key_2": "Tea, Earl Grey… decaf."
317
+ },
318
+ "created_at": 1658390470
319
+ },
320
+ "expired_at": 1701368999,
321
+ "customer_id": "cust_1Aa00000000001",
322
+ "compliant_with_tokenisation_guidelines": true,
323
+ "status": "active",
324
+ "notes": []
325
+ }
326
+ ```
327
+ -------------------------------------------------------------------------------------------------------
328
+
329
+ ### Fetch token
330
+ ```rb
331
+ Razorpay::Token.fetch({"id": "token_4lsdksD31GaZ09"});
332
+ ```
333
+
334
+ **Parameters:**
335
+
336
+ | Name | Type | Description |
337
+ |-------------|-------------|---------------------------------------------|
338
+ | id* | string | The unique identifier of a sub-merchant account generated by Razorpay. |
339
+
340
+ **Response:**
341
+ ```json
342
+ {
343
+ "id": "token_4lsdksD31GaZ09",
344
+ "entity": "token",
345
+ "customer_id": "cust_1Aa00000000001",
346
+ "method": "card",
347
+ "card": {
348
+ "last4": "3335",
349
+ "network": "Visa",
350
+ "type": "debit",
351
+ "issuer": "HDFC",
352
+ "international": false,
353
+ "emi": true,
354
+ "sub_type": "consumer",
355
+ "token_iin": "453335"
356
+ },
357
+ "compliant_with_tokenisation_guidelines": true,
358
+ "expired_at": 1748716199,
359
+ "status": "active",
360
+ "status_reason": null,
361
+ "notes": []
362
+ }
363
+ ```
364
+ -------------------------------------------------------------------------------------------------------
365
+ ### Delete a token
366
+ ```rb
367
+ Razorpay::Token.delete({"id": "token_4lsdksD31GaZ09"});
368
+ ```
369
+
370
+ **Parameters:**
371
+
372
+ | Name | Type | Description |
373
+ |-------------|-------------|---------------------------------------------|
374
+ | id* | string | The unique identifier of a sub-merchant account generated by Razorpay. |
375
+
376
+ **Response:**
377
+ ```json
378
+ []
379
+ ```
380
+ -------------------------------------------------------------------------------------------------------
381
+
382
+ ### Process a Payment on another PA/PG with Token
383
+ ```rb
384
+ Razorpay::Token.process_payment_on_alternate_pa_or_pg({"id":"spt_4lsdksD31GaZ09"});
385
+ ```
386
+
387
+ **Parameters:**
388
+
389
+ | Name | Type | Description |
390
+ |-------------|-------------|---------------------------------------------|
391
+ | id* | string | The unique identifier of the token whose details are to be fetched. |
392
+
393
+ **Response:**
394
+ ```json
395
+ {
396
+ "card": {
397
+ "number": "4016981500100002",
398
+ "expiry_month" : "12",
399
+ "expiry_year" : 2021
400
+ }
401
+ }
402
+ ```
403
+ -------------------------------------------------------------------------------------------------------
205
404
  **PN: * indicates mandatory fields**
206
405
  <br>
207
406
  <br>