Closed MottlShean closed 2 years ago
Repeated download of labels:
It can happen that user makes mistake or there is a downloading error etc. Repeated download of labels is sometimes necessary.
How can I download labels repeatedly if needs to download it again? Thanks
` private function printPackages(array $packages, ?Shipment $shipment): ?string { $client = new Client(new HttpClient()); $request = new GetPrintedLabels();
foreach ($packages as $package) { $request->addParcelId($package); } /** @var GetPrintedLabelsResponse $response */ $response = $client->on($this->account) ->request($request); if ($response->successfull()) { return $response->getPdf(); } if ($shipment) { $shipment->update( [ 'error_message' => $this->glsErrorsToText($response->errors()), ] ); } Log::error('printLabel: ' . $this->glsErrorsToText($response->errors())); return null; }
`
Hello,
You can download/generate the labels only once, unfortunately MyGLS doesn't support calling GetPrintedLabels multiple times for the same parcel.
Thanks for fast reaction. Jan
Repeated download of labels:
It can happen that user makes mistake or there is a downloading error etc. Repeated download of labels is sometimes necessary.
How can I download labels repeatedly if needs to download it again? Thanks
` private function printPackages(array $packages, ?Shipment $shipment): ?string { $client = new Client(new HttpClient()); $request = new GetPrintedLabels();
`