From b269a3147840fdb203d185824adff1d990b78a8e Mon Sep 17 00:00:00 2001 From: Victoria Mihell-Hale Date: Wed, 13 Nov 2024 10:48:07 +0000 Subject: [PATCH] [Bexley][WW] Include location_of_letterbox in Whitespace worksheets --- perllib/Integrations/Whitespace.pm | 6 ++++++ .../Endpoint/Integration/UK/Bexley/Whitespace.pm | 10 ++++++++-- perllib/Open311/Endpoint/Integration/Whitespace.pm | 2 ++ .../Open311/Endpoint/Service/UKCouncil/Whitespace.pm | 7 +++++++ t/open311/endpoint/whitespace.t | 3 ++- 5 files changed, 25 insertions(+), 3 deletions(-) diff --git a/perllib/Integrations/Whitespace.pm b/perllib/Integrations/Whitespace.pm index 817521313..f3df94a07 100644 --- a/perllib/Integrations/Whitespace.pm +++ b/perllib/Integrations/Whitespace.pm @@ -133,6 +133,12 @@ sub CreateWorksheet { 'wsap:ServicePropertyValue' => $params->{location_of_containers}, ), }, + { + 'wsap:Input.CreateWorksheetInput.ServicePropertyInput' => ixhash( + 'wsap:ServicePropertyId' => 82, + 'wsap:ServicePropertyValue' => $params->{location_of_letterbox}, + ), + }, ], ); diff --git a/perllib/Open311/Endpoint/Integration/UK/Bexley/Whitespace.pm b/perllib/Open311/Endpoint/Integration/UK/Bexley/Whitespace.pm index 20a7b785d..ad587de5f 100644 --- a/perllib/Open311/Endpoint/Integration/UK/Bexley/Whitespace.pm +++ b/perllib/Open311/Endpoint/Integration/UK/Bexley/Whitespace.pm @@ -12,8 +12,14 @@ around BUILDARGS => sub { sub _worksheet_message { my ($self, $args) = @_; - return "Assisted collection? $args->{attributes}->{assisted_yn}\n\n" . - "Location of containers: $args->{attributes}->{location_of_containers}\n"; + my $msg = "Assisted collection? $args->{attributes}->{assisted_yn}\n\n" + . "Location of containers: $args->{attributes}->{location_of_containers}\n"; + + $msg + .= "\nLocation of letterbox: $args->{attributes}->{location_of_letterbox}\n" + if $args->{attributes}->{location_of_letterbox}; + + return $msg; } __PACKAGE__->run_if_script; diff --git a/perllib/Open311/Endpoint/Integration/Whitespace.pm b/perllib/Open311/Endpoint/Integration/Whitespace.pm index 54db69acb..7eb2864f8 100644 --- a/perllib/Open311/Endpoint/Integration/Whitespace.pm +++ b/perllib/Open311/Endpoint/Integration/Whitespace.pm @@ -79,6 +79,7 @@ sub post_service_request { my $integration = $self->get_integration; $args->{attributes}{location_of_containers} //= ''; + $args->{attributes}{location_of_letterbox} //= ''; $args->{attributes}{quantity} ||= 1; my $worksheet_id = $integration->CreateWorksheet({ @@ -89,6 +90,7 @@ sub post_service_request { worksheet_message => $self->_worksheet_message($args), assisted_yn => $args->{attributes}->{assisted_yn}, location_of_containers => $args->{attributes}->{location_of_containers}, + location_of_letterbox => $args->{attributes}->{location_of_letterbox}, quantity => $args->{attributes}->{quantity}, }); diff --git a/perllib/Open311/Endpoint/Service/UKCouncil/Whitespace.pm b/perllib/Open311/Endpoint/Service/UKCouncil/Whitespace.pm index 3ebf1e5fc..fe1f10833 100644 --- a/perllib/Open311/Endpoint/Service/UKCouncil/Whitespace.pm +++ b/perllib/Open311/Endpoint/Service/UKCouncil/Whitespace.pm @@ -46,6 +46,13 @@ sub _build_attributes { required => 0, automated => 'hidden_field', ), + Open311::Endpoint::Service::Attribute->new( + code => 'location_of_letterbox', + description => 'Location of letterbox', + datatype => 'string', + required => 0, + automated => 'hidden_field', + ), Open311::Endpoint::Service::Attribute->new( code => 'quantity', description => 'Number of containers', diff --git a/t/open311/endpoint/whitespace.t b/t/open311/endpoint/whitespace.t index 4ddb29372..6588c4cc3 100644 --- a/t/open311/endpoint/whitespace.t +++ b/t/open311/endpoint/whitespace.t @@ -109,7 +109,8 @@ subtest "GET service" => sub { { code => 'fixmystreet_id', order => 3, required => 'true', variable => 'false', datatype => 'string', datatype_description => '', automated => 'server_set', description => 'external system ID' }, { code => 'assisted_yn', order => 4, required => 'false', variable => 'true', datatype => 'string', datatype_description => '', automated => 'hidden_field', description => 'Assisted collection (Yes/No)' }, { code => 'location_of_containers', order => 5, required => 'false', variable => 'true', datatype => 'string', datatype_description => '', automated => 'hidden_field', description => 'Location of containers' }, - { code => 'quantity', order => 6, required => 'false', variable => 'true', datatype => 'string', datatype_description => '', automated => 'hidden_field', description => 'Number of containers' }, + { code => 'location_of_letterbox', order => 6, required => 'false', variable => 'true', datatype => 'string', datatype_description => '', automated => 'hidden_field', description => 'Location of letterbox' }, + { code => 'quantity', order => 7, required => 'false', variable => 'true', datatype => 'string', datatype_description => '', automated => 'hidden_field', description => 'Number of containers' }, ], }, 'correct json returned'; };