Commit 879ec41 1 parent 71307e6 commit 879ec41 Copy full SHA for 879ec41
File tree 2 files changed +26
-0
lines changed
perllib/Open311/Endpoint/Role
2 files changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -41,6 +41,11 @@ around post_service_request_update => sub {
41
41
$args -> {description } = ' ' ; # Blank out so nothing sent to Echo now
42
42
}
43
43
44
+ if ($args -> {description } eq ' Booking cancelled by customer' ) {
45
+ $args -> {actiontype_id } = 8;
46
+ $args -> {datatype_id } = 0;
47
+ }
48
+
44
49
my $result = $class -> $orig ($args );
45
50
46
51
return $result ;
Original file line number Diff line number Diff line change @@ -160,4 +160,25 @@ subtest "POST a successful payment" => sub {
160
160
} ], ' correct json returned' ;
161
161
};
162
162
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
+
163
184
done_testing;
You can’t perform that action at this time.
0 commit comments