razorpay 2.4.1 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/dependabot.yml +8 -0
- data/.github/workflows/ruby.yml +38 -0
- data/CHANGELOG.md +19 -0
- data/README.md +29 -140
- data/documents/Invoice.md +531 -0
- data/documents/addon.md +169 -0
- data/documents/card.md +611 -0
- data/documents/customer.md +161 -0
- data/documents/emandate.md +484 -0
- data/documents/fund.md +87 -0
- data/documents/items.md +184 -0
- data/documents/order.md +230 -0
- data/documents/papernach.md +718 -0
- data/documents/payment.md +636 -0
- data/documents/paymentLink.md +1045 -0
- data/documents/paymentVerification.md +79 -0
- data/documents/plan.md +184 -0
- data/documents/qrcode.md +441 -0
- data/documents/refund.md +324 -0
- data/documents/registerEmandate.md +445 -0
- data/documents/registerNach.md +661 -0
- data/documents/settlement.md +477 -0
- data/documents/subscriptions.md +750 -0
- data/documents/tokens.md +208 -0
- data/documents/transfers.md +684 -0
- data/documents/upi.md +548 -0
- data/documents/virtualAccount.md +586 -0
- data/lib/razorpay/addon.rb +4 -0
- data/lib/razorpay/constants.rb +1 -1
- data/lib/razorpay/customer.rb +15 -0
- data/lib/razorpay/fund_account.rb +19 -0
- data/lib/razorpay/invoice.rb +8 -0
- data/lib/razorpay/item.rb +34 -0
- data/lib/razorpay/order.rb +10 -0
- data/lib/razorpay/payment.rb +52 -0
- data/lib/razorpay/payment_link.rb +36 -0
- data/lib/razorpay/qr_code.rb +34 -0
- data/lib/razorpay/refund.rb +4 -0
- data/lib/razorpay/request.rb +13 -6
- data/lib/razorpay/settlement.rb +39 -0
- data/lib/razorpay/subscription.rb +24 -0
- data/lib/razorpay/subscription_registration.rb +16 -0
- data/lib/razorpay/transfer.rb +35 -0
- data/lib/razorpay/utility.rb +7 -2
- data/lib/razorpay/virtual_account.rb +14 -6
- data/lib/razorpay.rb +7 -0
- data/test/fixtures/addon_collection.json +60 -0
- data/test/fixtures/create_json_payment.json +13 -0
- data/test/fixtures/delete_token.json +3 -0
- data/test/fixtures/downtimes_collection.json +21 -0
- data/test/fixtures/empty.json +2 -0
- data/test/fixtures/fake_addon.json +3 -3
- data/test/fixtures/fake_direct_transfer.json +32 -0
- data/test/fixtures/fake_downtime.json +14 -0
- data/test/fixtures/fake_fund_account.json +18 -0
- data/test/fixtures/fake_instant_settlement.json +19 -0
- data/test/fixtures/fake_item.json +9 -0
- data/test/fixtures/fake_order_transfers.json +88 -0
- data/test/fixtures/fake_otp_generate.json +19 -0
- data/test/fixtures/fake_otp_resend.json +7 -0
- data/test/fixtures/fake_otp_submit.json +5 -0
- data/test/fixtures/fake_payment_link.json +40 -0
- data/test/fixtures/fake_pending_update.json +30 -0
- data/test/fixtures/fake_qrcode.json +20 -0
- data/test/fixtures/fake_qrcode_close.json +22 -0
- data/test/fixtures/fake_recurring.json +5 -0
- data/test/fixtures/fake_refund.json +1 -1
- data/test/fixtures/fake_settlement.json +11 -0
- data/test/fixtures/fake_settlement_on_demand.json +39 -0
- data/test/fixtures/fake_subscription_pause.json +19 -0
- data/test/fixtures/fake_subscription_registration.json +91 -0
- data/test/fixtures/fake_subscription_resume.json +19 -0
- data/test/fixtures/fake_token.json +31 -0
- data/test/fixtures/fake_transfer.json +18 -0
- data/test/fixtures/fake_transfer_reverse.json +15 -0
- data/test/fixtures/fake_update_payment.json +39 -0
- data/test/fixtures/fake_virtual_account_allowed.json +46 -0
- data/test/fixtures/fake_virtual_account_receiver.json +46 -0
- data/test/fixtures/fund_collection.json +20 -0
- data/test/fixtures/item_collection.json +24 -0
- data/test/fixtures/payment_collection.json +1 -1
- data/test/fixtures/payment_link_collection.json +43 -0
- data/test/fixtures/payment_link_response.json +3 -0
- data/test/fixtures/qrcode_collection.json +50 -0
- data/test/fixtures/qrcode_payments_collection.json +74 -0
- data/test/fixtures/settlement_collection.json +26 -0
- data/test/fixtures/settlement_instant_collection.json +84 -0
- data/test/fixtures/settlement_report_collection.json +117 -0
- data/test/fixtures/success.json +3 -0
- data/test/fixtures/tokens_collection.json +36 -0
- data/test/fixtures/transfer_settlements_collection.json +38 -0
- data/test/fixtures/transfers_collection.json +41 -0
- data/test/razorpay/test_addon.rb +15 -15
- data/test/razorpay/test_customer.rb +27 -3
- data/test/razorpay/test_fund_account.rb +42 -0
- data/test/razorpay/test_invoice.rb +15 -2
- data/test/razorpay/test_item.rb +66 -0
- data/test/razorpay/test_order.rb +24 -1
- data/test/razorpay/test_payment.rb +184 -8
- data/test/razorpay/test_payment_link.rb +83 -0
- data/test/razorpay/test_plan.rb +2 -2
- data/test/razorpay/test_qr_code.rb +63 -0
- data/test/razorpay/test_refund.rb +16 -2
- data/test/razorpay/test_settlement.rb +76 -0
- data/test/razorpay/test_subscription.rb +72 -9
- data/test/razorpay/test_subscription_registration.rb +58 -0
- data/test/razorpay/test_transfer.rb +77 -0
- data/test/razorpay/test_utility.rb +32 -0
- data/test/razorpay/test_virtual_account.rb +64 -17
- data/test/test_helper.rb +6 -0
- metadata +138 -9
- data/.travis.yml +0 -22
- data/test/razorpay/test_errors.rb +0 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 16358451a0774ffe1eee29516c7a196315c9b224169fb28aa0faa07664041e14
|
4
|
+
data.tar.gz: 841f735f70da6e8b54b8d0370005ddbdad26ee393960133eb08505869dd04d6f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ffd3b0c1f38c5debb4a6b8a15fdfa00df1ca7b5f3f7d72b1d64227681923ec7307ae39d0e060346660c3270e143bbf7ac88185e664331390a52e7103a53a868e
|
7
|
+
data.tar.gz: e6048a8c9abfb4169d1f5e69203d9abb5824c13b8655a85cc53648497cfb38103887073562f3188297b8437fd6a823219456cfd72db67876e50f8409e06888ea
|
@@ -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: ['2.6', '2.7', '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,25 @@ Changelog for Razorpay-Ruby SDK.
|
|
4
4
|
|
5
5
|
## Unreleased
|
6
6
|
|
7
|
+
## [3.0.0] - 2022-06-03
|
8
|
+
|
9
|
+
### Added
|
10
|
+
|
11
|
+
- QR code end point API
|
12
|
+
- Settlement end point API
|
13
|
+
- Fund Account end point API
|
14
|
+
- PaymentLinks end point API
|
15
|
+
- Item end point API
|
16
|
+
- New APIs for Invoices (Delete, Send/resend)
|
17
|
+
- New API for Customers (Fetch Tokens, Delete Token)
|
18
|
+
- New APIs for Subscriptions (Update, Pause, Resume, Pending update, Delete offer)
|
19
|
+
- New API for Addons (Fetch all Addons)
|
20
|
+
- New API for Refund (Update refund)
|
21
|
+
- New APIs for Payments (Update, Create recurring, Create Json, Payment downtime details, refunds of a payment, Otp generate, Otp submit, Otp resend)
|
22
|
+
- New APIs for Virtual Account (Add receiver, add an allowed payer account, delete an allowed payer account)
|
23
|
+
- Updated Testcases
|
24
|
+
- Updated Readme
|
25
|
+
|
7
26
|
## [2.4.1] - 2019-04-09
|
8
27
|
|
9
28
|
### Fixed
|
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://
|
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.0-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,9 +20,12 @@ 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.
|
26
29
|
|
27
30
|
Next, you need to setup your key and secret using the following:
|
28
31
|
|
@@ -39,131 +42,30 @@ You can find your API keys at <https://dashboard.razorpay.com/#/app/keys>.
|
|
39
42
|
|
40
43
|
If you are using rails, the right place to do this might be `config/initializers/razorpay.rb`.
|
41
44
|
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
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
|
149
|
-
```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
|
152
|
-
```
|
153
|
-
|
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
|
160
|
-
|
161
|
-
# Fetching an addon
|
162
|
-
addon = Razorpay::Addon.fetch subscription_addon.id
|
163
|
-
```
|
164
|
-
|
165
|
-
You can find addon API documentation at <https://razorpay.com/docs/subscriptions/api/#add-on>.
|
166
|
-
|
45
|
+
## Supported Resources
|
46
|
+
- [Customer](documents/customer.md)
|
47
|
+
- [Token](documents/tokens.md)
|
48
|
+
- [Order](documents/order.md)
|
49
|
+
- [Payments](documents/payment.md)
|
50
|
+
- [Settlements](documents/settlement.md)
|
51
|
+
- [Fund](documents/fund.md)
|
52
|
+
- [Refunds](documents/refund.md)
|
53
|
+
- [Invoice](documents/Invoice.md)
|
54
|
+
- [Plan](documents/plan.md)
|
55
|
+
- [Item](documents/items.md)
|
56
|
+
- [Subscriptions](documents/subscriptions.md)
|
57
|
+
- [Add-on](documents/addon.md)
|
58
|
+
- [Payment Links](documents/paymentLink.md)
|
59
|
+
- [Smart Collect](documents/virtualAccount.md)
|
60
|
+
- [Transfer](documents/transfers.md)
|
61
|
+
- [QR Code](documents/qrcode.md)
|
62
|
+
- [Emandate](documents/emandate.md)
|
63
|
+
- [Cards](documents/card.md)
|
64
|
+
- [Paper NACH](documents/papernach.md)
|
65
|
+
- [UPI](documents/upi.md)
|
66
|
+
- [Register Emandate and Charge First Payment Together](documents/registerEmandate.md)
|
67
|
+
- [Register NACH and Charge First Payment Together](documents/registerNach.md)
|
68
|
+
- [Payment Verification](documents/paymentVerification.md)
|
167
69
|
## Development
|
168
70
|
|
169
71
|
- Everything is namespaced under the Razorpay module
|
@@ -183,19 +85,6 @@ You can find addon API documentation at <https://razorpay.com/docs/subscriptions
|
|
183
85
|
5. Push to the branch (`git push origin my-new-feature`)
|
184
86
|
6. Create a new Pull Request
|
185
87
|
|
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
88
|
## Release
|
200
89
|
|
201
90
|
Steps to follow for a release:
|