Giter Site home page Giter Site logo

billbee-php-sdk's Introduction

Packagist GitHub license Packagist

Logo

Billbee API

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

Prerequisites

Install

You can add this package as composer dependency

$ composer require billbee/billbee-api

Instructions without composer

Official API Documentation

https://app.billbee.io/swagger/ui/index

Usage

Simply instantiate a client object for accessing the api:

<?php

use BillbeeDe\BillbeeAPI\Client;

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

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

Example: Retrieve a list of products

<?php
 
use BillbeeDe\BillbeeAPI\Client;

$user = 'Your Billbee username';
$apiPassword = 'Your Billbee API Password'; // https://app.billbee.io/de/settings/api
$apiKey = 'Your Billbee API Key';
 
$client = new Client($user, $apiPassword, $apiKey);

/** @var \BillbeeDe\BillbeeAPI\Response\GetProductsResponse $productsResponse */
$productsResponse = $client->products()->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);
}

Example: Batch requests

<?php

use BillbeeDe\BillbeeAPI\Client;
use BillbeeDe\BillbeeAPI\Response;

$user = 'Your Billbee username';
$apiPassword = 'Your Billbee API Password'; // https://app.billbee.io/de/settings/api
$apiKey = 'Your Billbee API Key';
 
$client = new Client($user, $apiPassword, $apiKey);
$client->enableBatchMode();
 
$client->products()->getProducts(1, 1); # Adds the request to the batch pool / returns null
$client->orders()->getOrders(1, 1); # Adds the request to the batch pool / returns null
$client->events()->getEvents(1, 1); # Adds the request to the batch pool / returns null
 
$results = $client->executeBatch(); # Results contain all responses in the added order
 
/** @var Response\GetProductsResponse $productsResult */
$productsResult = $results[0];
 
/** @var Response\GetOrdersResponse $ordersResult */
$ordersResult = $results[1];
 
/** @var Response\GetEventsResponse $eventsResult */
$eventsResult = $results[2];

Testing

Run phpunit

Contributing

Feel free to fork the repository and create pull-requests

billbee-php-sdk's People

Contributors

christoferw avatar devtronic avatar fkunz avatar julian-at-billbee avatar quabit avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

billbee-php-sdk's Issues

Request of a new Delete Product Endpoint.

Hi again @devtronic,

I find very useful a delete endpoint of a product.

DELETE /api/v1/products/{id}

In case for example we want to delete one product from our online shop, we can send a delete request to Billbee to delete this product also. So we have always sync catalog.

Thank you in advance.

Wrong type mapping for Product.SoldAmount

Fatal error: Uncaught MintWare\DMM\Exception\TypeMismatchException: Wrong Type. Expected int got double. Property name: SoldAmount in billbee-php-sdk\vendor\mintware-de\data-model-mapper\src\ObjectMapper.php on line 516

MintWare\DMM\Exception\TypeMismatchException: Wrong Type. Expected int got double. Property name: SoldAmount in billbee-php-sdk\vendor\mintware-de\data-model-mapper\src\ObjectMapper.php on line 516

Call Stack:
    0.0003     393312   1. {main}() billbee-php-sdk\program.php:0
    0.0440    2698912   2. BillbeeDe\BillbeeAPI\Client->getProducts($page = ???, $pageSize = ???, $minCreatedAt = ???) billbee-php-sdk\program.php:12
    0.0440    2699288   3. BillbeeDe\BillbeeAPI\Client->requestGET($node = 'products', $query = ['page' => 1, 'pageSize' => 50], $responseClass = 'BillbeeDe\\BillbeeAPI\\Response\\GetProductsResponse') billbee-php-sdk\src\Client.php:134
    0.0440    2699984   4. BillbeeDe\BillbeeAPI\Client->internalRequest($responseClass = 'BillbeeDe\\BillbeeAPI\\Response\\GetProductsResponse', $requestFactory = class Closure { public $static = ['node' => 'products', 'query' => [...]]; public $this = class BillbeeDe\BillbeeAPI\Client { protected $endpoint = 'https://app.billbee.io/api/v1/'; protected $jom = class MintWare\DMM\ObjectMapper { ... }; public $useBatching = FALSE; protected $requestPool = [...]; private $logRequests = FALSE; protected $logger = class Psr\Log\NullLogger { ... }; private ${GuzzleHttp\Client}config = [...] } }, $ignorePool = ???) billbee-php-sdk\src\Client.php:1580

PHP Fatal error:  Uncaught MintWare\DMM\Exception\TypeMismatchException: Wrong Type. Expected int got double. Property name: SoldAmount in billbee-php-sdk\vendor\mintware-de\data-model-mapper\src\ObjectMapper.php:516
Stack trace:
#0 billbee-php-sdk\vendor\mintware-de\data-model-mapper\src\ObjectMapper.php(228): MintWare\DMM\ObjectMapper->castType(122, 'int', 'SoldAmount', 'Y-m-d\\TH:i:s', true)
#1 billbee-php-sdk\vendor\mintware-de\data-model-mapper\src\ObjectMapper.php(254): MintWare\DMM\ObjectMapper->mapDataToObject(Array, '\\BillbeeDe\\Bill...')
#2 billbee-php-sdk\vendor\mintware-de\data-model-mapper\src\ObjectMapper.php(113): MintWare\DMM\ObjectMapper->mapDataToObject(Array, 'BillbeeDe\\Billb...')
#3 billbee-php-sdk\src\Client.php(1750): MintWare\DMM\ObjectMapper->map('{"Paging":{"Pag...', 'BillbeeDe\\Billb...')
#4 billbee-php-sdk\src\Client.php(1580): BillbeeDe\BillbeeAPI\Client->internalRequest('BillbeeDe\\Billb...', Object(Closure))
#5 billbee-php-sdk\src\Client.php(134): BillbeeDe\BillbeeAPI\Client->requestGET('products', Array, 'BillbeeDe\\Billb...')
#6 billbee-php-sdk\program.php(12): BillbeeDe\BillbeeAPI\Client->getProducts()
#7 {main}
  thrown in billbee-php-sdk\vendor\mintware-de\data-model-mapper\src\ObjectMapper.php on line 516

Models for Webhook Answers

Hey!

Just a quick question - as i did not find any.

Are there already existing models for the Webhook Requests? These are the resource and some additional informations only.

If not i would create some in the future.

Best Regards
Kevin

Magic request methods require a URI and optional options array

The current version of billbee-php-sdk does not work for me. API calls (e.g. "Example: Retrieve a list of products") fail with the following error message:

Magic request methods require a URI and optional options array in /vendor/guzzlehttp/guzzle/src/Client.php on line 87

Something may have changed in guzzle.

The following packages were automatically installed by composer (composer require billbee/billbee-api):

  • psr/log (1.1.4)
  • ralouphie/getallheaders (3.0.3)
  • psr/http-message (1.0.1)
  • guzzlehttp/psr7 (1.8.3)
  • guzzlehttp/promises (1.5.0)
  • symfony/polyfill-php72 (v1.23.0)
  • symfony/polyfill-intl-normalizer (v1.23.0)
  • symfony/polyfill-intl-idn (v1.23.0)
  • guzzlehttp/guzzle (6.5.5)
  • doctrine/lexer (1.2.1)
  • psr/cache (1.0.1)
  • doctrine/annotations (1.13.2)
  • mintware-de/data-model-mapper (v1.0.1)
  • mintware-de/dmm-json (v1.0.1)
  • billbee/billbee-api (v1.9.0)

