Skip to content

Commit 42792e9

Browse files
authored
Merge pull request #190 from Ecwid/ECWID-99676
ECWID-99676 Delivery timeframes: new import/export
2 parents ea6bfaf + de5b0c0 commit 42792e9

5 files changed

Lines changed: 34 additions & 0 deletions

File tree

src/main/kotlin/com/ecwid/apiclient/v3/converter/FetchedProduct.kt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ fun FetchedProduct.toUpdated(): UpdatedProduct {
2929

3030
weight = weight,
3131
dimensions = dimensions?.toUpdated(),
32+
shippingPreparationTime = shippingPreparationTime?.toUpdated(),
33+
showDeliveryTimeInStorefront = showDeliveryTimeInStorefront,
3234
volume = volume,
3335
shipping = shipping?.toUpdated(),
3436
isShippingRequired = isShippingRequired,
@@ -195,6 +197,12 @@ private fun FetchedProduct.ProductDimensions.toUpdated() = UpdatedProduct.Produc
195197
height = height
196198
)
197199

200+
private fun FetchedProduct.ShippingPreparationTime.toUpdated() = UpdatedProduct.ShippingPreparationTime(
201+
shippingPreparationTimeForInStockItemDays = shippingPreparationTimeForInStockItemDays,
202+
shippingPreparationTimeForOutOfStockItemDays = shippingPreparationTimeForOutOfStockItemDays,
203+
pickupPreparationTimeForInStockItemInMinutes = pickupPreparationTimeForInStockItemInMinutes
204+
)
205+
198206
fun FetchedProduct.ProductMedia.toUpdated() = UpdatedProduct.ProductMedia(
199207
images = images.map(FetchedProduct.ProductImage::toUpdated)
200208
)

src/main/kotlin/com/ecwid/apiclient/v3/dto/product/request/UpdatedProduct.kt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ data class UpdatedProduct(
3333
val weight: Double? = null,
3434
val dimensions: ProductDimensions? = null,
3535
val volume: Double? = null,
36+
37+
val shippingPreparationTime: ShippingPreparationTime? = null,
38+
val showDeliveryTimeInStorefront: Boolean? = null,
39+
3640
val shipping: ShippingSettings? = null,
3741
val isShippingRequired: Boolean? = null,
3842

@@ -324,6 +328,12 @@ data class UpdatedProduct(
324328
val height: Double? = null
325329
)
326330

331+
data class ShippingPreparationTime(
332+
val shippingPreparationTimeForInStockItemDays: String? = null,
333+
val shippingPreparationTimeForOutOfStockItemDays: String? = null,
334+
val pickupPreparationTimeForInStockItemInMinutes: Int? = null
335+
)
336+
327337
data class CustomPriceTier(
328338
val value: Double = 0.0
329339
)

src/main/kotlin/com/ecwid/apiclient/v3/dto/product/result/FetchedProduct.kt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@ data class FetchedProduct(
5454
val weight: Double? = null,
5555
val dimensions: ProductDimensions? = null,
5656
val volume: Double = 0.0,
57+
58+
val shippingPreparationTime: ShippingPreparationTime? = null,
59+
val showDeliveryTimeInStorefront: Boolean? = null,
60+
5761
val shipping: ShippingSettings? = null,
5862
val isShippingRequired: Boolean? = null,
5963

@@ -247,6 +251,12 @@ data class FetchedProduct(
247251
val height: Double? = null
248252
)
249253

254+
data class ShippingPreparationTime(
255+
val shippingPreparationTimeForInStockItemDays: String? = null,
256+
val shippingPreparationTimeForOutOfStockItemDays: String? = null,
257+
val pickupPreparationTimeForInStockItemInMinutes: Int? = null
258+
)
259+
250260
data class CustomPriceTier(
251261
val value: Double = 0.0
252262
)

src/test/kotlin/com/ecwid/apiclient/v3/rule/NullablePropertyRules.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import com.ecwid.apiclient.v3.dto.variation.request.ProductVariationsRequest
1414
import com.ecwid.apiclient.v3.rule.NullablePropertyRule.AllowNullable
1515
import com.ecwid.apiclient.v3.rule.NullablePropertyRule.IgnoreNullable
1616
import com.ecwid.apiclient.v3.rule.nullablepropertyrules.*
17+
import com.ecwid.apiclient.v3.dto.product.result.FetchedProduct
1718
import kotlin.reflect.KProperty1
1819

1920
val otherNullablePropertyRules: List<NullablePropertyRule<*, *>> = listOf(
@@ -35,6 +36,9 @@ val otherNullablePropertyRules: List<NullablePropertyRule<*, *>> = listOf(
3536
AllowNullable(GetProductFiltersResult.ProductFilters::onsale),
3637
AllowNullable(GetProductFiltersResult.ProductFilters::options),
3738
AllowNullable(GetProductFiltersResult.ProductFilters::price),
39+
AllowNullable(FetchedProduct.ShippingPreparationTime::pickupPreparationTimeForInStockItemInMinutes),
40+
AllowNullable(FetchedProduct.ShippingPreparationTime::shippingPreparationTimeForInStockItemDays),
41+
AllowNullable(FetchedProduct.ShippingPreparationTime::shippingPreparationTimeForOutOfStockItemDays),
3842

3943
IgnoreNullable(ConvertCartToOrderResult::id),
4044
IgnoreNullable(ConvertCartToOrderResult::orderNumber),

src/test/kotlin/com/ecwid/apiclient/v3/rule/nullablepropertyrules/FetchedProductRules.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ val fetchedProductNullablePropertyRules: List<NullablePropertyRule<*, *>> = list
3838
IgnoreNullable(FetchedProduct::nameYourPriceEnabled),
3939
IgnoreNullable(FetchedProduct::customPriceTiers),
4040
IgnoreNullable(FetchedProduct::priceDefaultTier),
41+
IgnoreNullable(FetchedProduct::shippingPreparationTime),
42+
IgnoreNullable(FetchedProduct::showDeliveryTimeInStorefront),
4143
IgnoreNullable(FetchedProduct::options),
4244
IgnoreNullable(FetchedProduct::originalImage),
4345
IgnoreNullable(FetchedProduct::price),

0 commit comments

Comments
 (0)