Skip to content

Commit

Permalink
Fix EMV field repeatable (#3)
Browse files Browse the repository at this point in the history
* Fix EMV field repeatable

* Fix tests
  • Loading branch information
pedrofurtado committed Jun 29, 2021
1 parent 4c19df9 commit 96d7982
Show file tree
Hide file tree
Showing 8 changed files with 72 additions and 79 deletions.
1 change: 0 additions & 1 deletion .github/workflows/heroku.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,3 @@ jobs:

- name: Publish to Heroku
run: git push heroku `git subtree split --prefix demo master`:master --force

4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
## [Unreleased]

## [0.3.4] - 2021-06-28

- Fix behavior of EMV field 'repeatable' (the logic was inversed)

## [0.3.3] - 2021-06-25

- Rubocop setup
Expand Down
2 changes: 1 addition & 1 deletion LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2021 TODO: Write your name
Copyright (c)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ puts pix.base64
* https://www.bcb.gov.br/estabilidadefinanceira/pix
* https://gerencianet.com.br/blog/qr-code-estatico-qr-code-dinamico-no-pix
* https://blog.juno.com.br/pix-qr-code-estatico-x-qr-code-dinamico
* https://github.com/entria/awesome-pix

## Execute tests/specs

Expand All @@ -92,7 +93,7 @@ docker run -v $(pwd):/app/ -it qrcode_pix_ruby_specs

## Demo

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:
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:

https://qrcode-pix-ruby.herokuapp.com

Expand Down
8 changes: 4 additions & 4 deletions demo/config.ru
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def generate_html_with(env)
<br>
<form action='https://qrcode-pix-ruby.herokuapp.com' method='post'>
<div class='mb-3'>
<label for='pix_key'>PIX key (email, phone, CPF, and random keys)</label>
<label for='pix_key'>Pix key</label>
<input required type='text' class='form-control' id='pix_key' value='#{qrcode_data["pix_key"]}' name='pix_key'>
</div>
<div class='mb-3'>
Expand All @@ -78,11 +78,11 @@ def generate_html_with(env)
<input required type='text' class='form-control' id='merchant_city' value='#{qrcode_data["merchant_city"]}' name='merchant_city'>
</div>
<div class='mb-3'>
<label for='transaction_id'>Transaction ID (only numbers/characters without whitespaces)</label>
<label for='transaction_id'>Transaction ID</label>
<input required type='text' class='form-control' id='transaction_id' value='#{qrcode_data["transaction_id"]}' name='transaction_id'>
</div>
<div class='mb-3'>
<label for='amount'>Amount (examples: 1.00, 0.75, 7500.00, 12400.50)</label>
<label for='amount'>Amount</label>
<input required type='text' class='form-control' id='amount' value='#{qrcode_data["amount"]}' name='amount'>
</div>
<div class='mb-3'>
Expand All @@ -98,7 +98,7 @@ def generate_html_with(env)
</select>
</div>
<div class='mb-3'>
<label for='postal_code'>Postal code (only numbers)</label>
<label for='postal_code'>Postal code</label>
<input required type='text' class='form-control' id='postal_code' value='#{qrcode_data["postal_code"]}' name='postal_code'>
</div>
<div class='mb-3'>
Expand Down
2 changes: 1 addition & 1 deletion lib/qrcode_pix_ruby/payload.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def emv(id, value)
end

def emv_repeatable
emv(ID_POINT_OF_INITIATION_METHOD, repeatable ? '12' : '11')
emv(ID_POINT_OF_INITIATION_METHOD, repeatable ? '11' : '12')
end

def emv_merchant
Expand Down
2 changes: 1 addition & 1 deletion lib/qrcode_pix_ruby/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module QrcodePixRuby
VERSION = '0.3.3'
VERSION = '0.3.4'
end
129 changes: 59 additions & 70 deletions spec/qrcode_pix_ruby_spec.rb

Large diffs are not rendered by default.

0 comments on commit 96d7982

Please sign in to comment.