From 74f02b63364a12015b60e480d1031413258de39f Mon Sep 17 00:00:00 2001 From: kitty Date: Fri, 15 Sep 2023 17:59:31 +0400 Subject: [PATCH] ECWID-126818 OE2: Edit Items Options - file disappears from order after editing the item options. Added options files field to UpdatedOrder --- .../com/ecwid/apiclient/v3/converter/FetchedOrder.kt | 12 +++++++++++- .../apiclient/v3/dto/order/request/UpdatedOrder.kt | 10 +++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/src/main/kotlin/com/ecwid/apiclient/v3/converter/FetchedOrder.kt b/src/main/kotlin/com/ecwid/apiclient/v3/converter/FetchedOrder.kt index 8eb68c10..04281fbc 100644 --- a/src/main/kotlin/com/ecwid/apiclient/v3/converter/FetchedOrder.kt +++ b/src/main/kotlin/com/ecwid/apiclient/v3/converter/FetchedOrder.kt @@ -172,7 +172,8 @@ fun FetchedOrder.OrderItemSelectedOption.toUpdated(): UpdatedOrder.OrderItemSele valueTranslated = valueTranslated?.let { OrderedStringToStringMap(it) }, valuesArray = valuesArray?.let { ArrayList(it) }, valuesArrayTranslated = valuesArrayTranslated?.let { OrderedStringToListStringMap(it) }, - selections = selections?.map(FetchedOrder.OrderItemSelectionInfo::toUpdated) + selections = selections?.map(FetchedOrder.OrderItemSelectionInfo::toUpdated), + files = files?.map(FetchedOrder.OrderItemOptionFile::toUpdated), ) } @@ -184,6 +185,15 @@ fun FetchedOrder.OrderItemSelectionInfo.toUpdated(): UpdatedOrder.OrderItemSelec ) } +fun FetchedOrder.OrderItemOptionFile.toUpdated(): UpdatedOrder.OrderItemOptionFile { + return UpdatedOrder.OrderItemOptionFile( + id = id, + name = name, + size = size, + url = url, + ) +} + fun FetchedOrder.OrderItemTax.toUpdated(): UpdatedOrder.OrderItemTax { return UpdatedOrder.OrderItemTax( name = name, diff --git a/src/main/kotlin/com/ecwid/apiclient/v3/dto/order/request/UpdatedOrder.kt b/src/main/kotlin/com/ecwid/apiclient/v3/dto/order/request/UpdatedOrder.kt index 34eb4c03..c9b6141c 100644 --- a/src/main/kotlin/com/ecwid/apiclient/v3/dto/order/request/UpdatedOrder.kt +++ b/src/main/kotlin/com/ecwid/apiclient/v3/dto/order/request/UpdatedOrder.kt @@ -172,7 +172,8 @@ data class UpdatedOrder( val valueTranslated: OrderedStringToStringMap? = null, val valuesArray: List? = null, val valuesArrayTranslated: OrderedStringToListStringMap? = null, - val selections: List? = null + val selections: List? = null, + val files: List? = null, ) { companion object { @@ -242,6 +243,13 @@ data class UpdatedOrder( val selectionModifierType: PriceModifierType? = null ) + data class OrderItemOptionFile( + val id: Int? = null, + val name: String? = null, + val size: Int? = null, + val url: String? = null, + ) + data class BaseOrderItemTax( override val name: String? = null, override val value: Double? = null,