mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
Include DFC Offer in the export with valid id
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user