razorpay 3.0.1 → 3.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ci.yml +2 -2
  3. data/CHANGELOG.md +13 -0
  4. data/README.md +4 -0
  5. data/documents/account.md +449 -0
  6. data/documents/card.md +45 -0
  7. data/documents/payment.md +44 -1
  8. data/documents/productConfiguration.md +444 -0
  9. data/documents/stakeholder.md +334 -0
  10. data/documents/tokens.md +146 -1
  11. data/documents/webhook.md +224 -0
  12. data/lib/razorpay/account.rb +39 -0
  13. data/lib/razorpay/addon.rb +1 -1
  14. data/lib/razorpay/card.rb +4 -0
  15. data/lib/razorpay/constants.rb +2 -2
  16. data/lib/razorpay/iin.rb +15 -0
  17. data/lib/razorpay/order.rb +1 -1
  18. data/lib/razorpay/product.rb +37 -0
  19. data/lib/razorpay/request.rb +16 -16
  20. data/lib/razorpay/stakeholder.rb +39 -0
  21. data/lib/razorpay/token.rb +28 -0
  22. data/lib/razorpay/virtual_account.rb +1 -1
  23. data/lib/razorpay/webhook.rb +50 -0
  24. data/lib/razorpay.rb +6 -0
  25. data/test/fixtures/fake_account.json +78 -0
  26. data/test/fixtures/fake_card_reference.json +5 -0
  27. data/test/fixtures/fake_iin_token.json +23 -0
  28. data/test/fixtures/fake_product.json +138 -0
  29. data/test/fixtures/fake_stakeholder.json +29 -0
  30. data/test/fixtures/fake_tokenise_customer.json +40 -0
  31. data/test/fixtures/fake_webhook.json +79 -0
  32. data/test/fixtures/fake_webhook_by_account_id.json +22 -0
  33. data/test/fixtures/fetch_tnc.json +11 -0
  34. data/test/fixtures/stakeholder_collection.json +35 -0
  35. data/test/fixtures/webhook_by_account_collection.json +35 -0
  36. data/test/fixtures/webhook_collection.json +85 -0
  37. data/test/razorpay/test_account.rb +134 -0
  38. data/test/razorpay/test_card.rb +6 -0
  39. data/test/razorpay/test_customer.rb +8 -8
  40. data/test/razorpay/test_iin.rb +23 -0
  41. data/test/razorpay/test_order.rb +1 -1
  42. data/test/razorpay/test_product.rb +67 -0
  43. data/test/razorpay/test_settlement.rb +1 -1
  44. data/test/razorpay/test_stakeholder.rb +87 -0
  45. data/test/razorpay/test_token.rb +66 -0
  46. data/test/razorpay/test_transfer.rb +1 -1
  47. data/test/razorpay/test_webhook.rb +132 -0
  48. metadata +47 -1
