Skip to content

Commit daa6fa5

Browse files
committed
Merge pull request #2434 from alphagov/extract-marriage-abroad-service-data
Extract marriage-abroad service data
2 parents 6bc0866 + 296e21c commit daa6fa5

File tree

30 files changed

+1906
-343
lines changed

30 files changed

+1906
-343
lines changed

lib/data/marriage_abroad_services.yml

+1,655
Large diffs are not rendered by default.

lib/smart_answer/calculators/marriage_abroad_calculator.rb

+49-1
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,13 @@ class MarriageAbroadCalculator
66
attr_writer :sex_of_your_partner
77
attr_writer :marriage_or_pacs
88

9-
def initialize(data_query: nil, rates_query: nil, country_name_formatter: nil, registrations_data_query: nil)
9+
def initialize(data_query: nil, rates_query: nil, country_name_formatter: nil, registrations_data_query: nil, services_data: nil)
1010
@data_query = data_query || MarriageAbroadDataQuery.new
1111
@rates_query = rates_query || RatesQuery.from_file('marriage_abroad_consular_fees')
1212
@country_name_formatter = country_name_formatter || CountryNameFormatter.new
1313
@registrations_data_query = registrations_data_query || RegistrationsDataQuery.new
14+
services_data_file = Rails.root.join('lib', 'data', 'marriage_abroad_services.yml')
15+
@services_data = services_data || YAML.load_file(services_data_file)
1416
end
1517

1618
def partner_british?
@@ -265,8 +267,54 @@ def consular_fee(service)
265267
@rates_query.rates[service]
266268
end
267269

270+
def services
271+
if services_for_country_and_partner_sex_and_residency_and_partner_nationality?
272+
@services_data[ceremony_country][@sex_of_your_partner][@resident_of][@partner_nationality]
273+
elsif services_for_country_and_partner_sex_and_default_residency_and_partner_nationality?
274+
@services_data[ceremony_country][@sex_of_your_partner]['default'][@partner_nationality]
275+
elsif services_for_country_and_partner_sex_and_residency_and_default_partner_nationality?
276+
@services_data[ceremony_country][@sex_of_your_partner][@resident_of]['default']
277+
elsif services_for_country_and_partner_sex_and_default_residency_and_default_nationality?
278+
@services_data[ceremony_country][@sex_of_your_partner]['default']['default']
279+
else
280+
[]
281+
end
282+
end
283+
268284
private
269285

