Skip to content

Commit 2f6d3f6

Browse files
committed
Add crowd compatibility
1 parent a942ade commit 2f6d3f6

1 file changed

Lines changed: 11 additions & 5 deletions

File tree

src/Services/ApiWrapper.php

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -373,11 +373,17 @@ public function getOrganizationForms(string $organizationSlug, array $formTypes
373373
{
374374
$tokenData = $this->getOrganizationAccessToken($organizationSlug);
375375

376-
$response = $this->httpRequest('GET', "{$this->apiUrl}/organizations/{$organizationSlug}/forms", [
377-
'query' => [
378-
'formTypes' => implode(',', $formTypes),
379-
'pageSize' => 50,
380-
],
376+
// Construire la query string manuellement car Guzzle sérialise les arrays
377+
// avec des indices PHP (formTypes[0]=...) que l'API HelloAsso ne supporte pas.
378+
// L'API attend : formTypes=Donation&formTypes=CrowdFunding
379+
$queryParts = [];
380+
foreach ($formTypes as $type) {
381+
$queryParts[] = 'formTypes=' . urlencode($type);
382+
}
383+
$queryParts[] = 'pageSize=50';
384+
$queryString = implode('&', $queryParts);
385+
386+
$response = $this->httpRequest('GET', "{$this->apiUrl}/organizations/{$organizationSlug}/forms?{$queryString}", [
381387
'headers' => [
382388
'Authorization' => 'Bearer ' . $tokenData->access_token,
383389
'accept' => 'application/json',

0 commit comments

Comments
 (0)