-
-
Notifications
You must be signed in to change notification settings - Fork 241
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Bexley][WW] Cancel GGW subscription
- Loading branch information
1 parent
0c20788
commit 02b5be4
Showing
7 changed files
with
216 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
perllib/FixMyStreet/App/Form/Waste/Garden/Cancel/Bexley.pm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package FixMyStreet::App::Form::Waste::Garden::Cancel::Bexley; | ||
|
||
use utf8; | ||
use HTML::FormHandler::Moose; | ||
extends 'FixMyStreet::App::Form::Waste::Garden::Cancel'; | ||
|
||
has_field reason => ( | ||
type => 'Select', | ||
widget => 'RadioGroup', | ||
required => 1, | ||
label => 'Reason for cancellation', | ||
messages => { required => 'Please select a reason' }, | ||
); | ||
|
||
sub options_reason { | ||
my $form = shift; | ||
|
||
my @options = ( | ||
'Price', | ||
'Service Issues', | ||
'Moving Out of Borough', | ||
'Other', | ||
); | ||
return map { { label => $_, value => $_ } } @options; | ||
} | ||
|
||
has_field reason_further_details => ( | ||
required => 1, | ||
type => 'Text', | ||
widget => 'Textarea', | ||
label => | ||
"If you selected 'Other', please provide further details (up to 250 characters)", | ||
required_when => { reason => 'Other' }, | ||
maxlength => 250, | ||
messages => { required => 'Please provide further details' }, | ||
); | ||
|
||
1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
=head1 NAME | ||
Integrations::Agile - Agile Applications API integration | ||
=head1 DESCRIPTION | ||
This module provides an interface to the Agile Applications API | ||
=cut | ||
|
||
package Integrations::Agile; | ||
|
||
use strict; | ||
use warnings; | ||
|
||
use HTTP::Request; | ||
use JSON::MaybeXS; | ||
use LWP::UserAgent; | ||
use Moo; | ||
use URI; | ||
|
||
has url => ( is => 'ro' ); | ||
|
||
# TODO Logging | ||
|
||
sub call { | ||
my ( $self, %args ) = @_; | ||
|
||
my $action = $args{action}; | ||
my $controller = $args{controller}; | ||
my $data = $args{data}; | ||
my $method = 'POST'; | ||
|
||
my $body = { | ||
Method => $method, | ||
Controller => $controller, | ||
Action => $action, | ||
Data => $data, | ||
}; | ||
my $body_json = encode_json($body); | ||
|
||
my $uri = URI->new( $self->{url} ); | ||
|
||
my $req = HTTP::Request->new( $method, $uri ); | ||
$req->content_type('application/json; charset=UTF-8'); | ||
$req->content($body_json); | ||
|
||
my $ua = LWP::UserAgent->new; | ||
my $res = $ua->request($req); | ||
|
||
if ( $res->is_success ) { | ||
return decode_json( $res->content ); | ||
} else { | ||
die $res->content; | ||
} | ||
} | ||
|
||
sub IsAddressFree { | ||
my ( $self, $uprn ) = @_; | ||
|
||
return $self->call( | ||
action => 'isaddressfree', | ||
controller => 'customer', | ||
data => { UPRN => $uprn }, | ||
); | ||
} | ||
|
||
sub CustomerSearch { | ||
my ( $self, $uprn ) = @_; | ||
|
||
return $self->call( | ||
action => 'search', | ||
controller => 'customer', | ||
data => { ServiceContractUPRN => $uprn }, | ||
); | ||
} | ||
|
||
1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters