Skip to content

Commit fe715ec

Browse files
committed
Fix quantity type on LineItemImportDraft types
1 parent 26ea6aa commit fe715ec

File tree

4 files changed

+21
-21
lines changed

4 files changed

+21
-21
lines changed

src/commercetools/importapi/models/_schemas/orders.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131

3232
# Marshmallow Schemas
3333
class ItemStateSchema(helpers.BaseSchema):
34-
quantity = marshmallow.fields.Float(allow_none=True, missing=None)
34+
quantity = marshmallow.fields.Integer(allow_none=True, missing=None)
3535
state = helpers.LazyNestedField(
3636
nested=helpers.absmod(__name__, ".common.StateKeyReferenceSchema"),
3737
allow_none=True,
@@ -52,7 +52,7 @@ class ItemShippingTargetSchema(helpers.BaseSchema):
5252
address_key = marshmallow.fields.String(
5353
allow_none=True, missing=None, data_key="addressKey"
5454
)
55-
quantity = marshmallow.fields.Float(allow_none=True, missing=None)
55+
quantity = marshmallow.fields.Integer(allow_none=True, missing=None)
5656

5757
class Meta:
5858
unknown = marshmallow.EXCLUDE
@@ -292,7 +292,7 @@ class LineItemImportDraftSchema(helpers.BaseSchema):
292292
unknown=marshmallow.EXCLUDE,
293293
missing=None,
294294
)
295-
quantity = marshmallow.fields.Float(allow_none=True, missing=None)
295+
quantity = marshmallow.fields.Integer(allow_none=True, missing=None)
296296
state = helpers.LazyNestedField(
297297
nested=helpers.absmod(__name__, ".ItemStateSchema"),
298298
allow_none=True,
@@ -505,7 +505,7 @@ def post_load(self, data, **kwargs):
505505

506506
class DeliveryItemSchema(helpers.BaseSchema):
507507
id = marshmallow.fields.String(allow_none=True, missing=None)
508-
quantity = marshmallow.fields.Float(allow_none=True, missing=None)
508+
quantity = marshmallow.fields.Integer(allow_none=True, missing=None)
509509

510510
class Meta:
511511
unknown = marshmallow.EXCLUDE
@@ -824,7 +824,7 @@ class CustomLineItemDraftSchema(helpers.BaseSchema):
824824
data_key="totalPrice",
825825
)
826826
slug = marshmallow.fields.String(allow_none=True, missing=None)
827-
quantity = marshmallow.fields.Float(allow_none=True, missing=None)
827+
quantity = marshmallow.fields.Integer(allow_none=True, missing=None)
828828
state = helpers.LazyNestedField(
829829
nested=helpers.absmod(__name__, ".ItemStateSchema"),
830830
allow_none=True,

src/commercetools/importapi/models/orders.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,11 @@
7272
class ItemState(_BaseType):
7373
"""The item's state."""
7474

75-
quantity: float
75+
quantity: int
7676
#: Maps to `ItemState.state`.
7777
state: "StateKeyReference"
7878

79-
def __init__(self, *, quantity: float, state: "StateKeyReference"):
79+
def __init__(self, *, quantity: int, state: "StateKeyReference"):
8080
self.quantity = quantity
8181
self.state = state
8282
super().__init__()
@@ -99,9 +99,9 @@ class ItemShippingTarget(_BaseType):
9999
#: Maps to `ItemShippingTarget.addressKey`.
100100
address_key: str
101101
#: Maps to `ItemShippingTarget.quantity`.
102-
quantity: float
102+
quantity: int
103103

104-
def __init__(self, *, address_key: str, quantity: float):
104+
def __init__(self, *, address_key: str, quantity: int):
105105
self.address_key = address_key
106106
self.quantity = quantity
107107
super().__init__()
@@ -255,7 +255,7 @@ class LineItemImportDraft(_BaseType):
255255
#: Maps to `LineItem.price`.
256256
price: "LineItemPrice"
257257
#: Maps to `LineItem.quantity`.
258-
quantity: float
258+
quantity: int
259259
state: typing.Optional[typing.List["ItemState"]]
260260
#: References a supply channel. Maps to `LineItem.supplyChannel`.
261261
#:
@@ -281,7 +281,7 @@ def __init__(
281281
name: "LocalizedString",
282282
variant: "LineItemProductVariantImportDraft",
283283
price: "LineItemPrice",
284-
quantity: float,
284+
quantity: int,
285285
state: typing.Optional[typing.List["ItemState"]] = None,
286286
supply_channel: typing.Optional["ChannelKeyReference"] = None,
287287
distribution_channel: typing.Optional["ChannelKeyReference"] = None,
@@ -470,9 +470,9 @@ def serialize(self) -> typing.Dict[str, typing.Any]:
470470

471471
class DeliveryItem(_BaseType):
472472
id: str
473-
quantity: float
473+
quantity: int
474474

475-
def __init__(self, *, id: str, quantity: float):
475+
def __init__(self, *, id: str, quantity: int):
476476
self.id = id
477477
self.quantity = quantity
478478
super().__init__()
@@ -748,7 +748,7 @@ class CustomLineItemDraft(_BaseType):
748748
taxed_price: typing.Optional["CustomLineItemTaxedPrice"]
749749
total_price: "TypedMoney"
750750
slug: str
751-
quantity: float
751+
quantity: int
752752
state: typing.Optional[typing.List["ItemState"]]
753753
#: References a tax category by its key.
754754
tax_category: typing.Optional["TaxCategoryKeyReference"]
@@ -767,7 +767,7 @@ def __init__(
767767
taxed_price: typing.Optional["CustomLineItemTaxedPrice"] = None,
768768
total_price: "TypedMoney",
769769
slug: str,
770-
quantity: float,
770+
quantity: int,
771771
state: typing.Optional[typing.List["ItemState"]] = None,
772772
tax_category: typing.Optional["TaxCategoryKeyReference"] = None,
773773
tax_rate: typing.Optional["TaxRate"] = None,

src/commercetools/platform/models/_schemas/order.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ def post_load(self, data, **kwargs):
128128

129129

130130
class ItemStateSchema(helpers.BaseSchema):
131-
quantity = marshmallow.fields.Float(allow_none=True, missing=None)
131+
quantity = marshmallow.fields.Integer(allow_none=True, missing=None)
132132
state = helpers.LazyNestedField(
133133
nested=helpers.absmod(__name__, ".state.StateReferenceSchema"),
134134
allow_none=True,
@@ -167,7 +167,7 @@ class LineItemImportDraftSchema(helpers.BaseSchema):
167167
unknown=marshmallow.EXCLUDE,
168168
missing=None,
169169
)
170-
quantity = marshmallow.fields.Float(allow_none=True, missing=None)
170+
quantity = marshmallow.fields.Integer(allow_none=True, missing=None)
171171
state = helpers.LazyNestedField(
172172
nested=helpers.absmod(__name__, ".ItemStateSchema"),
173173
allow_none=True,

src/commercetools/platform/models/order.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -608,10 +608,10 @@ def serialize(self) -> typing.Dict[str, typing.Any]:
608608

609609

610610
class ItemState(_BaseType):
611-
quantity: float
611+
quantity: int
612612
state: "StateReference"
613613

614-
def __init__(self, *, quantity: float, state: "StateReference"):
614+
def __init__(self, *, quantity: int, state: "StateReference"):
615615
self.quantity = quantity
616616
self.state = state
617617
super().__init__()
@@ -636,7 +636,7 @@ class LineItemImportDraft(_BaseType):
636636
name: "LocalizedString"
637637
variant: "ProductVariantImportDraft"
638638
price: "PriceDraft"
639-
quantity: float
639+
quantity: int
640640
state: typing.Optional[typing.List["ItemState"]]
641641
#: Optional connection to a particular supplier.
642642
#: By providing supply channel information, you can uniquely identify
@@ -659,7 +659,7 @@ def __init__(
659659
name: "LocalizedString",
660660
variant: "ProductVariantImportDraft",
661661
price: "PriceDraft",
662-
quantity: float,
662+
quantity: int,
663663
state: typing.Optional[typing.List["ItemState"]] = None,
664664
supply_channel: typing.Optional["ChannelResourceIdentifier"] = None,
665665
distribution_channel: typing.Optional["ChannelResourceIdentifier"] = None,

0 commit comments

Comments
 (0)