impact-factoring/management-client

A PHP client for consuming Impact Factoring Management API

1.2.0 2025-01-23 08:39 UTC

This package is auto-updated.

Last update: 2025-05-23 09:17:45 UTC


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

MethodDescription
getOperatingCompanies(): ?OperatingCompanyResource[]Fetch all operating companies.
getOperatingCompanyById(int $operatingCompanyId): ?OperatingCompanyResourceFetch a single operating company.
getFunders(int $operatingCompanyId): ?FunderResource[]Fetch funders associated with an operating company.
getFunderById(int $funderId): ?FunderResourceFetch a single funder
getFunderCompartments(int $funderId): ?FunderCompartmentResource[]Fetch compartments for a specific funder
getFunderCompartmentById(int $funderCompartmentId): ?FunderCompartmentResourceFetch a single funder compartment
getAvailableBankAccounts(int $compartmentId): ?BankAccountResource[]Fetch available bank accounts for a funder compartment.
getBankAccountById(int $bankAccountId): ?BankAccountResourceFetch a single bank account
reserveBankAccount(int $accountId): boolReserve a bank account
releaseBankAccountReservation(int $accountId): boolRelease a bank account reservation.
getCustomerNumberById(int $customerNumberId): ?CustomerNumberResourceFetch a single customer number by ID.
reserveCustomerNumbers(int $amount): CustomerNumberResource[]Reserve a given amount of customer numbers
releaseCustomerNumberReservation(int $customerNumberId): boolRelease 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

MethodDescription
getId(): intRetrieve the ID of the operating company.
getCompanyName(): ?stringRetrieve the name of the operating company.
getAddress(): ?stringRetrieve the address where the operating company is based
getZipCode(): ?stringRetrieve the zipcode where the operating company is based
getCity(): ?stringRetrieve the city where the operating company is based
getCountry(): ?stringRetrieve the country where the operating company is based
getCompanyRegistrationNumber(): ?stringRetrieve the company's business registration number (KvK).
getCompanyVatNumber(): ?stringRetrieve the company's VAT number.
getPhone(): ?stringRetrieve the company's general contact phone number.
getEmail(): ?stringRetrieve the company's general contact email-address.
getBankAccountNumber(): ?stringRetrieve the company's general IBAN account number.
getBic(): ?stringRetrieve BIC associated with the general IBAN account number.
getActive(): ?stringRetrieve the company's current state.

FunderResource

MethodDescription
getId(): intRetrieve the ID of the funder.
getName(): ?stringRetrieve the name of the funder.
getActive(): ?stringRetrieve the current state of the funder.

FunderCompartmentResource

MethodDescription
getId(): intRetrieve the ID of the funder compartment.
getName(): ?stringRetrieve the name of the funder compartment.
getActive(): ?stringRetrieve the current state of the funder compartment.

BankAccountResource

MethodDescription
getId(): intRetrieve the ID of the bank account.
getIban(): ?stringRetrieve the IBAN of the bank account.

CustomerNumberResource

MethodDescription
getId(): intRetrieve the ID of the customer number.
getCustomerNumber(): ?stringRetrieve 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);