razorpay 2.4.0 → 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 (185) hide show
  1. checksums.yaml +4 -4
  2. data/.cursorignore +174 -0
  3. data/.github/dependabot.yml +8 -0
  4. data/.github/pull_request_template.md +8 -0
  5. data/.github/workflows/ci.yml +80 -0
  6. data/.github/workflows/ruby.yml +38 -0
  7. data/CHANGELOG.md +85 -1
  8. data/README.md +48 -137
  9. data/documents/Invoice.md +539 -0
  10. data/documents/account.md +449 -0
  11. data/documents/addon.md +191 -0
  12. data/documents/card.md +655 -0
  13. data/documents/customer.md +405 -0
  14. data/documents/dispute.md +301 -0
  15. data/documents/documents.md +65 -0
  16. data/documents/emandate.md +492 -0
  17. data/documents/fund.md +89 -0
  18. data/documents/items.md +208 -0
  19. data/documents/oauth_token.md +142 -0
  20. data/documents/order.md +352 -0
  21. data/documents/papernach.md +738 -0
  22. data/documents/payment.md +1122 -0
  23. data/documents/paymentLink.md +1063 -0
  24. data/documents/paymentVerification.md +79 -0
  25. data/documents/plan.md +184 -0
  26. data/documents/productConfiguration.md +444 -0
  27. data/documents/qrcode.md +439 -0
  28. data/documents/refund.md +325 -0
  29. data/documents/registerEmandate.md +452 -0
  30. data/documents/registerNach.md +653 -0
  31. data/documents/settlement.md +478 -0
  32. data/documents/stakeholder.md +334 -0
  33. data/documents/subscriptions.md +752 -0
  34. data/documents/tokens.md +407 -0
  35. data/documents/transfers.md +821 -0
  36. data/documents/upi.md +545 -0
  37. data/documents/virtualAccount.md +591 -0
  38. data/documents/webhook.md +224 -0
  39. data/lib/razorpay/account.rb +39 -0
  40. data/lib/razorpay/addon.rb +9 -1
  41. data/lib/razorpay/card.rb +4 -0
  42. data/lib/razorpay/constants.rb +7 -2
  43. data/lib/razorpay/customer.rb +31 -0
  44. data/lib/razorpay/dispute.rb +26 -0
  45. data/lib/razorpay/document.rb +19 -0
  46. data/lib/razorpay/fund_account.rb +19 -0
  47. data/lib/razorpay/iin.rb +15 -0
  48. data/lib/razorpay/invoice.rb +8 -0
  49. data/lib/razorpay/item.rb +34 -0
  50. data/lib/razorpay/oauth_token.rb +109 -0
  51. data/lib/razorpay/order.rb +19 -1
  52. data/lib/razorpay/payload_validator.rb +93 -0
  53. data/lib/razorpay/payment.rb +64 -0
  54. data/lib/razorpay/payment_link.rb +36 -0
  55. data/lib/razorpay/payment_method.rb +17 -0
  56. data/lib/razorpay/product.rb +37 -0
  57. data/lib/razorpay/qr_code.rb +34 -0
  58. data/lib/razorpay/refund.rb +4 -0
  59. data/lib/razorpay/request.rb +50 -26
  60. data/lib/razorpay/settlement.rb +39 -0
  61. data/lib/razorpay/stakeholder.rb +39 -0
  62. data/lib/razorpay/subscription.rb +24 -0
  63. data/lib/razorpay/subscription_registration.rb +16 -0
  64. data/lib/razorpay/token.rb +28 -0
  65. data/lib/razorpay/transfer.rb +39 -0
  66. data/lib/razorpay/utility.rb +41 -6
  67. data/lib/razorpay/validation_config.rb +11 -0
  68. data/lib/razorpay/virtual_account.rb +15 -7
  69. data/lib/razorpay/webhook.rb +50 -0
  70. data/lib/razorpay.rb +24 -1
  71. data/razorpay-ruby.gemspec +2 -1
  72. data/test/fixtures/addon_collection.json +60 -0
  73. data/test/fixtures/create_json_payment.json +13 -0
  74. data/test/fixtures/delete_token.json +3 -0
  75. data/test/fixtures/dispute_collection.json +67 -0
  76. data/test/fixtures/dispute_error.json +10 -0
  77. data/test/fixtures/document_error.json +10 -0
  78. data/test/fixtures/downtimes_collection.json +21 -0
  79. data/test/fixtures/empty.json +2 -0
  80. data/test/fixtures/error_customer.json +10 -0
  81. data/test/fixtures/error_eligibility.json +10 -0
  82. data/test/fixtures/error_eligibility_check.json +10 -0
  83. data/test/fixtures/fake_account.json +78 -0
  84. data/test/fixtures/fake_addon.json +3 -3
  85. data/test/fixtures/fake_bank_account.json +9 -0
  86. data/test/fixtures/fake_card_reference.json +5 -0
  87. data/test/fixtures/fake_create_upi_payment.json +3 -0
  88. data/test/fixtures/fake_direct_transfer.json +32 -0
  89. data/test/fixtures/fake_dispute.json +29 -0
  90. data/test/fixtures/fake_document.json +9 -0
  91. data/test/fixtures/fake_downtime.json +14 -0
  92. data/test/fixtures/fake_eligiblity.json +79 -0
  93. data/test/fixtures/fake_fulfillment.json +10 -0
  94. data/test/fixtures/fake_fund_account.json +18 -0
  95. data/test/fixtures/fake_iin_token.json +23 -0
  96. data/test/fixtures/fake_instant_settlement.json +19 -0
  97. data/test/fixtures/fake_item.json +9 -0
  98. data/test/fixtures/fake_oauth_token.json +8 -0
  99. data/test/fixtures/fake_order_transfers.json +88 -0
  100. data/test/fixtures/fake_otp_generate.json +19 -0
  101. data/test/fixtures/fake_otp_resend.json +7 -0
  102. data/test/fixtures/fake_otp_submit.json +5 -0
  103. data/test/fixtures/fake_payment_expanded_details.json +38 -0
  104. data/test/fixtures/fake_payment_expanded_details_card.json +50 -0
  105. data/test/fixtures/fake_payment_link.json +40 -0
  106. data/test/fixtures/fake_pending_update.json +30 -0
  107. data/test/fixtures/fake_product.json +138 -0
  108. data/test/fixtures/fake_qrcode.json +20 -0
  109. data/test/fixtures/fake_qrcode_close.json +22 -0
  110. data/test/fixtures/fake_recurring.json +5 -0
  111. data/test/fixtures/fake_refund.json +1 -1
  112. data/test/fixtures/fake_revoke_token.json +3 -0
  113. data/test/fixtures/fake_rto.json +15 -0
  114. data/test/fixtures/fake_settlement.json +11 -0
  115. data/test/fixtures/fake_settlement_on_demand.json +39 -0
  116. data/test/fixtures/fake_stakeholder.json +29 -0
  117. data/test/fixtures/fake_subscription_pause.json +19 -0
  118. data/test/fixtures/fake_subscription_registration.json +91 -0
  119. data/test/fixtures/fake_subscription_resume.json +19 -0
  120. data/test/fixtures/fake_token.json +31 -0
  121. data/test/fixtures/fake_tokenise_customer.json +40 -0
  122. data/test/fixtures/fake_transfer.json +18 -0
  123. data/test/fixtures/fake_transfer_reverse.json +15 -0
  124. data/test/fixtures/fake_update_payment.json +39 -0
  125. data/test/fixtures/fake_validate_vpa.json +5 -0
  126. data/test/fixtures/fake_virtual_account_allowed.json +46 -0
  127. data/test/fixtures/fake_virtual_account_receiver.json +46 -0
  128. data/test/fixtures/fake_webhook.json +79 -0
  129. data/test/fixtures/fake_webhook_by_account_id.json +22 -0
  130. data/test/fixtures/fetch_tnc.json +11 -0
  131. data/test/fixtures/fund_collection.json +20 -0
  132. data/test/fixtures/item_collection.json +24 -0
  133. data/test/fixtures/order_error.json +10 -0
  134. data/test/fixtures/payment_collection.json +1 -1
  135. data/test/fixtures/payment_error.json +10 -0
  136. data/test/fixtures/payment_link_collection.json +43 -0
  137. data/test/fixtures/payment_link_response.json +3 -0
  138. data/test/fixtures/payment_methods_collection.json +149 -0
  139. data/test/fixtures/qrcode_collection.json +50 -0
  140. data/test/fixtures/qrcode_payments_collection.json +74 -0
  141. data/test/fixtures/reversals_collection.json +22 -0
  142. data/test/fixtures/settlement_collection.json +26 -0
  143. data/test/fixtures/settlement_instant_collection.json +84 -0
  144. data/test/fixtures/settlement_report_collection.json +117 -0
  145. data/test/fixtures/stakeholder_collection.json +35 -0
  146. data/test/fixtures/success.json +3 -0
  147. data/test/fixtures/tokens_collection.json +36 -0
  148. data/test/fixtures/transfer_error.json +10 -0
  149. data/test/fixtures/transfer_settlements_collection.json +38 -0
  150. data/test/fixtures/transfers_collection.json +41 -0
  151. data/test/fixtures/webhook_by_account_collection.json +35 -0
  152. data/test/fixtures/webhook_collection.json +85 -0
  153. data/test/razorpay/test_account.rb +134 -0
  154. data/test/razorpay/test_addon.rb +19 -15
  155. data/test/razorpay/test_card.rb +6 -0
  156. data/test/razorpay/test_customer.rb +132 -3
  157. data/test/razorpay/test_dispute.rb +98 -0
  158. data/test/razorpay/test_document.rb +27 -0
  159. data/test/razorpay/test_fund_account.rb +42 -0
  160. data/test/razorpay/test_iin.rb +23 -0
  161. data/test/razorpay/test_invoice.rb +15 -2
  162. data/test/razorpay/test_item.rb +66 -0
  163. data/test/razorpay/test_oauth_token.rb +105 -0
  164. data/test/razorpay/test_order.rb +66 -1
  165. data/test/razorpay/test_payload_validator.rb +61 -0
  166. data/test/razorpay/test_payment.rb +251 -9
  167. data/test/razorpay/test_payment_link.rb +83 -0
  168. data/test/razorpay/test_plan.rb +2 -2
  169. data/test/razorpay/test_product.rb +67 -0
  170. data/test/razorpay/test_qr_code.rb +63 -0
  171. data/test/razorpay/test_razorpay.rb +19 -2
  172. data/test/razorpay/test_refund.rb +16 -2
  173. data/test/razorpay/test_settlement.rb +76 -0
  174. data/test/razorpay/test_stakeholder.rb +87 -0
  175. data/test/razorpay/test_subscription.rb +72 -9
  176. data/test/razorpay/test_subscription_registration.rb +58 -0
  177. data/test/razorpay/test_token.rb +66 -0
  178. data/test/razorpay/test_transfer.rb +94 -0
  179. data/test/razorpay/test_utility.rb +72 -4
  180. data/test/razorpay/test_virtual_account.rb +64 -17
  181. data/test/razorpay/test_webhook.rb +132 -0
  182. data/test/test_helper.rb +8 -0
  183. metadata +265 -10
  184. data/.travis.yml +0 -22
  185. data/test/razorpay/test_errors.rb +0 -19
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 39cc293b9e35da57fbe365e94ee9d46d9c21d7843d8e08f40382d9683d5dac8a
4
- data.tar.gz: '086f7b483c58b0841a5b4a7cc677f4d4cc083536b0999f5abff1986287be0fe3'
3
+ metadata.gz: 20c9fe5dd27329aceee373510059552808b2ed481fb59da923f2dca95d857156
4
+ data.tar.gz: d58229258c2df81882fea1bdb99a136e34f458f3170f0df4ab2b5f7123a827a5
5
5
  SHA512:
