Skip to content

Commit

Permalink
Merge pull request #699 from trade-tariff/HOTT-4070
Browse files Browse the repository at this point in the history
Alter for UKIMS users back dating commodities
  • Loading branch information
shjohnson committed Oct 12, 2023
2 parents d31358b + 8508001 commit 6831e03
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 31 deletions.
35 changes: 26 additions & 9 deletions app/helpers/ukims_helper.rb
Expand Up @@ -10,27 +10,44 @@ def market_scheme_type
end
end

def ukims_annual_turnover
def trader_scheme_header
if after_cut_off_date?
'£2,000,000'
'Are you authorised under the UK Internal Market Scheme - Online Tariff Duty calculator'
else
'£500,000'
'Were you authorised under the UK Trader Scheme (UKTS) or the UK Internal Market Scheme (UKIMS)'
end
end

def trader_scheme_body
if after_cut_off_date?
"If you are moving goods into Northern Ireland which are for sale to, or final use by, end consumers located in the UK and you are authorised under the UK Internal Market Scheme, then you may declare your goods as being 'not at risk' where the requirements are met. A 'not at risk' good entering Northern Ireland from Great Britain will not be subject to duty."
else
"If you were moving goods into Northern Ireland which are for sale to, or final use by, end consumers located in the UK and you were authorised under the UK Trader Scheme or the UK Internal Market Scheme, then you may declare your goods as being 'not at risk' where the requirements are met. A 'not at risk' good entering Northern Ireland from Great Britain will not be subject to duty.
Please note that UK Internal Market scheme trades cannot benefit from expanded processing rules before 30 September 2023. Trades before this date will use the UK Trader Scheme rules on processing"
end
end

def ukims_application_link
def trader_scheme_bullet_point_true
if after_cut_off_date?
'https://www.gov.uk/guidance/apply-for-authorisation-for-the-uk-internal-market-scheme-if-you-bring-goods-into-northern-ireland'
'Yes, I am authorised under the UK Internal Market Scheme'
else
'https://www.gov.uk/guidance/apply-for-authorisation-for-the-uk-trader-scheme-if-you-bring-goods-into-northern-ireland-from-1-january-2021'
'Yes, I was authorised under the UK Trader Scheme or UK Internal Market Scheme at the time of the trade'
end
end

def ukims_info_url
def trader_scheme_bullet_point_no
if after_cut_off_date?
'https://www.gov.uk/government/news/windsor-framework-unveiled-to-fix-problems-of-the-northern-ireland-protocol'
'No, I am not authorised under the UK Internal Market Scheme'
else
'https://www.gov.uk/guidance/apply-for-authorisation-for-the-uk-trader-scheme-if-you-bring-goods-into-northern-ireland'
'No, I was not authorised under the UK Trader Scheme or UK Internal Market Scheme at the time of the trade'
end
end

def ukims_annual_turnover
if after_cut_off_date?
'£2,000,000'
else
'£500,000'
end
end

Expand Down
4 changes: 2 additions & 2 deletions app/models/steps/trader_scheme.rb
Expand Up @@ -14,8 +14,8 @@ class TraderScheme < Steps::Base

def options
[
OpenStruct.new(id: 'yes', name: "Yes, I am authorised under the #{market_scheme_type}"),
OpenStruct.new(id: 'no', name: "No, I am not authorised under the #{market_scheme_type}"),
OpenStruct.new(id: 'yes', name: trader_scheme_bullet_point_true.to_s),
OpenStruct.new(id: 'no', name: trader_scheme_bullet_point_no.to_s),
].freeze
end

Expand Down
6 changes: 3 additions & 3 deletions app/views/steps/trader_scheme/show.html.erb
Expand Up @@ -5,20 +5,20 @@
<span class="govuk-caption-xl">Calculate import duties</span>


<%= f.govuk_collection_radio_buttons :trader_scheme, @step.options, :id, :name, legend: { text: "Are you authorised under the #{market_scheme_type}?", size: 'xl', tag: 'h1' }, hint: { text: "If you are moving goods into Northern Ireland which are for sale to, or final use by, end consumers located in the UK and you are authorised under the #{market_scheme_type}, then you may declare your goods as being 'not at risk' where the requirements are met. A 'not at risk' good entering Northern Ireland from Great Britain will not be subject to duty." }, include_hidden: true %>
<%= f.govuk_collection_radio_buttons :trader_scheme, @step.options, :id, :name, legend: { text: "#{trader_scheme_header}?", size: 'xl', tag: 'h1' }, hint: { text: "#{trader_scheme_body}" }, include_hidden: true %>
<%= f.govuk_submit %>
<% end %>

<p class='govuk-body'>If you are not yet authorised, then you can <%= link_to("find out more about applying for authorisation for the #{market_scheme_type}", ukims_application_link, class: 'govuk-link') %>.</p>
<p class='govuk-body'>If you are not yet authorised, then you can <%= link_to("find out more about applying for authorisation for the UK Internal Market Scheme", 'https://www.gov.uk/guidance/apply-for-authorisation-for-the-uk-internal-market-scheme-if-you-bring-goods-into-northern-ireland', class: 'govuk-link') %>.</p>

<%= render 'shared/commodity_details' %>

<div class="explore-topics-section">
<h2 class="govuk-heading-m govuk-!-margin-top-3"><%= explore_topic_title %></h2>
<ul class="govuk-list">
<li>
<%= link_to("Apply for authorisation for the #{market_scheme_type}", ukims_info_url, class: 'govuk-link') %>
<%= link_to("Apply for authorisation for the #{market_scheme_type}", 'https://www.gov.uk/government/news/windsor-framework-unveiled-to-fix-problems-of-the-northern-ireland-protocol', class: 'govuk-link') %>
</li>
</ul>
</div>
58 changes: 41 additions & 17 deletions spec/helpers/ukims_helper_spec.rb
Expand Up @@ -4,6 +4,8 @@
allow(helper).to receive(:user_session).and_return(user_session)
end

