Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
gavihs opened this issue Jun 10, 2024 · 0 comments

Comments

@gavihs
Copy link

gavihs commented Jun 10, 2024

{{[}}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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant