Aller au contenu

omnibill/email 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 réel
Licence
MIT
composer require omnibill/email:1.x-dev

Lue dans les fichiers PHP du paquet au commit 1bb02eee83ac : 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\Email

  • Api class

    What the e-mail gateway's actions work with: the mailer, the store, the message's settings.

    2 methods · 7 properties

  • EmailGatewayFactory class

    The invoice by e-mail: attached to a message to the buyer, sent by the application's mailer, its statuses kept by hand. No platform: legal for a small company's invoices until it must issue through an approved platform (1 September 2027 for SMEs and micro-companies); then the site changes gateway, not code.

    10 options · 1 method

  • InMemoryStatusStore class

    Statuses in this process's memory: for tests, a script, the harness.

    2 methods

  • StatusStoreInterface interface

    Where the statuses of invoices sent by e-mail are kept - by hand: nobody else tells them. The application's table, usually; InMemoryStatusStore for tests and scripts.

    2 methods

Omnibill\Email\Action

  • FetchStatusAction class

    The invoice's statuses, as the application recorded them.

    3 methods

  • SetStatusAction class

    A status recorded by hand: the invoice paid, refused, disputed - nobody else tells it by e-mail. Nothing is sent.

    3 methods

  • SubmitAction class

    The invoice, attached to an e-mail to the buyer's address: once the mailer took it, the invoice is SENT - what happens next, the application records by hand (setStatus).

    3 methods

Omnibill\Email

Api class

final class Api Api.php:8

What the e-mail gateway's actions work with: the mailer, the store, the message's settings.

public readonly MailerInterface $mailer
public readonly StatusStoreInterface $store
public readonly string $from
public readonly ?string $replyTo
public readonly array $bcc
public readonly string $subject
public readonly string $body

Api::__construct()

public function __construct(public readonly MailerInterface $mailer, public readonly StatusStoreInterface $store, public readonly string $from, public readonly ?string $replyTo = null, public readonly array $bcc = [], public readonly string $subject = 'Facture {number}', public readonly string $body = "Bonjour,\n\nVeuillez trouver ci-joint la facture {number}.\n\nCordialement,\n{seller}")

Api::fill()

public function fill(string $template, array $values): string

The subject or the body with {number}, {seller}, {buyer}, {total}, {currency} filled in.

EmailGatewayFactory class

final class EmailGatewayFactory extends GatewayFactory EmailGatewayFactory.php:33

The invoice by e-mail: attached to a message to the buyer, sent by the application's mailer, its statuses kept by hand. No platform: legal for a small company's invoices until it must issue through an approved platform (1 September 2027 for SMEs and micro-companies); then the site changes gateway, not code.

options: from: 'Atelier <factures@example.org>' # required reply_to: comptabilite@example.org bcc: [archives@example.org] # a copy of each invoice sent subject: 'Facture {number}' # {number}, {seller}, {buyer}, {total}, {currency} body: "Bonjour,\n\nVeuillez trouver ci-joint la facture {number}..."

The factory takes the application's MailerInterface (symfony/mailer, a library) and the StatusStoreInterface statuses are kept in - this process's memory when none is given.

Options

OptionDefault
reply_tonull
bcc[]
subject'Facture {number}'
body"Bonjour,\n\nVeuillez trouver ci-joint la facture {number}.\n\nCordialement,\n{seller}"
omnibill.capabilitiesnew Capabilities([Syntax::FACTURX, Syntax::UBL, Syntax::CII], approved: false, publicSector: false)
omnibill.apifn(Config $c) => new Api($this->mailer ?? throw new InvalidConfigException('The "email" gateway needs a mailer: give the factory a Symfony\Component\Mailer\M…
omnibill.action.submitnew SubmitAction()
omnibill.action.fetch_statusnew FetchStatusAction()
omnibill.action.set_statusnew SetStatusAction()
fromrequired

EmailGatewayFactory::__construct()

public function __construct(readonly ?MailerInterface $mailer = null, readonly ?StatusStoreInterface $store = null)

InMemoryStatusStore class

final class InMemoryStatusStore implements StatusStoreInterface InMemoryStatusStore.php:8

Statuses in this process's memory: for tests, a script, the harness.

InMemoryStatusStore::record()

public function record(string $reference, StatusChange $change): void

InMemoryStatusStore::history()

public function history(string $reference): array

StatusStoreInterface interface

interface StatusStoreInterface StatusStoreInterface.php:12

Where the statuses of invoices sent by e-mail are kept - by hand: nobody else tells them. The application's table, usually; InMemoryStatusStore for tests and scripts.

StatusStoreInterface::record()

public function record(string $reference, StatusChange $change): void

Adds a status to the invoice's history, under the flow's reference.

StatusStoreInterface::history()

public function history(string $reference): array
Returns

oldest first; empty for an unknown reference

Omnibill\Email\Action

FetchStatusAction class

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

The invoice's statuses, as the application recorded them.

FetchStatusAction::__construct()

public function __construct()

FetchStatusAction::supports()

public function supports(Request $request): bool

FetchStatusAction::execute()

public function execute(Request $request): void

SetStatusAction class

final class SetStatusAction implements ActionInterface, ApiAwareInterface SetStatusAction.php:18

A status recorded by hand: the invoice paid, refused, disputed - nobody else tells it by e-mail. Nothing is sent.

SetStatusAction::__construct()

public function __construct()

SetStatusAction::supports()

public function supports(Request $request): bool

SetStatusAction::execute()

public function execute(Request $request): void

SubmitAction class

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

The invoice, attached to an e-mail to the buyer's address: once the mailer took it, the invoice is SENT - what happens next, the application records by hand (setStatus).

SubmitAction::__construct()

public function __construct()

SubmitAction::supports()

public function supports(Request $request): bool

SubmitAction::execute()

public function execute(Request $request): void