let(:import_date) { Date.new(2023, 9, 30).strftime('%Y-%m-%d') }

let(:user_session) do
build(
:user_session,
Expand All @@ -13,8 +15,6 @@

describe '#market_scheme_type' do
context 'when the import date is after the cut off' do
let(:import_date) { Date.new(2023, 9, 30).strftime('%Y-%m-%d') }

it 'returns the corect string when the import_date is after cut off date' do
expect(helper.market_scheme_type).to eq('UK Internal Market Scheme')
end
Expand All @@ -29,64 +29,88 @@
end
end

describe '#ukims_annual_turnover' do
describe '#trader_scheme_header' do
context 'when the import date is after the cut off' do
let(:import_date) { Date.new(2023, 9, 30).strftime('%Y-%m-%d') }

it 'returns the corect string when the import_date is after cut off date' do
expect(helper.ukims_annual_turnover).to eq('£2,000,000')
expect(helper.trader_scheme_header).to eq('Are you authorised under the UK Internal Market Scheme - Online Tariff Duty calculator')
end
end

context 'when the import date is before the cut off' do
let(:import_date) { Date.new(2023, 9, 29).strftime('%Y-%m-%d') }

it 'returns the corect string when the import_date is after cut off date' do
expect(helper.ukims_annual_turnover).to eq('£500,000')
expect(helper.trader_scheme_header).to eq('Were you authorised under the UK Trader Scheme (UKTS) or the UK Internal Market Scheme (UKIMS)')
end
end
end

describe '#ukims_application_link' do
describe '#trader_scheme_body' do
context 'when the import date is after the cut off' do
let(:import_date) { Date.new(2023, 9, 30).strftime('%Y-%m-%d') }
it 'returns the corect string when the import_date is after cut off date' do
expect(helper.trader_scheme_body).to include('or final use by, end consumers located in the UK and you are authorised under the UK Internal Market Scheme')
end
end

context 'when the import date is before the cut off' do
let(:import_date) { Date.new(2023, 9, 29).strftime('%Y-%m-%d') }

it 'returns the corect string when the import_date is after cut off date' do
expect(helper.trader_scheme_body).to include('or final use by, end consumers located in the UK and you were authorised under the UK Trader Scheme or the UK Internal Market Scheme')
end
end
end

describe '#trader_scheme_bullet_point_true' do
context 'when the import date is after the cut off' do
it 'returns the corect string when the import_date is after cut off date' do
expect(helper.ukims_application_link).to eq('https://www.gov.uk/guidance/apply-for-authorisation-for-the-uk-internal-market-scheme-if-you-bring-goods-into-northern-ireland')
expect(helper.trader_scheme_bullet_point_true).to eq('Yes, I am authorised under the UK Internal Market Scheme')
end
end

context 'when the import date is before the cut off' do
let(:import_date) { Date.new(2023, 9, 29).strftime('%Y-%m-%d') }

it 'returns the corect string when the import_date is after cut off date' do
expect(helper.ukims_application_link).to eq('https://www.gov.uk/guidance/apply-for-authorisation-for-the-uk-trader-scheme-if-you-bring-goods-into-northern-ireland-from-1-january-2021')
expect(helper.trader_scheme_bullet_point_true).to eq('Yes, I was authorised under the UK Trader Scheme or UK Internal Market Scheme at the time of the trade')
end
end
end

describe '#ukims_info_url' do
describe '#trader_scheme_bullet_point_no' do
context 'when the import date is after the cut off' do
let(:import_date) { Date.new(2023, 9, 30).strftime('%Y-%m-%d') }
it 'returns the corect string when the import_date is after cut off date' do
expect(helper.trader_scheme_bullet_point_no).to eq('No, I am not authorised under the UK Internal Market Scheme')
end
end

context 'when the import date is before the cut off' do
let(:import_date) { Date.new(2023, 9, 29).strftime('%Y-%m-%d') }

it 'returns the corect string when the import_date is after cut off date' do
expect(helper.ukims_info_url).to eq('https://www.gov.uk/government/news/windsor-framework-unveiled-to-fix-problems-of-the-northern-ireland-protocol')
expect(helper.trader_scheme_bullet_point_no).to eq('No, I was not authorised under the UK Trader Scheme or UK Internal Market Scheme at the time of the trade')
end
end
end

describe '#ukims_annual_turnover' do
context 'when the import date is after the cut off' do
it 'returns the corect string when the import_date is after cut off date' do
expect(helper.ukims_annual_turnover).to eq('£2,000,000')
end
end

context 'when the import date is before the cut off' do
let(:import_date) { Date.new(2023, 9, 29).strftime('%Y-%m-%d') }

it 'returns the corect string when the import_date is after cut off date' do
expect(helper.ukims_info_url).to eq('https://www.gov.uk/guidance/apply-for-authorisation-for-the-uk-trader-scheme-if-you-bring-goods-into-northern-ireland')
expect(helper.ukims_annual_turnover).to eq('£500,000')
end
end
end

describe '#explore_topic_title' do
context 'when the import date is after the cut off' do
let(:import_date) { Date.new(2023, 9, 30).strftime('%Y-%m-%d') }

it 'returns the corect string when the import_date is after cut off date' do
expect(helper.explore_topic_title).to eq('Find out more about the Windsor Framework')
end
Expand Down

0 comments on commit 6831e03

Please sign in to comment.