Skip to content

petteri-hakala/procountor-php

 
 

Repository files navigation

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

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PHP 100.0%