Skip to content

Commit df0bf21

Browse files
authored
update changelog (#237)
1 parent b48072c commit df0bf21

File tree

4 files changed

+157
-1
lines changed

4 files changed

+157
-1
lines changed

CHANGELOG.md

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

55
## Unreleased
66

7+
## [3.2.0] - 2023-12-11
8+
9+
feat: Added generic access point
10+
711
## [3.1.0] - 2023-10-13
812

913
### Added

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@ If you are using rails, the right place to do this might be `config/initializers
7070
- [Register NACH and Charge First Payment Together](documents/registerNach.md)
7171
- [Payment Verification](documents/paymentVerification.md)
7272
- [Webhook](documents/webhook.md)
73+
- [Generic](documents/generic.md)
74+
7375
## Development
7476

7577
- Everything is namespaced under the Razorpay module

documents/generic.md

Lines changed: 150 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,150 @@
1+
## Generic Access point
2+
3+
4+
```rb
5+
Razorpay.setup('key_id', 'key_secret')
6+
```
7+
8+
### Method Signature
9+
```rb
10+
Razorpay::Generic.new(entity).do(url, method, payload, version)
11+
```
12+
13+
**Parameters:**
14+
15+
| Name | Type | Description |
16+
|---------------|-------------|---------------------------------------------|
17+
| entity* | string | The endpoint to which the request will be made. (e.g., "contacts" or "accounts") |
18+
| url* | string | Add params or query or query (e.g., "/order_000000000000001" or "?count=1") |
19+
| method* | string | The HTTP method for the request (e.g., 'Get', 'Post', 'Put', 'Patch', 'Delete'). |
20+
| payload | object | The data to be sent with the request.|
21+
| version | string | Add version (e.g., "v1" or "v2") |
22+
23+
-------------------------------------------------------------------------------------------------------
24+
25+
### Create a contacts using POST
26+
27+
```rb
28+
29+
payload = {
30+
"name": "Gaurav Kumar",
31+
"email": "gaurav.kumar@example.com",
32+
"contact": "9123456789",
33+
"type": "employee",
34+
"reference_id":"Acme Contact ID 12345",
35+
"notes": {
36+
"notes_key_1":"Tea, Earl Grey, Hot",
37+
"notes_key_2":"Tea, Earl Grey… decaf.",
38+
},
39+
}
40+
41+
Razorpay::Generic.new("contacts").do("/", "Post", payload)
42+
```
43+
44+
**Response:**
45+
46+
```json
47+
{
48+
"id": "cont_00000000000001",
49+
"entity": "contact",
50+
"name": "Gaurav Kumar",
51+
"contact": "9123456789",
52+
"email": "gaurav.kumar@example.com",
53+
"type": "employee",
54+
"reference_id": "Acme Contact ID 12345",
55+
"batch_id": null,
56+
"active": true,
57+
"notes": {
58+
"notes_key_1": "Tea, Earl Grey, Hot",
59+
"notes_key_2": "Tea, Earl Grey… decaf."
60+
},
61+
"created_at": 1545320320
62+
}
63+
```
64+
65+
-------------------------------------------------------------------------------------------------------
66+
67+
### Fetch an order using GET
68+
69+
```rb
70+
Razorpay::Generic.new("orders").do("/order_00000000000001", "Get", {})
71+
```
72+
73+
**Response:**
74+
75+
```json
76+
{
77+
"amount": 307,
78+
"amount_due": 0,
79+
"amount_paid": 307,
80+
"attempts": 1,
81+
"created_at": 1695625101,
82+
"currency": "INR",
83+
"entity": "order",
84+
"id": "order_00000000000001",
85+
"notes": [],
86+
"offer_id": null,
87+
"receipt": "851617",
88+
"status": "paid"
89+
}
90+
```
91+
92+
-------------------------------------------------------------------------------------------------------
93+
94+
### Fetch payments of a linked account using headers
95+
96+
```rb
97+
Razorpay.headers = {"X-Razorpay-Account" => "acc_00000000000001"}
98+
99+
Razorpay::Generic.new("payments").do("/pay_00000000000001", "Get", {})
100+
```
101+
102+
**Response:**
103+
104+
```json
105+
{
106+
"entity": "collection",
107+
"count": 2,
108+
"items": [
109+
{
110+
"id": "pay_00000000000001",
111+
"entity": "payment",
112+
"amount": 10000,
113+
"currency": "INR",
114+
"status": "captured",
115+
"order_id": "order_00000000000001",
116+
"invoice_id": null,
117+
"international": false,
118+
"method": "netbanking",
119+
"amount_refunded": 0,
120+
"refund_status": null,
121+
"captured": true,
122+
"description": "#JJCqaOhFihfkVE",
123+
"card_id": null,
124+
"bank": "YESB",
125+
"wallet": null,
126+
"vpa": null,
127+
"email": "john.example@example.com",
128+
"contact": "9999999999",
129+
"notes": [],
130+
"fee": 236,
131+
"tax": 36,
132+
"error_code": null,
133+
"error_description": null,
134+
"error_source": null,
135+
"error_step": null,
136+
"error_reason": null,
137+
"acquirer_data": {
138+
"bank_transaction_id": "2118867"
139+
},
140+
"created_at": 1649932775
141+
}
142+
]
143+
}
144+
```
145+
146+
-------------------------------------------------------------------------------------------------------
147+
148+
**PN: * indicates mandatory fields**
149+
<br>
150+
<br>

lib/razorpay/constants.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
module Razorpay
33
BASE_URI = 'https://api.razorpay.com'.freeze
44
TEST_URL = 'https://api.razorpay.com/'.freeze
5-
VERSION = '3.1.0'.freeze
5+
VERSION = '3.2.0'.freeze
66
ENTITIES_LIST = {
77
"cards" => "card",
88
"invoices" => "invoice",

0 commit comments

Comments
 (0)