ho-nl / BolCom_RetailerApi

Package that talks to the bol.com v8 API
10 stars 10 forks source link

Call to undefined method BolCom\RetailerApi\Model\Order\OrderItemId::toArray() #47

Open RickOSM opened 2 years ago

RickOSM commented 2 years ago

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
        ));
DirkHoffman commented 2 years ago

I'm having the same problem, is there already any update on this?

internetboekhandel commented 2 years ago

No update? We are stuck, we tried many times to get this working.

internetboekhandel commented 2 years ago

Dankzij hulp van jeroen een oplossing gekregen. Dit werkt nu voor ons:

Shiporderitem was het probleem.

/* @var \BolCom\RetailerApi\Model\ProcessStatus\ProcessStatus $processStatus / $processStatus = $messageBus->dispatch(\BolCom\RetailerApi\Model\Order\Command\ShipOrderItems::with([ \BolCom\RetailerApi\Model\Order\Command\ShipOrderItem::fromArray([ 'orderItemId' => \BolCom\RetailerApi\Model\Order\OrderItemId::fromString("$artikelid")->toString(), ]), ], "$artikelid",null, \BolCom\RetailerApi\Model\Transport\TransportInstruction::fromArray([ 'transporterCode' => "$shipper", 'trackAndTrace' => "$tt" ]) ),$land);