diff --git a/app/services/exports/organisation_export_constants.rb b/app/services/exports/organisation_export_constants.rb index 8b3ad741e..a7ab2182a 100644 --- a/app/services/exports/organisation_export_constants.rb +++ b/app/services/exports/organisation_export_constants.rb @@ -17,6 +17,9 @@ module Exports::OrganisationExportConstants "merge_date", "absorbing_organisation_id", "available_from", - "discarded_at", + "deleted_at", + "dsa_signed", + "dsa_signed_at", + "dpo_email" ] end diff --git a/app/services/exports/organisation_export_service.rb b/app/services/exports/organisation_export_service.rb index 0f1da1cae..60fa7fcbe 100644 --- a/app/services/exports/organisation_export_service.rb +++ b/app/services/exports/organisation_export_service.rb @@ -57,7 +57,13 @@ module Exports end def apply_cds_transformation(organisation) - organisation.attributes + attribute_hash = organisation.attributes + attribute_hash["deleted_at"] = organisation.discarded_at + attribute_hash["dsa_signed"] = organisation.data_protection_confirmed? + attribute_hash["dsa_signed_at"] = organisation.data_protection_confirmation&.signed_at + attribute_hash["dpo_email"] = organisation.data_protection_confirmation&.data_protection_officer_email + + attribute_hash end end end diff --git a/spec/fixtures/exports/organisation.xml b/spec/fixtures/exports/organisation.xml index be926039c..ed4e02039 100644 --- a/spec/fixtures/exports/organisation.xml +++ b/spec/fixtures/exports/organisation.xml @@ -16,6 +16,9 @@ - + + true + {dsa_signed_at} + {dpo_email} diff --git a/spec/services/exports/organisation_export_service_spec.rb b/spec/services/exports/organisation_export_service_spec.rb index a5cf2ab58..4474dfbdf 100644 --- a/spec/services/exports/organisation_export_service_spec.rb +++ b/spec/services/exports/organisation_export_service_spec.rb @@ -16,6 +16,8 @@ RSpec.describe Exports::OrganisationExportService do def replace_entity_ids(organisation, export_template) export_template.sub!(/\{id\}/, organisation["id"].to_s) + export_template.sub!(/\{dsa_signed_at\}/, organisation.data_protection_confirmation&.signed_at.to_s) + export_template.sub!(/\{dpo_email\}/, organisation.data_protection_confirmation&.data_protection_officer_email) end def replace_record_number(export_template, record_number)