Skip to content
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

Draft
wants to merge 1 commit into
base: bexley-ww-garden-subscription
Choose a base branch
from

Conversation

chrismytton
Copy link
Member

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

@chrismytton chrismytton changed the base branch from master to bexley-ww-garden-subscription February 13, 2025 20:21
@mysociety-pusher mysociety-pusher force-pushed the access-paysuite-integration branch from 9dd1054 to 8140558 Compare February 13, 2025 20:24
Copy link

codecov bot commented Feb 13, 2025

Codecov Report

Attention: Patch coverage is 16.80000% with 104 lines in your changes missing coverage. Please review.

Project coverage is 82.21%. Comparing base (b2518f4) to head (8140558).

Files with missing lines Patch % Lines
perllib/Integrations/AccessPaySuite.pm 14.28% 48 Missing ⚠️
perllib/FixMyStreet/App/Controller/Waste.pm 14.28% 29 Missing and 1 partial ⚠️
...erllib/FixMyStreet/Roles/Cobrand/AccessPaySuite.pm 22.22% 14 Missing ⚠️
perllib/FixMyStreet/Cobrand/Bexley/Garden.pm 0.00% 12 Missing ⚠️
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.
📢 Have feedback on the report? Share it here.

Copy link
Member Author

@chrismytton chrismytton left a 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.

Comment on lines +394 to +421

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;
Copy link
Member Author

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?

Comment on lines +139 to +148
# 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');
},
);
Copy link
Member Author

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?

Comment on lines +66 to +75
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',
Copy link
Member Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant