-
-
Notifications
You must be signed in to change notification settings - Fork 241
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
[Bexley] Access paysuite integration #5369
base: bexley-ww-garden-subscription
Are you sure you want to change the base?
[Bexley] Access paysuite integration #5369
Conversation
9dd1054
to
8140558
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## bexley-ww-garden-subscription #5369 +/- ##
=================================================================
- Coverage 82.46% 82.21% -0.25%
=================================================================
Files 418 421 +3
Lines 32948 33072 +124
Branches 5282 5298 +16
=================================================================
+ Hits 27170 27190 +20
- Misses 4223 4327 +104
Partials 1555 1555 ☔ 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.
Really struggling with this change. Kept thinking if I could just get a day of focus I'd make a breakthrough and then I could make some progress, but I just keep hitting a wall with my understanding of the WW form wizard and how to add the extra form needed for these details.
|
||
if ($c->cobrand->direct_debit_collection_method eq 'internal') { | ||
my $form = FixMyStreet::App::Form::Waste::BankDetails->new( | ||
c => $c, | ||
page_name => 'bank_details', | ||
); | ||
|
||
if ($c->req->method eq 'POST') { | ||
$form->process(params => $c->req->params); | ||
if ($form->validated) { | ||
my $success = $c->cobrand->call_hook('setup_direct_debit', [$form->value]); | ||
if ($success) { | ||
$c->res->redirect($c->uri_for('/waste/dd_complete', { | ||
token => $c->stash->{reference}, | ||
id => $c->stash->{report}->id | ||
})); | ||
$c->detach; | ||
} else { | ||
$form->add_form_error('Failed to setup direct debit'); | ||
} | ||
} | ||
} | ||
|
||
$c->stash->{form} = $form; | ||
} | ||
|
||
$c->stash->{template} = 'waste/dd.html'; | ||
$c->detach; |
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'm trying to display an extra form to gather the users details instead of redirecting them off to a portal like we do for other places, but it's not working as it should.
I think when the POST request is made for the Direct Debit details form it's picked up as a re-submission of the garden form, and so goes back to the page with the terms and conditions checkbox again, instead of submitting the Direct Debit.
I tried to alter the existing garden form to add a new page for the direct debit, but I couldn't get that working, I think in part because there are a lot of assumptions that the summary page will be the final page.
I must be missing a much easier way to do this?
# Create a dedicated page for entering bank details. | ||
has_page bank_details => ( | ||
title => 'Enter Your Bank Details', | ||
template => 'waste/bank_details.html', | ||
fields => ['account_holder', 'account_number', 'sort_code', 'reference', 'amount', 'report_id', 'submit'], | ||
next => sub { | ||
my $form = shift; | ||
return $form->wizard_finished('process_bank_details'); | ||
}, | ||
); |
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.
Not sure if this is even needed?
my $contract = $i->create_contract($customer->{Id}, { | ||
scheduleId => '38491b98-e3dd-45c1-80e7-e44941e481c6', | ||
start => '2025-03-01T00:00:00.000', | ||
isGiftAid => 0, | ||
terminationType => "Until further notice", | ||
atTheEnd => "Switch to further notice", | ||
paymentMonthInYear => 3, | ||
paymentDayInMonth => 28, | ||
amount => 50.00, | ||
additionalReference => 'BEXLEY GGW', |
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.
Some of this needs to take the dynamic values from the populate_dd_details
stash values.
Work in progress - add form for gathering user's direct debit details and pass off to Access PaySuite.
For https://github.com/mysociety/societyworks/issues/4612