6
- metadata.gz: af4c5ba0f617c776ac5b4ad191062e9530eb1c70443bc1e030873f90edb8b6072a90e66d50e7b55da8d1cbf30f6f590cb94f51c67b6cb9383584cd1f44182aaa
7
- data.tar.gz: 1ddbe5914250c4dd745da91780ad0ac9e35f13fee040490a4b49cd43f5a72a5882aeaec3af6b311220c3537af41b36e5348428dc746f0f8fe3a1f24cbcc45fe2
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/*
@@ -0,0 +1,8 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: bundler
4
+ directory: "/"
5
+ schedule:
6
+ interval: daily
7
+ time: "04:00"
8
+ timezone: Asia/Calcutta
@@ -0,0 +1,8 @@
1
+ ## Note :- Please follow the below points while attaching test cases document link below:
2
+ ### - If label `Tested` is added then test cases document URL is mandatory.
3
+ ### - Link added should be a valid URL and accessible throughout the org.
4
+ ### - If the branch name contains hotfix / revert by default the BVT workflow check will pass.
5
+
6
+ | Test Case Document URL |
7
+ |-----------------------------------------------|
8
+ | Please paste test case document link here.... |
@@ -0,0 +1,80 @@
1
+ name: CI
2
+ on:
3
+ push:
4
+ branches:
5
+ - master
6
+ - fix/upgrade-github-actions-v4
7
+ tags:
8
+ - v[0-9]+.[0-9]+.[0-9]+*
9
+ pull_request:
10
+ branches:
11
+ - master
12
+ jobs:
13
+ build:
14
+ name: Build
15
+ runs-on: ubuntu-latest
16
+
17
+ steps:
18
+ - uses: actions/checkout@v4
19
+ - name: Set up Ruby
20
+ uses: ruby/setup-ruby@v1
21
+ with:
22
+ ruby-version: 3.1
23
+ - name: Install dependencies
24
+ run: bundle install
25
+ - name: Build
26
+ run: gem build *.gemspec
27
+ - name: 'Upload Artifact'
28
+ uses: actions/upload-artifact@v4
29
+ with:
30
+ name: gems
31
+ path: '*.gem'
32
+ test:
33
+ runs-on: ubuntu-latest
34
+ needs: build
35
+ strategy:
36
+ matrix:
37
+ ruby-version: ['2.6', '2.7', '3.0', '3.1']
38
+
39
+ steps:
40
+ - name: Checkout
41
+ uses: actions/checkout@v4
42
+ - name: Set up Ruby latest
43
+ uses: ruby/setup-ruby@v1
44
+ with:
45
+ ruby-version: 3.1
46
+ - name: Install dependencies
47
+ run: bundle install
48
+ - name: Run tests and collect coverage
49
+ run: bundle exec rake
50
+ - name: Upload coverage to Codecov
51
+ if: ${{ matrix.ruby-version == 3.1 }}
52
+ uses: codecov/codecov-action@v4
53
+ with:
54
+ files: ${{ github.workspace }}/coverage/coverage.xml
55
+ publish:
56
+ name: Publish
57
+ # if: startsWith(github.ref, 'refs/tags/v')
58
+ needs: [build, test]
59
+ runs-on: ubuntu-latest
60
+ steps:
61
+ - uses: actions/checkout@v4
62
+ - run: sudo apt-get install -y oathtool
63
+ - name: Download all workflow run artifacts
64
+ uses: actions/download-artifact@v4
65
+ with:
66
+ name: gems
67
+ path: gems
68
+ - name: Set up Ruby
69
+ uses: ruby/setup-ruby@v1
70
+ with:
71
+ ruby-version: 3.1
72
+ - name: Publish gems to Rubygems
73
+ run: |
74
+ mkdir -p $HOME/.gem
75
+ touch $HOME/.gem/credentials
76
+ chmod 0600 $HOME/.gem/credentials
77
+ printf -- "---\n:rubygems_api_key: ${GEM_API_KEY}\n" > $HOME/.gem/credentials
78
+ gem push gems/*.gem
79
+ env:
80
+ GEM_API_KEY: ${{secrets.GEM_API_KEY}}
@@ -0,0 +1,38 @@
1
+ # This workflow uses actions that are not certified by GitHub.
2
+ # They are provided by a third-party and are governed by
3
+ # separate terms of service, privacy policy, and support
4
+ # documentation.
5
+ # This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
6
+ # For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
7
+
8
+ name: Ruby
9
+
10
+ on:
11
+ push:
12
+ branches: [ master ]
13
+ pull_request:
14
+ branches: [ master ]
15
+
16
+ permissions:
17
+ contents: read
18
+
19
+ jobs:
20
+ test:
21
+
22
+ runs-on: ubuntu-latest
23
+ strategy:
24
+ matrix:
25
+ ruby-version: ['3.0']
26
+
27
+ steps:
28
+ - uses: actions/checkout@v3
29
+ - name: Set up Ruby
30
+ # To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
31
+ # change this to (see https://github.com/ruby/setup-ruby#versioning):
32
+ # uses: ruby/setup-ruby@v1
33
+ uses: ruby/setup-ruby@473e4d8fe5dd94ee328fdfca9f8c9c7afc9dae5e
34
+ with:
35
+ ruby-version: ${{ matrix.ruby-version }}
36
+ bundler-cache: true # runs 'bundle install' and caches installed gems automatically
37
+ - name: Run tests
38
+ run: bundle exec rake
data/CHANGELOG.md CHANGED
@@ -4,6 +4,87 @@ 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
+
23
+ ## [3.2.2] - 2024-04-16
24
+
25
+ feat: Added oauth APIs and support for access token based authentication mechanism
26
+ * Added oauth APIs (getAuthURL, getAccessToken, refreshToken, revokeToken)
27
+ * Added support for access token based authentication mechanism
28
+ * Added support for onboarding signature generation
29
+
30
+ ## [3.2.1] - 2023-12-19
31
+
32
+ Rollback: Generic access point due to some performance concern
33
+
34
+ ## [3.2.0] - 2023-12-11
35
+
36
+ feat: Added generic access point
37
+
38
+ ## [3.1.0] - 2023-10-13
39
+
40
+ ### Added
41
+
42
+ feat: Added new API endpoints
43
+
44
+ Added account onboarding API create, fetch, edit, delete
45
+ Added stakeholders API create, fetch, all, edit
46
+ Added product configuration API request_product_configuration, fetch, edit, fetch_tnc
47
+ Added webhooks API create, fetch, all, edit, delete
48
+ Added Documents API upload_account_doc, fetch_account_doc, upload_stakeholder_doc, fetch_stakeholder_doc
49
+ Added token sharing API create, fetch, delete, process_payment_on_alternate_pa_or_pg
50
+
51
+ ## [3.0.1] - 2022-07-11
52
+
53
+ ### Added
54
+
55
+ - Added Third party validation API for Payments (create_upi, validate_vpa)
56
+ - New API for Payment Methods
57
+ - Doc Updated
58
+
59
+ ## [3.0.0] - 2022-06-03
60
+
61
+ ### Added
62
+
63
+ - QR code end point API
64
+ - Settlement end point API
65
+ - Fund Account end point API
66
+ - PaymentLinks end point API
67
+ - Item end point API
68
+ - New APIs for Invoices (Delete, Send/resend)
69
+ - New API for Customers (Fetch Tokens, Delete Token)
70
+ - New APIs for Subscriptions (Update, Pause, Resume, Pending update, Delete offer)
71
+ - New API for Addons (Fetch all Addons)
72
+ - New API for Refund (Update refund)
73
+ - New APIs for Payments (Update, Create recurring, Create Json, Payment downtime details, refunds of a payment, Otp generate, Otp submit, Otp resend)
74
+ - New APIs for Virtual Account (Add receiver, add an allowed payer account, delete an allowed payer account)
75
+ - Updated Testcases
76
+ - Updated Readme
77
+
78
+ ## [2.4.1] - 2019-04-09
79
+
80
+ ### Fixed
81
+
82
+ - Subscription signature verification [[#81][81]]
83
+
84
+ ### Added
85
+
86
+ - Ruby version to user agent header [[#79][79]]
87
+
7
88
  ## [2.4.0] - 2019-04-08
8
89
 
9
90
  ### Changed
@@ -109,7 +190,8 @@ Changelog for Razorpay-Ruby SDK.
109
190
 
110
191
  # Diff
111
192
 
112
- - [Unreleased](https://github.com/razorpay/razorpay-ruby/compare/2.4.0...HEAD)
193
+ - [Unreleased](https://github.com/razorpay/razorpay-ruby/compare/2.4.1...HEAD)
194
+ - [2.4.1](https://github.com/razorpay/razorpay-ruby/compare/2.4.0...2.4.1)
113
195
  - [2.4.0](https://github.com/razorpay/razorpay-ruby/compare/2.3.0...2.4.0)
114
196
  - [2.3.0](https://github.com/razorpay/razorpay-ruby/compare/2.2.0...2.3.0)
115
197
  - [2.2.0](https://github.com/razorpay/razorpay-ruby/compare/2.1.0...2.2.0)
@@ -126,3 +208,5 @@ Changelog for Razorpay-Ruby SDK.
126
208
  [68]: https://github.com/razorpay/razorpay-ruby/pull/68
127
209
  [72]: https://github.com/razorpay/razorpay-ruby/pull/72
128
210
  [75]: https://github.com/razorpay/razorpay-ruby/pull/75
211
+ [79]: https://github.com/razorpay/razorpay-ruby/pull/79
212
+ [81]: https://github.com/razorpay/razorpay-ruby/pull/81
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Razorpay Ruby bindings
2
2
 
3
- [![Build Status](https://travis-ci.org/razorpay/razorpay-ruby.svg?branch=master)](https://travis-ci.org/razorpay/razorpay-ruby) [![Gem Version](https://badge.fury.io/rb/razorpay.svg)](http://badge.fury.io/rb/razorpay) [![Coverage Status](https://coveralls.io/repos/github/Razorpay/razorpay-ruby/badge.svg?branch=master)](https://coveralls.io/github/Razorpay/razorpay-ruby?branch=master) [![License](http://img.shields.io/:license-mit-blue.svg)](http://doge.mit-license.org)
3
+ [![Build Status](https://travis-ci.org/razorpay/razorpay-ruby.svg?branch=master)](https://travis-ci.org/razorpay/razorpay-ruby) [![Gem Version](https://img.shields.io/badge/gem%20version-v3.0.1-dark%20green.svg)](http://badge.fury.io/rb/razorpay) [![Coverage Status](https://coveralls.io/repos/github/Razorpay/razorpay-ruby/badge.svg?branch=master)](https://coveralls.io/github/Razorpay/razorpay-ruby?branch=master) [![License](http://img.shields.io/:license-mit-blue.svg)](http://doge.mit-license.org)
4
4
 
5
5
  This is the base ruby gem for interacting with the Razorpay API. This is primarily meant for users who wish to perform interactions with the Razorpay API programatically.
6
6
 
@@ -20,11 +20,18 @@ Or install it yourself as:
20
20
 
21
21
  $ gem install razorpay
22
22
 
23
+ ## Requirements
24
+
25
+ Ruby 2.6.8 or later
23
26
  ## Usage
24
27
 
25
- Remember to `require razorpay` before anything else.
28
+ Remember to `require 'razorpay'` before anything else.
29
+
30
+ Next, you need to setup your auth details. This setup can be done via two ways:
26
31
 
27
- Next, you need to setup your key and secret using the following:
32
+ ### Using Private Auth
33
+
34
+ you need to setup your key and secret using the following:
28
35
 
29
36
  ```rb
30
37
  Razorpay.setup('key_id', 'key_secret')
@@ -35,134 +42,51 @@ You can set customer headers for your requests using the following:
35
42
  Razorpay.headers = {"CUSTOM_APP_HEADER" => "CUSTOM_VALUE"}
36
43
  ```
37
44
 
38
- You can find your API keys at <https://dashboard.razorpay.com/#/app/keys>.
39
-
40
- If you are using rails, the right place to do this might be `config/initializers/razorpay.rb`.
41
-
42
- The most common construct is capturing a payment, which you do via the following:
43
-
44
- ```rb
45
- Razorpay::Payment.fetch("payment_id").capture({amount:500})
46
- # Note that the amount should come from your session, so as to verify
47
- # that the purchase was correctly done and not tampered
48
- ```
49
-
50
- You can refund a payment via the following:
51
-
52
- ```rb
53
- Razorpay::Payment.fetch("payment_id").refund({amount:500})
54
- refunds = Razorpay::Payment.fetch("payment_id").refunds
55
- ```
56
-
57
- A payment can also be refunded without fetching it:
45
+ ### Using Access Token
46
+ you need to setup your access token using the following
58
47
  ```rb
59
- refund = Razorpay::Refund.create(payment_id:"payment_id")
60
- Razorpay::Refund.fetch(refund.id)
48
+ Razorpay.setup_with_oauth('access_token')
61
49
  ```
62
-
63
- If payment is captured or refunded via `capture!` or `refund!`, then the calling object is also updated:
64
- ```rb
65
- payment = Razorpay::Payment.fetch('payment_id')
66
- payment.status
67
- # 'authorized'
68
- payment.capture!
69
- payment.status
70
- # 'captured'
71
- payment.refund!
72
- payment.status
73
- # 'refunded'
74
- ```
75
-
76
- For other applications (such as fetching payments and refunds),
77
- see our online documentation on <https://docs.razorpay.com>
78
-
79
- ### Orders API
80
-
81
- You can use the orders API using the following constructs:
82
-
83
- You can find docs at <https://docs.razorpay.com/v1/page/orders>
84
-
85
- ```rb
86
- order = Razorpay::Order.create amount: 5000, currency: 'INR', receipt: 'TEST'
87
- # order.id = order_50sX9hGHZJvjjI
88
-
89
- # Same collection as Refunds or Payments
90
- orders = Razorpay::Order.all
91
-
92
- # Fetching an Order
93
- order = Razorpay::Order.fetch('order_50sX9hGHZJvjjI')
94
- puts order.amount
95
-
96
- # Fetching payments corresponding to an order
97
- payments = order.payments
98
- ```
99
-
100
- ### Verification
101
- You can use the Utility class to verify the signature received in response to a payment made using Orders API
102
- ```rb
103
- puts payment_response
104
- # {
105
- # :razorpay_order_id => "fake_order_id",
106
- # :razorpay_payment_id => "fake_payment_id",
107
- # :razorpay_signature => "signature"
108
- # }
109
- Razorpay::Utility.verify_payment_signature(payment_response)
110
- ```
111
- You can also [verify the signature](https://github.com/razorpay/razorpay-ruby/wiki/Webhooks) received in a webhook:
112
- ```rb
113
- Razorpay::Utility.verify_webhook_signature(webhook_body, webhook_signature, webhook_secret)
114
- ```
115
-
116
- ### Customers
117
- ```rb
118
- # Create a customer
119
- customer = Razorpay::Customer.create email: 'test@razorpay.com', contact: '9876543210'
120
- puts customer.id #cust_6vRXClWqnLhV14
121
- ```
122
-
123
- ### Cards
124
- ```rb
125
- # Fetch a card
126
- card = Razorpay::Card.fetch('card_7EZLhWkDt05n7V')
127
- puts card.network #VISA
128
- ```
129
-
130
- You can find cards API documentation at <https://docs.razorpay.com/v1/page/cards>.
131
-
132
- ### Invoices
133
- ```rb
134
- # Creating an invoice
135
- invoice = Razorpay::Invoice.create customer_id: customer.id, amount: 100, currency: 'INR', description: 'Test description', type: 'link'
136
- ```
137
-
138
- You can find invoices API documentation at <https://docs.razorpay.com/v1/page/invoices>.
139
-
140
- ### Plan
141
- ```rb
142
- # Creating a plan
143
- plan = Razorpay::Plan.create interval: 1, period: 'monthly', item: { name: 'fake_plan', description: 'fake_desc', currency: 'INR', amount: 500 }, notes: { identifier: 'plan_monthly_super' }
144
- ```
145
-
146
- You can find plan API documentation at <https://razorpay.com/docs/subscriptions/api/#plan>.
147
-
148
- ### Subscription
50
+ You can set customer headers for your requests using the following:
149
51
  ```rb
150
- # Creating a subscription and starting after 24 hours (24 hours = 60 * 60 * 24)
151
- subscription = Razorpay::Subscription.create plan_id: plan.id, customer_id: customer.id, start_at: (Time.now + (60 * 60 * 24)).to_i, total_count: 3
52
+ Razorpay.headers = {"CUSTOM_APP_HEADER" => "CUSTOM_VALUE"}
152
53
  ```
153
54
 
154
- You can find subscription API documentation at <https://razorpay.com/docs/subscriptions/api/#subscription>.
155
-
156
- ### Addon
157
- ```rb
158
- # Creating an addon
159
- subscription_addon = Razorpay::Addon.create subscription.id, item: { name: 'fake_plan', description: 'fake_desc', currency: 'INR', amount: 500 }, quantity: 1
55
+ You can find your API keys at <https://dashboard.razorpay.com/#/app/keys>.
160
56
 
161
- # Fetching an addon
162
- addon = Razorpay::Addon.fetch subscription_addon.id
163
- ```
57
+ If you are using rails, the right place to do this might be `config/initializers/razorpay.rb`.
164
58
 
165
- You can find addon API documentation at <https://razorpay.com/docs/subscriptions/api/#add-on>.
59
+ ## Supported Resources
60
+ - [Account](documents/account.md)
61
+ - [Customer](documents/customer.md)
62
+ - [Token](documents/tokens.md)
63
+ - [Order](documents/order.md)
64
+ - [Payments](documents/payment.md)
65
+ - [Settlements](documents/settlement.md)
66
+ - [Fund](documents/fund.md)
67
+ - [Refunds](documents/refund.md)
68
+ - [Invoice](documents/Invoice.md)
69
+ - [Plan](documents/plan.md)
70
+ - [Item](documents/items.md)
71
+ - [Subscriptions](documents/subscriptions.md)
72
+ - [Add-on](documents/addon.md)
73
+ - [Payment Links](documents/paymentLink.md)
74
+ - [Product Configuration](documents/productConfiguration.md)
75
+ - [Smart Collect](documents/virtualAccount.md)
76
+ - [Stakeholder](documents/stakeholder.md)
77
+ - [Transfer](documents/transfers.md)
78
+ - [QR Code](documents/qrcode.md)
79
+ - [Emandate](documents/emandate.md)
80
+ - [Cards](documents/card.md)
81
+ - [Paper NACH](documents/papernach.md)
82
+ - [UPI](documents/upi.md)
83
+ - [Register Emandate and Charge First Payment Together](documents/registerEmandate.md)
84
+ - [Register NACH and Charge First Payment Together](documents/registerNach.md)
85
+ - [Payment Verification](documents/paymentVerification.md)
86
+ - [Webhook](documents/webhook.md)
87
+ - [OAuthToken](documents/oauth_token.md)
88
+ - [Dispute](documents/dispute.md)
89
+ - [Document](documents/documents.md)
166
90
 
167
91
  ## Development
168
92
 
@@ -183,19 +107,6 @@ You can find addon API documentation at <https://razorpay.com/docs/subscriptions
183
107
  5. Push to the branch (`git push origin my-new-feature`)
184
108
  6. Create a new Pull Request
185
109
 
186
- ## Supported Versions
187
-
188
- While we support [all currently supported versions of Ruby](https://www.ruby-lang.org/en/downloads/branches/)
189
- only, the code is tested against the following versions:
190
-
191
- * 1.9.3
192
- * 2.0.0
193
- * 2.1.10
194
- * 2.3.8
195
- * 2.4.6
196
- * 2.5.5
197
- * 2.6.2
198
-
199
110
  ## Release
200
111
 
201
112
  Steps to follow for a release: