Skip to content

omnibill/afnor API reference

Floor
Provider · Omnibill
Version
1.x
Conformance suite
not wired
Verified for real
Verified in part
Licence
MIT
composer require omnibill/afnor:1.x-dev

Read from the package's own PHP files at the commit 57ee0e7b2093: its namespaces, classes, interfaces and enums, their public constants, properties and methods with their PHPDoc, and the options its factories take. Nothing of it is run.

Omnibill\Afnor

  • AfnorGatewayFactory class

    An approved platform (plateforme agréée) through the standard API of XP Z12-013 - one package for every platform that implements it, told apart by their addresses and credentials.

    20 options · 1 method

  • Api class

    A platform's XP Z12-013 API, as its Flow Service and Directory Service OpenAPI 1.3.0 describe it (published by the FNFE-MPE with the standard, 2026-06-30): a bearer token by OAuth 2.0 client credentials, the Organization-Id header for a delegated company, a Request-Id for the logs.

    10 methods · 6 properties · 1 constant

Omnibill\Afnor\Action

  • AbstractAction class

    An action on the platform's XP Z12-013 API.

    1 method

  • FetchStatusAction class

    GET /v1/flows/{flowId}?docType=Metadata: the platform's acknowledgement.

    2 methods

  • LookupAction class

    POST /v1/directory-line/search: where a SIREN or a SIRET receives its invoices.

    2 methods

  • NotifyAction class

    A webhook's call: its signature checked, the Flow it carries read. A flow coming in announces something to receive().

    2 methods

  • ReceiveAction class

    POST /v1/flows/search on the flows coming in, from the cursor; each one's file downloaded (docType Original): an invoice from a supplier, or a lifecycle message (CDAR) read for its status.

    2 methods

  • ReportAction class

    An e-reporting file, submitted as a flow (flowSyntax FRR).

    2 methods

  • SetStatusAction class

    A status declared: its lifecycle message (CDAR), produced by the application, submitted as a flow of its own.

    2 methods

  • SubmitAction class

    POST /v1/flows: the invoice's file and its flowInfo; the platform answers 202, the flow PENDING.

    2 methods

Omnibill\Afnor

AfnorGatewayFactory class

final class AfnorGatewayFactory extends GatewayFactory AfnorGatewayFactory.php:41

An approved platform (plateforme agréée) through the standard API of XP Z12-013 - one package for every platform that implements it, told apart by their addresses and credentials.

options: flow_url: https://api.flow.example-pa.fr/flow-service # required: the Flow Service's root (before /v1) directory_url: https://api.directory.example-pa.fr/directory-service # the Directory Service's root; none: no lookup() token_url: https://auth.example-pa.fr/auth-service/<customer>/token # required: OAuth 2.0, client credentials client_id: '%env(PA_CLIENT_ID)%' # required client_secret: '%env(PA_CLIENT_SECRET)%' # required scope: ~ # when the platform asks one organization_id: ~ # Organization-Id: the company acted for, under a delegation webhook_key: '%env(default::PA_WEBHOOK_KEY)%' # the webhook's signing key (base64): notify() checks Afnor-Signature with it webhook_tolerance: 300 # seconds a callback may be old; 0: any age profile: ~ # the invoices' flowProfile when the Invoice gives none: Basic, CIUS, Extended-CTC-FR rule: ~ # their processingRule: B2B, B2BInt, B2C, B2G...

The platform decides what it implements beyond the standard's mandatory routes: a route it lacks answers an error, not a refusal.

Options

