Skip to content

Repository files navigation

OpenAPIClient-php

PHP SDK for econnect PSB (https://psb.econnect.eu/?urls.primaryName=V1)

Installation & Usage

Requirements

PHP 8.2 and later.

Composer

To install the bindings via Composer, add the following to composer.json:

{
"repositories": [
{
"type": "vcs",
"url": "https://github.com/QbilSoftware/econnect-psb-php.git"
}
],
"require": {
"QbilSoftware/econnect-psb-php": "@dev-main"
}
}

Then run composer install

Your project is free to choose the http client of your choice Please require packages that will provide http client functionality: https://packagist.org/providers/psr/http-client-implementationhttps://packagist.org/providers/php-http/async-client-implementationhttps://packagist.org/providers/psr/http-factory-implementation

As an example:

composer require guzzlehttp/guzzle php-http/guzzle7-adapter http-interop/http-factory-guzzle

Manual Installation

Download the files and include autoload.php:

<?phprequire_once('/path/to/OpenAPIClient-php/vendor/autoload.php');

Getting Started

Please follow the installation procedure and then run the following:

<?phprequire_once(__DIR__ . '/vendor/autoload.php');
// Configure API key authorization: Subscription-Key$config = EConnect\Psb\Configuration::getDefaultConfiguration()->setApiKey('Subscription-Key', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed// $config = EConnect\Psb\Configuration::getDefaultConfiguration()->setApiKeyPrefix('Subscription-Key', 'Bearer');$config
->setUsername("{username}")
->setPassword("{password}");
->setHost("https://psb.econnect.eu")
->setApiKey('Subscription-Key', '{subscription key}');
$authN = new \EConnect\Psb\OidcAuthenticator(
\Http\Discovery\Psr18ClientDiscovery::find(),
\Http\Discovery\Psr17FactoryDiscovery::findRequestFactory(),
\Http\Discovery\Psr17FactoryDiscovery::findStreamFactory(),
new \Symfony\Component\Clock\NativeClock(),
$config,
);
$authN->login('{clientId}', '{clientSecret}');
$apiInstance = newEConnect\Psb\Api\HookApi(
// If you want use custom http client, pass your client which implements `Psr\Http\Client\ClientInterface`.// This is optional, `Psr18ClientDiscovery` will be used to find http client. For instance `GuzzleHttp\Client` implements that interface
\Http\Discovery\Psr18ClientDiscovery::find(),
$config
);
try {
$result = $apiInstance->getHookConfigs();
print_r($result);
} catch (Exception$e) {
echo'Exception when calling HookApi->getHookConfigs: ', $e->getMessage(), PHP_EOL;
}

API Endpoints

All URIs are relative to http://localhost

ClassMethodHTTP requestDescription
HookApigetHookConfigsGET /api/v1/hookGet registered environment hooks.
HookApigetHooksGET /api/v1/{partyId}/hookGet registered hooks.
HookApiremoveHookConfigDELETE /api/v1/hook/{hookId}Delete default hook.
HookApisendHookPingGET /api/v1/{partyId}/hook/pingSend ping to hook(s).
HookApisetHookConfigPUT /api/v1/hookAdd or update environment hook.
HookApisubscribePUT /api/v1/{partyId}/hookAdd or update hook.
HookApiunSubscribeDELETE /api/v1/{partyId}/hook/{hookId}Delete hook.
MeApigetUserGET /api/v1/meGet user.
MeApigetUserPartyGET /api/v1/me/partyGet parties.
PeppolApigetDeliveryOptionsGET /api/v1/peppol/deliveryOptionAdvanced recipient party lookup in Peppol.
PurchaseInvoiceApideletePurchaseInvoiceDELETE /api/v1/{partyId}/purchaseInvoice/{documentId}Delete purchase invoice.
PurchaseInvoiceApidownloadPurchaseInvoiceGET /api/v1/{partyId}/purchaseInvoice/{documentId}/downloadDownload purchase invoice.
PurchaseInvoiceApigetPurchaseInvoiceStatusesGET /api/v1/{partyId}/purchaseInvoice/{documentId}/statusGet purchase invoice statuses (FOR DEBUGGING ONLY).
PurchaseInvoiceApiqueryRecipientPartyForInvoiceResponsePOST /api/v1/{partyId}/purchaseInvoice/queryRecipientPartyLookup the recipient party (seller/supplier) for possible delivery.
PurchaseInvoiceApirecognizePurchaseInvoicePOST /api/v1/{partyId}/purchaseInvoice/recognizeRecognize purchase invoice.
PurchaseInvoiceApisendInvoiceResponsePOST /api/v1/{partyId}/purchaseInvoice/{documentId}/responseSend invoice response to let the seller know the status of the received invoice.
PurchaseOrderApiapiV1PartyIdPurchaseOrderDocumentIdStatusGetGET /api/v1/{partyId}/purchaseOrder/{documentId}/statusGet purchase order statuses (FOR DEBUGGING ONLY).
PurchaseOrderApiapiV1PartyIdPurchaseOrderQueryRecipientPartyPostPOST /api/v1/{partyId}/purchaseOrder/queryRecipientPartyLookup the recipient party (seller) for possible delivery.
PurchaseOrderApisendOrderCancellationPOST /api/v1/{partyId}/purchaseOrder/{documentId}/cancelSend order cancellation to let the seller know the order is cancelled.
PurchaseOrderApisendPurchaseOrderPOST /api/v1/{partyId}/purchaseOrder/sendSend a purchase order.
SalesInvoiceApigetSalesInvoiceStatusesGET /api/v1/{partyId}/salesInvoice/{documentId}/statusGet sales invoice statuses (FOR DEBUGGING ONLY).
SalesInvoiceApiqueryRecipientPartyForSalesInvoicePOST /api/v1/{partyId}/salesInvoice/queryRecipientPartyLookup the recipient party (buyer/customer) for possible delivery.
SalesInvoiceApirecognizeSalesInvoicePOST /api/v1/{partyId}/salesInvoice/recognizeRecognize sales invoice.
SalesInvoiceApisendSalesInvoicePOST /api/v1/{partyId}/salesInvoice/sendSend an invoice.
SalesOrderApideleteSalesOrderDELETE /api/v1/{partyId}/salesOrder/{documentId}Delete sales order.
SalesOrderApidownloadSalesOrderGET /api/v1/{partyId}/salesOrder/{documentId}/downloadDownload sales order.
SalesOrderApigetSalesOrderStatusesGET /api/v1/{partyId}/salesOrder/{documentId}/statusGet sales order statuses (FOR DEBUGGING ONLY).
SalesOrderApiqueryRecipientPartyForOrderResponsePOST /api/v1/{partyId}/salesOrder/queryRecipientPartyLookup the recipient party (buyer/customer) for possible delivery.
SalesOrderApisendOrderResponsePOST /api/v1/{partyId}/salesOrder/{documentId}/responseSend order response to let the buyer know the status of the received order.
UserApiaddOrUpdateUserPUT /api/v1/userAdd or update users.
UserApiaddOrUpdateUserPartyPUT /api/v1/user/{name}/partyAdd or update user's party.
UserApideleteUserDELETE /api/v1/user/{name}Delete user.
UserApideleteUserPartyDELETE /api/v1/user/{name}/party/{partyId}Removes user's party.
UserApigetUserPartiesGET /api/v1/user/{name}/partyGet user's parties.
UserApigetUsersGET /api/v1/userList users.

Models

Authorization

Bearer

  • Type: OAuth
  • Flow: implicit
  • Authorization URL: https://identity.econnect.eu/connect/authorize
  • Scopes:
    • ap: Procurement Service Bus API
    • vpd: Validated Party Service API

Subscription-Key

  • Type: API key
  • API key parameter name: Subscription-Key
  • Location: HTTP header

Tests

To run the tests, use:

composer install
vendor/bin/phpunit

Author

techsupport@econnect.eu

About this package

This PHP package is automatically generated by the OpenAPI Generator project:

  • API version: 1.0
    • Generator version: 7.12.0
  • Build package: org.openapitools.codegen.languages.PhpClientCodegen