What can we do?

Latest jms/serializer 3.3.0 breaks post requests

With latest version of jms/serializer 3.3.0 the code

use BillbeeDe\BillbeeAPI\Client;
use BillbeeDe\BillbeeAPI\Model\Order;

$user = 'Your Billbee username';
$apiPassword = 'Your Billbee API Password';
$apiKey = 'Your Billbee API Key';
 
$client = new Client($user, $apiPassword, $apiKey);

$orderObject = new Order();
$orderObject->setCreatedAt(new \DateTime());
$billbeeOrder = $client->orders()->createOrder($orderObject, 123456789);

will result in error:

"Client error: `POST https://api.billbee.io/api/v1/orders?shopId=123456789` resulted in a `400 Bad Request` response:
{"Message":"The request is invalid.","ModelState":{"orderData":["Required property 'CreatedAt' not found in JSON. Path ' (truncated...)
"

Because latest version of jms/serializer sends json data as 'create_at' instead of 'CreatedAt'.

Temporary fix: downgrading to previous version of jms/serializer 3.29.1 seams to fix this particular case.

missing pagination in CustomersEndpoint getCustomers()

missing pagination signature and implementation in getCustomers() results in not getting all customers.

Function should look like:

public function getCustomers($page = 1, $pageSize = 50, \DateTime $minCreatedAt = null)
{
$query = [
'page' => max(1, $page),
'pageSize' => max(1, $pageSize),
];

if ($minCreatedAt !== null && $minCreatedAt instanceof \DateTime) {
    $query['minCreatedAt'] = $minCreatedAt->format('c');
}
return $this->client->get(
    'customers',
    $query,
    Response\GetCustomersResponse::class
);

}

Falscher Datentyp

Danke erstmal für das schöne Package, erleichtert die Arbeit mit der API wirklich sehr!

Ich habe hier folgenden Fehler (Stacktrace gekürzt und sensible Daten entfernt):
(1/1) TypeMismatchException Wrong Type. Expected int got string in ObjectMapper.php (line 144) at ObjectMapper->mapDataToObject(array('Id' => '123534', 'Name' => 'Farbe', 'Value' => 'xxx', 'Price' => 0), 'BillbeeDe\\BillbeeAPI\\Model\\OrderItemAttribute') in ObjectMapper.php (line 246) at ObjectMapper->mapDataToObject(array('TransactionId' => '393663424723', ...))

Habe als Quickfix in OrderItemAttribute die Annotation auf string geändert: @JsonField(name="Id", type="string"). Vielleicht könnt ihr das ja mal ansehen...

Error with updateStock or updateStockMultiple -> "ErrorMessage":"Parameter SKU is empty" but given

Hello,
i have a problem for update stock.... and with newest serializer also paging orders error

using:
php 8.2
billbee/billbee-api 2.2.1
jms/serializer 3.30
guzzlehttp/guzzle 7.8.1

also if i used newest version of jms/serializer i get the error for orders:
PHP Fatal error: Uncaught TypeError: BillbeeDe\BillbeeAPI\Response\BaseResponse::getPaging(): Return value must be of type array, null returned

Here how i fixed the issues and also warnings:

  1. donwgrade jms/serializer to 3.28

  2. /customClient.php on line 41
    replace: $body = $options['body'] ?? null;
    with $body = $options['body'] ?? '';

  3. in file /Model/stock.php
    replace all protected with public
    example: protected $sku; to: public $sku;

  4. in File /Response/UpdateStockResponse.php
    i removed line 21
    * @var array<array{SKU: ?string, OldStock: ?float, CurrentStock: ?float, UnfulfilledAmount: ?float, Message: string}>
    so the response will display corrctly

maybe anyone can check this and update the SDK

Billbee API Invoice Date Issue

I cannot set the invoice date in the SDK I am using. When I try to create an invoice for a past date, Billbee does not accept it and sets the invoice date as the day I created the invoice. I cannot provide dates using setInvoiceDate or setCreatedAt. It always takes the date the invoice was created. I want to learn how to set the date via the API.

i use this sdk: https://github.com/billbeeio/billbee-php-sdk.git

Null-Pruefung im Konstruktor bei Model Stock

Hallo,

zuallerst großes Lob für den umfangreichen API Client. Bis jetzt konnte ich damit wunderbar arbeiten allerdings viel mir eine Kleinigkeit auf. Wenn ich ein Objekt vom Typ Stock erstelle und im Konstruktor für NewQuantity den Wert 0 übergebe wird dieser nicht akzeptiert bzw. mit dem Wert von OldQuantity überschrieben. Mein Workaround aktuell ist nach dem Konstruktor-Aufruf nochmal die SetNewQuantity-Methode verwende um den Wert 0 übertragen zu können(da wird nicht auf null geprüft). Wäre es dann nicht besser die Prüfung in Zeile 62 von (newQuantity == null) auf (newQuantity === null) anzupassen. Dann könnte man sich den Extra-Aufruf sparen.

Name des JsonFields in Order.php inkorrekt

Liebes Entwickler-Team,

in der Klasse /Model/Order.php ist für das Attribut $adjustmentCost beim Namen für das JsonField-Mapping TotalCost hinterlegt. Laut API müsste der Name jedoch AdjustmentCost lauten.

Viele Grüße
Jens

Creating new Article/Product result in a 500 Internal Server Error.

Like the Title indicates, creating new Article/Product result in a 500 Internal Server Error.

// Let's keep the example very simple.
use BillbeeDe\BillbeeAPI\Client;

$user = Config::get('BILLBEE_USER');
$apiPassword = Config::get('BILLBEE_API_PASSWORD');
$apiKey = Config::get('BILLBEE_API_KEY');

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

// Based on the server responses the minimum field requirement are the following fields.
$data = [
    'form_params' => [
        'Title' => 'Product Title',
        'VatIndex' => 1,
        'Price' => 5.29,
        'Vat1Rate' => 0,
        'Vat2Rate' => 0,
        'Type' => 1,
        // Another issue: will not accept boolean (This is the reason why i use string here.)
        'IsDigital' => 'false', 
        // Another issue: will not accept boolean (This is the reason why i use string here.)
        'IsCustomizable' => 'false',
    ]
];

$client->post('products', $data);

Here is the response from the server.

Fatal error: Uncaught GuzzleHttp\Exception\ServerException: Server error: `POST https://app.billbee.io/api/v1/products` resulted in a `500 Internal Server Error` response: {"ErrorMessage":"Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt.","ErrorCode":8,"Data":null}

Is ok if i open another issues here?

Default initialization of shippingProductId leads to server error

Hi @devtronic,
I noticed an issue with the SDK's code when creating a new product in Billbee with the API endpoint "POST /api/v1/products". First, I did not initiate the Product's field shippingProductId. Therefore, the PHP SDK used the integer "0" as default. However, the Billbee API responded an server error:

  • Error Code: 8
  • Error Message: The given ShippingProductId does not match any shipping provider product.

When explicitly initiating the field shippingProductId as "null", the Billbee endpoint accepts my request. Ironically, the request's response specifies the shippingProductId to be the integer "0" instead of "null" but when requesting the newly created product with the API endpoint "GET /api/v1/products/{id}", it shows "null" instead of the integer "0".

Hence, I propose to initiate that field with "null" instead of an integer "0" by default. I hope this eases the use of this SDK for others.

patchable fields for products

hi,
why are there so few fields to patch a product?
like updating the prices, title, materials, tags, widthCm, lengthCm, heightCm.
would be really handy, to reflect changes in the shop system.

No way to patch line2 and 3 of an address

There ist no way, to patch die fields line2 and line3 of an address. The only way, to patch an address is using the model für costumerAddress. But the model of costumerAddress is different to the model of addess that is used by the order endpoint. The fields line2 and line3 are missing in the costumerAddress model.

It would be nice, if you can add an endpoint to patch an address, that uses address n´modell or you add the line2 and 3 to the costumerAddress model.

Error in Multiple Stock Update

Since the serializer update there seems to be an error in the serialization of an array of stock models via the function $client->products()->updateStockMultiple().

I was able to dig down that, while executing there are only empty models transferred to billbee.
image

I am not as known to the serializer to fix this issue. Maybe someone can step in?
I am happy to help! :)

Title field is not updated.

Hi @devtronic,

If you make a patch request to update a product, the Title field will not update :(

simple example ....

use App\API\Billbee\Client;
use BillbeeDe\BillbeeAPI\Model\Product;
use BillbeeDe\BillbeeAPI\Model\TranslatableText;

$client = Client::init();

$product = new Product();
$product->title = [
    new TranslatableText('New Title', 'DE')
];
.....some other properties here....

$client->updateProduct($product);

oops, nothing happens :(

Thank you in advance.

Issue in express shipping with /api/v1/shipment/shipwithlabel

We are trying to hit the POST api/v1/shipment/shipwithlabel API for DHL Express. Our request is
{
"OrderId": xxx, // billbee order
"ProviderId": 20000000000012103, // DHL express provider id
"ProductId": 20000000000083776 // DHL express product id
}

Always I am getting this response :
{
"ErrorMessage": "Bitte einen Verpackungstyp auswählen",
"ErrorCode": 22,
"ErrorDescription": "InvalidShippingServices",
"Data": null
}
IT is not working with swagger also https://app.billbee.io//swagger/ui/index#!/Shipments/Shipment_ShipWithLabel
The DHL standards and international is working well but not DHL express anyone would like to share the answer?

createOrder not working

Example:

use BillbeeDe\BillbeeAPI\Client;
use BillbeeDe\BillbeeAPI\Model\Order;
use BillbeeDe\BillbeeAPI\Model\OrderItem;
use BillbeeDe\BillbeeAPI\Model\SoldProduct;

$user = '';
$apiPassword = '';
$apiKey = '';

$client = new Client($user, $apiPassword, $apiKey);
$client->setLogger(new \BillbeeDe\BillbeeAPI\Logger\DiagnosticsLogger(__DIR__.'/log.txt'));

$order = new Order();
$order->orderNumber = '4711';
$order->createdAt = new DateTime();
$order->acceptLossOfReturnRight = false;

$item = new OrderItem();
$item->quantity = 1;
$item->product = new SoldProduct();
$item->product->id = "Artikel Id in deinem System";
$item->product->sku = "Eine SKU";
// ...

$order->orderItems = [$item];

$shopId = null;
$client->orders()->createOrder($order, $shopId);

Log:

[2022-08-15 11:03:34.973] DEBUG:     Message: Execute request to https://api.billbee.io/api/v1/orders?shopId=; Context: {"method":"POST","body":{}}
[2022-08-15 11:03:35.360] ERROR:     Message: Error during request; Context: {"GuzzleHttp\\Exception\\RequestExceptionrequest":{},"GuzzleHttp\\Exception\\RequestExceptionresponse":{},"GuzzleHttp\\Exception\\RequestExceptionhandlerContext":[],"*message":"Client error: `POST https://api.billbee.io/api/v1/orders?shopId=` resulted in a `400 Bad Request` response:\n{\"Message\":\"Die Anforderung ist ungültig.\",\"ModelState\":{\"orderData.createdAt\":[\"Unexpected character encountered while (truncated...)\n","Exceptionstring":"","*code":400,"*file":"C:\\Users\\jfinkler\\Desktop\\billbee-php-sdk\\vendor\\guzzlehttp\\guzzle\\src\\Exception\\RequestException.php","*line":113,"Exceptiontrace":[{"file":"C:\\Users\\jfinkler\\Desktop\\billbee-php-sdk\\vendor\\guzzlehttp\\guzzle\\src\\Middleware.php","line":65,"function":"create","class":"GuzzleHttp\\Exception\\RequestException","type":"::","args":[{},{}]},{"file":"C:\\Users\\jfinkler\\Desktop\\billbee-php-sdk\\vendor\\guzzlehttp\\promises\\src\\Promise.php","line":204,"function":"GuzzleHttp\\{closure}","class":"GuzzleHttp\\Middleware","type":"::","args":[{}]},{"file":"C:\\Users\\jfinkler\\Desktop\\billbee-php-sdk\\vendor\\guzzlehttp\\promises\\src\\Promise.php","line":153,"function":"callHandler","class":"GuzzleHttp\\Promise\\Promise","type":"::","args":[1,{},null]},{"file":"C:\\Users\\jfinkler\\Desktop\\billbee-php-sdk\\vendor\\guzzlehttp\\promises\\src\\TaskQueue.php","line":48,"function":"GuzzleHttp\\Promise\\{closure}","class":"GuzzleHttp\\Promise\\Promise","type":"::","args":[]},{"file":"C:\\Users\\jfinkler\\Desktop\\billbee-php-sdk\\vendor\\guzzlehttp\\promises\\src\\Promise.php","line":248,"function":"run","class":"GuzzleHttp\\Promise\\TaskQueue","type":"->","args":[true]},{"file":"C:\\Users\\jfinkler\\Desktop\\billbee-php-sdk\\vendor\\guzzlehttp\\promises\\src\\Promise.php","line":224,"function":"invokeWaitFn","class":"GuzzleHttp\\Promise\\Promise","type":"->","args":[]},{"file":"C:\\Users\\jfinkler\\Desktop\\billbee-php-sdk\\vendor\\guzzlehttp\\promises\\src\\Promise.php","line":269,"function":"waitIfPending","class":"GuzzleHttp\\Promise\\Promise","type":"->","args":[]},{"file":"C:\\Users\\jfinkler\\Desktop\\billbee-php-sdk\\vendor\\guzzlehttp\\promises\\src\\Promise.php","line":226,"function":"invokeWaitList","class":"GuzzleHttp\\Promise\\Promise","type":"->","args":[]},{"file":"C:\\Users\\jfinkler\\Desktop\\billbee-php-sdk\\vendor\\guzzlehttp\\promises\\src\\Promise.php","line":62,"function":"waitIfPending","class":"GuzzleHttp\\Promise\\Promise","type":"->","args":[]},{"file":"C:\\Users\\jfinkler\\Desktop\\billbee-php-sdk\\src\\Client.php","line":441,"function":"wait","class":"GuzzleHttp\\Promise\\Promise","type":"->","args":[]},{"file":"C:\\Users\\jfinkler\\Desktop\\billbee-php-sdk\\src\\Client.php","line":346,"function":"internalRequest","class":"BillbeeDe\\BillbeeAPI\\Client","type":"->","args":["BillbeeDe\\BillbeeAPI\\Response\\BaseResponse",{}]},{"file":"C:\\Users\\jfinkler\\Desktop\\billbee-php-sdk\\src\\Endpoint\\OrdersEndpoint.php","line":265,"function":"post","class":"BillbeeDe\\BillbeeAPI\\Client","type":"->","args":["orders?shopId=","{\n    \"id\": null,\n    \"parentOrderId\": null,\n    \"externalId\": null,\n    \"shipping\": null,\n    \"acceptLossOfReturnRight\": false,\n    \"orderNumber\": \"4711\",\n    \"state\": 1,\n    \"vatMode\": 0,\n    \"createdAt\": [],\n    \"shippedAt\": null,\n    \"confirmedAt\": null,\n    \"payedAt\": null,\n    \"sellerComment\": null,\n    \"comments\": null,\n    \"invoiceNumberPrefix\": null,\n    \"invoiceNumberPostfix\": null,\n    \"invoiceNumber\": null,\n    \"invoiceDate\": null,\n    \"invoiceAddress\": null,\n    \"shippingAddress\": null,\n    \"paymentMethod\": null,\n    \"shippingCost\": null,\n    \"totalCost\": null,\n    \"adjustmentCost\": null,\n    \"adjustmentReason\": null,\n    \"orderItems\": [\n        {\n            \"billbeeId\": null,\n            \"transactionId\": null,\n            \"product\": {\n                \"id\": \"Artikel Id in deinem System\",\n                \"billbeeId\": null,\n                \"title\": null,\n                \"weight\": null,\n                \"sku\": \"Eine SKU\",\n                \"isDigital\": null,\n                \"ean\": null,\n                \"taric\": null,\n                \"countryOfOrigin\": null\n            },\n            \"quantity\": 1,\n            \"totalPrice\": null,\n            \"unrebatedTotalPrice\": null,\n            \"taxAmount\": null,\n            \"taxIndex\": null,\n            \"discount\": null,\n            \"attributes\": null,\n            \"getPriceFromArticleIfAny\": false,\n            \"isCoupon\": false,\n            \"shippingProfileId\": null,\n            \"dontAdjustStock\": null,\n            \"serialNumber\": null\n        }\n    ],\n    \"currency\": null,\n    \"isCanceled\": false,\n    \"restfulPath\": null,\n    \"seller\": null,\n    \"buyer\": null,\n    \"updatedAt\": null,\n    \"taxRate1\": null,\n    \"taxRate2\": null,\n    \"vatId\": null,\n    \"tags\": null,\n    \"shipWeightKg\": null,\n    \"languageCode\": null,\n    \"paidAmount\": null,\n    \"shippingProfileId\": null,\n    \"shippingProfileName\": null,\n    \"shippingProviderId\": null,\n    \"shippingProviderProductId\": null,\n    \"shippingProviderName\": null,\n    \"shippingProviderProductName\": null,\n    \"paymentInstruction\": null,\n    \"isCancellationFor\": null,\n    \"paymentTransactionId\": null,\n    \"deliverySourceCountryCode\": null,\n    \"customInvoiceNote\": null,\n    \"customerNumber\": null,\n    \"distributionCenter\": null,\n    \"customer\": null,\n    \"payments\": null\n}","BillbeeDe\\BillbeeAPI\\Response\\BaseResponse"]},{"file":"C:\\Users\\jfinkler\\Desktop\\billbee-php-sdk\\bin\\program.php","line":33,"function":"createOrder","class":"BillbeeDe\\BillbeeAPI\\Endpoint\\OrdersEndpoint","type":"->","args":[{"id":null,"parentOrderId":null,"externalId":null,"shipping":null,"acceptLossOfReturnRight":false,"orderNumber":"4711","state":1,"vatMode":0,"createdAt":{"date":"2022-08-15 11:03:34.966896","timezone_type":3,"timezone":"UTC"},"shippedAt":null,"confirmedAt":null,"payedAt":null,"sellerComment":null,"comments":null,"invoiceNumberPrefix":null,"invoiceNumberPostfix":null,"invoiceNumber":null,"invoiceDate":null,"invoiceAddress":null,"shippingAddress":null,"paymentMethod":null,"shippingCost":null,"totalCost":null,"adjustmentCost":null,"adjustmentReason":null,"orderItems":[{"billbeeId":null,"transactionId":null,"product":{"id":"Artikel Id in deinem System","billbeeId":null,"title":null,"weight":null,"sku":"Eine SKU","isDigital":null,"ean":null,"taric":null,"countryOfOrigin":null},"quantity":1,"totalPrice":null,"unrebatedTotalPrice":null,"taxAmount":null,"taxIndex":null,"discount":null,"attributes":null,"getPriceFromArticleIfAny":false,"isCoupon":false,"shippingProfileId":null,"dontAdjustStock":null,"serialNumber":null}],"currency":null,"isCanceled":false,"restfulPath":null,"seller":null,"buyer":null,"updatedAt":null,"taxRate1":null,"taxRate2":null,"vatId":null,"tags":null,"shipWeightKg":null,"languageCode":null,"paidAmount":null,"shippingProfileId":null,"shippingProfileName":null,"shippingProviderId":null,"shippingProviderProductId":null,"shippingProviderName":null,"shippingProviderProductName":null,"paymentInstruction":null,"isCancellationFor":null,"paymentTransactionId":null,"deliverySourceCountryCode":null,"customInvoiceNote":null,"customerNumber":null,"distributionCenter":null,"customer":null,"payments":null},null]}],"Exceptionprevious":null,"xdebug_message":"\nGuzzleHttp\\Exception\\ClientException: Client error: `POST https://api.billbee.io/api/v1/orders?shopId=` resulted in a `400 Bad Request` response:\n{\"Message\":\"Die Anforderung ist ungültig.\",\"ModelState\":{\"orderData.createdAt\":[\"Unexpected character encountered while (truncated...)\n in C:\\Users\\jfinkler\\Desktop\\billbee-php-sdk\\vendor\\guzzlehttp\\guzzle\\src\\Exception\\RequestException.php on line 113\n\nCall Stack:\n    0.0005     398880   1. {main}() C:\\Users\\jfinkler\\Desktop\\billbee-php-sdk\\bin\\program.php:0\n    0.0563    2342088   2. BillbeeDe\\BillbeeAPI\\Endpoint\\OrdersEndpoint->createOrder($order = class BillbeeDe\\BillbeeAPI\\Model\\Order { public $id = NULL; public $parentOrderId = NULL; public $externalId = NULL; public $shipping = NULL; public $acceptLossOfReturnRight = FALSE; public $orderNumber = '4711'; public $state = 1; public $vatMode = 0; public $createdAt = class DateTime { public $date = '2022-08-15 11:03:34.966896'; public $timezone_type = 3; public $timezone = 'UTC' }; public $shippedAt = NULL; public $confirmedAt = NULL; public $payedAt = NULL; public $sellerComment = NULL; public $comments = NULL; public $invoiceNumberPrefix = NULL; public $invoiceNumberPostfix = NULL; public $invoiceNumber = NULL; public $invoiceDate = NULL; public $invoiceAddress = NULL; public $shippingAddress = NULL; public $paymentMethod = NULL; public $shippingCost = NULL; public $totalCost = NULL; public $adjustmentCost = NULL; public $adjustmentReason = NULL; public $orderItems = [0 => class BillbeeDe\\BillbeeAPI\\Model\\OrderItem { ... }]; public $currency = NULL; public $isCanceled = FALSE; public $restfulPath = NULL; public $seller = NULL; public $buyer = NULL; public $updatedAt = NULL; public $taxRate1 = NULL; public $taxRate2 = NULL; public $vatId = NULL; public $tags = NULL; public $shipWeightKg = NULL; public $languageCode = NULL; public $paidAmount = NULL; public $shippingProfileId = NULL; public $shippingProfileName = NULL; public $shippingProviderId = NULL; public $shippingProviderProductId = NULL; public $shippingProviderName = NULL; public $shippingProviderProductName = NULL; public $paymentInstruction = NULL; public $isCancellationFor = NULL; public $paymentTransactionId = NULL; public $deliverySourceCountryCode = NULL; public $customInvoiceNote = NULL; public $customerNumber = NULL; public $distributionCenter = NULL; public $customer = NULL; public $payments = NULL }, $shopId = NULL) C:\\Users\\jfinkler\\Desktop\\billbee-php-sdk\\bin\\program.php:33\n    0.0565    2350248   3. BillbeeDe\\BillbeeAPI\\Client->post($node = 'orders?shopId=', $data = '{\\n    \"id\": null,\\n    \"parentOrderId\": null,\\n    \"externalId\": null,\\n    \"shipping\": null,\\n    \"acceptLossOfReturnRight\": false,\\n    \"orderNumber\": \"4711\",\\n    \"state\": 1,\\n    \"vatMode\": 0,\\n    \"createdAt\": [],\\n    \"shippedAt\": null,\\n    \"confirmedAt\": null,\\n    \"payedAt\": null,\\n    \"sellerComment\": null,\\n    \"comments\": null,\\n    \"invoiceNumberPrefix\": null,\\n    \"invoiceNumberPostfix\": null,\\n    \"invoiceNumber\": null,\\n    \"invoiceDate\": null,\\n    \"invoiceAddress\": null,\\n    \"shippingAdd', $responseClass = 'BillbeeDe\\\\BillbeeAPI\\\\Response\\\\BaseResponse') C:\\Users\\jfinkler\\Desktop\\billbee-php-sdk\\src\\Endpoint\\OrdersEndpoint.php:265\n    0.0565    2350944   4. BillbeeDe\\BillbeeAPI\\Client->internalRequest($responseClass = 'BillbeeDe\\\\BillbeeAPI\\\\Response\\\\BaseResponse', $requestFactory = class Closure { public $static = ['data' => '{\\n    \"id\": null,\\n    \"parentOrderId\": null,\\n    \"externalId\": null,\\n    \"shipping\": null,\\n    \"acceptLossOfReturnRight\": false,\\n    \"orderNumber\": \"4711\",\\n    \"state\": 1,\\n    \"vatMode\": 0,\\n    \"createdAt\": [],\\n    \"shippedAt\": null,\\n    \"confirmedAt\": null,\\n    \"payedAt\": null,\\n    \"sellerComment\": null,\\n    \"comments\": null,\\n    \"invoiceNumberPrefix\": null,\\n    \"invoiceNumberPostfix\": null,\\n    \"invoiceNumber\": null,\\n    \"invoiceDate\": null,\\n    \"invoiceAddress\": null,\\n    \"shippingAdd', 'node' => 'orders?shopId=']; public $this = class BillbeeDe\\BillbeeAPI\\Client { protected $endpoint = 'https://api.billbee.io/api/v1/'; protected $jom = class MintWare\\DMM\\ObjectMapper { ... }; private $useBatching = FALSE; protected $requestPool = [...]; private $logRequests = FALSE; private $productsEndpoint = class BillbeeDe\\BillbeeAPI\\Endpoint\\ProductsEndpoint { ... }; private $provisioningEndpoint = class BillbeeDe\\BillbeeAPI\\Endpoint\\ProvisioningEndpoint { ... }; private $eventsEndpoint = class BillbeeDe\\BillbeeAPI\\Endpoint\\EventsEndpoint { ... }; private $ordersEndpoint = class BillbeeDe\\BillbeeAPI\\Endpoint\\OrdersEndpoint { ... }; private $invoicesEndpoint = class BillbeeDe\\BillbeeAPI\\Endpoint\\InvoiceEndpoint { ... }; private $shipmentsEndpoint = class BillbeeDe\\BillbeeAPI\\Endpoint\\ShipmentsEndpoint { ... }; private $customFieldsEndpoint = class BillbeeDe\\BillbeeAPI\\Endpoint\\ProductCustomFieldsEndpoint { ... }; private $webHooksEndpoint = class BillbeeDe\\BillbeeAPI\\Endpoint\\WebHooksEndpoint { ... }; private $customersEndpoint = class BillbeeDe\\BillbeeAPI\\Endpoint\\CustomersEndpoint { ... }; private $cloudStoragesEndpoint = class BillbeeDe\\BillbeeAPI\\Endpoint\\CloudStorageEndpoint { ... }; private $layoutsEndpoint = class BillbeeDe\\BillbeeAPI\\Endpoint\\LayoutsEndpoint { ... }; private $searchEndpoint = class BillbeeDe\\BillbeeAPI\\Endpoint\\SearchEndpoint { ... }; private $client = class BillbeeDe\\BillbeeAPI\\CustomClient { ... }; protected $logger = class BillbeeDe\\BillbeeAPI\\Logger\\DiagnosticsLogger { ... } } }, $ignorePool = ???) C:\\Users\\jfinkler\\Desktop\\billbee-php-sdk\\src\\Client.php:346\n    0.4453    2739024   5. GuzzleHttp\\Promise\\Promise->wait($unwrap = ???) C:\\Users\\jfinkler\\Desktop\\billbee-php-sdk\\src\\Client.php:441\n"}

Error:

PHP Fatal error:  Uncaught GuzzleHttp\Exception\ClientException: Client error: `POST https://api.billbee.io/api/v1/orders?shopId=` resulted in a `400 Bad Request` response:
{"Message":"Die Anforderung ist ungültig.","ModelState":{"orderData.createdAt":["Unexpected character encountered while (truncated...)
 in C:\Users\jfinkler\Desktop\billbee-php-sdk\vendor\guzzlehttp\guzzle\src\Exception\RequestException.php:113
Stack trace:
#0 C:\Users\jfinkler\Desktop\billbee-php-sdk\vendor\guzzlehttp\guzzle\src\Middleware.php(65): GuzzleHttp\Exception\RequestException::create(Object(GuzzleHttp\Psr7\Request), Object(GuzzleHttp\Psr7\Response))
#1 C:\Users\jfinkler\Desktop\billbee-php-sdk\vendor\guzzlehttp\promises\src\Promise.php(204): GuzzleHttp\Middleware::GuzzleHttp\{closure}(Object(GuzzleHttp\Psr7\Response))
#2 C:\Users\jfinkler\Desktop\billbee-php-sdk\vendor\guzzlehttp\promises\src\Promise.php(153): GuzzleHttp\Promise\Promise::callHandler(1, Object(GuzzleHttp\Psr7\Response), NULL)
#3 C:\Users\jfinkler\Desktop\billbee-php-sdk\vendor\gu in C:\Users\jfinkler\Desktop\billbee-php-sdk\vendor\guzzlehttp\guzzle\src\Exception\RequestException.php on line 113

Fatal error: Uncaught GuzzleHttp\Exception\ClientException: Client error: `POST https://api.billbee.io/api/v1/orders?shopId=` resulted in a `400 Bad Request` response:
{"Message":"Die Anforderung ist ungültig.","ModelState":{"orderData.createdAt":["Unexpected character encountered while (truncated...)
 in C:\Users\jfinkler\Desktop\billbee-php-sdk\vendor\guzzlehttp\guzzle\src\Exception\RequestException.php on line 113

GuzzleHttp\Exception\ClientException: Client error: `POST https://api.billbee.io/api/v1/orders?shopId=` resulted in a `400 Bad Request` response:
{"Message":"Die Anforderung ist ungültig.","ModelState":{"orderData.createdAt":["Unexpected character encountered while (truncated...)
 in C:\Users\jfinkler\Desktop\billbee-php-sdk\vendor\guzzlehttp\guzzle\src\Exception\RequestException.php on line 113

Call Stack:
    0.0005     398880   1. {main}() C:\Users\jfinkler\Desktop\billbee-php-sdk\bin\program.php:0
    0.0563    2342088   2. BillbeeDe\BillbeeAPI\Endpoint\OrdersEndpoint->createOrder($order = class BillbeeDe\BillbeeAPI\Model\Order { public $id = NULL; public $parentOrderId = NULL; public $externalId = NULL; public $shipping = NULL; public $acceptLossOfReturnRight = FALSE; public $orderNumber = '4711'; public $state = 1; public $vatMode = 0; public $createdAt = class DateTime { public $date = '2022-08-15 11:03:34.966896'; public $timezone_type = 3; public $timezone = 'UTC' }; public $shippedAt = NULL; public $confirmedAt = NULL; public $payedAt = NULL; public $sellerComment = NULL; public $comments = NULL; public $invoiceNumberPrefix = NULL; public $invoiceNumberPostfix = NULL; public $invoiceNumber = NULL; public $invoiceDate = NULL; public $invoiceAddress = NULL; public $shippingAddress = NULL; public $paymentMethod = NULL; public $shippingCost = NULL; public $totalCost = NULL; public $adjustmentCost = NULL; public $adjustmentReason = NULL; public $orderItems = [0 => class BillbeeDe\BillbeeAPI\Model\OrderItem { ... }]; public $currency = NULL; public $isCanceled = FALSE; public $restfulPath = NULL; public $seller = NULL; public $buyer = NULL; public $updatedAt = NULL; public $taxRate1 = NULL; public $taxRate2 = NULL; public $vatId = NULL; public $tags = NULL; public $shipWeightKg = NULL; public $languageCode = NULL; public $paidAmount = NULL; public $shippingProfileId = NULL; public $shippingProfileName = NULL; public $shippingProviderId = NULL; public $shippingProviderProductId = NULL; public $shippingProviderName = NULL; public $shippingProviderProductName = NULL; public $paymentInstruction = NULL; public $isCancellationFor = NULL; public $paymentTransactionId = NULL; public $deliverySourceCountryCode = NULL; public $customInvoiceNote = NULL; public $customerNumber = NULL; public $distributionCenter = NULL; public $customer = NULL; public $payments = NULL }, $shopId = NULL) C:\Users\jfinkler\Desktop\billbee-php-sdk\bin\program.php:33
    0.0565    2350248   3. BillbeeDe\BillbeeAPI\Client->post($node = 'orders?shopId=', $data = '{\n    "id": null,\n    "parentOrderId": null,\n    "externalId": null,\n    "shipping": null,\n    "acceptLossOfReturnRight": false,\n    "orderNumber": "4711",\n    "state": 1,\n    "vatMode": 0,\n    "createdAt": [],\n    "shippedAt": null,\n    "confirmedAt": null,\n    "payedAt": null,\n    "sellerComment": null,\n    "comments": null,\n    "invoiceNumberPrefix": null,\n    "invoiceNumberPostfix": null,\n    "invoiceNumber": null,\n    "invoiceDate": null,\n    "invoiceAddress": null,\n    "shippingAdd', $responseClass = 'BillbeeDe\\BillbeeAPI\\Response\\BaseResponse') C:\Users\jfinkler\Desktop\billbee-php-sdk\src\Endpoint\OrdersEndpoint.php:265
    0.0565    2350944   4. BillbeeDe\BillbeeAPI\Client->internalRequest($responseClass = 'BillbeeDe\\BillbeeAPI\\Response\\BaseResponse', $requestFactory = class Closure { public $static = ['data' => '{\n    "id": null,\n    "parentOrderId": null,\n    "externalId": null,\n    "shipping": null,\n    "acceptLossOfReturnRight": false,\n    "orderNumber": "4711",\n    "state": 1,\n    "vatMode": 0,\n    "createdAt": [],\n    "shippedAt": null,\n    "confirmedAt": null,\n    "payedAt": null,\n    "sellerComment": null,\n    "comments": null,\n    "invoiceNumberPrefix": null,\n    "invoiceNumberPostfix": null,\n    "invoiceNumber": null,\n    "invoiceDate": null,\n    "invoiceAddress": null,\n    "shippingAdd', 'node' => 'orders?shopId=']; public $this = class BillbeeDe\BillbeeAPI\Client { protected $endpoint = 'https://api.billbee.io/api/v1/'; protected $jom = class MintWare\DMM\ObjectMapper { ... }; private $useBatching = FALSE; protected $requestPool = [...]; private $logRequests = FALSE; private $productsEndpoint = class BillbeeDe\BillbeeAPI\Endpoint\ProductsEndpoint { ... }; private $provisioningEndpoint = class BillbeeDe\BillbeeAPI\Endpoint\ProvisioningEndpoint { ... }; private $eventsEndpoint = class BillbeeDe\BillbeeAPI\Endpoint\EventsEndpoint { ... }; private $ordersEndpoint = class BillbeeDe\BillbeeAPI\Endpoint\OrdersEndpoint { ... }; private $invoicesEndpoint = class BillbeeDe\BillbeeAPI\Endpoint\InvoiceEndpoint { ... }; private $shipmentsEndpoint = class BillbeeDe\BillbeeAPI\Endpoint\ShipmentsEndpoint { ... }; private $customFieldsEndpoint = class BillbeeDe\BillbeeAPI\Endpoint\ProductCustomFieldsEndpoint { ... }; private $webHooksEndpoint = class BillbeeDe\BillbeeAPI\Endpoint\WebHooksEndpoint { ... }; private $customersEndpoint = class BillbeeDe\BillbeeAPI\Endpoint\CustomersEndpoint { ... }; private $cloudStoragesEndpoint = class BillbeeDe\BillbeeAPI\Endpoint\CloudStorageEndpoint { ... }; private $layoutsEndpoint = class BillbeeDe\BillbeeAPI\Endpoint\LayoutsEndpoint { ... }; private $searchEndpoint = class BillbeeDe\BillbeeAPI\Endpoint\SearchEndpoint { ... }; private $client = class BillbeeDe\BillbeeAPI\CustomClient { ... }; protected $logger = class BillbeeDe\BillbeeAPI\Logger\DiagnosticsLogger { ... } } }, $ignorePool = ???) C:\Users\jfinkler\Desktop\billbee-php-sdk\src\Client.php:346


Process finished with exit code 255

Update 2022-08-16 10:45:
Migration done, adding some tests for serializing.

Models:

  • Search
    • CustomerResult
    • OrderResult
    • ProductResult
  • Address
  • BillOfMaterialProduct
  • Category
  • CloudStorage
  • Comment
  • CreateCustomerRequest
  • Customer
  • CustomerAddress
  • CustomerMetaData
  • CustomFieldDefinition
  • DeliveryNoteDocument
  • Dimensions
  • Event
  • Image
  • Invoice
  • InvoiceDocument
  • InvoicePosition
  • Layout
  • MessageForCustomer
  • Order
  • OrderItem
  • OrderItemAttribute
  • PartnerOrder
  • Payment
  • Product
  • ProductCustomField
  • Seller
  • Shipment
  • ShipmentWithLabel
  • ShippingProduct
  • ShippingProvider
  • SoldProduct
  • Source
  • Stock
  • StockCode
  • TermsInfo
  • TranslatableText
  • WebHook
  • WebHookFilter

Branch: https://github.com/billbeeio/billbee-php-sdk/tree/63-migrate-to-jms-serializer


Response

  • Model
    • ShipmentWithLabelResult
  • BaseResponse
  • CreateDeliveryNoteResponse
  • CreateInvoiceResponse
  • GetCategoriesResponse
  • GetCloudStoragesResponse
  • GetCustomerAddressesResponse
  • GetCustomerAddressResponse
  • GetCustomerResponse
  • GetCustomersResponse
  • GetCustomFieldDefinitionResponse
  • GetCustomFieldDefinitionsResponse
  • GetEventsResponse
  • GetInvoicesResponse
  • GetLayoutsResponse
  • GetOrderByPartnerResponse
  • GetOrderResponse
  • GetOrdersResponse
  • GetPatchableFieldsResponse
  • GetProductResponse
  • GetProductsResponse
  • GetShippingProvidersResponse
  • GetTermsInfoResponse
  • SearchDataResponse
  • ShipWithLabelResponse
  • UpdateStockResponse

PHP V7.3

Ich habe ein PHP v7.3 upgrade durchgeführt und erhalte nun die nachfolgende Fehlermeldung. Ich verwende die neuesten Versionen von ObjectMapper und JsonSerializer

Fatal error: Uncaught Error: Call to a member function critical() on null in /src/Client.php:92 Stack trace: #0 /test.php(26): BillbeeDe\BillbeeAPI\Client->__construct('...') #1 {main} thrown in /.../src/Client.php on line 92

    try {
        $this->jom = new ObjectMapper(new JsonSerializer());
    } catch (\Exception $ex) {
        $this->logger->critical('Object Mapper could not be created.');
    }
    $this->setLogger($logger);

Search returns deleted records.

Hi @devtronic,

I found a small issue with the search api, let me explain please.

for example, let's search for a SKU.

$client = App\API\Billbee\Client::init();

$client->search('70-CM6C-PWRQ');

In this example, exist 3 Products with the same SKU, the 2 products of this example was deleted from us, you can't see the 2 last ids on Billbee UI.

array:3 [▼
  0 => BillbeeDe\BillbeeAPI\Model\Search\ProductResult {#5951 ▼
    +id: 22817443
    +shortText: "Osram SuperStar Halogen-Röhre, R7S-Sockel, dimmbar, 120 Watt - Ersatz für 150 Watt, Warmweiß - 2900K"
    +sku: "70-CM6C-PWRQ"
    +tags: ""
  }
  1 => BillbeeDe\BillbeeAPI\Model\Search\ProductResult {#5940 ▼
    +id: 22390094
    +shortText: "Osram SuperStar Halogen-Röhre, R7S-Sockel, dimmbar, 120 Watt - Ersatz für 150 Watt, Warmweiß - 2900K"
    +sku: "70-CM6C-PWRQ"
    +tags: ""
  }
  2 => BillbeeDe\BillbeeAPI\Model\Search\ProductResult {#5938 ▼
    +id: 21635548
    +shortText: "Osram SuperStar Halogen-Röhre, R7S-Sockel, dimmbar, 120 Watt - Ersatz für 150 Watt, Warmweiß - 2900K"
    +sku: "70-CM6C-PWRQ"
    +tags: ""
  }
]

Now of course in this point we don't know which record of this results exist or not, because if you decide to make a patch or get request or something with this record that is already deleted, then in this point we have a problem.

let's make a simple get request to retrieve the last product on array.

$client = App\API\Billbee\Client::init();

$client->getProduct(21635548);

Fatal error: Uncaught GuzzleHttp\Exception\ClientException: Client error: GET https://app.billbee.io/api/v1/products/21635548?lookupBy=id resulted in a 404 Not Found

My proposal is...
or you hide the deleted records from the search results.
or you include in the response a property isDeleted or isActive or something to indicate if the record is live or not.

Thank you in advance.

Leere Response bei Verwendung eines Loggers

Wenn der DiagnosticsLogger verwendet wird, ist die Response leer und es können keine Daten gemappt werden.

Technischer Hintergrund:
getBody() gibt ein StreamInterface (PSR-7) zurück. Da es sich hierbei um einen Stream handelt, wird nach dem lesen des Inhalts (getContents() beim auslesen für den Logger) der Pointer auf das Ende des Streams gesetzt. Beim weiteren lesen stehen keine Daten mehr zur Verfügung, weswegen ein leerer Body geliefert wird.

Lösung: Ergebnis von getContents() in eine Variable schreiben und weiterverwenden.

Patching DeliverySourceCountryCode of orders does not work

When trying to patch an order i get a 400 Bad Request - Property DeliverySourceCountryCode does not exist or is not patchable Error. It doesnt make a difference if i write the attribute key first letter uppercase or not. The following does not work:

$client->patchOrder($order->id, [
    'DeliverySourceCountryCode' => 'GB'
]);
$client->patchOrder($order->id, [
    'deliverySourceCountryCode' => 'GB'
]);

The orderID i use here as a variable is correct and exists inside billbee. Is there anything i do wrong, is it a bug and how am i supposed to update the value the right way if its not a bug?

We are able to patch other attributes like the SellerComment, so the problem is specific to the attribute.

The PSR Http Message implementation may return NULL for getHeader()

The docs for Psr\Http\Message\MessageInterface::getHeader() clearly say: "If the header does not appear in the message, this method MUST return an empty array."

The current implementation however may return NULL, which led to problems for me in our Drupal integration (causing PHP warnings)

Missing properties on Product Model.

Hi again @devtronic,

After a quick check on Billbee API, i realised that, they are missing properties on Product Model.

Base on the POST /api/v1/products
The missing properties are...

Condition
WidthCm
LengthCm
HeightCm
BillOfMaterial

This means, that i can't interact with this properties, if I make a get/post or patch request.

Thank you in advance.

Dependencies outdated for modern frameworks

I am building a custom Laravel Application and would love to use the SDK but unfortunately there are multiple dependencies that are too low in order for it to install with composer.

  • SDK needs guzzle version 6.3 but Laravel uses 7.0
  • SDK needs psr/log 1.1 but Laravel uses 3.0.0

Question 1: Is is easy to fork the project and make the changes so the SDK can use the newer Versions?
Question 2: Is it possible to just use both versions in my composer in order to support the SDK as well as Laravel?

What would be your approach when you got such a problem? Any help appreciated.

Extend the Shipments API implementation

Currently, the Shipments endpoint only has implemented the shippingproviders and shipwithlabel calls. There are a few more though available in the API. Especially querying the shipments would be very important for us, as we want to update the order in the webshop by adding the shipment tracking number

How do I create a product? How do I search for a product?

My goal is:
Reading out whether the product is available and if not, then creating it, but I already have an error while creating it.

My code:

...
$product = new Product;
$title = new TranslatableText;
$title->text = 'Test';
$title->languageCode = 'de';

$product->title 		= $title;
$product->sku		= 'test';
$product->soldAmount	=  99.99;

print_r($product);

$test = $client->createProduct($product);
print_r($test);
...

My Error:
Fatal error:
Uncaught GuzzleHttp\Exception\ClientException:
Client error: POST https://app.billbee.io/api/v1/products resulted in a 400 Bad Request response: {"Message":"Die Anforderung ist ungültig.","ModelState":{"model.Title.text":["Cannot deserialize the current JSON objec (truncated...) in .../vendor/guzzlehttp/guzzle/src/Exception/RequestException.php:113 Stack trace: #0 .../vendor/guzzlehttp/guzzle/src/Middleware.php(65): GuzzleHttp\Exception\RequestException::create(Object(GuzzleHttp\Psr7\Request), Object(GuzzleHttp\Psr7\Response)) #1 .../vendor/guzzlehttp/promises/src/Promise.php(204): GuzzleHttp\Middleware::GuzzleHttp{closure}(Object(GuzzleHttp\Psr7\Response)) #2
.../vendor/guzzlehttp/promises/src/Promise.php(153):
GuzzleHttp\Promise\Promise::callHandler(1, Object(GuzzleHttp\Psr7\Response), NULL) #3
.../ap in .../vendor/guzzlehttp/guzzle/src/Exception/RequestException.php on line 113

Search for products (etc) don't return data.

I'm trying to use the search endpoint "/api/v1/search".

The response from the server has "status Code: 200", but i don't see anywhere related data with the search.

use BillbeeDe\BillbeeAPI\Client;

$user = Config::get('BILLBEE_USER');
$apiPassword = Config::get('BILLBEE_API_PASSWORD');
$apiKey = Config::get('BILLBEE_API_KEY');

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

$response = $client->post('search', [
    'form_params' => [
        'Type' => 'product',
        'Term' => 'title:"samsung"',
    ]
]);

Here is the response from the server.

Response {#5671 ▼
  -reasonPhrase: "OK"
  -statusCode: 200
  -headers: array:11 [▶]
  -headerNames: array:11 [▶]
  -protocol: "1.1"
  -stream: Stream {#5691 ▶}
}

Error in SoldProduct Serialization

The SoldProduct Properties can be "null" if this is a discount position or something else.

BillbeeDe\BillbeeAPI\Model\SoldProduct::getSkuOrId(): Return value must be of type string, null returned

at C:\Users\refli\Projekte\beeconnect\vendor\billbee\billbee-api\src\Model\SoldProduct.php:184
180▕ }
181▕
182▕ public function getSkuOrId(): string
183▕ {
➜ 184▕ return $this->skuOrId;
185▕ }
186▕
187▕ public function setSkuOrId(string $skuOrId): self
188▕ {

I am happy to help again!

How do I create a product? How do I search for a product?

My problem has been closed, but my problem is still there:

My problem:
My goal is:
Reading out whether the product is available and if not, then creating it, but I already have an error while creating it.

My code:

...
$product = new Product;
$title = new TranslatableText;
$title->text = 'Test';
$title->languageCode = 'de';

$product->title 		= $title;
$product->sku		= 'test';
$product->soldAmount	=  99.99;

print_r($product);

$test = $client->createProduct($product);
print_r($test);
...

My Error:
Fatal error:
Uncaught GuzzleHttp\Exception\ClientException:
Client error: POST https://app.billbee.io/api/v1/products resulted in a 400 Bad Request response: {"Message":"Die Anforderung ist ungültig.","ModelState":{"model.Title.text":["Cannot deserialize the current JSON objec (truncated...) in .../vendor/guzzlehttp/guzzle/src/Exception/RequestException.php:113 Stack trace: #0 .../vendor/guzzlehttp/guzzle/src/Middleware.php(65): GuzzleHttp\Exception\RequestException::create(Object(GuzzleHttp\Psr7\Request), Object(GuzzleHttp\Psr7\Response)) #1 .../vendor/guzzlehttp/promises/src/Promise.php(204): GuzzleHttp\Middleware::GuzzleHttp{closure}(Object(GuzzleHttp\Psr7\Response)) #2
.../vendor/guzzlehttp/promises/src/Promise.php(153):
GuzzleHttp\Promise\Promise::callHandler(1, Object(GuzzleHttp\Psr7\Response), NULL) #3
.../ap in .../vendor/guzzlehttp/guzzle/src/Exception/RequestException.php on line 113

My addendum:

Thanks again for your help. I am working on the problem again and I keep getting the error 500 Internal Server Error.
Can you help me please?

Uncaught GuzzleHttp\Exception\ServerException: Server error: 'POST https://app.billbee.io/api/v1/products' resulted in a '500 Internal Server Error' response:

#75

When i am using composer install the version of Billbee is coming 1.9 not 2.0.

When I am using composer to install the Billbee API via composer it comes with version 1.9 and seen in SRC folder some files missing like "BatchClientInterface.php" and "ClientInterface.php". Please check on this. When i am trying to update in my composer version 2.0 it giving me bug as below:

  • Root composer.json requires billbee/billbee-api ^2.0, found billbee/billbee-api[v2.0.0-RC1, v2.0.0-RC2, v2.0.0-RC3, 2.0.0.x-dev] but it does not match your minimum-stability.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.