Skip to content

Commit 528ef71

Browse files
committed
harden product api
1 parent 142f44e commit 528ef71

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

core/src/main/java/io/snabble/sdk/ProductApi.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,10 @@ private static class ApiProduct {
1818
String name;
1919
String description;
2020
String subtitle;
21-
String taxCategory;
22-
boolean outOfStock;
23-
boolean deleted;
2421
boolean weighByCustomer;
2522
String referenceUnit;
2623
String encodingUnit;
2724
String imageUrl;
28-
String[] eans;
2925
ApiPrice price;
3026
boolean saleStop;
3127
ApiScannableCode[] codes;
@@ -235,10 +231,14 @@ private Product toProduct(ApiProduct apiProduct) {
235231
if (apiProduct.weighByCustomer) {
236232
builder.setType(Product.Type.UserWeighed);
237233
} else {
238-
if (referenceUnit == null || referenceUnit == Unit.PIECE) {
239-
builder.setType(Product.Type.Article);
234+
if (apiProduct.productType == ApiProductType.WEIGHABLE) {
235+
if (referenceUnit == null || referenceUnit == Unit.PIECE) {
236+
builder.setType(Product.Type.Article);
237+
} else {
238+
builder.setType(Product.Type.PreWeighed);
239+
}
240240
} else {
241-
builder.setType(Product.Type.PreWeighed);
241+
builder.setType(Product.Type.Article);
242242
}
243243
}
244244

0 commit comments

Comments
 (0)