razorpay 2.4.1 → 3.0.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 (114) hide show
  1. checksums.yaml +4 -4
  2. data/.github/dependabot.yml +8 -0
  3. data/.github/workflows/ruby.yml +38 -0
  4. data/CHANGELOG.md +19 -0
  5. data/README.md +29 -140
  6. data/documents/Invoice.md +531 -0
  7. data/documents/addon.md +169 -0
  8. data/documents/card.md +611 -0
  9. data/documents/customer.md +161 -0
  10. data/documents/emandate.md +484 -0
  11. data/documents/fund.md +87 -0
  12. data/documents/items.md +184 -0
  13. data/documents/order.md +230 -0
  14. data/documents/papernach.md +718 -0
  15. data/documents/payment.md +636 -0
  16. data/documents/paymentLink.md +1045 -0
  17. data/documents/paymentVerification.md +79 -0
  18. data/documents/plan.md +184 -0
  19. data/documents/qrcode.md +441 -0
  20. data/documents/refund.md +324 -0
  21. data/documents/registerEmandate.md +445 -0
  22. data/documents/registerNach.md +661 -0
  23. data/documents/settlement.md +477 -0
  24. data/documents/subscriptions.md +750 -0
  25. data/documents/tokens.md +208 -0
  26. data/documents/transfers.md +684 -0
  27. data/documents/upi.md +548 -0
  28. data/documents/virtualAccount.md +586 -0
  29. data/lib/razorpay/addon.rb +4 -0
  30. data/lib/razorpay/constants.rb +1 -1
  31. data/lib/razorpay/customer.rb +15 -0
  32. data/lib/razorpay/fund_account.rb +19 -0
  33. data/lib/razorpay/invoice.rb +8 -0
  34. data/lib/razorpay/item.rb +34 -0
  35. data/lib/razorpay/order.rb +10 -0
  36. data/lib/razorpay/payment.rb +52 -0
  37. data/lib/razorpay/payment_link.rb +36 -0
  38. data/lib/razorpay/qr_code.rb +34 -0
  39. data/lib/razorpay/refund.rb +4 -0
  40. data/lib/razorpay/request.rb +13 -6
  41. data/lib/razorpay/settlement.rb +39 -0
  42. data/lib/razorpay/subscription.rb +24 -0
  43. data/lib/razorpay/subscription_registration.rb +16 -0
  44. data/lib/razorpay/transfer.rb +35 -0
  45. data/lib/razorpay/utility.rb +7 -2
  46. data/lib/razorpay/virtual_account.rb +14 -6
  47. data/lib/razorpay.rb +7 -0
  48. data/test/fixtures/addon_collection.json +60 -0
  49. data/test/fixtures/create_json_payment.json +13 -0
  50. data/test/fixtures/delete_token.json +3 -0
  51. data/test/fixtures/downtimes_collection.json +21 -0
  52. data/test/fixtures/empty.json +2 -0
  53. data/test/fixtures/fake_addon.json +3 -3
  54. data/test/fixtures/fake_direct_transfer.json +32 -0
  55. data/test/fixtures/fake_downtime.json +14 -0
  56. data/test/fixtures/fake_fund_account.json +18 -0
  57. data/test/fixtures/fake_instant_settlement.json +19 -0
  58. data/test/fixtures/fake_item.json +9 -0
  59. data/test/fixtures/fake_order_transfers.json +88 -0
  60. data/test/fixtures/fake_otp_generate.json +19 -0
  61. data/test/fixtures/fake_otp_resend.json +7 -0
  62. data/test/fixtures/fake_otp_submit.json +5 -0
  63. data/test/fixtures/fake_payment_link.json +40 -0
  64. data/test/fixtures/fake_pending_update.json +30 -0
  65. data/test/fixtures/fake_qrcode.json +20 -0
  66. data/test/fixtures/fake_qrcode_close.json +22 -0
  67. data/test/fixtures/fake_recurring.json +5 -0
  68. data/test/fixtures/fake_refund.json +1 -1
  69. data/test/fixtures/fake_settlement.json +11 -0
  70. data/test/fixtures/fake_settlement_on_demand.json +39 -0
  71. data/test/fixtures/fake_subscription_pause.json +19 -0
  72. data/test/fixtures/fake_subscription_registration.json +91 -0
  73. data/test/fixtures/fake_subscription_resume.json +19 -0
  74. data/test/fixtures/fake_token.json +31 -0
  75. data/test/fixtures/fake_transfer.json +18 -0
  76. data/test/fixtures/fake_transfer_reverse.json +15 -0
  77. data/test/fixtures/fake_update_payment.json +39 -0
  78. data/test/fixtures/fake_virtual_account_allowed.json +46 -0
  79. data/test/fixtures/fake_virtual_account_receiver.json +46 -0
  80. data/test/fixtures/fund_collection.json +20 -0
  81. data/test/fixtures/item_collection.json +24 -0
  82. data/test/fixtures/payment_collection.json +1 -1
  83. data/test/fixtures/payment_link_collection.json +43 -0
  84. data/test/fixtures/payment_link_response.json +3 -0
  85. data/test/fixtures/qrcode_collection.json +50 -0
  86. data/test/fixtures/qrcode_payments_collection.json +74 -0
  87. data/test/fixtures/settlement_collection.json +26 -0
  88. data/test/fixtures/settlement_instant_collection.json +84 -0
  89. data/test/fixtures/settlement_report_collection.json +117 -0
  90. data/test/fixtures/success.json +3 -0
  91. data/test/fixtures/tokens_collection.json +36 -0
  92. data/test/fixtures/transfer_settlements_collection.json +38 -0
  93. data/test/fixtures/transfers_collection.json +41 -0
  94. data/test/razorpay/test_addon.rb +15 -15
  95. data/test/razorpay/test_customer.rb +27 -3
  96. data/test/razorpay/test_fund_account.rb +42 -0
  97. data/test/razorpay/test_invoice.rb +15 -2
  98. data/test/razorpay/test_item.rb +66 -0
  99. data/test/razorpay/test_order.rb +24 -1
  100. data/test/razorpay/test_payment.rb +184 -8
  101. data/test/razorpay/test_payment_link.rb +83 -0
  102. data/test/razorpay/test_plan.rb +2 -2
  103. data/test/razorpay/test_qr_code.rb +63 -0
  104. data/test/razorpay/test_refund.rb +16 -2
  105. data/test/razorpay/test_settlement.rb +76 -0
  106. data/test/razorpay/test_subscription.rb +72 -9
  107. data/test/razorpay/test_subscription_registration.rb +58 -0
  108. data/test/razorpay/test_transfer.rb +77 -0
  109. data/test/razorpay/test_utility.rb +32 -0
  110. data/test/razorpay/test_virtual_account.rb +64 -17
  111. data/test/test_helper.rb +6 -0
  112. metadata +138 -9
  113. data/.travis.yml +0 -22
  114. data/test/razorpay/test_errors.rb +0 -19
