razorpay 3.2.2 → 3.2.4

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 (46) hide show
  1. checksums.yaml +4 -4
  2. data/.cursorignore +174 -0
  3. data/.github/workflows/ci.yml +8 -7
  4. data/CHANGELOG.md +16 -0
  5. data/README.md +2 -0
  6. data/documents/customer.md +242 -0
  7. data/documents/dispute.md +301 -0
  8. data/documents/documents.md +65 -0
  9. data/documents/order.md +71 -0
  10. data/documents/payment.md +253 -0
  11. data/documents/transfers.md +40 -0
  12. data/lib/razorpay/constants.rb +1 -1
  13. data/lib/razorpay/customer.rb +16 -0
  14. data/lib/razorpay/dispute.rb +26 -0
  15. data/lib/razorpay/document.rb +19 -0
  16. data/lib/razorpay/order.rb +8 -0
  17. data/lib/razorpay/payment.rb +4 -0
  18. data/lib/razorpay/transfer.rb +4 -0
  19. data/lib/razorpay/utility.rb +8 -3
  20. data/lib/razorpay.rb +2 -0
  21. data/test/fixtures/dispute_collection.json +67 -0
  22. data/test/fixtures/dispute_error.json +10 -0
  23. data/test/fixtures/document_error.json +10 -0
  24. data/test/fixtures/error_customer.json +10 -0
  25. data/test/fixtures/error_eligibility.json +10 -0
  26. data/test/fixtures/error_eligibility_check.json +10 -0
  27. data/test/fixtures/fake_bank_account.json +9 -0
  28. data/test/fixtures/fake_dispute.json +29 -0
  29. data/test/fixtures/fake_document.json +9 -0
  30. data/test/fixtures/fake_eligiblity.json +79 -0
  31. data/test/fixtures/fake_fulfillment.json +10 -0
  32. data/test/fixtures/fake_payment_expanded_details.json +38 -0
  33. data/test/fixtures/fake_payment_expanded_details_card.json +50 -0
  34. data/test/fixtures/fake_rto.json +15 -0
  35. data/test/fixtures/order_error.json +10 -0
  36. data/test/fixtures/payment_error.json +10 -0
  37. data/test/fixtures/reversals_collection.json +22 -0
  38. data/test/fixtures/transfer_error.json +10 -0
  39. data/test/razorpay/test_customer.rb +105 -0
  40. data/test/razorpay/test_dispute.rb +98 -0
  41. data/test/razorpay/test_document.rb +27 -0
  42. data/test/razorpay/test_order.rb +43 -1
  43. data/test/razorpay/test_payment.rb +23 -1
  44. data/test/razorpay/test_transfer.rb +17 -0
  45. data/test/razorpay/test_utility.rb +2 -2
  46. metadata +51 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0f1899756cb2c34271a9cd8167029bb2aa56d3a07094df776feab8de024aa69b
4
- data.tar.gz: daf3f8a28f3d5f211a1f83de9772d4f71fa3aa8b0b415bb0731846930584e11a
3
+ metadata.gz: 20c9fe5dd27329aceee373510059552808b2ed481fb59da923f2dca95d857156
4
+ data.tar.gz: d58229258c2df81882fea1bdb99a136e34f458f3170f0df4ab2b5f7123a827a5
5
5
  SHA512:
