To install this bundle, simply run the following command:
$ composer require mpp/apicil-client-bundle
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
Here is the mapping of client for each specification name
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
// ...
}
}
You'll find an exemple of usage of each client below
- [WIP] ApicilAccClient (acc)
- [WIP] ApicilArbitrationClient (arbitration)
- ApicilTradingAccountClient (trading_account)
- [WIP] ApicilContractClient (contract)
- [WIP] ApicilCollectiveContractClient (collective_contract)
- [WIP] ApicilReferentialClient (referential)
- [WIP] ApicilProductClient (product)
- [WIP] ApicilFinancialProfileClient (financial_profile)
- [WIP] ApicilKycContactInformationClient (kyc_contact_information)
- [WIP] ApicilKycIbanClient (kyc_iban)
- [WIP] ApicilPreconizationClient (preconization)
- [WIP] ApicilManagementClient (management)
- [WIP] ApicilPartialRepurchaseClient (partial_repurchase)
- [WIP] ApicilTotalRepurchaseClient (total_repurchase)
- ApicilProjectClient (project)
- [WIP] ApicilPaymentClient (payment)
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
- 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 ?)