Skip to content

Commit

Permalink
Japanese freephone starts with 0800 has 7 digit in local part
Browse files Browse the repository at this point in the history
  • Loading branch information
fujimura committed Dec 20, 2018
1 parent 085fee5 commit e6d9327
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/phony/countries/japan.rb
Expand Up @@ -405,7 +405,8 @@
one_of('20', '50', '60', '70', '90') >> split(4,4) | # mobile, VoIP telephony
one_of(ndcs_with_5_subscriber_numbers) >> split(1,4) |
one_of(ndcs_with_6_subscriber_numbers) >> split(2,4) |
one_of(%w(120 800)) >> split(3,3) | # freephone
one_of(%w(120)) >> split(3,3) | # freephone
one_of(%w(120 800)) >> split(3,4) | # freephone
one_of(ndcs_with_7_subscriber_numbers) >> split(3,4) |
one_of(ndcs_with_8_subscriber_numbers) >> split(4,4) |
# TODO: 91(NDC) N(S)N length: 5-13 - Non-geographic number (Direct subscriber telephone service (legacy))
Expand Down
1 change: 1 addition & 0 deletions qed/plausibility.md
Expand Up @@ -580,6 +580,7 @@ Mobile.
plausible? true:[
'+81 3 1234 5678',
'+81 120 123 456',
'+81 800 123 4567',
'+81 11 1234 567',
'+81 123 123 456',
'+81 1267 123 45',
Expand Down
6 changes: 6 additions & 0 deletions spec/functional/plausibility_spec.rb
Expand Up @@ -587,6 +587,12 @@ def self.it_is_correct_for(country_name, options={})
it 'is correct for Malaysia' do
Phony.plausible?('+60 5 123 1234').should be_truthy # Non Selangor Landline
end

it 'is correct for Japan' do
Phony.plausible?('+81 90 1234 1234').should be_truthy
Phony.plausible?('+81 120 123 123').should be_truthy
Phony.plausible?('+81 800 123 1234').should be_truthy
end
end
end
end
1 change: 1 addition & 0 deletions spec/lib/phony/countries_spec.rb
Expand Up @@ -446,6 +446,7 @@ def self.it_splits number, expected
describe 'Japan' do
it_splits '81312345678', %w(81 3 1234 5678) # Tokyo
it_splits '81612345678', %w(81 6 1234 5678) # Osaka
it_splits '818001001234', %w(81 800 100 1234) # Freephone
it_splits '81120123456', %w(81 120 123 456) # Freephone
it_splits '81111234567', %w(81 11 123 4567)
it_splits '81123123456', %w(81 123 12 3456)
Expand Down

0 comments on commit e6d9327

Please sign in to comment.