Git Product home page Git Product logo

php-notification-handler-sample's Introduction

Il vous est possible de configurer une URL de notification depuis le BO de votre association. Cette URL recevra alors des notifications de la part de HelloAsso. Il en existe trois types:

  • Création de campagnes
  • Réalisation de commande
  • Réalisation d'un paiement

La documentation de notre API décrit cette fonctionnalité

Fonctionnement

Cette application reçoit la notification (appel POST à la racine) et stock le contenu dans un fichier. Elle permet aussi l'affichage des notifications reçu via une interface de visualisation.

alt text

C'est un cas d'application fictif, dans la réalité la notification vous permettra surement de mettre à jour votre S.I. mais une fois la partie réception faite, vous êtes logiquement en maitrise !

Déploiement

Cette application nécessite d'avoir un environnement PHP ainsi que composer pour gérer les dépendances.

Avant de tester ou déployer ce site, il faut donc récupérer les dépendances:

composer install

Pour tester en local il est possible d'utiliser Visual Studio Code et l'extension PHP Server Il faudra également simuler l'envoi de notification (curl, postman, insomnia, ...) car HelloAsso ne sera pas en mesure d'envoyer sur votre localhost 😅.

Voici des exemples curl pour chaque type de notification:

Création de campagnes

curl --request POST \
  --url http://localhost:3000/ \
  --header 'Content-Type: application/json' \
  --data '{"data":{"organizationLogo":"https:\/\/www.helloasso.com\/assets\/img\/logos\/croppedimage-f1fc3a6ba48746788ec4df2eb2023e8f.png","organizationName":"Demo Boutique","tiers":[{"id":1711234,"description":"","tierType":"Donation","price":2000,"vatRate":0,"paymentFrequency":"Single","isEligibleTaxReceipt":true},{"id":1711238,"tierType":"Donation","price":0,"vatRate":0,"paymentFrequency":"Single","isEligibleTaxReceipt":true},{"id":1711239,"description":"","tierType":"MonthlyDonation","price":1000,"vatRate":0,"paymentFrequency":"Single","isEligibleTaxReceipt":true},{"id":1711235,"description":"","tierType":"Donation","price":5000,"vatRate":0,"paymentFrequency":"Single","isEligibleTaxReceipt":true},{"id":1711236,"description":"","tierType":"Donation","price":10000,"vatRate":0,"paymentFrequency":"Single","isEligibleTaxReceipt":true},{"id":1711237,"description":"","tierType":"Donation","price":15000,"vatRate":0,"paymentFrequency":"Single","isEligibleTaxReceipt":true}],"currency":"EUR","meta":{"createdAt":"2021-02-17T10:17:49.4470247+01:00","updatedAt":"2021-02-17T10:17:49.4470247+01:00"},"state":"Public","title":"<h1>Faire un don \u00e0 Demo Boutique<\/h1>","privateTitle":"Test","widgetButtonUrl":"https:\/\/www.helloasso.com\/associations\/demo-boutique\/formulaires\/1\/widget-bouton","widgetFullUrl":"https:\/\/www.helloasso.com\/associations\/demo-boutique\/formulaires\/1\/widget","formSlug":"1","formType":"Donation","url":"https:\/\/www.helloasso.com\/associations\/demo-boutique\/formulaires\/1","organizationSlug":"demo-boutique"},"eventType":"Form"}'

Réalisation de commande

curl --request POST \
  --url http://localhost:3000/ \
  --header 'Content-Type: application/json' \
  --data '{"data":{"payer":{"dateOfBirth":"1990-01-01T00:00:00+01:00","email":"[email protected]","address":"1 rue un","city":"Bordeaux","zipCode":"33000","country":"FRA","firstName":"Eddy","lastName":"MONTUS"},"items":[{"payments":[{"id":7269832,"shareAmount":1000}],"user":{"firstName":"Eddy","lastName":"MONTUS"},"priceCategory":"Free","isCanceled":false,"id":1,"amount":1000,"type":"Payment","initialAmount":0,"state":"Processed"}],"payments":[{"items":[{"id":1,"shareAmount":1000,"shareItemAmount":1000}],"cashOutState":"Transfered","paymentReceiptUrl":"https:\/\/www.helloasso.com\/associations\/demo-boutique\/paiements\/vente-de-noel\/paiement-attestation\/1","id":7269832,"amount":1000,"date":"2021-02-17T09:19:51.2217994+00:00","paymentMeans":"Card","state":"Authorized"}],"amount":{"total":1000,"vat":0,"discount":0},"id":1,"date":"2021-02-17T09:19:40.770879+00:00","formSlug":"vente-de-noel","formType":"PaymentForm","organizationSlug":"demo-boutique"},"eventType":"Order"}'

Réalisation d'un paiement

curl --request POST \
  --url http://localhost:3000/ \
  --header 'Content-Type: application/json' \
  --data '{"data":{"payer":{"dateOfBirth":"1988-01-04T00:00:00+01:00","email":"[email protected]","address":"71 rue mouneyra","city":"Bordeaux","zipCode":"33000","country":"FRA","firstName":"Eddy","lastName":"MONTUS"},"order":{"id":1,"date":"2021-02-17T09:19:40.770879+00:00","formSlug":"vente-de-noel","formType":"PaymentForm","organizationSlug":"demo-boutique"},"items":[{"shareAmount":1000,"shareItemAmount":1000,"id":1,"amount":1000,"type":"Payment","state":"Processed"}],"cashOutState":"Transfered","paymentReceiptUrl":"https:\/\/www.helloasso.com\/associations\/demo-boutique\/paiements\/vente-de-noel\/paiement-attestation\/1","id":7269832,"amount":1000,"date":"2021-02-17T09:19:40.770879+00:00","paymentMeans":"Card","state":"Authorized"},"eventType":"Payment"}'

php-notification-handler-sample's People

Contributors

emnbdx avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.