Skip to content

Commit 879ec41

Browse files
committed
[SLWP] Submit cancellation action upon update.
1 parent 71307e6 commit 879ec41

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

perllib/Open311/Endpoint/Role/SLWP.pm

+5
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,11 @@ around post_service_request_update => sub {
4141
$args->{description} = ''; # Blank out so nothing sent to Echo now
4242
}
4343

44+
if ($args->{description} eq 'Booking cancelled by customer') {
45+
$args->{actiontype_id} = 8;
46+
$args->{datatype_id} = 0;
47+
}
48+
4449
my $result = $class->$orig($args);
4550

4651
return $result;

t/open311/endpoint/kingston.t

+21
Original file line numberDiff line numberDiff line change
@@ -160,4 +160,25 @@ subtest "POST a successful payment" => sub {
160160
} ], 'correct json returned';
161161
};
162162

163+
subtest "POST a cancellation" => sub {
164+
my $res = $endpoint->run_test_request(
165+
POST => '/servicerequestupdates.json',
166+
api_key => 'test',
167+
updated_datetime => '2023-09-01T19:00:00+01:00',
168+
service_request_id => '123cancel',
169+
update_id => 456,
170+
status => 'OPEN',
171+
description => 'Booking cancelled by customer',
172+
first_name => 'Bob',
173+
last_name => 'Mould',
174+
);
175+
ok $res->is_success, 'valid request'
176+
or diag $res->content;
177+
178+
is_deeply decode_json($res->content),
179+
[ {
180+
"update_id" => 'ABC',
181+
} ], 'correct json returned';
182+
};
183+
163184
done_testing;

0 commit comments

Comments
 (0)