Skip to content

Commit 15ee421

Browse files
Handle multiple category codes per categories
1 parent f1f7ad7 commit 15ee421

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/Api/Clients/TiteLive/TiteLiveClient.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,11 @@ private function normalizeValue($value, string $param): string
238238
}
239239

240240
if ($param === static::CATEGORY_CODES) {
241-
return str_pad(trim($value), 8, '0', STR_PAD_RIGHT);
241+
return collect(explode(',', $value))
242+
->map(function ($code) {
243+
return str_pad(ltrim(trim($code), '0'), 7, '0', STR_PAD_RIGHT);
244+
})
245+
->implode(',');
242246
}
243247

244248
return (string) $value;

tests/Api/Clients/TiteliveClientTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
return $request->hasHeader('User-Agent', 'qdb/v1.0')
5656
&& $request['detail'] == 0
5757
&& $request['tri'] == ''
58-
&& $request['codegtl'] == '12300000'
58+
&& $request['codegtl'] == '1230000'
5959
&& $request['stocks'] == 1
6060
&& $request['base'] == 'paper';
6161
});

0 commit comments

Comments
 (0)