mpp/apicil-client-bundle

Symfony ApiCil Bundle

v2.1.5 2021-07-27 14:54 UTC

README

68747470733a2f2f696d672e736869656c64732e696f2f62616467652f546f74616c2532306d6574686f647325323066726f6d253230646f63756d656e746174696f6e2d3236372d626c7565

68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4d6574686f647325323061646465642d31303025323525323028323637253246323637292d677265656e

68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4d6574686f6473253230696d706c656d656e7465642d393925323525323028323636253246323637292d79656c6c6f77677265656e

68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4d6574686f64732532307465737465642d3135253235253230283430253246323637292d726564

68747470733a2f2f696d672e736869656c64732e696f2f62616467652f446f63756d656e746174696f6e2d36302532352d79656c6c6f77

Installation

To install this bundle, simply run the following command:

$ composer require mpp/apicil-client-bundle

Configuration

First create a guzzle client:

// config/packages/eight_point_guzzle.yaml
eight_points_guzzle:
    clients:
        my_apicil_client:
            base_url: '%env(APICIL_BASE_URL)%'
            options:
                auth:
                    - '%env(APICIL_USERNAME)%'
                    - '%env(APICIL_PASSWORD)%'
        my_apicil_sign_client:
            base_url: '%env(APICIL_BASE_URL)%'
            options:
                auth:
                    - '%env(APICIL_SIGN_USERNAME)%'
                    - '%env(APICIL_SIGN_PASSWORD)%'

Then configure this client to be used by the bundle:

// config/packages/mpp_apicil_client.yaml
mpp_apicil_client:
    http_client: 'eight_points_guzzle.client.my_apicil_client'
    sign_http_client: 'eight_points_guzzle.client.my_apicil_sign_client'

Make sure to have enabled the serializer & property info component in symfony configuration (for serialization/deserialization):

// config/packages/framework.yaml
framework:
    serializer:
        enabled: true
    property_info:
        enabled: true

Clients

Here is the mapping of client for each specification name

Specification name Base path Client Client domain alias Usable ?
Actualisation Connaissance Client /connaissanceclient ApicilAccClient acc Yes
Arbitrage /arbitrage ApicilArbitrationClient arbitration Yes
Compte titre /comptestitres ApicilTradingAccountClient trading_account Yes
Contrat /contrats ApicilContractClient contract Yes
/contratscollectifs ApicilCollectiveContractClient collective_contract Yes
Données de références /referentiel ApicilReferentialClient referential Yes
/produit ApicilProductClient product Yes
KYC /profilfinancier ApicilFinancialProfileClient financial_profile Yes
/kyc/coordonnees ApicilKycContactInformationClient kyc_contact_information Yes
/kyc/iban ApicilKycIbanClient kyc_iban Partially
Preconisation - interne /interne/preconisation/contrat ApicilPreconizationClient preconization Yes
Profil de gestion /modegestion ApicilManagementClient management Yes
Rachat /rachatpartiel ApicilPartialRepurchaseClient partial_repurchase Yes
/rachattotal ApicilTotalRepurchaseClient total_repurchase Yes
Souscription /projet ApicilProjectClient project Yes
Versement /versement ApicilPaymentClient payment Yes

How to use ?

How to get a specific client domain ?

Here is a sample controller on how to get a specific client domain:

<?php

namespace App\Controller;

use Mpp\ApicilClientBundle\Client\ApicilClientDomainRegistryInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;

class ExampleController extends AbstractController
{
    public function exampleAction(ApicilClientDomainRegistryInterface $apicilClientRegistry)
    {
        // Here are the three different available methods on how to retrieve a client domain by its alias (choose the one you prefer)
        $myClient = $apicilClientRegistry->get('client_domain_alias');
        // or
        $myClient = $apicilClientRegistry->getClientDomainAlias();

        // Execute operations from the retrieved client domain
        // ...
    }
}

How to use each clients ?

You'll find an exemple of usage of each client below

Tests

Update the environment variables in phpunit.xml.dist:

<!-- ... -->
<php>
    <!-- ... -->
    <env name="APP_ENV" value="test" />
    <env name="APICIL_BASE_URL" value="APICIL_BASE_URL" />
    <env name="APICIL_USERNAME" value="USEERNAME" />
    <env name="APICIL_PASSWORD" value="PASSWORD" />
    <!-- ... -->
</php>
<!-- ... -->

Then, use the following commands if you want to run the tests suite

$ make composer-install # once

$ make phpunit

TODO

  • Create missing model/dto classes used in clients
    • CourtierDto
    • DonneesReferencesActifDto
    • FraisEncoursDto
    • PeriodiciteDto
    • ResultatDeCreationResource
    • SituationCompteDto
    • ProfilFinancierActeDto
    • ProfilFinancierConsultationDto
    • ProfilFinancierDto
    • ProfilFinancierQuestionDto
    • RepartitionDto
    • ChangementCoordonneesDto
    • ErreurCodeFonctionnelDto
    • IbanDto
    • RachatPartielDtoDeConsultation
    • EmailPropositionDto
    • RecuperationVersementSuppression
    • SuppressionOptionDto
    • ModeGestionDto
    • QuestionSupportStructureDto
    • EmailPropositionSouscriptionDto
    • ListDocumentDto
    • CompteTitreDto
    • ContratProfilGestionDto
    • RecuperationContratProfileGestionDto
    • TrClasseActifDto
    • BasePreconisationDto
    • TrProfilAllocationAutoriseDto
  • Add unit tests
    • ApicilAccClient
    • ApicilArbitrationClient
    • ApicilTradingAccountClient
    • ApicilContractClient
    • ApicilCollectiveContractClient
    • ApicilReferentialClient
    • ApicilProductClient
    • ApicilFinancialProfileClient
    • ApicilKycContactInformationClient
    • ApicilKycIbanClient
    • ApicilPreconizationClient
    • ApicilManagementClient
    • ApicilPartialRepurchaseClient
    • ApicilTotalRepurchaseClient
    • ApicilProjectClient
    • ApicilPaymentClient
  • Update documetation
    • Add client exemple usage for all routes in documentation
  • Enhance how options are resolved (ex: how file related fields are handled => add Trait ?)