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/upi.md CHANGED
@@ -10,6 +10,7 @@ Razorpay.setup('key_id', 'key_secret')
10
10
  para_attr = {
11
11
  "name": "Razorpay User",
12
12
  "email": "customer@razorpay.com",
13
+ "fail_existing": 0,
13
14
  "contact": 9123456780,
14
15
  "notes": {
15
16
  "notes_key_1": "Tea, Earl Grey, Hot",
@@ -52,23 +53,19 @@ Razorpay::Customer.create(para_attr)
52
53
 
53
54
  ```rb
54
55
  para_attr = {
55
- "amount": 0,
56
+ "amount": 100,
56
57
  "currency": "INR",
58
+ "customer_id": "cust_4xbQrmEoA5WJ01",
57
59
  "method": "upi",
58
- "customer_id": "cust_1Aa00000000001",
60
+ "token": {
61
+ "max_amount": 200000,
62
+ "expire_at": 2709971120,
63
+ "frequency": "monthly"
64
+ },
59
65
  "receipt": "Receipt No. 1",
60
66
  "notes": {
61
- "notes_key_1": "Beam me up Scotty",
62
- "notes_key_2": "Engage"
63
- },
64
- "token": {
65
- "auth_type": "netbanking",
66
- "max_amount": 9999900,
67
- "expire_at": 4102444799,
68
- "notes": {
69
- "notes_key_1": "Tea, Earl Grey, Hot",
70
- "notes_key_2": "Tea, Earl Grey… decaf."
71
- }
67
+ "notes_key_1": "Tea, Earl Grey, Hot",
68
+ "notes_key_2": "Tea, Earl Grey… decaf."
72
69
  }
73
70
  }
74
71
  Razorpay.Order.create(para_attr)
@@ -83,7 +80,7 @@ Razorpay.Order.create(para_attr)
83
80
  | method* | string | The authorization method. In this case the value will be `emandate` |
84
81
  | receipt | string | Your system order reference id. |
85
82
  | notes | object | A key-value pair |
86
- | token | object | A key-value pair |
83
+ | token | object | All parameters listed [here](https://razorpay.com/docs/api/payments/recurring-payments/upi/create-authorization-transaction#112-create-an-order) are supported |
87
84
 
88
85
  **Response:**
89
86
  ```json
@@ -147,17 +144,16 @@ Razorpay::SubscriptionRegistration.create(para_attr)
147
144
 
148
145
  | Name | Type | Description |
149
146
  |-----------------|---------|------------------------------------------------------------------------------|
150
- | customer | object | Details of the customer to whom the registration link will be sent. |
147
+ | customer | object | All parameters listed [here](https://razorpay.com/docs/api/payments/recurring-payments/upi/create-authorization-transaction/#121-create-a-registration-link) are supported |
151
148
  | type* | string | In this case, the value is `link`. |
152
149
  | currency* | string | The 3-letter ISO currency code for the payment. Currently, only `INR` is supported. |
153
150
  | amount* | integer | The payment amount in the smallest currency sub-unit. |
154
151
  | description* | string | A description that appears on the hosted page. For example, `12:30 p.m. Thali meals (Gaurav Kumar`). |
155
- | subscription_registration | object | Details of the authorization payment. |
156
- |sms_notify | array | Details of the line item that is billed in the invoice. |
157
- |email_notify | array | Details of the line item that is billed in the invoice. |
158
- |expire_by | array | Details of the line item that is billed in the invoice. |
159
- |receipt | string | Your system order reference id. |
160
- |notes | object | A key-value pair |
152
+ | subscription_registration | object | All parameters listed [here](https://razorpay.com/docs/api/payments/recurring-payments/upi/create-authorization-transaction/#121-create-a-registration-link) are supported |
153
+ | sms_notify | boolean | SMS notifications are to be sent by Razorpay (default : 1) |
154
+ | email_notify | boolean | Email notifications are to be sent by Razorpay (default : 1) |
155
+ | expire_by | integer | The timestamp, in Unix format, till when the customer can make the authorization payment. |
156
+ | notes | object | A key-value pair |
161
157
 
162
158
 
163
159
  **Response:**
@@ -227,7 +223,7 @@ invoiceId = "inv_JDdNb4xdf4gxQ7"
227
223
 
228
224
  medium = "email"
229
225
 
230
- Razorpay::Invoice.notifyBy(invoiceId, medium)
226
+ Razorpay::Invoice.notify_by(invoiceId, medium)
231
227
  ```
232
228
 
233
229
  **Parameters:**
@@ -322,9 +318,9 @@ Razorpay::Invoice.cancel(invoiceId)
322
318
  ### Fetch token by payment ID
323
319
 
324
320
  ```rb
325
- customerId = "cust_1Aa00000000004"
321
+ paymentId = "pay_FHfAzEJ51k8NLj"
326
322
 
327
- Razorpay::Customer.fetchTokens(customerId)
323
+ Razorpay::Payment.fetch(paymentId)
328
324
  ```
329
325
 
330
326
  **Parameters:**
@@ -382,7 +378,7 @@ Razorpay::Customer.fetchTokens(customerId)
382
378
  ```rb
383
379
  customerId = "cust_1Aa00000000004"
384
380
 
385
- Razorpay::Customer.fetchTokens(customerId)
381
+ Razorpay::Customer.fetch(customerId).fetchTokens
386
382
  ```
387
383
 
388
384
  **Parameters:**
@@ -433,7 +429,7 @@ customerId = "cust_1Aa00000000004"
433
429
 
434
430
  tokenId = "token_Hxe0skTXLeg9pF"
435
431
 
436
- Razorpay::fetch(customerId).deleteToken(tokenId)
432
+ Razorpay::Customer.fetch(customerId).deleteToken(tokenId)
437
433
  ```
438
434
 
439
435
  **Parameters:**
@@ -458,6 +454,7 @@ para_attr{
458
454
  "amount": 1000,
459
455
  "currency": "INR",
460
456
  "receipt": "Receipt No. 1",
457
+ "payment_capture": true,
461
458
  "notes": {
462
459
  "notes_key_1": "Tea, Earl Grey, Hot",
463
460
  "notes_key_2": "Tea, Earl Grey… decaf."
@@ -473,8 +470,8 @@ Razorpay::Order.create(para_attr)
473
470
  | amount* | integer | Amount of the order to be paid |
474
471
  | currency* | string | Currency of the order. Currently only `INR` is supported. |
475
472
  | receipt | string | Your system order reference id. |
473
+ | payment_capture* | boolean | Indicates whether payment status should be changed to captured automatically or not. Possible values: true - Payments are captured automatically. false - Payments are not captured automatically. |
476
474
  | notes | object | A key-value pair |
477
-
478
475
  **Response:**
479
476
  ```json
480
477
  {
@@ -512,7 +509,7 @@ para_attr = {
512
509
  "description": "Creating recurring payment for Gaurav Kumar"
513
510
  }
514
511
 
515
- Razorpay::Payment.createRecurringPayment(para_attr)
512
+ Razorpay::Payment.create_recurring_payment(para_attr)
516
513
  ```
517
514
 
518
515
  **Parameters:**
@@ -342,7 +342,7 @@ Razorpay::VirtualAccount.fetch(virtualId).payments(options)
342
342
  ```rb
343
343
  paymend_id = "pay_Di5iqCqA1WEHq6"
344
344
 
345
- Razorpay::Razorpay::Payment.fetch(paymend_id).bank_transfer
345
+ Razorpay::Payment.fetch(paymend_id).bank_transfer
346
346
  ```
347
347
 
348
348
  **Parameters:**
@@ -403,6 +403,8 @@ Razorpay::Razorpay::Payment.fetch(paymend_id).bank_transfer
403
403
 
404
404
  ### Refund payments made to a virtual account
405
405
  ```rb
406
+ paymend_id = "pay_Di5iqCqA1WEHq6"
407
+
406
408
  options = {
407
409
  "amount": "100",
408
410
  "speed": "normal",
@@ -413,7 +415,7 @@ options = {
413
415
  "receipt": "Receipt No. 31"
414
416
  }
415
417
 
416
- Razorpay::Payment.fetch(@payment_id).refund(options)
418
+ Razorpay::Payment.fetch(payment_id).refund(options)
417
419
  ```
418
420
 
419
421
  **Parameters:**
@@ -429,20 +431,22 @@ Razorpay::Payment.fetch(@payment_id).refund(options)
429
431
  **Response:**
430
432
  ```json
431
433
  {
432
- "id": "rfnd_E6j36ZEKvsWsEn",
434
+ "id": "rfnd_FP8QHiV938haTz",
433
435
  "entity": "refund",
434
- "amount": 100,
436
+ "amount": 500100,
437
+ "receipt": "Receipt No. 31",
435
438
  "currency": "INR",
436
- "payment_id": "pay_E54n391WnEAV9H",
437
- "notes": {
438
- "key_1": "value1",
439
- "key_2": "value2"
440
- },
439
+ "payment_id": "pay_FCXKPFtYfPXJPy",
440
+ "notes": [],
441
441
  "receipt": null,
442
442
  "acquirer_data": {
443
- "rrn": null
443
+ "arn": null
444
444
  },
445
- "created_at": 1579522301
445
+ "created_at": 1597078866,
446
+ "batch_id": null,
447
+ "status": "processed",
448
+ "speed_processed": "normal",
449
+ "speed_requested": "normal"
446
450
  }
447
451
  ```
448
452
  -------------------------------------------------------------------------------------------------------
@@ -469,7 +473,7 @@ Razorpay::VirtualAccount.add_receiver(virtualId, para_attr)
469
473
  |-------|-----------|--------------------------------------------------|
470
474
  | virtualId* | string | The id of the virtual to be updated |
471
475
  | types* | object | The receiver type to be added to the virtual account. Possible values are `vpa` or `bank_account` |
472
- | vpa | object | This is to be passed only when `vpa` is passed as the receiver types. |
476
+ | vpa.descriptor | string | Descriptor should be 10 characters only. |
473
477
 
474
478
  **Response:**
475
479
  For add receiver to an existing virtual account response please click [here](https://razorpay.com/docs/api/smart-collect/#add-receiver-to-an-existing-virtual-account)
@@ -560,7 +564,7 @@ Razorpay::VirtualAccount.delete_allowed_payer(virtualId,allowedPayersId)
560
564
 
561
565
  **Response:**
562
566
  ```json
563
- {}
567
+ null
564
568
  ```
565
569
  -------------------------------------------------------------------------------------------------------
566
570
  ### Close virtual account
@@ -578,6 +582,7 @@ Razorpay::VirtualAccount.close(virtualId)
578
582
 
579
583
  **Response:**
580
584
  For close virtual account response please click [here](https://razorpay.com/docs/api/smart-collect/#close-a-virtual-account)
585
+
581
586
  -------------------------------------------------------------------------------------------------------
582
587
 
583
588
  **PN: * indicates mandatory fields**
@@ -0,0 +1,224 @@
1
+ ## Webhook
2
+
3
+ ### Create a Webhook
4
+ ```rb
5
+ accountId = "acc_GP4lfNA0iIMn5B"
6
+
7
+ Razorpay::Webhook.create({
8
+ "url": "https://google.com",
9
+ "alert_email": "gaurav.kumar@example.com",
10
+ "secret": "12345",
11
+ "events": [
12
+ "payment.authorized",
13
+ "payment.failed",
14
+ "payment.captured",
15
+ "payment.dispute.created",
16
+ "refund.failed",
17
+ "refund.created"
18
+ ]
19
+ }, accountId)
20
+ ```
21
+
22
+ **Parameters:**
23
+
24
+ | Name | Type | Description |
25
+ |---------------|-------------|---------------------------------------------|
26
+ | accountId* | string | The unique identifier of a sub-merchant account generated by Razorpay. |
27
+ | url* | string | The URL where you receive the webhook payload when an event is triggered. The maximum length is 255 characters. |
28
+ | alert_email | string | This is the email address to which notifications must be sent in case of webhook failure. |
29
+ | secret | string | A secret for the webhook endpoint that is used to validate that the webhook is from Razorpay. |
30
+ | events | string | The required events from the list of Active Events. For example `payment.authorized`, `payment.captured`, `payment.failed`, `payment.dispute.created`, `refund.failed`, `refund.created` and so on. |
31
+
32
+ **Response:**
33
+ ```json
34
+ {
35
+ "id": "JebiXkKGYwua5L",
36
+ "created_at": 1654605478,
37
+ "updated_at": 1654605478,
38
+ "service": "beta-api-live",
39
+ "owner_id": "JOGUdtKu3dB03d",
40
+ "owner_type": "merchant",
41
+ "context": [],
42
+ "disabled_at": 0,
43
+ "url": "https://google.com",
44
+ "alert_email": "gaurav.kumar@example.com",
45
+ "secret_exists": true,
46
+ "entity": "webhook",
47
+ "active": true,
48
+ "events": [
49
+ "payment.authorized",
50
+ "payment.failed",
51
+ "payment.captured",
52
+ "payment.dispute.created",
53
+ "refund.failed",
54
+ "refund.created"
55
+ ]
56
+ }
57
+ ```
58
+
59
+ -------------------------------------------------------------------------------------------------------
60
+
61
+ ### Edit Webhook
62
+ ```rb
63
+ webhookId = "HK890egfiItP3H"
64
+
65
+ accountId = "acc_GP4lfNA0iIMn5B"
66
+
67
+ Razorpay::Webhook.edit({
68
+ "url": "https://www.linkedin.com",
69
+ "events": [
70
+ "refund.created"
71
+ ]
72
+ }, webhookId, accountId)
73
+ ```
74
+
75
+ **Parameters:**
76
+
77
+ | Name | Type | Description |
78
+ |---------------|-------------|---------------------------------------------|
79
+ | accountId* | string | The unique identifier of a sub-merchant account generated by Razorpay. |
80
+ | webhookId* | string | The unique identifier of the webhook whose details are to be updated |
81
+ | url | string | The URL where you receive the webhook payload when an event is triggered. The maximum length is 255 characters. |
82
+ | events | string | The required events from the list of Active Events. For example `payment.authorized`, `payment.captured`, `payment.failed`, `payment.dispute.created`, `refund.failed`, `refund.created` and so on. |
83
+
84
+ **Response:**
85
+ ```json
86
+ {
87
+ "id": "HK890egfiItP3H",
88
+ "created_at": 1623060358,
89
+ "updated_at": 1623067148,
90
+ "service": "beta-api-test",
91
+ "owner_id": "H3kYHQ635sBwXG",
92
+ "owner_type": "merchant",
93
+ "context": [],
94
+ "disabled_at": 0,
95
+ "url": "https://www.linkedin.com",
96
+ "alert_email": "gaurav.kumar@example.com",
97
+ "secret_exists": true,
98
+ "entity": "webhook",
99
+ "active": true,
100
+ "events": [
101
+ "refund.created"
102
+ ]
103
+ }
104
+ ```
105
+ -------------------------------------------------------------------------------------------------------
106
+
107
+ ### Delete an account
108
+ ```rb
109
+ accountId = "acc_GP4lfNA0iIMn5B"
110
+
111
+ webhookId = "HK890egfiItP3H"
112
+
113
+ Razorpay::Webhook.delete(webhookId, accountId)
114
+ ```
115
+
116
+ **Parameters:**
117
+
118
+ | Name | Type | Description |
119
+ |---------------|-------------|---------------------------------------------|
120
+ | accountId* | string | The unique identifier of a sub-merchant account that must be deleted. |
121
+ | webhookId* | string | The unique identifier of the webhook whose details are to be updated |
122
+
123
+ **Response:**
124
+ ```json
125
+ []
126
+ ```
127
+
128
+ -------------------------------------------------------------------------------------------------------
129
+
130
+ ### Fetch a webhook
131
+ ```rb
132
+ accountId = "acc_GP4lfNA0iIMn5B";
133
+
134
+ webhookId = "HK890egfiItP3H";
135
+
136
+ Razorpay::Webhook.fetch(webhookId, accountId);
137
+ ```
138
+
139
+ **Parameters:**
140
+
141
+ | Name | Type | Description |
142
+ |-------------|-------------|---------------------------------------------|
143
+ | accountId* | string | The unique identifier of a sub-merchant account generated by Razorpay. |
144
+ | webhookId* | string | The unique identifier of the webhook whose details are to be updated |
145
+
146
+ **Response:**
147
+ ```json
148
+ {
149
+ "id": "HK890egfiItP3H",
150
+ "created_at": 1623060358,
151
+ "updated_at": 1623060358,
152
+ "owner_id": "H3kYHQ635sBwXG",
153
+ "owner_type": "merchant",
154
+ "context": [],
155
+ "disabled_at": 0,
156
+ "url": "https://en1mwkqo5ioct.x.pipedream.net",
157
+ "alert_email": "gaurav.kumar@example.com",
158
+ "secret_exists": true,
159
+ "entity": "webhook",
160
+ "active": true,
161
+ "events": [
162
+ "payment.authorized",
163
+ "payment.failed",
164
+ "payment.captured",
165
+ "payment.dispute.created",
166
+ "refund.failed",
167
+ "refund.created"
168
+ ]
169
+ }
170
+ ```
171
+
172
+ -------------------------------------------------------------------------------------------------------
173
+
174
+ ### Fetch all Webhooks
175
+ ```rb
176
+ accountId = "acc_GP4lfNA0iIMn5B";
177
+
178
+ Razorpay::Webhook.all({
179
+ "count": 1
180
+ }, accountId);
181
+ ```
182
+
183
+ **Parameters:**
184
+
185
+ | Name | Type | Description |
186
+ |-------------|-------------|---------------------------------------------|
187
+ | accountId* | string | The unique identifier of a sub-merchant account generated by Razorpay. |
188
+ | from | integer | Timestamp, in seconds, from when the webhooks are to be fetched. |
189
+ | to | integer | Timestamp, in seconds, till when the webhooks are to be fetched. |
190
+ | count | integer | Number of webhooks to be fetched. The default value is `10` and the maximum value is `100`. This can be used for pagination, in combination with `skip`. |
191
+ | skip | integer | Number of records to be skipped while fetching the webhooks. This can be used for pagination, in combination with `count`. |
192
+
193
+ **Response:**
194
+ ```json
195
+ {
196
+ "id": "HK890egfiItP3H",
197
+ "created_at": 1623060358,
198
+ "updated_at": 1623060358,
199
+ "owner_id": "H3kYHQ635sBwXG",
200
+ "owner_type": "merchant",
201
+ "context": [],
202
+ "disabled_at": 0,
203
+ "url": "https://en1mwkqo5ioct.x.pipedream.net",
204
+ "alert_email": "gaurav.kumar@example.com",
205
+ "secret_exists": true,
206
+ "entity": "webhook",
207
+ "active": true,
208
+ "events": [
209
+ "payment.authorized",
210
+ "payment.failed",
211
+ "payment.captured",
212
+ "payment.dispute.created",
213
+ "refund.failed",
214
+ "refund.created"
215
+ ]
216
+ }
217
+ ```
218
+
219
+ -------------------------------------------------------------------------------------------------------
220
+
221
+ **PN: * indicates mandatory fields**
222
+ <br>
223
+ <br>
224
+ **For reference click [here](https://razorpay.com/docs/api/partners/webhooks)**
@@ -0,0 +1,39 @@
1
+ require 'razorpay/request'
2
+ require 'razorpay/entity'
3
+
4
+ module Razorpay
5
+ # Account API allows you to create a sub-merchant account.
6
+ class Account < Entity
7
+
8
+ @@versions = "v2"
9
+
10
+ def self.request
11
+ Razorpay::Request.new('accounts')
12
+ end
13
+
14
+ def self.create(options)
15
+ request.create options, @@versions
16
+ end
17
+
18
+ def self.fetch(id)
19
+ request.fetch id, @@versions
20
+ end
21
+
22
+ def self.edit(id, options = {})
23
+ request.patch id, options, @@versions
24
+ end
25
+
26
+ def self.delete(id)
27
+ request.delete "#{id}", @@versions
28
+ end
29
+
30
+ def self.upload_account_doc(id,options)
31
+ r = request
32
+ r.request :post, "/#{@@versions}/accounts/#{id}/documents", options
33
+ end
34
+
35
+ def self.fetch_account_doc(id)
36
+ request.fetch "#{id}/documents", @@versions
37
+ end
38
+ end
39
+ end
@@ -22,7 +22,11 @@ module Razorpay
22
22
  # POST /addons is not supported
23
23
  # Addon creation endpoint is:
24
24
  # POST subscriptions/{sub_id}/addons
25
- r.request :post, "/subscriptions/#{subscription_id}/addons", options
25
+ r.request :post, "/v1/subscriptions/#{subscription_id}/addons", options
26
+ end
27
+
28
+ def self.delete(id)
29
+ request.delete id
26
30
  end
27
31
  end
28
32
  end
data/lib/razorpay/card.rb CHANGED
@@ -13,5 +13,9 @@ module Razorpay
13
13
  def self.fetch(id)
14
14
  request.fetch id
15
15
  end
16
+
17
+ def self.request_card_reference(options)
18
+ request.post 'fingerprints', options
19
+ end
16
20
  end
17
21
  end
@@ -1,6 +1,6 @@
1
1
  # Version and other constants are defined here
2
2
  module Razorpay
3
- BASE_URI = 'https://api.razorpay.com/v1/'.freeze
3
+ BASE_URI = 'https://api.razorpay.com'.freeze
4
4
  TEST_URL = 'https://api.razorpay.com/'.freeze
5
- VERSION = '3.0.0'.freeze
5
+ VERSION = '3.1.0'.freeze
6
6
  end
@@ -0,0 +1,15 @@
1
+ require 'razorpay/request'
2
+ require 'razorpay/entity'
3
+
4
+ module Razorpay
5
+ # IIN API allows you to fetch card properties using token IIN.
6
+ class Iin < Entity
7
+ def self.request
8
+ Razorpay::Request.new('iins')
9
+ end
10
+
11
+ def self.fetch(id)
12
+ request.fetch id
13
+ end
14
+ end
15
+ end
@@ -23,7 +23,7 @@ module Razorpay
23
23
 
24
24
  def payments(options = {})
25
25
  r = self.class.request
26
- r.request :get, "/orders/#{id}/payments", options
26
+ r.request :get, "/v1/orders/#{id}/payments", options
27
27
  end
28
28
 
29
29
  def self.edit(id, options = {})
@@ -104,5 +104,13 @@ module Razorpay
104
104
  def otp_resend
105
105
  self.class.request.post "#{id}/otp/resend"
106
106
  end
107
+
108
+ def self.create_upi(data={})
109
+ request.post "create/upi" , data
110
+ end
111
+
112
+ def self.validate_vpa(data={})
113
+ request.post "validate/vpa" , data
114
+ end
107
115
  end
108
116
  end
@@ -0,0 +1,17 @@
1
+ require 'razorpay/request'
2
+ require 'razorpay/refund'
3
+ require 'razorpay/entity'
4
+
5
+ module Razorpay
6
+ # Payment Methods class is allows you to create
7
+ # to fetch all payment methods
8
+ class PaymentMethods < Entity
9
+ def self.request
10
+ Razorpay::Request.new('methods')
11
+ end
12
+
13
+ def self.all(options = {})
14
+ request.all options
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,37 @@
1
+ require 'razorpay/request'
2
+ require 'razorpay/entity'
3
+
4
+ module Razorpay
5
+ # Product API allows you to enable sub-merchants request for a product.
6
+ class Product < Entity
7
+
8
+ @@versions = "v2"
9
+
10
+ def self.request
11
+ Razorpay::Request.new('accounts')
12
+ end
13
+
14
+ def self.request_product_configuration(account_id, options)
15
+ if(!options.is_a?(String) && options.key?(:tnc_accepted))
16
+ options[:tnc_accepted] = (options[:tnc_accepted] ? 1 : 0)
17
+ end
18
+ request.post "#{account_id}/products", options, @@versions
19
+ end
20
+
21
+ def self.fetch(account_id, id)
22
+ request.fetch "#{account_id}/products/#{id}", @@versions
23
+ end
24
+
25
+ def self.edit(account_id, id, options = {})
26
+ if(!options.is_a?(String) && options.key?(:tnc_accepted))
27
+ options[:tnc_accepted] = (options[:tnc_accepted] ? 1 : 0)
28
+ end
29
+ request.patch "#{account_id}/products/#{id}", options, @@versions
30
+ end
31
+
32
+ def self.fetch_tnc(productName)
33
+ r = request
34
+ r.request :get, "/#{@@versions}/products/#{productName}/tnc", {}
35
+ end
36
+ end
37
+ end
@@ -27,36 +27,36 @@ module Razorpay
27
27
  }
28
28
  end
29
29
 
30
- def fetch(id)
31
- request :get, "/#{@entity_name}/#{id}"
30
+ def fetch(id, version="v1")
31
+ request :get, "/#{version}/#{@entity_name}/#{id}"
32
32
  end
33
33
 
34
- def all(options)
35
- request :get, "/#{@entity_name}", options
34
+ def all(options, version="v1")
35
+ request :get, "/#{version}/#{@entity_name}", options
36
36
  end
37
37
 
38
- def post(url, data = {})
39
- request :post, "/#{@entity_name}/#{url}", data
38
+ def post(url, data = {}, version="v1")
39
+ request :post, "/#{version}/#{@entity_name}/#{url}", data
40
40
  end
41
41
 
42
- def get(url, data = {})
43
- request :get, "/#{@entity_name}/#{url}", data
42
+ def get(url, data = {}, version="v1")
43
+ request :get, "/#{version}/#{@entity_name}/#{url}", data
44
44
  end
45
45
 
46
- def delete(url)
47
- request :delete, "/#{@entity_name}/#{url}"
46
+ def delete(url, version="v1")
47
+ request :delete, "/#{version}/#{@entity_name}/#{url}"
48
48
  end
49
49
 
50
- def put(id, data = {})
51
- request :put, "/#{@entity_name}/#{id}", data
50
+ def put(id, data = {}, version="v1")
51
+ request :put, "/#{version}/#{@entity_name}/#{id}", data
52
52
  end
53
53
 
54
- def patch(id, data = {})
55
- request :patch, "/#{@entity_name}/#{id}", data
54
+ def patch(id, data = {}, version="v1")
55
+ request :patch, "/#{version}/#{@entity_name}/#{id}", data
56
56
  end
57
57
 
58
- def create(data)
59
- request :post, "/#{@entity_name}", data
58
+ def create(data, version="v1")
59
+ request :post, "/#{version}/#{@entity_name}", data
60
60
  end
61
61
 
62
62
  def request(method, url, data = {})