impact-factoring / management-client
A PHP client for consuming Impact Factoring Management API
Requires
- ext-curl: *
- ext-json: *
README
Overview
The ImpactFactoringManagementClient
is a PHP client designed to interact with the Impact Factoring Management API. It simplifies managing resources like operating companies, funders, funder compartments, and bank accounts. The client offers methods to fetch and manipulate these resources and ensures seamless API communication with predefined request and response handling.
Contribution
Please keep this README up to date.
Installation
Use Composer to install the package:
composer require impact-factoring/management-client
Configuration
The client autoconfigures based on environment variables:
APP_ENV
: Determines if the client runs in production mode. Client will receive dummy data if APP_ENV is other than "production"IMPACT_FACTORING_MANAGEMENT_API_TOKEN
: Authentication token for API requests.IMPACT_FACTORING_MANAGEMENT_API_BASE_URL
: Base URL for the API.
Set these variables in your environment to streamline usage.
Features
- Fetch details of Operating Companies, Funders, Funder Compartments, and Bank Accounts.
- Reserve and release bank account reservations.
- Centralized configuration for API communication, including authentication and environment-specific settings.
Method Summary
Method | Description |
---|---|
getOperatingCompanies(): ?OperatingCompanyResource[] | Fetch all operating companies. |
getOperatingCompanyById(int $operatingCompanyId): ?OperatingCompanyResource | Fetch a single operating company. |
getFunders(int $operatingCompanyId): ?FunderResource[] | Fetch funders associated with an operating company. |
getFunderById(int $funderId): ?FunderResource | Fetch a single funder |
getFunderCompartments(int $funderId): ?FunderCompartmentResource[] | Fetch compartments for a specific funder |
getFunderCompartmentById(int $funderCompartmentId): ?FunderCompartmentResource | Fetch a single funder compartment |
getAvailableBankAccounts(int $compartmentId): ?BankAccountResource[] | Fetch available bank accounts for a funder compartment. |
getBankAccountById(int $bankAccountId): ?BankAccountResource | Fetch a single bank account |
reserveBankAccount(int $accountId): bool | Reserve a bank account |
releaseBankAccountReservation(int $accountId): bool | Release a bank account reservation. |
getCustomerNumberById(int $customerNumberId): ?CustomerNumberResource | Fetch a single customer number by ID. |
reserveCustomerNumbers(int $amount): CustomerNumberResource[] | Reserve a given amount of customer numbers |
releaseCustomerNumberReservation(int $customerNumberId): bool | Release a reservation of a customer number. |
Usage
Initializing the Client
Create a new instance of ImpactFactoringManagementClient
:
use ImpactFactoring\Management\Client\ImpactFactoringManagementClient;
$client = new ImpactFactoringManagementClient();
Fetching Resources
Operating Companies:
Fetch all active operating companies
$operatingCompanies = $client->getOperatingCompanies();
Fetch a single operating company by ID
$operatingCompanie = $client->getOperatingCompanyById($operatingCompanyId);
Funders:
Fetch active funders assigned to a specific operating company.
$funders = $client->getFunders($operatingCompanyId);
Fetch a single funder by ID.
$funder = $client->getFunderById($funderId);
Funder Compartments:
Fetch active funder compartment assigned to a specific funder
$compartments = $client->getFunderCompartments($funderId);
Fetch a single funder compartment by ID
$compartment = $client->getFunderCompartmentById($funderCompartmentId);
Bank Accounts:
Fetch available bank account assigned to a specified funder compartment
$bankAccounts = $client->getAvailableBankAccounts($funderCompartmentId);
Fetch a single bank account by ID
$bankAccount = $client->getBankAccountById($bankAccountId);
Customer Numbers:
Fetch a single customer number by ID
$bankAccount = $client->getCustomerNumberById($customerNumberId);
Resources
OperatingCompanyResource
Method | Description |
---|---|
getId(): int | Retrieve the ID of the operating company. |
getCompanyName(): ?string | Retrieve the name of the operating company. |
getAddress(): ?string | Retrieve the address where the operating company is based |
getZipCode(): ?string | Retrieve the zipcode where the operating company is based |
getCity(): ?string | Retrieve the city where the operating company is based |
getCountry(): ?string | Retrieve the country where the operating company is based |
getCompanyRegistrationNumber(): ?string | Retrieve the company's business registration number (KvK). |
getCompanyVatNumber(): ?string | Retrieve the company's VAT number. |
getPhone(): ?string | Retrieve the company's general contact phone number. |
getEmail(): ?string | Retrieve the company's general contact email-address. |
getBankAccountNumber(): ?string | Retrieve the company's general IBAN account number. |
getBic(): ?string | Retrieve BIC associated with the general IBAN account number. |
getActive(): ?string | Retrieve the company's current state. |
FunderResource
Method | Description |
---|---|
getId(): int | Retrieve the ID of the funder. |
getName(): ?string | Retrieve the name of the funder. |
getActive(): ?string | Retrieve the current state of the funder. |
FunderCompartmentResource
Method | Description |
---|---|
getId(): int | Retrieve the ID of the funder compartment. |
getName(): ?string | Retrieve the name of the funder compartment. |
getActive(): ?string | Retrieve the current state of the funder compartment. |
BankAccountResource
Method | Description |
---|---|
getId(): int | Retrieve the ID of the bank account. |
getIban(): ?string | Retrieve the IBAN of the bank account. |
CustomerNumberResource
Method | Description |
---|---|
getId(): int | Retrieve the ID of the customer number. |
getCustomerNumber(): ?string | Retrieve the generated customer number. |
Reserve and release bank accounts
It's mandatory to reserve a bank account after the bank account is picked. The bank account should be released if there is no use for it anymore.
Reserve:
$isReserved = $client->reserveBankAccount($bankAccountId);
Release:
$isReleased = $client->releaseBankAccountReservation($bankAccountId);
Reserve and release customer numbers
Once the request to reserve customer numbers has been completed, the given customer numbers are already reserved. If, for any reason, the customer number isn't used anymore, you can release the reservation of that customer number.
Reserve:
$customerNumbers = $client->reserveCustomerNumbers($amount);
Release:
$isReleased = $client->releaseCustomerNumberReservation($customerNumberId);