Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ECWID-126818 OE2: Edit Items Options - file disappears from order after editing the item options. #328

Merged
merged 4 commits into from
Sep 18, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
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