Include DFC Offer in the export with valid id

This commit is contained in:
Maikel Linke
2023-02-28 16:46:29 +11:00
parent 78cf3b5a1d
commit 7f8ce08d4e
2 changed files with 8 additions and 3 deletions

View File

@@ -15,8 +15,9 @@ module DfcProvider
end
def show
dfc_object = DfcBuilder.catalog_item(variant)
render json: DfcLoader.connector.export(dfc_object)
catalog_item = DfcBuilder.catalog_item(variant)
offers = catalog_item.offers
render json: DfcLoader.connector.export(catalog_item, *offers)
end
private

View File

@@ -27,7 +27,11 @@ class DfcBuilder
end
def self.offer(variant)
id = "/offers/#{variant.id}"
# We don't have an endpoint for offers yet and this URL is only a
# placeholder for now. The offer is actually affected by order cycle and
# customer tags. We'll solve that at a later stage.
enterprise_url = urls.enterprise_url(id: variant.product.supplier_id)
id = "#{enterprise_url}/offers/#{variant.id}"
offered_to = []
# The DFC sees "empty" stock as unlimited.