doskyft / helloasso-php
Helloasso PHP Library
v1.1.3
2024-03-29 13:14 UTC
Requires
- php: >=8.1
- phpdocumentor/reflection-docblock: ^5.3
- symfony/http-client: ^6.4|^7.0
- symfony/http-foundation: ^6.4|^7.0
- symfony/http-kernel: ^6.4|^7.0
- symfony/property-access: ^6.4|^7.0
- symfony/property-info: ^6.4|^7.0
- symfony/serializer: ^6.4|^7.0
README
Un sdk pour utiliser l'api d'helloasso
Installation
composer require doskyft/helloasso-php
Utilisation
Pour commencer, il faut créer une instance de HelloassoClient
.
use Helloasso\HelloassoClientFactory; $helloassoClient = HelloassoClientFactory::create( 'hello_asso_id', 'hello_asso_secret', 'hello_asso_organization_slug', true # sandbox );
Maintenant, on peut commencer à utiliser le client
CheckoutIntent
Créer un CheckoutIntent
use Helloasso\Models\Carts\CheckoutPayer; use Helloasso\Models\Carts\InitCheckoutBody; $checkoutIntent = (new InitCheckoutBody()) ->setTotalAmount(1000) ->setInitialAmount(1000) ->setItemName('Un produit') ->setBackUrl('https://localhost/back') ->setErrorUrl('https://localhost/error') ->setReturnUrl('https://localhost/return') ->setPayer((new CheckoutPayer()) ->setFirstName() ->setLastName() ->setEmail() ) ->setMetadata([ '' => '', ]) ; $helloassoClient->checkout->create($checkoutIntent);
Évènements
use Helloasso\Models\Event; $event = $helloassoClient->decodeEvent($rawEventReceivedFromHelloasso); // Returns an instance of Event
Contribuer
Ce projet inclut des tests fonctionnels qui nécessitent un accès à la sandbox d'Helloasso.
Pour lancer les tests :
HELLOASSO_CLIENT_ID=[YourClientId] HELLOASSO_CLIENT_SECRET=[YourClientSecret] HELLOASSO_ORGANISATION_SLUG=[YourOrganisation] vendor/bin/phpunit
Contributeurs
Damien Hebert |
Olivier Dolbeau |