Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion lib/pinpoint_supported_countries.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ class PinpointSupportedCountries
TH
].to_set.freeze

# Countries where AWS claims sender ID is required, and we don't have one, and
# it seems to work anyway.
SENDER_ID_EXCEPTION_COUNTRIES = %w[
AU
].to_set.freeze

CountrySupport = Struct.new(
:iso_code,
:name,
Expand Down Expand Up @@ -69,7 +75,7 @@ def sms_support
iso_code = sms_config['ISO code']
supports_sms = case trim_spaces(sms_config['Supports Sender IDs'])
when 'Registration required1'
SENDER_ID_COUNTRIES.include?(iso_code)
SENDER_ID_COUNTRIES.include?(iso_code) || SENDER_ID_EXCEPTION_COUNTRIES.include?(iso_code)
when 'Registration required3' # basically only India, has special rules
true
else
Expand Down
13 changes: 12 additions & 1 deletion spec/lib/pinpoint_supported_countries_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -150,11 +150,22 @@
stub_const('PinpointSupportedCountries::SENDER_ID_COUNTRIES', [])
end

it 'is supported' do
it 'is not supported' do
belarus = countries.sms_support.find { |c| c.iso_code == 'BY' }
expect(belarus.supports_sms).to eq(false)
end
end

context 'when we do not have a sender ID and the country is on our exceptions list' do
before do
stub_const('PinpointSupportedCountries::SENDER_ID_EXCEPTION_COUNTRIES', %w[BY])
end

it 'is supported' do
belarus = countries.sms_support.find { |c| c.iso_code == 'BY' }
expect(belarus.supports_sms).to eq(true)
end
end
end

describe '#voice_support' do
Expand Down