Skip to content

Commit

Permalink
[Bexley][Whitespace] Use custom message for worksheet
Browse files Browse the repository at this point in the history
Instead of passing through the FMS description Bexley want to have
details about whether a property is assisted and the location of the
containers in the message that goes to Whitespace.
  • Loading branch information
chrismytton committed Apr 11, 2024
1 parent 512defc commit 8098990
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
7 changes: 7 additions & 0 deletions perllib/Open311/Endpoint/Integration/UK/Bexley/Whitespace.pm
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,11 @@ around BUILDARGS => sub {
return $class->$orig(%args);
};

sub _worksheet_message {
my ($self, $args) = @_;

return "Assisted collection? $args->{attributes}->{assisted_yn}\n\n" .
"Location of containers: $args->{attributes}->{location_of_containers}\n";
}

__PACKAGE__->run_if_script;
8 changes: 7 additions & 1 deletion perllib/Open311/Endpoint/Integration/Whitespace.pm
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ sub post_service_request {
uprn => $args->{attributes}->{uprn},
service_item_name => $args->{attributes}->{service_item_name},
worksheet_reference => $args->{attributes}->{fixmystreet_id},
worksheet_message => $args->{description},
worksheet_message => $self->_worksheet_message($args),
assisted_yn => $args->{attributes}->{assisted_yn},
location_of_containers => $args->{attributes}->{location_of_containers},
});
Expand All @@ -94,4 +94,10 @@ sub post_service_request {
return $request;
}

sub _worksheet_message {
my ($self, $args) = @_;

return $args->{description};
}

1;
9 changes: 8 additions & 1 deletion t/open311/endpoint/whitespace.t
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@ around BUILDARGS => sub {
};
has integration_class => (is => 'ro', default => 'Integrations::Whitespace::Dummy');

sub _worksheet_message {
my ($self, $args) = @_;

return "Assisted collection? $args->{attributes}->{assisted_yn}\n\n" .
"Location of containers: $args->{attributes}->{location_of_containers}\n";
}

package main;

use strict;
Expand Down Expand Up @@ -50,7 +57,7 @@ $soap_lite->mock(call => sub {
is $params{Uprn}, 1000001, 'Uprn correct';
is $params{ServiceId}, '289', 'ServiceId correct';
is $params{WorksheetReference}, 2000123, 'WorksheetReference correct';
is $params{WorksheetMessage}, 'This is the details', 'Description correct';
is $params{WorksheetMessage}, "Assisted collection? No\n\nLocation of containers: Front of property\n", 'WorksheetMessage correct';

my %service_property_inputs = map { $_->value } map { ${$_->value}->value } ${$params{ServicePropertyInputs}}->value->value;
is $service_property_inputs{'79'}, 'No', 'AssistedYn correct';
Expand Down

0 comments on commit 8098990

Please sign in to comment.