aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--perllib/FixMyStreet/Cobrand/Bromley.pm11
-rw-r--r--perllib/Integrations/Echo.pm2
-rw-r--r--t/cobrand/bromley.t9
3 files changed, 20 insertions, 2 deletions
diff --git a/perllib/FixMyStreet/Cobrand/Bromley.pm b/perllib/FixMyStreet/Cobrand/Bromley.pm
index 8175138ed..c984f1728 100644
--- a/perllib/FixMyStreet/Cobrand/Bromley.pm
+++ b/perllib/FixMyStreet/Cobrand/Bromley.pm
@@ -571,7 +571,16 @@ sub bin_services_for_address {
my $ref = join(',', @{$_->{Ref}{Value}{anyType}});
my $completed = construct_bin_date($_->{CompletedDate});
my $state = $_->{State}{Name} || '';
+
my $resolution = $_->{Resolution}{Name} || '';
+ my $resolution_id = $_->{Resolution}{Ref}{Value}{anyType};
+ if ($resolution_id) {
+ my $template = FixMyStreet::DB->resultset('ResponseTemplate')->search({
+ 'me.body_id' => $self->body->id,
+ 'me.external_status_code' => $resolution_id,
+ })->first;
+ $resolution = $template->text if $template;
+ }
my $row = $task_ref_to_row{$ref};
$row->{last}{state} = $state;
@@ -581,7 +590,7 @@ sub bin_services_for_address {
if (!$completed && $row->{last}{date}->ymd eq $now->ymd) {
$row->{report_allowed} = 0;
}
- if ($state eq 'Not Completed' || ($state eq 'Completed' && $resolution eq 'Excess Waste')) {
+ if ($state eq 'Not Completed' || ($state eq 'Completed' && $_->{Resolution}{Name} eq 'Excess Waste')) {
$row->{report_allowed} = 0;
$row->{report_locked_out} = 1;
}
diff --git a/perllib/Integrations/Echo.pm b/perllib/Integrations/Echo.pm
index d8608708e..5878cdfa1 100644
--- a/perllib/Integrations/Echo.pm
+++ b/perllib/Integrations/Echo.pm
@@ -93,7 +93,7 @@ sub GetTasks {
{
Ref => { Value => { anyType => [ 123, 456 ] } },
State => { Name => 'Completed' },
- Resolution => { Name => 'Wrong Bin Out' },
+ Resolution => { Ref => { Value => { anyType => 187 } }, Name => 'Wrong Bin Out' },
CompletedDate => { DateTime => '2020-05-27T10:00:00Z' }
},
{
diff --git a/t/cobrand/bromley.t b/t/cobrand/bromley.t
index dfd7cce1d..8b2285458 100644
--- a/t/cobrand/bromley.t
+++ b/t/cobrand/bromley.t
@@ -290,6 +290,15 @@ FixMyStreet::override_config {
$mech->get_ok('/waste/uprn/12345');
$mech->content_contains('(completed at 10:00am)');
$mech->content_contains('Wrong Bin Out');
+ FixMyStreet::DB->resultset('ResponseTemplate')->create({
+ body_id => $body->id,
+ title => 'Wrong bin',
+ text => 'We could not collect your waste as it was not correctly presented.',
+ external_status_code => 187,
+ });
+ $mech->get_ok('/waste/uprn/12345');
+ $mech->content_contains('(completed at 10:00am)');
+ $mech->content_contains('We could not collect your waste as it was not correctly presented.');
$mech->content_lacks('Report a paper & cardboard collection');
$mech->content_contains('Report a refuse collection');
set_fixed_time('2020-05-28T12:00:00Z');