114 Commits

Author SHA1 Message Date
Maikel Linke
2e62531232 Authenticate only as platform to call webhooks 2025-12-10 16:24:53 +11:00
Maikel Linke
d811103a71 Add dummy webhook endpoint for LiteFarm 2025-12-10 16:24:53 +11:00
Maikel Linke
81165cd82b Replace country names with standard ISO code concepts
The DFC version 1.16.0 introduced this new standardisation.
2025-11-24 16:59:41 +11:00
Maikel Linke
5f237adda2 Publish phone numbers as objects
The standard introduced this a while ago but I didn't notice.

We have to update integrations like Disco Regen now.
2025-11-24 16:44:23 +11:00
Maikel Linke
2e09a96c4b Document new managedBy attribute on DFC API 2025-11-24 15:19:34 +11:00
Maikel Linke
2761cee5e6 Publish coordinates of addresses 2025-10-10 16:18:22 +11:00
Maikel Linke
df6e553661 Add SuppliedProducts index endpoint 2025-10-10 16:18:21 +11:00
Maikel Linke
4d59343f6c List enterprises on DFC API 2025-10-10 16:18:21 +11:00
Maikel Linke
1d2115766a Show product groups to platform user
I removed the caching of `managed_enterprises` in Permissions because
it's just a scope and calling it again is very cheap. And that makes the
method a lot easier to read now that we have a conditional here.

Accessing the managed enterprises via the user instead of a separate
scope on the Enterprise model also reduce the SQL queries. We may want
to use this method in more places. I prefer to keep the
admin-conditional in a permissions class instead of in the model.
2025-08-13 15:06:31 +10:00
Maikel Linke
c12d494de3 Demonstrate authentication as DFC client app 2025-08-13 15:02:09 +10:00
Maikel Linke
cfeafbfc51 Update API docs with latest version 2025-08-13 15:02:08 +10:00
Maikel
8491a167ed Merge pull request #13350 from mkllnk/dfc-ui
Add permission module with example data
2025-08-13 10:00:53 +10:00
Maikel Linke
52aeec5ac4 Update and list scopes for real 2025-08-08 14:00:40 +10:00
Maikel Linke
7032b3f463 Add endpoint to update scopes of platform
Dummy implementation only.
2025-08-08 14:00:40 +10:00
Maikel Linke
60c8f4ee20 Add DFC API endpoint for listing platforms
Only listing example JSON for now.

This is not part of the official DFC API but it's a DFC-related API and
therefore we put it in the same namespace.

The DFC Permission Module will make authenticated requests to grant
certain platforms certain permissions.
2025-08-08 14:00:01 +10:00
Maikel Linke
1ec570375f Remove Person from product catalog
Early versions of the DFC standard demanded that all data is published
in relationship to the authenticated user. But that is not necessary
anymore and can add complications when a platform is authenticated as
client user.
2025-08-07 14:56:35 +10:00
David Cook
be1f4e91e1 Map currency to DFC codes
Probably should have just hardcoded it. Hopefully we can remove this soon anyway.
2025-06-17 10:50:24 +10:00
Maikel Linke
699db02098 Remove enterprise id from DFC product group URL
A Spree::Product represented as product group is not directly associated
to an enterprise. In theory, it could have multiple enterprises through
its variants. So we better don't include the id in the URL.

```
-http://test.host/api/dfc/enterprises/10000/product_groups/90000
+http://test.host/api/dfc/product_groups/90000
```

This makes it simpler as well.
2025-02-18 16:19:27 +11:00
Maikel Linke
5d495b94b3 Use product group attributes for Spree::Product updates 2025-02-18 13:08:49 +11:00
Maikel Linke
3d435ae781 Include product group objects in our catalog response
And when we import a catalog, we don't try to import those product
groups as Spree::Variant. We just see them as reference to
Spree::Product.
2025-02-18 13:08:49 +11:00
Maikel Linke
d39da6d0da Provide endpoint to show a product group
Our Spree::Product corresponds to a DFC SuppliedProduct with variants.
2025-02-18 12:58:09 +11:00
Maikel Linke
35d7bf7a3b Add dfc-b:isVariantOf to supplied products 2025-02-18 12:58:09 +11:00
Maikel Linke
84648690a6 Publish price as in new DFC standard 2025-01-16 09:45:26 +11:00
Ahmed Ejaz
c0887b1806 12890: remove city from response 2024-11-25 19:29:31 +05:00
Maikel Linke
b1b4b10417 Update API docs 2024-11-22 12:40:54 +05:00
Maikel Linke
d1ebe4e1d1 Make DFC API docs deterministic 2024-10-15 15:47:31 +11:00
Maikel Linke
3e71459346 Update API doc 2024-10-11 09:15:42 +11:00
Maikel Linke
d52134dad8 Filter sales data by dates 2024-08-30 15:00:06 +10:00
Maikel Linke
bd1611630f Build DFC data for sales 2024-08-30 14:34:32 +10:00
Maikel Linke
ce28c10c7e Move sales data generation to a service object
There will be lots and lots. The sales data root object is also the
authenticated person. The data has its own URL (semantic id) which
doens't need to contain the user id.

