Skip to content

Commit

Permalink
[Waste] [Bromley] Don't cancel bookings without payment if staff crea…
Browse files Browse the repository at this point in the history
…ted.
  • Loading branch information
neprune committed Nov 9, 2023
1 parent 4209729 commit 971875d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions perllib/FixMyStreet/Cobrand/Bromley.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1225,6 +1225,7 @@ sub cancel_bulky_collections_without_payment {
created => { '<' => $cutoff_date },
external_id => { '!=', undef },
state => [ FixMyStreet::DB::Result::Problem->open_states ],
-not => { extra => { '@>' => '{"contributed_as":"another_user"}' } },
-or => [
extra => undef,
-not => { extra => { '\?' => 'payment_reference' } }
Expand Down
11 changes: 10 additions & 1 deletion t/app/controller/waste_bromley_bulky.t
Original file line number Diff line number Diff line change
Expand Up @@ -589,9 +589,18 @@ FixMyStreet::override_config {
is $p->state, "confirmed";
is $p->comments->count, 0;

# No payment - cancelled.
# No payment but made by staff - not cancelled.
$p->set_extra_metadata( contributed_as => 'another_user' );
$p->unset_extra_metadata('payment_reference');
$p->update;
$cobrand->cancel_bulky_collections_without_payment({ commit => 1 });
$p->discard_changes;
is $p->state, "confirmed";
is $p->comments->count, 0;

# No payment non-staff - cancelled.
$p->unset_extra_metadata('contributed_as');
$p->update;
$cobrand->cancel_bulky_collections_without_payment({ commit => 1});
$p->discard_changes;
is $p->state, "closed";
Expand Down

0 comments on commit 971875d

Please sign in to comment.