File tree Expand file tree Collapse file tree
src/test/kotlin/com/ecwid/apiclient/v3/entity Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -433,6 +433,11 @@ private fun UpdatedOrder.cleanupForComparison(order: UpdatedOrder): UpdatedOrder
433433 item.cleanupForComparison(requestItem)
434434 },
435435 customerFiscalCode = null , // ApiOrder has empty string instead of null
436+ discountInfo = order.discountInfo?.map {
437+ it.copy(
438+ appliesToItems = null
439+ )
440+ }
436441 )
437442}
438443
@@ -445,7 +450,11 @@ private fun UpdatedOrder.OrderItem.cleanupForComparison(orderItem: UpdatedOrder.
445450 selectedOptions = selectedOptions?.mapIndexed { index, option ->
446451 val requestOption = orderItem?.selectedOptions?.get(index)
447452 option.cleanupForComparison(requestOption)
448- }
453+ },
454+ discounts = discounts?.mapIndexed { index, discount ->
455+ val requestDiscount = orderItem?.discounts?.get(index)
456+ discount.cleanupForComparison(requestDiscount)
457+ },
449458 )
450459}
451460
@@ -458,3 +467,11 @@ private fun UpdatedOrder.OrderItemSelectedOption.cleanupForComparison(orderItemS
458467 }
459468 )
460469}
470+
471+ private fun UpdatedOrder.OrderItemDiscounts.cleanupForComparison (orderItemSelectedDiscount : UpdatedOrder .OrderItemDiscounts ? ): UpdatedOrder .OrderItemDiscounts {
472+ return copy(
473+ discountInfo = orderItemSelectedDiscount?.discountInfo?.copy(
474+ appliesToItems = null
475+ )
476+ )
477+ }
You can’t perform that action at this time.
0 commit comments