qrcode_pix_ruby 0.3.3 → 0.3.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +1 -1
- data/.github/workflows/heroku.yml +44 -0
- data/.github/workflows/rubygems.yml +1 -1
- data/.gitignore +1 -0
- data/.rubocop.yml +7 -0
- data/CHANGELOG.md +4 -0
- data/LICENSE.txt +1 -1
- data/README.md +10 -1
- data/demo/Gemfile +5 -0
- data/demo/config.ru +148 -0
- data/lib/qrcode_pix_ruby/payload.rb +1 -1
- data/lib/qrcode_pix_ruby/version.rb +1 -1
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 52e5a20fafc6b73338560780df06dd35cd0a458e29fe8e3a2a401b723a59a301
|
4
|
+
data.tar.gz: 8a3307288998e027a9aec36113a7b8dd4d543e97663c60ffd9fda0b6ba99e880
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6131ff1fabc61f1f3c51fae3ffdf93e6297eddefc98341e25b36bb8de84ca64f7570d62219eaf2ad21a83ac37b4bd762acd93624031e0b835e5faa84b8fe1aa1
|
7
|
+
data.tar.gz: 9bf41ca90b8a2213264cf7e2ec89f83c959a0ad6c98052624f16ec94ddc6b477b61160f545c7b9243d138ab5e07061f51aa80068f2a5205d7c31b8b1322627a9
|
data/.github/workflows/ci.yml
CHANGED
@@ -0,0 +1,44 @@
|
|
1
|
+
name: Publish to Heroku
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches: [master]
|
6
|
+
|
7
|
+
jobs:
|
8
|
+
deploy:
|
9
|
+
runs-on: ubuntu-latest
|
10
|
+
steps:
|
11
|
+
- uses: actions/checkout@v2
|
12
|
+
|
13
|
+
- name: Install Ruby
|
14
|
+
uses: ruby/setup-ruby@v1
|
15
|
+
with:
|
16
|
+
ruby-version: 3.0
|
17
|
+
|
18
|
+
- name: Install dependencies
|
19
|
+
run: |
|
20
|
+
cd demo/
|
21
|
+
bundle update qrcode_pix_ruby
|
22
|
+
cd ../
|
23
|
+
|
24
|
+
- name: Define Heroku credentials
|
25
|
+
run: |
|
26
|
+
cat > ~/.netrc <<EOF
|
27
|
+
machine api.heroku.com
|
28
|
+
login $HEROKU_EMAIL
|
29
|
+
password $HEROKU_API_KEY
|
30
|
+
machine git.heroku.com
|
31
|
+
login $HEROKU_EMAIL
|
32
|
+
password $HEROKU_API_KEY
|
33
|
+
EOF
|
34
|
+
env:
|
35
|
+
HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }}
|
36
|
+
HEROKU_EMAIL: ${{ secrets.HEROKU_EMAIL }}
|
37
|
+
|
38
|
+
- name: Define Heroku git remote
|
39
|
+
run: heroku git:remote --app $HEROKU_APP_NAME
|
40
|
+
env:
|
41
|
+
HEROKU_APP_NAME: ${{ secrets.HEROKU_APP_NAME }}
|
42
|
+
|
43
|
+
- name: Publish to Heroku
|
44
|
+
run: git push heroku `git subtree split --prefix demo master`:master --force
|
data/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
@@ -3,6 +3,7 @@ AllCops:
|
|
3
3
|
SuggestExtensions: false
|
4
4
|
Exclude:
|
5
5
|
- spec/*
|
6
|
+
- demo/*
|
6
7
|
|
7
8
|
Layout/LineLength:
|
8
9
|
Max: 120
|
@@ -26,3 +27,9 @@ Metrics/BlockNesting:
|
|
26
27
|
|
27
28
|
Style/IfUnlessModifier:
|
28
29
|
Enabled: false
|
30
|
+
|
31
|
+
Metrics/CyclomaticComplexity:
|
32
|
+
Enabled: false
|
33
|
+
|
34
|
+
Metrics/PerceivedComplexity:
|
35
|
+
Enabled: false
|
data/CHANGELOG.md
CHANGED
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
@@ -11,7 +11,7 @@
|
|
11
11
|
|
12
12
|
Ruby gem for Qrcode generation of Pix (Pagamento Instantâneo Brasileiro - Banco Central do Brasil).
|
13
13
|
|
14
|
-
<img src="https://github.com/pedrofurtado/qrcode_pix_ruby/blob/master/pix_logo.png?raw=true" height="100px" />
|
14
|
+
<img style="max-width: 100%;" src="https://github.com/pedrofurtado/qrcode_pix_ruby/blob/master/pix_logo.png?raw=true" height="100px" />
|
15
15
|
|
16
16
|
## Installation
|
17
17
|
|
@@ -74,6 +74,7 @@ puts pix.base64
|
|
74
74
|
* https://www.bcb.gov.br/estabilidadefinanceira/pix
|
75
75
|
* https://gerencianet.com.br/blog/qr-code-estatico-qr-code-dinamico-no-pix
|
76
76
|
* https://blog.juno.com.br/pix-qr-code-estatico-x-qr-code-dinamico
|
77
|
+
* https://github.com/entria/awesome-pix
|
77
78
|
|
78
79
|
## Execute tests/specs
|
79
80
|
|
@@ -90,6 +91,14 @@ docker build -t qrcode_pix_ruby_specs .
|
|
90
91
|
docker run -v $(pwd):/app/ -it qrcode_pix_ruby_specs
|
91
92
|
```
|
92
93
|
|
94
|
+
## Demo
|
95
|
+
|
96
|
+
It's provided a simple demo app, in Heroku, that uses the gem always in latest stable. You can check and test your QRCodes here:
|
97
|
+
|
98
|
+
https://qrcode-pix-ruby.herokuapp.com
|
99
|
+
|
100
|
+
🚨 Important note: The first page load can be slow, because of Heroku free tier. But don't worry, the demo works well 🤓
|
101
|
+
|
93
102
|
## Contributing
|
94
103
|
|
95
104
|
Bug reports and pull requests are welcome on GitHub at https://github.com/pedrofurtado/qrcode_pix_ruby. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/pedrofurtado/qrcode_pix_ruby/blob/master/CODE_OF_CONDUCT.md).
|
data/demo/Gemfile
ADDED
data/demo/config.ru
ADDED
@@ -0,0 +1,148 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'qrcode_pix_ruby'
|
4
|
+
|
5
|
+
def generate_html_with(env)
|
6
|
+
qrcode_data = Rack::Request.new(env).params
|
7
|
+
payload = ''
|
8
|
+
data_uri = ''
|
9
|
+
pix = QrcodePixRuby::Payload.new
|
10
|
+
|
11
|
+
unless qrcode_data.empty?
|
12
|
+
pix.pix_key = qrcode_data['pix_key'] unless qrcode_data['pix_key'].nil?
|
13
|
+
pix.description = qrcode_data['description'] unless qrcode_data['description'].nil?
|
14
|
+
pix.merchant_name = qrcode_data['merchant_name'] unless qrcode_data['merchant_name'].nil?
|
15
|
+
pix.merchant_city = qrcode_data['merchant_city'] unless qrcode_data['merchant_city'].nil?
|
16
|
+
pix.transaction_id = qrcode_data['transaction_id'] unless qrcode_data['transaction_id'].nil?
|
17
|
+
pix.amount = qrcode_data['amount'] unless qrcode_data['amount'].nil?
|
18
|
+
pix.currency = qrcode_data['currency'] unless qrcode_data['currency'].nil?
|
19
|
+
pix.country_code = qrcode_data['country_code'] unless qrcode_data['country_code'].nil?
|
20
|
+
pix.postal_code = qrcode_data['postal_code'] unless qrcode_data['postal_code'].nil?
|
21
|
+
pix.repeatable = qrcode_data['repeatable'] == 't' unless qrcode_data['repeatable'].nil?
|
22
|
+
|
23
|
+
payload = <<-HTML
|
24
|
+
<label for='payload'>Payload</label>
|
25
|
+
<div class='input-group mb-3'>
|
26
|
+
<input class='form-control' id='payload' value='#{pix.payload}'>
|
27
|
+
<button class='btn btn-outline-success btn-clipboard' data-clipboard-target='#payload' data-bs-toggle='tooltip' data-bs-placement='top' title='Copied!' data-bs-trigger='click'>Copy</button>
|
28
|
+
</div>
|
29
|
+
HTML
|
30
|
+
|
31
|
+
data_uri = "<img style='max-width: 100%;' src='#{pix.base64}'>"
|
32
|
+
end
|
33
|
+
|
34
|
+
StringIO.new <<-HTML
|
35
|
+
<!DOCTYPE html>
|
36
|
+
<html>
|
37
|
+
<head>
|
38
|
+
<meta charset='utf-8'>
|
39
|
+
<meta name='viewport' content='width=device-width, initial-scale=1'>
|
40
|
+
<link href='https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css' rel='stylesheet'>
|
41
|
+
<script src='https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js'></script>
|
42
|
+
<script src='https://cdn.jsdelivr.net/npm/clipboard@2.0.8/dist/clipboard.min.js'></script>
|
43
|
+
<title>QRCode Pix Ruby - Demo App</title>
|
44
|
+
</head>
|
45
|
+
<body>
|
46
|
+
<div class='container' style='margin-top: 50px;'>
|
47
|
+
<div class='row'>
|
48
|
+
<div class='col-md-12'>
|
49
|
+
<h1 class='text-center'>QRCode Pix Ruby - Demo App</h1>
|
50
|
+
<br>
|
51
|
+
<img style='display: block; margin: 0 auto; max-width: 100%;' src="https://github.com/pedrofurtado/qrcode_pix_ruby/blob/master/pix_logo.png?raw=true" height="100px" />
|
52
|
+
<br>
|
53
|
+
<p style='word-break: break-all;' class='text-center'>For more details check the official repo: <a href="https://github.com/pedrofurtado/qrcode_pix_ruby">https://github.com/pedrofurtado/qrcode_pix_ruby</a></p>
|
54
|
+
<br>
|
55
|
+
<br>
|
56
|
+
</div>
|
57
|
+
</div>
|
58
|
+
<div class='row' style='padding-bottom: 50px;'>
|
59
|
+
<div class='col-sm-6'>
|
60
|
+
<strong>QRCode informations</strong>
|
61
|
+
<br>
|
62
|
+
<br>
|
63
|
+
<form action='https://qrcode-pix-ruby.herokuapp.com' method='post'>
|
64
|
+
<div class='mb-3'>
|
65
|
+
<label for='pix_key'>Pix key</label>
|
66
|
+
<input required type='text' class='form-control' id='pix_key' value='#{qrcode_data["pix_key"]}' name='pix_key'>
|
67
|
+
</div>
|
68
|
+
<div class='mb-3'>
|
69
|
+
<label for='description'>Description</label>
|
70
|
+
<input required type='text' class='form-control' id='description' value='#{qrcode_data["description"]}' name='description'>
|
71
|
+
</div>
|
72
|
+
<div class='mb-3'>
|
73
|
+
<label for='merchant_name'>Merchant name</label>
|
74
|
+
<input required type='text' class='form-control' id='merchant_name' value='#{qrcode_data["merchant_name"]}' name='merchant_name'>
|
75
|
+
</div>
|
76
|
+
<div class='mb-3'>
|
77
|
+
<label for='merchant_city'>Merchant city</label>
|
78
|
+
<input required type='text' class='form-control' id='merchant_city' value='#{qrcode_data["merchant_city"]}' name='merchant_city'>
|
79
|
+
</div>
|
80
|
+
<div class='mb-3'>
|
81
|
+
<label for='transaction_id'>Transaction ID</label>
|
82
|
+
<input required type='text' class='form-control' id='transaction_id' value='#{qrcode_data["transaction_id"]}' name='transaction_id'>
|
83
|
+
</div>
|
84
|
+
<div class='mb-3'>
|
85
|
+
<label for='amount'>Amount</label>
|
86
|
+
<input required type='text' class='form-control' id='amount' value='#{qrcode_data["amount"]}' name='amount'>
|
87
|
+
</div>
|
88
|
+
<div class='mb-3'>
|
89
|
+
<label for='currency'>Currency</label>
|
90
|
+
<select required id='currency' name='currency' class='form-select'>
|
91
|
+
<option value='986' selected>Brazilian Real (R$)</option>
|
92
|
+
</select>
|
93
|
+
</div>
|
94
|
+
<div class='mb-3'>
|
95
|
+
<label for='country_code'>Country</label>
|
96
|
+
<select required id='country_code' name='country_code' class='form-select'>
|
97
|
+
<option value='BR' selected>Brazil</option>
|
98
|
+
</select>
|
99
|
+
</div>
|
100
|
+
<div class='mb-3'>
|
101
|
+
<label for='postal_code'>Postal code</label>
|
102
|
+
<input required type='text' class='form-control' id='postal_code' value='#{qrcode_data["postal_code"]}' name='postal_code'>
|
103
|
+
</div>
|
104
|
+
<div class='mb-3'>
|
105
|
+
<label for='repeatable'>Repeatable?</label>
|
106
|
+
<select required id='repeatable' name='repeatable' class='form-select'>
|
107
|
+
<option selected></option>
|
108
|
+
<option value='t'>Yes</option>
|
109
|
+
<option value='f'>No</option>
|
110
|
+
</select>
|
111
|
+
</div>
|
112
|
+
<div class='d-grid gap-2'>
|
113
|
+
<button type='submit' class='btn btn-lg btn-primary'>Generate</button>
|
114
|
+
</div>
|
115
|
+
</form>
|
116
|
+
</div>
|
117
|
+
<div class='col-sm-6'>
|
118
|
+
<strong>Preview</strong>
|
119
|
+
<br>
|
120
|
+
<br>
|
121
|
+
#{payload}
|
122
|
+
<br>
|
123
|
+
<br>
|
124
|
+
#{data_uri}
|
125
|
+
</div>
|
126
|
+
</div>
|
127
|
+
</div>
|
128
|
+
<script>
|
129
|
+
new ClipboardJS('.btn-clipboard');
|
130
|
+
|
131
|
+
Array.from(document.querySelectorAll('[data-bs-toggle="tooltip"]')).forEach(function (tooltipTriggerEl) {
|
132
|
+
new bootstrap.Tooltip(tooltipTriggerEl);
|
133
|
+
});
|
134
|
+
</script>
|
135
|
+
</body>
|
136
|
+
</html>
|
137
|
+
HTML
|
138
|
+
end
|
139
|
+
|
140
|
+
run lambda { |env|
|
141
|
+
[
|
142
|
+
200,
|
143
|
+
{
|
144
|
+
'Content-Type' => 'text/html'
|
145
|
+
},
|
146
|
+
generate_html_with(env)
|
147
|
+
]
|
148
|
+
}
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: qrcode_pix_ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pedro Furtado
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: exe
|
13
13
|
cert_chain: []
|
14
|
-
date: 2021-06-
|
14
|
+
date: 2021-06-29 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: rqrcode
|
@@ -81,6 +81,7 @@ extensions: []
|
|
81
81
|
extra_rdoc_files: []
|
82
82
|
files:
|
83
83
|
- ".github/workflows/ci.yml"
|
84
|
+
- ".github/workflows/heroku.yml"
|
84
85
|
- ".github/workflows/rubygems.yml"
|
85
86
|
- ".gitignore"
|
86
87
|
- ".rspec"
|
@@ -94,6 +95,9 @@ files:
|
|
94
95
|
- Rakefile
|
95
96
|
- bin/console
|
96
97
|
- bin/setup
|
98
|
+
- demo/Gemfile
|
99
|
+
- demo/Gemfile.lock
|
100
|
+
- demo/config.ru
|
97
101
|
- lib/qrcode_pix_ruby.rb
|
98
102
|
- lib/qrcode_pix_ruby/payload.rb
|
99
103
|
- lib/qrcode_pix_ruby/version.rb
|