Skip to content

Commit

Permalink
[Bromley] Fix issue with renewal of expired sub.
Browse files Browse the repository at this point in the history
If someone renews their subscription whilst it is active, but then their
subscription expires during the time to get their direct debit set up,
then the renewal request is rejected because there is no active
subscription. If this happens, change the request to be a new
subscription request.
  • Loading branch information
dracos committed Nov 24, 2021
1 parent b5ed36e commit 954c40f
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
5 changes: 5 additions & 0 deletions perllib/FixMyStreet/Cobrand/Bromley.pm
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,11 @@ sub open311_post_send {
my ($self, $row, $h, $sender) = @_;
$row->detail($self->{bromley_original_detail});
my $error = $sender->error;
if ($error =~ /Cannot renew this property, a new request is required/ && $row->title eq "Garden Subscription - Renew") {
# Was created as a renewal, but due to DD delay has now expired. Switch to new subscription
$row->title("Garden Subscription - New");
$row->set_extra_metadata(Subscription_Type => $self->waste_subscription_types->{New});
}
if ($error =~ /Missed Collection event already open for the property/) {
$row->state('duplicate');
}
Expand Down
21 changes: 21 additions & 0 deletions t/cobrand/bromley.t
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,27 @@ subtest 'test waste duplicate' => sub {
is $report->state, 'duplicate', 'State updated';
};

subtest 'test DD taking so long it expires' => sub {
my $title = $report->title;
$report->update({ title => "Garden Subscription - Renew" });
my $sender = FixMyStreet::SendReport::Open311->new(
bodies => [ $body ], body_config => { $body->id => $body },
);
Open311->_inject_response('/requests.xml', '<?xml version="1.0" encoding="utf-8"?><errors><error><code></code><description>Cannot renew this property, a new request is required</description></error></errors>', 500);
FixMyStreet::override_config {
ALLOWED_COBRANDS => 'bromley',
}, sub {
$sender->send($report, {
easting => 1,
northing => 2,
url => 'http://example.org/',
});
};
is $report->get_extra_metadata("Subscription_Type"), 1, 'Type updated';
is $report->title, "Garden Subscription - New";
$report->update({ title => $title });
};

subtest 'Private comments on updates are added to open311 description' => sub {
FixMyStreet::override_config {
ALLOWED_COBRANDS => ['bromley', 'tfl'],
Expand Down

0 comments on commit 954c40f

Please sign in to comment.