Skip to content

Commit

Permalink
Fixes and suggestions from PR #7 (#8)
Browse files Browse the repository at this point in the history
* Update README.md

* Update payload.rb
  • Loading branch information
pedrofurtado committed Jul 13, 2021
1 parent 6919b9a commit 1a61423
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,14 @@ pix = QrcodePixRuby::Payload.new(
repeatable: false
)

# If needed, change the attributes value later
pix.pix_key = 'minhaoutrachavepix'
pix.merchant_city = 'BRASILIA'

# QRCode copia-e-cola
puts pix.payload

# QRCode para uso em imagens
# QRCode for images
puts pix.base64
```

Expand All @@ -70,6 +74,10 @@ pix = QrcodePixRuby::Payload.new(
repeatable: false
)

# If needed, change the attributes value later
pix.url = 'https://another-example.com'
pix.amount = 1.50

# QRCode copia-e-cola
puts pix.payload

Expand Down
6 changes: 3 additions & 3 deletions lib/qrcode_pix_ruby/payload.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,11 @@ def base64
private

def verify_kwargs(keys)
unknows = keys - ATTRIBUTES
unknowns = keys - ATTRIBUTES

return unless unknows.any?
return unless unknowns.any?

raise QrcodePixRuby::PayloadArgumentError, "Unknown attributes: #{unknows.join(', ')}"
raise QrcodePixRuby::PayloadArgumentError, "Unknown attributes: #{unknowns.join(', ')}"
end

def emv(id, value)
Expand Down

0 comments on commit 1a61423

Please sign in to comment.