ercos/invoicing-sdk

v2.0.0 2023-12-14 11:20 UTC

This package is auto-updated.

Last update: 2024-04-14 12:17:17 UTC


README

Pré-requis

  • PHP 8.1

Installation

composer require ercos/invoicing-sdk

Configuration

Ajoutez les variables d'environnement :

  • INVOICING_BASE_URL URL de l'api de facturation. Example http://localhost:8000
  • INVOICING_APP_TOKEN jeton d'authentification

Utilisation

Pour pouvoir communiquer avec l'API, une nouvelle App doit être créée et récupérer le jeton d'authentification.

Chaque application peut ensuite créer plusieurs Vendors et, pour chacun d'entre eux, créer des factures et les paiements correspondants.

Entités existantes :

  • Vendor
  • Invoice
    • InvoiceLineCollection
    • MetadataCollection
  • Payment

Exemple d'utilisation :

$invoice = Invoice::store(new StoreInvoiceDto(
    vendor_id: 1,
    date: '2020-10-10',
    status: InvoiceStatus::Sent,
    customer_name: 'Dev test',
    invoice_lines: new InvoiceLineDtoCollection([
        new InvoiceLineDto(
            name: 'test item',
            unit_price_tax_included: 100,
            quantity: 1
        )
    ]),
    customer_email: 'test@test.com'
));
        
$invoice->send();