Include price in catalog

merge-requests/30/head
Bob Mottram 2021-07-25 10:39:21 +01:00
parent 312e8bbdfa
commit 5cd8854a48
1 changed files with 4 additions and 6 deletions

View File

@ -764,16 +764,15 @@ def sharesCatalogAccountEndpoint(baseDir: str, httpPrefix: str,
shareId = getValidSharedItemID(owner, item['displayName']) shareId = getValidSharedItemID(owner, item['displayName'])
dfcId = item['dfcId'].split('#')[1] dfcId = item['dfcId'].split('#')[1]
priceStr = item['itemPrice'] + ' ' + item['currency']
catalogItem = { catalogItem = {
"@id": shareId, "@id": shareId,
"@type": "DFC:SuppliedProduct", "@type": "DFC:SuppliedProduct",
"DFC:hasType": "dfc-pt:" + dfcId, "DFC:hasType": "dfc-pt:" + dfcId,
"DFC:offeredThrough": owner,
"DFC:startDate": item['published'], "DFC:startDate": item['published'],
"DFC:expiryDate": expireDateStr, "DFC:expiryDate": expireDateStr,
"DFC:quantity": item['itemQty'], "DFC:quantity": item['itemQty'],
"DFC:totalTheoriticalStock": item['itemQty'], "DFC:price": priceStr,
"DFC:price": "0",
"DFC:Image": item['imageUrl'], "DFC:Image": item['imageUrl'],
"DFC:description": item['displayName'] + ': ' + item['summary'] "DFC:description": item['displayName'] + ': ' + item['summary']
} }
@ -833,16 +832,15 @@ def sharesCatalogEndpoint(baseDir: str, httpPrefix: str,
description = item['displayName'] + ': ' + item['summary'] description = item['displayName'] + ': ' + item['summary']
shareId = getValidSharedItemID(owner, item['displayName']) shareId = getValidSharedItemID(owner, item['displayName'])
dfcId = item['dfcId'].split('#')[1] dfcId = item['dfcId'].split('#')[1]
priceStr = item['itemPrice'] + ' ' + item['currency']
catalogItem = { catalogItem = {
"@id": shareId, "@id": shareId,
"@type": "DFC:SuppliedProduct", "@type": "DFC:SuppliedProduct",
"DFC:hasType": "dfc-pt:" + dfcId, "DFC:hasType": "dfc-pt:" + dfcId,
"DFC:offeredThrough": owner,
"DFC:startDate": item['published'], "DFC:startDate": item['published'],
"DFC:expiryDate": expireDateStr, "DFC:expiryDate": expireDateStr,
"DFC:quantity": item['itemQty'], "DFC:quantity": item['itemQty'],
"DFC:totalTheoriticalStock": item['itemQty'], "DFC:price": priceStr,
"DFC:price": "0",
"DFC:Image": item['imageUrl'], "DFC:Image": item['imageUrl'],
"DFC:description": description "DFC:description": description
} }