data/documents/fund.md ADDED
@@ -0,0 +1,87 @@
1
+ ## Funds
2
+
3
+ ```rb
4
+ require "razorpay"
5
+ Razorpay.setup('key_id', 'key_secret')
6
+ ```
7
+
8
+ ### Create a fund account
9
+ ```rb
10
+ para_attr = {
11
+ "customer_id":"cust_Aa000000000001",
12
+ "account_type":"bank_account",
13
+ "bank_account":{
14
+ "name":"Gaurav Kumar",
15
+ "account_number":"11214311215411",
16
+ "ifsc":"HDFC0000053"
17
+ }
18
+ }
19
+
20
+ Razorpay::FundAccount.create(data)
21
+ ```
22
+
23
+ **Parameters:**
24
+
25
+ | Name | Type | Description |
26
+ |---------------|-------------|---------------------------------------------|
27
+ | customerId* | string | The id of the customer to be fetched |
28
+ | account_type* | string | The bank_account to be linked to the customer ID |
29
+ | bank_account* | object | A key-value pair |
30
+
31
+ **Response:**
32
+ ```json
33
+ {
34
+ "id":"fa_Aa00000000001",
35
+ "entity":"fund_account",
36
+ "customer_id":"cust_Aa000000000001",
37
+ "account_type":"bank_account",
38
+ "bank_account":{
39
+ "name":"Gaurav Kumar",
40
+ "account_number":"11214311215411",
41
+ "ifsc":"HDFC0000053",
42
+ "bank_name":"HDFC Bank"
43
+ },
44
+ "active":true,
45
+ "created_at":1543650891
46
+ }
47
+ ```
48
+ -------------------------------------------------------------------------------------------------------
49
+
50
+ ### Fetch all fund accounts
51
+
52
+ ```rb
53
+ para_attr = {
54
+ "customer_id": "cust_I3FToKbnExwDLu"
55
+ }
56
+ Razorpay::FundAccount.all(para_attr)
57
+ ```
58
+
59
+ **Parameters:**
60
+
61
+ | Name | Type | Description |
62
+ |---------------|-------------|---------------------------------------------|
63
+ | customerId* | string | The id of the customer to be fetched |
64
+
65
+ **Response:**
66
+ ```json
67
+ {
68
+ "id":"fa_Aa00000000001",
69
+ "entity":"fund_account",
70
+ "customer_id":"cust_Aa000000000001",
71
+ "account_type":"bank_account",
72
+ "bank_account":{
73
+ "name":"Gaurav Kumar",
74
+ "account_number":"11214311215411",
75
+ "ifsc":"HDFC0000053",
76
+ "bank_name":"HDFC Bank"
77
+ },
78
+ "active":true,
79
+ "created_at":1543650891
80
+ }
81
+ ```
82
+ -------------------------------------------------------------------------------------------------------
83
+
84
+ **PN: * indicates mandatory fields**
85
+ <br>
86
+ <br>
87
+ **For reference click [here](https://razorpay.com/docs/payments/customers/customer-fund-account-api/)**
@@ -0,0 +1,184 @@
1
+ ## items
2
+
3
+ ```rb
4
+ require "razorpay"
5
+ Razorpay.setup('key_id', 'key_secret')
6
+ ```
7
+
8
+ ### Create item
9
+
10
+ ```rb
11
+ Razorpay::Item.create({
12
+ "name": "Book / English August",
13
+ "description": "An indian story, Booker prize winner.",
14
+ "amount": 20000,
15
+ "currency": "INR"
16
+ });
17
+ ```
18
+
19
+ **Parameters:**
20
+
21
+ | Name | Type | Description |
22
+ |-----------------|---------|------------------------------------------------------------------------------|
23
+ | name* | string | Name of the item. |
24
+ | description | string | A brief description of the item. |
25
+ | amount | integer | Amount of the order to be paid |
26
+ | currency | string | Currency of the order. Currently only `INR` is supported. |
27
+
28
+ **Response:**
29
+ ```json
30
+ {
31
+ "id": "item_7Oxp4hmm6T4SCn",
32
+ "active": true,
33
+ "name": "Book / English August",
34
+ "description": "An indian story, Booker prize winner.",
35
+ "amount": 20000,
36
+ "currency": "INR"
37
+ }
38
+ ```
39
+
40
+ -------------------------------------------------------------------------------------------------------
41
+
42
+ ### Fetch all items
43
+
44
+ ```rb
45
+ options = {"count":1}
46
+
47
+ Razorpay::Item.all(options)
48
+ ```
49
+ **Parameters:**
50
+
51
+ | Name | Type | Description |
52
+ |-------|-----------|--------------------------------------------------|
53
+ | from | timestamp | timestamp after which the item were created |
54
+ | to | timestamp | timestamp before which the item were created |
55
+ | count | integer | number of item to fetch (default: 10) |
56
+ | skip | integer | number of item to be skipped (default: 0) |
57
+ | name | string | Name of the item. |
58
+ | description | string | A brief description of the item. |
59
+ | amount | integer | Amount of the order to be paid |
60
+ | currency | string | Currency of the order. Currently only `INR` is supported. |
61
+ | active | boolean | Possible values is `0` or `1` |
62
+
63
+ **Response:**
64
+ ```json
65
+ {
66
+ "entity": "collection",
67
+ "count": 3,
68
+ "items": [
69
+ {
70
+ "id": "item_7Oy8OMV6BdEAac",
71
+ "active": true,
72
+ "name": "Book / Ignited Minds",
73
+ "description": null,
74
+ "amount": 15000,
75
+ "currency": "INR"
76
+ },
77
+ {
78
+ "id": "item_7Oxp4hmm6T4SCn",
79
+ "active": true,
80
+ "name": "Book / English August",
81
+ "description": "An indian story, Booker prize winner.",
82
+ "amount": 20000,
83
+ "currency": "INR"
84
+ },
85
+ {
86
+ "id": "item_7OxoGnoxCuUKbo",
87
+ "active": true,
88
+ "name": "Book / English August",
89
+ "description": null,
90
+ "amount": 20000,
91
+ "currency": "INR"
92
+ }
93
+ ]
94
+ }
95
+ ```
96
+ -------------------------------------------------------------------------------------------------------
97
+ ### Fetch particular item
98
+
99
+ ```rb
100
+ itemId = "item_7Oxp4hmm6T4SCn"
101
+
102
+ Razorpay::Item.fetch(itemId)
103
+ ```
104
+ **Parameters**
105
+
106
+ | Name | Type | Description |
107
+ |----------|--------|-------------------------------------|
108
+ | itemId* | string | The id of the item to be fetched |
109
+
110
+ **Response:**
111
+ ```json
112
+ {
113
+ "id": "item_7Oxp4hmm6T4SCn",
114
+ "active": true,
115
+ "name": "Book / English August",
116
+ "description": "An indian story, Booker prize winner.",
117
+ "amount": 20000,
118
+ "currency": "INR"
119
+ }
120
+ ```
121
+
122
+ -------------------------------------------------------------------------------------------------------
123
+
124
+ ### Update item
125
+
126
+ ```rb
127
+ itemId = "item_JDcbIdX9xojCje"
128
+
129
+ para_attr = {
130
+ "name": "Book / Ignited Minds - Updated name!",
131
+ "description": "New descirption too. :).",
132
+ "amount": 20000,
133
+ "currency": "INR",
134
+ "active": true
135
+ }
136
+
137
+ Razorpay::Item.edit(itemId,para_attr)
138
+ ```
139
+ **Parameters**
140
+
141
+ | Name | Type | Description |
142
+ |----------|--------|-------------------------------------|
143
+ | itemId* | string | The id of the item to be fetched |
144
+ | name | string | Name of the item. |
145
+ | description | string | A brief description of the item. |
146
+ | amount | integer | Amount of the order to be paid |
147
+ | currency | string | Currency of the order. Currently only `INR` is supported. |
148
+ | active | boolean | Possible values is `0` or `1` |
149
+
150
+ **Response:**
151
+ ```json
152
+ {
153
+ "id": "item_7Oy8OMV6BdEAac",
154
+ "active": true,
155
+ "name": "Book / Ignited Minds - Updated name!",
156
+ "description": "New descirption too. :)",
157
+ "amount": 15000,
158
+ "currency": "INR"
159
+ }
160
+ ```
161
+ -------------------------------------------------------------------------------------------------------
162
+ ### Delete item
163
+
164
+ ```rb
165
+ itemId = "item_Jc7wDjjQ4x305A"
166
+
167
+ Razorpay::Item.delete(itemId)
168
+ ```
169
+ **Parameters**
170
+
171
+ | Name | Type | Description |
172
+ |----------|--------|-------------------------------------|
173
+ | itemId* | string | The id of the item to be fetched |
174
+
175
+ **Response:**
176
+ ```json
177
+ []
178
+ ```
179
+ -------------------------------------------------------------------------------------------------------
180
+
181
+ **PN: * indicates mandatory fields**
182
+ <br>
183
+ <br>
184
+ **For reference click [here](https://razorpay.com/docs/api/items)**
@@ -0,0 +1,230 @@
1
+ ## Orders
2
+
3
+ ```rb
4
+ require "razorpay"
5
+ Razorpay.setup('key_id', 'key_secret')
6
+ ```
7
+
8
+ ### Create order
9
+
10
+ ```rb
11
+
12
+ para_attr = {
13
+ "amount": 50000,
14
+ "currency": "INR",
15
+ "receipt": "receipt#1",
16
+ "notes": {
17
+ "key1": "value3",
18
+ "key2": "value2"
19
+ }
20
+ }
21
+
22
+ Razorpay::Order.create(para_attr)
23
+ ```
24
+
25
+ **Parameters:**
26
+
27
+ | Name | Type | Description |
28
+ |-----------------|---------|------------------------------------------------------------------------------|
29
+ | amount* | integer | Amount of the order to be paid |
30
+ | currency* | string | Currency of the order. Currently only `INR` is supported. |
31
+ | receipt | string | Your system order reference id. |
32
+ | notes | object | A key-value pair |
33
+
34
+ **Response:**
35
+
36
+ ```json
37
+ {
38
+ "id": "order_EKwxwAgItmmXdp",
39
+ "entity": "order",
40
+ "amount": 50000,
41
+ "amount_paid": 0,
42
+ "amount_due": 50000,
43
+ "currency": "INR",
44
+ "receipt": "receipt#1",
45
+ "offer_id": null,
46
+ "status": "created",
47
+ "attempts": 0,
48
+ "notes": [],
49
+ "created_at": 1582628071
50
+ }
51
+ ```
52
+
53
+ -------------------------------------------------------------------------------------------------------
54
+
55
+ ### Fetch all orders
56
+
57
+ ```rb
58
+ option = {"count":1}
59
+
60
+ Razorpay::Order.all(option)
61
+ ```
62
+
63
+ **Parameters**
64
+
65
+ | Name | Type | Description |
66
+ |------------|-----------|--------------------------------------------------------------|
67
+ | from | timestamp | timestamp after which the orders were created |
68
+ | to | timestamp | timestamp before which the orders were created |
69
+ | count | integer | number of orders to fetch (default: 10) |
70
+ | skip | integer | number of orders to be skipped (default: 0) |
71
+ | authorized | boolean | Orders for which orders are currently in authorized state. |
72
+ | receipt | string | Orders with the provided value for receipt. |
73
+
74
+ **Response:**
75
+
76
+ ```json
77
+ {
78
+ "entity": "collection",
79
+ "count": 1,
80
+ "items": [
81
+ {
82
+ "id": "order_EKzX2WiEWbMxmx",
83
+ "entity": "order",
84
+ "amount": 1234,
85
+ "amount_paid": 0,
86
+ "amount_due": 1234,
87
+ "currency": "INR",
88
+ "receipt": "Receipt No. 1",
89
+ "offer_id": null,
90
+ "status": "created",
91
+ "attempts": 0,
92
+ "notes": [],
93
+ "created_at": 1582637108
94
+ }
95
+ ]
96
+ }
97
+ ```
98
+ -------------------------------------------------------------------------------------------------------
99
+
100
+ ### Fetch particular order
101
+
102
+ ```rb
103
+ orderId = "order_DaaS6LOUAASb7Y"
104
+
105
+ Razorpay::Order.fetch(orderId)
106
+ ```
107
+ **Parameters**
108
+
109
+ | Name | Type | Description |
110
+ |----------|--------|-------------------------------------|
111
+ | orderId* | string | The id of the order to be fetched |
112
+
113
+ **Response:**
114
+
115
+ ```json
116
+ {
117
+ "id":"order_DaaS6LOUAASb7Y",
118
+ "entity":"order",
119
+ "amount":2200,
120
+ "amount_paid":0,
121
+ "amount_due":2200,
122
+ "currency":"INR",
123
+ "receipt":"Receipt #211",
124
+ "status":"attempted",
125
+ "attempts":1,
126
+ "notes":[],
127
+ "created_at":1572505143
128
+ }
129
+ ```
130
+ -------------------------------------------------------------------------------------------------------
131
+
132
+ ### Fetch payments for an order
133
+
134
+ ```rb
135
+ orderId = "order_DaaS6LOUAASb7Y"
136
+
137
+ Razorpay::Order.fetch("order_JCRhAvzvZQPkwT").payments
138
+ ```
139
+ **Parameters**
140
+
141
+ | Name | Type | Description |
142
+ |----------|--------|-------------------------------------|
143
+ | orderId* | string | The id of the order to be retrieve payment info |
144
+
145
+ **Response:**
146
+ ```json
147
+ {
148
+ "entity":"collection",
149
+ "count":1,
150
+ "items":[
151
+ {
152
+ "id":"pay_DaaSOvhgcOfzgR",
153
+ "entity":"payment",
154
+ "amount":2200,
155
+ "currency":"INR",
156
+ "status":"captured",
157
+ "order_id":"order_DaaS6LOUAASb7Y",
158
+ "invoice_id":null,
159
+ "international":false,
160
+ "method":"card",
161
+ "amount_refunded":0,
162
+ "refund_status":null,
163
+ "captured":true,
164
+ "description":"Beans in every imaginable flavour",
165
+ "card_id":"card_DZon6fd8J3IcA2",
166
+ "bank":null,
167
+ "wallet":null,
168
+ "vpa":null,
169
+ "email":"gaurav.kumar@example.com",
170
+ "contact":"+919999999988",
171
+ "notes":[],
172
+ "fee":44,
173
+ "tax":0,
174
+ "error_code":null,
175
+ "error_description":null,
176
+ "created_at":1572505160
177
+ }
178
+ ]
179
+ }
180
+ ```
181
+ -------------------------------------------------------------------------------------------------------
182
+
183
+ ### Update order
184
+
185
+ ```rb
186
+ orderId = "order_DaaS6LOUAASb7Y"
187
+
188
+ para_attr = {
189
+ "notes": {
190
+ "key1": "value3",
191
+ "key2": "value2"
192
+ }
193
+ }
194
+
195
+ Razorpay::Order.edit(orderId,para_attr)
196
+ ```
197
+ **Parameters**
198
+
199
+ | Name | Type | Description |
200
+ |----------|--------|-------------------------------------|
201
+ | orderId* | string | The id of the order to be retrieve payment info |
202
+ | notes* | object | A key-value pair |
203
+
204
+ **Response:**
205
+ ```json
206
+ {
207
+ "id":"order_DaaS6LOUAASb7Y",
208
+ "entity":"order",
209
+ "amount":2200,
210
+ "amount_paid":0,
211
+ "amount_due":2200,
212
+ "currency":"INR",
213
+ "receipt":"Receipt #211",
214
+ "offer_id":null,
215
+ "status":"attempted",
216
+ "attempts":1,
217
+ "notes":{
218
+ "notes_key_1":"Tea, Earl Grey, Hot",
219
+ "notes_key_2":"Tea, Earl Grey… decaf."
220
+ },
221
+ "created_at":1572505143
222
+ }
223
+ ```
224
+ -------------------------------------------------------------------------------------------------------
225
+
226
+
227
+ **PN: * indicates mandatory fields**
228
+ <br>
229
+ <br>
230
+ **For reference click [here](https://razorpay.com/docs/api/orders/)**