mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2026-03-18 05:08:13 +01:00
Allow to read amazon labels for part retrieval and creation
This commit is contained in:
@@ -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;
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user