razorpay 2.4.1 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
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
@@ -0,0 +1,208 @@
1
+ ## Tokens
2
+
3
+ ```rb
4
+ require "razorpay"
5
+
6
+ Razorpay.setup('key_id', 'key_secret')
7
+ ```
8
+
9
+ ### Fetch token by payment id
10
+ ```rb
11
+ paymentId = "pay_FHfqtkRzWvxky4"
12
+
13
+ Razorpay::Payment.fetch(paymentId)
14
+ ```
15
+
16
+ **Parameters:**
17
+
18
+ | Name | Type | Description |
19
+ |---------------|-------------|---------------------------------------------|
20
+ | paymentId* | string | The id of the payment to be fetched |
21
+
22
+ **Response:**
23
+ ```json
24
+ {
25
+ "id": "pay_FHfqtkRzWvxky4",
26
+ "entity": "payment",
27
+ "amount": 100,
28
+ "currency": "INR",
29
+ "status": "captured",
30
+ "order_id": "order_FHfnswDdfu96HQ",
31
+ "invoice_id": null,
32
+ "international": false,
33
+ "method": "card",
34
+ "amount_refunded": 0,
35
+ "refund_status": null,
36
+ "captured": true,
37
+ "description": null,
38
+ "card_id": "card_F0zoXUp4IPPGoI",
39
+ "bank": null,
40
+ "wallet": null,
41
+ "vpa": null,
42
+ "email": "gaurav.kumar@example.com",
43
+ "contact": "+919876543210",
44
+ "customer_id": "cust_DtHaBuooGHTuyZ",
45
+ "token_id": "token_FHfn3rIiM1Z8nr",
46
+ "notes": {
47
+ "note_key 1": "Beam me up Scotty",
48
+ "note_key 2": "Tea. Earl Gray. Hot."
49
+ },
50
+ "fee": 0,
51
+ "tax": 0,
52
+ "error_code": null,
53
+ "error_description": null,
54
+ "error_source": null,
55
+ "error_step": null,
56
+ "error_reason": null,
57
+ "acquirer_data": {
58
+ "auth_code": "541898"
59
+ },
60
+ "created_at": 1595449871
61
+ }
62
+ ```
63
+
64
+ -------------------------------------------------------------------------------------------------------
65
+
66
+ ### Fetch tokens by customer id
67
+
68
+ ```rb
69
+ customerId = "cust_1Aa00000000004"
70
+
71
+ Razorpay::Customer.fetch(customerId).fetchTokens
72
+ ```
73
+
74
+ **Parameters:**
75
+
76
+ | Name | Type | Description |
77
+ |---------------|-------------|---------------------------------------------|
78
+ | customerId* | string | The id of the customer to be fetched |
79
+
80
+ **Response:**
81
+ ```json
82
+ {
83
+ "entity":"collection",
84
+ "count":1,
85
+ "items":[
86
+ {
87
+ "id":"token_HouA2OQR5Z2jTL",
88
+ "entity":"token",
89
+ "token":"2JPRk664pZHUWG",
90
+ "bank":null,
91
+ "wallet":null,
92
+ "method":"card",
93
+ "card":{
94
+ "entity":"card",
95
+ "name":"Gaurav Kumar",
96
+ "last4":"8950",
97
+ "network":"Visa",
98
+ "type":"credit",
99
+ "issuer":"STCB",
100
+ "international":false,
101
+ "emi":false,
102
+ "sub_type":"consumer",
103
+ "expiry_month":12,
104
+ "expiry_year":2021,
105
+ "flows":{
106
+ "otp":true,
107
+ "recurring":true
108
+ }
109
+ },
110
+ "recurring":true,
111
+ "recurring_details":{
112
+ "status":"confirmed",
113
+ "failure_reason":null
114
+ },
115
+ "auth_type":null,
116
+ "mrn":null,
117
+ "used_at":1629779657,
118
+ "created_at":1629779657,
119
+ "expired_at":1640975399,
120
+ "dcc_enabled":false,
121
+ "billing_address":null
122
+ }
123
+ ]
124
+ }
125
+ ```
126
+ -------------------------------------------------------------------------------------------------------
127
+
128
+ ### Fetch particular token
129
+ ```rb
130
+ customerId = "cust_1Aa00000000004"
131
+
132
+ tokenId = "token_Hxe0skTXLeg9pF"
133
+
134
+ Razorpay::Customer.fetch(customerId).fetchToken(tokenId)
135
+ ```
136
+
137
+ **Parameters:**
138
+
139
+ | Name | Type | Description |
140
+ |---------------|-------------|---------------------------------------------|
141
+ | customerId* | string | The id of the customer to be fetched |
142
+ | tokenId* | string | The id of the token to be fetched |
143
+
144
+ **Response:**
145
+ ```json
146
+ {
147
+ "id": "token_Hxe0skTXLeg9pF",
148
+ "entity": "token",
149
+ "token": "F85BgXnGVwcuqV",
150
+ "bank": null,
151
+ "wallet": null,
152
+ "method": "card",
153
+ "card": {
154
+ "entity": "card",
155
+ "name": "ankit",
156
+ "last4": "5449",
157
+ "network": "MasterCard",
158
+ "type": "credit",
159
+ "issuer": "UTIB",
160
+ "international": false,
161
+ "emi": false,
162
+ "sub_type": "consumer",
163
+ "expiry_month": 12,
164
+ "expiry_year": 2024,
165
+ "flows": {
166
+ "recurring": true
167
+ }
168
+ },
169
+ "recurring": true,
170
+ "auth_type": null,
171
+ "mrn": null,
172
+ "used_at": 1632976165,
173
+ "created_at": 1631687852,
174
+ "expired_at": 1634215992,
175
+ "dcc_enabled": false
176
+ }
177
+ ```
178
+ -------------------------------------------------------------------------------------------------------
179
+
180
+ ### Delete token
181
+
182
+ ```rb
183
+ customerId = "cust_1Aa00000000004"
184
+
185
+ tokenId = "token_Hxe0skTXLeg9pF"
186
+
187
+ Razorpay::fetch(customerId).deleteToken(tokenId)
188
+ ```
189
+
190
+ **Parameters:**
191
+
192
+ | Name | Type | Description |
193
+ |---------------|-------------|---------------------------------------------|
194
+ | customerId* | string | The id of the customer to be fetched |
195
+ | tokenId* | string | The id of the token to be fetched |
196
+
197
+ **Response:**
198
+ ```json
199
+ {
200
+ "deleted": true
201
+ }
202
+ ```
203
+ -------------------------------------------------------------------------------------------------------
204
+
205
+ **PN: * indicates mandatory fields**
206
+ <br>
207
+ <br>
208
+ **For reference click [here](https://razorpay.com/docs/api/recurring-payments/upi/tokens/)**