Aller au contenu

omnibill/chorus-pro Référence de l’API

Étage
Fournisseur · Omnibill
Version
1.x
Suite de conformité
non branchée
Vérifié en réel
Vérifié en partie
Licence
MIT
composer require omnibill/chorus-pro:1.x-dev

Lue dans les fichiers PHP du paquet au commit 2d73786e492d : ses espaces de noms, classes, interfaces et énumérations, leurs constantes, propriétés et méthodes publiques avec leur PHPDoc, et les options que prennent ses fabriques. Rien n’en est exécuté.

Omnibill\ChorusPro

  • Api class

    Chorus Pro's "Factures" API through PISTE: a bearer token (OAuth 2.0 client credentials of a PISTE application) and the cpro-account header (the technical account, "login:password" in base64) on each call; every answer carries codeRetour (0: done) and libelle.

    2 methods · 2 properties · 5 constants

  • ChorusProGatewayFactory class

    Chorus Pro, the public sector's invoicing portal, through PISTE: a supplier's invoices to a public entity (B2G), deposited as flows and followed.

    13 options · 1 method

  • Statuses class

    Chorus Pro's statuses of an invoice (statutCourantCode) as the reform's lifecycle statuses - this package's reading of them, where one matches; the code itself is always kept. Chorus Pro's validation circuits (A_VALIDER_1, VALIDEE_2...) and its own technical states have none.

    1 method · 1 constant

Omnibill\ChorusPro\Action

  • FetchStatusAction class

    POST /v1/rechercher/fournisseur on the invoice's number: the invoice as Chorus Pro integrated it - from the flow it was deposited in, when several bear that number - and its current status (statut). Not found yet: the flow is still being processed, PENDING.

    3 methods

  • SubmitAction class

    POST /v1/deposer/flux: the file in base64, its name, its syntax in Chorus Pro's words (syntaxeFlux). The answer's numeroFluxDepot names the flow.

    4 methods

Omnibill\ChorusPro

Api class

final class Api Api.php:17

Chorus Pro's "Factures" API through PISTE: a bearer token (OAuth 2.0 client credentials of a PISTE application) and the cpro-account header (the technical account, "login:password" in base64) on each call; every answer carries codeRetour (0: done) and libelle.

const PROVIDER = 'chorus-pro'
const API = 'https://api.piste.gouv.fr/cpro/factures'
const OAUTH = 'https://oauth.piste.gouv.fr/api/oauth/token'
const SANDBOX_API = 'https://sandbox-api.piste.gouv.fr/cpro/factures'
const SANDBOX_OAUTH = 'https://sandbox-oauth.piste.gouv.fr/api/oauth/token'
public readonly string $apiUrl
public readonly ?int $userId

Api::__construct()

public function __construct(readonly HttpClientInterface $http, readonly ClientCredentials $credentials, readonly string $account, public readonly string $apiUrl = self::API, public readonly ?int $userId = null)

Api::call()

public function call(string $path, array $body): array
Returns

the answer, codeRetour 0

ChorusProGatewayFactory class

final class ChorusProGatewayFactory extends GatewayFactory ChorusProGatewayFactory.php:35

Chorus Pro, the public sector's invoicing portal, through PISTE: a supplier's invoices to a public entity (B2G), deposited as flows and followed.

options: client_id: '%env(PISTE_CLIENT_ID)%' # required: the PISTE application's client_secret: '%env(PISTE_CLIENT_SECRET)%' # required login: '%env(CPRO_LOGIN)%' # required: the Chorus Pro technical account (TECH_1_...@cpro.fr) password: '%env(CPRO_PASSWORD)%' # required sandbox: false # true: PISTE's sandbox and Chorus Pro's qualification user_id: ~ # idUtilisateurCourant, when the account asks for it syntaxes: { Factur-X: IN_DP_E2_CII_FACTURX, UBL: IN_DP_E1_UBL_INVOICE, CII: IN_DP_E1_CII_16B } api_url: ~ # https://api.piste.gouv.fr/cpro/factures by default oauth_url: ~ # https://oauth.piste.gouv.fr/api/oauth/token by default

It submits and follows. Receiving (the public entities' side), the directory, e-reporting and callbacks are not Chorus Pro's to give a supplier through this API.

Options

OptionDefault
sandboxfalse
user_idnull
syntaxes[]
api_urlnull
oauth_urlnull
omnibill.capabilitiesnew Capabilities([Syntax::FACTURX, Syntax::UBL, Syntax::CII], approved: false, publicSector: true, maxSize: 10 * 1024 * 1024)10 MB a file uncompressed, 30 MB compressed (annex on the API services, deposerFluxFacture).
omnibill.apifunction (Config $c): Api { $http = $this->http ?? HttpClient::create(); $sandbox = $c->bool('sandbox'); return new Api($http, new ClientCredenti…
omnibill.action.submitstatic fn(Config $c) => new SubmitAction(array_replace(SubmitAction::defaults(), (array) $c['syntaxes']))
omnibill.action.fetch_statusnew FetchStatusAction()
client_idrequired
client_secretrequired
loginrequired
passwordrequired

ChorusProGatewayFactory::__construct()

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

Statuses class

final class Statuses Statuses.php:13

Chorus Pro's statuses of an invoice (statutCourantCode) as the reform's lifecycle statuses - this package's reading of them, where one matches; the code itself is always kept. Chorus Pro's validation circuits (A_VALIDER_1, VALIDEE_2...) and its own technical states have none.

const MAP = ['DEPOSEE' => LifecycleStatus::DEPOSITED, 'EN_COURS_ACHEMINEMENT' => LifecycleStatus::ISSUED, 'MISE_A_DISPOSITION' => LifecycleStatus::MADE_AVAILABLE, 'PRISE…

Statuses::of()

public static function of(?string $code): ?LifecycleStatus

Omnibill\ChorusPro\Action

FetchStatusAction class

final class FetchStatusAction implements ActionInterface, ApiAwareInterface FetchStatusAction.php:22

POST /v1/rechercher/fournisseur on the invoice's number: the invoice as Chorus Pro integrated it - from the flow it was deposited in, when several bear that number - and its current status (statut). Not found yet: the flow is still being processed, PENDING.

FetchStatusAction::__construct()

public function __construct()

FetchStatusAction::supports()

public function supports(Request $request): bool

FetchStatusAction::execute()

public function execute(Request $request): void

SubmitAction class

final class SubmitAction implements ActionInterface, ApiAwareInterface SubmitAction.php:22

POST /v1/deposer/flux: the file in base64, its name, its syntax in Chorus Pro's words (syntaxeFlux). The answer's numeroFluxDepot names the flow.

SubmitAction::__construct()

public function __construct(readonly array $syntaxes)
$syntaxes

Chorus Pro's syntaxeFlux for each Syntax

SubmitAction::supports()

public function supports(Request $request): bool

SubmitAction::execute()

public function execute(Request $request): void

SubmitAction::defaults()

public static function defaults(): array