Skip to content

Commit

Permalink
[Bromley] [Waste] No refunds for unpaid bulky bookings.
Browse files Browse the repository at this point in the history
  • Loading branch information
neprune authored and dracos committed Nov 17, 2023
1 parent b951a75 commit 16ca1df
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
8 changes: 7 additions & 1 deletion perllib/FixMyStreet/Cobrand/Bromley.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1031,8 +1031,14 @@ sub bulky_location_text_prompt {

sub bulky_minimum_charge { $_[0]->wasteworks_config->{per_item_min_collection_price} }

sub bulky_booking_paid {
my ($self, $collection) = @_;
return $collection->get_extra_metadata('payment_reference');
}

sub bulky_can_refund_collection {
my ($self, $collection) = @_;
return 0 if !$self->bulky_booking_paid($collection);
return 0 if !$self->within_bulky_cancel_window($collection);
return $self->bulky_refund_amount($collection) > 0;
}
Expand All @@ -1047,7 +1053,7 @@ sub bulky_send_cancellation_confirmation {
],

wasteworks_id => $collection_report->id,
payment_reference => $collection_report->get_extra_metadata('payment_reference'),
paid => $self->bulky_booking_paid($collection_report),
refund_amount => $self->bulky_refund_amount($collection_report),
collection_date => $self->bulky_nice_collection_date($collection_report),
},
Expand Down
8 changes: 8 additions & 0 deletions t/app/controller/waste_bromley_bulky.t
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,14 @@ FixMyStreet::override_config {
$mech->clear_emails_ok();

subtest 'Refund info' => sub {
# Let's just check if no payment yet made
$report->unset_extra_metadata('payment_reference');
$report->update;
$mech->get_ok('/waste/12345/bulky/cancel/' . $report->id);
$mech->content_lacks('If you cancel you will be refunded £30.00');
$report->set_extra_metadata(payment_reference => 12345);
$report->update;

$mech->get_ok('/waste/12345/bulky/cancel/' . $report->id);
$mech->content_contains('If you cancel you will be refunded £30.00');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Subject: Cancelled bulky goods collection [% wasteworks_id %]

Bulky goods collection [% wasteworks_id %] scheduled for [%collection_date %] has been cancelled.

[% IF refund_amount > 0 && payment_reference %]
[% IF refund_amount > 0 && paid %]
£[% pounds(refund_amount / 100) %] will be refunded.
[% END %]

Expand Down

0 comments on commit 16ca1df

Please sign in to comment.