286+
def services_for_country_and_partner_sex_and_residency_and_partner_nationality?
287+
services_data_for_country_and_partner_sex_and_residency? &&
288+
@services_data[ceremony_country][@sex_of_your_partner][@resident_of].has_key?(@partner_nationality)
289+
end
290+
291+
def services_for_country_and_partner_sex_and_default_residency_and_partner_nationality?
292+
services_data_for_country_and_partner_sex? &&
293+
@services_data[ceremony_country][@sex_of_your_partner].has_key?('default') &&
294+
@services_data[ceremony_country][@sex_of_your_partner]['default'].has_key?(@partner_nationality)
295+
end
296+
297+
def services_for_country_and_partner_sex_and_residency_and_default_partner_nationality?
298+
services_data_for_country_and_partner_sex_and_residency? &&
299+
@services_data[ceremony_country][@sex_of_your_partner][@resident_of].has_key?('default')
300+
end
301+
302+
def services_for_country_and_partner_sex_and_default_residency_and_default_nationality?
303+
services_data_for_country_and_partner_sex? &&
304+
@services_data[ceremony_country][@sex_of_your_partner].has_key?('default') &&
305+
@services_data[ceremony_country][@sex_of_your_partner]['default'].has_key?('default')
306+
end
307+
308+
def services_data_for_country_and_partner_sex_and_residency?
309+
services_data_for_country_and_partner_sex? &&
310+
@services_data[ceremony_country][@sex_of_your_partner].has_key?(@resident_of)
311+
end
312+
313+
def services_data_for_country_and_partner_sex?
314+
@services_data.has_key?(ceremony_country) &&
315+
@services_data[ceremony_country].has_key?(@sex_of_your_partner)
316+
end
317+
270318
def outcome_path_when_resident_in(uk_or_ceremony_country)
271319
[
272320
'', 'marriage-abroad', 'y',

lib/smart_answer_flows/marriage-abroad/outcomes/_consular_fees_table.govspeak.erb

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
Service | Fee
44
-|-
55
<%= render partial: 'consular_fees_table_items.govspeak.erb',
6-
collection: services,
6+
collection: calculator.services,
77
as: :service,
88
locals: { calculator: calculator } %>

lib/smart_answer_flows/marriage-abroad/outcomes/os_affirmation/_fees.govspeak.erb

+2-87
Original file line numberDiff line numberDiff line change
@@ -1,92 +1,7 @@
1-
<% if %w(south-korea thailand turkey vietnam).include?(calculator.ceremony_country) %>
2-
<%= render partial: 'consular_fees_table.govspeak.erb',
3-
locals: {
4-
calculator: calculator,
5-
services: [
6-
:affidavit_for_marriage,
7-
]
8-
} %>
1+
<%= render partial: 'consular_fees_table.govspeak.erb',
2+
locals: { calculator: calculator } %>
93

10-
<% elsif %w(belgium ecuador macao morocco norway).include?(calculator.ceremony_country) %>
11-
<%= render partial: 'consular_fees_table.govspeak.erb',
12-
locals: {
13-
calculator: calculator,
14-
services: [
15-
:affidavit_or_affirmation_for_marriage,
16-
]
17-
} %>
18-
<% elsif calculator.ceremony_country == 'finland' %>
19-
<%= render partial: 'consular_fees_table.govspeak.erb',
20-
locals: {
21-
calculator: calculator,
22-
services: [
23-
:affirmation_for_marriage,
24-
]
25-
} %>
264

27-
<% elsif %w(philippines united-arab-emirates).include?(calculator.ceremony_country) %>
28-
<%= render partial: 'consular_fees_table.govspeak.erb',
29-
locals: {
30-
calculator: calculator,
31-
services: [
32-
:affirmation_for_freedom_to_marry_in_english,
33-
:affirmation_for_freedom_to_marry_in_other_language,
34-
]
35-
} %>
36-
37-
38-
<% elsif calculator.ceremony_country == 'qatar' %>
39-
<%= render partial: 'consular_fees_table.govspeak.erb',
40-
locals: {
41-
calculator: calculator,
42-
services: [
43-
:issuing_letter_or_certificate_english,
44-
:issuing_letter_or_certificate_other_language,
45-
:affidavit_for_marriage,
46-
]
47-
} %>
48-
49-
<% elsif calculator.ceremony_country == 'egypt' %>
50-
<%= render partial: 'consular_fees_table.govspeak.erb',
51-
locals: {
52-
calculator: calculator,
53-
services: [
54-
:marriage_declaration,
55-
:making_an_oath,
56-
]
57-
} %>
58-
59-
60-
<% elsif calculator.ceremony_country == 'china' %>
61-
<%= render partial: 'consular_fees_table.govspeak.erb',
62-
locals: {
63-
calculator: calculator,
64-
services: [
65-
:affirmation_for_freedom_to_marry_in_english_and_chinese,
66-
]
67-
} %>
68-
69-
<% elsif calculator.ceremony_country == 'peru' %>
70-
<%= render partial: 'consular_fees_table.govspeak.erb',
71-
locals: {
72-
calculator: calculator,
73-
services: [
74-
:affirmation_or_affidavit_for_freedom_to_marry,
75-
]
76-
} %>
77-
78-
<% else %>
79-
<%= render partial: 'consular_fees_table.govspeak.erb',
80-
locals: {
81-
calculator: calculator,
82-
services: [
83-
:affirmation_for_freedom_to_marry_in_english,
84-
:affirmation_for_freedom_to_marry_in_other_language,
85-
]
86-
} %>
87-
88-
89-
<% end %>
905
<% unless calculator.country_without_consular_facilities? %>
916
<% if calculator.ceremony_country == 'vietnam' %>
927
<%= render partial: 'consular_fees_in_cash_visa_master.govspeak.erb',

lib/smart_answer_flows/marriage-abroad/outcomes/outcome_ceremonies_in_dominican_republic.govspeak.erb

+1-8
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,7 @@
5454
<%= render partial: 'partner_naturalisation_in_uk.govspeak.erb' %>
5555

5656
<%= render partial: 'consular_fees_table.govspeak.erb',
57-
locals: {
58-
calculator: calculator,
59-
services: [
60-
:receiving_notice_of_registration,
61-
:registering_marriage,
62-
:issuing_marriage_certificate,
63-
]
64-
} %>
57+
locals: { calculator: calculator } %>
6558
<%= render partial: 'link_to_consular_fees.govspeak.erb',
6659
locals: { calculator: calculator } %>
6760

lib/smart_answer_flows/marriage-abroad/outcomes/outcome_ceremonies_in_spain.govspeak.erb

+1-10
Original file line numberDiff line numberDiff line change
@@ -136,16 +136,7 @@
136136
<% end %>
137137

138138
<%= render partial: 'consular_fees_table.govspeak.erb',
139-
locals: {
140-
calculator: calculator,
141-
services: [
142-
:receiving_notice_of_marriage,
143-
:issuing_cni_or_nulla_osta,
144-
:issuing_letter_or_certificate_english,
145-
:issuing_letter_or_certificate_other_language,
146-
:administering_oath_or_making_declaration,
147-
]
148-
} %>
139+
locals: { calculator: calculator } %>
149140
<%= render partial: 'link_to_consular_fees.govspeak.erb',
150141
locals: { calculator: calculator } %>
151142
<%= render partial: 'pay_by_visas_or_mastercard.govspeak.erb' %>

lib/smart_answer_flows/marriage-abroad/outcomes/outcome_opposite_sex_marriage_in_belarus.govspeak.erb

+1-6
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,7 @@
3939
<%= render partial: 'partner_probably_needs_affirmation.govspeak.erb' %>
4040

4141
<%= render partial: 'consular_fees_table.govspeak.erb',
42-
locals: {
43-
calculator: calculator,
44-
services: [
45-
:administering_oath_or_making_declaration,
46-
]
47-
} %>
42+
locals: { calculator: calculator } %>
4843

4944
<%= render partial: 'link_to_consular_fees.govspeak.erb',
5045
locals: { calculator: calculator } %>

lib/smart_answer_flows/marriage-abroad/outcomes/outcome_opposite_sex_marriage_in_cambodia.govspeak.erb

+1-6
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,7 @@
5252
You’ll need to take the approval letters to your local Sangkat for the marriage registration.
5353

5454
<%= render partial: 'consular_fees_table.govspeak.erb',
55-
locals: {
56-
calculator: calculator,
57-
services: [
58-
:affidavit_or_affirmation_for_marriage,
59-
]
60-
} %>
55+
locals: { calculator: calculator } %>
6156

6257
<%= render partial: 'pay_by_cash_or_us_dollars_only.govspeak.erb' %>
6358

lib/smart_answer_flows/marriage-abroad/outcomes/outcome_opposite_sex_marriage_in_consular_cni_countries_when_residing_in_uk_or_ceremony_country.govspeak.erb

+2-28
Original file line numberDiff line numberDiff line change
@@ -418,35 +418,9 @@
418418
You may be asked to provide a copy of your birth certificate. Make sure you send a [certified copy](/order-copy-birth-death-marriage-certificate) as you won’t get it back.
419419
<% end %>
420420

421-
<% if calculator.ceremony_country == 'croatia' && calculator.resident_of_ceremony_country? %>
422-
<%= render partial: 'consular_fees_table.govspeak.erb',
423-
locals: {
424-
calculator: calculator,
425-
services: [
426-
:receiving_notice_of_marriage,
427-
:issuing_cni_or_nulla_osta,
428-
:issuing_letter_or_certificate_english,
429-
:issuing_letter_or_certificate_other_language,
430-
:administering_oath_or_making_declaration,
431-
:issuing_custom_and_law_certificate,
432-
]
433-
} %>
434-
421+
<%= render partial: 'consular_fees_table.govspeak.erb',
422+
locals: { calculator: calculator } %>
435423

436-
<% else %>
437-
<%= render partial: 'consular_fees_table.govspeak.erb',
438-
locals: {
439-
calculator: calculator,
440-
services: [
441-
:receiving_notice_of_marriage,
442-
:issuing_cni_or_nulla_osta,
443-
:issuing_letter_or_certificate_english,
444-
:issuing_letter_or_certificate_other_language,
445-
:administering_oath_or_making_declaration,
446-
]
447-
} %>
448-
449-
<% end %>
450424
<% unless calculator.country_without_consular_facilities? || calculator.ceremony_country == 'cote-d-ivoire' %>
451425
<% if %w(kazakhstan kyrgyzstan).include?(calculator.ceremony_country) %>
452426
You normally have to pay fees for consular services in the local currency - these are shown in the list of [consular fees for Kazakhstan](/government/publications/kazakhstan-kyrgyzstan-consular-fees).

lib/smart_answer_flows/marriage-abroad/outcomes/outcome_opposite_sex_marriage_in_germany.govspeak.erb

+1-9
Original file line numberDiff line numberDiff line change
@@ -66,15 +66,7 @@
6666
<% end %>
6767

6868
<%= render partial: 'consular_fees_table.govspeak.erb',
69-
locals: {
70-
calculator: calculator,
71-
services: [
72-
:receiving_notice_of_marriage,
73-
:issuing_letter_or_certificate_english,
74-
:issuing_letter_or_certificate_other_language,
75-
:administering_oath_or_making_declaration,
76-
]
77-
} %>
69+
locals: { calculator: calculator } %>
7870
<%= render partial: 'link_to_consular_fees.govspeak.erb',
7971
locals: { calculator: calculator } %>
8072
<%= render partial: 'pay_by_cash_or_credit_card_no_cheque.govspeak.erb' %>

lib/smart_answer_flows/marriage-abroad/outcomes/outcome_opposite_sex_marriage_in_indonesia.govspeak.erb

+1-6
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,5 @@
3838
- evidence if you’ve changed your name by deed poll
3939

4040
<%= render partial: 'consular_fees_table.govspeak.erb',
41-
locals: {
42-
calculator: calculator,
43-
services: [
44-
:affidavit_or_affirmation_for_marriage,
45-
]
46-
} %>
41+
locals: { calculator: calculator } %>
4742
<% end %>

lib/smart_answer_flows/marriage-abroad/outcomes/outcome_opposite_sex_marriage_in_italy_when_residing_in_uk_or_italy.govspeak.erb

+1-7
Original file line numberDiff line numberDiff line change
@@ -108,13 +108,7 @@
108108
<% end %>
109109
<% if calculator.resident_of_ceremony_country? %>
110110
<%= render partial: 'consular_fees_table.govspeak.erb',
111-
locals: {
112-
calculator: calculator,
113-
services: [
114-
:receiving_notice_of_marriage,
115-
:issuing_cni_or_nulla_osta,
116-
]
117-
} %>
111+
locals: { calculator: calculator } %>
118112

119113

120114
<%= render partial: 'link_to_consular_fees.govspeak.erb',

lib/smart_answer_flows/marriage-abroad/outcomes/outcome_opposite_sex_marriage_in_japan.govspeak.erb

+1-6
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,7 @@
4848

4949

5050
<%= render partial: 'consular_fees_table.govspeak.erb',
51-
locals: {
52-
calculator: calculator,
53-
services: [
54-
:administering_oath_or_making_declaration,
55-
]
56-
} %>
51+
locals: { calculator: calculator } %>
5752

5853

5954
<%= render partial: 'link_to_consular_fees.govspeak.erb',

lib/smart_answer_flows/marriage-abroad/outcomes/outcome_opposite_sex_marriage_in_kosovo_when_residing_in_uk_or_kosovo.govspeak.erb

+2-20
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,7 @@
2929
%The names on all documents you provide must appear exactly as they do on your passports - if not, the authorities may refuse to allow the marriage to go ahead. You may need to provide evidence if the name on your passport is different to your birth certificate (eg marriage certificate or deed poll).%
3030

3131
<%= render partial: 'consular_fees_table.govspeak.erb',
32-
locals: {
33-
calculator: calculator,
34-
services: [
35-
:receiving_notice_of_marriage,
36-
:issuing_cni_or_nulla_osta,
37-
:issuing_letter_or_certificate_english,
38-
:issuing_letter_or_certificate_other_language,
39-
:administering_oath_or_making_declaration,
40-
]
41-
} %>
32+
locals: { calculator: calculator } %>
4233

4334

4435
You normally have to pay fees for consular services in the local currency - these are shown in the list of [consular fees for <%= calculator.country_name_lowercase_prefix %>](/government/publications/<%= calculator.ceremony_country %>-consular-fees).
@@ -102,16 +93,7 @@
10293
Your partner can apply to [become a British citizen](/becoming-a-british-citizen/if-your-spouse-is-a-british-citizen) once they’ve lived in the UK for 3 years.
10394

10495
<%= render partial: 'consular_fees_table.govspeak.erb',
105-
locals: {
106-
calculator: calculator,
107-
services: [
108-
:receiving_notice_of_marriage,
109-
:issuing_cni_or_nulla_osta,
110-
:issuing_letter_or_certificate_english,
111-
:issuing_letter_or_certificate_other_language,
112-
:administering_oath_or_making_declaration,
113-
]
114-
} %>
96+
locals: { calculator: calculator } %>
11597

11698
You normally have to pay fees for consular services in the local currency - these are shown in the list of [consular fees for <%= calculator.country_name_lowercase_prefix %>](/government/publications/<%= calculator.ceremony_country %>-consular-fees).
11799

0 commit comments

Comments
 (0)