wesley6j / qrcode_pix_ruby

Ruby gem for Qrcode generation of Pix (Pagamento Instantâneo Brasileiro - Banco Central do Brasil)

Home Page:https://rubygems.org/gems/qrcode_pix_ruby

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

QRCode Pix Ruby

Maintainability codecov CI Gem Version Gem license contributions welcome Ruby Style Guide

Ruby gem for Qrcode generation of Pix (Pagamento Instantâneo Brasileiro - Banco Central do Brasil).

Installation

Add this line to your application's Gemfile:

gem 'qrcode_pix_ruby'

And then execute:

bundle install

Or install it yourself as:

gem install qrcode_pix_ruby

Usage

require 'qrcode_pix_ruby'

pix = QrcodePixRuby::Payload.new

pix.pix_key        = 'minhachavedopix'
pix.description    = 'Pagamento do pedido 123456'
pix.merchant_name  = 'Fulano de Tal'
pix.merchant_city  = 'SAO PAULO'
pix.transaction_id = 'TID12345'
pix.amount         = '100.00'
pix.currency       = '986'
pix.country_code   = 'BR'
pix.postal_code    = '01131010'
pix.repeatable     = false

# QRCode copia-e-cola
puts pix.payload

# QRCode estático
puts pix.base64

🚨 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).

Useful links

Execute tests/specs

To execute gem tests locally, use Docker with the commands below:

git clone https://github.com/pedrofurtado/qrcode_pix_ruby
cd qrcode_pix_ruby/
docker build -t qrcode_pix_ruby_specs .

# Then, run this command how many times you want,
# after editing local files, and so on, to get
# feedback from test suite of gem.
docker run -v $(pwd):/app/ -it qrcode_pix_ruby_specs

Contributing

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.

License

The gem is available as open source under the terms of the MIT License.

Code of Conduct

Everyone interacting in the qrcode_pix_ruby project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.

About

Ruby gem for Qrcode generation of Pix (Pagamento Instantâneo Brasileiro - Banco Central do Brasil)

https://rubygems.org/gems/qrcode_pix_ruby

License:MIT License


Languages

Language:Ruby 98.2%Language:Dockerfile 1.2%Language:Shell 0.6%