Olivier Massot 2 hónapja
szülő
commit
f22a2eb1e5

+ 1 - 1
src/ApiResources/HelloAsso/HelloAssoProfile.php

@@ -11,7 +11,7 @@ use App\State\Provider\HelloAsso\AuthUrlProvider;
 use App\State\Provider\HelloAsso\HelloAssoProfileProvider;
 
 /**
- * Ressource contenant l'URL d'authentification HelloAsso et le vérificateur de défi PKCE.
+ * Profil HelloAsso d'une organisation.
  */
 #[ApiResource(
     operations: [

+ 16 - 0
src/Entity/Organization/HelloAsso.php

@@ -25,15 +25,31 @@ class HelloAsso
     #[ORM\JoinColumn(name: 'organization_id', referencedColumnName: 'id', nullable: false)]
     private Organization $organization;
 
+    /**
+     * La valeur utilisée pour générer le challenge PCKE; à conserver en base le temps de l'authentification HelloAsso.
+     * @var string|null
+     */
     #[ORM\Column(type: 'text', nullable: true)]
     private ?string $challengeVerifier = null;
 
+    /**
+     * Le token d'authentification HelloAsso, valable 30min.'
+     * @var string|null
+     */
     #[ORM\Column(type: 'text', nullable: true)]
     private ?string $token = null;
 
+    /**
+     * Un autre jeton, valable 30jours, permettant de regénérer le token d'authentification HelloAsso.'
+     * @var string|null
+     */
     #[ORM\Column(type: 'text', nullable: true)]
     private ?string $refreshToken = null;
 
+    /**
+     * Le slug de l'organisation sur HelloAsso.
+     * @var string|null
+     */
     #[ORM\Column(type: 'string', length: 255, nullable: true)]
     private ?string $organizationSlug = null;
 

+ 11 - 14
src/Service/HelloAsso/ConnectionService.php

@@ -141,6 +141,12 @@ class ConnectionService extends ApiRequestService
         return $helloAssoEntity;
     }
 
+    /**
+     * Génère le profil HelloAsso pour une organisation.
+     *
+     * @param int $organizationId
+     * @return HelloAssoProfile
+     */
     public function makeHelloAssoProfile(int $organizationId): HelloAssoProfile
     {
         $organization = $this->entityManager->getRepository(Organization::class)->find($organizationId);
@@ -162,6 +168,11 @@ class ConnectionService extends ApiRequestService
         return $profile;
     }
 
+    /**
+     * Génère l'URL de rappel pour les callbacks suite à l'authentification HelloAsso
+     *
+     * @return string
+     */
     protected function getCallbackUrl(): string
     {
         return UrlBuilder::concat($this->publicAppBaseUrl, ['helloasso/callback']);
@@ -213,20 +224,6 @@ class ConnectionService extends ApiRequestService
             throw new HttpException(500, 'Failed to fetch access token: '.$response->getContent(false));
         }
 
-//        $options = [
-//            'headers' => [
-//                'Content-Type' => 'application/x-www-form-urlencoded',
-//            ],
-//            'body' => $body,
-//        ];
-//
-//        $response = $this->post(
-//            UrlBuilder::concat($this->helloAssoApiBaseUrl, ['/oauth2/token']),
-//            [],
-//            [],
-//            $options
-//        );
-
         try {
             $data = json_decode($response->getContent(), true, 512, JSON_THROW_ON_ERROR);
 

+ 3 - 0
src/State/Processor/HelloAsso/ConnectionRequestProcessor.php

@@ -16,6 +16,9 @@ use http\Client\Response;
 use Symfony\Bundle\SecurityBundle\Security;
 use Symfony\Component\HttpFoundation\RedirectResponse;
 
+/**
+ * Processor pour la ressource ConnectionRequest.
+ */
 class ConnectionRequestProcessor implements ProcessorInterface
 {
     public function __construct(

+ 1 - 1
src/State/Provider/HelloAsso/HelloAssoProfileProvider.php

@@ -15,7 +15,7 @@ use Symfony\Bundle\SecurityBundle\Security;
 use Symfony\Component\HttpFoundation\Response;
 
 /**
- * Provider pour la ressource AuthUrl HelloAsso.
+ * Provider pour la ressource HelloAssoProfile.
  */
 final class HelloAssoProfileProvider implements ProviderInterface
 {