qrcode_pix_ruby 0.5.0 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/mergeable.yml +27 -0
- data/.github/workflows/ci.yml +4 -1
- data/.rubocop.yml +1 -1
- data/CHANGELOG.md +7 -0
- data/Dockerfile +1 -2
- data/README.md +26 -5
- data/demo/Dockerfile +7 -0
- data/demo/Gemfile +1 -0
- data/demo/config.ru +5 -12
- data/lib/qrcode_pix_ruby/payload.rb +1 -1
- data/lib/qrcode_pix_ruby/version.rb +1 -1
- metadata +5 -4
- data/.github/workflows/heroku.yml +0 -50
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f7eb7efbeeae8bd694b4ba8b24ef1537237d3cb7d878eca2a1b3649bcd027263
|
4
|
+
data.tar.gz: bc78c8e7d4c7fb49b1420fdd7d6be4ba8075bacbae03b9f6c4783e4ea36d2f24
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a27ff9ff972c6b713df6ad9e3c5446229cba87df5ab5b821e6e836ac8cd068e49f196b866838e46e3c87e3d2cc00cfe7153a992683d4106dec5cbc0ea72da952
|
7
|
+
data.tar.gz: d1f7f61516434b3ccf71d3545c9361119c130315e4b565a108d277a5da052744e526bb2c2a43a5c6628ad1cd08f44b16abb83d97121f1118d648b1d8a11cd7e9
|
@@ -0,0 +1,27 @@
|
|
1
|
+
version: 2
|
2
|
+
mergeable:
|
3
|
+
- when: pull_request.opened
|
4
|
+
validate: []
|
5
|
+
pass:
|
6
|
+
- do: comment
|
7
|
+
payload:
|
8
|
+
body: Thanks for creating a pull request! A maintainer will review your changes shortly.
|
9
|
+
- when: pull_request.*
|
10
|
+
validate:
|
11
|
+
- do: description
|
12
|
+
no_empty:
|
13
|
+
enabled: true
|
14
|
+
message: Please, provide for us an awesome description to your PR 🤝
|
15
|
+
- do: dependent
|
16
|
+
changed:
|
17
|
+
file: '*'
|
18
|
+
required: ['CHANGELOG.md']
|
19
|
+
- when: schedule.repository
|
20
|
+
validate:
|
21
|
+
- do: stale
|
22
|
+
days: 3
|
23
|
+
type: pull_request, issues
|
24
|
+
pass:
|
25
|
+
- do: comment
|
26
|
+
payload:
|
27
|
+
body: It looks old 🕰️
|
data/.github/workflows/ci.yml
CHANGED
@@ -18,7 +18,7 @@ jobs:
|
|
18
18
|
runs-on: ubuntu-latest
|
19
19
|
strategy:
|
20
20
|
matrix:
|
21
|
-
ruby-version: [2.
|
21
|
+
ruby-version: [2.6, 2.7, 3.0]
|
22
22
|
env:
|
23
23
|
CODECOV_TOKEN: ${{secrets.CODECOV_TOKEN}}
|
24
24
|
steps:
|
@@ -29,6 +29,9 @@ jobs:
|
|
29
29
|
with:
|
30
30
|
ruby-version: ${{ matrix.ruby-version }}
|
31
31
|
|
32
|
+
- name: Update rubygems
|
33
|
+
run: gem update --system
|
34
|
+
|
32
35
|
- name: Install dependencies
|
33
36
|
run: bundle install
|
34
37
|
|
data/.rubocop.yml
CHANGED
data/CHANGELOG.md
CHANGED
data/Dockerfile
CHANGED
data/README.md
CHANGED
@@ -31,6 +31,19 @@ Or install it yourself as:
|
|
31
31
|
|
32
32
|
## Usage (examples)
|
33
33
|
|
34
|
+
### Available parameters
|
35
|
+
|
36
|
+
- pix_key/url
|
37
|
+
- repeatable
|
38
|
+
- currency
|
39
|
+
- country_code
|
40
|
+
- description
|
41
|
+
- postal_code
|
42
|
+
- merchant_name
|
43
|
+
- merchant_city
|
44
|
+
- transaction_id
|
45
|
+
- amount
|
46
|
+
|
34
47
|
### Static QR Code
|
35
48
|
|
36
49
|
```ruby
|
@@ -87,7 +100,7 @@ puts pix.base64
|
|
87
100
|
|
88
101
|
🚨 Important note: BACEN (Banco Central do Brasil) sets a variety of rules for each field in QRCode Payload (maximum number of characters, invalid values, mandatory and optional fields, and so on). So, pay attention that a QRCode payload+base64 generated by the gem can be valid, theorically, but may not be accepted in banking apps because of these restrictions (that are out of scope of gem).
|
89
102
|
|
90
|
-
## Execute tests/specs
|
103
|
+
## Execute tests/specs locally
|
91
104
|
|
92
105
|
To execute gem tests locally, use Docker with the commands below:
|
93
106
|
|
@@ -102,13 +115,18 @@ docker build -t qrcode_pix_ruby_specs .
|
|
102
115
|
docker run -v $(pwd):/app/ -it qrcode_pix_ruby_specs
|
103
116
|
```
|
104
117
|
|
105
|
-
##
|
118
|
+
## Execute demo locally
|
106
119
|
|
107
|
-
|
120
|
+
To execute demo locally, use Docker with the commands below:
|
108
121
|
|
109
|
-
|
122
|
+
```bash
|
123
|
+
git clone https://github.com/pedrofurtado/qrcode_pix_ruby
|
124
|
+
cd qrcode_pix_ruby/demo/
|
125
|
+
docker build -t qrcode_pix_ruby_demo .
|
110
126
|
|
111
|
-
|
127
|
+
# Then, access http://localhost:3000 the see demo in action.
|
128
|
+
docker run -p 3000:3000 -it qrcode_pix_ruby_demo
|
129
|
+
```
|
112
130
|
|
113
131
|
## Useful links
|
114
132
|
|
@@ -135,6 +153,9 @@ https://qrcode-pix-ruby.herokuapp.com
|
|
135
153
|
* https://github.com/EnssureIT/faz-um-pix
|
136
154
|
* https://github.com/jesobreira/pixkey
|
137
155
|
* https://github.com/pedrinholemes/pix-br
|
156
|
+
* https://github.com/ceciliadeveza/gerarqrcodepix
|
157
|
+
* https://www.bcb.gov.br/content/estabilidadefinanceira/SiteAssets/Manual%20do%20BR%20Code.pdf
|
158
|
+
* https://www.bcb.gov.br/content/estabilidadefinanceira/spb_docs/ManualBRCode.pdf
|
138
159
|
|
139
160
|
## Contributing
|
140
161
|
|
data/demo/Dockerfile
ADDED
data/demo/Gemfile
CHANGED
data/demo/config.ru
CHANGED
@@ -9,17 +9,10 @@ def generate_html_with(env)
|
|
9
9
|
pix = QrcodePixRuby::Payload.new
|
10
10
|
|
11
11
|
unless qrcode_data.empty?
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
pix.merchant_city = qrcode_data['merchant_city'] if !qrcode_data['merchant_city'].nil? && !qrcode_data['merchant_city'].empty?
|
17
|
-
pix.transaction_id = qrcode_data['transaction_id'] if !qrcode_data['transaction_id'].nil? && !qrcode_data['transaction_id'].empty?
|
18
|
-
pix.amount = qrcode_data['amount'] if !qrcode_data['amount'].nil? && !qrcode_data['amount'].empty?
|
19
|
-
pix.currency = qrcode_data['currency'] if !qrcode_data['currency'].nil? && !qrcode_data['currency'].empty?
|
20
|
-
pix.country_code = qrcode_data['country_code'] if !qrcode_data['country_code'].nil? && !qrcode_data['country_code'].empty?
|
21
|
-
pix.postal_code = qrcode_data['postal_code'] if !qrcode_data['postal_code'].nil? && !qrcode_data['postal_code'].empty?
|
22
|
-
pix.repeatable = qrcode_data['repeatable'] == 't' if !qrcode_data['repeatable'].nil? && !qrcode_data['repeatable'].empty?
|
12
|
+
qrcode_data.keys.each do |key|
|
13
|
+
v = qrcode_data[key]
|
14
|
+
pix.public_send("#{key}=", key == 'repeatable' ? v == 't' : v) unless v.empty? || v.nil?
|
15
|
+
end
|
23
16
|
|
24
17
|
payload = <<-HTML
|
25
18
|
<label for='payload'>Payload</label>
|
@@ -61,7 +54,7 @@ def generate_html_with(env)
|
|
61
54
|
<strong>QRCode informations</strong>
|
62
55
|
<br>
|
63
56
|
<br>
|
64
|
-
<form action='
|
57
|
+
<form action='/' method='post'>
|
65
58
|
<div class='mb-3'>
|
66
59
|
<div class='form-text'>
|
67
60
|
For static Pix, please fill the 'Pix key' field.<br>
|
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.
|
4
|
+
version: 0.6.0
|
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:
|
14
|
+
date: 2024-04-16 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: rqrcode
|
@@ -80,8 +80,8 @@ executables: []
|
|
80
80
|
extensions: []
|
81
81
|
extra_rdoc_files: []
|
82
82
|
files:
|
83
|
+
- ".github/mergeable.yml"
|
83
84
|
- ".github/workflows/ci.yml"
|
84
|
-
- ".github/workflows/heroku.yml"
|
85
85
|
- ".github/workflows/rubygems.yml"
|
86
86
|
- ".gitignore"
|
87
87
|
- ".rspec"
|
@@ -95,6 +95,7 @@ files:
|
|
95
95
|
- Rakefile
|
96
96
|
- bin/console
|
97
97
|
- bin/setup
|
98
|
+
- demo/Dockerfile
|
98
99
|
- demo/Gemfile
|
99
100
|
- demo/config.ru
|
100
101
|
- lib/qrcode_pix_ruby.rb
|
@@ -124,7 +125,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
124
125
|
- !ruby/object:Gem::Version
|
125
126
|
version: '0'
|
126
127
|
requirements: []
|
127
|
-
rubygems_version: 3.
|
128
|
+
rubygems_version: 3.5.3
|
128
129
|
signing_key:
|
129
130
|
specification_version: 4
|
130
131
|
summary: Ruby gem for Qrcode generation of Pix (Pagamento Instantâneo Brasileiro -
|
@@ -1,50 +0,0 @@
|
|
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 install
|
22
|
-
bundle update qrcode_pix_ruby
|
23
|
-
cd ../
|
24
|
-
|
25
|
-
- name: Define Heroku credentials
|
26
|
-
run: |
|
27
|
-
cat > ~/.netrc <<EOF
|
28
|
-
machine api.heroku.com
|
29
|
-
login $HEROKU_EMAIL
|
30
|
-
password $HEROKU_API_KEY
|
31
|
-
machine git.heroku.com
|
32
|
-
login $HEROKU_EMAIL
|
33
|
-
password $HEROKU_API_KEY
|
34
|
-
EOF
|
35
|
-
env:
|
36
|
-
HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }}
|
37
|
-
HEROKU_EMAIL: ${{ secrets.HEROKU_EMAIL }}
|
38
|
-
|
39
|
-
- name: Define Heroku git remote
|
40
|
-
run: heroku git:remote --app $HEROKU_APP_NAME
|
41
|
-
env:
|
42
|
-
HEROKU_APP_NAME: ${{ secrets.HEROKU_APP_NAME }}
|
43
|
-
|
44
|
-
- name: Publish to Heroku
|
45
|
-
run: |
|
46
|
-
git config user.name 'Pedro Furtado'
|
47
|
-
git config user.email 'pedro.felipe.azevedo.furtado@gmail.com'
|
48
|
-
git add --all
|
49
|
-
git commit -m 'Publish to Heroku'
|
50
|
-
git push heroku `git subtree split --prefix demo master`:master --force
|