Skip to content

Commit

Permalink
[Whitespace] Add extra logging to Whitespace call method
Browse files Browse the repository at this point in the history
  • Loading branch information
chrismytton committed May 14, 2024
1 parent 10c84d5 commit 3b0720d
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
23 changes: 22 additions & 1 deletion perllib/Integrations/Whitespace.pm
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,15 @@ package Integrations::Whitespace;
use strict;
use warnings;
use Moo;
use JSON::MaybeXS qw(encode_json);

use FixMyStreet;

use SOAP::Lite; # +trace => [qw(debug)];

with 'FixMyStreet::Roles::SOAPIntegration';
with 'FixMyStreet::Roles::ParallelAPI';
with 'FixMyStreet::Roles::Syslog';

has attr => ( is => 'ro', default => 'http://webservices.whitespacews.com/' );
has username => ( is => 'ro' );
Expand All @@ -38,7 +40,12 @@ has endpoint => (
soapversion => 1.1,
proxy => $self->url,
default_ns => $self->attr,
on_action => sub { $self->attr . $_[1] }
on_action => sub { $self->attr . $_[1] },
on_fault => sub {
my ($soap, $res) = @_;
$self->log("[Whitespace] SOAP Fault: " . $res->method . ": " . $res->faultcode . " - " . $res->faultstring);
die $res->faultstring;
},
);
},
);
Expand All @@ -63,9 +70,23 @@ has security => (

has backend_type => ( is => 'ro', default => 'whitespace' );

has log_ident => (
is => 'ro',
default => sub {
my $feature = 'whitespace';
my $features = FixMyStreet->config('COBRAND_FEATURES');
return unless $features && ref $features eq 'HASH';
return unless $features->{$feature} && ref $features->{$feature} eq 'HASH';
my $f = $features->{$feature}->{_fallback};
return $f->{log_ident};
}
);

sub call {
my ($self, $method, @params) = @_;

$self->log("[Whitespace] $method : " . encode_json(\@params));

require SOAP::Lite;
@params = make_soap_structure(@params);
my $som = $self->endpoint->call(
Expand Down
2 changes: 2 additions & 0 deletions templates/web/bexley/waste/_bin_days_no_collections.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<p>Are you trying to report from a business, school, community group or place of worship?</p>

0 comments on commit 3b0720d

Please sign in to comment.