Allow to read amazon labels for part retrieval and creation

This commit is contained in:
Jan Böhmer
2026-02-22 23:16:39 +01:00
parent 87919eb445
commit 0b9b2cbf58
7 changed files with 103 additions and 9 deletions

View File

@@ -144,7 +144,12 @@ final readonly class BarcodeScanResultHandler
return $this->resolvePartFromLCSC($barcodeScan);
}
throw new \InvalidArgumentException("Barcode does not support resolving to a local entity: ".get_class($barcodeScan));
if ($barcodeScan instanceof AmazonBarcodeScanResult) {
return $this->em->getRepository(Part::class)->getPartByProviderInfo($barcodeScan->asin)
?? $this->em->getRepository(Part::class)->getPartBySPN($barcodeScan->asin);
}
return null;
}
/**
@@ -258,6 +263,13 @@ final readonly class BarcodeScanResultHandler
return $this->getCreationInfoForEIGP114($scanResult);
}
if ($scanResult instanceof AmazonBarcodeScanResult) {
return [
'providerKey' => 'canopy',
'providerId' => $scanResult->asin,
];
}
return null;
}