Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ fun FetchedProduct.toUpdated(): UpdatedProduct {

weight = weight,
dimensions = dimensions?.toUpdated(),
shippingPreparationTime = shippingPreparationTime?.toUpdated(),
showDeliveryTimeInStorefront = showDeliveryTimeInStorefront,
volume = volume,
shipping = shipping?.toUpdated(),
isShippingRequired = isShippingRequired,
Expand Down Expand Up @@ -195,6 +197,12 @@ private fun FetchedProduct.ProductDimensions.toUpdated() = UpdatedProduct.Produc
height = height
)

private fun FetchedProduct.ShippingPreparationTime.toUpdated() = UpdatedProduct.ShippingPreparationTime(
shippingPreparationTimeForInStockItemDays = shippingPreparationTimeForInStockItemDays,
shippingPreparationTimeForOutOfStockItemDays = shippingPreparationTimeForOutOfStockItemDays,
pickupPreparationTimeForInStockItemInMinutes = pickupPreparationTimeForInStockItemInMinutes
)

fun FetchedProduct.ProductMedia.toUpdated() = UpdatedProduct.ProductMedia(
images = images.map(FetchedProduct.ProductImage::toUpdated)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ data class UpdatedProduct(
val weight: Double? = null,
val dimensions: ProductDimensions? = null,
val volume: Double? = null,

val shippingPreparationTime: ShippingPreparationTime? = null,
val showDeliveryTimeInStorefront: Boolean? = null,

val shipping: ShippingSettings? = null,
val isShippingRequired: Boolean? = null,

Expand Down Expand Up @@ -324,6 +328,12 @@ data class UpdatedProduct(
val height: Double? = null
)

data class ShippingPreparationTime(
val shippingPreparationTimeForInStockItemDays: String? = null,
val shippingPreparationTimeForOutOfStockItemDays: String? = null,
val pickupPreparationTimeForInStockItemInMinutes: Int? = null
)

data class CustomPriceTier(
val value: Double = 0.0
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ data class FetchedProduct(
val weight: Double? = null,
val dimensions: ProductDimensions? = null,
val volume: Double = 0.0,

val shippingPreparationTime: ShippingPreparationTime? = null,
val showDeliveryTimeInStorefront: Boolean? = null,

val shipping: ShippingSettings? = null,
val isShippingRequired: Boolean? = null,

Expand Down Expand Up @@ -247,6 +251,12 @@ data class FetchedProduct(
val height: Double? = null
)

data class ShippingPreparationTime(
val shippingPreparationTimeForInStockItemDays: String? = null,
val shippingPreparationTimeForOutOfStockItemDays: String? = null,
val pickupPreparationTimeForInStockItemInMinutes: Int? = null
)

data class CustomPriceTier(
val value: Double = 0.0
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import com.ecwid.apiclient.v3.dto.variation.request.ProductVariationsRequest
import com.ecwid.apiclient.v3.rule.NullablePropertyRule.AllowNullable
import com.ecwid.apiclient.v3.rule.NullablePropertyRule.IgnoreNullable
import com.ecwid.apiclient.v3.rule.nullablepropertyrules.*
import com.ecwid.apiclient.v3.dto.product.result.FetchedProduct
import kotlin.reflect.KProperty1

val otherNullablePropertyRules: List<NullablePropertyRule<*, *>> = listOf(
Expand All @@ -35,6 +36,9 @@ val otherNullablePropertyRules: List<NullablePropertyRule<*, *>> = listOf(
AllowNullable(GetProductFiltersResult.ProductFilters::onsale),
AllowNullable(GetProductFiltersResult.ProductFilters::options),
AllowNullable(GetProductFiltersResult.ProductFilters::price),
AllowNullable(FetchedProduct.ShippingPreparationTime::pickupPreparationTimeForInStockItemInMinutes),
AllowNullable(FetchedProduct.ShippingPreparationTime::shippingPreparationTimeForInStockItemDays),
AllowNullable(FetchedProduct.ShippingPreparationTime::shippingPreparationTimeForOutOfStockItemDays),

IgnoreNullable(ConvertCartToOrderResult::id),
IgnoreNullable(ConvertCartToOrderResult::orderNumber),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ val fetchedProductNullablePropertyRules: List<NullablePropertyRule<*, *>> = list
IgnoreNullable(FetchedProduct::nameYourPriceEnabled),
IgnoreNullable(FetchedProduct::customPriceTiers),
IgnoreNullable(FetchedProduct::priceDefaultTier),
IgnoreNullable(FetchedProduct::shippingPreparationTime),
IgnoreNullable(FetchedProduct::showDeliveryTimeInStorefront),
IgnoreNullable(FetchedProduct::options),
IgnoreNullable(FetchedProduct::originalImage),
IgnoreNullable(FetchedProduct::price),
Expand Down