Skip to content

Commit

Permalink
[Bexley][WW] Include location_of_letterbox in Whitespace worksheets
Browse files Browse the repository at this point in the history
  • Loading branch information
nephila-nacrea committed Nov 27, 2024
1 parent 765ff93 commit b269a31
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 3 deletions.
6 changes: 6 additions & 0 deletions perllib/Integrations/Whitespace.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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},
),
},
],
);

Expand Down
10 changes: 8 additions & 2 deletions perllib/Open311/Endpoint/Integration/UK/Bexley/Whitespace.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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;
2 changes: 2 additions & 0 deletions perllib/Open311/Endpoint/Integration/Whitespace.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand All @@ -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},
});

Expand Down
7 changes: 7 additions & 0 deletions perllib/Open311/Endpoint/Service/UKCouncil/Whitespace.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
3 changes: 2 additions & 1 deletion t/open311/endpoint/whitespace.t
Original file line number Diff line number Diff line change
Expand Up @@ -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';
};
Expand Down

0 comments on commit b269a31

Please sign in to comment.