Skip to content

Commit

Permalink
Fixed portuguese IBAN validation.
Browse files Browse the repository at this point in the history
  • Loading branch information
leio10 committed Nov 3, 2017
1 parent bc7d89d commit 4c4c22c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ $ bundle exec rails generate iban_bic:install --with-static-data
#### 1.2.0

* Added `like_pattern_from_parts` method. Not a very performant version.
* Fixed portuguese IBAN validation.

#### 1.1.0

Expand Down
2 changes: 1 addition & 1 deletion lib/iban_bic/validators/countries/pt.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
add "PT" do |parts|
nib = "#{parts[:bank]}#{parts[:branch]}#{parts[:account]}"
sum = nib.chars.map(&:to_i).zip(IBAN_BIC_PT_WEIGHTS_INDEX).map { |a| a.inject(:*) } .sum
parts[:check] = 98 - sum % 97
parts[:check] = (98 - sum % 97).to_s.rjust(2, "0")
end
end

0 comments on commit 4c4c22c

Please sign in to comment.