PHP code example of neyric / mangopay-bundle

1. Go to this page and download the library: Download neyric/mangopay-bundle library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

neyric / mangopay-bundle example snippets


$bundles = [
    // ...
    new \Neyric\MangoPayBundle\NeyricMangoPayBundle(),
];

use Neyric\MangoPayBundle\Service\MangoPayService; 

class MyService
{
    public function __construct(MangoPayService $mangoPayService)
    {
        $this->mangoPayService = $mangoPayService;
    }

    public function someMethod()
    {
        // You can access the public `api` property, which is the
        // configured instance of MangoPay\MangoPayApi 
        $hooks = $this->mangoPayService->api->Hooks->GetAll();
    }
}

use Neyric\MangoPayBundle\Event\MangoPayHookEvent;

class MySubscriber implements EventSubscriberInterface
{
    
    public function onMangopayKycSucceeded(MangoPayHookEvent $event)
    {
        // ...
    }

    public function onMangopayUboDeclarationValidated(MangoPayHookEvent $event)
    {
        // ...
    }

    public static function getSubscribedEvents()
    {
        return [
            'MANGOPAY_KYC_SUCCEEDED' => ['onMangopayKycSucceeded', 1],
            'MANGOPAY_UBO_DECLARATION_VALIDATED' => ['onMangopayUboDeclarationValidated', 1],
        ];
    }
}
sh
php bin/console neyric_mangopay:hooks:list
sh
php bin/console neyric_mangopay:ratelimits