Skip to content

Commit

Permalink
Merge pull request #1 from mintware-de/master
Browse files Browse the repository at this point in the history
Initial release
  • Loading branch information
devtronic authored Oct 17, 2017
2 parents 629141e + 507f1eb commit 610525a
Show file tree
Hide file tree
Showing 53 changed files with 4,487 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.idea
vendor
test_config.yml
composer.lock
82 changes: 82 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
[![Logo](https://app01.billbee.de/static/billbee/img/logo.png)](https://www.billbee.de)

# Billbee API
With this package you can implement the official Billbee API in your application.

## Prerequisites
- For accessing the Billbee API you need an API Key.
To get an API key, send a mail to [[email protected]](mailto:[email protected]) and send us a short note about what you are building.
- The API module must be activated in the account ([https://www.billbee.de/de/settings/api](https://www.billbee.de/de/settings/api))

## Install
You can add this package as composer dependency
```bash
$ composer require billbee/billbee-api
```

## Official API Documentation
[https://app01.billbee.de/swagger/ui/index](https://app01.billbee.de/swagger/ui/index)

## Usage

Simply instantiate a client object for accessing the api:
```php
<?php

$user = 'Your Billbee username';
$apiPassword = 'Your Billbee API Password'; // https://www.billbee.de/de/settings/api
$apiKey = 'Your Billbee API Key';

$client = new \BillbeeDe\BillbeeAPI\Client($user, $apiPassword, $apiKey);
```

### Class methods
```text
__construct()
getProducts()
updateStock()
updateStockMultiple()
updateStockCode()
getProduct()
getTermsInfo()
getEvents()
getOrders()
getOrder()
getOrderByOrderNumber()
getOrderByPartner()
createOrder()
addOrderTags()
addOrderShipment()
createDeliveryNote()
createInvoice()
setOrderTags()
setOrderState()
getInvoices()
getShippingProviders()
```

## Example: Retrieve a list of products
```php
<?php

$user = 'Your Billbee username';
$apiPassword = 'Your Billbee API Password'; // https://www.billbee.de/de/settings/api
$apiKey = 'Your Billbee API Key';

$client = new \BillbeeDe\BillbeeAPI\Client($user, $apiPassword, $apiKey);

/** @var \BillbeeDe\BillbeeAPI\Response\GetProductsResponse $productsResponse */
$productsResponse = $client->getProducts($page = 1, $pageSize = 10);

/** @var \BillbeeDe\BillbeeAPI\Model\Product $product */
foreach ($productsResponse->data as $product) {
echo sprintf("Id: %s, SKU: %s, Price: %f\n", $product->id, $product->sku, $product->price);
}
```

## Testing
Clone the repository, copy the `test_config.dist.yml` to `test_config.yml` and fill it.
Run `phpunit`

## Contributing
Feel free to fork the repository and create pull-requests
28 changes: 28 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"name": "billbee/billbee-api",
"description": "The official Billbee API SDK for PHP",
"type": "library",
"require": {
"php": "5.6.* || ^7.0",
"mintware-de/json-object-mapper": "^1.1.0",
"guzzlehttp/guzzle": "^6.3"
},
"require-dev": {
"phpunit/phpunit": "~5.7",
"symfony/yaml": "~3.3"
},
"license": "MIT",
"authors": [
{
"name": "Julian Finkler",
"email": "[email protected]"
}
],
"minimum-stability": "stable",
"autoload": {
"psr-4": {
"BillbeeDe\\BillbeeAPI\\": "src/",
"BillbeeDe\\Tests\\BillbeeAPI\\": "tests/"
}
}
}
23 changes: 23 additions & 0 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<!--
~ This file is part of the Billbee API package.
~
~ Copyright 2017 by Billbee GmbH
~
~ For the full copyright and license information, please read the LICENSE
~ file that was distributed with this source code.
~
~ Created by Julian Finkler <[email protected]>
-->

<phpunit bootstrap="tests/autoload.php">
<testsuites>
<testsuite name="Billbee API Test Suite">
<directory suffix="Test.php">./tests/</directory>
</testsuite>
</testsuites>
<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
<directory suffix=".php">./src</directory>
</whitelist>
</filter>
</phpunit>
Loading

0 comments on commit 610525a

Please sign in to comment.