Skip to content

cart_discounts extraction not working if discounts are enabled on total price #150

@gavihs

Description

@gavihs

{{[}}ERROR{{] ValueError: Could not find discriminator schema totalPrice for field 'target' (

{'type': 'totalPrice'}
)}}
Traceback (most recent call last):
File "/var/task/ct_extract.py", line 194, in extract
{{ query_result = entity_query(offset=query_offset, limit=result_limit, where="lastModifiedAt >= "

{from_date}" and lastModifiedAt < "{to_date}"".format(from_date=from_date, to_date=to_date))}}
File "/var/task/commercetools/services/cart_discounts.py", line 78, in query
return self._client._get(
File "/var/task/commercetools/client.py", line 40, in _get
return response_class.deserialize(response.json())
File "/var/task/commercetools/platform/models/cart_discount.py", line 293, in deserialize
return CartDiscountPagedQueryResponseSchema().load(data)
File "/var/task/marshmallow/schema.py", line 723, in load
return self._do_load(
File "/var/task/marshmallow/schema.py", line 862, in _do_load
result = self._deserialize(
File "/var/task/marshmallow/schema.py", line 665, in _deserialize
value = self._call_and_store(
File "/var/task/marshmallow/schema.py", line 493, in _call_and_store
value = getter_func(data)
File "/var/task/marshmallow/schema.py", line 658, in getter
return field_obj.deserialize(
File "/var/task/marshmallow/fields.py", line 367, in deserialize
output = self._deserialize(value, attr, data, **kwargs)
File "/var/task/marshmallow/fields.py", line 671, in _deserialize
return self._load(value, data, partial=partial)
File "/var/task/marshmallow/fields.py", line 654, in _load
valid_data = self.schema.load(value, unknown=self.unknown, partial=partial)
File "/var/task/marshmallow/schema.py", line 723, in load
return self._do_load(
File "/var/task/marshmallow/schema.py", line 862, in _do_load
result = self._deserialize(
File "/var/task/marshmallow/schema.py", line 611, in _deserialize
ret_l = [
File "/var/task/marshmallow/schema.py", line 614, in
self._deserialize(
File "/var/task/marshmallow/schema.py", line 665, in _deserialize
value = self._call_and_store(
File "/var/task/marshmallow/schema.py", line 493, in _call_and_store
value = getter_func(data)
File "/var/task/marshmallow/schema.py", line 658, in getter
return field_obj.deserialize(
File "/var/task/marshmallow/fields.py", line 367, in deserialize
output = self._deserialize(value, attr, data, **kwargs)
File "/var/task/commercetools/helpers.py", line 294, in _deserialize
return self._load(value, data, **kwargs)
File "/var/task/commercetools/helpers.py", line 280, in _load
raise ValueError(

ValueError: Could not find discriminator schema totalPrice for field 'target' ({'type': 'totalPrice'})

If the configuration of the cart discount on total price is not set for any of the cart discount records the extract works fine - I have an issue only when a cart discount record is set on total price

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions