-
-
Notifications
You must be signed in to change notification settings - Fork 242
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Peterborough][WW] Add text messaging option for bulky waste #4887
base: master
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #4887 +/- ##
==========================================
+ Coverage 82.57% 82.61% +0.04%
==========================================
Files 393 393
Lines 30697 30726 +29
Branches 4861 4869 +8
==========================================
+ Hits 25347 25385 +38
+ Misses 3898 3892 -6
+ Partials 1452 1449 -3 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Functionally this is nearly there, but I've made a few comments about ways the code could be improved/tidied up a bit.
sprintf("%s\n\n | ||
Date: %s | ||
Items: %d | ||
%s | ||
View more details or cancel: %s", | ||
$title, | ||
$self->bulky_nice_collection_date($report->get_extra_field_value('DATE')), | ||
scalar grep ({ $_->{name} =~ /^ITEM/ && $_->{value} } @{$report->get_extra_fields}), | ||
$address, | ||
$h->{url}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please indent this.
@@ -344,6 +344,9 @@ sub _add_confirmed_update { | |||
sub _send_report_sent_email { | |||
my $self = shift; | |||
|
|||
if ($self->report->get_extra_field_value('bulky_text_updates')) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could this instead live in Peterborough::post_report_sent
or Peterborough::open311_post_send
perhaps? It'd be nice to keep cobrand-specific bits out of here if possible.
title => 'About you', | ||
next => 'choose_date_earlier', | ||
update_field_list => sub { | ||
my $form = shift; | ||
if ($form->c->cobrand->moniker eq 'peterborough') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be better to have a COBRAND_FEATURES
flag for the new feature rather than hardcoding the peterborough
check everywhere. This would make it easier to roll out to other cobrands later and also means we can turn it on/off for Peterborough with a redeploy rather than code changes.
@@ -552,10 +552,14 @@ sub bulky_reminders { | |||
sub _bulky_send_reminder_email { | |||
my ($self, $report, $h, $params) = @_; | |||
|
|||
return unless $report->user->email; | |||
return unless $report->user->email || $report->get_extra_field_value('bulky_text_updates'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is inside a function called _bulky_send_reminder_email
so shouldn't have anything to do with sending texts - can you factor this (and the below call_hook
lines) into a new _bulky_send_reminder_text
function which gets called independently?
@@ -64,6 +66,7 @@ create_contact( | |||
{ code => 'payment' }, | |||
{ code => 'payment_method' }, | |||
{ code => 'property_id' }, | |||
{ code => 'bulky_text_updates' }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is probably me not paying close enough attention but it took me ages of wondering why the feature wasn't working before I spotted this line and realised I also needed to add a bulky_text_updates
hidden field to my existing Bulky collection
category. Always helpful to please include notes for the reviewer when adding code that needs configuration/changes beyond checking out the branch.
unless $email->is_inactive || $email->value || ($is_staff_user && !$staff_provide_email); | ||
|
||
unless $email->is_inactive || $email->value || ($is_staff_user && !$staff_provide_email) | ||
|| (FixMyStreet::SMS->parse_username($phone->value)->{may_be_mobile} && $cobrand eq 'peterborough'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix to this in ba1e015 May need more discussion...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't think that fix has had the desired effect - if bulky_offer_text_updates
isn't present in waste_features
this still allows the user to omit their email address on the "about you" page and they'll still see the above error when trying to go to the payment screen.
@@ -62,6 +62,14 @@ has_field email => ( | |||
}, | |||
); | |||
|
|||
has_field extra_bulky_text_updates => ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -62,6 +62,14 @@ has_field email => ( | |||
}, | |||
); | |||
|
|||
has_field extra_bulky_text_updates => ( | |||
type => 'Checkbox', | |||
label => 'Bulky text updates', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still think the inclusion of 'updates' here is misleading as the message aren't really updates - they're reminders.
unless $email->is_inactive || $email->value || ($is_staff_user && !$staff_provide_email); | ||
|
||
unless $email->is_inactive || $email->value || ($is_staff_user && !$staff_provide_email) | ||
|| (FixMyStreet::SMS->parse_username($phone->value)->{may_be_mobile} && $cobrand eq 'peterborough'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't think that fix has had the desired effect - if bulky_offer_text_updates
isn't present in waste_features
this still allows the user to omit their email address on the "about you" page and they'll still see the above error when trying to go to the payment screen.
Adds text message request checkout to bulky waste details page that is active only for Peterborough mysociety/societyworks#3782
Checks if govuk_notify is an array which will contain hashes that now include type. If the config is not an array continues as previously, otherwise will choose which config to use based on data assigned to notify_choice Related to mysociety/societyworks#3782
If the user chose to receive updates by phone when making their bulky waste booking, send text updates for 3 and 1 day reminders. Continue to send emails if there is an email address. mysociety/societyworks#3782
If the user has elected to receive optional texts for updates to their booking, they will be sent a text when the bulky booking is confirmed. Normal email confirmation also takes place. mysociety/societyworks#3782
Adds tests for optional text messaging for Bulky waste bookings mysociety/societyworks#3782
Renaming to be clearer about what it's for which is for sending reminders about bulky waste collections which have been ordered.
2932a18
to
cea77c2
Compare
Adds text box to opt into text updates for bulky waste bookings.
Allows multiple govuk_notify templates/keys to be added in array
https://github.com/mysociety/societyworks/issues/3782
[skip changelog]