aboutsummaryrefslogtreecommitdiff
path: root/src/ee/digikey/search_parts.py
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2019-03-14 12:23:57 +0100
committerTrygve Laugstøl <trygvis@inamo.no>2019-03-15 08:22:01 +0100
commita8ec679349c3eb9c33a9d33e247fd86cb8e53f81 (patch)
tree094a498b7b30e402c419e8a588e86769f7d408c9 /src/ee/digikey/search_parts.py
parent3a90ab0dbf5826bc7476971cd163c9a080d2fb2f (diff)
downloadee-python-a8ec679349c3eb9c33a9d33e247fd86cb8e53f81.tar.gz
ee-python-a8ec679349c3eb9c33a9d33e247fd86cb8e53f81.tar.bz2
ee-python-a8ec679349c3eb9c33a9d33e247fd86cb8e53f81.tar.xz
ee-python-a8ec679349c3eb9c33a9d33e247fd86cb8e53f81.zip
o Adding PriceBreak. Parsing price breaks from DK.
o Adding Money type with parsing.
Diffstat (limited to 'src/ee/digikey/search_parts.py')
-rw-r--r--src/ee/digikey/search_parts.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/ee/digikey/search_parts.py b/src/ee/digikey/search_parts.py
index 9c8eb74..61c5c1b 100644
--- a/src/ee/digikey/search_parts.py
+++ b/src/ee/digikey/search_parts.py
@@ -27,6 +27,14 @@ def resolved(p: DigikeyProduct) -> bomFile.Part:
key = make_digikey_fact_key(a.attribute_type.id)
facts.append(bomFile.Fact(key=key, label=a.attribute_type.label, value=a.value))
+ if len(p.price_breaks):
+ part.price_breaksProp = bomFile.PriceBreakList()
+
+ price_breaks: List[bomFile.PriceBreak] = part.price_breaksProp.price_break
+ for pb in p.price_breaks:
+ amount = bomFile.Amount(value=str(pb.per_piece_price.amount), currency=pb.per_piece_price.currency)
+ price_breaks.append(bomFile.PriceBreak(pb.quantity, amount=amount))
+
return part