Skip to content

Commit

Permalink
[Waste] Option to confirm bulky before payment.
Browse files Browse the repository at this point in the history
This can be used in situations where the backend lets you then
confirm that payment has been successful.
  • Loading branch information
dracos committed Sep 22, 2023
1 parent b4653cb commit 2e49d60
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
4 changes: 3 additions & 1 deletion perllib/FixMyStreet/App/Controller/Waste.pm
Original file line number Diff line number Diff line change
Expand Up @@ -266,8 +266,10 @@ sub confirm_subscription : Private {

$c->stash->{property_id} = $p->get_extra_field_value('property_id');

my $already_confirmed;
if ($p->category eq 'Bulky collection') {
$c->stash->{template} = 'waste/bulky/confirmation.html';
$already_confirmed = $c->cobrand->bulky_send_before_payment;
} else {
$c->stash->{template} = 'waste/garden/subscribe_confirm.html';
}
Expand All @@ -277,7 +279,7 @@ sub confirm_subscription : Private {
# rather than the default 'done' form one
$c->stash->{override_template} = $c->stash->{template};

return unless $p->state eq 'unconfirmed';
return unless $p->state eq 'unconfirmed' || $already_confirmed;

$p->update_extra_field( {
name => 'LastPayMethod',
Expand Down
3 changes: 2 additions & 1 deletion perllib/FixMyStreet/App/Controller/Waste/Bulky.pm
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,8 @@ sub process_bulky_data : Private {
amend_extra_data($c, $c->stash->{report}, $data);
$c->stash->{report}->update;
} else {
$c->forward('/waste/add_report', [ $data, 1 ]) or return;
my $no_confirm = !$c->cobrand->bulky_send_before_payment;
$c->forward('/waste/add_report', [ $data, $no_confirm ]) or return;
}
if ( FixMyStreet->staging_flag('skip_waste_payment') ) {
$c->stash->{message} = 'Payment skipped on staging';
Expand Down
2 changes: 2 additions & 0 deletions perllib/FixMyStreet/Roles/CobrandBulkyWaste.pm
Original file line number Diff line number Diff line change
Expand Up @@ -475,4 +475,6 @@ sub _bulky_send_reminder_email {
}
}

sub bulky_send_before_payment { 0 }

1;

0 comments on commit 2e49d60

Please sign in to comment.