OptionDefault
directory_urlnull
scopenull
organization_idnull
webhook_keynull
webhook_tolerance300
profilenull
rulenull
omnibill.capabilitiesnew Capabilities([Syntax::FACTURX, Syntax::UBL, Syntax::CII, Syntax::CDAR, Syntax::FRR], approved: true, publicSector: true, maxSize: 100 * 1024 * 1024)The Flow Service takes a file of 100 MB at most.
omnibill.apifunction (Config $c): Api { $http = $this->http ?? HttpClient::create(); return new Api($http, new ClientCredentials($http, Api::PROVIDER, (string) $…
omnibill.action.submitnew SubmitAction()
omnibill.action.fetch_statusnew FetchStatusAction()
omnibill.action.receivenew ReceiveAction()
omnibill.action.set_statusnew SetStatusAction()
omnibill.action.reportnew ReportAction()
omnibill.action.lookupstatic fn(Config $c) => $c->get('directory_url') ? new LookupAction() : null
omnibill.action.notifystatic fn(Config $c) => $c->get('webhook_key') ? new NotifyAction() : null
flow_urlrequired
token_urlrequired
client_idrequired
client_secretrequired

AfnorGatewayFactory::__construct()

public function __construct(readonly ?HttpClientInterface $http = null)

Api class

final class Api Api.php:27

A platform's XP Z12-013 API, as its Flow Service and Directory Service OpenAPI 1.3.0 describe it (published by the FNFE-MPE with the standard, 2026-06-30): a bearer token by OAuth 2.0 client credentials, the Organization-Id header for a delegated company, a Request-Id for the logs.

const PROVIDER = 'afnor'
public readonly string $flowUrl
public readonly ?string $directoryUrl
public readonly ?string $organizationId
public readonly int $webhookTolerance
public readonly ?string $profile
public readonly ?string $rule

Api::__construct()

public function __construct(readonly HttpClientInterface $http, readonly ClientCredentials $credentials, public readonly string $flowUrl, public readonly ?string $directoryUrl = null, public readonly ?string $organizationId = null, readonly ?string $webhookKey = null, public readonly int $webhookTolerance = 300, public readonly ?string $profile = null, public readonly ?string $rule = null, readonly ?\Closure $clock = null)

Api::call()

public function call(string $method, string $url, array $options = []): Answer

A call to the platform, the token renewed once when it is refused.

Api::submit()

public function submit(string $content, string $name, Syntax $syntax, ?string $trackingId, ?string $profile, ?string $rule): array

Uploads a file as a flow: POST /v1/flows, multipart - flowInfo (JSON) and file.

Returns

the FullFlowInfo answered

Api::metadata()

public function metadata(string $flowId): array
Returns

the Flow, its metadata

Api::download()

public function download(string $flowId, string $docType = 'Original'): string

The file of a flow, as its emitter gave it (docType Original).

public function search(?string $cursor, int $limit): array

POST /v1/flows/search: the flows received, from the cursor.

Api::lookup()

public function lookup(string $identifier): array

POST /v1/directory-line/search on a SIREN or a SIRET.

Api::verifyWebhook()

public function verifyWebhook(string $body, ?string $signature, ?string $timestamp): array

A webhook's call, its Afnor-Signature checked: the HMAC-SHA-256, under the webhook's signing key, of the SHA-256 of "<body>@<timestamp>", in base64; Afnor-Signature-Timestamp in epoch seconds.

Returns

the Flow it carries

Api::flow()

public static function flow(array $flow, ?string $invoiceNumber = null): Flow

A Flow of the standard's, as the family's: its acknowledgement as a FlowState and, for an invoice sent, as its first lifecycle status - Ok: deposited (200), Error: rejected (213).

Api::lifecycle()

public static function lifecycle(string $cdar, ?string $filename = null): ?StatusChange

A lifecycle message (CDAR) read for what the family needs - where the DGFiP's Annex 2 (Flux 6, v2.3) puts it: the invoice's number (ReferenceReferencedDocument/IssuerAssignedID), its status code (ReferenceReferencedDocument/ProcessConditionCode), the reason given, the date (ExchangedDocument/IssueDateTime).

Omnibill\Afnor\Action

AbstractAction class

abstract class AbstractAction implements ActionInterface, ApiAwareInterface AbstractAction.php:11

An action on the platform's XP Z12-013 API.

AbstractAction::__construct()

public function __construct()

FetchStatusAction class

final class FetchStatusAction extends AbstractAction FetchStatusAction.php:13

GET /v1/flows/{flowId}?docType=Metadata: the platform's acknowledgement.

The recipient's statuses arrive as lifecycle flows: receive().

FetchStatusAction::supports()

public function supports(Request $request): bool

FetchStatusAction::execute()

public function execute(Request $request): void

LookupAction class

final class LookupAction extends AbstractAction LookupAction.php:10

POST /v1/directory-line/search: where a SIREN or a SIRET receives its invoices.

LookupAction::supports()

public function supports(Request $request): bool

LookupAction::execute()

public function execute(Request $request): void

NotifyAction class

final class NotifyAction extends AbstractAction NotifyAction.php:16

A webhook's call: its signature checked, the Flow it carries read. A flow coming in announces something to receive().

NotifyAction::supports()

public function supports(Request $request): bool

NotifyAction::execute()

public function execute(Request $request): void

ReceiveAction class

final class ReceiveAction extends AbstractAction ReceiveAction.php:19

POST /v1/flows/search on the flows coming in, from the cursor; each one's file downloaded (docType Original): an invoice from a supplier, or a lifecycle message (CDAR) read for its status.

ReceiveAction::supports()

public function supports(Request $request): bool

ReceiveAction::execute()

public function execute(Request $request): void

ReportAction class

final class ReportAction extends AbstractAction ReportAction.php:10

An e-reporting file, submitted as a flow (flowSyntax FRR).

ReportAction::supports()

public function supports(Request $request): bool

ReportAction::execute()

public function execute(Request $request): void

SetStatusAction class

final class SetStatusAction extends AbstractAction SetStatusAction.php:15

A status declared: its lifecycle message (CDAR), produced by the application, submitted as a flow of its own.

SetStatusAction::supports()

public function supports(Request $request): bool

SetStatusAction::execute()

public function execute(Request $request): void

SubmitAction class

final class SubmitAction extends AbstractAction SubmitAction.php:10

POST /v1/flows: the invoice's file and its flowInfo; the platform answers 202, the flow PENDING.

SubmitAction::supports()

public function supports(Request $request): bool

SubmitAction::execute()

public function execute(Request $request): void