Skip to content

Commit

Permalink
[Echo] Make sure we fetch all values, even blank.
Browse files Browse the repository at this point in the history
  • Loading branch information
dracos committed Feb 7, 2024
1 parent e713fe7 commit 369d376
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
4 changes: 2 additions & 2 deletions perllib/Open311/Endpoint/Integration/Echo.pm
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ sub post_service_request {
my $subrow = { id => $_->{Id} };
my $value = $self->check_for_data_value($_->{Name}, $args, $request, $type->{Name});
if (defined $value) {
my ($first, @rest) = split /::/, $value;
my ($first, @rest) = split /::/, $value, -1;
$subrow->{value} = $first;
push @{$row->{childdata}}, $subrow;
if (@rest) {
Expand All @@ -355,7 +355,7 @@ sub post_service_request {
}
}
} elsif ($type->{Name} eq 'Image' && $value) {
my ($first, @rest) = split /::/, $value;
my ($first, @rest) = split /::/, $value, -1;
$row->{value} = $first;
if (@rest) {
$extra{$type->{Id}} = \@rest;
Expand Down
11 changes: 11 additions & 0 deletions t/open311/endpoint/kingston.t
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ $soap_lite->mock(call => sub {
@payment = ${$data[2]->value}->value;
is $payment[0]->value, 1013;
is $payment[1]->value, $val;
if ($client_ref eq 'bulky-cc') { # Also check items
is @data, 9, 'Has all six items present in the data';
}
}
} elsif (@params == 2) {
is $params[0]->value, '123pay';
Expand Down Expand Up @@ -100,6 +103,12 @@ $soap_lite->mock(call => sub {
{ Id => 1011, Name => "Payment Type" },
{ Id => 1012, Name => "Payment Taken By" },
{ Id => 1013, Name => "Payment Method" },
{ Id => 1020, Name => "Bulky Collection",
ChildDatatypes => { ExtensibleDatatype => [
{ Id => 1021, Name => "Bulky Items" },
{ Id => 1022, Name => "Notes" },
] },
},
] },
});
} elsif ($method eq 'PerformEventAction') {
Expand Down Expand Up @@ -164,6 +173,8 @@ subtest "POST bulky request card payment OK" => sub {
service_code => EVENT_TYPE_BULKY,
'attribute[payment_method]' => 'credit_card',
'attribute[client_reference]' => 'bulky-cc',
'attribute[Bulky_Collection_Bulky_Items]' => "11::77::34::34::34::23",
'attribute[Bulky_Collection_Notes]' => "Vanity dressing table::Looks heavy but not too bad for 2 to move::::::::",
);
ok $res->is_success, 'valid request'
or diag $res->content;
Expand Down

0 comments on commit 369d376

Please sign in to comment.