Skip to content

Commit

Permalink
[Bexley] Garden subscription flow, front to payment.
Browse files Browse the repository at this point in the history
TODO lots more probably.
It does not know until you have picked DD/CC that DD is cheaper for the first bin.
Perhaps can be implemented as a 5GBP discount when you click the DD option?
  • Loading branch information
dracos committed Dec 19, 2024
1 parent 620e6f7 commit 60d01ed
Show file tree
Hide file tree
Showing 4 changed files with 445 additions and 3 deletions.
2 changes: 1 addition & 1 deletion perllib/FixMyStreet/App/Controller/Waste.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1429,7 +1429,7 @@ sub setup_garden_sub_params : Private {
my $service_id;
if (my $service = $c->cobrand->garden_current_subscription) {
$service_id = $service->{service_id};
} else {
} elsif ($c->cobrand->can('garden_service_id')) { # XXX TODO Does Bexley need its own? Or is this actually Echo only?
$service_id = $c->cobrand->garden_service_id;
}
$c->set_param('email_renewal_reminders_opt_in', $data->{email_renewal_reminders} eq 'Yes' ? 'Y' : 'N') if $data->{email_renewal_reminders};
Expand Down
5 changes: 3 additions & 2 deletions perllib/FixMyStreet/Cobrand/Bexley.pm
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@ use warnings;
use Time::Piece;
use DateTime;
use Moo;
with 'FixMyStreet::Roles::Open311Multi';
with 'FixMyStreet::Cobrand::Bexley::Waste';
with 'FixMyStreet::Roles::Open311Multi',
'FixMyStreet::Cobrand::Bexley::Garden',
'FixMyStreet::Cobrand::Bexley::Waste';

sub council_area_id { 2494 }
sub council_area { 'Bexley' }
Expand Down
61 changes: 61 additions & 0 deletions perllib/FixMyStreet/Cobrand/Bexley/Garden.pm
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
=head1 NAME
FixMyStreet::Cobrand::Bexley::Garden - code specific to Bexley WasteWorks GGW
=cut

package FixMyStreet::Cobrand::Bexley::Garden;

use Moo::Role;
with 'FixMyStreet::Roles::Cobrand::SCP',
'FixMyStreet::Roles::Cobrand::Paye';

sub garden_service_name { 'garden waste collection service' }

# TODO No current subscription look up here
#
sub garden_current_subscription { }

=item * You can order a maximum of five bins
=cut

sub waste_garden_maximum { 5 }

=item * Garden waste has different price for the first bin
=cut

around garden_waste_cost_pa => sub {
my ($orig, $self, $bin_count) = @_;
$bin_count ||= 1;
my $per_bin_cost = $self->garden_waste_subsequent_cost_pa;
my $first_cost = $self->garden_waste_first_cost_pa;
my $cost = $per_bin_cost * ($bin_count-1) + $first_cost;
return $cost;
};

# XXX DD Direct Debit TODO
around garden_waste_first_cost_pa => sub {
my ($orig, $self) = @_;
return $self->_get_cost('ggw_cost_first_cc');
};

around garden_waste_subsequent_cost_pa => sub {
my ($orig, $self) = @_;
return $self->_get_cost('ggw_cost_other');
};

# TODO Check
sub waste_cc_payment_sale_ref {
my ($self, $p) = @_;
return "GGW" . $p->get_extra_field_value('uprn');
}

# TODO Check
sub waste_cc_payment_line_item_ref {
my ($self, $p) = @_;
return $p->id;
}

1;
Loading

0 comments on commit 60d01ed

Please sign in to comment.