Skip to content

Commit

Permalink
fixup! fixup! [Merton][WW] Allow transfer of ggw subscription
Browse files Browse the repository at this point in the history
  • Loading branch information
MorayMySoc committed Oct 31, 2024
1 parent ea27997 commit 8492c7d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
1 change: 1 addition & 0 deletions perllib/FixMyStreet/App/Form/Waste/Garden/Transfer.pm
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ has_field addresses => (
my $data = $c->cobrand->call_hook('check_ggw_transfer_applicable' => $self->value);
if ($data->{error}) {
$self->add_error($messages{ $data->{error} });
return;
};
$self->form->saved_data->{transfer_old_ggw_sub} = $data;
($self->form->saved_data->{previous_ggw_address}) = (grep { $_->{value} == $self->value } @{$self->form->saved_data->{addresses}})[0];
Expand Down
11 changes: 8 additions & 3 deletions perllib/FixMyStreet/Cobrand/Merton/Waste.pm
Original file line number Diff line number Diff line change
Expand Up @@ -398,9 +398,14 @@ sub check_ggw_transfer_applicable {
return { error => 'due_soon' } if ($subscription_enddate && $self->waste_sub_due($subscription_enddate));

my $old_subscription_bin_data = Integrations::Echo::force_arrayref($servicetask->{Data}, 'ExtensibleDatum');
my ($bin_number) = grep { $_->{DatatypeName} eq 'Quantity'} @{$old_subscription_bin_data->[0]->{ChildData}->{ExtensibleDatum}};
my ($bin_type) = grep { $_->{DatatypeName} eq 'Container Type'} @{$old_subscription_bin_data->[0]->{ChildData}->{ExtensibleDatum}};

my $bin_number;

Check warning on line 401 in perllib/FixMyStreet/Cobrand/Merton/Waste.pm

View check run for this annotation

Codecov / codecov/patch

perllib/FixMyStreet/Cobrand/Merton/Waste.pm#L400-L401

Added lines #L400 - L401 were not covered by tests
my $bin_type;
for my $extensible_data (@$old_subscription_bin_data) {

Check warning on line 403 in perllib/FixMyStreet/Cobrand/Merton/Waste.pm

View check run for this annotation

Codecov / codecov/patch

perllib/FixMyStreet/Cobrand/Merton/Waste.pm#L403

Added line #L403 was not covered by tests
if ($extensible_data->{DatatypeName} eq 'SLWP - Containers') {
($bin_number) = grep { $_->{DatatypeName} eq 'Quantity'} @{$extensible_data->{ChildData}->{ExtensibleDatum}};
($bin_type) = grep { $_->{DatatypeName} eq 'Container Type'} @{$extensible_data->{ChildData}->{ExtensibleDatum}};

Check warning on line 406 in perllib/FixMyStreet/Cobrand/Merton/Waste.pm

View check run for this annotation

Codecov / codecov/patch

perllib/FixMyStreet/Cobrand/Merton/Waste.pm#L405-L406

Added lines #L405 - L406 were not covered by tests
}
};
$old_garden->{subscription_enddate} = $subscription_enddate;
$old_garden->{transfer_bin_number} = $bin_number->{Value};
$old_garden->{transfer_bin_type} = $bin_type->{Value};

Check warning on line 411 in perllib/FixMyStreet/Cobrand/Merton/Waste.pm

View check run for this annotation

Codecov / codecov/patch

perllib/FixMyStreet/Cobrand/Merton/Waste.pm#L409-L411

Added lines #L409 - L411 were not covered by tests
Expand Down

0 comments on commit 8492c7d

Please sign in to comment.