razorpay 3.2.0 → 3.2.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 59699530109b442fdc1c6a26cb1df4c906af476b1df20a09847dcda7ca3b5633
4
- data.tar.gz: d04d833b06a6b461f4ed2892a3fac80e33e6c43456598f4933b33036909f8337
3
+ metadata.gz: 5cd01ee8ed4e390a472e9054a4383fde2482eea27f29992bf7d7fc39f33b24c9
4
+ data.tar.gz: b099a18ac979054c0862c1bdfbb643cb997d42cd5b8bb73c034811109793537e
5
5
  SHA512:
6
- metadata.gz: a922d53c0aae270f874ac9160dc23112937361bcee7716a393e554ad94e1b999c00918a7a3fa1cf43fd1f3d2c8fbcad586b6f61e9a8cab712b264195a68c5e6a
7
- data.tar.gz: 2fab3f791c26bceb31d30d7e02ba6b273e9db3ce0b1d250cbe1a4afe29a9e05ded085793085dd503e10c65c3f65f4ed2a004219daff9cca30b0bd4e02c5420b6
6
+ metadata.gz: 726a001671bd021fb23623a05bcda7a952ee618b4b327d45643dddbe3feae613069aa0abb83fb695b798b759638ba5073cfa50711162dc2077c14e462221fd9b
7
+ data.tar.gz: 1fe13db4f2ace27314ccc8601e7679289ad1f3fb02ee150fced0c1c192e8727e01c1922c883bf66d627c10997a635de0b81b1ab51f0f859d650391a3fe01dbe9
@@ -22,7 +22,7 @@ jobs:
22
22
  runs-on: ubuntu-latest
23
23
  strategy:
24
24
  matrix:
25
- ruby-version: ['2.6', '2.7', '3.0']
25
+ ruby-version: ['3.0']
26
26
 
27
27
  steps:
28
28
  - uses: actions/checkout@v3
data/CHANGELOG.md CHANGED
@@ -4,6 +4,10 @@ Changelog for Razorpay-Ruby SDK.
4
4
 
5
5
  ## Unreleased
6
6
 
7
+ ## [3.2.1] - 2023-12-19
8
+
9
+ Rollback: Generic access point due to some performance concern
10
+
7
11
  ## [3.2.0] - 2023-12-11
8
12
 
9
13
  feat: Added generic access point
