Skip to content

Latest commit

 

History

History
75 lines (51 loc) · 1.6 KB

README.md

File metadata and controls

75 lines (51 loc) · 1.6 KB

procountor-php

Introduction

This opensource project is about procountor API

Start

use Procountor\Interfaces\LoggerInterface;

$yourLogger = new class() implements LoggerInterface {....}
$client = new Client($yourLogger);

$client->authenticateByApiKey(
    $clientId,
    $clientSecret,
    $redirectUri,
    $apiKey,
    $company
);

API connection

This is how to connect to invoices's API endpoint:

$invoicesApi = new Invoices($client);

Search invoices

$invoices = $invoicesApi->get();

Get an invoice

To get an invoice with ID = 1212:

$invoicesApi->get(1212);

Posting a new invoice

To post a new invoice, you need first to implement your own adapter:

$newInvoice = new class($yourdata) implements \Procountor\Interfaces\Write\Invoice {
    private $data;

    public function __construct($yourdata) {
        $this->data = $yourdata;
    }

    // then create the related getters:

    public function getPartnerId() {
        return $this->data->partnerid;
    }
    // ...etc
}

Finally you can properly post the invoice:

$invoice = $invoicesApi->post($newInvoice)

Developing

Documents about developing this project can be found under /doc directory