Skip to content

Commit 9e057a2

Browse files
authored
Merge pull request #128 from razorpay/addon_update
addon update with test case
2 parents 202bc57 + 1060231 commit 9e057a2

File tree

111 files changed

+12987
-259
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

111 files changed

+12987
-259
lines changed

.github/workflows/ruby.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

.travis.yml

Lines changed: 0 additions & 22 deletions
This file was deleted.

CHANGELOG.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,25 @@ Changelog for Razorpay-Ruby SDK.
44

55
## Unreleased
66

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+
726
## [2.4.1] - 2019-04-09
827

928
### Fixed

README.md

Lines changed: 28 additions & 139 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Razorpay Ruby bindings
22

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.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)
44

55
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.
66

@@ -20,6 +20,9 @@ Or install it yourself as:
2020

2121
$ gem install razorpay
2222

23+
## Requirements
24+
25+
Ruby 2.6.8 or later
2326
## Usage
2427

2528
Remember to `require 'razorpay'` before anything else.
@@ -39,131 +42,30 @@ You can find your API keys at <https://dashboard.razorpay.com/#/app/keys>.
3942

4043
If you are using rails, the right place to do this might be `config/initializers/razorpay.rb`.
4144

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:
58-
```rb
59-
refund = Razorpay::Refund.create(payment_id:"payment_id")
60-
Razorpay::Refund.fetch(refund.id)
61-
```
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
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)
16769
## Development
16870

16971
- Everything is namespaced under the Razorpay module
@@ -183,19 +85,6 @@ You can find addon API documentation at <https://razorpay.com/docs/subscriptions
18385
5. Push to the branch (`git push origin my-new-feature`)
18486
6. Create a new Pull Request
18587

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-
19988
## Release
20089

20190
Steps to follow for a release:

0 commit comments

Comments
 (0)