data/README.md CHANGED
@@ -70,7 +70,6 @@ If you are using rails, the right place to do this might be `config/initializers
70
70
  - [Register NACH and Charge First Payment Together](documents/registerNach.md)
71
71
  - [Payment Verification](documents/paymentVerification.md)
72
72
  - [Webhook](documents/webhook.md)
73
- - [Generic](documents/generic.md)
74
73
 
75
74
  ## Development
76
75
 
@@ -2,31 +2,5 @@
2
2
  module Razorpay
3
3
  BASE_URI = 'https://api.razorpay.com'.freeze
4
4
  TEST_URL = 'https://api.razorpay.com/'.freeze
5
- VERSION = '3.2.0'.freeze
6
- ENTITIES_LIST = {
7
- "cards" => "card",
8
- "invoices" => "invoice",
9
- "refunds" => "refund",
10
- "orders" => "order",
11
- "payments" => "payment",
12
- "customers" => "customer",
13
- "plans" => "plan",
14
- "virtual_accounts" => "virtualAccount",
15
- "addons" => "addon",
16
- "subscriptions" => "subscriptions",
17
- "subscription_registrations" => "subscription_registrations",
18
- "transfers" => "transfers",
19
- "payment_links" => "payment_links",
20
- "settlements" => "settlements",
21
- "qr_codes" => "qr_codes",
22
- "items" => "items",
23
- "fund_accounts" => "fund_accounts",
24
- "webhooks" => "webhook",
25
- "payment_methods" => "payment_methods",
26
- "products" => "products",
27
- "tokens" => "tokens",
28
- "iins" => "iins",
29
- "stakeholders" => "stakeholders",
30
- "accounts" => "accounts"
31
- }
5
+ VERSION = '3.2.1'.freeze
32
6
  end
@@ -115,11 +115,5 @@ module Razorpay
115
115
  # We got an unknown error, cast it to Error for now
116
116
  raise Razorpay::Error.new, 'Unknown Error'
117
117
  end
118
-
119
- def doesEntityExist(entity)
120
- if (Razorpay::ENTITIES_LIST.include?(entity))
121
- warn("Warning: The entity already has a specific function. Consider using it instead.")
122
- end
123
- end
124
118
  end
125
119
  end
data/lib/razorpay.rb CHANGED
@@ -26,7 +26,6 @@ require 'razorpay/token'
26
26
  require 'razorpay/product'
27
27
  require 'razorpay/stakeholder'
28
28
  require 'razorpay/account'
29
- require 'razorpay/generic'
30
29
 
31
30
  # Base Razorpay module
32
31
  module Razorpay
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: razorpay
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.0
4
+ version: 3.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Abhay Rana
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2023-12-11 00:00:00.000000000 Z
12
+ date: 2023-12-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: httparty
@@ -137,7 +137,6 @@ files:
137
137
  - documents/customer.md
138
138
  - documents/emandate.md
139
139
  - documents/fund.md
140
- - documents/generic.md
141
140
  - documents/items.md
142
141
  - documents/order.md
143
142
  - documents/papernach.md
@@ -174,7 +173,6 @@ files:
174
173
  - lib/razorpay/errors/razorpay_error.rb
175
174
  - lib/razorpay/errors/server_error.rb
176
175
  - lib/razorpay/fund_account.rb
177
- - lib/razorpay/generic.rb
178
176
  - lib/razorpay/iin.rb
179
177
  - lib/razorpay/invoice.rb
180
178
  - lib/razorpay/item.rb
@@ -295,7 +293,6 @@ files:
295
293
  - test/razorpay/test_customer.rb
296
294
  - test/razorpay/test_entity.rb
297
295
  - test/razorpay/test_fund_account.rb
298
- - test/razorpay/test_generic.rb
299
296
  - test/razorpay/test_iin.rb
300
297
  - test/razorpay/test_invoice.rb
301
298
  - test/razorpay/test_item.rb
@@ -440,7 +437,6 @@ test_files:
440
437
  - test/razorpay/test_customer.rb
441
438
  - test/razorpay/test_entity.rb
442
439
  - test/razorpay/test_fund_account.rb
443
- - test/razorpay/test_generic.rb
444
440
  - test/razorpay/test_iin.rb
445
441
  - test/razorpay/test_invoice.rb
446
442
  - test/razorpay/test_item.rb
data/documents/generic.md DELETED
@@ -1,150 +0,0 @@
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>
@@ -1,39 +0,0 @@
1
- require 'razorpay/request'
2
-
3
-
4
- module Razorpay
5
- class Generic
6
- def initialize(entity)
7
- @entity = entity
8
- end
9
-
10
- def request()
11
- Razorpay::Request.new(@entity)
12
- end
13
-
14
- def do(url="", method="Get", options={}, version="v1")
15
- r = self.request
16
- r.doesEntityExist(@entity)
17
-
18
- case method
19
- when "Get"
20
- r.get url, options, version
21
-
22
- when "Post"
23
- r.post url, options, version
24
-
25
- when "Patch"
26
- r.patch url, options, version
27
-
28
- when "Put"
29
- r.put url, options, version
30
-
31
- when "Delete"
32
- r.delete url, version
33
-
34
- else
35
- warn("Unsupported method or error occurred")
36
- end
37
- end
38
- end
39
- end
@@ -1,112 +0,0 @@
1
- require 'test_helper'
2
-
3
- module Razorpay
4
- # Tests for Razorpay::Addon
5
- class RazorpayGenericTest < Minitest::Test
6
- class Generic < Razorpay::Entity; end
7
-
8
- def setup
9
- @order_id = 'order_50sX9hGHZJvjjI'
10
- @customer_id = 'cust_6vRXClWqnLhV14'
11
- @invoice_id = 'inv_6vRZmJYFAG1mNq'
12
- @addon_id = 'ao_IrSY3UIqDRx7df'
13
- end
14
-
15
- def test_generic_should_be_defined
16
- refute_nil Razorpay::Generic
17
- end
18
-
19
- # Test fetch endpoint by order entity
20
- def test_generic_orders_should_be_fetch
21
- stub_get(%r{orders/#{@order_id}$}, 'fake_order')
22
-
23
- client = Razorpay::Generic.new("orders")
24
-
25
- order = client.do(@order_id)
26
-
27
- assert_equal 5000, order.amount
28
- assert_equal 'INR', order.currency
29
- assert_equal 'TEST', order.receipt
30
- end
31
-
32
- # Test post endpoint by order entity
33
- def test_generic_orders_should_be_create
34
- para_attr = {
35
- "amount": 5000
36
- }
37
-
38
- stub_post("#{BASE_URI}/v1/orders/", 'fake_order', para_attr.to_json)
39
-
40
- client = Razorpay::Generic.new("orders")
41
- order = client.do("", "Post", para_attr.to_json)
42
- assert_equal 5000, order.amount
43
- assert_equal 'INR', order.currency
44
- assert_equal 'TEST', order.receipt
45
- end
46
-
47
- # Test fetch endpoint by order entity
48
- def test_generic_orders_should_be_edit
49
- para_attr = {
50
- "notes": {
51
- "purpose": "Test UPI QR code notes uodate"
52
- }
53
- }
54
-
55
- stub_patch("#{BASE_URI}/v1/orders/#{@order_id}", 'fake_order', para_attr.to_json)
56
-
57
- client = Razorpay::Generic.new("orders")
58
- order = client.do(@order_id, "Patch", para_attr.to_json)
59
- assert_equal 5000, order.amount
60
- assert_equal 'INR', order.currency
61
- assert_equal 'TEST', order.receipt
62
- end
63
-
64
- # Test post endpoint by order entity
65
- def test_generic_customer_should_be_create
66
- para_attr = {
67
- "name": "Gaurav Kumar",
68
- "contact": 9123456780,
69
- "email": "gaurav.kumar@example.com",
70
- "notes": {
71
- "notes_key_1": "Tea, Earl Grey, Hot",
72
- "notes_key_2": "Tea, Earl Grey… decaf."
73
- }
74
- }
75
-
76
- stub_post("#{BASE_URI}/v1/customers/", 'fake_customer', para_attr.to_json)
77
-
78
- client = Razorpay::Generic.new("customers")
79
- customer = client.do("","Post", para_attr.to_json)
80
- assert_equal 'test@razorpay.com', customer.email
81
- assert_equal '9876543210', customer.contact
82
- end
83
-
84
- # Test put endpoint by order entity
85
- def test_generic_customer_should_be_edit
86
- para_attr = {
87
- "contact": 9123456780,
88
- }
89
-
90
- stub_put("#{BASE_URI}/v1/customers/#{@customer_id}", 'fake_customer', para_attr.to_json)
91
-
92
- client = Razorpay::Generic.new("customers")
93
- customer = client.do(@customer_id, "Put", para_attr.to_json)
94
- assert_equal 'test@razorpay.com', customer.email
95
- assert_equal '9876543210', customer.contact
96
- end
97
-
98
- def test_generic_delete_specific_invoice
99
- stub_delete(%r{invoices/#{@invoice_id}$}, 'empty')
100
- client = Razorpay::Generic.new("invoices")
101
- invoice = client.do("#{@invoice_id}", "Delete")
102
- refute_nil invoice
103
- end
104
-
105
- def test_generic_delete_addon
106
- stub_delete(%r{addons/#{@addon_id}$}, 'empty')
107
- client = Razorpay::Generic.new("addons")
108
- addon = client.do("#{@addon_id}", "Delete")
109
- refute_nil addon
110
- end
111
- end
112
- end