upi 2.0.1 → 2.0.2
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 +4 -4
- data/.idea/upi.iml +6 -5
- data/.rubocop.yml +3 -0
- data/CHANGELOG.md +9 -0
- data/Gemfile.lock +1 -1
- data/README.md +14 -2
- data/lib/upi/version.rb +1 -1
- data/lib/upi.rb +9 -4
- data/sig/upi/generator.rbs +1 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 69ebd28c841dea94af52286485d067afc224f52523684d5bb3cbcacb9c79322a
|
4
|
+
data.tar.gz: 4dad7fcf78afab8b327b01ee8310e2522181f76f4b8c0e3acb09b6d8f1c5ab4c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2e5e58ab3704147e279eda86fa89f2bcf40a5dafc0f5849a0ba91223265be59ec94e215f5dc104c8a5eca807f28f053c27a94b3dcd4a7fa4b67c7fb34c195d97
|
7
|
+
data.tar.gz: 68e63cd763bba3a9db65ef0137466fe58462203befb6feaae7a983fc29863f425c8415953580108f045584ece2551b612050b8cb7ff253ba9559ff821d3b1d9e
|
data/.idea/upi.iml
CHANGED
@@ -13,6 +13,7 @@
|
|
13
13
|
<orderEntry type="sourceFolder" forTests="false" />
|
14
14
|
<orderEntry type="library" scope="PROVIDED" name="ast (v2.4.2, RVM: ruby-3.1.0) [gem]" level="application" />
|
15
15
|
<orderEntry type="library" scope="PROVIDED" name="bundler (v2.3.3, RVM: ruby-3.1.0) [gem]" level="application" />
|
16
|
+
<orderEntry type="library" scope="PROVIDED" name="byebug (v11.1.3, RVM: ruby-3.1.0) [gem]" level="application" />
|
16
17
|
<orderEntry type="library" scope="PROVIDED" name="chunky_png (v1.4.0, RVM: ruby-3.1.0) [gem]" level="application" />
|
17
18
|
<orderEntry type="library" scope="PROVIDED" name="diff-lcs (v1.5.1, RVM: ruby-3.1.0) [gem]" level="application" />
|
18
19
|
<orderEntry type="library" scope="PROVIDED" name="json (v2.7.2, RVM: ruby-3.1.0) [gem]" level="application" />
|
@@ -39,21 +40,21 @@
|
|
39
40
|
<option name="myRootTask">
|
40
41
|
<RakeTaskImpl id="rake">
|
41
42
|
<subtasks>
|
42
|
-
<RakeTaskImpl description="Build upi-2.0.
|
43
|
+
<RakeTaskImpl description="Build upi-2.0.2.gem into the pkg directory" fullCommand="build" id="build" />
|
43
44
|
<RakeTaskImpl id="build">
|
44
45
|
<subtasks>
|
45
|
-
<RakeTaskImpl description="Generate SHA512 checksum if upi-2.0.
|
46
|
+
<RakeTaskImpl description="Generate SHA512 checksum if upi-2.0.2.gem into the checksums directory" fullCommand="build:checksum" id="checksum" />
|
46
47
|
</subtasks>
|
47
48
|
</RakeTaskImpl>
|
48
49
|
<RakeTaskImpl description="Remove any temporary products" fullCommand="clean" id="clean" />
|
49
50
|
<RakeTaskImpl description="Remove any generated files" fullCommand="clobber" id="clobber" />
|
50
|
-
<RakeTaskImpl description="Build and install upi-2.0.
|
51
|
+
<RakeTaskImpl description="Build and install upi-2.0.2.gem into system gems" fullCommand="install" id="install" />
|
51
52
|
<RakeTaskImpl id="install">
|
52
53
|
<subtasks>
|
53
|
-
<RakeTaskImpl description="Build and install upi-2.0.
|
54
|
+
<RakeTaskImpl description="Build and install upi-2.0.2.gem into system gems without network access" fullCommand="install:local" id="local" />
|
54
55
|
</subtasks>
|
55
56
|
</RakeTaskImpl>
|
56
|
-
<RakeTaskImpl description="Create tag v2.0.
|
57
|
+
<RakeTaskImpl description="Create tag v2.0.2 and build and push upi-2.0.2.gem to https://rubygems.org" fullCommand="release[remote]" id="release[remote]" />
|
57
58
|
<RakeTaskImpl description="Run RuboCop" fullCommand="rubocop" id="rubocop" />
|
58
59
|
<RakeTaskImpl id="rubocop">
|
59
60
|
<subtasks>
|
data/.rubocop.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,4 +1,13 @@
|
|
1
1
|
## [Unreleased]
|
2
|
+
- In the making
|
3
|
+
|
4
|
+
## [2.0.2] - 2024-09-08
|
5
|
+
- For Individual Mode there need not be merchant code being sent. Removed default '0000'. Can be still added explicitly.
|
6
|
+
- Changed the upi_content method to not parse the upi address and keep it as it is.
|
7
|
+
- Add support for no uri parse.
|
8
|
+
|
9
|
+
## [2.0.1] - 2024-09-06
|
10
|
+
- Updated Dependencies
|
2
11
|
|
3
12
|
## [2.0.0] - 2024-09-06
|
4
13
|
- Add support for changing amounts after initialization
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -25,7 +25,7 @@ To generate a UPI QR code, you need to initialize the Upi::Generator class with
|
|
25
25
|
|
26
26
|
### Example
|
27
27
|
|
28
|
-
Individual Mode:
|
28
|
+
## Individual Mode:
|
29
29
|
|
30
30
|
### Create a new UPI QR code generator instance
|
31
31
|
```ruby
|
@@ -67,7 +67,7 @@ puts payment_url
|
|
67
67
|
<a href="<%= payment_url %>">Pay Now</a>
|
68
68
|
```
|
69
69
|
|
70
|
-
Merchant Mode:
|
70
|
+
## Merchant Mode:
|
71
71
|
|
72
72
|
### Create a new UPI QR code generator instance
|
73
73
|
```ruby
|
@@ -135,6 +135,18 @@ You can specify the format of the QR code by using the mode parameter:
|
|
135
135
|
* mode: :svg generates an SVG format QR code.
|
136
136
|
* mode: :png generates a PNG format QR code.
|
137
137
|
|
138
|
+
## No URI parse mode
|
139
|
+
|
140
|
+
If you want to generate a QR code without parsing the UPI address, you can use the no_uri_parse option:
|
141
|
+
|
142
|
+
```ruby
|
143
|
+
svg_content = generator.generate_qr(100, 'Personal Payment', no_uri_parse: true, mode: :svg)
|
144
|
+
uri_content = generator.upi_content(100, 'Personal Payment', no_uri_parse: true)
|
145
|
+
|
146
|
+
# The no_uri_parse option will generate the QR code without URI parsing the UPI address.
|
147
|
+
```
|
148
|
+
|
149
|
+
|
138
150
|
## Development
|
139
151
|
|
140
152
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
data/lib/upi/version.rb
CHANGED
data/lib/upi.rb
CHANGED
@@ -43,9 +43,9 @@ module Upi
|
|
43
43
|
#
|
44
44
|
# @see https://www.npci.org.in/what-we-do/upi/product-overview for more details on UPI protocol
|
45
45
|
class Generator
|
46
|
-
attr_reader :params
|
46
|
+
attr_reader :params, :no_url_parse
|
47
47
|
|
48
|
-
def initialize(upi_id:, name:, currency: 'INR', merchant_code:
|
48
|
+
def initialize(upi_id:, name:, currency: 'INR', merchant_code: nil, no_url_parse: true)
|
49
49
|
@params = {
|
50
50
|
pa: upi_id,
|
51
51
|
pn: name,
|
@@ -57,6 +57,7 @@ module Upi
|
|
57
57
|
tid: nil,
|
58
58
|
url: nil
|
59
59
|
}.compact
|
60
|
+
@no_url_parse = no_url_parse
|
60
61
|
end
|
61
62
|
|
62
63
|
def generate_qr(amount = '0', note = '', transaction_ref_id: nil, transaction_id: nil, url: nil, mode: :svg)
|
@@ -94,8 +95,12 @@ module Upi
|
|
94
95
|
generate_transaction(amount, note, transaction_id, transaction_ref_id, url)
|
95
96
|
|
96
97
|
# Manually construct the UPI URI string without URI::UPI
|
97
|
-
query_string =
|
98
|
-
|
98
|
+
query_string = if no_url_parse
|
99
|
+
URI.encode_www_form(params.reject { |k, v| v.nil? || k == :pa })
|
100
|
+
else
|
101
|
+
params.reject { |k, v| v.nil? || k == :pa }.map { |k, v| "#{k}=#{v}" }.join('&')
|
102
|
+
end
|
103
|
+
"upi://pay?pa=#{params[:pa]}&#{query_string}"
|
99
104
|
end
|
100
105
|
|
101
106
|
private
|
data/sig/upi/generator.rbs
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: upi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Faraz Noor
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-09-
|
11
|
+
date: 2024-09-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: chunky_png
|