ho-nl / bolcom_retailerapi Goto Github PK
View Code? Open in Web Editor NEWPackage that talks to the bol.com v8 API
Package that talks to the bol.com v8 API
To be able to make a shippinglabel from bol we need the list of available shipping labes with their corresponding shippingLabelCode. I cannot see this option:
The shippingLabelCode is not always the same and can en will change, so we need this option.
purchasable-shippinglabels
Should generate somehting like:
{
"purchasableShippingLabels" : [ {
"transporterCode" : "DHLFORYOU",
"labelType" : "PARCEL",
"maxWeight" : "10 kg",
"maxDimensions" : "80 x 40 x 18,75 cm",
"retailerPrice" : 6.0,
"purchasePrice" : 4.83,
"discount" : 2.38,
"shippingLabelCode" : "PLR00000002"
}, {
"transporterCode" : "TNT",
"labelType" : "PARCEL",
"maxWeight" : "2 kg",
"maxDimensions" : "38 x 26,5 x 3,2 cm",
"retailerPrice" : 5.5,
"purchasePrice" : 4.22,
"discount" : 0.51,
"shippingLabelCode" : "PLR00000011"
}, {
"transporterCode" : "DPD-NL",
"labelType" : "PARCEL",
"maxWeight" : "20 kg",
"maxDimensions" : "100 x 50 x 50 cm",
"retailerPrice" : 6.5,
"purchasePrice" : 6.39,
"discount" : 2.63,
"shippingLabelCode" : "PLR00000014"
} ]
}
I have some issues with this package. I was in the process of fixing most of it in a fork and then submit a merge request, but then I realized the model classes were autogenerated.
The biggest issue is that the location of some classes don't match their namespace, and thus violate the PSR-4 autoloading standard. These classes won't autoload in Composer 2.x.
I'm not familiar with prolic/fpp
, but I tried installing it and it looks like it could be re-run to fix some of the issues.
Thoughts?
In ReducedReturnItem.php line 201:
[InvalidArgumentException]
Key 'returnReasonComments' is missing in data array or is not a string
Exception trace:
() at app/vendor/bol-com/retailer-api/src/Model/Rma/ReducedReturnItem.php:201
BolCom\RetailerApi\Model\Rma\ReducedReturnItem::fromArray() at app/vendor/bol-com/retailer-api/src/Model/Rma/ReturnItemList.php:53
BolCom\RetailerApi\Model\Rma\ReturnItemList::fromArray() at app/vendor/bol-com/retailer-api/src/Handler/Rma/GetAllReturnsHandler.php:54
BolCom\RetailerApi\Handler\Rma\GetAllReturnsHandler->__invoke() at app/vendor/bol-com/retailer-api/src/Infrastructure/MessageBus.php:111
namespace BolCom\RetailerApi\Handler\Invoice; must be instead of namespace BolCom\RetailerApi\Handler\Commission;
Same is about GetInvoiceHandler
Data returned by API call:
Array
(
[shipmentId] => XXXXX
[shipmentDate] => 2019-08-25T22:04:27+02:00
[shipmentReference] => XXXX
[shipmentItems] => Array
(
[0] => Array
(
[orderItemId] => XXZ
[orderId] => XXX
[orderDate] => 2019-08-25T20:06:12+02:00
[latestDeliveryDate] => 2019-08-26
[ean] => XXXX
[title] => XXXXX
[quantity] => 1
[offerPrice] => 36.99
[offerCondition] => NEW
[offerReference] => XXXX
[fulfilmentMethod] => FBB
)
)
[transport] => Array
(
[transportId] => XXX
[transporterCode] => TNT
[trackAndTrace] => XX
)
[customerDetails] => Array
(
[salutationCode] => XXX
[zipCode] => XXX
[countryCode] => NL
)
)
In CustomerDetails.php line 207:
[InvalidArgumentException]
Key 'firstName' is missing in data array or is not a string
Exception trace:
() at /var/www/projects/bol.com-app/vendor/bol-com/retailer-api/src/Model/Customer/CustomerDetails.php:207
BolCom\RetailerApi\Model\Customer\CustomerDetails::fromArray() at /var/www/projects/bol.com-app/vendor/bol-com/retailer-api/src/Model/Shipment/Shipment.php:157
BolCom\RetailerApi\Model\Shipment\Shipment::fromArray() at /var/www/projects/bol.com-app/vendor/bol-com/retailer-api/src/Handler/Shipment/GetShipmentHandler.php:46
BolCom\RetailerApi\Handler\Shipment\GetShipmentHandler->__invoke() at /var/www/projects/bol.com-app/vendor/bol-com/retailer-api/src/Infrastructure/MessageBus.php:111
BolCom\RetailerApi\Infrastructure\MessageBus->dispatch() at /var/www/projects/bol.com-app/src/Command/Local/BolComApiV3Command.php:53
Api returns:
Array
(
[shipmentId] => 578966572
[shipmentDate] => 2018-05-14T13:37:37+02:00
[shipmentItems] => Array
(
[0] => Array
(
[orderItemId] => XXXXX
[orderId] =>XXXXX
[orderDate] => 2018-05-11T21:31:30+02:00
[latestDeliveryDate] => 2018-05-15
[ean] => XXXXX
[title] => Product Title
[quantity] => 1
[offerPrice] => 16.95
[offerCondition] => NEW
[fulfilmentMethod] => FBR
)
)
)
Library returns various errors:
1) In Shipment.php line 127:
[InvalidArgumentException]
Key 'shipmentReference' is missing in data array or is not a string
() at /var/www/projects/bol.com-app/vendor/bol-com/retailer-api/src/Model/Shipment/Shipment.php:127
BolCom\RetailerApi\Model\Shipment\Shipment::fromArray() at /var/www/projects/bol.com-app/vendor/bol-com/retailer-api/src/Handler/Shipment/GetShipmentHandler.php:46
BolCom\RetailerApi\Handler\Shipment\GetShipmentHandler->__invoke() at /var/www/projects/bol.com-app/vendor/bol-com/retailer-api/src/Infrastructure/MessageBus.php:111
2) In ShipmentItem.php line 219:
[InvalidArgumentException]
Key 'offerReference' is missing in data array or is not a string
Exception trace:
() at /var/www/projects/bol.com-app/vendor/bol-com/retailer-api/src/Model/Shipment/ShipmentItem.php:219
BolCom\RetailerApi\Model\Shipment\ShipmentItem::fromArray() at /var/www/projects/bol.com-app/vendor/bol-com/retailer-api/src/Model/Shipment/Shipment.php:143
BolCom\RetailerApi\Model\Shipment\Shipment::fromArray() at /var/www/projects/bol.com-app/vendor/bol-com/retailer-api/src/Handler/Shipment/GetShipmentHandler.php:46
BolCom\RetailerApi\Handler\Shipment\GetShipmentHandler->__invoke() at /var/www/projects/bol.com-app/vendor/bol-com/retailer-api/src/Infrastructure/MessageBus.php:111
3) In Shipment.php line 148:
[InvalidArgumentException]
Key 'transport' is missing in data array or is not an array
Exception trace:
() at /var/www/projects/bol.com-app/vendor/bol-com/retailer-api/src/Model/Shipment/Shipment.php:148
BolCom\RetailerApi\Model\Shipment\Shipment::fromArray() at /var/www/projects/bol.com-app/vendor/bol-com/retailer-api/src/Handler/Shipment/GetShipmentHandler.php:46
BolCom\RetailerApi\Handler\Shipment\GetShipmentHandler->__invoke() at /var/www/projects/bol.com-app/vendor/bol-com/retailer-api/src/Infrastructure/MessageBus.php:111
4) In Shipment.php line 154:
[InvalidArgumentException]
Key 'customerDetails' is missing in data array or is not an array
Exception trace:
() at /var/www/projects/bol.com-app/vendor/bol-com/retailer-api/src/Model/Shipment/Shipment.php:154
BolCom\RetailerApi\Model\Shipment\Shipment::fromArray() at /var/www/projects/bol.com-app/vendor/bol-com/retailer-api/src/Handler/Shipment/GetShipmentHandler.php:46
BolCom\RetailerApi\Handler\Shipment\GetShipmentHandler->__invoke() at /var/www/projects/bol.com-app/vendor/bol-com/retailer-api/src/Infrastructure/MessageBus.php:111
In ProcessingResult.php line 64:
[InvalidArgumentException]
Unknown enum value given: CANCELLED
Exception trace:
() at app/vendor/bol-com/retailer-api/src/Model/Rma/ProcessingResult.php:64
BolCom\RetailerApi\Model\Rma\ProcessingResult::fromValue() at app/vendor/bol-com/retailer-api/src/Model/Rma/ReducedReturnItem.php:231
BolCom\RetailerApi\Model\Rma\ReducedReturnItem::fromArray() at app/vendor/bol-com/retailer-api/src/Model/Rma/ReturnItemList.php:53
BolCom\RetailerApi\Model\Rma\ReturnItemList::fromArray() at app/vendor/bol-com/retailer-api/src/Handler/Rma/GetAllReturnsHandler.php:54
BolCom\RetailerApi\Handler\Rma\GetAllReturnsHandler->__invoke() at app/vendor/bol-com/retailer-api/src/Infrastructure/MessageBus.php:111
Delivery date constant DC34d is no longer defined in:
https://github.com/ho-nl/BolCom_RetailerApi/blob/master/src/Model/Offer/DeliveryCode.php#L48
Your Magento plugin is using this constant. (ho-nl/bol-com-retailer).
Model/Config/Source/DeliveryCode.php:33
\BolCom\RetailerApi\Model\Offer\DeliveryCode::DC34d
As usually, in real world bol.com api does not match to documentation. I have multiple examples of missed "firstName" in GetOrder responses. As you can see below shipping address doe not contain any names at all.
Stack:
In AddressDetails.php line 207:
[InvalidArgumentException]
Key 'firstName' is missing in data array or is not a string
Exception trace:
at /var/www/projects/bol.com-app/vendor/bol-com/retailer-api/src/Model/Order/AddressDetails.php:207
BolCom\RetailerApi\Model\Order\AddressDetails::fromArray() at /var/www/projects/bol.com-app/vendor/bol-com/retailer-api/src/Model/Order/OrderCustomerDetails.php:48
BolCom\RetailerApi\Model\Order\OrderCustomerDetails::fromArray() at /var/www/projects/bol.com-app/vendor/bol-com/retailer-api/src/Model/Order/Order.php:103
BolCom\RetailerApi\Model\Order\Order::fromArray() at /var/www/projects/bol.com-app/vendor/bol-com/retailer-api/src/Handler/Order/GetOrderHandler.php:39
BolCom\RetailerApi\Handler\Order\GetOrderHandler->__invoke() at /var/www/projects/bol.com-app/vendor/bol-com/retailer-api/src/Infrastructure/MessageBus.php:111
Example of response:
Array
(
[orderId] => 2912074080
[pickUpPoint] => 1
[dateTimeOrderPlaced] => 2020-04-09T11:16:04+02:00
[customerDetails] => Array
(
[shipmentDetails] => Array
(
[pickUpPointName] => XXXX
[salutationCode] => XXXX
[streetName] => XXXX
[houseNumber] => XXX
[zipCode] => XXXXX
[city] => Kaatsheuvel
[countryCode] => NL
[email] => [email protected]
)
[billingDetails] => Array
(
[salutationCode] => 03
[firstName] => XXXX
[surName] => XXXX
[streetName] => XXXX
[houseNumber] => 17
[zipCode] => 5171 SP
[city] => XXX
[countryCode] => NL
[email] => [email protected]
)
)
[orderItems] => Array
(
[0] => Array
(
[orderItemId] => XXXXXXX
[offerReference] => XXXXXXX
[ean] => XXXXXXX
[title] => WXXXXXXX
[quantity] => 1
[offerPrice] => 18.99
[offerId] => 81b....67
[transactionFee] => 3.33
[latestDeliveryDate] => 2020-04-10
[offerCondition] => NEW
[cancelRequest] =>
[fulfilmentMethod] => FBB
)
)
)
First of all: Very nice package! Thanks for that :)
I'm running into this issue where I'm trying to send a FBB offer and the validator says that the 'deliveryCode' key is mandatory:
Key 'deliveryCode' is missing in data array or is not a string
After adding the key the validator is OK and I get a response from Bol saying that the deliveryCode key is not allowed when fulfilment type is FBB. Makes sense because all delivery codes are the same for FBB!
Request contains invalid value(s): 'Fulfilment(type=FBB, deliveryCode=1-2d)', DeliveryCode is not allowed for fulfilment type FBB.
I'm feeling this is a bug in the validator, but correct me if I'm wrong.
On call "get returns' bol.com Api returns some dates in format "2019-05-15T17:09:38.137+02:00" which causes Assert\InvalidArgumentException: Value is not a valid ISO 8601 format.
Problem with milliseconds part in date time string.
Here is final stack in one of my cases:
() at app/vendor/beberlei/assert/lib/Assert/Assertion.php:2752
Assert\Assertion::createException() at app/vendor/beberlei/assert/lib/Assert/Assertion.php:2403
Assert\Assertion::date() at app/vendor/bol-com/retailer-api/src/Model/DateTime.php:16
BolCom\RetailerApi\Model\DateTime->__construct() at app/vendor/bol-com/retailer-api/src/Model/DateTime.php:30
BolCom\RetailerApi\Model\DateTime::fromString() at app/src/Command/Returns/ImportCommand.php:37
And one more similar place:
In Assertion.php line 2752:
[Assert\InvalidArgumentException (214)]
Value is not a valid ISO 8601 format.
Exception trace:
() at app/vendor/beberlei/assert/lib/Assert/Assertion.php:2752
Assert\Assertion::createException() at app/vendor/beberlei/assert/lib/Assert/Assertion.php:2403
Assert\Assertion::date() at pp/vendor/bol-com/retailer-api/src/Model/DateTime.php:19
BolCom\RetailerApi\Model\DateTime->__construct() at app/vendor/bol-com/retailer-api/src/Model/DateTime.php:33
BolCom\RetailerApi\Model\DateTime::fromString() at app/vendor/bol-com/retailer-api/src/Model/Rma/ReducedReturnItem.php:243
BolCom\RetailerApi\Model\Rma\ReducedReturnItem::fromArray() at app/vendor/bol-com/retailer-api/src/Model/Rma/ReturnItemList.php:53
BolCom\RetailerApi\Model\Rma\ReturnItemList::fromArray() at app/vendor/bol-com/retailer-api/src/Handler/Rma/GetAllReturnsHandler.php:54
BolCom\RetailerApi\Handler\Rma\GetAllReturnsHandler->__invoke() at app/vendor/bol-com/retailer-api/src/Infrastructure/MessageBus.php:111
In #54 a change is introduced, particularly here that results in the GetStatusByProcessIdsHandler
no longer being able to handle concurrent requests.
Obviously i don't have access to the Magento module itself but you might want to check if this change is intentional and if so, refactor the method to no longer use promises or revert to support concurrent requests again.
I'd like the see an option where you can set the a custom product price for Bol.com seperatly from the Magento catalog price. This is useful to compensate for the Bol.com fees.
Currently Magento 2.3.7 or 2.4.x PHP 7.4 is required.
I have had to disable this module because it is not compatible with the PHP version and does give serious errors when ran on 7.4. But now I have disabled this module I get errors on the product pages in the admin that Class BolCom\Retailer\Model\Config\Soure\PublishStatus does not exist
.
Is there an expectation when it's compatible with 7.4 or how to resolve the issue above?
BolCom_RetailerApi/src/Model/Offer/domain.fpp
Lines 108 to 111 in cecd2d4
According to ReDoc the productTitle is optional and visible is required;
https://api.bol.com/retailer/public/redoc/v4#operation/get-offer
Data example:
Array
(
[shipmentId] => XXXXX
[shipmentDate] => 2019-08-25T22:04:27+02:00
[shipmentReference] => XXXXX
[shipmentItems] => Array
(
[0] => Array
(
[orderItemId] => XXXXX
[orderId] => XXXXX
[orderDate] => 2019-08-25T20:06:12+02:00
[latestDeliveryDate] => 2019-08-26
[ean] => XXXXX
[title] => XXXXX
[quantity] => 1
[offerPrice] => 36.99
[offerCondition] => NEW
[offerReference] => XXXXX
[fulfilmentMethod] => FBB
)
)
[transport] => Array
(
[transportId] => XXXXX
[transporterCode] => TNT
[trackAndTrace] => XXXXX
)
[customerDetails] => Array
(
[salutationCode] => 03
[zipCode] => 2541CD
[countryCode] => NL
)
)
In CustomerDetails.php line 217:
[InvalidArgumentException]
Key 'surname' is missing in data array or is not a string
Exception trace:
() at /var/www/projects/bol.com-app/vendor/bol-com/retailer-api/src/Model/Customer/CustomerDetails.php:217
BolCom\RetailerApi\Model\Customer\CustomerDetails::fromArray() at /var/www/projects/bol.com-app/vendor/bol-com/retailer-api/src/Model/Shipment/Shipment.php:166
BolCom\RetailerApi\Model\Shipment\Shipment::fromArray() at /var/www/projects/bol.com-app/vendor/bol-com/retailer-api/src/Handler/Shipment/GetShipmentHandler.php:46
BolCom\RetailerApi\Handler\Shipment\GetShipmentHandler->__invoke() at /var/www/projects/bol.com-app/vendor/bol-com/retailer-api/src/Infrastructure/MessageBus.php:111
$messageBus->dispatch(GetInvoiceList::with(Period::fromString('2019-11-01/2019-11-30')));
In AcceptHeaderMiddleware.php line 24:
Accept header is explicitly required, consult https://api.bol.com/retailer/public/redoc/ for options.
I cannot see an option to get a CSV with the current offers with id.
This option is available from the bol retailer api:
https://api.bol.com/retailer/offers/export
With regards, Theo
In ReducedReturnItem.php line 195:
[InvalidArgumentException]
Key 'returnReason' is missing in data array or is not a string
Exception trace:
() at app/vendor/bol-com/retailer-api/src/Model/Rma/ReducedReturnItem.php:195
BolCom\RetailerApi\Model\Rma\ReducedReturnItem::fromArray() at app/vendor/bol-com/retailer-api/src/Model/Rma/ReturnItemList.php:53
BolCom\RetailerApi\Model\Rma\ReturnItemList::fromArray() at app/vendor/bol-com/retailer-api/src/Handler/Rma/GetAllReturnsHandler.php:59
BolCom\RetailerApi\Handler\Rma\GetAllReturnsHandler->__invoke() at app/vendor/bol-com/retailer-api/src/Infrastructure/MessageBus.php:111
Data from API:
Array
(
[rmaId] => XXX
[orderId] => XXX
[ean] => XXX
[quantity] => 0
[registrationDateTime] => 2019-10-22T09:54:14+02:00
[fulfilmentMethod] => FBB
[handled] => 1
[handlingResult] => RETURN_RECEIVED
[processingResult] => ACCEPTED
[processingDateTime] => 2019-10-22T09:54:20+02:00
)
app/vendor/bol-com/retailer-api/src/Model/Rma/ReducedReturnItem.php:220:
string(32) "FAILED_TO_COLLECT_BY_TRANSPORTER"
In HandlingResult.php line 85:
[InvalidArgumentException]
Unknown enum value given
Exception trace:
() at app/vendor/bol-com/retailer-api/src/Model/Rma/HandlingResult.php:85
BolCom\RetailerApi\Model\Rma\HandlingResult::fromValue() at app/vendor/bol-com/retailer-api/src/Model/Rma/ReducedReturnItem.php:221
BolCom\RetailerApi\Model\Rma\ReducedReturnItem::fromArray() at app/vendor/bol-com/retailer-api/src/Model/Rma/ReturnItemList.php:53
BolCom\RetailerApi\Model\Rma\ReturnItemList::fromArray() at app/vendor/bol-com/retailer-api/src/Handler/Rma/GetAllReturnsHandler.php:54
BolCom\RetailerApi\Handler\Rma\GetAllReturnsHandler->__invoke() atapp/vendor/bol-com/retailer-api/src/Infrastructure/MessageBus.php:111
Array
(
[orderId] => XXXX
[dateTimeOrderPlaced] => 2019-10-30T13:24:32+01:00
[customerDetails] => Array
(
[shipmentDetails] => Array
(
[salutationCode] => 03
[firstName] => XXXX
[surName] => XXXX
[streetName] => XXX
[houseNumber] => XXX
[houseNumberExtended] => XXX
[zipCode] => XXX
[city] => Amsterdam
[countryCode] => NL
[email] => [email protected]
)
[billingDetails] => Array
(
[salutationCode] => 03
[firstName] => XXXX
[surName] => XXX
[streetName] => XXXXXX
[houseNumber] => XXXX
[houseNumberExtended] => XXXX
[zipCode] => XXXX
[city] => XXX
[countryCode] => NL
[email] => [email protected]
)
)
[orderItems] => Array
(
[0] => Array
(
[orderItemId] => XXXX
[ean] => XXXX
[title] => XXXXXX
[quantity] => 1
[offerPrice] => 23.85
[offerId] => XXXXX
[transactionFee] => 4.58
[latestDeliveryDate] => 2019-10-31
[offerCondition] => NEW
[cancelRequest] =>
[fulfilmentMethod] => FBB
)
)
)
In OrderItem.php line 171:
[InvalidArgumentException]
Key 'offerReference' is missing in data array or is not a string
Exception trace:
() at /var/www/projects/bol.com-app/vendor/bol-com/retailer-api/src/Model/Order/OrderItem.php:171
BolCom\RetailerApi\Model\Order\OrderItem::fromArray() at /var/www/projects/bol.com-app/vendor/bol-com/retailer-api/src/Model/Order/Order.php:116
BolCom\RetailerApi\Model\Order\Order::fromArray() at /var/www/projects/bol.com-app/vendor/bol-com/retailer-api/src/Handler/Order/GetOrderHandler.php:39
BolCom\RetailerApi\Handler\Order\GetOrderHandler->__invoke() at /var/www/projects/bol.com-app/vendor/bol-com/retailer-api/src/Infrastructure/MessageBus.php:111
This still doesn't work, we tried so many things.
ShipOrderItems does exist but keep given errors if used in the way discribed. ShipOrderItem cannot be found.
From May 1st we have to leave V4 and are are desperate by now.
/** @var \BolCom\RetailerApi\Model\ProcessStatus\ProcessStatus $processStatus */
$processStatus = $messageBus->dispatch(\BolCom\RetailerApi\Model\Order\Command\ShipOrderItems::with(
\BolCom\RetailerApi\Model\Order\OrderItemId::fromString('6107434013'),
'Shipment Reference',
\BolCom\RetailerApi\Model\Transport\TransportInstruction::fromArray([
'transporterCode' => 'TNT',
'trackAndTrace' => '123456789'
])
));
Any advice on how to get this going? All other code for getting orders and updating offers is working fine.
With regards, Theo
When Transporter code "DPD België" is selected and tracking codes are added to an order the "Invalid Transporter data: Unknown enum value given" error is thrown.
The root cause of the problem is likely located in src/Model/Transport/domain.fpp
We are having problems with the shipment updates to Bol. Since the v4 update this isn't working properly anymore. At first we found out we had to update the ShipOrderItem to the ShipOrderItems version while this gave an error that the Handler was not found anymore for this command.
At the moment we are stuck with the following error message:
Call to undefined method BolCom\RetailerApi\Model\Order\OrderItemId::toArray()
It looks like this method is just not defined, is this correct or are we missing out on something
We use the following code:
/** @var \BolCom\RetailerApi\Model\ProcessStatus\ProcessStatus $processStatus */
$processStatus = $this->messageBus->dispatch(ShipOrderItems::with(
[OrderItemId::fromString($orderline->external_reference_id)],
"{$orderline->order->external_reference_id}:{$orderline->external_reference_id}",
null,
$this->getTransportInstruction($orderline->shippingMethod, $orderline->barcode) // returning \BolCom\RetailerApi\Model\Transport\TransportInstruction
));
In HandlingResult.php line 92:
[InvalidArgumentException]
Unknown enum value given: RETURN_ITEM_LOST
Exception trace:
() at /app/vendor/bol-com/retailer-api/src/Model/Rma/HandlingResult.php:92
BolCom\RetailerApi\Model\Rma\HandlingResult::fromValue() at app/vendor/bol-com/retailer-api/src/Model/Rma/ReducedReturnItem.php:221
BolCom\RetailerApi\Model\Rma\ReducedReturnItem::fromArray() at app/vendor/bol-com/retailer-api/src/Model/Rma/ReturnItemList.php:53
BolCom\RetailerApi\Model\Rma\ReturnItemList::fromArray() at app/vendor/bol-com/retailer-api/src/Handler/Rma/GetAllReturnsHandler.php:54
BolCom\RetailerApi\Handler\Rma\GetAllReturnsHandler->__invoke() at app/vendor/bol-com/retailer-api/src/Infrastructure/MessageBus.php:111
BolCom\RetailerApi\Infrastructure\MessageBus->dispatch() at app/src/BolCom/ReturnsService.php:37
How to properly deal with "401 JWT expired" in long script?
Injection RefreshToken GrantType in constructor of BolCom\RetailerApi\Client\Oauth2Middleware did not help.
UPDATE: as I found it probably happens after multiple requests and when last returns 429 for the Retry.
Exception: Client error:
GET https://api.bol.com/retailer/shipments?page=1&order-id=2547266220` resulted in a 401 JWT expired at 2020-03-24T10:32:19Z. Current time: 2020-03-24T10:33:00Z, a difference of 40501 milliseconds. Allowed clock skew: 1000 milliseconds.:
response:
(truncated...)
#0 /var/www/html/bolcom_app_nonarbitrage/vendor/bol-com/retailer-api/src/Client/RequestException.php(47): GuzzleHttp\Exception\RequestException::create(Object(GuzzleHttp\Psr7\Request), Object(GuzzleHttp\Psr7\Response))
#1 /var/www/html/bolcom_app_nonarbitrage/vendor/bol-com/retailer-api/src/Client/RequestExceptionMiddleware.php(25): BolCom\RetailerApi\Client\RequestException::create(Object(GuzzleHttp\Psr7\Request), Object(GuzzleHttp\Psr7\Response))
#2 /var/www/html/bolcom_app_nonarbitrage/vendor/guzzlehttp/promises/src/Promise.php(203): BolCom\RetailerApi\Client\RequestExceptionMiddleware->BolCom\RetailerApi\Client{closure}(Object(GuzzleHttp\Psr7\Response))
#3 /var/www/html/bolcom_app_nonarbitrage/vendor/guzzlehttp/promises/src/Promise.php(156): GuzzleHttp\Promise\Promise::callHandler(1, Object(GuzzleHttp\Psr7\Response), Array)
#4 /var/www/html/bolcom_app_nonarbitrage/vendor/guzzlehttp/promises/src/TaskQueue.php(47): GuzzleHttp\Promise\Promise::GuzzleHttp\Promise{closure}()
#5 /var/www/html/bolcom_app_nonarbitrage/vendor/guzzlehttp/promises/src/Promise.php(246): GuzzleHttp\Promise\TaskQueue->run(true)
#6 /var/www/html/bolcom_app_nonarbitrage/vendor/guzzlehttp/promises/src/Promise.php(223): GuzzleHttp\Promise\Promise->invokeWaitFn()
#7 /var/www/html/bolcom_app_nonarbitrage/vendor/guzzlehttp/promises/src/Promise.php(267): GuzzleHttp\Promise\Promise->waitIfPending()
#8 /var/www/html/bolcom_app_nonarbitrage/vendor/guzzlehttp/promises/src/Promise.php(225): GuzzleHttp\Promise\Promise->invokeWaitList()
#9 /var/www/html/bolcom_app_nonarbitrage/vendor/guzzlehttp/promises/src/Promise.php(62): GuzzleHttp\Promise\Promise->waitIfPending()
#10 /var/www/html/bolcom_app_nonarbitrage/vendor/guzzlehttp/guzzle/src/Client.php(183): GuzzleHttp\Promise\Promise->wait()
#11 /var/www/html/bolcom_app_nonarbitrage/vendor/guzzlehttp/guzzle/src/Client.php(96): GuzzleHttp\Client->request('get', 'shipments', Array)
#12 /var/www/html/bolcom_app_nonarbitrage/vendor/bol-com/retailer-api/src/Handler/Shipment/GetShipmentListHandler.php(40): GuzzleHttp\Client->__call('get', Array)
`
Hi,
In your example of ShipOrderItem:
/** @var \BolCom\RetailerApi\Model\ProcessStatus\ProcessStatus $processStatus */ $processStatus = $messageBus->dispatch(\BolCom\RetailerApi\Model\Order\Command\ShipOrderItem::with( \BolCom\RetailerApi\Model\Order\OrderItemId::fromString('6107434013'), 'Shipment Reference', null, \BolCom\RetailerApi\Model\Transport\TransportInstruction::fromArray([ 'transporterCode' => 'TNT', 'trackAndTrace' => '123456789' ]) ));
PHPSTORM is telling me:
Method call is provided 4 parameters, but the method signature uses 3 parameters
So actually the ShipOrderItem isn't doing anything with the Transportinstructions. And Bol.com doesn't get the transportCode and Track&Trace info.
I then need to update the shipment ID with a PUT to /retailer/transports/123456 with the TransportCode and Track&trace, only then the correct info is added to the Bol order.
Is that how its supposed to work? Or should the track&trace info be added to the order directly?
Hi,
I figured out that setting the api to testmode can be done by adding the $clientUrl to the ClientConfig constructor. Works fine, but as a user of the package I really don't care about the urls, I just want to enable or disable testmode.
I see two solutions to this enhancement:
1: You're doing such a great job putting everything in constants, let's put these url's in constants as well, so I can grab them when needed.
2: My favourite and it extends solution 1: Change the constructor in ClientConfig and replace the $clientUrl parameter with $testMode. The $testMode boolean will decide witch of the two urls to use.
In api v2 if you want to update an offer it could be done easily. The offers are uniquely identified by the combination of EAN+Condition.
In this api version (v3) you need an offer-id for a offer update / delete.
So my question is, how can I easily update an offer, like in v2, with for example only EAN or Reference? My guess is this is not possible.
So the question is: how can you push an update without needing the export file or creating a database which contains all the offer-id's? Take into account the you can only ask 10 export files in an hour, due to limits.
In MessageBus.php line 105:
Handler not found for command "BolCom\RetailerApi\Model\Invoice\Query\GetInvoiceList".
Same problem is still of problem?
We are having the same problem:
PHP Fatal error: Uncaught Error: Call to undefined method BolCom\RetailerApi\Model\Order\Command\ShipOrderItem::with()
The file ShipOrderItem.php is in the correct folder.
If I get a print of the after logging in the handler is missing:
[handlerMapping:BolCom\RetailerApi\Infrastructure\MessageBus:private] => Array
(
[BolCom\RetailerApi\Model\Order\Query\GetAllOpenOrders] => BolCom\RetailerApi\Handler\Order\GetAllOpenOrdersHandler
[BolCom\RetailerApi\Model\Order\Query\GetOrder] => BolCom\RetailerApi\Handler\Order\GetOrderHandler
[BolCom\RetailerApi\Model\Order\Command\CancelOrder] => BolCom\RetailerApi\Handler\Order\CancelOrderHandler
[BolCom\RetailerApi\Model\Order\Command\ShipOrderItems] => BolCom\RetailerApi\Handler\Order\ShipOrderItemHandler
[BolCom\RetailerApi\Model\Offer\Command\CreateOffer] => BolCom\RetailerApi\Handler\Offer\CreateOfferHandler
[BolCom\RetailerApi\Model\Offer\Command\UpdateOffer] => BolCom\RetailerApi\Handler\Offer\UpdateOfferHandler
[BolCom\RetailerApi\Model\Offer\Command\UpdateOfferPrice] => BolCom\RetailerApi\Handler\Offer\UpdateOfferPriceHandler
[BolCom\RetailerApi\Model\Offer\Command\UpdateOfferStock] => BolCom\RetailerApi\Handler\Offer\UpdateOfferStockHandler
[BolCom\RetailerApi\Model\Offer\Query\GetOffer] => BolCom\RetailerApi\Handler\Offer\GetOfferHandler
[BolCom\RetailerApi\Model\Offer\Command\DeleteOffer] => BolCom\RetailerApi\Handler\Offer\DeleteOfferHandler
[BolCom\RetailerApi\Model\Rma\Query\GetAllReturns] => BolCom\RetailerApi\Handler\Rma\GetAllReturnsHandler
[BolCom\RetailerApi\Model\Rma\Query\GetReturn] => BolCom\RetailerApi\Handler\Rma\GetReturnHandler
[BolCom\RetailerApi\Model\Rma\Command\HandleReturn] => BolCom\RetailerApi\Handler\Rma\HandleReturnHandler
[BolCom\RetailerApi\Model\ProcessStatus\Query\GetStatusByEntity] => BolCom\RetailerApi\Handler\ProcessStatus\GetStatusByEntityHandler
[BolCom\RetailerApi\Model\ProcessStatus\Query\GetStatusByProcessIds] => BolCom\RetailerApi\Handler\ProcessStatus\GetStatusByProcessIdsHandler
[BolCom\RetailerApi\Model\Shipment\Query\GetShipment] => BolCom\RetailerApi\Handler\Shipment\GetShipmentHandler
[BolCom\RetailerApi\Model\Shipment\Query\GetShipmentList] => BolCom\RetailerApi\Handler\Shipment\GetShipmentListHandler
[BolCom\RetailerApi\Model\Inventory\Query\GetInventory] => BolCom\RetailerApi\Handler\Inventory\GetInventoryHandler
)
With regards, Theo
Volume discount is now officially supported by the Bol.com Retailer API.
Any plans of implanting this in the package?
We have in shipping method rate type "Table" is configured and at website level config table condition "Table vs. Destination" set. The table uploaded has different shipping prices based on weight and country location and zip code. But shipment creation always takes first price of table and ignores weight based price of shipping.
When I run the following code it returns the inventory response of the first user in the clientPool for all users...
$clientPoolArr = [];
foreach ($found_users as $key => $the_user) {
$clientPoolArr['user_' . $the_user['id']] = new \BolCom\RetailerApi\Client(new \BolCom\RetailerApi\Client\ClientConfig($the_user['public_key'], $the_user['private_key']));
}
$clientPool = new \BolCom\RetailerApi\Infrastructure\ClientPool($clientPoolArr);
$this->MessageBus = new \BolCom\RetailerApi\Infrastructure\MessageBus($clientPool);
//Request from all clients
foreach ($clientPool->names() as $name) {
/** @var \BolCom\RetailerApi\Model\Inventory\InventoryOfferList $inventoryOfferList */
$inventoryOfferList = $this->MessageBus->dispatch(\BolCom\RetailerApi\Model\Inventory\Query\GetInventory::with(
1
), $name);
var_dump($inventoryOfferList);
}
Got fatal error PHP Fatal error: Uncaught InvalidArgumentException: Key 'latestDeliveryDate' is missing in data array or is not a string in vendor/bol-com/retailer-api/src/Model/Order/OrderItem.php:229
However, latestDeliveryDate
is not always present:
Array
(
[orderItemId] =>
[offerReference] =>
[ean] =>
[title] =>
[quantity] =>
[offerPrice] =>
[offerId] =>
[transactionFee] =>
[expiryDate] => 2021-02-22
[exactDeliveryDate] => 2021-02-19
[offerCondition] => NEW
[cancelRequest] =>
[fulfilmentMethod] => FBR
)
In addition, the fields exactDeliveryDate
, expiryDate
are not supported at this time.
{
"orderItemId":"2012345678",
"offerReference":"BOLCOM00123",
"ean":"0000007740404",
"title":"Product Title",
"quantity":10,
"offerPrice":27.95,
"offerId":"xxxx",
"transactionFee":5.18,
"latestDeliveryDate":"2017-02-10",
"expiryDate":"2017-02-13",
"exactDeliveryDate":"2017-02-13",
"offerCondition":"NEW",
"cancelRequest":false,
"fulfilmentMethod":"FBR",
"additionalServices":[
{
"serviceType":"PLACEMENT_AND_INSTALLATION"
}
]
}
Call \Assert\Assertion::contains('/', $period); in AssertDateRange:assert has mixed up parameters!
In real world it is possible has no email in address info. Below output of "GetOrder" call which ends with exception:
In AddressDetails.php line 279: [InvalidArgumentException] Key 'email' is missing in data array or is not a string
Exception trace: at /var/www/projects/bol.com-app/vendor/bol-com/retailer-api/src/Model/Order/AddressDetails.php:279
Array
(
[orderId] => 2803264670
[dateTimeOrderPlaced] => 2020-01-05T19:42:56+01:00
[customerDetails] => Array
(
[shipmentDetails] => Array
(
[salutationCode] => XXX
[firstName] => XXX
[surName] => XXX
[streetName] => XXX
[houseNumber] => XXX
[zipCode] => XXX
[city] => XXX
[countryCode] => NL
)
[billingDetails] => Array
(
[salutationCode] => XXX
[firstName] => XXX
[surName] => XXX
[streetName] => XXX
[houseNumber] => XXX
[zipCode] => XXX
[city] => XXX
[countryCode] => NL
)
)
[orderItems] => Array
(
[0] => Array
(
XXX
)
)
)
From time to time on import we got such exception:
[app] Exception: Unknown enum value given
#0 /var/www/html/bolcom_app_nonarbitrage/vendor/bol-com/retailer-api/src/Model/Shipment/ShipmentItem.php(216): BolCom\RetailerApi\Model\Offer\Condition::fromValue('UNKNOWN')
#1 /var/www/html/bolcom_app_nonarbitrage/vendor/bol-com/retailer-api/src/Model/Shipment/Shipment.php(147): BolCom\RetailerApi\Model\Shipment\ShipmentItem::fromArray(Array)
#2 /var/www/html/bolcom_app_nonarbitrage/vendor/bol-com/retailer-api/src/Handler/Shipment/GetShipmentHandler.php(50): BolCom\RetailerApi\Model\Shipment\Shipment::fromArray(Array)
#3 /var/www/html/bolcom_app_nonarbitrage/vendor/bol-com/retailer-api/src/Infrastructure/MessageBus.php(111): BolCom\RetailerApi\Handler\Shipment\GetShipmentHandler->__invoke(Object(BolCom\RetailerApi\Model\Shipment\Query\GetShipment))
#4 /var/www/html/bolcom_app_nonarbitrage/src/BolCom/RetailerApi/MessageBus.php(30): BolCom\RetailerApi\Infrastructure\MessageBus->dispatch(Object(BolCom\RetailerApi\Model\Shipment\Query\GetShipment), 'default')
I suppose It makes sense support that date time format in all API methods.
`In Assertion.php line 2752:
[Assert\InvalidArgumentException (214)]
Value "2019-11-11T08:35:19.547+01:00" is not a valid ISO 8601 format.
Exception trace:
() at /var/www/projects/bol.com-app/vendor/beberlei/assert/lib/Assert/Assertion.php:2752
Assert\Assertion::createException() at /var/www/projects/bol.com-app/vendor/beberlei/assert/lib/Assert/Assertion.php:2403
Assert\Assertion::date() at /var/www/projects/bol.com-app/vendor/bol-com/retailer-api/src/Model/DateTime.php:17
BolCom\RetailerApi\Model\DateTime->__construct() at /var/www/projects/bol.com-app/vendor/bol-com/retailer-api/src/Model/DateTime.php:31
BolCom\RetailerApi\Model\DateTime::fromString() at /var/www/projects/bol.com-app/vendor/bol-com/retailer-api/src/Model/Shipment/ShipmentListItem.php:111
BolCom\RetailerApi\Model\Shipment\ShipmentListItem::fromArray() at /var/www/projects/bol.com-app/vendor/bol-com/retailer-api/src/Model/Shipment/ShipmentList.php:53
BolCom\RetailerApi\Model\Shipment\ShipmentList::fromArray() at /var/www/projects/bol.com-app/vendor/bol-com/retailer-api/src/Handler/Shipment/GetShipmentListHandler.php:54
BolCom\RetailerApi\Handler\Shipment\GetShipmentListHandler->__invoke() at /var/www/projects/bol.com-app/vendor/bol-com/retailer-api/src/Infrastructure/MessageBus.php:111
`
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.