Skip to content

Commit

Permalink
ECWID-126818 OE2: Edit Items Options - file disappears from order aft…
Browse files Browse the repository at this point in the history
…er editing the item options.

Added options files field to UpdatedOrder
  • Loading branch information
kitty-ecwid committed Sep 15, 2023
1 parent 85b6398 commit 74f02b6
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
12 changes: 11 additions & 1 deletion src/main/kotlin/com/ecwid/apiclient/v3/converter/FetchedOrder.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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),
)
}

Expand All @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,8 @@ data class UpdatedOrder(
val valueTranslated: OrderedStringToStringMap? = null,
val valuesArray: List<String>? = null,
val valuesArrayTranslated: OrderedStringToListStringMap? = null,
val selections: List<OrderItemSelectionInfo>? = null
val selections: List<OrderItemSelectionInfo>? = null,
val files: List<OrderItemOptionFile>? = null,
) {

companion object {
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 74f02b6

Please sign in to comment.