Skip to content

Commit 083beb1

Browse files
authored
Merge pull request #493 from Ecwid/composite_products
Add the Product.compositeComponents field (for now it's read-only)
2 parents bcc7cf1 + ea991fc commit 083beb1

File tree

8 files changed

+33
-1
lines changed

8 files changed

+33
-1
lines changed

src/main/kotlin/com/ecwid/apiclient/v3/dto/order/result/FetchedOrder.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import com.ecwid.apiclient.v3.dto.common.OrderedStringToStringMap
99
import com.ecwid.apiclient.v3.dto.customer.enums.CommercialRelationshipScheme
1010
import com.ecwid.apiclient.v3.dto.order.enums.*
1111
import com.ecwid.apiclient.v3.dto.order.request.UpdatedOrder
12+
import com.ecwid.apiclient.v3.dto.productcomponent.result.FetchedProductComponent
1213
import com.ecwid.apiclient.v3.jsontransformer.JsonFieldName
1314
import java.util.*
1415

@@ -218,7 +219,8 @@ data class FetchedOrder(
218219
val externalReferenceId: String? = null,
219220
val isPreorder: Boolean? = null,
220221
val attributes: List<OrderItemAttributeValue>? = null,
221-
val taxClassCode: String? = null
222+
val taxClassCode: String? = null,
223+
val compositeComponents: List<FetchedProductComponent>? = null,
222224
)
223225

224226
data class RecurringChargeSettings(

src/main/kotlin/com/ecwid/apiclient/v3/dto/product/result/FetchedProduct.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import com.ecwid.apiclient.v3.dto.common.*
44
import com.ecwid.apiclient.v3.dto.common.ApiFetchedDTO.ModifyKind
55
import com.ecwid.apiclient.v3.dto.product.enums.*
66
import com.ecwid.apiclient.v3.dto.product.request.UpdatedProduct
7+
import com.ecwid.apiclient.v3.dto.productcomponent.result.FetchedProductComponent
78
import com.ecwid.apiclient.v3.dto.producttype.enums.AttributeType
89
import com.ecwid.apiclient.v3.dto.variation.result.FetchedVariation
910
import java.util.*
@@ -142,6 +143,7 @@ data class FetchedProduct(
142143
val rating: Double? = null,
143144
val reviewsModerated: Int? = null,
144145
val reviewsPublished: Int? = null,
146+
val compositeComponents: List<FetchedProductComponent>? = null,
145147
) : ApiFetchedDTO, ApiResultDTO {
146148

147149
data class BorderInfo(
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package com.ecwid.apiclient.v3.dto.productcomponent.result
2+
3+
import com.ecwid.apiclient.v3.dto.common.ApiFetchedDTO
4+
import com.ecwid.apiclient.v3.dto.common.ApiResultDTO
5+
6+
data class FetchedProductComponent(
7+
val productId: Long = 0L,
8+
val combinationId: Long? = null,
9+
val quantity: Int = 0,
10+
) : ApiFetchedDTO, ApiResultDTO {
11+
12+
override fun getModifyKind() = ApiFetchedDTO.ModifyKind.ReadOnly
13+
14+
}

src/test/kotlin/com/ecwid/apiclient/v3/rule/NonUpdatablePropertyRules.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ val nonUpdatablePropertyRules: List<NonUpdatablePropertyRule<*, *>> = listOf(
7474
ReadOnly(FetchedProduct::rating),
7575
ReadOnly(FetchedProduct::reviewsModerated),
7676
ReadOnly(FetchedProduct::reviewsPublished),
77+
ReadOnly(FetchedProduct::compositeComponents),
7778

7879
Ignored(FetchedCart::cartId),
7980
Ignored(FetchedCart::email),
@@ -206,6 +207,7 @@ val nonUpdatablePropertyRules: List<NonUpdatablePropertyRule<*, *>> = listOf(
206207
ReadOnly(FetchedOrder.OrderItem::priceWithoutTax),
207208
ReadOnly(FetchedOrder.OrderItem::files),
208209
ReadOnly(FetchedOrder.OrderItem::attributes),
210+
ReadOnly(FetchedOrder.OrderItem::compositeComponents),
209211
Ignored(FetchedOrder.OrderItem::imageUrl),
210212
Ignored(FetchedOrder.OrderItem::smallThumbnailUrl),
211213
Ignored(FetchedOrder.OrderItem::hdThumbnailUrl),

src/test/kotlin/com/ecwid/apiclient/v3/rule/NullablePropertyRules.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,7 @@ val nullablePropertyRules: List<NullablePropertyRule<*, *>> = listOf(
206206
fetchedCustomersConfigNullablePropertyRules,
207207
brandsSearchRequestNullablePropertyRules,
208208
fetchedBrandNullablePropertyRules,
209+
fetchedProductComponentNullablePropertyRules,
209210
).flatten()
210211

211212
sealed class NullablePropertyRule<T, R>(

src/test/kotlin/com/ecwid/apiclient/v3/rule/nullablepropertyrules/FetchedOrderRules.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ val fetchedOrderNullablePropertyRules: List<NullablePropertyRule<*, *>> = listOf
100100
AllowNullable(FetchedOrder.OrderItem::isPreorder),
101101
AllowNullable(FetchedOrder.OrderItem::attributes),
102102
AllowNullable(FetchedOrder.OrderItem::taxClassCode),
103+
AllowNullable(FetchedOrder.OrderItem::compositeComponents),
103104
IgnoreNullable(FetchedOrder.OrderItemDiscounts::discountInfo),
104105
IgnoreNullable(FetchedOrder.OrderItemDiscounts::total),
105106
AllowNullable(FetchedOrder.OrderItemOptionFile::id),
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package com.ecwid.apiclient.v3.rule.nullablepropertyrules
2+
3+
import com.ecwid.apiclient.v3.dto.productcomponent.result.FetchedProductComponent
4+
import com.ecwid.apiclient.v3.rule.NullablePropertyRule
5+
import com.ecwid.apiclient.v3.rule.NullablePropertyRule.AllowNullable
6+
7+
val fetchedProductComponentNullablePropertyRules: List<NullablePropertyRule<*, *>> = listOf(
8+
AllowNullable(FetchedProductComponent::combinationId),
9+
)

src/test/kotlin/com/ecwid/apiclient/v3/rule/nullablepropertyrules/FetchedProductRules.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,4 +172,5 @@ val fetchedProductNullablePropertyRules: List<NullablePropertyRule<*, *>> = list
172172
AllowNullable(FetchedProduct::minPurchaseQuantity),
173173
AllowNullable(FetchedProduct::maxPurchaseQuantity),
174174
AllowNullable(FetchedProduct::locationInventory),
175+
AllowNullable(FetchedProduct::compositeComponents),
175176
)

0 commit comments

Comments
 (0)