Offer 4x6 label downloads alongside A4
Deploy HickLab3D Dashboard / Deploy to production (push) Successful in 1m48s
Deploy HickLab3D Dashboard / Deploy to production (push) Successful in 1m48s
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5.5
parent
51c6748894
commit
dff81caaea
@@ -182,13 +182,14 @@ class Parcel2Go
|
||||
return filled($query['hash'] ?? null) ? (string) $query['hash'] : null;
|
||||
}
|
||||
|
||||
public function labelPdf(string $reference, string $hash): string
|
||||
/** @param 'A4'|'Label4x6' $media */
|
||||
public function labelPdf(string $reference, string $hash, string $media = 'A4'): string
|
||||
{
|
||||
$token = $this->profileConnected() ? $this->profileAccessToken() : $this->accessToken();
|
||||
$data = Http::withToken($token)->acceptJson()->connectTimeout(3)->timeout(20)
|
||||
->get($this->url('labels/'.$reference), [
|
||||
'referenceType' => 'OrderLineId', 'detailLevel' => 'Labels',
|
||||
'labelMedia' => 'A4', 'labelFormat' => 'PDF', 'hash' => $hash,
|
||||
'labelMedia' => $media, 'labelFormat' => 'PDF', 'hash' => $hash,
|
||||
])->throw()->json();
|
||||
$encoded = $data['Base64EncodedLabels'][0] ?? '';
|
||||
$pdf = is_string($encoded) ? base64_decode($encoded, true) : false;
|
||||
|
||||
Reference in New Issue
Block a user