The service object can also be tested more easily. I'm setting up the
test data here.
2024-08-30 14:30:46 +10:00
Maikel Linke
4342d3b912 Add DFC API endpoint for sales data 2024-08-30 14:30:46 +10:00
Maikel Linke
4d4d9daf42 Add OFN contact name as DFC main contact person 2024-06-06 14:32:37 +10:00
Maikel Linke
5b7b8872b6 Use standard logo attribute on DFC API
Still keeping the custom OFN attribute for compatibility. Integrations
can be updated once this is live.
2024-06-06 10:59:25 +10:00
Maikel Linke
64d633c64e Publish enterprise website with https:// 2024-04-23 13:50:46 +10:00
Maikel Linke
965ca5ca92 Update DFC API docs 2024-04-05 10:09:00 +11:00
Maikel Linke
526069dbb3 Limit enterprise image sizes on DFC API
Uploaded images can be several MB in size. While offering the big size
would enable other apps to resize it and store the image size they need,
we have only one app using it in practice and it's using the image
directly. It's much simpler and if a default size will work for others
in the future then why not just serve that.

We can revise this in the future. There is a DFC discussion about
publishing several sizes which I started:
https://github.com/datafoodconsortium/ontology/discussions/77#discussioncomment-8228094
2024-03-19 12:26:23 +11:00
Gaetan Craig-Riou
a4b7a8f95d Spec creating variant via DFC API 2024-03-12 12:43:10 +11:00
Gaetan Craig-Riou
462c763cd1 Add spree_product_uri to SuppliedProduct
Also update SuppliedProductBuilder and specs
2024-03-12 12:43:10 +11:00
Gaetan Craig-Riou
a5bc1d5c48 Add region to address via DfcProvider::Address
Plus spec and documentation
2024-02-14 16:05:57 +11:00
David Cook
97ab41b47e Merge pull request #12068 from mkllnk/dfc-enterprise-promo-image
Add promo image to DFC Enterprise API
2024-01-31 13:35:47 +11:00
Maikel Linke
fc75ea97a2 Add promo image to DFC Enterprise API
We want to use this image in the Discover Regenerative portal in
Australia. The property is read-only and the API doesn't support the
upload of a new file.

The enterprise factory needed fixing as well. This trait hadn't been
used anywhere else.
2024-01-22 16:21:10 +11:00
Maikel Linke
28e17aff68 Fix DFC context in spec to resolve product types
The `dfc-b:hasType` value can only be parsed as object id if the context
contains:

```
    "dfc-b:hasType":{
      "@type":"@id"
    },
```

The standard context includes this and it's easier to use. Now that the
URIs of product types are correctly resolved, we don't need to
substitute the URI manually.

Also dropped an old unneeded spec for backwards compatibility.
2024-01-22 10:12:39 +11:00
Gaetan Craig-Riou
162fd4bef5 update documentation 2024-01-22 10:12:39 +11:00
Gaetan Craig-Riou
a2cb1f4c37 Update swagger documentation 2024-01-22 10:12:39 +11:00
Maikel Linke
af51177593 Update price and stock through the DFC API 2024-01-12 14:25:11 +11:00
Maikel Linke
8d6ae18fb6 Show Offers on the DFC API 2024-01-12 14:22:24 +11:00
Maikel Linke
4bac83dd83 Update variant name instead of product via DFC
A DFC SuppliedProduct relates to a Spree::Variant and when updating its
name we only want to change the name for that variant. Otherwise, when
we update the name of the product, it would update the name for all
variants and all the corresponding SuppliedProducts.
2024-01-12 14:22:24 +11:00
Gaetan Craig-Riou
92921c89d1 Add enpoint to delete enterprise from group
Plus documentation
2024-01-10 12:44:02 +11:00
Gaetan Craig-Riou
b90349e4c2 Add endpoint to add enterprise to a group
plus documentaion
2024-01-10 12:31:38 +11:00
Maikel Linke
eb03235295 Use full product and variant name on DFC API 2023-12-20 16:43:29 +11:00