Skip to content

Add the Product.compositeComponents field (for now it's read-only) #493

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

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import com.ecwid.apiclient.v3.dto.common.OrderedStringToStringMap
import com.ecwid.apiclient.v3.dto.customer.enums.CommercialRelationshipScheme
import com.ecwid.apiclient.v3.dto.order.enums.*
import com.ecwid.apiclient.v3.dto.order.request.UpdatedOrder
import com.ecwid.apiclient.v3.dto.productcomponent.result.FetchedProductComponent
import com.ecwid.apiclient.v3.jsontransformer.JsonFieldName
import java.util.*

Expand Down Expand Up @@ -217,7 +218,8 @@ data class FetchedOrder(
val discounts: List<OrderItemDiscounts>? = null,
val externalReferenceId: String? = null,
val isPreorder: Boolean? = null,
val attributes: List<OrderItemAttributeValue>? = null
val attributes: List<OrderItemAttributeValue>? = null,
val compositeComponents: List<FetchedProductComponent>? = null,
)

data class RecurringChargeSettings(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import com.ecwid.apiclient.v3.dto.common.*
import com.ecwid.apiclient.v3.dto.common.ApiFetchedDTO.ModifyKind
import com.ecwid.apiclient.v3.dto.product.enums.*
import com.ecwid.apiclient.v3.dto.product.request.UpdatedProduct
import com.ecwid.apiclient.v3.dto.productcomponent.result.FetchedProductComponent
import com.ecwid.apiclient.v3.dto.producttype.enums.AttributeType
import com.ecwid.apiclient.v3.dto.variation.result.FetchedVariation
import java.util.*
Expand Down Expand Up @@ -142,6 +143,7 @@ data class FetchedProduct(
val rating: Double? = null,
val reviewsModerated: Int? = null,
val reviewsPublished: Int? = null,
val compositeComponents: List<FetchedProductComponent>? = null,
) : ApiFetchedDTO, ApiResultDTO {

data class BorderInfo(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.ecwid.apiclient.v3.dto.productcomponent.result

import com.ecwid.apiclient.v3.dto.common.ApiFetchedDTO
import com.ecwid.apiclient.v3.dto.common.ApiResultDTO

data class FetchedProductComponent(
val productId: Long = 0L,
val combinationId: Long? = null,
val quantity: Int = 0,
) : ApiFetchedDTO, ApiResultDTO {

override fun getModifyKind() = ApiFetchedDTO.ModifyKind.ReadOnly

}
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ val nonUpdatablePropertyRules: List<NonUpdatablePropertyRule<*, *>> = listOf(
ReadOnly(FetchedProduct::rating),
ReadOnly(FetchedProduct::reviewsModerated),
ReadOnly(FetchedProduct::reviewsPublished),
ReadOnly(FetchedProduct::compositeComponents),

Ignored(FetchedCart::cartId),
Ignored(FetchedCart::email),
Expand Down Expand Up @@ -206,6 +207,7 @@ val nonUpdatablePropertyRules: List<NonUpdatablePropertyRule<*, *>> = listOf(
ReadOnly(FetchedOrder.OrderItem::priceWithoutTax),
ReadOnly(FetchedOrder.OrderItem::files),
ReadOnly(FetchedOrder.OrderItem::attributes),
ReadOnly(FetchedOrder.OrderItem::compositeComponents),
Ignored(FetchedOrder.OrderItem::imageUrl),
Ignored(FetchedOrder.OrderItem::smallThumbnailUrl),
Ignored(FetchedOrder.OrderItem::hdThumbnailUrl),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ val nullablePropertyRules: List<NullablePropertyRule<*, *>> = listOf(
fetchedCustomersConfigNullablePropertyRules,
brandsSearchRequestNullablePropertyRules,
fetchedBrandNullablePropertyRules,
fetchedProductComponentNullablePropertyRules,
).flatten()

sealed class NullablePropertyRule<T, R>(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ val fetchedOrderNullablePropertyRules: List<NullablePropertyRule<*, *>> = listOf
IgnoreNullable(FetchedOrder.OrderItem::externalReferenceId),
AllowNullable(FetchedOrder.OrderItem::isPreorder),
AllowNullable(FetchedOrder.OrderItem::attributes),
AllowNullable(FetchedOrder.OrderItem::compositeComponents),
IgnoreNullable(FetchedOrder.OrderItemDiscounts::discountInfo),
IgnoreNullable(FetchedOrder.OrderItemDiscounts::total),
AllowNullable(FetchedOrder.OrderItemOptionFile::id),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package com.ecwid.apiclient.v3.rule.nullablepropertyrules

import com.ecwid.apiclient.v3.dto.productcomponent.result.FetchedProductComponent
import com.ecwid.apiclient.v3.rule.NullablePropertyRule
import com.ecwid.apiclient.v3.rule.NullablePropertyRule.AllowNullable

val fetchedProductComponentNullablePropertyRules: List<NullablePropertyRule<*, *>> = listOf(
AllowNullable(FetchedProductComponent::combinationId),
)
Original file line number Diff line number Diff line change
Expand Up @@ -172,4 +172,5 @@ val fetchedProductNullablePropertyRules: List<NullablePropertyRule<*, *>> = list
AllowNullable(FetchedProduct::minPurchaseQuantity),
AllowNullable(FetchedProduct::maxPurchaseQuantity),
AllowNullable(FetchedProduct::locationInventory),
AllowNullable(FetchedProduct::compositeComponents),
)