Skip to content

Commit

Permalink
[Brent] Remove half-price end of 2024.
Browse files Browse the repository at this point in the history
  • Loading branch information
dracos committed Dec 10, 2024
1 parent 90341c9 commit 7d580e8
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 76 deletions.
4 changes: 2 additions & 2 deletions perllib/FixMyStreet/Cobrand/Brent.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1549,7 +1549,7 @@ sub garden_waste_sacks_cost_pa {
return $_[0]->garden_waste_cost_pa();
}

=item * Garden subscription is half price in October-December.
=item * Garden subscription is half price in October-December (up to end 2024).
=cut

Expand All @@ -1560,7 +1560,7 @@ sub garden_waste_cost_pa {
my $cost = $per_bin_cost * $bin_count;

my $now = DateTime->now( time_zone => FixMyStreet->local_time_zone );
if ($now->month =~ /^(10|11|12)$/ ) {
if ($now->year == 2024 && $now->month =~ /^(10|11|12)$/ ) {
$cost = $cost/2;
}

Expand Down
132 changes: 58 additions & 74 deletions t/app/controller/waste_brent_garden.t
Original file line number Diff line number Diff line change
Expand Up @@ -357,75 +357,66 @@ FixMyStreet::override_config {
is $mech->value('current_bins'), 1, "current bins is set to 1";
};

for my $test (
{
subtest 'check new sub credit card payment' => sub {
my $test = {
month => '01',
pounds_cost => '50.00',
pence_cost => '5000'
},
{
month => '10',
pounds_cost => '25.00',
pence_cost => '2500'
}
) {

subtest 'check new sub credit card payment' => sub {
set_fixed_time("2021-$test->{month}-09T17:00:00Z");
$mech->get_ok('/waste/12345/garden');
$mech->submit_form_ok({ form_number => 1 });
$mech->submit_form_ok({ with_fields => { existing => 'no' } });
$mech->content_like(qr#Total to pay now: £<span[^>]*>0.00#, "initial cost set to zero");
$mech->submit_form_ok({ with_fields => {
current_bins => 0,
bins_wanted => 1,
payment_method => 'credit_card',
name => 'Test McTest',
email => '[email protected]'
} });
$mech->content_contains('Test McTest');
$mech->content_contains('£' . $test->{pounds_cost});
$mech->content_contains('1 bin');
$mech->submit_form_ok({ with_fields => { goto => 'details' } });
$mech->content_contains('<span id="cost_pa">' . $test->{pounds_cost});
$mech->content_contains('<span id="cost_now">' . $test->{pounds_cost});
$mech->submit_form_ok({ with_fields => {
current_bins => 0,
bins_wanted => 1,
payment_method => 'credit_card',
name => 'Test McTest',
email => '[email protected]'
} });
$mech->content_contains('Continue to payment', 'Waste features text_for_waste_payment not used for non-staff payment');
$mech->content_contains('valid bin sticker', 'extra T&C text');
$mech->waste_submit_check({ with_fields => { tandc => 1 } });

my ( $token, $new_report, $report_id ) = get_report_from_redirect( $sent_params->{returnUrl} );

is $sent_params->{items}[0]{amount}, $test->{pence_cost}, 'correct amount used';
check_extra_data_pre_confirm($new_report, new_bin_type => 1, new_quantity => 1);

$mech->get('/waste/pay/xx/yyyyyyyyyyy');
ok !$mech->res->is_success(), "want a bad response";
is $mech->res->code, 404, "got 404";
$mech->get("/waste/pay_complete/$report_id/NOTATOKEN");
ok !$mech->res->is_success(), "want a bad response";
is $mech->res->code, 404, "got 404";
$mech->get_ok("/waste/pay_complete/$report_id/$token?STATUS=9&PAYID=54321");

check_extra_data_post_confirm($new_report);

$mech->content_like(qr#/waste/12345">Show upcoming#, "contains link to bin page");

FixMyStreet::Script::Reports::send();
my @emails = $mech->get_email;
my $body = $mech->get_text_body_from_email($emails[1]);
like $body, qr/Number of bin subscriptions: 1/;
like $body, qr/Bins to be delivered: 1/;
like $body, qr/Total:.*?$test->{pounds_cost}/;
$mech->clear_emails_ok;
};
}
set_fixed_time("2021-$test->{month}-09T17:00:00Z");
$mech->get_ok('/waste/12345/garden');
$mech->submit_form_ok({ form_number => 1 });
$mech->submit_form_ok({ with_fields => { existing => 'no' } });
$mech->content_like(qr#Total to pay now: £<span[^>]*>0.00#, "initial cost set to zero");
$mech->submit_form_ok({ with_fields => {
current_bins => 0,
bins_wanted => 1,
payment_method => 'credit_card',
name => 'Test McTest',
email => '[email protected]'
} });
$mech->content_contains('Test McTest');
$mech->content_contains('£' . $test->{pounds_cost});
$mech->content_contains('1 bin');
$mech->submit_form_ok({ with_fields => { goto => 'details' } });
$mech->content_contains('<span id="cost_pa">' . $test->{pounds_cost});
$mech->content_contains('<span id="cost_now">' . $test->{pounds_cost});
$mech->submit_form_ok({ with_fields => {
current_bins => 0,
bins_wanted => 1,
payment_method => 'credit_card',
name => 'Test McTest',
email => '[email protected]'
} });
$mech->content_contains('Continue to payment', 'Waste features text_for_waste_payment not used for non-staff payment');
$mech->content_contains('valid bin sticker', 'extra T&C text');
$mech->waste_submit_check({ with_fields => { tandc => 1 } });

my ( $token, $new_report, $report_id ) = get_report_from_redirect( $sent_params->{returnUrl} );

is $sent_params->{items}[0]{amount}, $test->{pence_cost}, 'correct amount used';
check_extra_data_pre_confirm($new_report, new_bin_type => 1, new_quantity => 1);

$mech->get('/waste/pay/xx/yyyyyyyyyyy');
ok !$mech->res->is_success(), "want a bad response";
is $mech->res->code, 404, "got 404";
$mech->get("/waste/pay_complete/$report_id/NOTATOKEN");
ok !$mech->res->is_success(), "want a bad response";
is $mech->res->code, 404, "got 404";
$mech->get_ok("/waste/pay_complete/$report_id/$token?STATUS=9&PAYID=54321");

check_extra_data_post_confirm($new_report);

$mech->content_like(qr#/waste/12345">Show upcoming#, "contains link to bin page");

FixMyStreet::Script::Reports::send();
my @emails = $mech->get_email;
my $body = $mech->get_text_body_from_email($emails[1]);
like $body, qr/Number of bin subscriptions: 1/;
like $body, qr/Bins to be delivered: 1/;
like $body, qr/Total:.*?$test->{pounds_cost}/;
$mech->clear_emails_ok;
};

set_fixed_time('2023-01-09T17:00:00Z'); # Set a date when garden service full price for most tests

Expand Down Expand Up @@ -663,13 +654,13 @@ FixMyStreet::override_config {
'bins_wanted' => 3,
'container_type' => 1,
'container_quantity' => 1,
cost => 2500,
cost => 5000,
},
{
'bins_wanted' => 4,
'container_type' => 1,
'container_quantity' => 2,
cost => 5000,
cost => 10000,
},
{
'bins_wanted' => 1,
Expand Down Expand Up @@ -724,13 +715,6 @@ FixMyStreet::override_config {
};

for my $test(
{
box_ticked => 1,
cost => '£20.00',
cost_pence => '2000',
description => '20 per cent off half price with checkbox ticked',
date => '2023-10-09T17:00:00Z',
},
{
box_ticked => 1,
cost => '£40.00',
Expand Down
2 changes: 2 additions & 0 deletions templates/web/brent/waste/garden/subscribe_intro.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@ <h3>How much does it cost?</h3>
<p>
The Brent Garden Waste service runs from 1st April - 31st March and costs £60.
</p>
[% USE date(format='%Y'); IF date.format == 2024 %]
<p>
If you sign up to the service between the 1st October and the 31st December, a discount will apply. You will be charged £30 for the service until the end of March (a 6 month period).
</p>
[% END %]
<p>
If you sign up to the service between the 1st January and the 31st March, the service will not begin until 1st April.
</p>
Expand Down

0 comments on commit 7d580e8

Please sign in to comment.