@@ -0,0 +1,444 @@
1
+ ## Product Configuration
2
+
3
+ ### Request a Product Configuration
4
+ ```rb
5
+
6
+ accountId = "acc_GP4lfNA0iIMn5B"
7
+
8
+ Razorpay::Product.request_product_configuration(accountId, {
9
+ "product_name": "payment_gateway",
10
+ "tnc_accepted": true,
11
+ "ip": "233.233.233.234"
12
+ })
13
+ ```
14
+
15
+ **Parameters:**
16
+
17
+ | Name | Type | Description |
18
+ |---------------|-------------|---------------------------------------------|
19
+ | product_name* | string | The product(s) to be configured. Possible value is `payment_gateway`, `payment_links` |
20
+ | tnc_accepted | boolean | Pass this parameter to accept terms and conditions. Send this parameter along with the ip parameter when the tnc is accepted. Possible values is `true` |
21
+ | ip | integer | The IP address of the merchant while accepting the terms and conditions. Send this parameter along with the `tnc_accepted` parameter when the `tnc` is accepted. |
22
+
23
+ **Response:**
24
+ ```json
25
+ {
26
+ "requested_configuration": {
27
+ "payment_methods": []
28
+ },
29
+ "active_configuration": {
30
+ "payment_capture": {
31
+ "mode": "automatic",
32
+ "refund_speed": "normal",
33
+ "automatic_expiry_period": 7200
34
+ },
35
+ "settlements": {
36
+ "account_number": null,
37
+ "ifsc_code": null,
38
+ "beneficiary_name": null
39
+ },
40
+ "checkout": {
41
+ "theme_color": "#FFFFFF",
42
+ "flash_checkout": true,
43
+ "logo": "https://example.com/your_logo"
44
+ },
45
+ "refund": {
46
+ "default_refund_speed": "normal"
47
+ },
48
+ "notifications": {
49
+ "whatsapp": true,
50
+ "sms": false,
51
+ "email": [
52
+ "b963e252-1201-45b0-9c39-c53eceb0cfd6_load@gmail.com"
53
+ ]
54
+ },
55
+ "payment_methods": {
56
+ "netbanking": {
57
+ "enabled": true,
58
+ "instrument": [
59
+ {
60
+ "type": "retail",
61
+ "bank": [
62
+ "hdfc",
63
+ "sbin",
64
+ "utib",
65
+ "icic",
66
+ "scbl",
67
+ "yesb"
68
+ ]
69
+ }
70
+ ]
71
+ },
72
+ "wallet": {
73
+ "enabled": true,
74
+ "instrument": [
75
+ "airtelmoney",
76
+ "freecharge",
77
+ "jiomoney",
78
+ "olamoney",
79
+ "payzapp",
80
+ "mobikwik"
81
+ ]
82
+ },
83
+ "upi": {
84
+ "enabled": true,
85
+ "instrument": [
86
+ "upi"
87
+ ]
88
+ }
89
+ }
90
+ },
91
+ "requirements": [
92
+ {
93
+ "field_reference": "individual_proof_of_address",
94
+ "resolution_url": "/accounts/acc_HQVlm3bnPmccC0/stakeholders/{stakeholderId}/documents",
95
+ "status": "required",
96
+ "reason_code": "document_missing"
97
+ },
98
+ {
99
+ "field_reference": "individual_proof_of_identification",
100
+ "resolution_url": "/accounts/acc_HQVlm3bnPmccC0/stakeholders/{stakeholderId}/documents",
101
+ "status": "required",
102
+ "reason_code": "document_missing"
103
+ },
104
+ {
105
+ "field_reference": "business_proof_of_identification",
106
+ "resolution_url": "/accounts/acc_HQVlm3bnPmccC0/documents",
107
+ "status": "required",
108
+ "reason_code": "document_missing"
109
+ },
110
+ {
111
+ "field_reference": "settlements.beneficiary_name",
112
+ "resolution_url": "/accounts/acc_HQVlm3bnPmccC0/products/acc_prd_HEgNpywUFctQ9e",
113
+ "status": "required",
114
+ "reason_code": "field_missing"
115
+ },
116
+ {
117
+ "field_reference": "settlements.account_number",
118
+ "resolution_url": "/accounts/acc_HQVlm3bnPmccC0/products/acc_prd_HEgNpywUFctQ9e",
119
+ "status": "required",
120
+ "reason_code": "field_missing"
121
+ },
122
+ {
123
+ "field_reference": "settlements.ifsc_code",
124
+ "resolution_url": "/accounts/acc_HQVlm3bnPmccC0/products/acc_prd_HEgNpywUFctQ9e",
125
+ "status": "required",
126
+ "reason_code": "field_missing"
127
+ },
128
+ {
129
+ "field_reference": "contact_name",
130
+ "resolution_url": "/accounts/acc_HQVlm3bnPmccC0",
131
+ "status": "required",
132
+ "reason_code": "field_missing"
133
+ },
134
+ {
135
+ "field_reference": "name",
136
+ "resolution_url": "/accounts/acc_HQVlm3bnPmccC0/stakeholders",
137
+ "status": "required",
138
+ "reason_code": "field_missing"
139
+ },
140
+ {
141
+ "field_reference": "customer_facing_business_name",
142
+ "resolution_url": "/accounts/acc_HQVlm3bnPmccC0",
143
+ "status": "required",
144
+ "reason_code": "field_missing"
145
+ },
146
+ {
147
+ "field_reference": "kyc.pan",
148
+ "resolution_url": "/accounts/acc_HQVlm3bnPmccC0/stakeholders",
149
+ "status": "required",
150
+ "reason_code": "field_missing"
151
+ }
152
+ ],
153
+ "tnc":{
154
+ "id": "tnc_IgohZaDBHRGjPv",
155
+ "accepted": true,
156
+ "accepted_at": 1641550798
157
+ },
158
+ "id": "acc_prd_HEgNpywUFctQ9e",
159
+ "account_id": "acc_HQVlm3bnPmccC0",
160
+ "product_name": "payment_gateway",
161
+ "activation_status": "needs_clarification",
162
+ "requested_at": 162547884
163
+ }
164
+ ```
165
+
166
+ -------------------------------------------------------------------------------------------------------
167
+
168
+ ### Edit a Product Configuration
169
+ ```rb
170
+ accountId = "acc_GP4lfNA0iIMn5B"
171
+ productId = "acc_prd_HEgNpywUFctQ9e"
172
+
173
+ Razorpay::Product.edit(accountId, productId, {
174
+ "notifications": {
175
+ "email": [
176
+ "gaurav.kumar@example.com",
177
+ "acd@gmail.com"
178
+ ]
179
+ },
180
+ "checkout": {
181
+ "theme_color": "#528FFF"
182
+ },
183
+ "refund": {
184
+ "default_refund_speed": "optimum"
185
+ },
186
+ "settlements": {
187
+ "account_number": "1234567890",
188
+ "ifsc_code": "HDFC0000317",
189
+ "beneficiary_name": "Gaurav Kumar"
190
+ },
191
+ "tnc_accepted": 1,
192
+ "ip": "233.233.233.234"
193
+ })
194
+ ```
195
+
196
+ **Parameters:**
197
+
198
+ | Name | Type | Description |
199
+ |---------------|-------------|---------------------------------------------|
200
+ | notifications | object | All keys listed [here](https://razorpay.com/docs/api/partners/product-configuration/#update-a-product-configuration) are supported |
201
+ | checkout | object | All keys listed [here](https://razorpay.com/docs/api/partners/product-configuration/#update-a-product-configuration) are supported |
202
+ | refund | object | All keys listed [here](https://razorpay.com/docs/api/partners/product-configuration/#update-a-product-configuration) are supported |
203
+ | settlements | object | All keys listed [here](https://razorpay.com/docs/api/partners/product-configuration/#update-a-product-configuration) are supported |
204
+ | tnc_accepted | boolean | Pass this parameter to accept terms and conditions. Send this parameter along with the ip parameter when the tnc is accepted. Possible value is `true` |
205
+ | ip | string | The IP address of the merchant while accepting the terms and conditions. Send this parameter along with the tnc_accepted parameter when the `tnc` is accepted. |
206
+ | payment_methods | All keys listed [here](https://razorpay.com/docs/api/partners/product-configuration/#update-a-product-configuration) are supported |
207
+ | type | string | Possible value is `domestic` |
208
+ | issuer | string | The card issuer. Possible values for issuer are `amex`, `dicl`, `maestro`, `mastercard`, `rupay`, `visa`. |
209
+ | wallet | object | All keys listed [here](https://razorpay.com/docs/api/partners/product-configuration/#update-a-product-configuration) are supported |
210
+ | instrument(wallet) | string | The wallet issuer. Possible values are `airtelmoney`, `amazonpay`, `freecharge`, `jiomoney`, `mobiwik`, `mpesa`, `olamoney`, `paytm`, `payzapp`, `payumoney`, `phonepe`, `phonepeswitch`, `sbibuddy` |
211
+ | instrument(wallet) | string | The wallet issuer. Possible values are `airtelmoney`, `amazonpay`, `freecharge`, `jiomoney`, `mobiwik`, `mpesa`, `olamoney`, `paytm`, `payzapp`, `payumoney`, `phonepe`, `phonepeswitch`, `sbibuddy` |
212
+ | upi | object | All keys listed [here](https://razorpay.com/docs/api/partners/product-configuration/#update-a-product-configuration) are supported |
213
+ | instrument(upi) | string | The UPI service provider. Possible values are `google_pay`, `upi`|
214
+ | paylater | object | All keys listed [here](https://razorpay.com/docs/api/partners/product-configuration/#update-a-product-configuration) are supported |
215
+ | instrument(emi) | string | The Paylater service provider. Possible values are `epaylater`, `getsimpl`|
216
+ | emi | object | All keys listed [here](https://razorpay.com/docs/api/partners/product-configuration/#update-a-product-configuration) are supported |
217
+
218
+ **Response:**
219
+ ```json
220
+ {
221
+ "id": "acc_GP4lfNA0iIMn5B",
222
+ "type": "standard",
223
+ "status": "created",
224
+ "email": "gauri@example.org",
225
+ "profile": {
226
+ "category": "healthcare",
227
+ "subcategory": "clinic",
228
+ "addresses": {
229
+ "registered": {
230
+ "street1": "507, Koramangala 1st block",
231
+ "street2": "MG Road-1",
232
+ "city": "Bengalore",
233
+ "state": "KARNATAKA",
234
+ "postal_code": "560034",
235
+ "country": "IN"
236
+ }
237
+ }
238
+ },
239
+ "notes": [],
240
+ "created_at": 1610603081,
241
+ "phone": "9000090000",
242
+ "reference_id": "randomId",
243
+ "business_type": "partnership",
244
+ "legal_business_name": "Acme Corp",
245
+ "customer_facing_business_name": "ABCD Ltd"
246
+ }
247
+ ```
248
+ -------------------------------------------------------------------------------------------------------
249
+
250
+ ### Fetch a product configuration
251
+ ```rb
252
+ accountId = "acc_GP4lfNA0iIMn5B"
253
+
254
+ productId = "acc_prd_HEgNpywUFctQ9e"
255
+
256
+ Razorpay::Product.fetch(accountId, productId)
257
+ ```
258
+
259
+ **Parameters:**
260
+
261
+ | Name | Type | Description |
262
+ |-------------|-------------|---------------------------------------------|
263
+ | accountId* | string | The unique identifier of a sub-merchant account generated by Razorpay. |
264
+ | productId* | string | The unique identifier of a product generated by Razorpay. |
265
+
266
+ **Response:**
267
+ ```json
268
+ {
269
+ "requested_configuration": {
270
+ "payment_methods": []
271
+ },
272
+ "active_configuration": {
273
+ "payment_capture": {
274
+ "mode": "automatic",
275
+ "refund_speed": "normal",
276
+ "automatic_expiry_period": 7200
277
+ },
278
+ "settlements": {
279
+ "account_number": null,
280
+ "ifsc_code": null,
281
+ "beneficiary_name": null
282
+ },
283
+ "checkout": {
284
+ "theme_color": "#FFFFFF",
285
+ "flash_checkout": true
286
+ },
287
+ "refund": {
288
+ "default_refund_speed": "normal"
289
+ },
290
+ "notifications": {
291
+ "whatsapp": true,
292
+ "sms": false,
293
+ "email": [
294
+ "b963e252-1201-45b0-9c39-c53eceb0cfd6_load@gmail.com"
295
+ ]
296
+ },
297
+ "payment_methods": {
298
+ "netbanking": {
299
+ "enabled": true,
300
+ "instrument": [
301
+ {
302
+ "type": "retail",
303
+ "bank": [
304
+ "hdfc",
305
+ "sbin",
306
+ "utib",
307
+ "icic",
308
+ "scbl",
309
+ "yesb"
310
+ ]
311
+ }
312
+ ]
313
+ },
314
+ "wallet": {
315
+ "enabled": true,
316
+ "instrument": [
317
+ "airtelmoney",
318
+ "freecharge",
319
+ "jiomoney",
320
+ "olamoney",
321
+ "payzapp",
322
+ "mobikwik"
323
+ ]
324
+ },
325
+ "upi": {
326
+ "enabled": true,
327
+ "instrument": [
328
+ "upi"
329
+ ]
330
+ }
331
+ }
332
+ },
333
+ "requirements": [
334
+ {
335
+ "field_reference": "individual_proof_of_address",
336
+ "resolution_url": "/accounts/acc_HQVlm3bnPmccC0/stakeholders/{stakeholderId}/documents",
337
+ "status": "required",
338
+ "reason_code": "document_missing"
339
+ },
340
+ {
341
+ "field_reference": "individual_proof_of_identification",
342
+ "resolution_url": "/accounts/acc_HQVlm3bnPmccC0/stakeholders/{stakeholderId}/documents",
343
+ "status": "required",
344
+ "reason_code": "document_missing"
345
+ },
346
+ {
347
+ "field_reference": "business_proof_of_identification",
348
+ "resolution_url": "/accounts/acc_HQVlm3bnPmccC0/documents",
349
+ "status": "required",
350
+ "reason_code": "document_missing"
351
+ },
352
+ {
353
+ "field_reference": "settlements.beneficiary_name",
354
+ "resolution_url": "/accounts/acc_HQVlm3bnPmccC0/products/acc_prd_HEgNpywUFctQ9e",
355
+ "status": "required",
356
+ "reason_code": "field_missing"
357
+ },
358
+ {
359
+ "field_reference": "settlements.account_number",
360
+ "resolution_url": "/accounts/acc_HQVlm3bnPmccC0/products/acc_prd_HEgNpywUFctQ9e",
361
+ "status": "required",
362
+ "reason_code": "field_missing"
363
+ },
364
+ {
365
+ "field_reference": "settlements.ifsc_code",
366
+ "resolution_url": "/accounts/acc_HQVlm3bnPmccC0/products/acc_prd_HEgNpywUFctQ9e",
367
+ "status": "required",
368
+ "reason_code": "field_missing"
369
+ },
370
+ {
371
+ "field_reference": "contact_name",
372
+ "resolution_url": "/accounts/acc_HQVlm3bnPmccC0",
373
+ "status": "required",
374
+ "reason_code": "field_missing"
375
+ },
376
+ {
377
+ "field_reference": "name",
378
+ "resolution_url": "/accounts/acc_HQVlm3bnPmccC0/stakeholders",
379
+ "status": "required",
380
+ "reason_code": "field_missing"
381
+ },
382
+ {
383
+ "field_reference": "customer_facing_business_name",
384
+ "resolution_url": "/accounts/acc_HQVlm3bnPmccC0",
385
+ "status": "required",
386
+ "reason_code": "field_missing"
387
+ },
388
+ {
389
+ "field_reference": "kyc.pan",
390
+ "resolution_url": "/accounts/acc_HQVlm3bnPmccC0/stakeholders",
391
+ "status": "required",
392
+ "reason_code": "field_missing"
393
+ }
394
+ ],
395
+ "tnc":{
396
+ "id": "tnc_IgohZaDBHRGjPv",
397
+ "accepted": true,
398
+ "accepted_at": 1641550798
399
+ },
400
+ "id": "acc_prd_HEgNpywUFctQ9e",
401
+ "account_id": "acc_HQVlm3bnPmccC0",
402
+ "product_name": "payment_gateway",
403
+ "activation_status": "needs_clarification",
404
+ "requested_at": 1625478849
405
+ }
406
+ ```
407
+
408
+ -------------------------------------------------------------------------------------------------------
409
+
410
+ ### Fetch Terms and Conditions for a Sub-Merchant
411
+ ```rb
412
+
413
+ productName = "payments"
414
+
415
+ Razorpay::Product.fetch_tnc(productName)
416
+ ```
417
+
418
+ **Parameters:**
419
+
420
+ | Name | Type | Description |
421
+ |-------------|-------------|---------------------------------------------|
422
+ | productName* | string | The product family for which the relevant product to be requested for the sub-merchant. Possible value is `payments` |
423
+
424
+ **Response:**
425
+ ```json
426
+ {
427
+ "entity": "tnc_map",
428
+ "product_name": "payments",
429
+ "id": "tnc_map_HjOVhIdpVDZ0FB",
430
+ "tnc": {
431
+ "terms": "https://razorpay.com/terms",
432
+ "privacy": "https://razorpay.com/privacy",
433
+ "agreement": "https://razorpay.com/agreement"
434
+ },
435
+ "last_published_at": 1640589653
436
+ }
437
+ ```
438
+
439
+ -------------------------------------------------------------------------------------------------------
440
+
441
+ **PN: * indicates mandatory fields**
442
+ <br>
443
+ <br>
444
+ **For reference click [here](https://razorpay.com/docs/api/partners/product-configuration/)**