6
- metadata.gz: 9458dcd7356a9017800f5ec4cdae747f17e4595ab7b9f194cb8f14c617f41b8c077497b4438afbd559ecd2f6c0f580f4de5ca5935ed7d7aa6de05679e27be535
7
- data.tar.gz: 3377a46637db6e97d2c2435818de9d8b4782aac20d72adf4721e149c9fff2b7fbe41a83a0374090d2556cec2b996438160850d95ffa3b7f0d92a6f99d22aa024
6
+ metadata.gz: fd7ecba7866f08006fc27b7d5a4b5cb4d9ccf7f5fdf39ca833e60988b46b0fded9afdea31bc7679b256a150fac525eeb2ca77985043143073d52471490919f67
7
+ data.tar.gz: 1d5747bf39b762bdbfd010fd212d07a78ab94c5cd712a121f8b6592e5850aa1bd8a0913ad8d26bce50f390631b94376088af78163574578f3b2e62a1e15f983d
data/.cursorignore ADDED
@@ -0,0 +1,174 @@
1
+ # Distribution and Environment
2
+ dist/*
3
+ build/*
4
+ venv/*
5
+ env/*
6
+ *.env
7
+ .env.*
8
+ virtualenv/*
9
+ .python-version
10
+ .ruby-version
11
+ .node-version
12
+
13
+ # Logs and Temporary Files
14
+ *.log
15
+ *.tsv
16
+ *.csv
17
+ *.txt
18
+ tmp/*
19
+ temp/*
20
+ .tmp/*
21
+ *.temp
22
+ *.cache
23
+ .cache/*
24
+ logs/*
25
+
26
+ # Sensitive Data
27
+ *.sqlite
28
+ *.sqlite3
29
+ *.dbsql
30
+ secrets.*
31
+ .npmrc
32
+ .yarnrc
33
+ .aws/*
34
+ .config/*
35
+
36
+ # Credentials and Keys
37
+ *.pem
38
+ *.ppk
39
+ *.key
40
+ *.pub
41
+ *.p12
42
+ *.pfx
43
+ *.htpasswd
44
+ *.keystore
45
+ *.jks
46
+ *.truststore
47
+ *.cer
48
+ id_rsa*
49
+ known_hosts
50
+ authorized_keys
51
+ .ssh/*
52
+ .gnupg/*
53
+ .pgpass
54
+
55
+ # Config Files
56
+ *.conf
57
+ *.toml
58
+ *.ini
59
+ .env.local
60
+ .env.development
61
+ .env.test
62
+ .env.production
63
+ config/*
64
+
65
+ # Database Files
66
+ *.sql
67
+ *.db
68
+ *.dmp
69
+ *.dump
70
+ *.backup
71
+ *.restore
72
+ *.mdb
73
+ *.accdb
74
+ *.realm*
75
+
76
+ # Backup and Archive Files
77
+ *.bak
78
+ *.backup
79
+ *.swp
80
+ *.swo
81
+ *.swn
82
+ *~
83
+ *.old
84
+ *.orig
85
+ *.archive
86
+ *.gz
87
+ *.zip
88
+ *.tar
89
+ *.rar
90
+ *.7z
91
+
92
+ # Compiled and Binary Files
93
+ *.pyc
94
+ *.pyo
95
+ **/__pycache__/**
96
+ *.class
97
+ *.jar
98
+ *.war
99
+ *.ear
100
+ *.dll
101
+ *.exe
102
+ *.so
103
+ *.dylib
104
+ *.bin
105
+ *.obj
106
+
107
+ # IDE and Editor Files
108
+ .idea/*
109
+ *.iml
110
+ .vscode/*
111
+ .project
112
+ .classpath
113
+ .settings/*
114
+ *.sublime-*
115
+ .atom/*
116
+ .eclipse/*
117
+ *.code-workspace
118
+ .history/*
119
+
120
+ # Build and Dependency Directories
121
+ node_modules/*
122
+ bower_components/*
123
+ vendor/*
124
+ packages/*
125
+ jspm_packages/*
126
+ .gradle/*
127
+ target/*
128
+ out/*
129
+
130
+ # Testing and Coverage Files
131
+ coverage/*
132
+ .coverage
133
+ htmlcov/*
134
+ .pytest_cache/*
135
+ .tox/*
136
+ junit.xml
137
+ test-results/*
138
+
139
+ # Mobile Development
140
+ *.apk
141
+ *.aab
142
+ *.ipa
143
+ *.xcarchive
144
+ *.provisionprofile
145
+ google-services.json
146
+ GoogleService-Info.plist
147
+
148
+ # Certificate and Security Files
149
+ *.crt
150
+ *.csr
151
+ *.ovpn
152
+ *.p7b
153
+ *.p7s
154
+ *.pfx
155
+ *.spc
156
+ *.stl
157
+ *.pem.crt
158
+ ssl/*
159
+
160
+ # Container and Infrastructure
161
+ *.tfstate
162
+ *.tfstate.backup
163
+ .terraform/*
164
+ .vagrant/*
165
+ docker-compose.override.yml
166
+ kubernetes/*
167
+
168
+ # Design and Media Files (often large and binary)
169
+ *.psd
170
+ *.ai
171
+ *.sketch
172
+ *.fig
173
+ *.xd
174
+ assets/raw/*
@@ -3,6 +3,7 @@ on:
3
3
  push:
4
4
  branches:
5
5
  - master
6
+ - fix/upgrade-github-actions-v4
6
7
  tags:
7
8
  - v[0-9]+.[0-9]+.[0-9]+*
8
9
  pull_request:
@@ -14,7 +15,7 @@ jobs:
14
15
  runs-on: ubuntu-latest
15
16
 
16
17
  steps:
17
- - uses: actions/checkout@v3
18
+ - uses: actions/checkout@v4
18
19
  - name: Set up Ruby
19
20
  uses: ruby/setup-ruby@v1
20
21
  with:
@@ -24,7 +25,7 @@ jobs:
24
25
  - name: Build
25
26
  run: gem build *.gemspec
26
27
  - name: 'Upload Artifact'
27
- uses: actions/upload-artifact@v3
28
+ uses: actions/upload-artifact@v4
28
29
  with:
29
30
  name: gems
30
31
  path: '*.gem'
@@ -37,7 +38,7 @@ jobs:
37
38
 
38
39
  steps:
39
40
  - name: Checkout
40
- uses: actions/checkout@v2
41
+ uses: actions/checkout@v4
41
42
  - name: Set up Ruby latest
42
43
  uses: ruby/setup-ruby@v1
43
44
  with:
@@ -48,19 +49,19 @@ jobs:
48
49
  run: bundle exec rake
49
50
  - name: Upload coverage to Codecov
50
51
  if: ${{ matrix.ruby-version == 3.1 }}
51
- uses: codecov/codecov-action@v3
52
+ uses: codecov/codecov-action@v4
52
53
  with:
53
54
  files: ${{ github.workspace }}/coverage/coverage.xml
54
55
  publish:
55
56
  name: Publish
56
- if: startsWith(github.ref, 'refs/tags/v')
57
+ # if: startsWith(github.ref, 'refs/tags/v')
57
58
  needs: [build, test]
58
59
  runs-on: ubuntu-latest
59
60
  steps:
60
- - uses: actions/checkout@v2
61
+ - uses: actions/checkout@v4
61
62
  - run: sudo apt-get install -y oathtool
62
63
  - name: Download all workflow run artifacts
63
- uses: actions/download-artifact@v3
64
+ uses: actions/download-artifact@v4
64
65
  with:
65
66
  name: gems
66
67
  path: gems
data/CHANGELOG.md CHANGED
@@ -4,6 +4,22 @@ Changelog for Razorpay-Ruby SDK.
4
4
 
5
5
  ## Unreleased
6
6
 
7
+ ## [3.2.4] - 2026-06-08
8
+
9
+ fix: Security fix for AES-GCM onboarding signature
10
+ * Fixed nonce reuse vulnerability in `generate_onboarding_signature` by using a random nonce per call instead of a static IV derived from the secret key
11
+ * New output format: `hex(iv[12] || ciphertext || tag[16])` — the receiver reads the first 24 hex chars as the IV before decrypting
12
+
13
+ ## [3.2.3] - 2024-05-27
14
+
15
+ feat: Added new API endpoints
16
+ * Added support for `add_bank_account`, `delete_bank_account`, `request_eligibility_check` & `fetch_eligibility` on customer
17
+ * Added support for `expand_details` on payment
18
+ * Added support for fetch Reversals for a Transfer
19
+ * Added support for Dispute
20
+ * Added support for Document
21
+ * Added support for `view_rto` & `edit_fulfillment` on order
22
+
7
23
  ## [3.2.2] - 2024-04-16
8
24
 
9
25
  feat: Added oauth APIs and support for access token based authentication mechanism
data/README.md CHANGED
@@ -85,6 +85,8 @@ If you are using rails, the right place to do this might be `config/initializers
85
85
  - [Payment Verification](documents/paymentVerification.md)
86
86
  - [Webhook](documents/webhook.md)
87
87
  - [OAuthToken](documents/oauth_token.md)
88
+ - [Dispute](documents/dispute.md)
89
+ - [Document](documents/documents.md)
88
90
 
89
91
  ## Development
90
92
 
@@ -157,6 +157,248 @@ Razorpay::Customer.fetch(customerId)
157
157
 
158
158
  -------------------------------------------------------------------------------------------------------
159
159
 
160
+ ### Add Bank Account of Customer
161
+
162
+ ```rb
163
+ customerId = "cust_N5mywh91sXB69O"
164
+
165
+ Razorpay::Customer.add_bank_account(customerId,{
166
+ "ifsc_code": "UTIB0000194",
167
+ "account_number": "916010082985661",
168
+ "beneficiary_name": "Pratheek",
169
+ "beneficiary_address1": "address 1",
170
+ "beneficiary_address2": "address 2",
171
+ "beneficiary_address3": "address 3",
172
+ "beneficiary_address4": "address 4",
173
+ "beneficiary_email": "random@email.com",
174
+ "beneficiary_mobile": "8762489310",
175
+ "beneficiary_city": "Bangalore",
176
+ "beneficiary_state": "KA",
177
+ "beneficiary_country": "IN"
178
+ })
179
+ ```
180
+
181
+ **Parameters:**
182
+
183
+ | Name | Type | Description |
184
+ |----------------------|----------|----------------------------------------------------------------------------|
185
+ | customerId* | string | Unique identifier of the customer. |
186
+ | account_number | string | Customer's bank account number. For example, `0002020000304030434`. |
187
+ | beneficiary_name | string | The name of the beneficiary associated with the bank account. |
188
+ | beneficiary_address1 | string | The virtual payment address. |
189
+ | beneficiary_email | string | Email address of the beneficiary. For example, `gaurav.kumar@example.com`. |
190
+ | beneficiary_mobile | integer | Mobile number of the beneficiary. |
191
+ | beneficiary_city | string | The name of the city of the beneficiary. |
192
+ | beneficiary_state | string | The state of the beneficiary. |
193
+ | beneficiary_country | string | The country of the beneficiary. |
194
+ | beneficiary_pin | interger | The pin code of the beneficiary's address. |
195
+ | ifsc_code | string | The IFSC code of the bank branch associated with the account. |
196
+
197
+ **Response:**
198
+ ```json
199
+ {
200
+ "id": "ba_LSZht1Cm7xFTwF",
201
+ "entity": "bank_account",
202
+ "ifsc": "ICIC0001207",
203
+ "bank_name": "ICICI Bank",
204
+ "name": "Gaurav Kumar",
205
+ "notes": [],
206
+ "account_number": "XXXXXXXXXXXXXXX0434"
207
+ }
208
+ ```
209
+
210
+ -------------------------------------------------------------------------------------------------------
211
+
212
+ ### Delete Bank Account of Customer
213
+
214
+ ```rb
215
+ customerId = "cust_N5mywh91sXB69O"
216
+
217
+ bankAccountId = "ba_N6aM8uo64IzxHu"
218
+
219
+ Razorpay::Customer.delete_bank_account(customerId, bankAccountId)
220
+ ```
221
+
222
+ **Parameters:**
223
+
224
+ | Name | Type | Description |
225
+ |---------------|-----------|-------------------------------------------------------------------|
226
+ | customerId* | string | Customer id of the customer whose bank account is to be deleted. |
227
+ | bankAccountId | string | The bank_id that needs to be deleted. |
228
+
229
+ **Response:**
230
+ ```json
231
+ {
232
+ "id": "ba_Evg09Ll05SIPSD",
233
+ "ifsc": "ICIC0001207",
234
+ "bank_name": "ICICI Bank",
235
+ "name": "Test R4zorpay",
236
+ "account_number": "XXXXXXXXXXXXXXX0434",
237
+ "status": "deleted"
238
+ }
239
+ ```
240
+
241
+ -------------------------------------------------------------------------------------------------------
242
+
243
+ ### Eligibility Check API
244
+
245
+ ```rb
246
+ Razorpay::Customer.request_eligibility_check({
247
+ "inquiry": "affordability",
248
+ "amount": 500,
249
+ "currency": "INR",
250
+ "customer": {
251
+ "id": "elig_xxxxxxxxxxxxx",
252
+ "contact": "+919999999999",
253
+ "ip": "105.106.107.108",
254
+ "referrer": "https://merchansite.com/example/paybill",
255
+ "user_agent": "Mozilla/5.0"
256
+ }
257
+ })
258
+ ```
259
+
260
+ **Parameters:**
261
+
262
+ | Name | Type | Description |
263
+ |-------------|---------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
264
+ | inquiry | string | List of methods or instruments on which eligibility check is required. Possible value is `affordability`. |
265
+ | amount* | integer | The amount for which the order was created, in currency subunits. For example, for an amount of ₹295, enter `29500`. The user makes a payment for this amount against the order; hence, eligibility is checked for the amount. |
266
+ | currency* | string | A three-letter ISO code for the currency in which you want to accept the payment. Possible value is `INR`. |
267
+ | customer* | object | Customer details. [here](https://razorpay.com/docs/payments/payment-gateway/affordability/eligibility-check/#eligibility-check-api) |
268
+ | instruments | object | Payment instruments on which an eligibility check is required. [here](https://razorpay.com/docs/payments/payment-gateway/affordability/eligibility-check/#eligibility-check-api) |
269
+
270
+
271
+ **Response:**
272
+ ```json
273
+ {
274
+ "amount": "500000",
275
+ "customer": {
276
+ "id": "KkBhM9EC1Y0HTm",
277
+ "contact": "+919999999999"
278
+ },
279
+ "instruments": [
280
+ {
281
+ "method": "emi",
282
+ "issuer": "HDFC",
283
+ "type": "debit",
284
+ "eligibility_req_id": "elig_xxxxxxxxxxxxx",
285
+ "eligibility": {
286
+ "status": "eligible"
287
+ }
288
+ },
289
+ {
290
+ "method": "paylater",
291
+ "provider": "getsimpl",
292
+ "eligibility_req_id": "elig_xxxxxxxxxxxxx",
293
+ "eligibility": {
294
+ "status": "eligible"
295
+ }
296
+ },
297
+ {
298
+ "method": "paylater",
299
+ "provider": "icic",
300
+ "eligibility_req_id": "elig_xxxxxxxxxxxxx",
301
+ "eligibility": {
302
+ "status": "eligible"
303
+ }
304
+ },
305
+ {
306
+ "method": "cardless_emi",
307
+ "provider": "walnut369",
308
+ "eligibility_req_id": "elig_xxxxxxxxxxxxx",
309
+ "eligibility": {
310
+ "status": "ineligible",
311
+ "error": {
312
+ "code": "GATEWAY_ERROR",
313
+ "description": "The customer has not been approved by the partner.",
314
+ "source": "business",
315
+ "step": "inquiry",
316
+ "reason": "user_not_approved"
317
+ }
318
+ }
319
+ },
320
+ {
321
+ "method": "cardless_emi",
322
+ "provider": "zestmoney",
323
+ "eligibility_req_id": "elig_xxxxxxxxxxxxx",
324
+ "eligibility": {
325
+ "status": "ineligible",
326
+ "error": {
327
+ "code": "GATEWAY_ERROR",
328
+ "description": "The customer has exhausted their credit limit.",
329
+ "source": "business",
330
+ "step": "inquiry",
331
+ "reason": "credit_limit_exhausted"
332
+ }
333
+ }
334
+ },
335
+ {
336
+ "method": "paylater",
337
+ "provider": "lazypay",
338
+ "eligibility_req_id": "elig_xxxxxxxxxxxxx",
339
+ "eligibility": {
340
+ "status": "ineligible",
341
+ "error": {
342
+ "code": "GATEWAY_ERROR",
343
+ "description": "The order amount is less than the minimum transaction amount.",
344
+ "source": "business",
345
+ "step": "inquiry",
346
+ "reason": "min_amt_required"
347
+ }
348
+ }
349
+ }
350
+ ]
351
+ }
352
+ ```
353
+
354
+ -------------------------------------------------------------------------------------------------------
355
+
356
+ ### Fetch Eligibility by id
357
+
358
+ ```rb
359
+ eligibilityId = "elig_F1cxDoHWD4fkQt"
360
+ Razorpay::Customer.fetch_eligibility(eligibilityId)
361
+ ```
362
+
363
+ **Parameters:**
364
+
365
+ | Name | Type | Description |
366
+ |---------------|-------------|--------------------------------------------------------------------|
367
+ | eligibilityId | string | The unique identifier of the eligibility request to be retrieved. |
368
+
369
+ **Response:**
370
+ ```json
371
+ {
372
+ "instruments": [
373
+ {
374
+ "method": "paylater",
375
+ "provider": "lazypay",
376
+ "eligibility_req_id": "elig_xxxxxxxxxxxxx",
377
+ "eligibility": {
378
+ "status": "eligible"
379
+ }
380
+ },
381
+ {
382
+ "method": "paylater",
383
+ "provider": "getsimpl",
384
+ "eligibility_req_id": "elig_xxxxxxxxxxxxx",
385
+ "eligibility": {
386
+ "status": "ineligible",
387
+ "error": {
388
+ "code": "GATEWAY_ERROR",
389
+ "description": "The customer has exhausted their credit limit",
390
+ "source": "gateway",
391
+ "step": "inquiry",
392
+ "reason": "credit_limit_exhausted"
393
+ }
394
+ }
395
+ }
396
+ ]
397
+ }
398
+ ```
399
+
400
+ -------------------------------------------------------------------------------------------------------
401
+
160
402
  **PN: * indicates mandatory fields**
161
403
  <br>
162
404
  <br>